Browse Source

* merged r23005

git-svn-id: branches/fixes_2_6@25884 -
marco 11 years ago
parent
commit
0cee37b059
100 changed files with 1718 additions and 314 deletions
  1. 13 0
      .gitattributes
  2. 16 11
      packages/Makefile
  3. 16 10
      packages/Makefile.fpc
  4. 253 12
      packages/graph/Makefile
  5. 3 4
      packages/graph/Makefile.fpc
  6. 1 1
      packages/graph/src/ptcgraph/ptccrt.pp
  7. 1 1
      packages/graph/src/ptcgraph/ptcgraph.pp
  8. 51 1
      packages/ptc/Makefile
  9. 2 2
      packages/ptc/Makefile.fpc
  10. 10 0
      packages/ptc/docs/CHANGES.txt
  11. 4 3
      packages/ptc/docs/README.txt
  12. 0 1
      packages/ptc/docs/TODO.txt
  13. 7 3
      packages/ptc/examples/Makefile.fpc
  14. 70 0
      packages/ptc/examples/keyboard3.pp
  15. 81 0
      packages/ptc/examples/ptcgl.pp
  16. 78 0
      packages/ptc/examples/ptcgl2.pp
  17. 1 1
      packages/ptc/src/core/aread.inc
  18. 2 2
      packages/ptc/src/core/areai.inc
  19. 12 1
      packages/ptc/src/core/baseconsoled.inc
  20. 55 1
      packages/ptc/src/core/baseconsolei.inc
  21. 1 1
      packages/ptc/src/core/basesurfaced.inc
  22. 1 1
      packages/ptc/src/core/basesurfacei.inc
  23. 1 1
      packages/ptc/src/core/cleard.inc
  24. 1 1
      packages/ptc/src/core/cleari.inc
  25. 1 1
      packages/ptc/src/core/clipperd.inc
  26. 1 1
      packages/ptc/src/core/clipperi.inc
  27. 1 1
      packages/ptc/src/core/colord.inc
  28. 2 2
      packages/ptc/src/core/colori.inc
  29. 1 1
      packages/ptc/src/core/consoled.inc
  30. 95 44
      packages/ptc/src/core/consolei.inc
  31. 1 1
      packages/ptc/src/core/copyd.inc
  32. 1 1
      packages/ptc/src/core/copyi.inc
  33. 1 0
      packages/ptc/src/core/coreimplementation.inc
  34. 1 0
      packages/ptc/src/core/coreinterface.inc
  35. 2 2
      packages/ptc/src/core/errord.inc
  36. 17 3
      packages/ptc/src/core/errori.inc
  37. 1 1
      packages/ptc/src/core/eventd.inc
  38. 1 1
      packages/ptc/src/core/eventi.inc
  39. 1 1
      packages/ptc/src/core/formatd.inc
  40. 2 2
      packages/ptc/src/core/formati.inc
  41. 2 1
      packages/ptc/src/core/keyeventd.inc
  42. 1 1
      packages/ptc/src/core/keyeventi.inc
  43. 1 1
      packages/ptc/src/core/log.inc
  44. 1 1
      packages/ptc/src/core/moded.inc
  45. 2 2
      packages/ptc/src/core/modei.inc
  46. 1 1
      packages/ptc/src/core/mouseeventd.inc
  47. 1 1
      packages/ptc/src/core/mouseeventi.inc
  48. 62 0
      packages/ptc/src/core/openglattributesd.inc
  49. 149 0
      packages/ptc/src/core/openglattributesi.inc
  50. 1 1
      packages/ptc/src/core/paletted.inc
  51. 1 1
      packages/ptc/src/core/palettei.inc
  52. 1 1
      packages/ptc/src/core/surfaced.inc
  53. 1 1
      packages/ptc/src/core/surfacei.inc
  54. 1 1
      packages/ptc/src/core/timerd.inc
  55. 1 1
      packages/ptc/src/core/timeri.inc
  56. 1 1
      packages/ptc/src/dos/base/moused.inc
  57. 1 1
      packages/ptc/src/dos/base/mousei.inc
  58. 2 2
      packages/ptc/src/dos/cga/cgaconsoled.inc
  59. 1 1
      packages/ptc/src/dos/cga/cgaconsolei.inc
  60. 2 2
      packages/ptc/src/dos/textfx2/textfx2consoled.inc
  61. 1 1
      packages/ptc/src/dos/textfx2/textfx2consolei.inc
  62. 2 2
      packages/ptc/src/dos/vesa/vesaconsoled.inc
  63. 1 1
      packages/ptc/src/dos/vesa/vesaconsolei.inc
  64. 2 2
      packages/ptc/src/dos/vga/vgaconsoled.inc
  65. 1 1
      packages/ptc/src/dos/vga/vgaconsolei.inc
  66. 13 4
      packages/ptc/src/ptc.pp
  67. 1 1
      packages/ptc/src/ptcwrapper/ptceventqueue.pp
  68. 1 3
      packages/ptc/src/ptcwrapper/ptcwrapper.pp
  69. 1 1
      packages/ptc/src/win32/base/cursor.inc
  70. 1 1
      packages/ptc/src/win32/base/cursord.inc
  71. 1 1
      packages/ptc/src/win32/base/event.inc
  72. 1 1
      packages/ptc/src/win32/base/eventd.inc
  73. 2 2
      packages/ptc/src/win32/base/hook.inc
  74. 1 1
      packages/ptc/src/win32/base/hookd.inc
  75. 14 1
      packages/ptc/src/win32/base/kbd.inc
  76. 1 1
      packages/ptc/src/win32/base/kbdd.inc
  77. 1 1
      packages/ptc/src/win32/base/monitor.inc
  78. 1 1
      packages/ptc/src/win32/base/monitord.inc
  79. 1 1
      packages/ptc/src/win32/base/moused.inc
  80. 1 1
      packages/ptc/src/win32/base/mousei.inc
  81. 106 84
      packages/ptc/src/win32/base/window.inc
  82. 6 8
      packages/ptc/src/win32/base/windowd.inc
  83. 1 1
      packages/ptc/src/win32/directx/check.inc
  84. 2 2
      packages/ptc/src/win32/directx/directxconsoled.inc
  85. 5 12
      packages/ptc/src/win32/directx/directxconsolei.inc
  86. 1 1
      packages/ptc/src/win32/directx/display.inc
  87. 1 1
      packages/ptc/src/win32/directx/displayd.inc
  88. 17 1
      packages/ptc/src/win32/directx/hook.inc
  89. 1 1
      packages/ptc/src/win32/directx/hookd.inc
  90. 1 1
      packages/ptc/src/win32/directx/library.inc
  91. 1 1
      packages/ptc/src/win32/directx/libraryd.inc
  92. 10 5
      packages/ptc/src/win32/directx/primary.inc
  93. 2 1
      packages/ptc/src/win32/directx/primaryd.inc
  94. 1 1
      packages/ptc/src/win32/directx/translate.inc
  95. 17 3
      packages/ptc/src/win32/gdi/gdiconsoled.inc
  96. 185 20
      packages/ptc/src/win32/gdi/gdiconsolei.inc
  97. 55 0
      packages/ptc/src/win32/gdi/gdihookd.inc
  98. 214 0
      packages/ptc/src/win32/gdi/gdihooki.inc
  99. 1 1
      packages/ptc/src/win32/gdi/win32dibd.inc
  100. 1 1
      packages/ptc/src/win32/gdi/win32dibi.inc

+ 13 - 0
.gitattributes

@@ -5806,6 +5806,7 @@ packages/ptc/examples/image.pp svneol=native#text/plain
 packages/ptc/examples/image.tga -text
 packages/ptc/examples/image.tga -text
 packages/ptc/examples/keyboard.pp svneol=native#text/plain
 packages/ptc/examples/keyboard.pp svneol=native#text/plain
 packages/ptc/examples/keyboard2.pp svneol=native#text/plain
 packages/ptc/examples/keyboard2.pp svneol=native#text/plain
+packages/ptc/examples/keyboard3.pp svneol=native#text/plain
 packages/ptc/examples/land.pp svneol=native#text/plain
 packages/ptc/examples/land.pp svneol=native#text/plain
 packages/ptc/examples/lights.pp svneol=native#text/plain
 packages/ptc/examples/lights.pp svneol=native#text/plain
 packages/ptc/examples/modes.pp svneol=native#text/plain
 packages/ptc/examples/modes.pp svneol=native#text/plain
@@ -5814,6 +5815,8 @@ packages/ptc/examples/mojo.raw -text svneol=unset#raw/binary
 packages/ptc/examples/mouse.pp svneol=native#text/plain
 packages/ptc/examples/mouse.pp svneol=native#text/plain
 packages/ptc/examples/palette.pp svneol=native#text/plain
 packages/ptc/examples/palette.pp svneol=native#text/plain
 packages/ptc/examples/pixel.pp svneol=native#text/plain
 packages/ptc/examples/pixel.pp svneol=native#text/plain
+packages/ptc/examples/ptcgl.pp svneol=native#text/plain
+packages/ptc/examples/ptcgl2.pp svneol=native#text/plain
 packages/ptc/examples/random.pp svneol=native#text/plain
 packages/ptc/examples/random.pp svneol=native#text/plain
 packages/ptc/examples/save.pp svneol=native#text/plain
 packages/ptc/examples/save.pp svneol=native#text/plain
 packages/ptc/examples/stretch.pp svneol=native#text/plain
 packages/ptc/examples/stretch.pp svneol=native#text/plain
@@ -5884,6 +5887,8 @@ packages/ptc/src/core/moded.inc svneol=native#text/plain
 packages/ptc/src/core/modei.inc svneol=native#text/plain
 packages/ptc/src/core/modei.inc svneol=native#text/plain
 packages/ptc/src/core/mouseeventd.inc svneol=native#text/plain
 packages/ptc/src/core/mouseeventd.inc svneol=native#text/plain
 packages/ptc/src/core/mouseeventi.inc svneol=native#text/plain
 packages/ptc/src/core/mouseeventi.inc svneol=native#text/plain
+packages/ptc/src/core/openglattributesd.inc svneol=native#text/plain
+packages/ptc/src/core/openglattributesi.inc svneol=native#text/plain
 packages/ptc/src/core/paletted.inc svneol=native#text/plain
 packages/ptc/src/core/paletted.inc svneol=native#text/plain
 packages/ptc/src/core/palettei.inc svneol=native#text/plain
 packages/ptc/src/core/palettei.inc svneol=native#text/plain
 packages/ptc/src/core/surfaced.inc svneol=native#text/plain
 packages/ptc/src/core/surfaced.inc svneol=native#text/plain
@@ -5948,8 +5953,14 @@ packages/ptc/src/win32/directx/primaryd.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/translate.inc svneol=native#text/plain
 packages/ptc/src/win32/directx/translate.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/gdiconsoled.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/gdiconsoled.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/gdiconsolei.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/gdiconsolei.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/gdihookd.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/gdihooki.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/win32dibd.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/win32dibd.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/win32dibi.inc svneol=native#text/plain
 packages/ptc/src/win32/gdi/win32dibi.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/win32modesetterd.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/win32modesetteri.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/win32openglwindowd.inc svneol=native#text/plain
+packages/ptc/src/win32/gdi/win32openglwindowi.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincekeyboardd.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincekeyboardd.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincekeyboardi.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincekeyboardi.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincemoused.inc svneol=native#text/plain
 packages/ptc/src/wince/base/wincemoused.inc svneol=native#text/plain
@@ -5967,6 +5978,8 @@ packages/ptc/src/wince/gdi/wincegdiconsolei.inc svneol=native#text/plain
 packages/ptc/src/wince/includes.inc svneol=native#text/plain
 packages/ptc/src/wince/includes.inc svneol=native#text/plain
 packages/ptc/src/x11/check.inc svneol=native#text/plain
 packages/ptc/src/x11/check.inc svneol=native#text/plain
 packages/ptc/src/x11/extensions.inc svneol=native#text/plain
 packages/ptc/src/x11/extensions.inc svneol=native#text/plain
+packages/ptc/src/x11/glxfbconfigd.inc svneol=native#text/plain
+packages/ptc/src/x11/glxfbconfigi.inc svneol=native#text/plain
 packages/ptc/src/x11/includes.inc svneol=native#text/plain
 packages/ptc/src/x11/includes.inc svneol=native#text/plain
 packages/ptc/src/x11/x11consoled.inc svneol=native#text/plain
 packages/ptc/src/x11/x11consoled.inc svneol=native#text/plain
 packages/ptc/src/x11/x11consolei.inc svneol=native#text/plain
 packages/ptc/src/x11/x11consolei.inc svneol=native#text/plain

+ 16 - 11
packages/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/05/23]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/10/30]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -9977,11 +9977,16 @@ graph_debug: sdl_debug
 graph_release: sdl_release
 graph_release: sdl_release
 endif
 endif
 ifneq ($(findstring $(OS_TARGET),linux win32 win64),)
 ifneq ($(findstring $(OS_TARGET),linux win32 win64),)
-graph_all: ptc_all
-graph_shared: ptc_shared
-graph_smart: ptc_smart
-graph_debug: ptc_debug
-graph_release: ptc_release
+graph_all: ptc_all opengl_all
+graph_shared: ptc_shared opengl_shared
+graph_smart: ptc_smart opengl_smart
+graph_debug: ptc_debug opengl_debug
+graph_release: ptc_release opengl_release
+ptc_all: opengl_all
+ptc_shared: opengl_shared
+ptc_smart: opengl_smart
+ptc_debug: opengl_debug
+ptc_release: opengl_release
 endif
 endif
 ifneq ($(findstring $(OS_TARGET),linux darwin iphonesim freebsd openbsd netbsd solaris),)
 ifneq ($(findstring $(OS_TARGET),linux darwin iphonesim freebsd openbsd netbsd solaris),)
 gtk1_all: x11_all opengl_all
 gtk1_all: x11_all opengl_all
@@ -10039,11 +10044,11 @@ opengl_shared: x11_shared
 opengl_smart: x11_smart
 opengl_smart: x11_smart
 opengl_debug: x11_debug
 opengl_debug: x11_debug
 opengl_release: x11_release
 opengl_release: x11_release
-ptc_all: x11_all
-ptc_shared: x11_shared
-ptc_smart: x11_smart
-ptc_debug: x11_debug
-ptc_release: x11_release
+ptc_all: x11_all opengl_all
+ptc_shared: x11_shared opengl_shared
+ptc_smart: x11_smart opengl_smart
+ptc_debug: x11_debug opengl_debug
+ptc_release: x11_release opengl_release
 endif
 endif
 tcl_all: fcl-base_all
 tcl_all: fcl-base_all
 tcl_shared: fcl-base_shared
 tcl_shared: fcl-base_shared

+ 16 - 10
packages/Makefile.fpc

@@ -279,11 +279,17 @@ graph_release: sdl_release
 endif
 endif
 
 
 ifneq ($(findstring $(OS_TARGET),linux win32 win64),)
 ifneq ($(findstring $(OS_TARGET),linux win32 win64),)
-graph_all: ptc_all
-graph_shared: ptc_shared
-graph_smart: ptc_smart
-graph_debug: ptc_debug
-graph_release: ptc_release
+graph_all: ptc_all opengl_all
+graph_shared: ptc_shared opengl_shared
+graph_smart: ptc_smart opengl_smart
+graph_debug: ptc_debug opengl_debug
+graph_release: ptc_release opengl_release
+
+ptc_all: opengl_all
+ptc_shared: opengl_shared
+ptc_smart: opengl_smart
+ptc_debug: opengl_debug
+ptc_release: opengl_release
 endif
 endif
 
 
 ifneq ($(findstring $(OS_TARGET),linux darwin iphonesim freebsd openbsd netbsd solaris),)
 ifneq ($(findstring $(OS_TARGET),linux darwin iphonesim freebsd openbsd netbsd solaris),)
@@ -351,11 +357,11 @@ opengl_smart: x11_smart
 opengl_debug: x11_debug
 opengl_debug: x11_debug
 opengl_release: x11_release
 opengl_release: x11_release
 
 
