Browse Source

Update to fltk 1.3.2

mingodad 11 years ago
parent
commit
44448059db
100 changed files with 6052 additions and 3431 deletions
  1. 84 10
      fltk/CHANGES
  2. 10 640
      fltk/CMakeLists.txt
  3. 16 8
      fltk/CREDITS
  4. 23 5
      fltk/FL/Enumerations.H
  5. 150 16
      fltk/FL/Fl.H
  6. 5 3
      fltk/FL/Fl_Bitmap.H
  7. 21 2
      fltk/FL/Fl_Browser_.H
  8. 135 0
      fltk/FL/Fl_Copy_Surface.H
  9. 3 2
      fltk/FL/Fl_Device.H
  10. 3 2
      fltk/FL/Fl_Gl_Window.H
  11. 5 3
      fltk/FL/Fl_Image.H
  12. 90 0
      fltk/FL/Fl_Image_Surface.H
  13. 6 3
      fltk/FL/Fl_Input_.H
  14. 128 40
      fltk/FL/Fl_Native_File_Chooser.H
  15. 11 4
      fltk/FL/Fl_PostScript.H
  16. 3 2
      fltk/FL/Fl_Preferences.H
  17. 10 2
      fltk/FL/Fl_Spinner.H
  18. 52 19
      fltk/FL/Fl_Sys_Menu_Bar.H
  19. 39 2
      fltk/FL/Fl_Table.H
  20. 160 2
      fltk/FL/Fl_Tabs.H
  21. 3 3
      fltk/FL/Fl_Text_Buffer.H
  22. 73 11
      fltk/FL/Fl_Text_Display.H
  23. 144 63
      fltk/FL/Fl_Tree.H
  24. 136 40
      fltk/FL/Fl_Tree_Item.H
  25. 20 2
      fltk/FL/Fl_Tree_Item_Array.H
  26. 29 5
      fltk/FL/Fl_Tree_Prefs.H
  27. 9 3
      fltk/FL/Fl_Widget.H
  28. 34 5
      fltk/FL/Fl_Window.H
  29. 3 3
      fltk/FL/Xutf8.h
  30. 21 3
      fltk/FL/fl_draw.H
  31. 36 22
      fltk/FL/mac.H
  32. 3 2
      fltk/FL/win32.H
  33. 3 7
      fltk/FL/x.H
  34. 9 4
      fltk/Makefile
  35. 39 15
      fltk/README
  36. 47 31
      fltk/README.CMake.txt
  37. 1 1
      fltk/README.Cairo.txt
  38. 4 2
      fltk/README.MSWindows.txt
  39. 25 6
      fltk/README.OSX.txt
  40. 145 8
      fltk/README.Unix.txt
  41. 16 0
      fltk/autogen.sh
  42. 16 6
      fltk/cairo/Fl_Cairo.cxx
  43. 1 1
      fltk/cairo/Makefile
  44. 1 0
      fltk/config.guess
  45. 1 0
      fltk/config.sub
  46. 10 2
      fltk/configh.cmake.in
  47. 10 2
      fltk/configh.in
  48. 381 336
      fltk/configure
  49. 1396 1404
      fltk/configure.in
  50. 6 4
      fltk/fltk-config
  51. 2 0
      fltk/fltk-config.cmake.in
  52. 4 2
      fltk/fltk-config.in
  53. 3 3
      fltk/fltk.list
  54. 1 1
      fltk/fltk.spec
  55. 3 3
      fltk/fluid/CodeEditor.cxx
  56. 2 2
      fltk/fluid/CodeEditor.h
  57. 2 2
      fltk/fluid/Fl_Type.cxx
  58. 2 2
      fltk/fluid/Fl_Type.h
  59. 10 2
      fltk/fluid/Fl_Widget_Type.cxx
  60. 3 3
      fltk/fluid/about_panel.cxx
  61. 5 5
      fltk/fluid/about_panel.fl
  62. 2 2
      fltk/fluid/about_panel.h
  63. 2 2
      fltk/fluid/alignment_panel.fl
  64. 16 3
      fltk/fluid/factory.cxx
  65. 2 2
      fltk/fluid/fluid.app/Contents/Info.plist
  66. 2 2
      fltk/fluid/fluid.cxx
  67. 10 6
      fltk/fluid/function_panel.fl
  68. 2 2
      fltk/makeinclude
  69. 3 0
      fltk/makesrcdist
  70. 39 0
      fltk/misc/cp1252.html
  71. 39 0
      fltk/misc/cp1252_utf-8.html
  72. 16 8
      fltk/src/CMakeLists.txt
  73. 182 63
      fltk/src/Fl.cxx
  74. 67 66
      fltk/src/Fl_Bitmap.cxx
  75. 5 4
      fltk/src/Fl_Button.cxx
  76. 399 0
      fltk/src/Fl_Copy_Surface.cxx
  77. 6 4
      fltk/src/Fl_Double_Window.cxx
  78. 111 5
      fltk/src/Fl_File_Browser.cxx
  79. 11 2
      fltk/src/Fl_File_Chooser2.cxx
  80. 10 5
      fltk/src/Fl_File_Icon2.cxx
  81. 2 3
      fltk/src/Fl_Font.H
  82. 7 3
      fltk/src/Fl_GDI_Printer.cxx
  83. 6 31
      fltk/src/Fl_Gl_Device_Plugin.cxx
  84. 40 10
      fltk/src/Fl_Gl_Window.cxx
  85. 18 3
      fltk/src/Fl_Image.cxx
  86. 158 0
      fltk/src/Fl_Image_Surface.cxx
  87. 29 11
      fltk/src/Fl_Input.cxx
  88. 7 7
      fltk/src/Fl_Input_.cxx
  89. 33 29
      fltk/src/Fl_JPEG_Image.cxx
  90. 1 1
      fltk/src/Fl_Menu_Button.cxx
  91. 3 2
      fltk/src/Fl_Menu_Window.cxx
  92. 308 255
      fltk/src/Fl_Native_File_Chooser_FLTK.cxx
  93. 700 0
      fltk/src/Fl_Native_File_Chooser_GTK.cxx
  94. 70 38
      fltk/src/Fl_Native_File_Chooser_MAC.mm
  95. 87 51
      fltk/src/Fl_Native_File_Chooser_WIN32.cxx
  96. 3 2
      fltk/src/Fl_Native_File_Chooser_common.cxx
  97. 17 15
      fltk/src/Fl_PNG_Image.cxx
  98. 12 6
      fltk/src/Fl_Paged_Device.cxx
  99. 13 6
      fltk/src/Fl_PostScript.cxx
  100. 1 1
      fltk/src/Fl_Printer.cxx

+ 84 - 10
fltk/CHANGES

@@ -1,12 +1,86 @@
-CHANGES IN FLTK 1.3.3
-
+CHANGES IN FLTK 1.3.3                                              RELEASED: MMM DD YYYY
+
+	- on Linux/Unix, class Fl_Native_File_Chooser uses file dialogs of the Gnome
+	  environment (provided by the libgtk dynamic library), when this is available,
+	  and falls back to FLTK's Fl_File_Chooser, when it's not (STR #3088).
+        - added class Fl_Copy_Surface allowing to copy graphical data to the clipboard 
+	  in a cross-platform way (STR #3058).
+	- added support for pasting graphical data from the clipboard to an FLTK widget.
+	- added class Fl_Image_Surface allowing to draw into an Fl_Image object. 
+	- removed constraint that lines are limited to 1024 chars in widget labels and browser lines (STR #2990).
+	- fix crash if Fl_Window::flush() was called, but window not shown() (STR #3028).
+	- new method Fl::scheme_is(const char *name) returns 1 if current scheme is name.
+	- Fixed recent MinGW build WRT configure not finding strcasecmp() (STR #2994).
+	  Note: This fix is temporary and should be revisited later.
+	- Fixed missing libdl dependency in CMake builds (STR #2977).
+	- Fixed segfault in fl_set_fonts_xft.cxx when loading fonts not named
+	  as expected (STR #2976).
+	- Removed autoconf/configure and CMake tests and defines for
+	  unused function strtoll().
 	- Fixed access of protected member (STR #2903)
 	- Fixed access of protected member (STR #2903)
 	- Implemented support for the Mac OS text input system that deals with character composition
 	- Implemented support for the Mac OS text input system that deals with character composition
-	and input of languages with large character sets (e.g., Chinese and Japanese). This
-	implementation has been reported to work well for Chinese. Superficial testing suggests
-	it's also operational for Japanese. In-depth testing remains needed though.
-
-CHANGES IN FLTK 1.3.2
+	  and input of languages with large character sets (e.g., Chinese and Japanese). This
+	  implementation has been reported to work well for Chinese. Superficial testing suggests
+	  it's also operational for Japanese. In-depth testing remains needed though.
+	- Mac OS version of Fl_Native_File_Chooser: when using filters in a save file dialog,
+	  the output file extension gets changed when the user modifies the output file type.
+	- Removed the now unused src/Fl_mac.cxx
+	- Fixed various Mac specific opengl issues (STR #2944)
+        - Added new method Fl_Widget::top_window() (STR #2948)
+        - Added new method Fl_Widget::top_window_offset() (part of STR #2944)
+	- Added ability to get notifications whenever the clipboard changes (STR#2636)
+	  New methods:
+	      Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data = 0)
+	      Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h)
+        - Fl_Tree_Item: added four new public accessor methods:
+	    label_x(), label_y(), label_w(), label_h().
+	    (Useful for new item_draw_callback() ABI feature)
+
+    1.3.3 ABI FEATURES
+	  (To enable the following ABI features, put: #define FLTK_ABI_VERSION 10303
+	  at the top of your FL/Enumerations.H and rebuild FLTK and your app)
+
+	- Made Fl_Help_View::handle() public and Fl_Help_View::draw() protected
+	  to enable inheritance and for consistency (STR #2834).
+	  Note: both methods were private.
+	- Added Fl_Table::tab_cell_nav() for controlling Tab key navigation of table
+	- Added Fl_Tree::get_selected_items(), returns the selected items as an array
+        - Added Fl_Tree::item_draw_callback(), letting one define a custom draw function
+	           for Fl_Tree_Item's.
+	- Fl_Tree: various related changes:
+	    o Added horizontal scrollbar
+	    o Separated draw() and tree size calculation
+	    o Added new public methods:
+	        > resize()           -- uses optimized dim calc, avoids tree recalc
+		> next_item()        -- added parameters: direction, visibility
+		> extend_selection() -- added parameters, improved algorithm
+		> calc_dimensions()  -- calc tix/y/w/h, tox/y/w/h and scrollbars
+		> calc_tree()        -- calc tree_w/tree_h
+		> recalc_tree()      -- schedules calc_tree()
+		> first_visible_item(), last_visible_item(), next_visible_item()
+		> first_selected_item(), last_selected_item(), next_selected_item()
+	    o Added protected variables:
+	        > _tix/y/w/h      -- tree widget 'inner' dimension
+		> _tox/y/w/h      -- tree widget 'outer' dimension
+		> _tree_w,_tree_h -- entire tree hierarchy width/height
+	    o Deprecated:
+	        > item_clicked() -- use callback_item() instead
+		> first_visible() -- use first_visible_item() instead
+		> last_visible() -- use last_visible_item() instead
+
+	- Fl_Tree_Item: various related changes:
+	    o Added Fl_Tree ptr: needed for auto-recalc when item modified directly
+	    o Added new methods tree(), recalc_tree()
+	    o Added new ctor that accepts Fl_Tree*
+	    o draw() parameters changed to include tree size calculations
+	    o Deprecated:
+	       > ctor using Fl_Tree_Prefs parameter (Fl_Tree* version better,
+	         and must be used for 1.3.3 ABI features to work correctly)
+	       > next_displayed() -- use next_visible() instead
+	       > prev_displayed() -- use prev_visible() instead
+	- test/tree: added tests for newly added features
+
+CHANGES IN FLTK 1.3.2                                              RELEASED: Dec 12 2012
 
 
 	- Removed unnecessary drawing calls (STR #2898)
 	- Removed unnecessary drawing calls (STR #2898)
         - Fixed regression in FLTK 1.3.1 for unbundled Mac OS FLTK applications that
         - Fixed regression in FLTK 1.3.1 for unbundled Mac OS FLTK applications that
@@ -16,10 +90,10 @@ CHANGES IN FLTK 1.3.2
 	- Prevents scrollbars from drawing when widget is sized too small to be visible (STR #2886).
 	- Prevents scrollbars from drawing when widget is sized too small to be visible (STR #2886).
 	- Documented how to make a Mac OS X FLTK application launchable by dropping files on its icon.
 	- Documented how to make a Mac OS X FLTK application launchable by dropping files on its icon.
 	- Fixed a Mac-specific issue appeared with OS 10.8 (Mountain Lion): long delay before
 	- Fixed a Mac-specific issue appeared with OS 10.8 (Mountain Lion): long delay before
-	opening when the application is started by dragging a file on the application icon.
-	- Fixed use of PNG image from im-memory data (STR #2884).
+	  opening when the application is started by dragging a file on the application icon.
+	- Fixed use of PNG image from in-memory data (STR #2884).
 	- Added static Fl_RGB_Image::max_size(size_t) to limit the maximum memory size allowed to
 	- Added static Fl_RGB_Image::max_size(size_t) to limit the maximum memory size allowed to
-	RGB images (STR #2881).
+	  RGB images (STR #2881).
 
 
 CHANGES IN FLTK 1.3.1
 CHANGES IN FLTK 1.3.1
 
 

+ 10 - 640
fltk/CMakeLists.txt

@@ -1,8 +1,8 @@
 #
 #
-# "$Id: CMakeLists.txt 9679 2012-09-13 14:19:01Z manolo $"
+# "$Id: CMakeLists.txt 10098 2014-02-09 18:41:29Z AlbrechtS $"
 #
 #
 # Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
 # Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
-# Written by Andy Cedilnik and Julien Jomier
+# Written by Michael Surette
 #
 #
 # Copyright 1998-2010 by Bill Spitzak and others.
 # Copyright 1998-2010 by Bill Spitzak and others.
 #
 #
@@ -17,613 +17,28 @@
 #     http://www.fltk.org/str.php
 #     http://www.fltk.org/str.php
 #
 #
 
 
-#######################################################################
-# basic setup
-#######################################################################
 project(FLTK)
 project(FLTK)
-cmake_minimum_required(VERSION 2.6)
-
-# The FLTK version
-set(FLTK_VERSION_MAJOR "1")
-set(FLTK_VERSION_MINOR "3")
-set(FLTK_VERSION_PATCH "0")
-set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
-set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
-
-set(EXECUTABLE_OUTPUT_PATH ${FLTK_BINARY_DIR}/bin)
-set(LIBRARY_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
-set(ARCHIVE_OUTPUT_PATH ${FLTK_BINARY_DIR}/lib)
-
-# Search for modules in the FLTK source dir first
-set(CMAKE_MODULE_PATH "${FLTK_SOURCE_DIR}/CMake")
-
-include_directories(${FLTK_BINARY_DIR} ${FLTK_SOURCE_DIR})
+cmake_minimum_required(VERSION 2.8)
 
 
 #######################################################################
 #######################################################################
-# platform dependent information
+# basic setup
 #######################################################################
 #######################################################################
-
-include(TestBigEndian)
-TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
-
-if(APPLE)
-   set(__APPLE_QUARTZ__ 1)
-   set(HAVE_STRTOLL 1)
-   set(HAVE_STRCASECMP 1)
-   set(HAVE_DIRENT_H 1)
-   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa")
-endif(APPLE)
-
-if(WIN32)
-   if(MSVC)
-      add_definitions(-DWIN32_LEAN_AND_MEAN)
-      add_definitions(-D_CRT_SECURE_NO_WARNINGS)
-   endif(MSVC)
-   if(CMAKE_C_COMPILER_ID STREQUAL GNU)
-      set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows")
-   endif(CMAKE_C_COMPILER_ID STREQUAL GNU)
-   if(MINGW AND EXISTS /mingw)
-      list(APPEND CMAKE_PREFIX_PATH /mingw)
-	endif(MINGW AND EXISTS /mingw)
-endif(WIN32)
-
-#######################################################################
-# size of ints
-include(CheckTypeSize)
-
-CHECK_TYPE_SIZE(short SIZEOF_SHORT)
-CHECK_TYPE_SIZE(int   SIZEOF_INT)
-CHECK_TYPE_SIZE(long  SIZEOF_LONG)
-CHECK_TYPE_SIZE("long long"  HAVE_LONG_LONG)
-
-if(${SIZEOF_SHORT} MATCHES "^2$")
-   set(U16 "unsigned short")
-endif(${SIZEOF_SHORT} MATCHES "^2$")
-
-if(${SIZEOF_INT} MATCHES "^4$")
-   set(U32 "unsigned")
-else()
-   if(${SIZEOF_LONG} MATCHES "^4$")
-      set(U32 "unsigned long")
-   endif(${SIZEOF_LONG} MATCHES "^4$")
-endif(${SIZEOF_INT} MATCHES "^4$")
-
-if(${SIZEOF_INT} MATCHES "^8$")
-   set(U64 "unsigned")
-else()
-   if(${SIZEOF_LONG} MATCHES "^8$")
-      set(U64 "unsigned long")
-   endif(${SIZEOF_LONG} MATCHES "^8$")
-endif(${SIZEOF_INT} MATCHES "^8$")
+include(CMake/setup.cmake)
 
 
 #######################################################################
 #######################################################################
 # check for headers, libraries and functions
 # check for headers, libraries and functions
 #######################################################################
 #######################################################################
-# headers
-find_file(HAVE_ALSA_ASOUNDLIB_H alsa/asoundlib.h)
-find_file(HAVE_DIRENT_H dirent.h)
-find_file(HAVE_DLFCN_H dlfcn.h)
-find_file(HAVE_FREETYPE_H freetype.h PATH_SUFFIXES freetype2)
-find_file(HAVE_GL_GL_H GL/gl.h)
-find_file(HAVE_GL_GLU_H GL/glu.h)
-find_file(HAVE_LIBPNG_PNG_H libpng/png.h)
-find_file(HAVE_LOCALE_H locale.h)
-find_file(HAVE_NDIR_H ndir.h)
-find_file(HAVE_OPENGL_GLU_H OpenGL/glu.h)
-find_file(HAVE_PNG_H png.h)
-find_file(HAVE_PTHREAD_H pthread.h)
-find_file(HAVE_STDIO_H stdio.h)
-find_file(HAVE_STRINGS_H strings.h)
-find_file(HAVE_SYS_DIR_H sys/dir.h)
-find_file(HAVE_SYS_NDIR_H sys/ndir.h)
-find_file(HAVE_SYS_SELECT_H sys/select.h)
-find_file(HAVE_SYS_STDTYPES_H sys/stdtypes.h)
-find_path(HAVE_XDBE_H Xdbe.h PATH_SUFFIXES X11/extensions extensions)
-
-mark_as_advanced(HAVE_ALSA_ASOUNDLIB_H HAVE_DIRENT_H HAVE_DLFCN_H)
-mark_as_advanced(HAVE_FREETYPE_H HAVE_GL_GL_H HAVE_GL_GLU_H)
-mark_as_advanced(HAVE_LIBPNG_PNG_H HAVE_LOCALE_H HAVE_NDIR_H)
-mark_as_advanced(HAVE_OPENGL_GLU_H HAVE_PNG_H HAVE_PTHREAD_H)
-mark_as_advanced(HAVE_STDIO_H HAVE_STRINGS_H HAVE_SYS_DIR_H)
-mark_as_advanced(HAVE_SYS_NDIR_H HAVE_SYS_SELECT_H)
-mark_as_advanced(HAVE_SYS_STDTYPES_H HAVE_XDBE_H)
-
-# where to find freetype headers
-find_path(FREETYPE_PATH freetype/config/ftheader.h PATH_SUFFIXES freetype2)
-if(FREETYPE_PATH)
-   include_directories(${FREETYPE_PATH})
-endif(FREETYPE_PATH)
-mark_as_advanced(FREETYPE_PATH)
-
-#######################################################################
-# libraries
-find_library(LIB_CAIRO cairo)
-find_library(LIB_fontconfig fontconfig)
-find_library(LIB_freetype freetype)
-find_library(LIB_GL GL)
-find_library(LIB_MesaGL MesaGL)
-find_library(LIB_jpeg jpeg)
-find_library(LIB_png png)
-find_library(LIB_zlib z)
-
-mark_as_advanced(LIB_CAIRO LIB_fontconfig LIB_freetype)
-mark_as_advanced(LIB_GL LIB_MesaGL)
-mark_as_advanced(LIB_jpeg LIB_png LIB_zlib)
-
-#######################################################################
-# functions
-include(CheckFunctionExists)
-
-if(HAVE_DLFCN_H)
-   set(CMAKE_REQUIRED_LIBRARIES dl)
-   set(HAVE_DLFCN_H 1)
-endif(HAVE_DLFCN_H)
-CHECK_FUNCTION_EXISTS(dlsym                  HAVE_DLSYM)
-
-CHECK_FUNCTION_EXISTS(localeconv             HAVE_LOCALECONV)
-
-if(LIB_png)
-   set(CMAKE_REQUIRED_LIBRARIES png)
-endif(LIB_png)
-CHECK_FUNCTION_EXISTS(png_get_valid          HAVE_PNG_GET_VALID)
-CHECK_FUNCTION_EXISTS(png_set_tRNS_to_alpha  HAVE_PNG_SET_TRNS_TO_ALPHA)
-
-CHECK_FUNCTION_EXISTS(scandir                HAVE_SCANDIR)
-CHECK_FUNCTION_EXISTS(snprintf               HAVE_SNPRINTF)
-
-# not really true but we convert strcasecmp calls to _stricmp calls in flstring.h
-if(MSVC)
-   set(HAVE_STRCASECMP 1)
-endif(MSVC)
-CHECK_FUNCTION_EXISTS(strcasecmp             HAVE_STRCASECMP)
-
-CHECK_FUNCTION_EXISTS(strlcat                HAVE_STRLCAT)
-CHECK_FUNCTION_EXISTS(strlcpy                HAVE_STRLCPY)
-CHECK_FUNCTION_EXISTS(strtoll                HAVE_STRTOLL)
-CHECK_FUNCTION_EXISTS(vsnprintf              HAVE_VSNPRINTF)
-
-set(CMAKE_REQUIRED_LIBRARIES)
-
-if(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX AND NOT APPLE)
-   set(MSG "POSIX compatible scandir")
-   message(STATUS "Looking for ${MSG}")
-   try_compile(V
-      ${FLTK_BINARY_DIR}
-      ${FLTK_SOURCE_DIR}/CMake/posixScandir.cxx
-      )
-   if(V)
-      message(STATUS "${MSG} - found")
-      set(HAVE_SCANDIR_POSIX 1 CACHE INTERNAL "")
-   else()
-      message(STATUS "${MSG} - not found")
-      set(HAVE_SCANDIR_POSIX HAVE_SCANDIR_POSIX-NOTFOUND)
-   endif(V)
-endif(HAVE_SCANDIR AND NOT HAVE_SCANDIR_POSIX AND NOT APPLE)
-mark_as_advanced(HAVE_SCANDIR_POSIX)
+include(CMake/resources.cmake)
 
 
 #######################################################################
 #######################################################################
 # options
 # options
 #######################################################################
 #######################################################################
-set(OPTION_OPTIM ""
-   CACHE STRING
-   "custom optimization flags"
-   )
-add_definitions(${OPTION_OPTIM})
-
-#######################################################################
-set(OPTION_ARCHFLAGS ""
-   CACHE STRING
-   "custom architecture flags"
-   )
-add_definitions(${OPTION_ARCHFLAGS})
-
-#######################################################################
-set(OPTION_PREFIX_BIN ""
-   CACHE STRING
-   "where to install executables - leave empty to use {CMAKE_INSTALL_PREFIX}/bin"
-   )
-
-if(OPTION_PREFIX_BIN)
-   set(PREFIX_BIN ${OPTION_PREFIX_BIN} CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_BIN ${CMAKE_INSTALL_PREFIX}/bin CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_BIN)
+include(CMake/options.cmake)
 
 
 #######################################################################
 #######################################################################
-set(OPTION_PREFIX_LIB ""
-   CACHE STRING
-   "where to install libraries - leave empty to use {CMAKE_INSTALL_PREFIX}/lib"
-   )
-
-if(OPTION_PREFIX_LIB)
-   set(PREFIX_LIB ${OPTION_PREFIX_LIB} CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_LIB ${CMAKE_INSTALL_PREFIX}/lib CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_LIB)
-
+# final config and export
 #######################################################################
 #######################################################################
-set(OPTION_PREFIX_INCLUDE ""
-   CACHE STRING
-   "where to install include files - leave empty to use {CMAKE_INSTALL_PREFIX}/include"
-   )
-
-if(OPTION_PREFIX_INCLUDE)
-   set(PREFIX_INCLUDE ${OPTION_PREFIX_INCLUDE} CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_INCLUDE ${CMAKE_INSTALL_PREFIX}/include CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_INCLUDE)
-
-#######################################################################
-set(OPTION_PREFIX_DATA ""
-   CACHE STRING
-   "where to install data files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/FLTK"
-   )
-
-if(OPTION_PREFIX_DATA)
-   set(PREFIX_DATA ${OPTION_PREFIX_DATA} CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_DATA ${CMAKE_INSTALL_PREFIX}/share/FLTK CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_DATA)
-
-#######################################################################
-set(OPTION_PREFIX_DOC ""
-   CACHE STRING
-   "where to install doc files - leave empty to use {CMAKE_INSTALL_PREFIX}/share/doc/FLTK"
-   )
-
-if(OPTION_PREFIX_DOC)
-   set(PREFIX_DOC ${OPTION_PREFIX_DOC} CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_DOC ${CMAKE_INSTALL_PREFIX}/share/doc/FLTK CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_DOC)
-
-#######################################################################
-if(WIN32)
-   set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/CMake")
-elseif(APPLE)
-   set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/FLTK/.framework/Resources/CMake")
-else()
-   set(DEFAULT_CONFIG "${CMAKE_INSTALL_PREFIX}/lib/FLTK-${FLTK_VERSION}")
-endif(WIN32)
-
-set(OPTION_PREFIX_CONFIG ""
-   CACHE STRING
-   "where to install CMake config files - leave empty to use ${DEFAULT_CONFIG}"
-   )
-
-if(OPTION_PREFIX_CONFIG)
-   set(PREFIX_CONFIG "${OPTION_PREFIX_CONFIG}" CACHE INTERNAL "" FORCE)
-else()
-   set(PREFIX_CONFIG "${DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE)
-endif(OPTION_PREFIX_CONFIG)
-
-#######################################################################
-if(CMAKE_HOST_UNIX)
-   set(OPTION_PREFIX_MAN ""
-      CACHE STRING
-      "where to install man files - leave empty to use {CMAKE_INSTALL_PREFIX}/man"
-      )
-
-   if(OPTION_PREFIX_MAN)
-      set(PREFIX_MAN ${OPTION_PREFIX_MAN} CACHE INTERNAL "" FORCE)
-   else()
-      set(PREFIX_MAN ${CMAKE_INSTALL_PREFIX}/man CACHE INTERNAL "" FORCE)
-   endif(OPTION_PREFIX_MAN)
-
-   option(OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
-endif(CMAKE_HOST_UNIX)
-
-#######################################################################
-if(APPLE)
-   option(OPTION_APPLE_X11 "use X11" OFF)
-endif(APPLE)
-
-if(NOT APPLE OR OPTION_APPLE_X11)
-   include(FindX11)
-   if(X11_FOUND)
-      set(USE_X11 1)
-      list(APPEND FLTK_CFLAGS -DUSE_X11)
-      list(APPEND FLTK_LDLIBS -lX11)
-   endif(X11_FOUND)
-endif(NOT APPLE OR OPTION_APPLE_X11)
-
-#######################################################################
-option(OPTION_USE_POLL "use poll if available" OFF)
-
-if(OPTION_USE_POLL)
-   CHECK_FUNCTION_EXISTS(poll USE_POLL)
-endif(OPTION_USE_POLL)
-
-#######################################################################
-option(OPTION_BUILD_SHARED_LIBS "Build shared libraries" OFF)
-
-#######################################################################
-option(OPTION_BUILD_EXAMPLES "build example programs" ON)
-
-#######################################################################
-include(FindPkgConfig)
-
-option(OPTION_CAIRO "use lib Cairo" OFF)
-option(OPTION_CAIROEXT
-   "use fltk code instrumentation for cairo extended use" OFF
-   )
-
-if(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO)
-   pkg_search_module(PKG_CAIRO cairo)
-endif(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO)
-
-if(PKG_CAIRO_FOUND)
-   set(FLTK_HAVE_CAIRO 1)
-   add_subdirectory(cairo)
-   list(APPEND FLTK_LDLIBS -lcairo -lpixman-1)
-   include_directories(${PKG_CAIRO_INCLUDE_DIRS})
-   string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}")
-endif(PKG_CAIRO_FOUND)
-
-if(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND)
-   set(FLTK_USE_CAIRO 1)
-   set(FLTK_CAIRO_FOUND TRUE)
-else()
-   set(FLTK_CAIRO_FOUND FALSE)
-endif(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND)
-
-#######################################################################
-set(HAVE_GL LIB_GL OR LIB_MesaGL)
-
-if(HAVE_GL)
-   option(OPTION_USE_GL "use OpenGL" ON)
-endif(HAVE_GL)
-
-if(OPTION_USE_GL)
-   include(FindOpenGL)
-endif(OPTION_USE_GL)
-
-if(OPENGL_FOUND)
-   set(CMAKE_REQUIRED_INCLUDES ${OPENGL_INCLUDE_DIR}/GL)
-   set(CMAKE_REQUIRED_LIBRARIES -lGLU -lGL)
-   CHECK_FUNCTION_EXISTS(glXGetProcAddressARB HAVE_GLXGETPROCADDRESSARB)
-   set(FLTK_GL_FOUND TRUE)
-else()
-   set(FLTK_GL_FOUND FALSE)
-endif(OPENGL_FOUND)
-
-#######################################################################
-option(OPTION_USE_THREADS "use multi-threading" ON)
-
-if(OPTION_USE_THREADS)
-   include(FindThreads)
-endif(OPTION_USE_THREADS)
-
-if(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY)
-   add_definitions("-D_THREAD_SAFE -D_REENTRANT")
-   set(USE_THREADS 1)
-   set(FLTK_THREADS_FOUND TRUE)
-else()
-   set(FLTK_THREADS_FOUND FALSE)
-endif(OPTION_USE_THREADS AND CMAKE_HAVE_THREADS_LIBRARY)
-
-if(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT)
-   set(HAVE_PTHREAD 1)
-   list(APPEND FLTK_LDLIBS -lpthread)
-   list(APPEND FLTK_CFLAGS -D_THREAD_SAFE -D_REENTRANT)
-   set(FLTK_PTHREADS_FOUND TRUE)
-else()
-   set(HAVE_PTHREAD 0)
-   set(HAVE_PTHREAD_H 0)
-   set(FLTK_PTHREADS_FOUND FALSE)
-endif(OPTION_USE_THREADS AND CMAKE_USE_PTHREADS_INIT)
-
-#######################################################################
-option(OPTION_LARGE_FILE "enable large file support" ON)
-
-if(OPTION_LARGE_FILE)
-   if(NOT MSVC)
-      add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
-      list(APPEND FLTK_CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
-   endif(NOT MSVC)
-endif(OPTION_LARGE_FILE)
-
-#######################################################################
-option(OPTION_USE_SYSTEM_LIBJPEG "Use's system libjpeg" ON)
-
-if(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
-   include(FindJPEG)
-endif(OPTION_USE_SYSTEM_LIBJPEG AND LIB_jpeg)
-
-if(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
-   set(FLTK_JPEG_LIBRARIES ${JPEG_LIBRARIES})
-   include_directories(${JPEG_INCLUDE_DIR})
-   set(FLTK_BUILTIN_JPEG_FOUND FALSE)
-else()
-   add_subdirectory(jpeg)
-   set(FLTK_JPEG_LIBRARIES fltk_jpeg)
-   include_directories(${FLTK_SOURCE_DIR}/jpeg)
-   set(FLTK_BUILTIN_JPEG_FOUND TRUE)
-endif(OPTION_USE_SYSTEM_LIBJPEG AND JPEG_FOUND)
-
-if(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
-   message(STATUS "\ncannot find system jpeg library - using built-in\n")
-endif(OPTION_USE_SYSTEM_LIBJPEG AND NOT JPEG_FOUND)
-
-set(HAVE_LIBJPEG 1)
-
-#######################################################################
-option(OPTION_USE_SYSTEM_ZLIB "Use's system zlib" ON)
-
-if(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib)
-   include(FindZLIB)
-endif(OPTION_USE_SYSTEM_ZLIB AND LIB_zlib)
-
-if(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
-   set(FLTK_ZLIB_LIBRARIES ${ZLIB_LIBRARIES})
-   include_directories(${ZLIB_INCLUDE_DIRS})
-   set(FLTK_BUILTIN_ZLIB_FOUND FALSE)
-else()
-   add_subdirectory(zlib)
-   set(FLTK_ZLIB_LIBRARIES fltk_z)
-   set(ZLIB_INCLUDE_DIR ${FLTK_SOURCE_DIR}/zlib)
-   include_directories(${FLTK_SOURCE_DIR}/zlib)
-   set(FLTK_BUILTIN_ZLIB_FOUND TRUE)
-endif(OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)
-
-if(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND)
-   message(STATUS "\ncannot find system zlib library - using built-in\n")
-endif(OPTION_USE_SYSTEM_ZLIB AND NOT ZLIB_FOUND)
-
-set(HAVE_LIBZ 1)
-
-#######################################################################
-option(OPTION_USE_SYSTEM_LIBPNG "Use's system libpng" ON)
-
-if(OPTION_USE_SYSTEM_LIBPNG AND LIB_png)
-   include(FindPNG)
-endif(OPTION_USE_SYSTEM_LIBPNG AND LIB_png)
-
-if(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)
-   set(FLTK_PNG_LIBRARIES ${PNG_LIBRARIES})
-   include_directories(${PNG_INCLUDE_DIR})
-   add_definitions(${PNG_DEFINITIONS})
-   set(FLTK_BUILTIN_PNG_FOUND FALSE)
-else()
-   add_subdirectory(png)
-   set(FLTK_PNG_LIBRARIES fltk_png)
-   set(HAVE_PNG_H 1)
-   set(HAVE_PNG_GET_VALID 1)
-   set(HAVE_PNG_SET_TRNS_TO_ALPHA 1)
-   include_directories(${FLTK_SOURCE_DIR}/png)
-   set(FLTK_BUILTIN_PNG_FOUND TRUE)
-endif(OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)
-
-if(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND)
-   message(STATUS "\ncannot find system png library - using built-in\n")
-endif(OPTION_USE_SYSTEM_LIBPNG AND NOT PNG_FOUND)
-
-set(HAVE_LIBPNG 1)
-
-#######################################################################
-if(X11_Xinerama_FOUND)
-   option(OPTION_USE_XINERAMA "use lib Xinerama" ON)
-endif(X11_Xinerama_FOUND)
-
-if(OPTION_USE_XINERAMA)
-   set(HAVE_XINERAMA ${X11_Xinerama_FOUND})
-   include_directories(${X11_Xinerama_INCLUDE_PATH})
-   list(APPEND FLTK_LDLIBS -lXinerama)
-   set(FLTK_XINERAMA_FOUND TRUE)
-else()
-   set(FLTK_XINERAMA_FOUND FALSE)
-endif(OPTION_USE_XINERAMA)
-
-#######################################################################
-if(X11_Xft_FOUND)
-   option(OPTION_USE_XFT "use lib Xft" ON)
-endif(X11_Xft_FOUND)
-
-if(OPTION_USE_XFT)
-   set(USE_XFT X11_Xft_FOUND)
-   list(APPEND FLTK_LDLIBS -lXft)
-   set(FLTK_XFT_FOUND TRUE)
-else()
-   set(FLTK_XFT_FOUND FALSE)
-endif(OPTION_USE_XFT)
-
-#######################################################################
-if(X11_FOUND)
-   option(OPTION_USE_XDBE "use lib Xdbe" ON)
-endif(X11_FOUND)
-
-if(OPTION_USE_XDBE AND HAVE_XDBE_H)
-   set(HAVE_XDBE 1)
-   set(FLTK_XDBE_FOUND TRUE)
-else()
-   set(FLTK_XDBE_FOUND FALSE)
-endif(OPTION_USE_XDBE AND HAVE_XDBE_H)
-
-#######################################################################
-# final setup and config
-#######################################################################
-# Set the fluid executable path
-if(CMAKE_CROSSCOMPILING)
-   find_file(FLUID_PATH
-      NAMES fluid fluid.exe
-      PATHS ENV PATH
-      NO_CMAKE_FIND_ROOT_PATH
-   )
-   add_executable(fluid IMPORTED)
-   set(FLTK_FLUID_EXECUTABLE ${FLUID_PATH})
-   set(FLTK_FLUID_PATH ${FLUID_PATH})
-   set_target_properties(fluid
-      PROPERTIES IMPORTED_LOCATION ${FLUID_PATH}
-   )
-else()
-   add_subdirectory(fluid)
-   set(FLTK_FLUID_EXECUTABLE fluid)
-   set(FLTK_FLUID_PATH ${PREFIX_BIN}/fluid)
-endif(CMAKE_CROSSCOMPILING)
-
-add_subdirectory(src)
-
-# generate FLTKConfig.cmake
-string(REPLACE ";" " " EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
-configure_file(
-   ${FLTK_SOURCE_DIR}/CMake/FLTKConfig.cmake.in
-   ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
-   @ONLY
-)
-
-# generate UseFLTK.cmake
-configure_file(
-   ${FLTK_SOURCE_DIR}/CMake/UseFLTK.cmake.in
-   ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
-   @ONLY
-)
-
-# generate config.h
-configure_file(
-   "${FLTK_SOURCE_DIR}/configh.cmake.in"
-   "${FLTK_BINARY_DIR}/config.h"
-   @ONLY
-)
-
-# generate fltk-config
-get_filename_component(CC ${CMAKE_C_COMPILER} NAME)
-get_filename_component(CXX ${CMAKE_CXX_COMPILER} NAME)
-
-string(REPLACE ";" " " C_FLAGS "${FLTK_CFLAGS}")
-
-if(X11_Xext_FOUND)
-   list(APPEND FLTK_LDLIBS -lXext)
-endif(X11_Xext_FOUND)
-string(REPLACE ";" " " LD_LIBS "${FLTK_LDLIBS}")
-
-configure_file(
-   "${FLTK_SOURCE_DIR}/fltk-config.cmake.in"
-   "${FLTK_BINARY_DIR}/fltk-config"
-   @ONLY
-)
-if(UNIX)
-   execute_process(COMMAND chmod 755 fltk-config
-      WORKING_DIRECTORY "${FLTK_BINARY_DIR}"
-   )
-endif(UNIX)
-
-if(OPTION_CREATE_LINKS)
-   configure_file(
-      "${FLTK_SOURCE_DIR}/CMake/install-symlinks.cmake.in"
-      "${FLTK_BINARY_DIR}/install-symlinks.cmake"
-      @ONLY
-   )
-endif(OPTION_CREATE_LINKS)
-
-# generate uninstall target
-configure_file(
-  "${CMAKE_CURRENT_SOURCE_DIR}/CMake/cmake_uninstall.cmake.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
-  @ONLY
-)
-add_custom_target(uninstall
-  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
-)
+include(CMake/export.cmake)
 
 
 #######################################################################
 #######################################################################
 # build examples - these have to be after fluid is built/imported
 # build examples - these have to be after fluid is built/imported
@@ -635,49 +50,4 @@ endif(OPTION_BUILD_EXAMPLES)
 #######################################################################
 #######################################################################
 # installation
 # installation
 #######################################################################
 #######################################################################
-
-install(DIRECTORY ${FLTK_SOURCE_DIR}/FL
-   DESTINATION ${PREFIX_INCLUDE} USE_SOURCE_PERMISSIONS
-   PATTERN ".svn" EXCLUDE
-)
-
-if(OPTION_CREATE_LINKS)
-   install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake)
-endif(OPTION_CREATE_LINKS)
-
-install(PROGRAMS ${FLTK_BINARY_DIR}/fltk-config
-   DESTINATION ${PREFIX_BIN}
-   OPTIONAL
-)
-
-install(EXPORT fltk-install
-   DESTINATION ${PREFIX_CONFIG}
-   FILE FLTKLibraries.cmake
-)
-
-install(FILES ${EXECUTABLE_OUTPUT_PATH}/FLTKConfig.cmake
-   DESTINATION ${PREFIX_CONFIG}
-)
-
-install(FILES ${EXECUTABLE_OUTPUT_PATH}/UseFLTK.cmake
-   DESTINATION ${PREFIX_CONFIG}
-)
-
-if(CMAKE_HOST_UNIX)
-   macro(INSTALL_MAN FILE LEVEL)
-   install(FILES
-      ${FLTK_SOURCE_DIR}/documentation/src/${FILE}.man
-      DESTINATION ${PREFIX_MAN}/man${LEVEL}
-      RENAME ${FILE}.${LEVEL}
-   )
-   endmacro(INSTALL_MAN FILE LEVEL)
-
-   INSTALL_MAN(fluid 1)
-   INSTALL_MAN(fltk-config 1)
-   INSTALL_MAN(fltk 3)
-   INSTALL_MAN(blocks 6)
-   INSTALL_MAN(checkers 6)
-   INSTALL_MAN(sudoku 6)
-
-endif(CMAKE_HOST_UNIX)
-
+include(CMake/install.cmake)

+ 16 - 8
fltk/CREDITS

@@ -1,8 +1,8 @@
-CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.0
+CREDITS - Fast Light Tool Kit (FLTK) Version 1.3.2
 --------------------------------------------------
 --------------------------------------------------
 
 
-    This file lists the people responsible for the toolkit you
-    are now using.  If you've looking for your name in lights
+    This file lists the people responsible for the toolkit you are
+    now using.  If you've been looking for your name in lights
     but we've forgotten you here, please use the report on the
     but we've forgotten you here, please use the report on the
     following page, and we'll update this file accordingly:
     following page, and we'll update this file accordingly:
 
 
@@ -14,12 +14,20 @@ CORE DEVELOPERS
     The following people do the day-to-day development of FLTK:
     The following people do the day-to-day development of FLTK:
 
 
 	Fabien Costantini ([email protected])
 	Fabien Costantini ([email protected])
+	Greg Ercolano
+	Manolo Gouy
+	Ian MacArthur
+	Matthias Melcher ([email protected])
+	Pierre Ossman
+	Albrecht Schlosser
+
+    These people have previously been active developers of FLTK:
+
 	Craig P. Earls
 	Craig P. Earls
 	Curtis Edwards ([email protected])
 	Curtis Edwards ([email protected])
 	Gustavo Hime ([email protected])
 	Gustavo Hime ([email protected])
 	Talbot Hughes
 	Talbot Hughes
 	Robert Kesterson ([email protected])
 	Robert Kesterson ([email protected])
-	Matthias Melcher ([email protected])
 	James Dean Palmer ([email protected])
 	James Dean Palmer ([email protected])
 	Vincent Penne ([email protected])
 	Vincent Penne ([email protected])
 	Bill Spitzak ([email protected])
 	Bill Spitzak ([email protected])
@@ -33,25 +41,25 @@ OTHER CONTRIBUTORS
     The following people have contributed fixes or enhancements
     The following people have contributed fixes or enhancements
     for FLTK:
     for FLTK:
 
 
+        Laszlo Z. Antal (LZA)
 	Teun Burgers
 	Teun Burgers
 	Paul Chambers
 	Paul Chambers
 	Stephen Davies
 	Stephen Davies
 	Yuri D'Elia
 	Yuri D'Elia
 	Domingo Alvarez Duarte
 	Domingo Alvarez Duarte
-	Greg Ercolano
 	Yuri Fedorchenko
 	Yuri Fedorchenko
 	George Garvey
 	George Garvey
 	Duncan Gibson
 	Duncan Gibson
-	Manolo Gouy
 	Mikael Hultgren
 	Mikael Hultgren
 	Stuart Levy
 	Stuart Levy
+	Jean-Marc Lienher (OksiD)
 	Howard Lightstone
 	Howard Lightstone
 	Mike Lindner
 	Mike Lindner
 	Alexander Mai
 	Alexander Mai
-	Pierre Ossman
 	Alexander Rabi
 	Alexander Rabi
 	James Roth
 	James Roth
-	Albrecht Schlosser
+	Ivan Nieto (Mr.Satan)
+	Jamie Snape
 	Andrea Suatoni
 	Andrea Suatoni
 	Michael Surette
 	Michael Surette
 	Paul Sydney
 	Paul Sydney

+ 23 - 5
fltk/FL/Enumerations.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Enumerations.H 9779 2012-12-26 19:44:56Z manolo $"
+// "$Id: Enumerations.H 10113 2014-02-25 04:24:41Z greg.ercolano $"
 //
 //
 // Enumerations for the Fast Light Tool Kit (FLTK).
 // Enumerations for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -520,6 +520,14 @@ enum Fl_Boxtype { // boxtypes (if you change these you must fix fl_boxtype.C):
   _FL_GTK_THIN_DOWN_FRAME,	///< gtk+ version of FL_THIN_DOWN_FRAME
   _FL_GTK_THIN_DOWN_FRAME,	///< gtk+ version of FL_THIN_DOWN_FRAME
   _FL_GTK_ROUND_UP_BOX,		///< gtk+ version of FL_ROUND_UP_BOX
   _FL_GTK_ROUND_UP_BOX,		///< gtk+ version of FL_ROUND_UP_BOX
   _FL_GTK_ROUND_DOWN_BOX,	///< gtk+ version of FL_ROUND_DOWN_BOX
   _FL_GTK_ROUND_DOWN_BOX,	///< gtk+ version of FL_ROUND_DOWN_BOX
+  _FL_GLEAM_UP_BOX,		///< gleam version of FL_GLEAM_UP_BOX
+  _FL_GLEAM_DOWN_BOX,		///< gleam version of FL_GLEAM_DOWN_BOX
+  _FL_GLEAM_UP_FRAME, 		///< gleam version of FL_GLEAM_UP_FRAME
+  _FL_GLEAM_DOWN_FRAME,		///< gleam version of FL_GLEAM_DOWN_FRAME
+  _FL_GLEAM_THIN_UP_BOX,    	///< gleam version of FL_GLEAM_THIN_UP_BOX
+  _FL_GLEAM_THIN_DOWN_BOX,	///< gleam version of FL_GLEAM_THIN_DOWN_BOX
+  _FL_GLEAM_ROUND_UP_BOX,   	///< gleam version of FL_GLEAM_ROUND_UP_BOX
+  _FL_GLEAM_ROUND_DOWN_BOX,	///< gleam version of FL_GLEAM_ROUND_DOWN_BOX
   FL_FREE_BOXTYPE		///< the first free box type for creation of new box types
   FL_FREE_BOXTYPE		///< the first free box type for creation of new box types
 };
 };
 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
 extern FL_EXPORT Fl_Boxtype fl_define_FL_ROUND_UP_BOX();
@@ -566,6 +574,16 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
 #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
 #define FL_GTK_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+8)
 #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
 #define FL_GTK_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GTK_UP_BOX()+9)
 
 
+extern FL_EXPORT Fl_Boxtype fl_define_FL_GLEAM_UP_BOX();
+#define FL_GLEAM_UP_BOX fl_define_FL_GLEAM_UP_BOX()
+#define FL_GLEAM_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+1)
+#define FL_GLEAM_UP_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+2)
+#define FL_GLEAM_DOWN_FRAME (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+3)
+#define FL_GLEAM_THIN_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+4)
+#define FL_GLEAM_THIN_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+5)
+#define FL_GLEAM_ROUND_UP_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+6)
+#define FL_GLEAM_ROUND_DOWN_BOX (Fl_Boxtype)(fl_define_FL_GLEAM_UP_BOX()+7)
+
 // conversions of box types to other boxtypes:
 // conversions of box types to other boxtypes:
 /**
 /**
   Get the filled version of a frame.
   Get the filled version of a frame.
@@ -755,7 +773,7 @@ extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE;	///< normal font size
     The Fl_Color type holds an FLTK color value.
     The Fl_Color type holds an FLTK color value.
 
 
     Colors are either 8-bit indexes into a virtual colormap
     Colors are either 8-bit indexes into a virtual colormap
-    or 24-bit RGB color values.
+    or 24-bit RGB color values. (See \ref drawing_colors for the default FLTK colormap)
 
 
     Color indices occupy the lower 8 bits of the value, while
     Color indices occupy the lower 8 bits of the value, while
     RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
     RGB colors occupy the upper 24 bits, for a byte organization of RGBI.
@@ -763,7 +781,7 @@ extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE;	///< normal font size
 <pre>
 <pre>
  Fl_Color => 0xrrggbbii
  Fl_Color => 0xrrggbbii
                 | | | |
                 | | | |
-                | | | +--- index between 0 and 255
+                | | | +--- \ref drawing_colors "index" between 0 and 255
                 | | +----- blue color component (8 bit)
                 | | +----- blue color component (8 bit)
                 | +------- green component (8 bit)
                 | +------- green component (8 bit)
                 +--------- red component (8 bit)
                 +--------- red component (8 bit)
@@ -774,7 +792,7 @@ extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE;	///< normal font size
 
 
  */
  */
 /*@{*/
 /*@{*/
-/** an FLTK color value */
+/** An FLTK color value; see also \ref drawing_colors  */
 typedef unsigned int Fl_Color;
 typedef unsigned int Fl_Color;
 
 
 // Standard colors. These are used as default colors in widgets and altered as necessary
 // Standard colors. These are used as default colors in widgets and altered as necessary
@@ -997,5 +1015,5 @@ enum Fl_Layout {
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Enumerations.H 9779 2012-12-26 19:44:56Z manolo $".
+// End of "$Id: Enumerations.H 10113 2014-02-25 04:24:41Z greg.ercolano $".
 //
 //

+ 150 - 16
fltk/FL/Fl.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl.H 9792 2013-01-13 15:25:37Z manolo $"
+// "$Id: Fl.H 10186 2014-06-07 12:01:59Z manolo $"
 //
 //
 // Main header file for the Fast Light Tool Kit (FLTK).
 // Main header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -109,6 +109,9 @@ typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i);
     \see Fl::event_dispatch(Fl_Event_Dispatch) */
     \see Fl::event_dispatch(Fl_Event_Dispatch) */
 typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
 typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
 
 
+/** Signature of add_clipboard_notify functions passed as parameters */
+typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data);
+
 /** signature of add_handler functions passed as parameters */
 /** signature of add_handler functions passed as parameters */
 typedef int (*Fl_Focus_Changing_Handler)(Fl_Widget *from, Fl_Widget *to);
 typedef int (*Fl_Focus_Changing_Handler)(Fl_Widget *from, Fl_Widget *to);
 
 
@@ -232,6 +235,8 @@ public: // should be private!
   static int e_keysym;
   static int e_keysym;
   static char* e_text;
   static char* e_text;
   static int e_length;
   static int e_length;
+  static void *e_clipboard_data;
+  static const char *e_clipboard_type;
   static Fl_Event_Dispatch e_dispatch;
   static Fl_Event_Dispatch e_dispatch;
   static Fl_Widget* belowmouse_;
   static Fl_Widget* belowmouse_;
   static Fl_Widget* pushed_;
   static Fl_Widget* pushed_;
@@ -266,8 +271,13 @@ public:
   typedef enum {
   typedef enum {
       /// When switched on, moving the text cursor beyond the start or end of
       /// When switched on, moving the text cursor beyond the start or end of
       /// a text in a text widget will change focus to the next text widget.
       /// a text in a text widget will change focus to the next text widget.
-      /// When switched off, the cursor will stop at the end of the text.
+      /// (This is considered 'old' behavior)
+      ///
+      /// When switched off (default), the cursor will stop at the end of the text.
       /// Pressing Tab or Ctrl-Tab will advance the keyboard focus.
       /// Pressing Tab or Ctrl-Tab will advance the keyboard focus.
+      ///
+      /// See also: Fl_Input_::tab_nav()
+      ///
     OPTION_ARROW_FOCUS = 0,
     OPTION_ARROW_FOCUS = 0,
       // When switched on, FLTK will use the file chooser dialog that comes 
       // When switched on, FLTK will use the file chooser dialog that comes 
       // with your operating system whenever possible. When switched off, FLTK
       // with your operating system whenever possible. When switched off, FLTK
@@ -279,19 +289,23 @@ public:
       // decides to choose the file.
       // decides to choose the file.
       // \todo implement me
       // \todo implement me
     //OPTION_FILECHOOSER_PREVIEW,
     //OPTION_FILECHOOSER_PREVIEW,
-      /// If visible focus is switched on, FLTK will draw a dotted rectangle 
+      /// If visible focus is switched on (default), FLTK will draw a dotted rectangle 
       /// inside the widget that will receive the next keystroke. If switched
       /// inside the widget that will receive the next keystroke. If switched
       /// off, no such indicator will be drawn and keyboard navigation
       /// off, no such indicator will be drawn and keyboard navigation
       /// is disabled.
       /// is disabled.
     OPTION_VISIBLE_FOCUS,
     OPTION_VISIBLE_FOCUS,
-      /// If text drag-and-drop is enabled, the user can select and drag text
+      /// If text drag-and-drop is enabled (default), the user can select and drag text
       /// from any text widget. If disabled, no dragging is possible, however
       /// from any text widget. If disabled, no dragging is possible, however
       /// dropping text from other applications still works.
       /// dropping text from other applications still works.
     OPTION_DND_TEXT,
     OPTION_DND_TEXT,
-      /// If tooltips are enabled, hovering the mouse over a widget with a 
+      /// If tooltips are enabled (default), hovering the mouse over a widget with a 
       /// tooltip text will open a little tooltip window until the mouse leaves
       /// tooltip text will open a little tooltip window until the mouse leaves
       /// the widget. If disabled, no tooltip is shown.
       /// the widget. If disabled, no tooltip is shown.
     OPTION_SHOW_TOOLTIPS,
     OPTION_SHOW_TOOLTIPS,
+     /// When switched on (default), Fl_Native_File_Chooser runs GTK file dialogs
+     /// if the GTK library is available on the platform (linux/unix only).
+     /// When switched off, GTK file dialogs aren't used even if the GTK library is available.
+    OPTION_FNFC_USES_GTK,
       // don't change this, leave it always as the last element
       // don't change this, leave it always as the last element
       /// For internal use only.
       /// For internal use only.
     OPTION_LAST
     OPTION_LAST
@@ -375,9 +389,40 @@ public:
   static void background2(uchar, uchar, uchar);
   static void background2(uchar, uchar, uchar);
 
 
   // schemes:
   // schemes:
-  static int scheme(const char*);
+  static int scheme(const char *name);
   /** See void scheme(const char *name) */
   /** See void scheme(const char *name) */
   static const char* scheme() {return scheme_;}
   static const char* scheme() {return scheme_;}
+
+  /** Returns whether the current scheme is the given name.
+
+    This is a fast inline convenience function to support scheme-specific
+    code in widgets, e.g. in their draw() methods, if required.
+
+    Use a valid scheme name, not \p NULL (although \p NULL is allowed,
+    this is not a useful argument - see below).
+
+    If Fl::scheme() has not been set or has been set to the default
+    scheme ("none" or "base"), then this will always return 0 regardless
+    of the argument, because Fl::scheme() is \p NULL in this case.
+
+    \note The stored scheme name is always lowercase, and this method will
+    do a case-sensitive compare, so you \b must provide a lowercase string to
+    return the correct value. This is intentional for performance reasons.
+
+    Example:
+    \code
+      if (Fl::is_scheme("gtk+")) { your_code_here(); }
+    \endcode
+
+    \param[in] name \b lowercase string of requested scheme name.
+
+    \return 1 if the given scheme is active, 0 otherwise.
+
+    \see Fl::scheme(const char *name)
+  */
+  static int is_scheme(const char *name) {
+    return (scheme_ && name && !strcmp(name,scheme_));
+  }
   /**
   /**
     Called by scheme according to scheme name.
     Called by scheme according to scheme name.
     Loads or reloads the current scheme selection.
     Loads or reloads the current scheme selection.
@@ -797,6 +842,16 @@ public:
     you paste a nul character.
     you paste a nul character.
   */
   */
   static int event_length() {return e_length;}
   static int event_length() {return e_length;}
+  
+  /** During an FL_PASTE event of non-textual data, returns a pointer to the pasted data.
+   The returned data is an Fl_Image * when the result of Fl::event_clipboard_type() is Fl::clipboard_image.
+   */
+  static void *event_clipboard() { return e_clipboard_data; }
+  /** Returns the type of the pasted data during an FL_PASTE event.
+   This type can be Fl::clipboard_plain_text or Fl::clipboard_image.
+   */
+  static const char *event_clipboard_type() {return e_clipboard_type; }
+
 
 
   static int compose(int &del);
   static int compose(int &del);
   static void compose_reset();
   static void compose_reset();
@@ -834,19 +889,35 @@ public:
   /**
   /**
   Copies the data pointed to by \p stuff to the selection buffer
   Copies the data pointed to by \p stuff to the selection buffer
   (\p destination is 0) or
   (\p destination is 0) or
-  the clipboard (\p destination is 1); \p len is the number of relevant
-  bytes in \p stuff.
+  the clipboard (\p destination is 1).
+  \p len is the number of relevant bytes in \p stuff.
+  \p type is always Fl::clipboard_plain_text.
   The selection buffer is used for
   The selection buffer is used for
   middle-mouse pastes and for drag-and-drop selections. The
   middle-mouse pastes and for drag-and-drop selections. The
   clipboard is used for traditional copy/cut/paste operations.
   clipboard is used for traditional copy/cut/paste operations.
   */
   */
-  static void copy(const char* stuff, int len, int destination = 0); // platform dependent
+#if FLTK_ABI_VERSION >= 10303 || defined(FL_DOXYGEN)
+  static void copy(const char* stuff, int len, int destination = 0, const char *type = Fl::clipboard_plain_text); // platform dependent
+#else
+  static void copy(const char* stuff, int len, int destination, const char *type);
+  static void copy(const char* stuff, int len, int destination = 0);
+#endif
+  
+#if !(defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN))
+  static void copy_image(const unsigned char* data, int W, int H, int destination = 0); // platform dependent
+#endif
   /**
   /**
-  Pastes the data from the selection buffer (\p source is 0) or the clipboard
-  (\p source is 1) into \p receiver.
-  Set things up so the receiver widget will be called with an FL_PASTE event some
-  time in the future with the data from the specified \p source in Fl::event_text()
-  and the number of characters in Fl::event_length().
+  Pastes the data from the selection buffer (\p source is 0) or the clipboard 
+  (\p source is 1) into \p receiver.  If \p source is 1,
+  the optional \p type argument indicates what type of data is requested from the clipboard
+  (at present, Fl::clipboard_plain_text - requesting text data - and 
+  Fl::clipboard_image - requesting image data - are possible).
+  Set things up so the handle function of the \p receiver widget will be called with an FL_PASTE event some
+  time in the future if the clipboard does contain data of the requested type. During processing of this event,
+  and if \p type is Fl::clipboard_plain_text, the text data from the specified \p source are in Fl::event_text()
+  with UTF-8 encoding, and the number of characters in Fl::event_length();
+  if \p type is Fl::clipboard_image, Fl::event_clipboard() returns a pointer to the
+  image data, as an Fl_Image *.
   The receiver
   The receiver
   should be prepared to be called \e directly by this, or for
   should be prepared to be called \e directly by this, or for
   it to happen \e later, or possibly <i>not at all</i>.  This
   it to happen \e later, or possibly <i>not at all</i>.  This
@@ -857,8 +928,59 @@ public:
   The selection buffer is used for middle-mouse pastes and for
   The selection buffer is used for middle-mouse pastes and for
   drag-and-drop selections. The clipboard is used for traditional
   drag-and-drop selections. The clipboard is used for traditional
   copy/cut/paste operations.
   copy/cut/paste operations.
+   
+   \par Platform details for image data:
+   \li Unix/Linux platform: Image data in PNG or BMP formats are recognized. Requires linking with the fltk_images library.
+   \li MSWindows platform: Both bitmap and vectorial (Enhanced metafile) data from clipboard
+   can be pasted as image data.
+   \li Mac OS X platform: Both bitmap (TIFF) and vectorial (PDF) data from clipboard
+   can be pasted as image data.
+    
+   */
+#if FLTK_ABI_VERSION >= 10303 || defined(FL_DOXYGEN)
+  static void paste(Fl_Widget &receiver, int source, const char *type = Fl::clipboard_plain_text); // platform dependent
+#else
+  static void paste(Fl_Widget &receiver, int source, const char *type);
+  static void paste(Fl_Widget &receiver, int source /*=0*/);
+#endif
+  /**
+  FLTK will call the registered callback whenever there is a change to the
+  selection buffer or the clipboard. The source argument indicates which
+  of the two has changed. Only changes by other applications are reported.
+
+  Example:
+  \code
+    void clip_callback(int source, void *data) {
+        if ( source == 0 ) printf("CLIP CALLBACK: selection buffer changed\n");
+	if ( source == 1 ) printf("CLIP CALLBACK: clipboard changed\n");
+    }
+    [..]
+    int main() {
+        [..]
+	Fl::add_clipboard_notify(clip_callback);
+	[..]
+    }
+  \endcode
+  \note Some systems require polling to monitor the clipboard and may
+  therefore have some delay in detecting changes.
   */
   */
-  static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
+  static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data = 0);
+  /**
+  Stop calling the specified callback when there are changes to the selection
+  buffer or the clipboard.
+  */
+  static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h);
+  /** Returns non 0 if the clipboard contains data matching \p type.
+   \p type can be Fl::clipboard_plain_text or Fl::clipboard_image.
+   */
+  static int clipboard_contains(const char *type);
+  /**  Denotes plain textual data
+   */
+  static char const * const clipboard_plain_text;
+  /**  Denotes image data
+   */
+  static char const * const clipboard_image;
+
   /**
   /**
     Initiate a Drag And Drop operation. The selection buffer should be
     Initiate a Drag And Drop operation. The selection buffer should be
     filled with relevant data before calling this method. FLTK will
     filled with relevant data before calling this method. FLTK will
@@ -906,6 +1028,8 @@ public:
   static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
   static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
   static void screen_xywh(int &X, int &Y, int &W, int &H, int n); 
   static void screen_xywh(int &X, int &Y, int &W, int &H, int n); 
   static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
   static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
+  static int screen_num(int x, int y);
+  static int screen_num(int x, int y, int w, int h);
   static void screen_dpi(float &h, float &v, int n=0);
   static void screen_dpi(float &h, float &v, int n=0);
   static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
   static void screen_work_area(int &X, int &Y, int &W, int &H, int mx, int my);
   static void screen_work_area(int &X, int &Y, int &W, int &H, int n);
   static void screen_work_area(int &X, int &Y, int &W, int &H, int n);
@@ -1118,6 +1242,16 @@ public:
   static void awake(void* message = 0);
   static void awake(void* message = 0);
   /** See void awake(void* message=0). */
   /** See void awake(void* message=0). */
   static int awake(Fl_Awake_Handler cb, void* message = 0);
   static int awake(Fl_Awake_Handler cb, void* message = 0);
+ 
+  // Cross platform sleep API
+
+  /** flexible sleep function in seconds, accepts decimals typically up to 100usec resolution (depends on your hardware) */
+  static void sleep(double seconds);
+  /** milli seconds sleep */
+  static void msleep(unsigned long milliseconds);
+  /** microseconds sleep */
+  static void usleep(unsigned long long microseconds);
+  
   /**
   /**
     The thread_message() method returns the last message
     The thread_message() method returns the last message
     that was sent from a child by the awake() method.
     that was sent from a child by the awake() method.
@@ -1301,5 +1435,5 @@ public:
 #endif // !Fl_H
 #endif // !Fl_H
 
 
 //
 //
-// End of "$Id: Fl.H 9792 2013-01-13 15:25:37Z manolo $".
+// End of "$Id: Fl.H 10186 2014-06-07 12:01:59Z manolo $".
 //
 //

+ 5 - 3
fltk/FL/Fl_Bitmap.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Bitmap.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Bitmap.H 10110 2014-02-22 14:51:50Z manolo $"
 //
 //
 // Bitmap header file for the Fast Light Tool Kit (FLTK).
 // Bitmap header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -33,6 +33,7 @@ class Fl_Menu_Item;
 class FL_EXPORT Fl_Bitmap : public Fl_Image {
 class FL_EXPORT Fl_Bitmap : public Fl_Image {
   friend class Fl_Quartz_Graphics_Driver;
   friend class Fl_Quartz_Graphics_Driver;
   friend class Fl_GDI_Graphics_Driver;
   friend class Fl_GDI_Graphics_Driver;
+  friend class Fl_GDI_Printer_Graphics_Driver;
   friend class Fl_Xlib_Graphics_Driver;
   friend class Fl_Xlib_Graphics_Driver;
 public:
 public:
 
 
@@ -42,7 +43,8 @@ public:
   int alloc_array;
   int alloc_array;
   
   
   private:
   private:
-
+  int start(int XP, int YP, int WP, int HP, int &cx, int &cy, 
+	    int &X, int &Y, int &W, int &H);
 #if defined(__APPLE__) || defined(WIN32)
 #if defined(__APPLE__) || defined(WIN32)
   /** for internal use */
   /** for internal use */
   void *id_;
   void *id_;
@@ -74,5 +76,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Bitmap, Fl_Image)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Bitmap.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Bitmap.H 10110 2014-02-22 14:51:50Z manolo $".
 //
 //

+ 21 - 2
fltk/FL/Fl_Browser_.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Browser_.H 9126 2011-10-04 13:10:55Z manolo $"
+// "$Id: Fl_Browser_.H 9846 2013-03-23 21:24:18Z greg.ercolano $"
 //
 //
 // Common browser header file for the Fast Light Tool Kit (FLTK).
 // Common browser header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -54,6 +54,25 @@
   useful if actually figuring out the size of an object requires
   useful if actually figuring out the size of an object requires
   accessing image data or doing stat() on a file or doing some
   accessing image data or doing stat() on a file or doing some
   other slow operation.
   other slow operation.
+
+  Keyboard navigation of browser items
+  ------------------------------------
+  The keyboard navigation of browser items is only possible if
+  visible_focus() is enabled. If disabled, the widget rejects keyboard focus;
+  Tab and Shift-Tab focus navigation will skip the widget.
+
+  In 'Select' and 'Normal' mode, the widget rejects keyboard focus;
+  no navigation keys are supported (other than scrollbar positioning).
+
+  In 'Hold' mode, the widget accepts keyboard focus, and Up/Down arrow
+  keys can navigate the selected item.
+
+  In 'Multi' mode, the widget accepts keyboard focus, and Up/Down arrow
+  keys navigate the focus box; Space toggles the current item's selection,
+  Enter selects only the current item (deselects all others).  If Shift
+  (or Ctrl) is combined with Up/Down arrow keys, the current item's
+  selection state is extended to the next item. In this way one can
+  extend a selection or de-selection.
 */
 */
 class FL_EXPORT Fl_Browser_ : public Fl_Group {
 class FL_EXPORT Fl_Browser_ : public Fl_Group {
   int position_;	// where user wants it scrolled to
   int position_;	// where user wants it scrolled to
@@ -367,5 +386,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Browser_, Fl_Group)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Browser_.H 9126 2011-10-04 13:10:55Z manolo $".
+// End of "$Id: Fl_Browser_.H 9846 2013-03-23 21:24:18Z greg.ercolano $".
 //
 //

+ 135 - 0
fltk/FL/Fl_Copy_Surface.H

@@ -0,0 +1,135 @@
+//
+// "$Id: Fl_Copy_Surface.H 10172 2014-05-24 16:21:46Z manolo $"
+//
+// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2014 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef Fl_Copy_Surface_H
+#define Fl_Copy_Surface_H
+
+#include <FL/Fl_Paged_Device.H>
+#include <FL/Fl_Printer.H>
+
+#if defined(__APPLE__)
+#include <ApplicationServices/ApplicationServices.h>
+#endif
+
+/** Supports copying of graphical data to the clipboard.
+ 
+ <br> After creation of an Fl_Copy_Surface object, call set_current() on it, and all subsequent graphics requests
+ will be recorded in the clipboard. It's possible to draw widgets (using Fl_Copy_Surface::draw()
+ ) or to use any of the \ref fl_drawings or the \ref fl_attributes.
+ Finally, delete the Fl_Copy_Surface object to load the clipboard with the graphical data.
+ <br> Fl_GL_Window 's can be copied to the clipboard as well. 
+ <br> Usage example:
+ \code
+ Fl_Widget *g = ...; // a widget you want to copy to the clipboard
+ Fl_Copy_Surface *copy_surf = new Fl_Copy_Surface(g->w(), g->h()); // create an Fl_Copy_Surface object
+ copy_surf->set_current(); // direct graphics requests to the clipboard
+ fl_color(FL_WHITE); fl_rectf(0, 0, g->w(), g->h()); // draw a white background
+ copy_surf->draw(g); // draw the g widget in the clipboard
+ delete copy_surf; // after this, the clipboard is loaded
+ Fl_Display_Device::display_device()->set_current();  // direct graphics requests back to the display
+ \endcode
+ Platform details:
+ \li MSWindows: Transparent RGB images copy without transparency.
+ The graphical data is copied to the clipboard as an 'enhanced metafile'.
+ \li Mac OS: The graphical data is copied to the clipboard (a.k.a. pasteboard) in 2 'flavors': 
+ 1) in vectorial form as PDF data; 2) in bitmap form as a TIFF image (or PICT for Mac OS 10.3). 
+ Applications to which the clipboard content is pasted can use the flavor that suits them best.
+ \li X11: the graphical data is copied to the clipboard as an image in BMP format.
+*/
+class Fl_Copy_Surface : public Fl_Surface_Device {
+private:
+  int width;
+  int height;
+  Fl_Paged_Device *helper;
+#ifdef __APPLE__
+  CFMutableDataRef pdfdata;
+  CGContextRef oldgc;
+  CGContextRef gc;
+  void prepare_copy_pdf_and_tiff(int w, int h);
+  void complete_copy_pdf_and_tiff();
+  void init_PDF_context(int w, int h);
+  static size_t MyPutBytes(void* info, const void* buffer, size_t count);
+#elif defined(WIN32)
+  HDC oldgc;
+  HDC gc;
+#else // Xlib
+  Fl_Offscreen xid;
+  Window oldwindow;
+  Fl_Surface_Device *_ss;
+#endif
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_Copy_Surface(int w, int h);
+  ~Fl_Copy_Surface();
+  void set_current();
+  void draw(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
+};
+
+#if defined(__APPLE__)
+
+/* Mac class to reimplement Fl_Paged_Device::printable_rect() */
+class Fl_Quartz_Surface_ : public Fl_System_Printer {
+protected:
+  int width;
+  int height;
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_Quartz_Surface_(int w, int h);
+  virtual int printable_rect(int *w, int *h);
+  virtual ~Fl_Quartz_Surface_() {};
+};
+
+#elif defined(WIN32)
+
+/* Win class to implement translate()/untranslate() */
+class Fl_GDI_Surface_ : public Fl_Paged_Device {
+  int width;
+  int height;
+  unsigned depth;
+  POINT origins[10];
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_GDI_Surface_();
+  virtual void translate(int x, int y);
+  virtual void untranslate();
+  virtual ~Fl_GDI_Surface_();
+};
+
+#elif !defined(FL_DOXYGEN)
+
+/* Xlib class to implement translate()/untranslate() */
+class Fl_Xlib_Surface_ : public Fl_Paged_Device {
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_Xlib_Surface_();
+  virtual void translate(int x, int y);
+  virtual void untranslate();
+  virtual ~Fl_Xlib_Surface_();
+};
+
+#endif
+
+#endif // Fl_Copy_Surface_H
+
+//
+// End of "$Id: Fl_Copy_Surface.H 10172 2014-05-24 16:21:46Z manolo $".
+//

+ 3 - 2
fltk/FL/Fl_Device.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Device.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Device.H 10110 2014-02-22 14:51:50Z manolo $"
 //
 //
 // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
 // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
 // for the Fast Light Tool Kit (FLTK).
 // for the Fast Light Tool Kit (FLTK).
@@ -484,6 +484,7 @@ public:
   static const char *class_id;
   static const char *class_id;
   const char *class_name() {return class_id;};
   const char *class_name() {return class_id;};
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
   void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
+  void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy);
 };
 };
 #endif
 #endif
 #if !(defined(__APPLE__) || defined(WIN32))
 #if !(defined(__APPLE__) || defined(WIN32))
@@ -583,5 +584,5 @@ public:
 #endif // Fl_Device_H
 #endif // Fl_Device_H
 
 
 //
 //
-// End of "$Id: Fl_Device.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Device.H 10110 2014-02-22 14:51:50Z manolo $".
 //
 //

+ 3 - 2
fltk/FL/Fl_Gl_Window.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Gl_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Gl_Window.H 10063 2014-01-16 15:38:06Z manolo $"
 //
 //
 // OpenGL header file for the Fast Light Tool Kit (FLTK).
 // OpenGL header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -70,6 +70,7 @@ class FL_EXPORT Fl_Gl_Window : public Fl_Window {
 
 
   static int can_do(int, const int *);
   static int can_do(int, const int *);
   int mode(int, const int *);
   int mode(int, const int *);
+  static int gl_plugin_linkage();
 
 
 public:
 public:
 
 
@@ -229,5 +230,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Gl_Window, Fl_Window)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Gl_Window.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Gl_Window.H 10063 2014-01-16 15:38:06Z manolo $".
 //
 //

+ 5 - 3
fltk/FL/Fl_Image.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Image.H 9595 2012-06-13 17:47:03Z greg.ercolano $"
+// "$Id: Fl_Image.H 10192 2014-06-12 13:28:04Z ossman $"
 //
 //
 // Image header file for the Fast Light Tool Kit (FLTK).
 // Image header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -29,7 +29,8 @@
 #include "Fl_Widget.H"
 #include "Fl_Widget.H"
 #endif
 #endif
 
 
-class Fl_Widget;
+class Fl_Widget;
+class Fl_Pixmap;
 class Fl_Menu_Item;
 class Fl_Menu_Item;
 class Fl_Label;
 class Fl_Label;
 
 
@@ -209,6 +210,7 @@ public:
   */
   */
   Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
   Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
     Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
     Fl_Image(W,H,D), array(bits), alloc_array(0), id_(0), mask_(0) {data((const char **)&array, 1); ld(LD);}
+  Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg=FL_GRAY);
   virtual ~Fl_RGB_Image();
   virtual ~Fl_RGB_Image();
   virtual Fl_Image *copy(int W, int H);
   virtual Fl_Image *copy(int W, int H);
   Fl_Image *copy() { return copy(w(), h()); }
   Fl_Image *copy() { return copy(w(), h()); }
@@ -241,5 +243,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_RGB_Image, Fl_Image)
 #endif // !Fl_Image_H
 #endif // !Fl_Image_H
 
 
 //
 //
-// End of "$Id: Fl_Image.H 9709 2012-11-09 16:02:08Z manolo $".
+// End of "$Id: Fl_Image.H 10192 2014-06-12 13:28:04Z ossman $".
 //
 //

+ 90 - 0
fltk/FL/Fl_Image_Surface.H

@@ -0,0 +1,90 @@
+//
+// "$Id: Fl_Image_Surface.H 10172 2014-05-24 16:21:46Z manolo $"
+//
+// Draw-to-image code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2014 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef Fl_Image_Surface_H
+#define Fl_Image_Surface_H
+
+#include <FL/Fl_Copy_Surface.H>
+#include <FL/Fl_Image.H>
+
+
+/** Directs all graphics requests to an Fl_Image.
+ 
+ After creation of an Fl_Image_Surface object, call set_current() on it, and all subsequent graphics requests
+ will be recorded in the image. It's possible to draw widgets (using Fl_Image_Surface::draw()) 
+ or to use any of the \ref fl_drawings or the \ref fl_attributes.
+ Finally, call image() on the object to obtain a newly allocated Fl_Image object.
+ <br> Fl_GL_Window objects can be drawn in the image as well. 
+ 
+ <br> Usage example:
+ \code
+ Fl_Widget *g = ...; // a widget you want to draw in an image
+ Fl_Image_Surface *img_surf = new Fl_Image_Surface(g->w(), g->h()); // create an Fl_Image_Surface object
+ img_surf->set_current(); // direct graphics requests to the image
+ fl_color(FL_WHITE); fl_rectf(0, 0, g->w(), g->h()); // draw a white background
+ img_surf->draw(g); // draw the g widget in the image
+ Fl_Image* image = img_surf->image(); // get the resulting image
+ delete img_surf; // delete the img_surf object
+ Fl_Display_Device::display_device()->set_current();  // direct graphics requests back to the display
+ \endcode
+*/
+class Fl_Image_Surface : public Fl_Surface_Device {
+private:
+  Fl_Offscreen offscreen;
+  int width;
+  int height;
+  Fl_Paged_Device *helper;
+#ifdef __APPLE__
+#elif defined(WIN32)
+  HDC _sgc; 
+  Window _sw; 
+  Fl_Surface_Device *_ss;
+  int _savedc;
+#else
+  Fl_Surface_Device *previous;
+  Window pre_window;
+  GC gc;
+#endif
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_Image_Surface(int w, int h);
+  ~Fl_Image_Surface();
+  void set_current();
+  void draw(Fl_Widget*, int delta_x = 0, int delta_y = 0);
+  Fl_Image *image();
+};
+
+#ifdef __APPLE__
+/* Mac class to implement translate()/untranslate() for a flipped bitmap graphics context */
+class Fl_Quartz_Flipped_Surface_ : public Fl_Quartz_Surface_ {
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_Quartz_Flipped_Surface_(int w, int h);
+  void translate(int x, int y);
+  void untranslate();
+  virtual ~Fl_Quartz_Flipped_Surface_() {};
+};
+#endif 
+
+#endif // Fl_Image_Surface_H
+
+//
+// End of "$Id: Fl_Image_Surface.H 10172 2014-05-24 16:21:46Z manolo $".
+//

+ 6 - 3
fltk/FL/Fl_Input_.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Input_.H 9196 2011-12-06 16:55:51Z AlbrechtS $"
+// "$Id: Fl_Input_.H 10134 2014-04-29 02:56:34Z greg.ercolano $"
 //
 //
 // Input base class header file for the Fast Light Tool Kit (FLTK).
 // Input base class header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -479,6 +479,8 @@ public:
 
 
     \param [in] val If \p val is 1, Tab advances focus (default).<BR>
     \param [in] val If \p val is 1, Tab advances focus (default).<BR>
                     If \p val is 0, Tab inserts a tab character (old FLTK behavior).
                     If \p val is 0, Tab inserts a tab character (old FLTK behavior).
+
+    \see tab_nav(), Fl::OPTION_ARROW_FOCUS.
   */
   */
   void tab_nav(int val) {
   void tab_nav(int val) {
     tab_nav_ = val;
     tab_nav_ = val;
@@ -491,7 +493,8 @@ public:
 
 
     If disabled, hitting Tab inserts a tab character into the text field.
     If disabled, hitting Tab inserts a tab character into the text field.
     \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters.
     \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters.
-    \see tab_nav(int)
+
+    \see tab_nav(int), Fl::OPTION_ARROW_FOCUS.
   */
   */
   int tab_nav() const {
   int tab_nav() const {
     return tab_nav_;
     return tab_nav_;
@@ -503,5 +506,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Input_, Fl_Widget)
 #endif 
 #endif 
 
 
 //
 //
-// End of "$Id: Fl_Input_.H 9196 2011-12-06 16:55:51Z AlbrechtS $".
+// End of "$Id: Fl_Input_.H 10134 2014-04-29 02:56:34Z greg.ercolano $".
 //
 //

+ 128 - 40
fltk/FL/Fl_Native_File_Chooser.H

@@ -1,9 +1,9 @@
 //
 //
-// "$Id: Fl_Native_File_Chooser.H 9704 2012-10-19 11:23:51Z manolo $"
+// "$Id: Fl_Native_File_Chooser.H 10186 2014-06-07 12:01:59Z manolo $"
 //
 //
 // FLTK native OS file chooser widget
 // FLTK native OS file chooser widget
 //
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 1998-2014 by Bill Spitzak and others.
 // Copyright 2004 Greg Ercolano.
 // Copyright 2004 Greg Ercolano.
 //
 //
 // This library is free software. Distribution and use rights are outlined in
 // This library is free software. Distribution and use rights are outlined in
@@ -23,32 +23,31 @@
 #ifndef FL_NATIVE_FILE_CHOOSER_H
 #ifndef FL_NATIVE_FILE_CHOOSER_H
 #define FL_NATIVE_FILE_CHOOSER_H
 #define FL_NATIVE_FILE_CHOOSER_H
 
 
-/* \file
- Fl_Native_File_Chooser widget. */
-
 // Use Windows' chooser
 // Use Windows' chooser
 #ifdef WIN32
 #ifdef WIN32
 // #define _WIN32_WINNT	0x0501	// needed for OPENFILENAME's 'FlagsEx'
 // #define _WIN32_WINNT	0x0501	// needed for OPENFILENAME's 'FlagsEx'
-#include <stdio.h>
-#include <stdlib.h>		// malloc
-#include <windows.h>
-#include <commdlg.h>		// OPENFILENAME, GetOpenFileName()
-#include <shlobj.h>		// BROWSEINFO, SHBrowseForFolder()
+#  include <stdio.h>
+#  include <stdlib.h>		// malloc
+#  include <windows.h>
+#  include <commdlg.h>		// OPENFILENAME, GetOpenFileName()
+#  include <shlobj.h>		// BROWSEINFO, SHBrowseForFolder()
 #endif
 #endif
 
 
 // Use Apple's chooser
 // Use Apple's chooser
 #ifdef __APPLE__
 #ifdef __APPLE__
-#define MAXFILTERS	80
+#  define MAXFILTERS	80
 #endif
 #endif
 
 
 // All else falls back to FLTK's own chooser
 // All else falls back to FLTK's own chooser
 #if ! defined(__APPLE__) && !defined(WIN32)
 #if ! defined(__APPLE__) && !defined(WIN32)
-#include <FL/Fl_File_Chooser.H>
-#include <unistd.h>		// _POSIX_NAME_MAX
+#  include <FL/Fl_File_Chooser.H>
+#  include <unistd.h>		// _POSIX_NAME_MAX
 #else
 #else
-#include <FL/filename.H>	// FL_EXPORT
+#  include <FL/filename.H>	// FL_EXPORT
 #endif
 #endif
 
 
+class Fl_FLTK_File_Chooser;
+class Fl_GTK_File_Chooser;
 
 
 /**
 /**
  This class lets an FLTK application easily and consistently access 
  This class lets an FLTK application easily and consistently access 
@@ -91,7 +90,10 @@
  
  
  <B>Platform Specific Caveats</B>
  <B>Platform Specific Caveats</B>
  
  
- - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
+ - Under X windows, and if Fl::OPTION_FNFC_USES_GTK has not been switched off,
+ the widget attempts to use standard GTK file chooser dialogs if they are
+ available at run-time on the platform, and falls back to use FLTK's Fl_File_Chooser if they are not.
+ In the latter case, it's best if you call Fl_File_Icon::load_system_icons()
  at the start of main(), to enable the nicer looking file browser widgets.
  at the start of main(), to enable the nicer looking file browser widgets.
  Use the static public attributes of class Fl_File_Chooser to localize
  Use the static public attributes of class Fl_File_Chooser to localize
  the browser.
  the browser.
@@ -114,9 +116,10 @@ public:
   };
   };
   enum Option {
   enum Option {
     NO_OPTIONS     = 0x0000,		///< no options enabled
     NO_OPTIONS     = 0x0000,		///< no options enabled
-    SAVEAS_CONFIRM = 0x0001,		///< Show native 'Save As' overwrite confirm dialog (if supported)
+    SAVEAS_CONFIRM = 0x0001,		///< Show native 'Save As' overwrite confirm dialog
     NEW_FOLDER     = 0x0002,		///< Show 'New Folder' icon (if supported)
     NEW_FOLDER     = 0x0002,		///< Show 'New Folder' icon (if supported)
-    PREVIEW        = 0x0004		///< enable preview mode
+    PREVIEW        = 0x0004,		///< enable preview mode (if supported)
+    USE_FILTER_EXT = 0x0008		///< Chooser filter pilots the output file extension (if supported)
   };
   };
   /** Localizable message */
   /** Localizable message */
   static const char *file_exists_message;
   static const char *file_exists_message;
@@ -126,33 +129,33 @@ public:
   ~Fl_Native_File_Chooser();
   ~Fl_Native_File_Chooser();
   
   
   // Public methods
   // Public methods
-  void type(int);
-  int type() const;
-  void options(int);
+  void type(int t);
+  int type() const ;
+  void options(int o);
   int options() const;
   int options() const;
   int count() const;
   int count() const;
-  const char *filename() const;
-  const char *filename(int i) const;
-  void directory(const char *val);
+  const char *filename() const ;
+  const char *filename(int i) const ;
+  void directory(const char *val) ;
   const char *directory() const;
   const char *directory() const;
-  void title(const char *);
+  void title(const char *t);
   const char* title() const;
   const char* title() const;
-  const char *filter() const;
-  void filter(const char *);
-  int filters() const;
-  void filter_value(int i);
-  int filter_value() const;
-  void preset_file(const char*);
+  const char *filter() const ;
+  void filter(const char *f);
+  int filters() const ;
+  void filter_value(int i) ;
+  int filter_value() const ;
+  void preset_file(const char*f) ;
   const char* preset_file() const;
   const char* preset_file() const;
-  const char *errmsg() const;
-  int show();
+  const char *errmsg() const ;
+  int show() ;
   
   
 #ifdef WIN32
 #ifdef WIN32
 private:
 private:
   int  _btype;			// kind-of browser to show()
   int  _btype;			// kind-of browser to show()
   int  _options;		// general options
   int  _options;		// general options
   OPENFILENAMEW _ofn;		// GetOpenFileName() & GetSaveFileName() struct
   OPENFILENAMEW _ofn;		// GetOpenFileName() & GetSaveFileName() struct
-  BROWSEINFO   _binf;		// SHBrowseForFolder() struct
+  BROWSEINFOW   _binf;		// SHBrowseForFolder() struct
   char  **_pathnames;		// array of pathnames
   char  **_pathnames;		// array of pathnames
   int     _tpathnames;		// total pathnames
   int     _tpathnames;		// total pathnames
   char   *_directory;		// default pathname to use
   char   *_directory;		// default pathname to use
@@ -196,10 +199,10 @@ private:
   char           *_preset_file;	        // the 'save as' filename
   char           *_preset_file;	        // the 'save as' filename
   
   
   char           *_filter;		// user-side search filter, eg:
   char           *_filter;		// user-side search filter, eg:
-					// C Files\t*.[ch]\nText Files\t*.txt"
+  // C Files\t*.[ch]\nText Files\t*.txt"
   
   
   char           *_filt_names;		// filter names (tab delimited)
   char           *_filt_names;		// filter names (tab delimited)
-					// eg. "C Files\tText Files"
+  // eg. "C Files\tText Files"
   
   
   char           *_filt_patt[MAXFILTERS];
   char           *_filt_patt[MAXFILTERS];
   // array of filter patterns, eg:
   // array of filter patterns, eg:
@@ -224,6 +227,7 @@ private:
 
 
 #if ! defined(__APPLE__) && !defined(WIN32)
 #if ! defined(__APPLE__) && !defined(WIN32)
 private:
 private:
+#if FLTK_ABI_VERSION <= 10302
   int   _btype;			// kind-of browser to show()
   int   _btype;			// kind-of browser to show()
   int   _options;		// general options
   int   _options;		// general options
   int   _nfilters;
   int   _nfilters;
@@ -234,20 +238,104 @@ private:
   char *_prevvalue;		// Returned filename
   char *_prevvalue;		// Returned filename
   char *_directory;
   char *_directory;
   char *_errmsg;		// error message
   char *_errmsg;		// error message
-  Fl_File_Chooser *_file_chooser;
-  
-  // Private methods
+#endif
+  static int have_looked_for_GTK_libs;
+  union {
+    Fl_FLTK_File_Chooser *_x11_file_chooser;
+    Fl_GTK_File_Chooser *_gtk_file_chooser;
+  };
+#endif
+};
+
+#if !defined(__APPLE__) && !defined(WIN32)
+class Fl_FLTK_File_Chooser {
+  friend class Fl_Native_File_Chooser;
+protected:
+  int   _btype;			// kind-of browser to show()
+  int   _options;		// general options
+  int   _nfilters;
+  char *_filter;		// user supplied filter
+  char *_parsedfilt;		// parsed filter
+  int   _filtvalue;		// selected filter
+  char *_preset_file;
+  char *_prevvalue;		// Returned filename
+  char *_directory;
+  char *_errmsg;		// error message
+  Fl_FLTK_File_Chooser(int val);
+  virtual ~Fl_FLTK_File_Chooser();
   void errmsg(const char *msg);
   void errmsg(const char *msg);
   int type_fl_file(int);
   int type_fl_file(int);
   void parse_filter();
   void parse_filter();
   void keeplocation();
   void keeplocation();
   int exist_dialog();
   int exist_dialog();
-#endif
+  Fl_File_Chooser *_file_chooser;
+  virtual void type(int);
+  int type() const;
+  void options(int);
+  int options() const;
+  virtual int count() const;
+  virtual const char *filename() const;
+  virtual const char *filename(int i) const;
+  void directory(const char *val);
+  const char *directory() const;
+  virtual void title(const char *);
+  virtual const char* title() const;
+  const char *filter() const;
+  void filter(const char *);
+  int filters() const;
+  void filter_value(int i);
+  int filter_value() const;
+  void preset_file(const char*);
+  const char* preset_file() const;
+  const char *errmsg() const;
+  virtual int show();
 };
 };
 
 
+
+class Fl_GTK_File_Chooser : public Fl_FLTK_File_Chooser {
+  friend class Fl_Native_File_Chooser;
+private:
+  typedef struct _GtkWidget GtkWidget;
+  typedef struct _GtkFileFilterInfo GtkFileFilterInfo;
+  struct pair {
+    Fl_GTK_File_Chooser* running; // the running Fl_GTK_File_Chooser
+    const char *filter; // a filter string of the chooser
+    pair(Fl_GTK_File_Chooser* c, const char *f) {
+      running = c; 
+      filter = strdup(f);
+    };
+    ~pair() {
+      free((char*)filter);
+    };
+  };
+  GtkWidget *gtkw_ptr; // used to hold a GtkWidget* without pulling GTK into everything...
+  void *gtkw_slist; // used to hold a GLib GSList...
+  unsigned gtkw_count; // number of files read back - if any
+  mutable char *gtkw_filename; // last name we read back
+  char *gtkw_title; // the title to be applied to the dialog
+  const char *previous_filter;
+  
+  int fl_gtk_chooser_wrapper(); // method that wraps the GTK widget
+  Fl_GTK_File_Chooser(int val);
+  virtual ~Fl_GTK_File_Chooser();
+  static int did_find_GTK_libs;
+  static void probe_for_GTK_libs(void);
+  virtual void type(int);
+  virtual int count() const;
+  virtual const char *filename() const;
+  virtual const char *filename(int i) const;
+  virtual void title(const char *);
+  virtual const char* title() const;
+  virtual int show();
+  void changed_output_type(const char *filter);
+  
+  static int custom_gtk_filter_function(const GtkFileFilterInfo*, Fl_GTK_File_Chooser::pair*);
+  static void free_pair(pair *p);
+};
+#endif // !defined(__APPLE__) && !defined(WIN32)
 
 
 #endif /*FL_NATIVE_FILE_CHOOSER_H*/
 #endif /*FL_NATIVE_FILE_CHOOSER_H*/
 
 
 //
 //
-// End of "$Id: Fl_Native_File_Chooser.H 9704 2012-10-19 11:23:51Z manolo $".
+// End of "$Id: Fl_Native_File_Chooser.H 10186 2014-06-07 12:01:59Z manolo $".
 //
 //

+ 11 - 4
fltk/FL/Fl_PostScript.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_PostScript.H 9683 2012-09-20 11:23:38Z manolo $"
+// "$Id: Fl_PostScript.H 9993 2013-09-25 08:55:01Z manolo $"
 //
 //
 // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
 // Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -52,6 +52,12 @@
  <br> All other unicode characters or all other fonts (FL_FREE_FONT and above) are output as a bitmap.
  <br> All other unicode characters or all other fonts (FL_FREE_FONT and above) are output as a bitmap.
  <br> FLTK standard fonts are output using the corresponding PostScript standard fonts.
  <br> FLTK standard fonts are output using the corresponding PostScript standard fonts.
  */
  */
+
+/** Signature of Fl_PostScript::close_command() functions passed as parameters. */
+extern "C" {
+  typedef int (Fl_PostScript_Close_Command)(FILE *);
+}
+
 class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
 class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
 public: 
 public: 
   static const char *class_id;
   static const char *class_id;
@@ -89,7 +95,7 @@ class Clip {
   int mx; // width of mask;
   int mx; // width of mask;
   int my; // mask lines
   int my; // mask lines
   //Fl_Color bg_;
   //Fl_Color bg_;
-  int (*close_cmd_)(FILE *);
+  Fl_PostScript_Close_Command* close_cmd_;
   int page_policy_;
   int page_policy_;
   int nPages;
   int nPages;
   int orientation_;
   int orientation_;
@@ -116,7 +122,7 @@ class Clip {
  
  
   void page_policy(int p);
   void page_policy(int p);
   int page_policy(){return page_policy_;};
   int page_policy(){return page_policy_;};
-  void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
+  void close_command(Fl_PostScript_Close_Command* cmd){close_cmd_=cmd;};
   FILE * file() {return output;};
   FILE * file() {return output;};
   //void orientation (int o);
   //void orientation (int o);
   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
   //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
@@ -192,6 +198,7 @@ class Clip {
   void rtl_draw(const char* s, int n, int x, int y);
   void rtl_draw(const char* s, int n, int x, int y);
   void font(int face, int size);
   void font(int face, int size);
   double width(const char *, int);
   double width(const char *, int);
+  double width(unsigned int u);
   void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);
   void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);
   int height();
   int height();
   int descent();
   int descent();
@@ -240,5 +247,5 @@ public:
 #endif // Fl_PostScript_H
 #endif // Fl_PostScript_H
 
 
 //
 //
-// End of "$Id: Fl_PostScript.H 9683 2012-09-20 11:23:38Z manolo $"
+// End of "$Id: Fl_PostScript.H 9993 2013-09-25 08:55:01Z manolo $"
 //
 //

+ 3 - 2
fltk/FL/Fl_Preferences.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Preferences.H 9228 2012-01-18 11:39:57Z AlbrechtS $"
+// "$Id: Fl_Preferences.H 9978 2013-09-16 20:25:14Z greg.ercolano $"
 //
 //
 // Preferences .
 // Preferences .
 //
 //
@@ -185,6 +185,7 @@ private:
   static char uuidBuffer[40];
   static char uuidBuffer[40];
   static Fl_Preferences *runtimePrefs;
   static Fl_Preferences *runtimePrefs;
 
 
+public:  // older Sun compilers need this (public definition of the following classes)
   class RootNode;
   class RootNode;
   
   
   class FL_EXPORT Node {	// a node contains a list to all its entries 
   class FL_EXPORT Node {	// a node contains a list to all its entries 
@@ -264,5 +265,5 @@ protected:
 #endif // !Fl_Preferences_H
 #endif // !Fl_Preferences_H
 
 
 //
 //
-// End of "$Id: Fl_Preferences.H 9228 2012-01-18 11:39:57Z AlbrechtS $".
+// End of "$Id: Fl_Preferences.H 9978 2013-09-16 20:25:14Z greg.ercolano $".
 //
 //

+ 10 - 2
fltk/FL/Fl_Spinner.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Spinner.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Spinner.H 9918 2013-05-16 05:02:18Z greg.ercolano $"
 //
 //
 // Spinner widget for the Fast Light Tool Kit (FLTK).
 // Spinner widget for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -241,6 +241,14 @@ private:
     Return the background color of the spinner widget's input field.
     Return the background color of the spinner widget's input field.
   */
   */
   Fl_Color	color() const { return(input_.color()); }
   Fl_Color	color() const { return(input_.color()); }
+  /**
+    Change the selection color of the spinner widget's input field.
+  */
+  void		selection_color(Fl_Color val) { input_.selection_color(val); }
+  /**
+    Return the selection color of the spinner widget's input field.
+  */
+  Fl_Color	selection_color() const { return input_.selection_color(); }
 
 
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Spinner, Fl_Group)
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Spinner, Fl_Group)
 };
 };
@@ -248,5 +256,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Spinner, Fl_Group)
 #endif // !Fl_Spinner_H
 #endif // !Fl_Spinner_H
 
 
 //
 //
-// End of "$Id: Fl_Spinner.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Spinner.H 9918 2013-05-16 05:02:18Z greg.ercolano $".
 //
 //

+ 52 - 19
fltk/FL/Fl_Sys_Menu_Bar.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Sys_Menu_Bar.H 9637 2012-07-24 04:37:22Z matt $"
+// "$Id: Fl_Sys_Menu_Bar.H 10102 2014-02-11 17:59:20Z manolo $"
 //
 //
 // MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
 // MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -25,37 +25,70 @@
 #if defined(__APPLE__) || defined(FL_DOXYGEN)
 #if defined(__APPLE__) || defined(FL_DOXYGEN)
 
 
 /**
 /**
- @brief A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen.
- *
- * On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar.
- *
- * You can configure a callback for the 'About' menu item to invoke your own code with fl_mac_set_about().
- *
+  A class to create, modify and delete menus that appear on Mac OS X in the menu bar at the top of the screen.
+ 
+  On other than Mac OS X platforms, Fl_Sys_Menu_Bar is a synonym of class Fl_Menu_Bar.
+ \n To use this class, just replace Fl_Menu_Bar by Fl_Sys_Menu_Bar, and, on the Mac platform,
+ a system menu at the top of the screen will be available. This menu will match an array
+ of Fl_Menu_Item's exactly as with standard FLTK menus.
+  \n A few FLTK features are not supported by the Mac System menu:
+  \li no symbolic labels
+  \li no embossed labels
+  \li no font sizes
+ 
+  You can configure a callback for the 'About' menu item to invoke your own code with fl_mac_set_about().
  */
  */
 class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar {
 class FL_EXPORT Fl_Sys_Menu_Bar : public Fl_Menu_Bar {
 protected:
 protected:
+  void update();
   void draw();
   void draw();
 public:
 public:
-  /**
-   @brief The constructor.
-   *
-   * On Mac OS X, all arguments are unused. On other platforms they are used as by Fl_Menu_Bar::Fl_Menu_Bar().
-   */
   Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0);
   Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0);
+  ~Fl_Sys_Menu_Bar();
+  /** Return the system menu's array of Fl_Menu_Item's 
+   */
   const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();}
   const Fl_Menu_Item *menu() const {return Fl_Menu_::menu();}
   void menu(const Fl_Menu_Item *m);
   void menu(const Fl_Menu_Item *m);
   int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
   int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
+  /** Adds a new menu item. 
+   \see Fl_Menu_::add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0)
+   */
+  int add(const char* label, const char* shortcut, Fl_Callback* cb, void *user_data=0, int flags=0) {
+    return add(label, fl_old_shortcut(shortcut), cb, user_data, flags);
+    }
+  int add(const char* str);
   int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0);
   int insert(int index, const char* label, int shortcut, Fl_Callback *cb, void *user_data=0, int flags=0);
+  /** Insert a new menu item. 
+   \see Fl_Menu_::insert(int index, const char* label, const char* shortcut, Fl_Callback *cb, void *user_data=0, int flags=0)
+   */
+  int insert(int index, const char* label, const char* shortcut, Fl_Callback *cb, void *user_data=0, int flags=0) {
+    return insert(index, label, fl_old_shortcut(shortcut), cb, user_data, flags);
+    }
   void remove(int n);
   void remove(int n);
   void replace(int rank, const char *name);
   void replace(int rank, const char *name);
+  /** Set the Fl_Menu_Item array pointer to null, indicating a zero-length menu. 
+   \see Fl_Menu_::clear()
+   */
   void clear();
   void clear();
+  /** Clears the specified submenu pointed to by index of all menu items.
+   \see Fl_Menu_::clear_submenu(int index)
+   */
   int clear_submenu(int index);
   int clear_submenu(int index);
-#if ! defined(FL_DOXYGEN)
-  enum menuOrItemOperation { itemAtIndex, setKeyEquivalent, setKeyEquivalentModifierMask, setState, initWithTitle,
-    numberOfItems, setSubmenu, setEnabled, addSeparatorItem, setTitle, removeItem, addNewItem };
-  // function doMenuOrItemOperation is in file Fl_cocoa.mm because it contains objective-c code
-  static void *doMenuOrItemOperation( menuOrItemOperation operation, ...);
-#endif
+  /** Make the shortcuts for this menu work no matter what window has the focus when you type it.
+   */
+  void global() {};
+  /** Sets the flags of item i
+   \see Fl_Menu_::mode(int i, int fl) */
+  void 	mode (int i, int fl) {
+    Fl_Menu_::mode(i, fl);
+    update();
+    }
+  /** Gets the flags of item i.
+   */
+  int mode(int i) const { return Fl_Menu_::mode(i); }
+  /** Changes the shortcut of item i to n.
+   */
+  void shortcut (int i, int s) { Fl_Menu_::shortcut(i, s); update(); };
 };
 };
 
 
 #else
 #else
@@ -67,5 +100,5 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
 #endif // Fl_Sys_Menu_Bar_H
 #endif // Fl_Sys_Menu_Bar_H
 
 
 //
 //
-// End of "$Id: Fl_Sys_Menu_Bar.H 9637 2012-07-24 04:37:22Z matt $".
+// End of "$Id: Fl_Sys_Menu_Bar.H 10102 2014-02-11 17:59:20Z manolo $".
 //
 //

+ 39 - 2
fltk/FL/Fl_Table.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Table.H 9731 2012-11-23 20:07:22Z greg.ercolano $"
+// "$Id: Fl_Table.H 9843 2013-03-23 08:14:08Z greg.ercolano $"
 //
 //
 // Fl_Table -- A table widget
 // Fl_Table -- A table widget
 //
 //
@@ -209,6 +209,12 @@ private:
   int _selecting;
   int _selecting;
 #if FLTK_ABI_VERSION >= 10301
 #if FLTK_ABI_VERSION >= 10301
   int _scrollbar_size;
   int _scrollbar_size;
+#endif
+#if FLTK_ABI_VERSION >= 10303
+  enum {
+    TABCELLNAV = 1<<0,			///> tab cell navigation flag
+  };
+  unsigned int flags_;
 #endif
 #endif
   
   
   // An STL-ish vector without templates
   // An STL-ish vector without templates
@@ -823,6 +829,7 @@ public:
   int is_selected(int r, int c);		// selected cell
   int is_selected(int r, int c);		// selected cell
   void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
   void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
   void set_selection(int row_top, int col_left, int row_bot, int col_right);
   void set_selection(int row_top, int col_left, int row_bot, int col_right);
+  int move_cursor(int R, int C, int shiftselect);
   int move_cursor(int R, int C);
   int move_cursor(int R, int C);
   
   
   /**
   /**
@@ -1107,12 +1114,42 @@ public:
       _scrollbar_size = newSize;
       _scrollbar_size = newSize;
   }   
   }   
 #endif
 #endif
+#if FLTK_ABI_VERSION >= 10303
+  /**
+    Flag to control if Tab navigates table cells or not.
 
 
+    If on, Tab key navigates table cells.
+    If off, Tab key navigates fltk widget focus. (default)
+
+    As of fltk 1.3, the default behavior of the Tab key is to navigate focus off
+    of the current widget, and on to the next one.  But in some applications,
+    it's useful for Tab to be used to navigate cells in the Fl_Table.
+
+    \param [in] val If \p val is 1, Tab key navigates cells in table, not fltk widgets.<BR>
+                    If \p val is 0, Tab key will advance focus to the next fltk widget (default), and does not navigate cells in table.
+  */
+  void tab_cell_nav(int val) {
+    if ( val ) flags_ |=  TABCELLNAV;
+    else       flags_ &= ~TABCELLNAV;
+  }
+
+  /**
+    Get state of table's 'Tab' key cell navigation flag.
+
+    \returns 1 if Tab configured to navigate cells in table<br>0 to navigate widget focus (default)
+
+    \see tab_cell_nav(int)
+  */
+  int tab_cell_nav() const {
+    return(flags_ & TABCELLNAV ? 1 : 0);
+  }
+#endif
+
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Table, Fl_Group)
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Table, Fl_Group)
 };
 };
 
 
 #endif /*_FL_TABLE_H*/
 #endif /*_FL_TABLE_H*/
 
 
 //
 //
-// End of "$Id: Fl_Table.H 9731 2012-11-23 20:07:22Z greg.ercolano $".
+// End of "$Id: Fl_Table.H 9843 2013-03-23 08:14:08Z greg.ercolano $".
 //
 //

+ 160 - 2
fltk/FL/Fl_Tabs.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Tabs.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Tabs.H 10120 2014-03-23 17:36:59Z greg.ercolano $"
 //
 //
 // Tab header file for the Fast Light Tool Kit (FLTK).
 // Tab header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -49,6 +49,154 @@
   gap is larger. It is easiest to lay this out in fluid, using the
   gap is larger. It is easiest to lay this out in fluid, using the
   fluid browser to select each child group and resize them until
   fluid browser to select each child group and resize them until
   the tabs look the way you want them to.
   the tabs look the way you want them to.
+  
+  The background area behind and to the right of the tabs is
+  "transparent", exposing the background detail of the parent. The
+  value of Fl_Tabs::box() does not affect this area. So if Fl_Tabs is
+  resized by itself without the parent, force the appropriate parent
+  (visible behind the tabs) to redraw() to prevent artifacts.
+
+  See "Resizing Caveats" below on how to keep tab heights constant.
+  See "Callback's Use Of when()" on how to control the details
+  of how clicks invoke the callback().
+
+  A typical use of the Fl_Tabs widget:
+
+  \par
+  \code
+      // Typical use of Fl_Tabs
+      Fl_Tabs *tabs = new Fl_Tabs(10,10,300,200);
+      {
+          Fl_Group *grp1 = new Fl_Group(20,30,280,170,"Tab1");
+	  {
+	      ..widgets that go in tab#1..
+          }
+	  grp1->end();
+          Fl_Group *grp2 = new Fl_Group(20,30,280,170,"Tab2");
+	  {
+	      ..widgets that go in tab#2..
+	  }
+	  grp2->end();
+      }
+      tabs->end();
+  \endcode
+
+  \b Default \b Appearance
+
+  The appearance of each "tab" is taken from the label() and color() of the
+  child group corresponding to that "tab" and panel. Where the "tabs" appear
+  depends on the position and size of the child groups that make up the
+  panels within the Fl_Tab, i.e. whether there is more space above or
+  below them. The height of the "tabs" depends on how much free space
+  is available.
+
+  \image html  tabs_default.png "Fl_Tabs Default Appearance"
+  \image latex tabs_default.png "Fl_Tabs Default Appearance" width=8cm
+
+  \b Highlighting \b The \b Selected \b Tab
+
+  The selected "tab" can be highlighted further by setting the
+  selection_color() of the Fl_Tab itself, e.g.
+
+  \par
+  \code
+  ..
+  tabs = new Fl_Tabs(..);
+  tabs->selection_color(FL_DARK3);
+  ..
+  \endcode
+
+  The result of the above looks like:
+  \image html  tabs_selection.png "Highlighting the selected tab"
+  \image latex tabs_selection.png "Highlighting the selected tab" width=8cm
+
+  \b Uniform \b Tab \b and \b Panel \b Appearance
+
+  In order to have uniform tab and panel appearance, not only must the color()
+  and selection_color() for each child group be set, but also the 
+  selection_color() of the Fl_Tab itself any time a new "tab" is selected.
+  This can be achieved within the Fl_Tab callback, e.g.
+
+  \par
+  \code
+  void MyTabCallback(Fl_Widget *w, void*) {
+    Fl_Tabs *tabs = (Fl_Tabs*)w;
+    // When tab changed, make sure it has same color as its group
+    tabs->selection_color( (tab->value())->color() );
+  }
+  ..
+  int main(..) {
+    // Define tabs widget
+    tabs = new Fl_Tabs(..);
+    tabs->callback(MyTabCallback);
+
+    // Create three tabs each colored differently
+    grp1 = new Fl_Group(.. "One");
+     grp1->color(9);
+     grp1->selection_color(9);
+    grp1->end();
+
+    grp2 = new Fl_Group(.. "Two");
+     grp2->color(10);
+     grp2->selection_color(10);
+    grp2->end();
+
+    grp3 = new Fl_Group(.. "Three");
+     grp3->color(14);
+     grp3->selection_color(14);
+    grp3->end();
+    ..
+    // Make sure default tab has same color as its group
+    tabs->selection_color( (tab->value())->color() );
+    ..
+    return Fl::run();
+  }
+  \endcode
+
+  The result of the above looks like:
+  \image html  tabs_uniform.png "Fl_Tabs with uniform colors"
+  \image latex tabs_uniform.png "Fl_Tabs with uniform colors" width=8cm
+
+  \b Resizing \b Caveats
+
+  When Fl_Tabs is resized vertically, the default behavior scales the
+  tab's height as well as its children.  To keep the tab height constant
+  during resizing, set the tab widget's resizable() to one of the tab's
+  child groups, i.e.
+
+  \par
+  \code
+    tabs = new Fl_Tabs(..);
+    grp1 = new Fl_Group(..);
+    ..
+    grp2 = new Fl_Group(..);
+    ..
+    tabs->end();
+    tabs->resizable(grp1);	// keeps tab height constant
+  \endcode
+
+  \par Callback's Use Of when()
+
+  As of FLTK 1.3.3, Fl_Tabs() supports the following flags for when():
+
+    - \ref FL_WHEN_NEVER       -- callback never invoked (all flags off)
+    - \ref FL_WHEN_CHANGED     -- if flag set, invokes callback when a tab has been changed (on click or keyboard navigation)
+    - \ref FL_WHEN_NOT_CHANGED -- if flag set, invokes callback when the tabs remain unchanged (on click or keyboard navigation)
+    - \ref FL_WHEN_RELEASE     -- if flag set, invokes callback on RELEASE of mouse button or keyboard navigation
+
+  Notes:
+
+    -#  The above flags can be logically OR-ed (|) or added (+) to combine behaviors.
+    -#  The default value for when() is \ref FL_WHEN_RELEASE (inherited from Fl_Widget).
+    -#  If \ref FL_WHEN_RELEASE is the \em only flag specified, 
+        the behavior will be as if (\ref FL_WHEN_RELEASE|\ref FL_WHEN_CHANGED) was specified.
+    -#  The value of changed() will be valid during the callback.
+    -#  If both \ref FL_WHEN_CHANGED and \ref FL_WHEN_NOT_CHANGED are specified, 
+        the callback is invoked whether the tab has been changed or not.
+	The changed() method can be used to determine the cause.
+    -#  \ref FL_WHEN_NOT_CHANGED can happen if someone clicks on an already selected tab,
+        or if a keyboard navigation attempt results in no change to the tabs,
+	such as using the arrow keys while at the left or right end of the tabs.
 */
 */
 class FL_EXPORT Fl_Tabs : public Fl_Group {
 class FL_EXPORT Fl_Tabs : public Fl_Group {
   Fl_Widget *value_;
   Fl_Widget *value_;
@@ -68,6 +216,16 @@ public:
   int handle(int);
   int handle(int);
   Fl_Widget *value();
   Fl_Widget *value();
   int value(Fl_Widget *);
   int value(Fl_Widget *);
+  /**
+    Returns the tab group for the tab the user has currently down-clicked on
+    and remains over until FL_RELEASE. Otherwise, returns NULL.
+
+    While the user is down-clicked on a tab, the return value is the tab group
+    for that tab. But as soon as the user releases, or drags off the tab with
+    the button still down, the return value will be NULL.
+
+    \see push(Fl_Widget*).
+  */
   Fl_Widget *push() const {return push_;}
   Fl_Widget *push() const {return push_;}
   int push(Fl_Widget *);
   int push(Fl_Widget *);
   Fl_Tabs(int,int,int,int,const char * = 0);
   Fl_Tabs(int,int,int,int,const char * = 0);
@@ -81,5 +239,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Tabs, Fl_Group)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Tabs.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Tabs.H 10120 2014-03-23 17:36:59Z greg.ercolano $".
 //
 //

+ 3 - 3
fltk/FL/Fl_Text_Buffer.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Text_Buffer.H 9366 2012-04-21 15:05:00Z fabien $"
+// "$Id: Fl_Text_Buffer.H 9956 2013-08-12 15:46:57Z greg.ercolano $"
 //
 //
 // Header file for Fl_Text_Buffer class.
 // Header file for Fl_Text_Buffer class.
 //
 //
@@ -207,7 +207,7 @@ public:
   /**
   /**
    Returns the character at the specified position pos in the buffer.
    Returns the character at the specified position pos in the buffer.
    Positions start at 0 
    Positions start at 0 
-   \param pos byte offset into buffer, pos must be at acharacter boundary
+   \param pos byte offset into buffer, pos must be at a character boundary
    \return Unicode UCS-4 encoded character
    \return Unicode UCS-4 encoded character
    */
    */
   unsigned int char_at(int pos) const;
   unsigned int char_at(int pos) const;
@@ -766,5 +766,5 @@ protected:
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Text_Buffer.H 9366 2012-04-21 15:05:00Z fabien $".
+// End of "$Id: Fl_Text_Buffer.H 9956 2013-08-12 15:46:57Z greg.ercolano $".
 //
 //

+ 73 - 11
fltk/FL/Fl_Text_Display.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Text_Display.H 9078 2011-09-28 20:08:48Z matt $"
+// "$Id: Fl_Text_Display.H 10152 2014-05-21 06:56:59Z greg.ercolano $"
 //
 //
 // Header file for Fl_Text_Display class.
 // Header file for Fl_Text_Display class.
 //
 //
@@ -33,10 +33,51 @@
 /**
 /**
  \brief Rich text display widget.
  \brief Rich text display widget.
  
  
- This is the FLTK text display widget. It allows the user to view multiple lines
- of text and supports highlighting and scrolling. The buffer that is displayed 
- in the widget is managed by the Fl_Text_Buffer class. A single Text Buffer
- can be displayed by multiple Text Displays.
+ This is the FLTK text display widget. It allows the user to view
+ multiple lines of text and supports highlighting, word wrap, mixes
+ of font faces and colors, line numbers and scrolling.  The buffer
+ that is displayed in the widget is managed by the Fl_Text_Buffer
+ class. A single Text Buffer can be displayed by multiple Text
+ Displays.
+
+ \image html editor.png "Fl_Text_Display widget"
+ \image latex editor.png "Fl_Text_Display widget" width=6cm
+ <BR><BR>
+ \image html editor-linenumbers.png "Fl_Text_Display widget with line numbers enabled"
+ \image latex editor-linenumbers.png "Fl_Text_Display widget with line numbers enabled" width=6cm
+
+ \b Example \b Use
+ \code
+     #include <FL/FL_Text_Display.H>
+     ..
+     int main() {
+         ..
+         Fl_Text_Buffer *buff = new Fl_Text_Buffer();
+         Fl_Text_Display *disp = new Fl_Text_Display(10, 10, 640, 480);
+         disp->buffer(buff);                 // attach text buffer to display widget
+         buff->text("line one\nline two");   // add some text to buffer
+	 ..
+     }
+ \endcode
+
+ \b Features
+
+ - Word wrap: wrap_mode(), wrapped_column(), wrapped_row()
+ - Font control: textfont(), textsize(), textcolor()
+ - Font styling: highlight_data()
+ - Cursor: cursor_style(), show_cursor(), hide_cursor(), cursor_color()
+ - Line numbers: linenumber_width(), linenumber_font(),
+   linenumber_size(), linenumber_fgcolor(), linenumber_bgcolor(),
+   linenumber_align(), linenumber_format()
+
+ Note that other features may be available via Fl_Text_Editor
+ and Fl_Text_Buffer classes.
+
+ \note Line numbers were added in 1.3.3. To avoid breaking ABI,
+       many of its options are read only. To adjust these features
+       in 1.3.x, you must build FLTK with FLTK_ABI_VERSION set to 10303
+       or higher.
+
  */
  */
 class FL_EXPORT Fl_Text_Display: public Fl_Group {
 class FL_EXPORT Fl_Text_Display: public Fl_Group {
 
 
@@ -293,6 +334,21 @@ public:
    */
    */
   double col_to_x(double col) const;
   double col_to_x(double col) const;
   
   
+  void linenumber_width(int width);
+  int linenumber_width() const;
+  void linenumber_font(Fl_Font val);
+  Fl_Font linenumber_font() const;
+  void linenumber_size(Fl_Fontsize val);
+  Fl_Fontsize linenumber_size() const;
+  void linenumber_fgcolor(Fl_Color val);
+  Fl_Color linenumber_fgcolor() const;
+  void linenumber_bgcolor(Fl_Color val);
+  Fl_Color linenumber_bgcolor() const;
+  void linenumber_align(Fl_Align val);
+  Fl_Align linenumber_align() const;
+  void linenumber_format(const char* val);
+  const char* linenumber_format() const;
+
 protected:
 protected:
   // Most (all?) of this stuff should only be called from resize() or
   // Most (all?) of this stuff should only be called from resize() or
   // draw().
   // draw().
@@ -461,18 +517,24 @@ protected:
   Fl_Color textcolor_;
   Fl_Color textcolor_;
   Fl_Fontsize extralinespace_;
   Fl_Fontsize extralinespace_;
   
   
-  // The following are not presently used from the original NEdit code,
-  // but are being put here so that future versions of Fl_Text_Display
-  // can implement line numbers without breaking binary compatibility.
-  
-  /* Line number margin and width */
+  // Line number margin and width
   int mLineNumLeft, mLineNumWidth;
   int mLineNumLeft, mLineNumWidth;
 
 
+  // Line number font/colors
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Font     linenumber_font_;
+  Fl_Fontsize linenumber_size_;
+  Fl_Color    linenumber_fgcolor_;
+  Fl_Color    linenumber_bgcolor_;
+  Fl_Align    linenumber_align_;
+  const char* linenumber_format_;
+#endif
+
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Text_Display, Fl_Group)
 DECLARE_CLASS_CHEAP_RTTI_2(Fl_Text_Display, Fl_Group)
 };
 };
 
 
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Text_Display.H 9078 2011-09-28 20:08:48Z matt $".
+// End of "$Id: Fl_Text_Display.H 10152 2014-05-21 06:56:59Z greg.ercolano $".
 //
 //

+ 144 - 63
fltk/FL/Fl_Tree.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Tree.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Tree.H 10081 2014-01-24 19:03:15Z greg.ercolano $"
 //
 //
 
 
 #ifndef FL_TREE_H
 #ifndef FL_TREE_H
@@ -79,80 +79,81 @@
 ///      tree.add("Simpsons/Lisa");
 ///      tree.add("Simpsons/Lisa");
 ///    tree.end();
 ///    tree.end();
 /// \endcode
 /// \endcode
-///
-/// \b FEATURES
-///
-///     Items can be added with add(),
-///     removed with remove(),
-///     completely cleared with clear(),
-///     inserted with insert() and insert_above(),
-///     selected/deselected with select() and deselect(),
-///     open/closed with open() and closed().
-///     Children of an item can be swapped around with Fl_Tree_Item::swap_children(),
-///     sorting can be controlled when items are add()ed via sortorder().
-///     You can walk the entire tree with first() and next().
+///     
+/// \par FEATURES
+///     Items can be added with add(),<BR>
+///     removed with remove(),<BR>
+///     completely cleared with clear(),<BR>
+///     inserted with insert() and insert_above(),<BR>
+///     selected/deselected with select() and deselect(),<BR>
+///     open/closed with open() and close(),<BR>
+///     positioned on the screen with show_item_top(), show_item_middle() and
+///     show_item_bottom(),<BR>
+///     item children can be swapped around with Fl_Tree_Item::swap_children(),<BR>
+///     sorting can be controlled when items are add()ed via sortorder().<BR>
+///     You can walk the entire tree with first() and next().<BR>
+///     You can walk visible items with first_visible_item()
+///     and next_visible_item().<BR>
 ///     You can walk selected items with first_selected_item() and
 ///     You can walk selected items with first_selected_item() and
-///     next_selected_item().
+///     next_selected_item().<BR>
 ///     Items can be found by their pathname using find_item(const char*),
 ///     Items can be found by their pathname using find_item(const char*),
-///     and an item's pathname can be found with item_pathname().
-///     The selected items' colors are controlled by selection_color() (inherited from Fl_Widget).
-///
-/// \b SELECTION OF ITEMS
+///     and an item's pathname can be found with item_pathname().<BR>
+///     The selected items' colors are controlled by selection_color()
+///     (inherited from Fl_Widget).<BR>
+///     A hook is provided to allow you to redefine how item's labels are drawn
+///     via Fl_Tree::item_draw_callback().<BR>
 ///
 ///
+/// \par SELECTION OF ITEMS
 ///     The tree can have different selection behaviors controlled by selectmode().
 ///     The tree can have different selection behaviors controlled by selectmode().
 ///     The background color used for selected items is the Fl_Tree::selection_color().
 ///     The background color used for selected items is the Fl_Tree::selection_color().
 ///     The foreground color for selected items is controlled internally with fl_contrast().
 ///     The foreground color for selected items is controlled internally with fl_contrast().
 ///
 ///
-/// \b CHILD WIDGETS
-///
+/// \par CHILD WIDGETS
 ///     FLTK widgets (including custom widgets) can be assigned to tree items via
 ///     FLTK widgets (including custom widgets) can be assigned to tree items via
 ///     Fl_Tree_Item::widget().
 ///     Fl_Tree_Item::widget().
-///
-///     When a widget() is defined, the default behavior is for the widget()
-///     to be shown in place of the item's label (if it has one).
+/// \par
+///     When an Fl_Tree_Item::widget() is defined, the default behavior is for the
+///     widget() to be shown in place of the item's label (if it has one).
 ///     Only the widget()'s width will be used; the widget()'s x() and y() position
 ///     Only the widget()'s width will be used; the widget()'s x() and y() position
 ///     will be managed by the tree, and the h() will track the item's height.
 ///     will be managed by the tree, and the h() will track the item's height.
-///     This default behavior can be altered: 
+///     This default behavior can be altered (ABI 1.3.1): 
 ///     Setting Fl_Tree::item_draw_mode()'s FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET flag
 ///     Setting Fl_Tree::item_draw_mode()'s FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET flag
 ///     causes the label + widget to be displayed together in that order, and
 ///     causes the label + widget to be displayed together in that order, and
 ///     adding the FL_TREE_ITEM_HEIGHT_FROM_WIDGET flag causes widget's height
 ///     adding the FL_TREE_ITEM_HEIGHT_FROM_WIDGET flag causes widget's height
 ///     to define the widget()'s height.
 ///     to define the widget()'s height.
 ///
 ///
-/// \b ICONS
-///
+/// \par ICONS
 ///     The tree's open/close icons can be redefined with
 ///     The tree's open/close icons can be redefined with
 ///     Fl_Tree::openicon(), Fl_Tree::closeicon(). User icons
 ///     Fl_Tree::openicon(), Fl_Tree::closeicon(). User icons
 ///     can either be changed globally with Fl_Tree::usericon(),
 ///     can either be changed globally with Fl_Tree::usericon(),
 ///     or on a per-item basis with Fl_Tree_Item::usericon().
 ///     or on a per-item basis with Fl_Tree_Item::usericon().
-///
-///     Various default preferences can be globally manipulated via Fl_Tree_Prefs,
+/// \par
+///     Various default preferences can be globally manipulated via Fl_Tree_Prefs, 
 ///     including colors, margins, icons, connection lines, etc. 
 ///     including colors, margins, icons, connection lines, etc. 
 ///
 ///
-/// \b FONTS AND COLORS
-///
+/// \par FONTS AND COLORS
 ///     When adding new items to the tree, the new items get the
 ///     When adding new items to the tree, the new items get the
 ///     defaults for fonts and colors from:
 ///     defaults for fonts and colors from:
-///
+/// \par
 ///	- Fl_Tree::item_labelfont() -- The default item label font (default: FL_HELVETICA)
 ///	- Fl_Tree::item_labelfont() -- The default item label font (default: FL_HELVETICA)
 ///     - Fl_Tree::item_labelsize() -- The default item label size (default: FL_NORMAL_SIZE)
 ///     - Fl_Tree::item_labelsize() -- The default item label size (default: FL_NORMAL_SIZE)
 ///     - Fl_Tree::item_labelfgcolor() -- The default item label foreground color (default: FL_FOREGROUND_COLOR)
 ///     - Fl_Tree::item_labelfgcolor() -- The default item label foreground color (default: FL_FOREGROUND_COLOR)
 ///     - Fl_Tree::item_labelbgcolor() -- The default item label background color (default: 0xffffffff, which tree uses as 'transparent')
 ///     - Fl_Tree::item_labelbgcolor() -- The default item label background color (default: 0xffffffff, which tree uses as 'transparent')
-///
+/// \par
 ///     Each item (Fl_Tree_Item) inherits a copy of these font/color attributes when created,
 ///     Each item (Fl_Tree_Item) inherits a copy of these font/color attributes when created,
 ///     and each item has its own methods to let the app change these values on a per-item basis
 ///     and each item has its own methods to let the app change these values on a per-item basis
 ///	using methods of the same name:
 ///	using methods of the same name:
+/// \par
+///	- Fl_Tree_Item::labelfont() -- The item's label font (default: FL_HELVETICA)
+///     - Fl_Tree_Item::labelsize() -- The item's label size (default: FL_NORMAL_SIZE)
+///     - Fl_Tree_Item::labelfgcolor() -- The item's label foreground color (default: FL_FOREGROUND_COLOR)
+///     - Fl_Tree_Item::labelbgcolor() -- The item's label background color (default: 0xffffffff, which uses the tree's own bg color)
 ///
 ///
-///	- Fl_Tree_Item::item_labelfont() -- The item's label font (default: FL_HELVETICA)
-///     - Fl_Tree_Item::item_labelsize() -- The item's label size (default: FL_NORMAL_SIZE)
-///     - Fl_Tree_Item::item_labelfgcolor() -- The item's label foreground color (default: FL_FOREGROUND_COLOR)
-///     - Fl_Tree_Item::item_labelbgcolor() -- The item's label background color (default: 0xffffffff, which tree uses as 'transparent')
-///
-/// \b CALLBACKS
-///
+/// \par CALLBACKS
 ///     The tree's callback() will be invoked when items change state or are open/closed.
 ///     The tree's callback() will be invoked when items change state or are open/closed.
 ///     when() controls when mouse/keyboard events invoke the callback.
 ///     when() controls when mouse/keyboard events invoke the callback.
-///     callback_item() and callback_reason() can be used to determine the cause of the callback. eg:
-///
+///     callback_item() and callback_reason() can be used to determine the cause of the callback. e.g.
+/// \par
 /// \code
 /// \code
 /// void MyTreeCallback(Fl_Widget *w, void *data) {
 /// void MyTreeCallback(Fl_Widget *w, void *data) {
 ///   Fl_Tree      *tree = (Fl_Tree*)w;
 ///   Fl_Tree      *tree = (Fl_Tree*)w;
@@ -166,13 +167,18 @@
 ///   }
 ///   }
 /// \endcode
 /// \endcode
 ///
 ///
-///     To get the item's full menu pathname, you can use Fl_Tree::item_pathname(), eg:
-///
+/// \par SIMPLE EXAMPLES
+///     To find all the selected items:
+/// \code
+/// for ( Fl_Tree_Item *i=first_selected_item(); i; i=next_selected_item(i) )
+///   printf("Item %s is selected\n", i->label());
+/// \endcode
+///     To get an item's full menu pathname, use Fl_Tree::item_pathname(), e.g.
 /// \code
 /// \code
 ///   char pathname[256] = "???";
 ///   char pathname[256] = "???";
 ///   tree->item_pathname(pathname, sizeof(pathname), item);		// eg. "Parent/Child/Item"
 ///   tree->item_pathname(pathname, sizeof(pathname), item);		// eg. "Parent/Child/Item"
 /// \endcode
 /// \endcode
-///
+/// \par
 ///     To walk all the items of the tree from top to bottom:
 ///     To walk all the items of the tree from top to bottom:
 /// \code
 /// \code
 /// // Walk all the items in the tree, and print their labels
 /// // Walk all the items in the tree, and print their labels
@@ -180,8 +186,8 @@
 ///     printf("Item: %s\n", item->label());
 ///     printf("Item: %s\n", item->label());
 /// }
 /// }
 /// \endcode
 /// \endcode
-///
-///     To recursively walk all the children of a particular item,
+/// \par
+///     To recursively walk all the children of a particular item, 
 ///     define a function that uses recursion:
 ///     define a function that uses recursion:
 ///     \code
 ///     \code
 /// // Find all of the item's children and print an indented report of their labels
 /// // Find all of the item's children and print an indented report of their labels
@@ -192,8 +198,8 @@
 ///     }
 ///     }
 /// }
 /// }
 ///     \endcode
 ///     \endcode
-///
-///     To change the default label font and color for creating new items:
+/// \par
+///     To change the default label font and color when creating new items:
 /// \code
 /// \code
 ///  tree = new Fl_Tree(..);
 ///  tree = new Fl_Tree(..);
 ///  tree->item_labelfont(FL_COURIER);	// Use Courier font for all new items
 ///  tree->item_labelfont(FL_COURIER);	// Use Courier font for all new items
@@ -204,8 +210,8 @@
 ///  tree->add("Bbb");
 ///  tree->add("Bbb");
 ///  [..]
 ///  [..]
 /// \endcode
 /// \endcode
-///
-///     To change the font and color of all items in the tree:
+/// \par
+///     To change the font and color of all existing items in the tree:
 /// \code
 /// \code
 /// // Change the font and color of all items currently in the tree
 /// // Change the font and color of all items currently in the tree
 /// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
 /// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
@@ -214,12 +220,19 @@
 /// }
 /// }
 /// \endcode
 /// \endcode
 ///
 ///
+/// \par DISPLAY DESCRIPTION
 ///     The following image shows the tree's various visual elements
 ///     The following image shows the tree's various visual elements
 ///     and the methods that control them:
 ///     and the methods that control them:
-///
+/// \par
 ///     \image html tree-elements.png
 ///     \image html tree-elements.png
-///     \image latex tree-elements.png "Fl_Tree dimensions" width=6cm
-///
+///     \image latex tree-elements.png "Fl_Tree elements" width=6cm
+/// \par
+///     The following shows the protected 'tree inner' (tix..)
+///     and 'tree outer' (tox..) dimension variables:
+///     \image html tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm
+///     \image latex tree-dimensions.png "Fl_Tree inner/outer dimensions" width=6cm
+///
+/// \par KEYBOARD BINDINGS
 ///     The following table lists keyboard bindings for navigating the tree:
 ///     The following table lists keyboard bindings for navigating the tree:
 ///
 ///
 ///  <TABLE BORDER="1" SUMMARY="Fl_Tree keyboard bindings.">
 ///  <TABLE BORDER="1" SUMMARY="Fl_Tree keyboard bindings.">
@@ -317,23 +330,36 @@ protected:
   Fl_Tree_Reason _callback_reason;		// reason for the callback
   Fl_Tree_Reason _callback_reason;		// reason for the callback
   Fl_Tree_Prefs  _prefs;			// all the tree's settings
   Fl_Tree_Prefs  _prefs;			// all the tree's settings
   int            _scrollbar_size;		// size of scrollbar trough
   int            _scrollbar_size;		// size of scrollbar trough
-
 #if FLTK_ABI_VERSION >= 10301
 #if FLTK_ABI_VERSION >= 10301
   // NEW: 
   // NEW: 
   Fl_Tree_Item *_lastselect;
   Fl_Tree_Item *_lastselect;
 #else /*FLTK_ABI_VERSION*/
 #else /*FLTK_ABI_VERSION*/
   // OLD: static data inside handle() method
   // OLD: static data inside handle() method
 #endif /*FLTK_ABI_VERSION*/
 #endif /*FLTK_ABI_VERSION*/
-
   void fix_scrollbar_order();
   void fix_scrollbar_order();
 
 
 protected:
 protected:
-  Fl_Scrollbar *_vscroll;			///< Vertical scrollbar
+  Fl_Scrollbar *_vscroll;	///< Vertical scrollbar
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Scrollbar *_hscroll;	///< Horizontal scrollbar
+  int _tox,_toy,_tow,_toh;	///< Tree widget outer xywh dimension: outside scrollbars, inside widget border
+  int _tix,_tiy,_tiw,_tih;	///< Tree widget inner xywh dimension: inside borders + scrollbars
+
+  /// the calculated width of the entire tree hierarchy. See calc_tree()
+  int _tree_w;
+  /// the calculated height of the entire tree hierarchy. See calc_tree()
+  int _tree_h;
+#endif
   void item_clicked(Fl_Tree_Item* val);
   void item_clicked(Fl_Tree_Item* val);
   void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason);
   void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason);
+#if FLTK_ABI_VERSION >= 10303
+// next_visible_item() and extend_selection() moved to 'public' in ABI 1.3.3
+// undocmented draw_tree() dropped -- draw() does all the work now
+#else
   Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);
   Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);
   void extend_selection(Fl_Tree_Item *from, Fl_Tree_Item *to);
   void extend_selection(Fl_Tree_Item *from, Fl_Tree_Item *to);
-  int draw_tree();
+  int draw_tree();
+#endif
   void set_root(Fl_Tree_Item *item);
   void set_root(Fl_Tree_Item *item);
 
 
 public:
 public:
@@ -342,19 +368,27 @@ public:
   int handle(int e);
   int handle(int e);
   void draw();
   void draw();
   void show_self();
   void show_self();
+  void resize(int,int,int,int);
 
 
   ///////////////////////
   ///////////////////////
   // root methods
   // root methods
   ///////////////////////
   ///////////////////////
   void root_label(const char *new_label);
   void root_label(const char *new_label);
   Fl_Tree_Item* root();
   Fl_Tree_Item* root();
+  void root(Fl_Tree_Item *newitem);
+  const Fl_Tree_Prefs& prefs() const { return _prefs; }
 
 
   ////////////////////////////////
   ////////////////////////////////
   // Item creation/removal methods
   // Item creation/removal methods
   ////////////////////////////////
   ////////////////////////////////
   virtual Fl_Tree_Item *new_fl_tree_item(const Fl_Tree_Prefs &prefs);
   virtual Fl_Tree_Item *new_fl_tree_item(const Fl_Tree_Prefs &prefs);
-  Fl_Tree_Item *add(const char *path);
-  Fl_Tree_Item* add(Fl_Tree_Item *item, const char *name);
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem=0);
+#else
+  Fl_Tree_Item *add(const char *path);
+  Fl_Tree_Item *add(const char *path, Fl_Tree_Item *newitem);
+#endif
+  Fl_Tree_Item* add(Fl_Tree_Item *parent_item, const char *name);
   Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
   Fl_Tree_Item *insert_above(Fl_Tree_Item *above, const char *name);
   Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
   Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
   int remove(Fl_Tree_Item *item);
   int remove(Fl_Tree_Item *item);
@@ -367,7 +401,13 @@ public:
   Fl_Tree_Item *find_item(const char *path);
   Fl_Tree_Item *find_item(const char *path);
   const Fl_Tree_Item *find_item(const char *path) const;
   const Fl_Tree_Item *find_item(const char *path) const;
   int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
   int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
+#if FLTK_ABI_VERSION >= 10303
+  const Fl_Tree_Item* find_clicked(int yonly=0) const;
+  Fl_Tree_Item* find_clicked(int yonly=0);
+#else
   const Fl_Tree_Item *find_clicked() const;
   const Fl_Tree_Item *find_clicked() const;
+  Fl_Tree_Item *find_clicked();
+#endif
   Fl_Tree_Item *item_clicked();
   Fl_Tree_Item *item_clicked();
   /// Return the parent for specified \p item.
   /// Return the parent for specified \p item.
   ///
   ///
@@ -380,13 +420,26 @@ public:
     return(_item_focus);
     return(_item_focus);
   }
   }
   Fl_Tree_Item *first();
   Fl_Tree_Item *first();
-  Fl_Tree_Item *first_visible();
+  Fl_Tree_Item *first_visible();		// deprecated in ABI 10303
+  Fl_Tree_Item *first_visible_item();
   Fl_Tree_Item *next(Fl_Tree_Item *item=0);
   Fl_Tree_Item *next(Fl_Tree_Item *item=0);
   Fl_Tree_Item *prev(Fl_Tree_Item *item=0);
   Fl_Tree_Item *prev(Fl_Tree_Item *item=0);
   Fl_Tree_Item *last();
   Fl_Tree_Item *last();
-  Fl_Tree_Item *last_visible();
+  Fl_Tree_Item *last_visible();			// deprecated in ABI 10303
+  Fl_Tree_Item *last_visible_item();
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);	// made public in 1.3.3 ABI
+#endif
   Fl_Tree_Item *first_selected_item();
   Fl_Tree_Item *first_selected_item();
+  Fl_Tree_Item *last_selected_item();
+  Fl_Tree_Item *next_item(Fl_Tree_Item *item, int dir=FL_Down, bool visible=false);
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0, int dir=FL_Down);
+  int get_selected_items(Fl_Tree_Item_Array &items);
+#else
   Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0);
   Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0);
+  Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item, int dir);
+#endif
 
 
   //////////////////////////
   //////////////////////////
   // Item open/close methods
   // Item open/close methods
@@ -412,6 +465,26 @@ public:
   int deselect_all(Fl_Tree_Item *item=0, int docallback=1);
   int deselect_all(Fl_Tree_Item *item=0, int docallback=1);
   int select_only(Fl_Tree_Item *selitem, int docallback=1);
   int select_only(Fl_Tree_Item *selitem, int docallback=1);
   int select_all(Fl_Tree_Item *item=0, int docallback=1);
   int select_all(Fl_Tree_Item *item=0, int docallback=1);
+  int extend_selection_dir(Fl_Tree_Item *from,
+                           Fl_Tree_Item *to,
+			   int dir,
+			   int val,
+			   bool visible);
+#if FLTK_ABI_VERSION >= 10303
+  int extend_selection(Fl_Tree_Item *from,
+  		       Fl_Tree_Item *to,
+		       int val=1,
+		       bool visible=false);
+#else
+private:
+  // Adding overload if not at least one overload breaks ABI, so avoid
+  // by keeping private until we can break ABI. ref: http://www.ros.org/reps/rep-0009.html
+  int extend_selection__(Fl_Tree_Item *from,
+  			 Fl_Tree_Item *to,
+			 int val,
+			 bool visible);
+public:
+#endif
   void set_item_focus(Fl_Tree_Item *item);
   void set_item_focus(Fl_Tree_Item *item);
   Fl_Tree_Item *get_item_focus() const;
   Fl_Tree_Item *get_item_focus() const;
   int is_selected(Fl_Tree_Item *item) const;
   int is_selected(Fl_Tree_Item *item) const;
@@ -476,7 +549,12 @@ public:
   Fl_Tree_Item_Draw_Mode item_draw_mode() const;
   Fl_Tree_Item_Draw_Mode item_draw_mode() const;
   void item_draw_mode(Fl_Tree_Item_Draw_Mode mode);
   void item_draw_mode(Fl_Tree_Item_Draw_Mode mode);
   void item_draw_mode(int mode);
   void item_draw_mode(int mode);
-#endif /*FLTK_ABI_VERSION*/
+#endif
+#if FLTK_ABI_VERSION >= 10303
+  void calc_dimensions();
+  void calc_tree();
+#endif
+  void recalc_tree();
   int displayed(Fl_Tree_Item *item);
   int displayed(Fl_Tree_Item *item);
   void show_item(Fl_Tree_Item *item, int yoff);
   void show_item(Fl_Tree_Item *item, int yoff);
   void show_item(Fl_Tree_Item *item);
   void show_item(Fl_Tree_Item *item);
@@ -488,11 +566,14 @@ public:
   void display(Fl_Tree_Item *item);
   void display(Fl_Tree_Item *item);
   int  vposition() const;
   int  vposition() const;
   void vposition(int pos);
   void vposition(int pos);
+  int  hposition() const;
+  void hposition(int pos);
 
 
   int is_scrollbar(Fl_Widget *w);
   int is_scrollbar(Fl_Widget *w);
   int scrollbar_size() const;
   int scrollbar_size() const;
   void scrollbar_size(int size);
   void scrollbar_size(int size);
   int is_vscroll_visible() const;
   int is_vscroll_visible() const;
+  int is_hscroll_visible() const;
 
 
   ///////////////////////
   ///////////////////////
   // callback related
   // callback related
@@ -510,5 +591,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Tree, Fl_Group)
 #endif /*FL_TREE_H*/
 #endif /*FL_TREE_H*/
 
 
 //
 //
-// End of "$Id: Fl_Tree.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Tree.H 10081 2014-01-24 19:03:15Z greg.ercolano $".
 //
 //

+ 136 - 40
fltk/FL/Fl_Tree_Item.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Tree_Item.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Tree_Item.H 10157 2014-05-22 15:38:27Z greg.ercolano $"
 //
 //
 
 
 #ifndef FL_TREE_ITEM_H
 #ifndef FL_TREE_ITEM_H
@@ -36,7 +36,8 @@
 /// \brief This file contains the definitions for Fl_Tree_Item
 /// \brief This file contains the definitions for Fl_Tree_Item
 ///
 ///
 
 
-/// \brief Tree item
+/// \class Fl_Tree_Item
+/// \brief Tree widget item.
 ///
 ///
 /// This class is a single tree item, and manages all of the item's attributes.
 /// This class is a single tree item, and manages all of the item's attributes.
 /// Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item.
 /// Fl_Tree_Item is used by Fl_Tree, which is comprised of many instances of Fl_Tree_Item.
@@ -51,18 +52,38 @@
 /// When you make changes to items, you'll need to tell the tree to redraw()
 /// When you make changes to items, you'll need to tell the tree to redraw()
 /// for the changes to show up.
 /// for the changes to show up.
 ///
 ///
+/// New 1.3.3 ABI feature:
+/// You can define custom items by either adding a custom widget to the item
+/// with Fl_Tree_Item::widget(), or override the draw_item_content() method
+/// if you want to just redefine how the label is drawn.
+///
+/// The following shows the Fl_Tree_Item's dimensions, useful when overriding
+/// the draw_item_content() method:
+///
+///     \image html  Fl_Tree_Item-dimensions.png "Fl_Tree_Item's internal dimensions." width=6cm
+///     \image latex Fl_Tree_Item-dimensions.png "Fl_Tree_Item's internal dimensions." width=6cm
+///
+class Fl_Tree;
 class FL_EXPORT Fl_Tree_Item {
 class FL_EXPORT Fl_Tree_Item {
-protected:
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree                *_tree;		// parent tree
+#endif
   const char             *_label;		// label (memory managed)
   const char             *_label;		// label (memory managed)
   Fl_Font                 _labelfont;		// label's font face
   Fl_Font                 _labelfont;		// label's font face
   Fl_Fontsize             _labelsize;		// label's font size
   Fl_Fontsize             _labelsize;		// label's font size
   Fl_Color                _labelfgcolor;	// label's fg color
   Fl_Color                _labelfgcolor;	// label's fg color
   Fl_Color                _labelbgcolor;	// label's bg color (0xffffffff is 'transparent')
   Fl_Color                _labelbgcolor;	// label's bg color (0xffffffff is 'transparent')
+#if FLTK_ABI_VERSION >= 10303
+  /// \enum Fl_Tree_Item_Flags
+  enum Fl_Tree_Item_Flags {
+#else
+  /// \enum
   enum {
   enum {
+#endif
     OPEN                = 1<<0,		///> item is open
     OPEN                = 1<<0,		///> item is open
     VISIBLE             = 1<<1,		///> item is visible
     VISIBLE             = 1<<1,		///> item is visible
     ACTIVE              = 1<<2,		///> item is active
     ACTIVE              = 1<<2,		///> item is active
-    SELECTED            = 1<<3,		///> item is selected
+    SELECTED            = 1<<3		///> item is selected
   };
   };
 #if FLTK_ABI_VERSION >= 10301
 #if FLTK_ABI_VERSION >= 10301
   // NEW
   // NEW
@@ -86,21 +107,59 @@ protected:
   Fl_Tree_Item           *_prev_sibling;	// previous sibling (same level)
   Fl_Tree_Item           *_prev_sibling;	// previous sibling (same level)
   Fl_Tree_Item           *_next_sibling;	// next sibling (same level)
   Fl_Tree_Item           *_next_sibling;	// next sibling (same level)
 #endif /*FLTK_ABI_VERSION*/
 #endif /*FLTK_ABI_VERSION*/
+  // Protected methods
 protected:
 protected:
+  void _Init(const Fl_Tree_Prefs &prefs, Fl_Tree *tree);
   void show_widgets();
   void show_widgets();
   void hide_widgets();
   void hide_widgets();
   void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs);
   void draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_Prefs &prefs);
   void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
   void draw_horizontal_connector(int x1, int x2, int y, const Fl_Tree_Prefs &prefs);
+  void recalc_tree();
+  int calc_item_height(const Fl_Tree_Prefs &prefs) const;
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Color drawfgcolor() const;
+  Fl_Color drawbgcolor() const;
+#endif
+
 public:
 public:
-  Fl_Tree_Item(const Fl_Tree_Prefs &prefs);	// CTOR
-  ~Fl_Tree_Item();				// DTOR
+  Fl_Tree_Item(const Fl_Tree_Prefs &prefs);	// CTOR -- backwards compatible
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item(Fl_Tree *tree);			// CTOR -- ABI 1.3.3+
+  virtual ~Fl_Tree_Item();			// DTOR -- ABI 1.3.3+
+#else
+  ~Fl_Tree_Item();				// DTOR -- backwards compatible
+#endif
   Fl_Tree_Item(const Fl_Tree_Item *o);		// COPY CTOR
   Fl_Tree_Item(const Fl_Tree_Item *o);		// COPY CTOR
+  /// The item's x position relative to the window
   int x() const { return(_xywh[0]); }
   int x() const { return(_xywh[0]); }
+  /// The item's y position relative to the window
   int y() const { return(_xywh[1]); }
   int y() const { return(_xywh[1]); }
+  /// The entire item's width to right edge of Fl_Tree's inner width
+  /// within scrollbars.
   int w() const { return(_xywh[2]); }
   int w() const { return(_xywh[2]); }
+  /// The item's height
   int h() const { return(_xywh[3]); }
   int h() const { return(_xywh[3]); }
-  int calc_item_height(const Fl_Tree_Prefs &prefs) const;
-  void draw(int X, int &Y, int W, Fl_Widget *tree, Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1);
+  /// The item's label x position relative to the window
+  /// \version 1.3.3
+  int label_x() const { return(_label_xywh[0]); }
+  /// The item's label y position relative to the window
+  /// \version 1.3.3
+  int label_y() const { return(_label_xywh[1]); }
+  /// The item's maximum label width to right edge of Fl_Tree's inner width
+  /// within scrollbars.
+  /// \version 1.3.3
+  int label_w() const { return(_label_xywh[2]); }
+  /// The item's label height
+  /// \version 1.3.3
+  int label_h() const { return(_label_xywh[3]); }
+#if FLTK_ABI_VERSION >= 10303
+  virtual int draw_item_content(int render);
+  void draw(int X, int &Y, int W, Fl_Tree_Item *itemfocus, 
+	    int &tree_item_xmax, int lastchild=1, int render=1);
+#else
+  void draw(int X, int &Y, int W, Fl_Widget *tree, 
+            Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1);
+#endif
   void show_self(const char *indent = "") const;
   void show_self(const char *indent = "") const;
   void label(const char *val);
   void label(const char *val);
   const char *label() const;
   const char *label() const;
@@ -113,7 +172,8 @@ public:
 
 
   /// Set item's label font face.
   /// Set item's label font face.
   void labelfont(Fl_Font val) {
   void labelfont(Fl_Font val) {
-    _labelfont = val;
+    _labelfont = val;
+    recalc_tree();		// may change tree geometry
   }
   }
   /// Get item's label font face.
   /// Get item's label font face.
   Fl_Font labelfont() const {
   Fl_Font labelfont() const {
@@ -121,7 +181,8 @@ public:
   }
   }
   /// Set item's label font size.
   /// Set item's label font size.
   void labelsize(Fl_Fontsize val) {
   void labelsize(Fl_Fontsize val) {
-    _labelsize = val;
+    _labelsize = val;
+    recalc_tree();		// may change tree geometry
   }
   }
   /// Get item's label font size.
   /// Get item's label font size.
   Fl_Fontsize labelsize() const {
   Fl_Fontsize labelsize() const {
@@ -131,31 +192,34 @@ public:
   void labelfgcolor(Fl_Color val) {
   void labelfgcolor(Fl_Color val) {
     _labelfgcolor = val;
     _labelfgcolor = val;
   }
   }
-  /// Set item's label text color.
+  /// Return item's label foreground text color.
+  Fl_Color labelfgcolor() const {
+    return(_labelfgcolor); 
+  }
+  /// Set item's label text color. Alias for labelfgcolor(Fl_Color)).
   void labelcolor(Fl_Color val) {
   void labelcolor(Fl_Color val) {
-    _labelfgcolor = val;
+     labelfgcolor(val);
   }
   }
-  /// Return item's label text color.
+  /// Return item's label text color. Alias for labelfgcolor() const).
   Fl_Color labelcolor() const {
   Fl_Color labelcolor() const {
-    return(_labelfgcolor);
-  }
-  /// Return item's label foreground text color.
-  Fl_Color labelfgcolor() const {
-    return(_labelfgcolor);
+    return labelfgcolor();
   }
   }
   /// Set item's label background color.
   /// Set item's label background color.
-  /// A special case is made for color 0xffffffff which is treated as 'transparent'.
+  /// A special case is made for color 0xffffffff which uses the parent tree's bg color.
   void labelbgcolor(Fl_Color val) {
   void labelbgcolor(Fl_Color val) {
     _labelbgcolor = val;
     _labelbgcolor = val;
   }
   }
-  /// Return item's background text color.
-  /// If the color is 0xffffffff, it is 'transparent'.
+  /// Return item's label background text color.
+  /// If the color is 0xffffffff, the default behavior is the parent tree's
+  /// bg color will be used. (An overloaded draw_item_content() can override
+  /// this behavior.)
   Fl_Color labelbgcolor() const {
   Fl_Color labelbgcolor() const {
     return(_labelbgcolor);
     return(_labelbgcolor);
   }
   }
   /// Assign an FLTK widget to this item.
   /// Assign an FLTK widget to this item.
   void widget(Fl_Widget *val) {
   void widget(Fl_Widget *val) {
-    _widget = val;
+    _widget = val; 
+    recalc_tree();		// may change tree geometry
   }
   }
   /// Return FLTK widget assigned to this item.
   /// Return FLTK widget assigned to this item.
   virtual Fl_Widget *widget() const {
   virtual Fl_Widget *widget() const {
@@ -182,16 +246,30 @@ public:
   void clear_children();
   void clear_children();
   void swap_children(int ax, int bx);
   void swap_children(int ax, int bx);
   int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
   int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
-  const Fl_Tree_Item *find_child_item(char **arr) const;	// const
-        Fl_Tree_Item *find_child_item(char **arr);		// non-const
-  const Fl_Tree_Item *find_item(char **arr) const;		// const
-        Fl_Tree_Item *find_item(char **arr);			// non-const
+  const Fl_Tree_Item *find_child_item(const char *name) const;
+        Fl_Tree_Item *find_child_item(const char *name);
+  const Fl_Tree_Item *find_child_item(char **arr) const;
+        Fl_Tree_Item *find_child_item(char **arr);
+  const Fl_Tree_Item *find_item(char **arr) const;
+        Fl_Tree_Item *find_item(char **arr);
   //////////////////
   //////////////////
   // Adding items
   // Adding items
   //////////////////
   //////////////////
   virtual Fl_Tree_Item *new_fl_tree_item(const Fl_Tree_Prefs &prefs);
   virtual Fl_Tree_Item *new_fl_tree_item(const Fl_Tree_Prefs &prefs);
-  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, const char *new_label);
-  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs, char **arr);
+  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
+  		    const char *new_label,
+  		    Fl_Tree_Item *newitem);
+  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
+  		    const char *new_label);
+  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
+  		    char **arr,
+		    Fl_Tree_Item *newitem);
+  Fl_Tree_Item *add(const Fl_Tree_Prefs &prefs,
+  		    char **arr);
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item *replace(Fl_Tree_Item *new_item);
+  Fl_Tree_Item *replace_child(Fl_Tree_Item *olditem, Fl_Tree_Item *newitem);
+#endif
   Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
   Fl_Tree_Item *insert(const Fl_Tree_Prefs &prefs, const char *new_label, int pos=0);
   Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
   Fl_Tree_Item *insert_above(const Fl_Tree_Prefs &prefs, const char *new_label);
   int depth() const;
   int depth() const;
@@ -200,9 +278,11 @@ public:
   Fl_Tree_Item *next_sibling();
   Fl_Tree_Item *next_sibling();
   Fl_Tree_Item *prev_sibling();
   Fl_Tree_Item *prev_sibling();
   void update_prev_next(int index);
   void update_prev_next(int index);
-  Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs);
-  Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs);
-
+  Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs);	// deprecated
+  Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs);	// deprecated
+  Fl_Tree_Item *next_visible(Fl_Tree_Prefs &prefs);
+  Fl_Tree_Item *prev_visible(Fl_Tree_Prefs &prefs);
+  
   /// Return the parent for this item. Returns NULL if we are the root.
   /// Return the parent for this item. Returns NULL if we are the root.
   Fl_Tree_Item *parent() {
   Fl_Tree_Item *parent() {
     return(_parent);
     return(_parent);
@@ -217,6 +297,13 @@ public:
   void parent(Fl_Tree_Item *val) {
   void parent(Fl_Tree_Item *val) {
     _parent = val;
     _parent = val;
   }
   }
+#if FLTK_ABI_VERSION >= 10303
+  const Fl_Tree_Prefs& prefs() const;
+  /// Return the tree for this item.
+  const Fl_Tree *tree() const {
+    return(_tree);
+  }
+#endif
   //////////////////
   //////////////////
   // State
   // State
   //////////////////
   //////////////////
@@ -232,7 +319,7 @@ public:
   }
   }
   /// Toggle the item's open/closed state.
   /// Toggle the item's open/closed state.
   void open_toggle() {
   void open_toggle() {
-    is_open()?close():open();
+    is_open()?close():open();	// handles calling recalc_tree()
   }
   }
   /// Change the item's selection state to the optionally specified 'val'.
   /// Change the item's selection state to the optionally specified 'val'.
   /// If 'val' is not specified, the item will be selected.
   /// If 'val' is not specified, the item will be selected.
@@ -288,10 +375,9 @@ public:
   }
   }
   /// Change the item's activation state to the optionally specified 'val'.
   /// Change the item's activation state to the optionally specified 'val'.
   ///
   ///
-  /// When deactivated, the item will be 'grayed out'; the callback()
-  /// won't be invoked if the user clicks on the label. If the item
-  /// has a widget() associated with the item, its activation state
-  /// will be changed as well.
+  /// When deactivated, the item will be 'grayed out'; the callback() 
+  /// won't be invoked if the user clicks on the label. If a widget()
+  /// is associated with the item, its activation state will be changed as well.
   ///
   ///
   /// If 'val' is not specified, the item will be activated.
   /// If 'val' is not specified, the item will be activated.
   ///
   ///
@@ -316,7 +402,7 @@ public:
   char is_activated() const {
   char is_activated() const {
     return(is_flag(ACTIVE));
     return(is_flag(ACTIVE));
   }
   }
-  /// See if the item is activated.
+  /// See if the item is activated. Alias for is_activated().
   char is_active() const {
   char is_active() const {
     return(is_activated());
     return(is_activated());
   }
   }
@@ -333,6 +419,7 @@ public:
   /// Set the item's user icon to an Fl_Image. '0' will disable.
   /// Set the item's user icon to an Fl_Image. '0' will disable.
   void usericon(Fl_Image *val) {
   void usericon(Fl_Image *val) {
     _usericon = val;
     _usericon = val;
+    recalc_tree();		// may change tree geometry
   }
   }
   /// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
   /// Get the item's user icon as an Fl_Image. Returns '0' if disabled.
   Fl_Image *usericon() const {
   Fl_Image *usericon() const {
@@ -341,8 +428,13 @@ public:
   //////////////////
   //////////////////
   // Events
   // Events
   //////////////////
   //////////////////
-  const Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs) const;
-  Fl_Tree_Item *find_clicked(const Fl_Tree_Prefs &prefs);
+#if FLTK_ABI_VERSION >= 10303
+  const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0) const;
+  Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs, int yonly=0);
+#else
+  const Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs) const;
+  Fl_Tree_Item* find_clicked(const Fl_Tree_Prefs &prefs);
+#endif
   int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
   int event_on_collapse_icon(const Fl_Tree_Prefs &prefs) const;
   int event_on_label(const Fl_Tree_Prefs &prefs) const;
   int event_on_label(const Fl_Tree_Prefs &prefs) const;
   /// Is this item the root of the tree?
   /// Is this item the root of the tree?
@@ -351,10 +443,14 @@ public:
   }
   }
 
 
   // Protected methods
   // Protected methods
+  // TODO: move these to top 'protected:' section
 protected:
 protected:
 #if FLTK_ABI_VERSION >= 10301
 #if FLTK_ABI_VERSION >= 10301
   /// Set a flag to an on or off value. val is 0 or 1.
   /// Set a flag to an on or off value. val is 0 or 1.
   inline void set_flag(unsigned short flag,int val) {
   inline void set_flag(unsigned short flag,int val) {
+    if ( flag==OPEN || flag==VISIBLE ) {
+      recalc_tree();		// may change tree geometry
+    }
     if ( val ) _flags |= flag; else _flags &= ~flag;
     if ( val ) _flags |= flag; else _flags &= ~flag;
   }
   }
   /// See if flag set. Returns 0 or 1.
   /// See if flag set. Returns 0 or 1.
@@ -388,5 +484,5 @@ protected:
 #endif /*FL_TREE_ITEM_H*/
 #endif /*FL_TREE_ITEM_H*/
 
 
 //
 //
-// End of "$Id: Fl_Tree_Item.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Tree_Item.H 10157 2014-05-22 15:38:27Z greg.ercolano $".
 //
 //

+ 20 - 2
fltk/FL/Fl_Tree_Item_Array.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Tree_Item_Array.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Tree_Item_Array.H 10071 2014-01-20 21:23:24Z greg.ercolano $"
 //
 //
 
 
 #ifndef _FL_TREE_ITEM_ARRAY_H
 #ifndef _FL_TREE_ITEM_ARRAY_H
@@ -49,6 +49,12 @@ class FL_EXPORT Fl_Tree_Item_Array {
   int _total;			// #items in array
   int _total;			// #items in array
   int _size;			// #items *allocated* for array
   int _size;			// #items *allocated* for array
   int _chunksize;		// #items to enlarge mem allocation
   int _chunksize;		// #items to enlarge mem allocation
+#if FLTK_ABI_VERSION >= 10303
+  enum {			
+    MANAGE_ITEM = 1,		///> manage the Fl_Tree_Item's internals (internal use only)
+  };
+  char _flags;			// flags to control behavior
+#endif
   void enlarge(int count);
   void enlarge(int count);
 public:
 public:
   Fl_Tree_Item_Array(int new_chunksize = 10);		// CTOR
   Fl_Tree_Item_Array(int new_chunksize = 10);		// CTOR
@@ -81,12 +87,24 @@ public:
   void clear();
   void clear();
   void add(Fl_Tree_Item *val);
   void add(Fl_Tree_Item *val);
   void insert(int pos, Fl_Tree_Item *new_item);
   void insert(int pos, Fl_Tree_Item *new_item);
+  void replace(int pos, Fl_Tree_Item *new_item);
   void remove(int index);
   void remove(int index);
   int  remove(Fl_Tree_Item *item);
   int  remove(Fl_Tree_Item *item);
+#if FLTK_ABI_VERSION >= 10303
+  /// Option to control if Fl_Tree_Item_Array's destructor will also destroy the Fl_Tree_Item's.
+  /// If set: items and item array is destroyed. 
+  /// If clear: only the item array is destroyed, not items themselves.
+  void manage_item_destroy(int val) {
+    if ( val ) _flags |= MANAGE_ITEM; else _flags &= ~MANAGE_ITEM;
+  }
+  int manage_item_destroy() const {
+    return _flags & MANAGE_ITEM ? 1 : 0;
+  }
+#endif
 };
 };
 
 
 #endif /*_FL_TREE_ITEM_ARRAY_H*/
 #endif /*_FL_TREE_ITEM_ARRAY_H*/
 
 
 //
 //
-// End of "$Id: Fl_Tree_Item_Array.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Tree_Item_Array.H 10071 2014-01-20 21:23:24Z greg.ercolano $".
 //
 //

+ 29 - 5
fltk/FL/Fl_Tree_Prefs.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Tree_Prefs.H 10034 2013-12-15 18:59:02Z greg.ercolano $"
 //
 //
 
 
 #ifndef FL_TREE_PREFS_H
 #ifndef FL_TREE_PREFS_H
@@ -11,7 +11,7 @@
 // FL/Fl_Tree_Prefs.H
 // FL/Fl_Tree_Prefs.H
 //////////////////////
 //////////////////////
 //
 //
-// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
+// Fl_Tree_Prefs -- This file is part of the Fl_Tree widget for FLTK
 // Copyright (C) 2009-2010 by Greg Ercolano.
 // Copyright (C) 2009-2010 by Greg Ercolano.
 //
 //
 // This library is free software. Distribution and use rights are outlined in
 // This library is free software. Distribution and use rights are outlined in
@@ -47,7 +47,7 @@
 /// Sort order options for items added to the tree
 /// Sort order options for items added to the tree
 ///
 ///
 enum Fl_Tree_Sort {
 enum Fl_Tree_Sort {
-  FL_TREE_SORT_NONE=0,	///< No sorting; items are added in the order defined (default).
+  FL_TREE_SORT_NONE=0,		///< No sorting; items are added in the order defined (default).
   FL_TREE_SORT_ASCENDING=1,	///< Add items in ascending sort order.
   FL_TREE_SORT_ASCENDING=1,	///< Add items in ascending sort order.
   FL_TREE_SORT_DESCENDING=2	///< Add items in descending sort order.
   FL_TREE_SORT_DESCENDING=2	///< Add items in descending sort order.
 };
 };
@@ -92,6 +92,11 @@ enum Fl_Tree_Item_Draw_Mode {
   FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2	///< If widget() defined, widget()'s height controls item's height
   FL_TREE_ITEM_HEIGHT_FROM_WIDGET=2	///< If widget() defined, widget()'s height controls item's height
 };
 };
 #endif /*FLTK_ABI_VERSION*/
 #endif /*FLTK_ABI_VERSION*/
+
+#if FLTK_ABI_VERSION >= 10303
+class Fl_Tree_Item;
+typedef void (Fl_Tree_Item_Draw_Callback)(Fl_Tree_Item*, void*);
+#endif
 
 
 /// \class Fl_Tree_Prefs
 /// \class Fl_Tree_Prefs
 ///
 ///
@@ -134,6 +139,10 @@ class FL_EXPORT Fl_Tree_Prefs {
   Fl_Tree_Item_Reselect_Mode _itemreselectmode;	// controls item selection callback() behavior
   Fl_Tree_Item_Reselect_Mode _itemreselectmode;	// controls item selection callback() behavior
   Fl_Tree_Item_Draw_Mode     _itemdrawmode;	// controls how items draw label + widget()
   Fl_Tree_Item_Draw_Mode     _itemdrawmode;	// controls how items draw label + widget()
 #endif /*FLTK_ABI_VERSION*/
 #endif /*FLTK_ABI_VERSION*/
+#if FLTK_ABI_VERSION >= 10303
+  Fl_Tree_Item_Draw_Callback *_itemdrawcallback;	// callback to handle drawing items (0=none)
+  void                       *_itemdrawuserdata;	// data for drawing items (0=none)
+#endif
 public:
 public:
   Fl_Tree_Prefs();
   Fl_Tree_Prefs();
   
   
@@ -412,11 +421,26 @@ public:
   inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
   inline void item_draw_mode(Fl_Tree_Item_Draw_Mode val) {
     _itemdrawmode = val;
     _itemdrawmode = val;
   }
   }
-#endif /*FLTK_ABI_VERSION*/
+#endif
+#if FLTK_ABI_VERSION >= 10303
+  void item_draw_callback(Fl_Tree_Item_Draw_Callback *cb, void *data=0) {
+    _itemdrawcallback = cb;
+    _itemdrawuserdata = data;
+  }
+  Fl_Tree_Item_Draw_Callback* item_draw_callback() const {
+    return(_itemdrawcallback);
+  }
+  void* item_draw_user_data() const {
+    return(_itemdrawuserdata);
+  }
+  void do_item_draw_callback(Fl_Tree_Item *o) const {
+    _itemdrawcallback(o, _itemdrawuserdata);
+  }
+#endif
 };
 };
 
 
 #endif /*FL_TREE_PREFS_H*/
 #endif /*FL_TREE_PREFS_H*/
 
 
 //
 //
-// End of "$Id: Fl_Tree_Prefs.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Tree_Prefs.H 10034 2013-12-15 18:59:02Z greg.ercolano $".
 //
 //

+ 9 - 3
fltk/FL/Fl_Widget.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Widget.H 9792 2013-01-13 15:25:37Z manolo $"
+// "$Id: Fl_Widget.H 10096 2014-02-08 01:10:44Z AlbrechtS $"
 //
 //
 // Widget header file for the Fast Light Tool Kit (FLTK).
 // Widget header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -29,7 +29,7 @@
   \todo	typedef's fl_intptr_t and fl_uintptr_t should be documented.
   \todo	typedef's fl_intptr_t and fl_uintptr_t should be documented.
 */
 */
 #ifdef _WIN64
 #ifdef _WIN64
-#ifdef __GNUC__
+#if defined(__GNUC__) || defined(__clang__)
 #include <stdint.h>
 #include <stdint.h>
 #else
 #else
 #include <stddef.h>  // M$VC
 #include <stddef.h>  // M$VC
@@ -1038,6 +1038,10 @@ Returns the full rectangle occupied by a widget plus it's external label if any
 
 
   /** Sets width ww and height hh accordingly with the label size.
   /** Sets width ww and height hh accordingly with the label size.
       Labels with images will return w() and h() of the image.
       Labels with images will return w() and h() of the image.
+      
+      This calls fl_measure() internally. For more information about
+      the arguments \p ww and \p hh and word wrapping
+      \see fl_measure(const char*, int&, int&, int)
    */
    */
   void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
   void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
 
 
@@ -1047,6 +1051,8 @@ Returns the full rectangle occupied by a widget plus it's external label if any
             (if any), not <I>this</I> window.
             (if any), not <I>this</I> window.
    */
    */
   Fl_Window* window() const ;
   Fl_Window* window() const ;
+  Fl_Window* top_window() const;
+  Fl_Window* top_window_offset(int& xoff, int& yoff) const;
 
 
   /** Returns an Fl_Group pointer if this widget is an Fl_Group.
   /** Returns an Fl_Group pointer if this widget is an Fl_Group.
 
 
@@ -1213,5 +1219,5 @@ DECLARE_CLASS_CHEAP_RTTI_1(Fl_Widget)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Widget.H 9792 2013-01-13 15:25:37Z manolo $".
+// End of "$Id: Fl_Widget.H 10096 2014-02-08 01:10:44Z AlbrechtS $".
 //
 //

+ 34 - 5
fltk/FL/Fl_Window.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Window.H 10189 2014-06-11 09:10:53Z ossman $"
 //
 //
 // Window header file for the Fast Light Tool Kit (FLTK).
 // Window header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -68,6 +68,22 @@ class FL_EXPORT Fl_Window : public Fl_Group {
   static // when these members are static, ABI compatibility with 1.3.0 is respected
   static // when these members are static, ABI compatibility with 1.3.0 is respected
 #endif
 #endif
   int no_fullscreen_h;
   int no_fullscreen_h;
+#if FLTK_ABI_VERSION < 10303
+  static // when these members are static, ABI compatibility with 1.3.2 is respected
+#endif
+  int fullscreen_screen_top;
+#if FLTK_ABI_VERSION < 10303
+  static // when these members are static, ABI compatibility with 1.3.2 is respected
+#endif
+  int fullscreen_screen_bottom;
+#if FLTK_ABI_VERSION < 10303
+  static // when these members are static, ABI compatibility with 1.3.2 is respected
+#endif
+  int fullscreen_screen_left;
+#if FLTK_ABI_VERSION < 10303
+  static // when these members are static, ABI compatibility with 1.3.2 is respected
+#endif
+  int fullscreen_screen_right;
 
 
   friend class Fl_X;
   friend class Fl_X;
   Fl_X *i; // points at the system-specific stuff
   Fl_X *i; // points at the system-specific stuff
@@ -402,13 +418,15 @@ public:
   */
   */
   void show(int argc, char **argv);
   void show(int argc, char **argv);
   /**
   /**
-    Makes the window completely fill the screen, without any window
-    manager border visible.  You must use fullscreen_off() to undo
-    this. 
+    Makes the window completely fill one or more screens, without any
+    window manager border visible.  You must use fullscreen_off() to
+    undo this. 
 
 
     \note On some platforms, this can result in the keyboard being
     \note On some platforms, this can result in the keyboard being
     grabbed. The window may also be recreated, meaning hide() and
     grabbed. The window may also be recreated, meaning hide() and
     show() will be called.
     show() will be called.
+
+    \see void Fl_Window::fullscreen_screens()
   */
   */
   void fullscreen();
   void fullscreen();
   /**
   /**
@@ -425,6 +443,17 @@ public:
   */
   */
   unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
   unsigned int fullscreen_active() const { return flags() & FULLSCREEN; }
   /**
   /**
+    Sets which screens should be used when this window is in fullscreen
+    mode. The window will be resized to the top of the screen with index
+    \p top, the bottom of the screen with index \p bottom, etc. 
+
+    If this method is never called, or if any argument is < 0, then the
+    window will be resized to fill the screen it is currently on.
+
+    \see void Fl_Window::fullscreen()
+    */
+  void fullscreen_screens(int top, int bottom, int left, int right);
+  /**
     Iconifies the window.  If you call this when shown() is false
     Iconifies the window.  If you call this when shown() is false
     it will show() it as an icon.  If the window is already
     it will show() it as an icon.  If the window is already
     iconified this does nothing.
     iconified this does nothing.
@@ -494,5 +523,5 @@ DECLARE_CLASS_CHEAP_RTTI_2(Fl_Window, Fl_Group)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Window.H 9706 2012-11-06 20:46:14Z matt $".
+// End of "$Id: Fl_Window.H 10189 2014-06-11 09:10:53Z ossman $".
 //
 //

+ 3 - 3
fltk/FL/Xutf8.h

@@ -1,4 +1,4 @@
-/* "$Id: Xutf8.h 8864 2011-07-19 04:49:30Z greg.ercolano $"
+/* "$Id: Xutf8.h 9958 2013-09-02 15:05:58Z manolo $"
  *
  *
  * Author: Jean-Marc Lienher ( http://oksid.ch )
  * Author: Jean-Marc Lienher ( http://oksid.ch )
  * Copyright 2000-2010 by O'ksi'D.
  * Copyright 2000-2010 by O'ksi'D.
@@ -14,7 +14,7 @@
  *     http://www.fltk.org/str.php
  *     http://www.fltk.org/str.php
  */
  */
 
 
-#ifndef _Xutf8_h
+#if ! ( defined(_Xutf8_h) || defined(FL_DOXYGEN) )
 #define _Xutf8_h
 #define _Xutf8_h
 
 
 #  ifdef __cplusplus
 #  ifdef __cplusplus
@@ -176,5 +176,5 @@ XUtf8Toupper(
 #endif
 #endif
 
 
 /*
 /*
- *  End of "$Id: Xutf8.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
+ *  End of "$Id: Xutf8.h 9958 2013-09-02 15:05:58Z manolo $".
  */
  */

+ 21 - 3
fltk/FL/fl_draw.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: fl_draw.H 9463 2012-05-08 16:15:34Z greg.ercolano $"
+// "$Id: fl_draw.H 9937 2013-06-22 12:01:11Z greg.ercolano $"
 //
 //
 // Portable drawing function header file for the Fast Light Tool Kit (FLTK).
 // Portable drawing function header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -394,6 +394,24 @@ inline void fl_curve(double X0, double Y0, double X1, double Y1, double X2, doub
  \param[in] start,end angles of start and end of arc measured in degrees
  \param[in] start,end angles of start and end of arc measured in degrees
  counter-clockwise from 3 o'clock. If \p end is less than \p start
  counter-clockwise from 3 o'clock. If \p end is less than \p start
  then it draws the arc in a clockwise direction.
  then it draws the arc in a clockwise direction.
+
+ Examples:
+ \code
+    // Draw an arc of points
+    fl_begin_points();
+    fl_arc(100.0, 100.0, 50.0, 0.0, 180.0);
+    fl_end_points();
+
+    // Draw arc with a line
+    fl_begin_line();
+    fl_arc(200.0, 100.0, 50.0, 0.0, 180.0);
+    fl_end_line();
+
+    // Draw filled arc
+    fl_begin_polygon();
+    fl_arc(300.0, 100.0, 50.0, 0.0, 180.0);
+    fl_end_polygon();
+ \endcode
  */
  */
 inline void fl_arc(double x, double y, double r, double start, double end) {fl_graphics_driver->arc(x,y,r,start,end); }
 inline void fl_arc(double x, double y, double r, double start, double end) {fl_graphics_driver->arc(x,y,r,start,end); }
 /**
 /**
@@ -599,7 +617,7 @@ inline void fl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->d
   Draws at the given \p x, \p y location a UTF-8 string of length \p n bytes 
   Draws at the given \p x, \p y location a UTF-8 string of length \p n bytes 
   rotating \p angle degrees counter-clockwise.
   rotating \p angle degrees counter-clockwise.
 */
 */
-inline void fl_draw(int angle,const char* str, int n, int x, int y) {fl_graphics_driver->draw(angle,str,n,x,y); }
+inline void fl_draw(int angle, const char* str, int n, int x, int y) {fl_graphics_driver->draw(angle,str,n,x,y); }
 /**
 /**
   Draws a UTF-8 string of length \p n bytes right to left starting at the given \p x, \p y location.
   Draws a UTF-8 string of length \p n bytes right to left starting at the given \p x, \p y location.
 */
 */
@@ -774,5 +792,5 @@ FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scal
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: fl_draw.H 9463 2012-05-08 16:15:34Z greg.ercolano $".
+// End of "$Id: fl_draw.H 9937 2013-06-22 12:01:11Z greg.ercolano $".
 //
 //

+ 36 - 22
fltk/FL/mac.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: mac.H 9792 2013-01-13 15:25:37Z manolo $"
+// "$Id: mac.H 10159 2014-05-23 16:47:21Z manolo $"
 //
 //
 // Mac header file for the Fast Light Tool Kit (FLTK).
 // Mac header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -48,6 +48,28 @@ typedef CGContextRef Fl_Offscreen;
 // Standard MacOS C/C++ includes...
 // Standard MacOS C/C++ includes...
 #include <ApplicationServices/ApplicationServices.h>
 #include <ApplicationServices/ApplicationServices.h>
 #undef check // because of Fl::check()
 #undef check // because of Fl::check()
+
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif
+#ifndef MAC_OS_X_VERSION_10_7
+#define MAC_OS_X_VERSION_10_7 1070
+#endif
+#ifndef MAC_OS_X_VERSION_10_8
+#define MAC_OS_X_VERSION_10_8 1080
+#endif
+
+#ifdef __OBJC__
+@class NSCursor;
+#else
+class NSCursor;
+#endif // __OBJC__
 
 
 typedef CGContextRef Fl_Offscreen;
 typedef CGContextRef Fl_Offscreen;
 
 
@@ -57,6 +79,7 @@ typedef struct flCocoaRegion {
 } *Fl_Region;  // a region is the union of a series of rectangles
 } *Fl_Region;  // a region is the union of a series of rectangles
 
 
 #  include "Fl_Window.H"
 #  include "Fl_Window.H"
+#  include "../src/Fl_Font.H"
 
 
 // Some random X equivalents
 // Some random X equivalents
 struct XPoint { int x, y; };
 struct XPoint { int x, y; };
@@ -83,8 +106,7 @@ inline void XDestroyRegion(Fl_Region r) {
     free(r);
     free(r);
   }
   }
 }
 }
-extern void *fl_system_menu;
-extern void *fl_default_cursor;
+extern NSCursor *fl_default_cursor;
 
 
 // This object contains all mac-specific stuff about a window:
 // This object contains all mac-specific stuff about a window:
 // WARNING: this object is highly subject to change!
 // WARNING: this object is highly subject to change!
@@ -99,7 +121,7 @@ public:
   Fl_X *next;              // linked tree to support subwindows
   Fl_X *next;              // linked tree to support subwindows
   Fl_X *xidChildren, *xidNext; // more subwindow tree
   Fl_X *xidChildren, *xidNext; // more subwindow tree
   int wait_for_expose;
   int wait_for_expose;
-  void *cursor;	           // is really NSCursor*
+  NSCursor *cursor;
   static Fl_X* first;
   static Fl_X* first;
   static Fl_X* i(const Fl_Window* w) {return w->i;}
   static Fl_X* i(const Fl_Window* w) {return w->i;}
   static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
   static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
@@ -123,6 +145,7 @@ public:
   void set_cursor(Fl_Cursor);
   void set_cursor(Fl_Cursor);
   static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
   static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
   static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
   static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
+  static CFDataRef CGBitmapContextToTIFF(CGContextRef c);
   static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
   static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
   static CGContextRef watch_cursor_image(void);
   static CGContextRef watch_cursor_image(void);
   static CGContextRef help_cursor_image(void);
   static CGContextRef help_cursor_image(void);
@@ -133,6 +156,8 @@ public:
   static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen
   static void screen_work_area(int &X, int &Y, int &W, int &H, int n); // compute work area of a given screen
   static int next_marked_length; // next length of marked text after current marked text will have been replaced
   static int next_marked_length; // next length of marked text after current marked text will have been replaced
   static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates & height of insertion point
   static int insertion_point_location(int *px, int *py, int *pheight); // computes window coordinates & height of insertion point
+  static const int CoreText_threshold;  // Mac OS version from which the Core Text API is used to display text
+  static Fl_Fontdesc* calc_fl_fonts(void); // computes the fl_fonts global variable
 private:
 private:
   static void relink(Fl_Window*, Fl_Window*);
   static void relink(Fl_Window*, Fl_Window*);
   bool subwindow;
   bool subwindow;
@@ -142,26 +167,9 @@ extern Window fl_window;
 
 
 #endif // FL_LIBRARY || FL_INTERNALS
 #endif // FL_LIBRARY || FL_INTERNALS
 
 
-#ifndef MAC_OS_X_VERSION_10_4
-#define MAC_OS_X_VERSION_10_4 1040
-#endif
-#ifndef MAC_OS_X_VERSION_10_5
-#define MAC_OS_X_VERSION_10_5 1050
-#endif
-#ifndef MAC_OS_X_VERSION_10_6
-#define MAC_OS_X_VERSION_10_6 1060
-#endif
-#ifndef MAC_OS_X_VERSION_10_7
-#define MAC_OS_X_VERSION_10_7 1070
-#endif
-#ifndef MAC_OS_X_VERSION_10_8
-#define MAC_OS_X_VERSION_10_8 1080
-#endif
-
 typedef CGImageRef Fl_Bitmask;
 typedef CGImageRef Fl_Bitmask;
 
 
 extern CGContextRef fl_gc;
 extern CGContextRef fl_gc;
-extern class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
 
 
 extern Window fl_xid(const Fl_Window*);
 extern Window fl_xid(const Fl_Window*);
 extern Fl_Window* fl_find(Window xid);
 extern Fl_Window* fl_find(Window xid);
@@ -186,6 +194,7 @@ extern void fl_open_display();
 
 
 /** \defgroup group_macosx Mac OS X-specific symbols
 /** \defgroup group_macosx Mac OS X-specific symbols
  Mac OS X-specific symbols declared in <FL/x.H> or <FL/gl.h>
  Mac OS X-specific symbols declared in <FL/x.H> or <FL/gl.h>
+ \sa \ref osissues_macos
  @{ */
  @{ */
 
 
 /** @brief Register a function called for each file dropped onto an application icon.
 /** @brief Register a function called for each file dropped onto an application icon.
@@ -208,6 +217,11 @@ extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0
  */
  */
 extern int fl_mac_os_version;
 extern int fl_mac_os_version;
 
 
+/** The system menu bar.
+ */
+extern class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
+
+
 class Fl_Mac_App_Menu {
 class Fl_Mac_App_Menu {
 public:
 public:
   /** Localizable text for the "About xxx" application menu item */
   /** Localizable text for the "About xxx" application menu item */
@@ -232,6 +246,6 @@ public:
 /** @} */
 /** @} */
 
 
 //
 //
-// End of "$Id: mac.H 9792 2013-01-13 15:25:37Z manolo $".
+// End of "$Id: mac.H 10159 2014-05-23 16:47:21Z manolo $".
 //
 //
 
 

+ 3 - 2
fltk/FL/win32.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: win32.H 9278 2012-03-12 11:55:50Z manolo $"
+// "$Id: win32.H 10189 2014-06-11 09:10:53Z ossman $"
 //
 //
 // WIN32 header file for the Fast Light Tool Kit (FLTK).
 // WIN32 header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -79,6 +79,7 @@ public:
   static Fl_X* i(const Fl_Window* w) {return w->i;}
   static Fl_X* i(const Fl_Window* w) {return w->i;}
   static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
   static int fake_X_wm(const Fl_Window* w,int &X, int &Y,
 		                 int &bt,int &bx,int &by);
 		                 int &bt,int &bx,int &by);
+  void make_fullscreen(int X, int Y, int W, int H);
   void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
   void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
   void flush() {w->flush();}
   void flush() {w->flush();}
   void set_minmax(LPMINMAXINFO minmax);
   void set_minmax(LPMINMAXINFO minmax);
@@ -151,5 +152,5 @@ inline void fl_open_callback(void (*)(const char *)) {}
 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
 extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
 #endif // FL_DOXYGEN
 #endif // FL_DOXYGEN
 //
 //
-// End of "$Id: win32.H 9278 2012-03-12 11:55:50Z manolo $".
+// End of "$Id: win32.H 10189 2014-06-11 09:10:53Z ossman $".
 //
 //

+ 3 - 7
fltk/FL/x.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: x.H 9299 2012-03-23 16:47:53Z manolo $"
+// "$Id: x.H 10158 2014-05-23 16:00:25Z manolo $"
 //
 //
 // X11 header file for the Fast Light Tool Kit (FLTK).
 // X11 header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -84,11 +84,7 @@ extern FL_EXPORT ulong fl_event_time;
 
 
 // off-screen pixmaps: create, destroy, draw into, copy to window:
 // off-screen pixmaps: create, destroy, draw into, copy to window:
 typedef ulong Fl_Offscreen;
 typedef ulong Fl_Offscreen;
-#   define fl_create_offscreen(w,h) \
-  XCreatePixmap(fl_display, \
-	      (Fl_Surface_Device::surface() == Fl_Display_Device::display_device() ? \
-	      fl_window : fl_xid(Fl::first_window()) ) , \
-	      w, h, fl_visual->depth)
+#    define fl_create_offscreen(w,h) XCreatePixmap(fl_display, RootWindow(fl_display, fl_screen), w, h, fl_visual->depth)
 // begin/end are macros that save the old state in local variables:
 // begin/end are macros that save the old state in local variables:
 #    define fl_begin_offscreen(pixmap) \
 #    define fl_begin_offscreen(pixmap) \
   Window _sw=fl_window; fl_window=pixmap; \
   Window _sw=fl_window; fl_window=pixmap; \
@@ -187,5 +183,5 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: x.H 9299 2012-03-23 16:47:53Z manolo $".
+// End of "$Id: x.H 10158 2014-05-23 16:00:25Z manolo $".
 //
 //

+ 9 - 4
fltk/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# "$Id: Makefile 8864 2011-07-19 04:49:30Z greg.ercolano $"
+# "$Id: Makefile 9990 2013-09-24 09:10:04Z ossman $"
 #
 #
 # Top-level makefile for the Fast Light Tool Kit (FLTK).
 # Top-level makefile for the Fast Light Tool Kit (FLTK).
 #
 #
@@ -66,7 +66,7 @@ clean:
 	done
 	done
 
 
 distclean: clean
 distclean: clean
-	$(RM) config.*
+	$(RM) config.h config.log config.status
 	$(RM) fltk-config fltk.list makeinclude
 	$(RM) fltk-config fltk.list makeinclude
 	$(RM) fltk.spec
 	$(RM) fltk.spec
 	$(RM) FL/Makefile
 	$(RM) FL/Makefile
@@ -90,7 +90,7 @@ fltk-config: configure configh.in fltk-config.in
 	touch config.h
 	touch config.h
 	chmod +x fltk-config
 	chmod +x fltk-config
 
 
-makeinclude: configure configh.in makeinclude.in
+makeinclude: configure configh.in makeinclude.in config.guess config.sub
 	if test -f config.status; then \
 	if test -f config.status; then \
 		./config.status --recheck; \
 		./config.status --recheck; \
 		./config.status; \
 		./config.status; \
@@ -103,6 +103,11 @@ makeinclude: configure configh.in makeinclude.in
 configure: configure.in
 configure: configure.in
 	autoconf
 	autoconf
 
 
+config.guess config.sub:
+	-automake --add-missing 2> /dev/null
+	if [ ! -e config.sub   ]; then echo NOTE: Using frozen copy of config.sub;   cp misc/config.sub   . ; fi
+	if [ ! -e config.guess ]; then echo NOTE: Using frozen copy of config.guess; cp misc/config.guess . ; fi
+
 portable-dist:
 portable-dist:
 	epm -v -s fltk.xpm fltk
 	epm -v -s fltk.xpm fltk
 
 
@@ -126,5 +131,5 @@ clang-changes:
 
 
 
 
 #
 #
-# End of "$Id: Makefile 8864 2011-07-19 04:49:30Z greg.ercolano $".
+# End of "$Id: Makefile 9990 2013-09-24 09:10:04Z ossman $".
 #
 #

+ 39 - 15
fltk/README

@@ -1,4 +1,4 @@
-README - Fast Light Tool Kit (FLTK) Version 1.3.0
+README - Fast Light Tool Kit (FLTK) Version 1.3.2
 -------------------------------------------------
 -------------------------------------------------
 
 
 WHAT IS FLTK?
 WHAT IS FLTK?
@@ -31,7 +31,7 @@ ON-LINE DOCUMENTATION
         http://www.fltk.org/documentation.php
         http://www.fltk.org/documentation.php
 
 
 
 
-BUILDING AND INSTALLING FLTK UNDER UNIX AND MacOS X
+BUILDING AND INSTALLING FLTK UNDER UNIX AND Mac OS X
 
 
     In most cases you can just type "make".  This will run
     In most cases you can just type "make".  This will run
     configure with the default (no) options and then compile
     configure with the default (no) options and then compile
@@ -85,6 +85,23 @@ BUILDING AND INSTALLING FLTK UNDER UNIX AND MacOS X
     need to run "make install-desktop" as root.
     need to run "make install-desktop" as root.
 
 
 
 
+SVN USERS
+    
+    If you've just checked out a fresh copy of FLTK from SVN,
+    you'll need to generate an initial version of 'configure'
+    by running 'make makeinclude'. (We don't include a copy
+    of configure in svn)
+
+
+MAKE TARGETS
+    
+    make            -- builds the library + test programs (does not install)
+    make install    -- builds and installs
+    make clean      -- clean for a rebuild
+    make distclean  -- like 'clean', but also removes docs, configure, fltk-config
+    ( cd src; make ) -- builds just the fltk libraries
+
+
 BUILDING FLTK UNDER MICROSOFT WINDOWS
 BUILDING FLTK UNDER MICROSOFT WINDOWS
 
 
     There are two ways to build FLTK under Microsoft Windows. 
     There are two ways to build FLTK under Microsoft Windows. 
@@ -98,6 +115,20 @@ BUILDING FLTK UNDER MICROSOFT WINDOWS
         sh configure ...options...
         sh configure ...options...
 
 
 
 
+BUILDING HTML DOCUMENTATION
+
+    If you want to build the HTML documentation:
+
+    	( cd documentation && make html )
+
+    If you want to build the PDF documentation:
+
+    	( cd documentation && make pdf )
+    
+    FLTK uses doxygen for documentation, so you'll at least need doxygen
+    installed for creating html docs, and LaTeX for creating PDF docs.
+
+
 INTERNET RESOURCES
 INTERNET RESOURCES
 
 
     FLTK is available on the 'net in a bunch of locations:
     FLTK is available on the 'net in a bunch of locations:
@@ -106,23 +137,16 @@ INTERNET RESOURCES
 	         http://www.fltk.org/str.php [for reporting bugs]
 	         http://www.fltk.org/str.php [for reporting bugs]
 	         http://www.fltk.org/software.php [source code]
 	         http://www.fltk.org/software.php [source code]
 
 
-	- FTP:   http://ftp.easysw.com/pub/fltk
-	         ftp://ftp.easysw.com/pub/fltk
-	         ftp://ftp2.easysw.com/pub/fltk
+	- FTP:   (offline Apr 20 '13) http://ftp.easysw.com/pub/fltk
+	         (offline Apr 20 '13) ftp://ftp.easysw.com/pub/fltk
+	         (offline Apr 20 '13) ftp://ftp2.easysw.com/pub/fltk
 	         ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk
 	         ftp://ftp.funet.fi/pub/mirrors/ftp.easysw.com/pub/fltk
 	         ftp://linux.mathematik.tu-darmstadt.de/pub/linux/mirrors/misc/fltk
 	         ftp://linux.mathematik.tu-darmstadt.de/pub/linux/mirrors/misc/fltk
 	         ftp://gd.tuwien.ac.at/hci/fltk
 	         ftp://gd.tuwien.ac.at/hci/fltk
 
 
-	- EMail: [email protected] [see instructions below]
-
-    To send a message to the FLTK mailing list ("[email protected]")
-    you must first join the list.  Non-member submissions are
-    blocked to avoid problems with SPAM.
-
     To join the FLTK mailing list, go the following web page:
     To join the FLTK mailing list, go the following web page:
 
 
-        http://lists.easysw.com/listinfo/fltk
-
+        http://www.fltk.org/newsgroups.php
 
 
 REPORTING BUGS
 REPORTING BUGS
 
 
@@ -145,8 +169,8 @@ TRADEMARKS
 
 
 COPYRIGHT
 COPYRIGHT
 
 
-    FLTK is copyright 1998-2011 by Bill Spitzak
-    ([email protected]) and others, 
+    FLTK is copyright 1998-2013 by Bill Spitzak
+    ([email protected]) and others,
     see the CREDITS file for more info.
     see the CREDITS file for more info.
 
 
     This library is free software. Distribution and use rights are
     This library is free software. Distribution and use rights are

+ 47 - 31
fltk/README.CMake.txt

@@ -69,29 +69,35 @@ toolchain.  Other platforms are just as easy to use.
 
 
  OPTIONS
  OPTIONS
 ---------
 ---------
+Options can be specified to cmake with the -D flag:
+
+    cmake -D <OPTION_NAME>=<OPTION_VALUE>
+
+Example:
+
+    cmake -D CMAKE_BUILD_TYPE=Debug
 
 
 All options have sensible defaults so you won't usually need to touch these.
 All options have sensible defaults so you won't usually need to touch these.
-There are only two CMake options that you may want to specify.
+There are only two CMake options that you may want to specify:
 
 
 CMAKE_BUILD_TYPE
 CMAKE_BUILD_TYPE
-   This specifies what kind of build this is i.e. Release, Debug...
-Platform specific compile/link flags/options are automatically selected
-by CMake depending on this value.
+    This specifies what kind of build this is i.e. Release, Debug...
+    Platform specific compile/link flags/options are automatically selected
+    by CMake depending on this value.
 
 
 CMAKE_INSTALL_PREFIX
 CMAKE_INSTALL_PREFIX
-   Where everything will go on install.  Defaults are /usr/local for unix
-and C:\Program Files\FLTK for Windows.
+    Where everything will go on install.  Defaults are /usr/local for unix
+    and C:\Program Files\FLTK for Windows.
 
 
-These are the FLTK specific options.  Platform specific options are ignored
-on other platforms.
+The following are the FLTK specific options.  Platform specific options
+are ignored on other platforms.
 
 
 OPTION_OPTIM
 OPTION_OPTIM
    Extra optimization flags.
    Extra optimization flags.
+
 OPTION_ARCHFLAGS
 OPTION_ARCHFLAGS
    Extra architecture flags.
    Extra architecture flags.
 
 
-   The OPTION_PREFIX_* flags are for fine-tuning where everything goes
-on the install.
 OPTION_PREFIX_BIN
 OPTION_PREFIX_BIN
 OPTION_PREFIX_LIB
 OPTION_PREFIX_LIB
 OPTION_PREFIX_INCLUDE
 OPTION_PREFIX_INCLUDE
@@ -99,20 +105,25 @@ OPTION_PREFIX_DATA
 OPTION_PREFIX_DOC
 OPTION_PREFIX_DOC
 OPTION_PREFIX_CONFIG
 OPTION_PREFIX_CONFIG
 OPTION_PREFIX_MAN
 OPTION_PREFIX_MAN
+   The OPTION_PREFIX_* flags are for fine-tuning where everything goes
+   on the install.
 
 
 OPTION_APPLE_X11 - default OFF
 OPTION_APPLE_X11 - default OFF
    In case you want to use X11 on OSX.  Not currently supported.
    In case you want to use X11 on OSX.  Not currently supported.
+
 OPTION_USE_POLL - default OFF
 OPTION_USE_POLL - default OFF
    Don't use this one either.
    Don't use this one either.
 
 
 OPTION_BUILD_SHARED_LIBS - default OFF
 OPTION_BUILD_SHARED_LIBS - default OFF
    Normally FLTK is built as static libraries which makes more portable
    Normally FLTK is built as static libraries which makes more portable
-binaries.  If you want to use shared libraries, this will build them too.
+   binaries.  If you want to use shared libraries, this will build them too.
+
 OPTION_BUILD_EXAMPLES - default ON
 OPTION_BUILD_EXAMPLES - default ON
    Builds the many fine example programs.
    Builds the many fine example programs.
 
 
 OPTION_CAIRO - default OFF
 OPTION_CAIRO - default OFF
    Enables libcairo support
    Enables libcairo support
+
 OPTION_CAIROEXT - default OFF
 OPTION_CAIROEXT - default OFF
    Enables extended libcairo support
    Enables extended libcairo support
 
 
@@ -125,17 +136,16 @@ OPTION_USE_THREADS - default ON
 OPTION_LARGE_FILE - default ON
 OPTION_LARGE_FILE - default ON
    Enables large file (>2G) support
    Enables large file (>2G) support
 
 
-   FLTK has built in jpeg zlib and png libraries.  These let you use
-system libraries instead, unless CMake can't find them.
 OPTION_USE_SYSTEM_LIBJPEG - default ON
 OPTION_USE_SYSTEM_LIBJPEG - default ON
 OPTION_USE_SYSTEM_ZLIB - default ON
 OPTION_USE_SYSTEM_ZLIB - default ON
 OPTION_USE_SYSTEM_LIBPNG - default ON
 OPTION_USE_SYSTEM_LIBPNG - default ON
+   FLTK has built in jpeg zlib and png libraries.  These let you use
+   system libraries instead, unless CMake can't find them.
 
 
-   X11 extended libraries.
 OPTION_USE_XINERAMA - default ON
 OPTION_USE_XINERAMA - default ON
 OPTION_USE_XFT - default ON
 OPTION_USE_XFT - default ON
 OPTION_USE_XDBE - default ON
 OPTION_USE_XDBE - default ON
-
+   These are X11 extended libraries.
 
 
  BUILDING UNDER LINUX WITH UNIX MAKEFILES
  BUILDING UNDER LINUX WITH UNIX MAKEFILES
 ------------------------------------------
 ------------------------------------------
@@ -143,24 +153,30 @@ OPTION_USE_XDBE - default ON
 After untaring the FLTK source, go to the root of the FLTK tree and type
 After untaring the FLTK source, go to the root of the FLTK tree and type
 the following.
 the following.
 
 
-mkdir build
-cd build
-cmake ..
-make
-sudo make install
+    mkdir build
+    cd build
+    cmake ..
+    make
+    sudo make install
 
 
 This will build and install a default configuration FLTK.
 This will build and install a default configuration FLTK.
+
+Some flags can be changed during the 'make' command, such as:
+
+    make VERBOSE=on
+
+..which builds in verbose mode, so you can see all the compile/link commands.
 
 
 
 
  CROSSCOMPILING
  CROSSCOMPILING
 ----------------
 ----------------
 
 
-Once you have a crosscompiler going, to use CMAke to build FLTK you need
+Once you have a crosscompiler going, to use CMake to build FLTK you need
 two more things.  You need a toolchain file which tells CMake where your
 two more things.  You need a toolchain file which tells CMake where your
 build tools are.  The CMake website is a good source of information on
 build tools are.  The CMake website is a good source of information on
 this file.  Here's mine for MinGW under Linux.
 this file.  Here's mine for MinGW under Linux.
-----
 
 
+----
 # the name of the target operating system
 # the name of the target operating system
 set(CMAKE_SYSTEM_NAME Windows)
 set(CMAKE_SYSTEM_NAME Windows)
 
 
@@ -180,7 +196,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 
 
 set(CMAKE_INSTALL_PREFIX ${CMAKE_FIND_ROOT_PATH}/usr CACHE FILEPATH
 set(CMAKE_INSTALL_PREFIX ${CMAKE_FIND_ROOT_PATH}/usr CACHE FILEPATH
    "install path prefix")
    "install path prefix")
-
 ----
 ----
 
 
 Not too tough.  The other thing you need is a native installation of FLTK
 Not too tough.  The other thing you need is a native installation of FLTK
@@ -189,11 +204,11 @@ compile the *.fl into C++ source and header files.
 
 
 So, again from the FLTK tree root.
 So, again from the FLTK tree root.
 
 
-mkdir mingw
-cd mingw
-cmake -DCMAKE_TOOLCHAIN_FILE=~/projects/toolchain/Toolchain-mingw32.cmake ..
-make
-sudo make install
+    mkdir mingw
+    cd mingw
+    cmake -DCMAKE_TOOLCHAIN_FILE=~/projects/toolchain/Toolchain-mingw32.cmake ..
+    make
+    sudo make install
 
 
 This will create a default configuration FLTK suitable for mingw/msys and
 This will create a default configuration FLTK suitable for mingw/msys and
 install it in the /usr/i486-mingw32/usr tree.
 install it in the /usr/i486-mingw32/usr tree.
@@ -246,15 +261,15 @@ a gui app.  It is ignored on other platforms.
 When you use the target_link_libraries command, CMake uses it's own
 When you use the target_link_libraries command, CMake uses it's own
 internal names for libraries.  The fltk library names are:
 internal names for libraries.  The fltk library names are:
 
 
-fltk     fltk_forms     fltk_images    fltk_gl
+    fltk     fltk_forms     fltk_images    fltk_gl
 
 
 and for the shared libraries (if built):
 and for the shared libraries (if built):
 
 
-fltk_SHARED     fltk_forms_SHARED     fltk_images_SHARED    fltk_gl_SHARED
+    fltk_SHARED     fltk_forms_SHARED     fltk_images_SHARED    fltk_gl_SHARED
 
 
 The built-in libraries (if built):
 The built-in libraries (if built):
 
 
-fltk_jpeg      fltk_png    fltk_z
+    fltk_jpeg      fltk_png    fltk_z
 
 
 
 
  USING FLUID FILES
  USING FLUID FILES
@@ -285,3 +300,4 @@ when find_package(FLTK REQUIRED NO_MODULE) succeeds.
 ==================
 ==================
 
 
 Dec 20 2010 - matt: merged and restructures
 Dec 20 2010 - matt: merged and restructures
+May 15 2013 - erco: small formatting tweaks, added some examples

+ 1 - 1
fltk/README.Cairo.txt

@@ -41,7 +41,7 @@ as in fltk2.
  Configuration
  Configuration
 ---------------
 ---------------
 
 
-All the changes are *inactive*  as long as the new configuration
+All the changes are *inactive* as long as the new configuration
 option --enable-cairo is not added to the configure command.
 option --enable-cairo is not added to the configure command.
 For non configure based platforms/ide, the FLTK_HAVE_CAIRO preprocess
 For non configure based platforms/ide, the FLTK_HAVE_CAIRO preprocess
 variable has to be defined.
 variable has to be defined.

+ 4 - 2
fltk/README.MSWindows.txt

@@ -214,9 +214,11 @@ in my dev directory:
  Configuring FLTK
  Configuring FLTK
 ------------------
 ------------------
 
 
-Stay in your FLTK source-code directory. Type:
+If you got FLTK via subversion then you need one extra step. Otherwise skip
+over this part. Stay in your FLTK source-code directory and type the
+following:
 
 
-  autoconf
+  NOCONFIGURE=1 ./autogen.sh
 
 
 Now configure your FLTK installation:
 Now configure your FLTK installation:
 
 

+ 25 - 6
fltk/README.OSX.txt

@@ -40,11 +40,14 @@ README.OSX.txt - 2010-10-23 - Building FLTK under Apple OS X
  1  INTRODUCTION
  1  INTRODUCTION
 =================
 =================
 
 
+FLTK supports all Mac OS X versions above 10.3 (Panther). See below for how to
+build FLTK applications that can run on all (old or recent) Mac OS X versions.
+
 FLTK currently supports the following development environments on the Apple OS X
 FLTK currently supports the following development environments on the Apple OS X
 platform:
 platform:
 
 
     - gcc command line tools
     - gcc command line tools
-    - Xcode 3.x
+    - Xcode 3.x and higher
     
     
 CAUTION: gcc command line built libraries and Xcode created Frameworks should
 CAUTION: gcc command line built libraries and Xcode created Frameworks should
 not be mixed!    
 not be mixed!    
@@ -77,7 +80,7 @@ Download FLTK from here:
 
 
 If you are familiar with "subversion" and like to stay current with your 
 If you are familiar with "subversion" and like to stay current with your 
 version, you will find the subversion access parameters at the bottom of that 
 version, you will find the subversion access parameters at the bottom of that 
-page. Unpack FLTK into a convinient location. I like to have everything in my 
+page. Unpack FLTK into a convenient location. I like to have everything in my 
 dev directory:
 dev directory:
 
 
   cd
   cd
@@ -91,9 +94,11 @@ dev directory:
  2.3  Configuring FLTK
  2.3  Configuring FLTK
 -----------------------
 -----------------------
 
 
-Stay in your FLTK source-code directory. Type:
-  
-  autoconf
+If you got FLTK via subversion then you need one extra step. Otherwise skip
+over this part. Stay in your FLTK source-code directory and type the
+following:
+
+  NOCONFIGURE=1 ./autogen.sh
 
 
 Now configure your FLTK installation:
 Now configure your FLTK installation:
 
 
@@ -105,6 +110,10 @@ more details can be found in README.
 
 
 To create Universal Binaries, start "configure" with these flags:
 To create Universal Binaries, start "configure" with these flags:
   ./configure  --with-archflags="-arch i386 -arch ppc -arch x86_64"
   ./configure  --with-archflags="-arch i386 -arch ppc -arch x86_64"
+  
+To create applications that can run under Mac OS X 10.4 and above, use these flags:
+  ./configure CXXFLAGS="-mmacosx-version-min=10.4" LDFLAGS="-mmacosx-version-min=10.4"
+
 :END_ADVANCED
 :END_ADVANCED
 
 
 The configuration script will check your machine for the required resources
 The configuration script will check your machine for the required resources
@@ -210,6 +219,11 @@ Use the "Project" pulldown menu to change "Active Build Configuration" to
 Use the "Project" pulldown menu to set the "Active Target" to "Demo". 
 Use the "Project" pulldown menu to set the "Active Target" to "Demo". 
 Select "Build" from the "Build" menu to create all libraries and test applications.
 Select "Build" from the "Build" menu to create all libraries and test applications.
 
 
+By default, the Xcode3 project builds applications that run under Mac OS X 10.5 and above.
+To build applications that run under older Mac OS versions, select "Edit Project Settings" 
+of the Project menu, then select the Build panel, and modify the "Mac OS X Deployment Target" 
+item.
+
 All frameworks and apps will be located in "./ide/Xcode3/build/Release/".
 All frameworks and apps will be located in "./ide/Xcode3/build/Release/".
 
 
 
 
@@ -327,7 +341,7 @@ follow the instructions.
 In order to build FLTK from within Xcode 4, you need to install the Xcode
 In order to build FLTK from within Xcode 4, you need to install the Xcode
 developer environment via the Apple App Store that comes with Lion and up. 
 developer environment via the Apple App Store that comes with Lion and up. 
 If you also want the command line version of gcc, you can use the 
 If you also want the command line version of gcc, you can use the 
-Downlaod section in the Preferences dialog.
+Download section in the Preferences dialog.
   
   
 
 
  4.2  Downloading and Unpacking
  4.2  Downloading and Unpacking
@@ -362,6 +376,10 @@ Use the "Scheme" pulldown menu to change the active target to "Demo" and
 "My Mac 32-bit" or "My Mac 64-bit". Select "Build for" -> "Running"Run" from 
 "My Mac 32-bit" or "My Mac 64-bit". Select "Build for" -> "Running"Run" from 
 the "Product" menu to create all libraries and test applications.
 the "Product" menu to create all libraries and test applications.
 
 
+By default, the Xcode4 project builds applications that need the current Mac OS X version.
+To build applications that also run under older Mac OS versions, modify the "OS X Deployment
+Target" item of the FLTK project build settings.
+
 All frameworks and apps will be located in a private directory. Use
 All frameworks and apps will be located in a private directory. Use
 "Window"->"Organizer" to find the full path. 
 "Window"->"Organizer" to find the full path. 
 
 
@@ -443,3 +461,4 @@ Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no long
 Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config script.
 Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config script.
 Apr 17 2012 - matt: added Xcode4 documentation
 Apr 17 2012 - matt: added Xcode4 documentation
 Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON"
 Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON"
+Apr 28 2014 - Manolo: how to build programs that run on various Mac OS X versions

+ 145 - 8
fltk/README.Unix.txt

@@ -15,9 +15,11 @@ README.Unix.txt - 2010-11-14 - Building FLTK on Unix
     2.5   * http://www.opensuse.org/en/
     2.5   * http://www.opensuse.org/en/
     2.6   * http://www.debian.org/
     2.6   * http://www.debian.org/
     2.7   * Mandrake?
     2.7   * Mandrake?
-    2.8   * Sun?
+    2.8   SunOS / Solaris
     2.9   * SGI?
     2.9   * SGI?
-    2.10  * HPUX?
+    2.10  HP-UX
+    2.11  AIX
+    2.12  NetBSD
   3   HOW TO BUILD FLTK USING GCC
   3   HOW TO BUILD FLTK USING GCC
     3.1   Prerequisites
     3.1   Prerequisites
     3.2   Downloading and Unpacking
     3.2   Downloading and Unpacking
@@ -81,7 +83,7 @@ If you are planning to use the Code::Blocks IDE, also install this
 
 
 I like to use subversion to install the latest FLTK-1.3.release:
 I like to use subversion to install the latest FLTK-1.3.release:
 
 
-  svn co http://svn.easysw.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
+  svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
   
   
 To update to the latest version, just go into the fltk-1.3 directory and type
 To update to the latest version, just go into the fltk-1.3 directory and type
 
 
@@ -117,7 +119,7 @@ If you are planning to use the Code::Blocks IDE, also install this
 
 
 I like to use subversion to install the latest FLTK-1.3.release:
 I like to use subversion to install the latest FLTK-1.3.release:
 
 
-  svn co http://svn.easysw.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
+  svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
   
   
 To update to the latest version, just go into the fltk-1.3 directory and type
 To update to the latest version, just go into the fltk-1.3 directory and type
 
 
@@ -152,7 +154,7 @@ yourself to the "sudo" list.
 
 
 I like to use subversion to install the latest FLTK-1.3.release:
 I like to use subversion to install the latest FLTK-1.3.release:
 
 
-  svn co http://svn.easysw.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
+  svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
   
   
 To update to the latest version, just go into the fltk-1.3 directory and type
 To update to the latest version, just go into the fltk-1.3 directory and type
 
 
@@ -161,6 +163,108 @@ To update to the latest version, just go into the fltk-1.3 directory and type
 FIXME: no FL_SYMBOL font (-*-symbol-*),  font 15 (Zapf-Dingbats)
 FIXME: no FL_SYMBOL font (-*-symbol-*),  font 15 (Zapf-Dingbats)
 
 
 
 
+ 2.8  SunOS / Solaris
+----------------------
+
+SunOS is a commercial operating system from Sun Microsystems (in 2009 the
+company was sold to Oracle). SunOS is also called Solaris since version 5.
+There was an open source derivative called OpenSolaris (based on Solaris 10)
+that was cancelled by Oracle. The successor in spirit is called OpenIndiana
+and can be downloaded from here:
+
+  http://www.openindiana.org/
+
+For FLTK you need at least SunOS 5.7 (aka Solaris 7). This version supports
+64 bit machines and POSIX threads. For machines with 64 bit SPARC processors
+it is highly recommended to use Sun compilers, the 64 bit code generated by
+older versions of GCC for such machines is unusable (expect something between
+horribly broken and immediate crash).
+
+Consider using pkgsrc with this operating system. See the NetBSD section if
+you want to do so.
+If you have GCC and Sun compilers installed, configure your environment like
+this to use the Sun compilers and pkgsrc graphics libraries:
+
+  export CC="cc"
+  export CXX="CC"
+  export CPPFLAGS="-I/usr/pkg/include"
+  export LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib"
+
+To build a 64 bit FLTK library, add the following flags:
+
+  export CFLAGS="-xarch=v9"
+  export CXXFLAGS="-xarch=v9"
+
+
+ 2.10  HP-UX
+-------------
+
+HP-UX is a commercial operating system from HP, no free or open source
+derivatives are available.
+
+For FLTK you need at least HP-UX 11.11 and the latest patch bundles should be
+installed.
+
+Consider using pkgsrc with this operating system. See the NetBSD section if
+you want to do so.
+
+
+ 2.11  AIX
+-----------
+
+AIX is a commercial operating system from IBM, no free or open source
+derivatives are available.
+
+For FLTK you need at least AIX 5L, I have tested version 5.1 patched to ML9.
+
+Consider using pkgsrc with this operating system. See the NetBSD section if
+you want to do so.
+
+
+ 2.12  NetBSD
+--------------
+
+NetBSD can be downloaded here:
+
+  http://www.netbsd.org/
+
+If you have not done so yet, download and install NetBSD. Ensure that the
+optional distribution sets "comp" (Compiler, header files, development tools)
+and x*** (X Window System) are installed.
+
+Now install and configure pkgsrc. The current version can be downloaded here:
+
+  http://www.pkgsrc.org/
+
+To use the current stable version of FLTK, simply install it from pkgsrc:
+
+  cd /usr/pkgsrc/x11/fltk13
+  bmake install
+
+For the latest development snapshot, first install the svn client from pkgsrc:
+
+  cd /usr/pkgsrc/devel/subversion
+  bmake install
+
+Now fetch the latest FLTK source code:
+
+  svn co http://seriss.com/public/fltk/fltk/branches/branch-1.3/ fltk-1.3
+
+To update to the latest version, just go into the fltk-1.3 directory and type
+
+  svn update
+
+If you have installed JPEG and PNG libraries from pkgsrc, configure your
+environment as follows so that the FLTK configure script can find them:
+
+  export CPPFLAGS="-I/usr/pkg/include"
+  export LDFLAGS="-L/usr/pkg/lib"
+
+To install GNU autoconf from pkgsrc:
+
+  cd /usr/pkgsrc/devel/autoconf
+  bmake install
+
 
 
  3  HOW TO BUILD FLTK USING GCC
  3  HOW TO BUILD FLTK USING GCC
 ================================
 ================================
@@ -189,9 +293,11 @@ dev directory:
  3.2  Configuring FLTK
  3.2  Configuring FLTK
 -----------------------
 -----------------------
 
 
-Stay in your FLTK source-code directory. Type:
-  
-  autoconf
+If you got FLTK via subversion then you need one extra step. Otherwise skip
+over this part. Stay in your FLTK source-code directory and type the
+following:
+
+  NOCONFIGURE=1 ./autogen.sh
 
 
 Now configure your FLTK installation:
 Now configure your FLTK installation:
 
 
@@ -296,6 +402,36 @@ The linker flags are located in the "Linker Settings" tab under "Other Linker
 Options". Add the flags to `fltk-config --ldstaticflags` in front of the 
 Options". Add the flags to `fltk-config --ldstaticflags` in front of the 
 second "`".
 second "`".
 
 
+CodeBlocks can be set up to use fluid to manage modules..
+The following info is from [email protected] posted on fltk.general 06/17/2013:
+
+"""
+    I have these settings in codeblocks on linux:
+
+    Settings -> 
+      Compiler and debugging settings ->
+        Other settings -> 
+	  Advanced options:
+
+    -- Add an extension (in my case "fl")
+
+    -- On command line macro:
+		cd $file_dir;  fluid -c $file
+
+    -- Generated files  (to be further compiled):
+		$file_dir/$file_name.cxx
+		$file_dir/$file_name.h
+
+    Settings -> Environment -> Files extension handling :
+		Wildcard : *.fl
+		To open file: Launch an external program
+		External program: fluid
+
+    With that I can double click on any fluid file I include on a project
+    and it opens with fluid. When I press "run" or "build" codeblocks
+    calls fluid to generate the c++ files and compiles if needed.
+"""
+
 
 
 
 
  5  DOCUMENT HISTORY
  5  DOCUMENT HISTORY
@@ -304,3 +440,4 @@ second "`".
 Oct 30 2010 - matt: added Code::Blocks chapter
 Oct 30 2010 - matt: added Code::Blocks chapter
 Oct 28 2010 - matt: restructured entire document and verified instructions
 Oct 28 2010 - matt: restructured entire document and verified instructions
 Nov 14 2010 - duncan: added install-desktop
 Nov 14 2010 - duncan: added install-desktop
+Jun 17 2013 - erco: added mingodad's CodeBlocks/Fluid recommendations

+ 16 - 0
fltk/autogen.sh

@@ -0,0 +1,16 @@
+#! /bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+srcdir=`cd $srcdir && pwd`
+
+ORIGDIR=`pwd`
+cd $srcdir
+
+autoconf --force || exit 1
+automake --add-missing
+if test ! -e config.sub; then echo NOTE: Using frozen copy of config.sub; cp misc/config.sub . ; fi
+if test ! -e config.guess; then echo NOTE: Using frozen copy of config.guess; cp misc/config.guess . ; fi
+cd $ORIGDIR || exit $?
+
+test -n "$NOCONFIGURE" || $srcdir/configure "$@"

+ 16 - 6
fltk/cairo/Fl_Cairo.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Cairo.cxx 9250 2012-02-21 12:27:31Z manolo $"
+// "$Id: Fl_Cairo.cxx 10027 2013-12-11 06:33:14Z fabien $"
 //
 //
 // Main header file for the Fast Light Tool Kit (FLTK).
 // Main header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -85,6 +85,7 @@ cairo_t * Fl::cairo_make_current(Fl_Window* wi) {
     Creates transparently a cairo_surface_t object.
     Creates transparently a cairo_surface_t object.
     gc is an HDC context in  WIN32, a CGContext* in Quartz, a display on X11
     gc is an HDC context in  WIN32, a CGContext* in Quartz, a display on X11
  */
  */
+
 static cairo_surface_t * cairo_create_surface(void * gc, int W, int H) {
 static cairo_surface_t * cairo_create_surface(void * gc, int W, int H) {
 # if defined(USE_X11)
 # if defined(USE_X11)
     return cairo_xlib_surface_create(fl_display, fl_window, fl_visual->visual, W, H);
     return cairo_xlib_surface_create(fl_display, fl_window, fl_visual->visual, W, H);
@@ -133,13 +134,15 @@ cairo_t * Fl::cairo_make_current(void *gc) {
 	cairo_state_.gc(0); // keep track for next time
 	cairo_state_.gc(0); // keep track for next time
 	return 0;
 	return 0;
     }
     }
-    if (gc==Fl::cairo_state_.gc() && fl_window== (Window) Fl::cairo_state_.window())
+    if (gc==Fl::cairo_state_.gc() && 
+	fl_window== (Window) Fl::cairo_state_.window() && 
+	cairo_state_.cc()!=0)
 	return Fl::cairo_cc();
 	return Fl::cairo_cc();
     cairo_state_.gc(fl_gc); // keep track for next time
     cairo_state_.gc(fl_gc); // keep track for next time
     cairo_surface_t * s = cairo_create_surface(gc, W, H);
     cairo_surface_t * s = cairo_create_surface(gc, W, H);
     cairo_t * c = cairo_create(s);
     cairo_t * c = cairo_create(s);
     cairo_surface_destroy(s);
     cairo_surface_destroy(s);
-    Fl::cairo_cc(c);
+    cairo_state_.cc(c);
     return c;
     return c;
 }
 }
 
 
@@ -148,10 +151,17 @@ cairo_t * Fl::cairo_make_current(void *gc) {
    \note Only available when configure has the --enable-cairo option
    \note Only available when configure has the --enable-cairo option
 */
 */
 cairo_t * Fl::cairo_make_current(void *gc, int W, int H) {
 cairo_t * Fl::cairo_make_current(void *gc, int W, int H) {
-  cairo_surface_t * s = cairo_create_surface(gc, W, H);
+    if (gc==Fl::cairo_state_.gc() && 
+	fl_window== (Window) Fl::cairo_state_.window() &&
+	cairo_state_.cc()!=0) // no need to create a cc, just return that one
+	return cairo_state_.cc(); 
+
+    // we need to (re-)create a fresh cc ...
+    cairo_state_.gc(gc); // keep track for next time
+    cairo_surface_t * s = cairo_create_surface(gc, W, H);
     cairo_t * c = cairo_create(s);
     cairo_t * c = cairo_create(s);
+    cairo_state_.cc(c); //  and purge any previously owned context
     cairo_surface_destroy(s);
     cairo_surface_destroy(s);
-    Fl::cairo_cc(c);
     return c;
     return c;
 }
 }
 #else
 #else
@@ -161,5 +171,5 @@ FL_EXPORT int fltk_cairo_dummy() { return 1;}
 #endif // FLTK_HAVE_CAIRO
 #endif // FLTK_HAVE_CAIRO
 
 
 //
 //
-// End of "$Id: Fl_Cairo.cxx 9250 2012-02-21 12:27:31Z manolo $" .
+// End of "$Id: Fl_Cairo.cxx 10027 2013-12-11 06:33:14Z fabien $" .
 //
 //

+ 1 - 1
fltk/cairo/Makefile

@@ -53,7 +53,7 @@ libfltk_cairo.1.3.dylib: $(CAIROOBJECTS) ../src/libfltk.1.3.dylib
 	echo $(DSOCOMMAND) $@ ...
 	echo $(DSOCOMMAND) $@ ...
 	$(DSOCOMMAND) $@ \
 	$(DSOCOMMAND) $@ \
 		-install_name $(libdir)/$@ \
 		-install_name $(libdir)/$@ \
-		-current_version 1.3.0 \
+		-current_version 1.3.2 \
 		-compatibility_version 1.3.0 \
 		-compatibility_version 1.3.0 \
 		$(CAIROOBJECTS)  -L../src $(LDLIBS) $(CAIROLIBS) -lfltk
 		$(CAIROOBJECTS)  -L../src $(LDLIBS) $(CAIROLIBS) -lfltk
 	$(RM) libfltk_cairo.dylib
 	$(RM) libfltk_cairo.dylib

+ 1 - 0
fltk/config.guess

@@ -0,0 +1 @@
+/usr/share/automake-1.11/config.guess

+ 1 - 0
fltk/config.sub

@@ -0,0 +1 @@
+/usr/share/automake-1.11/config.sub

+ 10 - 2
fltk/configh.cmake.in

@@ -1,5 +1,5 @@
 /*
 /*
- * "$Id: configh.cmake.in 8864 2011-07-19 04:49:30Z greg.ercolano $"
+ * "$Id: configh.cmake.in 9974 2013-09-11 12:54:40Z ossman $"
  *
  *
  * Configuration file for the Fast Light Tool Kit (FLTK).
  * Configuration file for the Fast Light Tool Kit (FLTK).
  * @configure_input@
  * @configure_input@
@@ -106,6 +106,14 @@
  */
  */
 
 
 #define USE_XDBE HAVE_XDBE
 #define USE_XDBE HAVE_XDBE
+
+/*
+ * HAVE_XFIXES:
+ *
+ * Do we have the X fixes extension?
+ */
+
+#cmakedefine01 HAVE_XFIXES
 
 
 /*
 /*
  * __APPLE_QUARTZ__:
  * __APPLE_QUARTZ__:
@@ -310,5 +318,5 @@
 #cmakedefine HAVE_DLSYM @HAVE_DLSYM@
 #cmakedefine HAVE_DLSYM @HAVE_DLSYM@
 
 
 /*
 /*
- * End of "$Id: configh.cmake.in 8864 2011-07-19 04:49:30Z greg.ercolano $".
+ * End of "$Id: configh.cmake.in 9974 2013-09-11 12:54:40Z ossman $".
  */
  */

+ 10 - 2
fltk/configh.in

@@ -1,5 +1,5 @@
 /*
 /*
- * "$Id: configh.in 8864 2011-07-19 04:49:30Z greg.ercolano $"
+ * "$Id: configh.in 9974 2013-09-11 12:54:40Z ossman $"
  *
  *
  * Configuration file for the Fast Light Tool Kit (FLTK).
  * Configuration file for the Fast Light Tool Kit (FLTK).
  * @configure_input@
  * @configure_input@
@@ -106,6 +106,14 @@
  */
  */
 
 
 #define USE_XDBE HAVE_XDBE
 #define USE_XDBE HAVE_XDBE
+
+/*
+ * HAVE_XFIXES:
+ *
+ * Do we have the X fixes extension?
+ */
+
+#define HAVE_XFIXES 0
 
 
 /*
 /*
  * __APPLE_QUARTZ__:
  * __APPLE_QUARTZ__:
@@ -315,5 +323,5 @@
 #undef HAVE_DLSYM
 #undef HAVE_DLSYM
 
 
 /*
 /*
- * End of "$Id: configh.in 8864 2011-07-19 04:49:30Z greg.ercolano $".
+ * End of "$Id: configh.in 9974 2013-09-11 12:54:40Z ossman $".
  */
  */

File diff suppressed because it is too large
+ 381 - 336
fltk/configure


+ 1396 - 1404
fltk/configure.in

@@ -1,1404 +1,1396 @@
-dnl -*- sh -*-
-dnl the "configure" script is made from this by running GNU "autoconf"
-dnl
-dnl "$Id: configure.in 9328 2012-04-07 11:56:09Z AlbrechtS $"
-dnl
-dnl Configuration script for the Fast Light Tool Kit (FLTK).
-dnl
-dnl Copyright 1998-2010 by Bill Spitzak and others.
-dnl
-dnl This library is free software. Distribution and use rights are outlined in
-dnl the file "COPYING" which should have been included with this file.  If this
-dnl file is missing or damaged, see the license at:
-dnl
-dnl     http://www.fltk.org/COPYING.php
-dnl
-dnl Please report all bugs and problems on the following page:
-dnl
-dnl      http://www.fltk.org/str.php
-dnl
-
-dnl We need at least autoconf 2.50...
-AC_PREREQ(2.50)
-
-dnl Required file in package...
-AC_INIT(src/Fl.cxx)
-
-dnl So --with-archflags option is used during "checking size of long"
-if test `uname` = Darwin; then
-  if test "x$with_archflags" != x ; then
-    CFLAGS="$CFLAGS $with_archflags"
-  fi
-  USEMMFILES="Yes"
-else
-  USEMMFILES="No"
-fi
-AC_SUBST(USEMMFILES)
-
-dnl FLTK library versions...
-FL_MAJOR_VERSION=1
-FL_MINOR_VERSION=3
-FL_PATCH_VERSION=0
-FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
-
-AC_SUBST(FL_MAJOR_VERSION)
-AC_SUBST(FL_MINOR_VERSION)
-AC_SUBST(FL_PATCH_VERSION)
-AC_SUBST(FL_API_VERSION)
-
-dnl Get the operating system and version number...
-uname=`uname`
-uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
-if test "x$uname" = xIRIX64; then
-    uname="IRIX"
-fi
-if test "x$uname" = x; then
-    # Older MinGW doesn't provide any output when uname is run, even with "-s".
-    # Current MinGW (as of Jan. 2011) however does, so this is not necessary anymore...
-    uname="MINGW"
-fi
-
-dnl Do not automatically add "-g" to compiler options...
-ARCHFLAGS="${ARCHFLAGS:=}"
-CFLAGS="${CFLAGS:=}"
-CPPFLAGS="${CPPFLAGS:=}"
-CXXFLAGS="${CXXFLAGS:=}"
-DSOFLAGS="${DSOFLAGS:=}"
-LDFLAGS="${LDFLAGS:=}"
-OPTIM="${OPTIM:=}"
-
-AC_SUBST(ARCHFLAGS)
-AC_SUBST(OPTIM)
-
-dnl in case of cross-compiling mingw32 under linux we must change uname for Win32 GUI
-dnl run ./configure --host=i686-pc-ming32 try use X11 without change uname
-if test "x$cross_compiling" != xno ; then
-  case $host_alias in
-    *mingw*)
-    uname=MINGW
-    ;;
-  esac
-fi
-
-dnl OS-specific pre-tests...
-dnl uname_GUI equals $uname unless we target Cygwin in combination with X11.
-uname_GUI=$uname
-case $uname in
-    CYGWIN*)
-        # Handle Cygwin option *first*, before all other tests.
-	AC_ARG_ENABLE(cygwin, [  --enable-cygwin         use the Cygwin libraries [(default=no)]])
-	AC_ARG_ENABLE(x11,    [  --enable-x11            use Cygwin with X11 [(default=no)]])
-	if test x$enable_cygwin != xyes; then
-	    # NOTE: We can't use ARCHFLAGS for this, since it does not work
-	    #       with some of the function tests - Cygwin uses a
-	    #       different C library...
-	    CFLAGS="$CFLAGS -mno-cygwin"
-	    CPPFLAGS="$CPPFLAGS -mno-cygwin"
-	    CXXFLAGS="$CXXFLAGS -mno-cygwin"
-	    LDFLAGS="$LDFLAGS -mno-cygwin"
-	    DSOFLAGS="$DSOFLAGS -mno-cygwin"
-	else
-	    # we target Cygwin in combination with X11
-	    if test x$enable_x11 = xyes; then
-		uname_GUI="X11$uname"
-	    fi
-	fi
-	;;
-esac
-
-dnl Define the libraries and link options we will need.
-LINKFLTK="../lib/libfltk.a"
-LINKFLTKFORMS="../lib/libfltk_forms.a"
-LINKFLTKGL="../lib/libfltk_gl.a"
-LINKFLTKIMG="../lib/libfltk_images.a"
-GLDEMOS="gldemos"
-
-LIBEXT=".a"
-LIBNAME="../lib/libfltk.a"
-FLLIBNAME="../lib/libfltk_forms.a"
-GLLIBNAME="../lib/libfltk_gl.a"
-IMGLIBNAME="../lib/libfltk_images.a"
-CAIROLIBNAME="../lib/libfltk_cairo.a"
-
-LIBBASENAME="libfltk.a"
-FLLIBBASENAME="libfltk_forms.a"
-GLLIBBASENAME="libfltk_gl.a"
-IMGLIBBASENAME="libfltk_images.a"
-CAIROLIBBASENAME="libfltk_cairo.a"
-
-dnl Check for Cairo library unless disabled...
-CAIRODIR=""
-CAIROFLAGS=""
-LINKFLTKCAIRO=""
-FLTKCAIROOPTION=""
-CAIROLIBS=""
-
-AC_ARG_ENABLE(cairoext,[  --enable-cairoext       use fltk code instrumentation for cairo extended use (default=no)])
-AC_ARG_ENABLE(cairo,[  --enable-cairo          use lib Cairo  (default=no)])
-
-if test x$enable_cairoext = xyes; then
-	  AC_DEFINE(FLTK_USE_CAIRO)
-	  AC_DEFINE(FLTK_HAVE_CAIRO)
-	  dnl FIXME This part should be fixed so configure do not depend on
-	  dnl we do not rely on pkg-config .
-	  CAIRODIR="cairo"
-          CAIROFLAGS="`pkg-config --cflags cairo`"
-          CAIROLIBS="-lcairo -lpixman-1"
-          CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
-	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
-	  FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
-	  LIBS="$CAIROLIBS $LIBS" 
-	  dnl $LINKFLTKCAIRO 
-	  LINKFLTK+=" $LINKFLTKCAIRO"
-else 
-    if test x$enable_cairo = xyes; then
-	  AC_DEFINE(FLTK_HAVE_CAIRO)
-	  dnl FIXME This part should be fixed so configure do not depend on
-	  dnl we do not rely on pkg-config .
-	  CAIRODIR="cairo"
-          CAIROFLAGS="`pkg-config --cflags cairo`"
-          CAIROLIBS="-lcairo -lpixman-1"
-          CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
-	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
-	  FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
-    fi
-fi
-
-AC_SUBST(CAIRODIR)
-AC_SUBST(CAIROFLAGS)
-AC_SUBST(CAIROLIBS)
-AC_SUBST(LINKFLTKCAIRO)
-AC_SUBST(FLTKCAIROOPTION)
-
-
-AC_SUBST(FLLIBNAME)
-AC_SUBST(GLDEMOS)
-AC_SUBST(GLLIBNAME)
-AC_SUBST(IMGLIBNAME)
-AC_SUBST(CAIROLIBNAME)
-AC_SUBST(LIBEXT)
-AC_SUBST(LIBNAME)
-AC_SUBST(LINKFLTK)
-AC_SUBST(LINKFLTKFORMS)
-AC_SUBST(LINKFLTKGL)
-AC_SUBST(LINKFLTKIMG)
-
-AC_SUBST(LIBBASENAME)
-AC_SUBST(FLLIBBASENAME)
-AC_SUBST(GLLIBBASENAME)
-AC_SUBST(IMGLIBBASENAME)
-AC_SUBST(CAIROLIBBASENAME)
-
-dnl Handle compile-time options...
-AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
-if test x$enable_debug = xyes; then
-    DEBUGFLAG="-g "
-else
-    DEBUGFLAG=""
-fi
-
-AC_ARG_ENABLE(cp936, [  --enable-cp936          turn on CP936 [default=no]])
-if test x$enable_cp936 = xyes; then
-    CFLAGS="$CFLAGS -DCP936"
-fi
-
-
-AC_ARG_ENABLE(gl, [  --enable-gl             turn on OpenGL support [default=yes]])
-
-AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries [default=no]])
-if test x$enable_shared = xyes; then
-    PICFLAG=1
-    SHAREDSUFFIX=""
-    FLUID="fluid-shared"
-
-    case $uname in
-	Darwin*)
-            DSONAME="libfltk.$FL_API_VERSION.dylib"
-            FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
-            GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
-            IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
-            CAIRODSONAME="libfltk_cairo.$FL_API_VERSION.dylib"
-	    DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
-	    ;;
-
-	SunOS* | UNIX_S*)
-            DSONAME="libfltk.so.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
-	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
-	    if test "x$libdir" != "x/usr/lib"; then
-		    DSOLINK="-R$libdir"
-            fi
-	    ;;
-	HP-UX*)
-            DSONAME="libfltk.sl.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.sl.$FL_API_VERSION"
-	    DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
-	    if test "x$libdir" != "x/usr/lib"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-            fi
-	    ;;
-	IRIX*)
-            DSONAME="libfltk.so.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
-            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
-	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-            fi
-	    ;;
-	OSF1*)
-            DSONAME="libfltk.so.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
-            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
-	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-            fi
-	    ;;
-	Linux* | *BSD*)
-            DSONAME="libfltk.so.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
-            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
-	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
-		    DSOLINK="-Wl,-rpath,$libdir"
-            fi
-	    ;;
-	AIX*)
-            DSONAME="libfltk_s.a"
-            FLDSONAME="libfltk_forms_s.a"
-            GLDSONAME="libfltk_gl_s.a"
-            IMGDSONAME="libfltk_images_s.a"
-            CAIRODSONAME="libfltk_cairo_s.a"
-            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
-            SHAREDSUFFIX="_s"
-            ;;
-        CYGWIN* | MINGW*)
-	    PICFLAG=0
-	    if test x$enable_cygwin != xyes; then
-		DSONAME="mgwfltknox-$FL_API_VERSION.dll"
-		FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
-		GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
-		IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
-		CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
-	    else
-		if test x$enable_x11 = xyes; then
-		    DSONAME="cygfltk-$FL_API_VERSION.dll"
-		    FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
-		    GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
-		    IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
-		    CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
-		else
-		    DSONAME="cygfltknox-$FL_API_VERSION.dll"
-		    FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
-		    GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
-		    IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
-		    CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
-		fi
-	    fi
-	    #-----------------------------------------------------------
-	    # -Wl,--enable-runtime-pseudo-reloc: See str 1585
-	    # appears to be necessary for older binutils versions < 2.16
-	    #-----------------------------------------------------------
-            LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
-	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
-	    	-Wl,--whole-archive -Wl,--export-all-symbols \
-		-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
-		-Wl,--enable-auto-image-base -o \$@"
-	    ;;
-	*)
-            AC_MSG_WARN(Shared libraries may not be supported.  Trying -shared option with compiler.)
-            DSONAME="libfltk.so.$FL_API_VERSION"
-            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
-            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
-            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
-            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
-            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
-	    ;;
-    esac
-
-    LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
-else
-    DSOCOMMAND="echo"
-    DSOLINK=""
-    DSONAME=""
-    FLDSONAME=""
-    GLDSONAME=""
-    IMGDSONAME=""
-    CAIRODSONAME=""
-    PICFLAG=0
-    SHAREDSUFFIX=""
-    FLUID="fluid"
-    LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
-fi
-
-AC_SUBST(DSOCOMMAND)
-AC_SUBST(DSOFLAGS)
-AC_SUBST(DSOLINK)
-AC_SUBST(DSONAME)
-AC_SUBST(FLDSONAME)
-AC_SUBST(GLDSONAME)
-AC_SUBST(IMGDSONAME)
-AC_SUBST(CAIRODSONAME)
-AC_SUBST(SHAREDSUFFIX)
-AC_SUBST(LINKSHARED)
-AC_SUBST(FLUID)
-
-AC_ARG_ENABLE(threads, [  --enable-threads        enable multi-threading support (default=yes)])
-
-AC_ARG_WITH(optim, [  --with-optim="flags"    use custom optimization flags])
-
-AC_ARG_WITH(archflags, [  --with-archflags="flags"
-                          use custom architecture flags 
-			  (possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
-    ARCHFLAGS="$withval")
-case $uname in
-    Darwin*)
-# QD is not supported anymore since 1.3
-	AC_DEFINE(__APPLE_QUARTZ__)
-	;;
-esac
-
-dnl Find commands...
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_INSTALL
-case $uname in
-    OSF1*)
-	INSTALL="`pwd`/install-sh -c"
-	;;
-esac
-if test "$INSTALL" = "$ac_install_sh"; then
-    # Use full path to install-sh script...
-    INSTALL="`pwd`/install-sh -c"
-fi
-AC_PATH_PROG(NROFF,nroff)
-if test "x$NROFF" = "x:"; then
-    # Try groff instead of nroff...
-    AC_PATH_PROG(GROFF,groff)
-    if test "x$GROFF" = "x:"; then
-        NROFF="echo"
-    else
-        NROFF="$GROFF -T ascii"
-    fi
-fi
-AC_PATH_PROG(HTMLDOC,htmldoc)
-AC_PATH_PROG(DOXYDOC,doxygen)
-
-dnl How do we make libraries?
-AC_PROG_RANLIB
-AC_PATH_TOOL(AR, ar)
-
-if test "x$AR" = "x:"; then
-    AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
-fi
-
-if test "x$RANLIB" != "x:"; then
-    LIBCOMMAND="$AR cr"
-else
-    LIBCOMMAND="$AR crs"
-fi
-
-AC_SUBST(LIBCOMMAND)
-
-dnl how to compile (Windows) resource files
-dnl this will only be used to compile resources for Windows .exe files
-AC_PATH_TOOL(RC,windres)
-
-dnl Architecture checks...
-if test "$uname" != Darwin; then
-  AC_C_BIGENDIAN
-fi
-
-AC_CHECK_SIZEOF(short, 2)
-AC_CHECK_SIZEOF(int, 4)
-AC_CHECK_SIZEOF(long, 4)
-if test $ac_cv_sizeof_short -eq 2; then
-    AC_DEFINE(U16,unsigned short)
-fi
-if test $ac_cv_sizeof_int -eq 4; then
-    AC_DEFINE(U32,unsigned)
-else
-    if test $ac_cv_sizeof_long -eq 4; then
-        AC_DEFINE(U32,unsigned long)
-    fi
-fi
-if test "$uname" != Darwin; then
-	if test $ac_cv_sizeof_int -eq 8; then
-		AC_DEFINE(U64,unsigned)
-	else
-		if test $ac_cv_sizeof_long -eq 8; then
-			AC_DEFINE(U64,unsigned long)
-		fi
-	fi
-fi
-
-dnl Does the C++ compiler support the bool type?
-AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
-    ac_cv_cxx_bool,[
-	AC_LANG_SAVE
-	AC_LANG_CPLUSPLUS
-	AC_TRY_COMPILE([
-	    int f(int  x){return 1;}
-	    int f(char x){return 1;}
-	    int f(bool x){return 1;}
-	],[
-	    bool b = true;
-	    return f(b);
-	], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
-	AC_LANG_RESTORE
-    ])
-
-if test "$ac_cv_cxx_bool" != yes; then
-    CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
-fi
-
-dnl Standard headers and functions...
-AC_HEADER_DIRENT
-AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
-AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
-
-dnl Do we have the POSIX compatible scandir() prototype?
-AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
-    ac_cv_cxx_scandir_posix,[
-	AC_LANG_SAVE
-	AC_LANG_CPLUSPLUS
-	AC_TRY_COMPILE([
-	  #include <dirent.h>
-	  int func (const char *d, dirent ***list, void *sort) {
-	    int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
-	  }
-	],[
-	], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
-	AC_LANG_RESTORE
-    ])
-
-dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
-dnl available. Otherwise: check, whether any scandir prototype is available,
-dnl but don't use it on SunOS and QNX because of an incompatibility in pre-Y2K
-dnl SunOS scandir versions. We assume, though, that the POSIX compatible
-dnl version on newer SunOS/Solaris versions works as expected.
-if test "$ac_cv_cxx_scandir_posix" = yes; then
-    AC_DEFINE(HAVE_SCANDIR)
-    AC_DEFINE(HAVE_SCANDIR_POSIX)
-else
-    AC_CHECK_FUNC(scandir,
-	if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
-            AC_MSG_WARN(Not using $uname scandir emulation function.)
-	else
-            AC_DEFINE(HAVE_SCANDIR)
-        fi)
-fi
-
-AC_CHECK_FUNC(vsnprintf,[
-    case "$uname" in
-    	HP-UX*)
-	    if test "$uversion" = "1020"; then
-	        AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
-	    else
-        	AC_DEFINE(HAVE_VSNPRINTF)
-	    fi
-	    ;;
-
-    	OSF1*)
-	    if test "$uversion" = "40"; then
-                AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
-	    else
-        	AC_DEFINE(HAVE_VSNPRINTF)
-	    fi
-	    ;;
-
-        *)
-            AC_DEFINE(HAVE_VSNPRINTF)
-	    ;;
-    esac])
-AC_CHECK_FUNC(snprintf,[
-    case "$uname" in
-    	HP-UX*)
-	    if test "$uversion" = "1020"; then
-	        AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
-	    else
-        	AC_DEFINE(HAVE_SNPRINTF)
-	    fi
-	    ;;
-
-    	OSF1*)
-	    if test "$uversion" = "40"; then
-                AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
-	    else
-        	AC_DEFINE(HAVE_SNPRINTF)
-	    fi
-	    ;;
-
-        *)
-            AC_DEFINE(HAVE_SNPRINTF)
-	    ;;
-    esac])
-AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
-AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
-
-AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
-AC_CHECK_FUNCS(localeconv)
-
-dnl FLTK library uses math library functions...
-AC_SEARCH_LIBS(pow, m)
-
-dnl Check for largefile support...
-AC_SYS_LARGEFILE
-
-dnl Define largefile options as needed...
-LARGEFILE=""
-if test x$enable_largefile != xno; then
-	LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
-
-	if test x$ac_cv_sys_large_files = x1; then
-		LARGEFILE="$LARGEFILE -D_LARGE_FILES"
-	fi
-
-	if test x$ac_cv_sys_file_offset_bits = x64; then
-		LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
-	fi
-fi
-AC_SUBST(LARGEFILE)
-
-dnl Check for "long long" support...
-AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
-	[if test "$GCC" = yes; then
-		ac_cv_c_long_long=yes
-	else
-		AC_TRY_COMPILE(,[long long int i;],
-			ac_cv_c_long_long=yes,
-			ac_cv_c_long_long=no)
-	fi])
-
-if test $ac_cv_c_long_long = yes; then
-	AC_DEFINE(HAVE_LONG_LONG)
-fi
-
-AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
-
-dnl Check for dlopen/dlsym...
-AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
-AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
-
-dnl Check for audio libraries...
-AUDIOLIBS=""
-
-case $uname in
-    CYGWIN* | MINGW*)
-	dnl Cygwin environment...
-	AUDIOLIBS="-lwinmm"
-	;;
-
-    Darwin*)
-	AUDIOLIBS="-framework CoreAudio"
-	;;
-
-    *)
-	AC_CHECK_HEADER(alsa/asoundlib.h,
-	    AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
-	    AUDIOLIBS="-lasound")
-        ;;
-esac
-
-AC_SUBST(AUDIOLIBS)
-
-dnl Check for image libraries...
-SAVELIBS="$LIBS"
-IMAGELIBS=""
-STATICIMAGELIBS=""
-
-AC_SUBST(IMAGELIBS)
-AC_SUBST(STATICIMAGELIBS)
-
-# Handle the JPEG lib linking mode (use fltk local or system lib)
-# If --enable-(resp. --disable-)localjpeg parameter is not set by user
-# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
-AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, default=auto])
-# Check for System lib use if automatic mode or --disable-localjpeg is requested
-sysjpeglib_ok=no
-sysjpeginc_ok=no
-if test x$enable_localjpeg != xyes; then
-    AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
-	[AC_CHECK_HEADER(jpeglib.h,
-	    sysjpeginc_ok=yes)
-	    if test x$sysjpeginc_ok = xyes; then
-		sysjpeglib_ok=yes
-		fi])
-fi
-# Now set the jpeg lib and include flags according to the requested mode and availability 
-if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
-    JPEGINC="-I../jpeg"
-    JPEG="jpeg"
-    IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
-    STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBJPEG)
-    #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
-    # Finally, warn user if system lib was requested but not found
-    if test x$enable_localjpeg = xno; then
-	AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
-    fi
-else
-    JPEGINC=""
-    JPEG=""
-    IMAGELIBS="-ljpeg $IMAGELIBS"
-    STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBJPEG)
-fi
-
-# Handle the ZLIB lib linking mode (use fltk local or system lib)
-# If --enable-(resp. --disable-)localzlib parameter is not set by user
-# Then we check the ZLIB lib usability, with result in syszlib_ok variable
-AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, default=auto])
-# Check for System lib use if automatic mode or --disable-localzlib is requested
-syszlib_ok=no
-syszinc_ok=no
-if test x$enable_localzlib != xyes; then
-    AC_CHECK_LIB(z,gzgets,
-	[AC_CHECK_HEADER(zlib.h, 
-		syszinc_ok=yes)
-	if test x$syszinc_ok = xyes; then
-	    syszlib_ok=yes
-	    fi])
-fi
-# Now set the Z lib and include flags according to the requested mode and availability 
-if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
-    ZLIBINC="-I../zlib"
-    ZLIB="zlib"
-    LIBS="-lfltk_z $LIBS"
-    IMAGELIBS="-lfltk_z $IMAGELIBS"
-    STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBZ)
-    ac_cv_lib_z_gzgets=no # fc: is still necessary ?
-    # Finally, warn user if system lib was requested but not found
-    if test x$enable_localzlib = xno; then
-	AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
-    fi
-else
-    ZLIBINC=""
-    ZLIB=""
-    LIBS="-lz $LIBS"
-    IMAGELIBS="-lz $IMAGELIBS"
-    STATICIMAGELIBS="-lz $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBZ)
-fi
-
-# Handle the PNG lib linking mode (use fltk local or system lib)
-# If --enable-(resp. --disable-)localpng parameter is not set by user
-# Then we check the png lib usability with result in syspng_lib variable
-AC_ARG_ENABLE(localpng, [  --enable-localpng       use local PNG library, default=auto])
-
-# Now check if system lib is usable, we check Lib AND include availability with inc variant,
-# but only, if the builtin lib is not requested
-syspnglib_ok=no
-syspnginc_ok=no
-if test x$enable_localpng != xyes; then
-  AC_CHECK_LIB(png, png_read_info, 
-    [AC_CHECK_HEADER(png.h, 
-	AC_DEFINE(HAVE_PNG_H)
-	syspnginc_ok=yes)
-    AC_CHECK_HEADER(libpng/png.h, 
-	AC_DEFINE(HAVE_LIBPNG_PNG_H)
-	syspnginc_ok=yes)
-    if test x$syspnginc_ok = xyes; then
-	syspnglib_ok=yes
-    fi])
-fi
-
-# The following is executed if the lib was not found usable or if local lib is required explicitly
-if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
-    PNGINC="-I../png"
-    PNG="png"
-    IMAGELIBS="-lfltk_png $IMAGELIBS"
-    STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBPNG)
-    AC_DEFINE(HAVE_PNG_H)
-    AC_DEFINE(HAVE_PNG_GET_VALID)
-    AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
-    # Finally, warn user if system lib was requested but not found
-    if test x$enable_localpng = xno; then
-	AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
-    fi
-else
-    PNGINC=""
-    PNG=""
-    IMAGELIBS="-lpng $IMAGELIBS"
-    STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
-    AC_DEFINE(HAVE_LIBPNG)
-    AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
-    AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
-fi
-
-AC_SUBST(JPEG)
-AC_SUBST(JPEGINC)
-AC_SUBST(PNG)
-AC_SUBST(PNGINC)
-AC_SUBST(ZLIB)
-AC_SUBST(ZLIBINC)
-
-dnl Restore original LIBS settings...
-LIBS="$SAVELIBS"
-
-dnl See if we need a .exe extension on executables...
-AC_EXEEXT
-
-dnl Check for pthreads for multi-threaded apps...
-have_pthread=no
-PTHREAD_FLAGS=""
-
-dnl Test whether we want to check for pthreads. We must not do it on Windows
-dnl unless we run under Cygwin with --enable-cygwin, since we always use
-dnl native threads on Windows (even if libpthread is available)
-check_pthread=yes
-case $uname in
-    MINGW*)
-	check_pthread=no
-	;;
-    CYGWIN*)
-	if test "x$enable_cygwin" != xyes; then
-	    check_pthread=no
-	fi
-	;;
-    *)
-	;;
-esac
-
-if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
-    AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
-
-    if test x$ac_cv_header_pthread_h = xyes; then
-	dnl Check various threading options for the platforms we support
-	for flag in -lpthreads -lpthread -pthread; do
-            AC_MSG_CHECKING([for pthread_create using $flag])
-	    SAVELIBS="$LIBS"
-	    LIBS="$flag $LIBS"
-            AC_TRY_LINK([#include <pthread.h>],
-		[pthread_create(0, 0, 0, 0);],
-        	have_pthread=yes,
-		LIBS="$SAVELIBS")
-            AC_MSG_RESULT([$have_pthread])
-
-	    if test $have_pthread = yes; then
-	        AC_DEFINE(HAVE_PTHREAD)
-		PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
-
-		# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
-		# be POSIX-compliant... :(
-		if test $uname = SunOS; then
-		    PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
-		fi
-		break
-	    fi
-	done
-    fi
-fi
-
-AC_SUBST(PTHREAD_FLAGS)
-
-dnl Define OS-specific stuff...
-HLINKS=
-OSX_ONLY=:
-THREADS=
-
-AC_ARG_WITH(links, [  --with-links            make header links for common misspellings (default=no)])
-
-INSTALL_DESKTOP=""
-UNINSTALL_DESKTOP=""
-
-case $uname_GUI in
-    CYGWIN* | MINGW*)
-	dnl Cygwin environment, using windows GDI ...
-	# Recent versions of Cygwin are seriously broken and the size
-	# checks don't work because the shell puts out \r\n instead of
-	# \n.  Here we just force U32 to be defined to "unsigned"...
-        AC_DEFINE(U32,unsigned)
-	CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
-	CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
-	LDFLAGS="-mwindows $LDFLAGS"
-	DSOFLAGS="-mwindows $DSOFLAGS"
-	LIBS="$LIBS -lole32 -luuid -lcomctl32 -lwinspool"
-	if test "x$with_optim" = x; then
-	    dnl Avoid -Os optimization on Cygwin/MinGW
-	    with_optim="-O3"
-	fi
-
-	if test x$enable_gl != xno; then
-	    AC_CHECK_HEADER(GL/gl.h,
-	        AC_DEFINE(HAVE_GL)
-		GLLIB="-lopengl32")
-	    AC_CHECK_HEADER(GL/glu.h,
-        	AC_DEFINE(HAVE_GL_GLU_H)
-		GLLIB="-lglu32 $GLLIB")
-	else
-	    LINKFLTKGL=""
-	    GLLIBNAME=""
-	    GLDSONAME=""
-	    GLDEMOS=""
-	fi
-
-	if test "x$enable_threads" != xno; then
-	    if test x$have_pthread = xyes; then
-		AC_DEFINE(HAVE_PTHREAD)
-	    fi
-        fi
-
-	THREADS="threads$EXEEXT"
-
-	# Don't make symlinks since Windows is not case sensitive.
-	if test "x$with_links" != xyes; then
-		HLINKS="#"
-	fi
-	;;
-
-    Darwin*)
-        # MacOS X uses Cocoa for graphics.
-        LIBS="$LIBS -framework Cocoa"
-
-	if test x$have_pthread = xyes; then
-	    AC_DEFINE(HAVE_PTHREAD)
-	    THREADS="threads$EXEEXT"
-	fi
-
-	if test x$enable_gl != xno; then
-            AC_DEFINE(HAVE_GL)
-            AC_DEFINE(HAVE_GL_GLU_H)
-            GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
-        else
-	    LINKFLTKGL=""
-	    GLLIBNAME=""
-	    GLDSONAME=""
-	    GLDEMOS=""
-        fi
-
-	# Don't make symlinks because HFS+ is not case sensitive...
-	if test "x$with_links" != xyes; then
-		HLINKS="#"
-	fi
-
-	# Some steps are only done for OS X package management
-	OSX_ONLY=
-
-	# Install/Uninstall FLUID application
-	INSTALL_DESKTOP="install-osx"
-	UNINSTALL_DESKTOP="uninstall-osx"
-	;;
-
-    *)
-	# All others are UNIX/X11...
-	# This includes Cygwin target combined with X11
-	if test x$have_pthread = xyes; then
-	    AC_DEFINE(HAVE_PTHREAD)
-	    THREADS="threads$EXEEXT"
-	fi
-
-	dnl Check for X11...
-	AC_PATH_XTRA
-
-	if test x$no_x = xyes; then
-	    AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
-	fi
-
-	if test "x$X_PRE_LIBS" != x; then
-	    AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
-	fi
-
-	LIBS="$LIBS -lX11 $X_EXTRA_LIBS"
-	CFLAGS="$CFLAGS $X_CFLAGS"
-	CXXFLAGS="$CXXFLAGS $X_CFLAGS"
-	LDFLAGS="$X_LIBS $LDFLAGS"
-	DSOFLAGS="$X_LIBS $DSOFLAGS"
-	AC_DEFINE(USE_X11)
-	if test "x$x_includes" != x; then
-	    ac_cpp="$ac_cpp -I$x_includes"
-	fi
-
-	dnl Check for OpenGL unless disabled...
-	GLLIB=
-
-	if test x$enable_gl != xno; then
-	    AC_SEARCH_LIBS(dlopen, dl)
-	    AC_CHECK_HEADER(GL/gl.h,
-		AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL",
-		    AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,
-			-lm),
-		    -lm)
-		AC_CHECK_LIB(GL, glXGetProcAddressARB,
-		             AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
-	    )
-	    AC_CHECK_HEADER(GL/glu.h,
-        	AC_DEFINE(HAVE_GL_GLU_H)
-		if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
-		    GLLIB="-lGLU $GLLIB"
-		fi
-		if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
-		    GLLIB="-lMesaGLU $GLLIB"
-		fi
-	    )
-
-	    if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
-		    LINKFLTKGL=""
-		    GLLIBNAME=""
-		    GLDSONAME=""
-		    GLDEMOS=""
-	    fi
-	else
-	    LINKFLTKGL=""
-	    GLLIBNAME=""
-	    GLDSONAME=""
-	    GLDEMOS=""
-	fi
-
-	dnl Check for Xinerama support unless disabled...
-        AC_ARG_ENABLE(xinerama, [  --enable-xinerama       turn on Xinerama support [default=yes]])
-
-	if test x$enable_xinerama != xno; then
-	    AC_CHECK_LIB(Xinerama,XineramaIsActive,
-		    AC_DEFINE(HAVE_XINERAMA)
-		    LIBS="-lXinerama $LIBS")
-	fi
-
-	dnl Check for the Xft library unless disabled...
-        AC_ARG_ENABLE(xft, [  --enable-xft            turn on Xft support [default=yes]])
-
-	if test x$enable_xft != xno; then
-            AC_PATH_PROG(FTCONFIG,freetype-config)
-
-	    if test "x$FTCONFIG" != x; then
-	        CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
-	        CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
-
-	        AC_CHECK_LIB(fontconfig, FcPatternCreate)
-		AC_CHECK_HEADER(X11/Xft/Xft.h,
-		    AC_CHECK_LIB(Xft, XftDrawCreate,
-			AC_DEFINE(USE_XFT)
-			LIBS="-lXft $LIBS"))
-	    fi
-	fi
-
-	dnl Check for the Xdbe extension unless disabled...
-        AC_ARG_ENABLE(xdbe, [  --enable-xdbe           turn on Xdbe support [default=yes]])
-
-	if test x$enable_xdbe != xno; then
-	    AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
-	        [#include <X11/Xlib.h>])
-	    AC_CHECK_LIB(Xext, XdbeQueryExtension,
-		LIBS="-lXext $LIBS")
-	fi
-
-	dnl Check for overlay visuals...
-	AC_PATH_PROG(XPROP, xprop)
-	AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
-	    if test "x$XPROP" != x; then
-		if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
-        	    ac_cv_have_overlay=yes
-		else
-        	    ac_cv_have_overlay=no
-		fi
-	    else
-        	ac_cv_have_overlay=no
-	    fi)
-
-        if test x$ac_cv_have_overlay = xyes; then
-	    AC_DEFINE(HAVE_OVERLAY)
-	fi
-
-	# Make symlinks since UNIX/Linux is case sensitive,
-	# but Cygwin in general not.
-	case $uname in
-	    CYGWIN*)
-		HLINKS="#"
-	    ;;
-	    *)
-	    ;;
-	esac
-	# Make symlinks since UNIX/Linux is case sensitive,
-	# but only if explicitly configured (default=no)
-	if test "x$with_links" != xyes; then
-		HLINKS="#"
-	fi
-
-	# Install/Uninstall FLUID application support files
-	INSTALL_DESKTOP="install-linux"
-	UNINSTALL_DESKTOP="uninstall-linux"
-	;;
-esac
-
-AC_SUBST(GLDEMOS)
-AC_SUBST(GLLIB)
-AC_SUBST(HLINKS)
-AC_SUBST(OSX_ONLY)
-AC_SUBST(THREADS)
-
-AC_SUBST(INSTALL_DESKTOP)
-AC_SUBST(UNINSTALL_DESKTOP)
-
-dnl Figure out the appropriate formatted man page extension...
-case "$uname" in
-    *BSD* | Darwin*)
-	# *BSD
-	CAT1EXT=0
-	CAT3EXT=0
-	CAT6EXT=0
-	;;
-    IRIX*)
-	# SGI IRIX
-	CAT1EXT=z
-	CAT3EXT=z
-	CAT6EXT=z
-	;;
-    *)
-	# All others
-	CAT1EXT=1
-	CAT3EXT=3
-	CAT6EXT=6
-	;;
-esac
-
-AC_SUBST(CAT1EXT)
-AC_SUBST(CAT3EXT)
-AC_SUBST(CAT6EXT)
-
-dnl Fix "mandir" variable...
-if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
-    case "$uname" in
-        *BSD* | Darwin* | Linux*)
-            # *BSD, Darwin, and Linux
-            mandir="\${prefix}/share/man"
-            ;;
-        IRIX*)
-            # SGI IRIX
-            mandir="\${prefix}/share/catman"
-            ;;
-    esac
-fi
-
-dnl Fix "libdir" variable...
-if test "$prefix" = NONE; then
-    prefix=/usr/local
-fi
-
-if test "$exec_prefix" = NONE; then
-    exec_prefix="\${prefix}"
-fi
-
-if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
-    libdir="/usr/lib32"
-fi
-
-dnl Define the command used to update the dependencies (this option
-dnl mainly for FLTK core developers - not necessary for users)
-MAKEDEPEND="\$(CXX) -M"
-AC_SUBST(MAKEDEPEND)
-
-dnl Add warnings to compiler switches:
-dnl do this last so messing with switches does not break tests
-
-if test -n "$GCC"; then
-    # Show all standard warnings + unused variables, conversion errors,
-    # and inlining problems when compiling...
-    OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"
-
-    # The following additional warnings are useful for tracking down problems...
-    #OPTIM="-Wshadow -Wconversion $OPTIM"
-
-    # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
-    # we will temporarily disable 'deprecated' warnings on OS X.
-    if test "$uname" = "Darwin" -a $uversion -ge 800; then
-        OPTIM="-Wno-deprecated-declarations $OPTIM"
-    fi
-
-    # Set the default compiler optimizations...
-    if test -z "$DEBUGFLAG"; then
-    	#
-	# Note: Can't use -fomit-frame-pointer - prevents tools like
-	#       libsafe from working!
-        #
-	#       Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
-	#       They all seem to make either no difference or enlarge
-	#       the code by a few hundred bytes.
-        #
-	#       "-Os" seems to be the best compromise between speed and
-	#       code size.  "-O3" and higher seem to make no effective
-	#       difference in the speed of the code, but does bloat the
-	#       library 10+%.
-	#
-
-        if test "x$with_optim" != x; then
-	    OPTIM="$with_optim $OPTIM"
-	else
-            OPTIM="-Os $OPTIM"
-	fi
-    fi
-
-    # Generate position-independent code when needed...
-    if test $PICFLAG = 1; then
-    	OPTIM="$OPTIM -fPIC"
-    fi
-
-    # See if GCC supports -fno-exceptions...
-    AC_MSG_CHECKING(if GCC supports -fno-exceptions)
-    OLDCFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -fno-exceptions"
-    AC_TRY_COMPILE(,,
-	OPTIM="$OPTIM -fno-exceptions"
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    CFLAGS="$OLDCFLAGS"
-
-    # See if GCC supports -fno-strict-aliasing...
-    AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
-    OLDCFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -fno-strict-aliasing"
-    AC_TRY_COMPILE(,,
-	OPTIM="$OPTIM -fno-strict-aliasing"
-	AC_MSG_RESULT(yes),
-	AC_MSG_RESULT(no))
-    CFLAGS="$OLDCFLAGS"
-
-    # See if we are running Solaris; if so, try the -fpermissive option...
-    # This option is required on some versions of Solaris to work around
-    # bugs in the X headers up through Solaris 7.
-    #
-    # Unlike the other compiler/optimization settings, this one is placed
-    # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
-    # to clients - otherwise client apps will not compile properly...
-    if test "$uname" = SunOS; then
-	AC_MSG_CHECKING(if GCC supports -fpermissive)
-
-	OLDCFLAGS="$CFLAGS"
-	CFLAGS="$CFLAGS -fpermissive"
-	AC_TRY_COMPILE(,,
-	    CXXFLAGS="$CXXFLAGS -fpermissive"
-	    AC_MSG_RESULT(yes),
-	    CFLAGS="$OLDCFLAGS"
-	    AC_MSG_RESULT(no))
-    fi
-else
-    case "$uname" in
-        IRIX*)
-	    # Running some flavor of IRIX; see which version and
-	    # set things up according...
-	    if test "$uversion" -ge 62; then
-	        # We are running IRIX 6.2 or higher; uncomment the following
-		# lines if you don't have IDO 7.2 or higher:
-		#
-		#     CXX="CC -n32 -mips3"
-		#     CC="cc -n32 -mips3"
-		#     LD="ld -n32 -mips3"
-		#     MAKEDEPEND="CC -M"
-
-		if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
-			AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
-		fi
-
-        	OPTIM="-fullwarn $OPTIM"
-	    fi
-	    if test -z "$DEBUGFLAG"; then
-        	if test "x$with_optim" != x; then
-		    OPTIM="$with_optim $OPTIM"
-		else
-        	    OPTIM="-O2 $OPTIM"
-		    if test $uversion -gt 62; then
-        	        OPTIM="-OPT:Olimit=4000 $OPTIM"
-	            fi
-		fi
-	    fi
-	    ;;
-	HP-UX*)
-	    # Running HP-UX; these options should work for the HP compilers.
-	    if test -z "$DEBUGFLAG"; then
-        	if test "x$with_optim" != x; then
-		    OPTIM="$with_optim $OPTIM"
-		else
-        	    OPTIM="+O2 $OPTIM"
-		fi
-	    fi
-
-	    if test $PICFLAG = 1; then
-		OPTIM="+z $OPTIM"
-	    fi
-
-	    CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
-	    ;;
-	OSF1*)
-	    # Running Digital/Tru64 UNIX; these options should work for the
-	    # Digital/Compaq/NewHP compilers.
-	    if test -z "$DEBUGFLAG"; then
-        	if test "x$with_optim" != x; then
-		    OPTIM="$with_optim $OPTIM"
-		else
-        	    OPTIM="-O2 $OPTIM"
-		fi
-	    fi
-	    ;;
-	SunOS*)
-	    # Solaris
-	    if test -z "$DEBUGFLAG"; then
-        	if test "x$with_optim" != x; then
-		    OPTIM="$with_optim $OPTIM"
-		else
-        	    OPTIM="-xO3 $OPTIM"
-		fi
-	    fi
-
-	    if test $PICFLAG = 1; then
-		OPTIM="-KPIC $OPTIM"
-	    fi
-	    ;;
-	AIX*)
-	    if test -z "$DEBUGFLAG"; then
-        	if test "x$with_optim" != x; then
-		    OPTIM="$with_optim $OPTIM"
-		else
-        	    OPTIM="-O2 $OPTIM"
-		fi
-	    fi
-
-	    AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
-	    ;;
-	*)
-	    # Running some other operating system; inform the user they
-	    # should contribute the necessary options via the STR form..
-	    AC_MSG_WARN(Building FLTK with default compiler optimizations)
-	    AC_MSG_WARN(Send the FLTK developers your uname and compiler options via http://www.fltk.org/str.php)
-	    ;;
-    esac
-fi
-
-OPTIM="$DEBUGFLAG $OPTIM"
-
-dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
-if test `uname` = Darwin; then
-  if test "x$with_archflags" != x ; then
-    CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
-  fi
-fi
-
-dnl Define the FLTK documentation directory...
-case $uname in
-  MINGW*)
-     # Determine the path where MSys has /usr installed
- 	msyspath=`mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
-     # Then substitute that in the WIN32 path instead of /usr
- 	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/fltk")
-    ;;
-  *)
-    if test x$prefix = xNONE; then
-	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
-    else
-	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
-    fi
-    ;;
-esac
-
-dnl Define the FLTK data directory...
-if test x$prefix = xNONE; then
-    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
-else
-    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
-fi
-
-dnl Summarize results of configure tests...
-echo ""
-echo "Configuration Summary"
-echo "-------------------------------------------------------------------------"
-
-case $uname_GUI in
-    CYGWIN* | MINGW*)
-        graphics="GDI"
-	;;
-    Darwin*)
-        graphics="Quartz"
-        ;;
-    *)
-        graphics="X11"
-	if test x$enable_xft != xno; then
-	    graphics="$graphics+Xft"
-	fi
-	if test x$enable_xdbe != xno; then
-	    graphics="$graphics+Xdbe"
-	fi
-	if test x$enable_xinerama != xno; then
-	    graphics="$graphics+Xinerama"
-	fi
-        ;;
-esac
-
-echo "    Directories: prefix=$prefix"
-echo "                 bindir=$bindir"
-echo "                 datadir=$datadir"
-echo "                 datarootdir=$datarootdir"
-echo "                 exec_prefix=$exec_prefix"
-echo "                 includedir=$includedir"
-echo "                 libdir=$libdir"
-echo "                 mandir=$mandir"
-case $uname in
-  MINGW*)
-    echo "                 MSys docpath=$msyspath/local/share/doc/fltk"
-  ;;
-esac
-echo "       Graphics: $graphics"
-
-if test x$JPEG = x; then
-    echo "Image Libraries: JPEG=System"
-else
-    echo "Image Libraries: JPEG=Builtin"
-fi
-if test x$PNG = x; then
-    echo "                 PNG=System"
-else
-    echo "                 PNG=Builtin"
-fi
-if test x$ZLIB = x; then
-    echo "                 ZLIB=System"
-else
-    echo "                 ZLIB=Builtin"
-fi
-if test x$enable_cairo = xyes; then
-    echo "                 CAIRO=lib"
-fi
-if test x$enable_cairoext = xyes; then
-    echo "                 CAIRO=internal_use"
-fi
-
-
-if test x$enable_largefile != xno; then
-    echo "    Large Files: YES"
-else
-    echo "    Large Files: NO"
-fi
-
-if test x$GLDEMOS = x; then
-    echo "         OpenGL: NO"
-else
-    echo "         OpenGL: YES"
-fi
-
-if test x$THREADS = x; then
-    echo "        Threads: NO"
-else
-    echo "        Threads: YES"
-fi
-
-dnl Write all of the files...
-AC_CONFIG_HEADER(config.h:configh.in)
-AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)
-
-dnl Make sure the fltk-config script is executable...
-chmod +x fltk-config
-
-dnl
-dnl End of "$Id: configure.in 9328 2012-04-07 11:56:09Z AlbrechtS $".
-dnl
+dnl -*- sh -*-
+dnl the "configure" script is made from this by running GNU "autoconf"
+dnl
+dnl "$Id: configure.in 9990 2013-09-24 09:10:04Z ossman $"
+dnl
+dnl Configuration script for the Fast Light Tool Kit (FLTK).
+dnl
+dnl Copyright 1998-2013 by Bill Spitzak and others.
+dnl
+dnl This library is free software. Distribution and use rights are outlined in
+dnl the file "COPYING" which should have been included with this file.  If this
+dnl file is missing or damaged, see the license at:
+dnl
+dnl     http://www.fltk.org/COPYING.php
+dnl
+dnl Please report all bugs and problems on the following page:
+dnl
+dnl      http://www.fltk.org/str.php
+dnl
+
+dnl We need at least autoconf 2.50...
+AC_PREREQ(2.50)
+
+dnl Required file in package...
+AC_INIT(src/Fl.cxx)
+
+AC_CANONICAL_HOST
+
+dnl So --with-archflags option is used during "checking size of long"
+case $host_os in
+    darwin*)
+        if test "x$with_archflags" != x ; then
+            CFLAGS="$CFLAGS $with_archflags"
+        fi
+        USEMMFILES="Yes"
+        ;;
+    *)
+        USEMMFILES="No"
+        ;;
+esac
+AC_SUBST(USEMMFILES)
+
+dnl FLTK library versions...
+FL_MAJOR_VERSION=1
+FL_MINOR_VERSION=3
+FL_PATCH_VERSION=2
+FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
+
+AC_SUBST(FL_MAJOR_VERSION)
+AC_SUBST(FL_MINOR_VERSION)
+AC_SUBST(FL_PATCH_VERSION)
+AC_SUBST(FL_API_VERSION)
+
+dnl Do not automatically add "-g" to compiler options...
+ARCHFLAGS="${ARCHFLAGS:=}"
+CFLAGS="${CFLAGS:=}"
+CPPFLAGS="${CPPFLAGS:=}"
+CXXFLAGS="${CXXFLAGS:=}"
+DSOFLAGS="${DSOFLAGS:=}"
+LDFLAGS="${LDFLAGS:=}"
+OPTIM="${OPTIM:=}"
+
+AC_SUBST(ARCHFLAGS)
+AC_SUBST(OPTIM)
+
+dnl OS-specific pre-tests...
+dnl host_os_gui equals $host_os unless we target Cygwin in combination with X11.
+host_os_gui=$host_os
+case $host_os in
+    cygwin*)
+        # Handle Cygwin option *first*, before all other tests.
+	AC_ARG_ENABLE(cygwin, [  --enable-cygwin         use the Cygwin libraries [(default=no)]])
+	AC_ARG_ENABLE(x11,    [  --enable-x11            use Cygwin with X11 [(default=no)]])
+	if test x$enable_cygwin != xyes; then
+	    # NOTE: We can't use ARCHFLAGS for this, since it does not work
+	    #       with some of the function tests - Cygwin uses a
+	    #       different C library...
+	    CFLAGS="$CFLAGS -mno-cygwin"
+	    CPPFLAGS="$CPPFLAGS -mno-cygwin"
+	    CXXFLAGS="$CXXFLAGS -mno-cygwin"
+	    LDFLAGS="$LDFLAGS -mno-cygwin"
+	    DSOFLAGS="$DSOFLAGS -mno-cygwin"
+	else
+	    # we target Cygwin in combination with X11
+	    if test x$enable_x11 = xyes; then
+		host_os_gui="X11$host_os"
+	    fi
+	fi
+	;;
+esac
+
+dnl Define the libraries and link options we will need.
+LINKFLTK="../lib/libfltk.a"
+LINKFLTKFORMS="../lib/libfltk_forms.a"
+LINKFLTKGL="../lib/libfltk_gl.a"
+LINKFLTKIMG="../lib/libfltk_images.a"
+GLDEMOS="gldemos"
+
+LIBEXT=".a"
+LIBNAME="../lib/libfltk.a"
+FLLIBNAME="../lib/libfltk_forms.a"
+GLLIBNAME="../lib/libfltk_gl.a"
+IMGLIBNAME="../lib/libfltk_images.a"
+CAIROLIBNAME="../lib/libfltk_cairo.a"
+
+LIBBASENAME="libfltk.a"
+FLLIBBASENAME="libfltk_forms.a"
+GLLIBBASENAME="libfltk_gl.a"
+IMGLIBBASENAME="libfltk_images.a"
+CAIROLIBBASENAME="libfltk_cairo.a"
+
+dnl Check for Cairo library unless disabled...
+CAIRODIR=""
+CAIROFLAGS=""
+LINKFLTKCAIRO=""
+FLTKCAIROOPTION=""
+CAIROLIBS=""
+
+AC_ARG_ENABLE(cairoext,[  --enable-cairoext       use fltk code instrumentation for cairo extended use (default=no)])
+AC_ARG_ENABLE(cairo,[  --enable-cairo          use lib Cairo  (default=no)])
+
+if test x$enable_cairoext = xyes; then
+	  AC_DEFINE(FLTK_USE_CAIRO)
+	  AC_DEFINE(FLTK_HAVE_CAIRO)
+	  dnl FIXME This part should be fixed so configure do not depend on
+	  dnl we do not rely on pkg-config .
+	  CAIRODIR="cairo"
+          CAIROFLAGS="`pkg-config --cflags cairo`"
+          CAIROLIBS="-lcairo -lpixman-1"
+          CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
+	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
+	  FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
+	  LIBS="$CAIROLIBS $LIBS" 
+	  dnl $LINKFLTKCAIRO 
+	  LINKFLTK+=" $LINKFLTKCAIRO"
+else 
+    if test x$enable_cairo = xyes; then
+	  AC_DEFINE(FLTK_HAVE_CAIRO)
+	  dnl FIXME This part should be fixed so configure do not depend on
+	  dnl we do not rely on pkg-config .
+	  CAIRODIR="cairo"
+          CAIROFLAGS="`pkg-config --cflags cairo`"
+          CAIROLIBS="-lcairo -lpixman-1"
+          CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
+	  LINKFLTKCAIRO="../lib/libfltk_cairo.a"
+	  FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
+    fi
+fi
+
+AC_SUBST(CAIRODIR)
+AC_SUBST(CAIROFLAGS)
+AC_SUBST(CAIROLIBS)
+AC_SUBST(LINKFLTKCAIRO)
+AC_SUBST(FLTKCAIROOPTION)
+
+
+AC_SUBST(FLLIBNAME)
+AC_SUBST(GLDEMOS)
+AC_SUBST(GLLIBNAME)
+AC_SUBST(IMGLIBNAME)
+AC_SUBST(CAIROLIBNAME)
+AC_SUBST(LIBEXT)
+AC_SUBST(LIBNAME)
+AC_SUBST(LINKFLTK)
+AC_SUBST(LINKFLTKFORMS)
+AC_SUBST(LINKFLTKGL)
+AC_SUBST(LINKFLTKIMG)
+
+AC_SUBST(LIBBASENAME)
+AC_SUBST(FLLIBBASENAME)
+AC_SUBST(GLLIBBASENAME)
+AC_SUBST(IMGLIBBASENAME)
+AC_SUBST(CAIROLIBBASENAME)
+
+dnl Handle compile-time options...
+AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
+if test x$enable_debug = xyes; then
+    DEBUGFLAG="-g "
+else
+    DEBUGFLAG=""
+fi
+
+AC_ARG_ENABLE(cp936, [  --enable-cp936          turn on CP936 [default=no]])
+if test x$enable_cp936 = xyes; then
+    CFLAGS="$CFLAGS -DCP936"
+fi
+
+
+AC_ARG_ENABLE(gl, [  --enable-gl             turn on OpenGL support [default=yes]])
+
+AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries [default=no]])
+if test x$enable_shared = xyes; then
+    PICFLAG=1
+    SHAREDSUFFIX=""
+    FLUID="fluid-shared"
+
+    case $host_os in
+	darwin*)
+            DSONAME="libfltk.$FL_API_VERSION.dylib"
+            FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
+            GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
+            IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
+            CAIRODSONAME="libfltk_cairo.$FL_API_VERSION.dylib"
+	    DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
+	    ;;
+
+	solaris*)
+            DSONAME="libfltk.so.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
+	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
+	    if test "x$libdir" != "x/usr/lib"; then
+		    DSOLINK="-R$libdir"
+            fi
+	    ;;
+	hpux*)
+            DSONAME="libfltk.sl.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.sl.$FL_API_VERSION"
+	    DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
+	    if test "x$libdir" != "x/usr/lib"; then
+		    DSOLINK="-Wl,-rpath,$libdir"
+            fi
+	    ;;
+	irix*)
+            DSONAME="libfltk.so.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
+            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
+	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
+		    DSOLINK="-Wl,-rpath,$libdir"
+            fi
+	    ;;
+	osf*)
+            DSONAME="libfltk.so.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
+            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
+	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
+		    DSOLINK="-Wl,-rpath,$libdir"
+            fi
+	    ;;
+	linux* | *bsd*)
+            DSONAME="libfltk.so.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
+            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
+	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
+		    DSOLINK="-Wl,-rpath,$libdir"
+            fi
+	    ;;
+	aix*)
+            DSONAME="libfltk_s.a"
+            FLDSONAME="libfltk_forms_s.a"
+            GLDSONAME="libfltk_gl_s.a"
+            IMGDSONAME="libfltk_images_s.a"
+            CAIRODSONAME="libfltk_cairo_s.a"
+            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
+            SHAREDSUFFIX="_s"
+            ;;
+        cygwin* | mingw*)
+	    PICFLAG=0
+	    if test x$enable_cygwin != xyes; then
+		DSONAME="mgwfltknox-$FL_API_VERSION.dll"
+		FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
+		GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
+		IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
+		CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
+	    else
+		if test x$enable_x11 = xyes; then
+		    DSONAME="cygfltk-$FL_API_VERSION.dll"
+		    FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
+		    GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
+		    IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
+		    CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
+		else
+		    DSONAME="cygfltknox-$FL_API_VERSION.dll"
+		    FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
+		    GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
+		    IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
+		    CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
+		fi
+	    fi
+	    #-----------------------------------------------------------
+	    # -Wl,--enable-runtime-pseudo-reloc: See str 1585
+	    # appears to be necessary for older binutils versions < 2.16
+	    #-----------------------------------------------------------
+            LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
+	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
+	    	-Wl,--whole-archive -Wl,--export-all-symbols \
+		-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
+		-Wl,--enable-auto-image-base -o \$@"
+	    ;;
+	*)
+            AC_MSG_WARN(Shared libraries may not be supported.  Trying -shared option with compiler.)
+            DSONAME="libfltk.so.$FL_API_VERSION"
+            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
+            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
+            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
+            CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
+            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
+	    ;;
+    esac
+
+    LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
+else
+    DSOCOMMAND="echo"
+    DSOLINK=""
+    DSONAME=""
+    FLDSONAME=""
+    GLDSONAME=""
+    IMGDSONAME=""
+    CAIRODSONAME=""
+    PICFLAG=0
+    SHAREDSUFFIX=""
+    FLUID="fluid"
+    LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
+fi
+
+AC_SUBST(DSOCOMMAND)
+AC_SUBST(DSOFLAGS)
+AC_SUBST(DSOLINK)
+AC_SUBST(DSONAME)
+AC_SUBST(FLDSONAME)
+AC_SUBST(GLDSONAME)
+AC_SUBST(IMGDSONAME)
+AC_SUBST(CAIRODSONAME)
+AC_SUBST(SHAREDSUFFIX)
+AC_SUBST(LINKSHARED)
+AC_SUBST(FLUID)
+
+AC_ARG_ENABLE(threads, [  --enable-threads        enable multi-threading support (default=yes)])
+
+AC_ARG_WITH(optim, [  --with-optim="flags"    use custom optimization flags])
+
+AC_ARG_WITH(archflags, [  --with-archflags="flags"
+                          use custom architecture flags 
+			  (possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
+    ARCHFLAGS="$withval")
+case $host_os in
+    darwin*)
+# QD is not supported anymore since 1.3
+	AC_DEFINE(__APPLE_QUARTZ__)
+	;;
+esac
+
+dnl Find commands...
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_INSTALL
+case $host_os in
+    osf*)
+	INSTALL="`pwd`/install-sh -c"
+	;;
+esac
+if test "$INSTALL" = "$ac_install_sh"; then
+    # Use full path to install-sh script...
+    INSTALL="`pwd`/install-sh -c"
+fi
+AC_PATH_PROG(NROFF,nroff)
+if test "x$NROFF" = "x:"; then
+    # Try groff instead of nroff...
+    AC_PATH_PROG(GROFF,groff)
+    if test "x$GROFF" = "x:"; then
+        NROFF="echo"
+    else
+        NROFF="$GROFF -T ascii"
+    fi
+fi
+AC_PATH_PROG(HTMLDOC,htmldoc)
+AC_PATH_PROG(DOXYDOC,doxygen)
+
+dnl How do we make libraries?
+AC_PROG_RANLIB
+AC_PATH_TOOL(AR, ar)
+
+if test "x$AR" = "x:"; then
+    AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
+fi
+
+if test "x$RANLIB" != "x:"; then
+    LIBCOMMAND="$AR cr"
+else
+    LIBCOMMAND="$AR crs"
+fi
+
+AC_SUBST(LIBCOMMAND)
+
+dnl how to compile (Windows) resource files
+dnl this will only be used to compile resources for Windows .exe files
+AC_PATH_TOOL(RC,windres)
+
+dnl Architecture checks...
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+if test $ac_cv_sizeof_short -eq 2; then
+    AC_DEFINE(U16,unsigned short)
+fi
+if test $ac_cv_sizeof_int -eq 4; then
+    AC_DEFINE(U32,unsigned)
+else
+    if test $ac_cv_sizeof_long -eq 4; then
+        AC_DEFINE(U32,unsigned long)
+    fi
+fi
+case $host_os in
+    darwin*)
+        ;;
+    *)
+        AC_C_BIGENDIAN
+
+	if test $ac_cv_sizeof_int -eq 8; then
+		AC_DEFINE(U64,unsigned)
+	else
+		if test $ac_cv_sizeof_long -eq 8; then
+			AC_DEFINE(U64,unsigned long)
+		fi
+	fi
+        ;;
+esac
+
+dnl Does the C++ compiler support the bool type?
+AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
+    ac_cv_cxx_bool,[
+	AC_LANG_SAVE
+	AC_LANG_CPLUSPLUS
+	AC_TRY_COMPILE([
+	    int f(int  x){return 1;}
+	    int f(char x){return 1;}
+	    int f(bool x){return 1;}
+	],[
+	    bool b = true;
+	    return f(b);
+	], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
+	AC_LANG_RESTORE
+    ])
+
+if test "$ac_cv_cxx_bool" != yes; then
+    CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
+fi
+
+dnl Standard headers and functions...
+AC_HEADER_DIRENT
+AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
+AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
+
+dnl Do we have the POSIX compatible scandir() prototype?
+AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
+    ac_cv_cxx_scandir_posix,[
+	AC_LANG_SAVE
+	AC_LANG_CPLUSPLUS
+	AC_TRY_COMPILE([
+	  #include <dirent.h>
+	  int func (const char *d, dirent ***list, void *sort) {
+	    int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
+	  }
+	],[
+	], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
+	AC_LANG_RESTORE
+    ])
+
+dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
+dnl available. Otherwise: check, whether any scandir prototype is available,
+dnl but dont use it on SunOS and QNX because of an incompatibility in pre-Y2K
+dnl SunOS scandir versions. We assume, though, that the POSIX compatible
+dnl version on newer SunOS/Solaris versions works as expected.
+if test "$ac_cv_cxx_scandir_posix" = yes; then
+    AC_DEFINE(HAVE_SCANDIR)
+    AC_DEFINE(HAVE_SCANDIR_POSIX)
+else
+    AC_CHECK_FUNC(scandir,[
+        case $host_os in
+            solaris* | *qnx*)
+                AC_MSG_WARN(Not using $host_os scandir emulation function.)
+                ;;
+            *)
+                AC_DEFINE(HAVE_SCANDIR)
+                ;;
+        esac])
+fi
+
+AC_CHECK_FUNC(vsnprintf,[
+    case $host_os in
+        hpux1020)
+            AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
+            ;;
+        osf4)
+            AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
+            ;;
+        *)
+            AC_DEFINE(HAVE_VSNPRINTF)
+            ;;
+    esac])
+AC_CHECK_FUNC(snprintf,[
+    case $host_os in
+        hpux1020)
+            AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
+            ;;
+        osf4)
+            AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
+            ;;
+        *)
+            AC_DEFINE(HAVE_SNPRINTF)
+            ;;
+    esac])
+AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
+AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
+
+AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
+AC_CHECK_FUNCS(localeconv)
+
+dnl FLTK library uses math library functions...
+AC_SEARCH_LIBS(pow, m)
+
+dnl Check for largefile support...
+AC_SYS_LARGEFILE
+
+dnl Define largefile options as needed...
+LARGEFILE=""
+if test x$enable_largefile != xno; then
+	LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
+
+	if test x$ac_cv_sys_large_files = x1; then
+		LARGEFILE="$LARGEFILE -D_LARGE_FILES"
+	fi
+
+	if test x$ac_cv_sys_file_offset_bits = x64; then
+		LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
+	fi
+fi
+AC_SUBST(LARGEFILE)
+
+dnl Check for "long long" support...
+AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
+	[if test "$GCC" = yes; then
+		ac_cv_c_long_long=yes
+	else
+		AC_TRY_COMPILE(,[long long int i;],
+			ac_cv_c_long_long=yes,
+			ac_cv_c_long_long=no)
+	fi])
+
+if test $ac_cv_c_long_long = yes; then
+	AC_DEFINE(HAVE_LONG_LONG)
+fi
+
+dnl Check for dlopen/dlsym...
+AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
+AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
+
+dnl Check for audio libraries...
+AUDIOLIBS=""
+
+case $host_os in
+    cygwin* | mingw*)
+	dnl Cygwin environment...
+	AUDIOLIBS="-lwinmm"
+	;;
+
+    darwin*)
+	AUDIOLIBS="-framework CoreAudio"
+	;;
+
+    *)
+	AC_CHECK_HEADER(alsa/asoundlib.h,
+	    AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
+	    AUDIOLIBS="-lasound")
+        ;;
+esac
+
+AC_SUBST(AUDIOLIBS)
+
+dnl Check for image libraries...
+SAVELIBS="$LIBS"
+IMAGELIBS=""
+STATICIMAGELIBS=""
+
+AC_SUBST(IMAGELIBS)
+AC_SUBST(STATICIMAGELIBS)
+
+# Handle the JPEG lib linking mode (use fltk local or system lib)
+# If --enable-(resp. --disable-)localjpeg parameter is not set by user
+# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
+AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, default=auto])
+# Check for System lib use if automatic mode or --disable-localjpeg is requested
+sysjpeglib_ok=no
+sysjpeginc_ok=no
+if test x$enable_localjpeg != xyes; then
+    AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
+	[AC_CHECK_HEADER(jpeglib.h,
+	    sysjpeginc_ok=yes)
+	    if test x$sysjpeginc_ok = xyes; then
+		sysjpeglib_ok=yes
+		fi])
+fi
+# Now set the jpeg lib and include flags according to the requested mode and availability 
+if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
+    JPEGINC="-I../jpeg"
+    JPEG="jpeg"
+    IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
+    STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBJPEG)
+    #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localjpeg = xno; then
+	AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
+    fi
+else
+    JPEGINC=""
+    JPEG=""
+    IMAGELIBS="-ljpeg $IMAGELIBS"
+    STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBJPEG)
+fi
+
+# Handle the ZLIB lib linking mode (use fltk local or system lib)
+# If --enable-(resp. --disable-)localzlib parameter is not set by user
+# Then we check the ZLIB lib usability, with result in syszlib_ok variable
+AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, default=auto])
+# Check for System lib use if automatic mode or --disable-localzlib is requested
+syszlib_ok=no
+syszinc_ok=no
+if test x$enable_localzlib != xyes; then
+    AC_CHECK_LIB(z,gzgets,
+	[AC_CHECK_HEADER(zlib.h, 
+		syszinc_ok=yes)
+	if test x$syszinc_ok = xyes; then
+	    syszlib_ok=yes
+	    fi])
+fi
+# Now set the Z lib and include flags according to the requested mode and availability 
+if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
+    ZLIBINC="-I../zlib"
+    ZLIB="zlib"
+    LIBS="-lfltk_z $LIBS"
+    IMAGELIBS="-lfltk_z $IMAGELIBS"
+    STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBZ)
+    ac_cv_lib_z_gzgets=no # fc: is still necessary ?
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localzlib = xno; then
+	AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
+    fi
+else
+    ZLIBINC=""
+    ZLIB=""
+    LIBS="-lz $LIBS"
+    IMAGELIBS="-lz $IMAGELIBS"
+    STATICIMAGELIBS="-lz $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBZ)
+fi
+
+# Handle the PNG lib linking mode (use fltk local or system lib)
+# If --enable-(resp. --disable-)localpng parameter is not set by user
+# Then we check the png lib usability with result in syspng_lib variable
+AC_ARG_ENABLE(localpng, [  --enable-localpng       use local PNG library, default=auto])
+
+# Now check if system lib is usable, we check Lib AND include availability with inc variant,
+# but only, if the builtin lib is not requested
+syspnglib_ok=no
+syspnginc_ok=no
+if test x$enable_localpng != xyes; then
+  AC_CHECK_LIB(png, png_read_info, 
+    [AC_CHECK_HEADER(png.h, 
+	AC_DEFINE(HAVE_PNG_H)
+	syspnginc_ok=yes)
+    AC_CHECK_HEADER(libpng/png.h, 
+	AC_DEFINE(HAVE_LIBPNG_PNG_H)
+	syspnginc_ok=yes)
+    if test x$syspnginc_ok = xyes; then
+	syspnglib_ok=yes
+    fi])
+fi
+
+# The following is executed if the lib was not found usable or if local lib is required explicitly
+if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
+    PNGINC="-I../png"
+    PNG="png"
+    IMAGELIBS="-lfltk_png $IMAGELIBS"
+    STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBPNG)
+    AC_DEFINE(HAVE_PNG_H)
+    AC_DEFINE(HAVE_PNG_GET_VALID)
+    AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
+    # Finally, warn user if system lib was requested but not found
+    if test x$enable_localpng = xno; then
+	AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
+    fi
+else
+    PNGINC=""
+    PNG=""
+    IMAGELIBS="-lpng $IMAGELIBS"
+    STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
+    AC_DEFINE(HAVE_LIBPNG)
+    AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
+    AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
+fi
+
+AC_SUBST(JPEG)
+AC_SUBST(JPEGINC)
+AC_SUBST(PNG)
+AC_SUBST(PNGINC)
+AC_SUBST(ZLIB)
+AC_SUBST(ZLIBINC)
+
+dnl Restore original LIBS settings...
+LIBS="$SAVELIBS"
+
+dnl See if we need a .exe extension on executables...
+AC_EXEEXT
+
+dnl Check for pthreads for multi-threaded apps...
+have_pthread=no
+PTHREAD_FLAGS=""
+
+dnl Test whether we want to check for pthreads. We must not do it on Windows
+dnl unless we run under Cygwin with --enable-cygwin, since we always use
+dnl native threads on Windows (even if libpthread is available)
+check_pthread=yes
+case $host_os in
+    mingw*)
+	check_pthread=no
+	;;
+    cygwin*)
+	if test "x$enable_cygwin" != xyes; then
+	    check_pthread=no
+	fi
+	;;
+    *)
+	;;
+esac
+
+if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
+    AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
+
+    if test x$ac_cv_header_pthread_h = xyes; then
+	dnl Check various threading options for the platforms we support
+	for flag in -lpthreads -lpthread -pthread; do
+            AC_MSG_CHECKING([for pthread_create using $flag])
+	    SAVELIBS="$LIBS"
+	    LIBS="$flag $LIBS"
+            AC_TRY_LINK([#include <pthread.h>],
+		[pthread_create(0, 0, 0, 0);],
+        	have_pthread=yes,
+		LIBS="$SAVELIBS")
+            AC_MSG_RESULT([$have_pthread])
+
+	    if test $have_pthread = yes; then
+	        AC_DEFINE(HAVE_PTHREAD)
+		PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
+
+		# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
+		# be POSIX-compliant... :(
+		case $host_os in
+		    solaris*)
+		        PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
+		        ;;
+		esac
+		break
+	    fi
+	done
+    fi
+fi
+
+AC_SUBST(PTHREAD_FLAGS)
+
+dnl Define OS-specific stuff...
+HLINKS=
+OSX_ONLY=:
+THREADS=
+
+AC_ARG_WITH(links, [  --with-links            make header links for common misspellings (default=no)])
+
+INSTALL_DESKTOP=""
+UNINSTALL_DESKTOP=""
+
+case $host_os_gui in
+    cygwin* | mingw*)
+	dnl Cygwin environment, using windows GDI ...
+	# Recent versions of Cygwin are seriously broken and the size
+	# checks don't work because the shell puts out \r\n instead of
+	# \n.  Here we just force U32 to be defined to "unsigned"...
+        AC_DEFINE(U32,unsigned)
+	CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
+	CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
+	LDFLAGS="-mwindows $LDFLAGS"
+	DSOFLAGS="-mwindows $DSOFLAGS"
+	LIBS="$LIBS -lole32 -luuid -lcomctl32"
+	if test "x$with_optim" = x; then
+	    dnl Avoid -Os optimization on Cygwin/MinGW
+	    with_optim="-O3"
+	fi
+
+	if test x$enable_gl != xno; then
+	    AC_CHECK_HEADER(GL/gl.h,
+	        AC_DEFINE(HAVE_GL)
+		GLLIB="-lopengl32")
+	    AC_CHECK_HEADER(GL/glu.h,
+        	AC_DEFINE(HAVE_GL_GLU_H)
+		GLLIB="-lglu32 $GLLIB")
+	else
+	    LINKFLTKGL=""
+	    GLLIBNAME=""
+	    GLDSONAME=""
+	    GLDEMOS=""
+	fi
+
+	if test "x$enable_threads" != xno; then
+	    if test x$have_pthread = xyes; then
+		AC_DEFINE(HAVE_PTHREAD)
+	    fi
+        fi
+
+	THREADS="threads$EXEEXT"
+
+	# Don't make symlinks since Windows is not case sensitive.
+	if test "x$with_links" != xyes; then
+		HLINKS="#"
+	fi
+	;;
+
+    darwin*)
+        # MacOS X uses Cocoa for graphics.
+        LIBS="$LIBS -framework Cocoa"
+
+	if test x$have_pthread = xyes; then
+	    AC_DEFINE(HAVE_PTHREAD)
+	    THREADS="threads$EXEEXT"
+	fi
+
+	if test x$enable_gl != xno; then
+            AC_DEFINE(HAVE_GL)
+            AC_DEFINE(HAVE_GL_GLU_H)
+            GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
+        else
+	    LINKFLTKGL=""
+	    GLLIBNAME=""
+	    GLDSONAME=""
+	    GLDEMOS=""
+        fi
+
+	# Don't make symlinks because HFS+ is not case sensitive...
+	if test "x$with_links" != xyes; then
+		HLINKS="#"
+	fi
+
+	# Some steps are only done for OS X package management
+	OSX_ONLY=
+
+	# Install/Uninstall FLUID application
+	INSTALL_DESKTOP="install-osx"
+	UNINSTALL_DESKTOP="uninstall-osx"
+	;;
+
+    *)
+	# All others are UNIX/X11...
+	# This includes Cygwin target combined with X11
+	if test x$have_pthread = xyes; then
+	    AC_DEFINE(HAVE_PTHREAD)
+	    THREADS="threads$EXEEXT"
+	fi
+
+	dnl Check for X11...
+	AC_PATH_XTRA
+
+	if test x$no_x = xyes; then
+	    AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
+	fi
+
+	if test "x$X_PRE_LIBS" != x; then
+	    AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
+	fi
+
+	LIBS="$LIBS -lX11 $X_EXTRA_LIBS"
+	CFLAGS="$CFLAGS $X_CFLAGS"
+	CXXFLAGS="$CXXFLAGS $X_CFLAGS"
+	LDFLAGS="$X_LIBS $LDFLAGS"
+	DSOFLAGS="$X_LIBS $DSOFLAGS"
+	AC_DEFINE(USE_X11)
+	if test "x$x_includes" != x; then
+	    ac_cpp="$ac_cpp -I$x_includes"
+	fi
+
+	dnl Check for OpenGL unless disabled...
+	GLLIB=
+
+	if test x$enable_gl != xno; then
+	    AC_SEARCH_LIBS(dlopen, dl)
+	    AC_CHECK_HEADER(GL/gl.h,
+		AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL",
+		    AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,
+			-lm),
+		    -lm)
+		AC_CHECK_LIB(GL, glXGetProcAddressARB,
+		             AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
+	    )
+	    AC_CHECK_HEADER(GL/glu.h,
+        	AC_DEFINE(HAVE_GL_GLU_H)
+		if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
+		    GLLIB="-lGLU $GLLIB"
+		fi
+		if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
+		    GLLIB="-lMesaGLU $GLLIB"
+		fi
+	    )
+
+	    if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
+		    LINKFLTKGL=""
+		    GLLIBNAME=""
+		    GLDSONAME=""
+		    GLDEMOS=""
+	    fi
+	else
+	    LINKFLTKGL=""
+	    GLLIBNAME=""
+	    GLDSONAME=""
+	    GLDEMOS=""
+	fi
+
+	dnl Check for Xinerama support unless disabled...
+        AC_ARG_ENABLE(xinerama, [  --enable-xinerama       turn on Xinerama support [default=yes]])
+
+	if test x$enable_xinerama != xno; then
+	    AC_CHECK_LIB(Xinerama,XineramaIsActive,
+		    AC_DEFINE(HAVE_XINERAMA)
+		    LIBS="-lXinerama $LIBS")
+	fi
+
+	dnl Check for the Xft library unless disabled...
+        AC_ARG_ENABLE(xft, [  --enable-xft            turn on Xft support [default=yes]])
+
+	if test x$enable_xft != xno; then
+            AC_PATH_PROG(FTCONFIG,freetype-config)
+
+	    if test "x$FTCONFIG" != x; then
+	        CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
+	        CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
+
+	        AC_CHECK_LIB(fontconfig, FcPatternCreate)
+		AC_CHECK_HEADER(X11/Xft/Xft.h,
+		    AC_CHECK_LIB(Xft, XftDrawCreate,
+			AC_DEFINE(USE_XFT)
+			LIBS="-lXft $LIBS"))
+	    fi
+	fi
+
+	dnl Check for the Xdbe extension unless disabled...
+        AC_ARG_ENABLE(xdbe, [  --enable-xdbe           turn on Xdbe support [default=yes]])
+
+	if test x$enable_xdbe != xno; then
+	    AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
+	        [#include <X11/Xlib.h>])
+	    AC_CHECK_LIB(Xext, XdbeQueryExtension,
+		LIBS="-lXext $LIBS")
+	fi
+
+	dnl Check for the Xfixes extension unless disabled...
+        AC_ARG_ENABLE(xfixes, [  --enable-xfixes       turn on Xfixes support [default=yes]])
+
+	if test x$enable_xfixes != xno; then
+	    AC_CHECK_HEADER(X11/extensions/Xfixes.h, AC_DEFINE(HAVE_XFIXES),,
+	        [#include <X11/Xlib.h>])
+	    AC_CHECK_LIB(Xfixes, XFixesQueryExtension,
+		LIBS="-lXfixes $LIBS")
+	fi
+
+	dnl Check for overlay visuals...
+	AC_PATH_PROG(XPROP, xprop)
+	AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
+	    if test "x$XPROP" != x; then
+		if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
+        	    ac_cv_have_overlay=yes
+		else
+        	    ac_cv_have_overlay=no
+		fi
+	    else
+        	ac_cv_have_overlay=no
+	    fi)
+
+        if test x$ac_cv_have_overlay = xyes; then
+	    AC_DEFINE(HAVE_OVERLAY)
+	fi
+
+	# Make symlinks since UNIX/Linux is case sensitive,
+	# but Cygwin in general not.
+	case $host_os in
+	    cygwin*)
+		HLINKS="#"
+	    ;;
+	    *)
+	    ;;
+	esac
+	# Make symlinks since UNIX/Linux is case sensitive,
+	# but only if explicitly configured (default=no)
+	if test "x$with_links" != xyes; then
+		HLINKS="#"
+	fi
+
+	# Install/Uninstall FLUID application support files
+	INSTALL_DESKTOP="install-linux"
+	UNINSTALL_DESKTOP="uninstall-linux"
+	;;
+esac
+
+AC_SUBST(GLDEMOS)
+AC_SUBST(GLLIB)
+AC_SUBST(HLINKS)
+AC_SUBST(OSX_ONLY)
+AC_SUBST(THREADS)
+
+AC_SUBST(INSTALL_DESKTOP)
+AC_SUBST(UNINSTALL_DESKTOP)
+
+dnl Figure out the appropriate formatted man page extension...
+case "$host_os" in
+    *bsd* | darwin*)
+	# *BSD
+	CAT1EXT=0
+	CAT3EXT=0
+	CAT6EXT=0
+	;;
+    irix*)
+	# SGI IRIX
+	CAT1EXT=z
+	CAT3EXT=z
+	CAT6EXT=z
+	;;
+    *)
+	# All others
+	CAT1EXT=1
+	CAT3EXT=3
+	CAT6EXT=6
+	;;
+esac
+
+AC_SUBST(CAT1EXT)
+AC_SUBST(CAT3EXT)
+AC_SUBST(CAT6EXT)
+
+dnl Fix "mandir" variable...
+if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
+    case "$host_os" in
+        *bsd* | darwin* | linux*)
+            # *BSD, Darwin, and Linux
+            mandir="\${prefix}/share/man"
+            ;;
+        irix*)
+            # SGI IRIX
+            mandir="\${prefix}/share/catman"
+            ;;
+    esac
+fi
+
+dnl Fix "libdir" variable...
+if test "$prefix" = NONE; then
+    prefix=/usr/local
+fi
+
+if test "$exec_prefix" = NONE; then
+    exec_prefix="\${prefix}"
+fi
+
+case $host_os in
+    irix[1-5]*)
+        ;;
+    irix*)
+        if test "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
+            libdir="/usr/lib32"
+        fi
+        ;;
+esac
+
+dnl Define the command used to update the dependencies (this option
+dnl mainly for FLTK core developers - not necessary for users)
+MAKEDEPEND="\$(CXX) -M"
+AC_SUBST(MAKEDEPEND)
+
+dnl Add warnings to compiler switches:
+dnl do this last so messing with switches does not break tests
+
+if test -n "$GCC"; then
+    # Show all standard warnings + unused variables, conversion errors,
+    # and inlining problems when compiling...
+    OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"
+
+    # The following additional warnings are useful for tracking down problems...
+    #OPTIM="-Wshadow -Wconversion $OPTIM"
+
+    # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
+    # we will temporarily disable 'deprecated' warnings on OS X.
+    case $host_os in
+        darwin[1-7])
+            ;;
+        darwin*)
+            OPTIM="-Wno-deprecated-declarations $OPTIM"
+            ;;
+    esac
+
+    # Set the default compiler optimizations...
+    if test -z "$DEBUGFLAG"; then
+    	#
+	# Note: Can't use -fomit-frame-pointer - prevents tools like
+	#       libsafe from working!
+        #
+	#       Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
+	#       They all seem to make either no difference or enlarge
+	#       the code by a few hundred bytes.
+        #
+	#       "-Os" seems to be the best compromise between speed and
+	#       code size.  "-O3" and higher seem to make no effective
+	#       difference in the speed of the code, but does bloat the
+	#       library 10+%.
+	#
+
+        if test "x$with_optim" != x; then
+	    OPTIM="$with_optim $OPTIM"
+	else
+            OPTIM="-Os $OPTIM"
+	fi
+    fi
+
+    # Generate position-independent code when needed...
+    if test $PICFLAG = 1; then
+    	OPTIM="$OPTIM -fPIC"
+    fi
+
+    # See if GCC supports -fno-exceptions...
+    AC_MSG_CHECKING(if GCC supports -fno-exceptions)
+    OLDCFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -fno-exceptions"
+    AC_TRY_COMPILE(,,
+	OPTIM="$OPTIM -fno-exceptions"
+	AC_MSG_RESULT(yes),
+	AC_MSG_RESULT(no))
+    CFLAGS="$OLDCFLAGS"
+
+    # See if GCC supports -fno-strict-aliasing...
+    AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
+    OLDCFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS -fno-strict-aliasing"
+    AC_TRY_COMPILE(,,
+	OPTIM="$OPTIM -fno-strict-aliasing"
+	AC_MSG_RESULT(yes),
+	AC_MSG_RESULT(no))
+    CFLAGS="$OLDCFLAGS"
+
+    # See if we are running Solaris; if so, try the -fpermissive option...
+    # This option is required on some versions of Solaris to work around
+    # bugs in the X headers up through Solaris 7.
+    #
+    # Unlike the other compiler/optimization settings, this one is placed
+    # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
+    # to clients - otherwise client apps will not compile properly...
+    case $host_os in
+        solaris*)
+	    AC_MSG_CHECKING(if GCC supports -fpermissive)
+
+	    OLDCFLAGS="$CFLAGS"
+	    CFLAGS="$CFLAGS -fpermissive"
+	    AC_TRY_COMPILE(,,
+	        CXXFLAGS="$CXXFLAGS -fpermissive"
+	        AC_MSG_RESULT(yes),
+	        CFLAGS="$OLDCFLAGS"
+	        AC_MSG_RESULT(no))
+	    ;;
+    esac
+else
+    case "$host_os" in
+        irix*)
+	    # Running some flavor of IRIX; see which version and
+	    # set things up according...
+	    if test "$uversion" -ge 62; then
+	        # We are running IRIX 6.2 or higher; uncomment the following
+		# lines if you don't have IDO 7.2 or higher:
+		#
+		#     CXX="CC -n32 -mips3"
+		#     CC="cc -n32 -mips3"
+		#     LD="ld -n32 -mips3"
+		#     MAKEDEPEND="CC -M"
+
+		if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
+			AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
+		fi
+
+        	OPTIM="-fullwarn $OPTIM"
+	    fi
+	    if test -z "$DEBUGFLAG"; then
+        	if test "x$with_optim" != x; then
+		    OPTIM="$with_optim $OPTIM"
+		else
+        	    OPTIM="-O2 $OPTIM"
+		    if test $uversion -gt 62; then
+        	        OPTIM="-OPT:Olimit=4000 $OPTIM"
+	            fi
+		fi
+	    fi
+	    ;;
+	hpux*)
+	    # Running HP-UX; these options should work for the HP compilers.
+	    if test -z "$DEBUGFLAG"; then
+        	if test "x$with_optim" != x; then
+		    OPTIM="$with_optim $OPTIM"
+		else
+        	    OPTIM="+O2 $OPTIM"
+		fi
+	    fi
+
+	    if test $PICFLAG = 1; then
+		OPTIM="+z $OPTIM"
+	    fi
+
+	    CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
+	    ;;
+	OSF1*)
+	    # Running Digital/Tru64 UNIX; these options should work for the
+	    # Digital/Compaq/NewHP compilers.
+	    if test -z "$DEBUGFLAG"; then
+        	if test "x$with_optim" != x; then
+		    OPTIM="$with_optim $OPTIM"
+		else
+        	    OPTIM="-O2 $OPTIM"
+		fi
+	    fi
+	    ;;
+	solaris*)
+	    # Solaris
+	    if test -z "$DEBUGFLAG"; then
+        	if test "x$with_optim" != x; then
+		    OPTIM="$with_optim $OPTIM"
+		else
+        	    OPTIM="-xO3 $OPTIM"
+		fi
+	    fi
+
+	    if test $PICFLAG = 1; then
+		OPTIM="-KPIC $OPTIM"
+	    fi
+	    ;;
+	aix*)
+	    if test -z "$DEBUGFLAG"; then
+        	if test "x$with_optim" != x; then
+		    OPTIM="$with_optim $OPTIM"
+		else
+        	    OPTIM="-O2 $OPTIM"
+		fi
+	    fi
+
+	    AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
+	    ;;
+	*)
+	    # Running some other operating system; inform the user they
+	    # should contribute the necessary options via the STR form..
+	    AC_MSG_WARN(Building FLTK with default compiler optimizations)
+	    AC_MSG_WARN(Send the FLTK developers your uname and compiler options via http://www.fltk.org/str.php)
+	    ;;
+    esac
+fi
+
+OPTIM="$DEBUGFLAG $OPTIM"
+
+dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
+case $host_os in
+    darwin*)
+        if test "x$with_archflags" != x ; then
+            CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
+        fi
+        ;;
+esac
+
+dnl Define the FLTK documentation directory...
+case $host_os in
+  mingw*)
+     # Determine the path where MSys has /usr installed
+ 	msyspath=`mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
+     # Then substitute that in the WIN32 path instead of /usr
+ 	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/fltk")
+    ;;
+  *)
+    if test x$prefix = xNONE; then
+	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
+    else
+	AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
+    fi
+    ;;
+esac
+
+dnl Define the FLTK data directory...
+if test x$prefix = xNONE; then
+    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
+else
+    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
+fi
+
+dnl Summarize results of configure tests...
+echo ""
+echo "Configuration Summary"
+echo "-------------------------------------------------------------------------"
+
+case $host_os_gui in
+    cygwin* | mingw*)
+        graphics="GDI"
+	;;
+    darwin*)
+        graphics="Quartz"
+        ;;
+    *)
+        graphics="X11"
+	if test x$enable_xft != xno; then
+	    graphics="$graphics+Xft"
+	fi
+	if test x$enable_xdbe != xno; then
+	    graphics="$graphics+Xdbe"
+	fi
+	if test x$enable_xinerama != xno; then
+	    graphics="$graphics+Xinerama"
+	fi
+        ;;
+esac
+
+echo "    Directories: prefix=$prefix"
+echo "                 bindir=$bindir"
+echo "                 datadir=$datadir"
+echo "                 datarootdir=$datarootdir"
+echo "                 exec_prefix=$exec_prefix"
+echo "                 includedir=$includedir"
+echo "                 libdir=$libdir"
+echo "                 mandir=$mandir"
+case $host_os in
+  mingw*)
+    echo "                 MSys docpath=$msyspath/local/share/doc/fltk"
+  ;;
+esac
+echo "       Graphics: $graphics"
+
+if test x$JPEG = x; then
+    echo "Image Libraries: JPEG=System"
+else
+    echo "Image Libraries: JPEG=Builtin"
+fi
+if test x$PNG = x; then
+    echo "                 PNG=System"
+else
+    echo "                 PNG=Builtin"
+fi
+if test x$ZLIB = x; then
+    echo "                 ZLIB=System"
+else
+    echo "                 ZLIB=Builtin"
+fi
+if test x$enable_cairo = xyes; then
+    echo "                 CAIRO=lib"
+fi
+if test x$enable_cairoext = xyes; then
+    echo "                 CAIRO=internal_use"
+fi
+
+
+if test x$enable_largefile != xno; then
+    echo "    Large Files: YES"
+else
+    echo "    Large Files: NO"
+fi
+
+if test x$GLDEMOS = x; then
+    echo "         OpenGL: NO"
+else
+    echo "         OpenGL: YES"
+fi
+
+if test x$THREADS = x; then
+    echo "        Threads: NO"
+else
+    echo "        Threads: YES"
+fi
+
+dnl Write all of the files...
+AC_CONFIG_HEADER(config.h:configh.in)
+AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)
+
+dnl Make sure the fltk-config script is executable...
+chmod +x fltk-config
+
+dnl
+dnl End of "$Id: configure.in 9990 2013-09-24 09:10:04Z ossman $".
+dnl

+ 6 - 4
fltk/fltk-config

@@ -1,6 +1,6 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
-# "$Id: fltk-config.in 8864 2011-07-19 04:49:30Z greg.ercolano $"
+# "$Id: fltk-config.in 9861 2013-04-05 15:28:43Z manolo $"
 #
 #
 # FLTK configuration utility.
 # FLTK configuration utility.
 #
 #
@@ -21,7 +21,7 @@
 
 
 MAJOR_VERSION=1
 MAJOR_VERSION=1
 MINOR_VERSION=3
 MINOR_VERSION=3
-PATCH_VERSION=0
+PATCH_VERSION=2
 VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
 VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
 APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
 APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
 
 
@@ -45,7 +45,7 @@ ARCHFLAGS=""
 CFLAGS="  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
 CFLAGS="  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
 CXXFLAGS="-I/usr/include/freetype2   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
 CXXFLAGS="-I/usr/include/freetype2   -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_THREAD_SAFE -D_REENTRANT"
 LDFLAGS=" "
 LDFLAGS=" "
-LDLIBS="-lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 "
+LDLIBS="-lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 "
 OPTIM=" -Os -Wall -Wunused -Wno-format-y2k  -fno-exceptions -fno-strict-aliasing"
 OPTIM=" -Os -Wall -Wunused -Wno-format-y2k  -fno-exceptions -fno-strict-aliasing"
 CAIROFLAGS=""
 CAIROFLAGS=""
 
 
@@ -317,6 +317,8 @@ if test -n "$post"; then
 	<string>$post</string>
 	<string>$post</string>
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
+	<key>NSHighResolutionCapable</key>
+	<true/>
     </dict>
     </dict>
 </plist>
 </plist>
 EOF
 EOF
@@ -393,5 +395,5 @@ if test "$echo_includedir" = "yes"; then
 fi
 fi
 
 
 #
 #
-# End of "$Id: fltk-config.in 8864 2011-07-19 04:49:30Z greg.ercolano $".
+# End of "$Id: fltk-config.in 9861 2013-04-05 15:28:43Z manolo $".
 #
 #

+ 2 - 0
fltk/fltk-config.cmake.in

@@ -317,6 +317,8 @@ if test -n "$post"; then
 	<string>$post</string>
 	<string>$post</string>
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
+	<key>NSHighResolutionCapable</key>
+	<true/>
     </dict>
     </dict>
 </plist>
 </plist>
 EOF
 EOF

+ 4 - 2
fltk/fltk-config.in

@@ -1,6 +1,6 @@
 #!/bin/sh
 #!/bin/sh
 #
 #
-# "$Id: fltk-config.in 8864 2011-07-19 04:49:30Z greg.ercolano $"
+# "$Id: fltk-config.in 9861 2013-04-05 15:28:43Z manolo $"
 #
 #
 # FLTK configuration utility.
 # FLTK configuration utility.
 #
 #
@@ -317,6 +317,8 @@ if test -n "$post"; then
 	<string>$post</string>
 	<string>$post</string>
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
+	<key>NSHighResolutionCapable</key>
+	<true/>
     </dict>
     </dict>
 </plist>
 </plist>
 EOF
 EOF
@@ -393,5 +395,5 @@ if test "$echo_includedir" = "yes"; then
 fi
 fi
 
 
 #
 #
-# End of "$Id: fltk-config.in 8864 2011-07-19 04:49:30Z greg.ercolano $".
+# End of "$Id: fltk-config.in 9861 2013-04-05 15:28:43Z manolo $".
 #
 #

+ 3 - 3
fltk/fltk.list

@@ -23,7 +23,7 @@
 %vendor FLTK Development Team
 %vendor FLTK Development Team
 %license COPYING
 %license COPYING
 %readme README
 %readme README
-%version 1.3.0
+%version 1.3.2
 %description The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a
 %description The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a
 %description cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11),
 %description cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11),
 %description Microsoft(r) Windows(r), and MacOS(r) X.  FLTK provides modern
 %description Microsoft(r) Windows(r), and MacOS(r) X.  FLTK provides modern
@@ -50,8 +50,8 @@ $FLLIBNAME=../lib/libfltk_forms.a
 $GLDSONAME=
 $GLDSONAME=
 $GLLIBNAME=../lib/libfltk_gl.a
 $GLLIBNAME=../lib/libfltk_gl.a
 $FLUID=fluid
 $FLUID=fluid
-$JPEG=jpeg
-$PNG=png
+$JPEG=jpeg
+$PNG=
 $ZLIB=
 $ZLIB=
 
 
 %if DSONAME
 %if DSONAME

+ 1 - 1
fltk/fltk.spec

@@ -16,7 +16,7 @@
 #      http://www.fltk.org/str.php
 #      http://www.fltk.org/str.php
 #
 #
 
 
-%define version 1.3.0
+%define version 1.3.2
 %define release 1
 %define release 1
 %define prefix /usr
 %define prefix /usr
 
 

+ 3 - 3
fltk/fluid/CodeEditor.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: CodeEditor.cxx 9341 2012-04-13 14:45:18Z ianmacarthur $"
+// "$Id: CodeEditor.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $"
 //
 //
 // Code editor widget for the Fast Light Tool Kit (FLTK).
 // Code editor widget for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -128,7 +128,7 @@ void CodeEditor::textsize(Fl_Fontsize s) {
 // 'compare_keywords()' - Compare two keywords...
 // 'compare_keywords()' - Compare two keywords...
 int CodeEditor::compare_keywords(const void *a, const void *b) {
 int CodeEditor::compare_keywords(const void *a, const void *b) {
   return (strcmp(*((const char **)a), *((const char **)b)));
   return (strcmp(*((const char **)a), *((const char **)b)));
-}
+}
 
 
 // 'style_parse()' - Parse text and produce style data.
 // 'style_parse()' - Parse text and produce style data.
 void CodeEditor::style_parse(const char *text, char *style, int length) {
 void CodeEditor::style_parse(const char *text, char *style, int length) {
@@ -427,5 +427,5 @@ void CodeEditor::change_text_size(int fsize){
   redraw();
   redraw();
 }
 }
 //
 //
-// End of "$Id: CodeEditor.cxx 9341 2012-04-13 14:45:18Z ianmacarthur $".
+// End of "$Id: CodeEditor.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $".
 //
 //

+ 2 - 2
fltk/fluid/CodeEditor.h

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: CodeEditor.h 9341 2012-04-13 14:45:18Z ianmacarthur $"
+// "$Id: CodeEditor.h 9980 2013-09-21 16:41:23Z greg.ercolano $"
 //
 //
 // Code editor widget for the Fast Light Tool Kit (FLTK).
 // Code editor widget for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -80,5 +80,5 @@ class CodeViewer : public CodeEditor {
 #endif // !CodeEditor_h
 #endif // !CodeEditor_h
 
 
 //
 //
-// End of "$Id: CodeEditor.h 9341 2012-04-13 14:45:18Z ianmacarthur $".
+// End of "$Id: CodeEditor.h 9980 2013-09-21 16:41:23Z greg.ercolano $".
 //
 //

+ 2 - 2
fltk/fluid/Fl_Type.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Type.cxx 9635 2012-07-14 18:31:43Z AlbrechtS $"
+// "$Id: Fl_Type.cxx 9992 2013-09-24 19:58:24Z greg.ercolano $"
 //
 //
 // Widget type code for the Fast Light Tool Kit (FLTK).
 // Widget type code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -1061,5 +1061,5 @@ int Fl_Type::user_defined(const char* cbname) const {
 
 
 
 
 //
 //
-// End of "$Id: Fl_Type.cxx 9635 2012-07-14 18:31:43Z AlbrechtS $".
+// End of "$Id: Fl_Type.cxx 9992 2013-09-24 19:58:24Z greg.ercolano $".
 //
 //

+ 2 - 2
fltk/fluid/Fl_Type.h

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Type.h 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Type.h 10093 2014-02-04 00:34:41Z AlbrechtS $"
 //
 //
 // Widget type header file for the Fast Light Tool Kit (FLTK).
 // Widget type header file for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -936,5 +936,5 @@ public:
 
 
 
 
 //
 //
-// End of "$Id: Fl_Type.h 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Type.h 10093 2014-02-04 00:34:41Z AlbrechtS $".
 //
 //

+ 10 - 2
fltk/fluid/Fl_Widget_Type.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Widget_Type.cxx 9082 2011-09-28 20:43:05Z matt $"
+// "$Id: Fl_Widget_Type.cxx 10113 2014-02-25 04:24:41Z greg.ercolano $"
 //
 //
 // Widget type code for the Fast Light Tool Kit (FLTK).
 // Widget type code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -814,6 +814,12 @@ Fl_Menu_Item boxmenu[] = {
 {"GTK_THIN_DOWN_BOX",0,0,(void *)FL_GTK_THIN_DOWN_BOX},
 {"GTK_THIN_DOWN_BOX",0,0,(void *)FL_GTK_THIN_DOWN_BOX},
 {"GTK_ROUND_UP_BOX",0,0,(void *)FL_GTK_ROUND_UP_BOX},
 {"GTK_ROUND_UP_BOX",0,0,(void *)FL_GTK_ROUND_UP_BOX},
 {"GTK_ROUND_DOWN_BOX",0,0,(void *)FL_GTK_ROUND_DOWN_BOX},
 {"GTK_ROUND_DOWN_BOX",0,0,(void *)FL_GTK_ROUND_DOWN_BOX},
+{"GLEAM_UP_BOX",0,0,(void *)FL_GLEAM_UP_BOX},
+{"GLEAM_DOWN_BOX",0,0,(void *)FL_GLEAM_DOWN_BOX},
+{"GLEAM_THIN_UP_BOX",0,0,(void *)FL_GLEAM_THIN_UP_BOX},
+{"GLEAM_THIN_DOWN_BOX",0,0,(void *)FL_GLEAM_THIN_DOWN_BOX},
+{"GLEAM_ROUND_UP_BOX",0,0,(void *)FL_GLEAM_ROUND_UP_BOX},
+{"GLEAM_ROUND_DOWN_BOX",0,0,(void *)FL_GLEAM_ROUND_DOWN_BOX},
 {0},
 {0},
 {"frames",0,0,0,FL_SUBMENU},
 {"frames",0,0,0,FL_SUBMENU},
 {"UP_FRAME",0,0,(void *)FL_UP_FRAME},
 {"UP_FRAME",0,0,(void *)FL_UP_FRAME},
@@ -832,6 +838,8 @@ Fl_Menu_Item boxmenu[] = {
 {"GTK_DOWN_FRAME",0,0,(void *)FL_GTK_DOWN_FRAME},
 {"GTK_DOWN_FRAME",0,0,(void *)FL_GTK_DOWN_FRAME},
 {"GTK_THIN_UP_FRAME",0,0,(void *)FL_GTK_THIN_UP_FRAME},
 {"GTK_THIN_UP_FRAME",0,0,(void *)FL_GTK_THIN_UP_FRAME},
 {"GTK_THIN_DOWN_FRAME",0,0,(void *)FL_GTK_THIN_DOWN_FRAME},
 {"GTK_THIN_DOWN_FRAME",0,0,(void *)FL_GTK_THIN_DOWN_FRAME},
+{"GLEAM_UP_FRAME",0,0,(void *)FL_GLEAM_UP_FRAME},
+{"GLEAM_DOWN_FRAME",0,0,(void *)FL_GLEAM_DOWN_FRAME},
 {0},
 {0},
 {0}};
 {0}};
 
 
@@ -3178,5 +3186,5 @@ void Fl_Pack_Type::copy_properties()
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_Widget_Type.cxx 9082 2011-09-28 20:43:05Z matt $".
+// End of "$Id: Fl_Widget_Type.cxx 10113 2014-02-25 04:24:41Z greg.ercolano $".
 //
 //

+ 3 - 3
fltk/fluid/about_panel.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: about_panel.cxx 9827 2013-02-20 10:27:47Z ianmacarthur $"
 //
 //
 // About dialog for the Fast Light Tool Kit (FLTK).
 // About dialog for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -269,7 +269,7 @@ Fl_Double_Window* make_about_panel() {
     { Fl_Box* o = new Fl_Box(10, 10, 115, 120);
     { Fl_Box* o = new Fl_Box(10, 10, 115, 120);
       o->image(image_fluid);
       o->image(image_fluid);
     } // Fl_Box* o
     } // Fl_Box* o
-    { Fl_Box* o = new Fl_Box(135, 10, 200, 70, "FLTK User\nInterface Designer\nVersion 1.3.0");
+    { Fl_Box* o = new Fl_Box(135, 10, 200, 70, "FLTK User\nInterface Designer\nVersion 1.3.2");
       o->color((Fl_Color)12);
       o->color((Fl_Color)12);
       o->selection_color(FL_DARK1);
       o->selection_color(FL_DARK1);
       o->labelfont(1);
       o->labelfont(1);
@@ -873,5 +873,5 @@ unsigned char fluid_org_png[12690] = /* binary data included from ../documentati
 73,69,78,68,174,66,96,130};
 73,69,78,68,174,66,96,130};
 
 
 //
 //
-// End of "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: about_panel.cxx 9827 2013-02-20 10:27:47Z ianmacarthur $".
 //
 //

+ 5 - 5
fltk/fluid/about_panel.fl

@@ -3,7 +3,7 @@ version 1.0302
 header_name {.h} 
 header_name {.h} 
 code_name {.cxx}
 code_name {.cxx}
 comment {//
 comment {//
-// "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: about_panel.fl 9827 2013-02-20 10:27:47Z ianmacarthur $"
 //
 //
 // About dialog for the Fast Light Tool Kit (FLTK).
 // About dialog for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -28,8 +28,8 @@ decl {void show_help(const char *name);} {public local
 Function {make_about_panel()} {open
 Function {make_about_panel()} {open
 } {
 } {
   Fl_Window about_panel {
   Fl_Window about_panel {
-    label {About FLUID} open selected
-    xywh {419 216 345 180} type Double color 50 selection_color 47 hotspot non_modal visible
+    label {About FLUID} open
+    xywh {680 247 345 180} type Double color 50 selection_color 47 hotspot non_modal visible
   } {
   } {
     Fl_Box {} {
     Fl_Box {} {
       image {icons/fluid-96.xpm} xywh {10 10 115 120}
       image {icons/fluid-96.xpm} xywh {10 10 115 120}
@@ -37,7 +37,7 @@ Function {make_about_panel()} {open
     Fl_Box {} {
     Fl_Box {} {
       label {FLTK User
       label {FLTK User
 Interface Designer
 Interface Designer
-Version 1.3.0}
+Version 1.3.2} selected
       xywh {135 10 200 70} color 12 selection_color 47 labelfont 1 labelsize 18 align 21
       xywh {135 10 200 70} color 12 selection_color 47 labelfont 1 labelsize 18 align 21
     }
     }
     Fl_Box {} {
     Fl_Box {} {
@@ -64,6 +64,6 @@ data fluid_org_png {
 
 
 comment {
 comment {
 //
 //
-// End of "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: about_panel.fl 9827 2013-02-20 10:27:47Z ianmacarthur $".
 //} {in_source in_header
 //} {in_source in_header
 } 
 } 

+ 2 - 2
fltk/fluid/about_panel.h

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: about_panel.h 9827 2013-02-20 10:27:47Z ianmacarthur $"
 //
 //
 // About dialog for the Fast Light Tool Kit (FLTK).
 // About dialog for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -32,5 +32,5 @@ extern unsigned char fluid_org_png[12690];
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: about_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: about_panel.h 9827 2013-02-20 10:27:47Z ianmacarthur $".
 //
 //

+ 2 - 2
fltk/fluid/alignment_panel.fl

@@ -3,7 +3,7 @@ version 1.0300
 header_name {.h} 
 header_name {.h} 
 code_name {.cxx}
 code_name {.cxx}
 comment {//
 comment {//
-// "$Id: alignment_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: alignment_panel.fl 10149 2014-05-17 20:46:25Z greg.ercolano $"
 //
 //
 // Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
 // Setting and shell dialogs for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -673,6 +673,6 @@ global_settings_window->hide();}
 
 
 comment {
 comment {
 //
 //
-// End of "$Id: alignment_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: alignment_panel.fl 10149 2014-05-17 20:46:25Z greg.ercolano $".
 //} {in_source in_header
 //} {in_source in_header
 } 
 } 

+ 16 - 3
fltk/fluid/factory.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: factory.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: factory.cxx 10074 2014-01-21 11:07:43Z AlbrechtS $"
 //
 //
 // Widget factory code for the Fast Light Tool Kit (FLTK).
 // Widget factory code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -37,7 +37,20 @@
 
 
 extern Fl_Pixmap *pixmap[];
 extern Fl_Pixmap *pixmap[];
 
 
-#if !HAVE_STRCASECMP
+// Note: current MinGW versions don't find strcasecmp() in configure,
+// since it has been #define'd to _stricmp, and hence it does work,
+// although it is actually not available as a function in any lib.
+// The following "&& !defined(strcasecmp)" fixes this *temporarily*,
+// until a better fix can be found. One way would be to rename this
+// local, static version of function strcasecmp()...
+// AlbrechtS, Jan 03, 2014, svn -r ~10044, see STR #2994
+//
+// For some (yet unknown) reason the previous fix didn't work with
+// CMake-generated MinGW (MSYS) Makefiles, hence we have to use
+// !defined(__MINGW32__) instead of !defined(strcasecmp).
+// AlbrechtS, Jan 21, 2014, svn -r ~10074, see STR #2994
+
+#if !HAVE_STRCASECMP && !defined(__MINGW32__)
 //
 //
 // 'strcasecmp()' - Do a case-insensitive compare...
 // 'strcasecmp()' - Do a case-insensitive compare...
 //
 //
@@ -1267,5 +1280,5 @@ int lookup_symbol(const char *name, int &v, int numberok) {
 }
 }
 
 
 //
 //
-// End of "$Id: factory.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: factory.cxx 10074 2014-01-21 11:07:43Z AlbrechtS $".
 //
 //

+ 2 - 2
fltk/fluid/fluid.app/Contents/Info.plist

@@ -17,7 +17,7 @@
 	<string>English</string>
 	<string>English</string>
 
 
 	<key>NSHumanReadableCopyright</key>
 	<key>NSHumanReadableCopyright</key>
-	<string>Copyright 1998-2006 by Bill Spitzak and others</string>
+	<string>Copyright 1998-2010 by Bill Spitzak and others</string>
 
 
 	<key>CFAppleHelpAnchor</key>
 	<key>CFAppleHelpAnchor</key>
 	<string>help</string>
 	<string>help</string>
@@ -38,7 +38,7 @@
 	<string>1.1.7</string>
 	<string>1.1.7</string>
 
 
 	<key>CFBundleGetInfoString</key>
 	<key>CFBundleGetInfoString</key>
-	<string>1.1.7, Copyright 1998-2006 by Bill Spitzak and others</string>
+	<string>1.1.7, Copyright 1998-2010 by Bill Spitzak and others</string>
 
 
 	<key>CFBundleDocumentTypes</key>
 	<key>CFBundleDocumentTypes</key>
 	<array>
 	<array>

+ 2 - 2
fltk/fluid/fluid.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: fluid.cxx 9325 2012-04-05 05:12:30Z fabien $"
+// "$Id: fluid.cxx 10113 2014-02-25 04:24:41Z greg.ercolano $"
 //
 //
 // FLUID main entry for the Fast Light Tool Kit (FLTK).
 // FLUID main entry for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -2129,5 +2129,5 @@ int main(int argc,char **argv) {
 }
 }
 
 
 //
 //
-// End of "$Id: fluid.cxx 9325 2012-04-05 05:12:30Z fabien $".
+// End of "$Id: fluid.cxx 10113 2014-02-25 04:24:41Z greg.ercolano $".
 //
 //

+ 10 - 6
fltk/fluid/function_panel.fl

@@ -3,7 +3,7 @@ version 1.0300
 header_name {.h} 
 header_name {.h} 
 code_name {.cxx}
 code_name {.cxx}
 comment {//
 comment {//
-// "$Id: function_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: function_panel.fl 10010 2013-10-25 22:03:47Z greg.ercolano $"
 //
 //
 // Code dialogs for the Fast Light Tool Kit (FLTK).
 // Code dialogs for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -129,11 +129,15 @@ Function {make_function_panel()} {} {
   }
   }
 } 
 } 
 
 
-Function {make_code_panel()} {} {
+Function {make_code_panel()} {open
+} {
   Fl_Window code_panel {
   Fl_Window code_panel {
-    label {Code Properties} open
-    xywh {-32000 -32000 540 216} type Double labelsize 11 hide resizable
-    code0 {o->size_range(200, 150);} modal
+    label {Code Properties}
+    callback {if (Fl::event()==FL_SHORTCUT && Fl::event_key()==FL_Escape) 
+    return; // ignore Escape
+code_panel->hide(); // otherwise hide..} open selected
+    xywh {353 262 540 180} type Double labelsize 11 resizable
+    code0 {o->size_range(200, 150);} modal visible
   } {
   } {
     Fl_Text_Editor code_input {
     Fl_Text_Editor code_input {
       xywh {10 45 520 130} box DOWN_BOX labelsize 11 textfont 4 textsize 11 resizable
       xywh {10 45 520 130} box DOWN_BOX labelsize 11 textfont 4 textsize 11 resizable
@@ -1019,6 +1023,6 @@ Function {make_sourceview()} {open
 
 
 comment {
 comment {
 //
 //
-// End of "$Id: function_panel.fl 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: function_panel.fl 10010 2013-10-25 22:03:47Z greg.ercolano $".
 //} {in_source in_header
 //} {in_source in_header
 } 
 } 

+ 2 - 2
fltk/makeinclude

@@ -81,8 +81,8 @@ CAIROLIBS	=
 CAIROFLAGS	= 
 CAIROFLAGS	= 
 DSOFLAGS	= -L. -L../../libharu/src -lhpdfs
 DSOFLAGS	= -L. -L../../libharu/src -lhpdfs
 LDFLAGS		= $(OPTIM)  
 LDFLAGS		= $(OPTIM)  
-LDLIBS		= -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 
-GLDLIBS		= -lGLU -lGL -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 
+LDLIBS		= -lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 
+GLDLIBS		= -lGLU -lGL -lXfixes -lXext -lXft -lfontconfig -lXinerama -lpthread -ldl -lm  -lX11 
 LINKFLTK	= ../lib/libfltk.a
 LINKFLTK	= ../lib/libfltk.a
 LINKFLTKGL	= ../lib/libfltk_gl.a
 LINKFLTKGL	= ../lib/libfltk_gl.a
 LINKFLTKFORMS	= ../lib/libfltk_forms.a ../lib/libfltk.a
 LINKFLTKFORMS	= ../lib/libfltk_forms.a ../lib/libfltk.a

+ 3 - 0
fltk/makesrcdist

@@ -61,6 +61,9 @@ sed -e '1,$s/@VERSION@/'$version'/' \
 echo Creating configure script...
 echo Creating configure script...
 autoconf -f
 autoconf -f
 
 
+echo Creating config.guess and config.sub \(ignore any other errors\)...
+automake --add-missing --copy
+
 echo Cleaning developer files...
 echo Cleaning developer files...
 rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
 rm -rf OpenGL autom4te* bc5 config forms glut images packages themes
 rm -f makesrcdist
 rm -f makesrcdist

+ 39 - 0
fltk/misc/cp1252.html

@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+  <title>UTF-8 Test File: Windows Code Page 1252 (Western) [windows-1252]</title>
+  <meta http-equiv='Content-Type' content='text/html; charset=windows-1252'/>
+</head>
+<body>
+<h1>Windows Code Page 1252 (aka "Western")</h1>
+<pre>
++---------------+-------------------------------------------------+
+| octal   -->   |  0  1  2  3  4  5  6  7 10 11 12 13 14 16 16 17 |
+|  |    dec. -> |  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 |
+|  v  |  v  |hex|  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F |
++-----+-----+---+-------------------------------------------------+
+|   0 |   0 | 0 |                                                 |
+|  20 |  16 | 1 |                                                 |
+|  40 |  32 | 2 |     ! ""  #  $  %  &  '  (  )  *  +  ,  -  .  / |
+|  60 |  48 | 3 |  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ? |
+| 100 |  64 | 4 |  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O |
+| 120 |  80 | 5 |  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _ |
+| 140 |  96 | 6 |  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o |
+| 160 | 112 | 7 |  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~    |
+| 200 | 128 | 8 |  €     ‚  ƒ  „  …  †  ‡  ˆ  ‰  Š  ‹  Œ     Ž    |
+| 220 | 144 | 9 |     ‘  ’  “  ”  •  –  —  ˜  ™  š  ›  œ     ž  Ÿ |
+| 240 | 160 | A |     ¡  ¢  £  ¤  ¥  ¦  §  ¨  ©  ª  «  ¬  ­  ®  ¯ |
+| 260 | 176 | B |  °  ±  ²  ³  ´  µ  ¶  ·  ¸  ¹  º  »  ¼  ½  ¾  ¿ |
+| 300 | 192 | C |  À  Á  Â  Ã  Ä  Å  Æ  Ç  È  É  Ê  Ë  Ì  Í  Î  Ï |
+| 320 | 208 | D |  Ð  Ñ  Ò  Ó  Ô  Õ  Ö  ×  Ø  Ù  Ú  Û  Ü  Ý  Þ  ß |
+| 340 | 224 | E |  à  á  â  ã  ä  å  æ  ç  è  é  ê  ë  ì  í  î  ï |
+| 360 | 240 | F |  ð  ñ  ò  ó  ô  õ  ö  ÷  ø  ù  ú  û  ü  ý  þ  ÿ |
++-----+-----+---+-------------------------------------------------+
+
+File:		cp1252.html
+Encoding:	windows-1252 = Windows Code Page 1252 ("Western")
+Meta tag:	content='text/html; charset=windows-1252'
+
+</pre>
+</body>
+</html>

+ 39 - 0
fltk/misc/cp1252_utf-8.html

@@ -0,0 +1,39 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+  <title>UTF-8 Test File: Windows Code Page 1252 (Western) [UTF-8]</title>
+  <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
+</head>
+<body>
+<h1>Windows Code Page 1252 (aka "Western")</h1>
+<pre>
++---------------+-------------------------------------------------+
+| octal   -->   |  0  1  2  3  4  5  6  7 10 11 12 13 14 16 16 17 |
+|  |    dec. -> |  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 |
+|  v  |  v  |hex|  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F |
++-----+-----+---+-------------------------------------------------+
+|   0 |   0 | 0 |                                                 |
+|  20 |  16 | 1 |                                                 |
+|  40 |  32 | 2 |     ! ""  #  $  %  &  '  (  )  *  +  ,  -  .  / |
+|  60 |  48 | 3 |  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ? |
+| 100 |  64 | 4 |  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O |
+| 120 |  80 | 5 |  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _ |
+| 140 |  96 | 6 |  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o |
+| 160 | 112 | 7 |  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~    |
+| 200 | 128 | 8 |  €     ‚  ƒ  „  …  †  ‡  ˆ  ‰  Š  ‹  Œ     Ž    |
+| 220 | 144 | 9 |     ‘  ’  “  ”  •  –  —  ˜  ™  š  ›  œ     ž  Ÿ |
+| 240 | 160 | A |     ¡  ¢  £  ¤  ¥  ¦  §  ¨  ©  ª  «  ¬  ­  ®  ¯ |
+| 260 | 176 | B |  °  ±  ²  ³  ´  µ  ¶  ·  ¸  ¹  º  »  ¼  ½  ¾  ¿ |
+| 300 | 192 | C |  À  Á  Â  Ã  Ä  Å  Æ  Ç  È  É  Ê  Ë  Ì  Í  Î  Ï |
+| 320 | 208 | D |  Ð  Ñ  Ò  Ó  Ô  Õ  Ö  ×  Ø  Ù  Ú  Û  Ü  Ý  Þ  ß |
+| 340 | 224 | E |  à  á  â  ã  ä  å  æ  ç  è  é  ê  ë  ì  í  î  ï |
+| 360 | 240 | F |  ð  ñ  ò  ó  ô  õ  ö  ÷  ø  ù  ú  û  ü  ý  þ  ÿ |
++-----+-----+---+-------------------------------------------------+
+
+File:		cp1252_utf-8.html
+Encoding:	UTF-8
+Meta tag:	content='text/html; charset=UTF-8'
+
+</pre>
+</body>
+</html>

+ 16 - 8
fltk/src/CMakeLists.txt

@@ -15,6 +15,7 @@ set(CPPFILES
   Fl_Choice.cxx
   Fl_Choice.cxx
   Fl_Clock.cxx
   Fl_Clock.cxx
   Fl_Color_Chooser.cxx
   Fl_Color_Chooser.cxx
+  Fl_Copy_Surface.cxx
   Fl_Counter.cxx
   Fl_Counter.cxx
   Fl_Device.cxx
   Fl_Device.cxx
   Fl_Dial.cxx
   Fl_Dial.cxx
@@ -27,13 +28,13 @@ set(CPPFILES
   Fl_Group.cxx
   Fl_Group.cxx
   Fl_Help_View.cxx
   Fl_Help_View.cxx
   Fl_Image.cxx
   Fl_Image.cxx
+  Fl_Image_Surface.cxx
   Fl_Input.cxx
   Fl_Input.cxx
   Fl_Input_.cxx
   Fl_Input_.cxx
   Fl_Light_Button.cxx
   Fl_Light_Button.cxx
   Fl_Menu.cxx
   Fl_Menu.cxx
   Fl_Menu_.cxx
   Fl_Menu_.cxx
   Fl_Menu_Bar.cxx
   Fl_Menu_Bar.cxx
-  Fl_Sys_Menu_Bar.cxx
   Fl_Menu_Button.cxx
   Fl_Menu_Button.cxx
   Fl_Menu_Window.cxx
   Fl_Menu_Window.cxx
   Fl_Menu_add.cxx
   Fl_Menu_add.cxx
@@ -91,6 +92,7 @@ set(CPPFILES
   Fl_get_system_colors.cxx
   Fl_get_system_colors.cxx
   Fl_grab.cxx
   Fl_grab.cxx
   Fl_lock.cxx
   Fl_lock.cxx
+  Fl_sleep.cxx
   Fl_own_colormap.cxx
   Fl_own_colormap.cxx
   Fl_visual.cxx
   Fl_visual.cxx
   Fl_x.cxx
   Fl_x.cxx
@@ -116,6 +118,7 @@ set(CPPFILES
   fl_engraved_label.cxx
   fl_engraved_label.cxx
   fl_file_dir.cxx
   fl_file_dir.cxx
   fl_font.cxx
   fl_font.cxx
+  fl_gleam.cxx
   fl_gtk.cxx
   fl_gtk.cxx
   fl_labeltype.cxx
   fl_labeltype.cxx
   fl_line_style.cxx
   fl_line_style.cxx
@@ -199,6 +202,7 @@ if(APPLE)
 		Fl_cocoa.mm
 		Fl_cocoa.mm
 		Fl_Quartz_Printer.mm
 		Fl_Quartz_Printer.mm
 		Fl_Native_File_Chooser_MAC.mm
 		Fl_Native_File_Chooser_MAC.mm
+		Fl_Sys_Menu_Bar.mm
 		)
 		)
 else()
 else()
    set(MMFILES
    set(MMFILES
@@ -220,7 +224,7 @@ if(MSVC)
 endif(MSVC)
 endif(MSVC)
 
 
 if(USE_THREADS)
 if(USE_THREADS)
-   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT})
+   target_link_libraries(fltk ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
 endif(USE_THREADS)
 endif(USE_THREADS)
 
 
 if(USE_X11)
 if(USE_X11)
@@ -238,6 +242,10 @@ ENDif(FLTK_HAVE_CAIRO)
 if(HAVE_XINERAMA)
 if(HAVE_XINERAMA)
    target_link_libraries(fltk ${X11_Xinerama_LIB})
    target_link_libraries(fltk ${X11_Xinerama_LIB})
 endif(HAVE_XINERAMA)
 endif(HAVE_XINERAMA)
+
+if(HAVE_XFIXES)
+   target_link_libraries(fltk ${X11_Xfixes_LIB})
+endif(HAVE_XFIXES)
 
 
 if(USE_XFT)
 if(USE_XFT)
    target_link_libraries(fltk ${X11_Xft_LIB})
    target_link_libraries(fltk ${X11_Xft_LIB})
@@ -334,7 +342,7 @@ else()
 endif(MSVC)
 endif(MSVC)
 
 
 if(USE_THREADS)
 if(USE_THREADS)
-   target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
+   target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
 endif(USE_THREADS)
 endif(USE_THREADS)
 
 
 if(USE_X11)
 if(USE_X11)
@@ -363,7 +371,7 @@ endif(LIB_fontconfig)
 
 
 #######################################################################
 #######################################################################
 add_library(fltk_forms_SHARED SHARED ${FLCPPFILES})
 add_library(fltk_forms_SHARED SHARED ${FLCPPFILES})
-target_link_libraries(fltk_forms_SHARED fltk)
+target_link_libraries(fltk_forms_SHARED fltk_SHARED)
 set_target_properties(fltk_forms_SHARED
 set_target_properties(fltk_forms_SHARED
    PROPERTIES CLEAN_DIRECT_OUTPUT 1
    PROPERTIES CLEAN_DIRECT_OUTPUT 1
    VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
    VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
@@ -384,16 +392,16 @@ else()
 endif(MSVC)
 endif(MSVC)
 
 
 if(USE_THREADS)
 if(USE_THREADS)
-   target_link_libraries(fltk_SHARED ${CMAKE_THREAD_LIBS_INIT})
+   target_link_libraries(fltk_forms_SHARED ${CMAKE_THREAD_LIBS_INIT} ${LIB_dl})
 endif(USE_THREADS)
 endif(USE_THREADS)
 
 
 if(USE_X11)
 if(USE_X11)
-   target_link_libraries(fltk_SHARED ${X11_LIBRARIES})
+   target_link_libraries(fltk_forms_SHARED ${X11_LIBRARIES})
 endif(USE_X11)
 endif(USE_X11)
 
 
 #######################################################################
 #######################################################################
 add_library(fltk_images_SHARED SHARED ${IMGCPPFILES})
 add_library(fltk_images_SHARED SHARED ${IMGCPPFILES})
-target_link_libraries(fltk_images_SHARED fltk
+target_link_libraries(fltk_images_SHARED fltk_SHARED
    ${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}
    ${FLTK_PNG_LIBRARIES} ${FLTK_JPEG_LIBRARIES} ${FLTK_ZLIB_LIBRARIES}
 )
 )
 set_target_properties(fltk_images_SHARED
 set_target_properties(fltk_images_SHARED
@@ -424,7 +432,7 @@ install(TARGETS fltk_SHARED fltk_forms_SHARED fltk_images_SHARED
 #######################################################################
 #######################################################################
 if(OPENGL_FOUND)
 if(OPENGL_FOUND)
    add_library(fltk_gl_SHARED SHARED ${GLCPPFILES})
    add_library(fltk_gl_SHARED SHARED ${GLCPPFILES})
-   target_link_libraries(fltk_gl_SHARED fltk ${OPENGL_LIBRARIES})
+   target_link_libraries(fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES})
    set_target_properties(fltk_gl_SHARED
    set_target_properties(fltk_gl_SHARED
       PROPERTIES CLEAN_DIRECT_OUTPUT 1
       PROPERTIES CLEAN_DIRECT_OUTPUT 1
       VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
       VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}

+ 182 - 63
fltk/src/Fl.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl.cxx 9666 2012-08-16 20:59:36Z matt $"
+// "$Id: Fl.cxx 10186 2014-06-07 12:01:59Z manolo $"
 //
 //
 // Main event handling code for the Fast Light Tool Kit (FLTK).
 // Main event handling code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -67,20 +67,20 @@ void fl_cleanup_pens(void);
 void fl_release_dc(HWND,HDC);
 void fl_release_dc(HWND,HDC);
 void fl_cleanup_dc_list(void);
 void fl_cleanup_dc_list(void);
 #elif defined(__APPLE__)
 #elif defined(__APPLE__)
-extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle);
+extern double fl_mac_flush_and_wait(double time_to_wait);
 #endif // WIN32
 #endif // WIN32
 
 
 //
 //
 // Globals...
 // Globals...
 //
 //
 #if defined(__APPLE__) || defined(FL_DOXYGEN)
 #if defined(__APPLE__) || defined(FL_DOXYGEN)
-const char *Fl_Mac_App_Menu::about = "About ";
+const char *Fl_Mac_App_Menu::about = "About %@";
 const char *Fl_Mac_App_Menu::print = "Print Front Window";
 const char *Fl_Mac_App_Menu::print = "Print Front Window";
 const char *Fl_Mac_App_Menu::services = "Services";
 const char *Fl_Mac_App_Menu::services = "Services";
-const char *Fl_Mac_App_Menu::hide = "Hide ";
+const char *Fl_Mac_App_Menu::hide = "Hide %@";
 const char *Fl_Mac_App_Menu::hide_others = "Hide Others";
 const char *Fl_Mac_App_Menu::hide_others = "Hide Others";
 const char *Fl_Mac_App_Menu::show = "Show All";
 const char *Fl_Mac_App_Menu::show = "Show All";
-const char *Fl_Mac_App_Menu::quit = "Quit ";
+const char *Fl_Mac_App_Menu::quit = "Quit %@";
 #endif // __APPLE__
 #endif // __APPLE__
 #ifndef FL_DOXYGEN
 #ifndef FL_DOXYGEN
 Fl_Widget	*Fl::belowmouse_,
 Fl_Widget	*Fl::belowmouse_,
@@ -104,6 +104,8 @@ int		Fl::damage_,
 
 
 char		*Fl::e_text = (char *)"";
 char		*Fl::e_text = (char *)"";
 int		Fl::e_length, Fl::e_timestamp = 0, Fl::e_dxy_timespan = 0;
 int		Fl::e_length, Fl::e_timestamp = 0, Fl::e_dxy_timespan = 0;
+const char*	Fl::e_clipboard_type = "";
+void *		Fl::e_clipboard_data = NULL;
 
 
 Fl_Event_Dispatch Fl::e_dispatch = 0;
 Fl_Event_Dispatch Fl::e_dispatch = 0;
 Fl_Do_Call_Timeout Fl::do_call_timeout_ = 0;
 Fl_Do_Call_Timeout Fl::do_call_timeout_ = 0;
@@ -122,6 +124,9 @@ void *Fl::user_data = NULL;
 Fl_Focus_Changing_Handler Fl::focus_changing_handler = NULL;
 Fl_Focus_Changing_Handler Fl::focus_changing_handler = NULL;
 #endif // FL_DOXYGEN
 #endif // FL_DOXYGEN
 
 
+char const * const Fl::clipboard_plain_text = "text/plain";
+char const * const Fl::clipboard_image = "image";
+
 //
 //
 // 'Fl::version()' - Return the API version number...
 // 'Fl::version()' - Return the API version number...
 //
 //
@@ -238,7 +243,7 @@ int Fl::getMilliSpan(int nTimeStart){
 
 
 #elif defined(__APPLE__)
 #elif defined(__APPLE__)
 
 
-// implementation in Fl_mac.cxx
+// implementation in Fl_cocoa.mm (was Fl_mac.cxx)
 
 
 #else
 #else
 
 
@@ -448,11 +453,75 @@ static void run_checks()
   }
   }
 }
 }
 
 
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__APPLE__)
 static char in_idle;
 static char in_idle;
 #endif
 #endif
 
 
 ////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////
+// Clipboard notifications
+
+struct Clipboard_Notify {
+  Fl_Clipboard_Notify_Handler handler;
+  void *data;
+  struct Clipboard_Notify *next;
+};
+
+static struct Clipboard_Notify *clip_notify_list = NULL;
+
+extern void fl_clipboard_notify_change(); // in Fl_<platform>.cxx
+
+void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) {
+  struct Clipboard_Notify *node;
+
+  remove_clipboard_notify(h);
+
+  node = new Clipboard_Notify;
+
+  node->handler = h;
+  node->data = data;
+  node->next = clip_notify_list;
+
+  clip_notify_list = node;
+
+  fl_clipboard_notify_change();
+}
+
+void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) {
+  struct Clipboard_Notify *node, **prev;
+
+  node = clip_notify_list;
+  prev = &clip_notify_list;
+  while (node != NULL) {
+    if (node->handler == h) {
+      *prev = node->next;
+      delete node;
+
+      fl_clipboard_notify_change();
+
+      return;
+    }
+
+    prev = &node->next;
+    node = node->next;
+  }
+}
+
+bool fl_clipboard_notify_empty(void) {
+  return clip_notify_list == NULL;
+}
+
+void fl_trigger_clipboard_notify(int source) {
+  struct Clipboard_Notify *node, *next;
+
+  node = clip_notify_list;
+  while (node != NULL) {
+    next = node->next;
+    node->handler(source, node->data);
+    node = next;
+  }
+}
+
+////////////////////////////////////////////////////////////////
 // wait/run/check/ready:
 // wait/run/check/ready:
 
 
 void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions
 void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions
@@ -474,16 +543,7 @@ double Fl::wait(double time_to_wait) {
 #elif defined(__APPLE__)
 #elif defined(__APPLE__)
 
 
   run_checks();
   run_checks();
-  if (idle) {
-    if (!in_idle) {
-      in_idle = 1;
-      idle();
-      in_idle = 0;
-    }
-    // the idle function may turn off idle, we can then wait:
-    if (idle) time_to_wait = 0.0;
-  }
-  return fl_mac_flush_and_wait(time_to_wait, in_idle);
+  return fl_mac_flush_and_wait(time_to_wait);
 
 
 #else
 #else
 
 
@@ -593,7 +653,7 @@ static Fl_Win32_At_Exit win32_at_exit;
   repeatedly to "run" your program.  You can also check what happened
   repeatedly to "run" your program.  You can also check what happened
   each time after this returns, which is quite useful for managing
   each time after this returns, which is quite useful for managing
   program state.
   program state.
-  
+
   What this really does is call all idle callbacks, all elapsed
   What this really does is call all idle callbacks, all elapsed
   timeouts, call Fl::flush() to get the screen to update, and
   timeouts, call Fl::flush() to get the screen to update, and
   then wait some time (zero if there are idle callbacks, the shortest of
   then wait some time (zero if there are idle callbacks, the shortest of
@@ -629,7 +689,7 @@ int Fl::wait() {
   if (user_hit_abort_button()) break;
   if (user_hit_abort_button()) break;
   }
   }
   \endcode
   \endcode
-  
+
   This returns non-zero if any windows are displayed, and 0 if no
   This returns non-zero if any windows are displayed, and 0 if no
   windows are displayed (this is likely to change in future versions of
   windows are displayed (this is likely to change in future versions of
   FLTK).
   FLTK).
@@ -648,12 +708,12 @@ int Fl::check() {
 
 
   \code
   \code
   while (!calculation_done()) {
   while (!calculation_done()) {
-  calculate();
-  if (Fl::ready()) {
-    do_expensive_cleanup();
-    Fl::check();
-    if (user_hit_abort_button()) break;
-  }
+    calculate();
+    if (Fl::ready()) {
+      do_expensive_cleanup();
+      Fl::check();
+      if (user_hit_abort_button()) break;
+    }
   }
   }
   \endcode
   \endcode
 */
 */
@@ -720,7 +780,7 @@ Fl_Window* Fl::next_window(const Fl_Window* window) {
 }
 }
 
 
 /**
 /**
- Sets the window that is returned by first_window().  
+ Sets the window that is returned by first_window().
  The window is removed from wherever it is in the
  The window is removed from wherever it is in the
  list and inserted at the top.  This is not done if Fl::modal()
  list and inserted at the top.  This is not done if Fl::modal()
  is on or if the window is not shown(). Because the first window
  is on or if the window is not shown(). Because the first window
@@ -794,7 +854,7 @@ static handler_link *handlers = 0;
   (most recent first) until one of them returns non-zero.  If none of
   (most recent first) until one of them returns non-zero.  If none of
   them returns non-zero then the event is ignored.  Events that cause
   them returns non-zero then the event is ignored.  Events that cause
   this to be called are:
   this to be called are:
-  
+
   - \ref FL_SHORTCUT events that are not recognized by any widget.
   - \ref FL_SHORTCUT events that are not recognized by any widget.
     This lets you provide global shortcut keys.
     This lets you provide global shortcut keys.
   - \ref FL_SCREEN_CONFIGURATION_CHANGED events.
   - \ref FL_SCREEN_CONFIGURATION_CHANGED events.
@@ -860,7 +920,7 @@ Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
     this or any widget, because sending FL_FOCUS is supposed to
     this or any widget, because sending FL_FOCUS is supposed to
     \e test if the widget wants the focus (by it returning non-zero from
     \e test if the widget wants the focus (by it returning non-zero from
     handle()).
     handle()).
-    
+
     \see Fl_Widget::take_focus()
     \see Fl_Widget::take_focus()
 */
 */
 void Fl::focus(Fl_Widget *o) {
 void Fl::focus(Fl_Widget *o) {
@@ -904,16 +964,16 @@ static char dnd_flag = 0; // make 'belowmouse' send DND_LEAVE instead of LEAVE
 
 
 /**
 /**
     Sets the widget that is below the mouse.  This is for
     Sets the widget that is below the mouse.  This is for
-    highlighting buttons.  It is not used to send FL_PUSH or 
+    highlighting buttons.  It is not used to send FL_PUSH or
     FL_MOVE directly, for several obscure reasons, but those events
     FL_MOVE directly, for several obscure reasons, but those events
-    typically go to this widget.  This is also the first widget tried for 
+    typically go to this widget.  This is also the first widget tried for
     FL_SHORTCUT events.
     FL_SHORTCUT events.
-    
+
     If you change the belowmouse widget, the previous one and all
     If you change the belowmouse widget, the previous one and all
     parents (that don't contain the new widget) are sent FL_LEAVE
     parents (that don't contain the new widget) are sent FL_LEAVE
     events.  Changing this does \e not send FL_ENTER to this
     events.  Changing this does \e not send FL_ENTER to this
     or any widget, because sending FL_ENTER is supposed to \e test
     or any widget, because sending FL_ENTER is supposed to \e test
-    if the widget wants the mouse (by it returning non-zero from 
+    if the widget wants the mouse (by it returning non-zero from
     handle()).
     handle()).
 */
 */
 void Fl::belowmouse(Fl_Widget *o) {
 void Fl::belowmouse(Fl_Widget *o) {
@@ -1063,7 +1123,7 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
 }
 }
 
 
 
 
-/** 
+/**
  \brief Set a new event dispatch function.
  \brief Set a new event dispatch function.
 
 
  The event dispatch function is called after native events are converted to
  The event dispatch function is called after native events are converted to
@@ -1077,7 +1137,7 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
 
 
  The event dispatch can be used to handle exceptions in FLTK events and
  The event dispatch can be used to handle exceptions in FLTK events and
  callbacks before they reach the native event handler:
  callbacks before they reach the native event handler:
- 
+
  \code
  \code
  int myHandler(int e, Fl_Window *w) {
  int myHandler(int e, Fl_Window *w) {
    try {
    try {
@@ -1086,39 +1146,39 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
      ...
      ...
    }
    }
  }
  }
- 
+
  main() {
  main() {
    Fl::event_dispatch(myHandler);
    Fl::event_dispatch(myHandler);
    ...
    ...
    Fl::run();
    Fl::run();
  }
  }
  \endcode
  \endcode
- 
- \param d new dispatch function, or NULL 
+
+ \param d new dispatch function, or NULL
  \see Fl::add_handler(Fl_Event_Handler)
  \see Fl::add_handler(Fl_Event_Handler)
  \see Fl::handle(int, Fl_Window*)
  \see Fl::handle(int, Fl_Window*)
  \see Fl::handle_(int, Fl_Window*)
  \see Fl::handle_(int, Fl_Window*)
  */
  */
-void Fl::event_dispatch(Fl_Event_Dispatch d) 
+void Fl::event_dispatch(Fl_Event_Dispatch d)
 {
 {
-  e_dispatch = d; 
+  e_dispatch = d;
 }
 }
 
 
 
 
-/** 
- \brief Return the current event dispatch function. 
+/**
+ \brief Return the current event dispatch function.
  */
  */
-Fl_Event_Dispatch Fl::event_dispatch() 
-{ 
-  return e_dispatch; 
+Fl_Event_Dispatch Fl::event_dispatch()
+{
+  return e_dispatch;
 }
 }
 
 
 
 
 /**
 /**
  \brief Handle events from the window system.
  \brief Handle events from the window system.
- 
+
  This is called from the native event dispatch after native events have been
  This is called from the native event dispatch after native events have been
- converted to FLTK notation. This function calls Fl::handle_(int, Fl_Window*) 
+ converted to FLTK notation. This function calls Fl::handle_(int, Fl_Window*)
  unless the user sets a dispatch function. If a user dispatch function is set,
  unless the user sets a dispatch function. If a user dispatch function is set,
  the user must make sure that Fl::handle_() is called, or the event will be
  the user must make sure that Fl::handle_() is called, or the event will be
  ignored.
  ignored.
@@ -1143,8 +1203,8 @@ int Fl::handle(int e, Fl_Window* window)
 /**
 /**
  \brief Handle events from the window system.
  \brief Handle events from the window system.
 
 
- This function is called from the native event dispatch, unless the user sets 
- another dispatch function. In that case, the user dispatch function must 
+ This function is called from the native event dispatch, unless the user sets
+ another dispatch function. In that case, the user dispatch function must
  decide when to call Fl::handle_(int, Fl_Window*)
  decide when to call Fl::handle_(int, Fl_Window*)
 
 
  \param e the event type (Fl::event_number() is not yet set)
  \param e the event type (Fl::event_number() is not yet set)
@@ -1268,8 +1328,8 @@ int Fl::handle_(int e, Fl_Window* window)
     // always the same widget that received the corresponding
     // always the same widget that received the corresponding
     // FL_KEYBOARD event because focus may have changed.
     // FL_KEYBOARD event because focus may have changed.
     // Sending the KEYUP to the right KEYDOWN is possible, but
     // Sending the KEYUP to the right KEYDOWN is possible, but
-    // would require that we track the KEYDOWN for every possible 
-    // key stroke (users may hold down multiple keys!) and then 
+    // would require that we track the KEYDOWN for every possible
+    // key stroke (users may hold down multiple keys!) and then
     // make sure that the widget still exists before sending
     // make sure that the widget still exists before sending
     // a KEYUP there. I believe that the current solution is
     // a KEYUP there. I believe that the current solution is
     // "close enough".
     // "close enough".
@@ -1382,11 +1442,38 @@ int Fl::handle_(int e, Fl_Window* window)
 ////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////
 // hide() destroys the X window, it does not do unmap!
 // hide() destroys the X window, it does not do unmap!
 
 
-#if !defined(WIN32) && USE_XFT
+#if defined(WIN32)
+extern void fl_clipboard_notify_untarget(HWND wnd);
+extern void fl_update_clipboard(void);
+#elif USE_XFT
 extern void fl_destroy_xft_draw(Window);
 extern void fl_destroy_xft_draw(Window);
 #endif
 #endif
 
 
 void Fl_Window::hide() {
 void Fl_Window::hide() {
+#ifdef WIN32
+  // STR#3079: if there remains a window and a non-modal window, and the window is deleted,
+  // the app remains running without any apparent window.
+  // Bug mechanism: hiding an owner window unmaps the owned (non-modal) window(s)
+  // but does not delete it(them) in FLTK.
+  // Fix for it: 
+  // when hiding a window, build list of windows it owns, and do hide/show on them.
+  int count = 0;
+  Fl_Window *win, **doit = NULL;
+  for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
+    if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
+      count++;
+    }
+  }
+  if (count) {
+    doit = new Fl_Window*[count];
+    count = 0;
+    for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
+      if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
+	doit[count++] = win;
+      }
+    }
+  }
+#endif
   clear_visible();
   clear_visible();
 
 
   if (!shown()) return;
   if (!shown()) return;
@@ -1429,14 +1516,10 @@ void Fl_Window::hide() {
 #if defined(WIN32)
 #if defined(WIN32)
   // this little trick keeps the current clipboard alive, even if we are about
   // this little trick keeps the current clipboard alive, even if we are about
   // to destroy the window that owns the selection.
   // to destroy the window that owns the selection.
-  if (GetClipboardOwner()==ip->xid) {
-    Fl_Window *w1 = Fl::first_window();
-    if (w1 && OpenClipboard(fl_xid(w1))) {
-      EmptyClipboard();
-      SetClipboardData(CF_TEXT, NULL);
-      CloseClipboard();
-    }
-  }
+  if (GetClipboardOwner()==ip->xid)
+    fl_update_clipboard();
+  // Make sure we unlink this window from the clipboard chain
+  fl_clipboard_notify_untarget(ip->xid);
   // Send a message to myself so that I'll get out of the event loop...
   // Send a message to myself so that I'll get out of the event loop...
   PostMessage(ip->xid, WM_APP, 0, 0);
   PostMessage(ip->xid, WM_APP, 0, 0);
   if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc);
   if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc);
@@ -1470,6 +1553,12 @@ void Fl_Window::hide() {
     ShowWindow(p, SW_SHOWNA);
     ShowWindow(p, SW_SHOWNA);
   }
   }
   XDestroyWindow(fl_display, ip->xid);
   XDestroyWindow(fl_display, ip->xid);
+  // end of fix for STR#3079
+  for (int ii = 0; ii < count; ii++) {
+    doit[ii]->hide();
+    doit[ii]->show();
+  }
+  if (count) delete[] doit;
 #elif defined(__APPLE_QUARTZ__)
 #elif defined(__APPLE_QUARTZ__)
   ip->destroy();
   ip->destroy();
 #else
 #else
@@ -1576,12 +1665,23 @@ void Fl::selection(Fl_Widget &owner, const char* text, int len) {
 
 
 /** Backward compatibility only.
 /** Backward compatibility only.
   This calls Fl::paste(receiver, 0);
   This calls Fl::paste(receiver, 0);
-  \see Fl::paste(Fl_Widget &receiver, int clipboard)
+  \see Fl::paste(Fl_Widget &receiver, int clipboard, const char* type)
 */
 */
 void Fl::paste(Fl_Widget &receiver) {
 void Fl::paste(Fl_Widget &receiver) {
   Fl::paste(receiver, 0);
   Fl::paste(receiver, 0);
+}
+#if FLTK_ABI_VERSION >= 10303
+#elif !defined(FL_DOXYGEN)
+void Fl::paste(Fl_Widget &receiver, int source)
+{
+  Fl::paste(receiver, source, Fl::clipboard_plain_text);
 }
 }
 
 
+void Fl::copy(const char* stuff, int len, int destination) {
+  Fl::copy(stuff, len, destination, Fl::clipboard_plain_text);
+}
+
+#endif
 ////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////
 
 
 #include <FL/fl_draw.H>
 #include <FL/fl_draw.H>
@@ -1760,6 +1860,7 @@ void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
   Fl::damage(FL_DAMAGE_CHILD);
   Fl::damage(FL_DAMAGE_CHILD);
 }
 }
 void Fl_Window::flush() {
 void Fl_Window::flush() {
+  if (!shown()) return;
   make_current();
   make_current();
 //if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
 //if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
   fl_clip_region(i->region); i->region = 0;
   fl_clip_region(i->region); i->region = 0;
@@ -1987,13 +2088,21 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
 
 
  This function needs to be documented in more detail. It can be used for more
  This function needs to be documented in more detail. It can be used for more
  optional settings, such as using a native file chooser instead of the FLTK one
  optional settings, such as using a native file chooser instead of the FLTK one
- wherever possible, disabling tooltips, disabling visible focus, disabling 
+ wherever possible, disabling tooltips, disabling visible focus, disabling
  FLTK file chooser preview, etc. .
  FLTK file chooser preview, etc. .
 
 
  There should be a command line option interface.
  There should be a command line option interface.
 
 
  There should be an application that manages options system wide, per user, and
  There should be an application that manages options system wide, per user, and
  per application.
  per application.
+
+ Example:
+ \code
+     if ( Fl::option(Fl::OPTION_ARROW_FOCUS) )
+         { ..on..  }
+     else
+         { ..off..  }
+ \endcode
 
 
  \note As of FLTK 1.3.0, options can be managed within fluid, using the menu
  \note As of FLTK 1.3.0, options can be managed within fluid, using the menu
  <i>Edit/Global FLTK Settings</i>.
  <i>Edit/Global FLTK Settings</i>.
@@ -2004,7 +2113,7 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
  \see Fl::option(Fl_Option, bool)
  \see Fl::option(Fl_Option, bool)
 
 
  \since FLTK 1.3.0
  \since FLTK 1.3.0
- */ 
+ */
 bool Fl::option(Fl_Option opt)
 bool Fl::option(Fl_Option opt)
 {
 {
   if (!options_read_) {
   if (!options_read_) {
@@ -2024,6 +2133,8 @@ bool Fl::option(Fl_Option opt)
       options_[OPTION_DND_TEXT] = tmp;
       options_[OPTION_DND_TEXT] = tmp;
       opt_prefs.get("ShowTooltips", tmp, 1);                    // default: on
       opt_prefs.get("ShowTooltips", tmp, 1);                    // default: on
       options_[OPTION_SHOW_TOOLTIPS] = tmp;
       options_[OPTION_SHOW_TOOLTIPS] = tmp;
+      opt_prefs.get("FNFCUsesGTK", tmp, 1);                    // default: on
+      options_[OPTION_FNFC_USES_GTK] = tmp;
     }
     }
     { // next, check the user preferences
     { // next, check the user preferences
       // override system options only, if the option is set ( >= 0 )
       // override system options only, if the option is set ( >= 0 )
@@ -2041,6 +2152,8 @@ bool Fl::option(Fl_Option opt)
       if (tmp >= 0) options_[OPTION_DND_TEXT] = tmp;
       if (tmp >= 0) options_[OPTION_DND_TEXT] = tmp;
       opt_prefs.get("ShowTooltips", tmp, -1);
       opt_prefs.get("ShowTooltips", tmp, -1);
       if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp;
       if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp;
+      opt_prefs.get("FNFCUsesGTK", tmp, -1);
+      if (tmp >= 0) options_[OPTION_FNFC_USES_GTK] = tmp;
     }
     }
     { // now, if the developer has registered this app, we could as for per-application preferences
     { // now, if the developer has registered this app, we could as for per-application preferences
     }
     }
@@ -2056,6 +2169,12 @@ bool Fl::option(Fl_Option opt)
 
 
  This function does not change any system or user settings.
  This function does not change any system or user settings.
 
 
+ Example:
+ \code
+     Fl::option(Fl::OPTION_ARROW_FOCUS, true);     // on
+     Fl::option(Fl::OPTION_ARROW_FOCUS, false);    // off
+ \endcode
+
  \param opt which option
  \param opt which option
  \param val set to true or false
  \param val set to true or false
  \see enum Fl::Fl_Option
  \see enum Fl::Fl_Option
@@ -2094,5 +2213,5 @@ Fl_Widget_Tracker::~Fl_Widget_Tracker()
 
 
 
 
 //
 //
-// End of "$Id: Fl.cxx 9666 2012-08-16 20:59:36Z matt $".
+// End of "$Id: Fl.cxx 10186 2014-06-07 12:01:59Z manolo $".
 //
 //

+ 67 - 66
fltk/src/Fl_Bitmap.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Bitmap.cxx 9293 2012-03-18 18:48:29Z manolo $"
+// "$Id: Fl_Bitmap.cxx 10132 2014-04-28 09:17:12Z manolo $"
 //
 //
 // Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
 // Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -243,35 +243,39 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
   fl_graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
   fl_graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
 }
 }
 
 
-static int start(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, 
+int Fl_Bitmap::start(int XP, int YP, int WP, int HP, int &cx, int &cy, 
 		 int &X, int &Y, int &W, int &H)
 		 int &X, int &Y, int &W, int &H)
 {
 {
+  if (!array) {
+    draw_empty(XP, YP);
+    return 1;
+  }
   // account for current clip region (faster on Irix):
   // account for current clip region (faster on Irix):
   fl_clip_box(XP,YP,WP,HP,X,Y,W,H);
   fl_clip_box(XP,YP,WP,HP,X,Y,W,H);
   cx += X-XP; cy += Y-YP;
   cx += X-XP; cy += Y-YP;
   // clip the box down to the size of image, quit if empty:
   // clip the box down to the size of image, quit if empty:
   if (cx < 0) {W += cx; X -= cx; cx = 0;}
   if (cx < 0) {W += cx; X -= cx; cx = 0;}
-  if (cx+W > w) W = w-cx;
+  if (cx+W > w()) W = w()-cx;
   if (W <= 0) return 1;
   if (W <= 0) return 1;
   if (cy < 0) {H += cy; Y -= cy; cy = 0;}
   if (cy < 0) {H += cy; Y -= cy; cy = 0;}
-  if (cy+H > h) H = h-cy;
+  if (cy+H > h()) H = h()-cy;
   if (H <= 0) return 1;
   if (H <= 0) return 1;
+#if defined(WIN32)
+  if (!id_) id_ = fl_create_bitmap(w(), h(), array);
+#else
+  if (!id_) id_ = fl_create_bitmask(w(), h(), array);
+#endif
   return 0;
   return 0;
 }
 }
 
 
 #ifdef __APPLE__
 #ifdef __APPLE__
 void Fl_Quartz_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
 void Fl_Quartz_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   int X, Y, W, H;
-  if (!bm->array) {
-    bm->draw_empty(XP, YP);
+  if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
     return;
     return;
   }
   }
-  if (start(bm, XP, YP, WP, HP, bm->w(), bm->h(), cx, cy, X, Y, W, H)) {
-    return;
-  }
-  if (!bm->id_) bm->id_ = fl_create_bitmask(bm->w(), bm->h(), bm->array);
   if (bm->id_ && fl_gc) {
   if (bm->id_ && fl_gc) {
-    CGRect rect = { { X, Y }, { W, H } };
+    CGRect rect = { { (CGFloat)X, (CGFloat)Y }, { (CGFloat)W, (CGFloat)H } };
     Fl_X::q_begin_image(rect, cx, cy, bm->w(), bm->h());
     Fl_X::q_begin_image(rect, cx, cy, bm->w(), bm->h());
     CGContextDrawImage(fl_gc, rect, (CGImageRef)bm->id_);
     CGContextDrawImage(fl_gc, rect, (CGImageRef)bm->id_);
     Fl_X::q_end_image();
     Fl_X::q_end_image();
@@ -281,60 +285,62 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int
 #elif defined(WIN32)
 #elif defined(WIN32)
 void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
 void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   int X, Y, W, H;
-  if (!bm->array) {
-    bm->draw_empty(XP, YP);
+  if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
     return;
     return;
   }
   }
-  if (start(bm, XP, YP, WP, HP, bm->w(), bm->h(), cx, cy, X, Y, W, H)) {
+  
+  HDC tempdc = CreateCompatibleDC(fl_gc);
+  int save = SaveDC(tempdc);
+  SelectObject(tempdc, (HGDIOBJ)bm->id_);
+  SelectObject(fl_gc, fl_brush());
+  // secret bitblt code found in old MSWindows reference manual:
+  BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
+  RestoreDC(tempdc, save);
+  DeleteDC(tempdc);
+}  
+
+void Fl_GDI_Printer_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  typedef BOOL (WINAPI* fl_transp_func)  (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
+  static fl_transp_func fl_TransparentBlt = NULL;
+  static HMODULE hMod = NULL;
+  if (!hMod) {
+    hMod = LoadLibrary("MSIMG32.DLL");
+    if (hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
+  }
+  if (!fl_TransparentBlt) {
+    Fl_GDI_Graphics_Driver::draw(bm,  XP,  YP,  WP,  HP,  cx,  cy);
+    return;
+    }
+  if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
     return;
     return;
   }
   }
-  if (!bm->id_) bm->id_ = fl_create_bitmap(bm->w(), bm->h(), bm->array);
   
   
-  typedef BOOL (WINAPI* fl_transp_func)  (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
-  static fl_transp_func fl_TransparentBlt;
   HDC tempdc;
   HDC tempdc;
   int save;
   int save;
-  BOOL use_print_algo = false;
-  if (Fl_Surface_Device::surface() != Fl_Display_Device::display_device()) {
-    static HMODULE hMod = NULL;
-    if (!hMod) {
-      hMod = LoadLibrary("MSIMG32.DLL");
-      if (hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
-    }
-    if (fl_TransparentBlt) use_print_algo = true;
-  }
-  if (use_print_algo) { // algorithm for bitmap output to Fl_GDI_Printer
-    Fl_Color save_c = fl_color(); // save bitmap's desired color
-    uchar r, g, b;
-    Fl::get_color(save_c, r, g, b);
-    r = 255-r;
-    g = 255-g;
-    b = 255-b;
-    Fl_Color background = fl_rgb_color(r, g, b); // a color very different from the bitmap's
-    Fl_Offscreen tmp_id = fl_create_offscreen(W, H);
-    fl_begin_offscreen(tmp_id);
-    fl_color(background);
-    fl_rectf(0,0,W,H); // use this color as offscreen background
-    fl_color(save_c); // back to bitmap's color
-    tempdc = CreateCompatibleDC(fl_gc);
-    save = SaveDC(tempdc);
-    SelectObject(tempdc, (HGDIOBJ)bm->id_);
-    SelectObject(fl_gc, fl_brush()); // use bitmap's desired color
-    BitBlt(fl_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen
-    fl_end_offscreen(); // offscreen data is in tmp_id
-    SelectObject(tempdc, (HGDIOBJ)tmp_id); // use offscreen data
-    // draw it to printer context with background color as transparent
-    fl_TransparentBlt(fl_gc, X,Y,W,H, tempdc, cx, cy, bm->w(), bm->h(), RGB(r, g, b) ); 
-    fl_delete_offscreen(tmp_id);
-  }
-  else { // algorithm for bitmap output to display
-    tempdc = CreateCompatibleDC(fl_gc);
-    save = SaveDC(tempdc);
-    SelectObject(tempdc, (HGDIOBJ)bm->id_);
-    SelectObject(fl_gc, fl_brush());
-    // secret bitblt code found in old MSWindows reference manual:
-    BitBlt(fl_gc, X, Y, W, H, tempdc, cx, cy, 0xE20746L);
-  }
+  // algorithm for bitmap output to Fl_GDI_Printer
+  Fl_Color save_c = fl_color(); // save bitmap's desired color
+  uchar r, g, b;
+  Fl::get_color(save_c, r, g, b);
+  r = 255-r;
+  g = 255-g;
+  b = 255-b;
+  Fl_Color background = fl_rgb_color(r, g, b); // a color very different from the bitmap's
+  Fl_Offscreen tmp_id = fl_create_offscreen(W, H);
+  fl_begin_offscreen(tmp_id);
+  fl_color(background);
+  fl_rectf(0,0,W,H); // use this color as offscreen background
+  fl_color(save_c); // back to bitmap's color
+  tempdc = CreateCompatibleDC(fl_gc);
+  save = SaveDC(tempdc);
+  SelectObject(tempdc, (HGDIOBJ)bm->id_);
+  SelectObject(fl_gc, fl_brush()); // use bitmap's desired color
+  BitBlt(fl_gc, 0, 0, W, H, tempdc, 0, 0, 0xE20746L); // draw bitmap to offscreen
+  fl_end_offscreen(); // offscreen data is in tmp_id
+  SelectObject(tempdc, (HGDIOBJ)tmp_id); // use offscreen data
+  // draw it to printer context with background color as transparent
+  fl_TransparentBlt(fl_gc, X,Y,W,H, tempdc, cx, cy, bm->w(), bm->h(), RGB(r, g, b) ); 
+  fl_delete_offscreen(tmp_id);
   RestoreDC(tempdc, save);
   RestoreDC(tempdc, save);
   DeleteDC(tempdc);
   DeleteDC(tempdc);
 }  
 }  
@@ -342,14 +348,9 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP,
 #else // Xlib
 #else // Xlib
 void Fl_Xlib_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
 void Fl_Xlib_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
   int X, Y, W, H;
   int X, Y, W, H;
-  if (!bm->array) {
-    bm->draw_empty(XP, YP);
-    return;
-  }
-  if (start(bm, XP, YP, WP, HP, bm->w(), bm->h(), cx, cy, X, Y, W, H)) {
+  if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
     return;
     return;
-  }
-  if (!bm->id_) bm->id_ = fl_create_bitmask(bm->w(), bm->h(), bm->array);
+  }
   
   
   XSetStipple(fl_display, fl_gc, bm->id_);
   XSetStipple(fl_display, fl_gc, bm->id_);
   int ox = X-cx; if (ox < 0) ox += bm->w();
   int ox = X-cx; if (ox < 0) ox += bm->w();
@@ -469,5 +470,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
 
 
 
 
 //
 //
-// End of "$Id: Fl_Bitmap.cxx 9293 2012-03-18 18:48:29Z manolo $".
+// End of "$Id: Fl_Bitmap.cxx 10132 2014-04-28 09:17:12Z manolo $".
 //
 //

+ 5 - 4
fltk/src/Fl_Button.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Button.cxx 9637 2012-07-24 04:37:22Z matt $"
+// "$Id: Fl_Button.cxx 9855 2013-03-29 18:26:36Z greg.ercolano $"
 //
 //
 // Button widget for the Fast Light Tool Kit (FLTK).
 // Button widget for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -89,12 +89,12 @@ int Fl_Button::handle(int event) {
     return 1;
     return 1;
   case FL_PUSH:
   case FL_PUSH:
     if (Fl::visible_focus() && visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
     if (Fl::visible_focus() && visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
+    /* FALLTHROUGH */
   case FL_DRAG:
   case FL_DRAG:
     if (Fl::event_inside(this)) {
     if (Fl::event_inside(this)) {
       if (type() == FL_RADIO_BUTTON) newval = 1;
       if (type() == FL_RADIO_BUTTON) newval = 1;
       else newval = !oldval;
       else newval = !oldval;
-    } else
-    {
+    } else {
       clear_changed();
       clear_changed();
       newval = oldval;
       newval = oldval;
     }
     }
@@ -142,6 +142,7 @@ int Fl_Button::handle(int event) {
       } else redraw();
       } else redraw();
       return 1;
       return 1;
     } else return 0;
     } else return 0;
+    /* NOTREACHED */
   case FL_KEYBOARD :
   case FL_KEYBOARD :
     if (Fl::focus() == this && Fl::event_key() == ' ' &&
     if (Fl::focus() == this && Fl::event_key() == ' ' &&
         !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
         !(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
@@ -224,5 +225,5 @@ Fl_Toggle_Button::Fl_Toggle_Button(int X,int Y,int W,int H,const char *l)
 
 
 
 
 //
 //
-// End of "$Id: Fl_Button.cxx 9637 2012-07-24 04:37:22Z matt $".
+// End of "$Id: Fl_Button.cxx 9855 2013-03-29 18:26:36Z greg.ercolano $".
 //
 //

+ 399 - 0
fltk/src/Fl_Copy_Surface.cxx

@@ -0,0 +1,399 @@
+//
+// "$Id$"
+//
+// Copy-to-clipboard code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2014 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <FL/Fl_Copy_Surface.H>
+#include <FL/Fl.H>
+
+
+#if defined(__APPLE__)
+#include <ApplicationServices/ApplicationServices.h>
+#if defined(__ppc__)
+#include <QuickTime/QuickTimeComponents.h>
+#endif // __ppc__
+
+Fl_Quartz_Surface_::Fl_Quartz_Surface_(int w, int h) : Fl_System_Printer(), width(w), height(h) {
+}
+
+int Fl_Quartz_Surface_::printable_rect(int *w, int *h) {
+  *w = width;
+  *h = height;
+  return 0;
+}
+
+const char *Fl_Quartz_Surface_::class_id = "Fl_Quartz_Surface_";
+
+#elif defined(WIN32)
+
+Fl_GDI_Surface_::Fl_GDI_Surface_() : Fl_Paged_Device() {
+  driver(new Fl_GDI_Graphics_Driver);
+  depth = 0;
+}
+
+Fl_GDI_Surface_::~Fl_GDI_Surface_() {
+  delete driver();
+}
+
+void Fl_GDI_Surface_::translate(int x, int y) {
+  GetWindowOrgEx(fl_gc, origins+depth);
+  SetWindowOrgEx(fl_gc, origins[depth].x - x, origins[depth].y - y, NULL);
+  if (depth < sizeof(origins)/sizeof(POINT)) depth++;
+  else Fl::warning("Fl_GDI_Surface_: translate stack overflow!");
+}
+
+void Fl_GDI_Surface_::untranslate() {
+  if (depth > 0) depth--;
+  SetWindowOrgEx(fl_gc, origins[depth].x, origins[depth].y, NULL);
+}
+  
+const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_";
+
+#endif
+
+
+const char *Fl_Copy_Surface::class_id = "Fl_Copy_Surface";
+
+/** Constructor. 
+ \param w and \param h are the width and height of the clipboard surface
+ in pixels where drawing will occur.
+ */
+Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) :  Fl_Surface_Device(NULL)
+{
+  width = w;
+  height = h;
+#ifdef __APPLE__
+  helper = new Fl_Quartz_Surface_(width, height);
+  driver(helper->driver());
+  prepare_copy_pdf_and_tiff(w, h);
+  oldgc = fl_gc;
+#elif defined(WIN32)
+  helper = new Fl_GDI_Surface_();
+  driver(helper->driver());
+  oldgc = fl_gc;
+  // exact computation of factor from screen units to EnhMetaFile units (0.01 mm)
+  HDC hdc = GetDC(NULL);
+  int hmm = GetDeviceCaps(hdc, HORZSIZE);
+  int hdots = GetDeviceCaps(hdc, HORZRES);
+  int vmm = GetDeviceCaps(hdc, VERTSIZE);
+  int vdots = GetDeviceCaps(hdc, VERTRES);
+  ReleaseDC(NULL, hdc);
+  float factorw =  (100. * hmm) / hdots;
+  float factorh =  (100. * vmm) / vdots + 0.5;
+  
+  RECT rect; rect.left = 0; rect.top = 0; rect.right = w * factorw; rect.bottom = h * factorh;
+  gc = CreateEnhMetaFile (NULL, NULL, &rect, NULL);
+  if (gc != NULL) {
+    SetTextAlign(gc, TA_BASELINE|TA_LEFT);
+    SetBkMode(gc, TRANSPARENT);
+  } 
+#else // Xlib
+  helper = new Fl_Xlib_Surface_();
+  driver(helper->driver());
+  Fl::first_window()->make_current();
+  oldwindow = fl_xid(Fl::first_window());
+  xid = fl_create_offscreen(w,h);
+  Fl_Surface_Device *present_surface = Fl_Surface_Device::surface();
+  set_current();
+  fl_color(FL_WHITE);
+  fl_rectf(0, 0, w, h);
+  present_surface->set_current();
+#endif
+}
+
+/** Destructor.
+ */
+Fl_Copy_Surface::~Fl_Copy_Surface()
+{
+#ifdef __APPLE__
+  complete_copy_pdf_and_tiff();
+  fl_gc = oldgc;
+  delete (Fl_Quartz_Surface_*)helper;
+#elif defined(WIN32)
+  if(oldgc == fl_gc) oldgc = NULL;
+  HENHMETAFILE hmf = CloseEnhMetaFile (gc);
+  if ( hmf != NULL ) {
+    if ( OpenClipboard (NULL) ){
+      EmptyClipboard ();
+      SetClipboardData (CF_ENHMETAFILE, hmf);
+      CloseClipboard ();
+    }
+    DeleteEnhMetaFile(hmf);
+  }
+  DeleteDC(gc);
+  fl_gc = oldgc;
+  delete (Fl_GDI_Surface_*)helper;
+#else // Xlib
+  fl_pop_clip(); 
+  unsigned char *data = fl_read_image(NULL,0,0,width,height,0);
+  fl_window = oldwindow; 
+  _ss->set_current();
+  Fl::copy_image(data,width,height,1);
+  delete[] data;
+  fl_delete_offscreen(xid);
+  delete (Fl_Xlib_Surface_*)helper;
+#endif
+}
+
+/** Copies a widget in the clipboard
+ 
+ \param widget any FLTK widget (e.g., standard, custom, window, GL view) to copy
+ \param delta_x and \param delta_y give 
+ the position in the clipboard of the top-left corner of the widget
+ */
+void Fl_Copy_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y) 
+{
+  helper->print_widget(widget, delta_x, delta_y);
+}
+
+void Fl_Copy_Surface::set_current()
+{
+#if defined(__APPLE__) || defined(WIN32)
+  fl_gc = gc;
+  fl_window = (Window)1;
+  Fl_Surface_Device::set_current();
+#else
+  fl_window=xid; 
+  _ss = Fl_Surface_Device::surface(); 
+  Fl_Surface_Device::set_current();
+  fl_push_no_clip();
+#endif
+}
+
+
+#if defined(__APPLE__)
+
+size_t Fl_Copy_Surface::MyPutBytes(void* info, const void* buffer, size_t count)
+  {
+  CFDataAppendBytes ((CFMutableDataRef) info, (const UInt8 *)buffer, count);
+  return count;
+}
+
+void Fl_Copy_Surface::init_PDF_context(int w, int h)
+{
+  CGRect bounds = CGRectMake(0, 0, w, h );	
+  pdfdata = CFDataCreateMutable(NULL, 0);
+  CGDataConsumerRef myconsumer;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  if(CGDataConsumerCreateWithCFData != NULL) {
+    myconsumer = CGDataConsumerCreateWithCFData(pdfdata); // 10.4
+  }
+  else 
+#endif
+  {
+    static CGDataConsumerCallbacks callbacks = { Fl_Copy_Surface::MyPutBytes, NULL };
+    myconsumer = CGDataConsumerCreate ((void*) pdfdata, &callbacks);
+  }
+  gc = CGPDFContextCreate (myconsumer, &bounds, NULL);
+  CGDataConsumerRelease (myconsumer);
+}
+
+void Fl_Copy_Surface::prepare_copy_pdf_and_tiff(int w, int h)
+{
+  init_PDF_context(w, h);
+  if (gc == NULL) return;
+  CGRect bounds = CGRectMake(0, 0, w, h );	
+  CGContextBeginPage (gc, &bounds);
+  CGContextTranslateCTM(gc, 0, h);
+  CGContextScaleCTM(gc, 1.0f, -1.0f);
+  CGContextSaveGState(gc);
+}
+
+
+void Fl_Copy_Surface::complete_copy_pdf_and_tiff()
+{
+  CGContextRestoreGState(gc);
+  CGContextEndPage(gc);
+  CGContextRelease(gc);
+  PasteboardRef clipboard = NULL;
+  PasteboardCreate(kPasteboardClipboard, &clipboard);
+  PasteboardClear(clipboard); //	first, copy PDF to clipboard 
+  PasteboardPutItemFlavor (clipboard, (PasteboardItemID)1, 
+			   CFSTR("com.adobe.pdf"), // kUTTypePDF
+			   pdfdata, kPasteboardFlavorNoFlags);
+  //second, transform this PDF to a bitmap image and put it as tiff in clipboard
+  CGDataProviderRef prov;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1040
+  if(fl_mac_os_version >= 100400)
+    prov = CGDataProviderCreateWithCFData(pdfdata); // 10.4
+  else 
+#endif
+    prov = CGDataProviderCreateWithData(NULL, CFDataGetBytePtr(pdfdata), CFDataGetLength(pdfdata), NULL);
+  CGPDFDocumentRef pdfdoc = CGPDFDocumentCreateWithProvider(prov);
+  CGPDFPageRef pdfpage = CGPDFDocumentGetPage(pdfdoc, 1);
+  CGDataProviderRelease(prov);
+  CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB();
+  void *mem = ( fl_mac_os_version >= 100600 ? NULL : malloc(width * height * 4) );
+  gc = CGBitmapContextCreate(mem, width, height, 8, width * 4, space, kCGImageAlphaNoneSkipLast);
+  CFRelease(space);
+  if (gc == NULL) { if (mem) free(mem); return; }
+  CGRect rect = CGRectMake(0, 0, width, height);
+  CGContextSetRGBFillColor(gc,  1,1,1,1);//need to clear background
+  CGContextFillRect(gc, rect);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
+  CGContextDrawPDFPage(gc, pdfpage);  // requires 10.3
+#endif
+  CGPDFDocumentRelease(pdfdoc);
+  CFRelease(pdfdata);
+  PasteboardPutItemFlavor(clipboard, (PasteboardItemID)1, CFSTR("public.tiff"), 
+			  Fl_X::CGBitmapContextToTIFF(gc), kPasteboardFlavorNoFlags);
+  CFRelease(clipboard);    
+  CGContextRelease(gc);
+  if (mem) free(mem);
+}
+
+#endif  // __APPLE__
+
+#if !(defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN))
+/* graphics driver that translates all graphics coordinates before calling Xlib */
+class Fl_translated_Xlib_Graphics_Driver_ : public Fl_Xlib_Graphics_Driver {
+  int offset_x, offset_y; // translation between user and graphical coordinates: graphical = user + offset
+  unsigned depth; // depth of translation stack
+  int stack_x[20], stack_y[20]; // translation stack allowing cumulative translations
+public:
+  static const char *class_id;
+  const char *class_name() {return class_id;};
+  Fl_translated_Xlib_Graphics_Driver_() {
+    offset_x = 0; offset_y = 0;
+    depth = 0;
+    }
+  virtual ~Fl_translated_Xlib_Graphics_Driver_() {};
+  void translate_all(int dx, int dy) { // reversibly adds dx,dy to the offset between user and graphical coordinates
+    stack_x[depth] = offset_x;
+    stack_y[depth] = offset_y;
+    offset_x = stack_x[depth] + dx;
+    offset_y = stack_y[depth] + dy;
+    push_matrix();
+    translate(dx, dy);
+    if (depth < sizeof(stack_x)/sizeof(int)) depth++;
+    else Fl::warning("%s: translate stack overflow!", class_id);
+  }
+  void untranslate_all() { // undoes previous translate_all()
+    if (depth > 0) depth--;
+    offset_x = stack_x[depth];
+    offset_y = stack_y[depth];
+    pop_matrix();
+  }
+  void rect(int x, int y, int w, int h) { Fl_Xlib_Graphics_Driver::rect(x+offset_x, y+offset_y, w, h); }
+  void rectf(int x, int y, int w, int h) { Fl_Xlib_Graphics_Driver::rectf(x+offset_x, y+offset_y, w, h); }
+  void xyline(int x, int y, int x1) { Fl_Xlib_Graphics_Driver::xyline(x+offset_x, y+offset_y, x1+offset_x); }
+  void xyline(int x, int y, int x1, int y2) { Fl_Xlib_Graphics_Driver::xyline(x+offset_x, y+offset_y, x1+offset_x, y2+offset_y); }
+  void xyline(int x, int y, int x1, int y2, int x3) { Fl_Xlib_Graphics_Driver::xyline(x+offset_x, y+offset_y, x1+offset_x, y2+offset_y, x3+offset_x); }
+  void yxline(int x, int y, int y1) { Fl_Xlib_Graphics_Driver::yxline(x+offset_x, y+offset_y, y1+offset_y); }
+  void yxline(int x, int y, int y1, int x2) { Fl_Xlib_Graphics_Driver::yxline(x+offset_x, y+offset_y, y1+offset_y, x2+offset_x); }
+  void yxline(int x, int y, int y1, int x2, int y3) { Fl_Xlib_Graphics_Driver::yxline(x+offset_x, y+offset_y, y1+offset_y, x2+offset_x, y3+offset_y); }
+  void line(int x, int y, int x1, int y1) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y); }
+  void line(int x, int y, int x1, int y1, int x2, int y2) { Fl_Xlib_Graphics_Driver::line(x+offset_x, y+offset_y, x1+offset_x, y1+offset_y, x2+offset_x, y2+offset_y); }
+  void draw(const char* str, int n, int x, int y) { 
+    Fl_Xlib_Graphics_Driver::draw(str, n, x+offset_x, y+offset_y); 
+ }
+  void draw(int angle, const char *str, int n, int x, int y) { 
+    Fl_Xlib_Graphics_Driver::draw(angle, str, n, x+offset_x, y+offset_y); 
+  }
+  void rtl_draw(const char* str, int n, int x, int y) { 
+    Fl_Xlib_Graphics_Driver::rtl_draw(str, n, x+offset_x, y+offset_y); 
+  }
+  void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) { 
+    XP += offset_x; YP += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw(pxm, XP, YP, WP,HP,cx,cy); 
+    untranslate_all();
+  }
+  void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) { 
+    XP += offset_x; YP += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw(bm, XP, YP, WP,HP,cx,cy); 
+    untranslate_all();
+  }
+  void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy) { 
+    XP += offset_x; YP += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw(img, XP, YP, WP,HP,cx,cy); 
+    untranslate_all();
+  }
+  void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) { 
+    X += offset_x; Y += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw_image(buf, X, Y, W,H,D,L); 
+    untranslate_all();
+  }
+  void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) { 
+    X += offset_x; Y += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw_image(cb, data, X, Y, W,H,D); 
+    untranslate_all();
+  }
+  void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) { 
+    X += offset_x; Y += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw_image_mono(buf, X, Y, W,H,D,L); 
+    untranslate_all();
+  }
+  void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) { 
+    X += offset_x; Y += offset_y;
+    translate_all(-offset_x, -offset_y);
+    Fl_Xlib_Graphics_Driver::draw_image_mono(cb, data, X, Y, W,H,D); 
+    untranslate_all();
+  }
+  void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) { 
+    Fl_Xlib_Graphics_Driver::copy_offscreen(x+offset_x, y+offset_y, w, h,pixmap,srcx,srcy); 
+  }
+  void push_clip(int x, int y, int w, int h) {
+    Fl_Xlib_Graphics_Driver::push_clip(x+offset_x, y+offset_y, w, h); 
+  }
+  int not_clipped(int x, int y, int w, int h) { return Fl_Xlib_Graphics_Driver::not_clipped(x + offset_x, y + offset_y, w, h); };
+  int clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H) { 
+    int retval = Fl_Xlib_Graphics_Driver::clip_box(x + offset_x, y + offset_y, w,h,X,Y,W,H);
+    X -= offset_x;
+    Y -= offset_y;
+    return retval;
+  }
+  void pie(int x, int y, int w, int h, double a1, double a2) { Fl_Xlib_Graphics_Driver::pie(x+offset_x,y+offset_y,w,h,a1,a2); }
+  void arc(int x, int y, int w, int h, double a1, double a2) { Fl_Xlib_Graphics_Driver::arc(x+offset_x,y+offset_y,w,h,a1,a2); }
+  void polygon(int x0, int y0, int x1, int y1, int x2, int y2) { Fl_Xlib_Graphics_Driver::polygon(x0+offset_x,y0+offset_y,x1+offset_x,y1+offset_y,x2+offset_x,y2+offset_y);}
+  void polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+    Fl_Xlib_Graphics_Driver::polygon(x0+offset_x,y0+offset_y,x1+offset_x,y1+offset_y,x2+offset_x,y2+offset_y,x3+offset_x,y3+offset_y);
+  }
+  void loop(int x0, int y0, int x1, int y1, int x2, int y2) {Fl_Xlib_Graphics_Driver::loop(x0+offset_x,y0+offset_y,x1+offset_x,y1+offset_y,x2+offset_x,y2+offset_y);}
+  void loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+    Fl_Xlib_Graphics_Driver::loop(x0+offset_x,y0+offset_y,x1+offset_x,y1+offset_y,x2+offset_x,y2+offset_y,x3+offset_x,y3+offset_y);
+  }
+  void point(int x, int y) { Fl_Xlib_Graphics_Driver::point(x+offset_x, y+offset_y); }
+};
+
+const char *Fl_translated_Xlib_Graphics_Driver_::class_id = "Fl_translated_Xlib_Graphics_Driver_";
+
+void Fl_Xlib_Surface_::translate(int x, int y) { 
+  ((Fl_translated_Xlib_Graphics_Driver_*)driver())->translate_all(x, y); 
+}
+void Fl_Xlib_Surface_::untranslate() { 
+  ((Fl_translated_Xlib_Graphics_Driver_*)driver())->untranslate_all(); 
+}
+
+Fl_Xlib_Surface_::Fl_Xlib_Surface_() : Fl_Paged_Device() {
+  driver(new Fl_translated_Xlib_Graphics_Driver_());
+}
+Fl_Xlib_Surface_::~Fl_Xlib_Surface_() {
+  delete driver();
+}
+
+const char *Fl_Xlib_Surface_::class_id = "Fl_Xlib_Surface_";
+
+#endif
+
+//
+// End of "$Id$".
+//

+ 6 - 4
fltk/src/Fl_Double_Window.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Double_Window.cxx 9706 2012-11-06 20:46:14Z matt $"
+// "$Id: Fl_Double_Window.cxx 10155 2014-05-21 14:12:04Z manolo $"
 //
 //
 // Double-buffered window code for the Fast Light Tool Kit (FLTK).
 // Double-buffered window code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -218,8 +218,9 @@ void Fl_GDI_Graphics_Driver::copy_offscreen_with_alpha(int x,int y,int w,int h,H
   BOOL alpha_ok = 0;
   BOOL alpha_ok = 0;
   // first try to alpha blend
   // first try to alpha blend
   // if to printer, always try alpha_blend
   // if to printer, always try alpha_blend
-  if ( Fl_Surface_Device::surface() != Fl_Display_Device::display_device() || fl_can_do_alpha_blending() ) {
-    if (fl_alpha_blend) alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc);
+  if ( (fl_graphics_driver->class_name() == Fl_GDI_Printer_Graphics_Driver::class_id && fl_alpha_blend) ||
+      (Fl_Surface_Device::surface() == Fl_Display_Device::display_device() && fl_can_do_alpha_blending() ) ) {
+    alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc);
   }
   }
   // if that failed (it shouldn't), still copy the bitmap over, but now alpha is 1
   // if that failed (it shouldn't), still copy the bitmap over, but now alpha is 1
   if (!alpha_ok) {
   if (!alpha_ok) {
@@ -369,6 +370,7 @@ void Fl_Double_Window::flush() {flush(0);}
   and leaving the clip region set to the entire window.
   and leaving the clip region set to the entire window.
 */
 */
 void Fl_Double_Window::flush(int eraseoverlay) {
 void Fl_Double_Window::flush(int eraseoverlay) {
+  if (!shown()) return;
   make_current(); // make sure fl_gc is non-zero
   make_current(); // make sure fl_gc is non-zero
   Fl_X *myi = Fl_X::i(this);
   Fl_X *myi = Fl_X::i(this);
   if (!myi) return; // window not yet created
   if (!myi) return; // window not yet created
@@ -514,5 +516,5 @@ Fl_Overlay_Window::Fl_Overlay_Window(int X, int Y, int W, int H, const char *l)
 
 
   
   
 //
 //
-// End of "$Id: Fl_Double_Window.cxx 9719 2012-11-13 14:45:42Z manolo $".
+// End of "$Id: Fl_Double_Window.cxx 10155 2014-05-21 14:12:04Z manolo $".
 //
 //

+ 111 - 5
fltk/src/Fl_File_Browser.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_File_Browser.cxx 9325 2012-04-05 05:12:30Z fabien $"
+// "$Id: Fl_File_Browser.cxx 10145 2014-05-04 13:46:09Z manolo $"
 //
 //
 // Fl_File_Browser routines.
 // Fl_File_Browser routines.
 //
 //
@@ -61,6 +61,33 @@
 #  include <sys/ucred.h>
 #  include <sys/ucred.h>
 #  include <sys/mount.h>
 #  include <sys/mount.h>
 #endif // __APPLE__
 #endif // __APPLE__
+
+#if defined(_AIX)
+extern "C" {
+#  include <sys/types.h>
+#  include <sys/vmount.h>
+#  include <sys/mntctl.h>
+  // Older AIX versions don't expose this prototype
+  int
+  mntctl(int, int, char *);
+}
+#endif  // _AIX
+
+#if defined(__NetBSD__)
+extern "C" {
+#  include <sys/param.h>  // For '__NetBSD_Version__' definition
+#  if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 300000000)
+#    include <sys/types.h>
+#    include <sys/statvfs.h>
+#    if defined(HAVE_PTHREAD) && defined(HAVE_PTHREAD_H)
+#      include <pthread.h>
+#    endif  // HAVE_PTHREAD && HAVE_PTHREAD_H
+#    ifdef HAVE_PTHREAD
+  static pthread_mutex_t getvfsstat_mutex = PTHREAD_MUTEX_INITIALIZER;
+#    endif  // HAVE_PTHREAD/
+#  endif  // __NetBSD_Version__
+}
+#endif  // __NetBSD__
 
 
 //
 //
 // FL_BLINE definition from "Fl_Browser.cxx"...
 // FL_BLINE definition from "Fl_Browser.cxx"...
@@ -349,7 +376,7 @@ Fl_File_Browser::item_draw(void *p,	// I - List item data
       if (columns)
       if (columns)
       {
       {
         // Try clipping inside this column...
         // Try clipping inside this column...
-	for (i = 0; i < column && columns[i]; i ++);
+	for (i = 0; i < column && columns[i]; i ++) { ; }
 
 
         if (columns[i])
         if (columns[i])
           cW = columns[i];
           cW = columns[i];
@@ -522,6 +549,77 @@ Fl_File_Browser::load(const char     *directory,// I - Directory to load
       // Free the memory used for the file system info array...
       // Free the memory used for the file system info array...
       delete[] fs;
       delete[] fs;
     }
     }
+#elif defined(_AIX)
+    // AIX don't write the mounted filesystems to a file like '/etc/mnttab'.
+    // But reading the list of mounted filesystems from the kernel is possible:
+    // http://publib.boulder.ibm.com/infocenter/pseries/v5r3/topic/com.ibm.aix.basetechref/doc/basetrf1/mntctl.htm
+    int res = -1, len;
+    char *list = NULL, *name;
+    struct vmount *vp;
+
+    // We always have the root filesystem
+    add("/", icon);
+    // Get the required buffer size for the vmount structures
+    res = mntctl(MCTL_QUERY, sizeof(len), (char *) &len);
+    if (!res) {
+      // Allocate buffer ...
+      list = (char *) malloc((size_t) len);
+      if (NULL == list) {
+        res = -1;
+      } else {
+        // ... and read vmount structures from kernel
+        res = mntctl(MCTL_QUERY, len, list);
+        if (0 >= res) {
+          res = -1;
+        } else {
+          for (i = 0, vp = (struct vmount *) list; i < res; ++i) {
+            name = (char *) vp + vp->vmt_data[VMT_STUB].vmt_off;
+            strlcpy(filename, name, sizeof(filename));
+            // Skip the already added root filesystem
+            if (strcmp("/", filename) != 0) {
+              strlcat(filename, "/", sizeof(filename));
+              add(filename, icon);
+            }
+            vp = (struct vmount *) ((char *) vp + vp->vmt_length);
+          }
+        }
+      }
+    }
+    // Note: Executing 'free(NULL)' is allowed and simply do nothing
+    free((void *) list);
+#elif defined(__NetBSD__) && defined(__NetBSD_Version__) \
+      && (__NetBSD_Version__ >= 300000000)
+    // NetBSD don't write the mounted filesystems to a file like '/etc/mnttab'.
+    // Since NetBSD 3.0 the system call getvfsstat(2) has replaced getfsstat(2)
+    // that is used by getmntinfo(3):
+    // http://www.daemon-systems.org/man/getmntinfo.3.html
+    int res = -1;
+    struct statvfs *list;
+
+    // We always have the root filesystem
+    add("/", icon);
+#  ifdef HAVE_PTHREAD
+    // Lock mutex for thread safety
+    if (!pthread_mutex_lock(&getvfsstat_mutex)) {
+#  endif  // HAVE_PTHREAD
+      // Get list of statvfs structures
+      res = getmntinfo(&list, ST_WAIT);
+      if(0 < res) {
+        for (i = 0;  i < res; ++i) {
+          strlcpy(filename, list[i].f_mntonname, sizeof(filename));
+          // Skip the already added root filesystem
+          if (strcmp("/", filename) != 0) {
+            strlcat(filename, "/", sizeof(filename));
+            add(filename, icon);
+          }
+        }
+      } else {
+         res = -1;
+      }
+#  ifdef HAVE_PTHREAD
+      pthread_mutex_unlock(&getvfsstat_mutex);
+    }
+#  endif  // HAVE_PTHREAD
 #else
 #else
     //
     //
     // UNIX code uses /etc/fstab or similar...
     // UNIX code uses /etc/fstab or similar...
@@ -550,7 +648,10 @@ Fl_File_Browser::load(const char     *directory,// I - Directory to load
         if (sscanf(line, "%*s%4095s", filename) != 1)
         if (sscanf(line, "%*s%4095s", filename) != 1)
 	  continue;
 	  continue;
 
 
-        strlcat(filename, "/", sizeof(filename));
+        // Add a trailing slash (except for the root filesystem)
+        if (strcmp("/", filename) != 0) {
+          strlcat(filename, "/", sizeof(filename));
+        }
 
 
 //        printf("Fl_File_Browser::load() - adding \"%s\" to list...\n", filename);
 //        printf("Fl_File_Browser::load() - adding \"%s\" to list...\n", filename);
         add(filename, icon);
         add(filename, icon);
@@ -558,8 +659,13 @@ Fl_File_Browser::load(const char     *directory,// I - Directory to load
       }
       }
 
 
       fclose(mtab);
       fclose(mtab);
+    } else {
+      // Every Unix has a root filesystem '/'.
+      // This last stage fallback ensures that the user don't get an empty
+      // window after requesting filesystem list.
+      add("/", icon);
     }
     }
-#endif // WIN32 || __EMX__
+#endif // WIN32 || __EMX__ || __APPLE__ || _AIX || ...
   }
   }
   else
   else
   {
   {
@@ -630,5 +736,5 @@ Fl_File_Browser::filter(const char *pattern)	// I - Pattern string
 
 
 
 
 //
 //
-// End of "$Id: Fl_File_Browser.cxx 9325 2012-04-05 05:12:30Z fabien $".
+// End of "$Id: Fl_File_Browser.cxx 10145 2014-05-04 13:46:09Z manolo $".
 //
 //

+ 11 - 2
fltk/src/Fl_File_Chooser2.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_File_Chooser2.cxx 9704 2012-10-19 11:23:51Z manolo $"
+// "$Id: Fl_File_Chooser2.cxx 10004 2013-10-21 04:58:43Z greg.ercolano $"
 //
 //
 // More Fl_File_Chooser routines.
 // More Fl_File_Chooser routines.
 //
 //
@@ -1423,6 +1423,15 @@ Fl_File_Chooser::update_preview()
       previewBox->labelsize(size);
       previewBox->labelsize(size);
       previewBox->labelfont(FL_COURIER);
       previewBox->labelfont(FL_COURIER);
     }
     }
+  } else if (image && ( (image->w() <= 0) ||
+                        (image->h() <= 0) ||
+                        (image->d() <= 0) )) {
+    // Image has errors? Show big 'X'
+    previewBox->label("X");
+    previewBox->align(FL_ALIGN_CLIP);
+    previewBox->labelsize(70);
+    previewBox->labelfont(FL_HELVETICA);
+    previewBox->redraw();
   } else if (image) {
   } else if (image) {
     pbw = previewBox->w() - 20;
     pbw = previewBox->w() - 20;
     pbh = previewBox->h() - 20;
     pbh = previewBox->h() - 20;
@@ -1696,5 +1705,5 @@ unquote_pathname(char       *dst,	// O - Destination string
 
 
 
 
 //
 //
-// End of "$Id: Fl_File_Chooser2.cxx 9704 2012-10-19 11:23:51Z manolo $".
+// End of "$Id: Fl_File_Chooser2.cxx 10004 2013-10-21 04:58:43Z greg.ercolano $".
 //
 //

+ 10 - 5
fltk/src/Fl_File_Icon2.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_File_Icon2.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_File_Icon2.cxx 10140 2014-05-01 15:55:03Z manolo $"
 //
 //
 // Fl_File_Icon system icon routines.
 // Fl_File_Icon system icon routines.
 //
 //
@@ -570,9 +570,14 @@ int Fl_File_Icon::load_image(const char *ifile)	// I - File to read from
   img->release();
   img->release();
 
 
 #ifdef DEBUG
 #ifdef DEBUG
-  printf("Icon File \"%s\":\n", xpm);
+{
+  int i;
+  printf("Icon File \"%s\":\n", ifile);
   for (i = 0; i < num_data_; i ++)
   for (i = 0; i < num_data_; i ++)
+  {
     printf("    %d,\n", data_[i]);
     printf("    %d,\n", data_[i]);
+  }
+}
 #endif // DEBUG
 #endif // DEBUG
 
 
   return 0;
   return 0;
@@ -582,7 +587,7 @@ int Fl_File_Icon::load_image(const char *ifile)	// I - File to read from
 /**
 /**
   Loads all system-defined icons. This call is useful when using the
   Loads all system-defined icons. This call is useful when using the
   FileChooser widget and should be used when the application starts:
   FileChooser widget and should be used when the application starts:
-  
+
   \code
   \code
   Fl_File_Icon::load_system_icons();
   Fl_File_Icon::load_system_icons();
   \endcode
   \endcode
@@ -616,7 +621,7 @@ Fl_File_Icon::load_system_icons(void) {
 		  VERTEX, 7000, 5000, END, LINE, VERTEX, 3000, 4000,
 		  VERTEX, 7000, 5000, END, LINE, VERTEX, 3000, 4000,
 		  VERTEX, 7000, 4000, END, LINE, VERTEX, 3000, 3000,
 		  VERTEX, 7000, 4000, END, LINE, VERTEX, 3000, 3000,
 		  VERTEX, 7000, 3000, END, LINE, VERTEX, 3000, 2000,
 		  VERTEX, 7000, 3000, END, LINE, VERTEX, 3000, 2000,
-		  VERTEX, 7000, 2000, END, 
+		  VERTEX, 7000, 2000, END,
 		  END
 		  END
 		};
 		};
   static short	image[] = {	// Image file icon
   static short	image[] = {	// Image file icon
@@ -1009,5 +1014,5 @@ get_kde_val(char       *str,
 
 
 
 
 //
 //
-// End of "$Id: Fl_File_Icon2.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_File_Icon2.cxx 10140 2014-05-01 15:55:03Z manolo $".
 //
 //

+ 2 - 3
fltk/src/Fl_Font.H

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Font.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Font.H 10011 2013-10-29 12:46:51Z manolo $"
 //
 //
 // Font definitions for the Fast Light Tool Kit (FLTK).
 // Font definitions for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -60,7 +60,6 @@ public:
 #     endif
 #     endif
   ATSUStyle style;
   ATSUStyle style;
   short ascent, descent, q_width;
   short ascent, descent, q_width;
-  char *q_name;
 #  elif USE_XFT
 #  elif USE_XFT
   XftFont* font;
   XftFont* font;
   //const char* encoding;
   //const char* encoding;
@@ -105,5 +104,5 @@ FL_EXPORT char *fl_find_fontsize(char *name);
 #endif
 #endif
 
 
 //
 //
-// End of "$Id: Fl_Font.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Font.H 10011 2013-10-29 12:46:51Z manolo $".
 //
 //

+ 7 - 3
fltk/src/Fl_GDI_Printer.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_GDI_Printer.cxx 9325 2012-04-05 05:12:30Z fabien $"
+// "$Id: Fl_GDI_Printer.cxx 9917 2013-05-15 13:42:19Z manolo $"
 //
 //
 // Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
 // Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -148,8 +148,11 @@ void Fl_System_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
 {
 {
   POINT         physPageSize;
   POINT         physPageSize;
   POINT         pixelsPerInch;
   POINT         pixelsPerInch;
-
+  XFORM		transform;
+    
   if (hPr == NULL) return;
   if (hPr == NULL) return;
+  GetWorldTransform(fl_gc, &transform);
+  ModifyWorldTransform(fl_gc, NULL, MWT_IDENTITY);
   SetWindowOrgEx(fl_gc, 0, 0, NULL);
   SetWindowOrgEx(fl_gc, 0, 0, NULL);
 
 
   physPageSize.x = GetDeviceCaps(hPr, HORZRES);
   physPageSize.x = GetDeviceCaps(hPr, HORZRES);
@@ -168,6 +171,7 @@ void Fl_System_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
   *x = left_margin;
   *x = left_margin;
   *y = top_margin;
   *y = top_margin;
   origin(x_offset, y_offset);
   origin(x_offset, y_offset);
+  SetWorldTransform(fl_gc, &transform);
 }
 }
 
 
 void Fl_System_Printer::margins(int *left, int *top, int *right, int *bottom)
 void Fl_System_Printer::margins(int *left, int *top, int *right, int *bottom)
@@ -289,5 +293,5 @@ void Fl_System_Printer::untranslate (void)
 #endif // WIN32
 #endif // WIN32
 
 
 //
 //
-// End of "$Id: Fl_GDI_Printer.cxx 9325 2012-04-05 05:12:30Z fabien $".
+// End of "$Id: Fl_GDI_Printer.cxx 9917 2013-05-15 13:42:19Z manolo $".
 //
 //

+ 6 - 31
fltk/src/Fl_Gl_Device_Plugin.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Gl_Device_Plugin.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Gl_Device_Plugin.cxx 10051 2014-01-10 16:50:55Z manolo $"
 //
 //
 // implementation of class Fl_Gl_Device_Plugin for the Fast Light Tool Kit (FLTK).
 // implementation of class Fl_Gl_Device_Plugin for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -34,33 +34,12 @@ static void imgProviderReleaseData (void *info, const void *data, size_t size)
 
 
 static void print_gl_window(Fl_Gl_Window *glw, int x, int y, int height)
 static void print_gl_window(Fl_Gl_Window *glw, int x, int y, int height)
 {
 {
-#ifdef WIN32
-  HDC save_gc = fl_gc;
-  const int bytesperpixel = 3;
-#elif defined(__APPLE__)
-  CGContextRef save_gc = fl_gc;
+#if defined(__APPLE__)
   const int bytesperpixel = 4;
   const int bytesperpixel = 4;
 #else
 #else
-  _XGC *save_gc = fl_gc;
   const int bytesperpixel = 3;
   const int bytesperpixel = 3;
 #endif
 #endif
-  Fl_Surface_Device *save_surface = Fl_Surface_Device::surface();
-  fl_gc = NULL;
-  Fl_Display_Device::display_device()->set_current();
-#ifdef WIN32
-  Fl::check();
-  Fl_Window *win = (Fl_Window*)glw;
-  while( win->window() ) win = win->window();
-  win->redraw();
-  Fl::check();
-  glw->make_current();
-#else
-  glw->make_current();
-  glw->redraw();
-  glFlush();
-  Fl::check();
-  glFinish();
-#endif
+  glw->flush(); // forces a GL redraw necessary for the glpuzzle demo
   // Read OpenGL context pixels directly.
   // Read OpenGL context pixels directly.
   // For extra safety, save & restore OpenGL states that are changed
   // For extra safety, save & restore OpenGL states that are changed
   glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
   glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
@@ -73,17 +52,13 @@ static void print_gl_window(Fl_Gl_Window *glw, int x, int y, int height)
   mByteWidth = (mByteWidth + 3) & ~3;    // Align to 4 bytes
   mByteWidth = (mByteWidth + 3) & ~3;    // Align to 4 bytes
   uchar *baseAddress = (uchar*)malloc(mByteWidth * glw->h());
   uchar *baseAddress = (uchar*)malloc(mByteWidth * glw->h());
   glReadPixels(0, 0, glw->w(), glw->h(), 
   glReadPixels(0, 0, glw->w(), glw->h(), 
-#ifdef WIN32
-	       GL_RGB, GL_UNSIGNED_BYTE,
-#elif defined(__APPLE__)
+#if defined(__APPLE__)
 	       GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
 	       GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
-#else // FIXME Linux/Unix
+#else
 	       GL_RGB, GL_UNSIGNED_BYTE,
 	       GL_RGB, GL_UNSIGNED_BYTE,
 #endif
 #endif
 	       baseAddress);
 	       baseAddress);
   glPopClientAttrib();
   glPopClientAttrib();
-  save_surface->set_current();
-  fl_gc = save_gc;
 #if defined(__APPLE__)
 #if defined(__APPLE__)
 // kCGBitmapByteOrder32Host and CGBitmapInfo are supposed to arrive with 10.4
 // kCGBitmapByteOrder32Host and CGBitmapInfo are supposed to arrive with 10.4
 // but some 10.4 don't have kCGBitmapByteOrder32Host, so we play a little #define game
 // but some 10.4 don't have kCGBitmapByteOrder32Host, so we play a little #define game
@@ -143,5 +118,5 @@ static Fl_Gl_Device_Plugin Gl_Device_Plugin;
 FL_EXPORT int fl_gl_load_plugin = 0;
 FL_EXPORT int fl_gl_load_plugin = 0;
 
 
 //
 //
-// End of "$Id: Fl_Gl_Device_Plugin.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Gl_Device_Plugin.cxx 10051 2014-01-10 16:50:55Z manolo $".
 //
 //

+ 40 - 10
fltk/src/Fl_Gl_Window.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Gl_Window.cxx 9264 2012-03-05 08:46:30Z manolo $"
+// "$Id: Fl_Gl_Window.cxx 10095 2014-02-07 00:09:52Z AlbrechtS $"
 //
 //
 // OpenGL window code for the Fast Light Tool Kit (FLTK).
 // OpenGL window code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -24,8 +24,6 @@ extern int fl_gl_load_plugin;
 extern void gl_texture_reset();
 extern void gl_texture_reset();
 #endif
 #endif
 
 
-static int temp = fl_gl_load_plugin;
-
 #include <FL/Fl.H>
 #include <FL/Fl.H>
 #include <FL/x.H>
 #include <FL/x.H>
 #ifdef __APPLE__
 #ifdef __APPLE__
@@ -183,8 +181,10 @@ void Fl_Gl_Window::make_current() {
   GLint xywh[4];
   GLint xywh[4];
 
 
   if (window()) {
   if (window()) {
-    xywh[0] = x();
-    xywh[1] = window()->h() - y() - h();
+    int xoff,yoff;
+    const Fl_Window *win = top_window_offset(xoff, yoff);	// STR #2944 [2]
+    xywh[0] = xoff;
+    xywh[1] = win->h() - yoff - h();
   } else {
   } else {
     xywh[0] = 0;
     xywh[0] = 0;
     xywh[1] = 0;
     xywh[1] = 0;
@@ -249,10 +249,34 @@ void Fl_Gl_Window::swap_buffers() {
 #  endif
 #  endif
 #elif defined(__APPLE_QUARTZ__)
 #elif defined(__APPLE_QUARTZ__)
   if(overlay != NULL) {
   if(overlay != NULL) {
-    //aglSwapBuffers does not work well with overlays under cocoa
-    glReadBuffer(GL_BACK);
-    glDrawBuffer(GL_FRONT);
-    glCopyPixels(0,0,w(),h(),GL_COLOR);
+    // STR# 2944 [1]
+    //    Save matrixmode/proj/modelview/rasterpos before doing overlay.
+    //
+    int wo=w(), ho=h();
+    GLint matrixmode;
+    GLfloat pos[4];
+    glGetIntegerv(GL_MATRIX_MODE, &matrixmode);
+    glGetFloatv(GL_CURRENT_RASTER_POSITION, pos);       // save original glRasterPos
+    glMatrixMode(GL_PROJECTION);			// save proj/model matrices
+    glPushMatrix();
+      glLoadIdentity();
+      glMatrixMode(GL_MODELVIEW);
+      glPushMatrix();
+        glLoadIdentity();
+        glScalef(2.0f/wo, 2.0f/ho, 1.0f);
+        glTranslatef(-wo/2.0f, -ho/2.0f, 0.0f);         // set transform so 0,0 is bottom/left of Gl_Window
+        glRasterPos2i(0,0);                             // set glRasterPos to bottom left corner
+        {
+          // Emulate overlay by doing copypixels
+          glReadBuffer(GL_BACK);
+          glDrawBuffer(GL_FRONT);
+          glCopyPixels(0, 0, wo, ho, GL_COLOR);         // copy GL_BACK to GL_FRONT
+        }
+        glPopMatrix(); // GL_MODELVIEW                  // restore model/proj matrices
+      glMatrixMode(GL_PROJECTION);
+      glPopMatrix();
+    glMatrixMode(matrixmode);
+    glRasterPos3f(pos[0], pos[1], pos[2]);              // restore original glRasterPos
   }
   }
   else
   else
     aglSwapBuffers((AGLContext)context_);
     aglSwapBuffers((AGLContext)context_);
@@ -268,6 +292,7 @@ int fl_overlay_depth = 0;
 
 
 
 
 void Fl_Gl_Window::flush() {
 void Fl_Gl_Window::flush() {
+  if (!shown()) return;
   uchar save_valid = valid_f_ & 1;
   uchar save_valid = valid_f_ & 1;
 #if HAVE_GL_OVERLAY && defined(WIN32)
 #if HAVE_GL_OVERLAY && defined(WIN32)
   uchar save_valid_f = valid_f_;
   uchar save_valid_f = valid_f_;
@@ -549,6 +574,11 @@ int Fl_Gl_Window::handle(int event)
   return Fl_Window::handle(event);
   return Fl_Window::handle(event);
 }
 }
 
 
+// don't remove me! this serves only to force linking of Fl_Gl_Device_Plugin.o
+int Fl_Gl_Window::gl_plugin_linkage() {
+  return fl_gl_load_plugin;
+}
+
 //
 //
-// End of "$Id: Fl_Gl_Window.cxx 9264 2012-03-05 08:46:30Z manolo $".
+// End of "$Id: Fl_Gl_Window.cxx 10095 2014-02-07 00:09:52Z AlbrechtS $".
 //
 //

+ 18 - 3
fltk/src/Fl_Image.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Image.cxx 9795 2013-01-16 08:45:35Z manolo $"
+// "$Id: Fl_Image.cxx 10192 2014-06-12 13:28:04Z ossman $"
 //
 //
 // Image drawing code for the Fast Light Tool Kit (FLTK).
 // Image drawing code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -165,7 +165,22 @@ Fl_Image::measure(const Fl_Label *lo,		// I - Label
 //
 //
 size_t Fl_RGB_Image::max_size_ = ~((size_t)0);
 size_t Fl_RGB_Image::max_size_ = ~((size_t)0);
 
 
-/**  The destructor free all memory and server resources that are used by  the image. */
+int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg);
+
+/** The constructor creates a new RGBA image from the specified Fl_Pixmap. 
+ 
+ The RGBA image is built fully opaque except for the transparent area
+ of the pixmap that is assigned the \par bg color with full transparency */
+Fl_RGB_Image::Fl_RGB_Image(const Fl_Pixmap *pxm, Fl_Color bg):
+  Fl_Image(pxm->w(), pxm->h(), 4), id_(0), mask_(0)
+{
+  array = new uchar[w() * h() * d()];
+  alloc_array = 1;
+  fl_convert_pixmap(pxm->data(), (uchar*)array, bg);
+  data((const char **)&array, 1);
+}
+
+/**  The destructor frees all memory and server resources that are used by the image. */
 Fl_RGB_Image::~Fl_RGB_Image() {
 Fl_RGB_Image::~Fl_RGB_Image() {
   uncache();
   uncache();
   if (alloc_array) delete[] (uchar *)array;
   if (alloc_array) delete[] (uchar *)array;
@@ -601,5 +616,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
 
 
 
 
 //
 //
-// End of "$Id: Fl_Image.cxx 9795 2013-01-16 08:45:35Z manolo $".
+// End of "$Id: Fl_Image.cxx 10192 2014-06-12 13:28:04Z ossman $".
 //
 //

+ 158 - 0
fltk/src/Fl_Image_Surface.cxx

@@ -0,0 +1,158 @@
+//
+// "$Id: Fl_Image_Surface.cxx 10171 2014-05-24 16:19:30Z manolo $"
+//
+// Draw-to-image code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2014 by Bill Spitzak and others.
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <FL/Fl_Image_Surface.H>
+#include <FL/Fl_Printer.H>
+#include <FL/Fl.H>
+
+
+const char *Fl_Image_Surface::class_id = "Fl_Image_Surface";
+
+/** The constructor.
+ \param w and \param h give the size in pixels of the resulting image.
+ */
+Fl_Image_Surface::Fl_Image_Surface(int w, int h) : Fl_Surface_Device(NULL) {
+  width = w;
+  height = h;
+#if !(defined(__APPLE__) || defined(WIN32))
+  gc = 0;
+  if (!fl_display) { // allows use of this class before any window is shown
+    fl_open_display();
+    gc = XCreateGC(fl_display, RootWindow(fl_display, fl_screen), 0, 0);
+    fl_gc = gc;
+    }
+#endif
+  offscreen = fl_create_offscreen(w, h);
+#ifdef __APPLE__
+  helper = new Fl_Quartz_Flipped_Surface_(width, height);
+  driver(helper->driver());
+#elif defined(WIN32)
+  helper = new Fl_GDI_Surface_();
+  driver(helper->driver());
+#else
+  helper = new Fl_Xlib_Surface_();
+  driver(helper->driver());
+#endif
+}
+
+/** The destructor.
+ */
+Fl_Image_Surface::~Fl_Image_Surface() {
+  fl_delete_offscreen(offscreen);
+#ifdef __APPLE__
+  delete (Fl_Quartz_Flipped_Surface_*)helper;
+#elif defined(WIN32)
+  delete (Fl_GDI_Surface_*)helper;
+#else
+  if (gc) { XFreeGC(fl_display, gc); fl_gc = 0; }
+  delete (Fl_Xlib_Surface_*)helper;
+#endif
+}
+
+/** Returns the image made of all drawings sent to the Fl_Image_Surface object.
+ The returned object can be safely cast to Fl_RGB_Image* and contains its own copy
+ of the RGB data.
+ */
+Fl_Image* Fl_Image_Surface::image()
+{
+  unsigned char *data;
+#ifdef __APPLE__
+  CGContextFlush(offscreen);
+  data = fl_read_image(NULL, 0, 0, width, height, 0);
+  fl_end_offscreen();
+#elif defined(WIN32)
+  fl_pop_clip(); 
+  data = fl_read_image(NULL, 0, 0, width, height, 0);
+  RestoreDC(fl_gc, _savedc); 
+  DeleteDC(fl_gc); 
+  _ss->set_current(); 
+  fl_window=_sw; 
+  fl_gc = _sgc;
+#else
+  fl_pop_clip(); 
+  data = fl_read_image(NULL, 0, 0, width, height, 0);
+  fl_window = pre_window; 
+  previous->set_current();
+#endif
+  Fl_RGB_Image *image = new Fl_RGB_Image(data, width, height);
+  image->alloc_array = 1;
+  return image;
+}
+
+/** Draws a widget in the image surface
+ 
+ \param widget any FLTK widget (e.g., standard, custom, window, GL view) to draw in the image
+ \param delta_x and \param delta_y give 
+ the position in the image of the top-left corner of the widget
+ */
+void Fl_Image_Surface::draw(Fl_Widget *widget, int delta_x, int delta_y)
+{
+  helper->print_widget(widget, delta_x, delta_y);
+}
+
+
+void Fl_Image_Surface::set_current()
+{
+#if defined(__APPLE__)
+  fl_begin_offscreen(offscreen);
+  fl_pop_clip();
+  Fl_Surface_Device::set_current(); 
+  fl_push_no_clip();
+#elif defined(WIN32)
+  _sgc=fl_gc; 
+  _sw=fl_window;
+  _ss = Fl_Surface_Device::surface(); 
+  Fl_Surface_Device::set_current();
+  fl_gc = fl_makeDC(offscreen); 
+   _savedc = SaveDC(fl_gc); 
+  fl_window=(HWND)offscreen; 
+  fl_push_no_clip();
+#else
+  pre_window = fl_window; 
+  fl_window = offscreen; 
+  previous = Fl_Surface_Device::surface(); 
+  Fl_Surface_Device::set_current();
+  fl_push_no_clip();
+#endif
+}
+
+#if defined(__APPLE__)
+
+Fl_Quartz_Flipped_Surface_::Fl_Quartz_Flipped_Surface_(int w, int h) : Fl_Quartz_Surface_(w, h) {
+}
+
+void Fl_Quartz_Flipped_Surface_::translate(int x, int y) {
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+  CGContextTranslateCTM(fl_gc, x, -y);
+  CGContextSaveGState(fl_gc);
+  CGContextTranslateCTM(fl_gc, 0, height);
+  CGContextScaleCTM(fl_gc, 1.0f, -1.0f);
+}
+
+void Fl_Quartz_Flipped_Surface_::untranslate() {
+  CGContextRestoreGState(fl_gc);
+}
+
+const char *Fl_Quartz_Flipped_Surface_::class_id = "Fl_Quartz_Flipped_Surface_";
+
+#endif // __APPLE__
+
+//
+// End of "$Id: Fl_Image_Surface.cxx 10171 2014-05-24 16:19:30Z manolo $".
+//

+ 29 - 11
fltk/src/Fl_Input.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Input.cxx 9792 2013-01-13 15:25:37Z manolo $"
+// "$Id: Fl_Input.cxx 10031 2013-12-13 16:28:38Z manolo $"
 //
 //
 // Input widget for the Fast Light Tool Kit (FLTK).
 // Input widget for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -535,8 +535,8 @@ int Fl_Input::handle_key() {
 	           Fl::event_text(), Fl::event_length());
 	           Fl::event_text(), Fl::event_length());
     }
     }
 #ifdef __APPLE__
 #ifdef __APPLE__
-    if (Fl::marked_text_length()) {
-      this->mark( this->position() - Fl::marked_text_length() );
+    if (Fl::compose_state) {
+      this->mark( this->position() - Fl::compose_state );
       }
       }
 #endif
 #endif
     return 1;
     return 1;
@@ -764,11 +764,11 @@ int Fl_Input::handle_key() {
 
 
 int Fl_Input::handle(int event) {
 int Fl_Input::handle(int event) {
   static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
   static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
-  static Fl_Widget *dnd_save_focus;
+  static Fl_Widget *dnd_save_focus = NULL;
   switch (event) {
   switch (event) {
 #ifdef __APPLE__
 #ifdef __APPLE__
     case FL_UNFOCUS:
     case FL_UNFOCUS:
-      if (Fl::marked_text_length()) {
+      if (Fl::compose_state) {
 	this->mark( this->position() );
 	this->mark( this->position() );
 	Fl::reset_marked_text();
 	Fl::reset_marked_text();
       }
       }
@@ -858,6 +858,7 @@ int Fl_Input::handle(int event) {
                                               // save the position because sometimes we don't get DND_ENTER:
                                               // save the position because sometimes we don't get DND_ENTER:
           dnd_save_position = position();
           dnd_save_position = position();
           dnd_save_mark = mark();
           dnd_save_mark = mark();
+	      dnd_save_focus = this;
           // drag the data:
           // drag the data:
           copy(0); Fl::dnd();
           copy(0); Fl::dnd();
           return 1;
           return 1;
@@ -889,10 +890,10 @@ int Fl_Input::handle(int event) {
 
 
     case FL_DND_ENTER:
     case FL_DND_ENTER:
       Fl::belowmouse(this); // send the leave events first
       Fl::belowmouse(this); // send the leave events first
-      dnd_save_position = position();
-      dnd_save_mark = mark();
-      dnd_save_focus = Fl::focus();
       if (dnd_save_focus != this) {
       if (dnd_save_focus != this) {
+		dnd_save_position = position();
+		dnd_save_mark = mark();
+		dnd_save_focus = Fl::focus();
         Fl::focus(this);
         Fl::focus(this);
         handle(FL_FOCUS);
         handle(FL_FOCUS);
       }
       }
@@ -918,16 +919,33 @@ int Fl_Input::handle(int event) {
 #if DND_OUT_XXXX
 #if DND_OUT_XXXX
       if (!focused())
       if (!focused())
 #endif
 #endif
-        if (dnd_save_focus != this) {
+        if (dnd_save_focus && dnd_save_focus != this) {
           Fl::focus(dnd_save_focus);
           Fl::focus(dnd_save_focus);
           handle(FL_UNFOCUS);
           handle(FL_UNFOCUS);
         }
         }
 #if !(defined(__APPLE__) || defined(WIN32))
 #if !(defined(__APPLE__) || defined(WIN32))
       Fl::first_window()->cursor(FL_CURSOR_MOVE);
       Fl::first_window()->cursor(FL_CURSOR_MOVE);
 #endif
 #endif
+      dnd_save_focus = NULL;
       return 1;
       return 1;
 
 
     case FL_DND_RELEASE:
     case FL_DND_RELEASE:
+      if (dnd_save_focus == this) { // if the dragged text comes from the same widget
+	// remove the selected text
+	int old_position = position();
+	if (dnd_save_mark > dnd_save_position) {
+	  int tmp = dnd_save_mark;
+	  dnd_save_mark = dnd_save_position;
+	  dnd_save_position = tmp;
+	  }
+	replace(dnd_save_mark, dnd_save_position, NULL, 0);
+	if (old_position > dnd_save_position) position(old_position - (dnd_save_position - dnd_save_mark));
+	else position(old_position);
+	}
+      else if(dnd_save_focus) {
+	dnd_save_focus->handle(FL_UNFOCUS);
+	}
+      dnd_save_focus = NULL;
       take_focus();
       take_focus();
       return 1;
       return 1;
 
 
@@ -1036,7 +1054,7 @@ Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l)
 int Fl_Secret_Input::handle(int event) {
 int Fl_Secret_Input::handle(int event) {
   int retval = Fl_Input::handle(event);
   int retval = Fl_Input::handle(event);
 #ifdef __APPLE__
 #ifdef __APPLE__
-  if (event == FL_KEYBOARD && Fl::marked_text_length()) {
+  if (event == FL_KEYBOARD && Fl::compose_state) {
     this->mark( this->position() ); // don't underline marked text
     this->mark( this->position() ); // don't underline marked text
   }
   }
 #endif
 #endif
@@ -1044,5 +1062,5 @@ int Fl_Secret_Input::handle(int event) {
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_Input.cxx 9792 2013-01-13 15:25:37Z manolo $".
+// End of "$Id: Fl_Input.cxx 10031 2013-12-13 16:28:38Z manolo $".
 //
 //

+ 7 - 7
fltk/src/Fl_Input_.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Input_.cxx 9792 2013-01-13 15:25:37Z manolo $"
+// "$Id: Fl_Input_.cxx 9816 2013-02-08 11:58:19Z manolo $"
 //
 //
 // Common input widget routines for the Fast Light Tool Kit (FLTK).
 // Common input widget routines for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -339,8 +339,8 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
       int offset2;
       int offset2;
       if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
       if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
       else offset2 = (int) strlen(buf);
       else offset2 = (int) strlen(buf);
-#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::marked_text_length() != 0) text 
-      if (Fl::marked_text_length()) {
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text 
+      if (Fl::compose_state) {
         fl_color(textcolor());
         fl_color(textcolor());
       }
       }
       else 
       else 
@@ -351,8 +351,8 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
       fl_color(fl_contrast(textcolor(), selection_color()));
       fl_color(fl_contrast(textcolor(), selection_color()));
       }
       }
       fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
       fl_draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
-#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::marked_text_length() != 0) text
-      if (Fl::marked_text_length()) {
+#ifdef __APPLE__ // Mac OS: underline marked ( = selected + Fl::compose_state != 0) text
+      if (Fl::compose_state) {
         fl_color( fl_color_average(textcolor(), color(), 0.6) );
         fl_color( fl_color_average(textcolor(), color(), 0.6) );
         float width = fl_width(buf+offset1, offset2-offset1);
         float width = fl_width(buf+offset1, offset2-offset1);
         fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
         fl_line(x1, Y+ypos+height-1, x1+width, Y+ypos+height-1);
@@ -374,7 +374,7 @@ void Fl_Input_::drawtext(int X, int Y, int W, int H) {
     // draw the cursor:
     // draw the cursor:
     if (Fl::focus() == this && (
     if (Fl::focus() == this && (
 #ifdef __APPLE__
 #ifdef __APPLE__
-				Fl::marked_text_length() || 
+				Fl::compose_state || 
 #endif
 #endif
 				selstart == selend) &&
 				selstart == selend) &&
 	position() >= p-value() && position() <= e-value()) {
 	position() >= p-value() && position() <= e-value()) {
@@ -1371,5 +1371,5 @@ unsigned int Fl_Input_::index(int i) const
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_Input_.cxx 9792 2013-01-13 15:25:37Z manolo $".
+// End of "$Id: Fl_Input_.cxx 9816 2013-02-08 11:58:19Z manolo $".
 //
 //

+ 33 - 29
fltk/src/Fl_JPEG_Image.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_JPEG_Image.cxx 9709 2012-11-09 16:02:08Z manolo $"
+// "$Id: Fl_JPEG_Image.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $"
 //
 //
 // Fl_JPEG_Image routines.
 // Fl_JPEG_Image routines.
 //
 //
@@ -212,35 +212,39 @@ typedef struct {
 typedef my_source_mgr *my_src_ptr;
 typedef my_source_mgr *my_src_ptr;
 
 
 
 
-void init_source (j_decompress_ptr cinfo) {
-  my_src_ptr src = (my_src_ptr)cinfo->src;
-  src->s = src->data;
-}
-
-boolean fill_input_buffer(j_decompress_ptr cinfo) {
-  my_src_ptr src = (my_src_ptr)cinfo->src;
-  size_t nbytes = 4096;
-  src->pub.next_input_byte = src->s;
-  src->pub.bytes_in_buffer = nbytes;
-  src->s += nbytes;
-  return TRUE;
-}
-
-void term_source(j_decompress_ptr cinfo)
-{
-}
-
-void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
-  my_src_ptr src = (my_src_ptr)cinfo->src;
-  if (num_bytes > 0) {
-    while (num_bytes > (long)src->pub.bytes_in_buffer) {
-      num_bytes -= (long)src->pub.bytes_in_buffer;
-      fill_input_buffer(cinfo);
+extern "C" {
+
+  static void init_source(j_decompress_ptr cinfo) {
+    my_src_ptr src = (my_src_ptr)cinfo->src;
+    src->s = src->data;
+  }
+
+  static boolean fill_input_buffer(j_decompress_ptr cinfo) {
+    my_src_ptr src = (my_src_ptr)cinfo->src;
+    size_t nbytes = 4096;
+    src->pub.next_input_byte = src->s;
+    src->pub.bytes_in_buffer = nbytes;
+    src->s += nbytes;
+    return TRUE;
+  }
+
+  static void term_source(j_decompress_ptr cinfo)
+  {
+  }
+
+  static void skip_input_data(j_decompress_ptr cinfo, long num_bytes) {
+    my_src_ptr src = (my_src_ptr)cinfo->src;
+    if (num_bytes > 0) {
+      while (num_bytes > (long)src->pub.bytes_in_buffer) {
+        num_bytes -= (long)src->pub.bytes_in_buffer;
+        fill_input_buffer(cinfo);
+      }
+      src->pub.next_input_byte += (size_t) num_bytes;
+      src->pub.bytes_in_buffer -= (size_t) num_bytes;
     }
     }
-    src->pub.next_input_byte += (size_t) num_bytes;
-    src->pub.bytes_in_buffer -= (size_t) num_bytes;
   }
   }
-}
+
+} // extern "C"
 
 
 static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *data)
 static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *data)
 {
 {
@@ -428,5 +432,5 @@ int Fl_JPEG_Image::encode(Fl_Image *img, int quality,
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_JPEG_Image.cxx 9709 2012-11-09 16:02:08Z manolo $".
+// End of "$Id: Fl_JPEG_Image.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $".
 //
 //

+ 1 - 1
fltk/src/Fl_Menu_Button.cxx

@@ -57,7 +57,7 @@ const Fl_Menu_Item* Fl_Menu_Button::popup(int px, int py) {
   redraw();
   redraw();
   Fl_Widget_Tracker mb(this);
   Fl_Widget_Tracker mb(this);
   if (!box() || type()) {
   if (!box() || type()) {
-    m = menu()->popup(px, py, label(), mvalue(), this);
+    m = menu()->popup(Fl::event_x(), Fl::event_y(), label(), mvalue(), this);
   } else {
   } else {
     m = menu()->pulldown(x(), y(), w(), h(), 0, this);
     m = menu()->pulldown(x(), y(), w(), h(), 0, this);
   }
   }

+ 3 - 2
fltk/src/Fl_Menu_Window.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Menu_Window.cxx 9637 2012-07-24 04:37:22Z matt $"
+// "$Id: Fl_Menu_Window.cxx 10095 2014-02-07 00:09:52Z AlbrechtS $"
 //
 //
 // Menu window code for the Fast Light Tool Kit (FLTK).
 // Menu window code for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -54,6 +54,7 @@ void Fl_Menu_Window::show() {
 }
 }
 
 
 void Fl_Menu_Window::flush() {
 void Fl_Menu_Window::flush() {
+  if (!shown()) return;
 #if HAVE_OVERLAY
 #if HAVE_OVERLAY
   if (!fl_overlay_visual || !overlay()) {Fl_Single_Window::flush(); return;}
   if (!fl_overlay_visual || !overlay()) {Fl_Single_Window::flush(); return;}
   Fl_X *myi = Fl_X::i(this);
   Fl_X *myi = Fl_X::i(this);
@@ -111,5 +112,5 @@ Fl_Menu_Window::Fl_Menu_Window(int X, int Y, int W, int H, const char *l)
 
 
 
 
 //
 //
-// End of "$Id: Fl_Menu_Window.cxx 9637 2012-07-24 04:37:22Z matt $".
+// End of "$Id: Fl_Menu_Window.cxx 10095 2014-02-07 00:09:52Z AlbrechtS $".
 //
 //

+ 308 - 255
fltk/src/Fl_Native_File_Chooser_FLTK.cxx

@@ -1,10 +1,9 @@
-// "$Id: Fl_Native_File_Chooser_FLTK.cxx 9547 2012-05-25 14:46:02Z manolo $"
+// "$Id: Fl_Native_File_Chooser_FLTK.cxx 10186 2014-06-07 12:01:59Z manolo $"
 //
 //
-// FLTK native OS file chooser widget
+// FLTK native file chooser widget wrapper for GTK's GtkFileChooserDialog 
 //
 //
-// Copyright 1998-2010 by Bill Spitzak and others.
-// Copyright 2004 Greg Ercolano.
-// API changes + filter improvements by Nathan Vander Wilt 2005
+// Copyright 1998-2014 by Bill Spitzak and others.
+// Copyright 2012 IMM
 //
 //
 // This library is free software. Distribution and use rights are outlined in
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
 // the file "COPYING" which should have been included with this file.  If this
@@ -25,24 +24,20 @@
 #define FLTK_CHOOSER_CREATE    Fl_File_Chooser::CREATE
 #define FLTK_CHOOSER_CREATE    Fl_File_Chooser::CREATE
 
 
 #include "Fl_Native_File_Chooser_common.cxx"
 #include "Fl_Native_File_Chooser_common.cxx"
+#include "Fl_Native_File_Chooser_GTK.cxx"
+
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <string.h>
 #include <string.h>
 
 
+int Fl_Native_File_Chooser::have_looked_for_GTK_libs = 0;
+
 /**
 /**
-  The constructor. Internally allocates the native widgets.
-  Optional \p val presets the type of browser this will be, 
-  which can also be changed with type().
-*/
+ The constructor. Internally allocates the native widgets.
+ Optional \p val presets the type of browser this will be, 
+ which can also be changed with type().
+ */
 Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
 Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
-  //// CANT USE THIS -- MESSES UP LINKING/CREATES DEPENDENCY ON fltk_images.
-  //// Have app call this from main() instead.
-  ////
-  ////  static int init = 0;		// 'first time' initialize flag
-  ////  if ( init == 0 ) {
-  ////    // Initialize when instanced for first time
-  ////    Fl_File_Icon::load_system_icons();
-  ////    init = 1;
-  ////  }
+#if FLTK_ABI_VERSION <= 10302
   _btype       = val;
   _btype       = val;
   _options     = NO_OPTIONS;
   _options     = NO_OPTIONS;
   _filter      = NULL;
   _filter      = NULL;
@@ -52,17 +47,201 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
   _prevvalue   = NULL;
   _prevvalue   = NULL;
   _directory   = NULL;
   _directory   = NULL;
   _errmsg      = NULL;
   _errmsg      = NULL;
-  _file_chooser = new Fl_File_Chooser(NULL, NULL, 0, NULL);
-  type(val);			// do this after _file_chooser created
-  _nfilters    = 0;
-} 
+#endif // FLTK_ABI_VERSION
+  if (have_looked_for_GTK_libs == 0) {
+    // First Time here, try to find the GTK libs if they are installed
+    if (Fl::option(Fl::OPTION_FNFC_USES_GTK)) {
+      Fl_GTK_File_Chooser::probe_for_GTK_libs();
+    }
+    have_looked_for_GTK_libs = -1;
+  }
+  // if we found all the GTK functions we need, we will use the GtkFileChooserDialog
+  if (Fl_GTK_File_Chooser::did_find_GTK_libs) _gtk_file_chooser = new Fl_GTK_File_Chooser(val);
+  else _x11_file_chooser = new Fl_FLTK_File_Chooser(val);
+}
 
 
 /**
 /**
-  Destructor. 
-  Deallocates any resources allocated to this widget.
-*/
+ Destructor. 
+ Deallocates any resources allocated to this widget.
+ */
 Fl_Native_File_Chooser::~Fl_Native_File_Chooser() {
 Fl_Native_File_Chooser::~Fl_Native_File_Chooser() {
+  delete _x11_file_chooser;
+}
+
+/**
+ Sets the current Fl_Native_File_Chooser::Type of browser.
+ */
+void Fl_Native_File_Chooser::type(int t) { return _x11_file_chooser->type(t); }
+/**
+ Gets the current Fl_Native_File_Chooser::Type of browser.
+ */
+int Fl_Native_File_Chooser::type() const { return _x11_file_chooser->type(); }
+/**
+ Sets the platform specific chooser options to \p val.
+ \p val is expected to be one or more Fl_Native_File_Chooser::Option flags ORed together.
+ Some platforms have OS-specific functions that can be enabled/disabled via this method.
+ <P>
+ \code
+ Flag              Description                                       Win       Mac       Other
+ --------------    -----------------------------------------------   -------   -------   -------
+ NEW_FOLDER        Shows the 'New Folder' button.                    Ignored   Used      Used
+ PREVIEW           Enables the 'Preview' mode by default.            Ignored   Ignored   Used
+ SAVEAS_CONFIRM    Confirm dialog if BROWSE_SAVE_FILE file exists.   Used      Used      Used
+ USE_FILTER_EXT    Chooser filter pilots the output file extension.  Ignored   Used      Ignored
+\endcode
+ */
+void Fl_Native_File_Chooser::options(int o) {  _x11_file_chooser->options(o); }
+/**
+ Gets the platform specific Fl_Native_File_Chooser::Option flags.
+ */
+int Fl_Native_File_Chooser::options() const {  return _x11_file_chooser->options(); }
+
+/**
+ Returns the number of filenames (or directory names) the user selected.
+ <P>
+ \b Example:
+ \code
+ if ( fnfc->show() == 0 ) {
+ // Print all filenames user selected
+ for (int n=0; n<fnfc->count(); n++ ) {
+ printf("%d) '%s'\n", n, fnfc->filename(n));
+ }
+ }
+ \endcode
+ */
+int Fl_Native_File_Chooser::count() const { return _x11_file_chooser->count(); }
+/**
+ Return the filename the user chose.
+ Use this if only expecting a single filename.
+ If more than one filename is expected, use filename(int) instead.
+ Return value may be "" if no filename was chosen (eg. user cancelled).
+ */
+const char *Fl_Native_File_Chooser::filename() const { return _x11_file_chooser->filename(); }
+/**
+ Return one of the filenames the user selected.
+ Use count() to determine how many filenames the user selected.
+ <P>
+ \b Example:
+ \code
+ if ( fnfc->show() == 0 ) {
+ // Print all filenames user selected
+ for (int n=0; n<fnfc->count(); n++ ) {
+ printf("%d) '%s'\n", n, fnfc->filename(n));
+ }
+ }
+ \endcode
+ */
+const char *Fl_Native_File_Chooser::filename(int i) const { return _x11_file_chooser->filename(i); }
+/**
+ Preset the directory the browser will show when opened.
+ If \p val is NULL, or no directory is specified, the chooser will attempt
+ to use the last non-cancelled folder.
+ */
+void Fl_Native_File_Chooser::directory(const char *val) {  _x11_file_chooser->directory(val); }
+/**
+ Returns the current preset directory() value.
+ */
+const char *Fl_Native_File_Chooser::directory() const { return _x11_file_chooser->directory(); }
+/**
+ Set the title of the file chooser's dialog window.
+ Can be NULL if no title desired.
+ The default title varies according to the platform, so you are advised to set the title explicitly.
+ */
+void Fl_Native_File_Chooser::title(const char *t) {  _x11_file_chooser->title(t); }
+/**
+ Get the title of the file chooser's dialog window.
+ Return value may be NULL if no title was set.
+ */
+const char* Fl_Native_File_Chooser::title() const { return _x11_file_chooser->title(); }
+/**
+ Returns the filter string last set.
+ Can be NULL if no filter was set.
+ */
+const char *Fl_Native_File_Chooser::filter() const { return _x11_file_chooser->filter(); }
+/**
+ Sets the filename filters used for browsing. 
+ The default is NULL, which browses all files.
+ <P>
+ The filter string can be any of:
+ <P>
+ - A single wildcard (eg. "*.txt")
+ - Multiple wildcards (eg. "*.{cxx,h,H}")
+ - A descriptive name followed by a "\t" and a wildcard (eg. "Text Files\t*.txt")
+ - A list of separate wildcards with a "\n" between each (eg. "*.{cxx,H}\n*.txt")
+ - A list of descriptive names and wildcards (eg. "C++ Files\t*.{cxx,H}\nTxt Files\t*.txt")
+ <P>
+ The format of each filter is a wildcard, or an optional user description 
+ followed by '\\t' and the wildcard.
+ <P>
+ On most platforms, each filter is available to the user via a pulldown menu 
+ in the file chooser. The 'All Files' option is always available to the user. 
+ */
+void Fl_Native_File_Chooser::filter(const char *f) {  _x11_file_chooser->filter(f); }
+/**
+ Gets how many filters were available, not including "All Files" 
+ */
+int Fl_Native_File_Chooser::filters() const { return _x11_file_chooser->filters(); }
+/**
+ Sets which filter will be initially selected.
+ 
+ The first filter is indexed as 0. 
+ If filter_value()==filters(), then "All Files" was chosen. 
+ If filter_value() > filters(), then a custom filter was set.
+ */
+void Fl_Native_File_Chooser::filter_value(int i) {  _x11_file_chooser->filter_value(i); }
+/**
+ Returns which filter value was last selected by the user.
+ This is only valid if the chooser returns success.
+ */
+int Fl_Native_File_Chooser::filter_value() const { return _x11_file_chooser->filter_value(); }
+/**
+ Sets the default filename for the chooser.
+ Use directory() to set the default directory.
+ Mainly used to preset the filename for save dialogs, 
+ and on most platforms can be used for opening files as well. 
+ */
+void Fl_Native_File_Chooser::preset_file(const char* f) {  _x11_file_chooser->preset_file(f); }
+/**
+ Get the preset filename.
+ */
+const char* Fl_Native_File_Chooser::preset_file() const { return _x11_file_chooser->preset_file(); }
+/**
+ Returns a system dependent error message for the last method that failed. 
+ This message should at least be flagged to the user in a dialog box, or to some kind of error log. 
+ Contents will be valid only for methods that document errmsg() will have info on failures.
+ */
+const char *Fl_Native_File_Chooser::errmsg() const { return _x11_file_chooser->errmsg(); }
+/**
+ Post the chooser's dialog. Blocks until dialog has been completed or cancelled.
+ \returns
+ - 0  -- user picked a file
+ - 1  -- user cancelled
+ - -1 -- failed; errmsg() has reason
+ */
+int Fl_Native_File_Chooser::show() { return _x11_file_chooser->show(); }
+
+
+Fl_FLTK_File_Chooser::Fl_FLTK_File_Chooser(int val) {
+  _btype       = 0;
+  _options     = 0;
+  _filter      = NULL;
+  _filtvalue   = 0;
+  _parsedfilt  = NULL;
+  _preset_file = NULL;
+  _prevvalue   = NULL;
+  _directory   = NULL;
+  _errmsg      = NULL;
+  _file_chooser= NULL;
+  if (val >= 0) {
+    _file_chooser = new Fl_File_Chooser(NULL, NULL, 0, NULL);
+    type(val);			// do this after _file_chooser created
+    }
+  _nfilters    = 0;
+} 
+
+Fl_FLTK_File_Chooser::~Fl_FLTK_File_Chooser() {
   delete _file_chooser;
   delete _file_chooser;
+  _file_chooser = NULL;
   _filter      = strfree(_filter);
   _filter      = strfree(_filter);
   _parsedfilt  = strfree(_parsedfilt);
   _parsedfilt  = strfree(_parsedfilt);
   _preset_file = strfree(_preset_file);
   _preset_file = strfree(_preset_file);
@@ -71,285 +250,169 @@ Fl_Native_File_Chooser::~Fl_Native_File_Chooser() {
   _errmsg      = strfree(_errmsg);
   _errmsg      = strfree(_errmsg);
 }
 }
 
 
+
 // PRIVATE: SET ERROR MESSAGE
 // PRIVATE: SET ERROR MESSAGE
-void Fl_Native_File_Chooser::errmsg(const char *msg) {
+void Fl_FLTK_File_Chooser::errmsg(const char *msg) {
   _errmsg = strfree(_errmsg);
   _errmsg = strfree(_errmsg);
   _errmsg = strnew(msg);
   _errmsg = strnew(msg);
 }
 }
 
 
 // PRIVATE: translate Native types to Fl_File_Chooser types
 // PRIVATE: translate Native types to Fl_File_Chooser types
-int Fl_Native_File_Chooser::type_fl_file(int val) {
+int Fl_FLTK_File_Chooser::type_fl_file(int val) {
   switch (val) {
   switch (val) {
-    case BROWSE_FILE:
-      return(FLTK_CHOOSER_SINGLE);
-    case BROWSE_DIRECTORY:
-      return(FLTK_CHOOSER_SINGLE | FLTK_CHOOSER_DIRECTORY);
-    case BROWSE_MULTI_FILE:
-      return(FLTK_CHOOSER_MULTI);
-    case BROWSE_MULTI_DIRECTORY:
-      return(FLTK_CHOOSER_DIRECTORY | FLTK_CHOOSER_MULTI);
-    case BROWSE_SAVE_FILE:
-      return(FLTK_CHOOSER_SINGLE | FLTK_CHOOSER_CREATE);
-    case BROWSE_SAVE_DIRECTORY:
-      return(FLTK_CHOOSER_DIRECTORY | FLTK_CHOOSER_MULTI | FLTK_CHOOSER_CREATE);
+    case Fl_Native_File_Chooser::BROWSE_FILE:
+      return(Fl_File_Chooser::SINGLE);
+    case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
+      return(Fl_File_Chooser::SINGLE | Fl_File_Chooser::DIRECTORY);
+    case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
+      return(Fl_File_Chooser::MULTI);
+    case Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY:
+      return(Fl_File_Chooser::DIRECTORY | Fl_File_Chooser::MULTI);
+    case Fl_Native_File_Chooser::BROWSE_SAVE_FILE:
+      return(Fl_File_Chooser::SINGLE | Fl_File_Chooser::CREATE);
+    case Fl_Native_File_Chooser::BROWSE_SAVE_DIRECTORY:
+      return(Fl_File_Chooser::DIRECTORY | Fl_File_Chooser::MULTI | Fl_File_Chooser::CREATE);
     default:
     default:
-      return(FLTK_CHOOSER_SINGLE);
+      return(Fl_File_Chooser::SINGLE);
   }
   }
 }
 }
 
 
-/**
-  Sets the current Fl_Native_File_Chooser::Type of browser.
- */
-void Fl_Native_File_Chooser::type(int val) {
+void Fl_FLTK_File_Chooser::type(int val) {
   _btype = val;
   _btype = val;
   _file_chooser->type(type_fl_file(val));
   _file_chooser->type(type_fl_file(val));
 }
 }
 
 
-/**
-  Gets the current Fl_Native_File_Chooser::Type of browser.
- */
-int Fl_Native_File_Chooser::type() const {
+int Fl_FLTK_File_Chooser::type() const {
   return(_btype);
   return(_btype);
 }
 }
 
 
-/**
-  Sets the platform specific chooser options to \p val.
-  \p val is expected to be one or more Fl_Native_File_Chooser::Option flags ORed together.
-  Some platforms have OS-specific functions that can be enabled/disabled via this method.
-  <P>
-  \code
-  Flag              Description                                       Win       Mac       Other
-  --------------    -----------------------------------------------   -------   -------   -------
-  NEW_FOLDER        Shows the 'New Folder' button.                    Ignored   Used      Used
-  PREVIEW           Enables the 'Preview' mode by default.            Ignored   Ignored   Used
-  SAVEAS_CONFIRM    Confirm dialog if BROWSE_SAVE_FILE file exists.   Used      Used      Used
-  \endcode
-*/
-void Fl_Native_File_Chooser::options(int val) {
+void Fl_FLTK_File_Chooser::options(int val) {
   _options = val;
   _options = val;
 }
 }
 
 
-/**
-  Gets the platform specific Fl_Native_File_Chooser::Option flags.
-*/
-int Fl_Native_File_Chooser::options() const {
+int Fl_FLTK_File_Chooser::options() const {
   return(_options);
   return(_options);
 }
 }
 
 
-/**
-  Post the chooser's dialog. Blocks until dialog has been completed or cancelled.
-  \returns
-     - 0  -- user picked a file
-     - 1  -- user cancelled
-     - -1 -- failed; errmsg() has reason
-*/
-int Fl_Native_File_Chooser::show() {
+int Fl_FLTK_File_Chooser::show() {
+
   // FILTER
   // FILTER
-  if ( _parsedfilt ) {
-    _file_chooser->filter(_parsedfilt);
-  }
-
-  // FILTER VALUE
-  //     Set this /after/ setting the filter
-  //
-  _file_chooser->filter_value(_filtvalue);
-
-  // DIRECTORY
-  if ( _directory && _directory[0] ) {
-    _file_chooser->directory(_directory);
-  } else {
-    _file_chooser->directory(_prevvalue);
-  }
-
-  // PRESET FILE
-  if ( _preset_file ) {
-    _file_chooser->value(_preset_file);
-  }
-
-  // OPTIONS: PREVIEW
-  _file_chooser->preview( (options() & PREVIEW) ? 1 : 0);
-
-  // OPTIONS: NEW FOLDER
-  if ( options() & NEW_FOLDER )
-    _file_chooser->type(_file_chooser->type() | FLTK_CHOOSER_CREATE);	// on
-
-  // SHOW
-  _file_chooser->show();
-
-  // BLOCK WHILE BROWSER SHOWN
-  while ( _file_chooser->shown() ) {
-    Fl::wait();
-  }
-
-  if ( _file_chooser->value() && _file_chooser->value()[0] ) {
-    _prevvalue = strfree(_prevvalue);
-    _prevvalue = strnew(_file_chooser->value());
-    _filtvalue = _file_chooser->filter_value();	// update filter value
-
-    // HANDLE SHOWING 'SaveAs' CONFIRM
-    if ( options() & SAVEAS_CONFIRM && type() == BROWSE_SAVE_FILE ) {
-      struct stat buf;
-      if ( stat(_file_chooser->value(), &buf) != -1 ) {
-	if ( buf.st_mode & S_IFREG ) {		// Regular file + exists?
-	  if ( exist_dialog() == 0 ) {
-	    return(1);
-	  }
-	}
+    if ( _parsedfilt ) {
+      _file_chooser->filter(_parsedfilt);
+    }
+
+    // FILTER VALUE
+    //     Set this /after/ setting the filter
+    //
+    _file_chooser->filter_value(_filtvalue);
+
+    // DIRECTORY
+    if ( _directory && _directory[0] ) {
+      _file_chooser->directory(_directory);
+    } else {
+      _file_chooser->directory(_prevvalue);
+    }
+
+    // PRESET FILE
+    if ( _preset_file ) {
+      _file_chooser->value(_preset_file);
+    }
+
+    // OPTIONS: PREVIEW
+    _file_chooser->preview( (options() & Fl_Native_File_Chooser::PREVIEW) ? 1 : 0);
+
+    // OPTIONS: NEW FOLDER
+    if ( options() & Fl_Native_File_Chooser::NEW_FOLDER )
+      _file_chooser->type(_file_chooser->type() | Fl_File_Chooser::CREATE);	// on
+  
+    // SHOW
+    _file_chooser->show();
+
+    // BLOCK WHILE BROWSER SHOWN
+    while ( _file_chooser->shown() ) {
+      Fl::wait();
+    }
+
+    if ( _file_chooser->value() && _file_chooser->value()[0] ) {
+      _prevvalue = strfree(_prevvalue);
+      _prevvalue = strnew(_file_chooser->value());
+      _filtvalue = _file_chooser->filter_value(); // update filter value
+
+      // HANDLE SHOWING 'SaveAs' CONFIRM
+      if ( options() & Fl_Native_File_Chooser::SAVEAS_CONFIRM && type() == Fl_Native_File_Chooser::BROWSE_SAVE_FILE ) {
+        struct stat buf;
+        if ( stat(_file_chooser->value(), &buf) != -1 ) {
+          if ( buf.st_mode & S_IFREG ) {    // Regular file + exists?
+            if ( exist_dialog() == 0 ) {
+              return(1);
+            }
+          }
+        }
       }
       }
     }
     }
-  }
 
 
-  if ( _file_chooser->count() ) return(0);
-  else return(1);
+    if ( _file_chooser->count() ) return(0);
+    else return(1);
 }
 }
 
 
-/**
-  Returns a system dependent error message for the last method that failed. 
-  This message should at least be flagged to the user in a dialog box, or to some kind of error log. 
-  Contents will be valid only for methods that document errmsg() will have info on failures.
- */
-const char *Fl_Native_File_Chooser::errmsg() const {
+const char *Fl_FLTK_File_Chooser::errmsg() const {
   return(_errmsg ? _errmsg : "No error");
   return(_errmsg ? _errmsg : "No error");
 }
 }
 
 
-/**
-  Return the filename the user choose.
-  Use this if only expecting a single filename.
-  If more than one filename is expected, use filename(int) instead.
-  Return value may be "" if no filename was chosen (eg. user cancelled).
- */
-const char* Fl_Native_File_Chooser::filename() const {
-  if ( _file_chooser->count() > 0 ) return(_file_chooser->value());
+const char* Fl_FLTK_File_Chooser::filename() const {
+  if ( _file_chooser->count() > 0 ) {
+    return(_file_chooser->value());
+  }
   return("");
   return("");
 }
 }
 
 
-/**
-  Return one of the filenames the user selected.
-  Use count() to determine how many filenames the user selected.
-  <P>
-  \b Example:
-  \code
-  if ( fnfc->show() == 0 ) {
-    // Print all filenames user selected
-    for (int n=0; n<fnfc->count(); n++ ) {
-      printf("%d) '%s'\n", n, fnfc->filename(n));
-    }
-  }
-  \endcode
- */
-const char* Fl_Native_File_Chooser::filename(int i) const {
-  if ( i < _file_chooser->count() )
-    return(_file_chooser->value(i+1));	// convert fltk 1 based to our 0 based
+const char* Fl_FLTK_File_Chooser::filename(int i) const {
+    if ( i < _file_chooser->count() )
+        return(_file_chooser->value(i+1));  // convert fltk 1 based to our 0 based
   return("");
   return("");
 }
 }
 
 
-/**
-  Set the title of the file chooser's dialog window.
-  Can be NULL if no title desired.
-  The default title varies according to the platform, so you are advised to set the title explicitly.
-*/
-void Fl_Native_File_Chooser::title(const char *val) {
+void Fl_FLTK_File_Chooser::title(const char *val) {
   _file_chooser->label(val);
   _file_chooser->label(val);
 }
 }
 
 
-/**
-  Get the title of the file chooser's dialog window.
-  Return value may be NULL if no title was set.
-*/
-const char *Fl_Native_File_Chooser::title() const {
-  return(_file_chooser->label());
+const char *Fl_FLTK_File_Chooser::title() const {
+    return(_file_chooser->label());
 }
 }
 
 
-/**
-  Sets the filename filters used for browsing. 
-  The default is NULL, which browses all files.
-  <P>
-  The filter string can be any of:
-  <P>
-    - A single wildcard (eg. "*.txt")
-    - Multiple wildcards (eg. "*.{cxx,h,H}")
-    - A descriptive name followed by a "\t" and a wildcard (eg. "Text Files\t*.txt")
-    - A list of separate wildcards with a "\n" between each (eg. "*.{cxx,H}\n*.txt")
-    - A list of descriptive names and wildcards (eg. "C++ Files\t*.{cxx,H}\nTxt Files\t*.txt")
-  <P>
-  The format of each filter is a wildcard, or an optional user description 
-  followed by '\\t' and the wildcard.
-  <P>
-  On most platforms, each filter is available to the user via a pulldown menu 
-  in the file chooser. The 'All Files' option is always available to the user. 
-*/
-void Fl_Native_File_Chooser::filter(const char *val) {
+void Fl_FLTK_File_Chooser::filter(const char *val) {
   _filter = strfree(_filter);
   _filter = strfree(_filter);
   _filter = strnew(val);
   _filter = strnew(val);
   parse_filter();
   parse_filter();
 }
 }
 
 
-/**
-  Returns the filter string last set.
-  Can be NULL if no filter was set.
- */
-const char *Fl_Native_File_Chooser::filter() const {
+const char *Fl_FLTK_File_Chooser::filter() const {
   return(_filter);
   return(_filter);
 }
 }
 
 
-/**
-Gets how many filters were available, not including "All Files" 
-*/
-int Fl_Native_File_Chooser::filters() const {
+int Fl_FLTK_File_Chooser::filters() const {
   return(_nfilters);
   return(_nfilters);
 }
 }
 
 
-/**
-  Sets which filter will be initially selected.
-
-  The first filter is indexed as 0. 
-  If filter_value()==filters(), then "All Files" was chosen. 
-  If filter_value() > filters(), then a custom filter was set.
- */
-void Fl_Native_File_Chooser::filter_value(int val) {
+void Fl_FLTK_File_Chooser::filter_value(int val) {
   _filtvalue = val;
   _filtvalue = val;
 }
 }
 
 
-/**
-  Returns which filter value was last selected by the user.
-  This is only valid if the chooser returns success.
- */
-int Fl_Native_File_Chooser::filter_value() const {
-  return(_filtvalue);
+int Fl_FLTK_File_Chooser::filter_value() const {
+  return _filtvalue;
 }
 }
 
 
-/**
-  Returns the number of filenames (or directory names) the user selected.
-  <P>
-  \b Example:
-  \code
-  if ( fnfc->show() == 0 ) {
-    // Print all filenames user selected
-    for (int n=0; n<fnfc->count(); n++ ) {
-      printf("%d) '%s'\n", n, fnfc->filename(n));
-    }
-  }
-  \endcode
-*/
-int Fl_Native_File_Chooser::count() const {
-  return(_file_chooser->count());
+int Fl_FLTK_File_Chooser::count() const {
+  return _file_chooser->count();
 }
 }
 
 
-/**
-  Preset the directory the browser will show when opened.
-  If \p val is NULL, or no directory is specified, the chooser will attempt
-  to use the last non-cancelled folder.
-*/
-void Fl_Native_File_Chooser::directory(const char *val) {
+void Fl_FLTK_File_Chooser::directory(const char *val) {
   _directory = strfree(_directory);
   _directory = strfree(_directory);
   _directory = strnew(val);
   _directory = strnew(val);
 }
 }
 
 
-/**
-  Returns the current preset directory() value.
-*/
-const char *Fl_Native_File_Chooser::directory() const {
-  return(_directory);
+const char *Fl_FLTK_File_Chooser::directory() const {
+  return _directory;
 }
 }
 
 
 // PRIVATE: Convert our filter format to fltk's chooser format
 // PRIVATE: Convert our filter format to fltk's chooser format
@@ -362,7 +425,7 @@ const char *Fl_Native_File_Chooser::directory() const {
 //     Returns a modified version of the filter that the caller is responsible
 //     Returns a modified version of the filter that the caller is responsible
 //     for freeing with strfree().
 //     for freeing with strfree().
 //
 //
-void Fl_Native_File_Chooser::parse_filter() {
+void Fl_FLTK_File_Chooser::parse_filter() {
   _parsedfilt = strfree(_parsedfilt);	// clear previous parsed filter (if any)
   _parsedfilt = strfree(_parsedfilt);	// clear previous parsed filter (if any)
   _nfilters = 0;
   _nfilters = 0;
   char *in = _filter;
   char *in = _filter;
@@ -425,29 +488,19 @@ void Fl_Native_File_Chooser::parse_filter() {
   //NOTREACHED
   //NOTREACHED
 }
 }
 
 
-/**
-  Sets the default filename for the chooser.
-  Use directory() to set the default directory.
-  Mainly used to preset the filename for save dialogs, 
-  and on most platforms can be used for opening files as well. 
- */
-void Fl_Native_File_Chooser::preset_file(const char* val) {
+void Fl_FLTK_File_Chooser::preset_file(const char* val) {
   _preset_file = strfree(_preset_file);
   _preset_file = strfree(_preset_file);
   _preset_file = strnew(val);
   _preset_file = strnew(val);
 }
 }
 
 
-/**
-  Get the preset filename.
-  */
-const char* Fl_Native_File_Chooser::preset_file() const {
-  return(_preset_file);
+const char* Fl_FLTK_File_Chooser::preset_file() const {
+  return _preset_file;
 }
 }
 
 
-
-int Fl_Native_File_Chooser::exist_dialog() {
-  return(fl_choice("%s", fl_cancel, fl_ok, NULL, file_exists_message));
+int Fl_FLTK_File_Chooser::exist_dialog() {
+  return fl_choice("%s", fl_cancel, fl_ok, NULL, Fl_Native_File_Chooser::file_exists_message);
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_Native_File_Chooser_FLTK.cxx 9547 2012-05-25 14:46:02Z manolo $".
+// End of "$Id: Fl_Native_File_Chooser_FLTK.cxx 10186 2014-06-07 12:01:59Z manolo $".
 //
 //

+ 700 - 0
fltk/src/Fl_Native_File_Chooser_GTK.cxx

@@ -0,0 +1,700 @@
+// "$Id$"
+//
+// FLTK native file chooser widget wrapper for GTK's GtkFileChooserDialog 
+//
+// Copyright 1998-2014 by Bill Spitzak and others.
+// Copyright 2012 IMM
+//
+// This library is free software. Distribution and use rights are outlined in
+// the file "COPYING" which should have been included with this file.  If this
+// file is missing or damaged, see the license at:
+//
+//     http://www.fltk.org/COPYING.php
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <FL/x.H>
+#include <dlfcn.h>   // for dlopen et al
+#include <locale.h>  // for setlocale
+
+/* --------------------- Type definitions from GLIB and GTK --------------------- */
+/* all of this is from the public gnome API, so unlikely to change */
+#ifndef	FALSE
+#define	FALSE	(0)
+#endif
+#ifndef	TRUE
+#define	TRUE	(!FALSE)
+#endif
+typedef void* gpointer;
+typedef int    gint;
+typedef unsigned int    guint;
+typedef unsigned long   gulong;
+typedef gint   gboolean;
+typedef char   gchar;
+typedef struct _GSList GSList;
+struct _GSList
+{
+  gpointer data;
+  GSList *next;
+};
+#define  g_slist_next(slist)	         ((slist) ? (((GSList *)(slist))->next) : NULL)
+typedef struct _GtkWidget      GtkWidget;
+typedef struct _GtkFileChooser      GtkFileChooser;
+typedef struct _GtkDialog        GtkDialog;
+typedef struct _GtkWindow          GtkWindow;
+typedef struct _GdkDrawable           GdkWindow;
+typedef struct _GtkFileFilter     GtkFileFilter;
+typedef struct _GtkToggleButton       GtkToggleButton;
+typedef enum {
+  GTK_FILE_FILTER_FILENAME     = 1 << 0,
+  GTK_FILE_FILTER_URI          = 1 << 1,
+  GTK_FILE_FILTER_DISPLAY_NAME = 1 << 2,
+  GTK_FILE_FILTER_MIME_TYPE    = 1 << 3
+} GtkFileFilterFlags;
+struct _GtkFileFilterInfo
+{
+  GtkFileFilterFlags contains;
+  
+  const gchar *filename;
+  const gchar *uri;
+  const gchar *display_name;
+  const gchar *mime_type;
+};
+typedef struct _GtkFileFilterInfo GtkFileFilterInfo;
+typedef gboolean (*GtkFileFilterFunc) (const GtkFileFilterInfo *filter_info, gpointer data);
+typedef void (*GDestroyNotify)(gpointer data);
+typedef enum
+{
+  GTK_FILE_CHOOSER_ACTION_OPEN,
+  GTK_FILE_CHOOSER_ACTION_SAVE,
+  GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+  GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+} GtkFileChooserAction;
+#define GTK_STOCK_CANCEL           "gtk-cancel"
+#define GTK_STOCK_SAVE             "gtk-save"
+#define GTK_STOCK_OPEN             "gtk-open"
+const int   GTK_RESPONSE_NONE = -1;
+const int   GTK_RESPONSE_ACCEPT = -3;
+const int   GTK_RESPONSE_DELETE_EVENT = -4;
+const int   GTK_RESPONSE_CANCEL = -6;
+typedef void  (*GCallback)(void);
+#define	G_CALLBACK(f)			 ((GCallback) (f))
+typedef int GConnectFlags;
+typedef struct _GClosure		 GClosure;
+typedef void  (*GClosureNotify)(gpointer data, GClosure	*closure);
+
+/* --------------------- End of Type definitions from GLIB and GTK --------------------- */
+
+int Fl_GTK_File_Chooser::did_find_GTK_libs = 0;
+
+/* These are the GTK/GLib methods we want to load, but not call by name...! */
+
+// void g_free (gpointer mem);
+typedef void (*XX_g_free)(gpointer);
+static XX_g_free fl_g_free = NULL;
+
+// gpointer g_slist_nth_data (GSList *list, guint n);
+typedef gpointer (*XX_g_slist_nth_data) (GSList *, guint);
+static XX_g_slist_nth_data fl_g_slist_nth_data = NULL;
+
+// guint g_slist_length (GSList *list);
+typedef guint (*XX_g_slist_length) (GSList *);
+static XX_g_slist_length fl_g_slist_length = NULL;
+
+// void g_slist_free (GSList *list);
+typedef void (*XX_g_slist_free) (GSList *);
+static XX_g_slist_free fl_g_slist_free = NULL;
+
+// gboolean gtk_init_check (int *argc, char ***argv);
+typedef gboolean (*XX_gtk_init_check)(int *, char ***);
+static XX_gtk_init_check fl_gtk_init_check = NULL;
+
+// void gtk_widget_destroy (GtkWidget *widget);
+typedef void (*XX_gtk_widget_destroy) (GtkWidget *);
+static XX_gtk_widget_destroy fl_gtk_widget_destroy = NULL;
+
+// void gtk_file_chooser_set_select_multiple(GtkFileChooser *chooser, gboolean select_multiple);
+typedef void (*XX_gtk_file_chooser_set_select_multiple)(GtkFileChooser *, gboolean);
+static XX_gtk_file_chooser_set_select_multiple fl_gtk_file_chooser_set_select_multiple = NULL;
+
+// void gtk_file_chooser_set_do_overwrite_confirmation(GtkFileChooser *chooser, gboolean do_overwrite_confirmation);
+typedef void (*XX_gtk_file_chooser_set_do_overwrite_confirmation)(GtkFileChooser *, gboolean);
+static XX_gtk_file_chooser_set_do_overwrite_confirmation fl_gtk_file_chooser_set_do_overwrite_confirmation = NULL;
+
+// void gtk_file_chooser_set_current_name (GtkFileChooser *chooser, const gchar *name);
+typedef void (*XX_gtk_file_chooser_set_current_name)(GtkFileChooser *, const gchar *);
+static XX_gtk_file_chooser_set_current_name fl_gtk_file_chooser_set_current_name = NULL;
+
+// void gtk_file_chooser_set_current_folder (GtkFileChooser *chooser, const gchar *name);
+typedef void (*XX_gtk_file_chooser_set_current_folder)(GtkFileChooser *, const gchar *);
+static XX_gtk_file_chooser_set_current_folder fl_gtk_file_chooser_set_current_folder = NULL;
+
+// void gtk_file_chooser_set_create_folders (GtkFileChooser *chooser, gboolean create_folders);
+typedef void (*XX_gtk_file_chooser_set_create_folders) (GtkFileChooser *, gboolean);
+static XX_gtk_file_chooser_set_create_folders fl_gtk_file_chooser_set_create_folders = NULL;
+
+// gboolean gtk_file_chooser_get_select_multiple(GtkFileChooser *chooser);
+typedef gboolean (*XX_gtk_file_chooser_get_select_multiple)(GtkFileChooser *);
+static XX_gtk_file_chooser_get_select_multiple fl_gtk_file_chooser_get_select_multiple = NULL;
+
+// void gtk_widget_hide(GtkWidget *widget);
+typedef void (*XX_gtk_widget_hide)(GtkWidget *);
+static XX_gtk_widget_hide fl_gtk_widget_hide = NULL;
+
+// gchar * gtk_file_chooser_get_filename(GtkFileChooser *chooser);
+typedef gchar* (*XX_gtk_file_chooser_get_filename)(GtkFileChooser *);
+static XX_gtk_file_chooser_get_filename fl_gtk_file_chooser_get_filename = NULL;
+
+// GSList * gtk_file_chooser_get_filenames(GtkFileChooser *chooser);
+typedef GSList* (*XX_gtk_file_chooser_get_filenames)(GtkFileChooser *chooser);
+static XX_gtk_file_chooser_get_filenames fl_gtk_file_chooser_get_filenames = NULL;
+
+// gboolean gtk_main_iteration(void);
+typedef gboolean (*XX_gtk_main_iteration)(void);
+static XX_gtk_main_iteration fl_gtk_main_iteration = NULL;
+
+// gboolean gtk_events_pending(void);
+typedef gboolean (*XX_gtk_events_pending)(void);
+static XX_gtk_events_pending fl_gtk_events_pending = NULL;
+
+// GtkWidget * gtk_file_chooser_dialog_new(const gchar *title, GtkWindow *parent, GtkFileChooserAction action, const gchar *first_button_text, ...);
+typedef GtkWidget* (*XX_gtk_file_chooser_dialog_new)(const gchar *, GtkWindow *, GtkFileChooserAction, const gchar *, ...);
+static XX_gtk_file_chooser_dialog_new fl_gtk_file_chooser_dialog_new = NULL;
+
+// void gtk_file_chooser_add_filter(GtkFileChooser*, GtkFileFilter*);
+typedef void (*XX_gtk_file_chooser_add_filter)(GtkFileChooser*, GtkFileFilter*);
+static XX_gtk_file_chooser_add_filter fl_gtk_file_chooser_add_filter = NULL;
+
+// GtkFileFilter* gtk_file_chooser_get_filter(GtkFileChooser*);
+typedef GtkFileFilter* (*XX_gtk_file_chooser_get_filter)(GtkFileChooser*);
+static XX_gtk_file_chooser_get_filter fl_gtk_file_chooser_get_filter = NULL;
+
+// void gtk_file_chooser_set_filter(GtkFileChooser*, GtkFileFilter*);
+typedef void (*XX_gtk_file_chooser_set_filter)(GtkFileChooser*, GtkFileFilter*);
+static XX_gtk_file_chooser_set_filter fl_gtk_file_chooser_set_filter = NULL;
+
+// GtkFileFilter * gtk_file_filter_new();
+typedef GtkFileFilter* (*XX_gtk_file_filter_new)(void);
+static XX_gtk_file_filter_new fl_gtk_file_filter_new = NULL;
+
+// void gtk_file_filter_add_pattern(GtkFileFilter*, const gchar*);
+typedef void (*XX_gtk_file_filter_add_pattern)(GtkFileFilter*, const gchar*);
+static XX_gtk_file_filter_add_pattern fl_gtk_file_filter_add_pattern = NULL;
+
+// void gtk_file_filter_add_custom(GtkFileFilter *filter, GtkFileFilterFlags needed,
+//  GtkFileFilterFunc func, gpointer data, GDestroyNotify notify);
+typedef void (*XX_gtk_file_filter_add_custom)(GtkFileFilter *filter, GtkFileFilterFlags needed,
+					      GtkFileFilterFunc func, gpointer data, 
+					      GDestroyNotify notify);
+static XX_gtk_file_filter_add_custom fl_gtk_file_filter_add_custom = NULL;
+
+// void gtk_file_filter_set_name(GtkFileFilter*, const gchar*);
+typedef void (*XX_gtk_file_filter_set_name)(GtkFileFilter*, const gchar*);
+static XX_gtk_file_filter_set_name fl_gtk_file_filter_set_name = NULL;
+
+// const gchar* gtk_file_filter_get_name(GtkFileFilter*);
+typedef const gchar* (*XX_gtk_file_filter_get_name)(GtkFileFilter*);
+static XX_gtk_file_filter_get_name fl_gtk_file_filter_get_name = NULL;
+
+// void gtk_file_chooser_set_extra_widget(GtkFileChooser *, GtkWidget *);
+typedef void (*XX_gtk_file_chooser_set_extra_widget)(GtkFileChooser *, GtkWidget *);
+static XX_gtk_file_chooser_set_extra_widget fl_gtk_file_chooser_set_extra_widget = NULL;
+
+// void gtk_widget_show_now(GtkWidget *);
+typedef void (*XX_gtk_widget_show_now)(GtkWidget *);
+static XX_gtk_widget_show_now fl_gtk_widget_show_now = NULL;
+
+// GdkWindow* gtk_widget_get_window(GtkWidget *);
+typedef GdkWindow* (*XX_gtk_widget_get_window)(GtkWidget *);
+static XX_gtk_widget_get_window fl_gtk_widget_get_window = NULL;
+
+// Window gdk_x11_drawable_get_xid(GdkWindow *);
+typedef Window (*XX_gdk_x11_drawable_get_xid)(GdkWindow *);
+static XX_gdk_x11_drawable_get_xid fl_gdk_x11_drawable_get_xid = NULL;
+
+// GtkWidget *gtk_check_button_new_with_label(const gchar *);
+typedef GtkWidget* (*XX_gtk_check_button_new_with_label)(const gchar *);
+static XX_gtk_check_button_new_with_label fl_gtk_check_button_new_with_label = NULL;
+
+// gulong g_signal_connect_data(gpointer, const gchar *, GCallback, gpointer, GClosureNotify, GConnectFlags);
+typedef gulong (*XX_g_signal_connect_data)(gpointer, const gchar *, GCallback, gpointer, GClosureNotify, GConnectFlags);
+static XX_g_signal_connect_data fl_g_signal_connect_data = NULL;
+
+// gboolean gtk_toggle_button_get_active(GtkToggleButton *);
+typedef gboolean (*XX_gtk_toggle_button_get_active)(GtkToggleButton*);
+static XX_gtk_toggle_button_get_active fl_gtk_toggle_button_get_active = NULL;
+
+// void gtk_file_chooser_set_show_hidden(GtkFileChooser *, gboolean);
+typedef void (*XX_gtk_file_chooser_set_show_hidden)(GtkFileChooser *, gboolean);
+static XX_gtk_file_chooser_set_show_hidden fl_gtk_file_chooser_set_show_hidden = NULL;
+
+// gboolean gtk_file_chooser_get_show_hidden(GtkFileChooser *);
+typedef gboolean (*XX_gtk_file_chooser_get_show_hidden)(GtkFileChooser *);
+static XX_gtk_file_chooser_get_show_hidden fl_gtk_file_chooser_get_show_hidden = NULL;
+
+// void gtk_toggle_button_set_active(GtkToggleButton *, gboolean);
+typedef void (*XX_gtk_toggle_button_set_active)(GtkToggleButton *, gboolean);
+static XX_gtk_toggle_button_set_active fl_gtk_toggle_button_set_active = NULL;
+
+
+Fl_GTK_File_Chooser::Fl_GTK_File_Chooser(int val) : Fl_FLTK_File_Chooser(-1)
+{
+  gtkw_ptr   = NULL;    // used to hold a GtkWidget* 
+  gtkw_slist = NULL;    // will hold the returned file names in a multi-selection...
+  gtkw_count = 0;       // How many items were selected?
+  gtkw_filename = NULL; // holds the last name we read back in a single file selection...
+  gtkw_title = NULL;    // dialog title
+  _btype = val;
+  previous_filter = NULL;
+}
+
+Fl_GTK_File_Chooser::~Fl_GTK_File_Chooser()
+{
+  // Should free up resources taken for...
+  if(gtkw_ptr) { 
+    fl_gtk_widget_destroy (gtkw_ptr);
+    gtkw_ptr = NULL;
+  }
+  if(gtkw_filename) {
+    fl_g_free(gtkw_filename);
+    gtkw_filename = NULL;
+  }
+  if(gtkw_slist) {
+    GSList *iter = (GSList *)gtkw_slist;
+    while(iter) {
+      if(iter->data) fl_g_free(iter->data);
+      iter = g_slist_next(iter);
+    }
+    fl_g_slist_free((GSList *)gtkw_slist);
+    gtkw_slist = NULL;
+  }
+  gtkw_count = 0; // assume we have no files selected now
+  gtkw_title = strfree(gtkw_title);
+}
+
+void Fl_GTK_File_Chooser::type(int val) {
+  _btype = val;
+}
+
+int Fl_GTK_File_Chooser::count() const {
+  return gtkw_count;
+}
+
+const char *Fl_GTK_File_Chooser::filename() const
+{
+  if(gtkw_ptr) {
+    if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) {
+      return gtkw_filename;
+    }
+    else {
+      GSList *iter = (GSList *)gtkw_slist;
+      char *nm = (char *)iter->data;
+      return nm;
+    }
+  }
+  return("");
+}
+
+const char *Fl_GTK_File_Chooser::filename(int i) const
+{
+  if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) {
+    return gtkw_filename;
+  }
+  else {
+    if ((unsigned)i < gtkw_count) {
+      GSList *iter = (GSList *)gtkw_slist;
+      char *nm = (char *)fl_g_slist_nth_data(iter, i);
+      return nm;
+    }
+  }
+  return("");
+}
+
+void Fl_GTK_File_Chooser::title(const char *val)
+{
+  strfree(gtkw_title);
+  gtkw_title = strnew(val);
+}
+
+const char* Fl_GTK_File_Chooser::title() const
+{
+  return gtkw_title;
+}
+
+/* changes the extension of the outfile in the chooser according to newly selected filter */
+void Fl_GTK_File_Chooser::changed_output_type(const char *filter)
+{
+  if ( !(options()&Fl_Native_File_Chooser::USE_FILTER_EXT) ) return;
+  if (strchr(filter, '(') || strchr(filter, '{') || strchr(filter+1, '*') || strncmp(filter, "*.", 2)) return;
+  const char *p = fl_gtk_file_chooser_get_filename((GtkFileChooser*)gtkw_ptr);
+  if (!p) return;
+  p = fl_filename_name(p);
+  const char *q = strrchr(p, '.');
+  if (!q) q = p + strlen(p);
+  char *r = new char[strlen(p) + strlen(filter)];
+  strcpy(r, p);
+  strcpy(r + (q - p), filter + 1);
+  fl_gtk_file_chooser_set_current_name((GtkFileChooser*)gtkw_ptr, r);
+  delete[] r;
+}
+
+/* Filters files before display in chooser. 
+ Also used to detect when the filter just changed */
+gboolean Fl_GTK_File_Chooser::custom_gtk_filter_function(const GtkFileFilterInfo *info, Fl_GTK_File_Chooser::pair* p)
+{
+  if (p->running->previous_filter != p->filter) {
+    p->running->changed_output_type(p->filter);
+    p->running->previous_filter = p->filter;
+    }
+  return (gboolean)fl_filename_match(info->filename, p->filter);
+}
+
+void Fl_GTK_File_Chooser::free_pair(Fl_GTK_File_Chooser::pair *p)
+{
+  delete p;
+}
+
+static void hidden_files_cb(GtkToggleButton *togglebutton, gpointer user_data)
+{
+  gboolean state = fl_gtk_toggle_button_get_active(togglebutton);
+  fl_gtk_file_chooser_set_show_hidden((GtkFileChooser*)user_data, state);
+}
+
+int Fl_GTK_File_Chooser::show()
+{
+  // The point here is that after running a GTK dialog, the calling program's current locale is modified.
+  // To avoid that, we memorize the calling program's current locale, and the locale as modified
+  // by GTK after the first dialog use. We restore the calling program's current locale 
+  // before returning, and we set the locale as modified by GTK before subsequent GTK dialog uses.
+  static bool first = true;
+  char *p;
+  char *before = NULL;
+  static char *gtk_wants = NULL;
+  // record in before the calling program's current locale
+  p = setlocale(LC_ALL, NULL);
+  if (p) before = strdup(p);
+  if (gtk_wants) { // set the locale as GTK 'wants it'
+    setlocale(LC_ALL, gtk_wants);
+  }
+  int retval = fl_gtk_chooser_wrapper(); // may change the locale
+  if (first) {
+    first = false;
+    // record in gtk_wants the locale as modified by the GTK dialog
+    p = setlocale(LC_ALL, NULL);
+    if (p) gtk_wants = strdup(p);
+  }
+  if (before) {
+    setlocale(LC_ALL, before); // restore calling program's current locale
+    free(before);
+    }
+  return retval;
+}
+
+
+static void run_response_handler(GtkDialog *dialog, gint response_id, gpointer data)
+{
+  gint *ri = (gint *)data;
+  *ri = response_id;
+}
+
+
+int Fl_GTK_File_Chooser::fl_gtk_chooser_wrapper()
+{
+  int result = 1;
+  static int have_gtk_init = 0;
+  if(!have_gtk_init) {
+    have_gtk_init = -1;
+    int ac = 0;
+    fl_gtk_init_check(&ac, NULL);
+  }
+  
+  if(gtkw_ptr) { // discard the previous dialog widget
+    fl_gtk_widget_destroy (gtkw_ptr);
+    gtkw_ptr = NULL;
+  }
+  
+  // set the dialog action type
+  GtkFileChooserAction gtw_action_type;
+  switch (_btype) {
+    case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
+    case Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY:
+      gtw_action_type = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
+      break;
+      
+    case Fl_Native_File_Chooser::BROWSE_SAVE_FILE:
+      gtw_action_type = GTK_FILE_CHOOSER_ACTION_SAVE;
+      break;
+      
+    case Fl_Native_File_Chooser::BROWSE_SAVE_DIRECTORY:
+      gtw_action_type = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
+      break;
+      
+    case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
+    case Fl_Native_File_Chooser::BROWSE_FILE:
+    default:
+      gtw_action_type = GTK_FILE_CHOOSER_ACTION_OPEN;
+      break;
+  }
+  // create a new dialog
+  gtkw_ptr = fl_gtk_file_chooser_dialog_new (gtkw_title,
+					     NULL, /* parent_window */
+					     gtw_action_type,
+					     GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+					     gtw_action_type == GTK_FILE_CHOOSER_ACTION_SAVE || gtw_action_type == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER ? 
+					     GTK_STOCK_SAVE : GTK_STOCK_OPEN, 
+					     GTK_RESPONSE_ACCEPT,
+					     NULL);
+  // did we create a valid dialog widget?
+  if(!gtkw_ptr) {
+    // fail
+    return -1;
+  }
+  
+  // set the dialog properties
+  switch (_btype) {
+    case Fl_Native_File_Chooser::BROWSE_MULTI_DIRECTORY:
+    case Fl_Native_File_Chooser::BROWSE_MULTI_FILE:
+      fl_gtk_file_chooser_set_select_multiple((GtkFileChooser *)gtkw_ptr, TRUE);
+      break;
+      
+    case Fl_Native_File_Chooser::BROWSE_SAVE_FILE:
+      if (_preset_file)fl_gtk_file_chooser_set_current_name ((GtkFileChooser *)gtkw_ptr, fl_filename_name(_preset_file));
+      /* FALLTHROUGH */
+    case Fl_Native_File_Chooser::BROWSE_SAVE_DIRECTORY:
+      fl_gtk_file_chooser_set_create_folders((GtkFileChooser *)gtkw_ptr, TRUE);
+      fl_gtk_file_chooser_set_do_overwrite_confirmation ((GtkFileChooser *)gtkw_ptr, (_options & Fl_Native_File_Chooser::SAVEAS_CONFIRM)?TRUE:FALSE);
+      break;
+      
+    case Fl_Native_File_Chooser::BROWSE_DIRECTORY:
+    case Fl_Native_File_Chooser::BROWSE_FILE:
+    default:
+      break;
+  }
+  
+  if (_directory && _directory[0]) fl_gtk_file_chooser_set_current_folder((GtkFileChooser *)gtkw_ptr, _directory);
+  
+  GtkFileFilter **filter_tab = NULL;
+  if (_parsedfilt) {
+    filter_tab = new GtkFileFilter*[_nfilters];
+    char *filter = strdup(_parsedfilt);
+    char *p = strtok(filter, "\t");
+    int count = 0;
+    while (p) {
+      filter_tab[count] = fl_gtk_file_filter_new();
+      fl_gtk_file_filter_set_name(filter_tab[count], p);
+      p = strchr(p, '(') + 1;
+      char *q = strchr(p, ')'); *q = 0;
+      fl_gtk_file_filter_add_custom(filter_tab[count], 
+				    GTK_FILE_FILTER_FILENAME, 
+				    (GtkFileFilterFunc)Fl_GTK_File_Chooser::custom_gtk_filter_function, 
+				    new Fl_GTK_File_Chooser::pair(this, p), 
+				    (GDestroyNotify)Fl_GTK_File_Chooser::free_pair);
+      fl_gtk_file_chooser_add_filter((GtkFileChooser *)gtkw_ptr, filter_tab[count]);
+      p = strtok(NULL, "\t");
+      count++;
+    }
+    free(filter);
+    fl_gtk_file_chooser_set_filter((GtkFileChooser *)gtkw_ptr, filter_tab[_filtvalue]);
+    previous_filter = NULL;
+    if (gtw_action_type == GTK_FILE_CHOOSER_ACTION_OPEN) {
+      GtkFileFilter* gfilter = fl_gtk_file_filter_new();
+      fl_gtk_file_filter_set_name(gfilter, Fl_File_Chooser::all_files_label);
+      fl_gtk_file_filter_add_pattern(gfilter, "*");
+      fl_gtk_file_chooser_add_filter((GtkFileChooser *)gtkw_ptr, gfilter);
+    }
+  }
+  
+  GtkWidget *toggle = fl_gtk_check_button_new_with_label(Fl_File_Chooser::hidden_label);
+  fl_gtk_file_chooser_set_extra_widget((GtkFileChooser *)gtkw_ptr, toggle);
+  fl_g_signal_connect_data(toggle, "toggled", G_CALLBACK(hidden_files_cb), gtkw_ptr, NULL, (GConnectFlags) 0);
+  Fl_Window* firstw = Fl::first_window();
+  fl_gtk_widget_show_now(gtkw_ptr); // map the GTK window on screen
+  if (firstw) {
+    GdkWindow* gdkw = fl_gtk_widget_get_window(gtkw_ptr);
+    Window xw = fl_gdk_x11_drawable_get_xid(gdkw); // get the X11 ref of the GTK window
+    XSetTransientForHint(fl_display, xw, fl_xid(firstw)); // set the GTK window transient for the last FLTK win
+    }
+  gboolean state = fl_gtk_file_chooser_get_show_hidden((GtkFileChooser *)gtkw_ptr);
+  fl_gtk_toggle_button_set_active((GtkToggleButton *)toggle, state);
+  
+  gint response_id = GTK_RESPONSE_NONE;
+  fl_g_signal_connect_data(gtkw_ptr, "response", G_CALLBACK(run_response_handler), &response_id, NULL, (GConnectFlags) 0);
+  while (response_id == GTK_RESPONSE_NONE) { // loop that shows the GTK dialog window
+    fl_gtk_main_iteration(); // one iteration of the GTK event loop
+    while (XEventsQueued(fl_display, QueuedAfterReading)) { // emulate modal dialog
+      XEvent xevent;
+      XNextEvent(fl_display, &xevent);
+      Window xid = xevent.xany.window;
+      if (xevent.type == ConfigureNotify) xid = xevent.xmaprequest.window;
+      if (!fl_find(xid)) continue; // skip events to non-FLTK windows
+      // process Expose and ConfigureNotify events
+      if ( xevent.type == Expose || xevent.type == ConfigureNotify ) fl_handle(xevent); 
+    }
+    Fl::flush(); // do the drawings needed after Expose events
+  } 
+  
+  if (response_id == GTK_RESPONSE_ACCEPT) {
+    if (_parsedfilt) {
+      GtkFileFilter *gfilter = fl_gtk_file_chooser_get_filter((GtkFileChooser *)gtkw_ptr);
+      for (_filtvalue = 0; _filtvalue < _nfilters; _filtvalue++) {
+	if (filter_tab[_filtvalue] == gfilter) break;
+      }
+    }
+    
+    // discard any filenames or lists from previous calls
+    if(gtkw_filename) {
+      fl_g_free(gtkw_filename);
+      gtkw_filename = NULL;
+    }
+    if(gtkw_slist) {
+      GSList *iter = (GSList *)gtkw_slist;
+      while(iter) {
+        if(iter->data) fl_g_free(iter->data);
+        iter = g_slist_next(iter);
+      }
+      fl_g_slist_free((GSList *)gtkw_slist);
+      gtkw_slist = NULL;
+    }
+    gtkw_count = 0; // assume we have no files selected now
+    
+    if(fl_gtk_file_chooser_get_select_multiple((GtkFileChooser *)gtkw_ptr) == FALSE) {
+      gtkw_filename = fl_gtk_file_chooser_get_filename ((GtkFileChooser *)gtkw_ptr);
+      if (gtkw_filename) {
+        gtkw_count = 1;
+        result = 0;
+        //printf("single: %s\n", gtkw_filename);
+      }
+    }
+    else {
+      gtkw_slist = fl_gtk_file_chooser_get_filenames((GtkFileChooser *)gtkw_ptr);
+      gtkw_count = fl_g_slist_length((GSList *)gtkw_slist);
+      if(gtkw_count) result = 0;
+      
+      //      puts("multiple");
+      //      GSList *iter = (GSList *)gtkw_slist;
+      //      printf ("Selected %d files\n", gtkw_count);
+      //      while(iter) {
+      //        char *nm = (char *)iter->data;
+      //        printf("%s\n", nm);
+      //        iter = g_slist_next(iter);
+      //      }
+    }
+  }
+  delete[] filter_tab;
+  if ( response_id == GTK_RESPONSE_DELETE_EVENT) gtkw_ptr = NULL;
+  else fl_gtk_widget_hide (gtkw_ptr);
+  
+  // I think this is analogus to doing an Fl::check() - we need this here to make sure
+  // the GtkFileChooserDialog is removed from the display correctly
+  while (fl_gtk_events_pending ()) fl_gtk_main_iteration (); 
+  
+  return result;
+} // fl_gtk_chooser_wrapper
+
+// macro to help with the symbol loading boilerplate...
+#define GET_SYM(SSS, LLL) \
+dlerror();    /* Clear any existing error */  \
+fl_##SSS = (XX_##SSS)dlsym(LLL, #SSS);        \
+if ((pc_dl_error = dlerror()) != NULL)  {     \
+fprintf(stderr, "%s\n", pc_dl_error);       \
+did_find_GTK_libs = 0;                      \
+return; }
+
+static void* fl_dlopen(const char *filename1, const char *filename2)
+{
+  void *ptr = dlopen(filename1, RTLD_LAZY | RTLD_GLOBAL);
+  if (!ptr) ptr = dlopen(filename2, RTLD_LAZY | RTLD_GLOBAL);
+  return ptr;
+}
+
+/* 
+ * Use dlopen to see if we can load the gtk dynamic libraries that
+ * will allow us to create a GtkFileChooserDialog() on the fly,
+ * without linking to the GTK libs at compile time.
+ */
+void Fl_GTK_File_Chooser::probe_for_GTK_libs(void) {
+  void *ptr_glib    = NULL;
+  void *ptr_gtk     = NULL;
+  
+#   ifdef __APPLE_CC__ // allows testing on Darwin + X11
+  ptr_glib    = dlopen("/sw/lib/libglib-2.0.dylib", RTLD_LAZY | RTLD_GLOBAL);
+#   else
+  ptr_glib    = fl_dlopen("libglib-2.0.so", "libglib-2.0.so.0");
+#   endif
+  // Try first with GTK2
+#   ifdef __APPLE_CC__ // allows testing on Darwin + X11
+  ptr_gtk     = dlopen("/sw/lib/libgtk-x11-2.0.dylib", RTLD_LAZY | RTLD_GLOBAL);
+#else
+  ptr_gtk     = fl_dlopen("libgtk-x11-2.0.so", "libgtk-x11-2.0.so.0");
+#endif
+  if (ptr_gtk && ptr_glib) {
+#ifdef DEBUG
+    puts("selected GTK-2\n");
+#endif
+  }
+  else {// Try then with GTK3
+    ptr_gtk     = fl_dlopen("libgtk-3.so", "libgtk-3.so.0");
+#ifdef DEBUG
+    if (ptr_gtk && ptr_glib) {
+      puts("selected GTK-3\n");
+    }
+#endif
+  }
+  
+  if((!ptr_glib) || (!ptr_gtk)) {
+#ifdef DEBUG
+    puts("Failure to load libglib or libgtk");
+#endif
+    did_find_GTK_libs = 0;
+    return;
+  }
+  
+  char *pc_dl_error; // used to report errors by the GET_SYM macro...
+  // items we need from GLib
+  GET_SYM(g_free, ptr_glib);
+  GET_SYM(g_slist_nth_data, ptr_glib);
+  GET_SYM(g_slist_length, ptr_glib);
+  GET_SYM(g_slist_free, ptr_glib);
+  // items we need from GTK
+  GET_SYM(gtk_init_check, ptr_gtk);
+  GET_SYM(gtk_widget_destroy, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_select_multiple, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_do_overwrite_confirmation, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_current_name, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_current_folder, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_create_folders, ptr_gtk);
+  GET_SYM(gtk_file_chooser_get_select_multiple, ptr_gtk);
+  GET_SYM(gtk_widget_hide, ptr_gtk);
+  GET_SYM(gtk_file_chooser_get_filename, ptr_gtk);
+  GET_SYM(gtk_file_chooser_get_filenames, ptr_gtk);
+  GET_SYM(gtk_main_iteration, ptr_gtk);
+  GET_SYM(gtk_events_pending, ptr_gtk);
+  GET_SYM(gtk_file_chooser_dialog_new, ptr_gtk);
+  GET_SYM(gtk_file_chooser_add_filter, ptr_gtk);
+  GET_SYM(gtk_file_chooser_get_filter, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_filter, ptr_gtk);
+  GET_SYM(gtk_file_filter_new, ptr_gtk);
+  GET_SYM(gtk_file_filter_add_pattern, ptr_gtk);
+  GET_SYM(gtk_file_filter_add_custom, ptr_gtk);
+  GET_SYM(gtk_file_filter_set_name, ptr_gtk);
+  GET_SYM(gtk_file_filter_get_name, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_extra_widget, ptr_gtk);
+  GET_SYM(gtk_widget_show_now, ptr_gtk);
+  GET_SYM(gtk_widget_get_window, ptr_gtk);
+  GET_SYM(gdk_x11_drawable_get_xid, ptr_gtk);
+  GET_SYM(gtk_check_button_new_with_label, ptr_gtk);
+  GET_SYM(g_signal_connect_data, ptr_gtk);
+  GET_SYM(gtk_toggle_button_get_active, ptr_gtk);
+  GET_SYM(gtk_file_chooser_set_show_hidden, ptr_gtk);
+  GET_SYM(gtk_file_chooser_get_show_hidden, ptr_gtk);
+  GET_SYM(gtk_toggle_button_set_active, ptr_gtk);
+  
+  did_find_GTK_libs = 1;
+} // probe_for_GTK_libs
+
+//
+// End of "$Id$".
+//

+ 70 - 38
fltk/src/Fl_Native_File_Chooser_MAC.mm

@@ -1,4 +1,4 @@
-// "$Id: Fl_Native_File_Chooser_MAC.mm 9798 2013-01-16 15:25:39Z manolo $"
+// "$Id: Fl_Native_File_Chooser_MAC.mm 9825 2013-02-19 15:19:58Z manolo $"
 //
 //
 // FLTK native OS file chooser widget
 // FLTK native OS file chooser widget
 //
 //
@@ -344,8 +344,7 @@ int Fl_Native_File_Chooser::filters() const {
 
 
 int Fl_Native_File_Chooser::get_saveas_basename(void) {
 int Fl_Native_File_Chooser::get_saveas_basename(void) {
   char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] );
   char *q = strdup( [[[(NSSavePanel*)_panel URL] path] UTF8String] );
-  id delegate = [(NSSavePanel*)_panel delegate];
-  if (delegate != nil) {
+  if ( !(_options & SAVEAS_CONFIRM) ) {
     const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String];
     const char *d = [[[[(NSSavePanel*)_panel URL] path] stringByDeletingLastPathComponent] UTF8String];
     int l = strlen(d) + 1;
     int l = strlen(d) + 1;
     if (strcmp(d, "/") == 0) l = 1;
     if (strcmp(d, "/") == 0) l = 1;
@@ -435,16 +434,52 @@ static char *prepareMacFilter(int count, const char *filter, char **patterns) {
 <NSOpenSavePanelDelegate>
 <NSOpenSavePanelDelegate>
 #endif
 #endif
 {
 {
+  NSSavePanel *dialog;
+  BOOL saveas_confirm;
 }
 }
 - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag;
 - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag;
+- (void)changedPopup:(id)sender;
+- (void)panel:(NSSavePanel*)p;
+- (void)option:(BOOL)o;
 @end
 @end
 @implementation FLsaveDelegate
 @implementation FLsaveDelegate
 - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag
 - (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag
 {
 {
-  if (! okFlag) return filename;
+  if ( !okFlag || saveas_confirm ) return filename;
   // User has clicked save, and no overwrite confirmation should occur.
   // User has clicked save, and no overwrite confirmation should occur.
   // To get the latter, we need to change the name we return (hence the prefix):
   // To get the latter, we need to change the name we return (hence the prefix):
   return [@ UNLIKELYPREFIX stringByAppendingString:filename];
   return [@ UNLIKELYPREFIX stringByAppendingString:filename];
+}
+- (void)changedPopup:(id)sender
+// runs when the save panel popup menu changes output file type
+// correspondingly changes the extension of the output file name
+{
+  if (fl_mac_os_version < 100600) return; // because of setNameFieldStringValue and nameFieldStringValue
+  char *s = strdup([[(NSPopUpButton*)sender titleOfSelectedItem] UTF8String]);
+  if (!s) return;
+  char *p = strchr(s, '(');
+  if (!p) p = s;
+  p = strchr(p, '.');
+  if (!p) {free(s); return;}
+  p++;
+  while (*p == ' ') p++;
+  if (!p || *p == '{') {free(s); return;}
+  char *q = p+1;
+  while (*q != ' ' && *q != ')' && *q != 0) q++;
+  *q = 0;
+  NSString *ns = [NSString stringWithFormat:@"%@.%@", 
+		  [[dialog performSelector:@selector(nameFieldStringValue)] stringByDeletingPathExtension],
+		  [NSString stringWithUTF8String:p]];
+  free(s);
+  [dialog performSelector:@selector(setNameFieldStringValue:) withObject:ns];
+}
+- (void)panel:(NSSavePanel*)p
+{
+  dialog = p;
+}
+- (void) option:(BOOL)o
+{
+  saveas_confirm = o;
 }
 }
 @end
 @end
   
   
@@ -501,8 +536,8 @@ int Fl_Native_File_Chooser::runmodal()
   }
   }
   if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory];
   if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory];
   if (fl_mac_os_version >= 100600) {
   if (fl_mac_os_version >= 100600) {
-    if (dir) [(NSSavePanel*)_panel performSelector:@selector(setDirectoryURL) withObject:[NSURL fileURLWithPath:dir]];
-    if (fname) [(NSSavePanel*)_panel performSelector:@selector(setNameFieldStringValue) withObject:fname];
+    if (dir) [(NSSavePanel*)_panel performSelector:@selector(setDirectoryURL:) withObject:[NSURL fileURLWithPath:dir]];
+    if (fname) [(NSSavePanel*)_panel performSelector:@selector(setNameFieldStringValue:) withObject:fname];
     retval = [(NSSavePanel*)_panel runModal];
     retval = [(NSSavePanel*)_panel runModal];
   }
   }
   else {
   else {
@@ -541,7 +576,6 @@ int Fl_Native_File_Chooser::post() {
       _panel =  [NSSavePanel savePanel];
       _panel =  [NSSavePanel savePanel];
       break;
       break;
   }
   }
-  int retval;
   NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
   NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
   [(NSSavePanel*)_panel setTitle:nstitle];
   [(NSSavePanel*)_panel setTitle:nstitle];
   switch (_btype) {
   switch (_btype) {
@@ -561,8 +595,9 @@ int Fl_Native_File_Chooser::post() {
   
   
   // SHOW THE DIALOG
   // SHOW THE DIALOG
   NSWindow *key = [NSApp keyWindow];
   NSWindow *key = [NSApp keyWindow];
-  if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) {
-    NSPopUpButton *popup = nil;
+  BOOL is_open_panel = [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]];
+  NSPopUpButton *popup = nil;
+  if ( is_open_panel ) {
     if (_filt_total) {
     if (_filt_total) {
       char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
       char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
       popup = createPopupAccessory((NSSavePanel*)_panel, t, Fl_File_Chooser::show_label, 0);
       popup = createPopupAccessory((NSSavePanel*)_panel, t, Fl_File_Chooser::show_label, 0);
@@ -571,19 +606,35 @@ int Fl_Native_File_Chooser::post() {
       [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:Fl_File_Chooser::all_files_label]];
       [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:Fl_File_Chooser::all_files_label]];
       [popup setAction:@selector(validateVisibleColumns)];
       [popup setAction:@selector(validateVisibleColumns)];
       [popup setTarget:(NSObject*)_panel];
       [popup setTarget:(NSObject*)_panel];
-      static FLopenDelegate *openDelegate = nil;
-      if (openDelegate == nil) {
-	// not to be ever freed
-	openDelegate = [[FLopenDelegate alloc] init];
-      }
+      FLopenDelegate *openDelegate = [[[FLopenDelegate alloc] init] autorelease];
       [openDelegate setPopup:popup filter_pattern:_filt_patt];
       [openDelegate setPopup:popup filter_pattern:_filt_patt];
       [(NSOpenPanel*)_panel setDelegate:openDelegate];
       [(NSOpenPanel*)_panel setDelegate:openDelegate];
     }
     }
-    retval = runmodal();
+  }
+  else {
+    FLsaveDelegate *saveDelegate = [[[FLsaveDelegate alloc] init] autorelease]; 
+    [(NSSavePanel*)_panel setAllowsOtherFileTypes:YES];
+    [(NSSavePanel*)_panel setDelegate:saveDelegate];
+    [saveDelegate option:(_options & SAVEAS_CONFIRM)];
     if (_filt_total) {
     if (_filt_total) {
-      _filt_value = [popup indexOfSelectedItem];
+      if (_filt_value >= _filt_total) _filt_value = _filt_total - 1;
+      char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
+      popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value);
+      delete[] t;
+      if (_options & USE_FILTER_EXT) {
+	[popup setAction:@selector(changedPopup:)];
+	[popup setTarget:saveDelegate];
+	[saveDelegate panel:(NSSavePanel*)_panel];
+      }
+      [(NSSavePanel*)_panel setCanSelectHiddenExtension:YES];
     }
     }
-    if ( retval == NSOKButton ) {
+  }
+  int retval = runmodal();
+  if (_filt_total) {
+    _filt_value = [popup indexOfSelectedItem];
+  }
+  if ( retval == NSOKButton ) {
+    if (is_open_panel) {
       clear_pathnames();
       clear_pathnames();
       NSArray *array = [(NSOpenPanel*)_panel URLs];
       NSArray *array = [(NSOpenPanel*)_panel URLs];
       _tpathnames = [array count];
       _tpathnames = [array count];
@@ -592,26 +643,7 @@ int Fl_Native_File_Chooser::post() {
 	_pathnames[i] = strnew([[(NSURL*)[array objectAtIndex:i] path] UTF8String]);
 	_pathnames[i] = strnew([[(NSURL*)[array objectAtIndex:i] path] UTF8String]);
       }
       }
     }
     }
-  }
-  else {
-    NSPopUpButton *popup = nil;
-    [(NSSavePanel*)_panel setAllowsOtherFileTypes:YES];
-    if ( !(_options & SAVEAS_CONFIRM) ) {
-      static FLsaveDelegate *saveDelegate = nil;
-      if (saveDelegate == nil)saveDelegate = [[FLsaveDelegate alloc] init]; // not to be ever freed
-      [(NSSavePanel*)_panel setDelegate:saveDelegate];
-    }
-    if (_filt_total) {
-      if (_filt_value >= _filt_total) _filt_value = _filt_total - 1;
-      char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
-      popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value);
-      delete[] t;
-    }
-    retval = runmodal();
-    if (_filt_total) {
-      _filt_value = [popup indexOfSelectedItem];
-    }
-    if ( retval == NSOKButton ) get_saveas_basename();
+    else get_saveas_basename();
   }
   }
   [key makeKeyWindow];
   [key makeKeyWindow];
   [localPool release];
   [localPool release];
@@ -621,5 +653,5 @@ int Fl_Native_File_Chooser::post() {
 #endif // __APPLE__
 #endif // __APPLE__
 
 
 //
 //
-// End of "$Id: Fl_Native_File_Chooser_MAC.mm 9798 2013-01-16 15:25:39Z manolo $".
+// End of "$Id: Fl_Native_File_Chooser_MAC.mm 9825 2013-02-19 15:19:58Z manolo $".
 //
 //

+ 87 - 51
fltk/src/Fl_Native_File_Chooser_WIN32.cxx

@@ -1,4 +1,4 @@
-// "$Id: Fl_Native_File_Chooser_WIN32.cxx 9629 2012-06-26 07:03:46Z greg.ercolano $"
+// "$Id: Fl_Native_File_Chooser_WIN32.cxx 10138 2014-05-01 09:00:30Z ianmacarthur $"
 //
 //
 // FLTK native OS file chooser widget
 // FLTK native OS file chooser widget
 //
 //
@@ -39,7 +39,6 @@ char *wchartoutf8(LPCWSTR in);  //MG
 #define RCURLY_CHR	'}'
 #define RCURLY_CHR	'}'
 #define LBRACKET_CHR	'['
 #define LBRACKET_CHR	'['
 #define RBRACKET_CHR	']'
 #define RBRACKET_CHR	']'
-#define MAXFILTERS	80
 
 
 void fl_OleInitialize();	// in Fl.cxx (Windows only)
 void fl_OleInitialize();	// in Fl.cxx (Windows only)
 
 
@@ -54,7 +53,7 @@ static void dnullprint(char *wp) {
       return;
       return;
     } else if ( wp[t] == '\0' ) {
     } else if ( wp[t] == '\0' ) {
       printf("\\0");
       printf("\\0");
-    } else { 
+    } else {
       printf("%c",wp[t]);
       printf("%c",wp[t]);
     }
     }
   }
   }
@@ -96,7 +95,7 @@ static void dnullcat(char*&wp, const char *string, int n = -1 ) {
     // Make copy of wp into larger buffer
     // Make copy of wp into larger buffer
     char *tmp = new char[wplen + inlen + 4];
     char *tmp = new char[wplen + inlen + 4];
     memcpy(tmp, wp, wplen+2);	// copy of wp plus doublenull
     memcpy(tmp, wp, wplen+2);	// copy of wp plus doublenull
-    delete [] wp;			// delete old wp
+    delete[] wp;		// delete old wp
     wp = tmp;			// use new copy
     wp = tmp;			// use new copy
     //DEBUG printf("DEBUG: dnullcat COPY: <"); dnullprint(wp); printf("> (wplen=%d)\n", wplen);
     //DEBUG printf("DEBUG: dnullcat COPY: <"); dnullprint(wp); printf("> (wplen=%d)\n", wplen);
   }
   }
@@ -191,7 +190,7 @@ void Fl_Native_File_Chooser::clear_pathnames() {
     while ( --_tpathnames >= 0 ) {
     while ( --_tpathnames >= 0 ) {
       _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
       _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
     }
     }
-    delete [] _pathnames;
+    delete[] _pathnames;
     _pathnames = NULL;
     _pathnames = NULL;
   }
   }
   _tpathnames = 0;
   _tpathnames = 0;
@@ -214,9 +213,9 @@ void Fl_Native_File_Chooser::add_pathname(const char *s) {
   } else {
   } else {
     // Grow array by 1
     // Grow array by 1
     char **tmp = new char*[_tpathnames+1];		// create new buffer
     char **tmp = new char*[_tpathnames+1];		// create new buffer
-    memcpy((void*)tmp, (void*)_pathnames, 
+    memcpy((void*)tmp, (void*)_pathnames,
 		       sizeof(char*)*_tpathnames);	// copy old
 		       sizeof(char*)*_tpathnames);	// copy old
-    delete [] _pathnames;				// delete old
+    delete[] _pathnames;				// delete old
     _pathnames = tmp;					// use new
     _pathnames = tmp;					// use new
     ++_tpathnames;
     ++_tpathnames;
   }
   }
@@ -237,11 +236,11 @@ void Fl_Native_File_Chooser::FreePIDL(LPITEMIDLIST pidl) {
 void Fl_Native_File_Chooser::ClearOFN() {
 void Fl_Native_File_Chooser::ClearOFN() {
   // Free any previously allocated lpstrFile before zeroing out _ofn
   // Free any previously allocated lpstrFile before zeroing out _ofn
   if ( _ofn.lpstrFile ) {
   if ( _ofn.lpstrFile ) {
-    delete [] _ofn.lpstrFile;
+    delete[] _ofn.lpstrFile;
     _ofn.lpstrFile = NULL;
     _ofn.lpstrFile = NULL;
   }
   }
   if ( _ofn.lpstrInitialDir ) {
   if ( _ofn.lpstrInitialDir ) {
-    delete [] (TCHAR*) _ofn.lpstrInitialDir; //msvc6 compilation fix
+    delete[] (TCHAR*) _ofn.lpstrInitialDir; //msvc6 compilation fix
     _ofn.lpstrInitialDir = NULL;
     _ofn.lpstrInitialDir = NULL;
   }
   }
   _ofn.lpstrFilter = NULL;		// (deleted elsewhere)
   _ofn.lpstrFilter = NULL;		// (deleted elsewhere)
@@ -364,7 +363,7 @@ int Fl_Native_File_Chooser::showfile() {
   char *oldcwd = 0;
   char *oldcwd = 0;
   DWORD oldcwdsz = GetCurrentDirectory(0,0);
   DWORD oldcwdsz = GetCurrentDirectory(0,0);
   if ( oldcwdsz > 0 ) {
   if ( oldcwdsz > 0 ) {
-    oldcwd = (char*)malloc(oldcwdsz); 
+    oldcwd = (char*)malloc(oldcwdsz);
     if (GetCurrentDirectory(oldcwdsz, oldcwd) == 0 ) {
     if (GetCurrentDirectory(oldcwdsz, oldcwd) == 0 ) {
       free(oldcwd); oldcwd = 0;
       free(oldcwd); oldcwd = 0;
     }
     }
@@ -376,30 +375,25 @@ int Fl_Native_File_Chooser::showfile() {
   } else {
   } else {
     err = GetOpenFileNameW(&_ofn);
     err = GetOpenFileNameW(&_ofn);
   }
   }
+  // GET EXTENDED ERROR
+  int exterr = CommDlgExtendedError();
+  // XXX: RESTORE CWD
+  if ( oldcwd ) {
+    SetCurrentDirectory(oldcwd);
+    free(oldcwd); oldcwd = 0;
+  }
+  // ERROR OR CANCEL?
   if ( err == 0 ) {
   if ( err == 0 ) {
-    // EXTENDED ERROR CHECK
-    int err = CommDlgExtendedError();
-    // CANCEL?
-    if ( err == 0 ) return(1);	// user hit 'cancel'
-    // AN ERROR OCCURRED
+    if ( exterr == 0 ) return(1);	// user hit cancel
+    // Otherwise, an error occurred..
     char msg[80];
     char msg[80];
     sprintf(msg, "CommDlgExtendedError() code=%d", err);
     sprintf(msg, "CommDlgExtendedError() code=%d", err);
     errmsg(msg);
     errmsg(msg);
-    // XXX: RESTORE CWD
-    if ( oldcwd ) {
-      SetCurrentDirectory(oldcwd);
-      free(oldcwd); oldcwd = 0;
-    }
     return(-1);
     return(-1);
   }
   }
-  // XXX: RESTORE CWD
-  if ( oldcwd ) {
-    SetCurrentDirectory(oldcwd);
-    free(oldcwd); oldcwd = 0;
-  }
   // PREPARE PATHNAMES FOR RETURN
   // PREPARE PATHNAMES FOR RETURN
   switch ( _btype ) {
   switch ( _btype ) {
-    case BROWSE_FILE: 
+    case BROWSE_FILE:
     case BROWSE_SAVE_FILE:
     case BROWSE_SAVE_FILE:
       set_single_pathname(wchartoutf8(_ofn.lpstrFile));
       set_single_pathname(wchartoutf8(_ofn.lpstrFile));
       // Win2Unix(_pathnames[_tpathnames-1]);
       // Win2Unix(_pathnames[_tpathnames-1]);
@@ -412,8 +406,8 @@ int Fl_Native_File_Chooser::showfile() {
 	// WALK STRING SEARCHING FOR 'DOUBLE-NULL'
 	// WALK STRING SEARCHING FOR 'DOUBLE-NULL'
 	//     eg. "/dir/name\0foo1\0foo2\0foo3\0\0"
 	//     eg. "/dir/name\0foo1\0foo2\0foo3\0\0"
 	//
 	//
-	char pathname[FNFC_MAX_PATH]; 
-	for ( const WCHAR *s = dirname + dirlen + 1; 
+	char pathname[FNFC_MAX_PATH];
+	for ( const WCHAR *s = dirname + dirlen + 1;
 		 *s; s+= (wcslen(s)+1)) {
 		 *s; s+= (wcslen(s)+1)) {
 		strcpy(pathname, wchartoutf8(dirname));
 		strcpy(pathname, wchartoutf8(dirname));
 		strcat(pathname, "\\");
 		strcat(pathname, "\\");
@@ -427,7 +421,7 @@ int Fl_Native_File_Chooser::showfile() {
       //    not to grok forward slashes, passing back as a 'filename'..!
       //    not to grok forward slashes, passing back as a 'filename'..!
       //
       //
       if ( _tpathnames == 0 ) {
       if ( _tpathnames == 0 ) {
-	add_pathname(wchartoutf8(dirname)); 
+	add_pathname(wchartoutf8(dirname));
 	// Win2Unix(_pathnames[_tpathnames-1]);
 	// Win2Unix(_pathnames[_tpathnames-1]);
       }
       }
       break;
       break;
@@ -459,7 +453,7 @@ int CALLBACK Fl_Native_File_Chooser::Dir_CB(HWND win, UINT msg, LPARAM param, LP
       }
       }
       break;
       break;
     case BFFM_VALIDATEFAILED:
     case BFFM_VALIDATEFAILED:
-      // we could pop up an annoying message here. 
+      // we could pop up an annoying message here.
       // also needs set ulFlags |= BIF_VALIDATE
       // also needs set ulFlags |= BIF_VALIDATE
       break;
       break;
     default:
     default:
@@ -477,7 +471,16 @@ int Fl_Native_File_Chooser::showdir() {
   // PARENT WINDOW
   // PARENT WINDOW
   _binf.hwndOwner = GetForegroundWindow();
   _binf.hwndOwner = GetForegroundWindow();
   // DIALOG TITLE
   // DIALOG TITLE
-  _binf.lpszTitle = _title ? _title : NULL;
+  //_binf.lpszTitle = _title ? _title : NULL;
+  if (_title) {
+    static WCHAR wtitle[256];
+    wcsncpy(wtitle, utf8towchar(_title), 256);
+    wtitle[255] = 0;
+    _binf.lpszTitle =  wtitle;
+  } else {
+    _binf.lpszTitle = NULL;
+  }
+
   // FLAGS
   // FLAGS
   _binf.ulFlags = 0; 		// initialize
   _binf.ulFlags = 0; 		// initialize
 
 
@@ -510,8 +513,10 @@ int Fl_Native_File_Chooser::showdir() {
 #endif
 #endif
 
 
   // BUFFER
   // BUFFER
-  char displayname[FNFC_MAX_PATH];
+  //char displayname[FNFC_MAX_PATH];
+  WCHAR displayname[FNFC_MAX_PATH];
   _binf.pszDisplayName = displayname;
   _binf.pszDisplayName = displayname;
+
   // PRESET DIR
   // PRESET DIR
   char presetname[FNFC_MAX_PATH];
   char presetname[FNFC_MAX_PATH];
   if ( _directory ) {
   if ( _directory ) {
@@ -522,7 +527,7 @@ int Fl_Native_File_Chooser::showdir() {
   else _binf.lParam = 0;
   else _binf.lParam = 0;
   _binf.lpfn = Dir_CB;
   _binf.lpfn = Dir_CB;
   // OPEN BROWSER
   // OPEN BROWSER
-  LPITEMIDLIST pidl = SHBrowseForFolder(&_binf);
+  LPITEMIDLIST pidl = SHBrowseForFolderW(&_binf);
   // CANCEL?
   // CANCEL?
   if ( pidl == NULL ) return(1);
   if ( pidl == NULL ) return(1);
 
 
@@ -530,13 +535,14 @@ int Fl_Native_File_Chooser::showdir() {
   // TBD: expand NetHood shortcuts from this PIDL??
   // TBD: expand NetHood shortcuts from this PIDL??
   // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
   // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shbrowseforfolder.asp
 
 
-  TCHAR path[FNFC_MAX_PATH];
-  if ( SHGetPathFromIDList(pidl, path) ) {
+  WCHAR path[FNFC_MAX_PATH];
+  if ( SHGetPathFromIDListW(pidl, path) ) {
     // Win2Unix(path);
     // Win2Unix(path);
-    add_pathname(path);
+    //add_pathname(path);
+    add_pathname(wchartoutf8(path));
   }
   }
   FreePIDL(pidl);
   FreePIDL(pidl);
-  if ( !strlen(path) ) return(1);             // don't return empty pathnames
+  if ( !wcslen(path) ) return(1);             // don't return empty pathnames
   return(0);
   return(0);
 }
 }
 
 
@@ -546,8 +552,8 @@ int Fl_Native_File_Chooser::showdir() {
 //   -1 - failed; errmsg() has reason
 //   -1 - failed; errmsg() has reason
 //
 //
 int Fl_Native_File_Chooser::show() {
 int Fl_Native_File_Chooser::show() {
-  if ( _btype == BROWSE_DIRECTORY || 
-       _btype == BROWSE_MULTI_DIRECTORY || 
+  if ( _btype == BROWSE_DIRECTORY ||
+       _btype == BROWSE_MULTI_DIRECTORY ||
        _btype == BROWSE_SAVE_DIRECTORY ) {
        _btype == BROWSE_SAVE_DIRECTORY ) {
     return(showdir());
     return(showdir());
   } else {
   } else {
@@ -620,7 +626,7 @@ void Fl_Native_File_Chooser::filter(const char *val) {
   add_filter("All Files", "*.*");	// always include 'all files' option
   add_filter("All Files", "*.*");	// always include 'all files' option
 
 
 #ifdef DEBUG
 #ifdef DEBUG
-  nullprint(_parsedfilt);
+  dnullprint(_parsedfilt);
 #endif /*DEBUG*/
 #endif /*DEBUG*/
 }
 }
 
 
@@ -655,9 +661,24 @@ void Fl_Native_File_Chooser::add_filter(const char *name_in,	// name of filter (
   dnullcat(_parsedfilt, winfilter);
   dnullcat(_parsedfilt, winfilter);
   _nfilters++;
   _nfilters++;
   //DEBUG printf("DEBUG: ADD FILTER name=<%s> winfilter=<%s>\n", name, winfilter);
   //DEBUG printf("DEBUG: ADD FILTER name=<%s> winfilter=<%s>\n", name, winfilter);
+}
+
+// COUNT OCCURRENCES OF ANY CHARS FROM 'find' IN 's'.
+static int strcnt(const char *s, const char *find) {
+  int cnt = 0;
+  const char *f;
+  while ( *s ) {
+    for (f=find; *f; f++) {
+      if (*s == *f) { ++cnt; break; }
+    }
+    ++s;
+  }
+  return cnt;
 }
 }
 
 
 // CONVERT FLTK STYLE PATTERN MATCHES TO WINDOWS 'DOUBLENULL' PATTERN
 // CONVERT FLTK STYLE PATTERN MATCHES TO WINDOWS 'DOUBLENULL' PATTERN
+// Returns with the parsed double-null result in '_parsedfilt'.
+//
 //    Handles:
 //    Handles:
 //        IN              OUT
 //        IN              OUT
 //        -----------     -----------------------------
 //        -----------     -----------------------------
@@ -685,16 +706,23 @@ void Fl_Native_File_Chooser::parse_filter(const char *in) {
   if ( ! in ) return;
   if ( ! in ) return;
 
 
   int has_name = strchr(in, '\t') ? 1 : 0;
   int has_name = strchr(in, '\t') ? 1 : 0;
+  char mode = has_name ? 'n' : 'w';		// parse mode: n=name, w=wildcard
 
 
-  char mode = has_name ? 'n' : 'w';	// parse mode: n=name, w=wildcard
-  int nwildcards = 0;
-  char wildcards[MAXFILTERS][1024];	// parsed wildcards (can be several)
-  char wildprefix[512] = "";
-  char name[512] = "";
+  // whatever input string is, our output won't be much longer in length..
+  // use double length just for safety.
+  size_t slen = strlen(in);
+  char *wildprefix = new char[slen*2]; wildprefix[0] = 0;
+  char *comp       = new char[slen*2]; comp[0] = 0;
+  char *name       = new char[slen*2]; name[0] = 0;
 
 
   // Init
   // Init
+  int nwildcards = 0;
+  char **wildcards;				// parsed wildcards (can be several)
+  int maxfilters = (strcnt(in, ",|") + 1);	// count wildcard seps
   int t;
   int t;
-  for ( t=0; t<MAXFILTERS; t++ ) {
+  wildcards = new char*[maxfilters];
+  for ( t=0; t<maxfilters; t++ ) {
+    wildcards[t] = new char[slen];
     wildcards[t][0] = '\0';
     wildcards[t][0] = '\0';
   }
   }
 
 
@@ -739,7 +767,7 @@ void Fl_Native_File_Chooser::parse_filter(const char *in) {
 	    strcpy(wildcards[nwildcards++], wildprefix);
 	    strcpy(wildcards[nwildcards++], wildprefix);
 	  }
 	  }
 	  // Append wildcards in Microsoft's "*.one;*.two" format
 	  // Append wildcards in Microsoft's "*.one;*.two" format
-	  char comp[4096] = "";
+	  comp[0] = 0;
 	  for ( t=0; t<nwildcards; t++ ) {
 	  for ( t=0; t<nwildcards; t++ ) {
 	    if ( t != 0 ) strcat(comp, ";");
 	    if ( t != 0 ) strcat(comp, ";");
 	    strcat(comp, wildcards[t]);
 	    strcat(comp, wildcards[t]);
@@ -750,14 +778,22 @@ void Fl_Native_File_Chooser::parse_filter(const char *in) {
 	  }
 	  }
 	}
 	}
 	// RESET
 	// RESET
-	for ( t=0; t<MAXFILTERS; t++ ) {
+	for ( t=0; t<maxfilters; t++ ) {
 	  wildcards[t][0] = '\0';
 	  wildcards[t][0] = '\0';
 	}
 	}
 	nwildcards = 0;
 	nwildcards = 0;
 	wildprefix[0] = name[0] = '\0';
 	wildprefix[0] = name[0] = '\0';
 	mode = strchr(in,'\t') ? 'n' : 'w';
 	mode = strchr(in,'\t') ? 'n' : 'w';
 	// DONE?
 	// DONE?
-	if ( *in == '\0' ) return;	// done
+	if ( *in == '\0' ) {		// done
+	  // Free everything
+	  delete[] wildprefix;
+	  delete[] comp;
+	  delete[] name;
+	  for ( t=0; t<maxfilters; t++ ) delete[] wildcards[t];
+	  delete[] wildcards;
+	  return;
+	}
 	continue;			// not done yet, more filters
 	continue;			// not done yet, more filters
       }
       }
 
 
@@ -781,7 +817,7 @@ void Fl_Native_File_Chooser::parse_filter(const char *in) {
       default:
       default:
       regchar:		// handle regular char
       regchar:		// handle regular char
 	switch ( mode ) {
 	switch ( mode ) {
-	  case LBRACKET_CHR: 
+	  case LBRACKET_CHR:
 	    // create new wildcard
 	    // create new wildcard
 	    ++nwildcards;
 	    ++nwildcards;
 	    // copy in prefix
 	    // copy in prefix
@@ -868,5 +904,5 @@ LPCWSTR utf8towchar(const char *in)
 #endif /*!FL_DOXYGEN*/
 #endif /*!FL_DOXYGEN*/
 
 
 //
 //
-// End of "$Id: Fl_Native_File_Chooser_WIN32.cxx 9629 2012-06-26 07:03:46Z greg.ercolano $".
+// End of "$Id: Fl_Native_File_Chooser_WIN32.cxx 10138 2014-05-01 09:00:30Z ianmacarthur $".
 //
 //

+ 3 - 2
fltk/src/Fl_Native_File_Chooser_common.cxx

@@ -1,4 +1,4 @@
-// "$Id: Fl_Native_File_Chooser_common.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Native_File_Chooser_common.cxx 10064 2014-01-16 16:10:19Z manolo $"
 //
 //
 // FLTK native OS file chooser widget
 // FLTK native OS file chooser widget
 //
 //
@@ -70,7 +70,8 @@ static void chrcat(char *s, char c) {
   char tmp[2] = { c, '\0' };
   char tmp[2] = { c, '\0' };
   strcat(s, tmp);
   strcat(s, tmp);
 }
 }
+
 
 
 //
 //
-// End of "$Id: Fl_Native_File_Chooser_common.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Native_File_Chooser_common.cxx 10064 2014-01-16 16:10:19Z manolo $".
 //
 //

+ 17 - 15
fltk/src/Fl_PNG_Image.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_PNG_Image.cxx 9713 2012-11-10 09:01:16Z manolo $"
+// "$Id: Fl_PNG_Image.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $"
 //
 //
 // Fl_PNG_Image routines.
 // Fl_PNG_Image routines.
 //
 //
@@ -51,20 +51,22 @@ typedef struct  {
   const unsigned char *last;
   const unsigned char *last;
 } fl_png_memory;
 } fl_png_memory;
 
 
-static void png_read_data_from_mem( png_structp png_ptr, //pointer to our data
-				   png_bytep data,  // where to copy the image data for libpng computing
-				   png_size_t length) // length of data to copy
-{
-  fl_png_memory *png_mem_data = (fl_png_memory*)png_get_io_ptr(png_ptr); // get the pointer to our struct
-  if (png_mem_data->current + length > png_mem_data->last) {
-    png_error(png_mem_data->pp, "Invalid attempt to read row data");
-    return;
+extern "C" {
+  static void png_read_data_from_mem( png_structp png_ptr, //pointer to our data
+				      png_bytep data,  // where to copy the image data for libpng computing
+				      png_size_t length) // length of data to copy
+  {
+    fl_png_memory *png_mem_data = (fl_png_memory*)png_get_io_ptr(png_ptr); // get the pointer to our struct
+    if (png_mem_data->current + length > png_mem_data->last) {
+      png_error(png_mem_data->pp, "Invalid attempt to read row data");
+      return;
+    }
+    /* copy data from image buffer */
+    memcpy (data, png_mem_data->current, length);
+    /* advance in the memory data */
+    png_mem_data->current += length;
   }
   }
-  /* copy data from image buffer */
-  memcpy (data, png_mem_data->current, length);
-  /* advance in the memory data */
-  png_mem_data->current += length;
-}
+} // extern "C"
 #endif // HAVE_LIBPNG && HAVE_LIBZ
 #endif // HAVE_LIBPNG && HAVE_LIBZ
 
 
 
 
@@ -330,5 +332,5 @@ int Fl_PNG_Image::encode(Fl_Image *img, unsigned char **outbuffer, int &outlen){
 }
 }
 
 
 //
 //
-// End of "$Id: Fl_PNG_Image.cxx 9713 2012-11-10 09:01:16Z manolo $".
+// End of "$Id: Fl_PNG_Image.cxx 9980 2013-09-21 16:41:23Z greg.ercolano $".
 //
 //

+ 12 - 6
fltk/src/Fl_Paged_Device.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_Paged_Device.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
+// "$Id: Fl_Paged_Device.cxx 10116 2014-03-05 12:55:34Z manolo $"
 //
 //
 // implementation of Fl_Paged_Device class for the Fast Light Tool Kit (FLTK).
 // implementation of Fl_Paged_Device class for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -42,6 +42,7 @@ void Fl_Paged_Device::print_widget(Fl_Widget* widget, int delta_x, int delta_y)
   int old_x, old_y, new_x, new_y, is_window;
   int old_x, old_y, new_x, new_y, is_window;
   if ( ! widget->visible() ) return;
   if ( ! widget->visible() ) return;
   is_window = (widget->as_window() != NULL);
   is_window = (widget->as_window() != NULL);
+  uchar old_damage = widget->damage();
   widget->damage(FL_DAMAGE_ALL);
   widget->damage(FL_DAMAGE_ALL);
   // set origin to the desired top-left position of the widget
   // set origin to the desired top-left position of the widget
   origin(&old_x, &old_y);
   origin(&old_x, &old_y);
@@ -54,29 +55,34 @@ void Fl_Paged_Device::print_widget(Fl_Widget* widget, int delta_x, int delta_y)
   if (new_x != old_x || new_y != old_y) {
   if (new_x != old_x || new_y != old_y) {
     translate(new_x - old_x, new_y - old_y );
     translate(new_x - old_x, new_y - old_y );
   }
   }
-  // if widget is a window, clip all drawings to the window area
-  if (is_window) fl_push_clip(0, 0, widget->w(), widget->h() );
+  // if widget is a main window, clip all drawings to the window area
+  if (is_window && !widget->window()) fl_push_clip(0, 0, widget->w(), widget->h() );
   // we do some trickery to recognize OpenGL windows and draw them via a plugin
   // we do some trickery to recognize OpenGL windows and draw them via a plugin
   int drawn_by_plugin = 0;
   int drawn_by_plugin = 0;
   if (widget->as_gl_window()) {
   if (widget->as_gl_window()) {
     Fl_Plugin_Manager pm("fltk:device");
     Fl_Plugin_Manager pm("fltk:device");
     Fl_Device_Plugin *pi = (Fl_Device_Plugin*)pm.plugin("opengl.device.fltk.org");
     Fl_Device_Plugin *pi = (Fl_Device_Plugin*)pm.plugin("opengl.device.fltk.org");
     if (pi) {
     if (pi) {
-      int width, height;
+      int height = 0;
+#ifdef __APPLE__
+      int width;
       this->printable_rect(&width, &height);
       this->printable_rect(&width, &height);
+#endif
       drawn_by_plugin = pi->print(widget, 0, 0, height);
       drawn_by_plugin = pi->print(widget, 0, 0, height);
     }
     }
   }
   }
   if (!drawn_by_plugin) {
   if (!drawn_by_plugin) {
     widget->draw();
     widget->draw();
   }
   }
-  if (is_window) fl_pop_clip();
+  if (is_window && !widget->window()) fl_pop_clip();
   // find subwindows of widget and print them
   // find subwindows of widget and print them
   traverse(widget);
   traverse(widget);
   // reset origin to where it was
   // reset origin to where it was
   if (new_x != old_x || new_y != old_y) {
   if (new_x != old_x || new_y != old_y) {
     untranslate();
     untranslate();
   }
   }
+  if ((old_damage & FL_DAMAGE_CHILD) == 0) widget->clear_damage(old_damage);
+  else widget->damage(FL_DAMAGE_ALL);
 }
 }
 
 
 
 
@@ -284,5 +290,5 @@ const Fl_Paged_Device::page_format Fl_Paged_Device::page_formats[NO_PAGE_FORMATS
 };
 };
 
 
 //
 //
-// End of "$Id: Fl_Paged_Device.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $".
+// End of "$Id: Fl_Paged_Device.cxx 10116 2014-03-05 12:55:34Z manolo $".
 //
 //

+ 13 - 6
fltk/src/Fl_PostScript.cxx

@@ -1,5 +1,5 @@
 //
 //
-// "$Id: Fl_PostScript.cxx 9775 2012-12-25 21:18:12Z manolo $"
+// "$Id: Fl_PostScript.cxx 10006 2013-10-23 09:24:30Z manolo $"
 //
 //
 // PostScript device support for the Fast Light Tool Kit (FLTK).
 // PostScript device support for the Fast Light Tool Kit (FLTK).
 //
 //
@@ -94,7 +94,7 @@ int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_Paged_Device::P
   // Show native chooser
   // Show native chooser
   if ( fnfc.show() ) return 1;
   if ( fnfc.show() ) return 1;
   Fl_PostScript_Graphics_Driver *ps = driver();
   Fl_PostScript_Graphics_Driver *ps = driver();
-  ps->output = fopen(fnfc.filename(), "w");
+  ps->output = fl_fopen(fnfc.filename(), "w");
   if(ps->output == NULL) return 2;
   if(ps->output == NULL) return 2;
   ps->ps_filename_ = strdup(fnfc.filename());
   ps->ps_filename_ = strdup(fnfc.filename());
   ps->start_postscript(pagecount, format, layout);
   ps->start_postscript(pagecount, format, layout);
@@ -102,9 +102,11 @@ int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_Paged_Device::P
   return 0;
   return 0;
 }
 }
 
 
-static int dont_close(FILE *f)
-{
-  return 0;
+extern "C" {
+  static int dont_close(FILE *f)
+  {
+    return 0;
+  }
 }
 }
 
 
 /**
 /**
@@ -962,6 +964,10 @@ double Fl_PostScript_Graphics_Driver::width(const char *s, int n) {
   return Fl_Display_Device::display_device()->driver()->width(s, n);
   return Fl_Display_Device::display_device()->driver()->width(s, n);
 }
 }
 
 
+double Fl_PostScript_Graphics_Driver::width(unsigned u) {
+  return Fl_Display_Device::display_device()->driver()->width(u);
+}
+
 int Fl_PostScript_Graphics_Driver::height() {
 int Fl_PostScript_Graphics_Driver::height() {
   return Fl_Display_Device::display_device()->driver()->height();
   return Fl_Display_Device::display_device()->driver()->height();
 }
 }
@@ -1254,6 +1260,7 @@ void Fl_PostScript_Graphics_Driver::arc(double x, double y, double r, double sta
 }
 }
 
 
 void Fl_PostScript_Graphics_Driver::arc(int x, int y, int w, int h, double a1, double a2) {
 void Fl_PostScript_Graphics_Driver::arc(int x, int y, int w, int h, double a1, double a2) {
+  if (w <= 1 || h <= 1) return;
   fprintf(output, "GS\n");
   fprintf(output, "GS\n");
   //fprintf(output, "BP\n");
   //fprintf(output, "BP\n");
   begin_line();
   begin_line();
@@ -1617,5 +1624,5 @@ int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) {
 #endif // FL_DOXYGEN
 #endif // FL_DOXYGEN
 
 
 //
 //
-// End of "$Id: Fl_PostScript.cxx 9775 2012-12-25 21:18:12Z manolo $".
+// End of "$Id: Fl_PostScript.cxx 10006 2013-10-23 09:24:30Z manolo $".
 //
 //

+ 1 - 1
fltk/src/Fl_Printer.cxx

@@ -1,7 +1,7 @@
 //
 //
 // "$Id: Fl_Printer.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
 // "$Id: Fl_Printer.cxx 8864 2011-07-19 04:49:30Z greg.ercolano $"
 //
 //
-// Encompasses platform-specific printing-support code and
+// Encompasses platform-specific printing-support code and 
 // PostScript output code for the Fast Light Tool Kit (FLTK).
 // PostScript output code for the Fast Light Tool Kit (FLTK).
 //
 //
 // Copyright 2010 by Bill Spitzak and others.
 // Copyright 2010 by Bill Spitzak and others.

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