-ptc_all: x11_all
-ptc_shared: x11_shared
-ptc_smart: x11_smart
-ptc_debug: x11_debug
-ptc_release: x11_release
+ptc_all: x11_all opengl_all
+ptc_shared: x11_shared opengl_shared
+ptc_smart: x11_smart opengl_smart
+ptc_debug: x11_debug opengl_debug
+ptc_release: x11_release opengl_release
 endif
 endif
 
 
 tcl_all: fcl-base_all
 tcl_all: fcl-base_all

+ 253 - 12
packages/graph/Makefile

@@ -1,11 +1,11 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/01/27]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013-06-17 rev 24913]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android i8086-msdos
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
-UNIXs = linux $(BSDs) solaris qnx haiku
-LIMIT83fs = go32v2 os2 emx watcom
+UNIXs = linux $(BSDs) solaris qnx haiku aix
+LIMIT83fs = go32v2 os2 emx watcom msdos
 OSNeedsComspecToRunBatch = go32v2 watcom
 OSNeedsComspecToRunBatch = go32v2 watcom
 FORCE:
 FORCE:
 .PHONY: FORCE
 .PHONY: FORCE
@@ -178,6 +178,12 @@ else
 ARCH=$(CPU_TARGET)
 ARCH=$(CPU_TARGET)
 endif
 endif
 endif
 endif
+ifeq ($(FULL_TARGET),arm-embedded)
+ifeq ($(SUBARCH),)
+$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined)
+endif
+override FPCOPT+=-Cp$(SUBARCH)
+endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 TARGETSUFFIX=$(OS_TARGET)
 TARGETSUFFIX=$(OS_TARGET)
 SOURCESUFFIX=$(OS_SOURCE)
 SOURCESUFFIX=$(OS_SOURCE)
@@ -203,6 +209,14 @@ endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 linuxHier=1
 linuxHier=1
 endif
 endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
 ifdef FPCDIR
 ifdef FPCDIR
 override FPCDIR:=$(subst \,/,$(FPCDIR))
 override FPCDIR:=$(subst \,/,$(FPCDIR))
@@ -251,8 +265,27 @@ endif
 ifndef BINUTILSPREFIX
 ifndef BINUTILSPREFIX
 ifndef CROSSBINDIR
 ifndef CROSSBINDIR
 ifdef CROSSCOMPILE
 ifdef CROSSCOMPILE
+ifneq ($(OS_TARGET),msdos)
 ifndef DARWIN2DARWIN
 ifndef DARWIN2DARWIN
+ifneq ($(CPU_TARGET),jvm)
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
 BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+ifeq ($(OS_TARGET),android)
+ifeq ($(CPU_TARGET),arm)
+BINUTILSPREFIX=arm-linux-androideabi-
+else
+ifeq ($(CPU_TARGET),i386)
+BINUTILSPREFIX=i686-linux-android-
+else
+ifeq ($(CPU_TARGET),mips)
+BINUTILSPREFIX=mipsel-linux-android-
+endif
+endif
+endif
+endif
+endif
+endif
+else
+BINUTILSPREFIX=$(OS_TARGET)-
 endif
 endif
 endif
 endif
 endif
 endif
@@ -364,6 +397,9 @@ endif
 ifeq ($(FULL_TARGET),armeb-linux)
 ifeq ($(FULL_TARGET),armeb-linux)
 override TARGET_UNITS+=$(GRAPH_UNIT) $(GGIGRAPH_UNIT) ptcgraph ptccrt
 override TARGET_UNITS+=$(GRAPH_UNIT) $(GGIGRAPH_UNIT) ptcgraph ptccrt
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_UNITS+=$(GRAPH_UNIT) $(GGIGRAPH_UNIT) ptcgraph ptccrt
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override TARGET_UNITS+=$(GRAPH_UNIT) $(GGIGRAPH_UNIT) ptcgraph ptccrt
 override TARGET_UNITS+=$(GRAPH_UNIT) $(GGIGRAPH_UNIT) ptcgraph ptccrt
 endif
 endif
@@ -433,6 +469,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
@@ -481,6 +520,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
@@ -541,6 +583,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
@@ -550,6 +595,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
@@ -559,9 +607,21 @@ endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
 endif
 endif
+ifeq ($(FULL_TARGET),jvm-java)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override CLEAN_UNITS+=$(GGIGRAPH_UNIT) $(GRAPH_UNIT)
+endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCPACKAGE=y
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
@@ -629,6 +689,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
@@ -677,6 +740,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
@@ -737,6 +803,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
@@ -746,6 +815,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
@@ -755,9 +827,21 @@ endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override COMPILER_OPTIONS+=-S2
 override COMPILER_OPTIONS+=-S2
 endif
 endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_OPTIONS+=-S2
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_OPTIONS+=-S2
+endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 endif
 endif
@@ -824,6 +908,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 endif
 endif
@@ -872,6 +959,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 endif
 endif
@@ -932,6 +1022,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 endif
 endif
@@ -941,6 +1034,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
@@ -950,9 +1046,21 @@ endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc  src/unix
 endif
 endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_INCLUDEDIR+=src/$(OS_TARGET) src/inc
+endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
@@ -1019,6 +1127,9 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
@@ -1067,6 +1178,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
@@ -1127,6 +1241,9 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
@@ -1136,6 +1253,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
@@ -1145,9 +1265,21 @@ endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
 endif
 endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_SOURCEDIR+=src/$(OS_TARGET) src/inc src/ptcgraph tests examples
+endif
 override SHARED_BUILD=n
 override SHARED_BUILD=n
 override SHARED_BUILD=n
 override SHARED_BUILD=n
 ifdef REQUIRE_UNITSDIR
 ifdef REQUIRE_UNITSDIR
@@ -1409,6 +1541,14 @@ SHAREDLIBEXT=.dll
 SHORTSUFFIX=wat
 SHORTSUFFIX=wat
 IMPORTLIBPREFIX=
 IMPORTLIBPREFIX=
 endif
 endif
+ifneq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+endif
 ifeq ($(OS_TARGET),linux)
 ifeq ($(OS_TARGET),linux)
 BATCHEXT=.sh
 BATCHEXT=.sh
 EXEEXT=
 EXEEXT=
@@ -1533,6 +1673,30 @@ EXEEXT=.dol
 SHAREDLIBEXT=.so
 SHAREDLIBEXT=.so
 SHORTSUFFIX=wii
 SHORTSUFFIX=wii
 endif
 endif
+ifeq ($(OS_TARGET),aix)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=aix
+endif
+ifeq ($(OS_TARGET),java)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=java
+endif
+ifeq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=android
+endif
+endif
+ifeq ($(OS_TARGET),msdos)
+STATICLIBPREFIX=
+STATICLIBEXT=.lib
+SHORTSUFFIX=d16
+endif
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 FPCMADE=fpcmade.$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
 ZIPSUFFIX=$(SHORTSUFFIX)
@@ -1754,7 +1918,11 @@ AS=$(ASPROG)
 LD=$(LDPROG)
 LD=$(LDPROG)
 RC=$(RCPROG)
 RC=$(RCPROG)
 AR=$(ARPROG)
 AR=$(ARPROG)
+ifdef inUnix
+PPAS=./ppas$(SRCBATCHEXT)
+else
 PPAS=ppas$(SRCBATCHEXT)
 PPAS=ppas$(SRCBATCHEXT)
+endif
 ifdef inUnix
 ifdef inUnix
 LDCONFIG=ldconfig
 LDCONFIG=ldconfig
 else
 else
@@ -1780,6 +1948,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_SDL=1
 REQUIRE_PACKAGES_SDL=1
@@ -1789,12 +1958,13 @@ REQUIRE_PACKAGES_RTL=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
-REQUIRE_PACKAGES_HERMES=1
-REQUIRE_PACKAGES_FCL-BASE=1
-REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_SDL=1
 REQUIRE_PACKAGES_SDL=1
+REQUIRE_PACKAGES_HERMES=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_PTC=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1859,11 +2029,15 @@ endif
 ifeq ($(FULL_TARGET),i386-iphonesim)
 ifeq ($(FULL_TARGET),i386-iphonesim)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),i386-android)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
@@ -1892,6 +2066,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_PTHREADS=1
 REQUIRE_PACKAGES_SDL=1
 REQUIRE_PACKAGES_SDL=1
@@ -1920,11 +2095,15 @@ endif
 ifeq ($(FULL_TARGET),powerpc-wii)
 ifeq ($(FULL_TARGET),powerpc-wii)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
@@ -1941,6 +2120,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
@@ -1963,6 +2143,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 ifeq ($(FULL_TARGET),x86_64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1972,6 +2153,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
@@ -1995,11 +2177,15 @@ endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),arm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
@@ -2008,6 +2194,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifeq ($(FULL_TARGET),avr-embedded)
 ifeq ($(FULL_TARGET),avr-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
@@ -2016,18 +2205,37 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 endif
 endif
+ifeq ($(FULL_TARGET),mips-linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_HERMES=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
+REQUIRE_PACKAGES_PTC=1
+endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 ifeq ($(FULL_TARGET),mipsel-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 REQUIRE_PACKAGES_PTC=1
 REQUIRE_PACKAGES_PTC=1
 endif
 endif
+ifeq ($(FULL_TARGET),jvm-java)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+REQUIRE_PACKAGES_RTL=1
+endif
 ifdef REQUIRE_PACKAGES_RTL
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)
 ifneq ($(PACKAGEDIR_RTL),)
@@ -2180,6 +2388,44 @@ ifdef UNITDIR_FPMAKE_X11
 override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_X11)
 override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_X11)
 endif
 endif
 endif
 endif
+ifdef REQUIRE_PACKAGES_OPENGL
+PACKAGEDIR_OPENGL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_OPENGL),)
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)),)
+UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_OPENGL)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_OPENGL) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_OPENGL)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_OPENGL=
+UNITDIR_OPENGL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /opengl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_OPENGL),)
+UNITDIR_OPENGL:=$(firstword $(UNITDIR_OPENGL))
+else
+UNITDIR_OPENGL=
+endif
+endif
+ifdef UNITDIR_OPENGL
+override COMPILER_UNITDIR+=$(UNITDIR_OPENGL)
+endif
+ifdef UNITDIR_FPMAKE_OPENGL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_OPENGL)
+endif
+endif
 ifdef REQUIRE_PACKAGES_PTC
 ifdef REQUIRE_PACKAGES_PTC
 PACKAGEDIR_PTC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ptc/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_PTC:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /ptc/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_PTC),)
 ifneq ($(PACKAGEDIR_PTC),)
@@ -2406,17 +2652,12 @@ endif
 endif
 endif
 ifdef CREATESHARED
 ifdef CREATESHARED
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
-ifeq ($(CPU_TARGET),i386)
-override FPCOPT+=-Aas
 endif
 endif
-endif
-ifeq ($(findstring 2.0.,$(FPC_VERSION)),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
 ifeq ($(CPU_TARGET),x86_64)
 ifeq ($(CPU_TARGET),x86_64)
 override FPCOPT+=-Cg
 override FPCOPT+=-Cg
 endif
 endif
 endif
 endif
-endif
 ifdef LINKSHARED
 ifdef LINKSHARED
 endif
 endif
 ifdef GCCLIBDIR
 ifdef GCCLIBDIR

+ 3 - 4
packages/graph/Makefile.fpc

@@ -8,13 +8,12 @@ version=2.6.3
 
 
 [require]
 [require]
 libc=y
 libc=y
-packages_linux=ptc
-packages_win32=ptc
-packages_win64=ptc
+packages_linux=ptc opengl
+packages_win32=sdl ptc opengl
+packages_win64=ptc opengl
 packages_linux_i386=sdl
 packages_linux_i386=sdl
 packages_linux_powerpc=sdl
 packages_linux_powerpc=sdl
 packages_freebsd_i386=sdl
 packages_freebsd_i386=sdl
-packages_win32=sdl
 packages_darwin_powerpc=sdl
 packages_darwin_powerpc=sdl
 packages_darwin_i386=sdl
 packages_darwin_i386=sdl
 
 

+ 1 - 1
packages/graph/src/ptcgraph/ptccrt.pp

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
-    Copyright (c) 2010 by Nikolay Nikolov ([email protected])
+    Copyright (c) 2010, 2011 by Nikolay Nikolov ([email protected])
 
 
     This file implements keyboard input support for ptcgraph
     This file implements keyboard input support for ptcgraph
 
 

+ 1 - 1
packages/graph/src/ptcgraph/ptcgraph.pp

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
-    Copyright (c) 2010 by Nikolay Nikolov ([email protected])
+    Copyright (c) 2010, 2011 by Nikolay Nikolov ([email protected])
     Copyright (c) 2007 by Daniel Mantione
     Copyright (c) 2007 by Daniel Mantione
       member of the Free Pascal development team
       member of the Free Pascal development team
 
 

+ 51 - 1
packages/ptc/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/01/27]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013/10/30]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -1519,6 +1519,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1540,6 +1541,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1633,12 +1635,14 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1675,6 +1679,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1717,6 +1722,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1738,12 +1744,14 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-netbsd)
 ifeq ($(FULL_TARGET),x86_64-netbsd)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1781,6 +1789,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1823,6 +1832,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1845,6 +1855,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
 ifeq ($(FULL_TARGET),armeb-embedded)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_RTL=1
@@ -1856,6 +1867,7 @@ REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_HERMES=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_X11=1
 REQUIRE_PACKAGES_X11=1
+REQUIRE_PACKAGES_OPENGL=1
 endif
 endif
 ifdef REQUIRE_PACKAGES_RTL
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2009,6 +2021,44 @@ ifdef UNITDIR_FPMAKE_X11
 override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_X11)
 override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_X11)
 endif
 endif
 endif
 endif
+ifdef REQUIRE_PACKAGES_OPENGL
+PACKAGEDIR_OPENGL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /opengl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_OPENGL),)
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)),)
+UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_OPENGL=$(PACKAGEDIR_OPENGL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_OPENGL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_OPENGL=$(PACKAGEDIR_OPENGL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_OPENGL)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_OPENGL) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_OPENGL)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_OPENGL=
+UNITDIR_OPENGL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /opengl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_OPENGL),)
+UNITDIR_OPENGL:=$(firstword $(UNITDIR_OPENGL))
+else
+UNITDIR_OPENGL=
+endif
+endif
+ifdef UNITDIR_OPENGL
+override COMPILER_UNITDIR+=$(UNITDIR_OPENGL)
+endif
+ifdef UNITDIR_FPMAKE_OPENGL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_OPENGL)
+endif
+endif
 ifdef REQUIRE_PACKAGES_UNIVINT
 ifdef REQUIRE_PACKAGES_UNIVINT
 PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
 PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_UNIVINT),)
 ifneq ($(PACKAGEDIR_UNIVINT),)

+ 2 - 2
packages/ptc/Makefile.fpc

@@ -24,8 +24,8 @@ sourcedir=src src/ptcwrapper
 
 
 [require]
 [require]
 packages=hermes fcl-base
 packages=hermes fcl-base
-packages_linux=x11
-packages_freebsd=x11
+packages_linux=x11 opengl
+packages_freebsd=x11 opengl
 
 
 [default]
 [default]
 fpcdir=../..
 fpcdir=../..

+ 10 - 0
packages/ptc/docs/CHANGES.txt

@@ -1,3 +1,13 @@
+0.99.13
+ - added support for OpenGL under X11 and Windows. You can now use PTCPas to initialize
+   OpenGL and handle events for you in a multiplatform way (similar to GLUT or SDL). See
+   ptcgl.pp and ptcgl2.pp in the example directory.
+ - X11 keyboard handling improvements:
+   - added support for the numpad keys
+   - typematic repeat (i.e. when you press a key and hold it down) now sends only
+     repeating key press events, instead of repeating pairs of key release + key press.
+     This makes it possible to detect auto-repeat and is also the way that Windows behaves.
+
 0.99.12
 0.99.12
  - pressing Alt or F10 under Windows no longer pauses the application.
  - pressing Alt or F10 under Windows no longer pauses the application.
  - API changes:
  - API changes:

+ 4 - 3
packages/ptc/docs/README.txt

@@ -1,4 +1,4 @@
-PTCPas 0.99.12
+PTCPas 0.99.13
 Nikolay Nikolov ([email protected])
 Nikolay Nikolov ([email protected])
 
 
 PTCPas is a free, portable framebuffer library, written in Free Pascal. It is
 PTCPas is a free, portable framebuffer library, written in Free Pascal. It is
@@ -10,8 +10,9 @@ The latest version can be found at http://ptcpas.sourceforge.net
 Basically it provides an abstraction layer for high-speed low-level graphics
 Basically it provides an abstraction layer for high-speed low-level graphics
 access. It is OOP and supports multiple platforms. (tested on Linux, DOS and
 access. It is OOP and supports multiple platforms. (tested on Linux, DOS and
 Windows, more will be added in the future)
 Windows, more will be added in the future)
-3d acceleration isn't supported, nor planned. If you need that, you should use
-something like OpenGL instead. :-)
+
+Since version 0.99.13 it is also possible to create OpenGL applications with
+PTCPas. See the ptcgl.pp and ptcgl2.pp examples in the 'examples' directory.
 
 
 PTCPas initially started out as a complete Object Pascal translation of the
 PTCPas initially started out as a complete Object Pascal translation of the
 OpenPTC C++ library. Since then, OpenPTC development has stalled and PTCPas
 OpenPTC C++ library. Since then, OpenPTC development has stalled and PTCPas

+ 0 - 1
packages/ptc/docs/TODO.txt

@@ -3,7 +3,6 @@
  - mouse support for the x11 dga console
  - mouse support for the x11 dga console
  - key release events support in dos
  - key release events support in dos
  - multiple video pages support for the x11 w/dga console
  - multiple video pages support for the x11 w/dga console
- - cross-platform opengl initialization support (like sdl or glut)
  - make hermes thread safe
  - make hermes thread safe
  - better timing under dos
  - better timing under dos
  - delphi (kylix? c++?) bindings
  - delphi (kylix? c++?) bindings

+ 7 - 3
packages/ptc/examples/Makefile.fpc

@@ -8,9 +8,13 @@ version=2.6.3
 
 
 [target]
 [target]
 programs=area buffer clear clip con_info console fire  \
 programs=area buffer clear clip con_info console fire  \
-         flower hicolor image keyboard keyboard2 land \
-         lights modes mojo palette pixel random save \
-         stretch texwarp timer tunnel3d tunnel
+         flower hicolor image keyboard keyboard2 keyboard3 \
+         land lights modes mojo palette pixel random save \
+         stretch texwarp timer tunnel3d tunnel keyboard3
+programs_win32=ptcgl ptcgl2
+programs_win64=ptcgl ptcgl2
+programs_linux=ptcgl ptcgl2
+programs_freebsd=ptcgl ptcgl2 
 
 
 [compiler]
 [compiler]
 unitdir=../$(UNITTARGETDIRPREFIX)
 unitdir=../$(UNITTARGETDIRPREFIX)

+ 70 - 0
packages/ptc/examples/keyboard3.pp

@@ -0,0 +1,70 @@
+{
+ Keyboard example for the PTCPas library
+ This source code is in the public domain
+}
+
+program KeyboardExample3;
+
+{$MODE objfpc}
+
+uses
+  ptc;
+
+procedure DumpKey(AKey: IPTCKeyEvent);
+begin
+  Writeln('Code=', AKey.Code:3, ', Unicode=$', HexStr(AKey.Unicode, 4),
+    ', Press=', AKey.Press:5, ', Shift=', AKey.Shift:5, ', Alt=', AKey.Alt:5,
+    ', Control=', AKey.Control:5);
+end;
+
+var
+  console: IPTCConsole;
+  format: IPTCFormat;
+  key: IPTCKeyEvent;
+  Done: Boolean;
+begin
+  try
+    try
+      { create console }
+      console := TPTCConsoleFactory.CreateNew;
+
+      { enable key release events }
+      console.KeyReleaseEnabled := True;
+
+      { create format }
+      format := TPTCFormatFactory.CreateNew(32, $00FF0000, $0000FF00, $000000FF);
+
+      { open the console }
+      console.open('Keyboard example 3', format);
+
+      { main loop }
+      Done := False;
+      repeat
+        { check for key press/release }
+        while console.KeyPressed do
+        begin
+          console.ReadKey(key);
+          case key.code of
+            PTCKEY_ESCAPE:
+              begin
+                Done := True;
+                Break;
+              end;
+            else
+              DumpKey(key);
+          end;
+        end;
+
+        { update console }
+        console.update;
+      until Done;
+    finally
+      if Assigned(console) then
+        console.close;
+    end;
+  except
+    on error: TPTCError do
+      { report error }
+      error.report;
+  end;
+end.

+ 81 - 0
packages/ptc/examples/ptcgl.pp

@@ -0,0 +1,81 @@
+{
+ PTC OpenGL example for PTCPas
+ Copyright (c) Nikolay Nikolov ([email protected])
+ This source code is in the public domain
+}
+
+program PtcGLExample;
+
+{$MODE objfpc}
+
+uses
+  ptc, gl, SysUtils;
+
+var
+  Console: IPTCConsole;
+  Event: IPTCEvent;
+  Done: Boolean = False;
+begin
+  try
+    try
+      { create console }
+      Console := TPTCConsoleFactory.CreateNew;
+
+      { tell PTC we want OpenGL }
+      Console.OpenGL_Enabled := True;
+
+      { enable OpenGL double buffering }
+      Console.OpenGL_Attributes.DoubleBuffer := True;
+
+      { open the console }
+      Console.Open('PTC OpenGL example');
+
+      glClearColor(0.0, 0.0, 0.0, 0.0);
+
+      glMatrixMode(GL_PROJECTION);
+      glLoadIdentity;
+      glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+
+      { loop until the key 'q' is pressed }
+      repeat
+        { draw scene }
+        glClear(GL_COLOR_BUFFER_BIT);
+
+        glBegin(GL_POLYGON);
+          glColor3f(1.0, 0.0, 0.0);
+          glVertex3f(0.25, 0.25, 0.0);
+          glColor3f(1.0, 1.0, 0.0);
+          glVertex3f(0.75, 0.25, 0.0);
+          glColor3f(0.5, 0.0, 1.0);
+          glVertex3f(0.75, 0.75, 0.0);
+          glColor3f(0.0, 1.0, 0.0);
+          glVertex3f(0.25, 0.75, 0.0);
+        glEnd;
+
+        glFlush;
+
+        { swap buffers }
+        Console.OpenGL_SwapBuffers;
+
+        { check for events }
+        if Console.NextEvent(Event, False, PTCAnyEvent) then
+        begin
+          { handle keyboard events }
+          if Supports(event, IPTCKeyEvent) and (event as IPTCKeyEvent).Press then
+          begin
+            case (event as IPTCKeyEvent).Code of
+              PTCKEY_Q: Done := True;
+            end;
+          end;
+        end;
+      until Done;
+    finally
+      if Assigned(Console) then
+        Console.Close;
+    end;
+  except
+    on Error: TPTCError do
+      { report error }
+      Error.Report;
+  end;
+end.

+ 78 - 0
packages/ptc/examples/ptcgl2.pp

@@ -0,0 +1,78 @@
+{
+ PTC OpenGL example for PTCPas
+ Copyright (c) Nikolay Nikolov ([email protected])
+ This source code is in the public domain
+}
+
+program PtcGL2Example;
+
+{$MODE objfpc}
+
+uses
+  ptc, gl, SysUtils;
+
+var
+  Console: IPTCConsole;
+  Event: IPTCEvent;
+  Done: Boolean = False;
+begin
+  try
+    try
+      { create console }
+      Console := TPTCConsoleFactory.CreateNew;
+
+      { tell PTC we want OpenGL }
+      Console.OpenGL_Enabled := True;
+
+      { use OpenGL single buffering }
+      Console.OpenGL_Attributes.DoubleBuffer := False;
+
+      { open the console }
+      Console.Open('PTC OpenGL single buffering example');
+
+      glClearColor(0.0, 0.0, 0.0, 0.0);
+
+      glMatrixMode(GL_PROJECTION);
+      glLoadIdentity;
+      glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
+
+      { loop until the key 'q' is pressed }
+      repeat
+        { draw scene }
+        glClear(GL_COLOR_BUFFER_BIT);
+
+        glBegin(GL_POLYGON);
+          glColor3f(1.0, 0.0, 0.0);
+          glVertex3f(0.25, 0.25, 0.0);
+          glColor3f(1.0, 1.0, 0.0);
+          glVertex3f(0.75, 0.25, 0.0);
+          glColor3f(0.5, 0.0, 1.0);
+          glVertex3f(0.75, 0.75, 0.0);
+          glColor3f(0.0, 1.0, 0.0);
+          glVertex3f(0.25, 0.75, 0.0);
+        glEnd;
+
+        glFlush;
+
+        { check for events }
+        if Console.NextEvent(Event, False, PTCAnyEvent) then
+        begin
+          { handle keyboard events }
+          if Supports(event, IPTCKeyEvent) and (event as IPTCKeyEvent).Press then
+          begin
+            case (event as IPTCKeyEvent).Code of
+              PTCKEY_Q: Done := True;
+            end;
+          end;
+        end;
+      until Done;
+    finally
+      if Assigned(Console) then
+        Console.Close;
+    end;
+  except
+    on Error: TPTCError do
+      { report error }
+      Error.Report;
+  end;
+end.

+ 1 - 1
packages/ptc/src/core/aread.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/core/areai.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -40,7 +40,7 @@ type
     function GetBottom: Integer;
     function GetBottom: Integer;
     function GetWidth: Integer;
     function GetWidth: Integer;
     function GetHeight: Integer;
     function GetHeight: Integer;
-    function Equals(AArea: IPTCArea): Boolean;
+    function Equals(AArea: IPTCArea): Boolean; reintroduce;
   public
   public
     constructor Create;
     constructor Create;
     constructor Create(ALeft, ATop, ARight, ABottom: Integer);
     constructor Create(ALeft, ATop, ARight, ABottom: Integer);

+ 12 - 1
packages/ptc/src/core/baseconsoled.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -37,6 +37,10 @@ type
     function GetTitle: string;
     function GetTitle: string;
     function GetInformation: string;
     function GetInformation: string;
 
 
+    function GetOpenGL_Enabled: Boolean;
+    procedure SetOpenGL_Enabled(AValue: Boolean);
+    function GetOpenGL_Attributes: IPTCOpenGLAttributes;
+
     procedure Configure(const AFileName: string);
     procedure Configure(const AFileName: string);
     function Modes: TPTCModeList;
     function Modes: TPTCModeList;
     procedure Open(const ATitle: string; APages: Integer = 0); overload;
     procedure Open(const ATitle: string; APages: Integer = 0); overload;
@@ -69,5 +73,12 @@ type
     property Name: string read GetName;
     property Name: string read GetName;
     property Title: string read GetTitle;
     property Title: string read GetTitle;
     property Information: string read GetInformation;
     property Information: string read GetInformation;
+
+    { OpenGL support }
+    property OpenGL_Enabled: Boolean read GetOpenGL_Enabled write SetOpenGL_Enabled;
+    property OpenGL_Attributes: IPTCOpenGLAttributes read GetOpenGL_Attributes;
+    procedure OpenGL_SwapBuffers;
+    procedure OpenGL_SetSwapInterval(AInterval: Integer);
+    function OpenGL_GetSwapInterval: Integer;
   end;
   end;
 
 

+ 55 - 1
packages/ptc/src/core/baseconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -48,6 +48,12 @@ type
     function GetName: string; virtual; abstract;
     function GetName: string; virtual; abstract;
     function GetTitle: string; virtual; abstract;
     function GetTitle: string; virtual; abstract;
     function GetInformation: string; virtual; abstract;
     function GetInformation: string; virtual; abstract;
+
+    function GetOpenGL_Enabled: Boolean; virtual; abstract;
+    procedure SetOpenGL_Enabled(AValue: Boolean); virtual; abstract;
+    function GetOpenGL_Attributes: IPTCOpenGLAttributes;
+  protected
+    FOpenGLAttributes: IPTCOpenGLAttributes;
   public
   public
     constructor Create; virtual;
     constructor Create; virtual;
 
 
@@ -120,11 +126,32 @@ type
     property Pitch: Integer read GetPitch;
     property Pitch: Integer read GetPitch;
     property Area: IPTCArea read GetArea;
     property Area: IPTCArea read GetArea;
     property Format: IPTCFormat read GetFormat;
     property Format: IPTCFormat read GetFormat;
+
+    property OpenGL_Enabled: Boolean read GetOpenGL_Enabled write SetOpenGL_Enabled;
+    procedure OpenGL_SwapBuffers; virtual; abstract;
+    procedure OpenGL_SetSwapInterval(AInterval: Integer); virtual; abstract;
+    function OpenGL_GetSwapInterval: Integer; virtual; abstract;
+  end;
+
+  TPTCOpenGLLessConsole = class(TPTCBaseConsole)
+  private
+    function GetOpenGL_Enabled: Boolean; override;
+    procedure SetOpenGL_Enabled(AValue: Boolean); override;
+  public
+    procedure OpenGL_SwapBuffers; override;
+    procedure OpenGL_SetSwapInterval(AInterval: Integer); override;
+    function OpenGL_GetSwapInterval: Integer; override;
   end;
   end;
 
 
 constructor TPTCBaseConsole.Create;
 constructor TPTCBaseConsole.Create;
 begin
 begin
   FReleaseEnabled := False;
   FReleaseEnabled := False;
+  FOpenGLAttributes := TPTCOpenGLAttributes.Create;
+end;
+
+function TPTCBaseConsole.GetOpenGL_Attributes: IPTCOpenGLAttributes;
+begin
+  Result := FOpenGLAttributes;
 end;
 end;
 
 
 function TPTCBaseConsole.KeyPressed: Boolean;
 function TPTCBaseConsole.KeyPressed: Boolean;
@@ -178,3 +205,30 @@ function TPTCBaseConsole.GetKeyReleaseEnabled: Boolean;
 begin
 begin
   Result := FReleaseEnabled;
   Result := FReleaseEnabled;
 end;
 end;
+
+function TPTCOpenGLLessConsole.GetOpenGL_Enabled: Boolean;
+begin
+  Result := False;
+end;
+
+procedure TPTCOpenGLLessConsole.SetOpenGL_Enabled(AValue: Boolean);
+begin
+  if AValue then
+    raise TPTCError.Create('Console does not support OpenGL');
+end;
+
+procedure TPTCOpenGLLessConsole.OpenGL_SwapBuffers;
+begin
+  raise TPTCError.Create('Console does not support OpenGL');
+end;
+
+procedure TPTCOpenGLLessConsole.OpenGL_SetSwapInterval(AInterval: Integer);
+begin
+  raise TPTCError.Create('Console does not support OpenGL');
+end;
+
+function TPTCOpenGLLessConsole.OpenGL_GetSwapInterval: Integer;
+begin
+  Result := -1;
+  raise TPTCError.Create('Console does not support OpenGL');
+end;

+ 1 - 1
packages/ptc/src/core/basesurfaced.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/basesurfacei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/cleard.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/cleari.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/clipperd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/clipperi.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/colord.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/core/colori.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -44,7 +44,7 @@ type
     function GetA: Single;
     function GetA: Single;
     function GetDirect: Boolean;
     function GetDirect: Boolean;
     function GetIndexed: Boolean;
     function GetIndexed: Boolean;
-    function Equals(AColor: IPTCColor): Boolean;
+    function Equals(AColor: IPTCColor): Boolean; reintroduce;
   public
   public
     constructor Create;
     constructor Create;
     constructor Create(AIndex: Integer);
     constructor Create(AIndex: Integer);

+ 1 - 1
packages/ptc/src/core/consoled.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 95 - 44
packages/ptc/src/core/consolei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -37,6 +37,7 @@ type
     FModes: array of IPTCMode;
     FModes: array of IPTCMode;
     FOptionsQueue: array of string;
     FOptionsQueue: array of string;
     FHackyOptionConsoleFlag: Boolean;
     FHackyOptionConsoleFlag: Boolean;
+    FUseOpenGL: Boolean;
 
 
     function ConsoleCreate(AIndex: Integer): IPTCConsole;
     function ConsoleCreate(AIndex: Integer): IPTCConsole;
     function ConsoleCreate(const AName: string): IPTCConsole;
     function ConsoleCreate(const AName: string): IPTCConsole;
@@ -45,6 +46,11 @@ type
     procedure AddOptionToOptionsQueue(const AOption: string);
     procedure AddOptionToOptionsQueue(const AOption: string);
     procedure ExecuteOptionsFromOptionsQueue;
     procedure ExecuteOptionsFromOptionsQueue;
     procedure ClearOptionsQueue;
     procedure ClearOptionsQueue;
+
+    procedure PassOpenGLOptionsToInnerConsole;
+
+    function GetOpenGL_Enabled: Boolean; override;
+    procedure SetOpenGL_Enabled(AValue: Boolean); override;
   public
   public
     constructor Create; override;
     constructor Create; override;
     destructor Destroy; override;
     destructor Destroy; override;
@@ -106,6 +112,9 @@ type
     function GetInformation: string; override;
     function GetInformation: string; override;
     function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean; override;
     function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean; override;
     function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent; override;
     function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent; override;
+    procedure OpenGL_SwapBuffers; override;
+    procedure OpenGL_SetSwapInterval(AInterval: Integer); override;
+    function OpenGL_GetSwapInterval: Integer; override;
   end;
   end;
 
 
 class function TPTCConsoleFactory.CreateNew: IPTCConsole;
 class function TPTCConsoleFactory.CreateNew: IPTCConsole;
@@ -130,36 +139,36 @@ const
     record
     record
       ConsoleClass: class of TPTCBaseConsole;
       ConsoleClass: class of TPTCBaseConsole;
       Names: array [1..2] of string;
       Names: array [1..2] of string;
+      OpenGL: Boolean;
     end =
     end =
   (
   (
   {$IFDEF GO32V2}
   {$IFDEF GO32V2}
-   (ConsoleClass: TVESAConsole;      Names: ('VESA', '')),
-   (ConsoleClass: TVGAConsole;       Names: ('VGA', 'Fakemode')),
-   (ConsoleClass: TCGAConsole;       Names: ('CGA', '')),
-   (ConsoleClass: TTEXTFX2Console;   Names: ('TEXTFX2', 'Text'))
+   (ConsoleClass: TVESAConsole;      Names: ('VESA', '');        OpenGL: False),
+   (ConsoleClass: TVGAConsole;       Names: ('VGA', 'Fakemode'); OpenGL: False),
+   (ConsoleClass: TCGAConsole;       Names: ('CGA', '');         OpenGL: False),
+   (ConsoleClass: TTEXTFX2Console;   Names: ('TEXTFX2', 'Text'); OpenGL: False)
   {$ENDIF GO32V2}
   {$ENDIF GO32V2}
 
 
   {$IF defined(Win32) OR defined(Win64)}
   {$IF defined(Win32) OR defined(Win64)}
-   (ConsoleClass: TDirectXConsole;   Names: ('DirectX', '')),
-   (ConsoleClass: TGDIConsole;       Names: ('GDI', ''))
+   (ConsoleClass: TDirectXConsole;   Names: ('DirectX', '');     OpenGL: False),
+   (ConsoleClass: TGDIConsole;       Names: ('GDI', '');         OpenGL: True)
   {$ENDIF defined(Win32) OR defined(Win64)}
   {$ENDIF defined(Win32) OR defined(Win64)}
 
 
   {$IFDEF WinCE}
   {$IFDEF WinCE}
-   (ConsoleClass: TWinCEGAPIConsole; Names: ('GAPI', '')),
-   (ConsoleClass: TWinCEGDIConsole;  Names: ('GDI', ''))
+   (ConsoleClass: TWinCEGAPIConsole; Names: ('GAPI', '');        OpenGL: False),
+   (ConsoleClass: TWinCEGDIConsole;  Names: ('GDI', '');         OpenGL: False)
   {$ENDIF WinCE}
   {$ENDIF WinCE}
 
 
   {$IFDEF UNIX}
   {$IFDEF UNIX}
-   (ConsoleClass: TX11Console;       Names: ('X11', ''))
+   (ConsoleClass: TX11Console;       Names: ('X11', '');         OpenGL: {$IFDEF ENABLE_X11_EXTENSION_GLX}True{$ELSE}False{$ENDIF})
   {$ENDIF UNIX}
   {$ENDIF UNIX}
   );
   );
 
 
 constructor TPTCConsole.Create;
 constructor TPTCConsole.Create;
+{$IFDEF UNIX}
 var
 var
-  I: Integer;
-  {$IFDEF UNIX}
   s: AnsiString;
   s: AnsiString;
-  {$ENDIF UNIX}
+{$ENDIF UNIX}
 begin
 begin
   inherited Create;
   inherited Create;
   FConsole := nil;
   FConsole := nil;
@@ -190,10 +199,8 @@ begin
 end;
 end;
 
 
 destructor TPTCConsole.Destroy;
 destructor TPTCConsole.Destroy;
-var
-  I: Integer;
 begin
 begin
-  close;
+  Close;
   FConsole := nil;
   FConsole := nil;
   inherited Destroy;
   inherited Destroy;
 end;
 end;
@@ -263,20 +270,17 @@ begin
     if Assigned(FConsole) then
     if Assigned(FConsole) then
     begin
     begin
       FHackyOptionConsoleFlag := True;
       FHackyOptionConsoleFlag := True;
+      PassOpenGLOptionsToInnerConsole;
       ExecuteOptionsFromOptionsQueue;
       ExecuteOptionsFromOptionsQueue;
 {      ClearOptionsQueue;}
 {      ClearOptionsQueue;}
       Result := True;
       Result := True;
     end
     end
     else
     else
     begin
     begin
-      { TODO: check if the option is supported by at least one console... }
-      if {OptionSupported}True then
-      begin
-        AddOptionToOptionsQueue(AOption);
-        Result := True;
-      end
-      else
-        Result := False;
+      { TODO: check if the option is supported by at least one console and return false otherwise... }
+
+      AddOptionToOptionsQueue(AOption);
+      Result := True;
     end;
     end;
   end;
   end;
 end;
 end;
@@ -334,7 +338,7 @@ begin
       exit;
       exit;
     except
     except
       on error: TPTCError do begin
       on error: TPTCError do begin
-        FreeAndNil(FConsole);
+        FConsole := nil;
         if FHackyOptionConsoleFlag then
         if FHackyOptionConsoleFlag then
         begin
         begin
           FHackyOptionConsoleFlag := False;
           FHackyOptionConsoleFlag := False;
@@ -353,6 +357,7 @@ begin
         FConsole := ConsoleCreate(index);
         FConsole := ConsoleCreate(index);
         if FConsole = nil then
         if FConsole = nil then
           break;
           break;
+        PassOpenGLOptionsToInnerConsole;
         ExecuteOptionsFromOptionsQueue;
         ExecuteOptionsFromOptionsQueue;
         FConsole.Open(ATitle, APages);
         FConsole.Open(ATitle, APages);
 {        ClearOptionsQueue;}
 {        ClearOptionsQueue;}
@@ -366,7 +371,7 @@ begin
           finally
           finally
             tmp.Free;
             tmp.Free;
           end;
           end;
-          FreeAndNil(FConsole);
+          FConsole := nil;
           continue;
           continue;
         end;
         end;
       end;
       end;
@@ -376,7 +381,7 @@ begin
   finally
   finally
     composite.Free;
     composite.Free;
     if not success then
     if not success then
-      FreeAndNil(FConsole);
+      FConsole := nil;
   end;
   end;
 end;
 end;
 
 
@@ -394,7 +399,7 @@ begin
       exit;
       exit;
     except
     except
       on error: TPTCError do begin
       on error: TPTCError do begin
-        FreeAndNil(FConsole);
+        FConsole := nil;
         if FHackyOptionConsoleFlag then
         if FHackyOptionConsoleFlag then
         begin
         begin
           FHackyOptionConsoleFlag := False;
           FHackyOptionConsoleFlag := False;
@@ -413,6 +418,7 @@ begin
         FConsole := ConsoleCreate(index);
         FConsole := ConsoleCreate(index);
         if FConsole = nil then
         if FConsole = nil then
           break;
           break;
+        PassOpenGLOptionsToInnerConsole;
         ExecuteOptionsFromOptionsQueue;
         ExecuteOptionsFromOptionsQueue;
         FConsole.open(ATitle, AFormat, APages);
         FConsole.open(ATitle, AFormat, APages);
 {        ClearOptionsQueue;}
 {        ClearOptionsQueue;}
@@ -426,7 +432,7 @@ begin
           finally
           finally
             tmp.Free;
             tmp.Free;
           end;
           end;
-          FreeAndNil(FConsole);
+          FConsole := nil;
           Continue;
           Continue;
         end;
         end;
       end;
       end;
@@ -436,7 +442,7 @@ begin
   finally
   finally
     composite.Free;
     composite.Free;
     if not success then
     if not success then
-      FreeAndNil(FConsole);
+      FConsole := nil;
   end;
   end;
 end;
 end;
 
 
@@ -454,7 +460,7 @@ begin
       exit;
       exit;
     except
     except
       on error: TPTCError do begin
       on error: TPTCError do begin
-        FreeAndNil(FConsole);
+        FConsole := nil;
         if FHackyOptionConsoleFlag then
         if FHackyOptionConsoleFlag then
         begin
         begin
           FHackyOptionConsoleFlag := False;
           FHackyOptionConsoleFlag := False;
@@ -473,6 +479,7 @@ begin
         FConsole := ConsoleCreate(index);
         FConsole := ConsoleCreate(index);
         if FConsole = nil then
         if FConsole = nil then
           Break;
           Break;
+        PassOpenGLOptionsToInnerConsole;
         ExecuteOptionsFromOptionsQueue;
         ExecuteOptionsFromOptionsQueue;
         FConsole.Open(ATitle, AWidth, AHeight, AFormat, APages);
         FConsole.Open(ATitle, AWidth, AHeight, AFormat, APages);
 {        ClearOptionsQueue;}
 {        ClearOptionsQueue;}
@@ -486,7 +493,7 @@ begin
           finally
           finally
             tmp.Free;
             tmp.Free;
           end;
           end;
-          FreeAndNil(FConsole);
+          FConsole := nil;
           Continue;
           Continue;
         end;
         end;
       end;
       end;
@@ -496,7 +503,7 @@ begin
   finally
   finally
     composite.Free;
     composite.Free;
     if not success then
     if not success then
-      FreeAndNil(FConsole);
+      FConsole := nil;
   end;
   end;
 end;
 end;
 
 
@@ -514,7 +521,7 @@ begin
       exit;
       exit;
     except
     except
       on error: TPTCError do begin
       on error: TPTCError do begin
-        FreeAndNil(FConsole);
+        FConsole := nil;
         if FHackyOptionConsoleFlag then
         if FHackyOptionConsoleFlag then
         begin
         begin
           FHackyOptionConsoleFlag := False;
           FHackyOptionConsoleFlag := False;
@@ -533,6 +540,7 @@ begin
         FConsole := ConsoleCreate(index);
         FConsole := ConsoleCreate(index);
         if FConsole = nil then
         if FConsole = nil then
           Break;
           Break;
+        PassOpenGLOptionsToInnerConsole;
         ExecuteOptionsFromOptionsQueue;
         ExecuteOptionsFromOptionsQueue;
         FConsole.Open(ATitle, AMode, APages);
         FConsole.Open(ATitle, AMode, APages);
 {        ClearOptionsQueue;}
 {        ClearOptionsQueue;}
@@ -546,7 +554,7 @@ begin
           finally
           finally
             tmp.Free;
             tmp.Free;
           end;
           end;
-          FreeAndNil(FConsole);
+          FConsole := nil;
           Continue;
           Continue;
         end;
         end;
       end;
       end;
@@ -556,7 +564,7 @@ begin
   finally
   finally
     composite.Free;
     composite.Free;
     if not success then
     if not success then
-      FreeAndNil(FConsole);
+      FConsole := nil;
   end;
   end;
 end;
 end;
 
 
@@ -780,10 +788,19 @@ begin
 end;
 end;
 
 
 function TPTCConsole.ConsoleCreate(AIndex: Integer): IPTCConsole;
 function TPTCConsole.ConsoleCreate(AIndex: Integer): IPTCConsole;
+var
+  ResultObj: TPTCBaseConsole;
 begin
 begin
   Result := nil;
   Result := nil;
   if (AIndex >= Low(ConsoleTypes)) and (AIndex <= High(ConsoleTypes)) then
   if (AIndex >= Low(ConsoleTypes)) and (AIndex <= High(ConsoleTypes)) then
-    Result := ConsoleTypes[AIndex].ConsoleClass.Create;
+  begin
+    if OpenGL_Enabled and not ConsoleTypes[AIndex].OpenGL then
+      raise TPTCError.Create('Console does not support OpenGL');
+
+    ResultObj := ConsoleTypes[AIndex].ConsoleClass.Create;
+    Result := ResultObj;
+    ResultObj.FOpenGLAttributes := FOpenGLAttributes;
+  end;
 
 
   if Result <> nil then
   if Result <> nil then
     Result.KeyReleaseEnabled := KeyReleaseEnabled;
     Result.KeyReleaseEnabled := KeyReleaseEnabled;
@@ -802,13 +819,8 @@ begin
     for J := Low(ConsoleTypes[I].Names) to High(ConsoleTypes[I].Names) do
     for J := Low(ConsoleTypes[I].Names) to High(ConsoleTypes[I].Names) do
       if AName = ConsoleTypes[I].Names[J] then
       if AName = ConsoleTypes[I].Names[J] then
       begin
       begin
-        Result := ConsoleTypes[I].ConsoleClass.Create;
-
-        if Result <> nil then
-        begin
-          Result.KeyReleaseEnabled := KeyReleaseEnabled;
-          exit;
-        end;
+        Result := ConsoleCreate(I);
+        exit;
       end;
       end;
 end;
 end;
 
 
@@ -817,3 +829,42 @@ begin
   if FConsole = nil then
   if FConsole = nil then
     raise TPTCError.Create('console is not open (core)');
     raise TPTCError.Create('console is not open (core)');
 end;
 end;
+
+procedure TPTCConsole.PassOpenGLOptionsToInnerConsole;
+begin
+  FConsole.OpenGL_Enabled := FUseOpenGL;
+end;
+
+function TPTCConsole.GetOpenGL_Enabled: Boolean;
+begin
+  if FConsole <> nil then
+    Result := FConsole.OpenGL_Enabled
+  else
+    Result := FUseOpenGL;
+end;
+
+procedure TPTCConsole.SetOpenGL_Enabled(AValue: Boolean);
+begin
+  if FConsole <> nil then
+    FConsole.OpenGL_Enabled := AValue
+  else
+    FUseOpenGL := AValue;
+end;
+
+procedure TPTCConsole.OpenGL_SwapBuffers;
+begin
+  Check;
+  FConsole.OpenGL_SwapBuffers;
+end;
+
+procedure TPTCConsole.OpenGL_SetSwapInterval(AInterval: Integer);
+begin
+  Check;
+  FConsole.OpenGL_SetSwapInterval(AInterval);
+end;
+
+function TPTCConsole.OpenGL_GetSwapInterval: Integer;
+begin
+  Check;
+  Result := FConsole.OpenGL_GetSwapInterval;
+end;

+ 1 - 1
packages/ptc/src/core/copyd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/copyi.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 0
packages/ptc/src/core/coreimplementation.inc

@@ -11,6 +11,7 @@
 {$INCLUDE copyi.inc}
 {$INCLUDE copyi.inc}
 {$INCLUDE clipperi.inc}
 {$INCLUDE clipperi.inc}
 {$INCLUDE basesurfacei.inc}
 {$INCLUDE basesurfacei.inc}
+{$INCLUDE openglattributesi.inc}
 {$INCLUDE baseconsolei.inc}
 {$INCLUDE baseconsolei.inc}
 {$INCLUDE surfacei.inc}
 {$INCLUDE surfacei.inc}
 {$INCLUDE timeri.inc}
 {$INCLUDE timeri.inc}

+ 1 - 0
packages/ptc/src/core/coreinterface.inc

@@ -11,6 +11,7 @@
 {$INCLUDE clipperd.inc}
 {$INCLUDE clipperd.inc}
 {$INCLUDE basesurfaced.inc}
 {$INCLUDE basesurfaced.inc}
 {$INCLUDE surfaced.inc}
 {$INCLUDE surfaced.inc}
+{$INCLUDE openglattributesd.inc}
 {$INCLUDE baseconsoled.inc}
 {$INCLUDE baseconsoled.inc}
 {$INCLUDE consoled.inc}
 {$INCLUDE consoled.inc}
 {$INCLUDE errord.inc}
 {$INCLUDE errord.inc}

+ 2 - 2
packages/ptc/src/core/errord.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009, 2010, 2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -41,7 +41,7 @@ type
     constructor Create(const AError: TPTCError);
     constructor Create(const AError: TPTCError);
     destructor Destroy; override;
     destructor Destroy; override;
     procedure Assign(const AError: TPTCError);
     procedure Assign(const AError: TPTCError);
-    function Equals(const AError: TPTCError): Boolean;
+    function Equals(Obj: TObject): Boolean; override;
     procedure Report;
     procedure Report;
     property Message: string read FMessage;
     property Message: string read FMessage;
   end;
   end;

+ 17 - 3
packages/ptc/src/core/errori.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009, 2010, 2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -62,9 +62,23 @@ begin
   FMessage := AError.FMessage;
   FMessage := AError.FMessage;
 end;
 end;
 
 
-function TPTCError.Equals(const AError: TPTCError): Boolean;
+function TPTCError.Equals(Obj: TObject): Boolean;
+var
+  OtherError: TPTCError;
 begin
 begin
-  Equals := (FMessage = AError.FMessage);
+  if Obj = nil then
+    exit(False);
+
+  if Obj = Self then
+    exit(True);
+
+  if Obj is TPTCError then
+  begin
+    OtherError := TPTCError(Obj);
+    Equals := (FMessage = OtherError.FMessage);
+  end
+  else
+    Result := False;
 end;
 end;
 
 
 procedure TPTCError.Report;
 procedure TPTCError.Report;

+ 1 - 1
packages/ptc/src/core/eventd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/eventi.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/formatd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/core/formati.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -35,7 +35,7 @@ type
   private
   private
     FFormat: THermesFormat;
     FFormat: THermesFormat;
     function GetHermesFormat: PHermesFormat;
     function GetHermesFormat: PHermesFormat;
-    function Equals(AFormat: IPTCFormat): Boolean;
+    function Equals(AFormat: IPTCFormat): Boolean; reintroduce;
     function GetR: Uint32;
     function GetR: Uint32;
     function GetG: Uint32;
     function GetG: Uint32;
     function GetB: Uint32;
     function GetB: Uint32;

+ 2 - 1
packages/ptc/src/core/keyeventd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -175,5 +175,6 @@ const
   PTCKEY_INSERT       = $9B;
   PTCKEY_INSERT       = $9B;
   PTCKEY_HELP         = $9C;
   PTCKEY_HELP         = $9C;
   PTCKEY_META         = $9D;
   PTCKEY_META         = $9D;
+  PTCKEY_MINUS        = $BD;
   PTCKEY_BACKQUOTE    = $C0;
   PTCKEY_BACKQUOTE    = $C0;
   PTCKEY_QUOTE        = $DE;
   PTCKEY_QUOTE        = $DE;

+ 1 - 1
packages/ptc/src/core/keyeventi.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/log.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/moded.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/core/modei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -46,7 +46,7 @@ type
     constructor Create(AWidth, AHeight: Integer; AFormat: IPTCFormat);
     constructor Create(AWidth, AHeight: Integer; AFormat: IPTCFormat);
     constructor Create(AMode: IPTCMode);
     constructor Create(AMode: IPTCMode);
 {    procedure Assign(const mode: TPTCMode);}
 {    procedure Assign(const mode: TPTCMode);}
-    function Equals(AMode: IPTCMode): Boolean;
+    function Equals(AMode: IPTCMode): Boolean; reintroduce;
 {    property Valid: Boolean read GetValid;
 {    property Valid: Boolean read GetValid;
     property Width: Integer read GetWidth;
     property Width: Integer read GetWidth;
     property Height: Integer read GetHeight;
     property Height: Integer read GetHeight;

+ 1 - 1
packages/ptc/src/core/mouseeventd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/mouseeventi.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 62 - 0
packages/ptc/src/core/openglattributesd.inc

@@ -0,0 +1,62 @@
+{
+    This file is part of the PTCPas framebuffer library
+    Copyright (C) 2012 Nikolay Nikolov ([email protected])
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version
+    with the following modification:
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,and
+    to copy and distribute the resulting executable under terms of your choice,
+    provided that you also meet, for each linked independent module, the terms
+    and conditions of the license of that module. An independent module is a
+    module which is not derived from or based on this library. If you modify
+    this library, you may extend this exception to your version of the library,
+    but you are not obligated to do so. If you do not wish to do so, delete this
+    exception statement from your version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+}
+
+type
+  IPTCOpenGLAttributes = interface
+    function GetDoubleBuffer: Boolean;
+    procedure SetDoubleBuffer(ADoubleBuffer: Boolean);
+
+    function GetDoubleBufferDontCare: Boolean;
+    procedure SetDoubleBufferDontCare(ADoubleBufferDontCare: Boolean);
+
+    function GetStereo: Boolean;
+    procedure SetStereo(AStereo: Boolean);
+
+    function GetStereoDontCare: Boolean;
+    procedure SetStereoDontCare(AStereoDontCare: Boolean);
+
+    function GetBufferSize: Integer;
+    procedure SetBufferSize(ABufferSize: Integer);
+
+    function GetDepthSize: Integer;
+    procedure SetDepthSize(ADepthSize: Integer);
+
+    function GetStencilSize: Integer;
+    procedure SetStencilSize(AStencilSize: Integer);
+
+    property DoubleBuffer: Boolean read GetDoubleBuffer write SetDoubleBuffer;
+    property DoubleBufferDontCare: Boolean read GetDoubleBufferDontCare write SetDoubleBufferDontCare;
+    property Stereo: Boolean read GetStereo write SetStereo;
+    property StereoDontCare: Boolean read GetStereoDontCare write SetStereoDontCare;
+    property BufferSize: Integer read GetBufferSize write SetBufferSize;
+    property DepthSize: Integer read GetDepthSize write SetDepthSize;
+    property StencilSize: Integer read GetStencilSize write SetStencilSize;
+  end;

+ 149 - 0
packages/ptc/src/core/openglattributesi.inc

@@ -0,0 +1,149 @@
+{
+    This file is part of the PTCPas framebuffer library
+    Copyright (C) 2012 Nikolay Nikolov ([email protected])
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version
+    with the following modification:
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,and
+    to copy and distribute the resulting executable under terms of your choice,
+    provided that you also meet, for each linked independent module, the terms
+    and conditions of the license of that module. An independent module is a
+    module which is not derived from or based on this library. If you modify
+    this library, you may extend this exception to your version of the library,
+    but you are not obligated to do so. If you do not wish to do so, delete this
+    exception statement from your version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+}
+
+type
+  TPTCOpenGLAttributes = class(TInterfacedObject, IPTCOpenGLAttributes)
+  private
+    FDoubleBuffer: Boolean;
+    FDoubleBufferDontCare: Boolean;
+    FStereo: Boolean;
+    FStereoDontCare: Boolean;
+    FBufferSize: Integer;
+    FDepthSize: Integer;
+    FStencilSize: Integer;
+
+  public
+    constructor Create;
+
+    function GetDoubleBuffer: Boolean;
+    procedure SetDoubleBuffer(ADoubleBuffer: Boolean);
+
+    function GetDoubleBufferDontCare: Boolean;
+    procedure SetDoubleBufferDontCare(ADoubleBufferDontCare: Boolean);
+
+    function GetStereo: Boolean;
+    procedure SetStereo(AStereo: Boolean);
+
+    function GetStereoDontCare: Boolean;
+    procedure SetStereoDontCare(AStereoDontCare: Boolean);
+
+    function GetBufferSize: Integer;
+    procedure SetBufferSize(ABufferSize: Integer);
+
+    function GetDepthSize: Integer;
+    procedure SetDepthSize(ADepthSize: Integer);
+
+    function GetStencilSize: Integer;
+    procedure SetStencilSize(AStencilSize: Integer);
+  end;
+
+constructor TPTCOpenGLAttributes.Create;
+begin
+  inherited;
+
+  FDoubleBuffer := True;
+  FDoubleBufferDontCare := False;
+  FStereo := False;
+  FStereoDontCare := False;
+  FBufferSize := 0;
+  FDepthSize := 0;
+  FStencilSize := 0;
+end;
+
+function TPTCOpenGLAttributes.GetDoubleBuffer: Boolean;
+begin
+  Result := FDoubleBuffer;
+end;
+
+procedure TPTCOpenGLAttributes.SetDoubleBuffer(ADoubleBuffer: Boolean);
+begin
+  FDoubleBuffer := ADoubleBuffer;
+end;
+
+function TPTCOpenGLAttributes.GetDoubleBufferDontCare: Boolean;
+begin
+  Result := FDoubleBufferDontCare;
+end;
+
+procedure TPTCOpenGLAttributes.SetDoubleBufferDontCare(ADoubleBufferDontCare: Boolean);
+begin
+  FDoubleBufferDontCare := ADoubleBufferDontCare;
+end;
+
+function TPTCOpenGLAttributes.GetStereo: Boolean;
+begin
+  Result := FStereo;
+end;
+
+procedure TPTCOpenGLAttributes.SetStereo(AStereo: Boolean);
+begin
+  FStereo := AStereo;
+end;
+
+function TPTCOpenGLAttributes.GetStereoDontCare: Boolean;
+begin
+  Result := FStereoDontCare;
+end;
+
+procedure TPTCOpenGLAttributes.SetStereoDontCare(AStereoDontCare: Boolean);
+begin
+  FStereoDontCare := AStereoDontCare;
+end;
+
+function TPTCOpenGLAttributes.GetBufferSize: Integer;
+begin
+  Result := FBufferSize;
+end;
+
+procedure TPTCOpenGLAttributes.SetBufferSize(ABufferSize: Integer);
+begin
+  FBufferSize := ABufferSize;
+end;
+
+function TPTCOpenGLAttributes.GetDepthSize: Integer;
+begin
+  Result := FDepthSize;
+end;
+
+procedure TPTCOpenGLAttributes.SetDepthSize(ADepthSize: Integer);
+begin
+  FDepthSize := ADepthSize;
+end;
+
+function TPTCOpenGLAttributes.GetStencilSize: Integer;
+begin
+  Result := FStencilSize;
+end;
+
+procedure TPTCOpenGLAttributes.SetStencilSize(AStencilSize: Integer);
+begin
+  FStencilSize := AStencilSize;
+end;

+ 1 - 1
packages/ptc/src/core/paletted.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/palettei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/surfaced.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/surfacei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/timerd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/core/timeri.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/dos/base/moused.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/dos/base/mousei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/dos/cga/cgaconsoled.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2012 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 }
 }
 
 
 type
 type
-  TCGAConsole = class(TPTCBaseConsole)
+  TCGAConsole = class(TPTCOpenGLLessConsole)
   private
   private
     { data }
     { data }
     m_modes: array of IPTCMode;
     m_modes: array of IPTCMode;

+ 1 - 1
packages/ptc/src/dos/cga/cgaconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

+ 2 - 2
packages/ptc/src/dos/textfx2/textfx2consoled.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2012 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 }
 }
 
 
 type
 type
-  TTextFX2Console = class(TPTCBaseConsole)
+  TTextFX2Console = class(TPTCOpenGLLessConsole)
   private
   private
     { data }
     { data }
     FModes: array of IPTCMode;
     FModes: array of IPTCMode;

+ 1 - 1
packages/ptc/src/dos/textfx2/textfx2consolei.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

+ 2 - 2
packages/ptc/src/dos/vesa/vesaconsoled.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2012 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 }
 }
 
 
 type
 type
-  TVESAConsole = class(TPTCBaseConsole)
+  TVESAConsole = class(TPTCOpenGLLessConsole)
   private
   private
     { data }
     { data }
     FModes: array of IPTCMode;
     FModes: array of IPTCMode;

+ 1 - 1
packages/ptc/src/dos/vesa/vesaconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

+ 2 - 2
packages/ptc/src/dos/vga/vgaconsoled.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2012 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,7 @@
 }
 }
 
 
 type
 type
-  TVGAConsole = class(TPTCBaseConsole)
+  TVGAConsole = class(TPTCOpenGLLessConsole)
   private
   private
     { data }
     { data }
     m_modes: array of IPTCMode;
     m_modes: array of IPTCMode;

+ 1 - 1
packages/ptc/src/dos/vga/vgaconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

+ 13 - 4
packages/ptc/src/ptc.pp

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -60,7 +60,7 @@ uses
 {$ENDIF FPDOC}
 {$ENDIF FPDOC}
 
 
 const
 const
-  PTCPAS_VERSION = 'PTCPas 0.99.12';
+  PTCPAS_VERSION = 'PTCPas 0.99.13';
 
 
 type
 type
   PUint8  = ^Uint8;
   PUint8  = ^Uint8;
@@ -113,7 +113,7 @@ uses
 
 
 {$IF defined(WIN32) OR defined(WIN64)}
 {$IF defined(WIN32) OR defined(WIN64)}
 uses
 uses
-  Windows, p_ddraw;
+  Windows, p_ddraw, glext;
 {$ENDIF defined(WIN32) OR defined(WIN64)}
 {$ENDIF defined(WIN32) OR defined(WIN64)}
 
 
 {$IFDEF WinCE}
 {$IFDEF WinCE}
@@ -123,7 +123,7 @@ uses
 
 
 {$IFDEF UNIX}
 {$IFDEF UNIX}
 uses
 uses
-  BaseUnix, Unix, ctypes, x, xlib, xutil, xatom, keysym
+  BaseUnix, Unix, ctypes, x, xlib, xutil, xatom, keysym, xkblib
   {$IFDEF ENABLE_X11_EXTENSION_XRANDR}
   {$IFDEF ENABLE_X11_EXTENSION_XRANDR}
   , xrandr
   , xrandr
   {$ENDIF ENABLE_X11_EXTENSION_XRANDR}
   {$ENDIF ENABLE_X11_EXTENSION_XRANDR}
@@ -136,6 +136,9 @@ uses
   {$IFDEF ENABLE_X11_EXTENSION_XSHM}
   {$IFDEF ENABLE_X11_EXTENSION_XSHM}
   , xshm, ipc
   , xshm, ipc
   {$ENDIF ENABLE_X11_EXTENSION_XSHM}
   {$ENDIF ENABLE_X11_EXTENSION_XSHM}
+  {$IFDEF ENABLE_X11_EXTENSION_GLX}
+  , glx
+  {$ENDIF ENABLE_X11_EXTENSION_GLX}
   ;
   ;
 {$ENDIF UNIX}
 {$ENDIF UNIX}
 
 
@@ -198,6 +201,9 @@ end;
 {$INCLUDE win32/directx/primaryd.inc}
 {$INCLUDE win32/directx/primaryd.inc}
 {$INCLUDE win32/directx/directxconsoled.inc}
 {$INCLUDE win32/directx/directxconsoled.inc}
 {$INCLUDE win32/gdi/win32dibd.inc}
 {$INCLUDE win32/gdi/win32dibd.inc}
+{$INCLUDE win32/gdi/win32modesetterd.inc}
+{$INCLUDE win32/gdi/win32openglwindowd.inc}
+{$INCLUDE win32/gdi/gdihookd.inc}
 {$INCLUDE win32/gdi/gdiconsoled.inc}
 {$INCLUDE win32/gdi/gdiconsoled.inc}
 
 
 {$INCLUDE win32/base/cursor.inc}
 {$INCLUDE win32/base/cursor.inc}
@@ -215,6 +221,9 @@ end;
 {$INCLUDE win32/directx/primary.inc}
 {$INCLUDE win32/directx/primary.inc}
 {$INCLUDE win32/directx/directxconsolei.inc}
 {$INCLUDE win32/directx/directxconsolei.inc}
 {$INCLUDE win32/gdi/win32dibi.inc}
 {$INCLUDE win32/gdi/win32dibi.inc}
+{$INCLUDE win32/gdi/win32modesetteri.inc}
+{$INCLUDE win32/gdi/win32openglwindowi.inc}
+{$INCLUDE win32/gdi/gdihooki.inc}
 {$INCLUDE win32/gdi/gdiconsolei.inc}
 {$INCLUDE win32/gdi/gdiconsolei.inc}
 {$ENDIF defined(Win32) OR defined(Win64)}
 {$ENDIF defined(Win32) OR defined(Win64)}
 
 

+ 1 - 1
packages/ptc/src/ptcwrapper/ptceventqueue.pp

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2010, 2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 3
packages/ptc/src/ptcwrapper/ptcwrapper.pp

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal PTCPas framebuffer library threaded wrapper
     Free Pascal PTCPas framebuffer library threaded wrapper
-    Copyright (C) 2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2010, 2011, 2012 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -259,8 +259,6 @@ procedure TPTCWrapperThread.Execute;
     end;
     end;
   end;
   end;
 
 
-var
-  I: Integer;
 begin
 begin
   try
   try
     FConsole := TPTCConsoleFactory.CreateNew;
     FConsole := TPTCConsoleFactory.CreateNew;

+ 1 - 1
packages/ptc/src/win32/base/cursor.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/cursord.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/event.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/eventd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/win32/base/hook.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009, 2010, 2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -38,7 +38,7 @@ type
   PWin32Hook_Lookup = ^TWin32Hook_Lookup;
   PWin32Hook_Lookup = ^TWin32Hook_Lookup;
   TWin32Hook_Lookup = record
   TWin32Hook_Lookup = record
     window: HWND;
     window: HWND;
-    wndproc: PtrUInt;
+    wndproc: LONG_PTR;
     hook: array [0..15] of TWin32Hook;
     hook: array [0..15] of TWin32Hook;
     count: Integer;
     count: Integer;
   end;
   end;

+ 1 - 1
packages/ptc/src/win32/base/hookd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 14 - 1
packages/ptc/src/win32/base/kbd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -30,6 +30,11 @@
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 }
 }
 
 
+{$WARNING this should be in the windows unit}
+const
+  VK_OEM_COMMA = $BC;
+  VK_OEM_PERIOD = $BE;
+
 constructor TWin32Keyboard.Create(AWindow: HWND; AThread: DWord; AMultithreaded: Boolean; AEventQueue: TEventQueue);
 constructor TWin32Keyboard.Create(AWindow: HWND; AThread: DWord; AMultithreaded: Boolean; AEventQueue: TEventQueue);
 begin
 begin
   FMonitor := nil;
   FMonitor := nil;
@@ -133,6 +138,14 @@ begin
     KeyCode := wParam;
     KeyCode := wParam;
     if wParam = VK_RETURN then
     if wParam = VK_RETURN then
       KeyCode := PTCKEY_ENTER;
       KeyCode := PTCKEY_ENTER;
+    if wParam = VK_INSERT then
+      KeyCode := PTCKEY_INSERT;
+    if wParam = VK_DELETE then
+      KeyCode := PTCKEY_DELETE;
+    if wParam = VK_OEM_COMMA then
+      KeyCode := PTCKEY_COMMA;
+    if wParam = VK_OEM_PERIOD then
+      KeyCode := PTCKEY_PERIOD;
 
 
     { handle key repeat count }
     { handle key repeat count }
     for i := 1 to lParam and $FFFF do
     for i := 1 to lParam and $FFFF do

+ 1 - 1
packages/ptc/src/win32/base/kbdd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/monitor.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/monitord.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/moused.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/base/mousei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2006  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2007, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 106 - 84
packages/ptc/src/win32/base/window.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -43,11 +43,86 @@ begin
   FManaged := False;
   FManaged := False;
 end;
 end;
 
 
-constructor TWin32Window.Create(const AWndClass, ATitle: string; AExtra, AStyle: DWord;
-                                AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded: Boolean;
-				AData: Pointer);
+function WndProcSingleThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; forward;
+function WndProcMultiThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; forward;
+
+constructor TWin32Window.Create(const AWndClass, ATitle: string; AExtra, AStyle, AClassStyle: DWord;
+                                AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded,
+                                ACursor: Boolean);
+var
+  program_instance{, library_instance}: DWord;
+  rectangle: RECT;
+  display_width, display_height: Integer;
+  wc: WNDCLASSEX;
 begin
 begin
-  internal_create(AWndClass, ATitle, AExtra, AStyle, AShow, AX, AY, AWidth, AHeight, ACenter, AMultithreaded, AData);
+  LOG('creating managed window');
+  Defaults;
+  FMultithreaded := AMultithreaded;
+  try
+    program_instance := GetModuleHandle(nil);
+{    library_instance := program_instance;}
+    wc.cbSize := SizeOf(WNDCLASSEX);
+    wc.hInstance := program_instance;
+    wc.lpszClassName := PChar(AWndClass);
+    wc.style := AClassStyle;
+    wc.hIcon := 0{LoadIcon(library_instance, 'IDI_PTC_ICON')};
+    wc.hIconSm := 0;
+    wc.lpszMenuName := nil;
+    wc.cbClsExtra := 0;
+    wc.cbWndExtra := 0;
+    wc.hbrBackground := 0;{(HBRUSH) GetStockObject(BLACK_BRUSH)}
+    if AMultithreaded then
+      wc.lpfnWndProc := @WndProcMultiThreaded
+    else
+      wc.lpfnWndProc := @WndProcSingleThreaded;
+    if ACursor then
+      wc.hCursor := LoadCursor(0, IDC_ARROW)
+    else
+      wc.hCursor := 0;
+    RegisterClassEx(wc);
+    with rectangle do
+    begin
+      left := 0;
+      top := 0;
+      right := AWidth;
+      bottom := AHeight;
+    end;
+    AdjustWindowRectEx(rectangle, AStyle, False, AExtra);
+    if ACenter then
+    begin
+      LOG('centering window');
+      display_width := GetSystemMetrics(SM_CXSCREEN);
+      display_height := GetSystemMetrics(SM_CYSCREEN);
+      AX := (display_width - (rectangle.right - rectangle.left)) div 2;
+      AY := (display_height - (rectangle.bottom - rectangle.top)) div 2;
+    end;
+    FName := AWndClass;
+    FTitle := ATitle;
+    FExtra := AExtra;
+    FStyle := AStyle;
+    FShow := AShow;
+    FX := AX;
+    FY := AY;
+    FWidth := rectangle.right - rectangle.left;
+    FHeight := rectangle.bottom - rectangle.top;
+    if AMultithreaded then
+    begin
+      {...}
+    end
+    else
+    begin
+      FWindow := CreateWindowEx(FExtra, PChar(FName), PChar(FTitle), FStyle, FX, FY, FWidth, FHeight, 0, 0, 0, Self);
+      if not IsWindow(FWindow) then
+        raise TPTCError.Create('could not create window');
+      ShowWindow(FWindow, FShow);
+      SetFocus(FWindow);
+      SetActiveWindow(FWindow);
+      SetForegroundWindow(FWindow);
+    end;
+  except
+    on error: TPTCError do
+      raise TPTCError.Create('could not create window', error);
+  end;
 end;
 end;
 
 
 destructor TWin32Window.Destroy;
 destructor TWin32Window.Destroy;
@@ -163,8 +238,23 @@ begin
 end;
 end;
 
 
 function WndProcSingleThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
 function WndProcSingleThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
+var
+  WindowObject: TWin32Window;
+  pCreate: PCREATESTRUCT;
 begin
 begin
   case message of
   case message of
+    WM_CREATE:
+      begin
+        pCreate := PCREATESTRUCT(lParam);
+        WindowObject := TWin32Window(pCreate^.lpCreateParams);
+        SetWindowLongPtr(hWnd, GWLP_USERDATA, LONG_PTR(WindowObject));
+        Result := WindowObject.WMCreate(hWnd, message, wParam, lParam);
+      end;
+    WM_DESTROY:
+      begin
+        WindowObject := TWin32Window(GetWindowLongPtr(hWnd, GWLP_USERDATA));
+        Result := WindowObject.WMDestroy(hWnd, message, wParam, lParam);
+      end;
     WM_SYSCOMMAND:
     WM_SYSCOMMAND:
       begin
       begin
         { this fixes the pausing of the application when the Alt or F10 key is pressed }
         { this fixes the pausing of the application when the Alt or F10 key is pressed }
@@ -227,83 +317,6 @@ begin
   end;
   end;
 end;
 end;
 
 
-procedure TWin32Window.internal_create(const AWndClass, ATitle: string; AExtra, AStyle: DWord;
-                                       AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded: Boolean;
-				       AData: Pointer);
-var
-  program_instance{, library_instance}: DWord;
-  rectangle: RECT;
-  display_width, display_height: Integer;
-  wc: WNDCLASSEX;
-begin
-  LOG('creating managed window');
-  Defaults;
-  FMultithreaded := AMultithreaded;
-  try
-    program_instance := GetModuleHandle(nil);
-{    library_instance := program_instance;}
-    wc.cbSize := SizeOf(WNDCLASSEX);
-    wc.hInstance := program_instance;
-    wc.lpszClassName := PChar(AWndClass);
-    wc.style := CS_VREDRAW or CS_HREDRAW;
-    wc.hIcon := 0{LoadIcon(library_instance, 'IDI_PTC_ICON')};
-    wc.hIconSm := 0;
-    wc.lpszMenuName := nil;
-    wc.cbClsExtra := 0;
-    wc.cbWndExtra := 0;
-    wc.hbrBackground := 0;{(HBRUSH) GetStockObject(BLACK_BRUSH)}
-    if AMultithreaded then
-      wc.lpfnWndProc := @WndProcMultiThreaded
-    else
-      wc.lpfnWndProc := @WndProcSingleThreaded;
-    wc.hCursor := LoadCursor(0, IDC_ARROW);
-    RegisterClassEx(wc);
-    with rectangle do
-    begin
-      left := 0;
-      top := 0;
-      right := AWidth;
-      bottom := AHeight;
-    end;
-    AdjustWindowRectEx(rectangle, AStyle, False, AExtra);
-    if ACenter then
-    begin
-      LOG('centering window');
-      display_width := GetSystemMetrics(SM_CXSCREEN);
-      display_height := GetSystemMetrics(SM_CYSCREEN);
-      AX := (display_width - (rectangle.right - rectangle.left)) div 2;
-      AY := (display_height - (rectangle.bottom - rectangle.top)) div 2;
-    end;
-    FName := AWndClass;
-    FTitle := ATitle;
-    FExtra := AExtra;
-    FStyle := AStyle;
-    FShow := AShow;
-    FX := AX;
-    FY := AY;
-    FWidth := rectangle.right - rectangle.left;
-    FHeight := rectangle.bottom - rectangle.top;
-    FData := AData;
-    if AMultithreaded then
-    begin
-      {...}
-    end
-    else
-    begin
-      FWindow := CreateWindowEx(FExtra, PChar(FName), PChar(FTitle), FStyle, FX, FY, FWidth, FHeight, 0, 0, 0, FData);
-      if not IsWindow(FWindow) then
-        raise TPTCError.Create('could not create window');
-      ShowWindow(FWindow, FShow);
-      SetFocus(FWindow);
-      SetActiveWindow(FWindow);
-      SetForegroundWindow(FWindow);
-    end;
-  except
-    on error: TPTCError do
-      raise TPTCError.Create('could not create window', error);
-  end;
-end;
-
 procedure TWin32Window.Defaults;
 procedure TWin32Window.Defaults;
 begin
 begin
   FWindow := 0;
   FWindow := 0;
@@ -319,7 +332,6 @@ begin
   FY := 0;
   FY := 0;
   FWidth := 0;
   FWidth := 0;
   FHeight := 0;
   FHeight := 0;
-  FData := nil;
   FManaged := True;
   FManaged := True;
   FMultithreaded := False;
   FMultithreaded := False;
 end;
 end;
@@ -367,7 +379,7 @@ var
 begin
 begin
   with AOwner do
   with AOwner do
   begin
   begin
-    FWindow := CreateWindowEx(FExtra, PChar(FName), PChar(FTitle), FStyle, FX, FY, FWidth, FHeight, 0, 0, 0, FData);
+    FWindow := CreateWindowEx(FExtra, PChar(FName), PChar(FTitle), FStyle, FX, FY, FWidth, FHeight, 0, 0, 0, nil);
     if IsWindow(FWindow) then
     if IsWindow(FWindow) then
     begin
     begin
       ShowWindow(FWindow, FShow);
       ShowWindow(FWindow, FShow);
@@ -384,3 +396,13 @@ begin
       SetEvent(FEvent);
       SetEvent(FEvent);
   end;
   end;
 end;
 end;
+
+function TWin32Window.WMCreate(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
+begin
+  Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
+end;
+
+function TWin32Window.WMDestroy(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT;
+begin
+  Result := DefWindowProc(hWnd, uMsg, wParam, lParam);
+end;

+ 6 - 8
packages/ptc/src/win32/base/windowd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009, 2010, 2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -44,26 +44,24 @@ type
     FShow: Integer;
     FShow: Integer;
     FX, FY: Integer;
     FX, FY: Integer;
     FWidth, FHeight: Integer;
     FWidth, FHeight: Integer;
-    FData: Pointer;
     FManaged: Boolean;
     FManaged: Boolean;
     FMultithreaded: Boolean;
     FMultithreaded: Boolean;
     FCursorConfineInEffect: Boolean;
     FCursorConfineInEffect: Boolean;
 
 
 {    class function WndProcSingleThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; StdCall;
 {    class function WndProcSingleThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; StdCall;
     class function WndProcMultiThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; StdCall;}
     class function WndProcMultiThreaded(hWnd: HWND; message: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; StdCall;}
-    procedure internal_create(const AWndClass, ATitle: string; AExtra, AStyle: DWord;
-                              AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded: Boolean;
-			      AData: Pointer);
 
 
     procedure Defaults;
     procedure Defaults;
     procedure Close;
     procedure Close;
     function GetThread: DWord;
     function GetThread: DWord;
     class procedure ThreadFunction(AOwner: TWin32Window);
     class procedure ThreadFunction(AOwner: TWin32Window);
+  protected
+    function WMCreate(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; virtual;
+    function WMDestroy(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; virtual;
   public
   public
     constructor Create(window: HWND);
     constructor Create(window: HWND);
-    constructor Create(const AWndClass, ATitle: string; AExtra, AStyle: DWord;
-                       AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded: Boolean;
-		       AData: Pointer = nil);
+    constructor Create(const AWndClass, ATitle: string; AExtra, AStyle, AClassStyle: DWord;
+                       AShow, AX, AY, AWidth, AHeight: Integer; ACenter, AMultithreaded, ACursor: Boolean);
     destructor Destroy; override;
     destructor Destroy; override;
     procedure Cursor(AFlag: Boolean);
     procedure Cursor(AFlag: Boolean);
     procedure ConfineCursor(AFlag: Boolean);
     procedure ConfineCursor(AFlag: Boolean);

+ 1 - 1
packages/ptc/src/win32/directx/check.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 2 - 2
packages/ptc/src/win32/directx/directxconsoled.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@
 
 
 type
 type
   TPrimaryModeEnum = (DIRECT, SECONDARY);
   TPrimaryModeEnum = (DIRECT, SECONDARY);
-  TDirectXConsole = class(TPTCBaseConsole)
+  TDirectXConsole = class(TPTCOpenGLLessConsole)
   private
   private
     { title data }
     { title data }
 {    FTitle: array [0..1023] of Char;}
 {    FTitle: array [0..1023] of Char;}

+ 5 - 12
packages/ptc/src/win32/directx/directxconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -313,18 +313,14 @@ begin
   if AOption = 'grab mouse' then
   if AOption = 'grab mouse' then
   begin
   begin
     if FOpen and (not FFullscreen) then
     if FOpen and (not FFullscreen) then
-    begin
       FWindow.ConfineCursor(True);
       FWindow.ConfineCursor(True);
-    end;
     FGrabMouse := True;
     FGrabMouse := True;
     exit;
     exit;
   end;
   end;
   if AOption = 'ungrab mouse' then
   if AOption = 'ungrab mouse' then
   begin
   begin
     if FOpen and (not FFullscreen) then
     if FOpen and (not FFullscreen) then
-    begin
       FWindow.ConfineCursor(False);
       FWindow.ConfineCursor(False);
-    end;
     FGrabMouse := False;
     FGrabMouse := False;
     exit;
     exit;
   end;
   end;
@@ -1028,17 +1024,15 @@ begin
                                     FTitle,
                                     FTitle,
                                     WS_EX_TOPMOST,
                                     WS_EX_TOPMOST,
                                     DWord(WS_POPUP or WS_SYSMENU or WS_VISIBLE), // fpc windows RTL bug - WS_POPUP should be a DWord!!!
                                     DWord(WS_POPUP or WS_SYSMENU or WS_VISIBLE), // fpc windows RTL bug - WS_POPUP should be a DWord!!!
+                                    CS_VREDRAW or CS_HREDRAW,
                                     SW_NORMAL,
                                     SW_NORMAL,
                                     0, 0,
                                     0, 0,
                                     GetSystemMetrics(SM_CXSCREEN),
                                     GetSystemMetrics(SM_CXSCREEN),
                                     GetSystemMetrics(SM_CYSCREEN),
                                     GetSystemMetrics(SM_CYSCREEN),
-                                    False, False)
+                                    False, False, FCursor)
   else
   else
     FWindow := TWin32Window.Create(window);
     FWindow := TWin32Window.Create(window);
 
 
-  { set window cursor }
-  FWindow.Cursor(FCursor);
-
   if FCursor then
   if FCursor then
     FWin32Cursor.Show
     FWin32Cursor.Show
   else
   else
@@ -1147,12 +1141,11 @@ begin
       extended := WS_EX_TOPMOST;
       extended := WS_EX_TOPMOST;
     case FWindowMode of
     case FWindowMode of
       RESIZABLE: FWindow := TWin32Window.Create('PTC_DIRECTX_WINDOWED_RESIZABLE', FTitle,
       RESIZABLE: FWindow := TWin32Window.Create('PTC_DIRECTX_WINDOWED_RESIZABLE', FTitle,
-                                              extended, WS_OVERLAPPEDWINDOW or WS_VISIBLE, SW_NORMAL, CW_USEDEFAULT, CW_USEDEFAULT, mode.width, mode.height, FCenterWindow, False);
+                                              extended, WS_OVERLAPPEDWINDOW or WS_VISIBLE, CS_VREDRAW or CS_HREDRAW, SW_NORMAL, CW_USEDEFAULT, CW_USEDEFAULT, mode.width, mode.height, FCenterWindow, False, FCursor);
       FIXED: FWindow := TWin32Window.Create('PTC_DIRECTX_WINDOWED_FIXED', FTitle,
       FIXED: FWindow := TWin32Window.Create('PTC_DIRECTX_WINDOWED_FIXED', FTitle,
-                                              extended, WS_VISIBLE or WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX, SW_NORMAL, CW_USEDEFAULT, CW_USEDEFAULT, mode.width, mode.height, FCenterWindow, False);
+                                              extended, WS_VISIBLE or WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX, CS_VREDRAW or CS_HREDRAW, SW_NORMAL, CW_USEDEFAULT, CW_USEDEFAULT, mode.width, mode.height, FCenterWindow, False, FCursor);
     end;
     end;
   end;
   end;
-  FWindow.Cursor(FCursor);
   FDisplay.cooperative(FWindow.handle, False);
   FDisplay.cooperative(FWindow.handle, False);
 end;
 end;
 
 

+ 1 - 1
packages/ptc/src/win32/directx/display.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/directx/displayd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 17 - 1
packages/ptc/src/win32/directx/hook.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -139,6 +139,22 @@ begin
 	end;
 	end;
       end;
       end;
     end;
     end;
+    WM_PALETTECHANGED:
+      begin
+        LOG('TDirectXHook WM_PALETTECHANGED');
+        if Windows.HWND(wParam) <> hWnd then
+        begin
+          LOG('not our window');
+          if FConsole.FPrimary.Active then
+          begin
+            FConsole.FPrimary.ResetPalette;
+          end;
+        end;
+      end;
+    WM_QUERYNEWPALETTE:
+      begin
+        LOG('TDirectXHook WM_QUERYNEWPALETTE');
+      end;
     WM_CLOSE: begin
     WM_CLOSE: begin
       LOG('TDirectXHook WM_CLOSE');
       LOG('TDirectXHook WM_CLOSE');
 
 

+ 1 - 1
packages/ptc/src/win32/directx/hookd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/directx/library.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 1 - 1
packages/ptc/src/win32/directx/libraryd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009, 2010  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 10 - 5
packages/ptc/src/win32/directx/primary.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -483,22 +483,27 @@ begin
 end;
 end;
 
 
 procedure TDirectXPrimary.Palette(APalette: IPTCPalette);
 procedure TDirectXPrimary.Palette(APalette: IPTCPalette);
+begin
+  Block;
+
+  FPalette.Load(APalette.Data);
+  ResetPalette;
+end;
+
+procedure TDirectXPrimary.ResetPalette;
 var
 var
   data: PUint32;
   data: PUint32;
   temp: array [0..255] of PALETTEENTRY;
   temp: array [0..255] of PALETTEENTRY;
   I: Integer;
   I: Integer;
   DDP: IDirectDrawPalette;
   DDP: IDirectDrawPalette;
 begin
 begin
-  Block;
-
-  FPalette.Load(APalette.Data);
   if not FFormat.Indexed then
   if not FFormat.Indexed then
   begin
   begin
     LOG('palette set in direct color');
     LOG('palette set in direct color');
   end
   end
   else
   else
   begin
   begin
-    data := APalette.Data;
+    data := FPalette.Data;
     for I := 0 to 255 do
     for I := 0 to 255 do
     begin
     begin
       temp[I].peRed := (data[I] and $00FF0000) shr 16;
       temp[I].peRed := (data[I] and $00FF0000) shr 16;

+ 2 - 1
packages/ptc/src/win32/directx/primaryd.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2009-2012  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
@@ -96,6 +96,7 @@ type
     procedure Clear(AColor: IPTCColor; const AArea: IPTCArea);
     procedure Clear(AColor: IPTCColor; const AArea: IPTCArea);
 
 
     procedure Palette(APalette: IPTCPalette);
     procedure Palette(APalette: IPTCPalette);
+    procedure ResetPalette;
     function Palette: IPTCPalette;
     function Palette: IPTCPalette;
 
 
     procedure Clip(const AArea: IPTCArea);
     procedure Clip(const AArea: IPTCArea);

+ 1 - 1
packages/ptc/src/win32/directx/translate.inc

@@ -1,6 +1,6 @@
 {
 {
     Free Pascal port of the OpenPTC C++ library.
     Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2003, 2006, 2007, 2009-2011  Nikolay Nikolov ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
     Original C++ version by Glenn Fiedler ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or

+ 17 - 3
packages/ptc/src/win32/gdi/gdiconsoled.inc

@@ -1,7 +1,6 @@
 {
 {
-    Free Pascal port of the OpenPTC C++ library.
-    Copyright (C) 2001-2003  Nikolay Nikolov ([email protected])
-    Original C++ version by Glenn Fiedler ([email protected])
+    This file is part of the PTCPas framebuffer library
+    Copyright (C) 2007, 2009-2012  Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -37,6 +36,8 @@ type
     FWin32DIB: TWin32DIB;
     FWin32DIB: TWin32DIB;
     FKeyboard: TWin32Keyboard;
     FKeyboard: TWin32Keyboard;
     FMouse: TWin32Mouse;
     FMouse: TWin32Mouse;
+    FWin32Cursor: TWin32Cursor;
+    FHook: TGDIHook;
 
 
     FCopy: TPTCCopy;
     FCopy: TPTCCopy;
     FClear: TPTCClear;
     FClear: TPTCClear;
@@ -46,6 +47,10 @@ type
     FPalette: IPTCPalette;
     FPalette: IPTCPalette;
     FModes: array of IPTCMode;
     FModes: array of IPTCMode;
 
 
+    FFullscreen: Boolean;
+    FModeSetter: TWin32ModeSetter;
+    FGrabMouse: Boolean;
+
     FOpen: Boolean;
     FOpen: Boolean;
     FLocked: Boolean;
     FLocked: Boolean;
     FCursor: Boolean;
     FCursor: Boolean;
@@ -60,6 +65,8 @@ type
     FDefaultHeight: Integer;
     FDefaultHeight: Integer;
     FDefaultFormat: IPTCFormat;
     FDefaultFormat: IPTCFormat;
 
 
+    FUseOpenGL: Boolean;
+
     procedure UpdateCursor;
     procedure UpdateCursor;
 
 
     function GetWidth: Integer; override;
     function GetWidth: Integer; override;
@@ -72,6 +79,9 @@ type
     function GetTitle: string; override;
     function GetTitle: string; override;
     function GetInformation: string; override;
     function GetInformation: string; override;
 
 
+    function GetOpenGL_Enabled: Boolean; override;
+    procedure SetOpenGL_Enabled(AValue: Boolean); override;
+
     procedure CheckOpen(const AMessage: string);
     procedure CheckOpen(const AMessage: string);
     procedure CheckUnlocked(const AMessage: string);
     procedure CheckUnlocked(const AMessage: string);
   public
   public
@@ -134,4 +144,8 @@ type
 
 
     function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean; override;
     function NextEvent(out AEvent: IPTCEvent; AWait: Boolean; const AEventMask: TPTCEventMask): Boolean; override;
     function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent; override;
     function PeekEvent(AWait: Boolean; const AEventMask: TPTCEventMask): IPTCEvent; override;
+
+    procedure OpenGL_SwapBuffers; override;
+	procedure OpenGL_SetSwapInterval(AInterval: Integer); override;
+	function OpenGL_GetSwapInterval: Integer; override;
   end;
   end;

+ 185 - 20
packages/ptc/src/win32/gdi/gdiconsolei.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2007, 2009-2012  Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public
@@ -38,8 +38,8 @@ begin
   FDisplayWidth := GetSystemMetrics(SM_CXSCREEN);
   FDisplayWidth := GetSystemMetrics(SM_CXSCREEN);
   FDisplayHeight := GetSystemMetrics(SM_CYSCREEN);
   FDisplayHeight := GetSystemMetrics(SM_CYSCREEN);
 
 
-  FDefaultWidth := 320;
-  FDefaultHeight := 200;
+  FDefaultWidth := 640;
+  FDefaultHeight := 480;
   FDefaultFormat := TPTCFormat.Create(32, $00FF0000, $0000FF00, $000000FF);
   FDefaultFormat := TPTCFormat.Create(32, $00FF0000, $0000FF00, $000000FF);
 
 
   FCopy := TPTCCopy.Create;
   FCopy := TPTCCopy.Create;
@@ -47,6 +47,11 @@ begin
   FArea := TPTCArea.Create;
   FArea := TPTCArea.Create;
   FClip := TPTCArea.Create;
   FClip := TPTCArea.Create;
   FPalette := TPTCPalette.Create;
   FPalette := TPTCPalette.Create;
+  FWin32Cursor := TWin32Cursor.Create;
+
+  FFullscreen := True;
+
+  FModeSetter := TWin32ModeSetter.Create;
 
 
   FOpen := False;
   FOpen := False;
 
 
@@ -65,11 +70,14 @@ begin
 
 
   {...}
   {...}
 
 
+  FModeSetter.Free;
+
   FWin32DIB.Free;
   FWin32DIB.Free;
   FWindow.Free;
   FWindow.Free;
   FEventQueue.Free;
   FEventQueue.Free;
   FCopy.Free;
   FCopy.Free;
   FClear.Free;
   FClear.Free;
+  FWin32Cursor.Free;
 
 
   inherited Destroy;
   inherited Destroy;
 end;
 end;
@@ -99,44 +107,112 @@ begin
   if FOpen then
   if FOpen then
     Close;
     Close;
 
 
+  case FCursorMode of
+    CURSOR_DEFAULT:
+      FCursor := not FFullScreen;
+    CURSOR_SHOW:
+      FCursor := True;
+    CURSOR_HIDE:
+      FCursor := False;
+  end;
+
+  if FFullscreen then
+  begin
+    FModeSetter.Save;
+    FModeSetter.Open(AWidth, AHeight, AFormat);
+  end;
+
 (*  FWindow := TWin32Window.Create('PTC_GDI_FULLSCREEN',
 (*  FWindow := TWin32Window.Create('PTC_GDI_FULLSCREEN',
                                  ATitle,
                                  ATitle,
                                  WS_EX_TOPMOST,
                                  WS_EX_TOPMOST,
                                  DWord(WS_POPUP or WS_SYSMENU or WS_VISIBLE), // fpc windows RTL bug - WS_POPUP should be a DWord!!!
                                  DWord(WS_POPUP or WS_SYSMENU or WS_VISIBLE), // fpc windows RTL bug - WS_POPUP should be a DWord!!!
+                                 CS_HREDRAW or CS_VREDRAW,
                                  SW_NORMAL,
                                  SW_NORMAL,
                                  0, 0,
                                  0, 0,
                                  GetSystemMetrics(SM_CXSCREEN),
                                  GetSystemMetrics(SM_CXSCREEN),
                                  GetSystemMetrics(SM_CYSCREEN),
                                  GetSystemMetrics(SM_CYSCREEN),
                                  False, False);*)
                                  False, False);*)
 
 
-  FWindow := TWin32Window.Create('PTC_GDI_WINDOWED_FIXED',
-                                 ATitle,
-                                 0,
-                                 WS_VISIBLE or WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX,
-                                 SW_NORMAL,
-                                 CW_USEDEFAULT, CW_USEDEFAULT,
-                                 AWidth, AHeight,
-                                 {m_center_window}False,
-                                 False);
-
 (*  FWindow := TWin32Window.Create('PTC_GDI_WINDOWED_RESIZABLE',
 (*  FWindow := TWin32Window.Create('PTC_GDI_WINDOWED_RESIZABLE',
                                  ATitle,
                                  ATitle,
                                  0,
                                  0,
                                  WS_OVERLAPPEDWINDOW or WS_VISIBLE,
                                  WS_OVERLAPPEDWINDOW or WS_VISIBLE,
+                                 CS_HREDRAW or CS_VREDRAW,
                                  SW_NORMAL,
                                  SW_NORMAL,
                                  CW_USEDEFAULT, CW_USEDEFAULT,
                                  CW_USEDEFAULT, CW_USEDEFAULT,
                                  AWidth, AHeight,
                                  AWidth, AHeight,
                                  {m_center_window}False,
                                  {m_center_window}False,
                                  False);*)
                                  False);*)
 
 
+  if FFullscreen then
+  begin
+    if FUseOpenGL then
+      FWindow := TWin32OpenGLWindow.Create('PTC_OPENGL_FULLSCREEN',
+                                           ATitle,
+                                           WS_EX_TOPMOST or WS_EX_APPWINDOW,
+                                           WS_VISIBLE or WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,
+                                           CS_HREDRAW or CS_VREDRAW or CS_OWNDC,
+                                           SW_NORMAL,
+                                           CW_USEDEFAULT, CW_USEDEFAULT,
+                                           AWidth, AHeight,
+                                           {m_center_window}False,
+                                           False,
+                                           FCursor,
+                                           FOpenGLAttributes)
+    else
+      FWindow := TWin32Window.Create('PTC_GDI_FULLSCREEN',
+                                     ATitle,
+                                     WS_EX_TOPMOST or WS_EX_APPWINDOW,
+                                     WS_VISIBLE or WS_POPUP,
+                                     CS_HREDRAW or CS_VREDRAW,
+                                     SW_NORMAL,
+                                     CW_USEDEFAULT, CW_USEDEFAULT,
+                                     AWidth, AHeight,
+                                     {m_center_window}False,
+                                     False,
+                                     FCursor);
+  end
+  else
+  begin
+    if FUseOpenGL then
+      FWindow := TWin32OpenGLWindow.Create('PTC_OPENGL_WINDOWED_FIXED',
+                                           ATitle,
+                                           0,
+                                           WS_VISIBLE or WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX or WS_CLIPSIBLINGS or WS_CLIPCHILDREN,
+                                           CS_HREDRAW or CS_VREDRAW or CS_OWNDC,
+                                           SW_NORMAL,
+                                           CW_USEDEFAULT, CW_USEDEFAULT,
+                                           AWidth, AHeight,
+                                           {m_center_window}False,
+                                           False,
+                                           FCursor,
+                                           FOpenGLAttributes)
+    else
+      FWindow := TWin32Window.Create('PTC_GDI_WINDOWED_FIXED',
+                                     ATitle,
+                                     0,
+                                     WS_VISIBLE or WS_SYSMENU or WS_CAPTION or WS_MINIMIZEBOX,
+                                     CS_HREDRAW or CS_VREDRAW,
+                                     SW_NORMAL,
+                                     CW_USEDEFAULT, CW_USEDEFAULT,
+                                     AWidth, AHeight,
+                                     {m_center_window}False,
+                                     False,
+                                     FCursor);
+  end;
+
   FWin32DIB := TWin32DIB.Create(AWidth, AHeight);
   FWin32DIB := TWin32DIB.Create(AWidth, AHeight);
 
 
   FreeAndNil(FKeyboard);
   FreeAndNil(FKeyboard);
   FreeAndNil(FMouse);
   FreeAndNil(FMouse);
+  FreeAndNil(FHook);
   FreeAndNil(FEventQueue);
   FreeAndNil(FEventQueue);
   FEventQueue := TEventQueue.Create;
   FEventQueue := TEventQueue.Create;
+  FHook := TGDIHook.Create(Self, FWindow.Handle, FWindow.Thread, FCursor, {AManaged}True, FFullScreen);
   FKeyboard := TWin32Keyboard.Create(FWindow.Handle, FWindow.Thread, False, FEventQueue);
   FKeyboard := TWin32Keyboard.Create(FWindow.Handle, FWindow.Thread, False, FEventQueue);
-  FMouse := TWin32Mouse.Create(FWindow.Handle, FWindow.Thread, False, FEventQueue, {FFullScreen}False, AWidth, AHeight);
+  FMouse := TWin32Mouse.Create(FWindow.Handle, FWindow.Thread, False, FEventQueue, FFullScreen, AWidth, AHeight);
+  if FFullscreen then
+    FMouse.SetWindowArea(0, 0, AWidth, AHeight);
 
 
   tmpArea := TPTCArea.Create(0, 0, AWidth, AHeight);
   tmpArea := TPTCArea.Create(0, 0, AWidth, AHeight);
   FArea := tmpArea;
   FArea := tmpArea;
@@ -144,6 +220,13 @@ begin
 
 
   FWindow.Update;
   FWindow.Update;
 
 
+  { hide/show cursor globally if running fullscreen }
+  if FFullscreen then
+    if FCursor then
+      FWin32Cursor.Show
+    else
+      FWin32Cursor.Hide;
+
   FTitle := ATitle;
   FTitle := ATitle;
 
 
   FOpen := True;
   FOpen := True;
@@ -156,8 +239,16 @@ begin
 
 
   {...}
   {...}
 
 
+  if FFullscreen then
+  begin
+    FModeSetter.Close;
+    FModeSetter.Restore;
+    FWin32Cursor.Show;
+  end;
+
   FreeAndNil(FKeyboard);
   FreeAndNil(FKeyboard);
   FreeAndNil(FMouse);
   FreeAndNil(FMouse);
+  FreeAndNil(FHook);
 
 
   FreeAndNil(FWin32DIB);
   FreeAndNil(FWin32DIB);
   FreeAndNil(FWindow);
   FreeAndNil(FWindow);
@@ -273,22 +364,25 @@ begin
 
 
   case FCursorMode of
   case FCursorMode of
     CURSOR_DEFAULT:
     CURSOR_DEFAULT:
-      FCursor := {Not FFullScreen}True;
+      FCursor := not FFullScreen;
     CURSOR_SHOW:
     CURSOR_SHOW:
       FCursor := True;
       FCursor := True;
     CURSOR_HIDE:
     CURSOR_HIDE:
       FCursor := False;
       FCursor := False;
   end;
   end;
 
 
+  { update hook cursor }
+  FHook.Cursor(FCursor);
+
   { update window cursor }
   { update window cursor }
   FWindow.Cursor(FCursor);
   FWindow.Cursor(FCursor);
 
 
   { hide/show cursor globally if running fullscreen }
   { hide/show cursor globally if running fullscreen }
-{  if FFullscreen then
+  if FFullscreen then
     if FCursor then
     if FCursor then
-      Win32Cursor_resurrect
+      FWin32Cursor.Show
     else
     else
-      Win32Cursor_kill;}
+      FWin32Cursor.Hide;
 end;
 end;
 
 
 procedure TGDIConsole.Clear;
 procedure TGDIConsole.Clear;
@@ -334,6 +428,21 @@ function TGDIConsole.Option(const AOption: String): Boolean;
 begin
 begin
   LOG('console option', AOption);
   LOG('console option', AOption);
   Result := True;
   Result := True;
+  if AOption = 'default output' then
+  begin
+    FFullscreen := False;
+    exit;
+  end;
+  if AOption = 'windowed output' then
+  begin
+    FFullscreen := False;
+    exit;
+  end;
+  if AOption = 'fullscreen output' then
+  begin
+    FFullscreen := True;
+    exit;
+  end;
   if AOption = 'default cursor' then
   if AOption = 'default cursor' then
   begin
   begin
     FCursorMode := CURSOR_DEFAULT;
     FCursorMode := CURSOR_DEFAULT;
@@ -354,12 +463,16 @@ begin
   end;
   end;
   if AOption = 'grab mouse' then
   if AOption = 'grab mouse' then
   begin
   begin
-    FWindow.ConfineCursor(true);
+    if FOpen and (not FFullscreen) then
+      FWindow.ConfineCursor(True);
+    FGrabMouse := True;
     exit;
     exit;
   end;
   end;
   if AOption = 'ungrab mouse' then
   if AOption = 'ungrab mouse' then
   begin
   begin
-    FWindow.ConfineCursor(false);
+    if FOpen and (not FFullscreen) then
+      FWindow.ConfineCursor(False);
+    FGrabMouse := False;
     exit;
     exit;
   end;
   end;
 
 
@@ -539,6 +652,58 @@ begin
   Result := ''; // todo...
   Result := ''; // todo...
 end;
 end;
 
 
+function TGDIConsole.GetOpenGL_Enabled: Boolean;
+begin
+  Result := FUseOpenGL;
+end;
+
+procedure TGDIConsole.SetOpenGL_Enabled(AValue: Boolean);
+begin
+  if FOpen then
+    raise TPTCError.Create('Value of UseOpenGL cannot be modified while the console is open');
+  FUseOpenGL := AValue;
+end;
+
+procedure TGDIConsole.OpenGL_SwapBuffers;
+begin
+  SwapBuffers(wglGetCurrentDC);
+end;
+
+procedure TGDIConsole.OpenGL_SetSwapInterval(AInterval: Integer);
+begin
+  LOG('SetSwapInterval(' + IntToStr(AInterval) + ')');
+  if AInterval < 0 then
+    raise TPTCError.Create('Invalid swap interval');
+  LOG('checking if WGL_EXT_swap_control is supported');
+  if Load_WGL_EXT_swap_control then
+  begin
+    LOG('using WGL_EXT_swap_control');
+    LOG('wglSwapIntervalEXT(' + IntToStr(AInterval) + ')');
+    if not wglSwapIntervalEXT(AInterval) then
+	  LOG('wglSwapIntervalEXT failed');
+  end
+  else
+    LOG('no supported extensions found for setting the swap interval');
+end;
+
+function TGDIConsole.OpenGL_GetSwapInterval: Integer;
+begin
+  LOG('GetSwapInterval');
+  LOG('checking if WGL_EXT_swap_control is supported');
+  if Load_WGL_EXT_swap_control then
+  begin
+    LOG('using WGL_EXT_swap_control');
+    LOG('wglGetSwapIntervalEXT()');
+    Result := wglGetSwapIntervalEXT();
+    LOG('wglGetSwapIntervalEXT() result', Result);
+  end
+  else
+  begin
+    LOG('no supported extensions found for setting the swap interval, assuming the swap interval is 0');
+    Result := 0;
+  end;
+end;
+
 procedure TGDIConsole.CheckOpen(const AMessage: String);
 procedure TGDIConsole.CheckOpen(const AMessage: String);
 begin
 begin
   if not FOpen then
   if not FOpen then

+ 55 - 0
packages/ptc/src/win32/gdi/gdihookd.inc

@@ -0,0 +1,55 @@
+{
+    This file is part of the PTCPas framebuffer library
+    Copyright (C) 2012 Nikolay Nikolov ([email protected])
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version
+    with the following modification:
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,and
+    to copy and distribute the resulting executable under terms of your choice,
+    provided that you also meet, for each linked independent module, the terms
+    and conditions of the license of that module. An independent module is a
+    module which is not derived from or based on this library. If you modify
+    this library, you may extend this exception to your version of the library,
+    but you are not obligated to do so. If you do not wish to do so, delete this
+    exception statement from your version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+}
+
+type
+  TGDIConsole = class;
+  TGDIHook = class(TWin32Hook)
+  private
+    { console }
+    FCursor: Boolean;
+    FManaged: Boolean;
+    FFullscreen: Boolean;
+    FConsole: TGDIConsole;
+  protected
+    { window procedure }
+    function WndProc(hWnd: HWND; message: DWord; wParam: WPARAM; lParam: LPARAM): LRESULT; override;
+
+    { window management }
+    procedure Activate;
+    procedure Deactivate;
+  public
+    { setup }
+    constructor Create(AConsole: TGDIConsole; AWindow: HWND; AThread: DWord; ACursor, AManaged, AFullscreen: Boolean);
+    destructor Destroy; override;
+
+    { cursor management }
+    procedure Cursor(AFlag: Boolean);
+  end;

+ 214 - 0
packages/ptc/src/win32/gdi/gdihooki.inc

@@ -0,0 +1,214 @@
+{
+    This file is part of the PTCPas framebuffer library
+    Copyright (C) 2012 Nikolay Nikolov ([email protected])
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version
+    with the following modification:
+
+    As a special exception, the copyright holders of this library give you
+    permission to link this library with independent modules to produce an
+    executable, regardless of the license terms of these independent modules,and
+    to copy and distribute the resulting executable under terms of your choice,
+    provided that you also meet, for each linked independent module, the terms
+    and conditions of the license of that module. An independent module is a
+    module which is not derived from or based on this library. If you modify
+    this library, you may extend this exception to your version of the library,
+    but you are not obligated to do so. If you do not wish to do so, delete this
+    exception statement from your version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+}
+
+constructor TGDIHook.Create(AConsole: TGDIConsole; AWindow: HWND; AThread: DWord; ACursor, AManaged, AFullscreen: Boolean);
+begin
+  FConsole := AConsole;
+
+  FCursor := ACursor;
+  FManaged := AManaged;
+  FFullscreen := AFullscreen;
+
+  LOG('creating window hook');
+
+  inherited Create(AWindow, AThread);
+end;
+
+destructor TGDIHook.Destroy;
+begin
+  LOG('destroying window hook');
+  inherited Destroy;
+end;
+
+procedure TGDIHook.Cursor(AFlag: Boolean);
+begin
+  FCursor := AFlag;
+end;
+
+function TGDIHook.WndProc(hWnd: HWND; message: DWord; wParam: WPARAM; lParam: LPARAM): LRESULT;
+
+  function WMSizeWParam2String(wParam: WPARAM): string;
+  begin
+    case wParam of
+      SIZE_MAXHIDE:   Result := 'SIZE_MAXHIDE';
+      SIZE_MAXIMIZED: Result := 'SIZE_MAXIMIZED';
+      SIZE_MAXSHOW:   Result := 'SIZE_MAXSHOW';
+      SIZE_MINIMIZED: Result := 'SIZE_MINIMIZED';
+      SIZE_RESTORED:  Result := 'SIZE_RESTORED';
+      else
+        Result := 'Unknown (' + IntToStr(wParam) + ')';
+    end;
+  end;
+
+var
+  active: Boolean;
+  thread: DWord;
+  console: TGDIConsole;
+begin
+  case message of
+    WM_PAINT: begin
+      LOG('TGDIHook WM_PAINT');
+
+      { paint console }
+      //FConsole.Paint;
+    end;
+    WM_ACTIVATEAPP: begin
+      LOG('TGDIHook WM_ACTIVATEAPP');
+
+      { get window message data }
+      active := wParam <> 0;
+      thread := DWord(lParam);
+
+      { check active flag }
+      if active = False then
+      begin
+        if FConsole.FGrabMouse and (not FFullscreen) then
+          FConsole.FWindow.ConfineCursor(False);
+
+        if FFullscreen then
+          ShowWindow(FWindow, SW_MINIMIZE);
+      end
+      else
+      begin
+        if FConsole.FGrabMouse and (not FFullscreen) then
+          FConsole.FWindow.ConfineCursor(True);
+      end;
+
+    end;
+    WM_SIZE:
+      begin
+        LOG('TGDIHook WM_SIZE, wParam = ' + WMSizeWParam2String(wParam));
+        case wParam of
+          SIZE_MINIMIZED:
+            begin
+              Deactivate;
+            end;
+          SIZE_RESTORED, SIZE_MAXIMIZED:
+            begin
+              Activate;
+            end;
+        end;
+
+        { pass to the next handler (or DefWindowProc) }
+        Result := 0;
+        exit;
+      end;
+    WM_SETCURSOR: begin
+      { check cursor }
+      if not FCursor then
+      begin
+        if FFullscreen or (LOWORD(lParam) = HTCLIENT) then
+        begin
+          { hide cursor }
+          SetCursor(0);
+
+          { handled }
+          Result := 1;
+        end;
+      end;
+    end;
+    WM_CLOSE: begin
+      LOG('TGDIHook WM_CLOSE');
+
+      if FManaged then
+      begin
+        console := FConsole;
+
+        { close console }
+        console.Close;
+
+        { note: at this point the hook object has been destroyed by the console! }
+
+        { internal console shutdown }
+        //console.internal_shutdown;
+
+        { halt }
+        Halt(0);
+      end;
+
+      { handled }
+      Result := 1;
+      exit;
+    end;
+  end;
+
+  { unhandled }
+  Result := 0;
+end;
+
+procedure TGDIHook.Activate;
+var
+//  placement: WINDOWPLACEMENT;
+  ModeSetter: TWin32ModeSetter;
+begin
+  LOG('activate');
+
+  if FConsole.FOpen then
+  begin
+    if FFullscreen then
+    begin
+      ModeSetter := FConsole.FModeSetter;
+
+      if not ModeSetter.InMode then
+      begin
+        ModeSetter.Save;
+        ModeSetter.Enter;
+      end;
+
+      if not FCursor then
+        FConsole.FWin32Cursor.Hide;
+    end;
+  end;
+end;
+
+procedure TGDIHook.Deactivate;
+var
+  ModeSetter: TWin32ModeSetter;
+begin
+  LOG('deactivate');
+
+  if FConsole.FOpen then
+  begin
+    if FFullscreen then
+    begin
+      if not FCursor then
+        FConsole.FWin32Cursor.Show;
+
+      ModeSetter := FConsole.FModeSetter;
+
+      if ModeSetter.InMode then
+      begin
+        ModeSetter.Leave;
+        ModeSetter.Restore;
+      end;
+    end;
+  end;
+end;

+ 1 - 1
packages/ptc/src/win32/gdi/win32dibd.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

+ 1 - 1
packages/ptc/src/win32/gdi/win32dibi.inc

@@ -1,6 +1,6 @@
 {
 {
     This file is part of the PTCPas framebuffer library
     This file is part of the PTCPas framebuffer library
-    Copyright (C) 2001-2010 Nikolay Nikolov ([email protected])
+    Copyright (C) 2001-2011 Nikolay Nikolov ([email protected])
 
 
     This library is free software; you can redistribute it and/or
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Lesser General Public
     modify it under the terms of the GNU Lesser General Public

Some files were not shown because too many files changed in this diff