FLTK logo

[Library] r9011 - in branches/branch-3.0: . fluid ide/VisualC2008 ide/VisualC2010 ide/VisualC6 ide/Xcode4/FLTK.xcodeproj include include/fltk3 include/fltk3gl include/fltk3images include/fltk3jpeg include/fltk3png include/fltk3zlib src src/fltk3 src/fltk3gl src/fltk3images test

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[Library] r9011 - in branches/branch-3.0: . fluid ide/VisualC2008 ide/VisualC2010 ide/VisualC6 ide/Xcode4/FLTK.xcodeproj include include/fltk3 include/fltk3gl include/fltk3images include/fltk3jpeg include/fltk3png include/fltk3zlib src src/fltk3 src/fltk3gl src/fltk3images test fltk-dev Aug 25, 2011  
 
Author: matt
Date: 2011-08-25 14:50:59 -0700 (Thu, 25 Aug 2011)
New Revision: 9011
Log:
FLTK3:

This is the big one. Everything is now renamed and more or less in its final position.

This is tested on OSX Xcode and command line and compiles without any warnings.

It has not been tested with Linux/Unix/Cygwin or VisualC.



Added:
   branches/branch-3.0/include/fltk3/all.h
   branches/branch-3.0/include/fltk3/fltk3.h
   branches/branch-3.0/include/fltk3images/
   branches/branch-3.0/include/fltk3images/BMPImage.h
   branches/branch-3.0/include/fltk3images/GIFImage.h
   branches/branch-3.0/include/fltk3images/HelpDialog.h
   branches/branch-3.0/include/fltk3images/JPEGImage.h
   branches/branch-3.0/include/fltk3images/PNGImage.h
   branches/branch-3.0/include/fltk3images/PNMImage.h
   branches/branch-3.0/include/fltk3images/all.h
   branches/branch-3.0/include/fltk3images/fltk3images.h
   branches/branch-3.0/include/fltk3jpeg/all.h
   branches/branch-3.0/include/fltk3jpeg/fltk3jpeg.h
   branches/branch-3.0/include/fltk3png/all.h
   branches/branch-3.0/include/fltk3png/fltk3png.h
   branches/branch-3.0/include/fltk3zlib/all.h
   branches/branch-3.0/include/fltk3zlib/fltk3zlib.h
   branches/branch-3.0/src/fltk3/Adjuster.cxx
   branches/branch-3.0/src/fltk3/Bitmap.cxx
   branches/branch-3.0/src/fltk3/Box.cxx
   branches/branch-3.0/src/fltk3/Browser.cxx
   branches/branch-3.0/src/fltk3/Browser_.cxx
   branches/branch-3.0/src/fltk3/Browser_load.cxx
   branches/branch-3.0/src/fltk3/Button.cxx
   branches/branch-3.0/src/fltk3/Chart.cxx
   branches/branch-3.0/src/fltk3/CheckBrowser.cxx
   branches/branch-3.0/src/fltk3/CheckButton.cxx
   branches/branch-3.0/src/fltk3/Choice.cxx
   branches/branch-3.0/src/fltk3/Clock.cxx
   branches/branch-3.0/src/fltk3/ColorChooser.cxx
   branches/branch-3.0/src/fltk3/Counter.cxx
   branches/branch-3.0/src/fltk3/Device.cxx
   branches/branch-3.0/src/fltk3/Dial.cxx
   branches/branch-3.0/src/fltk3/DoubleWindow.cxx
   branches/branch-3.0/src/fltk3/FileBrowser.cxx
   branches/branch-3.0/src/fltk3/FileChooser.cxx
   branches/branch-3.0/src/fltk3/FileChooser.fl
   branches/branch-3.0/src/fltk3/FileChooser2.cxx
   branches/branch-3.0/src/fltk3/FileIcon.cxx
   branches/branch-3.0/src/fltk3/FileInput.cxx
   branches/branch-3.0/src/fltk3/GDIPrinter.cxx
   branches/branch-3.0/src/fltk3/Group.cxx
   branches/branch-3.0/src/fltk3/HelpView.cxx
   branches/branch-3.0/src/fltk3/Image.cxx
   branches/branch-3.0/src/fltk3/Input.cxx
   branches/branch-3.0/src/fltk3/Input_.cxx
   branches/branch-3.0/src/fltk3/LightButton.cxx
   branches/branch-3.0/src/fltk3/Menu.cxx
   branches/branch-3.0/src/fltk3/MenuBar.cxx
   branches/branch-3.0/src/fltk3/MenuButton.cxx
   branches/branch-3.0/src/fltk3/MenuWindow.cxx
   branches/branch-3.0/src/fltk3/Menu_.cxx
   branches/branch-3.0/src/fltk3/Menu_add.cxx
   branches/branch-3.0/src/fltk3/Menu_global.cxx
   branches/branch-3.0/src/fltk3/MultiLabel.cxx
   branches/branch-3.0/src/fltk3/NativeFileChooser.cxx
   branches/branch-3.0/src/fltk3/NativeFileChooser_common.cxx
   branches/branch-3.0/src/fltk3/OverlayWindow.cxx
   branches/branch-3.0/src/fltk3/PackedGroup.cxx
   branches/branch-3.0/src/fltk3/PagedDevice.cxx
   branches/branch-3.0/src/fltk3/Pixmap.cxx
   branches/branch-3.0/src/fltk3/Positioner.cxx
   branches/branch-3.0/src/fltk3/PostScript.cxx
   branches/branch-3.0/src/fltk3/Preferences.cxx
   branches/branch-3.0/src/fltk3/Printer.cxx
   branches/branch-3.0/src/fltk3/Progress.cxx
   branches/branch-3.0/src/fltk3/RepeatButton.cxx
   branches/branch-3.0/src/fltk3/ReturnButton.cxx
   branches/branch-3.0/src/fltk3/Roller.cxx
   branches/branch-3.0/src/fltk3/RoundButton.cxx
   branches/branch-3.0/src/fltk3/ScrollGroup.cxx
   branches/branch-3.0/src/fltk3/Scrollbar.cxx
   branches/branch-3.0/src/fltk3/SharedImage.cxx
   branches/branch-3.0/src/fltk3/SingleWindow.cxx
   branches/branch-3.0/src/fltk3/Slider.cxx
   branches/branch-3.0/src/fltk3/Style.cxx
   branches/branch-3.0/src/fltk3/SysMenuBar.cxx
   branches/branch-3.0/src/fltk3/TabGroup.cxx
   branches/branch-3.0/src/fltk3/Table.cxx
   branches/branch-3.0/src/fltk3/TableRow.cxx
   branches/branch-3.0/src/fltk3/TextBuffer.cxx
   branches/branch-3.0/src/fltk3/TextDisplay.cxx
   branches/branch-3.0/src/fltk3/TextEditor.cxx
   branches/branch-3.0/src/fltk3/TiledGroup.cxx
   branches/branch-3.0/src/fltk3/TiledImage.cxx
   branches/branch-3.0/src/fltk3/Tooltip.cxx
   branches/branch-3.0/src/fltk3/Tree.cxx
   branches/branch-3.0/src/fltk3/TreeItem.cxx
   branches/branch-3.0/src/fltk3/TreeItemArray.cxx
   branches/branch-3.0/src/fltk3/TreePrefs.cxx
   branches/branch-3.0/src/fltk3/Valuator.cxx
   branches/branch-3.0/src/fltk3/ValueInput.cxx
   branches/branch-3.0/src/fltk3/ValueOutput.cxx
   branches/branch-3.0/src/fltk3/ValueSlider.cxx
   branches/branch-3.0/src/fltk3/Widget.cxx
   branches/branch-3.0/src/fltk3/Window.cxx
   branches/branch-3.0/src/fltk3/Window_fullscreen.cxx
   branches/branch-3.0/src/fltk3/Window_hotspot.cxx
   branches/branch-3.0/src/fltk3/Window_iconize.cxx
   branches/branch-3.0/src/fltk3/Wizard.cxx
   branches/branch-3.0/src/fltk3/XBMImage.cxx
   branches/branch-3.0/src/fltk3/XPMImage.cxx
   branches/branch-3.0/src/fltk3/abort.cxx
   branches/branch-3.0/src/fltk3/add_idle.cxx
   branches/branch-3.0/src/fltk3/aimm.h
   branches/branch-3.0/src/fltk3/allfiles.xbm
   branches/branch-3.0/src/fltk3/arc.cxx
   branches/branch-3.0/src/fltk3/arci.cxx
   branches/branch-3.0/src/fltk3/arg.cxx
   branches/branch-3.0/src/fltk3/ask.cxx
   branches/branch-3.0/src/fltk3/boxtype.cxx
   branches/branch-3.0/src/fltk3/call_main.cxx
   branches/branch-3.0/src/fltk3/cgdebug.h
   branches/branch-3.0/src/fltk3/cmap.cxx
   branches/branch-3.0/src/fltk3/cmap.h
   branches/branch-3.0/src/fltk3/cocoa.mm
   branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm
   branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm
   branches/branch-3.0/src/fltk3/cocoa_color.cxx
   branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx
   branches/branch-3.0/src/fltk3/cocoa_font.cxx
   branches/branch-3.0/src/fltk3/cocoa_get_key.cxx
   branches/branch-3.0/src/fltk3/cocoa_interface.cxx
   branches/branch-3.0/src/fltk3/cocoa_read_image.cxx
   branches/branch-3.0/src/fltk3/cocoa_set_fonts.cxx
   branches/branch-3.0/src/fltk3/color.cxx
   branches/branch-3.0/src/fltk3/compose.cxx
   branches/branch-3.0/src/fltk3/cursor.cxx
   branches/branch-3.0/src/fltk3/curve.cxx
   branches/branch-3.0/src/fltk3/d1.xbm
   branches/branch-3.0/src/fltk3/d1_mask.xbm
   branches/branch-3.0/src/fltk3/diamond_box.cxx
   branches/branch-3.0/src/fltk3/display.cxx
   branches/branch-3.0/src/fltk3/dnd.cxx
   branches/branch-3.0/src/fltk3/draw.cxx
   branches/branch-3.0/src/fltk3/draw_image.cxx
   branches/branch-3.0/src/fltk3/draw_pixmap.cxx
   branches/branch-3.0/src/fltk3/dump_compose.c
   branches/branch-3.0/src/fltk3/encoding_latin1.cxx
   branches/branch-3.0/src/fltk3/encoding_mac_roman.cxx
   branches/branch-3.0/src/fltk3/engraved_label.cxx
   branches/branch-3.0/src/fltk3/ew.xbm
   branches/branch-3.0/src/fltk3/ew_mask.xbm
   branches/branch-3.0/src/fltk3/fastarrow.h
   branches/branch-3.0/src/fltk3/file_dir.cxx
   branches/branch-3.0/src/fltk3/filename_absolute.cxx
   branches/branch-3.0/src/fltk3/filename_expand.cxx
   branches/branch-3.0/src/fltk3/filename_ext.cxx
   branches/branch-3.0/src/fltk3/filename_isdir.cxx
   branches/branch-3.0/src/fltk3/filename_list.cxx
   branches/branch-3.0/src/fltk3/filename_match.cxx
   branches/branch-3.0/src/fltk3/filename_setext.cxx
   branches/branch-3.0/src/fltk3/flstring.c
   branches/branch-3.0/src/fltk3/flstring.h
   branches/branch-3.0/src/fltk3/font.cxx
   branches/branch-3.0/src/fltk3/font.h
   branches/branch-3.0/src/fltk3/get_key.cxx
   branches/branch-3.0/src/fltk3/get_system_colors.cxx
   branches/branch-3.0/src/fltk3/grab.cxx
   branches/branch-3.0/src/fltk3/gtk.cxx
   branches/branch-3.0/src/fltk3/labeltype.cxx
   branches/branch-3.0/src/fltk3/line_style.cxx
   branches/branch-3.0/src/fltk3/lock.cxx
   branches/branch-3.0/src/fltk3/mediumarrow.h
   branches/branch-3.0/src/fltk3/new.xbm
   branches/branch-3.0/src/fltk3/ns.xbm
   branches/branch-3.0/src/fltk3/ns_mask.xbm
   branches/branch-3.0/src/fltk3/numericsort.cxx
   branches/branch-3.0/src/fltk3/open_uri.cxx
   branches/branch-3.0/src/fltk3/oval_box.cxx
   branches/branch-3.0/src/fltk3/overlay.cxx
   branches/branch-3.0/src/fltk3/overlay_visual.cxx
   branches/branch-3.0/src/fltk3/own_colormap.cxx
   branches/branch-3.0/src/fltk3/plastic.cxx
   branches/branch-3.0/src/fltk3/print_panel.cxx
   branches/branch-3.0/src/fltk3/print_panel.h
   branches/branch-3.0/src/fltk3/ps_image.cxx
   branches/branch-3.0/src/fltk3/read_image.cxx
   branches/branch-3.0/src/fltk3/rect.cxx
   branches/branch-3.0/src/fltk3/round_box.cxx
   branches/branch-3.0/src/fltk3/rounded_box.cxx
   branches/branch-3.0/src/fltk3/scandir.cxx
   branches/branch-3.0/src/fltk3/screen_xywh.cxx
   branches/branch-3.0/src/fltk3/scroll_area.cxx
   branches/branch-3.0/src/fltk3/set_font.cxx
   branches/branch-3.0/src/fltk3/set_fonts.cxx
   branches/branch-3.0/src/fltk3/shadow_box.cxx
   branches/branch-3.0/src/fltk3/shortcut.cxx
   branches/branch-3.0/src/fltk3/show_colormap.cxx
   branches/branch-3.0/src/fltk3/slowarrow.h
   branches/branch-3.0/src/fltk3/symbols.cxx
   branches/branch-3.0/src/fltk3/tile.xpm
   branches/branch-3.0/src/fltk3/up.xbm
   branches/branch-3.0/src/fltk3/utf.cxx
   branches/branch-3.0/src/fltk3/utf8.cxx
   branches/branch-3.0/src/fltk3/vertex.cxx
   branches/branch-3.0/src/fltk3/visual.cxx
   branches/branch-3.0/src/fltk3/vsnprintf.c
   branches/branch-3.0/src/fltk3/win32.cxx
   branches/branch-3.0/src/fltk3/win32NativeFileChooser.cxx
   branches/branch-3.0/src/fltk3/win32_color.cxx
   branches/branch-3.0/src/fltk3/win32_dnd.cxx
   branches/branch-3.0/src/fltk3/win32_draw_image.cxx
   branches/branch-3.0/src/fltk3/win32_font.cxx
   branches/branch-3.0/src/fltk3/win32_get_key.cxx
   branches/branch-3.0/src/fltk3/win32_read_image.cxx
   branches/branch-3.0/src/fltk3/win32_scandir.cxx
   branches/branch-3.0/src/fltk3/win32_set_fonts.cxx
   branches/branch-3.0/src/fltk3/x11.cxx
   branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx
   branches/branch-3.0/src/fltk3/x11_dnd.cxx
   branches/branch-3.0/src/fltk3/x11_font.cxx
   branches/branch-3.0/src/fltk3/x11_set_fonts.cxx
   branches/branch-3.0/src/fltk3/xcolor.h
   branches/branch-3.0/src/fltk3/xft_font.cxx
   branches/branch-3.0/src/fltk3/xft_set_fonts.cxx
   branches/branch-3.0/src/fltk3/xutf8/
   branches/branch-3.0/src/fltk3images/BMPImage.cxx
   branches/branch-3.0/src/fltk3images/FileIcon2.cxx
   branches/branch-3.0/src/fltk3images/GIFImage.cxx
   branches/branch-3.0/src/fltk3images/HelpDialog.cxx
   branches/branch-3.0/src/fltk3images/HelpDialog.fl
   branches/branch-3.0/src/fltk3images/HelpDialogDox.cxx
   branches/branch-3.0/src/fltk3images/JPEGImage.cxx
   branches/branch-3.0/src/fltk3images/PNGImage.cxx
   branches/branch-3.0/src/fltk3images/PNMImage.cxx
   branches/branch-3.0/src/fltk3images/images_core.cxx
Removed:
   branches/branch-3.0/include/fltk3/BMPImage.h
   branches/branch-3.0/include/fltk3/GIFImage.h
   branches/branch-3.0/include/fltk3/HelpDialog.h
   branches/branch-3.0/include/fltk3/JPEGImage.h
   branches/branch-3.0/include/fltk3/PNGImage.h
   branches/branch-3.0/include/fltk3/PNMImage.h
   branches/branch-3.0/include/fltk3/forms.h
   branches/branch-3.0/src/core/
Modified:
   branches/branch-3.0/configure.in
   branches/branch-3.0/fltk.flw
   branches/branch-3.0/fluid/Fl_Function_Type.cxx
   branches/branch-3.0/fluid/Fl_Group_Type.cxx
   branches/branch-3.0/fluid/Fl_Menu_Type.cxx
   branches/branch-3.0/fluid/Fl_Type.cxx
   branches/branch-3.0/fluid/Fl_Type.h
   branches/branch-3.0/fluid/Fl_Widget_Type.cxx
   branches/branch-3.0/fluid/Fl_Window_Type.cxx
   branches/branch-3.0/fluid/Fluid_Image.cxx
   branches/branch-3.0/fluid/code.cxx
   branches/branch-3.0/fluid/factory.cxx
   branches/branch-3.0/fluid/file.cxx
   branches/branch-3.0/fluid/file_make.cxx
   branches/branch-3.0/fluid/fluid.cxx
   branches/branch-3.0/fluid/makedepend
   branches/branch-3.0/fluid/template_panel.cxx
   branches/branch-3.0/fluid/undo.cxx
   branches/branch-3.0/ide/VisualC2008/fltk3.vcproj
   branches/branch-3.0/ide/VisualC2008/fltk3images.vcproj
   branches/branch-3.0/ide/VisualC2010/fltk3.vcxproj
   branches/branch-3.0/ide/VisualC2010/fltk3images.vcxproj
   branches/branch-3.0/ide/VisualC6/fltk3.dsp
   branches/branch-3.0/ide/VisualC6/fltk3images.dsp
   branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
   branches/branch-3.0/include/fltk3gl/all.h
   branches/branch-3.0/include/fltk3gl/fltk3gl.h
   branches/branch-3.0/src/Makefile
   branches/branch-3.0/src/fltk3/run.cxx
   branches/branch-3.0/src/fltk3gl/GLChoice.cxx
   branches/branch-3.0/src/fltk3gl/GLWindow.cxx
   branches/branch-3.0/src/makedepend
   branches/branch-3.0/test/file_chooser.cxx
   branches/branch-3.0/test/help.cxx
   branches/branch-3.0/test/makedepend
   branches/branch-3.0/test/menubar.cxx
   branches/branch-3.0/test/sudoku.cxx

Modified: branches/branch-3.0/configure.in
===================================================================
--- branches/branch-3.0/configure.in	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/configure.in	2011-08-25 21:50:59 UTC (rev 9011)
@@ -31,7 +31,7 @@
 AC_PREREQ(2.50)
 
 dnl Required file in package...
-AC_INIT(src/core/Fl.cxx)
+AC_INIT(src/fltk3/run.cxx)
 
 dnl So --with-archflags option is used during "checking size of long"
 if test `uname` = Darwin; then

Modified: branches/branch-3.0/fltk.flw
===================================================================
--- branches/branch-3.0/fltk.flw	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fltk.flw	2011-08-25 21:50:59 UTC (rev 9011)
@@ -12,9 +12,9 @@
   uuid_Xcode4_ReleaseBuildConfiguration {C5259E66-FBF8-43A2-B30F-8D59BBE3CF16}
   uuid_VC2008_Workspace {D21EA206-7BBC-4F5B-8518-A798E56EE0FC}
   uuid_VC2010_Workspace {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}
-  build_env 64
+  build_env 1
 } {
-  folder Applications {
+  folder Applications {open
     uuid_Xcode4_Group {137F861A-5702-45AC-821B-A2C51A17F780}
   } {
     app_target Fluid {
@@ -334,9 +334,25 @@
       target_path lib
       makefile_path src
     } {
-      folder Headers {
+      folder Headers {open
         uuid_Xcode4_Group {C2F00625-E401-4002-85F6-FA183D17629D}
       } {
+        file_ref {all.h} {
+          uuid_Xcode4_BuildFile {9E850E7A-3E87-45D8-9C32-299A0B34F920}
+          uuid_Xcode4_FileRef {DDEC0AB0-A3B1-46ED-A7CC-1090FA5FD9DC}
+          uuid_Xcode4_BuildFileInHeaders {6EC5A8E1-B2EE-44F9-9EE3-80C3505CDA66}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3/all.h}
+        }
+        file_ref {fltk3.h} {
+          uuid_Xcode4_BuildFile {9ABADC91-1800-47C9-8E88-2C4F7EC7BBF5}
+          uuid_Xcode4_FileRef {15B1A08E-DA32-48B0-904D-004A1C92EDD1}
+          uuid_Xcode4_BuildFileInHeaders {39576718-B602-42A5-839B-9B7E885D7837}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3/fltk3.h}
+        }
         file_ref {Adjuster.h} {
           uuid_Xcode4_BuildFile {19D0A8A7-81F6-48F4-A42B-0A0DBBC3770F}
           uuid_Xcode4_FileRef {1CDC310C-BCD1-48E9-90F6-541607EE265B}
@@ -361,14 +377,6 @@
           list_env 124
           filename_and_path {include/fltk3/Bitmap.h}
         }
-        file_ref {BMPImage.h} {
-          uuid_Xcode4_BuildFile {B02F1ACA-8C63-4C41-A0FA-429D42B66E10}
-          uuid_Xcode4_FileRef {5B9A35BB-8AE6-4627-BE89-BB6BF86DBDA1}
-          uuid_Xcode4_BuildFileInHeaders {26C1F556-804D-49CA-B330-7472D37CCAA4}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/BMPImage.h}
-        }
         file_ref {Box.h} {
           uuid_Xcode4_BuildFile {A443E7E1-065D-4CA8-9E14-C567C120B62E}
           uuid_Xcode4_FileRef {0800D21F-C11C-4581-BA43-356FDB90C72D}
@@ -625,14 +633,6 @@
           list_env 124
           filename_and_path {include/fltk3/Free.h}
         }
-        file_ref {GIFImage.h} {
-          uuid_Xcode4_BuildFile {E1645FE3-A511-42A3-873D-131C575CF91A}
-          uuid_Xcode4_FileRef {605121E0-DA10-4363-AD06-B3FF977E11C8}
-          uuid_Xcode4_BuildFileInHeaders {8845649A-5BB6-4BA3-879C-1952D0C93211}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/GIFImage.h}
-        }
         file_ref {Group.h} {
           uuid_Xcode4_BuildFile {2D46FE73-1213-4993-9C58-3AD4F912D0F1}
           uuid_Xcode4_FileRef {91EA0376-23A2-4777-B42C-16F89603F364}
@@ -641,14 +641,6 @@
           list_env 124
           filename_and_path {include/fltk3/Group.h}
         }
-        file_ref {HelpDialog.h} {
-          uuid_Xcode4_BuildFile {039E6910-80A1-4672-8705-02AC45E81900}
-          uuid_Xcode4_FileRef {0925F193-41B3-477E-B5AD-81F5397661F3}
-          uuid_Xcode4_BuildFileInHeaders {F7A66B0A-98D9-44E3-B704-829151BB84FB}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/HelpDialog.h}
-        }
         file_ref {HelpView.h} {
           uuid_Xcode4_BuildFile {35AC3DE1-3781-43C2-A095-E3DC454BDCD4}
           uuid_Xcode4_FileRef {0CD096CD-1274-4A7C-9EC2-74191B646DB4}
@@ -737,14 +729,6 @@
           list_env 124
           filename_and_path {include/fltk3/IntInput.h}
         }
-        file_ref {JPEGImage.h} {
-          uuid_Xcode4_BuildFile {E924726D-D8F9-42F3-99B6-0B33A6E07929}
-          uuid_Xcode4_FileRef {60A217E0-989A-441E-96AA-E8B7D7B44D49}
-          uuid_Xcode4_BuildFileInHeaders {30029E6A-2C65-48E5-8722-0B7CFEBA9CF8}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/JPEGImage.h}
-        }
         file_ref {LightButton.h} {
           uuid_Xcode4_BuildFile {CC28845A-AB92-4F7F-8BAB-D7C630F0AD00}
           uuid_Xcode4_FileRef {5A390823-6671-4644-BA82-DC6AB1FB4B81}
@@ -945,22 +929,6 @@
           list_env 124
           filename_and_path {include/fltk3/Plugin.h}
         }
-        file_ref {PNGImage.h} {
-          uuid_Xcode4_BuildFile {5D9E7161-6EC7-4233-AA60-D021CB0DFC59}
-          uuid_Xcode4_FileRef {25BEA285-CF71-4ED0-B043-193DEA1014E2}
-          uuid_Xcode4_BuildFileInHeaders {E3127242-7B17-4B32-9FCC-1F2101B769A4}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/PNGImage.h}
-        }
-        file_ref {PNMImage.h} {
-          uuid_Xcode4_BuildFile {4C35DB58-66D6-4FE6-8D74-0F09B1B8EC70}
-          uuid_Xcode4_FileRef {EC95850E-4FC1-4DEB-A8EB-551759E4EBC2}
-          uuid_Xcode4_BuildFileInHeaders {CBE8880E-97E1-45DC-8CC0-78ED5298EAAE}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/PNMImage.h}
-        }
         file_ref {Positioner.h} {
           uuid_Xcode4_BuildFile {62B3D61F-3AE4-4EF7-8084-F0A6FBD55B84}
           uuid_Xcode4_FileRef {813FC874-2EAA-4EDF-A759-0016EDAE447C}
@@ -1425,6 +1393,14 @@
           list_env 124
           filename_and_path {include/fltk3/x.h}
         }
+        file_ref {Xutf8.h} {
+          uuid_Xcode4_BuildFile {A0588617-DA9D-48BB-8001-E0414DBCBAA2}
+          uuid_Xcode4_FileRef {2E1B4089-1661-448E-8219-3960A46CDE69}
+          uuid_Xcode4_BuildFileInHeaders {E0943D9D-3EC5-4918-9A46-090378EBF9DF}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3/Xutf8.h}
+        }
         file_ref {XBMImage.h} {
           uuid_Xcode4_BuildFile {8AF480EA-F1C2-4A25-9AD4-658E8600CB70}
           uuid_Xcode4_FileRef {9F6F453D-C13B-4551-9976-F2088679FDAA}
@@ -1441,41 +1417,33 @@
           list_env 124
           filename_and_path {include/fltk3/XPMImage.h}
         }
-        file_ref {Xutf8.h} {
-          uuid_Xcode4_BuildFile {A0588617-DA9D-48BB-8001-E0414DBCBAA2}
-          uuid_Xcode4_FileRef {2E1B4089-1661-448E-8219-3960A46CDE69}
-          uuid_Xcode4_BuildFileInHeaders {E0943D9D-3EC5-4918-9A46-090378EBF9DF}
-          build_env 96
-          list_env 124
-          filename_and_path {include/fltk3/Xutf8.h}
-        }
       }
       folder Sources {
         uuid_Xcode4_Group {91990322-0AF9-42F2-A077-713540EE5AB1}
       } {
-        file_ref {Fl_cocoa.mm} {
+        file_ref {cocoa.mm} {
           uuid_Xcode4_BuildFile {99D08647-5486-4C7E-8CC9-51B70074F29C}
           uuid_Xcode4_FileRef {F6BB47B6-F621-4FC2-A7DC-BFD6B7C5F16D}
           uuid_Xcode4_BuildFileInSources {69C261B5-4876-4079-9B0B-EBCE4F62E633}
           build_env 99
           list_env 96
-          filename_and_path {src/core/Fl_cocoa.mm}
+          filename_and_path {src/fltk3/cocoa.mm}
         }
-        file_ref {Fl_Native_File_Chooser_MAC.mm} {
+        file_ref {cocoaNativeFileChooser.mm} {
           uuid_Xcode4_BuildFile {60D9759F-404F-4A7C-A356-2F92BC2F400F}
           uuid_Xcode4_FileRef {B23CCB73-2D6F-4196-8925-2B663827C3EE}
           uuid_Xcode4_BuildFileInSources {02BBCA82-9B2B-44D0-9C15-96A37443CA28}
           build_env 99
           list_env 96
-          filename_and_path {src/core/Fl_Native_File_Chooser_MAC.mm}
+          filename_and_path {src/fltk3/cocoaNativeFileChooser.mm}
         }
-        file_ref {Fl_Quartz_Printer.mm} {
+        file_ref {cocoaQuartzPrinter.mm} {
           uuid_Xcode4_BuildFile {982B3E9E-7B79-4E84-A10F-7270A2EB17A5}
           uuid_Xcode4_FileRef {10A048C4-1F53-4215-8F9A-E8829C9F77EA}
           uuid_Xcode4_BuildFileInSources {B7920395-B4B5-480F-BB30-14BE46AA357D}
           build_env 99
           list_env 96
-          filename_and_path {src/core/Fl_Quartz_Printer.mm}
+          filename_and_path {src/fltk3/cocoaQuartzPrinter.mm}
         }
         file_ref {run.cxx} {
           uuid_Xcode4_BuildFile {5E78E80A-9D1C-4351-9F3E-B2944D622982}
@@ -1483,930 +1451,930 @@
           uuid_Xcode4_BuildFileInSources {008DDC0F-78E3-4A40-8F42-9408DA34594C}
           filename_and_path {src/fltk3/run.cxx}
         }
-        file_ref {Fl_Adjuster.cxx} {
+        file_ref {Adjuster.cxx} {
           uuid_Xcode4_BuildFile {91FE1840-74E4-4847-8B8E-D8952CEAF112}
           uuid_Xcode4_FileRef {ECEA64F2-F8B3-4A76-B195-748D6949AD76}
           uuid_Xcode4_BuildFileInSources {2271ACEB-F7A7-435C-8F11-380D4086EF24}
-          filename_and_path {src/core/Fl_Adjuster.cxx}
+          filename_and_path {src/fltk3/Adjuster.cxx}
         }
-        file_ref {Fl_Bitmap.cxx} {
+        file_ref {Bitmap.cxx} {
           uuid_Xcode4_BuildFile {E9733D69-4D22-4B2E-B89C-81D879FA8FC5}
           uuid_Xcode4_FileRef {D68004A5-9E82-4A55-B1D1-365E2E22B59B}
           uuid_Xcode4_BuildFileInSources {87F292ED-EBB4-4EBB-BAC3-FF7CAEA18EC5}
-          filename_and_path {src/core/Fl_Bitmap.cxx}
+          filename_and_path {src/fltk3/Bitmap.cxx}
         }
-        file_ref {Fl_Box.cxx} {
+        file_ref {Box.cxx} {
           uuid_Xcode4_BuildFile {F4F6FEBB-918A-4AC7-813D-7B3E68C40425}
           uuid_Xcode4_FileRef {81608512-8823-4586-AF62-6E7935A2B539}
           uuid_Xcode4_BuildFileInSources {D3D9C65E-F19F-4B98-BE09-98BD5E8C7725}
-          filename_and_path {src/core/Fl_Box.cxx}
+          filename_and_path {src/fltk3/Box.cxx}
         }
-        file_ref {Fl_Browser.cxx} {
+        file_ref {Browser.cxx} {
           uuid_Xcode4_BuildFile {DA189983-8D64-4A1D-96B0-2E367C8C4CC6}
           uuid_Xcode4_FileRef {5CE1FF6E-BFDC-4925-A6BE-F6B954C22170}
           uuid_Xcode4_BuildFileInSources {F343A0DF-4678-4211-8A50-FC76857BF06F}
-          filename_and_path {src/core/Fl_Browser.cxx}
+          filename_and_path {src/fltk3/Browser.cxx}
         }
-        file_ref {Fl_Browser_.cxx} {
+        file_ref {Browser_.cxx} {
           uuid_Xcode4_BuildFile {545A2839-E435-4EB6-839C-22C991346FF0}
           uuid_Xcode4_FileRef {2FC85E98-E2B4-484F-815B-75078EBBA1CC}
           uuid_Xcode4_BuildFileInSources {9036C344-A95E-4174-8C78-610EB425415E}
-          filename_and_path {src/core/Fl_Browser_.cxx}
+          filename_and_path {src/fltk3/Browser_.cxx}
         }
-        file_ref {Fl_Browser_load.cxx} {
+        file_ref {Browser_load.cxx} {
           uuid_Xcode4_BuildFile {C18A3B76-19AC-4503-9A82-6386F545EFE7}
           uuid_Xcode4_FileRef {B89AE0F9-320A-489A-A15A-34AEA064E6FF}
           uuid_Xcode4_BuildFileInSources {C96803EE-BABD-4805-97B5-C7008A9507D0}
-          filename_and_path {src/core/Fl_Browser_load.cxx}
+          filename_and_path {src/fltk3/Browser_load.cxx}
         }
-        file_ref {Fl_Button.cxx} {
+        file_ref {Button.cxx} {
           uuid_Xcode4_BuildFile {07627EF8-0726-4AEE-A7BE-5B01D59A2320}
           uuid_Xcode4_FileRef {70F96088-141B-442E-AF9B-5EAE13E45EFD}
           uuid_Xcode4_BuildFileInSources {DE2BB513-7AFF-460D-8095-4D0C6D632F84}
-          filename_and_path {src/core/Fl_Button.cxx}
+          filename_and_path {src/fltk3/Button.cxx}
         }
-        file_ref {Fl_Chart.cxx} {
+        file_ref {Chart.cxx} {
           uuid_Xcode4_BuildFile {A6F1AA20-5E36-4069-95D7-B2ADB04EACBB}
           uuid_Xcode4_FileRef {39250031-7441-4BDF-ABE1-745EE2786E57}
           uuid_Xcode4_BuildFileInSources {B0CAF4D1-1E41-4BDD-AF60-C1F8DFCA17AA}
-          filename_and_path {src/core/Fl_Chart.cxx}
+          filename_and_path {src/fltk3/Chart.cxx}
         }
-        file_ref {Fl_Check_Browser.cxx} {
+        file_ref {CheckBrowser.cxx} {
           uuid_Xcode4_BuildFile {2D43DF76-FFA8-46BE-8CC7-97E71F74AB36}
           uuid_Xcode4_FileRef {F6EC011E-29BD-4ADB-B4C8-EEC9E72E52E7}
           uuid_Xcode4_BuildFileInSources {37D83B9E-5F12-4F75-9351-7841D83CC630}
-          filename_and_path {src/core/Fl_Check_Browser.cxx}
+          filename_and_path {src/fltk3/CheckBrowser.cxx}
         }
-        file_ref {Fl_Check_Button.cxx} {
+        file_ref {CheckButton.cxx} {
           uuid_Xcode4_BuildFile {6F0253C7-58FE-4E3E-A84D-ACA19AE0B60F}
           uuid_Xcode4_FileRef {490C9DC5-6833-46C7-A0F5-F3D9C9795A6D}
           uuid_Xcode4_BuildFileInSources {B34F20AC-057A-41BD-B8E5-05E3F37A17B1}
-          filename_and_path {src/core/Fl_Check_Button.cxx}
+          filename_and_path {src/fltk3/CheckButton.cxx}
         }
-        file_ref {Fl_Choice.cxx} {
+        file_ref {Choice.cxx} {
           uuid_Xcode4_BuildFile {3BD02867-1A12-4C3A-AE6C-5D570873345C}
           uuid_Xcode4_FileRef {6356BFF2-3C95-496B-8310-FA86D8F77F5C}
           uuid_Xcode4_BuildFileInSources {16189C32-2A6C-4A8A-BAF6-4DFE1DBD4A2E}
-          filename_and_path {src/core/Fl_Choice.cxx}
+          filename_and_path {src/fltk3/Choice.cxx}
         }
-        file_ref {Fl_Clock.cxx} {
+        file_ref {Clock.cxx} {
           uuid_Xcode4_BuildFile {64809F27-28E9-4E6E-95D6-BF69AE67D5FD}
           uuid_Xcode4_FileRef {1C4F7DBF-440E-4FD8-A83E-F098D786280A}
           uuid_Xcode4_BuildFileInSources {4BB96489-76E9-44BD-A619-51624DCAD9BA}
-          filename_and_path {src/core/Fl_Clock.cxx}
+          filename_and_path {src/fltk3/Clock.cxx}
         }
-        file_ref {Fl_Color_Chooser.cxx} {
+        file_ref {ColorChooser.cxx} {
           uuid_Xcode4_BuildFile {F4AB783F-377F-4E93-8461-F7D5660002E3}
           uuid_Xcode4_FileRef {4CF353D8-81FC-4DE3-9189-39E910629419}
           uuid_Xcode4_BuildFileInSources {2D847DBF-42FA-4B1F-8C9F-587D52345529}
-          filename_and_path {src/core/Fl_Color_Chooser.cxx}
+          filename_and_path {src/fltk3/ColorChooser.cxx}
         }
-        file_ref {Fl_Counter.cxx} {
+        file_ref {Counter.cxx} {
           uuid_Xcode4_BuildFile {45E38AE7-C514-4BBB-A2CE-4B897029509D}
           uuid_Xcode4_FileRef {96D41530-E053-46CC-8B6F-C1EBDBF7E11E}
           uuid_Xcode4_BuildFileInSources {B2BB321C-34B1-4D09-9434-7E63F4A99288}
-          filename_and_path {src/core/Fl_Counter.cxx}
+          filename_and_path {src/fltk3/Counter.cxx}
         }
-        file_ref {Fl_Device.cxx} {
+        file_ref {Device.cxx} {
           uuid_Xcode4_BuildFile {9CBCE251-1829-44C4-BAF4-F95523E02EDF}
           uuid_Xcode4_FileRef {CB4EA804-687E-4579-AB3B-DE67EA64E9FB}
           uuid_Xcode4_BuildFileInSources {B1AB3E6C-AA35-4A2D-9177-44469F0CB1D8}
-          filename_and_path {src/core/Fl_Device.cxx}
+          filename_and_path {src/fltk3/Device.cxx}
         }
-        file_ref {Fl_Dial.cxx} {
+        file_ref {Dial.cxx} {
           uuid_Xcode4_BuildFile {F4D1986C-C2AB-46EA-951E-0F696A73F7F5}
           uuid_Xcode4_FileRef {FDB40722-2840-4C62-98C1-D38291CAB607}
           uuid_Xcode4_BuildFileInSources {1369E7AD-84B4-4FD2-9D04-99627B063564}
-          filename_and_path {src/core/Fl_Dial.cxx}
+          filename_and_path {src/fltk3/Dial.cxx}
         }
-        file_ref {Fl_Double_Window.cxx} {
+        file_ref {DoubleWindow.cxx} {
           uuid_Xcode4_BuildFile {6E8494D3-F35B-4D9F-846B-5EFE8203DC04}
           uuid_Xcode4_FileRef {D65E879C-A8F7-46EF-94C2-E474B73853BC}
           uuid_Xcode4_BuildFileInSources {43FA5D81-2826-46FC-95B5-175515727381}
-          filename_and_path {src/core/Fl_Double_Window.cxx}
+          filename_and_path {src/fltk3/DoubleWindow.cxx}
         }
-        file_ref {Fl_File_Browser.cxx} {
+        file_ref {FileBrowser.cxx} {
           uuid_Xcode4_BuildFile {3C81269D-295A-4C8D-93B4-9A7B72027FE2}
           uuid_Xcode4_FileRef {31B32445-8CFD-4811-A4C7-628F7D814264}
           uuid_Xcode4_BuildFileInSources {ECCA6DC4-1741-433D-AE93-BFDE5390C8D1}
-          filename_and_path {src/core/Fl_File_Browser.cxx}
+          filename_and_path {src/fltk3/FileBrowser.cxx}
         }
-        file_ref {Fl_File_Chooser.cxx} {
+        file_ref {FileChooser.cxx} {
           uuid_Xcode4_BuildFile {3B24302E-E655-42B1-8195-4A65633638BE}
           uuid_Xcode4_FileRef {E74C762F-3E71-4C17-8E8F-783C5BA2394A}
           uuid_Xcode4_BuildFileInSources {049EB013-455E-45FB-A557-6567D1DB2191}
-          filename_and_path {src/core/Fl_File_Chooser.cxx}
+          filename_and_path {src/fltk3/FileChooser.cxx}
         }
-        file_ref {Fl_File_Chooser2.cxx} {
+        file_ref {FileChooser2.cxx} {
           uuid_Xcode4_BuildFile {22A4B14E-FC3A-4D9F-A56C-07AD36664F71}
           uuid_Xcode4_FileRef {A7770A7F-FF59-489E-AB60-3811A3BFB46C}
           uuid_Xcode4_BuildFileInSources {17819EFD-407A-4954-8402-474A47FF9A97}
-          filename_and_path {src/core/Fl_File_Chooser2.cxx}
+          filename_and_path {src/fltk3/FileChooser2.cxx}
         }
-        file_ref {Fl_File_Icon.cxx} {
+        file_ref {FileIcon.cxx} {
           uuid_Xcode4_BuildFile {AF7F7642-24A6-444F-9A16-C020F722E332}
           uuid_Xcode4_FileRef {19FA31AE-9089-4E73-97EA-56F68EC5D035}
           uuid_Xcode4_BuildFileInSources {3DCD457D-328B-485F-8CAE-463ED9EE4246}
-          filename_and_path {src/core/Fl_File_Icon.cxx}
+          filename_and_path {src/fltk3/FileIcon.cxx}
         }
-        file_ref {Fl_File_Input.cxx} {
+        file_ref {FileInput.cxx} {
           uuid_Xcode4_BuildFile {E80A34C3-962D-4260-9AE8-3099080002B9}
           uuid_Xcode4_FileRef {D05F5EBC-72FF-49FD-912F-BB5399F2DDC2}
           uuid_Xcode4_BuildFileInSources {8F4CA13F-413A-400F-8266-4ABF3D647078}
-          filename_and_path {src/core/Fl_File_Input.cxx}
+          filename_and_path {src/fltk3/FileInput.cxx}
         }
-        file_ref {Fl_Group.cxx} {
+        file_ref {Group.cxx} {
           uuid_Xcode4_BuildFile {18D56E2C-8A51-4AC4-8247-489E424C5E2D}
           uuid_Xcode4_FileRef {A5952FB9-CE93-48E3-8F3E-9906B15F1B22}
           uuid_Xcode4_BuildFileInSources {99FB6408-3164-4FB6-8895-DA2F31644F95}
-          filename_and_path {src/core/Fl_Group.cxx}
+          filename_and_path {src/fltk3/Group.cxx}
         }
-        file_ref {Fl_Help_View.cxx} {
+        file_ref {HelpView.cxx} {
           uuid_Xcode4_BuildFile {E452ED95-DA10-4107-8505-81FF885CB929}
           uuid_Xcode4_FileRef {047B650C-DBF4-44C6-8D05-A009B49D48D6}
           uuid_Xcode4_BuildFileInSources {5D0D1C84-6B6B-4157-A676-0974C4878E5E}
-          filename_and_path {src/core/Fl_Help_View.cxx}
+          filename_and_path {src/fltk3/HelpView.cxx}
         }
-        file_ref {Fl_Image.cxx} {
+        file_ref {Image.cxx} {
           uuid_Xcode4_BuildFile {DF973496-4200-49AA-BC93-249BA2210DA0}
           uuid_Xcode4_FileRef {E01E16F1-143B-485F-B5FC-F6258C32F5F6}
           uuid_Xcode4_BuildFileInSources {DE9BFEBC-9FBA-49A7-86CB-DD7151D3A983}
-          filename_and_path {src/core/Fl_Image.cxx}
+          filename_and_path {src/fltk3/Image.cxx}
         }
-        file_ref {Fl_Input.cxx} {
+        file_ref {Input.cxx} {
           uuid_Xcode4_BuildFile {76FB90B7-4336-4503-9BE1-BAFE1C6595FD}
           uuid_Xcode4_FileRef {184F6210-C542-4DA1-83AC-8711FD7A0384}
           uuid_Xcode4_BuildFileInSources {1DC72F81-A8D1-4EAC-A118-87F7C91CC055}
-          filename_and_path {src/core/Fl_Input.cxx}
+          filename_and_path {src/fltk3/Input.cxx}
         }
-        file_ref {Fl_Input_.cxx} {
+        file_ref {Input_.cxx} {
           uuid_Xcode4_BuildFile {48A7C3EF-5BA8-4979-B113-AD2901649800}
           uuid_Xcode4_FileRef {A8924614-71DC-4863-9895-60692D538E50}
           uuid_Xcode4_BuildFileInSources {22D48105-5628-4901-9056-E590708B7A5C}
-          filename_and_path {src/core/Fl_Input_.cxx}
+          filename_and_path {src/fltk3/Input_.cxx}
         }
-        file_ref {Fl_Light_Button.cxx} {
+        file_ref {LightButton.cxx} {
           uuid_Xcode4_BuildFile {A7701349-FD57-46A0-84D3-B65C795C834B}
           uuid_Xcode4_FileRef {36C72097-8E40-47E8-914C-FB7F861ACD51}
           uuid_Xcode4_BuildFileInSources {EDFFE30A-F0F2-4A3C-BBFA-CC51818EFD3C}
-          filename_and_path {src/core/Fl_Light_Button.cxx}
+          filename_and_path {src/fltk3/LightButton.cxx}
         }
-        file_ref {Fl_Menu.cxx} {
+        file_ref {Menu.cxx} {
           uuid_Xcode4_BuildFile {FC5ADC05-7CB3-4213-9C1A-5F737CC9EDAE}
           uuid_Xcode4_FileRef {4672B51C-C45E-4BD5-8083-1C8403D7EAA5}
           uuid_Xcode4_BuildFileInSources {FB4C0311-03FE-4E29-A8FE-55B021C93B23}
-          filename_and_path {src/core/Fl_Menu.cxx}
+          filename_and_path {src/fltk3/Menu.cxx}
         }
-        file_ref {Fl_Menu_.cxx} {
+        file_ref {Menu_.cxx} {
           uuid_Xcode4_BuildFile {F4886C34-73DF-44FB-A100-AD10EEC6340F}
           uuid_Xcode4_FileRef {DE9E57A2-6320-4D65-8B5C-485F9D820566}
           uuid_Xcode4_BuildFileInSources {24D66152-234B-40E8-96E4-9BE455EEA9CD}
-          filename_and_path {src/core/Fl_Menu_.cxx}
+          filename_and_path {src/fltk3/Menu_.cxx}
         }
-        file_ref {Fl_Menu_Bar.cxx} {
+        file_ref {MenuBar.cxx} {
           uuid_Xcode4_BuildFile {F690A4A3-C410-4C28-8B0C-DD694D66E06E}
           uuid_Xcode4_FileRef {265C00BF-D5DC-4849-813B-19E9A10BE42A}
           uuid_Xcode4_BuildFileInSources {BD7AE3AE-8500-4770-86A5-3D5C7D63A102}
-          filename_and_path {src/core/Fl_Menu_Bar.cxx}
+          filename_and_path {src/fltk3/MenuBar.cxx}
         }
-        file_ref {Fl_Menu_Button.cxx} {
+        file_ref {MenuButton.cxx} {
           uuid_Xcode4_BuildFile {FD9004A1-F802-4C5D-9225-5344D737A373}
           uuid_Xcode4_FileRef {58FD2064-F6B4-447C-BCF8-E8998D2E68DB}
           uuid_Xcode4_BuildFileInSources {1EC305B7-05F0-4FD7-A035-7FAC4486CAEA}
-          filename_and_path {src/core/Fl_Menu_Button.cxx}
+          filename_and_path {src/fltk3/MenuButton.cxx}
         }
-        file_ref {Fl_Menu_Window.cxx} {
+        file_ref {MenuWindow.cxx} {
           uuid_Xcode4_BuildFile {8C7C9611-0CD1-4C32-847B-11A750EB0745}
           uuid_Xcode4_FileRef {CBE03F81-8878-47F2-8580-C669735AEFC9}
           uuid_Xcode4_BuildFileInSources {63C85999-1423-4DE8-A091-764292A98548}
-          filename_and_path {src/core/Fl_Menu_Window.cxx}
+          filename_and_path {src/fltk3/MenuWindow.cxx}
         }
-        file_ref {Fl_Menu_add.cxx} {
+        file_ref {Menu_add.cxx} {
           uuid_Xcode4_BuildFile {83EF6417-50A0-4E49-8D93-357ECA893443}
           uuid_Xcode4_FileRef {C649ABF1-FC49-41C2-B145-EEF11539FB5F}
           uuid_Xcode4_BuildFileInSources {A5B4D789-9B30-4430-9193-9A2FCFC14069}
-          filename_and_path {src/core/Fl_Menu_add.cxx}
+          filename_and_path {src/fltk3/Menu_add.cxx}
         }
-        file_ref {Fl_Menu_global.cxx} {
+        file_ref {Menu_global.cxx} {
           uuid_Xcode4_BuildFile {8FA4327A-A0BD-4F1B-A447-93E87A9BCE1C}
           uuid_Xcode4_FileRef {25D17230-B6AF-4AF7-B3C0-2995DA9C6F23}
           uuid_Xcode4_BuildFileInSources {6C148F33-17A5-4AF2-9A68-A5C91E171DE8}
-          filename_and_path {src/core/Fl_Menu_global.cxx}
+          filename_and_path {src/fltk3/Menu_global.cxx}
         }
-        file_ref {Fl_Multi_Label.cxx} {
+        file_ref {MultiLabel.cxx} {
           uuid_Xcode4_BuildFile {2F50A0D8-B6F7-490A-A8EC-11F893AC8AB9}
           uuid_Xcode4_FileRef {37D57C7D-DA2D-4296-AA55-229B1A3BFC20}
           uuid_Xcode4_BuildFileInSources {46A6752E-635C-4E9A-AA63-5B7155C93484}
-          filename_and_path {src/core/Fl_Multi_Label.cxx}
+          filename_and_path {src/fltk3/MultiLabel.cxx}
         }
-        file_ref {Fl_Native_File_Chooser.cxx} {
+        file_ref {NativeFileChooser.cxx} {
           uuid_Xcode4_BuildFile {3CCD0677-B052-4EAB-847D-EA18F342D11F}
           uuid_Xcode4_FileRef {FC634C34-9189-40E6-90A4-8D42EF923847}
           uuid_Xcode4_BuildFileInSources {B30D6189-B227-4351-BD2F-EAAB376B6779}
-          filename_and_path {src/core/Fl_Native_File_Chooser.cxx}
+          filename_and_path {src/fltk3/NativeFileChooser.cxx}
         }
-        file_ref {Fl_Overlay_Window.cxx} {
+        file_ref {OverlayWindow.cxx} {
           uuid_Xcode4_BuildFile {50CCB3E9-D605-4F6C-97EA-4607BFC19BEC}
           uuid_Xcode4_FileRef {CEF1A66A-1E4B-4A61-A236-82B007C52832}
           uuid_Xcode4_BuildFileInSources {5857DE8B-5066-46E4-89B9-03B693032DB4}
-          filename_and_path {src/core/Fl_Overlay_Window.cxx}
+          filename_and_path {src/fltk3/OverlayWindow.cxx}
         }
-        file_ref {Fl_Pack.cxx} {
+        file_ref {PackedGroup.cxx} {
           uuid_Xcode4_BuildFile {2EC07AEA-4325-4E47-8D60-139740EAE1C2}
           uuid_Xcode4_FileRef {0F0129FF-794E-4E1D-9091-7900F59B9FB5}
           uuid_Xcode4_BuildFileInSources {5C93DA84-CF25-4D54-ACD5-CFE6763AA2F8}
-          filename_and_path {src/core/Fl_Pack.cxx}
+          filename_and_path {src/fltk3/PackedGroup.cxx}
         }
-        file_ref {Fl_Paged_Device.cxx} {
+        file_ref {PagedDevice.cxx} {
           uuid_Xcode4_BuildFile {3851F580-32C6-4733-9167-C8CBD7610692}
           uuid_Xcode4_FileRef {680EF039-6F4F-4B31-B176-BD222AD802F6}
           uuid_Xcode4_BuildFileInSources {BFD45A93-42FD-4D79-8F8D-953B663EB28F}
-          filename_and_path {src/core/Fl_Paged_Device.cxx}
+          filename_and_path {src/fltk3/PagedDevice.cxx}
         }
-        file_ref {Fl_Pixmap.cxx} {
+        file_ref {Pixmap.cxx} {
           uuid_Xcode4_BuildFile {C4D7E2E9-314F-4361-AD85-CDBEB0E9B9A8}
           uuid_Xcode4_FileRef {9AEB9365-32CF-48CF-8810-7F9B2046454D}
           uuid_Xcode4_BuildFileInSources {EBD65896-39D0-45DE-9F3B-66A8B55D8A75}
-          filename_and_path {src/core/Fl_Pixmap.cxx}
+          filename_and_path {src/fltk3/Pixmap.cxx}
         }
-        file_ref {Fl_Positioner.cxx} {
+        file_ref {Positioner.cxx} {
           uuid_Xcode4_BuildFile {AFC22C98-7D5A-47AD-8F79-8AE0ABA64048}
           uuid_Xcode4_FileRef {9EB992B1-D710-426E-A89D-8F3306A07426}
           uuid_Xcode4_BuildFileInSources {78781310-D555-4403-B4E1-EF0EA0E1E765}
-          filename_and_path {src/core/Fl_Positioner.cxx}
+          filename_and_path {src/fltk3/Positioner.cxx}
         }
-        file_ref {Fl_Printer.cxx} {
+        file_ref {Printer.cxx} {
           uuid_Xcode4_BuildFile {7BA4A607-6C7B-4BB0-B8CB-0F7B4F3EDE3F}
           uuid_Xcode4_FileRef {53F2F9DE-99B0-4879-AD46-BA1EA21D0246}
           uuid_Xcode4_BuildFileInSources {C759F618-3B69-4CCC-A1E6-73E8DBD7488D}
-          filename_and_path {src/core/Fl_Printer.cxx}
+          filename_and_path {src/fltk3/Printer.cxx}
         }
-        file_ref {Fl_Preferences.cxx} {
+        file_ref {Preferences.cxx} {
           uuid_Xcode4_BuildFile {B6CC4604-60B8-4F7A-B134-C1D8EC515A12}
           uuid_Xcode4_FileRef {59610374-761E-4912-BDCE-5F669B7B3FA5}
           uuid_Xcode4_BuildFileInSources {96257899-ED70-4DA5-83C8-42BB3FAC5200}
-          filename_and_path {src/core/Fl_Preferences.cxx}
+          filename_and_path {src/fltk3/Preferences.cxx}
         }
-        file_ref {Fl_Progress.cxx} {
+        file_ref {Progress.cxx} {
           uuid_Xcode4_BuildFile {20F00948-E2C6-4027-BE38-4BD07D34D62E}
           uuid_Xcode4_FileRef {B62169E8-CBE5-4A83-8893-D176E6E4DD9F}
           uuid_Xcode4_BuildFileInSources {486D31DD-6CF6-4B78-B16A-9D3B44B6284E}
-          filename_and_path {src/core/Fl_Progress.cxx}
+          filename_and_path {src/fltk3/Progress.cxx}
         }
-        file_ref {Fl_Repeat_Button.cxx} {
+        file_ref {RepeatButton.cxx} {
           uuid_Xcode4_BuildFile {A494B047-B897-48AC-B463-91BA94498C6B}
           uuid_Xcode4_FileRef {F2E611B0-825F-4087-AD5E-6863D06946BC}
           uuid_Xcode4_BuildFileInSources {4E4DEB0F-5530-4490-8B70-6CDBB682FBAF}
-          filename_and_path {src/core/Fl_Repeat_Button.cxx}
+          filename_and_path {src/fltk3/RepeatButton.cxx}
         }
-        file_ref {Fl_Return_Button.cxx} {
+        file_ref {ReturnButton.cxx} {
           uuid_Xcode4_BuildFile {87CE402C-87A8-4C9C-AB9A-0F4D9B28E093}
           uuid_Xcode4_FileRef {69E296C0-6A1A-43E1-A97D-9905A82EE913}
           uuid_Xcode4_BuildFileInSources {5B4F6F77-657B-4161-8495-8F9D9DCE19F1}
-          filename_and_path {src/core/Fl_Return_Button.cxx}
+          filename_and_path {src/fltk3/ReturnButton.cxx}
         }
-        file_ref {Fl_Roller.cxx} {
+        file_ref {Roller.cxx} {
           uuid_Xcode4_BuildFile {07E3396B-982F-4ACA-A15F-604C0F96FB37}
           uuid_Xcode4_FileRef {A5526E66-615E-4C5D-BEFD-4A34647C13A4}
           uuid_Xcode4_BuildFileInSources {01570F25-D56A-4F38-A635-7167DA170772}
-          filename_and_path {src/core/Fl_Roller.cxx}
+          filename_and_path {src/fltk3/Roller.cxx}
         }
-        file_ref {Fl_Round_Button.cxx} {
+        file_ref {RoundButton.cxx} {
           uuid_Xcode4_BuildFile {8CE9A2F5-45BE-4D71-845A-3BCEFBC1D0AF}
           uuid_Xcode4_FileRef {5DA33AF3-3DC1-4878-970E-E2E5BE824A96}
           uuid_Xcode4_BuildFileInSources {F32B3FAD-0BC4-4B34-9E26-9E69FA6158E3}
-          filename_and_path {src/core/Fl_Round_Button.cxx}
+          filename_and_path {src/fltk3/RoundButton.cxx}
         }
-        file_ref {Fl_Scroll.cxx} {
+        file_ref {ScrollGroup.cxx} {
           uuid_Xcode4_BuildFile {0105EB4F-2FD7-4B85-B5D8-B09B33CEBC16}
           uuid_Xcode4_FileRef {135F7AE4-1BF1-474C-BB37-117ED80BB12D}
           uuid_Xcode4_BuildFileInSources {B506EE63-364E-4744-9C3F-94D382B52F62}
-          filename_and_path {src/core/Fl_Scroll.cxx}
+          filename_and_path {src/fltk3/ScrollGroup.cxx}
         }
-        file_ref {Fl_Scrollbar.cxx} {
+        file_ref {Scrollbar.cxx} {
           uuid_Xcode4_BuildFile {5C70A5A9-A67B-4B14-9D23-ABBDCE533FD9}
           uuid_Xcode4_FileRef {6F7BEB35-6EBF-499D-A9F5-BD43167B1FB8}
           uuid_Xcode4_BuildFileInSources {5622DE29-66EB-4F16-8F99-3642F1607BC6}
-          filename_and_path {src/core/Fl_Scrollbar.cxx}
+          filename_and_path {src/fltk3/Scrollbar.cxx}
         }
-        file_ref {Fl_Shared_Image.cxx} {
+        file_ref {SharedImage.cxx} {
           uuid_Xcode4_BuildFile {8A0C023A-0383-430E-95D8-B9AEA5E17969}
           uuid_Xcode4_FileRef {8580401C-DB11-4629-931A-AA44CAD127AC}
           uuid_Xcode4_BuildFileInSources {7CB9D27B-4F25-4039-8052-62DE828F280B}
-          filename_and_path {src/core/Fl_Shared_Image.cxx}
+          filename_and_path {src/fltk3/SharedImage.cxx}
         }
-        file_ref {Fl_Single_Window.cxx} {
+        file_ref {SingleWindow.cxx} {
           uuid_Xcode4_BuildFile {C6BD816D-59B7-4C3C-A83A-A78D32B5BDBC}
           uuid_Xcode4_FileRef {17A03BA5-0404-4989-A516-C22F7D8BDCEE}
           uuid_Xcode4_BuildFileInSources {550F71EE-612D-428E-8D5C-55BC0A890F88}
-          filename_and_path {src/core/Fl_Single_Window.cxx}
+          filename_and_path {src/fltk3/SingleWindow.cxx}
         }
-        file_ref {Fl_Slider.cxx} {
+        file_ref {Slider.cxx} {
           uuid_Xcode4_BuildFile {05A570C7-6790-48AF-B07E-3DA2E4738B28}
           uuid_Xcode4_FileRef {085FAF82-6F59-4F42-AB4C-349D927A8BAA}
           uuid_Xcode4_BuildFileInSources {052ACB65-EF8A-454B-AFDB-BD3FDFA7B7C1}
-          filename_and_path {src/core/Fl_Slider.cxx}
+          filename_and_path {src/fltk3/Slider.cxx}
         }
         file_ref {Style.cxx} {
           uuid_Xcode4_BuildFile {DD895EB1-D352-4D09-99D7-D9DE1758D9F9}
           uuid_Xcode4_FileRef {CAA3AD96-0CC5-4893-8893-68022791C783}
           uuid_Xcode4_BuildFileInSources {19513486-168E-430B-88A7-6896DF857E7B}
-          filename_and_path {src/core/Style.cxx}
+          filename_and_path {src/fltk3/Style.cxx}
         }
-        file_ref {Fl_Sys_Menu_Bar.cxx} {
+        file_ref {SysMenuBar.cxx} {
           uuid_Xcode4_BuildFile {FC5F7A11-9A94-4596-BCF0-458EB54BF587}
           uuid_Xcode4_FileRef {43C12A4D-7C89-4BAE-B250-C5E2307220CC}
           uuid_Xcode4_BuildFileInSources {B7E4B117-9D18-4D8B-A68F-4BDF4AD5127B}
-          filename_and_path {src/core/Fl_Sys_Menu_Bar.cxx}
+          filename_and_path {src/fltk3/SysMenuBar.cxx}
         }
-        file_ref {Fl_Table.cxx} {
+        file_ref {Table.cxx} {
           uuid_Xcode4_BuildFile {BFA14DC7-600F-49DF-99DF-24A48C8142E6}
           uuid_Xcode4_FileRef {02584243-5408-4D4A-96A5-3FA806F5BCFA}
           uuid_Xcode4_BuildFileInSources {E0D6CAE3-0A6F-47A7-9A4B-CE1FB5C61EBA}
-          filename_and_path {src/core/Fl_Table.cxx}
+          filename_and_path {src/fltk3/Table.cxx}
         }
-        file_ref {Fl_Table_Row.cxx} {
+        file_ref {TableRow.cxx} {
           uuid_Xcode4_BuildFile {8B6C6698-82A4-490F-B7D9-3AB8182B0DD4}
           uuid_Xcode4_FileRef {7097EA09-FB87-4E3F-B29A-4E64EBE28CA8}
           uuid_Xcode4_BuildFileInSources {56C8DD01-88A0-4126-BD4E-B59F64F2047B}
-          filename_and_path {src/core/Fl_Table_Row.cxx}
+          filename_and_path {src/fltk3/TableRow.cxx}
         }
-        file_ref {Fl_Tabs.cxx} {
+        file_ref {TabGroup.cxx} {
           uuid_Xcode4_BuildFile {BDA1F834-FADD-4394-A2A3-67616F09DB47}
           uuid_Xcode4_FileRef {77126381-0CA1-4F19-8800-48B51FF6A61B}
           uuid_Xcode4_BuildFileInSources {135F22EC-8E13-48D2-AB1C-CF4BF223E1EA}
-          filename_and_path {src/core/Fl_Tabs.cxx}
+          filename_and_path {src/fltk3/TabGroup.cxx}
         }
-        file_ref {Fl_Text_Buffer.cxx} {
+        file_ref {TextBuffer.cxx} {
           uuid_Xcode4_BuildFile {9BD37A78-D289-47A9-BBA2-7B67CEFEB0DA}
           uuid_Xcode4_FileRef {8867A20B-7B96-4B4E-BBE1-E492D157D617}
           uuid_Xcode4_BuildFileInSources {1ABCEAD8-C819-4B1E-971C-A1F949D56A9B}
-          filename_and_path {src/core/Fl_Text_Buffer.cxx}
+          filename_and_path {src/fltk3/TextBuffer.cxx}
         }
-        file_ref {Fl_Text_Display.cxx} {
+        file_ref {TextDisplay.cxx} {
           uuid_Xcode4_BuildFile {1A94F4A9-95C0-4A75-8DE5-8945E353D597}
           uuid_Xcode4_FileRef {E5E1DA87-AA6C-460E-90F4-2C8D9411CDB9}
           uuid_Xcode4_BuildFileInSources {9B434666-39BA-4D16-8A78-77F8CF1A44C7}
-          filename_and_path {src/core/Fl_Text_Display.cxx}
+          filename_and_path {src/fltk3/TextDisplay.cxx}
         }
-        file_ref {Fl_Text_Editor.cxx} {
+        file_ref {TextEditor.cxx} {
           uuid_Xcode4_BuildFile {A507F8F6-5687-406F-A0B0-A424A3CB162B}
           uuid_Xcode4_FileRef {5995AACC-72D1-4AAA-A20A-84D4CEE88139}
           uuid_Xcode4_BuildFileInSources {038A56E9-A8EE-4DC7-971B-3C3FD59EF7FA}
-          filename_and_path {src/core/Fl_Text_Editor.cxx}
+          filename_and_path {src/fltk3/TextEditor.cxx}
         }
-        file_ref {Fl_Tile.cxx} {
+        file_ref {TiledGroup.cxx} {
           uuid_Xcode4_BuildFile {3870255E-E9C6-4D50-9C26-E04A6CA659C9}
           uuid_Xcode4_FileRef {A3F6667D-AF2F-460F-809F-4BDDED6E95FC}
           uuid_Xcode4_BuildFileInSources {45E744C6-8C6C-4F03-913D-2D3B7F9F04EE}
-          filename_and_path {src/core/Fl_Tile.cxx}
+          filename_and_path {src/fltk3/TiledGroup.cxx}
         }
-        file_ref {Fl_Tiled_Image.cxx} {
+        file_ref {TiledImage.cxx} {
           uuid_Xcode4_BuildFile {C043B0DE-0983-418C-88CB-5CB7F7F4A60A}
           uuid_Xcode4_FileRef {4C92BA7B-29EF-46D2-91C9-348D49388F69}
           uuid_Xcode4_BuildFileInSources {E9D3E58E-0CCD-4003-845F-E0C0B2BC43EA}
-          filename_and_path {src/core/Fl_Tiled_Image.cxx}
+          filename_and_path {src/fltk3/TiledImage.cxx}
         }
-        file_ref {Fl_Tooltip.cxx} {
+        file_ref {Tooltip.cxx} {
           uuid_Xcode4_BuildFile {36ACF63E-9691-4DFE-8918-CA3610F13FAD}
           uuid_Xcode4_FileRef {22CA4A41-F913-4DAC-A13D-CC57F6A6F244}
           uuid_Xcode4_BuildFileInSources {90FFE6AA-D57A-4579-BAB9-1C971983C991}
-          filename_and_path {src/core/Fl_Tooltip.cxx}
+          filename_and_path {src/fltk3/Tooltip.cxx}
         }
-        file_ref {Fl_Tree.cxx} {
+        file_ref {Tree.cxx} {
           uuid_Xcode4_BuildFile {AE64AF6B-751E-4D4E-B923-16EFC07C9234}
           uuid_Xcode4_FileRef {214492E9-38C0-491D-AC42-F4E1EF8FEAA3}
           uuid_Xcode4_BuildFileInSources {68148315-74B0-49C3-9C8F-FE81AA36873D}
-          filename_and_path {src/core/Fl_Tree.cxx}
+          filename_and_path {src/fltk3/Tree.cxx}
         }
-        file_ref {Fl_Tree_Item.cxx} {
+        file_ref {TreeItem.cxx} {
           uuid_Xcode4_BuildFile {03133ABA-346B-4DEC-B667-9E9A78C07AD7}
           uuid_Xcode4_FileRef {D9F29791-60DE-48C5-9266-701106AB7E8E}
           uuid_Xcode4_BuildFileInSources {9A57CF11-9BC9-40E0-B6C2-E305BAEF98A7}
-          filename_and_path {src/core/Fl_Tree_Item.cxx}
+          filename_and_path {src/fltk3/TreeItem.cxx}
         }
-        file_ref {Fl_Tree_Item_Array.cxx} {
+        file_ref {TreeItemArray.cxx} {
           uuid_Xcode4_BuildFile {A082BAF2-ECA2-4E15-A323-76837C355BE9}
           uuid_Xcode4_FileRef {D6CBFFFA-2FE1-4D65-883E-F592FACE5284}
           uuid_Xcode4_BuildFileInSources {D2A37420-118D-4BAF-A60C-C4B971A051DE}
-          filename_and_path {src/core/Fl_Tree_Item_Array.cxx}
+          filename_and_path {src/fltk3/TreeItemArray.cxx}
         }
-        file_ref {Fl_Tree_Prefs.cxx} {
+        file_ref {TreePrefs.cxx} {
           uuid_Xcode4_BuildFile {D18C9E57-25E8-4D5D-8A64-59536C9DD869}
           uuid_Xcode4_FileRef {CFFE37EE-309C-43FC-BCE5-41E02E7B592D}
           uuid_Xcode4_BuildFileInSources {68CC4C36-27B6-4DA0-9B5A-A5E1BCEE853E}
-          filename_and_path {src/core/Fl_Tree_Prefs.cxx}
+          filename_and_path {src/fltk3/TreePrefs.cxx}
         }
-        file_ref {Fl_Valuator.cxx} {
+        file_ref {Valuator.cxx} {
           uuid_Xcode4_BuildFile {2BE8F141-3682-40D9-86E6-ED82BFF69E75}
           uuid_Xcode4_FileRef {35EB53B1-EE73-4CA2-A8DE-47D037A4970E}
           uuid_Xcode4_BuildFileInSources {4A519B4F-67A2-43BF-9740-82E3DA6D3231}
-          filename_and_path {src/core/Fl_Valuator.cxx}
+          filename_and_path {src/fltk3/Valuator.cxx}
         }
-        file_ref {Fl_Value_Input.cxx} {
+        file_ref {ValueInput.cxx} {
           uuid_Xcode4_BuildFile {44BC0D55-DA69-4BD4-9F19-B42DD0F34E4E}
           uuid_Xcode4_FileRef {1685625E-A5F8-463D-BE13-D96C29D7D314}
           uuid_Xcode4_BuildFileInSources {BD78190E-0B6A-4932-85C7-DA11B71AFEDA}
-          filename_and_path {src/core/Fl_Value_Input.cxx}
+          filename_and_path {src/fltk3/ValueInput.cxx}
         }
-        file_ref {Fl_Value_Output.cxx} {
+        file_ref {ValueOutput.cxx} {
           uuid_Xcode4_BuildFile {4EA1B94C-4E2A-4416-A2D4-2552A132F55A}
           uuid_Xcode4_FileRef {7553A0E7-0663-41E1-AE1E-E07C7DB0DDE5}
           uuid_Xcode4_BuildFileInSources {7E26A26E-5A02-440D-8966-60F1255F67D7}
-          filename_and_path {src/core/Fl_Value_Output.cxx}
+          filename_and_path {src/fltk3/ValueOutput.cxx}
         }
-        file_ref {Fl_Value_Slider.cxx} {
+        file_ref {ValueSlider.cxx} {
           uuid_Xcode4_BuildFile {2AF743E0-9646-472E-9B92-7D02BD5C25D0}
           uuid_Xcode4_FileRef {07F5E789-E549-43E0-B527-FB1FE46B9744}
           uuid_Xcode4_BuildFileInSources {00BFB74D-1DF3-4632-9997-B303AFF72C8E}
-          filename_and_path {src/core/Fl_Value_Slider.cxx}
+          filename_and_path {src/fltk3/ValueSlider.cxx}
         }
-        file_ref {Fl_Widget.cxx} {
+        file_ref {Widget.cxx} {
           uuid_Xcode4_BuildFile {9B2E9C9D-3B03-453C-B5ED-887C12F26BBC}
           uuid_Xcode4_FileRef {C5F5E189-F794-4C76-B727-E18198ADF418}
           uuid_Xcode4_BuildFileInSources {C8308863-F3C1-47E0-8715-2A26C5442423}
-          filename_and_path {src/core/Fl_Widget.cxx}
+          filename_and_path {src/fltk3/Widget.cxx}
         }
-        file_ref {Fl_Window.cxx} {
+        file_ref {Window.cxx} {
           uuid_Xcode4_BuildFile {92A1ED53-56AF-4774-ADED-DC90687267DF}
           uuid_Xcode4_FileRef {8E1A3A4F-8323-456A-9EC0-B1C80AF48D54}
           uuid_Xcode4_BuildFileInSources {EAFF1F86-859B-4124-B744-7D388FCCEA28}
-          filename_and_path {src/core/Fl_Window.cxx}
+          filename_and_path {src/fltk3/Window.cxx}
         }
-        file_ref {Fl_Window_fullscreen.cxx} {
+        file_ref {Window_fullscreen.cxx} {
           uuid_Xcode4_BuildFile {06F92B62-70C7-4220-9B40-9E49613889D5}
           uuid_Xcode4_FileRef {7679F6CC-1F04-4C95-82A8-45ADD9B921DA}
           uuid_Xcode4_BuildFileInSources {C62F4F9E-5D2F-4E98-A29C-451146033106}
-          filename_and_path {src/core/Fl_Window_fullscreen.cxx}
+          filename_and_path {src/fltk3/Window_fullscreen.cxx}
         }
-        file_ref {Fl_Window_hotspot.cxx} {
+        file_ref {Window_hotspot.cxx} {
           uuid_Xcode4_BuildFile {01838D98-2D61-477B-8251-BFEF7F7934B1}
           uuid_Xcode4_FileRef {B5E58AC3-DBBC-4921-9066-AABABE238301}
           uuid_Xcode4_BuildFileInSources {A76E032A-9937-4086-80F0-B370163BB493}
-          filename_and_path {src/core/Fl_Window_hotspot.cxx}
+          filename_and_path {src/fltk3/Window_hotspot.cxx}
         }
-        file_ref {Fl_Window_iconize.cxx} {
+        file_ref {Window_iconize.cxx} {
           uuid_Xcode4_BuildFile {C23C9712-2419-4812-927C-ADFAB6DF91C0}
           uuid_Xcode4_FileRef {C34CF806-B0A3-4A4A-B3B1-502CDFD23D3B}
           uuid_Xcode4_BuildFileInSources {E373B7F4-2FFB-4CEE-9357-7586F6D255E9}
-          filename_and_path {src/core/Fl_Window_iconize.cxx}
+          filename_and_path {src/fltk3/Window_iconize.cxx}
         }
-        file_ref {Fl_Wizard.cxx} {
+        file_ref {Wizard.cxx} {
           uuid_Xcode4_BuildFile {0ECB24E4-43CE-497B-AE79-CFB4AA24EE9F}
           uuid_Xcode4_FileRef {A84F1844-4DC5-4FCD-925E-20F4809D2871}
           uuid_Xcode4_BuildFileInSources {72DEB4A9-12C7-445B-82A8-8DB9C103EF90}
-          filename_and_path {src/core/Fl_Wizard.cxx}
+          filename_and_path {src/fltk3/Wizard.cxx}
         }
-        file_ref {Fl_XBM_Image.cxx} {
+        file_ref {XBMImage.cxx} {
           uuid_Xcode4_BuildFile {0331C1F4-F50E-40CE-A3DF-DBCE1026AEE5}
           uuid_Xcode4_FileRef {9A21D7ED-A598-46CE-9BEF-FF2BB0EDD969}
           uuid_Xcode4_BuildFileInSources {F4974EC2-D5E9-4919-8325-C1F3AEB0CC0D}
-          filename_and_path {src/core/Fl_XBM_Image.cxx}
+          filename_and_path {src/fltk3/XBMImage.cxx}
         }
-        file_ref {Fl_XPM_Image.cxx} {
+        file_ref {XPMImage.cxx} {
           uuid_Xcode4_BuildFile {BA6520FE-E8C8-46CE-97D2-B2004FBA58EB}
           uuid_Xcode4_FileRef {302A3FA8-E0E6-4BBF-BFFF-61815255E28C}
           uuid_Xcode4_BuildFileInSources {A7891F57-3F3F-4B7F-B2EF-B57A4D70C5D4}
-          filename_and_path {src/core/Fl_XPM_Image.cxx}
+          filename_and_path {src/fltk3/XPMImage.cxx}
         }
-        file_ref {Fl_abort.cxx} {
+        file_ref {abort.cxx} {
           uuid_Xcode4_BuildFile {76CBBC9B-34FC-4D1D-8B91-4364D399C78E}
           uuid_Xcode4_FileRef {671B96BA-1F00-4285-B741-6287EE31AB76}
           uuid_Xcode4_BuildFileInSources {230F7BA0-D22C-4FF3-BDAC-74F889B89DFF}
-          filename_and_path {src/core/Fl_abort.cxx}
+          filename_and_path {src/fltk3/abort.cxx}
         }
-        file_ref {Fl_add_idle.cxx} {
+        file_ref {add_idle.cxx} {
           uuid_Xcode4_BuildFile {995D8E2D-7F48-4AA5-BC5D-1EE141C7D5B7}
           uuid_Xcode4_FileRef {1821AF47-D43D-4B6F-BAF7-0C8239CB0CF8}
           uuid_Xcode4_BuildFileInSources {EC8E6A4E-E23B-4501-9094-B62AEC330000}
-          filename_and_path {src/core/Fl_add_idle.cxx}
+          filename_and_path {src/fltk3/add_idle.cxx}
         }
-        file_ref {Fl_arg.cxx} {
+        file_ref {arg.cxx} {
           uuid_Xcode4_BuildFile {3DBCCC28-455E-4B3D-A821-A87B87661BAB}
           uuid_Xcode4_FileRef {8E5EB755-F5D6-4F27-8C0C-B3BD5109FC0C}
           uuid_Xcode4_BuildFileInSources {A87E247A-A9E6-4714-843A-A9F46B7DFEE1}
-          filename_and_path {src/core/Fl_arg.cxx}
+          filename_and_path {src/fltk3/arg.cxx}
         }
-        file_ref {Fl_compose.cxx} {
+        file_ref {compose.cxx} {
           uuid_Xcode4_BuildFile {008D083F-48BF-4D00-91BE-4A038C38678F}
           uuid_Xcode4_FileRef {AA048ACB-ADC4-4FE4-9FEE-77DF739595BD}
           uuid_Xcode4_BuildFileInSources {867ED2B3-580E-4431-AD43-EC19CBA63053}
-          filename_and_path {src/core/Fl_compose.cxx}
+          filename_and_path {src/fltk3/compose.cxx}
         }
-        file_ref {Fl_display.cxx} {
+        file_ref {display.cxx} {
           uuid_Xcode4_BuildFile {7CD1939D-5904-41CA-8EDF-051E74AF82AD}
           uuid_Xcode4_FileRef {44287148-A93A-4F14-BF82-CF1A80C4EA41}
           uuid_Xcode4_BuildFileInSources {EF8285FB-C1F0-4987-9920-B186F7E61B8A}
-          filename_and_path {src/core/Fl_display.cxx}
+          filename_and_path {src/fltk3/display.cxx}
         }
-        file_ref {Fl_get_key.cxx} {
+        file_ref {get_key.cxx} {
           uuid_Xcode4_BuildFile {A82ED410-8A3B-4306-8DB8-B26F032BF0B4}
           uuid_Xcode4_FileRef {A8DC358A-CD4F-4EDF-BCC0-1853A9A8AE55}
           uuid_Xcode4_BuildFileInSources {11ADE417-BC90-4DDF-8E9C-777EEE8083CE}
-          filename_and_path {src/core/Fl_get_key.cxx}
+          filename_and_path {src/fltk3/get_key.cxx}
         }
-        file_ref {Fl_get_system_colors.cxx} {
+        file_ref {get_system_colors.cxx} {
           uuid_Xcode4_BuildFile {304D9DBC-B02C-4B24-9313-78D56E0DB732}
           uuid_Xcode4_FileRef {FEADB63E-10A5-4C86-BDC0-C7427884C5C5}
           uuid_Xcode4_BuildFileInSources {05360A38-1464-4542-ADD3-F1DC5DE74075}
-          filename_and_path {src/core/Fl_get_system_colors.cxx}
+          filename_and_path {src/fltk3/get_system_colors.cxx}
         }
-        file_ref {Fl_grab.cxx} {
+        file_ref {grab.cxx} {
           uuid_Xcode4_BuildFile {63ABEAB0-ACB7-4C09-907A-41FB050A8D7C}
           uuid_Xcode4_FileRef {76AA6E6C-3BA9-4D36-8E49-3F1EF8125874}
           uuid_Xcode4_BuildFileInSources {DF2B279A-3F18-4376-A29F-EF041DAF6A30}
-          filename_and_path {src/core/Fl_grab.cxx}
+          filename_and_path {src/fltk3/grab.cxx}
         }
-        file_ref {Fl_lock.cxx} {
+        file_ref {lock.cxx} {
           uuid_Xcode4_BuildFile {590BA941-4384-40FA-AFFA-2CA40D153532}
           uuid_Xcode4_FileRef {7FAC5183-623B-4758-B960-41D044E55B90}
           uuid_Xcode4_BuildFileInSources {F08C8B0E-2FA4-4A06-8350-642417682E0C}
-          filename_and_path {src/core/Fl_lock.cxx}
+          filename_and_path {src/fltk3/lock.cxx}
         }
-        file_ref {Fl_own_colormap.cxx} {
+        file_ref {own_colormap.cxx} {
           uuid_Xcode4_BuildFile {2A1194F3-22E2-490B-AD07-E1CAB1EBB610}
           uuid_Xcode4_FileRef {013DBB50-59E0-4063-B31F-D57E3C31E2A9}
           uuid_Xcode4_BuildFileInSources {D93BEFC6-7FD5-48E3-935B-5D96C57C91B9}
-          filename_and_path {src/core/Fl_own_colormap.cxx}
+          filename_and_path {src/fltk3/own_colormap.cxx}
         }
-        file_ref {Fl_visual.cxx} {
+        file_ref {visual.cxx} {
           uuid_Xcode4_BuildFile {899B51B6-BAE8-4D54-942F-B2CD51DE703F}
           uuid_Xcode4_FileRef {1626800F-6D7F-4052-88E8-7EF69E2468DD}
           uuid_Xcode4_BuildFileInSources {D57FBCFB-33F0-4145-A643-4334A7F80562}
-          filename_and_path {src/core/Fl_visual.cxx}
+          filename_and_path {src/fltk3/visual.cxx}
         }
-        file_ref {Fl_x.cxx} {
+        file_ref {x11.cxx} {
           uuid_Xcode4_BuildFile {4FEC890B-E99A-4CC0-B4FA-8A61FFB4C5AD}
           uuid_Xcode4_FileRef {F285310A-3E4D-4595-B259-6AD6965104C8}
           uuid_Xcode4_BuildFileInSources {D9007598-62D1-4DEA-BB6B-B7B00EF91A73}
-          filename_and_path {src/core/Fl_x.cxx}
+          filename_and_path {src/fltk3/x11.cxx}
         }
         file_ref {filename_absolute.cxx} {
           uuid_Xcode4_BuildFile {9C057CB7-470D-474A-8A65-F3EB5D64C178}
           uuid_Xcode4_FileRef {04A6409B-1DA2-4F77-8692-2F0417606460}
           uuid_Xcode4_BuildFileInSources {AABCD211-5E58-4F6F-8407-F05C5B24F9F8}
-          filename_and_path {src/core/filename_absolute.cxx}
+          filename_and_path {src/fltk3/filename_absolute.cxx}
         }
         file_ref {filename_expand.cxx} {
           uuid_Xcode4_BuildFile {53B53EC9-FB0E-4CA1-908C-AD77EC9602D1}
           uuid_Xcode4_FileRef {F9F779F2-6B64-4A82-B453-84BD4A837595}
           uuid_Xcode4_BuildFileInSources {B1C7F800-5F13-4AF7-8785-DF351ED0339C}
-          filename_and_path {src/core/filename_expand.cxx}
+          filename_and_path {src/fltk3/filename_expand.cxx}
         }
         file_ref {filename_ext.cxx} {
           uuid_Xcode4_BuildFile {D613722A-19E9-4250-953B-907DFE7B14FC}
           uuid_Xcode4_FileRef {210616B2-483B-418C-9D2D-89C418A5CD3B}
           uuid_Xcode4_BuildFileInSources {80D7B46E-ED1F-468B-8C5B-E65A968CCDF8}
-          filename_and_path {src/core/filename_ext.cxx}
+          filename_and_path {src/fltk3/filename_ext.cxx}
         }
         file_ref {filename_isdir.cxx} {
           uuid_Xcode4_BuildFile {6C9314CD-21BC-40F7-8415-73B0E190D503}
           uuid_Xcode4_FileRef {C07EC3AE-3C83-4B3E-9966-35A28058E2CA}
           uuid_Xcode4_BuildFileInSources {3211F94B-69C8-49ED-B0E1-2B661D48CC63}
-          filename_and_path {src/core/filename_isdir.cxx}
+          filename_and_path {src/fltk3/filename_isdir.cxx}
         }
         file_ref {filename_list.cxx} {
           uuid_Xcode4_BuildFile {F2152084-2546-45BA-8321-EB4ADC4D82C9}
           uuid_Xcode4_FileRef {F08599CC-AC58-4DC3-9A01-8C41395AB3D0}
           uuid_Xcode4_BuildFileInSources {8C352F42-1C2F-4C09-B088-AEE742F1FA19}
-          filename_and_path {src/core/filename_list.cxx}
+          filename_and_path {src/fltk3/filename_list.cxx}
         }
         file_ref {filename_match.cxx} {
           uuid_Xcode4_BuildFile {D2F1A161-BF18-4766-B901-D2BF0C467D27}
           uuid_Xcode4_FileRef {AB171A4B-B928-4010-BDE1-1F82E10FD0AD}
           uuid_Xcode4_BuildFileInSources {BF87576C-B066-4869-859A-D0477380B991}
-          filename_and_path {src/core/filename_match.cxx}
+          filename_and_path {src/fltk3/filename_match.cxx}
         }
         file_ref {filename_setext.cxx} {
           uuid_Xcode4_BuildFile {B68A8072-65B1-4E62-8618-393D6277AB38}
           uuid_Xcode4_FileRef {003AA96B-483E-4BCF-BB09-CF9C7585B088}
           uuid_Xcode4_BuildFileInSources {53ADEE51-9229-4C76-A145-4FAE4A79CA21}
-          filename_and_path {src/core/filename_setext.cxx}
+          filename_and_path {src/fltk3/filename_setext.cxx}
         }
-        file_ref {fl_arc.cxx} {
+        file_ref {arc.cxx} {
           uuid_Xcode4_BuildFile {F2D72D4B-3CD3-424B-BCBE-E6ED0B1ADE19}
           uuid_Xcode4_FileRef {876B6A63-7D11-413F-926D-F400FC3119DD}
           uuid_Xcode4_BuildFileInSources {CF3BDDBE-929B-42C9-B756-D8C9B4C8A1D2}
-          filename_and_path {src/core/fl_arc.cxx}
+          filename_and_path {src/fltk3/arc.cxx}
         }
-        file_ref {fl_arci.cxx} {
+        file_ref {arci.cxx} {
           uuid_Xcode4_BuildFile {201C7772-F8EA-46A9-8675-1DC75946FF84}
           uuid_Xcode4_FileRef {E52CB16D-9900-4D70-ACBA-7698063934AA}
           uuid_Xcode4_BuildFileInSources {3C758F19-115F-4754-92FA-29F331A7A741}
-          filename_and_path {src/core/fl_arci.cxx}
+          filename_and_path {src/fltk3/arci.cxx}
         }
-        file_ref {fl_ask.cxx} {
+        file_ref {ask.cxx} {
           uuid_Xcode4_BuildFile {7888A1B7-3CC5-44AD-B3AB-20E7A8B7289F}
           uuid_Xcode4_FileRef {60E7DD73-D034-4D69-BA46-619166E2E30F}
           uuid_Xcode4_BuildFileInSources {F10B0DD6-7998-48AA-AE32-78A6D8879B1C}
-          filename_and_path {src/core/fl_ask.cxx}
+          filename_and_path {src/fltk3/ask.cxx}
         }
-        file_ref {fl_boxtype.cxx} {
+        file_ref {boxtype.cxx} {
           uuid_Xcode4_BuildFile {FFD22E0B-E0EC-485B-8838-5DF7DC9649AC}
           uuid_Xcode4_FileRef {BC14596F-6410-40F3-96F5-930B8CE39DAF}
           uuid_Xcode4_BuildFileInSources {7CD1A504-D74F-4F06-AAA0-B99DFB39DF46}
-          filename_and_path {src/core/fl_boxtype.cxx}
+          filename_and_path {src/fltk3/boxtype.cxx}
         }
-        file_ref {fl_call_main.cxx} {
+        file_ref {call_main.cxx} {
           uuid_Xcode4_BuildFile {E0BFCC98-3264-4E4F-A465-DAD81F5A9450}
           uuid_Xcode4_FileRef {8B35EF2F-2920-4F0F-A82D-D8472B46BDD7}
           uuid_Xcode4_BuildFileInSources {36978A2B-1507-4071-9AD5-7F9BDA3F8D90}
-          filename_and_path {src/core/fl_call_main.cxx}
+          filename_and_path {src/fltk3/call_main.cxx}
         }
-        file_ref {fl_color.cxx} {
+        file_ref {color.cxx} {
           uuid_Xcode4_BuildFile {27FB3CD2-EF50-4CE1-A940-76EE40C14C3D}
           uuid_Xcode4_FileRef {02716487-AA34-406A-9C95-983284DE5A34}
           uuid_Xcode4_BuildFileInSources {E5A3C248-605C-4BC2-BA7A-9BF5550D91DA}
-          filename_and_path {src/core/fl_color.cxx}
+          filename_and_path {src/fltk3/color.cxx}
         }
-        file_ref {fl_cursor.cxx} {
+        file_ref {cursor.cxx} {
           uuid_Xcode4_BuildFile {191125BA-A890-4754-AB59-D8FB26F9328A}
           uuid_Xcode4_FileRef {C832D220-A5C0-4938-8129-C2CB8FBAFED8}
           uuid_Xcode4_BuildFileInSources {79967B56-B64B-423D-B3EA-8097A7A830CF}
-          filename_and_path {src/core/fl_cursor.cxx}
+          filename_and_path {src/fltk3/cursor.cxx}
         }
-        file_ref {fl_curve.cxx} {
+        file_ref {curve.cxx} {
           uuid_Xcode4_BuildFile {56EADAE0-20B2-430D-B01C-FA223EA97E3A}
           uuid_Xcode4_FileRef {53EC964E-94FC-461A-A2EF-7CA3BF80B206}
           uuid_Xcode4_BuildFileInSources {B2341118-0C6D-4D9E-876D-4B5EC32E75A1}
-          filename_and_path {src/core/fl_curve.cxx}
+          filename_and_path {src/fltk3/curve.cxx}
         }
-        file_ref {fl_diamond_box.cxx} {
+        file_ref {diamond_box.cxx} {
           uuid_Xcode4_BuildFile {E40B19F0-5E9F-4EC7-9899-F4528B9AA70D}
           uuid_Xcode4_FileRef {5557266E-5E95-4208-AE3A-EA3B72D5DF09}
           uuid_Xcode4_BuildFileInSources {2BF48610-D394-48FD-8CF6-4319B5C7950E}
-          filename_and_path {src/core/fl_diamond_box.cxx}
+          filename_and_path {src/fltk3/diamond_box.cxx}
         }
-        file_ref {fl_dnd.cxx} {
+        file_ref {dnd.cxx} {
           uuid_Xcode4_BuildFile {298EDA4F-8AF0-4A92-AFC1-9408CFCD5712}
           uuid_Xcode4_FileRef {D1E006BE-6D34-4468-9F0D-9085A8E51304}
           uuid_Xcode4_BuildFileInSources {207AE6E5-9923-44E6-84D3-5AEC30896F39}
-          filename_and_path {src/core/fl_dnd.cxx}
+          filename_and_path {src/fltk3/dnd.cxx}
         }
-        file_ref {fl_draw.cxx} {
+        file_ref {draw.cxx} {
           uuid_Xcode4_BuildFile {4F438445-50DE-4B76-BBFF-BC46EBBFA664}
           uuid_Xcode4_FileRef {3CF0F8B5-7C8D-4462-B572-4A122D6549B0}
           uuid_Xcode4_BuildFileInSources {363F858B-A81F-4AFF-A530-A54242350184}
-          filename_and_path {src/core/fl_draw.cxx}
+          filename_and_path {src/fltk3/draw.cxx}
         }
-        file_ref {fl_draw_image.cxx} {
+        file_ref {draw_image.cxx} {
           uuid_Xcode4_BuildFile {4665DB5F-068D-4310-B2C0-AE689AA85929}
           uuid_Xcode4_FileRef {F608DA64-EF05-49A3-ABAC-C7C9E7494BEA}
           uuid_Xcode4_BuildFileInSources {F546A37A-4D5E-4409-9163-28738A3E4227}
-          filename_and_path {src/core/fl_draw_image.cxx}
+          filename_and_path {src/fltk3/draw_image.cxx}
         }
-        file_ref {fl_draw_pixmap.cxx} {
+        file_ref {draw_pixmap.cxx} {
           uuid_Xcode4_BuildFile {E4923B73-9025-450C-BB43-97FC0850A83A}
           uuid_Xcode4_FileRef {B6E2BA6C-59E0-4F18-AD7D-164F016C0FF0}
           uuid_Xcode4_BuildFileInSources {30E10499-75E4-4180-8EB1-884A87A5DD43}
-          filename_and_path {src/core/fl_draw_pixmap.cxx}
+          filename_and_path {src/fltk3/draw_pixmap.cxx}
         }
-        file_ref {fl_encoding_latin1.cxx} {
+        file_ref {encoding_latin1.cxx} {
           uuid_Xcode4_BuildFile {B00A9E35-5560-4825-904B-EF57CD4C0A92}
           uuid_Xcode4_FileRef {0BEBF5A7-7773-43BE-91CC-B0DFBB6BDA08}
           uuid_Xcode4_BuildFileInSources {DE48D544-6329-4439-8CA5-E1D3FDA1F6E0}
-          filename_and_path {src/core/fl_encoding_latin1.cxx}
+          filename_and_path {src/fltk3/encoding_latin1.cxx}
         }
-        file_ref {fl_encoding_mac_roman.cxx} {
+        file_ref {encoding_mac_roman.cxx} {
           uuid_Xcode4_BuildFile {8555518A-BE8E-4BFA-B667-6551E92013A8}
           uuid_Xcode4_FileRef {C2BF9CDF-E31E-4895-A45D-5AAF3768C51B}
           uuid_Xcode4_BuildFileInSources {ABB49E92-5D1D-47B4-8863-06E5EBD8142A}
-          filename_and_path {src/core/fl_encoding_mac_roman.cxx}
+          filename_and_path {src/fltk3/encoding_mac_roman.cxx}
         }
-        file_ref {fl_engraved_label.cxx} {
+        file_ref {engraved_label.cxx} {
           uuid_Xcode4_BuildFile {52DA813A-9A95-4890-A38D-19B026277F95}
           uuid_Xcode4_FileRef {0522E1C2-0E5A-4C29-A956-E8CD45EF1B4D}
           uuid_Xcode4_BuildFileInSources {15FDFD86-96C6-4012-A0D0-F022C221FBAC}
-          filename_and_path {src/core/fl_engraved_label.cxx}
+          filename_and_path {src/fltk3/engraved_label.cxx}
         }
-        file_ref {fl_file_dir.cxx} {
+        file_ref {file_dir.cxx} {
           uuid_Xcode4_BuildFile {8F52E66B-DE06-408C-9FA4-1444637F7B80}
           uuid_Xcode4_FileRef {1BF9BBF4-D53A-424A-8C0A-D3B0D92797FF}
           uuid_Xcode4_BuildFileInSources {EB81F388-5E43-4527-9396-969A7D312740}
-          filename_and_path {src/core/fl_file_dir.cxx}
+          filename_and_path {src/fltk3/file_dir.cxx}
         }
-        file_ref {fl_font.cxx} {
+        file_ref {font.cxx} {
           uuid_Xcode4_BuildFile {DAECD573-97D2-4295-8321-13B8F8BC23A6}
           uuid_Xcode4_FileRef {1CFFB72A-F54F-4002-AE50-C1BCF9F0C89C}
           uuid_Xcode4_BuildFileInSources {C9F44B46-D3FF-4EA3-9D30-1E9AB89600F8}
-          filename_and_path {src/core/fl_font.cxx}
+          filename_and_path {src/fltk3/font.cxx}
         }
-        file_ref {fl_gtk.cxx} {
+        file_ref {gtk.cxx} {
           uuid_Xcode4_BuildFile {1FB7855F-AB31-4B42-AA73-93B07D746272}
           uuid_Xcode4_FileRef {E3303C9A-F31B-4B23-8AC3-863A5C000D0C}
           uuid_Xcode4_BuildFileInSources {EFCDA004-6B05-439D-AD1D-A8747F6CF4B9}
-          filename_and_path {src/core/fl_gtk.cxx}
+          filename_and_path {src/fltk3/gtk.cxx}
         }
-        file_ref {fl_labeltype.cxx} {
+        file_ref {labeltype.cxx} {
           uuid_Xcode4_BuildFile {A91665C1-0010-43EE-8A86-9EC869983557}
           uuid_Xcode4_FileRef {95F43A2D-21DE-4899-9F5B-1DB341E90C3A}
           uuid_Xcode4_BuildFileInSources {4598BB77-92AB-4548-B34E-78B261C56140}
-          filename_and_path {src/core/fl_labeltype.cxx}
+          filename_and_path {src/fltk3/labeltype.cxx}
         }
-        file_ref {fl_line_style.cxx} {
+        file_ref {line_style.cxx} {
           uuid_Xcode4_BuildFile {70D1EF40-CEE3-4460-9437-445EF6570006}
           uuid_Xcode4_FileRef {5FD374C4-6C63-497E-9F2B-1B396390EEE5}
           uuid_Xcode4_BuildFileInSources {A59E78B8-0AD1-490B-ABBF-87C212D49294}
-          filename_and_path {src/core/fl_line_style.cxx}
+          filename_and_path {src/fltk3/line_style.cxx}
         }
-        file_ref {fl_open_uri.cxx} {
+        file_ref {open_uri.cxx} {
           uuid_Xcode4_BuildFile {AE238B51-38F4-4F2E-BC0B-78F3746B987F}
           uuid_Xcode4_FileRef {5515C9CC-3DEB-4ED1-8B65-42966A9B7E06}
           uuid_Xcode4_BuildFileInSources {BE74DB33-04BD-4EEC-A847-755EB62B76EB}
-          filename_and_path {src/core/fl_open_uri.cxx}
+          filename_and_path {src/fltk3/open_uri.cxx}
         }
-        file_ref {fl_oval_box.cxx} {
+        file_ref {oval_box.cxx} {
           uuid_Xcode4_BuildFile {5C5315ED-224F-4077-A54A-D916A09FD43D}
           uuid_Xcode4_FileRef {554EB894-1B49-46DC-9B44-004AF565327A}
           uuid_Xcode4_BuildFileInSources {61BF99BB-9B5E-4A8F-B47A-362BE0170B8A}
-          filename_and_path {src/core/fl_oval_box.cxx}
+          filename_and_path {src/fltk3/oval_box.cxx}
         }
-        file_ref {fl_overlay.cxx} {
+        file_ref {overlay.cxx} {
           uuid_Xcode4_BuildFile {13DECC0A-91E0-4B09-9A65-7565C4E4DE00}
           uuid_Xcode4_FileRef {5536CF51-0B6B-499F-9C91-C2E4898D00BA}
           uuid_Xcode4_BuildFileInSources {C4F171DD-B2C3-45AB-B493-13C66A684B76}
-          filename_and_path {src/core/fl_overlay.cxx}
+          filename_and_path {src/fltk3/overlay.cxx}
         }
-        file_ref {fl_overlay_visual.cxx} {
+        file_ref {overlay_visual.cxx} {
           uuid_Xcode4_BuildFile {B447BDF4-E847-4FC6-A720-0CDF4002BA4E}
           uuid_Xcode4_FileRef {3132F016-7D43-43BE-B074-445C9F20DB50}
           uuid_Xcode4_BuildFileInSources {305944C7-0273-41CA-B68D-4B8634805326}
-          filename_and_path {src/core/fl_overlay_visual.cxx}
+          filename_and_path {src/fltk3/overlay_visual.cxx}
         }
-        file_ref {fl_plastic.cxx} {
+        file_ref {plastic.cxx} {
           uuid_Xcode4_BuildFile {E84D52FD-DECE-4423-8099-1101A9B16E65}
           uuid_Xcode4_FileRef {D9934C34-B4C6-45E9-9D8D-302562D201D1}
           uuid_Xcode4_BuildFileInSources {40F29FD8-75BE-4958-9975-880694258FAB}
-          filename_and_path {src/core/fl_plastic.cxx}
+          filename_and_path {src/fltk3/plastic.cxx}
         }
-        file_ref {fl_read_image.cxx} {
+        file_ref {read_image.cxx} {
           uuid_Xcode4_BuildFile {89292870-50B2-4B4C-9C47-BDD54D8F9A95}
           uuid_Xcode4_FileRef {1FA85C80-2951-4144-A92D-E37E598C9B19}
           uuid_Xcode4_BuildFileInSources {C91AB9AC-9EA0-4F8B-982E-2C9D52A00338}
-          filename_and_path {src/core/fl_read_image.cxx}
+          filename_and_path {src/fltk3/read_image.cxx}
         }
-        file_ref {fl_rect.cxx} {
+        file_ref {rect.cxx} {
           uuid_Xcode4_BuildFile {7DFE2DA4-C5ED-4447-8F6A-3F7D514DEDA3}
           uuid_Xcode4_FileRef {82F1E1FC-8B3C-460B-A309-ABE348A6FD1B}
           uuid_Xcode4_BuildFileInSources {39238B46-6210-41AC-B7DC-4153DA9EE223}
-          filename_and_path {src/core/fl_rect.cxx}
+          filename_and_path {src/fltk3/rect.cxx}
         }
-        file_ref {fl_round_box.cxx} {
+        file_ref {round_box.cxx} {
           uuid_Xcode4_BuildFile {54AED6D6-19AA-4960-A913-C1DDE3A04981}
           uuid_Xcode4_FileRef {C791DFA1-9A90-4016-B393-FF1205CA92D3}
           uuid_Xcode4_BuildFileInSources {FE83B31E-A46A-4A32-A89D-E1A6D243B8C2}
-          filename_and_path {src/core/fl_round_box.cxx}
+          filename_and_path {src/fltk3/round_box.cxx}
         }
-        file_ref {fl_rounded_box.cxx} {
+        file_ref {rounded_box.cxx} {
           uuid_Xcode4_BuildFile {07653622-17B7-423E-8440-FA89462F116C}
           uuid_Xcode4_FileRef {557E8041-0084-4B1C-9D36-CF44F1C0F5BE}
           uuid_Xcode4_BuildFileInSources {AD0B8E3D-D68A-481D-8F9F-69BAC55B967F}
-          filename_and_path {src/core/fl_rounded_box.cxx}
+          filename_and_path {src/fltk3/rounded_box.cxx}
         }
-        file_ref {fl_scroll_area.cxx} {
+        file_ref {scroll_area.cxx} {
           uuid_Xcode4_BuildFile {62206CE3-C4B8-41A3-B0B2-E87558EF8359}
           uuid_Xcode4_FileRef {0E08EA1C-BD91-44D4-A0EA-0D4243805A2C}
           uuid_Xcode4_BuildFileInSources {FCAEAB49-901B-4E09-A421-B91C2138610D}
-          filename_and_path {src/core/fl_scroll_area.cxx}
+          filename_and_path {src/fltk3/scroll_area.cxx}
         }
-        file_ref {fl_set_font.cxx} {
+        file_ref {set_font.cxx} {
           uuid_Xcode4_BuildFile {A21C7DBB-77B4-4145-94D3-C8F4E0F7A704}
           uuid_Xcode4_FileRef {C7ED2C14-A368-4077-A484-B5C6DDCAC057}
           uuid_Xcode4_BuildFileInSources {2952645A-BFB2-4D1A-AA4B-9C938ADA48F9}
-          filename_and_path {src/core/fl_set_font.cxx}
+          filename_and_path {src/fltk3/set_font.cxx}
         }
-        file_ref {fl_set_fonts.cxx} {
+        file_ref {set_fonts.cxx} {
           uuid_Xcode4_BuildFile {2D99B7D6-2146-4F22-B7C4-7CF6B353B3B6}
           uuid_Xcode4_FileRef {22603052-0721-416C-9BC9-9117FA96A7E6}
           uuid_Xcode4_BuildFileInSources {83BEAD36-5B66-40D1-BDE6-01CAD030A36B}
-          filename_and_path {src/core/fl_set_fonts.cxx}
+          filename_and_path {src/fltk3/set_fonts.cxx}
         }
-        file_ref {fl_shadow_box.cxx} {
+        file_ref {shadow_box.cxx} {
           uuid_Xcode4_BuildFile {5F09A8BB-4F72-4A29-9D89-1B3686738A5F}
           uuid_Xcode4_FileRef {2C5EEC89-51E9-41FB-8530-FBF66EEA73B1}
           uuid_Xcode4_BuildFileInSources {03E51C61-09BD-4D5D-8C34-E11561CDE5EB}
-          filename_and_path {src/core/fl_shadow_box.cxx}
+          filename_and_path {src/fltk3/shadow_box.cxx}
         }
-        file_ref {fl_shortcut.cxx} {
+        file_ref {shortcut.cxx} {
           uuid_Xcode4_BuildFile {6DC429A2-4E0F-46F0-9928-C972C13F3A79}
           uuid_Xcode4_FileRef {BFCE21B1-56B8-4D68-B7AE-BFB8E2D65029}
           uuid_Xcode4_BuildFileInSources {1915B2B4-3576-473D-8C68-044EC53616C9}
-          filename_and_path {src/core/fl_shortcut.cxx}
+          filename_and_path {src/fltk3/shortcut.cxx}
         }
-        file_ref {fl_show_colormap.cxx} {
+        file_ref {show_colormap.cxx} {
           uuid_Xcode4_BuildFile {09571C9D-E0F2-44E1-B3BB-BEA58AF6DB6E}
           uuid_Xcode4_FileRef {76D6638A-FCA0-47DD-97AC-02F20B149360}
           uuid_Xcode4_BuildFileInSources {CA982582-BAB9-4F43-AE95-97787D7118DA}
-          filename_and_path {src/core/fl_show_colormap.cxx}
+          filename_and_path {src/fltk3/show_colormap.cxx}
         }
-        file_ref {fl_symbols.cxx} {
+        file_ref {symbols.cxx} {
           uuid_Xcode4_BuildFile {E5E13729-9359-407A-ADAE-8CA9BF1153A4}
           uuid_Xcode4_FileRef {ECAFDF98-A4C6-47A4-AAC5-CBBAA9E2B887}
           uuid_Xcode4_BuildFileInSources {3F497BC1-2E55-4693-A590-93B1AB680203}
-          filename_and_path {src/core/fl_symbols.cxx}
+          filename_and_path {src/fltk3/symbols.cxx}
         }
-        file_ref {fl_utf8.cxx} {
+        file_ref {utf8.cxx} {
           uuid_Xcode4_BuildFile {1D28C444-CF47-48A3-B7BD-AC7FC031BF60}
           uuid_Xcode4_FileRef {C82D09C9-A25C-4969-AA75-C1844388A904}
           uuid_Xcode4_BuildFileInSources {E05DB01E-3C7C-4D10-B25A-24C5B0A9984E}
-          filename_and_path {src/core/fl_utf8.cxx}
+          filename_and_path {src/fltk3/utf8.cxx}
         }
-        file_ref {fl_utf.cxx} {
+        file_ref {utf.cxx} {
           uuid_Xcode4_BuildFile {AB04400B-9F1A-4F37-888C-89372FDCF7F7}
           uuid_Xcode4_FileRef {574878A1-4FD8-42FA-9BD2-ABE5009BD0DE}
           uuid_Xcode4_BuildFileInSources {DBA6ED75-939E-4F8A-B1F2-9A110D95B619}
-          filename_and_path {src/core/fl_utf.cxx}
+          filename_and_path {src/fltk3/utf.cxx}
         }
-        file_ref {fl_vertex.cxx} {
+        file_ref {vertex.cxx} {
           uuid_Xcode4_BuildFile {62CA9151-24C4-427F-8D7C-E667CB1A6005}
           uuid_Xcode4_FileRef {6C74D84D-D2D9-473C-B4EF-A2916D41A606}
           uuid_Xcode4_BuildFileInSources {0DA67340-5E06-45F0-98AB-1EF4FFEF7D18}
-          filename_and_path {src/core/fl_vertex.cxx}
+          filename_and_path {src/fltk3/vertex.cxx}
         }
         file_ref {numericsort.cxx} {
           uuid_Xcode4_BuildFile {BDD37F5E-669D-45D0-AEA7-84934BD116C6}
           uuid_Xcode4_FileRef {2286DB22-6117-4F0A-BEE5-E39D655B21BB}
           uuid_Xcode4_BuildFileInSources {F9A99DC4-A8F3-48B7-B098-CACFF2242B0F}
-          filename_and_path {src/core/numericsort.cxx}
+          filename_and_path {src/fltk3/numericsort.cxx}
         }
         file_ref {ps_image.cxx} {
           uuid_Xcode4_BuildFile {3FCA9BA2-08F4-4493-AAC5-1C5BA6C19BF9}
           uuid_Xcode4_FileRef {472AB397-43B4-4F36-8D30-46796562F422}
           uuid_Xcode4_BuildFileInSources {7B5F222A-9CA7-4A2B-BB10-915A4853951A}
-          filename_and_path {src/core/ps_image.cxx}
+          filename_and_path {src/fltk3/ps_image.cxx}
         }
         file_ref {scandir.cxx} {
           uuid_Xcode4_BuildFile {91F32552-6EBD-41A3-A404-C13499D47D1B}
           uuid_Xcode4_FileRef {1E2B1DAE-2CA8-4E24-9D70-7648A5F0E604}
           uuid_Xcode4_BuildFileInSources {611144BE-9E25-4734-BEB0-17AA14E629C2}
-          filename_and_path {src/core/scandir.cxx}
+          filename_and_path {src/fltk3/scandir.cxx}
         }
         file_ref {screen_xywh.cxx} {
           uuid_Xcode4_BuildFile {898DCC19-92C6-4CAD-8F97-795C17BF0F8E}
           uuid_Xcode4_FileRef {4302C79C-040D-4155-9A83-7B77750879E4}
           uuid_Xcode4_BuildFileInSources {ED67E26F-DB1F-48D1-A1D9-9717C2196D3A}
-          filename_and_path {src/core/screen_xywh.cxx}
+          filename_and_path {src/fltk3/screen_xywh.cxx}
         }
         file_ref {flstring.c} {
           uuid_Xcode4_BuildFile {1B622B06-3765-4E90-BE13-155DFCBAB791}
           uuid_Xcode4_FileRef {EF672C7C-6AF9-43D0-8320-CBAED55C8145}
           uuid_Xcode4_BuildFileInSources {F4C279B7-3932-4279-8131-B75DFA0C11E5}
-          filename_and_path {src/core/flstring.c}
+          filename_and_path {src/fltk3/flstring.c}
         }
         file_ref {vsnprintf.c} {
           uuid_Xcode4_BuildFile {22C4313D-D9D6-41BD-BA8B-E3CE07600FE1}
           uuid_Xcode4_FileRef {4024031C-0F34-4A2D-A3F2-9D9373805457}
           uuid_Xcode4_BuildFileInSources {2A8804F6-AFE8-4FED-BF50-8CAEF1B22A54}
-          filename_and_path {src/core/vsnprintf.c}
+          filename_and_path {src/fltk3/vsnprintf.c}
         }
         file_ref {case.c} {
           uuid_Xcode4_BuildFile {F9589A9E-897C-4D01-9853-40C736FE4C03}
           uuid_Xcode4_FileRef {6A8D0240-7AD5-4648-B663-8D1B5B0D8F30}
           uuid_Xcode4_BuildFileInSources {C8A52709-D6A3-46B6-8BC2-631AC161BB93}
-          filename_and_path {src/core/xutf8/case.c}
+          filename_and_path {src/fltk3/xutf8/case.c}
         }
         file_ref {is_right2left.c} {
           uuid_Xcode4_BuildFile {5D197D19-28FF-4FA8-B83B-F0796D18D7C7}
           uuid_Xcode4_FileRef {15064F3F-0F6F-4A59-8531-9E361125C187}
           uuid_Xcode4_BuildFileInSources {8DB42169-E703-4087-8E7D-743F1AAADA6D}
-          filename_and_path {src/core/xutf8/is_right2left.c}
+          filename_and_path {src/fltk3/xutf8/is_right2left.c}
         }
         file_ref {is_spacing.c} {
           uuid_Xcode4_BuildFile {33D01DE7-EC28-45C9-AC26-AB81F6F7E056}
           uuid_Xcode4_FileRef {35196210-B2C0-48F9-88B8-7DB816C06ED2}
           uuid_Xcode4_BuildFileInSources {2FAB16B4-529A-454C-8FDD-480347534445}
-          filename_and_path {src/core/xutf8/is_spacing.c}
+          filename_and_path {src/fltk3/xutf8/is_spacing.c}
         }
         file_ref {keysym2Ucs.c} {
           uuid_Xcode4_BuildFileInSources {5947D812-BC7F-4400-9267-2ED8879F5C8C}
           uuid_Xcode4_FileRef {6FB3D799-D5E6-4B46-B0D8-241B52F0EF44}
           build_env 3
           list_env 0
-          filename_and_path {src/core/xutf8/keysym2Ucs.c}
+          filename_and_path {src/fltk3/xutf8/keysym2Ucs.c}
         }
         file_ref {utf8Input.c} {
           uuid_Xcode4_BuildFileInSources {25B5DE2D-97EE-4E32-9CA8-05174FB0DB2F}
           uuid_Xcode4_FileRef {77C2578B-D9D9-4526-BB2D-01C1C3C80034}
           build_env 3
           list_env 0
-          filename_and_path {src/core/xutf8/utf8Input.c}
+          filename_and_path {src/fltk3/xutf8/utf8Input.c}
         }
         file_ref {utf8Utils.c} {
           uuid_Xcode4_BuildFileInSources {24005306-9985-4AC5-BE6D-6D7500E3217E}
           uuid_Xcode4_FileRef {737A139C-1672-4BB4-8105-7BBD5750BA73}
           build_env 3
           list_env 0
-          filename_and_path {src/core/xutf8/utf8Utils.c}
+          filename_and_path {src/fltk3/xutf8/utf8Utils.c}
         }
         file_ref {utf8Wrap.c} {
           uuid_Xcode4_BuildFileInSources {C7B16874-D0F9-451B-82FE-5CDE5ED6E374}
           uuid_Xcode4_FileRef {46AA9D55-FF6A-42F9-9D65-167B6C61CD4A}
           build_env 3
           list_env 0
-          filename_and_path {src/core/xutf8/utf8Wrap.c}
+          filename_and_path {src/fltk3/xutf8/utf8Wrap.c}
         }
       }
-      folder Libraries {open
+      folder Libraries {
         uuid_Xcode4_Group {5495DB62-2621-4D95-824E-7D7E0FD9E613}
       } {
         file_ref {Cocoa.framework} {
@@ -2497,7 +2465,7 @@
           filename_and_path {include/fltk3gl/GLWindow.h}
         }
       }
-      folder Sources {open
+      folder Sources {
         uuid_Xcode4_Group {AF239AB5-D7A8-4916-B8FD-AB46E12676A0}
       } {
         file_ref {GLChoice.cxx} {
@@ -2561,7 +2529,7 @@
           filename_and_path {src/fltk3gl/glut_font.cxx}
         }
       }
-      folder Libraries {open
+      folder Libraries {
         uuid_Xcode4_Group {7FA05EA9-A69A-4DF5-856E-FB09F85F9A93}
       } {
         file_ref {AGL.framework} {
@@ -2601,7 +2569,7 @@
           location 3
         }
       }
-      folder Dependencies {open
+      folder Dependencies {
         uuid_Xcode4_Group {5AD936C1-6A47-4960-8FF6-30D89A6A3DA1}
       } {
         target_dependency fltk3 {
@@ -2613,7 +2581,7 @@
         }
       }
     }
-    lib_target fltk3images {
+    lib_target fltk3images {open
       uuid_Xcode4_FluidBuildRule {3B6D1711-B7F7-4646-9550-CCC0D38666DB}
       uuid_Xcode4_ProductFileReference {BF7522F0-DF30-4FBE-B61F-D44FB67C2110}
       uuid_Xcode4_FrameworksBuildPhase {E922EF9B-6694-4CD8-9E64-646407893DE6}
@@ -2630,51 +2598,119 @@
       target_path lib
       makefile_path src
     } {
+      folder Headers {open
+        uuid_Xcode4_Group {572634D5-961B-429A-BD3D-A5E0B8ADA06D}
+      } {
+        file_ref {all.h} {
+          uuid_Xcode4_BuildFile {2CE8F302-A99F-4C82-94FF-FF9EFAFC8698}
+          uuid_Xcode4_FileRef {1010B13D-EDA7-4521-A769-8067E16E3514}
+          uuid_Xcode4_BuildFileInHeaders {8EFCC7E9-3D05-4924-824D-5C994B2C58AC}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/all.h}
+        }
+        file_ref {fltk3images.h} {
+          uuid_Xcode4_BuildFile {8BB652FC-9526-474B-84AB-AB5807963823}
+          uuid_Xcode4_FileRef {2C2435D9-9D93-417A-A741-7667983C81F3}
+          uuid_Xcode4_BuildFileInHeaders {F0C926FC-BB9C-4326-8184-DDBCAB2B38A6}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/fltk3images.h}
+        }
+        file_ref {BMPImage.h} {
+          uuid_Xcode4_BuildFile {B02F1ACA-8C63-4C41-A0FA-429D42B66E10}
+          uuid_Xcode4_FileRef {5B9A35BB-8AE6-4627-BE89-BB6BF86DBDA1}
+          uuid_Xcode4_BuildFileInHeaders {26C1F556-804D-49CA-B330-7472D37CCAA4}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/BMPImage.h}
+        }
+        file_ref {GIFImage.h} {
+          uuid_Xcode4_BuildFile {E1645FE3-A511-42A3-873D-131C575CF91A}
+          uuid_Xcode4_FileRef {605121E0-DA10-4363-AD06-B3FF977E11C8}
+          uuid_Xcode4_BuildFileInHeaders {8845649A-5BB6-4BA3-879C-1952D0C93211}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/GIFImage.h}
+        }
+        file_ref {HelpDialog.h} {
+          uuid_Xcode4_BuildFile {039E6910-80A1-4672-8705-02AC45E81900}
+          uuid_Xcode4_FileRef {0925F193-41B3-477E-B5AD-81F5397661F3}
+          uuid_Xcode4_BuildFileInHeaders {F7A66B0A-98D9-44E3-B704-829151BB84FB}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/HelpDialog.h}
+        }
+        file_ref {JPEGImage.h} {
+          uuid_Xcode4_BuildFile {E924726D-D8F9-42F3-99B6-0B33A6E07929}
+          uuid_Xcode4_FileRef {60A217E0-989A-441E-96AA-E8B7D7B44D49}
+          uuid_Xcode4_BuildFileInHeaders {30029E6A-2C65-48E5-8722-0B7CFEBA9CF8}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/JPEGImage.h}
+        }
+        file_ref {PNGImage.h} {
+          uuid_Xcode4_BuildFile {5D9E7161-6EC7-4233-AA60-D021CB0DFC59}
+          uuid_Xcode4_FileRef {25BEA285-CF71-4ED0-B043-193DEA1014E2}
+          uuid_Xcode4_BuildFileInHeaders {E3127242-7B17-4B32-9FCC-1F2101B769A4}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/PNGImage.h}
+        }
+        file_ref {PNMImage.h} {
+          uuid_Xcode4_BuildFile {4C35DB58-66D6-4FE6-8D74-0F09B1B8EC70}
+          uuid_Xcode4_FileRef {EC95850E-4FC1-4DEB-A8EB-551759E4EBC2}
+          uuid_Xcode4_BuildFileInHeaders {CBE8880E-97E1-45DC-8CC0-78ED5298EAAE}
+          build_env 96
+          list_env 124
+          filename_and_path {include/fltk3images/PNMImage.h}
+        }
+      }
       folder Sources {
         uuid_Xcode4_Group {E2718243-909A-4978-97ED-407EA35C2EB3}
       } {
-        file_ref {Fl_BMP_Image.cxx} {
+        file_ref {BMPImage.cxx} {
           uuid_Xcode4_BuildFileInSources {E6582F0C-0750-4240-82F3-E8318102A2E1}
           uuid_Xcode4_FileRef {BEBF4248-3EAD-4A52-AAA4-E820B7383470}
-          filename_and_path {src/core/Fl_BMP_Image.cxx}
+          filename_and_path {src/fltk3images/BMPImage.cxx}
         }
-        file_ref {Fl_File_Icon2.cxx} {
+        file_ref {FileIcon2.cxx} {
           uuid_Xcode4_BuildFileInSources {4527A184-6B41-4768-86C4-ACF47AB984FD}
           uuid_Xcode4_FileRef {7655FB1C-DE8D-4283-BC6F-56486E0C6765}
-          filename_and_path {src/core/Fl_File_Icon2.cxx}
+          filename_and_path {src/fltk3images/FileIcon2.cxx}
         }
-        file_ref {Fl_GIF_Image.cxx} {
+        file_ref {GIFImage.cxx} {
           uuid_Xcode4_BuildFileInSources {61475B35-29FB-4C24-8830-ECA24AD4D896}
           uuid_Xcode4_FileRef {CFAC1FAE-3A10-47AA-AFCF-D8465E2BC5E9}
-          filename_and_path {src/core/Fl_GIF_Image.cxx}
+          filename_and_path {src/fltk3images/GIFImage.cxx}
         }
-        file_ref {Fl_Help_Dialog.cxx} {
+        file_ref {HelpDialog.cxx} {
           uuid_Xcode4_BuildFileInSources {D0C37235-7804-45A7-899C-281EC063120A}
           uuid_Xcode4_FileRef {0EDA91FF-EE99-4E85-8C47-3C2A2CD72D46}
-          filename_and_path {src/core/Fl_Help_Dialog.cxx}
+          filename_and_path {src/fltk3images/HelpDialog.cxx}
         }
-        file_ref {Fl_JPEG_Image.cxx} {
+        file_ref {images_core.cxx} {
+          uuid_Xcode4_BuildFileInSources {C99E8BD8-E953-4FF3-8C5D-3186E07EE04C}
+          uuid_Xcode4_FileRef {6ADD9C72-9A09-406D-A836-86A180529588}
+          filename_and_path {src/fltk3images/images_core.cxx}
+        }
+        file_ref {JPEGImage.cxx} {
           uuid_Xcode4_BuildFileInSources {633E5465-917A-472C-A60F-0F991EB5A771}
           uuid_Xcode4_FileRef {771C095F-B545-47EB-A972-E68EACA213AB}
-          filename_and_path {src/core/Fl_JPEG_Image.cxx}
+          filename_and_path {src/fltk3images/JPEGImage.cxx}
         }
-        file_ref {Fl_PNG_Image.cxx} {
+        file_ref {PNGImage.cxx} {
           uuid_Xcode4_BuildFileInSources {6C957398-2885-42CA-94E3-6A7DE9ADFFDD}
           uuid_Xcode4_FileRef {E1BECD1D-5322-476A-97C7-1A355469A00E}
-          filename_and_path {src/core/Fl_PNG_Image.cxx}
+          filename_and_path {src/fltk3images/PNGImage.cxx}
         }
-        file_ref {Fl_PNM_Image.cxx} {
+        file_ref {PNMImage.cxx} {
           uuid_Xcode4_BuildFileInSources {E8B17358-E01C-468D-BA98-FD841B2BD4D5}
           uuid_Xcode4_FileRef {948DEE29-B0C3-4360-8B48-E166578DD9C0}
-          filename_and_path {src/core/Fl_PNM_Image.cxx}
+          filename_and_path {src/fltk3images/PNMImage.cxx}
         }
-        file_ref {fl_images_core.cxx} {
-          uuid_Xcode4_BuildFileInSources {C99E8BD8-E953-4FF3-8C5D-3186E07EE04C}
-          uuid_Xcode4_FileRef {6ADD9C72-9A09-406D-A836-86A180529588}
-          filename_and_path {src/core/fl_images_core.cxx}
-        }
       }
-      folder Dependencies {open
+      folder Dependencies {
         uuid_Xcode4_Group {5C231979-6ADE-4A65-9BA7-0688B9D02387}
       } {
         target_dependency fltk3 {
@@ -2700,7 +2736,7 @@
         }
       }
     }
-    lib_target fltk3png {
+    lib_target fltk3png {open
       uuid_Xcode4_FluidBuildRule {B468177C-52F4-4139-A3FF-67AB6002BC34}
       uuid_Xcode4_ProductFileReference {06A7B68E-69DF-48DF-9752-4CC40872987D}
       uuid_Xcode4_FrameworksBuildPhase {E6A799B5-B767-4119-BAAE-E6ABAED46318}
@@ -2816,7 +2852,7 @@
         }
       }
     }
-    lib_target fltk3jpeg {
+    lib_target fltk3jpeg {open
       uuid_Xcode4_FluidBuildRule {657AA958-2632-4A29-B657-91775A869EBC}
       uuid_Xcode4_ProductFileReference {C03975F6-58DD-41B5-9A0D-D73961888340}
       uuid_Xcode4_FrameworksBuildPhase {65CF0CCA-3098-403B-A9B6-70000827BCE8}
@@ -2834,7 +2870,7 @@
       target_path lib
       makefile_path src
     } {
-      folder Sources {open
+      folder Sources {
         uuid_Xcode4_Group {C49343E4-9CEB-4F51-A1BB-E511537472C9}
       } {
         file_ref {jaricom.c} {
@@ -3080,7 +3116,7 @@
         }
       }
     }
-    lib_target fltk3zlib {
+    lib_target fltk3zlib {open
       uuid_Xcode4_FluidBuildRule {123C1072-0C58-4F44-AD82-E57DC97E4F36}
       uuid_Xcode4_ProductFileReference {AFDEBB8C-A6BB-4318-814D-9D4B6586BF8B}
       uuid_Xcode4_FrameworksBuildPhase {DEBCC581-E57F-4C21-8DA4-57A0CC89BBE4}
@@ -3190,10 +3226,10 @@
       }
     }
   }
-  folder Tests {open
+  folder Tests {
     uuid_Xcode4_Group {5B388C4A-A5BB-4166-B79C-7335DA628E4D}
   } {
-    app_target Demo {open
+    app_target Demo {
       uuid_Xcode4_FluidBuildRule {2D727B96-E7A2-4AE3-9D7A-4F7F659C111E}
       uuid_Xcode4_CopyFilesBuildPhase {5CEA130D-C6C9-4262-85E4-33EDAE54E1AF}
       uuid_Xcode4_ProductFileReference {84AB5A59-0B0A-4F0C-8A1E-D4A51C07CE22}
@@ -3648,7 +3684,7 @@
         location 2
       }
     }
-    app_target adjuster {open
+    app_target adjuster {
       uuid_Xcode4_FluidBuildRule {7F4E1728-AA0B-4CE8-A872-92E1BEF787E1}
       uuid_Xcode4_CopyFilesBuildPhase {32C8A51E-56B3-4B97-80CE-687395BC6B83}
       uuid_Xcode4_ProductFileReference {A7E21FA5-F599-4F5F-B681-9AF31A556B3A}
@@ -3677,7 +3713,7 @@
         uuid_Xcode4_TargetDependency {69469051-2637-4BD1-9BD6-8C5E20160426}
       }
     }
-    app_target arc {open
+    app_target arc {
       uuid_Xcode4_FluidBuildRule {699A7A9E-A60C-4507-B347-0C3DBA393555}
       uuid_Xcode4_CopyFilesBuildPhase {79C869C0-BB2B-476D-A4F6-B8FC170EDD99}
       uuid_Xcode4_ProductFileReference {5DBEAD2F-EA63-465C-8B2D-B3CB08805827}
@@ -3706,7 +3742,7 @@
         uuid_Xcode4_TargetDependency {D6D7D6B9-C331-4AF8-B823-116BBA47DF6A}
       }
     }
-    app_target ask {open
+    app_target ask {
       uuid_Xcode4_FluidBuildRule {FBFDA712-92F6-47C9-AE68-858A73813070}
       uuid_Xcode4_CopyFilesBuildPhase {D57D8419-3DEF-4005-94DC-DDE99B2AA71B}
       uuid_Xcode4_ProductFileReference {4DC5C5FF-FB6A-4895-A9F2-CA805C76B0BF}

Modified: branches/branch-3.0/fluid/Fl_Function_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Function_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Function_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -31,7 +31,7 @@
 #include "Fl_Type.h"
 #include <fltk3/ask.h>
 #include <fltk3/FileChooser.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdio.h>
 #include <stdlib.h>
 

Modified: branches/branch-3.0/fluid/Fl_Group_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Group_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Group_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -35,7 +35,7 @@
 #include <fltk3/Table.h>
 #include <fltk3/message.h>
 #include "Fl_Widget_Type.h"
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 
 // Override group's resize behavior to do nothing to children:
 void igroup::resize(int X, int Y, int W, int H) {

Modified: branches/branch-3.0/fluid/Fl_Menu_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Menu_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Menu_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -40,7 +40,7 @@
 #include <fltk3/ValueInput.h>
 #include <fltk3/TextDisplay.h>
 #include <fltk3/Wrapper.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdio.h>
 #include <stdlib.h>
 

Modified: branches/branch-3.0/fluid/Fl_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -43,7 +43,7 @@
 #include <fltk3/draw.h>
 #include <fltk3/filename.h>
 #include <stdlib.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdio.h>
 
 #include "Fl_Type.h"

Modified: branches/branch-3.0/fluid/Fl_Type.h
===================================================================
--- branches/branch-3.0/fluid/Fl_Type.h	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Type.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -152,6 +152,7 @@
   virtual const char *title(); // string for browser
   virtual const char *type_name() = 0; // type for code output
   virtual const char *alt_type_name() { return type_name(); } // alternate type for FLTK1 file reading
+  virtual const char *include_path() { return 0; }
 
   const char *name() const {return name_;}
   void name(const char *);
@@ -622,6 +623,7 @@
   void open();
   virtual const char *type_name() {return "class";}
   virtual const char *alt_type_name() { return type_name(); }
+  virtual const char *include_path() { return "fltk3"; }
   int is_parent() const {return 1;}
   int is_decl_block() const {return 1;}
   int is_class() const {return 1;}
@@ -678,6 +680,7 @@
   Fl_Widget_Type();
   Fl_Type *make();
   void open();
+  virtual const char *include_path() { return "fltk3"; }
 
   const char *extra_code(int n) const {return extra_code_[n];}
   void extra_code(int n,const char *);

Modified: branches/branch-3.0/fluid/Fl_Widget_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Widget_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Widget_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -35,7 +35,7 @@
 #include <fltk3/Slider.h>
 #include <fltk3/Spinner.h>
 #include <fltk3/Window.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -1960,8 +1960,7 @@
 void Fl_Widget_Type::write_static() {
   const char* t = subclassname(this);
   if (!subclass() || (is_class() && !strncmp(t, "fltk3::", 7))) {
-    // FIXME: this will not work for fltk3gl and fltk3images any more!
-    write_declare("#include <fltk3/%s.h>", t+7);
+    write_declare("#include <%s/%s.h>", include_path(), t+7);
   }
   for (int n=0; n < NUM_EXTRA_CODE; n++) {
     if (extra_code(n) && isdeclare(extra_code(n)))

Modified: branches/branch-3.0/fluid/Fl_Window_Type.cxx
===================================================================
--- branches/branch-3.0/fluid/Fl_Window_Type.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fl_Window_Type.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -1359,7 +1359,7 @@
 ////////////////////////////////////////////////////////////////
 
 #include <stdio.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 
 void Fl_Window_Type::write_code1() {
   Fl_Widget_Type::write_code1();

Modified: branches/branch-3.0/fluid/Fluid_Image.cxx
===================================================================
--- branches/branch-3.0/fluid/Fluid_Image.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/Fluid_Image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -29,7 +29,7 @@
 #include <fltk3/Widget.h>
 #include "Fl_Type.h"
 #include "Fluid_Image.h"
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
@@ -57,7 +57,6 @@
     // Write Pixmap data...
     write_c("\n");
     if (pixmap_header_written != write_number) {
-      // FIXME: this will have to be fltk3image/...
       write_c("#include <fltk3/Pixmap.h>\n");
       pixmap_header_written = write_number;
     }
@@ -106,7 +105,7 @@
     // Write jpeg image data...
     write_c("\n");
     if (jpeg_header_written != write_number) {
-      write_c("#include <fltk3/JPEGImage.h>\n");
+      write_c("#include <fltk3images/JPEGImage.h>\n");
       jpeg_header_written = write_number;
     }
     write_c("static unsigned char %s[] =\n",

Modified: branches/branch-3.0/fluid/code.cxx
===================================================================
--- branches/branch-3.0/fluid/code.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/code.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -27,7 +27,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdarg.h>
 
 #include <fltk3/run.h>

Modified: branches/branch-3.0/fluid/factory.cxx
===================================================================
--- branches/branch-3.0/fluid/factory.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/factory.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -39,7 +39,7 @@
 #include <fltk3/Pixmap.h>
 #include <fltk3/Tree.h>
 #include <stdio.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include "undo.h"
 
 #include "Fl_Widget_Type.h"

Modified: branches/branch-3.0/fluid/file.cxx
===================================================================
--- branches/branch-3.0/fluid/file.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/file.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -33,7 +33,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 // FIXME: either make the interface public or remove this include statement!
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <stdarg.h>
 #include "alignment_panel.h"
 #include "workspace_panel.h"

Modified: branches/branch-3.0/fluid/file_make.cxx
===================================================================
--- branches/branch-3.0/fluid/file_make.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/file_make.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -281,7 +281,7 @@
   fprintf(out, "AC_PREREQ(2.50)\n");
   fprintf(out, "\n");
   fprintf(out, "dnl Required file in package...\n");
-  fprintf(out, "AC_INIT(src/core/Fl.cxx)\n");
+  fprintf(out, "AC_INIT(src/fltk3/run.cxx)\n");
   fprintf(out, "\n");
   fprintf(out, "dnl So --with-archflags option is used during \"checking size of long\"\n");
   fprintf(out, "if test `uname` = Darwin; then\n");

Modified: branches/branch-3.0/fluid/fluid.cxx
===================================================================
--- branches/branch-3.0/fluid/fluid.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/fluid.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -30,7 +30,7 @@
 #include <fltk3/Box.h>
 #include <fltk3/Button.h>
 #include <fltk3/FileIcon.h>
-#include <fltk3/HelpDialog.h>
+#include <fltk3images/HelpDialog.h>
 #include <fltk3/HoldBrowser.h>
 #include <fltk3/MenuBar.h>
 #include <fltk3/Input.h>
@@ -38,7 +38,7 @@
 #include <fltk3/ask.h>
 #include <fltk3/draw.h>
 #include <fltk3/FileChooser.h>
-#include <fltk3/PNGImage.h>
+#include <fltk3images/PNGImage.h>
 #include <fltk3/Printer.h>
 #include <fltk3/message.h>
 #include <fltk3/filename.h>
@@ -48,7 +48,7 @@
 #include <sys/stat.h>
 #include <time.h> // time(), localtime(), etc.
 
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include "alignment_panel.h"
 #include "function_panel.h"
 #include "template_panel.h"

Modified: branches/branch-3.0/fluid/makedepend
===================================================================
--- branches/branch-3.0/fluid/makedepend	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/makedepend	2011-08-25 21:50:59 UTC (rev 9011)
@@ -50,7 +50,7 @@
 Fl_Function_Type.o: ../include/fltk3/PackedGroup.h
 Fl_Function_Type.o: ../include/fltk3/WizardGroup.h ../include/fltk3/Menu_.h
 Fl_Function_Type.o: ../include/fltk3/InputChoice.h ../include/fltk3/MenuBar.h
-Fl_Function_Type.o: ../src/core/flstring.h ../include/fltk3/Export.h
+Fl_Function_Type.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h
 Fl_Function_Type.o: ../include/config.h function_panel.h
 Fl_Function_Type.o: ../include/fltk3/LightButton.h
 Fl_Function_Type.o: ../include/fltk3/TextEditor.h
@@ -83,7 +83,7 @@
 Fl_Group_Type.o: ../include/fltk3/MenuButton.h ../include/fltk3/Menu_.h
 Fl_Group_Type.o: ../include/fltk3/Choice.h ../include/fltk3/InputChoice.h
 Fl_Group_Type.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
-Fl_Group_Type.o: ../include/fltk3/MenuBar.h ../src/core/flstring.h
+Fl_Group_Type.o: ../include/fltk3/MenuBar.h ../src/fltk3/flstring.h
 Fl_Group_Type.o: ../include/fltk3/Export.h ../include/config.h
 Fl_Menu_Type.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
 Fl_Menu_Type.o: ../include/fltk3/Export.h ../include/fltk3/types.h
@@ -120,7 +120,7 @@
 Fl_Menu_Type.o: ../include/fltk3/ReturnButton.h
 Fl_Menu_Type.o: ../include/fltk3/RoundButton.h ../include/fltk3/message.h
 Fl_Menu_Type.o: ../include/fltk3/ask.h ../include/fltk3/ValueInput.h
-Fl_Menu_Type.o: ../src/core/flstring.h ../include/fltk3/Export.h
+Fl_Menu_Type.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h
 Fl_Menu_Type.o: ../include/config.h ../include/fltk3/Output.h
 Fl_Menu_Type.o: Shortcut_Button.h
 Fl_Type.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
@@ -139,7 +139,7 @@
 Fl_Type.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
 Fl_Type.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
 Fl_Type.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
-Fl_Type.o: ../src/core/flstring.h ../include/fltk3/Export.h
+Fl_Type.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h
 Fl_Type.o: ../include/config.h Fl_Type.h ../include/fltk3/DoubleWindow.h
 Fl_Type.o: ../include/fltk3/Menu.h ../include/fltk3/MenuItem.h Fluid_Image.h
 Fl_Type.o: ../include/fltk3/SharedImage.h ../include/fltk3/TabGroup.h
@@ -215,7 +215,7 @@
 Fl_Widget_Type.o: ../include/fltk3/run.h ../include/fltk3/ReturnButton.h
 Fl_Widget_Type.o: ../include/fltk3/RoundButton.h ../include/fltk3/message.h
 Fl_Widget_Type.o: ../include/fltk3/ask.h ../include/fltk3/Slider.h
-Fl_Widget_Type.o: ../src/core/flstring.h ../include/fltk3/Export.h
+Fl_Widget_Type.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h
 Fl_Widget_Type.o: ../include/config.h widget_panel.h
 Fl_Widget_Type.o: ../include/fltk3/ValueInput.h
 Fl_Widget_Type.o: ../include/fltk3/LightButton.h Shortcut_Button.h
@@ -262,7 +262,7 @@
 Fl_Window_Type.o: ../include/fltk3/ValueInput.h
 Fl_Window_Type.o: ../include/fltk3/LightButton.h Shortcut_Button.h
 Fl_Window_Type.o: CodeEditor.h ../include/fltk3/TextEditor.h
-Fl_Window_Type.o: ../include/fltk3/TextDisplay.h ../src/core/flstring.h
+Fl_Window_Type.o: ../include/fltk3/TextDisplay.h ../src/fltk3/flstring.h
 Fl_Window_Type.o: ../include/fltk3/Export.h ../include/config.h
 Fluid_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
 Fluid_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
@@ -286,7 +286,7 @@
 Fluid_Image.o: ../include/fltk3/Menu_.h ../include/fltk3/Choice.h
 Fluid_Image.o: ../include/fltk3/InputChoice.h ../include/fltk3/Input.h
 Fluid_Image.o: ../include/fltk3/Input_.h ../include/fltk3/MenuBar.h
-Fluid_Image.o: ../src/core/flstring.h ../include/fltk3/Export.h
+Fluid_Image.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h
 Fluid_Image.o: ../include/config.h ../include/fltk3/filename.h
 Fluid_Image.o: ../include/fltk3/FileChooser.h ../include/fltk3/Button.h
 Fluid_Image.o: ../include/fltk3/TiledGroup.h ../include/fltk3/FileBrowser.h
@@ -360,7 +360,7 @@
 alignment_panel.o: ../include/fltk3/RepeatButton.h ../include/fltk3/run.h
 alignment_panel.o: ../include/fltk3/ReturnButton.h
 alignment_panel.o: ../include/fltk3/RoundButton.h ../include/fltk3/ask.h
-code.o: ../src/core/flstring.h ../include/fltk3/Export.h ../include/config.h
+code.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
 code.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
 code.o: ../include/fltk3/Export.h ../include/fltk3/types.h
 code.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h Fl_Type.h
@@ -410,7 +410,7 @@
 factory.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
 factory.o: ../include/fltk3/Bitmap.h ../include/fltk3/RGBImage.h
 factory.o: ../include/fltk3/TreeItem.h ../include/fltk3/TreeItemArray.h
-factory.o: ../include/fltk3/TreePrefs.h ../src/core/flstring.h
+factory.o: ../include/fltk3/TreePrefs.h ../src/fltk3/flstring.h
 factory.o: ../include/fltk3/Export.h ../include/config.h undo.h
 factory.o: Fl_Widget_Type.h Fl_Type.h ../include/fltk3/DoubleWindow.h
 factory.o: ../include/fltk3/Menu.h ../include/fltk3/MenuItem.h Fluid_Image.h
@@ -441,7 +441,7 @@
 factory.o: ../include/fltk3/Input.h ../include/fltk3/ValueInput.h
 factory.o: ../include/fltk3/ValueOutput.h ../include/fltk3/ValueSlider.h
 factory.o: ../include/fltk3/MultiLabel.h
-file.o: ../src/core/flstring.h ../include/fltk3/Export.h ../include/config.h
+file.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
 file.o: alignment_panel.h ../include/fltk3/run.h ../include/fltk3/utf8.h
 file.o: ../include/fltk3/Export.h ../include/fltk3/types.h
 file.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
@@ -630,7 +630,7 @@
 fluid.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
 fluid.o: ../include/fltk3/Box.h ../include/fltk3/Button.h
 fluid.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-fluid.o: ../include/fltk3/HelpDialog.h ../include/fltk3/Group.h
+fluid.o: ../include/fltk3images/HelpDialog.h ../include/fltk3/Group.h
 fluid.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
 fluid.o: ../include/fltk3/HelpView.h ../include/fltk3/Scrollbar.h
 fluid.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
@@ -651,10 +651,10 @@
 fluid.o: ../include/fltk3/FileIcon.h ../include/fltk3/CheckButton.h
 fluid.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
 fluid.o: ../include/fltk3/FileInput.h ../include/fltk3/ReturnButton.h
-fluid.o: ../include/fltk3/PNGImage.h ../include/fltk3/Printer.h
+fluid.o: ../include/fltk3images/PNGImage.h ../include/fltk3/Printer.h
 fluid.o: ../include/fltk3/PagedDevice.h ../include/fltk3/PostScript.h
 fluid.o: ../include/fltk3/message.h ../include/fltk3/ask.h
-fluid.o: ../include/fltk3/filename.h ../src/core/flstring.h
+fluid.o: ../include/fltk3/filename.h ../src/fltk3/flstring.h
 fluid.o: ../include/fltk3/Export.h ../include/config.h alignment_panel.h
 fluid.o: ../include/fltk3/TextBuffer.h ../include/fltk3/TextDisplay.h
 fluid.o: ../include/fltk3/TextBuffer.h ../include/fltk3/Tooltip.h
@@ -715,7 +715,7 @@
 template_panel.o: ../include/fltk3/Box.h ../include/fltk3/Input.h
 template_panel.o: ../include/fltk3/Input_.h ../include/fltk3/Group.h
 template_panel.o: ../include/fltk3/Button.h ../include/fltk3/ReturnButton.h
-template_panel.o: ../include/fltk3/Button.h ../src/core/flstring.h
+template_panel.o: ../include/fltk3/Button.h ../src/fltk3/flstring.h
 template_panel.o: ../include/fltk3/Export.h ../include/config.h
 template_panel.o: ../include/fltk3/filename.h ../include/fltk3/ask.h
 template_panel.o: ../include/fltk3/SharedImage.h
@@ -742,7 +742,7 @@
 undo.o: ../include/fltk3/Choice.h ../include/fltk3/InputChoice.h
 undo.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
 undo.o: ../include/fltk3/MenuBar.h undo.h ../include/fltk3/filename.h
-undo.o: ../src/core/flstring.h ../include/fltk3/Export.h ../include/config.h
+undo.o: ../src/fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
 widget_panel.o: widget_panel.h ../include/fltk3/run.h ../include/fltk3/utf8.h
 widget_panel.o: ../include/fltk3/Export.h ../include/fltk3/types.h
 widget_panel.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h

Modified: branches/branch-3.0/fluid/template_panel.cxx
===================================================================
--- branches/branch-3.0/fluid/template_panel.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/template_panel.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -30,7 +30,7 @@
 #include "template_panel.h"
 #include <stdio.h>
 #include <stdlib.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <errno.h>
 #include <fltk3/filename.h>
 #include <fltk3/ask.h>

Modified: branches/branch-3.0/fluid/undo.cxx
===================================================================
--- branches/branch-3.0/fluid/undo.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/fluid/undo.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -30,7 +30,7 @@
 #include "undo.h"
 #include <fltk3/Preferences.h>
 #include <fltk3/filename.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #if defined(WIN32) && !defined(__CYGWIN__)
 #  include <io.h>
 #  include <windows.h>

Modified: branches/branch-3.0/ide/VisualC2008/fltk3.vcproj
===================================================================
--- branches/branch-3.0/ide/VisualC2008/fltk3.vcproj	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC2008/fltk3.vcproj	2011-08-25 21:50:59 UTC (rev 9011)
@@ -184,7 +184,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Adjuster.cxx"
+			RelativePath="..\..\src\fltk3\Adjuster.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -207,7 +207,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Bitmap.cxx"
+			RelativePath="..\..\src\fltk3\Bitmap.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -230,7 +230,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Box.cxx"
+			RelativePath="..\..\src\fltk3\Box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -253,7 +253,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Browser.cxx"
+			RelativePath="..\..\src\fltk3\Browser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -276,7 +276,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Browser_.cxx"
+			RelativePath="..\..\src\fltk3\Browser_.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -299,7 +299,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Browser_load.cxx"
+			RelativePath="..\..\src\fltk3\Browser_load.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -322,7 +322,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Button.cxx"
+			RelativePath="..\..\src\fltk3\Button.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -345,7 +345,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Chart.cxx"
+			RelativePath="..\..\src\fltk3\Chart.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -368,7 +368,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Check_Browser.cxx"
+			RelativePath="..\..\src\fltk3\CheckBrowser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -391,7 +391,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Check_Button.cxx"
+			RelativePath="..\..\src\fltk3\CheckButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -414,7 +414,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Choice.cxx"
+			RelativePath="..\..\src\fltk3\Choice.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -437,7 +437,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Clock.cxx"
+			RelativePath="..\..\src\fltk3\Clock.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -460,7 +460,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Color_Chooser.cxx"
+			RelativePath="..\..\src\fltk3\ColorChooser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -483,7 +483,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Counter.cxx"
+			RelativePath="..\..\src\fltk3\Counter.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -506,7 +506,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Device.cxx"
+			RelativePath="..\..\src\fltk3\Device.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -529,7 +529,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Dial.cxx"
+			RelativePath="..\..\src\fltk3\Dial.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -552,7 +552,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Double_Window.cxx"
+			RelativePath="..\..\src\fltk3\DoubleWindow.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -575,7 +575,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Browser.cxx"
+			RelativePath="..\..\src\fltk3\FileBrowser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -598,7 +598,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Chooser.cxx"
+			RelativePath="..\..\src\fltk3\FileChooser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -621,7 +621,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Chooser2.cxx"
+			RelativePath="..\..\src\fltk3\FileChooser2.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -644,7 +644,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Icon.cxx"
+			RelativePath="..\..\src\fltk3\FileIcon.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -667,7 +667,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Input.cxx"
+			RelativePath="..\..\src\fltk3\FileInput.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -690,7 +690,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Group.cxx"
+			RelativePath="..\..\src\fltk3\Group.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -713,7 +713,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Help_View.cxx"
+			RelativePath="..\..\src\fltk3\HelpView.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -736,7 +736,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Image.cxx"
+			RelativePath="..\..\src\fltk3\Image.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -759,7 +759,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Input.cxx"
+			RelativePath="..\..\src\fltk3\Input.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -782,7 +782,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Input_.cxx"
+			RelativePath="..\..\src\fltk3\Input_.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -805,7 +805,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Light_Button.cxx"
+			RelativePath="..\..\src\fltk3\LightButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -828,7 +828,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu.cxx"
+			RelativePath="..\..\src\fltk3\Menu.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -851,7 +851,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_.cxx"
+			RelativePath="..\..\src\fltk3\Menu_.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -874,7 +874,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_Bar.cxx"
+			RelativePath="..\..\src\fltk3\MenuBar.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -897,7 +897,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_Button.cxx"
+			RelativePath="..\..\src\fltk3\MenuButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -920,7 +920,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_Window.cxx"
+			RelativePath="..\..\src\fltk3\MenuWindow.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -943,7 +943,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_add.cxx"
+			RelativePath="..\..\src\fltk3\Menu_add.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -966,7 +966,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Menu_global.cxx"
+			RelativePath="..\..\src\fltk3\Menu_global.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -989,7 +989,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Multi_Label.cxx"
+			RelativePath="..\..\src\fltk3\MultiLabel.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1012,7 +1012,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Native_File_Chooser.cxx"
+			RelativePath="..\..\src\fltk3\NativeFileChooser.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1035,7 +1035,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Overlay_Window.cxx"
+			RelativePath="..\..\src\fltk3\OverlayWindow.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1058,7 +1058,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Pack.cxx"
+			RelativePath="..\..\src\fltk3\PackedGroup.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1081,7 +1081,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Paged_Device.cxx"
+			RelativePath="..\..\src\fltk3\PagedDevice.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1104,7 +1104,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Pixmap.cxx"
+			RelativePath="..\..\src\fltk3\Pixmap.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1127,7 +1127,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Positioner.cxx"
+			RelativePath="..\..\src\fltk3\Positioner.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1150,7 +1150,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Printer.cxx"
+			RelativePath="..\..\src\fltk3\Printer.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1173,7 +1173,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Preferences.cxx"
+			RelativePath="..\..\src\fltk3\Preferences.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1196,7 +1196,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Progress.cxx"
+			RelativePath="..\..\src\fltk3\Progress.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1219,7 +1219,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Repeat_Button.cxx"
+			RelativePath="..\..\src\fltk3\RepeatButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1242,7 +1242,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Return_Button.cxx"
+			RelativePath="..\..\src\fltk3\ReturnButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1265,7 +1265,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Roller.cxx"
+			RelativePath="..\..\src\fltk3\Roller.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1288,7 +1288,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Round_Button.cxx"
+			RelativePath="..\..\src\fltk3\RoundButton.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1311,7 +1311,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Scroll.cxx"
+			RelativePath="..\..\src\fltk3\ScrollGroup.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1334,7 +1334,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Scrollbar.cxx"
+			RelativePath="..\..\src\fltk3\Scrollbar.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1357,7 +1357,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Shared_Image.cxx"
+			RelativePath="..\..\src\fltk3\SharedImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1380,7 +1380,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Single_Window.cxx"
+			RelativePath="..\..\src\fltk3\SingleWindow.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1403,7 +1403,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Slider.cxx"
+			RelativePath="..\..\src\fltk3\Slider.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1426,7 +1426,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Style.cxx"
+			RelativePath="..\..\src\fltk3\Style.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1449,7 +1449,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Sys_Menu_Bar.cxx"
+			RelativePath="..\..\src\fltk3\SysMenuBar.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1472,7 +1472,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Table.cxx"
+			RelativePath="..\..\src\fltk3\Table.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1495,7 +1495,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Table_Row.cxx"
+			RelativePath="..\..\src\fltk3\TableRow.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1518,7 +1518,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tabs.cxx"
+			RelativePath="..\..\src\fltk3\TabGroup.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1541,7 +1541,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Text_Buffer.cxx"
+			RelativePath="..\..\src\fltk3\TextBuffer.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1564,7 +1564,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Text_Display.cxx"
+			RelativePath="..\..\src\fltk3\TextDisplay.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1587,7 +1587,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Text_Editor.cxx"
+			RelativePath="..\..\src\fltk3\TextEditor.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1610,7 +1610,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tile.cxx"
+			RelativePath="..\..\src\fltk3\TiledGroup.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1633,7 +1633,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tiled_Image.cxx"
+			RelativePath="..\..\src\fltk3\TiledImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1656,7 +1656,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tooltip.cxx"
+			RelativePath="..\..\src\fltk3\Tooltip.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1679,7 +1679,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tree.cxx"
+			RelativePath="..\..\src\fltk3\Tree.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1702,7 +1702,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tree_Item.cxx"
+			RelativePath="..\..\src\fltk3\TreeItem.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1725,7 +1725,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tree_Item_Array.cxx"
+			RelativePath="..\..\src\fltk3\TreeItemArray.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1748,7 +1748,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Tree_Prefs.cxx"
+			RelativePath="..\..\src\fltk3\TreePrefs.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1771,7 +1771,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Valuator.cxx"
+			RelativePath="..\..\src\fltk3\Valuator.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1794,7 +1794,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Value_Input.cxx"
+			RelativePath="..\..\src\fltk3\ValueInput.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1817,7 +1817,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Value_Output.cxx"
+			RelativePath="..\..\src\fltk3\ValueOutput.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1840,7 +1840,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Value_Slider.cxx"
+			RelativePath="..\..\src\fltk3\ValueSlider.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1863,7 +1863,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Widget.cxx"
+			RelativePath="..\..\src\fltk3\Widget.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1886,7 +1886,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Window.cxx"
+			RelativePath="..\..\src\fltk3\Window.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1909,7 +1909,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Window_fullscreen.cxx"
+			RelativePath="..\..\src\fltk3\Window_fullscreen.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1932,7 +1932,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Window_hotspot.cxx"
+			RelativePath="..\..\src\fltk3\Window_hotspot.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1955,7 +1955,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Window_iconize.cxx"
+			RelativePath="..\..\src\fltk3\Window_iconize.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -1978,7 +1978,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Wizard.cxx"
+			RelativePath="..\..\src\fltk3\Wizard.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2001,7 +2001,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_XBM_Image.cxx"
+			RelativePath="..\..\src\fltk3\XBMImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2024,7 +2024,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_XPM_Image.cxx"
+			RelativePath="..\..\src\fltk3\XPMImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2047,7 +2047,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_abort.cxx"
+			RelativePath="..\..\src\fltk3\abort.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2070,7 +2070,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_add_idle.cxx"
+			RelativePath="..\..\src\fltk3\add_idle.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2093,7 +2093,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_arg.cxx"
+			RelativePath="..\..\src\fltk3\arg.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2116,7 +2116,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_compose.cxx"
+			RelativePath="..\..\src\fltk3\compose.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2139,7 +2139,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_display.cxx"
+			RelativePath="..\..\src\fltk3\display.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2162,7 +2162,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_get_key.cxx"
+			RelativePath="..\..\src\fltk3\get_key.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2185,7 +2185,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_get_system_colors.cxx"
+			RelativePath="..\..\src\fltk3\get_system_colors.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2208,7 +2208,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_grab.cxx"
+			RelativePath="..\..\src\fltk3\grab.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2231,7 +2231,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_lock.cxx"
+			RelativePath="..\..\src\fltk3\lock.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2254,7 +2254,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_own_colormap.cxx"
+			RelativePath="..\..\src\fltk3\own_colormap.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2277,7 +2277,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_visual.cxx"
+			RelativePath="..\..\src\fltk3\visual.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2300,7 +2300,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_x.cxx"
+			RelativePath="..\..\src\fltk3\x11.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2323,7 +2323,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_absolute.cxx"
+			RelativePath="..\..\src\fltk3\filename_absolute.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2346,7 +2346,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_expand.cxx"
+			RelativePath="..\..\src\fltk3\filename_expand.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2369,7 +2369,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_ext.cxx"
+			RelativePath="..\..\src\fltk3\filename_ext.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2392,7 +2392,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_isdir.cxx"
+			RelativePath="..\..\src\fltk3\filename_isdir.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2415,7 +2415,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_list.cxx"
+			RelativePath="..\..\src\fltk3\filename_list.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2438,7 +2438,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_match.cxx"
+			RelativePath="..\..\src\fltk3\filename_match.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2461,7 +2461,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\filename_setext.cxx"
+			RelativePath="..\..\src\fltk3\filename_setext.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2484,7 +2484,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_arc.cxx"
+			RelativePath="..\..\src\fltk3\arc.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2507,7 +2507,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_arci.cxx"
+			RelativePath="..\..\src\fltk3\arci.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2530,7 +2530,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_ask.cxx"
+			RelativePath="..\..\src\fltk3\ask.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2553,7 +2553,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_boxtype.cxx"
+			RelativePath="..\..\src\fltk3\boxtype.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2576,7 +2576,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_call_main.cxx"
+			RelativePath="..\..\src\fltk3\call_main.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2599,7 +2599,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_color.cxx"
+			RelativePath="..\..\src\fltk3\color.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2622,7 +2622,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_cursor.cxx"
+			RelativePath="..\..\src\fltk3\cursor.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2645,7 +2645,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_curve.cxx"
+			RelativePath="..\..\src\fltk3\curve.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2668,7 +2668,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_diamond_box.cxx"
+			RelativePath="..\..\src\fltk3\diamond_box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2691,7 +2691,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_dnd.cxx"
+			RelativePath="..\..\src\fltk3\dnd.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2714,7 +2714,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_draw.cxx"
+			RelativePath="..\..\src\fltk3\draw.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2737,7 +2737,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_draw_image.cxx"
+			RelativePath="..\..\src\fltk3\draw_image.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2760,7 +2760,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_draw_pixmap.cxx"
+			RelativePath="..\..\src\fltk3\draw_pixmap.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2783,7 +2783,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_encoding_latin1.cxx"
+			RelativePath="..\..\src\fltk3\encoding_latin1.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2806,7 +2806,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_encoding_mac_roman.cxx"
+			RelativePath="..\..\src\fltk3\encoding_mac_roman.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2829,7 +2829,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_engraved_label.cxx"
+			RelativePath="..\..\src\fltk3\engraved_label.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2852,7 +2852,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_file_dir.cxx"
+			RelativePath="..\..\src\fltk3\file_dir.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2875,7 +2875,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_font.cxx"
+			RelativePath="..\..\src\fltk3\font.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2898,7 +2898,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_gtk.cxx"
+			RelativePath="..\..\src\fltk3\gtk.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2921,7 +2921,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_labeltype.cxx"
+			RelativePath="..\..\src\fltk3\labeltype.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2944,7 +2944,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_line_style.cxx"
+			RelativePath="..\..\src\fltk3\line_style.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2967,7 +2967,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_open_uri.cxx"
+			RelativePath="..\..\src\fltk3\open_uri.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -2990,7 +2990,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_oval_box.cxx"
+			RelativePath="..\..\src\fltk3\oval_box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3013,7 +3013,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_overlay.cxx"
+			RelativePath="..\..\src\fltk3\overlay.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3036,7 +3036,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_overlay_visual.cxx"
+			RelativePath="..\..\src\fltk3\overlay_visual.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3059,7 +3059,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_plastic.cxx"
+			RelativePath="..\..\src\fltk3\plastic.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3082,7 +3082,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_read_image.cxx"
+			RelativePath="..\..\src\fltk3\read_image.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3105,7 +3105,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_rect.cxx"
+			RelativePath="..\..\src\fltk3\rect.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3128,7 +3128,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_round_box.cxx"
+			RelativePath="..\..\src\fltk3\round_box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3151,7 +3151,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_rounded_box.cxx"
+			RelativePath="..\..\src\fltk3\rounded_box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3174,7 +3174,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_scroll_area.cxx"
+			RelativePath="..\..\src\fltk3\scroll_area.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3197,7 +3197,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_set_font.cxx"
+			RelativePath="..\..\src\fltk3\set_font.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3220,7 +3220,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_set_fonts.cxx"
+			RelativePath="..\..\src\fltk3\set_fonts.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3243,7 +3243,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_shadow_box.cxx"
+			RelativePath="..\..\src\fltk3\shadow_box.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3266,7 +3266,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_shortcut.cxx"
+			RelativePath="..\..\src\fltk3\shortcut.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3289,7 +3289,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_show_colormap.cxx"
+			RelativePath="..\..\src\fltk3\show_colormap.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3312,7 +3312,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_symbols.cxx"
+			RelativePath="..\..\src\fltk3\symbols.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3335,7 +3335,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_utf8.cxx"
+			RelativePath="..\..\src\fltk3\utf8.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3358,7 +3358,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_utf.cxx"
+			RelativePath="..\..\src\fltk3\utf.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3381,7 +3381,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_vertex.cxx"
+			RelativePath="..\..\src\fltk3\vertex.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3404,7 +3404,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\numericsort.cxx"
+			RelativePath="..\..\src\fltk3\numericsort.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3427,7 +3427,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\ps_image.cxx"
+			RelativePath="..\..\src\fltk3\ps_image.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3450,7 +3450,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\scandir.cxx"
+			RelativePath="..\..\src\fltk3\scandir.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3473,7 +3473,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\screen_xywh.cxx"
+			RelativePath="..\..\src\fltk3\screen_xywh.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3496,7 +3496,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\flstring.c"
+			RelativePath="..\..\src\fltk3\flstring.c"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3519,7 +3519,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\vsnprintf.c"
+			RelativePath="..\..\src\fltk3\vsnprintf.c"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3542,7 +3542,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\xutf8\case.c"
+			RelativePath="..\..\src\fltk3\xutf8\case.c"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3565,7 +3565,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\xutf8\is_right2left.c"
+			RelativePath="..\..\src\fltk3\xutf8\is_right2left.c"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -3588,7 +3588,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\xutf8\is_spacing.c"
+			RelativePath="..\..\src\fltk3\xutf8\is_spacing.c"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"

Modified: branches/branch-3.0/ide/VisualC2008/fltk3images.vcproj
===================================================================
--- branches/branch-3.0/ide/VisualC2008/fltk3images.vcproj	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC2008/fltk3images.vcproj	2011-08-25 21:50:59 UTC (rev 9011)
@@ -161,7 +161,7 @@
 	</References>
 	<Files>
 		<File
-			RelativePath="..\..\src\core\Fl_BMP_Image.cxx"
+			RelativePath="..\..\src\fltk3images\BMPImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -184,7 +184,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_File_Icon2.cxx"
+			RelativePath="..\..\src\fltk3images\FileIcon2.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -207,7 +207,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_GIF_Image.cxx"
+			RelativePath="..\..\src\fltk3images\GIFImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -230,7 +230,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_Help_Dialog.cxx"
+			RelativePath="..\..\src\fltk3images\HelpDialog.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -253,7 +253,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_JPEG_Image.cxx"
+			RelativePath="..\..\src\fltk3images\images_core.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -276,7 +276,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_PNG_Image.cxx"
+			RelativePath="..\..\src\fltk3images\JPEGImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -299,7 +299,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\Fl_PNM_Image.cxx"
+			RelativePath="..\..\src\fltk3images\PNGImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"
@@ -322,7 +322,7 @@
 			</FileConfiguration>
 		</File>
 		<File
-			RelativePath="..\..\src\core\fl_images_core.cxx"
+			RelativePath="..\..\src\fltk3images\PNMImage.cxx"
 			>
 			<FileConfiguration
 				Name="Debug|Win32"

Modified: branches/branch-3.0/ide/VisualC2010/fltk3.vcxproj
===================================================================
--- branches/branch-3.0/ide/VisualC2010/fltk3.vcxproj	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC2010/fltk3.vcxproj	2011-08-25 21:50:59 UTC (rev 9011)
@@ -100,1043 +100,1043 @@
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Adjuster.cxx">
+    <ClCompile Include="..\..\src\fltk3\Adjuster.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Bitmap.cxx">
+    <ClCompile Include="..\..\src\fltk3\Bitmap.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Box.cxx">
+    <ClCompile Include="..\..\src\fltk3\Box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Browser.cxx">
+    <ClCompile Include="..\..\src\fltk3\Browser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Browser_.cxx">
+    <ClCompile Include="..\..\src\fltk3\Browser_.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Browser_load.cxx">
+    <ClCompile Include="..\..\src\fltk3\Browser_load.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\Button.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Chart.cxx">
+    <ClCompile Include="..\..\src\fltk3\Chart.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Check_Browser.cxx">
+    <ClCompile Include="..\..\src\fltk3\CheckBrowser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Check_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\CheckButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Choice.cxx">
+    <ClCompile Include="..\..\src\fltk3\Choice.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Clock.cxx">
+    <ClCompile Include="..\..\src\fltk3\Clock.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Color_Chooser.cxx">
+    <ClCompile Include="..\..\src\fltk3\ColorChooser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Counter.cxx">
+    <ClCompile Include="..\..\src\fltk3\Counter.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Device.cxx">
+    <ClCompile Include="..\..\src\fltk3\Device.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Dial.cxx">
+    <ClCompile Include="..\..\src\fltk3\Dial.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Double_Window.cxx">
+    <ClCompile Include="..\..\src\fltk3\DoubleWindow.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Browser.cxx">
+    <ClCompile Include="..\..\src\fltk3\FileBrowser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Chooser.cxx">
+    <ClCompile Include="..\..\src\fltk3\FileChooser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Chooser2.cxx">
+    <ClCompile Include="..\..\src\fltk3\FileChooser2.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Icon.cxx">
+    <ClCompile Include="..\..\src\fltk3\FileIcon.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Input.cxx">
+    <ClCompile Include="..\..\src\fltk3\FileInput.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Group.cxx">
+    <ClCompile Include="..\..\src\fltk3\Group.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Help_View.cxx">
+    <ClCompile Include="..\..\src\fltk3\HelpView.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3\Image.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Input.cxx">
+    <ClCompile Include="..\..\src\fltk3\Input.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Input_.cxx">
+    <ClCompile Include="..\..\src\fltk3\Input_.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Light_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\LightButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu.cxx">
+    <ClCompile Include="..\..\src\fltk3\Menu.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_.cxx">
+    <ClCompile Include="..\..\src\fltk3\Menu_.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_Bar.cxx">
+    <ClCompile Include="..\..\src\fltk3\MenuBar.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\MenuButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_Window.cxx">
+    <ClCompile Include="..\..\src\fltk3\MenuWindow.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_add.cxx">
+    <ClCompile Include="..\..\src\fltk3\Menu_add.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Menu_global.cxx">
+    <ClCompile Include="..\..\src\fltk3\Menu_global.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Multi_Label.cxx">
+    <ClCompile Include="..\..\src\fltk3\MultiLabel.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Native_File_Chooser.cxx">
+    <ClCompile Include="..\..\src\fltk3\NativeFileChooser.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Overlay_Window.cxx">
+    <ClCompile Include="..\..\src\fltk3\OverlayWindow.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Pack.cxx">
+    <ClCompile Include="..\..\src\fltk3\PackedGroup.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Paged_Device.cxx">
+    <ClCompile Include="..\..\src\fltk3\PagedDevice.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Pixmap.cxx">
+    <ClCompile Include="..\..\src\fltk3\Pixmap.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Positioner.cxx">
+    <ClCompile Include="..\..\src\fltk3\Positioner.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Printer.cxx">
+    <ClCompile Include="..\..\src\fltk3\Printer.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Preferences.cxx">
+    <ClCompile Include="..\..\src\fltk3\Preferences.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Progress.cxx">
+    <ClCompile Include="..\..\src\fltk3\Progress.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Repeat_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\RepeatButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Return_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\ReturnButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Roller.cxx">
+    <ClCompile Include="..\..\src\fltk3\Roller.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Round_Button.cxx">
+    <ClCompile Include="..\..\src\fltk3\RoundButton.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Scroll.cxx">
+    <ClCompile Include="..\..\src\fltk3\ScrollGroup.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Scrollbar.cxx">
+    <ClCompile Include="..\..\src\fltk3\Scrollbar.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Shared_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3\SharedImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Single_Window.cxx">
+    <ClCompile Include="..\..\src\fltk3\SingleWindow.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Slider.cxx">
+    <ClCompile Include="..\..\src\fltk3\Slider.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Style.cxx">
+    <ClCompile Include="..\..\src\fltk3\Style.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Sys_Menu_Bar.cxx">
+    <ClCompile Include="..\..\src\fltk3\SysMenuBar.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Table.cxx">
+    <ClCompile Include="..\..\src\fltk3\Table.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Table_Row.cxx">
+    <ClCompile Include="..\..\src\fltk3\TableRow.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tabs.cxx">
+    <ClCompile Include="..\..\src\fltk3\TabGroup.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Text_Buffer.cxx">
+    <ClCompile Include="..\..\src\fltk3\TextBuffer.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Text_Display.cxx">
+    <ClCompile Include="..\..\src\fltk3\TextDisplay.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Text_Editor.cxx">
+    <ClCompile Include="..\..\src\fltk3\TextEditor.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tile.cxx">
+    <ClCompile Include="..\..\src\fltk3\TiledGroup.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tiled_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3\TiledImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tooltip.cxx">
+    <ClCompile Include="..\..\src\fltk3\Tooltip.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tree.cxx">
+    <ClCompile Include="..\..\src\fltk3\Tree.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tree_Item.cxx">
+    <ClCompile Include="..\..\src\fltk3\TreeItem.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tree_Item_Array.cxx">
+    <ClCompile Include="..\..\src\fltk3\TreeItemArray.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Tree_Prefs.cxx">
+    <ClCompile Include="..\..\src\fltk3\TreePrefs.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Valuator.cxx">
+    <ClCompile Include="..\..\src\fltk3\Valuator.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Value_Input.cxx">
+    <ClCompile Include="..\..\src\fltk3\ValueInput.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Value_Output.cxx">
+    <ClCompile Include="..\..\src\fltk3\ValueOutput.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Value_Slider.cxx">
+    <ClCompile Include="..\..\src\fltk3\ValueSlider.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Widget.cxx">
+    <ClCompile Include="..\..\src\fltk3\Widget.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Window.cxx">
+    <ClCompile Include="..\..\src\fltk3\Window.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Window_fullscreen.cxx">
+    <ClCompile Include="..\..\src\fltk3\Window_fullscreen.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Window_hotspot.cxx">
+    <ClCompile Include="..\..\src\fltk3\Window_hotspot.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Window_iconize.cxx">
+    <ClCompile Include="..\..\src\fltk3\Window_iconize.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Wizard.cxx">
+    <ClCompile Include="..\..\src\fltk3\Wizard.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_XBM_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3\XBMImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_XPM_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3\XPMImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_abort.cxx">
+    <ClCompile Include="..\..\src\fltk3\abort.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_add_idle.cxx">
+    <ClCompile Include="..\..\src\fltk3\add_idle.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_arg.cxx">
+    <ClCompile Include="..\..\src\fltk3\arg.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_compose.cxx">
+    <ClCompile Include="..\..\src\fltk3\compose.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_display.cxx">
+    <ClCompile Include="..\..\src\fltk3\display.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_get_key.cxx">
+    <ClCompile Include="..\..\src\fltk3\get_key.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_get_system_colors.cxx">
+    <ClCompile Include="..\..\src\fltk3\get_system_colors.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_grab.cxx">
+    <ClCompile Include="..\..\src\fltk3\grab.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_lock.cxx">
+    <ClCompile Include="..\..\src\fltk3\lock.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_own_colormap.cxx">
+    <ClCompile Include="..\..\src\fltk3\own_colormap.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_visual.cxx">
+    <ClCompile Include="..\..\src\fltk3\visual.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_x.cxx">
+    <ClCompile Include="..\..\src\fltk3\x11.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_absolute.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_absolute.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_expand.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_expand.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_ext.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_ext.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_isdir.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_isdir.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_list.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_list.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_match.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_match.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\filename_setext.cxx">
+    <ClCompile Include="..\..\src\fltk3\filename_setext.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_arc.cxx">
+    <ClCompile Include="..\..\src\fltk3\arc.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_arci.cxx">
+    <ClCompile Include="..\..\src\fltk3\arci.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_ask.cxx">
+    <ClCompile Include="..\..\src\fltk3\ask.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_boxtype.cxx">
+    <ClCompile Include="..\..\src\fltk3\boxtype.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_call_main.cxx">
+    <ClCompile Include="..\..\src\fltk3\call_main.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_color.cxx">
+    <ClCompile Include="..\..\src\fltk3\color.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_cursor.cxx">
+    <ClCompile Include="..\..\src\fltk3\cursor.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_curve.cxx">
+    <ClCompile Include="..\..\src\fltk3\curve.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_diamond_box.cxx">
+    <ClCompile Include="..\..\src\fltk3\diamond_box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_dnd.cxx">
+    <ClCompile Include="..\..\src\fltk3\dnd.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_draw.cxx">
+    <ClCompile Include="..\..\src\fltk3\draw.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_draw_image.cxx">
+    <ClCompile Include="..\..\src\fltk3\draw_image.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_draw_pixmap.cxx">
+    <ClCompile Include="..\..\src\fltk3\draw_pixmap.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_encoding_latin1.cxx">
+    <ClCompile Include="..\..\src\fltk3\encoding_latin1.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_encoding_mac_roman.cxx">
+    <ClCompile Include="..\..\src\fltk3\encoding_mac_roman.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_engraved_label.cxx">
+    <ClCompile Include="..\..\src\fltk3\engraved_label.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_file_dir.cxx">
+    <ClCompile Include="..\..\src\fltk3\file_dir.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_font.cxx">
+    <ClCompile Include="..\..\src\fltk3\font.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_gtk.cxx">
+    <ClCompile Include="..\..\src\fltk3\gtk.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_labeltype.cxx">
+    <ClCompile Include="..\..\src\fltk3\labeltype.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_line_style.cxx">
+    <ClCompile Include="..\..\src\fltk3\line_style.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_open_uri.cxx">
+    <ClCompile Include="..\..\src\fltk3\open_uri.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_oval_box.cxx">
+    <ClCompile Include="..\..\src\fltk3\oval_box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_overlay.cxx">
+    <ClCompile Include="..\..\src\fltk3\overlay.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_overlay_visual.cxx">
+    <ClCompile Include="..\..\src\fltk3\overlay_visual.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_plastic.cxx">
+    <ClCompile Include="..\..\src\fltk3\plastic.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_read_image.cxx">
+    <ClCompile Include="..\..\src\fltk3\read_image.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_rect.cxx">
+    <ClCompile Include="..\..\src\fltk3\rect.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_round_box.cxx">
+    <ClCompile Include="..\..\src\fltk3\round_box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_rounded_box.cxx">
+    <ClCompile Include="..\..\src\fltk3\rounded_box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_scroll_area.cxx">
+    <ClCompile Include="..\..\src\fltk3\scroll_area.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_set_font.cxx">
+    <ClCompile Include="..\..\src\fltk3\set_font.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_set_fonts.cxx">
+    <ClCompile Include="..\..\src\fltk3\set_fonts.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_shadow_box.cxx">
+    <ClCompile Include="..\..\src\fltk3\shadow_box.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_shortcut.cxx">
+    <ClCompile Include="..\..\src\fltk3\shortcut.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_show_colormap.cxx">
+    <ClCompile Include="..\..\src\fltk3\show_colormap.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_symbols.cxx">
+    <ClCompile Include="..\..\src\fltk3\symbols.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_utf8.cxx">
+    <ClCompile Include="..\..\src\fltk3\utf8.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_utf.cxx">
+    <ClCompile Include="..\..\src\fltk3\utf.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_vertex.cxx">
+    <ClCompile Include="..\..\src\fltk3\vertex.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\numericsort.cxx">
+    <ClCompile Include="..\..\src\fltk3\numericsort.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\ps_image.cxx">
+    <ClCompile Include="..\..\src\fltk3\ps_image.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\scandir.cxx">
+    <ClCompile Include="..\..\src\fltk3\scandir.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\screen_xywh.cxx">
+    <ClCompile Include="..\..\src\fltk3\screen_xywh.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\flstring.c">
+    <ClCompile Include="..\..\src\fltk3\flstring.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\vsnprintf.c">
+    <ClCompile Include="..\..\src\fltk3\vsnprintf.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\xutf8\case.c">
+    <ClCompile Include="..\..\src\fltk3\xutf8\case.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\xutf8\is_right2left.c">
+    <ClCompile Include="..\..\src\fltk3\xutf8\is_right2left.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\xutf8\is_spacing.c">
+    <ClCompile Include="..\..\src\fltk3\xutf8\is_spacing.c">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>

Modified: branches/branch-3.0/ide/VisualC2010/fltk3images.vcxproj
===================================================================
--- branches/branch-3.0/ide/VisualC2010/fltk3images.vcxproj	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC2010/fltk3images.vcxproj	2011-08-25 21:50:59 UTC (rev 9011)
@@ -93,56 +93,56 @@
     </Lib>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClCompile Include="..\..\src\core\Fl_BMP_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3images\BMPImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_File_Icon2.cxx">
+    <ClCompile Include="..\..\src\fltk3images\FileIcon2.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_GIF_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3images\GIFImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_Help_Dialog.cxx">
+    <ClCompile Include="..\..\src\fltk3images\HelpDialog.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_JPEG_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3images\images_core.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_PNG_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3images\JPEGImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\Fl_PNM_Image.cxx">
+    <ClCompile Include="..\..\src\fltk3images\PNGImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="..\..\src\core\fl_images_core.cxx">
+    <ClCompile Include="..\..\src\fltk3images\PNMImage.cxx">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>

Modified: branches/branch-3.0/ide/VisualC6/fltk3.dsp
===================================================================
--- branches/branch-3.0/ide/VisualC6/fltk3.dsp	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC6/fltk3.dsp	2011-08-25 21:50:59 UTC (rev 9011)
@@ -87,599 +87,599 @@
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Adjuster.cxx
+SOURCE=..\..\src\fltk3\Adjuster.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Bitmap.cxx
+SOURCE=..\..\src\fltk3\Bitmap.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Box.cxx
+SOURCE=..\..\src\fltk3\Box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Browser.cxx
+SOURCE=..\..\src\fltk3\Browser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Browser_.cxx
+SOURCE=..\..\src\fltk3\Browser_.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Browser_load.cxx
+SOURCE=..\..\src\fltk3\Browser_load.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Button.cxx
+SOURCE=..\..\src\fltk3\Button.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Chart.cxx
+SOURCE=..\..\src\fltk3\Chart.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Check_Browser.cxx
+SOURCE=..\..\src\fltk3\CheckBrowser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Check_Button.cxx
+SOURCE=..\..\src\fltk3\CheckButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Choice.cxx
+SOURCE=..\..\src\fltk3\Choice.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Clock.cxx
+SOURCE=..\..\src\fltk3\Clock.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Color_Chooser.cxx
+SOURCE=..\..\src\fltk3\ColorChooser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Counter.cxx
+SOURCE=..\..\src\fltk3\Counter.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Device.cxx
+SOURCE=..\..\src\fltk3\Device.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Dial.cxx
+SOURCE=..\..\src\fltk3\Dial.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Double_Window.cxx
+SOURCE=..\..\src\fltk3\DoubleWindow.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Browser.cxx
+SOURCE=..\..\src\fltk3\FileBrowser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Chooser.cxx
+SOURCE=..\..\src\fltk3\FileChooser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Chooser2.cxx
+SOURCE=..\..\src\fltk3\FileChooser2.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Icon.cxx
+SOURCE=..\..\src\fltk3\FileIcon.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Input.cxx
+SOURCE=..\..\src\fltk3\FileInput.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Group.cxx
+SOURCE=..\..\src\fltk3\Group.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Help_View.cxx
+SOURCE=..\..\src\fltk3\HelpView.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Image.cxx
+SOURCE=..\..\src\fltk3\Image.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Input.cxx
+SOURCE=..\..\src\fltk3\Input.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Input_.cxx
+SOURCE=..\..\src\fltk3\Input_.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Light_Button.cxx
+SOURCE=..\..\src\fltk3\LightButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu.cxx
+SOURCE=..\..\src\fltk3\Menu.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_.cxx
+SOURCE=..\..\src\fltk3\Menu_.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_Bar.cxx
+SOURCE=..\..\src\fltk3\MenuBar.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_Button.cxx
+SOURCE=..\..\src\fltk3\MenuButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_Window.cxx
+SOURCE=..\..\src\fltk3\MenuWindow.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_add.cxx
+SOURCE=..\..\src\fltk3\Menu_add.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Menu_global.cxx
+SOURCE=..\..\src\fltk3\Menu_global.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Multi_Label.cxx
+SOURCE=..\..\src\fltk3\MultiLabel.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Native_File_Chooser.cxx
+SOURCE=..\..\src\fltk3\NativeFileChooser.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Overlay_Window.cxx
+SOURCE=..\..\src\fltk3\OverlayWindow.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Pack.cxx
+SOURCE=..\..\src\fltk3\PackedGroup.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Paged_Device.cxx
+SOURCE=..\..\src\fltk3\PagedDevice.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Pixmap.cxx
+SOURCE=..\..\src\fltk3\Pixmap.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Positioner.cxx
+SOURCE=..\..\src\fltk3\Positioner.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Printer.cxx
+SOURCE=..\..\src\fltk3\Printer.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Preferences.cxx
+SOURCE=..\..\src\fltk3\Preferences.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Progress.cxx
+SOURCE=..\..\src\fltk3\Progress.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Repeat_Button.cxx
+SOURCE=..\..\src\fltk3\RepeatButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Return_Button.cxx
+SOURCE=..\..\src\fltk3\ReturnButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Roller.cxx
+SOURCE=..\..\src\fltk3\Roller.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Round_Button.cxx
+SOURCE=..\..\src\fltk3\RoundButton.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Scroll.cxx
+SOURCE=..\..\src\fltk3\ScrollGroup.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Scrollbar.cxx
+SOURCE=..\..\src\fltk3\Scrollbar.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Shared_Image.cxx
+SOURCE=..\..\src\fltk3\SharedImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Single_Window.cxx
+SOURCE=..\..\src\fltk3\SingleWindow.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Slider.cxx
+SOURCE=..\..\src\fltk3\Slider.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Style.cxx
+SOURCE=..\..\src\fltk3\Style.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Sys_Menu_Bar.cxx
+SOURCE=..\..\src\fltk3\SysMenuBar.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Table.cxx
+SOURCE=..\..\src\fltk3\Table.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Table_Row.cxx
+SOURCE=..\..\src\fltk3\TableRow.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tabs.cxx
+SOURCE=..\..\src\fltk3\TabGroup.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Text_Buffer.cxx
+SOURCE=..\..\src\fltk3\TextBuffer.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Text_Display.cxx
+SOURCE=..\..\src\fltk3\TextDisplay.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Text_Editor.cxx
+SOURCE=..\..\src\fltk3\TextEditor.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tile.cxx
+SOURCE=..\..\src\fltk3\TiledGroup.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tiled_Image.cxx
+SOURCE=..\..\src\fltk3\TiledImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tooltip.cxx
+SOURCE=..\..\src\fltk3\Tooltip.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tree.cxx
+SOURCE=..\..\src\fltk3\Tree.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tree_Item.cxx
+SOURCE=..\..\src\fltk3\TreeItem.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tree_Item_Array.cxx
+SOURCE=..\..\src\fltk3\TreeItemArray.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Tree_Prefs.cxx
+SOURCE=..\..\src\fltk3\TreePrefs.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Valuator.cxx
+SOURCE=..\..\src\fltk3\Valuator.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Value_Input.cxx
+SOURCE=..\..\src\fltk3\ValueInput.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Value_Output.cxx
+SOURCE=..\..\src\fltk3\ValueOutput.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Value_Slider.cxx
+SOURCE=..\..\src\fltk3\ValueSlider.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Widget.cxx
+SOURCE=..\..\src\fltk3\Widget.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Window.cxx
+SOURCE=..\..\src\fltk3\Window.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Window_fullscreen.cxx
+SOURCE=..\..\src\fltk3\Window_fullscreen.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Window_hotspot.cxx
+SOURCE=..\..\src\fltk3\Window_hotspot.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Window_iconize.cxx
+SOURCE=..\..\src\fltk3\Window_iconize.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Wizard.cxx
+SOURCE=..\..\src\fltk3\Wizard.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_XBM_Image.cxx
+SOURCE=..\..\src\fltk3\XBMImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_XPM_Image.cxx
+SOURCE=..\..\src\fltk3\XPMImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_abort.cxx
+SOURCE=..\..\src\fltk3\abort.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_add_idle.cxx
+SOURCE=..\..\src\fltk3\add_idle.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_arg.cxx
+SOURCE=..\..\src\fltk3\arg.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_compose.cxx
+SOURCE=..\..\src\fltk3\compose.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_display.cxx
+SOURCE=..\..\src\fltk3\display.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_get_key.cxx
+SOURCE=..\..\src\fltk3\get_key.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_get_system_colors.cxx
+SOURCE=..\..\src\fltk3\get_system_colors.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_grab.cxx
+SOURCE=..\..\src\fltk3\grab.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_lock.cxx
+SOURCE=..\..\src\fltk3\lock.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_own_colormap.cxx
+SOURCE=..\..\src\fltk3\own_colormap.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_visual.cxx
+SOURCE=..\..\src\fltk3\visual.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_x.cxx
+SOURCE=..\..\src\fltk3\x11.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_absolute.cxx
+SOURCE=..\..\src\fltk3\filename_absolute.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_expand.cxx
+SOURCE=..\..\src\fltk3\filename_expand.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_ext.cxx
+SOURCE=..\..\src\fltk3\filename_ext.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_isdir.cxx
+SOURCE=..\..\src\fltk3\filename_isdir.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_list.cxx
+SOURCE=..\..\src\fltk3\filename_list.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_match.cxx
+SOURCE=..\..\src\fltk3\filename_match.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\filename_setext.cxx
+SOURCE=..\..\src\fltk3\filename_setext.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_arc.cxx
+SOURCE=..\..\src\fltk3\arc.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_arci.cxx
+SOURCE=..\..\src\fltk3\arci.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_ask.cxx
+SOURCE=..\..\src\fltk3\ask.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_boxtype.cxx
+SOURCE=..\..\src\fltk3\boxtype.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_call_main.cxx
+SOURCE=..\..\src\fltk3\call_main.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_color.cxx
+SOURCE=..\..\src\fltk3\color.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_cursor.cxx
+SOURCE=..\..\src\fltk3\cursor.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_curve.cxx
+SOURCE=..\..\src\fltk3\curve.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_diamond_box.cxx
+SOURCE=..\..\src\fltk3\diamond_box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_dnd.cxx
+SOURCE=..\..\src\fltk3\dnd.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_draw.cxx
+SOURCE=..\..\src\fltk3\draw.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_draw_image.cxx
+SOURCE=..\..\src\fltk3\draw_image.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_draw_pixmap.cxx
+SOURCE=..\..\src\fltk3\draw_pixmap.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_encoding_latin1.cxx
+SOURCE=..\..\src\fltk3\encoding_latin1.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_encoding_mac_roman.cxx
+SOURCE=..\..\src\fltk3\encoding_mac_roman.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_engraved_label.cxx
+SOURCE=..\..\src\fltk3\engraved_label.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_file_dir.cxx
+SOURCE=..\..\src\fltk3\file_dir.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_font.cxx
+SOURCE=..\..\src\fltk3\font.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_gtk.cxx
+SOURCE=..\..\src\fltk3\gtk.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_labeltype.cxx
+SOURCE=..\..\src\fltk3\labeltype.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_line_style.cxx
+SOURCE=..\..\src\fltk3\line_style.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_open_uri.cxx
+SOURCE=..\..\src\fltk3\open_uri.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_oval_box.cxx
+SOURCE=..\..\src\fltk3\oval_box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_overlay.cxx
+SOURCE=..\..\src\fltk3\overlay.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_overlay_visual.cxx
+SOURCE=..\..\src\fltk3\overlay_visual.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_plastic.cxx
+SOURCE=..\..\src\fltk3\plastic.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_read_image.cxx
+SOURCE=..\..\src\fltk3\read_image.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_rect.cxx
+SOURCE=..\..\src\fltk3\rect.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_round_box.cxx
+SOURCE=..\..\src\fltk3\round_box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_rounded_box.cxx
+SOURCE=..\..\src\fltk3\rounded_box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_scroll_area.cxx
+SOURCE=..\..\src\fltk3\scroll_area.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_set_font.cxx
+SOURCE=..\..\src\fltk3\set_font.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_set_fonts.cxx
+SOURCE=..\..\src\fltk3\set_fonts.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_shadow_box.cxx
+SOURCE=..\..\src\fltk3\shadow_box.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_shortcut.cxx
+SOURCE=..\..\src\fltk3\shortcut.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_show_colormap.cxx
+SOURCE=..\..\src\fltk3\show_colormap.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_symbols.cxx
+SOURCE=..\..\src\fltk3\symbols.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_utf8.cxx
+SOURCE=..\..\src\fltk3\utf8.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_utf.cxx
+SOURCE=..\..\src\fltk3\utf.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_vertex.cxx
+SOURCE=..\..\src\fltk3\vertex.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\numericsort.cxx
+SOURCE=..\..\src\fltk3\numericsort.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\ps_image.cxx
+SOURCE=..\..\src\fltk3\ps_image.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\scandir.cxx
+SOURCE=..\..\src\fltk3\scandir.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\screen_xywh.cxx
+SOURCE=..\..\src\fltk3\screen_xywh.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\flstring.c
+SOURCE=..\..\src\fltk3\flstring.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\vsnprintf.c
+SOURCE=..\..\src\fltk3\vsnprintf.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\xutf8\case.c
+SOURCE=..\..\src\fltk3\xutf8\case.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\xutf8\is_right2left.c
+SOURCE=..\..\src\fltk3\xutf8\is_right2left.c
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\xutf8\is_spacing.c
+SOURCE=..\..\src\fltk3\xutf8\is_spacing.c
 # End Source File
 # End Target
 # End Project

Modified: branches/branch-3.0/ide/VisualC6/fltk3images.dsp
===================================================================
--- branches/branch-3.0/ide/VisualC6/fltk3images.dsp	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/VisualC6/fltk3images.dsp	2011-08-25 21:50:59 UTC (rev 9011)
@@ -83,35 +83,35 @@
 # Name "fltk3images - Win32 Debug"
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_BMP_Image.cxx
+SOURCE=..\..\src\fltk3images\BMPImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_File_Icon2.cxx
+SOURCE=..\..\src\fltk3images\FileIcon2.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_GIF_Image.cxx
+SOURCE=..\..\src\fltk3images\GIFImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_Help_Dialog.cxx
+SOURCE=..\..\src\fltk3images\HelpDialog.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_JPEG_Image.cxx
+SOURCE=..\..\src\fltk3images\images_core.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_PNG_Image.cxx
+SOURCE=..\..\src\fltk3images\JPEGImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\Fl_PNM_Image.cxx
+SOURCE=..\..\src\fltk3images\PNGImage.cxx
 # End Source File
 # Begin Source File
 
-SOURCE=..\..\src\core\fl_images_core.cxx
+SOURCE=..\..\src\fltk3images\PNMImage.cxx
 # End Source File
 # End Target
 # End Project

Modified: branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj
===================================================================
--- branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/ide/Xcode4/FLTK.xcodeproj/project.pbxproj	2011-08-25 21:50:59 UTC (rev 9011)
@@ -44,103 +44,103 @@
 		F552DCC431AA40CCC6F1988A /* fltk3png.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 06A7B68E2100DB960872987D /* fltk3png.framework */; };
 		CC663664EF1FE8C4CB778028 /* fltk3jpeg.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C03975F619684D3461888340 /* fltk3jpeg.framework */; };
 		0D2A2AC958D590B51B01BBEF /* fltk3zlib.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = AFDEBB8CE5A31C066586BF8B /* fltk3zlib.framework */; };
-		69C261B5080F70C54F62E633 /* Fl_cocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BB47B6B9E3180AB7C5F16D /* Fl_cocoa.mm */; };
-		02BBCA82DFFB0AB67443CA28 /* Fl_Native_File_Chooser_MAC.mm in Sources */ = {isa = PBXBuildFile; fileRef = B23CCB736CF9A2433827C3EE /* Fl_Native_File_Chooser_MAC.mm */; };
-		B7920395FCBAAF8E46AA357D /* Fl_Quartz_Printer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 10A048C45D4667189C9F77EA /* Fl_Quartz_Printer.mm */; };
+		69C261B5080F70C54F62E633 /* cocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6BB47B6B9E3180AB7C5F16D /* cocoa.mm */; };
+		02BBCA82DFFB0AB67443CA28 /* cocoaNativeFileChooser.mm in Sources */ = {isa = PBXBuildFile; fileRef = B23CCB736CF9A2433827C3EE /* cocoaNativeFileChooser.mm */; };
+		B7920395FCBAAF8E46AA357D /* cocoaQuartzPrinter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 10A048C45D4667189C9F77EA /* cocoaQuartzPrinter.mm */; };
 		008DDC0F32A31B4ADA34594C /* run.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 81045D024AA56D9CD81C23A2 /* run.cxx */; };
-		2271ACEBB4FBB71C4086EF24 /* Fl_Adjuster.cxx in Sources */ = {isa = PBXBuildFile; fileRef = ECEA64F2B2C5C5186949AD76 /* Fl_Adjuster.cxx */; };
-		87F292EDA50F45BFAEA18EC5 /* Fl_Bitmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D68004A5D4D7878F2E22B59B /* Fl_Bitmap.cxx */; };
-		D3D9C65EBA0726B45E8C7725 /* Fl_Box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 81608512CDA5C11B35A2B539 /* Fl_Box.cxx */; };
-		F343A0DF04697626857BF06F /* Fl_Browser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5CE1FF6EF6F9500754C22170 /* Fl_Browser.cxx */; };
-		9036C344E82AED76B425415E /* Fl_Browser_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2FC85E98AAFBF45C8EBBA1CC /* Fl_Browser_.cxx */; };
-		C96803EEF2B850B58A9507D0 /* Fl_Browser_load.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B89AE0F97A9095F4A064E6FF /* Fl_Browser_load.cxx */; };
-		DE2BB5133CF2CD996D632F84 /* Fl_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 70F960885035F13513E45EFD /* Fl_Button.cxx */; };
-		B0CAF4D1559C6E98DFCA17AA /* Fl_Chart.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 392500313F9EDFBFE2786E57 /* Fl_Chart.cxx */; };
-		37D83B9E1067EB10D83CC630 /* Fl_Check_Browser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F6EC011E63665A01E72E52E7 /* Fl_Check_Browser.cxx */; };
-		B34F20AC44C7BD06F37A17B1 /* Fl_Check_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 490C9DC52EF4532CC9795A6D /* Fl_Check_Button.cxx */; };
-		16189C3260E6F7081DBD4A2E /* Fl_Choice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6356BFF275FE7996D8F77F5C /* Fl_Choice.cxx */; };
-		4BB964893254F77B4DCAD9BA /* Fl_Clock.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1C4F7DBF0BD658A6D786280A /* Fl_Clock.cxx */; };
-		2D847DBF09E5D4E252345529 /* Fl_Color_Chooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4CF353D8CC1FA86010629419 /* Fl_Color_Chooser.cxx */; };
-		B2BB321C79B8EA57F4A99288 /* Fl_Counter.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 96D41530A69F4A84DBF7E11E /* Fl_Counter.cxx */; };
-		B1AB3E6CE018D5319F0CB1D8 /* Fl_Device.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CB4EA8042D07755CEA64E9FB /* Fl_Device.cxx */; };
-		1369E7ADCB6604667B063564 /* Fl_Dial.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FDB4072264224B4391CAB607 /* Fl_Dial.cxx */; };
-		43FA5D816EDA82E015727381 /* Fl_Double_Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D65E879CEE1870B6B73853BC /* Fl_Double_Window.cxx */; };
-		ECCA6DC4547C114D5390C8D1 /* Fl_File_Browser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 31B32445C4ECC6487D814264 /* Fl_File_Browser.cxx */; };
-		049EB01300A5C030D1DB2191 /* Fl_File_Chooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E74C762F7266F6B35BA2394A /* Fl_File_Chooser.cxx */; };
-		17819EFD092EC34847FF9A97 /* Fl_File_Chooser2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A7770A7FB7C79371A3BFB46C /* Fl_File_Chooser2.cxx */; };
-		3DCD457D7AD4CA90D9EE4246 /* Fl_File_Icon.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 19FA31AEDEFAC11C8EC5D035 /* Fl_File_Icon.cxx */; };
-		8F4CA13F0135C8D93D647078 /* Fl_File_Input.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D05F5EBC3B022A7C99F2DDC2 /* Fl_File_Input.cxx */; };
-		99FB64087ED252BA31644F95 /* Fl_Group.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A5952FB986701638B15F1B22 /* Fl_Group.cxx */; };
-		5D0D1C842A3CAF02C4878E5E /* Fl_Help_View.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 047B650C9F322D0CB49D48D6 /* Fl_Help_View.cxx */; };
-		DE9BFEBCD61D5BBA51D3A983 /* Fl_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E01E16F15C6443D98C32F5F6 /* Fl_Image.cxx */; };
-		1DC72F81E67D26EFC91CC055 /* Fl_Input.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 184F621088E304BDFD7A0384 /* Fl_Input.cxx */; };
-		22D481051F2975C6708B7A5C /* Fl_Input_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A892461439BFF8FC2D538E50 /* Fl_Input_.cxx */; };
-		EDFFE30ABACE77AB818EFD3C /* Fl_Light_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 36C72097C9A86A33861ACD51 /* Fl_Light_Button.cxx */; };
-		FB4C03114DD7FD4E21C93B23 /* Fl_Menu.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4672B51C8F8B9C0703D7EAA5 /* Fl_Menu.cxx */; };
-		24D6615263A30D0055EEA9CD /* Fl_Menu_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DE9E57A22E45C3039D820566 /* Fl_Menu_.cxx */; };
-		BD7AE3AEC270BBF97D63A102 /* Fl_Menu_Bar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 265C00BF9D9598D2A10BE42A /* Fl_Menu_Bar.cxx */; };
-		1EC305B74A27DF994486CAEA /* Fl_Menu_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 58FD2064B2C854618D2E68DB /* Fl_Menu_Button.cxx */; };
-		63C8599959CBD6D392A98548 /* Fl_Menu_Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CBE03F81CF8A43E9735AEFC9 /* Fl_Menu_Window.cxx */; };
-		A5B4D789DF000BBCCFC14069 /* Fl_Menu_add.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C649ABF1BD8B5FB41539FB5F /* Fl_Menu_add.cxx */; };
-		6C148F335D573FA11E171DE8 /* Fl_Menu_global.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 25D17230FC589A55DA9C6F23 /* Fl_Menu_global.cxx */; };
-		46A6752E2DC6F11255C93484 /* Fl_Multi_Label.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 37D57C7D98BB88CE1A3BFC20 /* Fl_Multi_Label.cxx */; };
-		B30D6189F1765784376B6779 /* Fl_Native_File_Chooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FC634C34D16F1DE6EF923847 /* Fl_Native_File_Chooser.cxx */; };
-		5857DE8B16828A0F93032DB4 /* Fl_Overlay_Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CEF1A66A542A208607C52832 /* Fl_Overlay_Window.cxx */; };
-		5C93DA8482716333763AA2F8 /* Fl_Pack.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0F0129FF3753E991F59B9FB5 /* Fl_Pack.cxx */; };
-		BFD45A930F841AB6663EB28F /* Fl_Paged_Device.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 680EF039247E0C542AD802F6 /* Fl_Paged_Device.cxx */; };
-		EBD658967C0EF993B55D8A75 /* Fl_Pixmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9AEB93657A00F78B2046454D /* Fl_Pixmap.cxx */; };
-		7878131091565BEFA0E1E765 /* Fl_Positioner.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9EB992B1957E27AE06A07426 /* Fl_Positioner.cxx */; };
-		C759F61877A5D20EDBD7488D /* Fl_Printer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 53F2F9DED1C91758A21D0246 /* Fl_Printer.cxx */; };
-		96257899A0D5C1733FAC5200 /* Fl_Preferences.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 596103743F0CE2A89B7B3FA5 /* Fl_Preferences.cxx */; };
-		486D31DD278E2C5144B6284E /* Fl_Progress.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B62169E8816659E5E6E4DD9F /* Fl_Progress.cxx */; };
-		4E4DEB0F11A0E7ABB682FBAF /* Fl_Repeat_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F2E611B0C2D8C53DD06946BC /* Fl_Repeat_Button.cxx */; };
-		5B4F6F77241A0B089DCE19F1 /* Fl_Return_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 69E296C029FB3078A82EE913 /* Fl_Return_Button.cxx */; };
-		01570F259A52D752DA170772 /* Fl_Roller.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A5526E662D03F4C9647C13A4 /* Fl_Roller.cxx */; };
-		F32B3FAD40F0004FFA6158E3 /* Fl_Round_Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5DA33AF375B975EBBE824A96 /* Fl_Round_Button.cxx */; };
-		B506EE63710A08EC82B52F62 /* Fl_Scroll.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 135F7AE45CBDAA49D80BB12D /* Fl_Scroll.cxx */; };
-		5622DE2929FDB9DBF1607BC6 /* Fl_Scrollbar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6F7BEB35272214B6167B1FB8 /* Fl_Scrollbar.cxx */; };
-		7CB9D27B0F1CE28C828F280B /* Fl_Shared_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8580401C9D38395ECAD127AC /* Fl_Shared_Image.cxx */; };
-		550F71EE23A3D8E00A890F88 /* Fl_Single_Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 17A03BA54D8D67397D8BDCEE /* Fl_Single_Window.cxx */; };
-		052ACB65AAC112E4DFA7B7C1 /* Fl_Slider.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 085FAF82201B9FD1927A8BAA /* Fl_Slider.cxx */; };
+		2271ACEBB4FBB71C4086EF24 /* Adjuster.cxx in Sources */ = {isa = PBXBuildFile; fileRef = ECEA64F2B2C5C5186949AD76 /* Adjuster.cxx */; };
+		87F292EDA50F45BFAEA18EC5 /* Bitmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D68004A5D4D7878F2E22B59B /* Bitmap.cxx */; };
+		D3D9C65EBA0726B45E8C7725 /* Box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 81608512CDA5C11B35A2B539 /* Box.cxx */; };
+		F343A0DF04697626857BF06F /* Browser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5CE1FF6EF6F9500754C22170 /* Browser.cxx */; };
+		9036C344E82AED76B425415E /* Browser_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2FC85E98AAFBF45C8EBBA1CC /* Browser_.cxx */; };
+		C96803EEF2B850B58A9507D0 /* Browser_load.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B89AE0F97A9095F4A064E6FF /* Browser_load.cxx */; };
+		DE2BB5133CF2CD996D632F84 /* Button.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 70F960885035F13513E45EFD /* Button.cxx */; };
+		B0CAF4D1559C6E98DFCA17AA /* Chart.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 392500313F9EDFBFE2786E57 /* Chart.cxx */; };
+		37D83B9E1067EB10D83CC630 /* CheckBrowser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F6EC011E63665A01E72E52E7 /* CheckBrowser.cxx */; };
+		B34F20AC44C7BD06F37A17B1 /* CheckButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 490C9DC52EF4532CC9795A6D /* CheckButton.cxx */; };
+		16189C3260E6F7081DBD4A2E /* Choice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6356BFF275FE7996D8F77F5C /* Choice.cxx */; };
+		4BB964893254F77B4DCAD9BA /* Clock.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1C4F7DBF0BD658A6D786280A /* Clock.cxx */; };
+		2D847DBF09E5D4E252345529 /* ColorChooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4CF353D8CC1FA86010629419 /* ColorChooser.cxx */; };
+		B2BB321C79B8EA57F4A99288 /* Counter.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 96D41530A69F4A84DBF7E11E /* Counter.cxx */; };
+		B1AB3E6CE018D5319F0CB1D8 /* Device.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CB4EA8042D07755CEA64E9FB /* Device.cxx */; };
+		1369E7ADCB6604667B063564 /* Dial.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FDB4072264224B4391CAB607 /* Dial.cxx */; };
+		43FA5D816EDA82E015727381 /* DoubleWindow.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D65E879CEE1870B6B73853BC /* DoubleWindow.cxx */; };
+		ECCA6DC4547C114D5390C8D1 /* FileBrowser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 31B32445C4ECC6487D814264 /* FileBrowser.cxx */; };
+		049EB01300A5C030D1DB2191 /* FileChooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E74C762F7266F6B35BA2394A /* FileChooser.cxx */; };
+		17819EFD092EC34847FF9A97 /* FileChooser2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A7770A7FB7C79371A3BFB46C /* FileChooser2.cxx */; };
+		3DCD457D7AD4CA90D9EE4246 /* FileIcon.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 19FA31AEDEFAC11C8EC5D035 /* FileIcon.cxx */; };
+		8F4CA13F0135C8D93D647078 /* FileInput.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D05F5EBC3B022A7C99F2DDC2 /* FileInput.cxx */; };
+		99FB64087ED252BA31644F95 /* Group.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A5952FB986701638B15F1B22 /* Group.cxx */; };
+		5D0D1C842A3CAF02C4878E5E /* HelpView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 047B650C9F322D0CB49D48D6 /* HelpView.cxx */; };
+		DE9BFEBCD61D5BBA51D3A983 /* Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E01E16F15C6443D98C32F5F6 /* Image.cxx */; };
+		1DC72F81E67D26EFC91CC055 /* Input.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 184F621088E304BDFD7A0384 /* Input.cxx */; };
+		22D481051F2975C6708B7A5C /* Input_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A892461439BFF8FC2D538E50 /* Input_.cxx */; };
+		EDFFE30ABACE77AB818EFD3C /* LightButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 36C72097C9A86A33861ACD51 /* LightButton.cxx */; };
+		FB4C03114DD7FD4E21C93B23 /* Menu.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4672B51C8F8B9C0703D7EAA5 /* Menu.cxx */; };
+		24D6615263A30D0055EEA9CD /* Menu_.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DE9E57A22E45C3039D820566 /* Menu_.cxx */; };
+		BD7AE3AEC270BBF97D63A102 /* MenuBar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 265C00BF9D9598D2A10BE42A /* MenuBar.cxx */; };
+		1EC305B74A27DF994486CAEA /* MenuButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 58FD2064B2C854618D2E68DB /* MenuButton.cxx */; };
+		63C8599959CBD6D392A98548 /* MenuWindow.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CBE03F81CF8A43E9735AEFC9 /* MenuWindow.cxx */; };
+		A5B4D789DF000BBCCFC14069 /* Menu_add.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C649ABF1BD8B5FB41539FB5F /* Menu_add.cxx */; };
+		6C148F335D573FA11E171DE8 /* Menu_global.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 25D17230FC589A55DA9C6F23 /* Menu_global.cxx */; };
+		46A6752E2DC6F11255C93484 /* MultiLabel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 37D57C7D98BB88CE1A3BFC20 /* MultiLabel.cxx */; };
+		B30D6189F1765784376B6779 /* NativeFileChooser.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FC634C34D16F1DE6EF923847 /* NativeFileChooser.cxx */; };
+		5857DE8B16828A0F93032DB4 /* OverlayWindow.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CEF1A66A542A208607C52832 /* OverlayWindow.cxx */; };
+		5C93DA8482716333763AA2F8 /* PackedGroup.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0F0129FF3753E991F59B9FB5 /* PackedGroup.cxx */; };
+		BFD45A930F841AB6663EB28F /* PagedDevice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 680EF039247E0C542AD802F6 /* PagedDevice.cxx */; };
+		EBD658967C0EF993B55D8A75 /* Pixmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9AEB93657A00F78B2046454D /* Pixmap.cxx */; };
+		7878131091565BEFA0E1E765 /* Positioner.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9EB992B1957E27AE06A07426 /* Positioner.cxx */; };
+		C759F61877A5D20EDBD7488D /* Printer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 53F2F9DED1C91758A21D0246 /* Printer.cxx */; };
+		96257899A0D5C1733FAC5200 /* Preferences.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 596103743F0CE2A89B7B3FA5 /* Preferences.cxx */; };
+		486D31DD278E2C5144B6284E /* Progress.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B62169E8816659E5E6E4DD9F /* Progress.cxx */; };
+		4E4DEB0F11A0E7ABB682FBAF /* RepeatButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F2E611B0C2D8C53DD06946BC /* RepeatButton.cxx */; };
+		5B4F6F77241A0B089DCE19F1 /* ReturnButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 69E296C029FB3078A82EE913 /* ReturnButton.cxx */; };
+		01570F259A52D752DA170772 /* Roller.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A5526E662D03F4C9647C13A4 /* Roller.cxx */; };
+		F32B3FAD40F0004FFA6158E3 /* RoundButton.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5DA33AF375B975EBBE824A96 /* RoundButton.cxx */; };
+		B506EE63710A08EC82B52F62 /* ScrollGroup.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 135F7AE45CBDAA49D80BB12D /* ScrollGroup.cxx */; };
+		5622DE2929FDB9DBF1607BC6 /* Scrollbar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6F7BEB35272214B6167B1FB8 /* Scrollbar.cxx */; };
+		7CB9D27B0F1CE28C828F280B /* SharedImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8580401C9D38395ECAD127AC /* SharedImage.cxx */; };
+		550F71EE23A3D8E00A890F88 /* SingleWindow.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 17A03BA54D8D67397D8BDCEE /* SingleWindow.cxx */; };
+		052ACB65AAC112E4DFA7B7C1 /* Slider.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 085FAF82201B9FD1927A8BAA /* Slider.cxx */; };
 		195134865585E031DF857E7B /* Style.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CAA3AD964456E0912791C783 /* Style.cxx */; };
-		B7E4B117D093ED504AD5127B /* Fl_Sys_Menu_Bar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 43C12A4D372777B2307220CC /* Fl_Sys_Menu_Bar.cxx */; };
-		E0D6CAE34DC85454B5C61EBA /* Fl_Table.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 025842431942A90D06F5BCFA /* Fl_Table.cxx */; };
-		56C8DD01C98608D164F2047B /* Fl_Table_Row.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7097EA09B5B8FCFEEBE28CA8 /* Fl_Table_Row.cxx */; };
-		135F22ECC6C16457F223E1EA /* Fl_Tabs.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7712638143B8C0B51FF6A61B /* Fl_Tabs.cxx */; };
-		1ABCEAD8830736E549D56A9B /* Fl_Text_Buffer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8867A20B30D85F73D157D617 /* Fl_Text_Buffer.cxx */; };
-		9B43466674ACFD80CF1A44C7 /* Fl_Text_Display.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E5E1DA87EC62BC799411CDB9 /* Fl_Text_Display.cxx */; };
-		038A56E9E529AB24D59EF7FA /* Fl_Text_Editor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5995AACC387B26DECEE88139 /* Fl_Text_Editor.cxx */; };
-		45E744C6C36FBC067F9F04EE /* Fl_Tile.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A3F6667DE920CB42ED6E95FC /* Fl_Tile.cxx */; };
-		E9D3E58E4CCE649FB2BC43EA /* Fl_Tiled_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4C92BA7B6F3DA54449388F69 /* Fl_Tiled_Image.cxx */; };
-		90FFE6AA9003A62E1983C991 /* Fl_Tooltip.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 22CA4A41B4BF6D6AF6A6F244 /* Fl_Tooltip.cxx */; };
-		681483153D73620EAA36873D /* Fl_Tree.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 214492E971DD58A3EF8FEAA3 /* Fl_Tree.cxx */; };
-		9A57CF11DB2955C7BAEF98A7 /* Fl_Tree_Item.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D9F29791281BE27706AB7E8E /* Fl_Tree_Item.cxx */; };
-		D2A374205A2262B571A051DE /* Fl_Tree_Item_Array.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D6CBFFFA62847DACFACE5284 /* Fl_Tree_Item_Array.cxx */; };
-		68CC4C366A163EBBBCEE853E /* Fl_Tree_Prefs.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CFFE37EE7360FD052E7B592D /* Fl_Tree_Prefs.cxx */; };
-		4A519B4F241D15A3DA6D3231 /* Fl_Valuator.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 35EB53B1A2D1EF0E37A4970E /* Fl_Valuator.cxx */; };
-		BD78190E42585FD6B71AFEDA /* Fl_Value_Input.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1685625EE3C5677F29D7D314 /* Fl_Value_Input.cxx */; };
-		7E26A26E1E0FE997255F67D7 /* Fl_Value_Output.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7553A0E747824E627DB0DDE5 /* Fl_Value_Output.cxx */; };
-		00BFB74D5BC12A94AFF72C8E /* Fl_Value_Slider.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 07F5E789A6A94E38E46B9744 /* Fl_Value_Slider.cxx */; };
-		C8308863B421AD33C5442423 /* Fl_Widget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C5F5E189BBE256A698ADF418 /* Fl_Widget.cxx */; };
-		EAFF1F86C4BFCA7C8FCCEA28 /* Fl_Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8E1A3A4FC6492F080AF48D54 /* Fl_Window.cxx */; };
-		C62F4F9E13B7E78D46033106 /* Fl_Window_fullscreen.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7679F6CC5391C705D9B921DA /* Fl_Window_fullscreen.cxx */; };
-		A76E032AD9B13380163BB493 /* Fl_Window_hotspot.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B5E58AC3929D3ADCBE238301 /* Fl_Window_hotspot.cxx */; };
-		E373B7F46315E6D1F6D255E9 /* Fl_Window_iconize.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C34CF806FAE9E39DDFD23D3B /* Fl_Window_iconize.cxx */; };
-		72DEB4A9569C0F11C103EF90 /* Fl_Wizard.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A84F18440208B2AA809D2871 /* Fl_Wizard.cxx */; };
-		F4974EC29CF042D6AEB0CC0D /* Fl_XBM_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9A21D7EDE35664C4B0EDD969 /* Fl_XBM_Image.cxx */; };
-		A7891F57744007954D70C5D4 /* Fl_XPM_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 302A3FA8AB59DE7E5255E28C /* Fl_XPM_Image.cxx */; };
-		230F7BA09DDFC95489B89DFF /* Fl_abort.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 671B96BA5D85D5C6EE31AB76 /* Fl_abort.cxx */; };
-		EC8E6A4EA73A26BEEC330000 /* Fl_add_idle.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1821AF479F52B67539CB0CF8 /* Fl_add_idle.cxx */; };
-		A87E247AEEF22DCE6B7DFEE1 /* Fl_arg.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8E5EB755BAF13FB15109FC0C /* Fl_arg.cxx */; };
-		867ED2B31C3F415ACBA63053 /* Fl_compose.cxx in Sources */ = {isa = PBXBuildFile; fileRef = AA048ACBE220E831739595BD /* Fl_compose.cxx */; };
-		EF8285FB887728A6F7E61B8A /* Fl_display.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 44287148E62E709880C4EA41 /* Fl_display.cxx */; };
-		11ADE417F14FF9E2EE8083CE /* Fl_get_key.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A8DC358A8390A493A9A8AE55 /* Fl_get_key.cxx */; };
-		05360A3851265C0F5DE74075 /* Fl_get_system_colors.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FEADB63E5C237A827884C5C5 /* Fl_get_system_colors.cxx */; };
-		DF2B279A7C6E4D9B1DAF6A30 /* Fl_grab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 76AA6E6C769FB157F8125874 /* Fl_grab.cxx */; };
-		F08C8B0E65A2E77417682E0C /* Fl_lock.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7FAC51832563F8B044E55B90 /* Fl_lock.cxx */; };
-		D93BEFC63736CECDC57C91B9 /* Fl_own_colormap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 013DBB50198366613C31E2A9 /* Fl_own_colormap.cxx */; };
-		D57FBCFB72B5E577A7F80562 /* Fl_visual.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1626800F2D2DF61E9E2468DD /* Fl_visual.cxx */; };
-		D90075982F3B0CDB0EF91A73 /* Fl_x.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F285310A7BD8D88F965104C8 /* Fl_x.cxx */; };
+		B7E4B117D093ED504AD5127B /* SysMenuBar.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 43C12A4D372777B2307220CC /* SysMenuBar.cxx */; };
+		E0D6CAE34DC85454B5C61EBA /* Table.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 025842431942A90D06F5BCFA /* Table.cxx */; };
+		56C8DD01C98608D164F2047B /* TableRow.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7097EA09B5B8FCFEEBE28CA8 /* TableRow.cxx */; };
+		135F22ECC6C16457F223E1EA /* TabGroup.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7712638143B8C0B51FF6A61B /* TabGroup.cxx */; };
+		1ABCEAD8830736E549D56A9B /* TextBuffer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8867A20B30D85F73D157D617 /* TextBuffer.cxx */; };
+		9B43466674ACFD80CF1A44C7 /* TextDisplay.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E5E1DA87EC62BC799411CDB9 /* TextDisplay.cxx */; };
+		038A56E9E529AB24D59EF7FA /* TextEditor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5995AACC387B26DECEE88139 /* TextEditor.cxx */; };
+		45E744C6C36FBC067F9F04EE /* TiledGroup.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A3F6667DE920CB42ED6E95FC /* TiledGroup.cxx */; };
+		E9D3E58E4CCE649FB2BC43EA /* TiledImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 4C92BA7B6F3DA54449388F69 /* TiledImage.cxx */; };
+		90FFE6AA9003A62E1983C991 /* Tooltip.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 22CA4A41B4BF6D6AF6A6F244 /* Tooltip.cxx */; };
+		681483153D73620EAA36873D /* Tree.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 214492E971DD58A3EF8FEAA3 /* Tree.cxx */; };
+		9A57CF11DB2955C7BAEF98A7 /* TreeItem.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D9F29791281BE27706AB7E8E /* TreeItem.cxx */; };
+		D2A374205A2262B571A051DE /* TreeItemArray.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D6CBFFFA62847DACFACE5284 /* TreeItemArray.cxx */; };
+		68CC4C366A163EBBBCEE853E /* TreePrefs.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CFFE37EE7360FD052E7B592D /* TreePrefs.cxx */; };
+		4A519B4F241D15A3DA6D3231 /* Valuator.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 35EB53B1A2D1EF0E37A4970E /* Valuator.cxx */; };
+		BD78190E42585FD6B71AFEDA /* ValueInput.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1685625EE3C5677F29D7D314 /* ValueInput.cxx */; };
+		7E26A26E1E0FE997255F67D7 /* ValueOutput.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7553A0E747824E627DB0DDE5 /* ValueOutput.cxx */; };
+		00BFB74D5BC12A94AFF72C8E /* ValueSlider.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 07F5E789A6A94E38E46B9744 /* ValueSlider.cxx */; };
+		C8308863B421AD33C5442423 /* Widget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C5F5E189BBE256A698ADF418 /* Widget.cxx */; };
+		EAFF1F86C4BFCA7C8FCCEA28 /* Window.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8E1A3A4FC6492F080AF48D54 /* Window.cxx */; };
+		C62F4F9E13B7E78D46033106 /* Window_fullscreen.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7679F6CC5391C705D9B921DA /* Window_fullscreen.cxx */; };
+		A76E032AD9B13380163BB493 /* Window_hotspot.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B5E58AC3929D3ADCBE238301 /* Window_hotspot.cxx */; };
+		E373B7F46315E6D1F6D255E9 /* Window_iconize.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C34CF806FAE9E39DDFD23D3B /* Window_iconize.cxx */; };
+		72DEB4A9569C0F11C103EF90 /* Wizard.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A84F18440208B2AA809D2871 /* Wizard.cxx */; };
+		F4974EC29CF042D6AEB0CC0D /* XBMImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 9A21D7EDE35664C4B0EDD969 /* XBMImage.cxx */; };
+		A7891F57744007954D70C5D4 /* XPMImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 302A3FA8AB59DE7E5255E28C /* XPMImage.cxx */; };
+		230F7BA09DDFC95489B89DFF /* abort.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 671B96BA5D85D5C6EE31AB76 /* abort.cxx */; };
+		EC8E6A4EA73A26BEEC330000 /* add_idle.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1821AF479F52B67539CB0CF8 /* add_idle.cxx */; };
+		A87E247AEEF22DCE6B7DFEE1 /* arg.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8E5EB755BAF13FB15109FC0C /* arg.cxx */; };
+		867ED2B31C3F415ACBA63053 /* compose.cxx in Sources */ = {isa = PBXBuildFile; fileRef = AA048ACBE220E831739595BD /* compose.cxx */; };
+		EF8285FB887728A6F7E61B8A /* display.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 44287148E62E709880C4EA41 /* display.cxx */; };
+		11ADE417F14FF9E2EE8083CE /* get_key.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A8DC358A8390A493A9A8AE55 /* get_key.cxx */; };
+		05360A3851265C0F5DE74075 /* get_system_colors.cxx in Sources */ = {isa = PBXBuildFile; fileRef = FEADB63E5C237A827884C5C5 /* get_system_colors.cxx */; };
+		DF2B279A7C6E4D9B1DAF6A30 /* grab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 76AA6E6C769FB157F8125874 /* grab.cxx */; };
+		F08C8B0E65A2E77417682E0C /* lock.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7FAC51832563F8B044E55B90 /* lock.cxx */; };
+		D93BEFC63736CECDC57C91B9 /* own_colormap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 013DBB50198366613C31E2A9 /* own_colormap.cxx */; };
+		D57FBCFB72B5E577A7F80562 /* visual.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1626800F2D2DF61E9E2468DD /* visual.cxx */; };
+		D90075982F3B0CDB0EF91A73 /* x11.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F285310A7BD8D88F965104C8 /* x11.cxx */; };
 		AABCD2111137745B5B24F9F8 /* filename_absolute.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 04A6409B52D5A99617606460 /* filename_absolute.cxx */; };
 		B1C7F80015E458B01ED0339C /* filename_expand.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F9F779F221E630EE4A837595 /* filename_expand.cxx */; };
 		80D7B46EAB946A01968CCDF8 /* filename_ext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 210616B209B714E918A5CD3B /* filename_ext.cxx */; };
@@ -148,46 +148,46 @@
 		8C352F4250261E6F42F1FA19 /* filename_list.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F08599CCE19B1640395AB3D0 /* filename_list.cxx */; };
 		BF87576CF80F55DD7380B991 /* filename_match.cxx in Sources */ = {isa = PBXBuildFile; fileRef = AB171A4BF938A263E10FD0AD /* filename_match.cxx */; };
 		53ADEE51DE5FEEEB4A79CA21 /* filename_setext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 003AA96B03F174957585B088 /* filename_setext.cxx */; };
-		CF3BDDBED0526F9FB4C8A1D2 /* fl_arc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 876B6A633C2E666DFC3119DD /* fl_arc.cxx */; };
-		3C758F19560BBB0931A7A741 /* fl_arci.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E52CB16DD470DA22063934AA /* fl_arci.cxx */; };
-		F10B0DD63132D694D8879B1C /* fl_ask.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 60E7DD739D5DDBD766E2E30F /* fl_ask.cxx */; };
-		7CD1A5049849133DFB39DF46 /* fl_boxtype.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BC14596F24E305FE8CE39DAF /* fl_boxtype.cxx */; };
-		36978A2B5576E54EDA3F8D90 /* fl_call_main.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8B35EF2F662F706A2B46BDD7 /* fl_call_main.cxx */; };
-		E5A3C2482B9E218F550D91DA /* fl_color.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 02716487EA5E04A784DE5A34 /* fl_color.cxx */; };
-		79967B56F476337DA7A830CF /* fl_cursor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C832D220ECF843E28FBAFED8 /* fl_cursor.cxx */; };
-		B234111841F3CC33C32E75A1 /* fl_curve.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 53EC964ED2E6DE4CBF80B206 /* fl_curve.cxx */; };
-		2BF486109B69CFEFB5C7950E /* fl_diamond_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5557266E1C9D440172D5DF09 /* fl_diamond_box.cxx */; };
-		207AE6E5DDC5DE3F30896F39 /* fl_dnd.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D1E006BE295C0F88A8E51304 /* fl_dnd.cxx */; };
-		363F858BE2E0007242350184 /* fl_draw.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3CF0F8B538EFFF602D6549B0 /* fl_draw.cxx */; };
-		F546A37A0957B9108A3E4227 /* fl_draw_image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F608DA64A6A66C65E7494BEA /* fl_draw_image.cxx */; };
-		30E10499346406FB87A5DD43 /* fl_draw_pixmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B6E2BA6C16F8BB32016C0FF0 /* fl_draw_pixmap.cxx */; };
-		DE48D54427106D76FDA1F6E0 /* fl_encoding_latin1.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0BEBF5A734CD2113BB6BDA08 /* fl_encoding_latin1.cxx */; };
-		ABB49E921AA98E86EBD8142A /* fl_encoding_mac_roman.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C2BF9CDFAB8BFEF23768C51B /* fl_encoding_mac_roman.cxx */; };
-		15FDFD86D6D450F2C221FBAC /* fl_engraved_label.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0522E1C24273419B45EF1B4D /* fl_engraved_label.cxx */; };
-		EB81F3881B64050C7D312740 /* fl_file_dir.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1BF9BBF497705FBAD92797FF /* fl_file_dir.cxx */; };
-		C9F44B469D5C83AAB89600F8 /* fl_font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1CFFB72AB54D6FECF9F0C89C /* fl_font.cxx */; };
-		EFCDA004289805697F6CF4B9 /* fl_gtk.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E3303C9AB8380CF95C000D0C /* fl_gtk.cxx */; };
-		4598BB77D7E3CBFC61C56140 /* fl_labeltype.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 95F43A2D694782E841E90C3A /* fl_labeltype.cxx */; };
-		A59E78B843DA2C7D12D49294 /* fl_line_style.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5FD374C4251D84126390EEE5 /* fl_line_style.cxx */; };
-		BE74DB334A51DD19B62B76EB /* fl_open_uri.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5515C9CC733AC9F36A9B7E06 /* fl_open_uri.cxx */; };
-		61BF99BBD1D18251E0170B8A /* fl_oval_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 554EB8945D959B0EF565327A /* fl_oval_box.cxx */; };
-		C4F171DDF768A7556A684B76 /* fl_overlay.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5536CF5142F45E75898D00BA /* fl_overlay.cxx */; };
-		305944C743B9FD0B34805326 /* fl_overlay_visual.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3132F0163EFDF4289F20DB50 /* fl_overlay_visual.cxx */; };
-		40F29FD83CE6117394258FAB /* fl_plastic.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D9934C34F12FADA862D201D1 /* fl_plastic.cxx */; };
-		C91AB9ACD12BB4B352A00338 /* fl_read_image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1FA85C8068154A53598C9B19 /* fl_read_image.cxx */; };
-		39238B4623BCF68FDA9EE223 /* fl_rect.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 82F1E1FCCD3708EA48A6FD1B /* fl_rect.cxx */; };
-		FE83B31EEE58493BD243B8C2 /* fl_round_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C791DFA1DA864C8105CA92D3 /* fl_round_box.cxx */; };
-		AD0B8E3D9E97E625C55B967F /* fl_rounded_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 557E80414B985272F1C0F5BE /* fl_rounded_box.cxx */; };
-		FCAEAB49DE121D3D2138610D /* fl_scroll_area.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0E08EA1CF945ADA843805A2C /* fl_scroll_area.cxx */; };
-		2952645AF2A836D88ADA48F9 /* fl_set_font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C7ED2C14E31F1142DDCAC057 /* fl_set_font.cxx */; };
-		83BEAD361BB7BC2CD030A36B /* fl_set_fonts.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 22603052464D0ADEFA96A7E6 /* fl_set_fonts.cxx */; };
-		03E51C6144E06D2161CDE5EB /* fl_shadow_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2C5EEC8910127EC66EEA73B1 /* fl_shadow_box.cxx */; };
-		1915B2B4724B8826C53616C9 /* fl_shortcut.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BFCE21B11BD00816E2D65029 /* fl_shortcut.cxx */; };
-		CA982582F5FA39ED7D7118DA /* fl_show_colormap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 76D6638ABB7D955E0B149360 /* fl_show_colormap.cxx */; };
-		3F497BC168C63621AB680203 /* fl_symbols.cxx in Sources */ = {isa = PBXBuildFile; fileRef = ECAFDF98E362617FA9E2B887 /* fl_symbols.cxx */; };
-		E05DB01E716C969FB0A9984E /* fl_utf8.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C82D09C9EB356BF14388A904 /* fl_utf8.cxx */; };
-		DBA6ED75DC142BE30D95B619 /* fl_utf.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 574878A10D223037009BD0DE /* fl_utf.cxx */; };
-		0DA673401BF6865FFFEF7D18 /* fl_vertex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6C74D84D95E5167E6D41A606 /* fl_vertex.cxx */; };
+		CF3BDDBED0526F9FB4C8A1D2 /* arc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 876B6A633C2E666DFC3119DD /* arc.cxx */; };
+		3C758F19560BBB0931A7A741 /* arci.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E52CB16DD470DA22063934AA /* arci.cxx */; };
+		F10B0DD63132D694D8879B1C /* ask.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 60E7DD739D5DDBD766E2E30F /* ask.cxx */; };
+		7CD1A5049849133DFB39DF46 /* boxtype.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BC14596F24E305FE8CE39DAF /* boxtype.cxx */; };
+		36978A2B5576E54EDA3F8D90 /* call_main.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 8B35EF2F662F706A2B46BDD7 /* call_main.cxx */; };
+		E5A3C2482B9E218F550D91DA /* color.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 02716487EA5E04A784DE5A34 /* color.cxx */; };
+		79967B56F476337DA7A830CF /* cursor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C832D220ECF843E28FBAFED8 /* cursor.cxx */; };
+		B234111841F3CC33C32E75A1 /* curve.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 53EC964ED2E6DE4CBF80B206 /* curve.cxx */; };
+		2BF486109B69CFEFB5C7950E /* diamond_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5557266E1C9D440172D5DF09 /* diamond_box.cxx */; };
+		207AE6E5DDC5DE3F30896F39 /* dnd.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D1E006BE295C0F88A8E51304 /* dnd.cxx */; };
+		363F858BE2E0007242350184 /* draw.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3CF0F8B538EFFF602D6549B0 /* draw.cxx */; };
+		F546A37A0957B9108A3E4227 /* draw_image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = F608DA64A6A66C65E7494BEA /* draw_image.cxx */; };
+		30E10499346406FB87A5DD43 /* draw_pixmap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = B6E2BA6C16F8BB32016C0FF0 /* draw_pixmap.cxx */; };
+		DE48D54427106D76FDA1F6E0 /* encoding_latin1.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0BEBF5A734CD2113BB6BDA08 /* encoding_latin1.cxx */; };
+		ABB49E921AA98E86EBD8142A /* encoding_mac_roman.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C2BF9CDFAB8BFEF23768C51B /* encoding_mac_roman.cxx */; };
+		15FDFD86D6D450F2C221FBAC /* engraved_label.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0522E1C24273419B45EF1B4D /* engraved_label.cxx */; };
+		EB81F3881B64050C7D312740 /* file_dir.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1BF9BBF497705FBAD92797FF /* file_dir.cxx */; };
+		C9F44B469D5C83AAB89600F8 /* font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1CFFB72AB54D6FECF9F0C89C /* font.cxx */; };
+		EFCDA004289805697F6CF4B9 /* gtk.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E3303C9AB8380CF95C000D0C /* gtk.cxx */; };
+		4598BB77D7E3CBFC61C56140 /* labeltype.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 95F43A2D694782E841E90C3A /* labeltype.cxx */; };
+		A59E78B843DA2C7D12D49294 /* line_style.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5FD374C4251D84126390EEE5 /* line_style.cxx */; };
+		BE74DB334A51DD19B62B76EB /* open_uri.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5515C9CC733AC9F36A9B7E06 /* open_uri.cxx */; };
+		61BF99BBD1D18251E0170B8A /* oval_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 554EB8945D959B0EF565327A /* oval_box.cxx */; };
+		C4F171DDF768A7556A684B76 /* overlay.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 5536CF5142F45E75898D00BA /* overlay.cxx */; };
+		305944C743B9FD0B34805326 /* overlay_visual.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 3132F0163EFDF4289F20DB50 /* overlay_visual.cxx */; };
+		40F29FD83CE6117394258FAB /* plastic.cxx in Sources */ = {isa = PBXBuildFile; fileRef = D9934C34F12FADA862D201D1 /* plastic.cxx */; };
+		C91AB9ACD12BB4B352A00338 /* read_image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1FA85C8068154A53598C9B19 /* read_image.cxx */; };
+		39238B4623BCF68FDA9EE223 /* rect.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 82F1E1FCCD3708EA48A6FD1B /* rect.cxx */; };
+		FE83B31EEE58493BD243B8C2 /* round_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C791DFA1DA864C8105CA92D3 /* round_box.cxx */; };
+		AD0B8E3D9E97E625C55B967F /* rounded_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 557E80414B985272F1C0F5BE /* rounded_box.cxx */; };
+		FCAEAB49DE121D3D2138610D /* scroll_area.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0E08EA1CF945ADA843805A2C /* scroll_area.cxx */; };
+		2952645AF2A836D88ADA48F9 /* set_font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C7ED2C14E31F1142DDCAC057 /* set_font.cxx */; };
+		83BEAD361BB7BC2CD030A36B /* set_fonts.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 22603052464D0ADEFA96A7E6 /* set_fonts.cxx */; };
+		03E51C6144E06D2161CDE5EB /* shadow_box.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2C5EEC8910127EC66EEA73B1 /* shadow_box.cxx */; };
+		1915B2B4724B8826C53616C9 /* shortcut.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BFCE21B11BD00816E2D65029 /* shortcut.cxx */; };
+		CA982582F5FA39ED7D7118DA /* show_colormap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 76D6638ABB7D955E0B149360 /* show_colormap.cxx */; };
+		3F497BC168C63621AB680203 /* symbols.cxx in Sources */ = {isa = PBXBuildFile; fileRef = ECAFDF98E362617FA9E2B887 /* symbols.cxx */; };
+		E05DB01E716C969FB0A9984E /* utf8.cxx in Sources */ = {isa = PBXBuildFile; fileRef = C82D09C9EB356BF14388A904 /* utf8.cxx */; };
+		DBA6ED75DC142BE30D95B619 /* utf.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 574878A10D223037009BD0DE /* utf.cxx */; };
+		0DA673401BF6865FFFEF7D18 /* vertex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6C74D84D95E5167E6D41A606 /* vertex.cxx */; };
 		F9A99DC4E0447A57F2242B0F /* numericsort.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2286DB222E1D5D78655B21BB /* numericsort.cxx */; };
 		7B5F222AD68C2A4A4853951A /* ps_image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 472AB3970C82CB496562F422 /* ps_image.cxx */; };
 		611144BED911A91A14E629C2 /* scandir.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1E2B1DAE628CEB38A5F0E604 /* scandir.cxx */; };
@@ -197,10 +197,11 @@
 		C8A527099015E8D8C161BB93 /* case.c in Sources */ = {isa = PBXBuildFile; fileRef = 6A8D02403C9D3B785B0D8F30 /* case.c */; };
 		8DB42169A784FA421AAADA6D /* is_right2left.c in Sources */ = {isa = PBXBuildFile; fileRef = 15064F3F45361B071125C187 /* is_right2left.c */; };
 		2FAB16B417D6C7DE47534445 /* is_spacing.c in Sources */ = {isa = PBXBuildFile; fileRef = 35196210FA39F50016C06ED2 /* is_spacing.c */; };
+		6EC5A8E1F6171E20505CDA66 /* all.h in Headers */ = {isa = PBXBuildFile; fileRef = DDEC0AB0E55CB75CFA5FD9DC /* all.h */; };
+		39576718F4A718E5885D7837 /* fltk3.h in Headers */ = {isa = PBXBuildFile; fileRef = 15B1A08E928290071C92EDD1 /* fltk3.h */; };
 		757ECB76CD9272004B8A4A42 /* Adjuster.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CDC310CF438C4E007EE265B /* Adjuster.h */; };
 		CC311448876EC9C10D5614AF /* ask.h in Headers */ = {isa = PBXBuildFile; fileRef = D31DE8ACD497B8FA62A57910 /* ask.h */; };
 		72A9364B21F8DEDED9A43B9E /* Bitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 249A3332647089ACC2702523 /* Bitmap.h */; };
-		26C1F556C987C742D37CCAA4 /* BMPImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */; };
 		35DE2AD5F6204186A6545D86 /* Box.h in Headers */ = {isa = PBXBuildFile; fileRef = 0800D21F849D8F2CDB90C72D /* Box.h */; };
 		42605FAF974760B9A405E61E /* Browser_.h in Headers */ = {isa = PBXBuildFile; fileRef = 32841D65E2F82C3F24A360D2 /* Browser_.h */; };
 		7713D95988E151E950DE9A22 /* Browser.h in Headers */ = {isa = PBXBuildFile; fileRef = B8F30574865BA1A8081AF0E4 /* Browser.h */; };
@@ -233,9 +234,7 @@
 		20CBFB6F570A48CAA0751DBF /* FormsBitmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 11DF5111A6EE377DAAFDB68B /* FormsBitmap.h */; };
 		742D204F4CECC650D53AC070 /* FormsPixmap.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E62E615D0C146DBB74B477A /* FormsPixmap.h */; };
 		6A197BCC5117B3666D368B25 /* Free.h in Headers */ = {isa = PBXBuildFile; fileRef = 11F5FE43FEC401E52D4CABB7 /* Free.h */; };
-		8845649A10159ECED0C93211 /* GIFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 605121E099731EF9977E11C8 /* GIFImage.h */; };
 		5E1D236DDF180951F39D88D0 /* Group.h in Headers */ = {isa = PBXBuildFile; fileRef = 91EA037664D5A2D49603F364 /* Group.h */; };
-		F7A66B0ADC3A359551BB84FB /* HelpDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = 0925F19306CD3458397661F3 /* HelpDialog.h */; };
 		E5826346717EA4FA214A9B1B /* HelpView.h in Headers */ = {isa = PBXBuildFile; fileRef = 0CD096CD5808EADB1B646DB4 /* HelpView.h */; };
 		0CBBFB5E384976AB8AC9A2E0 /* HoldBrowser.h in Headers */ = {isa = PBXBuildFile; fileRef = CFF83CFB9E060DA4F81AE816 /* HoldBrowser.h */; };
 		C731F1AF175523B779E819E5 /* HorFillSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C8658CA906CD5A6C35FA96B /* HorFillSlider.h */; };
@@ -247,7 +246,6 @@
 		78D8944F6051F6574682C312 /* Input.h in Headers */ = {isa = PBXBuildFile; fileRef = 28D897DFA27CCC5A3933D952 /* Input.h */; };
 		6291854E45CD36763495507E /* InputChoice.h in Headers */ = {isa = PBXBuildFile; fileRef = 11C999453D2BEBD3A5B32DA4 /* InputChoice.h */; };
 		0F5897939A32668EEBBEA347 /* IntInput.h in Headers */ = {isa = PBXBuildFile; fileRef = B5CA37E08339E6D7820C0973 /* IntInput.h */; };
-		30029E6A64808C5EFEBA9CF8 /* JPEGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 60A217E0DC847E1DD7B44D49 /* JPEGImage.h */; };
 		8E35401D5E144E48E1E2E147 /* LightButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A390823203566E8B1FB4B81 /* LightButton.h */; };
 		C5C32DAEA102D25D12F86757 /* LineDial.h in Headers */ = {isa = PBXBuildFile; fileRef = D10E3F19DD8CC6A3FAA912AF /* LineDial.h */; };
 		E62C50EAAA4C4B51F3A50640 /* math.h in Headers */ = {isa = PBXBuildFile; fileRef = 6523340D0E47A3A4B3852435 /* math.h */; };
@@ -273,8 +271,6 @@
 		38C7D942581B7C5369F2AC03 /* PagedDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = C539C329532BE09B0422A23A /* PagedDevice.h */; };
 		F5061313596F1BC761AC582B /* Pixmap.h in Headers */ = {isa = PBXBuildFile; fileRef = AEF910125AE91654739457BF /* Pixmap.h */; };
 		6AFC8619DFF2FA3604F112C0 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DB3592DA82366555A66B4A /* Plugin.h */; };
-		E3127242302580ED01B769A4 /* PNGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 25BEA28581A1A97EEA1014E2 /* PNGImage.h */; };
-		CBE8880ED23DF42D5298EAAE /* PNMImage.h in Headers */ = {isa = PBXBuildFile; fileRef = EC95850E022AFDFC59E4EBC2 /* PNMImage.h */; };
 		F702DFA64620B02A76332D90 /* Positioner.h in Headers */ = {isa = PBXBuildFile; fileRef = 813FC8746075A74FEDAE447C /* Positioner.h */; };
 		ACFD331F39EEA65591D0492B /* PostScript.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A0B5BF3C5ECFAF041951029 /* PostScript.h */; };
 		987CCADF07B02BD64D159D9F /* Preferences.h in Headers */ = {isa = PBXBuildFile; fileRef = A9B88BB6C6654424E37B8082 /* Preferences.h */; };
@@ -333,9 +329,9 @@
 		92B4EB04CFFC5ECFD3F79630 /* WizardGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BD4A9C136E457CC92F9ADFE /* WizardGroup.h */; };
 		65AFEF19DE305C21D5DD6CA6 /* Wrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = DF6994452C6FD170E9507C6D /* Wrapper.h */; };
 		39A61403B387ECD58A0E92D3 /* x.h in Headers */ = {isa = PBXBuildFile; fileRef = 059505668BA88697E40E6C32 /* x.h */; };
+		E0943D9D77DD934578EBF9DF /* Xutf8.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E1B408952EFBB79A46CDE69 /* Xutf8.h */; };
 		CBE1938D51C95931483B5C48 /* XBMImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F6F453D846A6B7E8679FDAA /* XBMImage.h */; };
 		ACA9550AC903E3D31D80B160 /* XPMImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C163988CD45E6AB4710982F /* XPMImage.h */; };
-		E0943D9D77DD934578EBF9DF /* Xutf8.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E1B408952EFBB79A46CDE69 /* Xutf8.h */; };
 		CF5FA17E9AD84BE1BB907031 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 14F66311E977D66CE29024C3 /* Cocoa.framework */; };
 		E1C77AA3B54E8E48277C3538 /* GLChoice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DE5C107D549D9A4AFBEF3B60 /* GLChoice.cxx */; };
 		E8D5789A3FCFB823CBE99BDE /* GLDevicePlugin.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 391E3B0B723D3B5BEC865531 /* GLDevicePlugin.cxx */; };
@@ -361,14 +357,22 @@
 		374185370DF817EF401AD7FB /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 39E229DEF1CA3739A0890F43 /* ApplicationServices.framework */; };
 		A63A2DF4B57CC71275DAF8AC /* fltk3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C380FE76A739F296A44961 /* fltk3.framework */; };
 		3A7B08012DF761A8E2829536 /* fltk3.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 86C380FE76A739F296A44961 /* fltk3.framework */; };
-		E6582F0C45106AC28102A2E1 /* Fl_BMP_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BEBF424874FF4284B7383470 /* Fl_BMP_Image.cxx */; };
-		4527A1842C292A307AB984FD /* Fl_File_Icon2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7655FB1C9C0EEA276E0C6765 /* Fl_File_Icon2.cxx */; };
-		61475B3565DF64924AD4D896 /* Fl_GIF_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CFAC1FAE7DBA77895E2BC5E9 /* Fl_GIF_Image.cxx */; };
-		D0C372353DA3A182C063120A /* Fl_Help_Dialog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0EDA91FFA01CB06D2CD72D46 /* Fl_Help_Dialog.cxx */; };
-		633E5465D656A9961EB5A771 /* Fl_JPEG_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 771C095FF2AE4FFCACA213AB /* Fl_JPEG_Image.cxx */; };
-		6C9573986A4FFE9EE9ADFFDD /* Fl_PNG_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E1BECD1D14488DF25469A00E /* Fl_PNG_Image.cxx */; };
-		E8B17358A691471C1B2BD4D5 /* Fl_PNM_Image.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 948DEE29F3A36A2E578DD9C0 /* Fl_PNM_Image.cxx */; };
-		C99E8BD8A6A0BDDBE07EE04C /* fl_images_core.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6ADD9C72DA642E9780529588 /* fl_images_core.cxx */; };
+		E6582F0C45106AC28102A2E1 /* BMPImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = BEBF424874FF4284B7383470 /* BMPImage.cxx */; };
+		4527A1842C292A307AB984FD /* FileIcon2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7655FB1C9C0EEA276E0C6765 /* FileIcon2.cxx */; };
+		61475B3565DF64924AD4D896 /* GIFImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = CFAC1FAE7DBA77895E2BC5E9 /* GIFImage.cxx */; };
+		D0C372353DA3A182C063120A /* HelpDialog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 0EDA91FFA01CB06D2CD72D46 /* HelpDialog.cxx */; };
+		C99E8BD8A6A0BDDBE07EE04C /* images_core.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 6ADD9C72DA642E9780529588 /* images_core.cxx */; };
+		633E5465D656A9961EB5A771 /* JPEGImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 771C095FF2AE4FFCACA213AB /* JPEGImage.cxx */; };
+		6C9573986A4FFE9EE9ADFFDD /* PNGImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E1BECD1D14488DF25469A00E /* PNGImage.cxx */; };
+		E8B17358A691471C1B2BD4D5 /* PNMImage.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 948DEE29F3A36A2E578DD9C0 /* PNMImage.cxx */; };
+		8EFCC7E97421DED44B2C58AC /* all.h in Headers */ = {isa = PBXBuildFile; fileRef = 1010B13DA886270EE16E3514 /* all.h */; };
+		F0C926FCF8BA5C38AB2B38A6 /* fltk3images.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C2435D9DCE9D126983C81F3 /* fltk3images.h */; };
+		26C1F556C987C742D37CCAA4 /* BMPImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */; };
+		8845649A10159ECED0C93211 /* GIFImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 605121E099731EF9977E11C8 /* GIFImage.h */; };
+		F7A66B0ADC3A359551BB84FB /* HelpDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = 0925F19306CD3458397661F3 /* HelpDialog.h */; };
+		30029E6A64808C5EFEBA9CF8 /* JPEGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 60A217E0DC847E1DD7B44D49 /* JPEGImage.h */; };
+		E3127242302580ED01B769A4 /* PNGImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 25BEA28581A1A97EEA1014E2 /* PNGImage.h */; };
+		CBE8880ED23DF42D5298EAAE /* PNMImage.h in Headers */ = {isa = PBXBuildFile; fileRef = EC95850E022AFDFC59E4EBC2 /* PNMImage.h */; };
 		8A255408062F7A3777F2346E /* fltk3.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 86C380FE76A739F296A44961 /* fltk3.framework */; };
 		5F01A68D9FECE518EF71F730 /* fltk3png.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06A7B68E2100DB960872987D /* fltk3png.framework */; };
 		788FE6BCB3796A6FF4069E08 /* fltk3jpeg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C03975F619684D3461888340 /* fltk3jpeg.framework */; };
@@ -3880,10 +3884,11 @@
 		425C2E3ED45A5CA834A7B379 /* widget_panel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = widget_panel.cxx; path = ../../fluid/widget_panel.cxx; sourceTree = SOURCE_ROOT; };
 		436422818D83DCB8718FDFEE /* workspace_panel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = workspace_panel.cxx; path = ../../fluid/workspace_panel.cxx; sourceTree = SOURCE_ROOT; };
 		4616D95804473A73F80B6CC7 /* Fluid.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Fluid.app; sourceTree = BUILT_PRODUCTS_DIR; };
+		DDEC0AB0E55CB75CFA5FD9DC /* all.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = all.h; path = ../../include/fltk3/all.h; sourceTree = SOURCE_ROOT; };
+		15B1A08E928290071C92EDD1 /* fltk3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fltk3.h; path = ../../include/fltk3/fltk3.h; sourceTree = SOURCE_ROOT; };
 		1CDC310CF438C4E007EE265B /* Adjuster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Adjuster.h; path = ../../include/fltk3/Adjuster.h; sourceTree = SOURCE_ROOT; };
 		D31DE8ACD497B8FA62A57910 /* ask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ask.h; path = ../../include/fltk3/ask.h; sourceTree = SOURCE_ROOT; };
 		249A3332647089ACC2702523 /* Bitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bitmap.h; path = ../../include/fltk3/Bitmap.h; sourceTree = SOURCE_ROOT; };
-		5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMPImage.h; path = ../../include/fltk3/BMPImage.h; sourceTree = SOURCE_ROOT; };
 		0800D21F849D8F2CDB90C72D /* Box.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Box.h; path = ../../include/fltk3/Box.h; sourceTree = SOURCE_ROOT; };
 		32841D65E2F82C3F24A360D2 /* Browser_.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Browser_.h; path = ../../include/fltk3/Browser_.h; sourceTree = SOURCE_ROOT; };
 		B8F30574865BA1A8081AF0E4 /* Browser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Browser.h; path = ../../include/fltk3/Browser.h; sourceTree = SOURCE_ROOT; };
@@ -3916,9 +3921,7 @@
 		11DF5111A6EE377DAAFDB68B /* FormsBitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FormsBitmap.h; path = ../../include/fltk3/FormsBitmap.h; sourceTree = SOURCE_ROOT; };
 		7E62E615D0C146DBB74B477A /* FormsPixmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FormsPixmap.h; path = ../../include/fltk3/FormsPixmap.h; sourceTree = SOURCE_ROOT; };
 		11F5FE43FEC401E52D4CABB7 /* Free.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Free.h; path = ../../include/fltk3/Free.h; sourceTree = SOURCE_ROOT; };
-		605121E099731EF9977E11C8 /* GIFImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIFImage.h; path = ../../include/fltk3/GIFImage.h; sourceTree = SOURCE_ROOT; };
 		91EA037664D5A2D49603F364 /* Group.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Group.h; path = ../../include/fltk3/Group.h; sourceTree = SOURCE_ROOT; };
-		0925F19306CD3458397661F3 /* HelpDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelpDialog.h; path = ../../include/fltk3/HelpDialog.h; sourceTree = SOURCE_ROOT; };
 		0CD096CD5808EADB1B646DB4 /* HelpView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelpView.h; path = ../../include/fltk3/HelpView.h; sourceTree = SOURCE_ROOT; };
 		CFF83CFB9E060DA4F81AE816 /* HoldBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HoldBrowser.h; path = ../../include/fltk3/HoldBrowser.h; sourceTree = SOURCE_ROOT; };
 		5C8658CA906CD5A6C35FA96B /* HorFillSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HorFillSlider.h; path = ../../include/fltk3/HorFillSlider.h; sourceTree = SOURCE_ROOT; };
@@ -3930,7 +3933,6 @@
 		28D897DFA27CCC5A3933D952 /* Input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Input.h; path = ../../include/fltk3/Input.h; sourceTree = SOURCE_ROOT; };
 		11C999453D2BEBD3A5B32DA4 /* InputChoice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputChoice.h; path = ../../include/fltk3/InputChoice.h; sourceTree = SOURCE_ROOT; };
 		B5CA37E08339E6D7820C0973 /* IntInput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IntInput.h; path = ../../include/fltk3/IntInput.h; sourceTree = SOURCE_ROOT; };
-		60A217E0DC847E1DD7B44D49 /* JPEGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JPEGImage.h; path = ../../include/fltk3/JPEGImage.h; sourceTree = SOURCE_ROOT; };
 		5A390823203566E8B1FB4B81 /* LightButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LightButton.h; path = ../../include/fltk3/LightButton.h; sourceTree = SOURCE_ROOT; };
 		D10E3F19DD8CC6A3FAA912AF /* LineDial.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LineDial.h; path = ../../include/fltk3/LineDial.h; sourceTree = SOURCE_ROOT; };
 		6523340D0E47A3A4B3852435 /* math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = math.h; path = ../../include/fltk3/math.h; sourceTree = SOURCE_ROOT; };
@@ -3956,8 +3958,6 @@
 		C539C329532BE09B0422A23A /* PagedDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PagedDevice.h; path = ../../include/fltk3/PagedDevice.h; sourceTree = SOURCE_ROOT; };
 		AEF910125AE91654739457BF /* Pixmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Pixmap.h; path = ../../include/fltk3/Pixmap.h; sourceTree = SOURCE_ROOT; };
 		A5DB3592DA82366555A66B4A /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../include/fltk3/Plugin.h; sourceTree = SOURCE_ROOT; };
-		25BEA28581A1A97EEA1014E2 /* PNGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNGImage.h; path = ../../include/fltk3/PNGImage.h; sourceTree = SOURCE_ROOT; };
-		EC95850E022AFDFC59E4EBC2 /* PNMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNMImage.h; path = ../../include/fltk3/PNMImage.h; sourceTree = SOURCE_ROOT; };
 		813FC8746075A74FEDAE447C /* Positioner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Positioner.h; path = ../../include/fltk3/Positioner.h; sourceTree = SOURCE_ROOT; };
 		6A0B5BF3C5ECFAF041951029 /* PostScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PostScript.h; path = ../../include/fltk3/PostScript.h; sourceTree = SOURCE_ROOT; };
 		A9B88BB6C6654424E37B8082 /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Preferences.h; path = ../../include/fltk3/Preferences.h; sourceTree = SOURCE_ROOT; };
@@ -4016,162 +4016,162 @@
 		8BD4A9C136E457CC92F9ADFE /* WizardGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WizardGroup.h; path = ../../include/fltk3/WizardGroup.h; sourceTree = SOURCE_ROOT; };
 		DF6994452C6FD170E9507C6D /* Wrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Wrapper.h; path = ../../include/fltk3/Wrapper.h; sourceTree = SOURCE_ROOT; };
 		059505668BA88697E40E6C32 /* x.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = x.h; path = ../../include/fltk3/x.h; sourceTree = SOURCE_ROOT; };
+		2E1B408952EFBB79A46CDE69 /* Xutf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Xutf8.h; path = ../../include/fltk3/Xutf8.h; sourceTree = SOURCE_ROOT; };
 		9F6F453D846A6B7E8679FDAA /* XBMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XBMImage.h; path = ../../include/fltk3/XBMImage.h; sourceTree = SOURCE_ROOT; };
 		0C163988CD45E6AB4710982F /* XPMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPMImage.h; path = ../../include/fltk3/XPMImage.h; sourceTree = SOURCE_ROOT; };
-		2E1B408952EFBB79A46CDE69 /* Xutf8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Xutf8.h; path = ../../include/fltk3/Xutf8.h; sourceTree = SOURCE_ROOT; };
-		F6BB47B6B9E3180AB7C5F16D /* Fl_cocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Fl_cocoa.mm; path = ../../src/core/Fl_cocoa.mm; sourceTree = SOURCE_ROOT; };
-		B23CCB736CF9A2433827C3EE /* Fl_Native_File_Chooser_MAC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Fl_Native_File_Chooser_MAC.mm; path = ../../src/core/Fl_Native_File_Chooser_MAC.mm; sourceTree = SOURCE_ROOT; };
-		10A048C45D4667189C9F77EA /* Fl_Quartz_Printer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = Fl_Quartz_Printer.mm; path = ../../src/core/Fl_Quartz_Printer.mm; sourceTree = SOURCE_ROOT; };
+		F6BB47B6B9E3180AB7C5F16D /* cocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = cocoa.mm; path = ../../src/fltk3/cocoa.mm; sourceTree = SOURCE_ROOT; };
+		B23CCB736CF9A2433827C3EE /* cocoaNativeFileChooser.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = cocoaNativeFileChooser.mm; path = ../../src/fltk3/cocoaNativeFileChooser.mm; sourceTree = SOURCE_ROOT; };
+		10A048C45D4667189C9F77EA /* cocoaQuartzPrinter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = cocoaQuartzPrinter.mm; path = ../../src/fltk3/cocoaQuartzPrinter.mm; sourceTree = SOURCE_ROOT; };
 		81045D024AA56D9CD81C23A2 /* run.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = run.cxx; path = ../../src/fltk3/run.cxx; sourceTree = SOURCE_ROOT; };
-		ECEA64F2B2C5C5186949AD76 /* Fl_Adjuster.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Adjuster.cxx; path = ../../src/core/Fl_Adjuster.cxx; sourceTree = SOURCE_ROOT; };
-		D68004A5D4D7878F2E22B59B /* Fl_Bitmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Bitmap.cxx; path = ../../src/core/Fl_Bitmap.cxx; sourceTree = SOURCE_ROOT; };
-		81608512CDA5C11B35A2B539 /* Fl_Box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Box.cxx; path = ../../src/core/Fl_Box.cxx; sourceTree = SOURCE_ROOT; };
-		5CE1FF6EF6F9500754C22170 /* Fl_Browser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Browser.cxx; path = ../../src/core/Fl_Browser.cxx; sourceTree = SOURCE_ROOT; };
-		2FC85E98AAFBF45C8EBBA1CC /* Fl_Browser_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Browser_.cxx; path = ../../src/core/Fl_Browser_.cxx; sourceTree = SOURCE_ROOT; };
-		B89AE0F97A9095F4A064E6FF /* Fl_Browser_load.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Browser_load.cxx; path = ../../src/core/Fl_Browser_load.cxx; sourceTree = SOURCE_ROOT; };
-		70F960885035F13513E45EFD /* Fl_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Button.cxx; path = ../../src/core/Fl_Button.cxx; sourceTree = SOURCE_ROOT; };
-		392500313F9EDFBFE2786E57 /* Fl_Chart.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Chart.cxx; path = ../../src/core/Fl_Chart.cxx; sourceTree = SOURCE_ROOT; };
-		F6EC011E63665A01E72E52E7 /* Fl_Check_Browser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Check_Browser.cxx; path = ../../src/core/Fl_Check_Browser.cxx; sourceTree = SOURCE_ROOT; };
-		490C9DC52EF4532CC9795A6D /* Fl_Check_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Check_Button.cxx; path = ../../src/core/Fl_Check_Button.cxx; sourceTree = SOURCE_ROOT; };
-		6356BFF275FE7996D8F77F5C /* Fl_Choice.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Choice.cxx; path = ../../src/core/Fl_Choice.cxx; sourceTree = SOURCE_ROOT; };
-		1C4F7DBF0BD658A6D786280A /* Fl_Clock.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Clock.cxx; path = ../../src/core/Fl_Clock.cxx; sourceTree = SOURCE_ROOT; };
-		4CF353D8CC1FA86010629419 /* Fl_Color_Chooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Color_Chooser.cxx; path = ../../src/core/Fl_Color_Chooser.cxx; sourceTree = SOURCE_ROOT; };
-		96D41530A69F4A84DBF7E11E /* Fl_Counter.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Counter.cxx; path = ../../src/core/Fl_Counter.cxx; sourceTree = SOURCE_ROOT; };
-		CB4EA8042D07755CEA64E9FB /* Fl_Device.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Device.cxx; path = ../../src/core/Fl_Device.cxx; sourceTree = SOURCE_ROOT; };
-		FDB4072264224B4391CAB607 /* Fl_Dial.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Dial.cxx; path = ../../src/core/Fl_Dial.cxx; sourceTree = SOURCE_ROOT; };
-		D65E879CEE1870B6B73853BC /* Fl_Double_Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Double_Window.cxx; path = ../../src/core/Fl_Double_Window.cxx; sourceTree = SOURCE_ROOT; };
-		31B32445C4ECC6487D814264 /* Fl_File_Browser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Browser.cxx; path = ../../src/core/Fl_File_Browser.cxx; sourceTree = SOURCE_ROOT; };
-		E74C762F7266F6B35BA2394A /* Fl_File_Chooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Chooser.cxx; path = ../../src/core/Fl_File_Chooser.cxx; sourceTree = SOURCE_ROOT; };
-		A7770A7FB7C79371A3BFB46C /* Fl_File_Chooser2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Chooser2.cxx; path = ../../src/core/Fl_File_Chooser2.cxx; sourceTree = SOURCE_ROOT; };
-		19FA31AEDEFAC11C8EC5D035 /* Fl_File_Icon.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Icon.cxx; path = ../../src/core/Fl_File_Icon.cxx; sourceTree = SOURCE_ROOT; };
-		D05F5EBC3B022A7C99F2DDC2 /* Fl_File_Input.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Input.cxx; path = ../../src/core/Fl_File_Input.cxx; sourceTree = SOURCE_ROOT; };
-		A5952FB986701638B15F1B22 /* Fl_Group.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Group.cxx; path = ../../src/core/Fl_Group.cxx; sourceTree = SOURCE_ROOT; };
-		047B650C9F322D0CB49D48D6 /* Fl_Help_View.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Help_View.cxx; path = ../../src/core/Fl_Help_View.cxx; sourceTree = SOURCE_ROOT; };
-		E01E16F15C6443D98C32F5F6 /* Fl_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Image.cxx; path = ../../src/core/Fl_Image.cxx; sourceTree = SOURCE_ROOT; };
-		184F621088E304BDFD7A0384 /* Fl_Input.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Input.cxx; path = ../../src/core/Fl_Input.cxx; sourceTree = SOURCE_ROOT; };
-		A892461439BFF8FC2D538E50 /* Fl_Input_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Input_.cxx; path = ../../src/core/Fl_Input_.cxx; sourceTree = SOURCE_ROOT; };
-		36C72097C9A86A33861ACD51 /* Fl_Light_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Light_Button.cxx; path = ../../src/core/Fl_Light_Button.cxx; sourceTree = SOURCE_ROOT; };
-		4672B51C8F8B9C0703D7EAA5 /* Fl_Menu.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu.cxx; path = ../../src/core/Fl_Menu.cxx; sourceTree = SOURCE_ROOT; };
-		DE9E57A22E45C3039D820566 /* Fl_Menu_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_.cxx; path = ../../src/core/Fl_Menu_.cxx; sourceTree = SOURCE_ROOT; };
-		265C00BF9D9598D2A10BE42A /* Fl_Menu_Bar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_Bar.cxx; path = ../../src/core/Fl_Menu_Bar.cxx; sourceTree = SOURCE_ROOT; };
-		58FD2064B2C854618D2E68DB /* Fl_Menu_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_Button.cxx; path = ../../src/core/Fl_Menu_Button.cxx; sourceTree = SOURCE_ROOT; };
-		CBE03F81CF8A43E9735AEFC9 /* Fl_Menu_Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_Window.cxx; path = ../../src/core/Fl_Menu_Window.cxx; sourceTree = SOURCE_ROOT; };
-		C649ABF1BD8B5FB41539FB5F /* Fl_Menu_add.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_add.cxx; path = ../../src/core/Fl_Menu_add.cxx; sourceTree = SOURCE_ROOT; };
-		25D17230FC589A55DA9C6F23 /* Fl_Menu_global.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Menu_global.cxx; path = ../../src/core/Fl_Menu_global.cxx; sourceTree = SOURCE_ROOT; };
-		37D57C7D98BB88CE1A3BFC20 /* Fl_Multi_Label.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Multi_Label.cxx; path = ../../src/core/Fl_Multi_Label.cxx; sourceTree = SOURCE_ROOT; };
-		FC634C34D16F1DE6EF923847 /* Fl_Native_File_Chooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Native_File_Chooser.cxx; path = ../../src/core/Fl_Native_File_Chooser.cxx; sourceTree = SOURCE_ROOT; };
-		CEF1A66A542A208607C52832 /* Fl_Overlay_Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Overlay_Window.cxx; path = ../../src/core/Fl_Overlay_Window.cxx; sourceTree = SOURCE_ROOT; };
-		0F0129FF3753E991F59B9FB5 /* Fl_Pack.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Pack.cxx; path = ../../src/core/Fl_Pack.cxx; sourceTree = SOURCE_ROOT; };
-		680EF039247E0C542AD802F6 /* Fl_Paged_Device.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Paged_Device.cxx; path = ../../src/core/Fl_Paged_Device.cxx; sourceTree = SOURCE_ROOT; };
-		9AEB93657A00F78B2046454D /* Fl_Pixmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Pixmap.cxx; path = ../../src/core/Fl_Pixmap.cxx; sourceTree = SOURCE_ROOT; };
-		9EB992B1957E27AE06A07426 /* Fl_Positioner.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Positioner.cxx; path = ../../src/core/Fl_Positioner.cxx; sourceTree = SOURCE_ROOT; };
-		53F2F9DED1C91758A21D0246 /* Fl_Printer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Printer.cxx; path = ../../src/core/Fl_Printer.cxx; sourceTree = SOURCE_ROOT; };
-		596103743F0CE2A89B7B3FA5 /* Fl_Preferences.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Preferences.cxx; path = ../../src/core/Fl_Preferences.cxx; sourceTree = SOURCE_ROOT; };
-		B62169E8816659E5E6E4DD9F /* Fl_Progress.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Progress.cxx; path = ../../src/core/Fl_Progress.cxx; sourceTree = SOURCE_ROOT; };
-		F2E611B0C2D8C53DD06946BC /* Fl_Repeat_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Repeat_Button.cxx; path = ../../src/core/Fl_Repeat_Button.cxx; sourceTree = SOURCE_ROOT; };
-		69E296C029FB3078A82EE913 /* Fl_Return_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Return_Button.cxx; path = ../../src/core/Fl_Return_Button.cxx; sourceTree = SOURCE_ROOT; };
-		A5526E662D03F4C9647C13A4 /* Fl_Roller.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Roller.cxx; path = ../../src/core/Fl_Roller.cxx; sourceTree = SOURCE_ROOT; };
-		5DA33AF375B975EBBE824A96 /* Fl_Round_Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Round_Button.cxx; path = ../../src/core/Fl_Round_Button.cxx; sourceTree = SOURCE_ROOT; };
-		135F7AE45CBDAA49D80BB12D /* Fl_Scroll.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Scroll.cxx; path = ../../src/core/Fl_Scroll.cxx; sourceTree = SOURCE_ROOT; };
-		6F7BEB35272214B6167B1FB8 /* Fl_Scrollbar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Scrollbar.cxx; path = ../../src/core/Fl_Scrollbar.cxx; sourceTree = SOURCE_ROOT; };
-		8580401C9D38395ECAD127AC /* Fl_Shared_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Shared_Image.cxx; path = ../../src/core/Fl_Shared_Image.cxx; sourceTree = SOURCE_ROOT; };
-		17A03BA54D8D67397D8BDCEE /* Fl_Single_Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Single_Window.cxx; path = ../../src/core/Fl_Single_Window.cxx; sourceTree = SOURCE_ROOT; };
-		085FAF82201B9FD1927A8BAA /* Fl_Slider.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Slider.cxx; path = ../../src/core/Fl_Slider.cxx; sourceTree = SOURCE_ROOT; };
-		CAA3AD964456E0912791C783 /* Style.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Style.cxx; path = ../../src/core/Style.cxx; sourceTree = SOURCE_ROOT; };
-		43C12A4D372777B2307220CC /* Fl_Sys_Menu_Bar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Sys_Menu_Bar.cxx; path = ../../src/core/Fl_Sys_Menu_Bar.cxx; sourceTree = SOURCE_ROOT; };
-		025842431942A90D06F5BCFA /* Fl_Table.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Table.cxx; path = ../../src/core/Fl_Table.cxx; sourceTree = SOURCE_ROOT; };
-		7097EA09B5B8FCFEEBE28CA8 /* Fl_Table_Row.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Table_Row.cxx; path = ../../src/core/Fl_Table_Row.cxx; sourceTree = SOURCE_ROOT; };
-		7712638143B8C0B51FF6A61B /* Fl_Tabs.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tabs.cxx; path = ../../src/core/Fl_Tabs.cxx; sourceTree = SOURCE_ROOT; };
-		8867A20B30D85F73D157D617 /* Fl_Text_Buffer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Text_Buffer.cxx; path = ../../src/core/Fl_Text_Buffer.cxx; sourceTree = SOURCE_ROOT; };
-		E5E1DA87EC62BC799411CDB9 /* Fl_Text_Display.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Text_Display.cxx; path = ../../src/core/Fl_Text_Display.cxx; sourceTree = SOURCE_ROOT; };
-		5995AACC387B26DECEE88139 /* Fl_Text_Editor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Text_Editor.cxx; path = ../../src/core/Fl_Text_Editor.cxx; sourceTree = SOURCE_ROOT; };
-		A3F6667DE920CB42ED6E95FC /* Fl_Tile.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tile.cxx; path = ../../src/core/Fl_Tile.cxx; sourceTree = SOURCE_ROOT; };
-		4C92BA7B6F3DA54449388F69 /* Fl_Tiled_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tiled_Image.cxx; path = ../../src/core/Fl_Tiled_Image.cxx; sourceTree = SOURCE_ROOT; };
-		22CA4A41B4BF6D6AF6A6F244 /* Fl_Tooltip.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tooltip.cxx; path = ../../src/core/Fl_Tooltip.cxx; sourceTree = SOURCE_ROOT; };
-		214492E971DD58A3EF8FEAA3 /* Fl_Tree.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree.cxx; path = ../../src/core/Fl_Tree.cxx; sourceTree = SOURCE_ROOT; };
-		D9F29791281BE27706AB7E8E /* Fl_Tree_Item.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Item.cxx; path = ../../src/core/Fl_Tree_Item.cxx; sourceTree = SOURCE_ROOT; };
-		D6CBFFFA62847DACFACE5284 /* Fl_Tree_Item_Array.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Item_Array.cxx; path = ../../src/core/Fl_Tree_Item_Array.cxx; sourceTree = SOURCE_ROOT; };
-		CFFE37EE7360FD052E7B592D /* Fl_Tree_Prefs.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Tree_Prefs.cxx; path = ../../src/core/Fl_Tree_Prefs.cxx; sourceTree = SOURCE_ROOT; };
-		35EB53B1A2D1EF0E37A4970E /* Fl_Valuator.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Valuator.cxx; path = ../../src/core/Fl_Valuator.cxx; sourceTree = SOURCE_ROOT; };
-		1685625EE3C5677F29D7D314 /* Fl_Value_Input.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Value_Input.cxx; path = ../../src/core/Fl_Value_Input.cxx; sourceTree = SOURCE_ROOT; };
-		7553A0E747824E627DB0DDE5 /* Fl_Value_Output.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Value_Output.cxx; path = ../../src/core/Fl_Value_Output.cxx; sourceTree = SOURCE_ROOT; };
-		07F5E789A6A94E38E46B9744 /* Fl_Value_Slider.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Value_Slider.cxx; path = ../../src/core/Fl_Value_Slider.cxx; sourceTree = SOURCE_ROOT; };
-		C5F5E189BBE256A698ADF418 /* Fl_Widget.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Widget.cxx; path = ../../src/core/Fl_Widget.cxx; sourceTree = SOURCE_ROOT; };
-		8E1A3A4FC6492F080AF48D54 /* Fl_Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Window.cxx; path = ../../src/core/Fl_Window.cxx; sourceTree = SOURCE_ROOT; };
-		7679F6CC5391C705D9B921DA /* Fl_Window_fullscreen.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Window_fullscreen.cxx; path = ../../src/core/Fl_Window_fullscreen.cxx; sourceTree = SOURCE_ROOT; };
-		B5E58AC3929D3ADCBE238301 /* Fl_Window_hotspot.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Window_hotspot.cxx; path = ../../src/core/Fl_Window_hotspot.cxx; sourceTree = SOURCE_ROOT; };
-		C34CF806FAE9E39DDFD23D3B /* Fl_Window_iconize.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Window_iconize.cxx; path = ../../src/core/Fl_Window_iconize.cxx; sourceTree = SOURCE_ROOT; };
-		A84F18440208B2AA809D2871 /* Fl_Wizard.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Wizard.cxx; path = ../../src/core/Fl_Wizard.cxx; sourceTree = SOURCE_ROOT; };
-		9A21D7EDE35664C4B0EDD969 /* Fl_XBM_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_XBM_Image.cxx; path = ../../src/core/Fl_XBM_Image.cxx; sourceTree = SOURCE_ROOT; };
-		302A3FA8AB59DE7E5255E28C /* Fl_XPM_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_XPM_Image.cxx; path = ../../src/core/Fl_XPM_Image.cxx; sourceTree = SOURCE_ROOT; };
-		671B96BA5D85D5C6EE31AB76 /* Fl_abort.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_abort.cxx; path = ../../src/core/Fl_abort.cxx; sourceTree = SOURCE_ROOT; };
-		1821AF479F52B67539CB0CF8 /* Fl_add_idle.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_add_idle.cxx; path = ../../src/core/Fl_add_idle.cxx; sourceTree = SOURCE_ROOT; };
-		8E5EB755BAF13FB15109FC0C /* Fl_arg.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_arg.cxx; path = ../../src/core/Fl_arg.cxx; sourceTree = SOURCE_ROOT; };
-		AA048ACBE220E831739595BD /* Fl_compose.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_compose.cxx; path = ../../src/core/Fl_compose.cxx; sourceTree = SOURCE_ROOT; };
-		44287148E62E709880C4EA41 /* Fl_display.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_display.cxx; path = ../../src/core/Fl_display.cxx; sourceTree = SOURCE_ROOT; };
-		A8DC358A8390A493A9A8AE55 /* Fl_get_key.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_get_key.cxx; path = ../../src/core/Fl_get_key.cxx; sourceTree = SOURCE_ROOT; };
-		FEADB63E5C237A827884C5C5 /* Fl_get_system_colors.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_get_system_colors.cxx; path = ../../src/core/Fl_get_system_colors.cxx; sourceTree = SOURCE_ROOT; };
-		76AA6E6C769FB157F8125874 /* Fl_grab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_grab.cxx; path = ../../src/core/Fl_grab.cxx; sourceTree = SOURCE_ROOT; };
-		7FAC51832563F8B044E55B90 /* Fl_lock.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_lock.cxx; path = ../../src/core/Fl_lock.cxx; sourceTree = SOURCE_ROOT; };
-		013DBB50198366613C31E2A9 /* Fl_own_colormap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_own_colormap.cxx; path = ../../src/core/Fl_own_colormap.cxx; sourceTree = SOURCE_ROOT; };
-		1626800F2D2DF61E9E2468DD /* Fl_visual.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_visual.cxx; path = ../../src/core/Fl_visual.cxx; sourceTree = SOURCE_ROOT; };
-		F285310A7BD8D88F965104C8 /* Fl_x.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_x.cxx; path = ../../src/core/Fl_x.cxx; sourceTree = SOURCE_ROOT; };
-		04A6409B52D5A99617606460 /* filename_absolute.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_absolute.cxx; path = ../../src/core/filename_absolute.cxx; sourceTree = SOURCE_ROOT; };
-		F9F779F221E630EE4A837595 /* filename_expand.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_expand.cxx; path = ../../src/core/filename_expand.cxx; sourceTree = SOURCE_ROOT; };
-		210616B209B714E918A5CD3B /* filename_ext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_ext.cxx; path = ../../src/core/filename_ext.cxx; sourceTree = SOURCE_ROOT; };
-		C07EC3AE77BDACC48058E2CA /* filename_isdir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_isdir.cxx; path = ../../src/core/filename_isdir.cxx; sourceTree = SOURCE_ROOT; };
-		F08599CCE19B1640395AB3D0 /* filename_list.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_list.cxx; path = ../../src/core/filename_list.cxx; sourceTree = SOURCE_ROOT; };
-		AB171A4BF938A263E10FD0AD /* filename_match.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_match.cxx; path = ../../src/core/filename_match.cxx; sourceTree = SOURCE_ROOT; };
-		003AA96B03F174957585B088 /* filename_setext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_setext.cxx; path = ../../src/core/filename_setext.cxx; sourceTree = SOURCE_ROOT; };
-		876B6A633C2E666DFC3119DD /* fl_arc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_arc.cxx; path = ../../src/core/fl_arc.cxx; sourceTree = SOURCE_ROOT; };
-		E52CB16DD470DA22063934AA /* fl_arci.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_arci.cxx; path = ../../src/core/fl_arci.cxx; sourceTree = SOURCE_ROOT; };
-		60E7DD739D5DDBD766E2E30F /* fl_ask.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_ask.cxx; path = ../../src/core/fl_ask.cxx; sourceTree = SOURCE_ROOT; };
-		BC14596F24E305FE8CE39DAF /* fl_boxtype.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_boxtype.cxx; path = ../../src/core/fl_boxtype.cxx; sourceTree = SOURCE_ROOT; };
-		8B35EF2F662F706A2B46BDD7 /* fl_call_main.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_call_main.cxx; path = ../../src/core/fl_call_main.cxx; sourceTree = SOURCE_ROOT; };
-		02716487EA5E04A784DE5A34 /* fl_color.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_color.cxx; path = ../../src/core/fl_color.cxx; sourceTree = SOURCE_ROOT; };
-		C832D220ECF843E28FBAFED8 /* fl_cursor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_cursor.cxx; path = ../../src/core/fl_cursor.cxx; sourceTree = SOURCE_ROOT; };
-		53EC964ED2E6DE4CBF80B206 /* fl_curve.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_curve.cxx; path = ../../src/core/fl_curve.cxx; sourceTree = SOURCE_ROOT; };
-		5557266E1C9D440172D5DF09 /* fl_diamond_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_diamond_box.cxx; path = ../../src/core/fl_diamond_box.cxx; sourceTree = SOURCE_ROOT; };
-		D1E006BE295C0F88A8E51304 /* fl_dnd.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_dnd.cxx; path = ../../src/core/fl_dnd.cxx; sourceTree = SOURCE_ROOT; };
-		3CF0F8B538EFFF602D6549B0 /* fl_draw.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_draw.cxx; path = ../../src/core/fl_draw.cxx; sourceTree = SOURCE_ROOT; };
-		F608DA64A6A66C65E7494BEA /* fl_draw_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_draw_image.cxx; path = ../../src/core/fl_draw_image.cxx; sourceTree = SOURCE_ROOT; };
-		B6E2BA6C16F8BB32016C0FF0 /* fl_draw_pixmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_draw_pixmap.cxx; path = ../../src/core/fl_draw_pixmap.cxx; sourceTree = SOURCE_ROOT; };
-		0BEBF5A734CD2113BB6BDA08 /* fl_encoding_latin1.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_encoding_latin1.cxx; path = ../../src/core/fl_encoding_latin1.cxx; sourceTree = SOURCE_ROOT; };
-		C2BF9CDFAB8BFEF23768C51B /* fl_encoding_mac_roman.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_encoding_mac_roman.cxx; path = ../../src/core/fl_encoding_mac_roman.cxx; sourceTree = SOURCE_ROOT; };
-		0522E1C24273419B45EF1B4D /* fl_engraved_label.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_engraved_label.cxx; path = ../../src/core/fl_engraved_label.cxx; sourceTree = SOURCE_ROOT; };
-		1BF9BBF497705FBAD92797FF /* fl_file_dir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_file_dir.cxx; path = ../../src/core/fl_file_dir.cxx; sourceTree = SOURCE_ROOT; };
-		1CFFB72AB54D6FECF9F0C89C /* fl_font.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_font.cxx; path = ../../src/core/fl_font.cxx; sourceTree = SOURCE_ROOT; };
-		E3303C9AB8380CF95C000D0C /* fl_gtk.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_gtk.cxx; path = ../../src/core/fl_gtk.cxx; sourceTree = SOURCE_ROOT; };
-		95F43A2D694782E841E90C3A /* fl_labeltype.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_labeltype.cxx; path = ../../src/core/fl_labeltype.cxx; sourceTree = SOURCE_ROOT; };
-		5FD374C4251D84126390EEE5 /* fl_line_style.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_line_style.cxx; path = ../../src/core/fl_line_style.cxx; sourceTree = SOURCE_ROOT; };
-		5515C9CC733AC9F36A9B7E06 /* fl_open_uri.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_open_uri.cxx; path = ../../src/core/fl_open_uri.cxx; sourceTree = SOURCE_ROOT; };
-		554EB8945D959B0EF565327A /* fl_oval_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_oval_box.cxx; path = ../../src/core/fl_oval_box.cxx; sourceTree = SOURCE_ROOT; };
-		5536CF5142F45E75898D00BA /* fl_overlay.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_overlay.cxx; path = ../../src/core/fl_overlay.cxx; sourceTree = SOURCE_ROOT; };
-		3132F0163EFDF4289F20DB50 /* fl_overlay_visual.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_overlay_visual.cxx; path = ../../src/core/fl_overlay_visual.cxx; sourceTree = SOURCE_ROOT; };
-		D9934C34F12FADA862D201D1 /* fl_plastic.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_plastic.cxx; path = ../../src/core/fl_plastic.cxx; sourceTree = SOURCE_ROOT; };
-		1FA85C8068154A53598C9B19 /* fl_read_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_read_image.cxx; path = ../../src/core/fl_read_image.cxx; sourceTree = SOURCE_ROOT; };
-		82F1E1FCCD3708EA48A6FD1B /* fl_rect.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_rect.cxx; path = ../../src/core/fl_rect.cxx; sourceTree = SOURCE_ROOT; };
-		C791DFA1DA864C8105CA92D3 /* fl_round_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_round_box.cxx; path = ../../src/core/fl_round_box.cxx; sourceTree = SOURCE_ROOT; };
-		557E80414B985272F1C0F5BE /* fl_rounded_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_rounded_box.cxx; path = ../../src/core/fl_rounded_box.cxx; sourceTree = SOURCE_ROOT; };
-		0E08EA1CF945ADA843805A2C /* fl_scroll_area.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_scroll_area.cxx; path = ../../src/core/fl_scroll_area.cxx; sourceTree = SOURCE_ROOT; };
-		C7ED2C14E31F1142DDCAC057 /* fl_set_font.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_set_font.cxx; path = ../../src/core/fl_set_font.cxx; sourceTree = SOURCE_ROOT; };
-		22603052464D0ADEFA96A7E6 /* fl_set_fonts.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_set_fonts.cxx; path = ../../src/core/fl_set_fonts.cxx; sourceTree = SOURCE_ROOT; };
-		2C5EEC8910127EC66EEA73B1 /* fl_shadow_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_shadow_box.cxx; path = ../../src/core/fl_shadow_box.cxx; sourceTree = SOURCE_ROOT; };
-		BFCE21B11BD00816E2D65029 /* fl_shortcut.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_shortcut.cxx; path = ../../src/core/fl_shortcut.cxx; sourceTree = SOURCE_ROOT; };
-		76D6638ABB7D955E0B149360 /* fl_show_colormap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_show_colormap.cxx; path = ../../src/core/fl_show_colormap.cxx; sourceTree = SOURCE_ROOT; };
-		ECAFDF98E362617FA9E2B887 /* fl_symbols.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_symbols.cxx; path = ../../src/core/fl_symbols.cxx; sourceTree = SOURCE_ROOT; };
-		C82D09C9EB356BF14388A904 /* fl_utf8.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_utf8.cxx; path = ../../src/core/fl_utf8.cxx; sourceTree = SOURCE_ROOT; };
-		574878A10D223037009BD0DE /* fl_utf.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_utf.cxx; path = ../../src/core/fl_utf.cxx; sourceTree = SOURCE_ROOT; };
-		6C74D84D95E5167E6D41A606 /* fl_vertex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_vertex.cxx; path = ../../src/core/fl_vertex.cxx; sourceTree = SOURCE_ROOT; };
-		2286DB222E1D5D78655B21BB /* numericsort.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = numericsort.cxx; path = ../../src/core/numericsort.cxx; sourceTree = SOURCE_ROOT; };
-		472AB3970C82CB496562F422 /* ps_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ps_image.cxx; path = ../../src/core/ps_image.cxx; sourceTree = SOURCE_ROOT; };
-		1E2B1DAE628CEB38A5F0E604 /* scandir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scandir.cxx; path = ../../src/core/scandir.cxx; sourceTree = SOURCE_ROOT; };
-		4302C79C4558E1F4750879E4 /* screen_xywh.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = screen_xywh.cxx; path = ../../src/core/screen_xywh.cxx; sourceTree = SOURCE_ROOT; };
-		EF672C7C2929488ED55C8145 /* flstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = flstring.c; path = ../../src/core/flstring.c; sourceTree = SOURCE_ROOT; };
-		4024031C45193E6173805457 /* vsnprintf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vsnprintf.c; path = ../../src/core/vsnprintf.c; sourceTree = SOURCE_ROOT; };
-		6A8D02403C9D3B785B0D8F30 /* case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = case.c; path = ../../src/core/xutf8/case.c; sourceTree = SOURCE_ROOT; };
-		15064F3F45361B071125C187 /* is_right2left.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = is_right2left.c; path = ../../src/core/xutf8/is_right2left.c; sourceTree = SOURCE_ROOT; };
-		35196210FA39F50016C06ED2 /* is_spacing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = is_spacing.c; path = ../../src/core/xutf8/is_spacing.c; sourceTree = SOURCE_ROOT; };
+		ECEA64F2B2C5C5186949AD76 /* Adjuster.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Adjuster.cxx; path = ../../src/fltk3/Adjuster.cxx; sourceTree = SOURCE_ROOT; };
+		D68004A5D4D7878F2E22B59B /* Bitmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bitmap.cxx; path = ../../src/fltk3/Bitmap.cxx; sourceTree = SOURCE_ROOT; };
+		81608512CDA5C11B35A2B539 /* Box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Box.cxx; path = ../../src/fltk3/Box.cxx; sourceTree = SOURCE_ROOT; };
+		5CE1FF6EF6F9500754C22170 /* Browser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Browser.cxx; path = ../../src/fltk3/Browser.cxx; sourceTree = SOURCE_ROOT; };
+		2FC85E98AAFBF45C8EBBA1CC /* Browser_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Browser_.cxx; path = ../../src/fltk3/Browser_.cxx; sourceTree = SOURCE_ROOT; };
+		B89AE0F97A9095F4A064E6FF /* Browser_load.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Browser_load.cxx; path = ../../src/fltk3/Browser_load.cxx; sourceTree = SOURCE_ROOT; };
+		70F960885035F13513E45EFD /* Button.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Button.cxx; path = ../../src/fltk3/Button.cxx; sourceTree = SOURCE_ROOT; };
+		392500313F9EDFBFE2786E57 /* Chart.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Chart.cxx; path = ../../src/fltk3/Chart.cxx; sourceTree = SOURCE_ROOT; };
+		F6EC011E63665A01E72E52E7 /* CheckBrowser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckBrowser.cxx; path = ../../src/fltk3/CheckBrowser.cxx; sourceTree = SOURCE_ROOT; };
+		490C9DC52EF4532CC9795A6D /* CheckButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckButton.cxx; path = ../../src/fltk3/CheckButton.cxx; sourceTree = SOURCE_ROOT; };
+		6356BFF275FE7996D8F77F5C /* Choice.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Choice.cxx; path = ../../src/fltk3/Choice.cxx; sourceTree = SOURCE_ROOT; };
+		1C4F7DBF0BD658A6D786280A /* Clock.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Clock.cxx; path = ../../src/fltk3/Clock.cxx; sourceTree = SOURCE_ROOT; };
+		4CF353D8CC1FA86010629419 /* ColorChooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColorChooser.cxx; path = ../../src/fltk3/ColorChooser.cxx; sourceTree = SOURCE_ROOT; };
+		96D41530A69F4A84DBF7E11E /* Counter.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Counter.cxx; path = ../../src/fltk3/Counter.cxx; sourceTree = SOURCE_ROOT; };
+		CB4EA8042D07755CEA64E9FB /* Device.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Device.cxx; path = ../../src/fltk3/Device.cxx; sourceTree = SOURCE_ROOT; };
+		FDB4072264224B4391CAB607 /* Dial.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Dial.cxx; path = ../../src/fltk3/Dial.cxx; sourceTree = SOURCE_ROOT; };
+		D65E879CEE1870B6B73853BC /* DoubleWindow.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DoubleWindow.cxx; path = ../../src/fltk3/DoubleWindow.cxx; sourceTree = SOURCE_ROOT; };
+		31B32445C4ECC6487D814264 /* FileBrowser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileBrowser.cxx; path = ../../src/fltk3/FileBrowser.cxx; sourceTree = SOURCE_ROOT; };
+		E74C762F7266F6B35BA2394A /* FileChooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileChooser.cxx; path = ../../src/fltk3/FileChooser.cxx; sourceTree = SOURCE_ROOT; };
+		A7770A7FB7C79371A3BFB46C /* FileChooser2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileChooser2.cxx; path = ../../src/fltk3/FileChooser2.cxx; sourceTree = SOURCE_ROOT; };
+		19FA31AEDEFAC11C8EC5D035 /* FileIcon.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileIcon.cxx; path = ../../src/fltk3/FileIcon.cxx; sourceTree = SOURCE_ROOT; };
+		D05F5EBC3B022A7C99F2DDC2 /* FileInput.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileInput.cxx; path = ../../src/fltk3/FileInput.cxx; sourceTree = SOURCE_ROOT; };
+		A5952FB986701638B15F1B22 /* Group.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Group.cxx; path = ../../src/fltk3/Group.cxx; sourceTree = SOURCE_ROOT; };
+		047B650C9F322D0CB49D48D6 /* HelpView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelpView.cxx; path = ../../src/fltk3/HelpView.cxx; sourceTree = SOURCE_ROOT; };
+		E01E16F15C6443D98C32F5F6 /* Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Image.cxx; path = ../../src/fltk3/Image.cxx; sourceTree = SOURCE_ROOT; };
+		184F621088E304BDFD7A0384 /* Input.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Input.cxx; path = ../../src/fltk3/Input.cxx; sourceTree = SOURCE_ROOT; };
+		A892461439BFF8FC2D538E50 /* Input_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Input_.cxx; path = ../../src/fltk3/Input_.cxx; sourceTree = SOURCE_ROOT; };
+		36C72097C9A86A33861ACD51 /* LightButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LightButton.cxx; path = ../../src/fltk3/LightButton.cxx; sourceTree = SOURCE_ROOT; };
+		4672B51C8F8B9C0703D7EAA5 /* Menu.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Menu.cxx; path = ../../src/fltk3/Menu.cxx; sourceTree = SOURCE_ROOT; };
+		DE9E57A22E45C3039D820566 /* Menu_.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Menu_.cxx; path = ../../src/fltk3/Menu_.cxx; sourceTree = SOURCE_ROOT; };
+		265C00BF9D9598D2A10BE42A /* MenuBar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MenuBar.cxx; path = ../../src/fltk3/MenuBar.cxx; sourceTree = SOURCE_ROOT; };
+		58FD2064B2C854618D2E68DB /* MenuButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MenuButton.cxx; path = ../../src/fltk3/MenuButton.cxx; sourceTree = SOURCE_ROOT; };
+		CBE03F81CF8A43E9735AEFC9 /* MenuWindow.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MenuWindow.cxx; path = ../../src/fltk3/MenuWindow.cxx; sourceTree = SOURCE_ROOT; };
+		C649ABF1BD8B5FB41539FB5F /* Menu_add.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Menu_add.cxx; path = ../../src/fltk3/Menu_add.cxx; sourceTree = SOURCE_ROOT; };
+		25D17230FC589A55DA9C6F23 /* Menu_global.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Menu_global.cxx; path = ../../src/fltk3/Menu_global.cxx; sourceTree = SOURCE_ROOT; };
+		37D57C7D98BB88CE1A3BFC20 /* MultiLabel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MultiLabel.cxx; path = ../../src/fltk3/MultiLabel.cxx; sourceTree = SOURCE_ROOT; };
+		FC634C34D16F1DE6EF923847 /* NativeFileChooser.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NativeFileChooser.cxx; path = ../../src/fltk3/NativeFileChooser.cxx; sourceTree = SOURCE_ROOT; };
+		CEF1A66A542A208607C52832 /* OverlayWindow.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OverlayWindow.cxx; path = ../../src/fltk3/OverlayWindow.cxx; sourceTree = SOURCE_ROOT; };
+		0F0129FF3753E991F59B9FB5 /* PackedGroup.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PackedGroup.cxx; path = ../../src/fltk3/PackedGroup.cxx; sourceTree = SOURCE_ROOT; };
+		680EF039247E0C542AD802F6 /* PagedDevice.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PagedDevice.cxx; path = ../../src/fltk3/PagedDevice.cxx; sourceTree = SOURCE_ROOT; };
+		9AEB93657A00F78B2046454D /* Pixmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Pixmap.cxx; path = ../../src/fltk3/Pixmap.cxx; sourceTree = SOURCE_ROOT; };
+		9EB992B1957E27AE06A07426 /* Positioner.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Positioner.cxx; path = ../../src/fltk3/Positioner.cxx; sourceTree = SOURCE_ROOT; };
+		53F2F9DED1C91758A21D0246 /* Printer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Printer.cxx; path = ../../src/fltk3/Printer.cxx; sourceTree = SOURCE_ROOT; };
+		596103743F0CE2A89B7B3FA5 /* Preferences.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Preferences.cxx; path = ../../src/fltk3/Preferences.cxx; sourceTree = SOURCE_ROOT; };
+		B62169E8816659E5E6E4DD9F /* Progress.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Progress.cxx; path = ../../src/fltk3/Progress.cxx; sourceTree = SOURCE_ROOT; };
+		F2E611B0C2D8C53DD06946BC /* RepeatButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RepeatButton.cxx; path = ../../src/fltk3/RepeatButton.cxx; sourceTree = SOURCE_ROOT; };
+		69E296C029FB3078A82EE913 /* ReturnButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ReturnButton.cxx; path = ../../src/fltk3/ReturnButton.cxx; sourceTree = SOURCE_ROOT; };
+		A5526E662D03F4C9647C13A4 /* Roller.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Roller.cxx; path = ../../src/fltk3/Roller.cxx; sourceTree = SOURCE_ROOT; };
+		5DA33AF375B975EBBE824A96 /* RoundButton.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RoundButton.cxx; path = ../../src/fltk3/RoundButton.cxx; sourceTree = SOURCE_ROOT; };
+		135F7AE45CBDAA49D80BB12D /* ScrollGroup.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScrollGroup.cxx; path = ../../src/fltk3/ScrollGroup.cxx; sourceTree = SOURCE_ROOT; };
+		6F7BEB35272214B6167B1FB8 /* Scrollbar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Scrollbar.cxx; path = ../../src/fltk3/Scrollbar.cxx; sourceTree = SOURCE_ROOT; };
+		8580401C9D38395ECAD127AC /* SharedImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SharedImage.cxx; path = ../../src/fltk3/SharedImage.cxx; sourceTree = SOURCE_ROOT; };
+		17A03BA54D8D67397D8BDCEE /* SingleWindow.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SingleWindow.cxx; path = ../../src/fltk3/SingleWindow.cxx; sourceTree = SOURCE_ROOT; };
+		085FAF82201B9FD1927A8BAA /* Slider.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Slider.cxx; path = ../../src/fltk3/Slider.cxx; sourceTree = SOURCE_ROOT; };
+		CAA3AD964456E0912791C783 /* Style.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Style.cxx; path = ../../src/fltk3/Style.cxx; sourceTree = SOURCE_ROOT; };
+		43C12A4D372777B2307220CC /* SysMenuBar.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SysMenuBar.cxx; path = ../../src/fltk3/SysMenuBar.cxx; sourceTree = SOURCE_ROOT; };
+		025842431942A90D06F5BCFA /* Table.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Table.cxx; path = ../../src/fltk3/Table.cxx; sourceTree = SOURCE_ROOT; };
+		7097EA09B5B8FCFEEBE28CA8 /* TableRow.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TableRow.cxx; path = ../../src/fltk3/TableRow.cxx; sourceTree = SOURCE_ROOT; };
+		7712638143B8C0B51FF6A61B /* TabGroup.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TabGroup.cxx; path = ../../src/fltk3/TabGroup.cxx; sourceTree = SOURCE_ROOT; };
+		8867A20B30D85F73D157D617 /* TextBuffer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextBuffer.cxx; path = ../../src/fltk3/TextBuffer.cxx; sourceTree = SOURCE_ROOT; };
+		E5E1DA87EC62BC799411CDB9 /* TextDisplay.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextDisplay.cxx; path = ../../src/fltk3/TextDisplay.cxx; sourceTree = SOURCE_ROOT; };
+		5995AACC387B26DECEE88139 /* TextEditor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TextEditor.cxx; path = ../../src/fltk3/TextEditor.cxx; sourceTree = SOURCE_ROOT; };
+		A3F6667DE920CB42ED6E95FC /* TiledGroup.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TiledGroup.cxx; path = ../../src/fltk3/TiledGroup.cxx; sourceTree = SOURCE_ROOT; };
+		4C92BA7B6F3DA54449388F69 /* TiledImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TiledImage.cxx; path = ../../src/fltk3/TiledImage.cxx; sourceTree = SOURCE_ROOT; };
+		22CA4A41B4BF6D6AF6A6F244 /* Tooltip.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tooltip.cxx; path = ../../src/fltk3/Tooltip.cxx; sourceTree = SOURCE_ROOT; };
+		214492E971DD58A3EF8FEAA3 /* Tree.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Tree.cxx; path = ../../src/fltk3/Tree.cxx; sourceTree = SOURCE_ROOT; };
+		D9F29791281BE27706AB7E8E /* TreeItem.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TreeItem.cxx; path = ../../src/fltk3/TreeItem.cxx; sourceTree = SOURCE_ROOT; };
+		D6CBFFFA62847DACFACE5284 /* TreeItemArray.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TreeItemArray.cxx; path = ../../src/fltk3/TreeItemArray.cxx; sourceTree = SOURCE_ROOT; };
+		CFFE37EE7360FD052E7B592D /* TreePrefs.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TreePrefs.cxx; path = ../../src/fltk3/TreePrefs.cxx; sourceTree = SOURCE_ROOT; };
+		35EB53B1A2D1EF0E37A4970E /* Valuator.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Valuator.cxx; path = ../../src/fltk3/Valuator.cxx; sourceTree = SOURCE_ROOT; };
+		1685625EE3C5677F29D7D314 /* ValueInput.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueInput.cxx; path = ../../src/fltk3/ValueInput.cxx; sourceTree = SOURCE_ROOT; };
+		7553A0E747824E627DB0DDE5 /* ValueOutput.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueOutput.cxx; path = ../../src/fltk3/ValueOutput.cxx; sourceTree = SOURCE_ROOT; };
+		07F5E789A6A94E38E46B9744 /* ValueSlider.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ValueSlider.cxx; path = ../../src/fltk3/ValueSlider.cxx; sourceTree = SOURCE_ROOT; };
+		C5F5E189BBE256A698ADF418 /* Widget.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Widget.cxx; path = ../../src/fltk3/Widget.cxx; sourceTree = SOURCE_ROOT; };
+		8E1A3A4FC6492F080AF48D54 /* Window.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Window.cxx; path = ../../src/fltk3/Window.cxx; sourceTree = SOURCE_ROOT; };
+		7679F6CC5391C705D9B921DA /* Window_fullscreen.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Window_fullscreen.cxx; path = ../../src/fltk3/Window_fullscreen.cxx; sourceTree = SOURCE_ROOT; };
+		B5E58AC3929D3ADCBE238301 /* Window_hotspot.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Window_hotspot.cxx; path = ../../src/fltk3/Window_hotspot.cxx; sourceTree = SOURCE_ROOT; };
+		C34CF806FAE9E39DDFD23D3B /* Window_iconize.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Window_iconize.cxx; path = ../../src/fltk3/Window_iconize.cxx; sourceTree = SOURCE_ROOT; };
+		A84F18440208B2AA809D2871 /* Wizard.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Wizard.cxx; path = ../../src/fltk3/Wizard.cxx; sourceTree = SOURCE_ROOT; };
+		9A21D7EDE35664C4B0EDD969 /* XBMImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XBMImage.cxx; path = ../../src/fltk3/XBMImage.cxx; sourceTree = SOURCE_ROOT; };
+		302A3FA8AB59DE7E5255E28C /* XPMImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XPMImage.cxx; path = ../../src/fltk3/XPMImage.cxx; sourceTree = SOURCE_ROOT; };
+		671B96BA5D85D5C6EE31AB76 /* abort.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = abort.cxx; path = ../../src/fltk3/abort.cxx; sourceTree = SOURCE_ROOT; };
+		1821AF479F52B67539CB0CF8 /* add_idle.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = add_idle.cxx; path = ../../src/fltk3/add_idle.cxx; sourceTree = SOURCE_ROOT; };
+		8E5EB755BAF13FB15109FC0C /* arg.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arg.cxx; path = ../../src/fltk3/arg.cxx; sourceTree = SOURCE_ROOT; };
+		AA048ACBE220E831739595BD /* compose.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = compose.cxx; path = ../../src/fltk3/compose.cxx; sourceTree = SOURCE_ROOT; };
+		44287148E62E709880C4EA41 /* display.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = display.cxx; path = ../../src/fltk3/display.cxx; sourceTree = SOURCE_ROOT; };
+		A8DC358A8390A493A9A8AE55 /* get_key.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = get_key.cxx; path = ../../src/fltk3/get_key.cxx; sourceTree = SOURCE_ROOT; };
+		FEADB63E5C237A827884C5C5 /* get_system_colors.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = get_system_colors.cxx; path = ../../src/fltk3/get_system_colors.cxx; sourceTree = SOURCE_ROOT; };
+		76AA6E6C769FB157F8125874 /* grab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = grab.cxx; path = ../../src/fltk3/grab.cxx; sourceTree = SOURCE_ROOT; };
+		7FAC51832563F8B044E55B90 /* lock.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lock.cxx; path = ../../src/fltk3/lock.cxx; sourceTree = SOURCE_ROOT; };
+		013DBB50198366613C31E2A9 /* own_colormap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = own_colormap.cxx; path = ../../src/fltk3/own_colormap.cxx; sourceTree = SOURCE_ROOT; };
+		1626800F2D2DF61E9E2468DD /* visual.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = visual.cxx; path = ../../src/fltk3/visual.cxx; sourceTree = SOURCE_ROOT; };
+		F285310A7BD8D88F965104C8 /* x11.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = x11.cxx; path = ../../src/fltk3/x11.cxx; sourceTree = SOURCE_ROOT; };
+		04A6409B52D5A99617606460 /* filename_absolute.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_absolute.cxx; path = ../../src/fltk3/filename_absolute.cxx; sourceTree = SOURCE_ROOT; };
+		F9F779F221E630EE4A837595 /* filename_expand.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_expand.cxx; path = ../../src/fltk3/filename_expand.cxx; sourceTree = SOURCE_ROOT; };
+		210616B209B714E918A5CD3B /* filename_ext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_ext.cxx; path = ../../src/fltk3/filename_ext.cxx; sourceTree = SOURCE_ROOT; };
+		C07EC3AE77BDACC48058E2CA /* filename_isdir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_isdir.cxx; path = ../../src/fltk3/filename_isdir.cxx; sourceTree = SOURCE_ROOT; };
+		F08599CCE19B1640395AB3D0 /* filename_list.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_list.cxx; path = ../../src/fltk3/filename_list.cxx; sourceTree = SOURCE_ROOT; };
+		AB171A4BF938A263E10FD0AD /* filename_match.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_match.cxx; path = ../../src/fltk3/filename_match.cxx; sourceTree = SOURCE_ROOT; };
+		003AA96B03F174957585B088 /* filename_setext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filename_setext.cxx; path = ../../src/fltk3/filename_setext.cxx; sourceTree = SOURCE_ROOT; };
+		876B6A633C2E666DFC3119DD /* arc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arc.cxx; path = ../../src/fltk3/arc.cxx; sourceTree = SOURCE_ROOT; };
+		E52CB16DD470DA22063934AA /* arci.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arci.cxx; path = ../../src/fltk3/arci.cxx; sourceTree = SOURCE_ROOT; };
+		60E7DD739D5DDBD766E2E30F /* ask.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ask.cxx; path = ../../src/fltk3/ask.cxx; sourceTree = SOURCE_ROOT; };
+		BC14596F24E305FE8CE39DAF /* boxtype.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = boxtype.cxx; path = ../../src/fltk3/boxtype.cxx; sourceTree = SOURCE_ROOT; };
+		8B35EF2F662F706A2B46BDD7 /* call_main.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = call_main.cxx; path = ../../src/fltk3/call_main.cxx; sourceTree = SOURCE_ROOT; };
+		02716487EA5E04A784DE5A34 /* color.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = color.cxx; path = ../../src/fltk3/color.cxx; sourceTree = SOURCE_ROOT; };
+		C832D220ECF843E28FBAFED8 /* cursor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cursor.cxx; path = ../../src/fltk3/cursor.cxx; sourceTree = SOURCE_ROOT; };
+		53EC964ED2E6DE4CBF80B206 /* curve.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = curve.cxx; path = ../../src/fltk3/curve.cxx; sourceTree = SOURCE_ROOT; };
+		5557266E1C9D440172D5DF09 /* diamond_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = diamond_box.cxx; path = ../../src/fltk3/diamond_box.cxx; sourceTree = SOURCE_ROOT; };
+		D1E006BE295C0F88A8E51304 /* dnd.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dnd.cxx; path = ../../src/fltk3/dnd.cxx; sourceTree = SOURCE_ROOT; };
+		3CF0F8B538EFFF602D6549B0 /* draw.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = draw.cxx; path = ../../src/fltk3/draw.cxx; sourceTree = SOURCE_ROOT; };
+		F608DA64A6A66C65E7494BEA /* draw_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = draw_image.cxx; path = ../../src/fltk3/draw_image.cxx; sourceTree = SOURCE_ROOT; };
+		B6E2BA6C16F8BB32016C0FF0 /* draw_pixmap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = draw_pixmap.cxx; path = ../../src/fltk3/draw_pixmap.cxx; sourceTree = SOURCE_ROOT; };
+		0BEBF5A734CD2113BB6BDA08 /* encoding_latin1.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = encoding_latin1.cxx; path = ../../src/fltk3/encoding_latin1.cxx; sourceTree = SOURCE_ROOT; };
+		C2BF9CDFAB8BFEF23768C51B /* encoding_mac_roman.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = encoding_mac_roman.cxx; path = ../../src/fltk3/encoding_mac_roman.cxx; sourceTree = SOURCE_ROOT; };
+		0522E1C24273419B45EF1B4D /* engraved_label.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = engraved_label.cxx; path = ../../src/fltk3/engraved_label.cxx; sourceTree = SOURCE_ROOT; };
+		1BF9BBF497705FBAD92797FF /* file_dir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = file_dir.cxx; path = ../../src/fltk3/file_dir.cxx; sourceTree = SOURCE_ROOT; };
+		1CFFB72AB54D6FECF9F0C89C /* font.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = font.cxx; path = ../../src/fltk3/font.cxx; sourceTree = SOURCE_ROOT; };
+		E3303C9AB8380CF95C000D0C /* gtk.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gtk.cxx; path = ../../src/fltk3/gtk.cxx; sourceTree = SOURCE_ROOT; };
+		95F43A2D694782E841E90C3A /* labeltype.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = labeltype.cxx; path = ../../src/fltk3/labeltype.cxx; sourceTree = SOURCE_ROOT; };
+		5FD374C4251D84126390EEE5 /* line_style.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = line_style.cxx; path = ../../src/fltk3/line_style.cxx; sourceTree = SOURCE_ROOT; };
+		5515C9CC733AC9F36A9B7E06 /* open_uri.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = open_uri.cxx; path = ../../src/fltk3/open_uri.cxx; sourceTree = SOURCE_ROOT; };
+		554EB8945D959B0EF565327A /* oval_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = oval_box.cxx; path = ../../src/fltk3/oval_box.cxx; sourceTree = SOURCE_ROOT; };
+		5536CF5142F45E75898D00BA /* overlay.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = overlay.cxx; path = ../../src/fltk3/overlay.cxx; sourceTree = SOURCE_ROOT; };
+		3132F0163EFDF4289F20DB50 /* overlay_visual.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = overlay_visual.cxx; path = ../../src/fltk3/overlay_visual.cxx; sourceTree = SOURCE_ROOT; };
+		D9934C34F12FADA862D201D1 /* plastic.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = plastic.cxx; path = ../../src/fltk3/plastic.cxx; sourceTree = SOURCE_ROOT; };
+		1FA85C8068154A53598C9B19 /* read_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = read_image.cxx; path = ../../src/fltk3/read_image.cxx; sourceTree = SOURCE_ROOT; };
+		82F1E1FCCD3708EA48A6FD1B /* rect.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rect.cxx; path = ../../src/fltk3/rect.cxx; sourceTree = SOURCE_ROOT; };
+		C791DFA1DA864C8105CA92D3 /* round_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = round_box.cxx; path = ../../src/fltk3/round_box.cxx; sourceTree = SOURCE_ROOT; };
+		557E80414B985272F1C0F5BE /* rounded_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rounded_box.cxx; path = ../../src/fltk3/rounded_box.cxx; sourceTree = SOURCE_ROOT; };
+		0E08EA1CF945ADA843805A2C /* scroll_area.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scroll_area.cxx; path = ../../src/fltk3/scroll_area.cxx; sourceTree = SOURCE_ROOT; };
+		C7ED2C14E31F1142DDCAC057 /* set_font.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = set_font.cxx; path = ../../src/fltk3/set_font.cxx; sourceTree = SOURCE_ROOT; };
+		22603052464D0ADEFA96A7E6 /* set_fonts.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = set_fonts.cxx; path = ../../src/fltk3/set_fonts.cxx; sourceTree = SOURCE_ROOT; };
+		2C5EEC8910127EC66EEA73B1 /* shadow_box.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shadow_box.cxx; path = ../../src/fltk3/shadow_box.cxx; sourceTree = SOURCE_ROOT; };
+		BFCE21B11BD00816E2D65029 /* shortcut.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = shortcut.cxx; path = ../../src/fltk3/shortcut.cxx; sourceTree = SOURCE_ROOT; };
+		76D6638ABB7D955E0B149360 /* show_colormap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = show_colormap.cxx; path = ../../src/fltk3/show_colormap.cxx; sourceTree = SOURCE_ROOT; };
+		ECAFDF98E362617FA9E2B887 /* symbols.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = symbols.cxx; path = ../../src/fltk3/symbols.cxx; sourceTree = SOURCE_ROOT; };
+		C82D09C9EB356BF14388A904 /* utf8.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utf8.cxx; path = ../../src/fltk3/utf8.cxx; sourceTree = SOURCE_ROOT; };
+		574878A10D223037009BD0DE /* utf.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = utf.cxx; path = ../../src/fltk3/utf.cxx; sourceTree = SOURCE_ROOT; };
+		6C74D84D95E5167E6D41A606 /* vertex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = vertex.cxx; path = ../../src/fltk3/vertex.cxx; sourceTree = SOURCE_ROOT; };
+		2286DB222E1D5D78655B21BB /* numericsort.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = numericsort.cxx; path = ../../src/fltk3/numericsort.cxx; sourceTree = SOURCE_ROOT; };
+		472AB3970C82CB496562F422 /* ps_image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ps_image.cxx; path = ../../src/fltk3/ps_image.cxx; sourceTree = SOURCE_ROOT; };
+		1E2B1DAE628CEB38A5F0E604 /* scandir.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scandir.cxx; path = ../../src/fltk3/scandir.cxx; sourceTree = SOURCE_ROOT; };
+		4302C79C4558E1F4750879E4 /* screen_xywh.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = screen_xywh.cxx; path = ../../src/fltk3/screen_xywh.cxx; sourceTree = SOURCE_ROOT; };
+		EF672C7C2929488ED55C8145 /* flstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = flstring.c; path = ../../src/fltk3/flstring.c; sourceTree = SOURCE_ROOT; };
+		4024031C45193E6173805457 /* vsnprintf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = vsnprintf.c; path = ../../src/fltk3/vsnprintf.c; sourceTree = SOURCE_ROOT; };
+		6A8D02403C9D3B785B0D8F30 /* case.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = case.c; path = ../../src/fltk3/xutf8/case.c; sourceTree = SOURCE_ROOT; };
+		15064F3F45361B071125C187 /* is_right2left.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = is_right2left.c; path = ../../src/fltk3/xutf8/is_right2left.c; sourceTree = SOURCE_ROOT; };
+		35196210FA39F50016C06ED2 /* is_spacing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = is_spacing.c; path = ../../src/fltk3/xutf8/is_spacing.c; sourceTree = SOURCE_ROOT; };
 		14F66311E977D66CE29024C3 /* Cocoa.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
 		86C380FE76A739F296A44961 /* fltk3.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = fltk3.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		CED790200D16A60047341619 /* all.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = all.h; path = ../../include/fltk3gl/all.h; sourceTree = SOURCE_ROOT; };
@@ -4197,14 +4197,22 @@
 		74F320856CA55C5B27D76923 /* OpenGL.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenGL.framework; sourceTree = DEVELOPER_DIR; };
 		39E229DEF1CA3739A0890F43 /* ApplicationServices.framework */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = SDKs/MacOSX10.7.sdk/System/Library/Frameworks/ApplicationServices.framework; sourceTree = DEVELOPER_DIR; };
 		47405B558C14400ABA410AF3 /* fltk3gl.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = fltk3gl.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-		BEBF424874FF4284B7383470 /* Fl_BMP_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_BMP_Image.cxx; path = ../../src/core/Fl_BMP_Image.cxx; sourceTree = SOURCE_ROOT; };
-		7655FB1C9C0EEA276E0C6765 /* Fl_File_Icon2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_File_Icon2.cxx; path = ../../src/core/Fl_File_Icon2.cxx; sourceTree = SOURCE_ROOT; };
-		CFAC1FAE7DBA77895E2BC5E9 /* Fl_GIF_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_GIF_Image.cxx; path = ../../src/core/Fl_GIF_Image.cxx; sourceTree = SOURCE_ROOT; };
-		0EDA91FFA01CB06D2CD72D46 /* Fl_Help_Dialog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_Help_Dialog.cxx; path = ../../src/core/Fl_Help_Dialog.cxx; sourceTree = SOURCE_ROOT; };
-		771C095FF2AE4FFCACA213AB /* Fl_JPEG_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_JPEG_Image.cxx; path = ../../src/core/Fl_JPEG_Image.cxx; sourceTree = SOURCE_ROOT; };
-		E1BECD1D14488DF25469A00E /* Fl_PNG_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_PNG_Image.cxx; path = ../../src/core/Fl_PNG_Image.cxx; sourceTree = SOURCE_ROOT; };
-		948DEE29F3A36A2E578DD9C0 /* Fl_PNM_Image.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Fl_PNM_Image.cxx; path = ../../src/core/Fl_PNM_Image.cxx; sourceTree = SOURCE_ROOT; };
-		6ADD9C72DA642E9780529588 /* fl_images_core.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = fl_images_core.cxx; path = ../../src/core/fl_images_core.cxx; sourceTree = SOURCE_ROOT; };
+		1010B13DA886270EE16E3514 /* all.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = all.h; path = ../../include/fltk3images/all.h; sourceTree = SOURCE_ROOT; };
+		2C2435D9DCE9D126983C81F3 /* fltk3images.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fltk3images.h; path = ../../include/fltk3images/fltk3images.h; sourceTree = SOURCE_ROOT; };
+		5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BMPImage.h; path = ../../include/fltk3images/BMPImage.h; sourceTree = SOURCE_ROOT; };
+		605121E099731EF9977E11C8 /* GIFImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GIFImage.h; path = ../../include/fltk3images/GIFImage.h; sourceTree = SOURCE_ROOT; };
+		0925F19306CD3458397661F3 /* HelpDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = HelpDialog.h; path = ../../include/fltk3images/HelpDialog.h; sourceTree = SOURCE_ROOT; };
+		60A217E0DC847E1DD7B44D49 /* JPEGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JPEGImage.h; path = ../../include/fltk3images/JPEGImage.h; sourceTree = SOURCE_ROOT; };
+		25BEA28581A1A97EEA1014E2 /* PNGImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNGImage.h; path = ../../include/fltk3images/PNGImage.h; sourceTree = SOURCE_ROOT; };
+		EC95850E022AFDFC59E4EBC2 /* PNMImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PNMImage.h; path = ../../include/fltk3images/PNMImage.h; sourceTree = SOURCE_ROOT; };
+		BEBF424874FF4284B7383470 /* BMPImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BMPImage.cxx; path = ../../src/fltk3images/BMPImage.cxx; sourceTree = SOURCE_ROOT; };
+		7655FB1C9C0EEA276E0C6765 /* FileIcon2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileIcon2.cxx; path = ../../src/fltk3images/FileIcon2.cxx; sourceTree = SOURCE_ROOT; };
+		CFAC1FAE7DBA77895E2BC5E9 /* GIFImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GIFImage.cxx; path = ../../src/fltk3images/GIFImage.cxx; sourceTree = SOURCE_ROOT; };
+		0EDA91FFA01CB06D2CD72D46 /* HelpDialog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HelpDialog.cxx; path = ../../src/fltk3images/HelpDialog.cxx; sourceTree = SOURCE_ROOT; };
+		6ADD9C72DA642E9780529588 /* images_core.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = images_core.cxx; path = ../../src/fltk3images/images_core.cxx; sourceTree = SOURCE_ROOT; };
+		771C095FF2AE4FFCACA213AB /* JPEGImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JPEGImage.cxx; path = ../../src/fltk3images/JPEGImage.cxx; sourceTree = SOURCE_ROOT; };
+		E1BECD1D14488DF25469A00E /* PNGImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PNGImage.cxx; path = ../../src/fltk3images/PNGImage.cxx; sourceTree = SOURCE_ROOT; };
+		948DEE29F3A36A2E578DD9C0 /* PNMImage.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PNMImage.cxx; path = ../../src/fltk3images/PNMImage.cxx; sourceTree = SOURCE_ROOT; };
 		BF7522F0908E6250B67C2110 /* fltk3images.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = fltk3images.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		6B712BE1A8794707CD95C26F /* png.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = png.c; path = ../../src/fltk3png/png.c; sourceTree = SOURCE_ROOT; };
 		1773D73E34DF0D8632576CC2 /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pngerror.c; path = ../../src/fltk3png/pngerror.c; sourceTree = SOURCE_ROOT; };
@@ -5303,10 +5311,11 @@
 		C2F00625A4037FEE3D17629D /* Headers */ = {
 			isa = PBXGroup;
 			children = (
+				DDEC0AB0E55CB75CFA5FD9DC /* all.h */,
+				15B1A08E928290071C92EDD1 /* fltk3.h */,
 				1CDC310CF438C4E007EE265B /* Adjuster.h */,
 				D31DE8ACD497B8FA62A57910 /* ask.h */,
 				249A3332647089ACC2702523 /* Bitmap.h */,
-				5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */,
 				0800D21F849D8F2CDB90C72D /* Box.h */,
 				32841D65E2F82C3F24A360D2 /* Browser_.h */,
 				B8F30574865BA1A8081AF0E4 /* Browser.h */,
@@ -5339,9 +5348,7 @@
 				11DF5111A6EE377DAAFDB68B /* FormsBitmap.h */,
 				7E62E615D0C146DBB74B477A /* FormsPixmap.h */,
 				11F5FE43FEC401E52D4CABB7 /* Free.h */,
-				605121E099731EF9977E11C8 /* GIFImage.h */,
 				91EA037664D5A2D49603F364 /* Group.h */,
-				0925F19306CD3458397661F3 /* HelpDialog.h */,
 				0CD096CD5808EADB1B646DB4 /* HelpView.h */,
 				CFF83CFB9E060DA4F81AE816 /* HoldBrowser.h */,
 				5C8658CA906CD5A6C35FA96B /* HorFillSlider.h */,
@@ -5353,7 +5360,6 @@
 				28D897DFA27CCC5A3933D952 /* Input.h */,
 				11C999453D2BEBD3A5B32DA4 /* InputChoice.h */,
 				B5CA37E08339E6D7820C0973 /* IntInput.h */,
-				60A217E0DC847E1DD7B44D49 /* JPEGImage.h */,
 				5A390823203566E8B1FB4B81 /* LightButton.h */,
 				D10E3F19DD8CC6A3FAA912AF /* LineDial.h */,
 				6523340D0E47A3A4B3852435 /* math.h */,
@@ -5379,8 +5385,6 @@
 				C539C329532BE09B0422A23A /* PagedDevice.h */,
 				AEF910125AE91654739457BF /* Pixmap.h */,
 				A5DB3592DA82366555A66B4A /* Plugin.h */,
-				25BEA28581A1A97EEA1014E2 /* PNGImage.h */,
-				EC95850E022AFDFC59E4EBC2 /* PNMImage.h */,
 				813FC8746075A74FEDAE447C /* Positioner.h */,
 				6A0B5BF3C5ECFAF041951029 /* PostScript.h */,
 				A9B88BB6C6654424E37B8082 /* Preferences.h */,
@@ -5439,9 +5443,9 @@
 				8BD4A9C136E457CC92F9ADFE /* WizardGroup.h */,
 				DF6994452C6FD170E9507C6D /* Wrapper.h */,
 				059505668BA88697E40E6C32 /* x.h */,
+				2E1B408952EFBB79A46CDE69 /* Xutf8.h */,
 				9F6F453D846A6B7E8679FDAA /* XBMImage.h */,
 				0C163988CD45E6AB4710982F /* XPMImage.h */,
-				2E1B408952EFBB79A46CDE69 /* Xutf8.h */,
 			);
 			name = Headers;
 			sourceTree = "<group>";
@@ -5449,103 +5453,103 @@
 		91990322480BD14240EE5AB1 /* Sources */ = {
 			isa = PBXGroup;
 			children = (
-				F6BB47B6B9E3180AB7C5F16D /* Fl_cocoa.mm */,
-				B23CCB736CF9A2433827C3EE /* Fl_Native_File_Chooser_MAC.mm */,
-				10A048C45D4667189C9F77EA /* Fl_Quartz_Printer.mm */,
+				F6BB47B6B9E3180AB7C5F16D /* cocoa.mm */,
+				B23CCB736CF9A2433827C3EE /* cocoaNativeFileChooser.mm */,
+				10A048C45D4667189C9F77EA /* cocoaQuartzPrinter.mm */,
 				81045D024AA56D9CD81C23A2 /* run.cxx */,
-				ECEA64F2B2C5C5186949AD76 /* Fl_Adjuster.cxx */,
-				D68004A5D4D7878F2E22B59B /* Fl_Bitmap.cxx */,
-				81608512CDA5C11B35A2B539 /* Fl_Box.cxx */,
-				5CE1FF6EF6F9500754C22170 /* Fl_Browser.cxx */,
-				2FC85E98AAFBF45C8EBBA1CC /* Fl_Browser_.cxx */,
-				B89AE0F97A9095F4A064E6FF /* Fl_Browser_load.cxx */,
-				70F960885035F13513E45EFD /* Fl_Button.cxx */,
-				392500313F9EDFBFE2786E57 /* Fl_Chart.cxx */,
-				F6EC011E63665A01E72E52E7 /* Fl_Check_Browser.cxx */,
-				490C9DC52EF4532CC9795A6D /* Fl_Check_Button.cxx */,
-				6356BFF275FE7996D8F77F5C /* Fl_Choice.cxx */,
-				1C4F7DBF0BD658A6D786280A /* Fl_Clock.cxx */,
-				4CF353D8CC1FA86010629419 /* Fl_Color_Chooser.cxx */,
-				96D41530A69F4A84DBF7E11E /* Fl_Counter.cxx */,
-				CB4EA8042D07755CEA64E9FB /* Fl_Device.cxx */,
-				FDB4072264224B4391CAB607 /* Fl_Dial.cxx */,
-				D65E879CEE1870B6B73853BC /* Fl_Double_Window.cxx */,
-				31B32445C4ECC6487D814264 /* Fl_File_Browser.cxx */,
-				E74C762F7266F6B35BA2394A /* Fl_File_Chooser.cxx */,
-				A7770A7FB7C79371A3BFB46C /* Fl_File_Chooser2.cxx */,
-				19FA31AEDEFAC11C8EC5D035 /* Fl_File_Icon.cxx */,
-				D05F5EBC3B022A7C99F2DDC2 /* Fl_File_Input.cxx */,
-				A5952FB986701638B15F1B22 /* Fl_Group.cxx */,
-				047B650C9F322D0CB49D48D6 /* Fl_Help_View.cxx */,
-				E01E16F15C6443D98C32F5F6 /* Fl_Image.cxx */,
-				184F621088E304BDFD7A0384 /* Fl_Input.cxx */,
-				A892461439BFF8FC2D538E50 /* Fl_Input_.cxx */,
-				36C72097C9A86A33861ACD51 /* Fl_Light_Button.cxx */,
-				4672B51C8F8B9C0703D7EAA5 /* Fl_Menu.cxx */,
-				DE9E57A22E45C3039D820566 /* Fl_Menu_.cxx */,
-				265C00BF9D9598D2A10BE42A /* Fl_Menu_Bar.cxx */,
-				58FD2064B2C854618D2E68DB /* Fl_Menu_Button.cxx */,
-				CBE03F81CF8A43E9735AEFC9 /* Fl_Menu_Window.cxx */,
-				C649ABF1BD8B5FB41539FB5F /* Fl_Menu_add.cxx */,
-				25D17230FC589A55DA9C6F23 /* Fl_Menu_global.cxx */,
-				37D57C7D98BB88CE1A3BFC20 /* Fl_Multi_Label.cxx */,
-				FC634C34D16F1DE6EF923847 /* Fl_Native_File_Chooser.cxx */,
-				CEF1A66A542A208607C52832 /* Fl_Overlay_Window.cxx */,
-				0F0129FF3753E991F59B9FB5 /* Fl_Pack.cxx */,
-				680EF039247E0C542AD802F6 /* Fl_Paged_Device.cxx */,
-				9AEB93657A00F78B2046454D /* Fl_Pixmap.cxx */,
-				9EB992B1957E27AE06A07426 /* Fl_Positioner.cxx */,
-				53F2F9DED1C91758A21D0246 /* Fl_Printer.cxx */,
-				596103743F0CE2A89B7B3FA5 /* Fl_Preferences.cxx */,
-				B62169E8816659E5E6E4DD9F /* Fl_Progress.cxx */,
-				F2E611B0C2D8C53DD06946BC /* Fl_Repeat_Button.cxx */,
-				69E296C029FB3078A82EE913 /* Fl_Return_Button.cxx */,
-				A5526E662D03F4C9647C13A4 /* Fl_Roller.cxx */,
-				5DA33AF375B975EBBE824A96 /* Fl_Round_Button.cxx */,
-				135F7AE45CBDAA49D80BB12D /* Fl_Scroll.cxx */,
-				6F7BEB35272214B6167B1FB8 /* Fl_Scrollbar.cxx */,
-				8580401C9D38395ECAD127AC /* Fl_Shared_Image.cxx */,
-				17A03BA54D8D67397D8BDCEE /* Fl_Single_Window.cxx */,
-				085FAF82201B9FD1927A8BAA /* Fl_Slider.cxx */,
+				ECEA64F2B2C5C5186949AD76 /* Adjuster.cxx */,
+				D68004A5D4D7878F2E22B59B /* Bitmap.cxx */,
+				81608512CDA5C11B35A2B539 /* Box.cxx */,
+				5CE1FF6EF6F9500754C22170 /* Browser.cxx */,
+				2FC85E98AAFBF45C8EBBA1CC /* Browser_.cxx */,
+				B89AE0F97A9095F4A064E6FF /* Browser_load.cxx */,
+				70F960885035F13513E45EFD /* Button.cxx */,
+				392500313F9EDFBFE2786E57 /* Chart.cxx */,
+				F6EC011E63665A01E72E52E7 /* CheckBrowser.cxx */,
+				490C9DC52EF4532CC9795A6D /* CheckButton.cxx */,
+				6356BFF275FE7996D8F77F5C /* Choice.cxx */,
+				1C4F7DBF0BD658A6D786280A /* Clock.cxx */,
+				4CF353D8CC1FA86010629419 /* ColorChooser.cxx */,
+				96D41530A69F4A84DBF7E11E /* Counter.cxx */,
+				CB4EA8042D07755CEA64E9FB /* Device.cxx */,
+				FDB4072264224B4391CAB607 /* Dial.cxx */,
+				D65E879CEE1870B6B73853BC /* DoubleWindow.cxx */,
+				31B32445C4ECC6487D814264 /* FileBrowser.cxx */,
+				E74C762F7266F6B35BA2394A /* FileChooser.cxx */,
+				A7770A7FB7C79371A3BFB46C /* FileChooser2.cxx */,
+				19FA31AEDEFAC11C8EC5D035 /* FileIcon.cxx */,
+				D05F5EBC3B022A7C99F2DDC2 /* FileInput.cxx */,
+				A5952FB986701638B15F1B22 /* Group.cxx */,
+				047B650C9F322D0CB49D48D6 /* HelpView.cxx */,
+				E01E16F15C6443D98C32F5F6 /* Image.cxx */,
+				184F621088E304BDFD7A0384 /* Input.cxx */,
+				A892461439BFF8FC2D538E50 /* Input_.cxx */,
+				36C72097C9A86A33861ACD51 /* LightButton.cxx */,
+				4672B51C8F8B9C0703D7EAA5 /* Menu.cxx */,
+				DE9E57A22E45C3039D820566 /* Menu_.cxx */,
+				265C00BF9D9598D2A10BE42A /* MenuBar.cxx */,
+				58FD2064B2C854618D2E68DB /* MenuButton.cxx */,
+				CBE03F81CF8A43E9735AEFC9 /* MenuWindow.cxx */,
+				C649ABF1BD8B5FB41539FB5F /* Menu_add.cxx */,
+				25D17230FC589A55DA9C6F23 /* Menu_global.cxx */,
+				37D57C7D98BB88CE1A3BFC20 /* MultiLabel.cxx */,
+				FC634C34D16F1DE6EF923847 /* NativeFileChooser.cxx */,
+				CEF1A66A542A208607C52832 /* OverlayWindow.cxx */,
+				0F0129FF3753E991F59B9FB5 /* PackedGroup.cxx */,
+				680EF039247E0C542AD802F6 /* PagedDevice.cxx */,
+				9AEB93657A00F78B2046454D /* Pixmap.cxx */,
+				9EB992B1957E27AE06A07426 /* Positioner.cxx */,
+				53F2F9DED1C91758A21D0246 /* Printer.cxx */,
+				596103743F0CE2A89B7B3FA5 /* Preferences.cxx */,
+				B62169E8816659E5E6E4DD9F /* Progress.cxx */,
+				F2E611B0C2D8C53DD06946BC /* RepeatButton.cxx */,
+				69E296C029FB3078A82EE913 /* ReturnButton.cxx */,
+				A5526E662D03F4C9647C13A4 /* Roller.cxx */,
+				5DA33AF375B975EBBE824A96 /* RoundButton.cxx */,
+				135F7AE45CBDAA49D80BB12D /* ScrollGroup.cxx */,
+				6F7BEB35272214B6167B1FB8 /* Scrollbar.cxx */,
+				8580401C9D38395ECAD127AC /* SharedImage.cxx */,
+				17A03BA54D8D67397D8BDCEE /* SingleWindow.cxx */,
+				085FAF82201B9FD1927A8BAA /* Slider.cxx */,
 				CAA3AD964456E0912791C783 /* Style.cxx */,
-				43C12A4D372777B2307220CC /* Fl_Sys_Menu_Bar.cxx */,
-				025842431942A90D06F5BCFA /* Fl_Table.cxx */,
-				7097EA09B5B8FCFEEBE28CA8 /* Fl_Table_Row.cxx */,
-				7712638143B8C0B51FF6A61B /* Fl_Tabs.cxx */,
-				8867A20B30D85F73D157D617 /* Fl_Text_Buffer.cxx */,
-				E5E1DA87EC62BC799411CDB9 /* Fl_Text_Display.cxx */,
-				5995AACC387B26DECEE88139 /* Fl_Text_Editor.cxx */,
-				A3F6667DE920CB42ED6E95FC /* Fl_Tile.cxx */,
-				4C92BA7B6F3DA54449388F69 /* Fl_Tiled_Image.cxx */,
-				22CA4A41B4BF6D6AF6A6F244 /* Fl_Tooltip.cxx */,
-				214492E971DD58A3EF8FEAA3 /* Fl_Tree.cxx */,
-				D9F29791281BE27706AB7E8E /* Fl_Tree_Item.cxx */,
-				D6CBFFFA62847DACFACE5284 /* Fl_Tree_Item_Array.cxx */,
-				CFFE37EE7360FD052E7B592D /* Fl_Tree_Prefs.cxx */,
-				35EB53B1A2D1EF0E37A4970E /* Fl_Valuator.cxx */,
-				1685625EE3C5677F29D7D314 /* Fl_Value_Input.cxx */,
-				7553A0E747824E627DB0DDE5 /* Fl_Value_Output.cxx */,
-				07F5E789A6A94E38E46B9744 /* Fl_Value_Slider.cxx */,
-				C5F5E189BBE256A698ADF418 /* Fl_Widget.cxx */,
-				8E1A3A4FC6492F080AF48D54 /* Fl_Window.cxx */,
-				7679F6CC5391C705D9B921DA /* Fl_Window_fullscreen.cxx */,
-				B5E58AC3929D3ADCBE238301 /* Fl_Window_hotspot.cxx */,
-				C34CF806FAE9E39DDFD23D3B /* Fl_Window_iconize.cxx */,
-				A84F18440208B2AA809D2871 /* Fl_Wizard.cxx */,
-				9A21D7EDE35664C4B0EDD969 /* Fl_XBM_Image.cxx */,
-				302A3FA8AB59DE7E5255E28C /* Fl_XPM_Image.cxx */,
-				671B96BA5D85D5C6EE31AB76 /* Fl_abort.cxx */,
-				1821AF479F52B67539CB0CF8 /* Fl_add_idle.cxx */,
-				8E5EB755BAF13FB15109FC0C /* Fl_arg.cxx */,
-				AA048ACBE220E831739595BD /* Fl_compose.cxx */,
-				44287148E62E709880C4EA41 /* Fl_display.cxx */,
-				A8DC358A8390A493A9A8AE55 /* Fl_get_key.cxx */,
-				FEADB63E5C237A827884C5C5 /* Fl_get_system_colors.cxx */,
-				76AA6E6C769FB157F8125874 /* Fl_grab.cxx */,
-				7FAC51832563F8B044E55B90 /* Fl_lock.cxx */,
-				013DBB50198366613C31E2A9 /* Fl_own_colormap.cxx */,
-				1626800F2D2DF61E9E2468DD /* Fl_visual.cxx */,
-				F285310A7BD8D88F965104C8 /* Fl_x.cxx */,
+				43C12A4D372777B2307220CC /* SysMenuBar.cxx */,
+				025842431942A90D06F5BCFA /* Table.cxx */,
+				7097EA09B5B8FCFEEBE28CA8 /* TableRow.cxx */,
+				7712638143B8C0B51FF6A61B /* TabGroup.cxx */,
+				8867A20B30D85F73D157D617 /* TextBuffer.cxx */,
+				E5E1DA87EC62BC799411CDB9 /* TextDisplay.cxx */,
+				5995AACC387B26DECEE88139 /* TextEditor.cxx */,
+				A3F6667DE920CB42ED6E95FC /* TiledGroup.cxx */,
+				4C92BA7B6F3DA54449388F69 /* TiledImage.cxx */,
+				22CA4A41B4BF6D6AF6A6F244 /* Tooltip.cxx */,
+				214492E971DD58A3EF8FEAA3 /* Tree.cxx */,
+				D9F29791281BE27706AB7E8E /* TreeItem.cxx */,
+				D6CBFFFA62847DACFACE5284 /* TreeItemArray.cxx */,
+				CFFE37EE7360FD052E7B592D /* TreePrefs.cxx */,
+				35EB53B1A2D1EF0E37A4970E /* Valuator.cxx */,
+				1685625EE3C5677F29D7D314 /* ValueInput.cxx */,
+				7553A0E747824E627DB0DDE5 /* ValueOutput.cxx */,
+				07F5E789A6A94E38E46B9744 /* ValueSlider.cxx */,
+				C5F5E189BBE256A698ADF418 /* Widget.cxx */,
+				8E1A3A4FC6492F080AF48D54 /* Window.cxx */,
+				7679F6CC5391C705D9B921DA /* Window_fullscreen.cxx */,
+				B5E58AC3929D3ADCBE238301 /* Window_hotspot.cxx */,
+				C34CF806FAE9E39DDFD23D3B /* Window_iconize.cxx */,
+				A84F18440208B2AA809D2871 /* Wizard.cxx */,
+				9A21D7EDE35664C4B0EDD969 /* XBMImage.cxx */,
+				302A3FA8AB59DE7E5255E28C /* XPMImage.cxx */,
+				671B96BA5D85D5C6EE31AB76 /* abort.cxx */,
+				1821AF479F52B67539CB0CF8 /* add_idle.cxx */,
+				8E5EB755BAF13FB15109FC0C /* arg.cxx */,
+				AA048ACBE220E831739595BD /* compose.cxx */,
+				44287148E62E709880C4EA41 /* display.cxx */,
+				A8DC358A8390A493A9A8AE55 /* get_key.cxx */,
+				FEADB63E5C237A827884C5C5 /* get_system_colors.cxx */,
+				76AA6E6C769FB157F8125874 /* grab.cxx */,
+				7FAC51832563F8B044E55B90 /* lock.cxx */,
+				013DBB50198366613C31E2A9 /* own_colormap.cxx */,
+				1626800F2D2DF61E9E2468DD /* visual.cxx */,
+				F285310A7BD8D88F965104C8 /* x11.cxx */,
 				04A6409B52D5A99617606460 /* filename_absolute.cxx */,
 				F9F779F221E630EE4A837595 /* filename_expand.cxx */,
 				210616B209B714E918A5CD3B /* filename_ext.cxx */,
@@ -5553,46 +5557,46 @@
 				F08599CCE19B1640395AB3D0 /* filename_list.cxx */,
 				AB171A4BF938A263E10FD0AD /* filename_match.cxx */,
 				003AA96B03F174957585B088 /* filename_setext.cxx */,
-				876B6A633C2E666DFC3119DD /* fl_arc.cxx */,
-				E52CB16DD470DA22063934AA /* fl_arci.cxx */,
-				60E7DD739D5DDBD766E2E30F /* fl_ask.cxx */,
-				BC14596F24E305FE8CE39DAF /* fl_boxtype.cxx */,
-				8B35EF2F662F706A2B46BDD7 /* fl_call_main.cxx */,
-				02716487EA5E04A784DE5A34 /* fl_color.cxx */,
-				C832D220ECF843E28FBAFED8 /* fl_cursor.cxx */,
-				53EC964ED2E6DE4CBF80B206 /* fl_curve.cxx */,
-				5557266E1C9D440172D5DF09 /* fl_diamond_box.cxx */,
-				D1E006BE295C0F88A8E51304 /* fl_dnd.cxx */,
-				3CF0F8B538EFFF602D6549B0 /* fl_draw.cxx */,
-				F608DA64A6A66C65E7494BEA /* fl_draw_image.cxx */,
-				B6E2BA6C16F8BB32016C0FF0 /* fl_draw_pixmap.cxx */,
-				0BEBF5A734CD2113BB6BDA08 /* fl_encoding_latin1.cxx */,
-				C2BF9CDFAB8BFEF23768C51B /* fl_encoding_mac_roman.cxx */,
-				0522E1C24273419B45EF1B4D /* fl_engraved_label.cxx */,
-				1BF9BBF497705FBAD92797FF /* fl_file_dir.cxx */,
-				1CFFB72AB54D6FECF9F0C89C /* fl_font.cxx */,
-				E3303C9AB8380CF95C000D0C /* fl_gtk.cxx */,
-				95F43A2D694782E841E90C3A /* fl_labeltype.cxx */,
-				5FD374C4251D84126390EEE5 /* fl_line_style.cxx */,
-				5515C9CC733AC9F36A9B7E06 /* fl_open_uri.cxx */,
-				554EB8945D959B0EF565327A /* fl_oval_box.cxx */,
-				5536CF5142F45E75898D00BA /* fl_overlay.cxx */,
-				3132F0163EFDF4289F20DB50 /* fl_overlay_visual.cxx */,
-				D9934C34F12FADA862D201D1 /* fl_plastic.cxx */,
-				1FA85C8068154A53598C9B19 /* fl_read_image.cxx */,
-				82F1E1FCCD3708EA48A6FD1B /* fl_rect.cxx */,
-				C791DFA1DA864C8105CA92D3 /* fl_round_box.cxx */,
-				557E80414B985272F1C0F5BE /* fl_rounded_box.cxx */,
-				0E08EA1CF945ADA843805A2C /* fl_scroll_area.cxx */,
-				C7ED2C14E31F1142DDCAC057 /* fl_set_font.cxx */,
-				22603052464D0ADEFA96A7E6 /* fl_set_fonts.cxx */,
-				2C5EEC8910127EC66EEA73B1 /* fl_shadow_box.cxx */,
-				BFCE21B11BD00816E2D65029 /* fl_shortcut.cxx */,
-				76D6638ABB7D955E0B149360 /* fl_show_colormap.cxx */,
-				ECAFDF98E362617FA9E2B887 /* fl_symbols.cxx */,
-				C82D09C9EB356BF14388A904 /* fl_utf8.cxx */,
-				574878A10D223037009BD0DE /* fl_utf.cxx */,
-				6C74D84D95E5167E6D41A606 /* fl_vertex.cxx */,
+				876B6A633C2E666DFC3119DD /* arc.cxx */,
+				E52CB16DD470DA22063934AA /* arci.cxx */,
+				60E7DD739D5DDBD766E2E30F /* ask.cxx */,
+				BC14596F24E305FE8CE39DAF /* boxtype.cxx */,
+				8B35EF2F662F706A2B46BDD7 /* call_main.cxx */,
+				02716487EA5E04A784DE5A34 /* color.cxx */,
+				C832D220ECF843E28FBAFED8 /* cursor.cxx */,
+				53EC964ED2E6DE4CBF80B206 /* curve.cxx */,
+				5557266E1C9D440172D5DF09 /* diamond_box.cxx */,
+				D1E006BE295C0F88A8E51304 /* dnd.cxx */,
+				3CF0F8B538EFFF602D6549B0 /* draw.cxx */,
+				F608DA64A6A66C65E7494BEA /* draw_image.cxx */,
+				B6E2BA6C16F8BB32016C0FF0 /* draw_pixmap.cxx */,
+				0BEBF5A734CD2113BB6BDA08 /* encoding_latin1.cxx */,
+				C2BF9CDFAB8BFEF23768C51B /* encoding_mac_roman.cxx */,
+				0522E1C24273419B45EF1B4D /* engraved_label.cxx */,
+				1BF9BBF497705FBAD92797FF /* file_dir.cxx */,
+				1CFFB72AB54D6FECF9F0C89C /* font.cxx */,
+				E3303C9AB8380CF95C000D0C /* gtk.cxx */,
+				95F43A2D694782E841E90C3A /* labeltype.cxx */,
+				5FD374C4251D84126390EEE5 /* line_style.cxx */,
+				5515C9CC733AC9F36A9B7E06 /* open_uri.cxx */,
+				554EB8945D959B0EF565327A /* oval_box.cxx */,
+				5536CF5142F45E75898D00BA /* overlay.cxx */,
+				3132F0163EFDF4289F20DB50 /* overlay_visual.cxx */,
+				D9934C34F12FADA862D201D1 /* plastic.cxx */,
+				1FA85C8068154A53598C9B19 /* read_image.cxx */,
+				82F1E1FCCD3708EA48A6FD1B /* rect.cxx */,
+				C791DFA1DA864C8105CA92D3 /* round_box.cxx */,
+				557E80414B985272F1C0F5BE /* rounded_box.cxx */,
+				0E08EA1CF945ADA843805A2C /* scroll_area.cxx */,
+				C7ED2C14E31F1142DDCAC057 /* set_font.cxx */,
+				22603052464D0ADEFA96A7E6 /* set_fonts.cxx */,
+				2C5EEC8910127EC66EEA73B1 /* shadow_box.cxx */,
+				BFCE21B11BD00816E2D65029 /* shortcut.cxx */,
+				76D6638ABB7D955E0B149360 /* show_colormap.cxx */,
+				ECAFDF98E362617FA9E2B887 /* symbols.cxx */,
+				C82D09C9EB356BF14388A904 /* utf8.cxx */,
+				574878A10D223037009BD0DE /* utf.cxx */,
+				6C74D84D95E5167E6D41A606 /* vertex.cxx */,
 				2286DB222E1D5D78655B21BB /* numericsort.cxx */,
 				472AB3970C82CB496562F422 /* ps_image.cxx */,
 				1E2B1DAE628CEB38A5F0E604 /* scandir.cxx */,
@@ -5685,17 +5689,32 @@
 			name = fltk3gl;
 			sourceTree = "<group>";
 		};
+		572634D5D48118DDB8ADA06D /* Headers */ = {
+			isa = PBXGroup;
+			children = (
+				1010B13DA886270EE16E3514 /* all.h */,
+				2C2435D9DCE9D126983C81F3 /* fltk3images.h */,
+				5B9A35BBCCC105E2F86DBDA1 /* BMPImage.h */,
+				605121E099731EF9977E11C8 /* GIFImage.h */,
+				0925F19306CD3458397661F3 /* HelpDialog.h */,
+				60A217E0DC847E1DD7B44D49 /* JPEGImage.h */,
+				25BEA28581A1A97EEA1014E2 /* PNGImage.h */,
+				EC95850E022AFDFC59E4EBC2 /* PNMImage.h */,
+			);
+			name = Headers;
+			sourceTree = "<group>";
+		};
 		E2718243D9E2D793A35C2EB3 /* Sources */ = {
 			isa = PBXGroup;
 			children = (
-				BEBF424874FF4284B7383470 /* Fl_BMP_Image.cxx */,
-				7655FB1C9C0EEA276E0C6765 /* Fl_File_Icon2.cxx */,
-				CFAC1FAE7DBA77895E2BC5E9 /* Fl_GIF_Image.cxx */,
-				0EDA91FFA01CB06D2CD72D46 /* Fl_Help_Dialog.cxx */,
-				771C095FF2AE4FFCACA213AB /* Fl_JPEG_Image.cxx */,
-				E1BECD1D14488DF25469A00E /* Fl_PNG_Image.cxx */,
-				948DEE29F3A36A2E578DD9C0 /* Fl_PNM_Image.cxx */,
-				6ADD9C72DA642E9780529588 /* fl_images_core.cxx */,
+				BEBF424874FF4284B7383470 /* BMPImage.cxx */,
+				7655FB1C9C0EEA276E0C6765 /* FileIcon2.cxx */,
+				CFAC1FAE7DBA77895E2BC5E9 /* GIFImage.cxx */,
+				0EDA91FFA01CB06D2CD72D46 /* HelpDialog.cxx */,
+				6ADD9C72DA642E9780529588 /* images_core.cxx */,
+				771C095FF2AE4FFCACA213AB /* JPEGImage.cxx */,
+				E1BECD1D14488DF25469A00E /* PNGImage.cxx */,
+				948DEE29F3A36A2E578DD9C0 /* PNMImage.cxx */,
 			);
 			name = Sources;
 			sourceTree = "<group>";
@@ -5710,6 +5729,7 @@
 		92E5313C3A089F59528CDB9C /* fltk3images */ = {
 			isa = PBXGroup;
 			children = (
+				572634D5D48118DDB8ADA06D /* Headers */,
 				E2718243D9E2D793A35C2EB3 /* Sources */,
 				5C23197920BB9D2FB9D02387 /* Dependencies */,
 			);
@@ -6563,10 +6583,11 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				6EC5A8E1F6171E20505CDA66 /* all.h in Headers */,
+				39576718F4A718E5885D7837 /* fltk3.h in Headers */,
 				757ECB76CD9272004B8A4A42 /* Adjuster.h in Headers */,
 				CC311448876EC9C10D5614AF /* ask.h in Headers */,
 				72A9364B21F8DEDED9A43B9E /* Bitmap.h in Headers */,
-				26C1F556C987C742D37CCAA4 /* BMPImage.h in Headers */,
 				35DE2AD5F6204186A6545D86 /* Box.h in Headers */,
 				42605FAF974760B9A405E61E /* Browser_.h in Headers */,
 				7713D95988E151E950DE9A22 /* Browser.h in Headers */,
@@ -6599,9 +6620,7 @@
 				20CBFB6F570A48CAA0751DBF /* FormsBitmap.h in Headers */,
 				742D204F4CECC650D53AC070 /* FormsPixmap.h in Headers */,
 				6A197BCC5117B3666D368B25 /* Free.h in Headers */,
-				8845649A10159ECED0C93211 /* GIFImage.h in Headers */,
 				5E1D236DDF180951F39D88D0 /* Group.h in Headers */,
-				F7A66B0ADC3A359551BB84FB /* HelpDialog.h in Headers */,
 				E5826346717EA4FA214A9B1B /* HelpView.h in Headers */,
 				0CBBFB5E384976AB8AC9A2E0 /* HoldBrowser.h in Headers */,
 				C731F1AF175523B779E819E5 /* HorFillSlider.h in Headers */,
@@ -6613,7 +6632,6 @@
 				78D8944F6051F6574682C312 /* Input.h in Headers */,
 				6291854E45CD36763495507E /* InputChoice.h in Headers */,
 				0F5897939A32668EEBBEA347 /* IntInput.h in Headers */,
-				30029E6A64808C5EFEBA9CF8 /* JPEGImage.h in Headers */,
 				8E35401D5E144E48E1E2E147 /* LightButton.h in Headers */,
 				C5C32DAEA102D25D12F86757 /* LineDial.h in Headers */,
 				E62C50EAAA4C4B51F3A50640 /* math.h in Headers */,
@@ -6639,8 +6657,6 @@
 				38C7D942581B7C5369F2AC03 /* PagedDevice.h in Headers */,
 				F5061313596F1BC761AC582B /* Pixmap.h in Headers */,
 				6AFC8619DFF2FA3604F112C0 /* Plugin.h in Headers */,
-				E3127242302580ED01B769A4 /* PNGImage.h in Headers */,
-				CBE8880ED23DF42D5298EAAE /* PNMImage.h in Headers */,
 				F702DFA64620B02A76332D90 /* Positioner.h in Headers */,
 				ACFD331F39EEA65591D0492B /* PostScript.h in Headers */,
 				987CCADF07B02BD64D159D9F /* Preferences.h in Headers */,
@@ -6699,9 +6715,9 @@
 				92B4EB04CFFC5ECFD3F79630 /* WizardGroup.h in Headers */,
 				65AFEF19DE305C21D5DD6CA6 /* Wrapper.h in Headers */,
 				39A61403B387ECD58A0E92D3 /* x.h in Headers */,
+				E0943D9D77DD934578EBF9DF /* Xutf8.h in Headers */,
 				CBE1938D51C95931483B5C48 /* XBMImage.h in Headers */,
 				ACA9550AC903E3D31D80B160 /* XPMImage.h in Headers */,
-				E0943D9D77DD934578EBF9DF /* Xutf8.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -6723,6 +6739,14 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				8EFCC7E97421DED44B2C58AC /* all.h in Headers */,
+				F0C926FCF8BA5C38AB2B38A6 /* fltk3images.h in Headers */,
+				26C1F556C987C742D37CCAA4 /* BMPImage.h in Headers */,
+				8845649A10159ECED0C93211 /* GIFImage.h in Headers */,
+				F7A66B0ADC3A359551BB84FB /* HelpDialog.h in Headers */,
+				30029E6A64808C5EFEBA9CF8 /* JPEGImage.h in Headers */,
+				E3127242302580ED01B769A4 /* PNGImage.h in Headers */,
+				CBE8880ED23DF42D5298EAAE /* PNMImage.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -9066,103 +9090,103 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				69C261B5080F70C54F62E633 /* Fl_cocoa.mm in Sources */,
-				02BBCA82DFFB0AB67443CA28 /* Fl_Native_File_Chooser_MAC.mm in Sources */,
-				B7920395FCBAAF8E46AA357D /* Fl_Quartz_Printer.mm in Sources */,
+				69C261B5080F70C54F62E633 /* cocoa.mm in Sources */,
+				02BBCA82DFFB0AB67443CA28 /* cocoaNativeFileChooser.mm in Sources */,
+				B7920395FCBAAF8E46AA357D /* cocoaQuartzPrinter.mm in Sources */,
 				008DDC0F32A31B4ADA34594C /* run.cxx in Sources */,
-				2271ACEBB4FBB71C4086EF24 /* Fl_Adjuster.cxx in Sources */,
-				87F292EDA50F45BFAEA18EC5 /* Fl_Bitmap.cxx in Sources */,
-				D3D9C65EBA0726B45E8C7725 /* Fl_Box.cxx in Sources */,
-				F343A0DF04697626857BF06F /* Fl_Browser.cxx in Sources */,
-				9036C344E82AED76B425415E /* Fl_Browser_.cxx in Sources */,
-				C96803EEF2B850B58A9507D0 /* Fl_Browser_load.cxx in Sources */,
-				DE2BB5133CF2CD996D632F84 /* Fl_Button.cxx in Sources */,
-				B0CAF4D1559C6E98DFCA17AA /* Fl_Chart.cxx in Sources */,
-				37D83B9E1067EB10D83CC630 /* Fl_Check_Browser.cxx in Sources */,
-				B34F20AC44C7BD06F37A17B1 /* Fl_Check_Button.cxx in Sources */,
-				16189C3260E6F7081DBD4A2E /* Fl_Choice.cxx in Sources */,
-				4BB964893254F77B4DCAD9BA /* Fl_Clock.cxx in Sources */,
-				2D847DBF09E5D4E252345529 /* Fl_Color_Chooser.cxx in Sources */,
-				B2BB321C79B8EA57F4A99288 /* Fl_Counter.cxx in Sources */,
-				B1AB3E6CE018D5319F0CB1D8 /* Fl_Device.cxx in Sources */,
-				1369E7ADCB6604667B063564 /* Fl_Dial.cxx in Sources */,
-				43FA5D816EDA82E015727381 /* Fl_Double_Window.cxx in Sources */,
-				ECCA6DC4547C114D5390C8D1 /* Fl_File_Browser.cxx in Sources */,
-				049EB01300A5C030D1DB2191 /* Fl_File_Chooser.cxx in Sources */,
-				17819EFD092EC34847FF9A97 /* Fl_File_Chooser2.cxx in Sources */,
-				3DCD457D7AD4CA90D9EE4246 /* Fl_File_Icon.cxx in Sources */,
-				8F4CA13F0135C8D93D647078 /* Fl_File_Input.cxx in Sources */,
-				99FB64087ED252BA31644F95 /* Fl_Group.cxx in Sources */,
-				5D0D1C842A3CAF02C4878E5E /* Fl_Help_View.cxx in Sources */,
-				DE9BFEBCD61D5BBA51D3A983 /* Fl_Image.cxx in Sources */,
-				1DC72F81E67D26EFC91CC055 /* Fl_Input.cxx in Sources */,
-				22D481051F2975C6708B7A5C /* Fl_Input_.cxx in Sources */,
-				EDFFE30ABACE77AB818EFD3C /* Fl_Light_Button.cxx in Sources */,
-				FB4C03114DD7FD4E21C93B23 /* Fl_Menu.cxx in Sources */,
-				24D6615263A30D0055EEA9CD /* Fl_Menu_.cxx in Sources */,
-				BD7AE3AEC270BBF97D63A102 /* Fl_Menu_Bar.cxx in Sources */,
-				1EC305B74A27DF994486CAEA /* Fl_Menu_Button.cxx in Sources */,
-				63C8599959CBD6D392A98548 /* Fl_Menu_Window.cxx in Sources */,
-				A5B4D789DF000BBCCFC14069 /* Fl_Menu_add.cxx in Sources */,
-				6C148F335D573FA11E171DE8 /* Fl_Menu_global.cxx in Sources */,
-				46A6752E2DC6F11255C93484 /* Fl_Multi_Label.cxx in Sources */,
-				B30D6189F1765784376B6779 /* Fl_Native_File_Chooser.cxx in Sources */,
-				5857DE8B16828A0F93032DB4 /* Fl_Overlay_Window.cxx in Sources */,
-				5C93DA8482716333763AA2F8 /* Fl_Pack.cxx in Sources */,
-				BFD45A930F841AB6663EB28F /* Fl_Paged_Device.cxx in Sources */,
-				EBD658967C0EF993B55D8A75 /* Fl_Pixmap.cxx in Sources */,
-				7878131091565BEFA0E1E765 /* Fl_Positioner.cxx in Sources */,
-				C759F61877A5D20EDBD7488D /* Fl_Printer.cxx in Sources */,
-				96257899A0D5C1733FAC5200 /* Fl_Preferences.cxx in Sources */,
-				486D31DD278E2C5144B6284E /* Fl_Progress.cxx in Sources */,
-				4E4DEB0F11A0E7ABB682FBAF /* Fl_Repeat_Button.cxx in Sources */,
-				5B4F6F77241A0B089DCE19F1 /* Fl_Return_Button.cxx in Sources */,
-				01570F259A52D752DA170772 /* Fl_Roller.cxx in Sources */,
-				F32B3FAD40F0004FFA6158E3 /* Fl_Round_Button.cxx in Sources */,
-				B506EE63710A08EC82B52F62 /* Fl_Scroll.cxx in Sources */,
-				5622DE2929FDB9DBF1607BC6 /* Fl_Scrollbar.cxx in Sources */,
-				7CB9D27B0F1CE28C828F280B /* Fl_Shared_Image.cxx in Sources */,
-				550F71EE23A3D8E00A890F88 /* Fl_Single_Window.cxx in Sources */,
-				052ACB65AAC112E4DFA7B7C1 /* Fl_Slider.cxx in Sources */,
+				2271ACEBB4FBB71C4086EF24 /* Adjuster.cxx in Sources */,
+				87F292EDA50F45BFAEA18EC5 /* Bitmap.cxx in Sources */,
+				D3D9C65EBA0726B45E8C7725 /* Box.cxx in Sources */,
+				F343A0DF04697626857BF06F /* Browser.cxx in Sources */,
+				9036C344E82AED76B425415E /* Browser_.cxx in Sources */,
+				C96803EEF2B850B58A9507D0 /* Browser_load.cxx in Sources */,
+				DE2BB5133CF2CD996D632F84 /* Button.cxx in Sources */,
+				B0CAF4D1559C6E98DFCA17AA /* Chart.cxx in Sources */,
+				37D83B9E1067EB10D83CC630 /* CheckBrowser.cxx in Sources */,
+				B34F20AC44C7BD06F37A17B1 /* CheckButton.cxx in Sources */,
+				16189C3260E6F7081DBD4A2E /* Choice.cxx in Sources */,
+				4BB964893254F77B4DCAD9BA /* Clock.cxx in Sources */,
+				2D847DBF09E5D4E252345529 /* ColorChooser.cxx in Sources */,
+				B2BB321C79B8EA57F4A99288 /* Counter.cxx in Sources */,
+				B1AB3E6CE018D5319F0CB1D8 /* Device.cxx in Sources */,
+				1369E7ADCB6604667B063564 /* Dial.cxx in Sources */,
+				43FA5D816EDA82E015727381 /* DoubleWindow.cxx in Sources */,
+				ECCA6DC4547C114D5390C8D1 /* FileBrowser.cxx in Sources */,
+				049EB01300A5C030D1DB2191 /* FileChooser.cxx in Sources */,
+				17819EFD092EC34847FF9A97 /* FileChooser2.cxx in Sources */,
+				3DCD457D7AD4CA90D9EE4246 /* FileIcon.cxx in Sources */,
+				8F4CA13F0135C8D93D647078 /* FileInput.cxx in Sources */,
+				99FB64087ED252BA31644F95 /* Group.cxx in Sources */,
+				5D0D1C842A3CAF02C4878E5E /* HelpView.cxx in Sources */,
+				DE9BFEBCD61D5BBA51D3A983 /* Image.cxx in Sources */,
+				1DC72F81E67D26EFC91CC055 /* Input.cxx in Sources */,
+				22D481051F2975C6708B7A5C /* Input_.cxx in Sources */,
+				EDFFE30ABACE77AB818EFD3C /* LightButton.cxx in Sources */,
+				FB4C03114DD7FD4E21C93B23 /* Menu.cxx in Sources */,
+				24D6615263A30D0055EEA9CD /* Menu_.cxx in Sources */,
+				BD7AE3AEC270BBF97D63A102 /* MenuBar.cxx in Sources */,
+				1EC305B74A27DF994486CAEA /* MenuButton.cxx in Sources */,
+				63C8599959CBD6D392A98548 /* MenuWindow.cxx in Sources */,
+				A5B4D789DF000BBCCFC14069 /* Menu_add.cxx in Sources */,
+				6C148F335D573FA11E171DE8 /* Menu_global.cxx in Sources */,
+				46A6752E2DC6F11255C93484 /* MultiLabel.cxx in Sources */,
+				B30D6189F1765784376B6779 /* NativeFileChooser.cxx in Sources */,
+				5857DE8B16828A0F93032DB4 /* OverlayWindow.cxx in Sources */,
+				5C93DA8482716333763AA2F8 /* PackedGroup.cxx in Sources */,
+				BFD45A930F841AB6663EB28F /* PagedDevice.cxx in Sources */,
+				EBD658967C0EF993B55D8A75 /* Pixmap.cxx in Sources */,
+				7878131091565BEFA0E1E765 /* Positioner.cxx in Sources */,
+				C759F61877A5D20EDBD7488D /* Printer.cxx in Sources */,
+				96257899A0D5C1733FAC5200 /* Preferences.cxx in Sources */,
+				486D31DD278E2C5144B6284E /* Progress.cxx in Sources */,
+				4E4DEB0F11A0E7ABB682FBAF /* RepeatButton.cxx in Sources */,
+				5B4F6F77241A0B089DCE19F1 /* ReturnButton.cxx in Sources */,
+				01570F259A52D752DA170772 /* Roller.cxx in Sources */,
+				F32B3FAD40F0004FFA6158E3 /* RoundButton.cxx in Sources */,
+				B506EE63710A08EC82B52F62 /* ScrollGroup.cxx in Sources */,
+				5622DE2929FDB9DBF1607BC6 /* Scrollbar.cxx in Sources */,
+				7CB9D27B0F1CE28C828F280B /* SharedImage.cxx in Sources */,
+				550F71EE23A3D8E00A890F88 /* SingleWindow.cxx in Sources */,
+				052ACB65AAC112E4DFA7B7C1 /* Slider.cxx in Sources */,
 				195134865585E031DF857E7B /* Style.cxx in Sources */,
-				B7E4B117D093ED504AD5127B /* Fl_Sys_Menu_Bar.cxx in Sources */,
-				E0D6CAE34DC85454B5C61EBA /* Fl_Table.cxx in Sources */,
-				56C8DD01C98608D164F2047B /* Fl_Table_Row.cxx in Sources */,
-				135F22ECC6C16457F223E1EA /* Fl_Tabs.cxx in Sources */,
-				1ABCEAD8830736E549D56A9B /* Fl_Text_Buffer.cxx in Sources */,
-				9B43466674ACFD80CF1A44C7 /* Fl_Text_Display.cxx in Sources */,
-				038A56E9E529AB24D59EF7FA /* Fl_Text_Editor.cxx in Sources */,
-				45E744C6C36FBC067F9F04EE /* Fl_Tile.cxx in Sources */,
-				E9D3E58E4CCE649FB2BC43EA /* Fl_Tiled_Image.cxx in Sources */,
-				90FFE6AA9003A62E1983C991 /* Fl_Tooltip.cxx in Sources */,
-				681483153D73620EAA36873D /* Fl_Tree.cxx in Sources */,
-				9A57CF11DB2955C7BAEF98A7 /* Fl_Tree_Item.cxx in Sources */,
-				D2A374205A2262B571A051DE /* Fl_Tree_Item_Array.cxx in Sources */,
-				68CC4C366A163EBBBCEE853E /* Fl_Tree_Prefs.cxx in Sources */,
-				4A519B4F241D15A3DA6D3231 /* Fl_Valuator.cxx in Sources */,
-				BD78190E42585FD6B71AFEDA /* Fl_Value_Input.cxx in Sources */,
-				7E26A26E1E0FE997255F67D7 /* Fl_Value_Output.cxx in Sources */,
-				00BFB74D5BC12A94AFF72C8E /* Fl_Value_Slider.cxx in Sources */,
-				C8308863B421AD33C5442423 /* Fl_Widget.cxx in Sources */,
-				EAFF1F86C4BFCA7C8FCCEA28 /* Fl_Window.cxx in Sources */,
-				C62F4F9E13B7E78D46033106 /* Fl_Window_fullscreen.cxx in Sources */,
-				A76E032AD9B13380163BB493 /* Fl_Window_hotspot.cxx in Sources */,
-				E373B7F46315E6D1F6D255E9 /* Fl_Window_iconize.cxx in Sources */,
-				72DEB4A9569C0F11C103EF90 /* Fl_Wizard.cxx in Sources */,
-				F4974EC29CF042D6AEB0CC0D /* Fl_XBM_Image.cxx in Sources */,
-				A7891F57744007954D70C5D4 /* Fl_XPM_Image.cxx in Sources */,
-				230F7BA09DDFC95489B89DFF /* Fl_abort.cxx in Sources */,
-				EC8E6A4EA73A26BEEC330000 /* Fl_add_idle.cxx in Sources */,
-				A87E247AEEF22DCE6B7DFEE1 /* Fl_arg.cxx in Sources */,
-				867ED2B31C3F415ACBA63053 /* Fl_compose.cxx in Sources */,
-				EF8285FB887728A6F7E61B8A /* Fl_display.cxx in Sources */,
-				11ADE417F14FF9E2EE8083CE /* Fl_get_key.cxx in Sources */,
-				05360A3851265C0F5DE74075 /* Fl_get_system_colors.cxx in Sources */,
-				DF2B279A7C6E4D9B1DAF6A30 /* Fl_grab.cxx in Sources */,
-				F08C8B0E65A2E77417682E0C /* Fl_lock.cxx in Sources */,
-				D93BEFC63736CECDC57C91B9 /* Fl_own_colormap.cxx in Sources */,
-				D57FBCFB72B5E577A7F80562 /* Fl_visual.cxx in Sources */,
-				D90075982F3B0CDB0EF91A73 /* Fl_x.cxx in Sources */,
+				B7E4B117D093ED504AD5127B /* SysMenuBar.cxx in Sources */,
+				E0D6CAE34DC85454B5C61EBA /* Table.cxx in Sources */,
+				56C8DD01C98608D164F2047B /* TableRow.cxx in Sources */,
+				135F22ECC6C16457F223E1EA /* TabGroup.cxx in Sources */,
+				1ABCEAD8830736E549D56A9B /* TextBuffer.cxx in Sources */,
+				9B43466674ACFD80CF1A44C7 /* TextDisplay.cxx in Sources */,
+				038A56E9E529AB24D59EF7FA /* TextEditor.cxx in Sources */,
+				45E744C6C36FBC067F9F04EE /* TiledGroup.cxx in Sources */,
+				E9D3E58E4CCE649FB2BC43EA /* TiledImage.cxx in Sources */,
+				90FFE6AA9003A62E1983C991 /* Tooltip.cxx in Sources */,
+				681483153D73620EAA36873D /* Tree.cxx in Sources */,
+				9A57CF11DB2955C7BAEF98A7 /* TreeItem.cxx in Sources */,
+				D2A374205A2262B571A051DE /* TreeItemArray.cxx in Sources */,
+				68CC4C366A163EBBBCEE853E /* TreePrefs.cxx in Sources */,
+				4A519B4F241D15A3DA6D3231 /* Valuator.cxx in Sources */,
+				BD78190E42585FD6B71AFEDA /* ValueInput.cxx in Sources */,
+				7E26A26E1E0FE997255F67D7 /* ValueOutput.cxx in Sources */,
+				00BFB74D5BC12A94AFF72C8E /* ValueSlider.cxx in Sources */,
+				C8308863B421AD33C5442423 /* Widget.cxx in Sources */,
+				EAFF1F86C4BFCA7C8FCCEA28 /* Window.cxx in Sources */,
+				C62F4F9E13B7E78D46033106 /* Window_fullscreen.cxx in Sources */,
+				A76E032AD9B13380163BB493 /* Window_hotspot.cxx in Sources */,
+				E373B7F46315E6D1F6D255E9 /* Window_iconize.cxx in Sources */,
+				72DEB4A9569C0F11C103EF90 /* Wizard.cxx in Sources */,
+				F4974EC29CF042D6AEB0CC0D /* XBMImage.cxx in Sources */,
+				A7891F57744007954D70C5D4 /* XPMImage.cxx in Sources */,
+				230F7BA09DDFC95489B89DFF /* abort.cxx in Sources */,
+				EC8E6A4EA73A26BEEC330000 /* add_idle.cxx in Sources */,
+				A87E247AEEF22DCE6B7DFEE1 /* arg.cxx in Sources */,
+				867ED2B31C3F415ACBA63053 /* compose.cxx in Sources */,
+				EF8285FB887728A6F7E61B8A /* display.cxx in Sources */,
+				11ADE417F14FF9E2EE8083CE /* get_key.cxx in Sources */,
+				05360A3851265C0F5DE74075 /* get_system_colors.cxx in Sources */,
+				DF2B279A7C6E4D9B1DAF6A30 /* grab.cxx in Sources */,
+				F08C8B0E65A2E77417682E0C /* lock.cxx in Sources */,
+				D93BEFC63736CECDC57C91B9 /* own_colormap.cxx in Sources */,
+				D57FBCFB72B5E577A7F80562 /* visual.cxx in Sources */,
+				D90075982F3B0CDB0EF91A73 /* x11.cxx in Sources */,
 				AABCD2111137745B5B24F9F8 /* filename_absolute.cxx in Sources */,
 				B1C7F80015E458B01ED0339C /* filename_expand.cxx in Sources */,
 				80D7B46EAB946A01968CCDF8 /* filename_ext.cxx in Sources */,
@@ -9170,46 +9194,46 @@
 				8C352F4250261E6F42F1FA19 /* filename_list.cxx in Sources */,
 				BF87576CF80F55DD7380B991 /* filename_match.cxx in Sources */,
 				53ADEE51DE5FEEEB4A79CA21 /* filename_setext.cxx in Sources */,
-				CF3BDDBED0526F9FB4C8A1D2 /* fl_arc.cxx in Sources */,
-				3C758F19560BBB0931A7A741 /* fl_arci.cxx in Sources */,
-				F10B0DD63132D694D8879B1C /* fl_ask.cxx in Sources */,
-				7CD1A5049849133DFB39DF46 /* fl_boxtype.cxx in Sources */,
-				36978A2B5576E54EDA3F8D90 /* fl_call_main.cxx in Sources */,
-				E5A3C2482B9E218F550D91DA /* fl_color.cxx in Sources */,
-				79967B56F476337DA7A830CF /* fl_cursor.cxx in Sources */,
-				B234111841F3CC33C32E75A1 /* fl_curve.cxx in Sources */,
-				2BF486109B69CFEFB5C7950E /* fl_diamond_box.cxx in Sources */,
-				207AE6E5DDC5DE3F30896F39 /* fl_dnd.cxx in Sources */,
-				363F858BE2E0007242350184 /* fl_draw.cxx in Sources */,
-				F546A37A0957B9108A3E4227 /* fl_draw_image.cxx in Sources */,
-				30E10499346406FB87A5DD43 /* fl_draw_pixmap.cxx in Sources */,
-				DE48D54427106D76FDA1F6E0 /* fl_encoding_latin1.cxx in Sources */,
-				ABB49E921AA98E86EBD8142A /* fl_encoding_mac_roman.cxx in Sources */,
-				15FDFD86D6D450F2C221FBAC /* fl_engraved_label.cxx in Sources */,
-				EB81F3881B64050C7D312740 /* fl_file_dir.cxx in Sources */,
-				C9F44B469D5C83AAB89600F8 /* fl_font.cxx in Sources */,
-				EFCDA004289805697F6CF4B9 /* fl_gtk.cxx in Sources */,
-				4598BB77D7E3CBFC61C56140 /* fl_labeltype.cxx in Sources */,
-				A59E78B843DA2C7D12D49294 /* fl_line_style.cxx in Sources */,
-				BE74DB334A51DD19B62B76EB /* fl_open_uri.cxx in Sources */,
-				61BF99BBD1D18251E0170B8A /* fl_oval_box.cxx in Sources */,
-				C4F171DDF768A7556A684B76 /* fl_overlay.cxx in Sources */,
-				305944C743B9FD0B34805326 /* fl_overlay_visual.cxx in Sources */,
-				40F29FD83CE6117394258FAB /* fl_plastic.cxx in Sources */,
-				C91AB9ACD12BB4B352A00338 /* fl_read_image.cxx in Sources */,
-				39238B4623BCF68FDA9EE223 /* fl_rect.cxx in Sources */,
-				FE83B31EEE58493BD243B8C2 /* fl_round_box.cxx in Sources */,
-				AD0B8E3D9E97E625C55B967F /* fl_rounded_box.cxx in Sources */,
-				FCAEAB49DE121D3D2138610D /* fl_scroll_area.cxx in Sources */,
-				2952645AF2A836D88ADA48F9 /* fl_set_font.cxx in Sources */,
-				83BEAD361BB7BC2CD030A36B /* fl_set_fonts.cxx in Sources */,
-				03E51C6144E06D2161CDE5EB /* fl_shadow_box.cxx in Sources */,
-				1915B2B4724B8826C53616C9 /* fl_shortcut.cxx in Sources */,
-				CA982582F5FA39ED7D7118DA /* fl_show_colormap.cxx in Sources */,
-				3F497BC168C63621AB680203 /* fl_symbols.cxx in Sources */,
-				E05DB01E716C969FB0A9984E /* fl_utf8.cxx in Sources */,
-				DBA6ED75DC142BE30D95B619 /* fl_utf.cxx in Sources */,
-				0DA673401BF6865FFFEF7D18 /* fl_vertex.cxx in Sources */,
+				CF3BDDBED0526F9FB4C8A1D2 /* arc.cxx in Sources */,
+				3C758F19560BBB0931A7A741 /* arci.cxx in Sources */,
+				F10B0DD63132D694D8879B1C /* ask.cxx in Sources */,
+				7CD1A5049849133DFB39DF46 /* boxtype.cxx in Sources */,
+				36978A2B5576E54EDA3F8D90 /* call_main.cxx in Sources */,
+				E5A3C2482B9E218F550D91DA /* color.cxx in Sources */,
+				79967B56F476337DA7A830CF /* cursor.cxx in Sources */,
+				B234111841F3CC33C32E75A1 /* curve.cxx in Sources */,
+				2BF486109B69CFEFB5C7950E /* diamond_box.cxx in Sources */,
+				207AE6E5DDC5DE3F30896F39 /* dnd.cxx in Sources */,
+				363F858BE2E0007242350184 /* draw.cxx in Sources */,
+				F546A37A0957B9108A3E4227 /* draw_image.cxx in Sources */,
+				30E10499346406FB87A5DD43 /* draw_pixmap.cxx in Sources */,
+				DE48D54427106D76FDA1F6E0 /* encoding_latin1.cxx in Sources */,
+				ABB49E921AA98E86EBD8142A /* encoding_mac_roman.cxx in Sources */,
+				15FDFD86D6D450F2C221FBAC /* engraved_label.cxx in Sources */,
+				EB81F3881B64050C7D312740 /* file_dir.cxx in Sources */,
+				C9F44B469D5C83AAB89600F8 /* font.cxx in Sources */,
+				EFCDA004289805697F6CF4B9 /* gtk.cxx in Sources */,
+				4598BB77D7E3CBFC61C56140 /* labeltype.cxx in Sources */,
+				A59E78B843DA2C7D12D49294 /* line_style.cxx in Sources */,
+				BE74DB334A51DD19B62B76EB /* open_uri.cxx in Sources */,
+				61BF99BBD1D18251E0170B8A /* oval_box.cxx in Sources */,
+				C4F171DDF768A7556A684B76 /* overlay.cxx in Sources */,
+				305944C743B9FD0B34805326 /* overlay_visual.cxx in Sources */,
+				40F29FD83CE6117394258FAB /* plastic.cxx in Sources */,
+				C91AB9ACD12BB4B352A00338 /* read_image.cxx in Sources */,
+				39238B4623BCF68FDA9EE223 /* rect.cxx in Sources */,
+				FE83B31EEE58493BD243B8C2 /* round_box.cxx in Sources */,
+				AD0B8E3D9E97E625C55B967F /* rounded_box.cxx in Sources */,
+				FCAEAB49DE121D3D2138610D /* scroll_area.cxx in Sources */,
+				2952645AF2A836D88ADA48F9 /* set_font.cxx in Sources */,
+				83BEAD361BB7BC2CD030A36B /* set_fonts.cxx in Sources */,
+				03E51C6144E06D2161CDE5EB /* shadow_box.cxx in Sources */,
+				1915B2B4724B8826C53616C9 /* shortcut.cxx in Sources */,
+				CA982582F5FA39ED7D7118DA /* show_colormap.cxx in Sources */,
+				3F497BC168C63621AB680203 /* symbols.cxx in Sources */,
+				E05DB01E716C969FB0A9984E /* utf8.cxx in Sources */,
+				DBA6ED75DC142BE30D95B619 /* utf.cxx in Sources */,
+				0DA673401BF6865FFFEF7D18 /* vertex.cxx in Sources */,
 				F9A99DC4E0447A57F2242B0F /* numericsort.cxx in Sources */,
 				7B5F222AD68C2A4A4853951A /* ps_image.cxx in Sources */,
 				611144BED911A91A14E629C2 /* scandir.cxx in Sources */,
@@ -9245,14 +9269,14 @@
 			isa = PBXSourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				E6582F0C45106AC28102A2E1 /* Fl_BMP_Image.cxx in Sources */,
-				4527A1842C292A307AB984FD /* Fl_File_Icon2.cxx in Sources */,
-				61475B3565DF64924AD4D896 /* Fl_GIF_Image.cxx in Sources */,
-				D0C372353DA3A182C063120A /* Fl_Help_Dialog.cxx in Sources */,
-				633E5465D656A9961EB5A771 /* Fl_JPEG_Image.cxx in Sources */,
-				6C9573986A4FFE9EE9ADFFDD /* Fl_PNG_Image.cxx in Sources */,
-				E8B17358A691471C1B2BD4D5 /* Fl_PNM_Image.cxx in Sources */,
-				C99E8BD8A6A0BDDBE07EE04C /* fl_images_core.cxx in Sources */,
+				E6582F0C45106AC28102A2E1 /* BMPImage.cxx in Sources */,
+				4527A1842C292A307AB984FD /* FileIcon2.cxx in Sources */,
+				61475B3565DF64924AD4D896 /* GIFImage.cxx in Sources */,
+				D0C372353DA3A182C063120A /* HelpDialog.cxx in Sources */,
+				C99E8BD8A6A0BDDBE07EE04C /* images_core.cxx in Sources */,
+				633E5465D656A9961EB5A771 /* JPEGImage.cxx in Sources */,
+				6C9573986A4FFE9EE9ADFFDD /* PNGImage.cxx in Sources */,
+				E8B17358A691471C1B2BD4D5 /* PNMImage.cxx in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Deleted: branches/branch-3.0/include/fltk3/BMPImage.h

Deleted: branches/branch-3.0/include/fltk3/GIFImage.h

Deleted: branches/branch-3.0/include/fltk3/HelpDialog.h

Deleted: branches/branch-3.0/include/fltk3/JPEGImage.h

Deleted: branches/branch-3.0/include/fltk3/PNGImage.h

Deleted: branches/branch-3.0/include/fltk3/PNMImage.h

Copied: branches/branch-3.0/include/fltk3/all.h (from rev 9010, branches/branch-3.0/include/fltk3gl/all.h)
===================================================================
--- branches/branch-3.0/include/fltk3/all.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,177 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3_ALL_H
+#define FLTK3_ALL_H
+
+#include "Adjuster.h"
+#include "BMPImage.h"
+#include "Bitmap.h"
+#include "Box.h"
+#include "Browser.h"
+#include "Browser_.h"
+#include "Button.h"
+#include "Cairo.h"
+#include "CairoWindow.h"
+#include "Chart.h"
+#include "CheckBrowser.h"
+#include "CheckButton.h"
+#include "Choice.h"
+#include "Clock.h"
+#include "ColorChooser.h"
+#include "Counter.h"
+#include "Device.h"
+#include "Dial.h"
+#include "DoubleWindow.h"
+#include "Export.h"
+#include "FileBrowser.h"
+#include "FileChooser.h"
+#include "FileIcon.h"
+#include "FileInput.h"
+#include "FillDial.h"
+#include "FillSlider.h"
+#include "FloatInput.h"
+#include "FormsBitmap.h"
+#include "FormsPixmap.h"
+#include "Free.h"
+#include "GIFImage.h"
+#include "Group.h"
+#include "HelpDialog.h"
+#include "HelpView.h"
+#include "HoldBrowser.h"
+#include "HorFillSlider.h"
+#include "HorNiceSlider.h"
+#include "HorSlider.h"
+#include "HorValueSlider.h"
+#include "Image.h"
+#include "Input.h"
+#include "InputChoice.h"
+#include "Input_.h"
+#include "IntInput.h"
+#include "JPEGImage.h"
+#include "LightButton.h"
+#include "LineDial.h"
+#include "Makefile"
+#include "Makefile.in"
+#include "Menu.h"
+#include "MenuBar.h"
+#include "MenuButton.h"
+#include "MenuItem.h"
+#include "MenuWindow.h"
+#include "Menu_.h"
+#include "MultiBrowser.h"
+#include "MultiLabel.h"
+#include "MultilineInput.h"
+#include "MultilineOutput.h"
+#include "NativeFileChooser.h"
+#include "NiceSlider.h"
+#include "Object.h"
+#include "Output.h"
+#include "OverlayWindow.h"
+#include "PNGImage.h"
+#include "PNMImage.h"
+#include "PackedGroup.h"
+#include "PagedDevice.h"
+#include "Pixmap.h"
+#include "Plugin.h"
+#include "Positioner.h"
+#include "PostScript.h"
+#include "Preferences.h"
+#include "Printer.h"
+#include "Progress.h"
+#include "README.Xcode"
+#include "RGBImage.h"
+#include "RadioButton.h"
+#include "RadioLightButton.h"
+#include "RadioRoundButton.h"
+#include "Rectangle.h"
+#include "RepeatButton.h"
+#include "ReturnButton.h"
+#include "Roller.h"
+#include "RoundButton.h"
+#include "RoundClock.h"
+#include "ScrollGroup.h"
+#include "Scrollbar.h"
+#include "SecretInput.h"
+#include "SelectBrowser.h"
+#include "SharedImage.h"
+#include "SimpleCounter.h"
+#include "SingleWindow.h"
+#include "Slider.h"
+#include "Spinner.h"
+#include "Style.h"
+#include "SysMenuBar.h"
+#include "TabGroup.h"
+#include "Table.h"
+#include "TableRow.h"
+#include "TextBuffer.h"
+#include "TextDisplay.h"
+#include "TextEditor.h"
+#include "TiledGroup.h"
+#include "TiledImage.h"
+#include "Timer.h"
+#include "ToggleButton.h"
+#include "ToggleLightButton.h"
+#include "ToggleRoundButton.h"
+#include "Tooltip.h"
+#include "Tree.h"
+#include "TreeItem.h"
+#include "TreeItemArray.h"
+#include "TreePrefs.h"
+#include "Valuator.h"
+#include "ValueInput.h"
+#include "ValueOutput.h"
+#include "ValueSlider.h"
+#include "Widget.h"
+#include "Window.h"
+#include "WizardGroup.h"
+#include "Wrapper.h"
+#include "XBMImage.h"
+#include "XPMImage.h"
+#include "Xutf8.h"
+#include "ask.h"
+#include "dirent.h"
+#include "draw.h"
+#include "enumerations.h"
+#include "filename.h"
+#include "math.h"
+#include "message.h"
+#include "names.h"
+#include "osx.h"
+#include "run.h"
+#include "showInput.h"
+#include "show_colormap.h"
+#include "types.h"
+#include "utf8.h"
+#include "win32.h"
+#include "x.h"
+
+#endif // !FLTK3_ALL_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3/fltk3.h (from rev 9008, branches/branch-3.0/include/fltk3gl/fltk3gl.h)
===================================================================
--- branches/branch-3.0/include/fltk3/fltk3.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3/fltk3.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,37 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3_FLTK3_H
+#define FLTK3_FLTK3_H
+
+#include "all.h"
+
+#endif // !FLTK3_FLTK3_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Deleted: branches/branch-3.0/include/fltk3/forms.h

Modified: branches/branch-3.0/include/fltk3gl/all.h
===================================================================
--- branches/branch-3.0/include/fltk3gl/all.h	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/include/fltk3gl/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -34,7 +34,7 @@
 #include "GLWindow.h"
 #include "glDraw.h"
 
-#endif // !FLTK3GLALL_H
+#endif // !FLTK3GL_ALL_H
 
 //
 // End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".

Modified: branches/branch-3.0/include/fltk3gl/fltk3gl.h
===================================================================
--- branches/branch-3.0/include/fltk3gl/fltk3gl.h	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/include/fltk3gl/fltk3gl.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -26,7 +26,7 @@
 //
 
 #ifndef FLTK3GL_FLTK3GL_H
-#define FLTK3GL_FLTK3ALL_H
+#define FLTK3GL_FLTK3GL_H
 
 #include "all.h"
 

Copied: branches/branch-3.0/include/fltk3images/BMPImage.h (from rev 9002, branches/branch-3.0/include/fltk3/BMPImage.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/BMPImage.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/BMPImage.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,55 @@
+//
+// "$Id: BMPImage.h 7903 2010-11-28 21:06:39Z matt $"
+//
+// BMP image header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::BMPImage widget . */
+
+#ifndef Fltk3_BMP_Image_H
+#define Fltk3_BMP_Image_H
+
+#include <fltk3/Image.h>
+
+namespace fltk3 {
+  
+  /**
+   The fltk3::BMPImage class supports loading, caching,
+   and drawing of Windows Bitmap (BMP) image files.
+   */
+  class FLTK3_EXPORT BMPImage : public fltk3::RGBImage {
+    
+  public:
+    
+    BMPImage(const char* filename);
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: BMPImage.h 7903 2010-11-28 21:06:39Z matt $".
+//

Copied: branches/branch-3.0/include/fltk3images/GIFImage.h (from rev 9002, branches/branch-3.0/include/fltk3/GIFImage.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/GIFImage.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/GIFImage.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,55 @@
+//
+// "$Id: GIFImage.h 7903 2010-11-28 21:06:39Z matt $"
+//
+// GIF image header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::GIFImage widget . */
+
+#ifndef Fltk3_GIF_Image_H
+#define Fltk3_GIF_Image_H
+#include <fltk3/Pixmap.h>
+
+namespace fltk3 {
+  
+  /**
+   The fltk3::GIFImage class supports loading, caching,
+   and drawing of Compuserve GIF<SUP>SM</SUP> images. The class
+   loads the first image and supports transparency.
+   */
+  class FLTK3_EXPORT GIFImage : public fltk3::Pixmap {
+    
+  public:
+    
+    GIFImage(const char* filename);
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: GIFImage.h 7903 2010-11-28 21:06:39Z matt $".
+//

Copied: branches/branch-3.0/include/fltk3images/HelpDialog.h (from rev 9002, branches/branch-3.0/include/fltk3/HelpDialog.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/HelpDialog.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/HelpDialog.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,100 @@
+//
+// "$Id: HelpDialog.h 8063 2010-12-19 21:20:10Z matt $"
+//
+// fltk3::HelpDialog dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::HelpDialog widget . */
+
+// generated by Fast Light User Interface Designer (fluid) version 1.0108
+
+#ifndef Fltk3_Help_Dialog_H
+#define Fltk3_Help_Dialog_H
+#include <fltk3/run.h>
+#include <fltk3/DoubleWindow.h>
+#include <fltk3/Group.h>
+#include <fltk3/Button.h>
+#include <fltk3/Input.h>
+#include <fltk3/Box.h>
+#include <fltk3/HelpView.h>
+
+namespace fltk3 {
+  
+  class FLTK3_EXPORT HelpDialog {
+    int index_; 
+    int max_; 
+    int line_[100];                 // FIXME: we must remove those static numbers
+    char file_[100][FLTK3_PATH_MAX];   // FIXME: we must remove those static numbers
+    int find_pos_; 
+  public:
+    HelpDialog();
+  private:
+    fltk3::DoubleWindow *window_;
+    fltk3::Button *back_;
+    void cb_back__i(fltk3::Button*, void*);
+    static void cb_back_(fltk3::Button*, void*);
+    fltk3::Button *forward_;
+    void cb_forward__i(fltk3::Button*, void*);
+    static void cb_forward_(fltk3::Button*, void*);
+    fltk3::Button *smaller_;
+    void cb_smaller__i(fltk3::Button*, void*);
+    static void cb_smaller_(fltk3::Button*, void*);
+    fltk3::Button *larger_;
+    void cb_larger__i(fltk3::Button*, void*);
+    static void cb_larger_(fltk3::Button*, void*);
+    fltk3::Input *find_;
+    void cb_find__i(fltk3::Input*, void*);
+    static void cb_find_(fltk3::Input*, void*);
+    fltk3::HelpView *view_;
+    void cb_view__i(fltk3::HelpView*, void*);
+    static void cb_view_(fltk3::HelpView*, void*);
+  public:
+    ~HelpDialog();
+    int h();
+    void hide();
+    void load(const char *f);
+    void position(int xx, int yy);
+    void resize(int xx, int yy, int ww, int hh);
+    void show();
+    void show(int argc, char **argv);
+    void textsize(fltk3::Fontsize s);
+    fltk3::Fontsize textsize();
+    void topline(const char *n);
+    void topline(int n);
+    void value(const char *f);
+    const char * value() const;
+    int visible();
+    int w();
+    int x();
+    int y();
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: HelpDialog.h 8063 2010-12-19 21:20:10Z matt $".
+//

Copied: branches/branch-3.0/include/fltk3images/JPEGImage.h (from rev 9002, branches/branch-3.0/include/fltk3/JPEGImage.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/JPEGImage.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/JPEGImage.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,58 @@
+//
+// "$Id: JPEGImage.h 7903 2010-11-28 21:06:39Z matt $"
+//
+// JPEG image header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::JPEGImage class . */
+
+#ifndef Fltk3_JPEG_Image_H
+#define Fltk3_JPEG_Image_H
+#  include <fltk3/Image.h>
+
+
+namespace fltk3 {
+  
+  /**
+   The fltk3::JPEGImage class supports loading, caching,
+   and drawing of Joint Photographic Experts Group (JPEG) File
+   Interchange Format (JFIF) images. The class supports grayscale
+   and color (RGB) JPEG image files.
+   */
+  class FLTK3_EXPORT JPEGImage : public fltk3::RGBImage {
+    
+  public:
+    
+    JPEGImage(const char *filename);
+    JPEGImage(const char *name, const unsigned char *data);
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: JPEGImage.h 7903 2010-11-28 21:06:39Z matt $".
+//

Copied: branches/branch-3.0/include/fltk3images/PNGImage.h (from rev 9002, branches/branch-3.0/include/fltk3/PNGImage.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/PNGImage.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/PNGImage.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,59 @@
+//
+// "$Id: PNGImage.h 8287 2011-01-17 20:51:12Z manolo $"
+//
+// PNG image header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::PNGImage class . */
+
+#ifndef Fltk3_PNG_Image_H
+#define Fltk3_PNG_Image_H
+#  include <fltk3/Image.h>
+
+namespace fltk3 {
+  
+  /**
+   The fltk3::PNGImage class supports loading, caching,
+   and drawing of Portable Network Graphics (PNG) image files. The
+   class loads colormapped and full-color images and handles color-
+   and alpha-based transparency.
+   */
+  class FLTK3_EXPORT PNGImage : public fltk3::RGBImage {
+    
+  public:
+    
+    PNGImage(const char* filename);
+    PNGImage (const char *name_png, const unsigned char *buffer, int datasize);
+  private:
+    void load_png_(const char *name_png, const unsigned char *buffer_png, int datasize);
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: PNGImage.h 8287 2011-01-17 20:51:12Z manolo $".
+//

Copied: branches/branch-3.0/include/fltk3images/PNMImage.h (from rev 9002, branches/branch-3.0/include/fltk3/PNMImage.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/PNMImage.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/PNMImage.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,56 @@
+//
+// "$Id: PNMImage.h 7903 2010-11-28 21:06:39Z matt $"
+//
+// PNM image header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* \file
+ fltk3::PNMImage class . */
+
+#ifndef Fltk3_PNM_Image_H
+#define Fltk3_PNM_Image_H
+#  include <fltk3/Image.h>
+
+namespace fltk3 {
+  
+  /**
+   The fltk3::PNMImage class supports loading, caching,
+   and drawing of Portable Anymap (PNM, PBM, PGM, PPM) image files. The class
+   loads bitmap, grayscale, and full-color images in both ASCII and
+   binary formats.
+   */
+  class FLTK3_EXPORT PNMImage : public fltk3::RGBImage {
+    
+  public:
+    
+    PNMImage(const char* filename);
+  };
+  
+}
+
+#endif
+
+//
+// End of "$Id: PNMImage.h 7903 2010-11-28 21:06:39Z matt $".
+//

Copied: branches/branch-3.0/include/fltk3images/all.h (from rev 9010, branches/branch-3.0/include/fltk3gl/all.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/all.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,42 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3IMAGES_ALL_H
+#define FLTK3IMAGES_ALL_H
+
+#include "BMPImage.h"
+#include "GIFImage.h"
+#include "HelpDialog.h"
+#include "JPEGImage.h"
+#include "PNGImage.h"
+#include "PNMImage.h"
+
+#endif // !FLTK3IMAGES_ALL_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3images/fltk3images.h (from rev 9008, branches/branch-3.0/include/fltk3gl/fltk3gl.h)
===================================================================
--- branches/branch-3.0/include/fltk3images/fltk3images.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3images/fltk3images.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,37 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3IMAGES_FLTK3IMAGES_H
+#define FLTK3IMAGES_FLTK3IMAGES_H
+
+#include "all.h"
+
+#endif // !FLTK3IMAGES_FLTK3IMAGES_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3jpeg/all.h (from rev 9010, branches/branch-3.0/include/fltk3gl/all.h)
===================================================================
--- branches/branch-3.0/include/fltk3jpeg/all.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3jpeg/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,45 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3JPEG_ALL_H
+#define FLTK3JPEG_ALL_H
+
+#include "jconfig.h"
+#include "jdct.h"
+#include "jerror.h"
+#include "jinclude.h"
+#include "jmemsys.h"
+#include "jmorecfg.h"
+#include "jpegint.h"
+#include "jpeglib.h"
+#include "jversion.h"
+
+#endif // !FLTK3JPEG_ALL_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3jpeg/fltk3jpeg.h (from rev 9008, branches/branch-3.0/include/fltk3gl/fltk3gl.h)
===================================================================
--- branches/branch-3.0/include/fltk3jpeg/fltk3jpeg.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3jpeg/fltk3jpeg.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,37 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3JPEG_FLTK3JPEG_H
+#define FLTK3JPEG_FLTK3JPEG_H
+
+#include "all.h"
+
+#endif // !FLTK3JPEG_FLTK3JPEG_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3png/all.h (from rev 9010, branches/branch-3.0/include/fltk3gl/all.h)
===================================================================
--- branches/branch-3.0/include/fltk3png/all.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3png/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,43 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3PNG_ALL_H
+#define FLTK3PNG_ALL_H
+
+#include "png.h"
+#include "pngconf.h"
+#include "pngdebug.h"
+#include "pnginfo.h"
+#include "pnglibconf.h"
+#include "pngpriv.h"
+#include "pngstruct.h"
+
+#endif // !FLTK3PNG_ALL_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3png/fltk3png.h (from rev 9008, branches/branch-3.0/include/fltk3gl/fltk3gl.h)
===================================================================
--- branches/branch-3.0/include/fltk3png/fltk3png.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3png/fltk3png.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,37 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3PNG_FLTK3PNG_H
+#define FLTK3PNG_FLTK3PNG_H
+
+#include "all.h"
+
+#endif // !FLTK3PNG_FLTK3PNG_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3zlib/all.h (from rev 9010, branches/branch-3.0/include/fltk3gl/all.h)
===================================================================
--- branches/branch-3.0/include/fltk3zlib/all.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3zlib/all.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,48 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3ZLIB_ALL_H
+#define FLTK3ZLIB_ALL_H
+
+#include "crc32.h"
+#include "deflate.h"
+#include "gzguts.h"
+#include "inffast.h"
+#include "inffixed.h"
+#include "inflate.h"
+#include "inftrees.h"
+#include "trees.h"
+#include "xx.h"
+#include "zconf.h"
+#include "zlib.h"
+#include "zutil.h"
+
+#endif // !FLTK3ZLIB_ALL_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Copied: branches/branch-3.0/include/fltk3zlib/fltk3zlib.h (from rev 9008, branches/branch-3.0/include/fltk3gl/fltk3gl.h)
===================================================================
--- branches/branch-3.0/include/fltk3zlib/fltk3zlib.h	                        (rev 0)
+++ branches/branch-3.0/include/fltk3zlib/fltk3zlib.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,37 @@
+//
+// "$Id: all.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
+//
+// OpenGL header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3ZLIB_FLTK3ZLIB_H
+#define FLTK3ZLIB_FLTK3ZLIB_H
+
+#include "all.h"
+
+#endif // !FLTK3ZLIB_FLTK3ZLIB_H
+
+//
+// End of "$Id: gl.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
+//

Modified: branches/branch-3.0/src/Makefile
===================================================================
--- branches/branch-3.0/src/Makefile	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/src/Makefile	2011-08-25 21:50:59 UTC (rev 9011)
@@ -27,150 +27,150 @@
 
 FLTK3_CPPFILES = \
 	fltk3/run.cxx \
-	core/Fl_Adjuster.cxx \
-	core/Fl_Bitmap.cxx \
-	core/Fl_Box.cxx \
-	core/Fl_Browser.cxx \
-	core/Fl_Browser_.cxx \
-	core/Fl_Browser_load.cxx \
-	core/Fl_Button.cxx \
-	core/Fl_Chart.cxx \
-	core/Fl_Check_Browser.cxx \
-	core/Fl_Check_Button.cxx \
-	core/Fl_Choice.cxx \
-	core/Fl_Clock.cxx \
-	core/Fl_Color_Chooser.cxx \
-	core/Fl_Counter.cxx \
-	core/Fl_Device.cxx \
-	core/Fl_Dial.cxx \
-	core/Fl_Double_Window.cxx \
-	core/Fl_File_Browser.cxx \
-	core/Fl_File_Chooser.cxx \
-	core/Fl_File_Chooser2.cxx \
-	core/Fl_File_Icon.cxx \
-	core/Fl_File_Input.cxx \
-	core/Fl_Group.cxx \
-	core/Fl_Help_View.cxx \
-	core/Fl_Image.cxx \
-	core/Fl_Input.cxx \
-	core/Fl_Input_.cxx \
-	core/Fl_Light_Button.cxx \
-	core/Fl_Menu.cxx \
-	core/Fl_Menu_.cxx \
-	core/Fl_Menu_Bar.cxx \
-	core/Fl_Menu_Button.cxx \
-	core/Fl_Menu_Window.cxx \
-	core/Fl_Menu_add.cxx \
-	core/Fl_Menu_global.cxx \
-	core/Fl_Multi_Label.cxx \
-	core/Fl_Native_File_Chooser.cxx \
-	core/Fl_Overlay_Window.cxx \
-	core/Fl_Pack.cxx \
-	core/Fl_Paged_Device.cxx \
-	core/Fl_Pixmap.cxx \
-	core/Fl_Positioner.cxx \
-	core/Fl_Printer.cxx \
-	core/Fl_Preferences.cxx \
-	core/Fl_Progress.cxx \
-	core/Fl_Repeat_Button.cxx \
-	core/Fl_Return_Button.cxx \
-	core/Fl_Roller.cxx \
-	core/Fl_Round_Button.cxx \
-	core/Fl_Scroll.cxx \
-	core/Fl_Scrollbar.cxx \
-	core/Fl_Shared_Image.cxx \
-	core/Fl_Single_Window.cxx \
-	core/Fl_Slider.cxx \
-	core/Style.cxx \
-	core/Fl_Sys_Menu_Bar.cxx \
-	core/Fl_Table.cxx \
-	core/Fl_Table_Row.cxx \
-	core/Fl_Tabs.cxx \
-	core/Fl_Text_Buffer.cxx \
-	core/Fl_Text_Display.cxx \
-	core/Fl_Text_Editor.cxx \
-	core/Fl_Tile.cxx \
-	core/Fl_Tiled_Image.cxx \
-	core/Fl_Tooltip.cxx \
-	core/Fl_Tree.cxx \
-	core/Fl_Tree_Item.cxx \
-	core/Fl_Tree_Item_Array.cxx \
-	core/Fl_Tree_Prefs.cxx \
-	core/Fl_Valuator.cxx \
-	core/Fl_Value_Input.cxx \
-	core/Fl_Value_Output.cxx \
-	core/Fl_Value_Slider.cxx \
-	core/Fl_Widget.cxx \
-	core/Fl_Window.cxx \
-	core/Fl_Window_fullscreen.cxx \
-	core/Fl_Window_hotspot.cxx \
-	core/Fl_Window_iconize.cxx \
-	core/Fl_Wizard.cxx \
-	core/Fl_XBM_Image.cxx \
-	core/Fl_XPM_Image.cxx \
-	core/Fl_abort.cxx \
-	core/Fl_add_idle.cxx \
-	core/Fl_arg.cxx \
-	core/Fl_compose.cxx \
-	core/Fl_display.cxx \
-	core/Fl_get_key.cxx \
-	core/Fl_get_system_colors.cxx \
-	core/Fl_grab.cxx \
-	core/Fl_lock.cxx \
-	core/Fl_own_colormap.cxx \
-	core/Fl_visual.cxx \
-	core/Fl_x.cxx \
-	core/filename_absolute.cxx \
-	core/filename_expand.cxx \
-	core/filename_ext.cxx \
-	core/filename_isdir.cxx \
-	core/filename_list.cxx \
-	core/filename_match.cxx \
-	core/filename_setext.cxx \
-	core/fl_arc.cxx \
-	core/fl_arci.cxx \
-	core/fl_ask.cxx \
-	core/fl_boxtype.cxx \
-	core/fl_call_main.cxx \
-	core/fl_color.cxx \
-	core/fl_cursor.cxx \
-	core/fl_curve.cxx \
-	core/fl_diamond_box.cxx \
-	core/fl_dnd.cxx \
-	core/fl_draw.cxx \
-	core/fl_draw_image.cxx \
-	core/fl_draw_pixmap.cxx \
-	core/fl_encoding_latin1.cxx \
-	core/fl_encoding_mac_roman.cxx \
-	core/fl_engraved_label.cxx \
-	core/fl_file_dir.cxx \
-	core/fl_font.cxx \
-	core/fl_gtk.cxx \
-	core/fl_labeltype.cxx \
-	core/fl_line_style.cxx \
-	core/fl_open_uri.cxx \
-	core/fl_oval_box.cxx \
-	core/fl_overlay.cxx \
-	core/fl_overlay_visual.cxx \
-	core/fl_plastic.cxx \
-	core/fl_read_image.cxx \
-	core/fl_rect.cxx \
-	core/fl_round_box.cxx \
-	core/fl_rounded_box.cxx \
-	core/fl_scroll_area.cxx \
-	core/fl_set_font.cxx \
-	core/fl_set_fonts.cxx \
-	core/fl_shadow_box.cxx \
-	core/fl_shortcut.cxx \
-	core/fl_show_colormap.cxx \
-	core/fl_symbols.cxx \
-	core/fl_utf8.cxx \
-	core/fl_utf.cxx \
-	core/fl_vertex.cxx \
-	core/numericsort.cxx \
-	core/ps_image.cxx \
-	core/scandir.cxx \
-	core/screen_xywh.cxx
+	fltk3/Adjuster.cxx \
+	fltk3/Bitmap.cxx \
+	fltk3/Box.cxx \
+	fltk3/Browser.cxx \
+	fltk3/Browser_.cxx \
+	fltk3/Browser_load.cxx \
+	fltk3/Button.cxx \
+	fltk3/Chart.cxx \
+	fltk3/CheckBrowser.cxx \
+	fltk3/CheckButton.cxx \
+	fltk3/Choice.cxx \
+	fltk3/Clock.cxx \
+	fltk3/ColorChooser.cxx \
+	fltk3/Counter.cxx \
+	fltk3/Device.cxx \
+	fltk3/Dial.cxx \
+	fltk3/DoubleWindow.cxx \
+	fltk3/FileBrowser.cxx \
+	fltk3/FileChooser.cxx \
+	fltk3/FileChooser2.cxx \
+	fltk3/FileIcon.cxx \
+	fltk3/FileInput.cxx \
+	fltk3/Group.cxx \
+	fltk3/HelpView.cxx \
+	fltk3/Image.cxx \
+	fltk3/Input.cxx \
+	fltk3/Input_.cxx \
+	fltk3/LightButton.cxx \
+	fltk3/Menu.cxx \
+	fltk3/Menu_.cxx \
+	fltk3/MenuBar.cxx \
+	fltk3/MenuButton.cxx \
+	fltk3/MenuWindow.cxx \
+	fltk3/Menu_add.cxx \
+	fltk3/Menu_global.cxx \
+	fltk3/MultiLabel.cxx \
+	fltk3/NativeFileChooser.cxx \
+	fltk3/OverlayWindow.cxx \
+	fltk3/PackedGroup.cxx \
+	fltk3/PagedDevice.cxx \
+	fltk3/Pixmap.cxx \
+	fltk3/Positioner.cxx \
+	fltk3/Printer.cxx \
+	fltk3/Preferences.cxx \
+	fltk3/Progress.cxx \
+	fltk3/RepeatButton.cxx \
+	fltk3/ReturnButton.cxx \
+	fltk3/Roller.cxx \
+	fltk3/RoundButton.cxx \
+	fltk3/ScrollGroup.cxx \
+	fltk3/Scrollbar.cxx \
+	fltk3/SharedImage.cxx \
+	fltk3/SingleWindow.cxx \
+	fltk3/Slider.cxx \
+	fltk3/Style.cxx \
+	fltk3/SysMenuBar.cxx \
+	fltk3/Table.cxx \
+	fltk3/TableRow.cxx \
+	fltk3/TabGroup.cxx \
+	fltk3/TextBuffer.cxx \
+	fltk3/TextDisplay.cxx \
+	fltk3/TextEditor.cxx \
+	fltk3/TiledGroup.cxx \
+	fltk3/TiledImage.cxx \
+	fltk3/Tooltip.cxx \
+	fltk3/Tree.cxx \
+	fltk3/TreeItem.cxx \
+	fltk3/TreeItemArray.cxx \
+	fltk3/TreePrefs.cxx \
+	fltk3/Valuator.cxx \
+	fltk3/ValueInput.cxx \
+	fltk3/ValueOutput.cxx \
+	fltk3/ValueSlider.cxx \
+	fltk3/Widget.cxx \
+	fltk3/Window.cxx \
+	fltk3/Window_fullscreen.cxx \
+	fltk3/Window_hotspot.cxx \
+	fltk3/Window_iconize.cxx \
+	fltk3/Wizard.cxx \
+	fltk3/XBMImage.cxx \
+	fltk3/XPMImage.cxx \
+	fltk3/abort.cxx \
+	fltk3/add_idle.cxx \
+	fltk3/arg.cxx \
+	fltk3/compose.cxx \
+	fltk3/display.cxx \
+	fltk3/get_key.cxx \
+	fltk3/get_system_colors.cxx \
+	fltk3/grab.cxx \
+	fltk3/lock.cxx \
+	fltk3/own_colormap.cxx \
+	fltk3/visual.cxx \
+	fltk3/x11.cxx \
+	fltk3/filename_absolute.cxx \
+	fltk3/filename_expand.cxx \
+	fltk3/filename_ext.cxx \
+	fltk3/filename_isdir.cxx \
+	fltk3/filename_list.cxx \
+	fltk3/filename_match.cxx \
+	fltk3/filename_setext.cxx \
+	fltk3/arc.cxx \
+	fltk3/arci.cxx \
+	fltk3/ask.cxx \
+	fltk3/boxtype.cxx \
+	fltk3/call_main.cxx \
+	fltk3/color.cxx \
+	fltk3/cursor.cxx \
+	fltk3/curve.cxx \
+	fltk3/diamond_box.cxx \
+	fltk3/dnd.cxx \
+	fltk3/draw.cxx \
+	fltk3/draw_image.cxx \
+	fltk3/draw_pixmap.cxx \
+	fltk3/encoding_latin1.cxx \
+	fltk3/encoding_mac_roman.cxx \
+	fltk3/engraved_label.cxx \
+	fltk3/file_dir.cxx \
+	fltk3/font.cxx \
+	fltk3/gtk.cxx \
+	fltk3/labeltype.cxx \
+	fltk3/line_style.cxx \
+	fltk3/open_uri.cxx \
+	fltk3/oval_box.cxx \
+	fltk3/overlay.cxx \
+	fltk3/overlay_visual.cxx \
+	fltk3/plastic.cxx \
+	fltk3/read_image.cxx \
+	fltk3/rect.cxx \
+	fltk3/round_box.cxx \
+	fltk3/rounded_box.cxx \
+	fltk3/scroll_area.cxx \
+	fltk3/set_font.cxx \
+	fltk3/set_fonts.cxx \
+	fltk3/shadow_box.cxx \
+	fltk3/shortcut.cxx \
+	fltk3/show_colormap.cxx \
+	fltk3/symbols.cxx \
+	fltk3/utf8.cxx \
+	fltk3/utf.cxx \
+	fltk3/vertex.cxx \
+	fltk3/numericsort.cxx \
+	fltk3/ps_image.cxx \
+	fltk3/scandir.cxx \
+	fltk3/screen_xywh.cxx
 
 FLTK3GL_CPPFILES = \
 	fltk3gl/GLChoice.cxx \
@@ -187,30 +187,30 @@
 	fltk3gl/glut_font.cxx
 
 FLTK3IMAGES_CPPFILES = \
-	core/Fl_BMP_Image.cxx \
-	core/Fl_File_Icon2.cxx \
-	core/Fl_GIF_Image.cxx \
-	core/Fl_Help_Dialog.cxx \
-	core/Fl_JPEG_Image.cxx \
-	core/Fl_PNG_Image.cxx \
-	core/Fl_PNM_Image.cxx \
-	core/fl_images_core.cxx
+	fltk3images/BMPImage.cxx \
+	fltk3images/FileIcon2.cxx \
+	fltk3images/GIFImage.cxx \
+	fltk3images/HelpDialog.cxx \
+	fltk3images/images_core.cxx \
+	fltk3images/JPEGImage.cxx \
+	fltk3images/PNGImage.cxx \
+	fltk3images/PNMImage.cxx
 
 FLTK3_OBJCPPFILES = \
-	core/Fl_cocoa.mm \
-	core/Fl_Native_File_Chooser_MAC.mm \
-	core/Fl_Quartz_Printer.mm
+	fltk3/cocoa.mm \
+	fltk3/cocoaNativeFileChooser.mm \
+	fltk3/cocoaQuartzPrinter.mm
 
 FLTK3_CFILES = \
-	core/flstring.c \
-	core/vsnprintf.c \
-	core/xutf8/case.c \
-	core/xutf8/is_right2left.c \
-	core/xutf8/is_spacing.c \
-	core/xutf8/keysym2Ucs.c \
-	core/xutf8/utf8Input.c \
-	core/xutf8/utf8Utils.c \
-	core/xutf8/utf8Wrap.c
+	fltk3/flstring.c \
+	fltk3/vsnprintf.c \
+	fltk3/xutf8/case.c \
+	fltk3/xutf8/is_right2left.c \
+	fltk3/xutf8/is_spacing.c \
+	fltk3/xutf8/keysym2Ucs.c \
+	fltk3/xutf8/utf8Input.c \
+	fltk3/xutf8/utf8Utils.c \
+	fltk3/xutf8/utf8Wrap.c
 
 FLTK3PNG_CFILES = \
 	fltk3png/png.c \

Copied: branches/branch-3.0/src/fltk3/Adjuster.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Adjuster.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Adjuster.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Adjuster.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,183 @@
+//
+// "$Id$"
+//
+// Adjuster widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Adjuster.h>
+#include <fltk3/Bitmap.h>
+#include <fltk3/draw.h>
+#include <fltk3/Wrapper.h>
+
+#include "fastarrow.h"
+static fltk3::Bitmap fastarrow(fastarrow_bits, fastarrow_width, fastarrow_height);
+#include "mediumarrow.h"
+static fltk3::Bitmap mediumarrow(mediumarrow_bits, mediumarrow_width, mediumarrow_height);
+#include "slowarrow.h"
+static fltk3::Bitmap slowarrow(slowarrow_bits, slowarrow_width, slowarrow_height);
+
+// changing the value does not change the appearance:
+void fltk3::Adjuster::value_damage() {}
+
+void fltk3::Adjuster::draw() {
+  int dx, dy, W, H;
+  if (w()>=h()) {
+    dx = W = w()/3;
+    dy = 0; H = h();
+  } else {
+    dx = 0; W = w();
+    dy = H = h()/3;
+  }
+  draw_box(drag==1?fltk3::DOWN_BOX:box(), x(),  y()+2*dy, W, H, color());
+  draw_box(drag==2?fltk3::DOWN_BOX:box(), x()+dx, y()+dy, W, H, color());
+  draw_box(drag==3?fltk3::DOWN_BOX:box(), x()+2*dx,  y(), W, H, color());
+  if (active_r())
+    fltk3::color(selection_color());
+  else
+    fltk3::color(fltk3::inactive(selection_color()));
+  fastarrow.draw(x()+(W-fastarrow_width)/2,
+		 y()+2*dy+(H-fastarrow_height)/2, W, H);
+  mediumarrow.draw(x()+dx+(W-mediumarrow_width)/2,
+		   y()+dy+(H-mediumarrow_height)/2, W, H);
+  slowarrow.draw(x()+2*dx+(W-slowarrow_width)/2,
+		 y()+(H-slowarrow_width)/2, W, H);
+  if (fltk3::focus() == this) draw_focus();
+}
+
+int fltk3::Adjuster::handle(int event) {
+  double v;
+  int delta;
+  int mx = fltk3::event_x();
+  // fltk3::WidgetTracker wp(this);
+  switch (event) {
+    case fltk3::PUSH:
+      if (fltk3::visible_focus()) fltk3::focus(this);
+      ix = mx;
+      if (w()>=h())
+	drag = 3*(mx-x())/w() + 1;
+      else
+	drag = 3-3*(fltk3::event_y()-y()-1)/h();
+      { fltk3::WidgetTracker wp(this);
+	handle_push();
+	if (wp.deleted()) return 1;
+      }
+      redraw();
+      return 1;
+    case fltk3::DRAG:
+      if (w() >= h()) {
+	delta = x()+(drag-1)*w()/3;	// left edge of button
+	if (mx < delta)
+	  delta = mx-delta;
+	else if (mx > (delta+w()/3)) // right edge of button
+	  delta = mx-delta-w()/3;
+	else
+	  delta = 0;
+      } else {
+	if (mx < x())
+	  delta = mx-x();
+	else if (mx > (x()+w()))
+	  delta = mx-x()-w();
+	else
+	  delta = 0;
+      }
+      switch (drag) {
+	case 3: v = increment(previous_value(), delta); break;
+	case 2: v = increment(previous_value(), delta*10); break;
+	default:v = increment(previous_value(), delta*100); break;
+      }
+      handle_drag(soft() ? softclamp(v) : clamp(v));
+      return 1;
+    case fltk3::RELEASE:
+      if (fltk3::event_is_click()) { // detect click but no drag
+	if (fltk3::event_state()&0xF0000) delta = -10;
+	else delta = 10;
+	switch (drag) {
+	  case 3: v = increment(previous_value(), delta); break;
+	  case 2: v = increment(previous_value(), delta*10); break;
+	  default:v = increment(previous_value(), delta*100); break;
+	}
+	fltk3::WidgetTracker wp(this);
+	handle_drag(soft() ? softclamp(v) : clamp(v));
+	if (wp.deleted()) return 1;
+      }
+      drag = 0;
+      redraw();
+      handle_release();
+      return 1;
+    case fltk3::KEYBOARD :
+      switch (fltk3::event_key()) {
+	case fltk3::UpKey:
+          if (w() > h()) return 0;
+	  handle_drag(clamp(increment(value(),-1)));
+	  return 1;
+	case fltk3::DownKey:
+          if (w() > h()) return 0;
+	  handle_drag(clamp(increment(value(),1)));
+	  return 1;
+	case fltk3::LeftKey:
+          if (w() < h()) return 0;
+	  handle_drag(clamp(increment(value(),-1)));
+	  return 1;
+	case fltk3::RightKey:
+          if (w() < h()) return 0;
+	  handle_drag(clamp(increment(value(),1)));
+	  return 1;
+	default:
+          return 0;
+      }
+      // break not required because of switch...
+
+    case fltk3::FOCUS:
+    case fltk3::UNFOCUS:
+      if (fltk3::visible_focus()) {
+        redraw();
+        return 1;
+      } else return 0;
+
+    case fltk3::ENTER :
+    case fltk3::LEAVE :
+      return 1;
+  }
+  return 0;
+}
+
+/**
+  Creates a new fltk3::Adjuster widget using the given position,
+  size, and label string. It looks best if one of the dimensions is 3
+  times the other.
+  <P> Inherited destructor destroys the Valuator.
+*/
+fltk3::Adjuster::Adjuster(int X, int Y, int W, int H, const char* l)
+  : fltk3::Valuator(X, Y, W, H, l) {
+  box(fltk3::UP_BOX);
+  step(1, 10000);
+  selection_color(fltk3::SELECTION_COLOR);
+  drag = 0;
+  soft_ = 1;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Bitmap.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Bitmap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Bitmap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Bitmap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,482 @@
+//
+// "$Id$"
+//
+// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/** \fn fltk3::Bitmap::fltk3::Bitmap(const char *array, int W, int H)
+  The constructors create a new bitmap from the specified bitmap data.*/
+
+/** \fn fltk3::Bitmap::fltk3::Bitmap(const unsigned char *array, int W, int H)
+  The constructors create a new bitmap from the specified bitmap data.*/
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+#include <fltk3/Widget.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/Bitmap.h>
+#include <fltk3/Printer.h>
+#include "flstring.h"
+
+#if defined(__APPLE_QUARTZ__)
+
+
+fltk3::Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
+  static uchar reverse[16] =    /* Bit reversal lookup table */
+    { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee, 
+      0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
+  int rowBytes = (w+7)>>3 ;
+  uchar *bmask = (uchar*)malloc(rowBytes*h), *dst = bmask;
+  const uchar *src = array;
+  for ( int i=rowBytes*h; i>0; i--,src++ ) {
+    *dst++ = ((reverse[*src & 0x0f] & 0xf0) | (reverse[(*src >> 4) & 0x0f] & 0x0f))^0xff;
+  }
+  CGDataProviderRef srcp = CGDataProviderCreateWithData( 0L, bmask, rowBytes*h, 0L);
+  CGImageRef id_ = CGImageMaskCreate( w, h, 1, 1, rowBytes, srcp, 0L, false);
+  CGDataProviderRelease(srcp);
+  return (fltk3::Bitmask)id_;
+}
+void fl_delete_bitmask(fltk3::Bitmask bm) {
+  if (bm) CGImageRelease((CGImageRef)bm);
+}
+
+
+#elif defined(WIN32) // Windows bitmask functions...
+
+
+// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
+static fltk3::Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
+  // we need to pad the lines out to words & swap the bits
+  // in each byte.
+  int w1 = (w+7)/8;
+  int w2 = ((w+15)/16)*2;
+  uchar* newarray = new uchar[w2*h];
+  const uchar* src = data;
+  uchar* dest = newarray;
+  fltk3::Bitmask bm;
+  static uchar reverse[16] =	/* Bit reversal lookup table */
+  	      { 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
+		0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
+
+  for (int y=0; y < h; y++) {
+    for (int n = 0; n < w1; n++, src++)
+      *dest++ = (uchar)((reverse[*src & 0x0f] & 0xf0) |
+	                (reverse[(*src >> 4) & 0x0f] & 0x0f));
+    dest += w2-w1;
+  }
+
+  bm = CreateBitmap(w, h, 1, 1, newarray);
+
+  delete[] newarray;
+
+  return bm;
+}
+
+// 'fl_create_bitmask()' - Create an N-bit bitmap for masking...
+fltk3::Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
+  // this won't work when the user changes display mode during run or
+  // has two screens with differnet depths
+  fltk3::Bitmask bm;
+  static uchar hiNibble[16] =
+  { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 };
+  static uchar loNibble[16] =
+  { 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e,
+    0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f };
+  int np  = GetDeviceCaps(fl_gc, PLANES);	//: was always one on sample machines
+  int bpp = GetDeviceCaps(fl_gc, BITSPIXEL);//: 1,4,8,16,24,32 and more odd stuff?
+  int Bpr = (bpp*w+7)/8;			//: bytes per row
+  int pad = Bpr&1, w1 = (w+7)/8, shr = ((w-1)&7)+1;
+  if (bpp==4) shr = (shr+1)/2;
+  uchar *newarray = new uchar[(Bpr+pad)*h];
+  uchar *dst = newarray;
+  const uchar *src = data;
+
+  for (int i=0; i<h; i++) {
+    // This is slooow, but we do it only once per pixmap
+    for (int j=w1; j>0; j--) {
+      uchar b = *src++;
+      if (bpp==1) {
+        *dst++ = (uchar)( hiNibble[b&15] ) | ( loNibble[(b>>4)&15] );
+      } else if (bpp==4) {
+        for (int k=(j==1)?shr:4; k>0; k--) {
+          *dst++ = (uchar)("\377\360\017\000"[b&3]);
+          b = b >> 2;
+        }
+      } else {
+        for (int k=(j==1)?shr:8; k>0; k--) {
+          if (b&1) {
+            *dst++=0;
+	    if (bpp>8) *dst++=0;
+            if (bpp>16) *dst++=0;
+	    if (bpp>24) *dst++=0;
+	  } else {
+	    *dst++=0xff;
+	    if (bpp>8) *dst++=0xff;
+	    if (bpp>16) *dst++=0xff;
+	    if (bpp>24) *dst++=0xff;
+	  }
+
+	  b = b >> 1;
+        }
+      }
+    }
+
+    dst += pad;
+  }
+
+  bm = CreateBitmap(w, h, np, bpp, newarray);
+  delete[] newarray;
+
+  return bm;
+}
+
+
+void fl_delete_bitmask(fltk3::Bitmask bm) {
+  DeleteObject((HGDIOBJ)bm);
+}
+
+
+#else // X11 bitmask functions
+
+
+fltk3::Bitmask fl_create_bitmask(int w, int h, const uchar *data) {
+  return XCreateBitmapFromData(fl_display, fl_window, (const char *)data,
+                               (w+7)&-8, h);
+}
+
+void fl_delete_bitmask(fltk3::Bitmask bm) {
+  fl_delete_offscreen((fltk3::Offscreen)bm);
+}
+
+
+#endif // __APPLE__
+
+
+// Create a 1-bit mask used for alpha blending
+fltk3::Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
+  fltk3::Bitmask bm;
+  int bmw = (w + 7) / 8;
+  uchar *bitmap = new uchar[bmw * h];
+  uchar *bitptr, bit;
+  const uchar *dataptr;
+  int x, y;
+  static uchar dither[16][16] = { // Simple 16x16 Floyd dither
+    { 0,   128, 32,  160, 8,   136, 40,  168,
+      2,   130, 34,  162, 10,  138, 42,  170 },
+    { 192, 64,  224, 96,  200, 72,  232, 104,
+      194, 66,  226, 98,  202, 74,  234, 106 },
+    { 48,  176, 16,  144, 56,  184, 24,  152,
+      50,  178, 18,  146, 58,  186, 26,  154 },
+    { 240, 112, 208, 80,  248, 120, 216, 88,
+      242, 114, 210, 82,  250, 122, 218, 90 },
+    { 12,  140, 44,  172, 4,   132, 36,  164,
+      14,  142, 46,  174, 6,   134, 38,  166 },
+    { 204, 76,  236, 108, 196, 68,  228, 100,
+      206, 78,  238, 110, 198, 70,  230, 102 },
+    { 60,  188, 28,  156, 52,  180, 20,  148,
+      62,  190, 30,  158, 54,  182, 22,  150 },
+    { 252, 124, 220, 92,  244, 116, 212, 84,
+      254, 126, 222, 94,  246, 118, 214, 86 },
+    { 3,   131, 35,  163, 11,  139, 43,  171,
+      1,   129, 33,  161, 9,   137, 41,  169 },
+    { 195, 67,  227, 99,  203, 75,  235, 107,
+      193, 65,  225, 97,  201, 73,  233, 105 },
+    { 51,  179, 19,  147, 59,  187, 27,  155,
+      49,  177, 17,  145, 57,  185, 25,  153 },
+    { 243, 115, 211, 83,  251, 123, 219, 91,
+      241, 113, 209, 81,  249, 121, 217, 89 },
+    { 15,  143, 47,  175, 7,   135, 39,  167,
+      13,  141, 45,  173, 5,   133, 37,  165 },
+    { 207, 79,  239, 111, 199, 71,  231, 103,
+      205, 77,  237, 109, 197, 69,  229, 101 },
+    { 63,  191, 31,  159, 55,  183, 23,  151,
+      61,  189, 29,  157, 53,  181, 21,  149 },
+    { 254, 127, 223, 95,  247, 119, 215, 87,
+      253, 125, 221, 93,  245, 117, 213, 85 }
+  };
+
+  // Generate a 1-bit "screen door" alpha mask; not always pretty, but
+  // definitely fast...  In the future we may be able to support things
+  // like the RENDER extension in XFree86, when available, to provide
+  // true RGBA-blended rendering.  See:
+  //
+  //     http://www.xfree86.org/~keithp/render/protocol.html
+  //
+  // for more info on XRender...
+  //
+  // MacOS already provides alpha blending support and has its own
+  // fl_create_alphamask() function...
+  memset(bitmap, 0, bmw * h);
+
+  for (dataptr = array + d - 1, y = 0; y < h; y ++, dataptr += ld)
+    for (bitptr = bitmap + y * bmw, bit = 1, x = 0; x < w; x ++, dataptr += d) {
+      if (*dataptr > dither[x & 15][y & 15])
+	*bitptr |= bit;
+      if (bit < 128) bit <<= 1;
+      else {
+	bit = 1;
+	bitptr ++;
+      }
+    }
+
+  bm = fl_create_bitmask(w, h, bitmap);
+  delete[] bitmap;
+
+  return (bm);
+}
+
+void fltk3::Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+  fltk3::graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+static int start(fltk3::Bitmap *bm, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, 
+		 int &X, int &Y, int &W, int &H)
+{
+  // account for current clip region (faster on Irix):
+  fltk3::clip_box(XP,YP,WP,HP,X,Y,W,H);
+  cx += X-XP; cy += Y-YP;
+  // clip the box down to the size of image, quit if empty:
+  if (cx < 0) {W += cx; X -= cx; cx = 0;}
+  if (cx+W > w) W = w-cx;
+  if (W <= 0) return 1;
+  if (cy < 0) {H += cy; Y -= cy; cy = 0;}
+  if (cy+H > h) H = h-cy;
+  if (H <= 0) return 1;
+  return 0;
+}
+
+#ifdef __APPLE__
+void fltk3::QuartzGraphicsDriver::draw(fltk3::Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  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)) {
+    return;
+  }
+  if (!bm->id_) bm->id_ = fl_create_bitmask(bm->w(), bm->h(), bm->array);
+  if (bm->id_ && fl_gc) {
+    CGRect rect = { { X, Y }, { W, H } };
+    Fl_X::q_begin_image(rect, cx, cy, bm->w(), bm->h());
+    CGContextDrawImage(fl_gc, rect, (CGImageRef)bm->id_);
+    Fl_X::q_end_image();
+  }
+}
+
+#elif defined(WIN32)
+void fltk3::GDIGraphicsDriver::draw(fltk3::Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  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)) {
+    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;
+  int save;
+  BOOL use_print_algo = false;
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+    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
+    fltk3::Offscreen tmp_id = fl_create_offscreen(W, H);
+    fl_begin_offscreen(tmp_id);
+    fltk3::Color save_c = fltk3::color(); // save bitmap's desired color
+    uchar r, g, b;
+    fltk3::get_color(save_c, r, g, b);
+    r = 255-r;
+    g = 255-g;
+    b = 255-b;
+    fltk3::Color background = fltk3::rgb_color(r, g, b); // a color very different from the bitmap's
+    fltk3::color(background);
+    fltk3::rectf(0,0,W,H); // use this color as offscreen background
+    fltk3::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);
+  }
+  RestoreDC(tempdc, save);
+  DeleteDC(tempdc);
+}  
+
+#else // Xlib
+void fltk3::XlibGraphicsDriver::draw(fltk3::Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  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)) {
+    return;
+  }
+  if (!bm->id_) bm->id_ = fl_create_bitmask(bm->w(), bm->h(), bm->array);
+  
+  XSetStipple(fl_display, fl_gc, bm->id_);
+  int ox = X-cx; if (ox < 0) ox += bm->w();
+  int oy = Y-cy; if (oy < 0) oy += bm->h();
+  XSetTSOrigin(fl_display, fl_gc, ox, oy);
+  XSetFillStyle(fl_display, fl_gc, FillStippled);
+  XFillRectangle(fl_display, fl_window, fl_gc, X, Y, W, H);
+  XSetFillStyle(fl_display, fl_gc, FillSolid);
+}
+#endif
+
+/**
+  The destructor free all memory and server resources that are used by
+  the bitmap.
+*/
+fltk3::Bitmap::~Bitmap() {
+  uncache();
+  if (alloc_array) delete[] (uchar *)array;
+}
+
+void fltk3::Bitmap::uncache() {
+  if (id_) {
+#ifdef __APPLE_QUARTZ__
+    fl_delete_bitmask((fltk3::Bitmask)id_);
+#else
+    fl_delete_bitmask((fltk3::Offscreen)id_);
+#endif
+    id_ = 0;
+  }
+}
+
+void fltk3::Bitmap::label(fltk3::Widget* widget) {
+  widget->image(this);
+}
+
+void fltk3::Bitmap::label(fltk3::MenuItem* m) {
+  fltk3::set_labeltype(fltk3::IMAGE_LABEL, labeltype, measure);
+  m->label(fltk3::IMAGE_LABEL, (const char*)this);
+}
+
+fltk3::Image *fltk3::Bitmap::copy(int W, int H) {
+  fltk3::Bitmap	*new_image;	// New RGB image
+  uchar		*new_array;	// New array for image data
+
+  // Optimize the simple copy where the width and height are the same...
+  if (W == w() && H == h()) {
+    new_array = new uchar [H * ((W + 7) / 8)];
+    memcpy(new_array, array, H * ((W + 7) / 8));
+
+    new_image = new fltk3::Bitmap(new_array, W, H);
+    new_image->alloc_array = 1;
+
+    return new_image;
+  }
+  if (W <= 0 || H <= 0) return 0;
+
+  // OK, need to resize the image data; allocate memory and 
+  uchar		*new_ptr,	// Pointer into new array
+		new_bit,	// Bit for new array
+		old_bit;	// Bit for old array
+  const uchar	*old_ptr;	// Pointer into old array
+  int		sx, sy,		// Source coordinates
+		dx, dy,		// Destination coordinates
+		xerr, yerr,	// X & Y errors
+		xmod, ymod,	// X & Y moduli
+		xstep, ystep;	// X & Y step increments
+
+
+  // Figure out Bresenheim step/modulus values...
+  xmod   = w() % W;
+  xstep  = w() / W;
+  ymod   = h() % H;
+  ystep  = h() / H;
+
+  // Allocate memory for the new image...
+  new_array = new uchar [H * ((W + 7) / 8)];
+  new_image = new fltk3::Bitmap(new_array, W, H);
+  new_image->alloc_array = 1;
+
+  memset(new_array, 0, H * ((W + 7) / 8));
+
+  // Scale the image using a nearest-neighbor algorithm...
+  for (dy = H, sy = 0, yerr = H, new_ptr = new_array; dy > 0; dy --) {
+    for (dx = W, xerr = W, old_ptr = array + sy * ((w() + 7) / 8), sx = 0, new_bit = 1;
+	 dx > 0;
+	 dx --) {
+      old_bit = (uchar)(1 << (sx & 7));
+      if (old_ptr[sx / 8] & old_bit) *new_ptr |= new_bit;
+
+      if (new_bit < 128) new_bit <<= 1;
+      else {
+        new_bit = 1;
+	new_ptr ++;
+      }
+
+      sx   += xstep;
+      xerr -= xmod;
+
+      if (xerr <= 0) {
+	xerr += W;
+	sx ++;
+      }
+    }
+
+    if (new_bit > 1) new_ptr ++;
+
+    sy   += ystep;
+    yerr -= ymod;
+    if (yerr <= 0) {
+      yerr += H;
+      sy ++;
+    }
+  }
+
+  return new_image;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Box.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,47 @@
+//
+// "$Id$"
+//
+// Box widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/Widget.h>
+#include <fltk3/Box.h>
+#include <fltk3/Wrapper.h>
+
+
+void fltk3::Box::draw() {
+  draw_box();
+  draw_label();
+}
+
+
+int fltk3::Box::handle(int event) {
+  if (event == fltk3::ENTER || event == fltk3::LEAVE) return 1;
+  else return 0;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Browser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Browser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Browser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Browser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,982 @@
+//
+// "$Id$"
+//
+// Browser widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Browser.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+#include <stdlib.h>
+#include <math.h>
+
+#if defined(FL_DLL)	// really needed for c'tors for MS VC++ only
+#include <fltk3/HoldBrowser.h>
+#include <fltk3/MultiBrowser.h>
+#include <fltk3/SelectBrowser.h>
+#endif
+
+// I modified this from the original Forms data to use a linked list
+// so that the number of items in the browser and size of those items
+// is unlimited. The only problem is that the old browser used an
+// index number to identify a line, and it is slow to convert from/to
+// a pointer. I use a cache of the last match to try to speed this up.
+
+// Also added the ability to "hide" a line. This sets its height to
+// zero, so the fltk3::Browser_ cannot pick it.
+
+#define SELECTED 1
+#define NOTDISPLAYED 2
+
+namespace fltk3 {
+  
+  // WARNING:
+  //       fltk3::FileChooser.cxx also has a definition of this structure (fltk3::BrowserLine_).
+  //       Changes to fltk3::BrowserLine_ *must* be reflected in fltk3::FileChooser.cxx as well.
+  //       This hack in fltk3::FileChooser should be solved.
+  //
+  struct BrowserLine_ {	// data is in a linked list of these
+    fltk3::BrowserLine_* prev;
+    fltk3::BrowserLine_* next;
+    void* data;
+    fltk3::Image* icon;
+    short length;		// sizeof(txt)-1, may be longer than string
+    char flags;		// selected, displayed
+    char txt[1];		// start of allocated array
+  };
+  
+}
+
+
+void fltk3::Browser::item_swap(void *a, void *b) { 
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_swap(a, b), BrowserItemSwap) 
+  swap((fltk3::BrowserLine_*)a, (fltk3::BrowserLine_*)b); 
+}
+
+void *fltk3::Browser::item_at(int line) const { 
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_at(line), BrowserItemAt) 
+  return (void*)find_line(line);
+}
+
+/**
+  Returns the very first item in the list.
+  Example of use:
+  \code
+  // Walk the browser from beginning to end
+  for ( void *i=item_first(); i; i=item_next(i) ) {
+      printf("item label='%s'\n", item_text(i));
+  }
+  \endcode
+  \returns The first item, or NULL if list is empty.
+  \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* fltk3::Browser::item_first() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_first(), BrowserItemFirst) 
+  return first;
+}
+
+/**
+  Returns the next item after \p item.
+  \param[in] item The 'current' item
+  \returns The next item after \p item, or NULL if there are none after this one.
+  \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* fltk3::Browser::item_next(void* item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_next(item), BrowserItemNext) 
+  return ((fltk3::BrowserLine_*)item)->next;
+}
+
+/**
+  Returns the previous item before \p item.
+  \param[in] item The 'current' item
+  \returns The previous item before \p item, or NULL if there none before this one.
+  \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* fltk3::Browser::item_prev(void* item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_prev(item), BrowserItemPrev) 
+  return ((fltk3::BrowserLine_*)item)->prev;
+}
+
+/**
+  Returns the very last item in the list.
+  Example of use:
+  \code
+  // Walk the browser in reverse, from end to start
+  for ( void *i=item_last(); i; i=item_prev(i) ) {
+      printf("item label='%s'\n", item_text(i));
+  }
+  \endcode
+  \returns The last item, or NULL if list is empty.
+  \see item_first(), item_last(), item_next(), item_prev()
+*/
+void* fltk3::Browser::item_last() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_last(), BrowserItemLast) 
+  return last;
+}
+
+/**
+  See if \p item is selected.
+  \param[in] item The item whose selection state is to be checked.
+  \returns 1 if selected, 0 if not.
+  \see select(), selected(), value(), item_select(), item_selected()
+*/
+int fltk3::Browser::item_selected(void* item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_selected(item), BrowserItemSelected)
+  return ((fltk3::BrowserLine_*)item)->flags&SELECTED;
+}
+/**
+  Change the selection state of \p item to the value \p val.
+  \param[in] item The item to be changed.
+  \param[in] val The new selection state: 1 selects, 0 de-selects.
+  \see select(), selected(), value(), item_select(), item_selected()
+*/
+void fltk3::Browser::item_select(void *item, int val) {
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_select(item, val), BrowserItemSelect)
+  if (val) ((fltk3::BrowserLine_*)item)->flags |= SELECTED;
+  else     ((fltk3::BrowserLine_*)item)->flags &= ~SELECTED;
+}
+
+/**
+  Returns the label text for \p item.
+  \param[in] item The item whose label text is returned.
+  \returns The item's text string. (Can be NULL)
+*/
+const char *fltk3::Browser::item_text(void *item) const { 
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(const char *, item_text(item), BrowserItemText)
+  return ((fltk3::BrowserLine_*)item)->txt;
+}
+
+/**
+  Returns the item for specified \p line.
+
+  Note: This call is slow. It's fine for e.g. responding to user
+  clicks, but slow if called often, such as in a tight sorting loop.
+  Finding an item 'by line' involves a linear lookup on the internal
+  linked list. The performance hit can be significant if the browser's
+  contents is large, and the method is called often (e.g. during a sort).
+  If you're writing a subclass, use the protected methods item_first(),
+  item_next(), etc. to access the internal linked list more efficiently.
+
+  \param[in] line The line number of the item to return. (1 based)
+  \retval item that was found.
+  \retval NULL if line is out of range.
+  \see item_at(), find_line(), lineno()
+*/
+fltk3::BrowserLine_* fltk3::Browser::find_line(int line) const {
+  int n; fltk3::BrowserLine_* l;
+  if (line == cacheline) return cache;
+  if (cacheline && line > (cacheline/2) && line < ((cacheline+lines)/2)) {
+    n = cacheline; l = cache;
+  } else if (line <= (lines/2)) {
+    n = 1; l = first;
+  } else {
+    n = lines; l = last;
+  }
+  for (; n < line && l; n++) l = l->next;
+  for (; n > line && l; n--) l = l->prev;
+  ((fltk3::Browser*)this)->cacheline = line;
+  ((fltk3::Browser*)this)->cache = l;
+  return l;
+}
+
+/**
+  Returns line number corresponding to \p item, or zero if not found.
+  Caveat: See efficiency note in find_line().
+  \param[in] item The item to be found
+  \returns The line number of the item, or 0 if not found.
+  \see item_at(), find_line(), lineno()
+*/
+int fltk3::Browser::lineno(void *item) const {
+  fltk3::BrowserLine_* l = (fltk3::BrowserLine_*)item;
+  if (!l) return 0;
+  if (l == cache) return cacheline;
+  if (l == first) return 1;
+  if (l == last) return lines;
+  if (!cache) {
+    ((fltk3::Browser*)this)->cache = first;
+    ((fltk3::Browser*)this)->cacheline = 1;
+  }
+  // assume it is near cache, search both directions:
+  fltk3::BrowserLine_* b = cache->prev;
+  int bnum = cacheline-1;
+  fltk3::BrowserLine_* f = cache->next;
+  int fnum = cacheline+1;
+  int n = 0;
+  for (;;) {
+    if (b == l) {n = bnum; break;}
+    if (f == l) {n = fnum; break;}
+    if (b) {b = b->prev; bnum--;}
+    if (f) {f = f->next; fnum++;}
+  }
+  ((fltk3::Browser*)this)->cache = l;
+  ((fltk3::Browser*)this)->cacheline = n;
+  return n;
+}
+
+/**
+  Removes the item at the specified \p line.
+  Caveat: See efficiency note in find_line().
+  You must call redraw() to make any changes visible.
+  \param[in] line The line number to be removed. (1 based) Must be in range!
+  \returns Pointer to browser item that was removed (and is no longer valid).
+  \see add(), insert(), remove(), swap(int,int), clear()
+*/
+fltk3::BrowserLine_* fltk3::Browser::_remove(int line) {
+  fltk3::BrowserLine_* ttt = find_line(line);
+  deleting(ttt);
+
+  cacheline = line-1;
+  cache = ttt->prev;
+  lines--;
+  full_height_ -= item_height(ttt);
+  if (ttt->prev) ttt->prev->next = ttt->next;
+  else first = ttt->next;
+  if (ttt->next) ttt->next->prev = ttt->prev;
+  else last = ttt->prev;
+
+  return(ttt);
+}
+
+/**
+  Remove entry for given \p line number, making the browser one line shorter.
+  You must call redraw() to make any changes visible.
+  \param[in] line Line to be removed. (1 based) \n
+                  If \p line is out of range, no action is taken.
+  \see add(), insert(), remove(), swap(int,int), clear()
+*/
+void fltk3::Browser::remove(int line) {
+  if (line < 1 || line > lines) return;
+  free(_remove(line));
+}
+
+/**
+  Insert specified \p item above \p line.
+  If \p line > size() then the line is added to the end.
+
+  Caveat: See efficiency note in find_line().
+
+  \param[in] line  The new line will be inserted above this line (1 based).
+  \param[in] item  The item to be added.
+*/
+void fltk3::Browser::insert(int line, fltk3::BrowserLine_* item) {
+  if (!first) {
+    item->prev = item->next = 0;
+    first = last = item;
+  } else if (line <= 1) {
+    inserting(first, item);
+    item->prev = 0;
+    item->next = first;
+    item->next->prev = item;
+    first = item;
+  } else if (line > lines) {
+    item->prev = last;
+    item->prev->next = item;
+    item->next = 0;
+    last = item;
+  } else {
+    fltk3::BrowserLine_* n = find_line(line);
+    inserting(n, item);
+    item->next = n;
+    item->prev = n->prev;
+    item->prev->next = item;
+    n->prev = item;
+  }
+  cacheline = line;
+  cache = item;
+  lines++;
+  full_height_ += item_height(item);
+  redraw_line(item);
+}
+
+/**
+  Insert a new entry whose label is \p newtext \e above given \p line, optional data \p d.
+
+  Text may contain format characters; see format_char() for details.
+  \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+  The optional void * argument \p d will be the data() of the new item.
+
+  \param[in] line Line position for insert. (1 based) \n
+             If \p line > size(), the entry will be added at the end.
+  \param[in] newtext The label text for the new line.
+  \param[in] d Optional pointer to user data to be associated with the new line.
+*/
+void fltk3::Browser::insert(int line, const char* newtext, void* d) {
+  int l = strlen(newtext);
+  fltk3::BrowserLine_* t = (fltk3::BrowserLine_*)malloc(sizeof(fltk3::BrowserLine_)+l);
+  t->length = (short)l;
+  t->flags = 0;
+  strcpy(t->txt, newtext);
+  t->data = d;
+  t->icon = 0;
+  insert(line, t);
+}
+
+/**
+  Line \p from is removed and reinserted at \p to.
+  Note: \p to is calculated \e after line \p from gets removed.
+  \param[in] to Destination line number (calculated \e after line \p from is removed)
+  \param[in] from Line number of item to be moved
+*/
+void fltk3::Browser::move(int to, int from) {
+  if (from < 1 || from > lines) return;
+  insert(to, _remove(from));
+}
+
+/**
+  Sets the text for the specified \p line to \p newtext.
+
+  Text may contain format characters; see format_char() for details.
+  \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+  Does nothing if \p line is out of range.
+
+  \param[in] line The line of the item whose text will be changed. (1 based)
+  \param[in] newtext The new string to be assigned to the item.
+*/
+void fltk3::Browser::text(int line, const char* newtext) {
+  if (line < 1 || line > lines) return;
+  fltk3::BrowserLine_* t = find_line(line);
+  int l = strlen(newtext);
+  if (l > t->length) {
+    fltk3::BrowserLine_* n = (fltk3::BrowserLine_*)malloc(sizeof(fltk3::BrowserLine_)+l);
+    replacing(t, n);
+    cache = n;
+    n->data = t->data;
+    n->icon = t->icon;
+    n->length = (short)l;
+    n->flags = t->flags;
+    n->prev = t->prev;
+    if (n->prev) n->prev->next = n; else first = n;
+    n->next = t->next;
+    if (n->next) n->next->prev = n; else last = n;
+    free(t);
+    t = n;
+  }
+  strcpy(t->txt, newtext);
+  redraw_line(t);
+}
+
+/**
+  Sets the user data for specified \p line to \p d.
+  Does nothing if \p line is out of range.
+  \param[in] line The line of the item whose data() is to be changed. (1 based)
+  \param[in] d The new data to be assigned to the item. (can be NULL)
+*/
+void fltk3::Browser::data(int line, void* d) {
+  if (line < 1 || line > lines) return;
+  find_line(line)->data = d;
+}
+
+/**
+  Returns height of \p item in pixels.
+  This takes into account embedded \@ codes within the text() label.
+  \param[in] item The item whose height is returned.
+  \returns The height of the item in pixels.
+  \see item_height(), item_width(),\n
+       incr_height(), full_height()
+*/
+int fltk3::Browser::item_height(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_height(item), BrowserItemHeight) 
+  fltk3::BrowserLine_* l = (fltk3::BrowserLine_*)item;
+  if (l->flags & NOTDISPLAYED) return 0;
+
+  int hmax = 2; // use 2 to insure we don't return a zero!
+
+  if (!l->txt[0]) {
+    // For blank lines set the height to exactly 1 line!
+    fltk3::font(textfont(), textsize());
+    int hh = fltk3::height();
+    if (hh > hmax) hmax = hh;
+  } else {
+    const int* i = column_widths();
+    long int dummy;
+    // do each column separately as they may all set different fonts:
+    for (char* str = l->txt; str && *str; str++) {
+      fltk3::Font font = textfont(); // default font
+      int tsize = textsize(); // default size
+      while (*str==format_char()) {
+	str++;
+	switch (*str++) {
+	case 'l': case 'L': tsize = 24; break;
+	case 'm': case 'M': tsize = 18; break;
+	case 's': tsize = 11; break;
+	case 'b': font = (fltk3::Font)(font|fltk3::BOLD); break;
+	case 'i': font = (fltk3::Font)(font|fltk3::ITALIC); break;
+	case 'f': case 't': font = fltk3::COURIER; break;
+	case 'B':
+	case 'C': dummy = strtol(str, &str, 10); break;// skip a color number
+	case 'F': font = (fltk3::Font)strtol(str,&str,10); break;
+	case 'S': tsize = strtol(str,&str,10); break;
+	case 0: case '@': str--;
+	case '.': goto END_FORMAT;
+	}
+      }
+      END_FORMAT:
+      char* ptr = str;
+      if (ptr && *i++) str = strchr(str, column_char());
+      else str = NULL;
+      if((!str && *ptr) || (str && ptr < str)) {
+	fltk3::font(font, tsize); int hh = fltk3::height();
+	if (hh > hmax) hmax = hh;
+      }
+      if (!str || !*str) break;
+    }
+  }
+
+  if (l->icon && (l->icon->h()+2)>hmax) {
+    hmax = l->icon->h() + 2;	// leave 2px above/below
+  }
+  return hmax; // previous version returned hmax+2!
+}
+
+/**
+  Returns width of \p item in pixels.
+  This takes into account embedded \@ codes within the text() label.
+  \param[in] item The item whose width is returned.
+  \returns The width of the item in pixels.
+  \see item_height(), item_width(),\n
+       incr_height(), full_height()
+*/
+int fltk3::Browser::item_width(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_width(item), BrowserItemWidth)
+  fltk3::BrowserLine_* l=(fltk3::BrowserLine_*)item;
+  char* str = l->txt;
+  const int* i = column_widths();
+  int ww = 0;
+
+  while (*i) { // add up all tab-separated fields
+    char* e;
+    e = strchr(str, column_char());
+    if (!e) break; // last one occupied by text
+    str = e+1;
+    ww += *i++;
+  }
+
+  // OK, we gotta parse the string and find the string width...
+  int tsize = textsize();
+  fltk3::Font font = textfont();
+  int done = 0;
+
+  while (*str == format_char_ && str[1] && str[1] != format_char_) {
+    long int dummy;
+    str ++;
+    switch (*str++) {
+    case 'l': case 'L': tsize = 24; break;
+    case 'm': case 'M': tsize = 18; break;
+    case 's': tsize = 11; break;
+    case 'b': font = (fltk3::Font)(font|fltk3::BOLD); break;
+    case 'i': font = (fltk3::Font)(font|fltk3::ITALIC); break;
+    case 'f': case 't': font = fltk3::COURIER; break;
+    case 'B':
+    case 'C': dummy = strtol(str, &str, 10); break;// skip a color number
+    case 'F': font = (fltk3::Font)strtol(str, &str, 10); break;
+    case 'S': tsize = strtol(str, &str, 10); break;
+    case '.':
+      done = 1;
+      break;
+    case '@':
+      str--;
+      done = 1;
+    }
+
+    if (done)
+      break;
+  }
+
+  if (*str == format_char_ && str[1])
+    str ++;
+
+  if (ww==0 && l->icon) ww = l->icon->w();
+
+  fltk3::font(font, tsize);
+  return ww + int(fltk3::width(str)) + 6;
+}
+
+/**
+  The height of the entire list of all visible() items in pixels.
+  This returns the accumulated height of *all* the items in the browser
+  that are not hidden with hide(), including items scrolled off screen.
+  \returns The accumulated size of all the visible items in pixels.
+  \see item_height(), item_width(),\n
+       incr_height(), full_height()
+*/
+int fltk3::Browser::full_height() const {
+  return full_height_;
+}
+
+/**
+  The default 'average' item height (including inter-item spacing) in pixels.
+  This currently returns textsize() + 2.
+  \returns The value in pixels.
+  \see item_height(), item_width(),\n
+       incr_height(), full_height()
+*/
+int fltk3::Browser::incr_height() const {
+  return textsize()+2;
+}
+
+/**
+  Draws \p item at the position specified by \p X \p Y \p W \p H.
+  The \p W and \p H values are used for clipping.
+  Should only be called within the context of an FLTK draw().
+  \param[in] item The item to be drawn
+  \param[in] X,Y,W,H position and size.
+*/
+void fltk3::Browser::item_draw(void* item, int X, int Y, int W, int H) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_draw(item, X, Y, W, H), BrowserItemDraw)
+  fltk3::BrowserLine_* l = (fltk3::BrowserLine_*)item;
+  char* str = l->txt;
+  const int* i = column_widths();
+
+  bool first = true;	// for icon
+  while (W > 6) {	// do each tab-separated field
+    int w1 = W;	// width for this field
+    char* e = 0; // pointer to end of field or null if none
+    if (*i) { // find end of field and temporarily replace with 0
+      e = strchr(str, column_char());
+      if (e) {*e = 0; w1 = *i++;}
+    }
+    // Icon drawing code
+    if (first) {
+      first = false;
+      if (l->icon) {
+	l->icon->draw(X+2,Y+1);	// leave 2px left, 1px above
+	int iconw = l->icon->w()+2;
+	X += iconw; W -= iconw; w1 -= iconw;
+      }
+    }
+    int tsize = textsize();
+    fltk3::Font font = textfont();
+    fltk3::Color lcol = textcolor();
+    fltk3::Align talign = fltk3::ALIGN_LEFT;
+    // check for all the @-lines recognized by XForms:
+    //#if defined(__GNUC__)
+    //#warning FIXME This maybe needs to be more UTF8 aware now...?
+    //#endif /*__GNUC__*/
+    while (*str == format_char() && *++str && *str != format_char()) {
+      long int dummy;
+      switch (*str++) {
+      case 'l': case 'L': tsize = 24; break;
+      case 'm': case 'M': tsize = 18; break;
+      case 's': tsize = 11; break;
+      case 'b': font = (fltk3::Font)(font|fltk3::BOLD); break;
+      case 'i': font = (fltk3::Font)(font|fltk3::ITALIC); break;
+      case 'f': case 't': font = fltk3::COURIER; break;
+      case 'c': talign = fltk3::ALIGN_CENTER; break;
+      case 'r': talign = fltk3::ALIGN_RIGHT; break;
+      case 'B': 
+	if (!(l->flags & SELECTED)) {
+	  fltk3::color((fltk3::Color)strtol(str, &str, 10));
+	  fltk3::rectf(X, Y, w1, H);
+	} else dummy = strtol(str, &str, 10);
+        break;
+      case 'C':
+	lcol = (fltk3::Color)strtol(str, &str, 10);
+	break;
+      case 'F':
+	font = (fltk3::Font)strtol(str, &str, 10);
+	break;
+      case 'N':
+	lcol = fltk3::INACTIVE_COLOR;
+	break;
+      case 'S':
+	tsize = strtol(str, &str, 10);
+	break;
+      case '-':
+	fltk3::color(fltk3::DARK3);
+	fltk3::line(X+3, Y+H/2, X+w1-3, Y+H/2);
+	fltk3::color(fltk3::LIGHT3);
+	fltk3::line(X+3, Y+H/2+1, X+w1-3, Y+H/2+1);
+	break;
+      case 'u':
+      case '_':
+	fltk3::color(lcol);
+	fltk3::line(X+3, Y+H-1, X+w1-3, Y+H-1);
+	break;
+      case '.':
+	goto BREAK;
+      case '@':
+	str--; goto BREAK;
+      }
+    }
+  BREAK:
+    fltk3::font(font, tsize);
+    if (l->flags & SELECTED)
+      lcol = fltk3::contrast(lcol, selection_color());
+    if (!active_r()) lcol = fltk3::inactive(lcol);
+    fltk3::color(lcol);
+    fltk3::draw(str, X+3, Y, w1-6, H, e ? fltk3::Align(talign|fltk3::ALIGN_CLIP) : talign, 0, 0);
+    if (!e) break; // no more fields...
+    *e = column_char(); // put the separator back
+    X += w1;
+    W -= w1;
+    str = e+1;
+  }
+}
+
+static const int no_columns[1] = {0};
+
+/**
+  The constructor makes an empty browser.
+  \param[in] X,Y,W,H position and size.
+  \param[in] L label string, may be NULL.
+*/
+fltk3::Browser::Browser(int X, int Y, int W, int H, const char *L)
+: fltk3::Browser_(X, Y, W, H, L) {
+  column_widths_ = no_columns;
+  lines = 0;
+  full_height_ = 0;
+  cacheline = 0;
+  format_char_ = '@';
+  column_char_ = '\t';
+  first = last = cache = 0;
+}
+
+/**
+  Updates the browser so that \p line is shown at position \p pos.
+  \param[in] line line number. (1 based)
+  \param[in] pos position.
+  \see topline(), middleline(), bottomline()
+*/
+void fltk3::Browser::lineposition(int line, LinePosition pos) {
+  if (line<1) line = 1;
+  if (line>lines) line = lines;
+  int p = 0;
+
+  fltk3::BrowserLine_* l;
+  for (l=first; l && line>1; l = l->next) {
+    line--; p += item_height(l);
+  }
+  if (l && (pos == BOTTOM)) p += item_height (l);
+
+  int final = p, X, Y, W, H;
+  bbox(X, Y, W, H);
+
+  switch(pos) {
+    case TOP: break;
+    case BOTTOM: final -= H; break;
+    case MIDDLE: final -= H/2; break;
+  }
+  
+  if (final > (full_height() - H)) final = full_height() -H;
+  position(final);
+}
+
+/**
+  Returns the line that is currently visible at the top of the browser.
+  If there is no vertical scrollbar then this will always return 1.
+  \returns The lineno() of the top() of the browser.
+*/
+int fltk3::Browser::topline() const {
+  return lineno(top());
+}
+
+/**
+  Removes all the lines in the browser.
+  \see add(), insert(), remove(), swap(int,int), clear()
+*/
+void fltk3::Browser::clear() {
+  for (fltk3::BrowserLine_* l = first; l;) {
+    fltk3::BrowserLine_* n = l->next;
+    free(l);
+    l = n;
+  }
+  full_height_ = 0;
+  first = 0;
+  last = 0;
+  lines = 0;
+  new_list();
+}
+
+/**
+  Adds a new line to the end of the browser.
+
+  The text string \p newtext may contain format characters; see format_char() for details.
+  \p newtext is copied using the strdup() function, and can be NULL to make a blank line.
+
+  The optional void* argument \p d will be the data() for the new item.
+
+  \param[in] newtext The label text used for the added item
+  \param[in] d Optional user data() for the item (0 if unspecified)
+  \see add(), insert(), remove(), swap(int,int), clear()
+*/
+void fltk3::Browser::add(const char* newtext, void* d) {
+  insert(lines+1, newtext, d);
+  //fltk3::Browser_::display(last);
+}
+
+/**
+  Returns the label text for the specified \p line.
+  Return value can be NULL if \p line is out of range or unset.
+  The parameter \p line is 1 based.
+  \param[in] line The line number of the item whose text is returned. (1 based)
+  \returns The text string (can be NULL)
+*/
+const char* fltk3::Browser::text(int line) const {
+  if (line < 1 || line > lines) return 0;
+  return find_line(line)->txt;
+}
+
+/**
+  Returns the user data() for specified \p line.
+  Return value can be NULL if \p line is out of range or no user data() was defined.
+  The parameter \p line is 1 based (1 will be the first item in the list).
+  \param[in] line The line number of the item whose data() is returned. (1 based)
+  \returns The user data pointer (can be NULL)
+
+*/
+void* fltk3::Browser::data(int line) const {
+  if (line < 1 || line > lines) return 0;
+  return find_line(line)->data;
+}
+
+/**
+  Sets the selection state of the item at \p line to the value \p val.
+  If \p val is not specified, the default is 1 (selects the item).
+  \param[in] line The line number of the item to be changed. (1 based)
+  \param[in] val The new selection state (1=select, 0=de-select).
+  \returns 1 if the state changed, 0 if not.
+  \see select(), selected(), value(), item_select(), item_selected()
+*/
+int fltk3::Browser::select(int line, int val) {
+  if (line < 1 || line > lines) return 0;
+  return Browser_::select(find_line(line), val);
+}
+
+/**
+  Returns 1 if specified \p line is selected, 0 if not.
+  \param[in] line The line being checked (1 based)
+  \returns 1 if item selected, 0 if not.
+  \see select(), selected(), value(), item_select(), item_selected()
+  */
+int fltk3::Browser::selected(int line) const {
+  if (line < 1 || line > lines) return 0;
+  return find_line(line)->flags & SELECTED;
+}
+
+/**
+  Makes \p line visible, and available for selection by user.
+  Opposite of hide(int).
+  This changes the full_height() if the state was changed.
+  redraw() is called automatically if a change occurred.
+  \param[in] line The line to be shown. (1 based)
+  \see show(int), hide(int), display(), visible(), make_visible()
+*/
+void fltk3::Browser::show(int line) {
+  fltk3::BrowserLine_* t = find_line(line);
+  if (t->flags & NOTDISPLAYED) {
+    t->flags &= ~NOTDISPLAYED;
+    full_height_ += item_height(t);
+    if (Browser_::displayed(t)) redraw();
+  }
+}
+
+/**
+  Makes \p line invisible, preventing selection by the user.
+  The line can still be selected under program control.
+  This changes the full_height() if the state was changed.
+  When a line is made invisible, lines below it are moved up in the display.
+  redraw() is called automatically if a change occurred.
+  \param[in] line The line to be hidden. (1 based)
+  \see show(int), hide(int), display(), visible(), make_visible()
+*/
+void fltk3::Browser::hide(int line) {
+  fltk3::BrowserLine_* t = find_line(line);
+  if (!(t->flags & NOTDISPLAYED)) {
+    full_height_ -= item_height(t);
+    t->flags |= NOTDISPLAYED;
+    if (Browser_::displayed(t)) redraw();
+  }
+}
+
+/**
+  For back compatibility.
+  This calls show(line) if \p val is true, and hide(line) otherwise.
+  If \p val is not specified, the default is 1 (makes the line visible).
+  \see show(int), hide(int), display(), visible(), make_visible()
+*/
+void fltk3::Browser::display(int line, int val) {
+  if (line < 1 || line > lines) return;
+  if (val) show(line); else hide(line);
+}
+
+/**
+  Returns non-zero if the specified \p line is visible, 0 if hidden.
+  Use show(int), hide(int), or make_visible(int) to change an item's visible state.
+  \param[in] line The line in the browser to be tested. (1 based)
+  \see show(int), hide(int), display(), visible(), make_visible()
+*/
+int fltk3::Browser::visible(int line) const {
+  if (line < 1 || line > lines) return 0;
+  return !(find_line(line)->flags&NOTDISPLAYED);
+}
+
+/**
+  Returns the line number of the currently selected line, or 0 if none.
+  \returns The line number of current selection, or 0 if none selected.
+  \see select(), selected(), value(), item_select(), item_selected()
+*/
+int fltk3::Browser::value() const {
+  return lineno(selection());
+}
+
+/**
+  Swap the two items \p a and \p b.
+  Uses swapping() to ensure list updates correctly.
+  \param[in] a,b The two items to be swapped.
+  \see swap(int,int), item_swap()
+*/
+void fltk3::Browser::swap(fltk3::BrowserLine_ *a, fltk3::BrowserLine_ *b) {
+
+  if ( a == b || !a || !b) return;          // nothing to do
+  swapping(a, b);
+  fltk3::BrowserLine_ *aprev  = a->prev;
+  fltk3::BrowserLine_ *anext  = a->next;
+  fltk3::BrowserLine_ *bprev  = b->prev;
+  fltk3::BrowserLine_ *bnext  = b->next;
+  if ( b->prev == a ) { 		// A ADJACENT TO B
+     if ( aprev ) aprev->next = b; else first = b;
+     b->next = a;
+     a->next = bnext;
+     b->prev = aprev;
+     a->prev = b;
+     if ( bnext ) bnext->prev = a; else last = a;
+  } else if ( a->prev == b ) {		// B ADJACENT TO A
+     if ( bprev ) bprev->next = a; else first = a;
+     a->next = b;
+     b->next = anext;
+     a->prev = bprev;
+     b->prev = a;
+     if ( anext ) anext->prev = b; else last = b;
+  } else {				// A AND B NOT ADJACENT
+     // handle prev's
+     b->prev = aprev;
+     if ( anext ) anext->prev = b; else last = b;
+     a->prev = bprev;
+     if ( bnext ) bnext->prev = a; else last = a;
+     // handle next's
+     if ( aprev ) aprev->next = b; else first = b;
+     b->next = anext;
+     if ( bprev ) bprev->next = a; else first = a;
+     a->next = bnext;
+  }
+  // Disable cache -- we played around with positions
+  cacheline = 0;
+  cache = 0;
+}
+
+/**
+  Swaps two browser lines \p a and \p b.
+  You must call redraw() to make any changes visible.
+  \param[in] a,b The two lines to be swapped. (both 1 based)
+  \see swap(int,int), item_swap()
+*/
+void fltk3::Browser::swap(int a, int b) {
+  if (a < 1 || a > lines || b < 1 || b > lines) return;
+  fltk3::BrowserLine_* ai = find_line(a);
+  fltk3::BrowserLine_* bi = find_line(b);
+  swap(ai,bi);
+}
+
+/**
+  Set the image icon for \p line to the value \p icon.
+  Caller is responsible for keeping the icon allocated.
+  The \p line is automatically redrawn.
+  \param[in] line The line to be modified. If out of range, nothing is done.
+  \param[in] icon The image icon to be assigned to the \p line.
+                  If NULL, any previous icon is removed.
+*/
+void fltk3::Browser::icon(int line, fltk3::Image* icon) {
+
+  if (line<1 || line > lines) return;
+
+  fltk3::BrowserLine_* bl = find_line(line);
+
+  int old_h = bl->icon ? bl->icon->h()+2 : 0;	// init with *old* icon height
+  bl->icon = 0;					// remove icon, if any
+  int th = item_height(bl);			// height of text only
+  int new_h = icon ? icon->h()+2 : 0;		// init with *new* icon height
+  if (th > old_h) old_h = th;
+  if (th > new_h) new_h = th;
+  int dh = new_h - old_h;
+  full_height_ += dh;				// do this *always*
+
+  bl->icon = icon;				// set new icon
+  if (dh>0) {
+    redraw();					// icon larger than item? must redraw widget
+  } else {
+    redraw_line(bl);				// icon same or smaller? can redraw just this line
+  }
+  replacing(bl,bl);				// recalc fltk3::Browser_::max_width et al
+}
+
+/**
+  Returns the icon currently defined for \p line.
+  If no icon is defined, NULL is returned.
+  \param[in] line The line whose icon is returned.
+  \returns The icon defined, or NULL if none.
+*/
+fltk3::Image* fltk3::Browser::icon(int line) const {
+  fltk3::BrowserLine_* l = find_line(line);
+  return(l ? l->icon : NULL);
+}
+
+/**
+  Removes the icon for \p line.
+  It's ok to remove an icon if none has been defined.
+  \param[in] line The line whose icon is to be removed.
+*/
+void fltk3::Browser::remove_icon(int line) { 
+  icon(line,0);
+}
+
+/*
+ The following constructors must not be in the header file(s) if we
+ build a shared object (DLL). Instead they are defined here to force
+ the constructor (and default destructor as well) to be defined in
+ the DLL and exported (STR #2632, #2645).
+ 
+ Note: if you change any of them, do the same changes in the specific
+ header file as well.  This redundant definition was chosen to enable
+ inline constructors in the header files (for static linking) as well
+ as those here for dynamic linking (Windows DLL).
+ */
+#if defined(FL_DLL)
+
+fltk3::HoldBrowser::HoldBrowser(int X,int Y,int W,int H,const char *L)
+: fltk3::Browser(X,Y,W,H,L) {type(fltk3::HOLD_BROWSER);}
+
+fltk3::MultiBrowser::MultiBrowser(int X,int Y,int W,int H,const char *L)
+: fltk3::Browser(X,Y,W,H,L) {type(fltk3::MULTI_BROWSER);}
+
+fltk3::SelectBrowser::SelectBrowser(int X,int Y,int W,int H,const char *L)
+: fltk3::Browser(X,Y,W,H,L) {type(fltk3::SELECT_BROWSER);}
+
+#endif // FL_DLL
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Browser_.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Browser_.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Browser_.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Browser_.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1167 @@
+//
+// "$Id$"
+//
+// Base Browser widget class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#define DISPLAY_SEARCH_BOTH_WAYS_AT_ONCE
+
+#include <stdio.h>
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/Browser_.h>
+#include <fltk3/draw.h>
+#include <fltk3/Wrapper.h>
+
+
+// This is the base class for browsers.  To be useful it must be
+// subclassed and several virtual functions defined.  The
+// Forms-compatible browser and the file chooser's browser are
+// subclassed off of this.
+
+// Yes, I know this should be a template...
+
+// This has been designed so that the subclass has complete control
+// over the storage of the data, although because next() and prev()
+// functions are used to index, it works best as a linked list or as a
+// large block of characters in which the line breaks must be searched
+// for.
+
+// A great deal of work has been done so that the "height" of a data
+// object does not need to be determined until it is drawn.  This was
+// done for the file chooser, because the height requires doing stat()
+// to see if the file is a directory, which can be annoyingly slow
+// over the network.
+
+/* redraw bits:
+ 1 = redraw children (the scrollbar)
+ 2 = redraw one or two items
+ 4 = redraw all items
+ */
+
+static void scrollbar_callback(fltk3::Widget* s, void*) {
+  ((fltk3::Browser_*)(s->parent()))->position(int(((fltk3::Scrollbar*)s)->value()));
+}
+
+static void hscrollbar_callback(fltk3::Widget* s, void*) {
+  ((fltk3::Browser_*)(s->parent()))->hposition(int(((fltk3::Scrollbar*)s)->value()));
+}
+
+// return where to draw the actual box:
+/**
+ Returns the bounding box for the interior of the list's display window, inside
+ the scrollbars.
+ \param[out] X,Y,W,H The returned bounding box.\n
+ (The original contents of these parameters are overwritten)
+ */
+void fltk3::Browser_::bbox(int& X, int& Y, int& W, int& H) const {
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  fltk3::Boxtype b = box() ? box() : fltk3::DOWN_BOX;
+  X = x()+fltk3::box_dx(b);
+  Y = y()+fltk3::box_dy(b);
+  W = w()-fltk3::box_dw(b);
+  H = h()-fltk3::box_dh(b);
+  if (scrollbar.visible()) {
+    W -= scrollsize;
+    if (scrollbar.align() & fltk3::ALIGN_LEFT) X += scrollsize;
+  }
+  if (W < 0) W = 0;
+  if (hscrollbar.visible()) {
+    H -= scrollsize;
+    if (scrollbar.align() & fltk3::ALIGN_TOP) Y += scrollsize;
+  }
+  if (H < 0) H = 0;
+}
+
+/**
+ This method returns the X position of the left edge of the list area
+ after adjusting for the scrollbar and border, if any.
+ \returns The X position of the left edge of the list, in pixels.
+ \see fltk3::Browser_::bbox()
+ */
+int fltk3::Browser_::leftedge() const {
+  int X, Y, W, H; bbox(X, Y, W, H);
+  return X;
+}
+
+// The scrollbars may be moved again by draw(), since each one's size
+// depends on whether the other is visible or not.  This skips over
+// fltk3::Group::resize since it moves the scrollbars uselessly.
+/**
+ Repositions and/or resizes the browser.
+ \param[in] X,Y,W,H The new position and size for the browser, in pixels.
+ */
+void fltk3::Browser_::resize(int X, int Y, int W, int H) {
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  Widget::resize(X, Y, W, H);
+  // move the scrollbars so they can respond to events:
+  bbox(X,Y,W,H);
+  scrollbar.resize(
+                   scrollbar.align()&fltk3::ALIGN_LEFT ? X-scrollsize : X+W,
+                   Y, scrollsize, H);
+  hscrollbar.resize(
+                    X, scrollbar.align()&fltk3::ALIGN_TOP ? Y-scrollsize : Y+H,
+                    W, scrollsize);
+}
+
+// Cause minimal update to redraw the given item:
+/**
+ This method should be called when the contents of \p item has changed,
+ but not its height.
+ \param[in] item The item that needs to be redrawn.
+ \see redraw_lines(), redraw_line()
+ */
+void fltk3::Browser_::redraw_line(void* item) {
+  if (!redraw1 || redraw1 == item) {redraw1 = item; damage(fltk3::DAMAGE_EXPOSE);}
+  else if (!redraw2 || redraw2 == item) {redraw2 = item; damage(fltk3::DAMAGE_EXPOSE);}
+  else damage(fltk3::DAMAGE_SCROLL);
+}
+
+// Figure out top() based on position():
+void fltk3::Browser_::update_top() {
+  if (!top_) top_ = item_first();
+  if (position_ != real_position_) {
+    void* l;
+    int ly;
+    int yy = position_;
+    // start from either head or current position, whichever is closer:
+    if (!top_ || yy <= (real_position_/2)) {
+      l = item_first();
+      ly = 0;
+    } else {
+      l = top_;
+      ly = real_position_-offset_;
+    }
+    if (!l) {
+      top_ = 0;
+      offset_ = 0;
+      real_position_ = 0;
+    } else {
+      int hh = item_quick_height(l);
+      // step through list until we find line containing this point:
+      while (ly > yy) {
+	void* l1 = item_prev(l);
+	if (!l1) {ly = 0; break;} // hit the top
+	l  = l1;
+	hh = item_quick_height(l);
+	ly -= hh;
+      }
+      while ((ly+hh) <= yy) {
+	void* l1 = item_next(l);
+	if (!l1) {yy = ly+hh-1; break;}
+	l = l1;
+	ly += hh;
+	hh = item_quick_height(l);
+      }
+      // top item must *really* be visible, use slow height:
+      for (;;) {
+	hh = item_height(l);
+	if ((ly+hh) > yy) break; // it is big enough to see
+                                 // go up to top of previous item:
+	void* l1 = item_prev(l);
+	if (!l1) {ly = yy = 0; break;} // hit the top
+	l = l1; yy = position_ = ly = ly-item_quick_height(l);
+      }
+      // use it:
+      top_ = l;
+      offset_ = yy-ly;
+      real_position_ = yy;
+    }
+    damage(fltk3::DAMAGE_SCROLL);
+  }
+}
+
+// Change position(), top() will update when update_top() is called
+// (probably by draw() or handle()):
+/**
+ Sets the vertical scroll position of the list to pixel position \p pos.
+ The position is how many pixels of the list are scrolled off the top edge
+ of the screen. Example: A position of '3' scrolls the top three pixels of
+ the list off the top edge of the screen.
+ \param[in] pos The vertical position (in pixels) to scroll the browser to.
+ \see position(), hposition()
+ */
+void fltk3::Browser_::position(int pos) {
+  if (pos < 0) pos = 0;
+  if (pos == position_) return;
+  position_ = pos;
+  if (pos != real_position_) redraw_lines();
+}
+
+/**
+ Sets the horizontal scroll position of the list to pixel position \p pos.
+ The position is how many pixels of the list are scrolled off the left edge
+ of the screen. Example: A position of '18' scrolls the left 18 pixels of the list
+ off the left edge of the screen.
+ \param[in] pos The horizontal position (in pixels) to scroll the browser to.
+ \see position(), hposition()
+ */
+void fltk3::Browser_::hposition(int pos) {
+  if (pos < 0) pos = 0;
+  if (pos == hposition_) return;
+  hposition_ = pos;
+  if (pos != real_hposition_) redraw_lines();
+}
+
+// Tell whether item is currently displayed:
+/**
+ Returns non-zero if \p item has been scrolled to a position where it is being displayed.
+ Checks to see if the item's vertical position is within the top and bottom
+ edges of the display window. This does NOT take into account the hide()/show()
+ status of the widget or item.
+ \param[in] item The item to check
+ \returns 1 if visible, 0 if not visible.
+ \see display(), displayed()
+ */
+int fltk3::Browser_::displayed(void* item) const {
+  int X, Y, W, H; bbox(X, Y, W, H);
+  int yy = H+offset_;
+  for (void* l = top_; l && yy > 0; l = item_next(l)) {
+    if (l == item) return 1;
+    yy -= item_height(l);
+  }
+  return 0;
+}
+
+// Ensure this item is displayed:
+// Messy because we have no idea if it is before top or after bottom:
+/**
+ Displays the \p item, scrolling the list as necessary.
+ \param[in] item The item to be displayed.
+ \see display(), displayed()
+ */
+void fltk3::Browser_::display(void* item) {
+  
+  // First special case - want to display first item in the list?
+  update_top();
+  if (item == item_first()) {position(0); return;}
+  
+  int X, Y, W, H, Yp; bbox(X, Y, W, H);
+  void* l = top_;
+  Y = Yp = -offset_;
+  int h1;
+  
+  // 2nd special case - want to display item already displayed at top of browser?
+  if (l == item) {position(real_position_+Y); return;} // scroll up a bit
+  
+  // 3rd special case - want to display item just above top of browser?
+  void* lp = item_prev(l);
+  if (lp == item) {position(real_position_+Y-item_quick_height(lp)); return;}
+  
+#ifdef DISPLAY_SEARCH_BOTH_WAYS_AT_ONCE
+  // search for item.  We search both up and down the list at the same time,
+  // this evens up the execution time for the two cases - the old way was
+  // much slower for going up than for going down.
+  while (l || lp) {
+    if (l) {
+      h1 = item_quick_height(l);
+      if (l == item) {
+	if (Y <= H) { // it is visible or right at bottom
+	  Y = Y+h1-H; // find where bottom edge is
+	  if (Y > 0) position(real_position_+Y); // scroll down a bit
+	} else {
+	  position(real_position_+Y-(H-h1)/2); // center it
+	}
+	return;
+      }
+      Y += h1;
+      l = item_next(l);
+    }
+    if (lp) {
+      h1 = item_quick_height(lp);
+      Yp -= h1;
+      if (lp == item) {
+	if ((Yp + h1) >= 0) position(real_position_+Yp);
+	else position(real_position_+Yp-(H-h1)/2);
+	return;
+      }
+      lp = item_prev(lp);
+    }
+  }
+#else
+  // Old version went forwards and then backwards:
+  // search forward for it:
+  l = top_;
+  for (; l; l = item_next(l)) {
+    h1 = item_quick_height(l);
+    if (l == item) {
+      if (Y <= H) { // it is visible or right at bottom
+	Y = Y+h1-H; // find where bottom edge is
+	if (Y > 0) position(real_position_+Y); // scroll down a bit
+      } else {
+	position(real_position_+Y-(H-h1)/2); // center it
+      }
+      return;
+    }
+    Y += h1;
+  }
+  // search backward for it, if found center it:
+  l = lp;
+  Y = -offset_;
+  for (; l; l = item_prev(l)) {
+    h1 = item_quick_height(l);
+    Y -= h1;
+    if (l == item) {
+      if ((Y + h1) >= 0) position(real_position_+Y);
+      else position(real_position_+Y-(H-h1)/2);
+      return;
+    }
+  }
+#endif
+}
+
+// redraw, has side effect of updating top and setting scrollbar:
+/**
+ Draws the list within the normal widget bounding box.
+ */
+void fltk3::Browser_::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int drawsquare = 0;
+  update_top();
+  int full_width_ = full_width();
+  int full_height_ = full_height();
+  int X, Y, W, H; bbox(X, Y, W, H);
+  int dont_repeat = 0;
+J1:
+  if (damage() & fltk3::DAMAGE_ALL) { // redraw the box if full redraw
+    fltk3::Boxtype b = box() ? box() : fltk3::DOWN_BOX;
+    draw_box(b, x(), y(), w(), h(), color());
+    drawsquare = 1;
+  }
+  // see if scrollbar needs to be switched on/off:
+  if ((has_scrollbar_ & VERTICAL) && (
+                                      (has_scrollbar_ & ALWAYS_ON) || position_ || full_height_ > H)) {
+    if (!scrollbar.visible()) {
+      scrollbar.set_visible();
+      drawsquare = 1;
+      bbox(X, Y, W, H);
+    }
+  } else {
+    top_ = item_first(); real_position_ = offset_ = 0;
+    if (scrollbar.visible()) {
+      scrollbar.clear_visible();
+      clear_damage((uchar)(damage()|fltk3::DAMAGE_SCROLL));
+    }
+  }
+  
+  if ((has_scrollbar_ & HORIZONTAL) && (
+                                        (has_scrollbar_ & ALWAYS_ON) || hposition_ || full_width_ > W)) {
+    if (!hscrollbar.visible()) {
+      hscrollbar.set_visible();
+      drawsquare = 1;
+      bbox(X, Y, W, H);
+    }
+  } else {
+    real_hposition_ = 0;
+    if (hscrollbar.visible()) {
+      hscrollbar.clear_visible();
+      clear_damage((uchar)(damage()|fltk3::DAMAGE_SCROLL));
+    }
+  }
+  
+  // Check the vertical scrollbar again, just in case it needs to be drawn
+  // because the horizontal one is drawn.  There should be a cleaner way
+  // to do this besides copying the same code...
+  if ((has_scrollbar_ & VERTICAL) && (
+                                      (has_scrollbar_ & ALWAYS_ON) || position_ || full_height_ > H)) {
+    if (!scrollbar.visible()) {
+      scrollbar.set_visible();
+      drawsquare = 1;
+      bbox(X, Y, W, H);
+    }
+  } else {
+    top_ = item_first(); real_position_ = offset_ = 0;
+    if (scrollbar.visible()) {
+      scrollbar.clear_visible();
+      clear_damage((uchar)(damage()|fltk3::DAMAGE_SCROLL));
+    }
+  }
+  
+  bbox(X, Y, W, H);
+  
+  fltk3::push_clip(X, Y, W, H);
+  // for each line, draw it if full redraw or scrolled.  Erase background
+  // if not a full redraw or if it is selected:
+  void* l = top();
+  int yy = -offset_;
+  for (; l && yy < H; l = item_next(l)) {
+    int hh = item_height(l);
+    if (hh <= 0) continue;
+    if ((damage()&(fltk3::DAMAGE_SCROLL|fltk3::DAMAGE_ALL)) || l == redraw1 || l == redraw2) {
+      if (item_selected(l)) {
+	fltk3::color(active_r() ? selection_color() : fltk3::inactive(selection_color()));
+	fltk3::rectf(X, yy+Y, W, hh);
+      } else if (!(damage()&fltk3::DAMAGE_ALL)) {
+	fltk3::push_clip(X, yy+Y, W, hh);
+	draw_box(box() ? box() : fltk3::DOWN_BOX, x(), y(), w(), h(), color());
+	fltk3::pop_clip();
+      }
+      item_draw(l, X-hposition_, yy+Y, W+hposition_, hh);
+      if (l == selection_ && fltk3::focus() == this) {
+	draw_box(fltk3::BORDER_FRAME, X, yy+Y, W, hh, color());
+	draw_focus(fltk3::NO_BOX, X, yy+Y, W+1, hh+1);
+      }
+      int ww = item_width(l);
+      if (ww > max_width) {max_width = ww; max_width_item = l;}
+    }
+    yy += hh;
+  }
+  // erase the area below last line:
+  if (!(damage()&fltk3::DAMAGE_ALL) && yy < H) {
+    fltk3::push_clip(X, yy+Y, W, H-yy);
+    draw_box(box() ? box() : fltk3::DOWN_BOX, x(), y(), w(), h(), color());
+    fltk3::pop_clip();
+  }
+  fltk3::pop_clip();
+  redraw1 = redraw2 = 0;
+  
+  if (!dont_repeat) {
+    dont_repeat = 1;
+    // see if changes to full_height caused by calls to slow_height
+    // caused scrollbar state to change, in which case we have to redraw:
+    full_height_ = full_height();
+    full_width_ = full_width();
+    if ((has_scrollbar_ & VERTICAL) &&
+	((has_scrollbar_ & ALWAYS_ON) || position_ || full_height_>H)) {
+      if (!scrollbar.visible()) { damage(fltk3::DAMAGE_ALL); goto J1; }
+    } else {
+      if (scrollbar.visible()) { damage(fltk3::DAMAGE_ALL); goto J1; }
+    }
+    if ((has_scrollbar_ & HORIZONTAL) &&
+	((has_scrollbar_ & ALWAYS_ON) || hposition_ || full_width_>W)) {
+      if (!hscrollbar.visible()) { damage(fltk3::DAMAGE_ALL); goto J1; }
+    } else {
+      if (hscrollbar.visible()) { damage(fltk3::DAMAGE_ALL); goto J1; }
+    }
+  }
+  
+  // update the scrollbars and redraw them:
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  int dy = top_ ? item_quick_height(top_) : 0; if (dy < 10) dy = 10;
+  if (scrollbar.visible()) {
+    scrollbar.damage_resize(
+                            scrollbar.align()&fltk3::ALIGN_LEFT ? X-scrollsize : X+W,
+                            Y, scrollsize, H);
+    scrollbar.value(position_, H, 0, full_height_);
+    scrollbar.linesize(dy);
+    if (drawsquare) draw_child(scrollbar);
+    else update_child(scrollbar);
+  }
+  if (hscrollbar.visible()) {
+    hscrollbar.damage_resize(
+                             X, scrollbar.align()&fltk3::ALIGN_TOP ? Y-scrollsize : Y+H,
+                             W, scrollsize);
+    hscrollbar.value(hposition_, W, 0, full_width_);
+    hscrollbar.linesize(dy);
+    if (drawsquare) draw_child(hscrollbar);
+    else update_child(hscrollbar);
+  }
+  
+  // draw that little square between the scrollbars:
+  if (drawsquare && scrollbar.visible() && hscrollbar.visible()) {
+    fltk3::color(parent()->color());
+    fltk3::rectf(scrollbar.x(), hscrollbar.y(), scrollsize, scrollsize);
+  }
+  
+  real_hposition_ = hposition_;
+}
+
+// Quick way to delete and reset everything:
+/**
+ This method should be called when the list data is completely replaced
+ or cleared. It informs the fltk3::Browser_ widget that any cached
+ information it has concerning the items is invalid.
+ This method does not clear the list, it just handles the follow up
+ bookkeeping after the list has been cleared.
+ */
+void fltk3::Browser_::new_list() {
+  top_ = 0;
+  position_ = real_position_ = 0;
+  hposition_ = real_hposition_ = 0;
+  selection_ = 0;
+  offset_ = 0;
+  max_width = 0;
+  max_width_item = 0;
+  redraw_lines();
+}
+
+// Tell it that this item is going away, and that this must remove
+// all pointers to it:
+/**
+ This method should be used when \p item is being deleted from the list.
+ It allows the fltk3::Browser_ to discard any cached data it has on the item.
+ This method does not actually delete the item, but handles the follow up
+ bookkeeping after the item has just been deleted.
+ \param[in] item The item being deleted.
+ */
+void fltk3::Browser_::deleting(void* item) {
+  if (displayed(item)) {
+    redraw_lines();
+    if (item == top_) {
+      real_position_ -= offset_;
+      offset_ = 0;
+      top_ = item_next(item);
+      if (!top_) top_ = item_prev(item);
+    }
+  } else {
+    // we don't know where this item is, recalculate top...
+    real_position_ = 0;
+    offset_ = 0;
+    top_ = 0;
+  }
+  if (item == selection_) selection_ = 0;
+  if (item == max_width_item) {max_width_item = 0; max_width = 0;}
+}
+
+/**
+ This method should be used when item \p a is being replaced by item \p b.
+ It allows the fltk3::Browser_ to update its cache data as needed,
+ schedules a redraw for the item being changed, and tries to maintain the selection.
+ This method does not actually replace the item, but handles the follow up
+ bookkeeping after the item has just been replaced.
+ \param[in] a Item being replaced
+ \param[in] b Item to replace 'a'
+ */
+void fltk3::Browser_::replacing(void* a, void* b) {
+  redraw_line(a);
+  if (a == selection_) selection_ = b;
+  if (a == top_) top_ = b;
+  if (a == max_width_item) {max_width_item = 0; max_width = 0;}
+}
+
+/**
+ This method should be used when two items \p a and \p b are being swapped.
+ It allows the fltk3::Browser_ to update its cache data as needed,
+ schedules a redraw for the two items, and tries to maintain the current selection.
+ This method does not actually swap items, but handles the follow up
+ bookkeeping after items have been swapped.
+ \param[in] a,b Items being swapped.
+ */
+void fltk3::Browser_::swapping(void* a, void* b) {
+  redraw_line(a);
+  redraw_line(b);
+  if (a == selection_) selection_ = b;
+  else if (b == selection_) selection_ = a;
+  if (a == top_) top_ = b;
+  else if (b == top_) top_ = a;
+}
+
+/**
+ This method should be used when an item is in the process of
+ being inserted into the list.
+ It allows the fltk3::Browser_ to update its cache data as needed,
+ scheduling a redraw for the affected lines.
+ This method does not actually insert items, but handles the 
+ follow up bookkeeping after items have been inserted.
+ \param[in] a The starting item position
+ \param[in] b The new item being inserted
+ */
+void fltk3::Browser_::inserting(void* a, void* b) {
+  if (displayed(a)) redraw_lines();
+  if (a == top_) top_ = b;
+}
+
+/**
+ This method returns the item under mouse y position \p ypos.
+ NULL is returned if no item is displayed at that position.
+ \param[in] ypos The y position (eg. fltk3::event_y()) to find an item under.
+ \returns The item, or NULL if not found
+ */
+void* fltk3::Browser_::find_item(int ypos) {
+  update_top();
+  int X, Y, W, H; bbox(X, Y, W, H);
+  int yy = Y-offset_;
+  for (void *l = top_; l; l = item_next(l)) {
+    int hh = item_height(l); if (hh <= 0) continue;
+    yy += hh;
+    if (ypos <= yy || yy>=(Y+H)) return l;
+  }
+  return 0;
+}
+
+/**
+ Sets the selection state of \p item to \p val,
+ and returns 1 if the state changed or 0 if it did not.
+ 
+ If \p docallbacks is non-zero, select tries to call
+ the callback function for the widget.
+ 
+ \param[in] item The item whose selection state is to be changed
+ \param[in] val The new selection state (1=select, 0=de-select)
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+ \returns 1 if state was changed, 0 if not.
+ */
+int fltk3::Browser_::select(void* item, int val, int docallbacks) {
+  if (type() == fltk3::MULTI_BROWSER) {
+    if (selection_ != item) {
+      if (selection_) redraw_line(selection_);
+      selection_ = item;
+      redraw_line(item);
+    }
+    if ((!val)==(!item_selected(item))) return 0;
+    item_select(item, val);
+    redraw_line(item);
+  } else {
+    if (val && selection_ == item) return 0;
+    if (!val && selection_ != item) return 0;
+    if (selection_) {
+      item_select(selection_, 0);
+      redraw_line(selection_);
+      selection_ = 0;
+    }
+    if (val) {
+      item_select(item, 1);
+      selection_ = item;
+      redraw_line(item);
+      display(item);
+    }
+  }	    
+  if (docallbacks) {
+    set_changed();
+    do_callback();
+  }
+  return 1;
+}
+
+/**
+ Deselects all items in the list and returns 1 if the state changed
+ or 0 if it did not.
+ 
+ If the optional \p docallbacks parameter is non-zero, deselect tries
+ to call the callback function for the widget.
+ 
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+ */
+int fltk3::Browser_::deselect(int docallbacks) {
+  if (type() == fltk3::MULTI_BROWSER) {
+    int change = 0;
+    for (void* p = item_first(); p; p = item_next(p))
+      change |= select(p, 0, docallbacks);
+    return change;
+  } else {
+    if (!selection_) return 0;
+    item_select(selection_, 0);
+    redraw_line(selection_);
+    selection_ = 0;
+    return 1;
+  }
+}
+
+/**
+ Selects \p item and returns 1 if the state changed or 0 if it did not.
+ Any other items in the list are deselected.
+ \param[in] item The \p item to select.
+ \param[in] docallbacks If 1, invokes widget callback if item changed.\n
+ If 0, doesn't do callback (default).
+ */
+int fltk3::Browser_::select_only(void* item, int docallbacks) {
+  if (!item) return deselect(docallbacks);
+  int change = 0;
+  fltk3::WidgetTracker wp(this);
+  if (type() == fltk3::MULTI_BROWSER) {
+    for (void* p = item_first(); p; p = item_next(p)) {
+      if (p != item) change |= select(p, 0, docallbacks);
+      if (wp.deleted()) return change;
+    }
+  }
+  change |= select(item, 1, docallbacks);
+  if (wp.deleted()) return change;
+  display(item);
+  return change;
+}
+
+/**
+ Handles the \p event within the normal widget bounding box.
+ \param[in] event The event to process.
+ \returns 1 if event was processed, 0 if not.
+ */
+int fltk3::Browser_::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  
+  // NOTE:
+  // We use fltk3::WidgetTracker to test if the user has deleted
+  // this widget in a callback. Callbacks can be called by:
+  //  - do_callback()
+  //  - select()
+  //  - select_only()
+  //  - deselect()
+  // Thus we must test wp.deleted() after each of these calls,
+  // unless we return directly after one of these.
+  // If wp.deleted() is true, we return 1 because we used the event.
+  
+  fltk3::WidgetTracker wp(this);
+  
+  // must do shortcuts first or the scrollbar will get them...
+  if (event == fltk3::ENTER || event == fltk3::LEAVE) return 1;
+  if (event == fltk3::KEYBOARD && type() >= fltk3::HOLD_BROWSER) {
+    void* l1 = selection_;
+    void* l = l1; if (!l) l = top_; if (!l) l = item_first();
+    if (l) {
+      if (type()==fltk3::HOLD_BROWSER) {
+        switch (fltk3::event_key()) {
+          case fltk3::DownKey:
+            while ((l = item_next(l)))
+              if (item_height(l)>0) {select_only(l, when()); break;}
+            return 1;
+          case fltk3::UpKey:
+            while ((l = item_prev(l))) {
+              if (item_height(l)>0) {
+                select_only(l, when());
+                break; // no need to test wp (return 1)
+              }
+            }
+            return 1;
+        } 
+      } else  {
+        switch (fltk3::event_key()) {
+          case fltk3::EnterKey:
+          case fltk3::KPEnterKey:
+            select_only(l, when() & ~fltk3::WHEN_ENTER_KEY);
+            if (wp.deleted()) return 1;
+            if (when() & fltk3::WHEN_ENTER_KEY) {
+              set_changed();
+              do_callback();
+            }
+            return 1;
+          case ' ':
+            selection_ = l;
+            select(l, !item_selected(l), when() & ~fltk3::WHEN_ENTER_KEY);
+            return 1;
+          case fltk3::DownKey:
+            while ((l = item_next(l))) {
+              if (fltk3::event_state(fltk3::SHIFT|fltk3::CTRL))
+                select(l, l1 ? item_selected(l1) : 1, when());
+              if (wp.deleted()) return 1;
+              if (item_height(l)>0) goto J1;
+            }
+            return 1;
+          case fltk3::UpKey:
+            while ((l = item_prev(l))) {
+              if (fltk3::event_state(fltk3::SHIFT|fltk3::CTRL))
+                select(l, l1 ? item_selected(l1) : 1, when());
+              if (wp.deleted()) return 1;
+              if (item_height(l)>0) goto J1;
+            }
+            return 1;
+          J1:
+            if (selection_) redraw_line(selection_);
+            selection_ = l; redraw_line(l);
+            display(l);
+            return 1;
+        }
+      }
+    }
+  }
+  
+  if (Group::handle(event)) return 1;
+  if (wp.deleted()) return 1;
+  
+  int X, Y, W, H; bbox(X, Y, W, H);
+  int my;
+  // NOTE:
+  // instead of:
+  //     change = select_only(find_item(my), when() & fltk3::WHEN_CHANGED)
+  // we use the construct:
+  //     change = select_only(find_item(my), 0);
+  //     if (change && (when() & fltk3::WHEN_CHANGED)) {
+  //	 set_changed();
+  //       do_callback();
+  //     }
+  // See str #834
+  // The first form calls the callback *before* setting change.
+  // The callback may execute an fltk3::wait(), resulting in another
+  // call of fltk3::Browser_::handle() for the same widget. The sequence
+  // of events can be an fltk3::PUSH followed by an fltk3::RELEASE.
+  // This second call of fltk3::Browser_::handle() may result in a -
+  // somewhat unexpected - second concurrent invocation of the callback.
+  
+  static char change;
+  static char whichway;
+  static int py;
+  switch (event) {
+    case fltk3::PUSH:
+      if (!fltk3::event_inside(X, Y, W, H)) return 0;
+      if (fltk3::visible_focus()) {
+        fltk3::focus(this);
+        redraw();
+      }
+      my = py = fltk3::event_y();
+      change = 0;
+      if (type() == fltk3::NORMAL_BROWSER || !top_)
+        ;
+      else if (type() != fltk3::MULTI_BROWSER) {
+        change = select_only(find_item(my), 0);
+        if (wp.deleted()) return 1;
+        if (change && (when() & fltk3::WHEN_CHANGED)) {
+          set_changed();
+          do_callback();
+          if (wp.deleted()) return 1;
+        }
+      } else {
+        void* l = find_item(my);
+        whichway = 1;
+        if (fltk3::event_state(fltk3::CTRL)) { // toggle selection:
+        TOGGLE:
+          if (l) {
+            whichway = !item_selected(l);
+            change = select(l, whichway, 0);
+            if (wp.deleted()) return 1;
+            if (change && (when() & fltk3::WHEN_CHANGED)) {
+              set_changed();
+              do_callback();
+              if (wp.deleted()) return 1;
+            }
+          }
+        } else if (fltk3::event_state(fltk3::SHIFT)) { // extend selection:
+          if (l == selection_) goto TOGGLE;
+          // state of previous selection determines new value:
+          whichway = l ? !item_selected(l) : 1;
+          // see which of the new item or previous selection is earlier,
+          // by searching from the previous forward for this one:
+          int down;
+          if (!l) down = 1;
+          else {for (void* m = selection_; ; m = item_next(m)) {
+            if (m == l) {down = 1; break;}
+            if (!m) {down = 0; break;}
+          }}
+          if (down) {
+            for (void* m = selection_; m != l; m = item_next(m)) {
+              select(m, whichway, when() & fltk3::WHEN_CHANGED);
+              if (wp.deleted()) return 1;
+            }
+          } else {
+            void* e = selection_;
+            for (void* m = item_next(l); m; m = item_next(m)) {
+              select(m, whichway, when() & fltk3::WHEN_CHANGED);
+              if (wp.deleted()) return 1;
+              if (m == e) break;
+            }
+          }
+          // do the clicked item last so the select box is around it:
+          change = 1;
+          if (l) select(l, whichway, when() & fltk3::WHEN_CHANGED);
+          if (wp.deleted()) return 1;
+        } else { // select only this item
+          change = select_only(l, 0);
+          if (wp.deleted()) return 1;
+          if (change && (when() & fltk3::WHEN_CHANGED)) {
+            set_changed();
+            do_callback();
+            if (wp.deleted()) return 1;
+          }
+        }
+      }
+      return 1;
+    case fltk3::DRAG:
+      // do the scrolling first:
+      my = fltk3::event_y();
+      if (my < Y && my < py) {
+        int p = real_position_+my-Y;
+        if (p<0) p = 0;
+        position(p);
+      } else if (my > (Y+H) && my > py) {
+        int p = real_position_+my-(Y+H);
+        int hh = full_height()-H; if (p > hh) p = hh;
+        if (p<0) p = 0;
+        position(p);
+      }
+      if (type() == fltk3::NORMAL_BROWSER || !top_)
+        ;
+      else if (type() == fltk3::MULTI_BROWSER) {
+        void* l = find_item(my);
+        void* t; void* b; // this will be the range to change
+        if (my > py) { // go down
+          t = selection_ ? item_next(selection_) : 0;
+          b = l ? item_next(l) : 0;
+        } else {	// go up
+          t = l;
+          b = selection_;
+        }
+        for (; t && t != b; t = item_next(t)) {
+          char change_t;
+          change_t = select(t, whichway, 0);
+          if (wp.deleted()) return 1;
+          change |= change_t;
+          if (change_t && (when() & fltk3::WHEN_CHANGED)) {
+            set_changed();
+            do_callback();
+            if (wp.deleted()) return 1;
+          }
+        }
+        if (l) selection_ = l;
+      } else {
+        void* l1 = selection_;
+        void* l =
+	(fltk3::event_x()<x() || fltk3::event_x()>x()+w()) ? selection_ :
+	find_item(my);
+        change = (l != l1);
+        select_only(l, when() & fltk3::WHEN_CHANGED);
+        if (wp.deleted()) return 1;
+      }
+      py = my;
+      return 1;
+    case fltk3::RELEASE:
+      if (type() == fltk3::SELECT_BROWSER) {
+        void* t = selection_;
+        deselect();
+        if (wp.deleted()) return 1;
+        selection_ = t;
+      }
+      if (change) {
+        set_changed();
+        if (when() & fltk3::WHEN_RELEASE) do_callback();
+      } else {
+        if (when() & fltk3::WHEN_NOT_CHANGED) do_callback();
+      }
+      if (wp.deleted()) return 1;
+      
+      // double click calls the callback: (like Enter Key)
+      if (fltk3::event_clicks() && (when() & fltk3::WHEN_ENTER_KEY)) {
+        set_changed();
+        do_callback();
+      }
+      return 1;
+    case fltk3::FOCUS:
+    case fltk3::UNFOCUS:
+      if (type() >= fltk3::HOLD_BROWSER && fltk3::visible_focus()) {
+        redraw();
+        return 1;
+      } else return 0;
+  }
+  
+  return 0;
+}
+
+/**
+ The constructor makes an empty browser.
+ \param[in] X,Y,W,H position and size.
+ \param[in] L The label string, may be NULL.
+ */
+fltk3::Browser_::Browser_(int X, int Y, int W, int H, const char* L)
+: fltk3::Group(X, Y, W, H, L),
+scrollbar(0, 0, 0, 0, 0), // they will be resized by draw()
+hscrollbar(0, 0, 0, 0, 0)
+{
+  box(fltk3::NO_BOX);
+  align(fltk3::ALIGN_BOTTOM);
+  position_ = real_position_ = 0;
+  hposition_ = real_hposition_ = 0;
+  offset_ = 0;
+  top_ = 0;
+  when(fltk3::WHEN_RELEASE_ALWAYS);
+  selection_ = 0;
+  color(fltk3::BACKGROUND2_COLOR, fltk3::SELECTION_COLOR);
+  scrollbar.callback(scrollbar_callback);
+  //scrollbar.align(fltk3::ALIGN_LEFT|fltk3::ALIGN_BOTTOM); // back compatibility?
+  hscrollbar.callback(hscrollbar_callback);
+  hscrollbar.type(fltk3::HORIZONTAL);
+  textfont(fltk3::HELVETICA);
+  textsize(fltk3::NORMAL_SIZE);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  has_scrollbar_ = BOTH;
+  max_width = 0;
+  max_width_item = 0;
+  scrollbar_size_ = 0;
+  redraw1 = redraw2 = 0;
+  end();
+}
+
+/**
+ Sort the items in the browser based on \p flags.
+ item_swap(void*, void*) and item_text(void*) must be implemented for this call.
+ \param[in] flags fltk3::SORT_ASCENDING -- sort in ascending order\n
+ fltk3::SORT_DESCENDING -- sort in descending order\n
+ Values other than the above will cause undefined behavior\n
+ Other flags may appear in the future.
+ \todo Add a flag to ignore case
+ */
+void fltk3::Browser_::sort(int flags) {
+  //
+  // Simple bubble sort - pure lazyness on my side.
+  //
+  int i, j, n = -1, desc = ((flags&fltk3::SORT_DESCENDING)==fltk3::SORT_DESCENDING);
+  void *a =item_first(), *b, *c;
+  if (!a) return;
+  while (a) {
+    a = item_next(a);
+    n++;
+  }
+  for (i=n; i>0; i--) {
+    char swapped = 0;
+    a = item_first();
+    b = item_next(a);
+    for (j=0; j<i; j++) {
+      const char *ta = item_text(a);
+      const char *tb = item_text(b);
+      c = item_next(b);
+      if (desc) {
+        if (strcmp(ta, tb)<0) {
+          item_swap(a, b);
+          swapped = 1;
+        }
+      } else {
+        if (strcmp(ta, tb)>0) {
+          item_swap(a, b);
+          swapped = 1;
+        }
+      }
+      if (!c) break;
+      b = c; a = item_prev(b);
+    }
+    if (!swapped)
+      break;
+  }
+}
+
+// Default versions of some of the virtual functions:
+
+/**
+ This method may be provided by the subclass to return the height of the
+ \p item, in pixels.  
+ Allow for two additional pixels for the list selection box.
+ This method differs from item_height in that it is only called for 
+ selection and scrolling operations. 
+ The default implementation calls item_height.
+ \param[in] item The item whose height to return.
+ \returns The height, in pixels.
+ */
+int fltk3::Browser_::item_quick_height(void* item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_quick_height(item), BrowserItemQuickHeight)
+  return item_height(item);
+}
+
+/**
+ This method may be provided to return the average height of all items
+ to be used for scrolling. 
+ The default implementation uses the height of the first item.
+ \returns The average height of items, in pixels.
+ */
+int fltk3::Browser_::incr_height() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, incr_height(), BrowserIncrHeight)
+  return item_quick_height(item_first());
+}
+
+/**
+ This method may be provided by the subclass to indicate the full height
+ of the item list, in pixels. 
+ The default implementation computes the full height from the item heights. 
+ Includes the items that are scrolled off screen.
+ \returns The height of the entire list, in pixels.
+ */
+int fltk3::Browser_::full_height() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, full_height(), BrowserFullHeight)
+  int t = 0;
+  for (void* p = item_first(); p; p = item_next(p))
+    t += item_quick_height(p);
+  return t;
+}
+
+/**
+ This method may be provided by the subclass to indicate the full width
+ of the item list, in pixels. 
+ The default implementation computes the full width from the item widths.
+ \returns The maximum width of all the items, in pixels.
+ */
+int fltk3::Browser_::full_width() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, full_width(), BrowserFullWidth)
+  return max_width;
+}
+
+/**
+ This method must be implemented by the subclass if it supports 
+ multiple selections; sets the selection state to \p val for the \p item.
+ Sets the selection state for \p item, where optional \p val is 1 (select, the default)
+ or 0 (de-select).
+ \param[in] item The item to be selected
+ \param[in] val The optional selection state; 1=select, 0=de-select.\n
+ The default is to select the item (1).
+ */
+void fltk3::Browser_::item_select(void *item, int val) {
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_select(item, val), BrowserItemSelect)
+}
+
+/**
+ This method must be implemented by the subclass if it supports
+ multiple selections; returns the selection state for \p item.
+ The method should return 1 if \p item is selected, or 0 otherwise.
+ \param[in] item The item to test.
+ */
+int fltk3::Browser_::item_selected(void* item) const { 
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_selected(item), BrowserItemSelected)
+  return item==selection_ ? 1 : 0; 
+}
+
+void *fltk3::Browser_::item_first() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_first(), BrowserItemFirst)
+  return 0;
+}
+
+void *fltk3::Browser_::item_next(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_next(item), BrowserItemNext)
+  return 0;
+}
+
+void *fltk3::Browser_::item_prev(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_prev(item), BrowserItemPrev)
+  return 0;
+}
+
+void *fltk3::Browser_::item_last() const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void*, item_last(), BrowserItemLast)
+  return 0;
+}
+
+int fltk3::Browser_::item_height(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_height(item), BrowserItemHeight)
+  return 0;
+}
+
+int fltk3::Browser_::item_width(void *item) const { 
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, item_width(item), BrowserItemWidth)
+  return 0;
+}
+
+void fltk3::Browser_::item_draw(void *item,int X,int Y,int W,int H) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_draw(item, X, Y, W, H), BrowserItemDraw)
+}
+
+const char *fltk3::Browser_::item_text(void *item) const {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(const char *, item_text(item), BrowserItemText)
+  return 0L;
+}
+
+void fltk3::Browser_::item_swap(void *a,void *b) { 
+  FLTK3_OBJECT_VCALLS_WRAPPER(item_swap(a, b), BrowserItemSwap)
+}
+
+void *fltk3::Browser_::item_at(int index) const { 
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(void *, item_at(index), BrowserItemAt)
+  return 0L; 
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Browser_load.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Browser_load.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Browser_load.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Browser_load.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,70 @@
+//
+// "$Id$"
+//
+// File loading routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Browser.h>
+#include <stdio.h>
+#include <fltk3/utf8.h>
+
+/**
+  Clears the browser and reads the file, adding each line from the file
+  to the browser.  If the filename is NULL or a zero-length
+  string then this just clears the browser.  This returns zero if there
+  was any error in opening or reading the file, in which case errno
+  is set to the system error.  The data() of each line is set
+  to NULL.
+  \param[in] filename The filename to load
+  \returns 1 if OK, 0 on error (errno has reason)
+  \see add()
+*/
+int fltk3::Browser::load(const char *filename) {
+#define MAXFL_BLINE 1024
+    char newtext[MAXFL_BLINE];
+    int c;
+    int i;
+    clear();
+    if (!filename || !(filename[0])) return 1;
+    FILE *fl = fltk3::fopen(filename,"r");
+    if (!fl) return 0;
+    i = 0;
+    do {
+	c = getc(fl);
+	if (c == '\n' || c <= 0 || i>=(MAXFL_BLINE-1)) {
+	    newtext[i] = 0;
+	    add(newtext);
+	    i = 0;
+	} else {
+	    newtext[i++] = c;
+	}
+    } while (c >= 0);
+    fclose(fl);
+    return 1;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Button.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Button.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Button.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,228 @@
+//
+// "$Id$"
+//
+// Button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Button.h>
+#include <fltk3/Group.h>
+#include <fltk3/Window.h>
+
+
+fltk3::WidgetTracker *fltk3::Button::key_release_tracker = 0;
+
+
+// There are a lot of subclasses, named Fl_*_Button.  Some of
+// them are implemented by setting the type() value and testing it
+// here.  This includes fltk3::RadioButton and fltk3::ToggleButton
+
+/**
+  Sets the current value of the button.
+  A non-zero value sets the button to 1 (ON), and zero sets it to 0 (OFF).
+  \param[in] v button value.
+  \see set(), clear()
+ */
+int fltk3::Button::value(int v) {
+  v = v ? 1 : 0;
+  oldval = v;
+  clear_changed();
+  if (value_ != v) {
+    value_ = v;
+    if (box()) redraw();
+    else redraw_label();
+    return 1;
+  } else {
+    return 0;
+  }
+}
+
+/**
+  Turns on this button and turns off all other radio buttons in the group
+  (calling \c value(1) or \c set() does not do this).
+ */
+void fltk3::Button::setonly() { // set this radio button on, turn others off
+  value(1);
+  fltk3::Group* g = parent();
+  fltk3::Widget*const* a = g->array();
+  for (int i = g->children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (o != this && o->type()==fltk3::RADIO_BUTTON) ((fltk3::Button*)o)->value(0);
+  }
+}
+
+void fltk3::Button::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (type() == fltk3::HIDDEN_BUTTON) return;
+  fltk3::Color col;
+  if (value()) {
+    if (selection_color()==fltk3::GRAY) 
+      col = fltk3::color_average(fltk3::BLACK, color(), 0.2f);
+    else
+      col = selection_color();
+  } else {
+    col = color();
+  }
+  draw_box(value() ? (down_box()?down_box():fltk3::down(box())) : box(), col);
+  draw_backdrop();
+  if (labeltype() == fltk3::NORMAL_LABEL && value()) {
+    fltk3::Color c = labelcolor();
+    labelcolor(fltk3::contrast(c, col));
+    draw_label();
+    labelcolor(c);
+  } else draw_label();
+  if (fltk3::focus() == this) draw_focus();
+}
+
+int fltk3::Button::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  int newval;
+  switch (event) {
+  case fltk3::ENTER: /* FALLTHROUGH */
+  case fltk3::LEAVE:
+//  if ((value_?selection_color():color())==fltk3::GRAY) redraw();
+    return 1;
+  case fltk3::PUSH:
+    if (fltk3::visible_focus() && handle(fltk3::FOCUS)) fltk3::focus(this);
+  case fltk3::DRAG:
+    if (fltk3::event_inside(this)) {
+      if (type() == fltk3::RADIO_BUTTON) newval = 1;
+      else newval = !oldval;
+    } else
+    {
+      clear_changed();
+      newval = oldval;
+    }
+    if (newval != value_) {
+      value_ = newval;
+      set_changed();
+      redraw();
+      if (when() & fltk3::WHEN_CHANGED) do_callback();
+    }
+    return 1;
+  case fltk3::RELEASE:
+    if (value_ == oldval) {
+      if (when() & fltk3::WHEN_NOT_CHANGED) do_callback();
+      return 1;
+    }
+    set_changed();
+    if (type() == fltk3::RADIO_BUTTON) setonly();
+    else if (type() == fltk3::TOGGLE_BUTTON) oldval = value_;
+    else {
+      value(oldval);
+      set_changed();
+      if (when() & fltk3::WHEN_CHANGED) {
+	fltk3::WidgetTracker wp(this);
+        do_callback();
+        if (wp.deleted()) return 1;
+      }
+    }
+    if (when() & fltk3::WHEN_RELEASE) do_callback();
+    return 1;
+  case fltk3::SHORTCUT:
+    if (!(shortcut() ?
+	  fltk3::test_shortcut(shortcut()) : test_shortcut())) return 0;    
+    if (fltk3::visible_focus() && handle(fltk3::FOCUS)) fltk3::focus(this);
+    goto triggered_by_keyboard;
+  case fltk3::FOCUS : /* FALLTHROUGH */
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      if (box() == fltk3::NO_BOX) {
+	// Widgets with the fltk3::NO_BOX boxtype need a parent to
+	// redraw, since it is responsible for redrawing the
+	// background...
+	int X = x() > 0 ? x() - 1 : 0;
+	int Y = y() > 0 ? y() - 1 : 0;
+	if (window()) window()->damage(fltk3::DAMAGE_ALL, X, Y, w() + 2, h() + 2);
+      } else redraw();
+      return 1;
+    } else return 0;
+  case fltk3::KEYBOARD :
+    if (fltk3::focus() == this && fltk3::event_key() == ' ' &&
+        !(fltk3::event_state() & (fltk3::SHIFT | fltk3::CTRL | fltk3::ALT | fltk3::META))) {
+      set_changed();
+    triggered_by_keyboard:
+      fltk3::WidgetTracker wp(this);
+      if (type() == fltk3::RADIO_BUTTON && !value_) {
+	setonly();
+	if (when() & fltk3::WHEN_CHANGED) do_callback();
+      } else if (type() == fltk3::TOGGLE_BUTTON) {
+	value(!value());
+	if (when() & fltk3::WHEN_CHANGED) do_callback();
+      } else {
+        simulate_key_action();
+      }
+      if (wp.deleted()) return 1;
+      if (when() & fltk3::WHEN_RELEASE) do_callback();
+      return 1;
+    }
+  default:
+    return 0;
+  }
+}
+
+void fltk3::Button::simulate_key_action()
+{
+  if (key_release_tracker) {
+    fltk3::remove_timeout(key_release_timeout, key_release_tracker);
+    key_release_timeout(key_release_tracker);
+  }
+  value(1); 
+  redraw();
+  key_release_tracker = new fltk3::WidgetTracker(this);
+  fltk3::add_timeout(0.15, key_release_timeout, key_release_tracker);
+}
+
+void fltk3::Button::key_release_timeout(void *d)
+{
+  fltk3::WidgetTracker *wt = (fltk3::WidgetTracker*)d;
+  if (!wt)
+    return;
+  if (wt==key_release_tracker) 
+    key_release_tracker = 0L;
+  fltk3::Button *btn = (fltk3::Button*)wt->widget();
+  if (btn) {
+    btn->value(0);
+    btn->redraw();
+  }
+  delete wt;
+}
+
+/**
+  The constructor creates the button using the given position, size and label.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Button::Button(int X, int Y, int W, int H, const char *L)
+: fltk3::Widget(X,Y,W,H,L) {
+  box(fltk3::UP_BOX);
+  down_box(fltk3::NO_BOX);
+  value_ = oldval = 0;
+  shortcut_ = 0;
+  set_flag(SHORTCUT_LABEL);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Chart.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Chart.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Chart.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Chart.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,436 @@
+//
+// "$Id$"
+//
+// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/math.h>
+#include <fltk3/run.h>
+#include <fltk3/Chart.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+#include <stdlib.h>
+
+#define ARCINC	(2.0*M_PI/360.0)
+
+// this function is in fl_boxtype.cxx:
+void fl_rectbound(int x,int y,int w,int h, fltk3::Color color, fltk3::Boxtype);
+
+/* Widget specific information */
+
+static void draw_barchart(int x,int y,int w,int h,
+			  int numb, fltk3::CHART_ENTRY entries[],
+			  double min, double max, int autosize, int maxnumb,
+			  fltk3::Color textcolor)
+/* Draws a bar chart. x,y,w,h is the bounding box, entries the array of
+   numb entries and min and max the boundaries. */
+{
+  double incr;
+  int zeroh;
+  double lh = fltk3::height();
+  if (max == min) incr = h;
+  else incr = h/(max-min);
+  if ( (-min*incr) < lh) {
+      incr = (h - lh + min*incr)/(max-min);
+      zeroh = int(y+h-lh);
+  } else {
+      zeroh = (int)rint(y+h+min * incr);
+  }
+  int bwidth = (int)rint(w/double(autosize?numb:maxnumb));
+  /* Draw base line */
+  fltk3::color(textcolor);
+  fltk3::line(x, zeroh, x+w, zeroh);
+  if (min == 0.0 && max == 0.0) return; /* Nothing else to draw */
+  int i;
+  /* Draw the bars */
+  for (i=0; i<numb; i++) {
+      int hh = (int)rint(entries[i].val*incr);
+      if (hh < 0)
+	fl_rectbound(x+i*bwidth,zeroh,bwidth+1,-hh+1, (fltk3::Color)entries[i].col, (fltk3::Boxtype)0);
+      else if (hh > 0)
+	fl_rectbound(x+i*bwidth,zeroh-hh,bwidth+1,hh+1,(fltk3::Color)entries[i].col, (fltk3::Boxtype)0);
+  }
+  /* Draw the labels */
+  fltk3::color(textcolor);
+  for (i=0; i<numb; i++)
+      fltk3::draw(entries[i].str,
+	      x+i*bwidth+bwidth/2,zeroh,0,0,
+	      fltk3::ALIGN_TOP);
+}
+
+static void draw_horbarchart(int x,int y,int w,int h,
+			     int numb, fltk3::CHART_ENTRY entries[],
+			     double min, double max, int autosize, int maxnumb,
+			     fltk3::Color textcolor)
+/* Draws a horizontal bar chart. x,y,w,h is the bounding box, entries the
+   array of numb entries and min and max the boundaries. */
+{
+  int i;
+  double lw = 0.0;		/* Maximal label width */
+  /* Compute maximal label width */
+  for (i=0; i<numb; i++) {
+      double w1 = fltk3::width(entries[i].str);
+      if (w1 > lw) lw = w1;
+  }
+  if (lw > 0.0) lw += 4.0;
+  double incr;
+  int zeroh;
+  if (max == min) incr = w;
+  else incr = w/(max-min);
+  if ( (-min*incr) < lw) {
+      incr = (w - lw + min*incr)/(max-min);
+      zeroh = x+(int)rint(lw);
+  } else {
+      zeroh = (int)rint(x-min * incr);
+  }
+  int bwidth = (int)rint(h/double(autosize?numb:maxnumb));
+  /* Draw base line */
+  fltk3::color(textcolor);
+  fltk3::line(zeroh, y, zeroh, y+h);
+  if (min == 0.0 && max == 0.0) return; /* Nothing else to draw */
+  /* Draw the bars */
+  for (i=0; i<numb; i++) {
+      int ww = (int)rint(entries[i].val*incr);
+      if (ww > 0)
+	fl_rectbound(zeroh,y+i*bwidth,ww+1,bwidth+1, (fltk3::Color)entries[i].col, (fltk3::Boxtype)0);
+      else if (ww < 0)
+	fl_rectbound(zeroh+ww,y+i*bwidth,-ww+1,bwidth+1,(fltk3::Color)entries[i].col, (fltk3::Boxtype)0);
+  }
+  /* Draw the labels */
+  fltk3::color(textcolor);
+  for (i=0; i<numb; i++)
+      fltk3::draw(entries[i].str,
+	      zeroh-2,y+i*bwidth+bwidth/2,0,0,
+	      fltk3::ALIGN_RIGHT);
+}
+
+static void draw_linechart(int type, int x,int y,int w,int h,
+			   int numb, fltk3::CHART_ENTRY entries[],
+			   double min, double max, int autosize, int maxnumb,
+			   fltk3::Color textcolor)
+/* Draws a line chart. x,y,w,h is the bounding box, entries the array of
+   numb entries and min and max the boundaries. */
+{
+  int i;
+  double lh = fltk3::height();
+  double incr;
+  if (max == min) incr = h-2.0*lh;
+  else incr = (h-2.0*lh)/ (max-min);
+  int zeroh = (int)rint(y+h-lh+min * incr);
+  double bwidth = w/double(autosize?numb:maxnumb);
+  /* Draw the values */
+  for (i=0; i<numb; i++) {
+      int x0 = x + (int)rint((i-.5)*bwidth);
+      int x1 = x + (int)rint((i+.5)*bwidth);
+      int yy0 = i ? zeroh - (int)rint(entries[i-1].val*incr) : 0;
+      int yy1 = zeroh - (int)rint(entries[i].val*incr);
+      if (type == fltk3::SPIKE_CHART) {
+	  fltk3::color((fltk3::Color)entries[i].col);
+	  fltk3::line(x1, zeroh, x1, yy1);
+      } else if (type == fltk3::LINE_CHART && i != 0) {
+	  fltk3::color((fltk3::Color)entries[i-1].col);
+	  fltk3::line(x0,yy0,x1,yy1);
+      } else if (type == fltk3::FILLED_CHART && i != 0) {
+	  fltk3::color((fltk3::Color)entries[i-1].col);
+	  if ((entries[i-1].val>0.0)!=(entries[i].val>0.0)) {
+	      double ttt = entries[i-1].val/(entries[i-1].val-entries[i].val);
+	      int xt = x + (int)rint((i-.5+ttt)*bwidth);
+	      fltk3::polygon(x0,zeroh, x0,yy0, xt,zeroh);
+	      fltk3::polygon(xt,zeroh, x1,yy1, x1,zeroh);
+	  } else {
+	      fltk3::polygon(x0,zeroh, x0,yy0, x1,yy1, x1,zeroh);
+	  }
+	  fltk3::color(textcolor);
+	  fltk3::line(x0,yy0,x1,yy1);
+      }
+  }
+  /* Draw base line */
+  fltk3::color(textcolor);
+  fltk3::line(x,zeroh,x+w,zeroh);
+  /* Draw the labels */
+  for (i=0; i<numb; i++)
+      fltk3::draw(entries[i].str,
+	      x+(int)rint((i+.5)*bwidth), zeroh - (int)rint(entries[i].val*incr),0,0,
+	      entries[i].val>=0 ? fltk3::ALIGN_BOTTOM : fltk3::ALIGN_TOP);
+}
+
+static void draw_piechart(int x,int y,int w,int h,
+			  int numb, fltk3::CHART_ENTRY entries[], int special,
+			  fltk3::Color textcolor)
+/* Draws a pie chart. x,y,w,h is the bounding box, entries the array of
+   numb entries */
+{
+  int i;
+  double xc,yc,rad;	/* center and radius */
+  double tot;		/* sum of values */
+  double incr;		/* increment in angle */
+  double curang;		/* current angle we are drawing */
+  double txc,tyc;	/* temporary center */
+  double lh = fltk3::height();
+  /* compute center and radius */
+  double h_denom = (special ? 2.3 : 2.0);
+  rad = (h - 2*lh)/h_denom/1.1;
+  xc = x+w/2.0; yc = y+h-1.1*rad-lh;
+  /* compute sum of values */
+  tot = 0.0;
+  for (i=0; i<numb; i++)
+    if (entries[i].val > 0.0) tot += entries[i].val;
+  if (tot == 0.0) return;
+  incr = 360.0/tot;
+  /* Draw the pie */
+  curang = 0.0;
+  for (i=0; i<numb; i++)
+    if (entries[i].val > 0.0)
+    {
+      txc = xc; tyc = yc;
+      /* Correct for special pies */
+      if (special && i==0)
+      {
+        txc += 0.3*rad*cos(ARCINC*(curang+0.5*incr*entries[i].val));
+        tyc -= 0.3*rad*sin(ARCINC*(curang+0.5*incr*entries[i].val));
+      }
+      fltk3::color((fltk3::Color)entries[i].col);
+      fltk3::begin_polygon(); fltk3::vertex(txc,tyc);
+      fltk3::arc(txc,tyc,rad,curang, curang+incr*entries[i].val);
+      fltk3::end_polygon();
+      fltk3::color(textcolor);
+      fltk3::begin_loop(); fltk3::vertex(txc,tyc);
+      fltk3::arc(txc,tyc,rad,curang, curang+incr*entries[i].val);
+      fltk3::end_loop();
+      curang += 0.5 * incr * entries[i].val;
+      /* draw the label */
+      double xl = txc + 1.1*rad*cos(ARCINC*curang);
+      fltk3::draw(entries[i].str,
+	      (int)rint(xl),
+	      (int)rint(tyc - 1.1*rad*sin(ARCINC*curang)),
+	      0, 0,
+	      xl<txc ? fltk3::ALIGN_RIGHT : fltk3::ALIGN_LEFT);
+      curang += 0.5 * incr * entries[i].val;
+    }
+}
+
+void fltk3::Chart::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+    draw_box();
+    fltk3::Boxtype b = box();
+    int xx = x()+fltk3::box_dx(b); // was 9 instead of dx...
+    int yy = y()+fltk3::box_dy(b);
+    int ww = w()-fltk3::box_dw(b);
+    int hh = h()-fltk3::box_dh(b);
+    fltk3::push_clip(xx, yy, ww, hh);
+
+    ww--; hh--; // adjust for line thickness
+
+    if (min >= max) {
+	min = max = 0.0;
+	for (int i=0; i<numb; i++) {
+	    if (entries[i].val < min) min = entries[i].val;
+	    if (entries[i].val > max) max = entries[i].val;
+	}
+    }
+
+    fltk3::font(textfont(),textsize());
+
+    switch (type()) {
+    case fltk3::BAR_CHART:
+	ww++; // makes the bars fill box correctly
+	draw_barchart(xx,yy,ww,hh, numb, entries, min, max,
+			autosize(), maxnumb, textcolor());
+	break;
+    case fltk3::HORBAR_CHART:
+	hh++; // makes the bars fill box correctly
+	draw_horbarchart(xx,yy,ww,hh, numb, entries, min, max,
+			autosize(), maxnumb, textcolor());
+	break;
+    case fltk3::PIE_CHART:
+	draw_piechart(xx,yy,ww,hh,numb,entries,0, textcolor());
+	break;
+    case fltk3::SPECIALPIE_CHART:
+	draw_piechart(xx,yy,ww,hh,numb,entries,1,textcolor());
+	break;
+    default:
+	draw_linechart(type(),xx,yy,ww,hh, numb, entries, min, max,
+			autosize(), maxnumb, textcolor());
+	break;
+    }
+    draw_label();
+    fltk3::pop_clip();
+}
+
+/*------------------------------*/
+
+#define FL_CHART_BOXTYPE	fltk3::BORDER_BOX
+#define FL_CHART_COL1		FL_COL1
+#define FL_CHART_LCOL		FL_LCOL
+#define FL_CHART_ALIGN		fltk3::ALIGN_BOTTOM
+
+/**
+  Create a new fltk3::Chart widget using the given position, size and label string.
+  The default boxstyle is \c fltk3::NO_BOX.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Chart::Chart(int X, int Y, int W, int H,const char *L) :
+fltk3::Widget(X,Y,W,H,L) {
+  box(fltk3::BORDER_BOX);
+  align(fltk3::ALIGN_BOTTOM);
+  numb       = 0;
+  maxnumb    = 0;
+  sizenumb   = fltk3::CHART_MAX;
+  autosize_  = 1;
+  min = max  = 0;
+  textfont(fltk3::HELVETICA);
+  textsize(10);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  entries    = (fltk3::CHART_ENTRY *)calloc(sizeof(fltk3::CHART_ENTRY), fltk3::CHART_MAX + 1);
+}
+
+/**
+  Destroys the fltk3::Chart widget and all of its data.
+ */
+fltk3::Chart::~Chart() {
+  free(entries);
+}
+
+/**
+  Removes all values from the chart.
+ */
+void fltk3::Chart::clear() {
+  numb = 0;
+  min = max = 0;
+  redraw();
+}
+
+/**
+  Add the data value \p val with optional label \p str and color \p col
+  to the chart.
+  \param[in] val data value
+  \param[in] str optional data label
+  \param[in] col optional data color
+ */
+void fltk3::Chart::add(double val, const char *str, unsigned col) {
+  /* Allocate more entries if required */
+  if (numb >= sizenumb) {
+    sizenumb += fltk3::CHART_MAX;
+    entries = (fltk3::CHART_ENTRY *)realloc(entries, sizeof(fltk3::CHART_ENTRY) * (sizenumb + 1));
+  }
+  // Shift entries as needed
+  if (numb >= maxnumb && maxnumb > 0) {
+    memmove(entries, entries + 1, sizeof(fltk3::CHART_ENTRY) * (numb - 1));
+    numb --;
+  }
+  entries[numb].val = float(val);
+  entries[numb].col = col;
+    if (str) {
+	strlcpy(entries[numb].str,str,fltk3::CHART_LABEL_MAX + 1);
+    } else {
+	entries[numb].str[0] = 0;
+    }
+  numb++;
+  redraw();
+}
+
+/**
+  Inserts a data value \p val at the given position \p ind.
+  Position 1 is the first data value.
+  \param[in] ind insertion position
+  \param[in] val data value
+  \param[in] str optional data label
+  \param[in] col optional data color
+ */
+void fltk3::Chart::insert(int ind, double val, const char *str, unsigned col) {
+  int i;
+  if (ind < 1 || ind > numb+1) return;
+  /* Allocate more entries if required */
+  if (numb >= sizenumb) {
+    sizenumb += fltk3::CHART_MAX;
+    entries = (fltk3::CHART_ENTRY *)realloc(entries, sizeof(fltk3::CHART_ENTRY) * (sizenumb + 1));
+  }
+  // Shift entries as needed
+  for (i=numb; i >= ind; i--) entries[i] = entries[i-1];
+  if (numb < maxnumb || maxnumb == 0) numb++;
+  /* Fill in the new entry */
+  entries[ind-1].val = float(val);
+  entries[ind-1].col = col;
+  if (str) {
+      strlcpy(entries[ind-1].str,str,fltk3::CHART_LABEL_MAX+1);
+  } else {
+      entries[ind-1].str[0] = 0;
+  }
+  redraw();
+}
+
+/**
+  Replace a data value \p val at the given position \p ind.
+  Position 1 is the first data value.
+  \param[in] ind insertion position
+  \param[in] val data value
+  \param[in] str optional data label
+  \param[in] col optional data color
+ */
+void fltk3::Chart::replace(int ind,double val, const char *str, unsigned col) {
+  if (ind < 1 || ind > numb) return;
+  entries[ind-1].val = float(val);
+  entries[ind-1].col = col;
+  if (str) {
+      strlcpy(entries[ind-1].str,str,fltk3::CHART_LABEL_MAX+1);
+  } else {
+      entries[ind-1].str[0] = 0;
+  }
+  redraw();
+}
+
+/**
+  Sets the lower and upper bounds of the chart values.
+  \param[in] a, b are used to set lower, upper
+ */
+void fltk3::Chart::bounds(double a, double b) {
+  this->min = a;
+  this->max = b;
+  redraw();
+}
+
+/**
+  Set the maximum number of data values for a chart.
+  If you do not call this method then the chart will be allowed to grow
+  to any size depending on available memory.
+  \param[in] m maximum number of data values allowed.
+ */
+void fltk3::Chart::maxsize(int m) {
+  int i;
+  /* Fill in the new number */
+  if (m < 0) return;
+  maxnumb = m;
+  /* Shift entries if required */
+  if (numb > maxnumb) {
+      for (i = 0; i<maxnumb; i++)
+	  entries[i] = entries[i+numb-maxnumb];
+      numb = maxnumb;
+      redraw();
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/CheckBrowser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Check_Browser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/CheckBrowser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/CheckBrowser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,330 @@
+//
+// "$Id$"
+//
+// fltk3::CheckBrowser header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <fltk3/draw.h>
+#include <fltk3/CheckBrowser.h>
+
+/* This uses a cache for faster access when you're scanning the list
+either forwards or backwards. */
+
+fltk3::CheckBrowser::cb_item *fltk3::CheckBrowser::find_item(int n) const {
+	int i = n;
+	cb_item *p = first;
+
+	if (n <= 0 || n > nitems_ || p == 0) {
+		return 0;
+	}
+
+	if (n == cached_item) {
+		p = cache;
+		n = 1;
+	} else if (n == cached_item + 1) {
+		p = cache->next;
+		n = 1;
+	} else if (n == cached_item - 1) {
+		p = cache->prev;
+		n = 1;
+	}
+
+	while (--n) {
+		p = p->next;
+	}
+
+	/* Cast to not const and cache it. */
+
+	((fltk3::CheckBrowser *)this)->cache = p;
+	((fltk3::CheckBrowser *)this)->cached_item = i;
+
+	return p;
+}
+
+int fltk3::CheckBrowser::lineno(cb_item *p0) const {
+	cb_item *p = first;
+
+	if (p == 0) {
+		return 0;
+	}
+
+	int i = 1;
+	while (p) {
+		if (p == p0) {
+			return i;
+		}
+		i++;
+		p = p->next;
+	}
+
+	return 0;
+}
+
+fltk3::CheckBrowser::CheckBrowser(int X, int Y, int W, int H, const char *l)
+/**  The constructor makes an empty browser.*/
+: fltk3::Browser_(X, Y, W, H, l) {
+	type(fltk3::SELECT_BROWSER);
+	when(fltk3::WHEN_NEVER);
+	first = last = 0;
+	nitems_ = nchecked_ = 0;
+	cached_item = -1;
+}
+
+void *fltk3::CheckBrowser::item_first() const {
+	return first;
+}
+
+void *fltk3::CheckBrowser::item_next(void *l) const {
+	return ((cb_item *)l)->next;
+}
+
+void *fltk3::CheckBrowser::item_prev(void *l) const {
+	return ((cb_item *)l)->prev;
+}
+
+int fltk3::CheckBrowser::item_height(void *) const {
+	return textsize() + 2;
+}
+
+#define CHECK_SIZE (textsize()-2)
+
+int fltk3::CheckBrowser::item_width(void *v) const {
+	fltk3::font(textfont(), textsize());
+	return int(fltk3::width(((cb_item *)v)->text)) + CHECK_SIZE + 8;
+}
+
+void fltk3::CheckBrowser::item_draw(void *v, int X, int Y, int, int) const {
+	cb_item *i = (cb_item *)v;
+	char *s = i->text;
+	int tsize = textsize();
+	fltk3::Color col = active_r() ? textcolor() : fltk3::inactive(textcolor());
+	int cy = Y + (tsize + 1 - CHECK_SIZE) / 2;
+	X += 2;
+
+	fltk3::color(active_r() ? fltk3::FOREGROUND_COLOR : fltk3::inactive(fltk3::FOREGROUND_COLOR));
+	fltk3::loop(X, cy, X, cy + CHECK_SIZE,
+	        X + CHECK_SIZE, cy + CHECK_SIZE, X + CHECK_SIZE, cy);
+	if (i->checked) {
+	  int tx = X + 3;
+	  int tw = CHECK_SIZE - 4;
+	  int d1 = tw/3;
+	  int d2 = tw-d1;
+	  int ty = cy + (CHECK_SIZE+d2)/2-d1-2;
+	  for (int n = 0; n < 3; n++, ty++) {
+	    fltk3::line(tx, ty, tx+d1, ty+d1);
+	    fltk3::line(tx+d1, ty+d1, tx+tw-1, ty+d1-d2+1);
+	  }
+	}
+	fltk3::font(textfont(), tsize);
+	if (i->selected) {
+		col = fltk3::contrast(col, selection_color());
+	}
+	fltk3::color(col);
+	fltk3::draw(s, X + CHECK_SIZE + 8, Y + tsize - 1);
+}
+
+void fltk3::CheckBrowser::item_select(void *v, int state) {
+	cb_item *i = (cb_item *)v;
+
+	if (state) {
+		if (i->checked) {
+			i->checked = 0;
+			nchecked_--;
+		} else {
+			i->checked = 1;
+			nchecked_++;
+		}
+	}
+}
+
+int fltk3::CheckBrowser::item_selected(void *v) const {
+	cb_item *i = (cb_item *)v;
+	return i->selected;
+}
+/**
+ Add a new unchecked line to the end of the browser.  
+ \see add(char *s, int b)
+*/
+int fltk3::CheckBrowser::add(char *s) {
+	return (add(s, 0));
+}
+
+/** 
+ Add a new line to the end of the browser.  The text is copied
+ using the strdup() function.  It may also be NULL to make
+ a blank line.  It can set the item checked if \p b is not 0.
+ */
+int fltk3::CheckBrowser::add(char *s, int b) {
+	cb_item *p = (cb_item *)malloc(sizeof(cb_item));
+	p->next = 0;
+	p->prev = 0;
+	p->checked = b;
+	p->selected = 0;
+	p->text = strdup(s);
+
+	if (b) {
+		nchecked_++;
+	}
+
+	if (last == 0) {
+		first = last = p;
+	} else {
+		last->next = p;
+		p->prev = last;
+		last = p;
+	}
+	nitems_++;
+
+	return (nitems_);
+}
+
+/**
+  Remove line n and make the browser one line shorter. Returns the 
+  number of lines left in the browser.
+*/
+int fltk3::CheckBrowser::remove(int item) {
+  cb_item *p = find_item(item);
+  
+  // line at item exists
+  if(p) {
+    // tell the Browser_ what we will do
+    deleting(p);
+
+    // fix checked count
+    if(p->checked)
+      --nchecked_;
+    
+    // remove the node
+    if (p->prev) 
+      p->prev->next = p->next;
+    else 
+      first = p->next;
+    if (p->next) 
+      p->next->prev = p->prev;
+    else 
+      last = p->prev;
+    
+    free(p->text);
+    free(p);
+    
+    --nitems_;
+    cached_item = -1;
+  }
+  
+  return (nitems_);
+}
+
+/**  Remove every item from the browser.*/
+void fltk3::CheckBrowser::clear() {
+	cb_item *p = first;
+	cb_item *next;
+
+	if (p == 0) {
+		return;
+	}
+
+	new_list();
+	do {
+		next = p->next;
+		free(p->text);
+		free(p);
+		p = next;
+	} while (p);
+
+	first = last = 0;
+	nitems_ = nchecked_ = 0;
+	cached_item = -1;
+}
+
+/** Gets the current status of item item. */
+int fltk3::CheckBrowser::checked(int i) const {
+	cb_item *p = find_item(i);
+
+	if (p) return p->checked;
+	return 0;
+}
+
+/** Sets the check status of item item to b. */
+void fltk3::CheckBrowser::checked(int i, int b) {
+	cb_item *p = find_item(i);
+
+	if (p && (p->checked ^ b)) {
+		p->checked = b;
+		if (b) {
+			nchecked_++;
+		} else {
+			nchecked_--;
+		}
+		redraw();
+	}
+}
+
+/**  Returns the index of the currently selected item.*/
+int fltk3::CheckBrowser::value() const {
+	return lineno((cb_item *)selection());
+}
+
+/**  Return a pointer to an internal buffer holding item item's text.*/
+char *fltk3::CheckBrowser::text(int i) const {
+	cb_item *p = find_item(i);
+
+	if (p) return p->text;
+	return 0;
+}
+
+/**  Sets all the items checked.*/
+void fltk3::CheckBrowser::check_all() {
+	cb_item *p;
+
+	nchecked_ = nitems_;
+	for (p = first; p; p = p->next) {
+		p->checked = 1;
+	}
+	redraw();
+}
+
+/**  Sets all the items unchecked.*/
+void fltk3::CheckBrowser::check_none() {
+	cb_item *p;
+
+	nchecked_ = 0;
+	for (p = first; p; p = p->next) {
+		p->checked = 0;
+	}
+	redraw();
+}
+
+int fltk3::CheckBrowser::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (event==fltk3::PUSH)
+    deselect();
+  return Browser_::handle(event);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/CheckButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Check_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/CheckButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/CheckButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,47 @@
+//
+// "$Id$"
+//
+// Check button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/CheckButton.h>
+
+// TODO Correct incorrect fltk3::CheckButton comments.
+// A subclass of fltk3::Button that always draws as a diamond box.  This
+// diamond is smaller than the widget size and can be surchecked by
+// another box type, for compatibility with Forms.
+
+/**
+  Creates a new fltk3::CheckButton widget using the given position, size and
+  label string.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::CheckButton::CheckButton(int X, int Y, int W, int H, const char *L)
+: fltk3::LightButton(X, Y, W, H, L) {
+  box(fltk3::NO_BOX);
+  down_box(fltk3::DOWN_BOX);
+  selection_color(fltk3::FOREGROUND_COLOR);
+}

Copied: branches/branch-3.0/src/fltk3/Choice.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Choice.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Choice.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Choice.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,216 @@
+//
+// "$Id$"
+//
+// Choice widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Choice.h>
+#include <fltk3/draw.h>
+#include <fltk3/Wrapper.h>
+#include "flstring.h"
+
+// Emulates the Forms choice widget.  This is almost exactly the same
+// as an fltk3::MenuButton.  The only difference is the appearance of the
+// button: it draws the text of the current pick and a down-arrow.
+
+void fltk3::Choice::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int dx = fltk3::box_dx(fltk3::DOWN_BOX);
+  int dy = fltk3::box_dy(fltk3::DOWN_BOX);
+  int H = h() - 2 * dy;
+  int W = (H > 20) ? 20 : H;
+  int X = x() + w() - W - dx;
+  int Y = y() + dy;
+  int w1 = (W - 4) / 3; if (w1 < 1) w1 = 1;
+  int x1 = X + (W - 2 * w1 - 1) / 2;
+  int y1 = Y + (H - w1 - 1) / 2;
+
+  if (fltk3::scheme()) {
+    draw_box(fltk3::UP_BOX, color());
+
+    fltk3::color(active_r() ? labelcolor() : fltk3::inactive(labelcolor()));
+    if (!strcmp(fltk3::scheme(), "plastic")) {
+      // Show larger up/down arrows...
+      fltk3::polygon(x1, y1 + 3, x1 + w1, y1 + w1 + 3, x1 + 2 * w1, y1 + 3);
+      fltk3::polygon(x1, y1 + 1, x1 + w1, y1 - w1 + 1, x1 + 2 * w1, y1 + 1);
+    } else {
+      // Show smaller up/down arrows with a divider...
+      x1 = x() + w() - 13 - dx;
+      y1 = y() + h() / 2;
+      fltk3::polygon(x1, y1 - 2, x1 + 3, y1 - 5, x1 + 6, y1 - 2);
+      fltk3::polygon(x1, y1 + 2, x1 + 3, y1 + 5, x1 + 6, y1 + 2);
+
+      fltk3::color(fltk3::darker(color()));
+      fltk3::yxline(x1 - 7, y1 - 8, y1 + 8);
+
+      fltk3::color(fltk3::lighter(color()));
+      fltk3::yxline(x1 - 6, y1 - 8, y1 + 8);
+    }
+  } else {
+    if (fltk3::contrast(textcolor(), fltk3::BACKGROUND2_COLOR) == textcolor()) {
+      draw_box(fltk3::DOWN_BOX, fltk3::BACKGROUND2_COLOR);
+    } else {
+      draw_box(fltk3::DOWN_BOX, fltk3::lighter(color()));
+    }
+    draw_box(fltk3::UP_BOX,X,Y,W,H,color());
+
+    fltk3::color(active_r() ? labelcolor() : fltk3::inactive(labelcolor()));
+    fltk3::polygon(x1, y1, x1 + w1, y1 + w1, x1 + 2 * w1, y1);
+  }
+
+  W += 2 * dx;
+
+  if (mvalue()) {
+    fltk3::MenuItem m = *mvalue();
+    if (active_r()) m.activate(); else m.deactivate();
+
+    // ERCO
+    int xx = x() + dx, yy = y() + dy + 1, ww = w() - W, hh = H - 2;
+
+    fltk3::push_clip(xx, yy, ww, hh);
+
+    if ( fltk3::scheme()) {
+      fltk3::Label l;
+      l.value = m.text;
+      l.image = 0;
+      l.deimage = 0;
+      l.type = m.labeltype_;
+      l.font = m.labelsize_ || m.labelfont_ ? m.labelfont_ : textfont();
+      l.size = m.labelsize_ ? m.labelsize_ : textsize();
+      l.color= m.labelcolor_ ? m.labelcolor_ : textcolor();
+      if (!m.active()) l.color = fltk3::inactive((fltk3::Color)l.color);
+      fltk3::draw_shortcut = 2; // hack value to make '&' disappear
+      l.draw(xx+3, yy, ww>6 ? ww-6 : 0, hh, fltk3::ALIGN_LEFT);
+      fltk3::draw_shortcut = 0;
+      if ( fltk3::focus() == this ) draw_focus(box(), xx, yy, ww, hh);
+    }
+    else {
+      fltk3::draw_shortcut = 2; // hack value to make '&' disappear
+      m.draw(xx, yy, ww, hh, this, fltk3::focus() == this);
+      fltk3::draw_shortcut = 0;
+    }
+
+    fltk3::pop_clip();
+  }
+
+  draw_label();
+}
+
+/**
+  Create a new fltk3::Choice widget using the given position, size and label string.
+  The default boxtype is \c fltk3::UP_BOX.
+
+  The constructor sets menu() to NULL.
+  See fltk3::Menu_ for the methods to set or change the menu.
+
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Choice::Choice(int X, int Y, int W, int H, const char *L)
+: fltk3::Menu_(X,Y,W,H,L) {
+  align(fltk3::ALIGN_LEFT);
+  when(fltk3::WHEN_RELEASE);
+  textfont(fltk3::HELVETICA);
+  box(fltk3::FLAT_BOX);
+  down_box(fltk3::BORDER_BOX);
+}
+
+/**
+  Sets the currently selected value using a pointer to menu item.
+  Changing the selected value causes a redraw().
+  \param[in] v pointer to menu item in the menu item array.
+  \returns non-zero if the new value is different to the old one.
+ */
+int fltk3::Choice::value(const fltk3::MenuItem *v) {
+  if (!Menu_::value(v)) return 0;
+  redraw();
+  return 1;
+}
+
+/**
+  Sets the currently selected value using the index into the menu item array.
+  Changing the selected value causes a redraw().
+  \param[in] v index of value in the menu item array.
+  \returns non-zero if the new value is different to the old one.
+ */
+int fltk3::Choice::value(int v) {
+  if (v == -1) return value((const fltk3::MenuItem *)0);
+  if (v < 0 || v >= (size() - 1)) return 0;
+  if (!Menu_::value(v)) return 0;
+  redraw();
+  return 1;
+}
+
+int fltk3::Choice::handle(int e) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+  if (!menu() || !menu()->text) return 0;
+  const fltk3::MenuItem* v;
+  switch (e) {
+  case fltk3::ENTER:
+  case fltk3::LEAVE:
+    return 1;
+
+  case fltk3::KEYBOARD:
+    if (fltk3::event_key() != ' ' ||
+        (fltk3::event_state() & (fltk3::SHIFT | fltk3::CTRL | fltk3::ALT | fltk3::META))) return 0;
+  case fltk3::PUSH:
+    if (fltk3::visible_focus()) fltk3::focus(this);
+  J1:
+    if (fltk3::scheme()
+	|| fltk3::contrast(textcolor(), fltk3::BACKGROUND2_COLOR) != textcolor()) {
+      v = menu()->pulldown(x(), y(), w(), h(), mvalue(), this);
+    } else {
+      // In order to preserve the old look-n-feel of "white" menus,
+      // temporarily override the color() of this widget...
+      fltk3::Color c = color();
+      color(fltk3::BACKGROUND2_COLOR);
+      v = menu()->pulldown(x(), y(), w(), h(), mvalue(), this);
+      color(c);
+    }
+    if (!v || v->submenu()) return 1;
+    if (v != mvalue()) redraw();
+    picked(v);
+    return 1;
+  case fltk3::SHORTCUT:
+    if (Widget::test_shortcut()) goto J1;
+    v = menu()->test_shortcut();
+    if (!v) return 0;
+    if (v != mvalue()) redraw();
+    picked(v);
+    return 1;
+  case fltk3::FOCUS:
+  case fltk3::UNFOCUS:
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    } else return 0;
+  default:
+    return 0;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Clock.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Clock.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Clock.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Clock.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,220 @@
+//
+// "$Id$"
+//
+// Clock widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Clock.h>
+#include <fltk3/draw.h>
+#include <math.h>
+#include <time.h>
+#ifndef WIN32
+#  include <sys/time.h>
+#endif /* !WIN32 */
+
+// Original clock display written by Paul Haeberli at SGI.
+// Modifications by Mark Overmars for Forms
+// Further changes by Bill Spitzak for fltk
+
+const float hourhand[4][2] = {{-0.5f, 0}, {0, 1.5f}, {0.5f, 0}, {0, -7.0f}};
+const float  minhand[4][2] = {{-0.5f, 0}, {0, 1.5f}, {0.5f, 0}, {0, -11.5f}};
+const float  sechand[4][2] = {{-0.1f, 0}, {0, 2.0f}, {0.1f, 0}, {0, -11.5f}};
+
+static void drawhand(double ang,const float v[][2],fltk3::Color fill,fltk3::Color line)
+{
+  fltk3::push_matrix();
+  fltk3::rotate(ang);
+  fltk3::color(fill); fltk3::begin_polygon();
+  int i; for (i=0; i<4; i++) fltk3::vertex(v[i][0],v[i][1]); fltk3::end_polygon();
+  fltk3::color(line); fltk3::begin_loop();
+  for (i=0; i<4; i++) fltk3::vertex(v[i][0],v[i][1]); fltk3::end_loop();
+  fltk3::pop_matrix();
+}
+
+void fltk3::ClockOutput::drawhands(fltk3::Color fill, fltk3::Color line) {
+  if (!active_r()) {
+    fill = fltk3::inactive(fill);
+    line = fltk3::inactive(line);
+  }
+  drawhand(-360*(hour()+minute()/60.0)/12, hourhand, fill, line);
+  drawhand(-360*(minute()+second()/60.0)/60, minhand, fill, line);
+  drawhand(-360*(second()/60.0), sechand, fill, line);
+}
+
+static void rect(double x, double y, double w, double h) {
+  double r = x+w;
+  double t = y+h;
+  fltk3::begin_polygon();
+  fltk3::vertex(x, y);
+  fltk3::vertex(r, y);
+  fltk3::vertex(r, t);
+  fltk3::vertex(x, t);
+  fltk3::end_polygon();
+}
+
+/**
+  Draw clock with the given position and size.
+  \param[in] X, Y, W, H position and size
+*/
+void fltk3::ClockOutput::draw(int X, int Y, int W, int H) {
+  fltk3::Color box_color = type()==fltk3::ROUND_CLOCK ? fltk3::GRAY : color();
+  fltk3::Color shadow_color = fltk3::color_average(box_color, fltk3::BLACK, 0.5);
+  draw_box(box(), X, Y, W, H, box_color);
+  fltk3::push_matrix();
+  fltk3::translate(X+W/2.0-.5, Y+H/2.0-.5);
+  fltk3::scale((W-1)/28.0, (H-1)/28.0);
+  if (type() == fltk3::ROUND_CLOCK) {
+    fltk3::color(active_r() ? color() : fltk3::inactive(color()));
+    fltk3::begin_polygon(); fltk3::circle(0,0,14); fltk3::end_polygon();
+    fltk3::color(active_r() ? fltk3::FOREGROUND_COLOR : fltk3::inactive(fltk3::FOREGROUND_COLOR));
+    fltk3::begin_loop(); fltk3::circle(0,0,14); fltk3::end_loop();
+  }
+  // draw the shadows:
+  fltk3::push_matrix();
+  fltk3::translate(0.60, 0.60);
+  drawhands(shadow_color, shadow_color);
+  fltk3::pop_matrix();
+  // draw the tick marks:
+  fltk3::push_matrix();
+  fltk3::color(active_r() ? fltk3::FOREGROUND_COLOR : fltk3::inactive(fltk3::FOREGROUND_COLOR));
+  for (int i=0; i<12; i++) {
+    if (i==6) ::rect(-0.5, 9, 1, 2);
+    else if (i==3 || i==0 || i== 9) ::rect(-0.5, 9.5, 1, 1);
+    else ::rect(-0.25, 9.5, .5, 1);
+    fltk3::rotate(-30);
+  }
+  fltk3::pop_matrix();
+  // draw the hands:
+  drawhands(selection_color(), fltk3::FOREGROUND_COLOR); // color was 54
+  fltk3::pop_matrix();
+}
+
+/**
+  Draw clock with current position and size.
+*/
+void fltk3::ClockOutput::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  draw(x(), y(), w(), h());
+  draw_label();
+}
+
+/**
+  Set the displayed time.
+  Set the time in hours, minutes, and seconds.
+  \param[in] H, m, s displayed time
+  \see hour(), minute(), second()
+ */
+void fltk3::ClockOutput::value(int H, int m, int s) {
+  if (H!=hour_ || m!=minute_ || s!=second_) {
+    hour_ = H; minute_ = m; second_ = s;
+    value_ = (H * 60 + m) * 60 + s;
+    damage(fltk3::DAMAGE_CHILD);
+  }
+}
+
+/**
+  Set the displayed time.
+  Set the time in seconds since the UNIX epoch (January 1, 1970).
+  \param[in] v seconds since epoch
+  \see value()
+ */
+void fltk3::ClockOutput::value(ulong v) {
+  value_ = v;
+  struct tm *timeofday;
+  // Some platforms, notably Windows, now use a 64-bit time_t value...
+  time_t vv = (time_t)v;
+  timeofday = localtime(&vv);
+  value(timeofday->tm_hour, timeofday->tm_min, timeofday->tm_sec);
+}
+
+/**
+  Create a new fltk3::ClockOutput widget with the given position, size and label.
+  The default boxtype is \c fltk3::NO_BOX.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::ClockOutput::ClockOutput(int X, int Y, int W, int H, const char *L)
+: fltk3::Widget(X, Y, W, H, L) {
+  box(fltk3::UP_BOX);
+  selection_color(fltk3::gray_ramp(5));
+  align(fltk3::ALIGN_BOTTOM);
+  hour_ = 0;
+  minute_ = 0;
+  second_ = 0;
+  value_ = 0;
+}
+
+////////////////////////////////////////////////////////////////
+
+/**
+  Create an fltk3::Clock widget using the given position, size, and label string.
+  The default boxtype is \c fltk3::NO_BOX.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Clock::Clock(int X, int Y, int W, int H, const char *L)
+  : fltk3::ClockOutput(X, Y, W, H, L) {}
+
+/**
+  Create an fltk3::Clock widget using the given boxtype, position, size, and
+  label string.
+  \param[in] t boxtype
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Clock::Clock(uchar t, int X, int Y, int W, int H, const char *L)
+  : fltk3::ClockOutput(X, Y, W, H, L) {
+  type(t);
+  box(t==fltk3::ROUND_CLOCK ? fltk3::NO_BOX : fltk3::UP_BOX);
+}
+
+static void tick(void *v) {
+  ((fltk3::Clock*)v)->value(time(0));
+  fltk3::add_timeout(1.0, tick, v);
+}
+
+int fltk3::Clock::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  switch (event) {
+  case fltk3::SHOW:
+    tick(this);
+    break;
+  case fltk3::HIDE:
+    fltk3::remove_timeout(tick, this);
+    break;
+  }
+  return ClockOutput::handle(event);
+}
+  
+/**
+  The destructor removes the clock.
+ */
+fltk3::Clock::~Clock() {
+  fltk3::remove_timeout(tick, this);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ColorChooser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Color_Chooser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ColorChooser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ColorChooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,634 @@
+//
+// "$Id$"
+//
+// Color chooser for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/ColorChooser.h>
+#include <fltk3/draw.h>
+#include <fltk3/math.h>
+#include <stdio.h>
+
+// Besides being a useful object on it's own, the fltk3::ColorChooser was
+// an attempt to make a complex composite object that could be easily
+// imbedded into a user interface.  If you wish to make complex objects
+// of your own, be sure to read this code.
+
+// The function fltk3::color_chooser() creates a window containing a color
+// chooser and a few buttons and current-color indicators.  It is an
+// easier interface for simple programs that just need a color.
+
+// The "hue box" can be a circle or rectilinear.
+// You get a circle by defining this:
+#define CIRCLE 1
+// And the "hue box" can auto-update when the value changes
+// you get this by defining this:
+#define UPDATE_HUE_BOX 1
+
+/**
+  This \e static method converts HSV colors to RGB colorspace.
+  \param[in] H, S, V color components
+  \param[out] R, G, B color components
+ */
+void fltk3::ColorChooser::hsv2rgb(
+	double H, double S, double V, double& R, double& G, double& B) {
+  if (S < 5.0e-6) {
+    R = G = B = V;
+  } else {
+    int i = (int)H;  
+    double f = H - (float)i;
+    double p1 = V*(1.0-S);
+    double p2 = V*(1.0-S*f);
+    double p3 = V*(1.0-S*(1.0-f));
+    switch (i) {
+    case 0: R = V;   G = p3;  B = p1;  break;
+    case 1: R = p2;  G = V;   B = p1;  break;
+    case 2: R = p1;  G = V;   B = p3;  break;
+    case 3: R = p1;  G = p2;  B = V;   break;
+    case 4: R = p3;  G = p1;  B = V;   break;
+    case 5: R = V;   G = p1;  B = p2;  break;
+    }
+  }
+}
+
+/**
+  This \e static method converts RGB colors to HSV colorspace.
+  \param[in] R, G, B color components
+  \param[out] H, S, V color components
+ */
+void fltk3::ColorChooser::rgb2hsv(
+	double R, double G, double B, double& H, double& S, double& V) {
+  double maxv = R > G ? R : G; if (B > maxv) maxv = B;
+  V = maxv;
+  if (maxv>0) {
+    double minv = R < G ? R : G; if (B < minv) minv = B;
+    S = 1.0 - double(minv)/maxv;
+    if (maxv > minv) {
+      if (maxv == R) {H = (G-B)/double(maxv-minv); if (H<0) H += 6.0;}
+      else if (maxv == G) H = 2.0+(B-R)/double(maxv-minv);
+      else H = 4.0+(R-G)/double(maxv-minv);
+    }
+  }
+}
+
+/** fltk3::ColorChooser modes */
+enum {
+  M_RGB,	/**< mode() of fltk3::ColorChooser showing RGB values */
+  M_BYTE,	/**< mode() of fltk3::ColorChooser showing byte values */
+  M_HEX,	/**< mode() of fltk3::ColorChooser showing hex values */
+  M_HSV		/**< mode() of fltk3::ColorChooser showing HSV values */
+};
+static fltk3::MenuItem mode_menu[] = {
+  {"rgb"},
+  {"byte"},
+  {"hex"},
+  {"hsv"},
+  {0}
+};
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::cc_Value_Input::format(char* buf) {
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+  if (c->mode() == M_HEX) return sprintf(buf,"0x%02X", int(value()));
+  else return Valuator::format(buf);
+}
+#endif // !FLTK3_DOXYGEN
+
+void fltk3::ColorChooser::set_valuators() {
+  switch (mode()) {
+  case M_RGB:
+    rvalue.range(0,1); rvalue.step(1,1000); rvalue.value(r_);
+    gvalue.range(0,1); gvalue.step(1,1000); gvalue.value(g_);
+    bvalue.range(0,1); bvalue.step(1,1000); bvalue.value(b_);
+    break;
+  case M_BYTE: /* FALLTHROUGH */
+  case M_HEX:
+    rvalue.range(0,255); rvalue.step(1); rvalue.value(int(255*r_+.5));
+    gvalue.range(0,255); gvalue.step(1); gvalue.value(int(255*g_+.5));
+    bvalue.range(0,255); bvalue.step(1); bvalue.value(int(255*b_+.5));
+    break;
+  case M_HSV:
+    rvalue.range(0,6); rvalue.step(1,1000); rvalue.value(hue_);
+    gvalue.range(0,1); gvalue.step(1,1000); gvalue.value(saturation_);
+    bvalue.range(0,1); bvalue.step(1,1000); bvalue.value(value_);
+    break;
+  }
+}
+
+/**
+  Sets the current rgb color values.
+  Does not do the callback. Does not clamp (but out of range values will
+  produce psychedelic effects in the hue selector).
+  \param[in] R, G, B color components.
+  \return 1 if a new rgb value was set, 0 if the rgb value was the previous one.
+ */
+int fltk3::ColorChooser::rgb(double R, double G, double B) {
+  if (R == r_ && G == g_ && B == b_) return 0;
+  r_ = R; g_ = G; b_ = B;
+  double ph = hue_;
+  double ps = saturation_;
+  double pv = value_;
+  rgb2hsv(R,G,B,hue_,saturation_,value_);
+  set_valuators();
+  set_changed();
+  if (value_ != pv) {
+#ifdef UPDATE_HUE_BOX
+    huebox.damage(fltk3::DAMAGE_SCROLL);
+#endif
+    valuebox.damage(fltk3::DAMAGE_EXPOSE);}
+  if (hue_ != ph || saturation_ != ps) {
+    huebox.damage(fltk3::DAMAGE_EXPOSE); 
+    valuebox.damage(fltk3::DAMAGE_SCROLL);
+  }
+  return 1;
+}
+
+/**
+  Set the hsv values.
+  The passed values are clamped (or for hue, modulus 6 is used) to get
+  legal values. Does not do the callback.
+  \param[in] H, S, V color components.
+  \return 1 if a new hsv value was set, 0 if the hsv value was the previous one.
+*/
+int fltk3::ColorChooser::hsv(double H, double S, double V) {
+  H = fmod(H,6.0); if (H < 0.0) H += 6.0;
+  if (S < 0.0) S = 0.0; else if (S > 1.0) S = 1.0;
+  if (V < 0.0) V = 0.0; else if (V > 1.0) V = 1.0;
+  if (H == hue_ && S == saturation_ && V == value_) return 0;
+  double ph = hue_;
+  double ps = saturation_;
+  double pv = value_;
+  hue_ = H; saturation_ = S; value_ = V;
+  if (value_ != pv) {
+#ifdef UPDATE_HUE_BOX
+    huebox.damage(fltk3::DAMAGE_SCROLL);
+#endif
+    valuebox.damage(fltk3::DAMAGE_EXPOSE);}
+  if (hue_ != ph || saturation_ != ps) {
+    huebox.damage(fltk3::DAMAGE_EXPOSE); 
+    valuebox.damage(fltk3::DAMAGE_SCROLL);
+  }
+  hsv2rgb(H,S,V,r_,g_,b_);
+  set_valuators();
+  set_changed();
+  return 1;
+}
+
+////////////////////////////////////////////////////////////////
+
+static void tohs(double x, double y, double& h, double& s) {
+#ifdef CIRCLE
+  x = 2*x-1;
+  y = 1-2*y;
+  s = sqrt(x*x+y*y); if (s > 1.0) s = 1.0;
+  h = (3.0/M_PI)*atan2(y,x);
+  if (h<0) h += 6.0;
+#else
+  h = fmod(6.0*x,6.0); if (h < 0.0) h += 6.0;
+  s = 1.0-y; if (s < 0.0) s = 0.0; else if (s > 1.0) s = 1.0;
+#endif
+}
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::cc_HueBox::handle(int e) {
+  static double ih, is;
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+  switch (e) {
+  case fltk3::PUSH:
+    if (fltk3::visible_focus()) {
+      fltk3::focus(this);
+      redraw();
+    }
+    ih = c->hue();
+    is = c->saturation();
+  case fltk3::DRAG: {
+    double Xf, Yf, H, S;
+    Xf = (fltk3::event_x()-x()-fltk3::box_dx(box()))/double(w()-fltk3::box_dw(box()));
+    Yf = (fltk3::event_y()-y()-fltk3::box_dy(box()))/double(h()-fltk3::box_dh(box()));
+    tohs(Xf, Yf, H, S);
+    if (fabs(H-ih) < 3*6.0/w()) H = ih;
+    if (fabs(S-is) < 3*1.0/h()) S = is;
+    if (fltk3::event_state(fltk3::CTRL)) H = ih;
+    if (c->hsv(H, S, c->value())) c->do_callback();
+    } return 1;
+  case fltk3::FOCUS : /* FALLTHROUGH */
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    }
+    else return 1;
+  case fltk3::KEYBOARD :
+    return handle_key(fltk3::event_key());
+  default:
+    return 0;
+  }
+}
+#endif // !FLTK3_DOXYGEN
+
+static void generate_image(void* vv, int X, int Y, int W, uchar* buf) {
+  fltk3::cc_HueBox* v = (fltk3::cc_HueBox*)vv;
+  int iw = v->w()-fltk3::box_dw(v->box());
+  double Yf = double(Y)/(v->h()-fltk3::box_dh(v->box()));
+#ifdef UPDATE_HUE_BOX
+  const double V = ((fltk3::ColorChooser*)(v->parent()))->value();
+#else
+  const double V = 1.0;
+#endif
+  for (int x = X; x < X+W; x++) {
+    double Xf = double(x)/iw;
+    double H,S; tohs(Xf,Yf,H,S);
+    double r,g,b;
+    fltk3::ColorChooser::hsv2rgb(H,S,V,r,g,b);
+    *buf++ = uchar(255*r+.5);
+    *buf++ = uchar(255*g+.5);
+    *buf++ = uchar(255*b+.5);
+  }
+}
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::cc_HueBox::handle_key(int key) {
+  int w1 = w()-fltk3::box_dw(box())-6;
+  int h1 = h()-fltk3::box_dh(box())-6;
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+
+#ifdef CIRCLE
+  int X = int(.5*(cos(c->hue()*(M_PI/3.0))*c->saturation()+1) * w1);
+  int Y = int(.5*(1-sin(c->hue()*(M_PI/3.0))*c->saturation()) * h1);
+#else
+  int X = int(c->hue()/6.0*w1);
+  int Y = int((1-c->saturation())*h1);
+#endif
+
+  switch (key) {
+    case fltk3::UpKey :
+      Y -= 3;
+      break;
+    case fltk3::DownKey :
+      Y += 3;
+      break;
+    case fltk3::LeftKey :
+      X -= 3;
+      break;
+    case fltk3::RightKey :
+      X += 3;
+      break;
+    default :
+      return 0;
+  }
+
+  double Xf, Yf, H, S;
+  Xf = (double)X/(double)w1;
+  Yf = (double)Y/(double)h1;
+  tohs(Xf, Yf, H, S);
+  if (c->hsv(H, S, c->value())) c->do_callback();
+
+  return 1;
+}
+#endif // !FLTK3_DOXYGEN
+
+#ifndef FLTK3_DOXYGEN
+void fltk3::cc_HueBox::draw() {
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  int x1 = x()+fltk3::box_dx(box());
+  int yy1 = y()+fltk3::box_dy(box());
+  int w1 = w()-fltk3::box_dw(box());
+  int h1 = h()-fltk3::box_dh(box());
+  if (damage() == fltk3::DAMAGE_EXPOSE) fltk3::push_clip(x1+px,yy1+py,6,6);
+  fltk3::draw_image(generate_image, this, x1, yy1, w1, h1);
+  if (damage() == fltk3::DAMAGE_EXPOSE) fltk3::pop_clip();
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+#ifdef CIRCLE
+  int X = int(.5*(cos(c->hue()*(M_PI/3.0))*c->saturation()+1) * (w1-6));
+  int Y = int(.5*(1-sin(c->hue()*(M_PI/3.0))*c->saturation()) * (h1-6));
+#else
+  int X = int(c->hue()/6.0*(w1-6));
+  int Y = int((1-c->saturation())*(h1-6));
+#endif
+  if (X < 0) X = 0; else if (X > w1-6) X = w1-6;
+  if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
+  //  fltk3::color(c->value()>.75 ? fltk3::BLACK : fltk3::WHITE);
+  draw_box(fltk3::UP_BOX,x1+X,yy1+Y,6,6,fltk3::focus() == this ? fltk3::FOREGROUND_COLOR : fltk3::GRAY);
+  px = X; py = Y;
+}
+#endif // !FLTK3_DOXYGEN
+
+////////////////////////////////////////////////////////////////
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::cc_ValueBox::handle(int e) {
+  static double iv;
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+  switch (e) {
+  case fltk3::PUSH:
+    if (fltk3::visible_focus()) {
+      fltk3::focus(this);
+      redraw();
+    }
+    iv = c->value();
+  case fltk3::DRAG: {
+    double Yf;
+    Yf = 1-(fltk3::event_y()-y()-fltk3::box_dy(box()))/double(h()-fltk3::box_dh(box()));
+    if (fabs(Yf-iv)<(3*1.0/h())) Yf = iv;
+    if (c->hsv(c->hue(),c->saturation(),Yf)) c->do_callback();
+    } return 1;
+  case fltk3::FOCUS : /* FALLTHROUGH */
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    }
+    else return 1;
+  case fltk3::KEYBOARD :
+    return handle_key(fltk3::event_key());
+  default:
+    return 0;
+  }
+}
+#endif // !FLTK3_DOXYGEN
+
+static double tr, tg, tb;
+static void generate_vimage(void* vv, int X, int Y, int W, uchar* buf) {
+  fltk3::cc_ValueBox* v = (fltk3::cc_ValueBox*)vv;
+  double Yf = 255*(1.0-double(Y)/(v->h()-fltk3::box_dh(v->box())));
+  uchar r = uchar(tr*Yf+.5);
+  uchar g = uchar(tg*Yf+.5);
+  uchar b = uchar(tb*Yf+.5);
+  for (int x = X; x < X+W; x++) {
+    *buf++ = r; *buf++ = g; *buf++ = b;
+  }
+}
+
+#ifndef FLTK3_DOXYGEN
+void fltk3::cc_ValueBox::draw() {
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+  c->hsv2rgb(c->hue(),c->saturation(),1.0,tr,tg,tb);
+  int x1 = x()+fltk3::box_dx(box());
+  int yy1 = y()+fltk3::box_dy(box());
+  int w1 = w()-fltk3::box_dw(box());
+  int h1 = h()-fltk3::box_dh(box());
+  if (damage() == fltk3::DAMAGE_EXPOSE) fltk3::push_clip(x1,yy1+py,w1,6);
+  fltk3::draw_image(generate_vimage, this, x1, yy1, w1, h1);
+  if (damage() == fltk3::DAMAGE_EXPOSE) fltk3::pop_clip();
+  int Y = int((1-c->value()) * (h1-6));
+  if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
+  draw_box(fltk3::UP_BOX,x1,yy1+Y,w1,6,fltk3::focus() == this ? fltk3::FOREGROUND_COLOR : fltk3::GRAY);
+  py = Y;
+}
+#endif // !FLTK3_DOXYGEN
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::cc_ValueBox::handle_key(int key) {
+  int h1 = h()-fltk3::box_dh(box())-6;
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)parent();
+
+  int Y = int((1-c->value()) * h1);
+  if (Y < 0) Y = 0; else if (Y > h1) Y = h1;
+
+  switch (key) {
+    case fltk3::UpKey :
+      Y -= 3;
+      break;
+    case fltk3::DownKey :
+      Y += 3;
+      break;
+    default :
+      return 0;
+  }
+
+  double Yf;
+  Yf = 1-((double)Y/(double)h1);
+  if (c->hsv(c->hue(),c->saturation(),Yf)) c->do_callback();
+
+  return 1;
+}
+#endif // !FLTK3_DOXYGEN
+
+////////////////////////////////////////////////////////////////
+
+void fltk3::ColorChooser::rgb_cb(fltk3::Widget* o, void*) {
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)(o->parent());
+  double R = c->rvalue.value();
+  double G = c->gvalue.value();
+  double B = c->bvalue.value();
+  if (c->mode() == M_HSV) {
+    if (c->hsv(R,G,B)) c->do_callback();
+    return;
+  }
+  if (c->mode() != M_RGB) {
+    R = R/255;
+    G = G/255;
+    B = B/255;
+  }
+  if (c->rgb(R,G,B)) c->do_callback();
+}
+
+void fltk3::ColorChooser::mode_cb(fltk3::Widget* o, void*) {
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)(o->parent());
+  // force them to redraw even if value is the same:
+  c->rvalue.value(-1);
+  c->gvalue.value(-1);
+  c->bvalue.value(-1);
+  c->set_valuators();
+}
+
+void fltk3::ColorChooser::mode(int newMode)
+{
+  choice.value(newMode);
+  choice.do_callback();
+}
+
+
+////////////////////////////////////////////////////////////////
+
+/**
+  Creates a new fltk3::ColorChooser widget using the given position, size, and
+  label string.
+  The recommended dimensions are 200x95. The color is initialized to black.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::ColorChooser::ColorChooser(int X, int Y, int W, int H, const char* L)
+  : fltk3::Group(0,0,195,115,L),
+    huebox(0,0,115,115),
+    valuebox(115,0,20,115),
+    choice(140,0,55,25),
+    rvalue(140,30,55,25),
+    gvalue(140,60,55,25),
+    bvalue(140,90,55,25),
+    resize_box(0,0,115,115)
+{
+  end();
+  resizable(resize_box);
+  resize(X,Y,W,H);
+  r_ = g_ = b_ = 0;
+  hue_ = 0.0;
+  saturation_ = 0.0;
+  value_ = 0.0;
+  huebox.box(fltk3::DOWN_FRAME);
+  valuebox.box(fltk3::DOWN_FRAME);
+  choice.menu(mode_menu);
+  set_valuators();
+  rvalue.callback(rgb_cb);
+  gvalue.callback(rgb_cb);
+  bvalue.callback(rgb_cb);
+  choice.callback(mode_cb);
+  choice.box(fltk3::THIN_UP_BOX);
+  choice.textfont(fltk3::HELVETICA_BOLD_ITALIC);
+}
+
+////////////////////////////////////////////////////////////////
+// fltk3::color_chooser():
+
+#include <fltk3/Window.h>
+#include <fltk3/Box.h>
+#include <fltk3/ReturnButton.h>
+
+class ColorChip : public fltk3::Widget {
+  void draw();
+public:
+  uchar r,g,b;
+  ColorChip(int X, int Y, int W, int H) : fltk3::Widget(X,Y,W,H) {
+    box(fltk3::ENGRAVED_FRAME);}
+};
+
+void ColorChip::draw() {
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  fltk3::rectf(x()+fltk3::box_dx(box()),
+	   y()+fltk3::box_dy(box()),
+	   w()-fltk3::box_dw(box()),
+	   h()-fltk3::box_dh(box()),r,g,b);
+}
+
+static void chooser_cb(fltk3::Widget* o, void* vv) {
+  fltk3::ColorChooser* c = (fltk3::ColorChooser*)o;
+  ColorChip* v = (ColorChip*)vv;
+  v->r = uchar(255*c->r()+.5);
+  v->g = uchar(255*c->g()+.5);
+  v->b = uchar(255*c->b()+.5);
+  v->damage(fltk3::DAMAGE_EXPOSE);
+}
+
+namespace fltk3 {
+  extern const char* ok;
+  extern const char* cancel;
+}
+
+// fltk3::color_chooser's callback for ok_button (below)
+//  [in] o is a pointer to okay_button (below) 
+//  [in] p is a pointer to an int to receive the return value (1)
+// closes the fltk3::color_chooser window
+static void cc_ok_cb (fltk3::Widget *o, void *p) {
+  *((int *)p) = 1; // set return value
+  o->window()->hide();
+}
+
+// fltk3::color_chooser's callback for cancel_button and window close
+//  [in] o is a pointer to cancel_button (below) _or_ the dialog window
+//  [in] p is a pointer to an int to receive the return value (0)
+// closes the fltk3::color_chooser window
+static void cc_cancel_cb (fltk3::Widget *o, void *p) {
+  *((int *)p) = 0; // set return value
+  if (o->window()) // cancel button
+    o->window()->hide();
+  else // window close
+    o->hide();
+}
+
+/** \addtogroup  group_comdlg 
+    @{ */
+/**
+  \brief Pops up a window to let the user pick an arbitrary RGB color.
+  \note \#include <fltk3/ColorChooser.h>
+  \image html fltk3::color_chooser.jpg 
+  \image latex  fltk3::color_chooser.jpg "fltk3::color_chooser" width=8cm
+  \param[in] name Title label for the window
+  \param[in,out] r, g, b Color components in the range 0.0 to 1.0.
+  \param[in] cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).
+  \retval 1 if user confirms the selection 
+  \retval 0 if user cancels the dialog
+  \relates fltk3::ColorChooser
+ */
+int fltk3::color_chooser(const char* name, double& r, double& g, double& b, int cmode) {
+  int ret = 0;
+  fltk3::Window window(215,200,name);
+  window.callback(cc_cancel_cb,&ret);
+  fltk3::ColorChooser chooser(10, 10, 195, 115);
+  ColorChip ok_color(10, 130, 95, 25);
+  fltk3::ReturnButton ok_button(10, 165, 95, 25, fltk3::ok);
+  ok_button.callback(cc_ok_cb,&ret);
+  ColorChip cancel_color(110, 130, 95, 25);
+  cancel_color.r = uchar(255*r+.5); ok_color.r = cancel_color.r;
+  ok_color.g = cancel_color.g = uchar(255*g+.5);
+  ok_color.b = cancel_color.b = uchar(255*b+.5);
+  fltk3::Button cancel_button(110, 165, 95, 25, fltk3::cancel);
+  cancel_button.callback(cc_cancel_cb,&ret);
+  window.resizable(chooser);
+  chooser.rgb(r,g,b);
+  chooser.callback(chooser_cb, &ok_color);
+  if (cmode!=-1) chooser.mode(cmode);
+  window.end();
+  window.set_modal();
+  window.hotspot(window);
+  window.show();
+  while (window.shown()) fltk3::wait();
+  if (ret) { // ok_button or Enter
+    r = chooser.r();
+    g = chooser.g();
+    b = chooser.b();
+  }
+  return ret;
+}
+
+/**
+  \brief Pops up a window to let the user pick an arbitrary RGB color.
+  \note \#include <fltk3/ColorChooser.h>
+  \image html fltk3::color_chooser.jpg 
+  \image latex  fltk3::color_chooser.jpg "fltk3::color_chooser" width=8cm
+  \param[in] name Title label for the window
+  \param[in,out] r, g, b Color components in the range 0 to 255.
+  \param[in] cmode Optional mode for color chooser. See mode(int). Default -1 if none (rgb mode).
+  \retval 1 if user confirms the selection 
+  \retval 0 if user cancels the dialog
+  \relates fltk3::ColorChooser
+ */
+int fltk3::color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int cmode) {
+  double dr = r/255.0;
+  double dg = g/255.0;
+  double db = b/255.0;
+  if (fltk3::color_chooser(name,dr,dg,db,cmode)) {
+    r = uchar(255*dr+.5);
+    g = uchar(255*dg+.5);
+    b = uchar(255*db+.5);
+    return 1;
+  }
+  return 0;
+}
+
+/** @} */
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Counter.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Counter.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Counter.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Counter.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,213 @@
+//
+// "$Id$"
+//
+// Counter widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Counter.h>
+#include <fltk3/draw.h>
+
+void fltk3::Counter::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int i; fltk3::Boxtype boxtype[5];
+  fltk3::Color selcolor;
+
+  boxtype[0] = box();
+  if (boxtype[0] == fltk3::UP_BOX) boxtype[0] = fltk3::DOWN_BOX;
+  if (boxtype[0] == fltk3::THIN_UP_BOX) boxtype[0] = fltk3::THIN_DOWN_BOX;
+  for (i=1; i<5; i++)
+    if (mouseobj == i)
+      boxtype[i] = fltk3::down(box());
+    else
+      boxtype[i] = box();
+
+  int xx[5], ww[5];
+  if (type() == fltk3::NORMAL_COUNTER) {
+    int W = w()*15/100;
+    xx[1] = x();	 ww[1] = W;
+    xx[2] = x()+1*W;     ww[2] = W;
+    xx[0] = x()+2*W;     ww[0] = w()-4*W;
+    xx[3] = x()+w()-2*W; ww[3] = W;
+    xx[4] = x()+w()-1*W; ww[4] = W;
+  } else {
+    int W = w()*20/100;
+    xx[1] = 0;	         ww[1] = 0;
+    xx[2] = x();	 ww[2] = W;
+    xx[0] = x()+W;	 ww[0] = w()-2*W;
+    xx[3] = x()+w()-1*W; ww[3] = W;
+    xx[4] = 0;	         ww[4] = 0;
+  }
+
+  draw_box(boxtype[0], xx[0], y(), ww[0], h(), fltk3::BACKGROUND2_COLOR);
+  fltk3::font(textfont(), textsize());
+  fltk3::color(active_r() ? textcolor() : fltk3::inactive(textcolor()));
+  char str[128]; format(str);
+  fltk3::draw(str, xx[0], y(), ww[0], h(), fltk3::ALIGN_CENTER);
+  if (fltk3::focus() == this) draw_focus(boxtype[0], xx[0], y(), ww[0], h());
+  if (!(damage()&fltk3::DAMAGE_ALL)) return; // only need to redraw text
+
+  if (active_r())
+    selcolor = labelcolor();
+  else
+    selcolor = fltk3::inactive(labelcolor());
+
+  if (type() == fltk3::NORMAL_COUNTER) {
+    draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
+    fltk3::draw_symbol("@-4<<", xx[1], y(), ww[1], h(), selcolor);
+  }
+  draw_box(boxtype[2], xx[2], y(), ww[2], h(), color());
+  fltk3::draw_symbol("@-4<",  xx[2], y(), ww[2], h(), selcolor);
+  draw_box(boxtype[3], xx[3], y(), ww[3], h(), color());
+  fltk3::draw_symbol("@-4>",  xx[3], y(), ww[3], h(), selcolor);
+  if (type() == fltk3::NORMAL_COUNTER) {
+    draw_box(boxtype[4], xx[4], y(), ww[4], h(), color());
+    fltk3::draw_symbol("@-4>>", xx[4], y(), ww[4], h(), selcolor);
+  }
+}
+
+void fltk3::Counter::increment_cb() {
+  if (!mouseobj) return;
+  double v = value();
+  switch (mouseobj) {
+  case 1: v -= lstep_; break;
+  case 2: v = increment(v, -1); break;
+  case 3: v = increment(v, 1); break;
+  case 4: v += lstep_; break;
+  }
+  handle_drag(clamp(round(v)));
+}
+
+#define INITIALREPEAT .5
+#define REPEAT .1
+
+void fltk3::Counter::repeat_callback(void* v) {
+  fltk3::Counter* b = (fltk3::Counter*)v;
+  if (b->mouseobj) {
+    fltk3::add_timeout(REPEAT, repeat_callback, b);
+    b->increment_cb();
+  }
+}
+
+int fltk3::Counter::calc_mouseobj() {
+  if (type() == fltk3::NORMAL_COUNTER) {
+    int W = w()*15/100;
+    if (fltk3::event_inside(x(), y(), W, h())) return 1;
+    if (fltk3::event_inside(x()+W, y(), W, h())) return 2;
+    if (fltk3::event_inside(x()+w()-2*W, y(), W, h())) return 3;
+    if (fltk3::event_inside(x()+w()-W, y(), W, h())) return 4;
+  } else {
+    int W = w()*20/100;
+    if (fltk3::event_inside(x(), y(), W, h())) return 2;
+    if (fltk3::event_inside(x()+w()-W, y(), W, h())) return 3;
+  }
+  return -1;
+}
+
+int fltk3::Counter::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  int i;
+  switch (event) {
+  case fltk3::RELEASE:
+    if (mouseobj) {
+      fltk3::remove_timeout(repeat_callback, this);
+      mouseobj = 0;
+      redraw();
+    }
+    handle_release();
+    return 1;
+  case fltk3::PUSH:
+    if (fltk3::visible_focus()) fltk3::focus(this);
+    { fltk3::WidgetTracker wp(this);
+      handle_push();
+      if (wp.deleted()) return 1;
+    }
+  case fltk3::DRAG:
+    i = calc_mouseobj();
+    if (i != mouseobj) {
+      fltk3::remove_timeout(repeat_callback, this);
+      mouseobj = (uchar)i;
+      if (i) fltk3::add_timeout(INITIALREPEAT, repeat_callback, this);
+      fltk3::WidgetTracker wp(this);
+      increment_cb();
+      if (wp.deleted()) return 1;
+      redraw();
+    }
+    return 1;
+  case fltk3::KEYBOARD :
+    switch (fltk3::event_key()) {
+      case fltk3::LeftKey:
+	handle_drag(clamp(increment(value(),-1)));
+	return 1;
+      case fltk3::RightKey:
+	handle_drag(clamp(increment(value(),1)));
+	return 1;
+      default:
+        return 0;
+    }
+    // break not required because of switch...
+  case fltk3::FOCUS : /* FALLTHROUGH */
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    } else return 0;
+  case fltk3::ENTER : /* FALLTHROUGH */
+  case fltk3::LEAVE :
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+/**
+  Destroys the valuator.
+ */
+fltk3::Counter::~Counter() {
+  fltk3::remove_timeout(repeat_callback, this);
+}
+
+/**
+  Creates a new fltk3::Counter widget using the given position, size, and label
+  string. The default type is fltk3::NORMAL_COUNTER.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+ */
+fltk3::Counter::Counter(int X, int Y, int W, int H, const char* L)
+  : fltk3::Valuator(X, Y, W, H, L) {
+  box(fltk3::UP_BOX);
+  selection_color(fltk3::INACTIVE_COLOR); // was fltk3::BLUE
+  align(fltk3::ALIGN_BOTTOM);
+  bounds(-1000000.0, 1000000.0);
+  Valuator::step(1, 10);
+  lstep_ = 1.0;
+  mouseobj = 0;
+  textfont(fltk3::HELVETICA);
+  textsize(fltk3::NORMAL_SIZE);
+  textcolor(fltk3::FOREGROUND_COLOR);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Device.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Device.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Device.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Device.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,92 @@
+//
+// "$Id$"
+//
+// implementation of fltk3::Device class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Device.h>
+#include <fltk3/Image.h>
+
+const char *fltk3::Device::class_id = "fltk3::Device";
+const char *fltk3::SurfaceDevice::class_id = "fltk3::SurfaceDevice";
+const char *fltk3::DisplayDevice::class_id = "fltk3::DisplayDevice";
+const char *fltk3::GraphicsDriver::class_id = "fltk3::GraphicsDriver";
+#if defined(__APPLE__) || defined(FLTK3_DOXYGEN)
+const char *fltk3::QuartzGraphicsDriver::class_id = "fltk3::QuartzGraphicsDriver";
+#endif
+#if defined(WIN32) || defined(FLTK3_DOXYGEN)
+const char *fltk3::GDIGraphicsDriver::class_id = "fltk3::GDIGraphicsDriver";
+#endif
+#if !(defined(__APPLE__) || defined(WIN32))
+namespace fltk3 {
+  const char *XlibGraphicsDriver::class_id = "fltk3::XlibGraphicsDriver";
+}
+#endif
+
+
+/** \brief Use this drawing surface for future graphics requests. */
+void fltk3::SurfaceDevice::set_current(void)
+{
+  fltk3::graphics_driver = _driver;
+  _surface = this;
+}
+
+const fltk3::GraphicsDriver::matrix fltk3::GraphicsDriver::m0 = {1, 0, 0, 1, 0, 0};
+
+fltk3::GraphicsDriver::GraphicsDriver() {
+  font_ = 0;
+  size_ = 0;
+  sptr=0; rstackptr=0; 
+  fl_clip_state_number=0;
+  m = m0; 
+  fl_matrix = &m; 
+  p = (XPOINT *)0;
+  font_descriptor_ = NULL;
+};
+
+void fltk3::GraphicsDriver::text_extents(const char*t, int n, int& dx, int& dy, int& w, int& h)
+{
+  w = (int)width(t, n);
+  h = - height();
+  dx = 0;
+  dy = descent();
+}
+
+fltk3::DisplayDevice::DisplayDevice(fltk3::GraphicsDriver *graphics_driver) : fltk3::SurfaceDevice( graphics_driver) {
+#ifdef __APPLE__
+  SInt32 versionMajor = 0;
+  SInt32 versionMinor = 0;
+  SInt32 versionBugFix = 0;
+  Gestalt( gestaltSystemVersionMajor, &versionMajor );
+  Gestalt( gestaltSystemVersionMinor, &versionMinor );
+  Gestalt( gestaltSystemVersionBugFix, &versionBugFix );
+  fl_mac_os_version = versionMajor * 10000 + versionMinor * 100 + versionBugFix;
+#endif
+};
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Dial.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Dial.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Dial.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Dial.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,169 @@
+//
+// "$Id$"
+//
+// Circular dial widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Dial.h>
+#include <fltk3/draw.h>
+#include <stdlib.h>
+#include <fltk3/math.h>
+#include <fltk3/Wrapper.h>
+
+// All angles are measured with 0 to the right and counter-clockwise
+/**
+  Draws dial at given position and size.
+  \param[in] X, Y, W, H position and size
+*/
+void fltk3::Dial::draw(int X, int Y, int W, int H) {
+  if (damage()&fltk3::DAMAGE_ALL) draw_box(box(), X, Y, W, H, color());
+  X += fltk3::box_dx(box());
+  Y += fltk3::box_dy(box());
+  W -= fltk3::box_dw(box());
+  H -= fltk3::box_dh(box());
+  double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
+  if (type() == fltk3::FILL_DIAL) {
+    // foo: draw this nicely in certain round box types
+    int foo = (box() > fltk3::ROUND_UP_BOX && fltk3::box_dx(box()));
+    if (foo) {X--; Y--; W+=2; H+=2;}
+    if (active_r()) fltk3::color(color());
+    else fltk3::color(fltk3::inactive(color()));
+    fltk3::pie(X, Y, W, H, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle);
+    if (active_r()) fltk3::color(selection_color());
+    else fltk3::color(fltk3::inactive(selection_color()));
+    fltk3::pie(X, Y, W, H, 270-angle, 270-a1);
+    if (foo) {
+      if (active_r()) fltk3::color(fltk3::FOREGROUND_COLOR);
+      else fltk3::color(fltk3::inactive(fltk3::FOREGROUND_COLOR));
+      fltk3::arc(X, Y, W, H, 0, 360);
+    }
+    return;
+  }
+  if (!(damage()&fltk3::DAMAGE_ALL)) {
+    if (active_r()) fltk3::color(color());
+    else fltk3::color(fltk3::inactive(color()));
+    fltk3::pie(X+1, Y+1, W-2, H-2, 0, 360);
+  }
+  fltk3::push_matrix();
+  fltk3::translate(X+W/2-.5, Y+H/2-.5);
+  fltk3::scale(W-1, H-1);
+  fltk3::rotate(45-angle);
+  if (active_r()) fltk3::color(selection_color());
+  else fltk3::color(fltk3::inactive(selection_color()));
+  if (type()) { // fltk3::LINE_DIAL
+    fltk3::begin_polygon();
+    fltk3::vertex(0.0,   0.0);
+    fltk3::vertex(-0.04, 0.0);
+    fltk3::vertex(-0.25, 0.25);
+    fltk3::vertex(0.0,   0.04);
+    fltk3::end_polygon();
+    if (active_r()) fltk3::color(fltk3::FOREGROUND_COLOR);
+    else fltk3::color(fltk3::inactive(fltk3::FOREGROUND_COLOR));
+    fltk3::begin_loop();
+    fltk3::vertex(0.0,   0.0);
+    fltk3::vertex(-0.04, 0.0);
+    fltk3::vertex(-0.25, 0.25);
+    fltk3::vertex(0.0,   0.04);
+    fltk3::end_loop();
+  } else {
+    fltk3::begin_polygon(); fltk3::circle(-0.20, 0.20, 0.07); fltk3::end_polygon();
+    if (active_r()) fltk3::color(fltk3::FOREGROUND_COLOR);
+    else fltk3::color(fltk3::inactive(fltk3::FOREGROUND_COLOR));
+    fltk3::begin_loop(); fltk3::circle(-0.20, 0.20, 0.07); fltk3::end_loop();
+  }
+  fltk3::pop_matrix();
+}
+
+/**
+  Draws dial at current position and size.
+*/
+void fltk3::Dial::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  draw(x(), y(), w(), h());
+  draw_label();
+}
+
+/**
+  Allows subclasses to handle event based on given position and size.
+  \param[in] event, X, Y, W, H event to handle, related position and size.
+*/
+int fltk3::Dial::handle(int event, int X, int Y, int W, int H) {
+  switch (event) {
+  case fltk3::PUSH: {
+    fltk3::WidgetTracker wp(this);  
+    handle_push();
+    if (wp.deleted()) return 1; }
+  case fltk3::DRAG: {
+    int mx = (fltk3::event_x()-X-W/2)*H;
+    int my = (fltk3::event_y()-Y-H/2)*W;
+    if (!mx && !my) return 1;
+    double angle = 270-atan2((float)-my, (float)mx)*180/M_PI;
+    double oldangle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1;
+    while (angle < oldangle-180) angle += 360;
+    while (angle > oldangle+180) angle -= 360;
+    double val;
+    if ((a1<a2) ? (angle <= a1) : (angle >= a1)) {
+      val = minimum();
+    } else if ((a1<a2) ? (angle >= a2) : (angle <= a2)) {
+      val = maximum();
+    } else {
+      val = minimum() + (maximum()-minimum())*(angle-a1)/(a2-a1);
+    }
+    handle_drag(clamp(round(val)));
+  } return 1;
+  case fltk3::RELEASE:
+    handle_release();
+    return 1;
+  case fltk3::ENTER : /* FALLTHROUGH */
+  case fltk3::LEAVE :
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+/**
+  Allow subclasses to handle event based on current position and size.
+*/
+int fltk3::Dial::handle(int e) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+  return handle(e, x(), y(), w(), h());
+}
+
+/**
+ Creates a new fltk3::Dial widget using the given position, size,
+ and label string. The default type is fltk3::NORMAL_DIAL.
+ */
+fltk3::Dial::Dial(int X, int Y, int W, int H, const char* l)
+: fltk3::Valuator(X, Y, W, H, l) {
+  box(fltk3::OVAL_BOX);
+  selection_color(fltk3::INACTIVE_COLOR); // was 37
+  a1 = 45;
+  a2 = 315;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/DoubleWindow.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Double_Window.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/DoubleWindow.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/DoubleWindow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,465 @@
+//
+// "$Id$"
+//
+// Double-buffered window code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/DoubleWindow.h>
+#include <fltk3/Printer.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+
+
+// On systems that support double buffering "naturally" the base
+// fltk3::Window class will probably do double-buffer and this subclass
+// does nothing.
+
+#if USE_XDBE
+
+#include <X11/extensions/Xdbe.h>
+
+static int use_xdbe;
+
+static int can_xdbe() {
+  static int tried;
+  if (!tried) {
+    tried = 1;
+    int event_base, error_base;
+    if (!XdbeQueryExtension(fl_display, &event_base, &error_base)) return 0;
+    Drawable root = RootWindow(fl_display,fl_screen);
+    int numscreens = 1;
+    XdbeScreenVisualInfo *a = XdbeGetVisualInfo(fl_display,&root,&numscreens);
+    if (!a) return 0;
+    for (int j = 0; j < a->count; j++) {
+      if (a->visinfo[j].visual == fl_visual->visualid
+	  /*&& a->visinfo[j].perflevel > 0*/) {
+        use_xdbe = 1; break;
+      }
+    }
+    XdbeFreeVisualInfo(a);
+  }
+  return use_xdbe;
+}
+#endif
+
+void fltk3::DoubleWindow::show() {
+  Window::show();
+}
+
+static void fl_copy_offscreen_to_display(int x, int y, int w, int h, fltk3::Offscreen pixmap, int srcx, int srcy);
+
+/** \addtogroup fl_drawings
+ @{
+ */
+/** Copy a rectangular area of the given offscreen buffer into the current drawing destination.
+ \param x,y	position where to draw the copied rectangle
+ \param w,h	size of the copied rectangle
+ \param pixmap  offscreen buffer containing the rectangle to copy
+ \param srcx,srcy origin in offscreen buffer of rectangle to copy
+ */
+void fl_copy_offscreen(int x, int y, int w, int h, fltk3::Offscreen pixmap, int srcx, int srcy) {
+  if (fltk3::graphics_driver == fltk3::DisplayDevice::display_device()->driver()) {
+    fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
+  }
+  else { // when copy is not to the display
+    fl_begin_offscreen(pixmap);
+    uchar *img = fltk3::read_image(NULL, srcx, srcy, w, h, 0);
+    fl_end_offscreen();
+    fltk3::draw_image(img, x, y, w, h, 3, 0);
+    delete[] img;
+  }
+}
+/** @} */
+
+#if defined(USE_X11)
+
+static void fl_copy_offscreen_to_display(int x, int y, int w, int h, fltk3::Offscreen pixmap, int srcx, int srcy) {
+  XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
+}
+
+
+// maybe someone feels inclined to implement alpha blending on X11?
+char fltk3::can_do_alpha_blending() {
+  return 0;
+}
+#elif defined(WIN32)
+
+// Code used to switch output to an off-screen window.  See macros in
+// win32.h which save the old state in local variables.
+
+typedef struct { BYTE a; BYTE b; BYTE c; BYTE d; } FL_BLENDFUNCTION;
+typedef BOOL (WINAPI* fl_alpha_blend_func)
+    (HDC,int,int,int,int,HDC,int,int,int,int,FL_BLENDFUNCTION);
+static fl_alpha_blend_func fl_alpha_blend = NULL;
+static FL_BLENDFUNCTION blendfunc = { 0, 0, 255, 1};
+
+/*
+ * This function checks if the version of MSWindows that we
+ * curently run on supports alpha blending for bitmap transfers
+ * and finds the required function if so.
+ */
+char fltk3::can_do_alpha_blending() {
+  static char been_here = 0;
+  static char can_do = 0;
+  // do this test only once
+  if (been_here) return can_do;
+  been_here = 1;
+  // load the library that implements alpha blending
+  HMODULE hMod = LoadLibrary("MSIMG32.DLL");
+  // give up if that doesn't exist (Win95?)
+  if (!hMod) return 0;
+  // now find the blending function inside that dll
+  fl_alpha_blend = (fl_alpha_blend_func)GetProcAddress(hMod, "AlphaBlend");
+  // give up if we can't find it (Win95)
+  if (!fl_alpha_blend) return 0;
+  // we have the call, but does our display support alpha blending?
+  // get the desktop's device context
+  HDC dc = GetDC(0L);
+  if (!dc) return 0;
+  // check the device capabilities flags. However GetDeviceCaps
+  // does not return anything useful, so we have to do it manually:
+
+  HBITMAP bm = CreateCompatibleBitmap(dc, 1, 1);
+  HDC new_gc = CreateCompatibleDC(dc);
+  int save = SaveDC(new_gc);
+  SelectObject(new_gc, bm);
+  /*COLORREF set = */ SetPixel(new_gc, 0, 0, 0x01010101);
+  BOOL alpha_ok = fl_alpha_blend(dc, 0, 0, 1, 1, new_gc, 0, 0, 1, 1, blendfunc);
+  RestoreDC(new_gc, save);
+  DeleteDC(new_gc);
+  DeleteObject(bm);
+  ReleaseDC(0L, dc);
+
+  if (alpha_ok) can_do = 1;
+  return can_do;
+}
+
+HDC fl_makeDC(HBITMAP bitmap) {
+  HDC new_gc = CreateCompatibleDC(fl_gc);
+  SetTextAlign(new_gc, TA_BASELINE|TA_LEFT);
+  SetBkMode(new_gc, TRANSPARENT);
+#if USE_COLORMAP
+  if (fl_palette) SelectPalette(new_gc, fl_palette, FALSE);
+#endif
+  SelectObject(new_gc, bitmap);
+  return new_gc;
+}
+
+static void fl_copy_offscreen_to_display(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) {
+  HDC new_gc = CreateCompatibleDC(fl_gc);
+  int save = SaveDC(new_gc);
+  SelectObject(new_gc, bitmap);
+  BitBlt(fl_gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY);
+  RestoreDC(new_gc, save);
+  DeleteDC(new_gc);
+}
+
+void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) {
+  HDC new_gc = CreateCompatibleDC(fl_gc);
+  int save = SaveDC(new_gc);
+  SelectObject(new_gc, bitmap);
+  BOOL alpha_ok = 0;
+  // first try to alpha blend
+  // if to printer, always try alpha_blend
+  int to_display = fltk3::SurfaceDevice::surface()->class_name() == fltk3::DisplayDevice::class_id; // true iff display output
+  if ( (to_display && fltk3::can_do_alpha_blending()) || fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+    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 (!alpha_ok) {
+    BitBlt(fl_gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY);
+  }
+  RestoreDC(new_gc, save);
+  DeleteDC(new_gc);
+}
+
+extern void fltk3::restore_clip();
+
+#elif defined(__APPLE_QUARTZ__) || defined(FLTK3_DOXYGEN)
+
+char fltk3::can_do_alpha_blending() {
+  return 1;
+}
+
+fltk3::Offscreen fl_create_offscreen_with_alpha(int w, int h) {
+  void *data = calloc(w*h,4);
+  CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+  CGContextRef ctx = CGBitmapContextCreate(
+    data, w, h, 8, w*4, lut, kCGImageAlphaPremultipliedLast);
+  CGColorSpaceRelease(lut);
+  return (fltk3::Offscreen)ctx;
+}
+
+/** \addtogroup fl_drawings
+ @{
+ */
+
+/** 
+  Creation of an offscreen graphics buffer.
+ \param w,h     width and height in pixels of the buffer.
+ \return    the created graphics buffer.
+ */
+fltk3::Offscreen fl_create_offscreen(int w, int h) {
+  void *data = calloc(w*h,4);
+  CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+  CGContextRef ctx = CGBitmapContextCreate(
+    data, w, h, 8, w*4, lut, kCGImageAlphaNoneSkipLast);
+  CGColorSpaceRelease(lut);
+  return (fltk3::Offscreen)ctx;
+}
+
+static void bmProviderRelease (void *src, const void *data, size_t size) {
+  CFIndex count = CFGetRetainCount(src);
+  CFRelease(src);
+  if(count == 1) free((void*)data);
+}
+
+static void fl_copy_offscreen_to_display(int x,int y,int w,int h,fltk3::Offscreen osrc,int srcx,int srcy) {
+  CGContextRef src = (CGContextRef)osrc;
+  void *data = CGBitmapContextGetData(src);
+  int sw = CGBitmapContextGetWidth(src);
+  int sh = CGBitmapContextGetHeight(src);
+  CGImageAlphaInfo alpha = CGBitmapContextGetAlphaInfo(src);
+  CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+  // when output goes to a Quartz printercontext, release of the bitmap must be
+  // delayed after the end of the print page
+  CFRetain(src);
+  CGDataProviderRef src_bytes = CGDataProviderCreateWithData( src, data, sw*sh*4, bmProviderRelease);
+  CGImageRef img = CGImageCreate( sw, sh, 8, 4*8, 4*sw, lut, alpha,
+    src_bytes, 0L, false, kCGRenderingIntentDefault);
+  // fltk3::push_clip();
+  CGRect rect = { { x, y }, { w, h } };
+  Fl_X::q_begin_image(rect, srcx, srcy, sw, sh);
+  CGContextDrawImage(fl_gc, rect, img);
+  Fl_X::q_end_image();
+  CGImageRelease(img);
+  CGColorSpaceRelease(lut);
+  CGDataProviderRelease(src_bytes);
+}
+
+/**  Deletion of an offscreen graphics buffer.
+ \param ctx     the buffer to be deleted.
+ */
+void fl_delete_offscreen(fltk3::Offscreen ctx) {
+  if (!ctx) return;
+  void *data = CGBitmapContextGetData((CGContextRef)ctx);
+  CFIndex count = CFGetRetainCount(ctx);
+  CGContextRelease((CGContextRef)ctx);
+  if(count == 1) free(data);
+}
+
+const int stack_max = 16;
+static int stack_ix = 0;
+static CGContextRef stack_gc[stack_max];
+static Window stack_window[stack_max];
+static fltk3::SurfaceDevice *_ss;
+
+/**  Send all subsequent drawing commands to this offscreen buffer.
+ \param ctx     the offscreen buffer.
+ */
+void fl_begin_offscreen(fltk3::Offscreen ctx) {
+  _ss = fltk3::SurfaceDevice::surface(); 
+  fltk3::DisplayDevice::display_device()->set_current();
+  if (stack_ix<stack_max) {
+    stack_gc[stack_ix] = fl_gc;
+    stack_window[stack_ix] = fl_window;
+  } else 
+    fprintf(stderr, "FLTK CGContext Stack overflow error\n");
+  stack_ix++;
+
+  fl_gc = (CGContextRef)ctx;
+  fl_window = 0;
+  CGContextSaveGState(fl_gc);
+  fltk3::push_no_clip();
+}
+
+/** Quit sending drawing commands to the current offscreen buffer.
+ */
+void fl_end_offscreen() {
+  Fl_X::q_release_context();
+  fltk3::pop_clip();
+  if (stack_ix>0)
+    stack_ix--;
+  else
+    fprintf(stderr, "FLTK CGContext Stack underflow error\n");
+  if (stack_ix<stack_max) {
+    fl_gc = stack_gc[stack_ix];
+    fl_window = stack_window[stack_ix];
+  }
+  _ss->set_current();
+}
+
+/** @} */
+
+namespace fltk3 {
+  extern void restore_clip();
+}
+
+#else
+# error unsupported platform
+#endif
+
+/**
+  Forces the window to be redrawn.
+*/
+void fltk3::DoubleWindow::flush() {flush(0);}
+
+/**
+  Forces the window to be redrawn.
+  \param[in] eraseoverlay non-zero to erase overlay, zero to ignore
+
+  fltk3::OverlayWindow relies on flush(1) copying the back buffer to the
+  front everywhere, even if damage() == 0, thus erasing the overlay,
+  and leaving the clip region set to the entire window.
+*/
+void fltk3::DoubleWindow::flush(int eraseoverlay) {
+  make_current(); // make sure fl_gc is non-zero
+  Fl_X *myi = Fl_X::i(this);
+  if (!myi->other_xid) {
+#if USE_XDBE
+    if (can_xdbe()) {
+      myi->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeCopied);
+      myi->backbuffer_bad = 1;
+    } else
+#endif
+#if defined(USE_X11) || defined(WIN32)
+    myi->other_xid = fl_create_offscreen(w(), h());
+    clear_damage(fltk3::DAMAGE_ALL);
+#elif defined(__APPLE_QUARTZ__)
+    if (force_doublebuffering_) {
+      myi->other_xid = fl_create_offscreen(w(), h());
+      clear_damage(fltk3::DAMAGE_ALL);
+    }
+#else
+# error unsupported platform
+#endif
+  }
+#if USE_XDBE
+  if (use_xdbe) {
+    if (myi->backbuffer_bad || eraseoverlay) {
+      // Make sure we do a complete redraw...
+      if (myi->region) {XDestroyRegion(myi->region); myi->region = 0;}
+      clear_damage(fltk3::DAMAGE_ALL);
+      myi->backbuffer_bad = 0;
+    }
+
+    // Redraw as needed...
+    if (damage()) {
+      fltk3::clip_region(myi->region); myi->region = 0;
+      fl_window = myi->other_xid;
+      draw();
+      fl_window = myi->xid;
+    }
+
+    // Copy contents of back buffer to window...
+    XdbeSwapInfo s;
+    s.swap_window = fl_xid(this);
+    s.swap_action = XdbeCopied;
+    XdbeSwapBuffers(fl_display, &s, 1);
+    return;
+  } else
+#endif
+    if (damage() & ~fltk3::DAMAGE_EXPOSE) {
+    fltk3::clip_region(myi->region); myi->region = 0;
+#ifdef WIN32
+    HDC _sgc = fl_gc;
+    fl_gc = fl_makeDC(myi->other_xid);
+    int save = SaveDC(fl_gc);
+    fltk3::restore_clip(); // duplicate region into new gc
+    draw();
+    RestoreDC(fl_gc, save);
+    DeleteDC(fl_gc);
+    fl_gc = _sgc;
+    //# if defined(FLTK_USE_CAIRO)
+    //if fltk3::cairo_autolink_context() fltk3::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+    //# endif
+#elif defined(__APPLE__)
+    if ( myi->other_xid ) {
+      fl_begin_offscreen( myi->other_xid );
+      fltk3::clip_region( 0 );   
+      draw();
+      fl_end_offscreen();
+    } else {
+      draw();
+    }
+#else // X:
+    fl_window = myi->other_xid;
+    draw();
+    fl_window = myi->xid;
+#endif
+  }
+  if (eraseoverlay) fltk3::clip_region(0);
+  // on Irix (at least) it is faster to reduce the area copied to
+  // the current clip region:
+  int X,Y,W,H; fltk3::clip_box(0,0,w(),h(),X,Y,W,H);
+  if (myi->other_xid) fl_copy_offscreen(X, Y, W, H, myi->other_xid, X, Y);
+}
+
+void fltk3::DoubleWindow::resize(int X,int Y,int W,int H) {
+  int ow = w();
+  int oh = h();
+  Window::resize(X,Y,W,H);
+#if USE_XDBE
+  if (use_xdbe) {
+    Fl_X* myi = Fl_X::i(this);
+    if (myi && myi->other_xid && (ow < w() || oh < h())) {
+      // STR #2152: Deallocate the back buffer to force creation of a new one.
+      XdbeDeallocateBackBufferName(fl_display,myi->other_xid);
+      myi->other_xid = 0;
+    }
+    return;
+  }
+#endif
+  Fl_X* myi = Fl_X::i(this);
+  if (myi && myi->other_xid && (ow != w() || oh != h())) {
+    fl_delete_offscreen(myi->other_xid);
+    myi->other_xid = 0;
+  }
+}
+
+void fltk3::DoubleWindow::hide() {
+  Fl_X* myi = Fl_X::i(this);
+  if (myi && myi->other_xid) {
+#if USE_XDBE
+    if (!use_xdbe)
+#endif
+      fl_delete_offscreen(myi->other_xid);
+  }
+  Window::hide();
+}
+
+/**
+  The destructor <I>also deletes all the children</I>. This allows a
+  whole tree to be deleted at once, without having to keep a pointer to
+  all the children in the user code.
+*/
+fltk3::DoubleWindow::~DoubleWindow() {
+  hide();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/FileBrowser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Browser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/FileBrowser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileBrowser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,643 @@
+//
+// "$Id$"
+//
+// fltk3::FileBrowser routines.
+//
+// Copyright 1999-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::FileBrowser::full_height()     - Return the height of the list.
+//   fltk3::FileBrowser::item_height()     - Return the height of a list item.
+//   fltk3::FileBrowser::item_width()      - Return the width of a list item.
+//   fltk3::FileBrowser::item_draw()       - Draw a list item.
+//   fltk3::FileBrowser::fltk3::FileBrowser() - Create a fltk3::FileBrowser widget.
+//   fltk3::FileBrowser::load()            - Load a directory into the browser.
+//   fltk3::FileBrowser::filter()          - Set the filename filter.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/FileBrowser.h>
+#include <fltk3/draw.h>
+#include <fltk3/filename.h>
+#include <fltk3/Image.h>	// icon
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+#ifdef __CYGWIN__
+#  include <mntent.h>
+#elif defined(WIN32)
+#  include <windows.h>
+#  include <direct.h>
+// Apparently Borland C++ defines DIRECTORY in <direct.h>, which
+// interfers with the fltk3::FileIcon enumeration of the same name.
+#  ifdef DIRECTORY
+#    undef DIRECTORY
+#  endif // DIRECTORY
+#endif // __CYGWIN__
+
+#ifdef __EMX__
+#  define  INCL_DOS
+#  define  INCL_DOSMISC
+#  include <os2.h>
+#endif // __EMX__
+
+#if defined(__APPLE__)
+#  include <sys/param.h>
+#  include <sys/ucred.h>
+#  include <sys/mount.h>
+#endif // __APPLE__
+
+//
+// fltk3::BrowserLine_ definition from "fltk3::Browser.cxx"...
+//
+
+#define SELECTED 1
+#define NOTDISPLAYED 2
+
+// TODO -- Warning: The definition of fltk3::BrowserLine_ here is a hack.
+//    fltk3::FileBrowser should not do this. PLEASE FIX.
+//    fltk3::BrowserLine_ should be private to fltk3::Browser, and not re-defined here.
+//    For now, make sure this struct is precisely consistent with fltk3::Browser.cxx.
+//
+struct fltk3::BrowserLine_			// data is in a linked list of these
+{
+  fltk3::BrowserLine_	*prev;		// Previous item in list
+  fltk3::BrowserLine_	*next;		// Next item in list
+  void		*data;		// Pointer to data (function)
+  fltk3::Image      *icon;		// Pointer to optional icon
+  short		length;		// sizeof(txt)-1, may be longer than string
+  char		flags;		// selected, displayed
+  char		txt[1];		// start of allocated array
+};
+
+
+//
+// 'fltk3::FileBrowser::full_height()' - Return the height of the list.
+//
+
+int					// O - Height in pixels
+fltk3::FileBrowser::full_height() const
+{
+  int	i,				// Looping var
+	th;				// Total height of list.
+
+
+  for (i = 0, th = 0; i < size(); i ++)
+    th += item_height(find_line(i));
+
+  return (th);
+}
+
+
+//
+// 'fltk3::FileBrowser::item_height()' - Return the height of a list item.
+//
+
+int					// O - Height in pixels
+fltk3::FileBrowser::item_height(void *p) const	// I - List item data
+{
+  fltk3::BrowserLine_	*line;			// Pointer to line
+  char		*t;			// Pointer into text
+  int		height;			// Width of line
+  int		textheight;		// Height of text
+
+
+  // Figure out the standard text height...
+  fltk3::font(textfont(), textsize());
+  textheight = fltk3::height();
+
+  // We always have at least 1 line...
+  height = textheight;
+
+  // Scan for newlines...
+  line = (fltk3::BrowserLine_ *)p;
+
+  if (line != NULL)
+    for (t = line->txt; *t != '\0'; t ++)
+      if (*t == '\n')
+	height += textheight;
+
+  // If we have enabled icons then add space for them...
+  if (fltk3::FileIcon::first() != NULL && height < iconsize_)
+    height = iconsize_;
+
+  // Add space for the selection border..
+  height += 2;
+
+  // Return the height
+  return (height);
+}
+
+
+//
+// 'fltk3::FileBrowser::item_width()' - Return the width of a list item.
+//
+
+int					// O - Width in pixels
+fltk3::FileBrowser::item_width(void *p) const	// I - List item data
+{
+  int		i;			// Looping var
+  fltk3::BrowserLine_	*line;			// Pointer to line
+  char		*t,			// Pointer into text
+		*ptr,			// Pointer into fragment
+		fragment[10240];	// Fragment of text
+  int		width,			// Width of line
+		tempwidth;		// Width of fragment
+  int		column;			// Current column
+  const int	*columns;		// Columns
+
+
+  // Scan for newlines...
+  line    = (fltk3::BrowserLine_ *)p;
+  columns = column_widths();
+
+  // Set the font and size...
+  if (line->txt[strlen(line->txt) - 1] == '/')
+    fltk3::font(textfont() | fltk3::BOLD, textsize());
+  else
+    fltk3::font(textfont(), textsize());
+
+  if (strchr(line->txt, '\n') == NULL &&
+      strchr(line->txt, column_char()) == NULL)
+  {
+    // Do a fast width calculation...
+    width = (int)fltk3::width(line->txt);
+  }
+  else
+  {
+    // More than 1 line or have columns; find the maximum width...
+    width     = 0;
+    tempwidth = 0;
+    column    = 0;
+
+    for (t = line->txt, ptr = fragment; *t != '\0'; t ++)
+      if (*t == '\n')
+      {
+        // Newline - nul terminate this fragment and get the width...
+        *ptr = '\0';
+
+	tempwidth += (int)fltk3::width(fragment);
+
+        // Update the max width as needed...
+	if (tempwidth > width)
+	  width = tempwidth;
+
+        // Point back to the start of the fragment...
+	ptr       = fragment;
+	tempwidth = 0;
+	column    = 0;
+      }
+      else if (*t == column_char())
+      {
+        // Advance to the next column...
+        column ++;
+	if (columns)
+	{
+	  for (i = 0, tempwidth = 0; i < column && columns[i]; i ++)
+	    tempwidth += columns[i];
+	}
+	else
+          tempwidth = column * (int)(fltk3::height() * 0.6 * 8.0);
+
+        if (tempwidth > width)
+	  width = tempwidth;
+
+	ptr = fragment;
+      }
+      else
+        *ptr++ = *t;
+
+    if (ptr > fragment)
+    {
+      // Nul terminate this fragment and get the width...
+      *ptr = '\0';
+
+      tempwidth += (int)fltk3::width(fragment);
+
+      // Update the max width as needed...
+      if (tempwidth > width)
+	width = tempwidth;
+    }
+  }
+
+  // If we have enabled icons then add space for them...
+  if (fltk3::FileIcon::first() != NULL)
+    width += iconsize_ + 8;
+
+  // Add space for the selection border..
+  width += 2;
+
+  // Return the width
+  return (width);
+}
+
+
+//
+// 'fltk3::FileBrowser::item_draw()' - Draw a list item.
+//
+
+void
+fltk3::FileBrowser::item_draw(void *p,	// I - List item data
+                 	   int  X,	// I - Upper-lefthand X coordinate
+		 	   int  Y,	// I - Upper-lefthand Y coordinate
+		 	   int  W,	// I - Width of item
+			   int) const	// I - Height of item
+{
+  int		i;			// Looping var
+  fltk3::BrowserLine_	*line;			// Pointer to line
+  fltk3::Color	c;			// Text color
+  char		*t,			// Pointer into text
+		*ptr,			// Pointer into fragment
+		fragment[10240];	// Fragment of text
+  int		width,			// Width of line
+		height;			// Height of line
+  int		column;			// Current column
+  const int	*columns;		// Columns
+
+
+  // Draw the list item text...
+  line = (fltk3::BrowserLine_ *)p;
+
+  if (line->txt[strlen(line->txt) - 1] == '/')
+    fltk3::font(textfont() | fltk3::BOLD, textsize());
+  else
+    fltk3::font(textfont(), textsize());
+
+  if (line->flags & SELECTED)
+    c = fltk3::contrast(textcolor(), selection_color());
+  else
+    c = textcolor();
+
+  if (fltk3::FileIcon::first() == NULL)
+  {
+    // No icons, just draw the text...
+    X ++;
+    W -= 2;
+  }
+  else
+  {
+    // Draw the icon if it is set...
+    if (line->data)
+      ((fltk3::FileIcon *)line->data)->draw(X, Y, iconsize_, iconsize_,
+                                	(line->flags & SELECTED) ? fltk3::YELLOW :
+				                                   fltk3::LIGHT2,
+					active_r());
+
+    // Draw the text offset to the right...
+    X += iconsize_ + 9;
+    W -= iconsize_ - 10;
+
+    // Center the text vertically...
+    height = fltk3::height();
+
+    for (t = line->txt; *t != '\0'; t ++)
+      if (*t == '\n')
+	height += fltk3::height();
+
+    if (height < iconsize_)
+      Y += (iconsize_ - height) / 2;
+  }
+
+  // Draw the text...
+  line    = (fltk3::BrowserLine_ *)p;
+  columns = column_widths();
+  width   = 0;
+  column  = 0;
+
+  if (active_r())
+    fltk3::color(c);
+  else
+    fltk3::color(fltk3::inactive(c));
+
+  for (t = line->txt, ptr = fragment; *t != '\0'; t ++)
+    if (*t == '\n')
+    {
+      // Newline - nul terminate this fragment and draw it...
+      *ptr = '\0';
+
+      fltk3::draw(fragment, X + width, Y, W - width, fltk3::height(),
+              (fltk3::Align)(fltk3::ALIGN_LEFT | fltk3::ALIGN_CLIP), 0, 0);
+
+      // Point back to the start of the fragment...
+      ptr    = fragment;
+      width  = 0;
+      Y      += fltk3::height();
+      column = 0;
+    }
+    else if (*t == column_char())
+    {
+      // Tab - nul terminate this fragment and draw it...
+      *ptr = '\0';
+
+      int cW = W - width; // Clip width...
+
+      if (columns)
+      {
+        // Try clipping inside this column...
+	for (i = 0; i < column && columns[i]; i ++);
+
+        if (columns[i])
+          cW = columns[i];
+      }
+
+      fltk3::draw(fragment, X + width, Y, cW, fltk3::height(),
+              (fltk3::Align)(fltk3::ALIGN_LEFT | fltk3::ALIGN_CLIP), 0, 0);
+
+      // Advance to the next column...
+      column ++;
+      if (columns)
+      {
+	for (i = 0, width = 0; i < column && columns[i]; i ++)
+	  width += columns[i];
+      }
+      else
+        width = column * (int)(fltk3::height() * 0.6 * 8.0);
+
+      ptr = fragment;
+    }
+    else
+      *ptr++ = *t;
+
+  if (ptr > fragment)
+  {
+    // Nul terminate this fragment and draw it...
+    *ptr = '\0';
+
+    fltk3::draw(fragment, X + width, Y, W - width, fltk3::height(),
+            (fltk3::Align)(fltk3::ALIGN_LEFT | fltk3::ALIGN_CLIP), 0, 0);
+  }
+}
+
+
+//
+// 'fltk3::FileBrowser::fltk3::FileBrowser()' - Create a fltk3::FileBrowser widget.
+//
+
+fltk3::FileBrowser::FileBrowser(int        X,  // I - Upper-lefthand X coordinate
+                        	 int        Y,  // I - Upper-lefthand Y coordinate
+				 int        W,  // I - Width in pixels
+				 int        H,  // I - Height in pixels
+				 const char *l)	// I - Label text
+    : fltk3::Browser(X, Y, W, H, l)
+{
+  // Initialize the filter pattern, current directory, and icon size...
+  pattern_   = "*";
+  directory_ = "";
+  iconsize_  = (uchar)(3 * textsize() / 2);
+  filetype_  = FILES;
+}
+
+
+//
+// 'fltk3::FileBrowser::load()' - Load a directory into the browser.
+//
+
+int						// O - Number of files loaded
+fltk3::FileBrowser::load(const char     *directory,// I - Directory to load
+                      fltk3::FileSortF *sort)	// I - Sort function to use
+{
+  int		i;				// Looping var
+  int		num_files;			// Number of files in directory
+  int		num_dirs;			// Number of directories in list
+  char		filename[4096];			// Current file
+  fltk3::FileIcon	*icon;				// Icon to use
+
+
+//  printf("fltk3::FileBrowser::load(\"%s\")\n", directory);
+
+  clear();
+
+  directory_ = directory;
+
+  if (!directory)
+    return (0);
+
+  if (directory_[0] == '\0')
+  {
+    //
+    // No directory specified; for UNIX list all mount points.  For DOS
+    // list all valid drive letters...
+    //
+
+    num_files = 0;
+    if ((icon = fltk3::FileIcon::find("any", fltk3::FileIcon::DEVICE)) == NULL)
+      icon = fltk3::FileIcon::find("any", fltk3::FileIcon::DIRECTORY);
+
+#ifdef WIN32
+#  ifdef __CYGWIN__
+    //
+    // Cygwin provides an implementation of setmntent() to get the list
+    // of available drives...
+    //
+    FILE          *m = setmntent("/-not-used-", "r");
+    struct mntent *p;
+
+    while ((p = getmntent (m)) != NULL) {
+      add(p->mnt_dir, icon);
+      num_files ++;
+    }
+
+    endmntent(m);
+#  else
+    //
+    // Normal WIN32 code uses drive bits...
+    //
+    DWORD	drives;		// Drive available bits
+
+    drives = GetLogicalDrives();
+    for (i = 'A'; i <= 'Z'; i ++, drives >>= 1)
+      if (drives & 1)
+      {
+        sprintf(filename, "%c:/", i);
+
+	if (i < 'C') // see also: GetDriveType and GetVolumeInformation in WIN32
+	  add(filename, icon);
+	else
+	  add(filename, icon);
+
+	num_files ++;
+      }
+#  endif // __CYGWIN__
+#elif defined(__EMX__)
+    //
+    // OS/2 code uses drive bits...
+    //
+    ULONG	curdrive;	// Current drive
+    ULONG	drives;		// Drive available bits
+    int		start = 3;      // 'C' (MRS - dunno if this is correct!)
+
+
+    DosQueryCurrentDisk(&curdrive, &drives);
+    drives >>= start - 1;
+    for (i = 'A'; i <= 'Z'; i ++, drives >>= 1)
+      if (drives & 1)
+      {
+        sprintf(filename, "%c:/", i);
+        add(filename, icon);
+
+	num_files ++;
+      }
+#elif defined(__APPLE__)
+    // MacOS X and Darwin use getfsstat() system call...
+    int			numfs;	// Number of file systems
+    struct statfs	*fs;	// Buffer for file system info
+
+
+    // We always have the root filesystem.
+    add("/", icon);
+
+    // Get the mounted filesystems...
+    numfs = getfsstat(NULL, 0, MNT_NOWAIT);
+    if (numfs > 0) {
+      // We have file systems, get them...
+      fs = new struct statfs[numfs];
+      getfsstat(fs, sizeof(struct statfs) * numfs, MNT_NOWAIT);
+
+      // Add filesystems to the list...
+      for (i = 0; i < numfs; i ++) {
+	// Ignore "/", "/dev", and "/.vol"...
+        if (fs[i].f_mntonname[1] && strcmp(fs[i].f_mntonname, "/dev") &&
+	    strcmp(fs[i].f_mntonname, "/.vol")) {
+          snprintf(filename, sizeof(filename), "%s/", fs[i].f_mntonname);
+          add(filename, icon);
+        }
+        num_files ++;
+      }
+
+      // Free the memory used for the file system info array...
+      delete[] fs;
+    }
+#else
+    //
+    // UNIX code uses /etc/fstab or similar...
+    //
+    FILE	*mtab;		// /etc/mtab or /etc/mnttab file
+    char	line[FLTK3_PATH_MAX];	// Input line
+
+    //
+    // Open the file that contains a list of mounted filesystems...
+    //
+
+    mtab = fltk3::fopen("/etc/mnttab", "r");	// Fairly standard
+    if (mtab == NULL)
+      mtab = fltk3::fopen("/etc/mtab", "r");	// More standard
+    if (mtab == NULL)
+      mtab = fltk3::fopen("/etc/fstab", "r");	// Otherwise fallback to full list
+    if (mtab == NULL)
+      mtab = fltk3::fopen("/etc/vfstab", "r");	// Alternate full list file
+
+    if (mtab != NULL)
+    {
+      while (fgets(line, sizeof(line), mtab) != NULL)
+      {
+        if (line[0] == '#' || line[0] == '\n')
+	  continue;
+        if (sscanf(line, "%*s%4095s", filename) != 1)
+	  continue;
+
+        strlcat(filename, "/", sizeof(filename));
+
+//        printf("fltk3::FileBrowser::load() - adding \"%s\" to list...\n", filename);
+        add(filename, icon);
+	num_files ++;
+      }
+
+      fclose(mtab);
+    }
+#endif // WIN32 || __EMX__
+  }
+  else
+  {
+    dirent	**files;	// Files in in directory
+
+
+    //
+    // Build the file list...
+    //
+
+#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__)
+    strlcpy(filename, directory_, sizeof(filename));
+    i = strlen(filename) - 1;
+
+    if (i == 2 && filename[1] == ':' &&
+        (filename[2] == '/' || filename[2] == '\\'))
+      filename[2] = '/';
+    else if (filename[i] != '/' && filename[i] != '\\')
+      strlcat(filename, "/", sizeof(filename));
+
+    num_files = fltk3::filename_list(filename, &files, sort);
+#else
+    num_files = fltk3::filename_list(directory_, &files, sort);
+#endif /* WIN32 || __EMX__ */
+
+    if (num_files <= 0)
+      return (0);
+
+    for (i = 0, num_dirs = 0; i < num_files; i ++) {
+      if (strcmp(files[i]->d_name, "./")) {
+	snprintf(filename, sizeof(filename), "%s/%s", directory_,
+	         files[i]->d_name);
+
+        icon = fltk3::FileIcon::find(filename);
+	if ((icon && icon->type() == fltk3::FileIcon::DIRECTORY) ||
+	     fltk3::_filename_isdir_quick(filename)) {
+          num_dirs ++;
+          insert(num_dirs, files[i]->d_name, icon);
+	} else if (filetype_ == FILES &&
+	           fltk3::filename_match(files[i]->d_name, pattern_)) {
+          add(files[i]->d_name, icon);
+	}
+      }
+
+      free(files[i]);
+    }
+
+    free(files);
+  }
+
+  return (num_files);
+}
+
+
+//
+// 'fltk3::FileBrowser::filter()' - Set the filename filter.
+//
+
+void
+fltk3::FileBrowser::filter(const char *pattern)	// I - Pattern string
+{
+  // If pattern is NULL set the pattern to "*"...
+  if (pattern)
+    pattern_ = pattern;
+  else
+    pattern_ = "*";
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/FileChooser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Chooser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/FileChooser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileChooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,475 @@
+//
+// "$Id$"
+//
+// fltk3::FileChooser dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// generated by Fast Light User Interface Designer (fluid) version 1.0300
+
+#include <fltk3/FileChooser.h>
+#include <fltk3/draw.h>
+
+void fltk3::FileChooser::cb_window_i(fltk3::DoubleWindow*, void*) {
+  fileName->value("");
+fileList->deselect();
+fltk3::remove_timeout((fltk3::TimeoutHandler)previewCB, this);
+window->hide();
+}
+void fltk3::FileChooser::cb_window(fltk3::DoubleWindow* o, void* v) {
+  ((fltk3::FileChooser*)(o->user_data()))->cb_window_i(o,v);
+}
+
+void fltk3::FileChooser::cb_showChoice_i(fltk3::Choice*, void*) {
+  showChoiceCB();
+}
+void fltk3::FileChooser::cb_showChoice(fltk3::Choice* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_showChoice_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favoritesButton_i(fltk3::MenuButton*, void*) {
+  favoritesButtonCB();
+}
+void fltk3::FileChooser::cb_favoritesButton(fltk3::MenuButton* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favoritesButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_newButton_i(fltk3::Button*, void*) {
+  newdir();
+}
+void fltk3::FileChooser::cb_newButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_newButton_i(o,v);
+}
+
+#include <fltk3/Bitmap.h>
+static unsigned char idata_new[] =
+{0,0,120,0,132,0,2,1,1,254,1,128,49,128,49,128,253,128,253,128,49,128,49,
+128,1,128,1,128,255,255,0,0};
+static fltk3::Bitmap image_new(idata_new, 16, 16);
+
+void fltk3::FileChooser::cb__i(fltk3::TiledGroup*, void*) {
+  update_preview();
+}
+void fltk3::FileChooser::cb_(fltk3::TiledGroup* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->user_data()))->cb__i(o,v);
+}
+
+void fltk3::FileChooser::cb_fileList_i(fltk3::FileBrowser*, void*) {
+  fileListCB();
+}
+void fltk3::FileChooser::cb_fileList(fltk3::FileBrowser* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_fileList_i(o,v);
+}
+
+void fltk3::FileChooser::cb_previewButton_i(fltk3::CheckButton*, void*) {
+  preview(previewButton->value());
+}
+void fltk3::FileChooser::cb_previewButton(fltk3::CheckButton* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->parent()->user_data()))->cb_previewButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_showHiddenButton_i(fltk3::CheckButton*, void*) {
+  showHidden(showHiddenButton->value());
+}
+void fltk3::FileChooser::cb_showHiddenButton(fltk3::CheckButton* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->parent()->user_data()))->cb_showHiddenButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_fileName_i(fltk3::FileInput*, void*) {
+  fileNameCB();
+}
+void fltk3::FileChooser::cb_fileName(fltk3::FileInput* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_fileName_i(o,v);
+}
+
+void fltk3::FileChooser::cb_okButton_i(fltk3::ReturnButton*, void*) {
+  window->hide();
+
+// Do any callback that is registered...
+if (callback_)
+  (*callback_)(this, data_);
+}
+void fltk3::FileChooser::cb_okButton(fltk3::ReturnButton* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->parent()->user_data()))->cb_okButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_cancelButton_i(fltk3::Button*, void*) {
+  fileName->value("");
+fileList->deselect();
+fltk3::remove_timeout((fltk3::TimeoutHandler)previewCB, this);
+window->hide();
+}
+void fltk3::FileChooser::cb_cancelButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->parent()->user_data()))->cb_cancelButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favList_i(fltk3::FileBrowser*, void*) {
+  favoritesCB(favList);
+}
+void fltk3::FileChooser::cb_favList(fltk3::FileBrowser* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->user_data()))->cb_favList_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favUpButton_i(fltk3::Button*, void*) {
+  favoritesCB(favUpButton);
+}
+void fltk3::FileChooser::cb_favUpButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favUpButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favDeleteButton_i(fltk3::Button*, void*) {
+  favoritesCB(favDeleteButton);
+}
+void fltk3::FileChooser::cb_favDeleteButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favDeleteButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favDownButton_i(fltk3::Button*, void*) {
+  favoritesCB(favDownButton);
+}
+void fltk3::FileChooser::cb_favDownButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favDownButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favCancelButton_i(fltk3::Button*, void*) {
+  favWindow->hide();
+}
+void fltk3::FileChooser::cb_favCancelButton(fltk3::Button* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favCancelButton_i(o,v);
+}
+
+void fltk3::FileChooser::cb_favOkButton_i(fltk3::ReturnButton*, void*) {
+  favoritesCB(favOkButton);
+}
+void fltk3::FileChooser::cb_favOkButton(fltk3::ReturnButton* o, void* v) {
+  ((fltk3::FileChooser*)(o->parent()->parent()->user_data()))->cb_favOkButton_i(o,v);
+}
+
+fltk3::FileChooser::FileChooser(const char *d, const char *p, int t, const char *title) {
+  fltk3::Group *prev_current = fltk3::Group::current();
+  { window = new fltk3::DoubleWindow(490, 380, "Choose File");
+    window->callback((fltk3::Callback*)cb_window, (void*)(this));
+    { fltk3::Group* o = new fltk3::Group(10, 10, 470, 25);
+      { showChoice = new fltk3::Choice(65, 10, 215, 25, "Show:");
+        showChoice->down_box(fltk3::BORDER_BOX);
+        showChoice->labelfont(1);
+        showChoice->callback((fltk3::Callback*)cb_showChoice);
+        fltk3::Group::current()->resizable(showChoice);
+        showChoice->label(show_label);
+      } // fltk3::Choice* showChoice
+      { favoritesButton = new fltk3::MenuButton(290, 10, 155, 25, "Favorites");
+        favoritesButton->down_box(fltk3::BORDER_BOX);
+        favoritesButton->callback((fltk3::Callback*)cb_favoritesButton);
+        favoritesButton->align(fltk3::Align(fltk3::ALIGN_LEFT|fltk3::ALIGN_INSIDE));
+        favoritesButton->label(favorites_label);
+      } // fltk3::MenuButton* favoritesButton
+      { fltk3::Button* o = newButton = new fltk3::Button(455, 10, 25, 25);
+        newButton->image(image_new);
+        newButton->labelsize(8);
+        newButton->callback((fltk3::Callback*)cb_newButton);
+        o->tooltip(new_directory_tooltip);
+      } // fltk3::Button* newButton
+      o->end();
+    } // fltk3::Group* o
+    { fltk3::TiledGroup* o = new fltk3::TiledGroup(10, 45, 470, 225);
+      o->callback((fltk3::Callback*)cb_);
+      { fileList = new fltk3::FileBrowser(10, 45, 295, 225);
+        fileList->type(2);
+        fileList->callback((fltk3::Callback*)cb_fileList);
+        fileList->window()->hotspot(fileList);
+      } // fltk3::FileBrowser* fileList
+      { previewBox = new fltk3::Box(305, 45, 175, 225, "?");
+        previewBox->box(fltk3::DOWN_BOX);
+        previewBox->labelsize(100);
+        previewBox->align(fltk3::Align(fltk3::ALIGN_CLIP|fltk3::ALIGN_INSIDE));
+      } // fltk3::Box* previewBox
+      o->end();
+      fltk3::Group::current()->resizable(o);
+    } // fltk3::TiledGroup* o
+    { fltk3::Group* o = new fltk3::Group(10, 275, 470, 95);
+      { fltk3::Group* o = new fltk3::Group(10, 275, 470, 20);
+        { previewButton = new fltk3::CheckButton(10, 275, 73, 20, "Preview");
+          previewButton->shortcut(0x80070);
+          previewButton->down_box(fltk3::DOWN_BOX);
+          previewButton->value(1);
+          previewButton->callback((fltk3::Callback*)cb_previewButton);
+          previewButton->label(preview_label);
+        } // fltk3::CheckButton* previewButton
+        { showHiddenButton = new fltk3::CheckButton(115, 275, 165, 20, "Show hidden files");
+          showHiddenButton->down_box(fltk3::DOWN_BOX);
+          showHiddenButton->callback((fltk3::Callback*)cb_showHiddenButton);
+          showHiddenButton->label(hidden_label);
+        } // fltk3::CheckButton* showHiddenButton
+        { fltk3::Box* o = new fltk3::Box(115, 275, 365, 20);
+          fltk3::Group::current()->resizable(o);
+        } // fltk3::Box* o
+        o->end();
+      } // fltk3::Group* o
+      { fileName = new fltk3::FileInput(115, 300, 365, 35);
+        fileName->labelfont(1);
+        fileName->callback((fltk3::Callback*)cb_fileName);
+        fileName->when(fltk3::WHEN_ENTER_KEY);
+        fltk3::Group::current()->resizable(fileName);
+        fileName->when(fltk3::WHEN_CHANGED | fltk3::WHEN_ENTER_KEY);
+      } // fltk3::FileInput* fileName
+      { fltk3::Box* o = new fltk3::Box(10, 310, 105, 25, "Filename:");
+        o->labelfont(1);
+        o->align(fltk3::Align(fltk3::ALIGN_RIGHT|fltk3::ALIGN_INSIDE));
+        o->label(filename_label);
+      } // fltk3::Box* o
+      { fltk3::Group* o = new fltk3::Group(10, 345, 470, 25);
+        { okButton = new fltk3::ReturnButton(313, 345, 85, 25, "OK");
+          okButton->callback((fltk3::Callback*)cb_okButton);
+          okButton->label(fltk3::ok);
+        } // fltk3::ReturnButton* okButton
+        { fltk3::Button* o = cancelButton = new fltk3::Button(408, 345, 72, 25, "Cancel");
+          cancelButton->callback((fltk3::Callback*)cb_cancelButton);
+          o->label(fltk3::cancel);
+        } // fltk3::Button* cancelButton
+        { fltk3::Box* o = new fltk3::Box(10, 345, 30, 25);
+          fltk3::Group::current()->resizable(o);
+        } // fltk3::Box* o
+        o->end();
+      } // fltk3::Group* o
+      o->end();
+    } // fltk3::Group* o
+    if (title) window->label(title);
+    window->set_modal();
+    window->end();
+  } // fltk3::DoubleWindow* window
+  { favWindow = new fltk3::DoubleWindow(355, 150, "Manage Favorites");
+    favWindow->user_data((void*)(this));
+    { favList = new fltk3::FileBrowser(10, 10, 300, 95);
+      favList->type(2);
+      favList->callback((fltk3::Callback*)cb_favList);
+      fltk3::Group::current()->resizable(favList);
+    } // fltk3::FileBrowser* favList
+    { fltk3::Group* o = new fltk3::Group(320, 10, 25, 95);
+      { favUpButton = new fltk3::Button(320, 10, 25, 25, "@8>");
+        favUpButton->callback((fltk3::Callback*)cb_favUpButton);
+      } // fltk3::Button* favUpButton
+      { favDeleteButton = new fltk3::Button(320, 45, 25, 25, "X");
+        favDeleteButton->labelfont(1);
+        favDeleteButton->callback((fltk3::Callback*)cb_favDeleteButton);
+        fltk3::Group::current()->resizable(favDeleteButton);
+      } // fltk3::Button* favDeleteButton
+      { favDownButton = new fltk3::Button(320, 80, 25, 25, "@2>");
+        favDownButton->callback((fltk3::Callback*)cb_favDownButton);
+      } // fltk3::Button* favDownButton
+      o->end();
+    } // fltk3::Group* o
+    { fltk3::Group* o = new fltk3::Group(10, 113, 335, 29);
+      { favCancelButton = new fltk3::Button(273, 115, 72, 25, "Cancel");
+        favCancelButton->callback((fltk3::Callback*)cb_favCancelButton);
+        favCancelButton->label(fltk3::cancel);
+      } // fltk3::Button* favCancelButton
+      { favOkButton = new fltk3::ReturnButton(181, 115, 79, 25, "Save");
+        favOkButton->callback((fltk3::Callback*)cb_favOkButton);
+        favOkButton->label(save_label);
+      } // fltk3::ReturnButton* favOkButton
+      { fltk3::Box* o = new fltk3::Box(10, 115, 161, 25);
+        fltk3::Group::current()->resizable(o);
+      } // fltk3::Box* o
+      o->end();
+    } // fltk3::Group* o
+    favWindow->label(manage_favorites_label);
+    favWindow->set_modal();
+    favWindow->size_range(181, 150);
+    favWindow->end();
+  } // fltk3::DoubleWindow* favWindow
+  callback_ = 0;
+  data_ = 0;
+  directory_[0] = 0;
+  window->size_range(window->w(), window->h(), fltk3::w(), fltk3::h());
+  type(t);
+  filter(p);
+  update_favorites();
+  value(d);
+  type(t);
+  int e;
+  prefs_.get("preview", e, 1);
+  preview(e);
+  fltk3::Group::current(prev_current);
+  ext_group=(fltk3::Widget*)0;
+}
+
+fltk3::FileChooser::~FileChooser() {
+  fltk3::remove_timeout((fltk3::TimeoutHandler)previewCB, this);
+  if(ext_group)window->remove(ext_group);
+  delete window;
+  delete favWindow;
+}
+
+void fltk3::FileChooser::callback(void (*cb)(fltk3::FileChooser *, void *), void *d ) {
+  callback_ = cb;
+  data_     = d;
+}
+
+void fltk3::FileChooser::color(fltk3::Color c) {
+  fileList->color(c);
+}
+
+fltk3::Color fltk3::FileChooser::color() {
+  return (fileList->color());
+}
+
+char * fltk3::FileChooser::directory() {
+  return directory_;
+}
+
+const char * fltk3::FileChooser::filter() {
+  return (fileList->filter());
+}
+
+int fltk3::FileChooser::filter_value() {
+  return showChoice->value();
+}
+
+void fltk3::FileChooser::filter_value(int f) {
+  showChoice->value(f);
+  showChoiceCB();
+}
+
+void fltk3::FileChooser::hide() {
+  window->hide();
+}
+
+void fltk3::FileChooser::iconsize(uchar s) {
+  fileList->iconsize(s);
+}
+
+uchar fltk3::FileChooser::iconsize() {
+  return (fileList->iconsize());
+}
+
+void fltk3::FileChooser::label(const char *l) {
+  window->label(l);
+}
+
+const char * fltk3::FileChooser::label() {
+  return (window->label());
+}
+
+void fltk3::FileChooser::ok_label(const char *l) {
+  okButton->label(l);
+  int w=0, h=0;
+  okButton->measure_label(w, h);
+  okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
+                   w + 40, 25);
+  okButton->parent()->init_sizes();
+}
+
+const char * fltk3::FileChooser::ok_label() {
+  return (okButton->label());
+}
+
+int fltk3::FileChooser::shown() {
+  return window->shown();
+}
+
+void fltk3::FileChooser::textcolor(fltk3::Color c) {
+  fileList->textcolor(c);
+}
+
+fltk3::Color fltk3::FileChooser::textcolor() {
+  return (fileList->textcolor());
+}
+
+void fltk3::FileChooser::textfont(fltk3::Font f) {
+  fileList->textfont(f);
+}
+
+fltk3::Font fltk3::FileChooser::textfont() {
+  return (fileList->textfont());
+}
+
+void fltk3::FileChooser::textsize(fltk3::Fontsize s) {
+  fileList->textsize(s);
+}
+
+fltk3::Fontsize fltk3::FileChooser::textsize() {
+  return (fileList->textsize());
+}
+
+void fltk3::FileChooser::type(int t) {
+  type_ = t;
+  if (t & MULTI)
+    fileList->type(fltk3::MULTI_BROWSER);
+  else
+    fileList->type(fltk3::HOLD_BROWSER);
+  if (t & CREATE)
+    newButton->activate();
+  else
+    newButton->deactivate();
+  if (t & DIRECTORY)
+    fileList->filetype(fltk3::FileBrowser::DIRECTORIES);
+  else
+    fileList->filetype(fltk3::FileBrowser::FILES);
+}
+
+int fltk3::FileChooser::type() {
+  return (type_);
+}
+
+void * fltk3::FileChooser::user_data() const {
+  return (data_);
+}
+
+void fltk3::FileChooser::user_data(void *d) {
+  data_ = d;
+}
+
+int fltk3::FileChooser::visible() {
+  return window->visible();
+}
+
+fltk3::Widget* fltk3::FileChooser::add_extra(fltk3::Widget* gr) {
+  fltk3::Widget* ret=ext_group;
+  if (gr==ext_group) {
+    return ret;
+  }
+  if (ext_group) {
+    int sh=ext_group->h()+4;
+    fltk3::Widget* svres=window->resizable();
+    window->resizable(NULL);
+    window->size(window->w(),window->h()-sh);
+    window->remove(ext_group);
+    ext_group=NULL;
+    window->resizable(svres);
+  }
+  if (gr) {
+    int nh=window->h()+gr->h()+4;
+    fltk3::Widget* svres=window->resizable();
+    window->resizable(NULL);
+    window->size(window->w(),nh);
+    gr->position(2,okButton->y()+okButton->h()+2);
+    window->add(gr);
+    ext_group=gr;
+    window->resizable(svres);
+  }
+  return ret;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/FileChooser.fl (from rev 9002, branches/branch-3.0/src/core/Fl_File_Chooser.fl)
===================================================================
--- branches/branch-3.0/src/fltk3/FileChooser.fl	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileChooser.fl	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,470 @@
+# data file for the Fltk User Interface Designer (fluid)
+version 1.0300 
+header_name {../FL/Fl_File_Chooser.H} 
+code_name {.cxx}
+comment {//
+// "$Id$"
+//
+// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 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
+//
+} {in_source in_header
+} 
+
+decl {\#include <FL/fl_draw.H>} {} 
+
+class FL_EXPORT Fl_File_Chooser {open
+} {
+  decl {enum { SINGLE = 0, MULTI = 1, CREATE = 2, DIRECTORY = 4 };} {public
+  }
+  decl {static Fl_Preferences prefs_;} {}
+  decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
+  decl {void *data_;} {}
+  decl {char directory_[FL_PATH_MAX];} {}
+  decl {char pattern_[FL_PATH_MAX];} {}
+  decl {char preview_text_[2048];} {}
+  decl {int type_;} {}
+  decl {void favoritesButtonCB();} {}
+  decl {void favoritesCB(Fl_Widget *w);} {}
+  decl {void fileListCB();} {}
+  decl {void fileNameCB();} {}
+  decl {void newdir();} {}
+  decl {static void previewCB(Fl_File_Chooser *fc);} {}
+  decl {void showChoiceCB();} {}
+  decl {void update_favorites();} {}
+  decl {void update_preview();} {}
+  Function {Fl_File_Chooser(const char *d, const char *p, int t, const char *title)} {} {
+    code {Fl_Group *prev_current = Fl_Group::current();} {}
+    Fl_Window window {
+      label {Choose File}
+      callback {fileName->value("");
+fileList->deselect();
+Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+window->hide();} open
+      private xywh {507 327 490 380} type Double resizable
+      code0 {if (title) window->label(title);}
+      code1 {\#include <stdio.h>}
+      code2 {\#include <stdlib.h>}
+      code3 {\#include <string.h>} modal visible
+    } {
+      Fl_Group {} {open
+        private xywh {10 10 470 25}
+      } {
+        Fl_Choice showChoice {
+          label {Show:}
+          callback {showChoiceCB();} open
+          private xywh {65 10 215 25} down_box BORDER_BOX labelfont 1 resizable
+          code0 {showChoice->label(show_label);}
+        } {}
+        Fl_Menu_Button favoritesButton {
+          label Favorites
+          callback {favoritesButtonCB();} open
+          private xywh {290 10 155 25} down_box BORDER_BOX align 20
+          code0 {favoritesButton->label(favorites_label);}
+        } {}
+        Fl_Button newButton {
+          callback {newdir();}
+          image {new.xbm} xywh {455 10 25 25} labelsize 8
+          code0 {\#include <FL/Fl_Preferences.H>}
+          code1 {o->tooltip(new_directory_tooltip);}
+        }
+      }
+      Fl_Tile {} {
+        callback {update_preview();}
+        private xywh {10 45 470 225} resizable
+      } {
+        Fl_File_Browser fileList {
+          callback {fileListCB();}
+          private xywh {10 45 295 225} type Hold hotspot
+          code0 {\#include <FL/Fl_File_Browser.H>}
+        }
+        Fl_Box previewBox {
+          label {?}
+          private xywh {305 45 175 225} box DOWN_BOX labelsize 100 align 80
+        }
+      }
+      Fl_Group {} {open
+        private xywh {10 275 470 95}
+      } {
+        Fl_Group {} {open
+          private xywh {10 275 470 20}
+        } {
+          Fl_Check_Button previewButton {
+            label Preview
+            callback {preview(previewButton->value());}
+            xywh {10 275 73 20} down_box DOWN_BOX shortcut 0x80070 value 1
+            code0 {previewButton->label(preview_label);}
+          }
+          Fl_Check_Button showHiddenButton {
+            label {Show hidden files}
+            callback {showHidden(showHiddenButton->value());}
+            xywh {115 275 165 20} down_box DOWN_BOX
+            code0 {showHiddenButton->label(hidden_label);}
+          }
+          Fl_Box {} {
+            private xywh {115 275 365 20} resizable
+          }
+        }
+        Fl_File_Input fileName {
+          callback {fileNameCB();}
+          private xywh {115 300 365 35} labelfont 1 when 8 resizable
+          code0 {fileName->when(FL_WHEN_CHANGED | FL_WHEN_ENTER_KEY);}
+        }
+        Fl_Box {} {
+          label {Filename:}
+          private xywh {10 310 105 25} labelfont 1 align 24
+          code0 {o->label(filename_label);}
+        }
+        Fl_Group {} {open
+          private xywh {10 345 470 25}
+        } {
+          Fl_Return_Button okButton {
+            label OK
+            callback {window->hide();
+
+// Do any callback that is registered...
+if (callback_)
+  (*callback_)(this, data_);}
+            private xywh {313 345 85 25}
+            code0 {\#include <FL/fl_ask.H>}
+            code1 {okButton->label(fl_ok);}
+          }
+          Fl_Button cancelButton {
+            label Cancel
+            callback {fileName->value("");
+fileList->deselect();
+Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+window->hide();}
+            private xywh {408 345 72 25}
+            code0 {o->label(fl_cancel);}
+          }
+          Fl_Box {} {
+            private xywh {10 345 30 25} resizable
+          }
+        }
+      }
+    }
+    Fl_Window favWindow {
+      label {Manage Favorites}
+      private xywh {413 100 355 150} type Double resizable
+      code0 {favWindow->label(manage_favorites_label);} modal size_range {181 150 0 0} visible
+    } {
+      Fl_File_Browser favList {
+        callback {favoritesCB(favList);}
+        private xywh {10 10 300 95} type Hold resizable
+      }
+      Fl_Group {} {open
+        xywh {320 10 25 95}
+      } {
+        Fl_Button favUpButton {
+          label {@8>}
+          callback {favoritesCB(favUpButton);}
+          private xywh {320 10 25 25}
+        }
+        Fl_Button favDeleteButton {
+          label X
+          callback {favoritesCB(favDeleteButton);}
+          private xywh {320 45 25 25} labelfont 1 resizable
+        }
+        Fl_Button favDownButton {
+          label {@2>}
+          callback {favoritesCB(favDownButton);}
+          private xywh {320 80 25 25}
+        }
+      }
+      Fl_Group {} {open
+        xywh {10 113 335 29}
+      } {
+        Fl_Button favCancelButton {
+          label Cancel
+          callback {favWindow->hide();}
+          private xywh {273 115 72 25}
+          code0 {favCancelButton->label(fl_cancel);}
+        }
+        Fl_Return_Button favOkButton {
+          label Save
+          callback {favoritesCB(favOkButton);}
+          private xywh {181 115 79 25}
+          code0 {\#include <FL/fl_ask.H>}
+          code1 {favOkButton->label(save_label);}
+        }
+        Fl_Box {} {
+          xywh {10 115 161 25} resizable
+        }
+      }
+    }
+    code {callback_ = 0;
+data_ = 0;
+directory_[0] = 0;
+window->size_range(window->w(), window->h(), Fl::w(), Fl::h());
+type(t);
+filter(p);
+update_favorites();
+value(d);
+type(t);
+int e;
+prefs_.get("preview", e, 1);
+preview(e);
+Fl_Group::current(prev_current);} {}
+    code {ext_group=(Fl_Widget*)0;} {}
+  }
+  Function {~Fl_File_Chooser()} {open
+  } {
+    code {Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
+if(ext_group)window->remove(ext_group);
+delete window;
+delete favWindow;} {}
+  }
+  Function {callback(void (*cb)(Fl_File_Chooser *, void *), void *d = 0)} {return_type void
+  } {
+    code {callback_ = cb;
+data_     = d;} {}
+  }
+  Function {color(Fl_Color c)} {} {
+    code {fileList->color(c);} {}
+  }
+  Function {color()} {return_type Fl_Color
+  } {
+    code {return (fileList->color());} {}
+  }
+  decl {int count();} {public
+  }
+  decl {void directory(const char *d);} {public
+  }
+  Function {directory()} {return_type {char *}
+  } {
+    code {return directory_;} {}
+  }
+  decl {void filter(const char *p);} {public
+  }
+  Function {filter()} {return_type {const char *}
+  } {
+    code {return (fileList->filter());} {}
+  }
+  Function {filter_value()} {return_type int
+  } {
+    code {return showChoice->value();} {}
+  }
+  Function {filter_value(int f)} {return_type void
+  } {
+    code {showChoice->value(f);
+showChoiceCB();} {}
+  }
+  Function {hide()} {return_type void
+  } {
+    code {window->hide();} {}
+  }
+  Function {iconsize(uchar s)} {return_type void
+  } {
+    code {fileList->iconsize(s);} {}
+  }
+  Function {iconsize()} {return_type uchar
+  } {
+    code {return (fileList->iconsize());} {}
+  }
+  Function {label(const char *l)} {return_type void
+  } {
+    code {window->label(l);} {}
+  }
+  Function {label()} {return_type {const char *}
+  } {
+    code {return (window->label());} {}
+  }
+  Function {ok_label(const char *l)} {return_type void
+  } {
+    code {okButton->label(l);
+int w=0, h=0;
+okButton->measure_label(w, h);
+okButton->resize(cancelButton->x() - 50 - w, cancelButton->y(),
+                 w + 40, 25);
+okButton->parent()->init_sizes();} {}
+  }
+  Function {ok_label()} {return_type {const char *}
+  } {
+    code {return (okButton->label());} {}
+  }
+  decl {void preview(int e);} {public
+  }
+  decl {int preview() const { return previewButton->value(); }} {public
+  }
+  decl {void showHidden(int e);} {private
+  }
+  decl {void remove_hidden_files();} {private
+  }
+  decl {void rescan();} {public
+  }
+  decl {void rescan_keep_filename();} {public
+  }
+  decl {void show();} {public
+  }
+  Function {shown()} {return_type int
+  } {
+    code {return window->shown();} {}
+  }
+  Function {textcolor(Fl_Color c)} {return_type void
+  } {
+    code {fileList->textcolor(c);} {}
+  }
+  Function {textcolor()} {return_type Fl_Color
+  } {
+    code {return (fileList->textcolor());} {}
+  }
+  Function {textfont(Fl_Font f)} {return_type void
+  } {
+    code {fileList->textfont(f);} {}
+  }
+  Function {textfont()} {selected return_type Fl_Font
+  } {
+    code {return (fileList->textfont());} {}
+  }
+  Function {textsize(Fl_Fontsize s)} {return_type void
+  } {
+    code {fileList->textsize(s);} {}
+  }
+  Function {textsize()} {return_type Fl_Fontsize
+  } {
+    code {return (fileList->textsize());} {}
+  }
+  Function {type(int t)} {return_type void
+  } {
+    code {type_ = t;
+if (t & MULTI)
+  fileList->type(FL_MULTI_BROWSER);
+else
+  fileList->type(FL_HOLD_BROWSER);
+if (t & CREATE)
+  newButton->activate();
+else
+  newButton->deactivate();
+if (t & DIRECTORY)
+  fileList->filetype(Fl_File_Browser::DIRECTORIES);
+else
+  fileList->filetype(Fl_File_Browser::FILES);} {}
+  }
+  Function {type()} {return_type int
+  } {
+    code {return (type_);} {}
+  }
+  Function {user_data() const} {return_type {void *}
+  } {
+    code {return (data_);} {}
+  }
+  Function {user_data(void *d)} {return_type void
+  } {
+    code {data_ = d;} {}
+  }
+  decl {const char *value(int f = 1);} {public
+  }
+  decl {void value(const char *filename);} {public
+  }
+  Function {visible()} {return_type int
+  } {
+    code {return window->visible();} {}
+  }
+  decl {static const char *add_favorites_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *all_files_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *custom_filter_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *existing_file_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *favorites_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *filename_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *filesystems_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *manage_favorites_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *new_directory_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *new_directory_tooltip;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *preview_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *save_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *show_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static const char *hidden_label;} {
+    comment {[standard text may be customized at run-time]} public
+  }
+  decl {static Fl_File_Sort_F *sort;} {
+    comment {the sort function that is used when loading
+the contents of a directory.} public
+  }
+  decl {Fl_Widget* ext_group;} {}
+  Function {add_extra(Fl_Widget* gr)} {open return_type {Fl_Widget*}
+  } {
+    code {Fl_Widget* ret=ext_group;} {}
+    codeblock {if (gr==ext_group)} {open
+    } {
+      code {return ret;} {}
+    }
+    codeblock {if (ext_group)} {open
+    } {
+      code {int sh=ext_group->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),window->h()-sh);
+window->remove(ext_group);
+ext_group=NULL;
+window->resizable(svres);} {}
+    }
+    codeblock {if (gr)} {open
+    } {
+      code {int nh=window->h()+gr->h()+4;
+Fl_Widget* svres=window->resizable();
+window->resizable(NULL);
+window->size(window->w(),nh);
+gr->position(2,okButton->y()+okButton->h()+2);
+window->add(gr);
+ext_group=gr;
+window->resizable(svres);} {}
+    }
+    code {return ret;} {}
+  }
+} 
+
+decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);} {public
+} 
+
+decl {FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);} {public
+} 
+
+decl {FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));} {public
+} 
+
+decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
+} 
+
+comment {
+//
+// End of "$Id$".
+//} {in_source in_header
+} 

Copied: branches/branch-3.0/src/fltk3/FileChooser2.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Chooser2.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/FileChooser2.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileChooser2.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1695 @@
+//
+// "$Id$"
+//
+// More fltk3::FileChooser routines.
+//
+// Copyright 1999-2011 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// fabien: ATTENTION: Only Out Of Source Gen. because cxx/H files are autogenerated by fluid.
+/** \defgroup group_comdlg Common Dialogs classes and functions
+    @{
+*/
+/** \class fltk3::FileChooser
+  The fltk3::FileChooser widget displays a standard file selection
+  dialog that supports various selection modes.
+  
+  \image html fltk3::FileChooser.jpg 
+  \image latex  fltk3::FileChooser.jpg "fltk3::FileChooser" width=12cm
+  
+  The fltk3::FileChooser class also exports several static values
+  that may be used to localize or customize the appearance of all file chooser
+  dialogs:
+  
+  <CENTER><TABLE BORDER="1">
+  <TR>
+  	<TH>Member</TH>
+  	<TH>Default value</TH>
+  </TR>
+  <TR>
+  	<TD>add_favorites_label</TD>
+  	<TD>"Add to Favorites"</TD>
+  </TR>
+  <TR>
+  	<TD>all_files_label</TD>
+  	<TD>"All Files (*)"</TD>
+  </TR>
+  <TR>
+  	<TD>custom_filter_label</TD>
+  	<TD>"Custom Filter"</TD>
+  </TR>
+  <TR>
+  	<TD>existing_file_label</TD>
+  	<TD>"Please choose an existing file!"</TD>
+  </TR>
+  <TR>
+  	<TD>favorites_label</TD>
+  	<TD>"Favorites"</TD>
+  </TR>
+  <TR>
+  	<TD>filename_label</TD>
+  	<TD>"Filename:"</TD>
+  </TR>
+  <TR>
+  	<TD>filesystems_label</TD>
+  	<TD>"My Computer" (WIN32)<BR>
+  	"File Systems" (all others)</TD>
+  </TR>
+ <TR>
+	<TD>hidden_label</TD>
+	<TD>"Show hidden files:"</TD>
+ </TR>
+ <TR>
+  	<TD>manage_favorites_label</TD>
+  	<TD>"Manage Favorites"</TD>
+  </TR>
+  <TR>
+  	<TD>new_directory_label</TD>
+  	<TD>"New Directory?"</TD>
+  </TR>
+  <TR>
+  	<TD>new_directory_tooltip</TD>
+  	<TD>"Create a new directory."</TD>
+  </TR>
+  <TR>
+  	<TD>preview_label</TD>
+  	<TD>"Preview"</TD>
+  </TR>
+  <TR>
+  	<TD>save_label</TD>
+  	<TD>"Save"</TD>
+  </TR>
+  <TR>
+  	<TD>show_label</TD>
+  	<TD>"Show:"</TD>
+  </TR>
+ <TR>
+  	<TD>sort</TD>
+  	<TD>fltk3::numericsort</TD>
+  </TR>
+  </TABLE></CENTER>
+
+  The fltk3::FileChooser::sort member specifies the sort function that is
+  used when loading the contents of a directory and can be customized
+  at run-time.
+
+  The fltk3::FileChooser class also exports the fltk3::FileChooser::newButton
+  and fltk3::FileChooser::previewButton widgets so that application developers
+  can control their appearance and use.  For more complex customization,
+  consider copying the FLTK file chooser code and changing it accordingly.
+*/
+/** @} */
+
+/** \fn fltk3::FileChooser::fltk3::FileChooser(const char *pathname, const char *pattern, int type, const char *title)
+  The constructor creates the fltk3::FileChooser dialog shown.
+  The pathname argument can be a directory name or a
+  complete file name (in which case the corresponding file is highlighted
+  in the list and in the filename input field.)
+  
+  The pattern argument can be a NULL
+  string or "*" to list all files, or it can be a
+  series of descriptions and filter strings separated by tab
+  characters (\\t). The format of filters is either
+  "Description text (patterns)" or just "patterns". A file chooser
+  that provides filters for HTML and image files might look like:
+  
+  \code
+  "HTML Files (*.html)\tImage Files (*.{bmp,gif,jpg,png})"
+  \endcode
+  
+  The file chooser will automatically add the "All Files (*)"
+  pattern to the end of the string you pass if you do not provide
+  one. The first filter in the string is the default filter.
+  
+  See the FLTK documentation on fltk3::filename_match()
+  for the kinds of pattern strings that are supported.
+  
+  The type argument can be one of the following:
+  
+  \li \c SINGLE - allows the user to select a single, existing file.
+  \li \c MULTI - allows the user to select one or more existing files.
+  \li \c CREATE - allows the user to select a single, existing file or
+         specify a new filename.
+  \li \c DIRECTORY - allows the user to select a single, existing directory.
+  
+  The title argument is used to set the title bar text for the
+  fltk3::FileChooser window.
+*/
+
+/** \var fltk3::FileChooser::newButton
+  The "new directory" button is exported so that application developers
+  can control the appearance and use.
+*/
+
+/** \var fltk3::FileChooser::previewButton
+  The "preview" button is exported so that application developers can
+  control the appearance and use.
+*/
+
+/** \fn fltk3::FileChooser::~Fl_File_Chooser()
+  Destroys the widget and frees all memory used by it.*/
+
+/** \fn void fltk3::FileChooser::color(fltk3::Color c)
+  Sets the background color of the fltk3::FileBrowser list.*/
+
+/** \fn fltk3::Color fltk3::FileChooser::color()
+  Gets the background color of the fltk3::FileBrowser list.*/
+
+/** \fn int fltk3::FileChooser::count()
+  Returns the number of selected files.*/
+
+/** \fn void fltk3::FileChooser::directory(const char *pathname)
+  Sets the current directory.*/
+
+/** \fn const char *fltk3::FileChooser::directory()
+  Gets the current directory.*/
+
+/** \fn void fltk3::FileChooser::filter(const char *pattern)
+  Sets or gets the current filename filter patterns. The filter
+  patterns use fltk3::filename_match().
+  Multiple patterns can be used by separating them with tabs, like
+  <tt>"*.jpg\t*.png\t*.gif\t*"</tt>. In addition, you can provide
+  human-readable labels with the patterns inside parenthesis, like
+  <tt>"JPEG Files (*.jpg)\tPNG Files (*.png)\tGIF Files (*.gif)\tAll Files (*)"
+  </tt>.
+
+  Use filter(NULL) to show all files.
+*/
+
+/** \fn const char *fltk3::FileChooser::filter()
+  See void filter(const char *pattern)*/
+
+/** \fn void fltk3::FileChooser::filter_value(int f)
+  Sets the current filename filter selection.*/
+
+/** \fn int fltk3::FileChooser::filter_value()
+  Gets the current filename filter selection.*/
+
+/** \fn void fltk3::FileChooser::hide()
+  Hides the fltk3::FileChooser window.*/
+
+/** \fn void fltk3::FileChooser::iconsize(uchar s)
+  Sets the size of the icons in the fltk3::FileBrowser.  By
+  default the icon size is set to 1.5 times the textsize().
+*/
+
+/** \fn uchar fltk3::FileChooser::iconsize()
+  Gets the size of the icons in the fltk3::FileBrowser.  By
+  default the icon size is set to 1.5 times the textsize().
+*/
+
+/** \fn void fltk3::FileChooser::label(const char *l)
+  Sets the title bar text for the fltk3::FileChooser.*/
+
+/** \fn const char *fltk3::FileChooser::label()
+  Gets the title bar text for the fltk3::FileChooser.*/
+
+/** \fn void fltk3::FileChooser::ok_label(const char *l)
+  Sets the label for the "ok" button in the fltk3::FileChooser.
+*/
+
+/** \fn const char *fltk3::FileChooser::ok_label()
+  Gets the label for the "ok" button in the fltk3::FileChooser.
+*/
+
+/** \fn int fltk3::FileChooser::preview() const
+   Returns the current state of the preview box. */
+
+/** \fn void fltk3::FileChooser::rescan()
+  Reloads the current directory in the fltk3::FileBrowser.*/
+
+/** \fn void fltk3::FileChooser::show()
+  Shows the fltk3::FileChooser window.*/
+
+/** \fn void fltk3::FileChooser::textcolor(fltk3::Color c)
+  Sets the current fltk3::FileBrowser text color.*/
+
+/** \fn fltk3::Color fltk3::FileChooser::textcolor()
+  Gets the current fltk3::FileBrowser text color.*/
+
+/** \fn void fltk3::FileChooser::textfont(fltk3::Font f)
+  Sets the current fltk3::FileBrowser text font.*/
+
+/** \fn fltk3::Font fltk3::FileChooser::textfont()
+  Gets the current fltk3::FileBrowser text font.*/
+
+/** \fn void fltk3::FileChooser::textsize(fltk3::Fontsize s)
+  Sets the current fltk3::FileBrowser text size.*/
+
+/** \fn fltk3::Fontsize fltk3::FileChooser::textsize()
+  Gets the current fltk3::FileBrowser text size.*/
+
+/** \fn void fltk3::FileChooser::type(int t)
+  Sets the current type of fltk3::FileChooser.*/
+
+/** \fn int fltk3::FileChooser::type()
+  Gets the current type of fltk3::FileChooser.*/
+
+/** \fn void fltk3::FileChooser::value(const char *pathname)
+  Sets the current value of the selected file.
+*/
+
+/** \fn const char *fltk3::FileChooser::value(int f)
+ Gets the current value of the selected file(s).
+ \p f is a \c 1-based index into a list of
+ file names. The number of selected files is returned by
+ fltk3::FileChooser::count().
+ 
+ This sample code loops through all selected files:
+ \code
+ // Get list of filenames user selected from a MULTI chooser
+ for ( int t=1; t<=chooser->count(); t++ ) {
+ const char *filename = chooser->value(t);
+ ...
+ }
+ \endcode
+ */
+
+/** \fn int fltk3::FileChooser::visible()
+  Returns 1 if the fltk3::FileChooser window is visible.*/
+
+/** \fn fltk3::Widget* fltk3::FileChooser::add_extra(fltk3::Widget*)
+  Adds extra widget at the bottom of fltk3::FileChooser window.
+  Returns pointer for previous extra widget or NULL if not set previously.
+  If argument is NULL only remove previous extra widget.
+
+  \note fltk3::FileChooser does \b not delete extra widget in destructor!
+     To prevent memory leakage, don't forget to delete unused extra widgets
+*/
+  /** \fn int fltk3::FileChooser::shown()
+    Returns non-zero if the file chooser main window show() has been called (but not hide()
+    see fltk3::Window::shown()
+  */
+
+  /** \fn void fltk3::FileChooser::callback(void (*cb)(fltk3::FileChooser *, void *), void *d = 0)
+    Sets the file chooser callback cb and associated data d */
+
+  /** \fn void fltk3::FileChooser::user_data(void *d)
+    Sets the file chooser user data d */
+
+  /** \fn void * fltk3::FileChooser::user_data() const
+    Gets the file chooser user data d */
+
+// *** END OF OUT OF SOURCE DOC ***
+
+// Contents:
+//
+//   fltk3::FileChooser::count()             - Return the number of selected files.
+//   fltk3::FileChooser::directory()         - Set the directory in the file chooser.
+//   fltk3::FileChooser::filter()            - Set the filter(s) for the chooser.
+//   fltk3::FileChooser::newdir()            - Make a new directory.
+//   fltk3::FileChooser::value()             - Return a selected filename.
+//   fltk3::FileChooser::rescan()            - Rescan the current directory.
+//   fltk3::FileChooser::favoritesButtonCB() - Handle favorites selections.
+//   fltk3::FileChooser::fileListCB()        - Handle clicks (and double-clicks)
+//                                          in the fltk3::FileBrowser.
+//   fltk3::FileChooser::fileNameCB()        - Handle text entry in the FileBrowser.
+//   fltk3::FileChooser::showChoiceCB()      - Handle show selections.
+//   compare_dirnames()                   - Compare two directory names.
+//   quote_pathname()                     - Quote a pathname for a menu.
+//   unquote_pathname()                   - Unquote a pathname from a menu.
+//
+//   fltk3::FileChooser::add_extra()         - add extra widget at the bottom, return pointer 
+//                                          to previous extra widget or NULL if none,
+//                                          If argument is NULL extra widget removed.
+//                                          NOTE! file chooser does't delete extra widget in 
+//                                          destructor! To prevent memory leakage don't forget
+//					    delete unused extra widgets by yourself.
+//
+
+//
+// Include necessary headers.
+//
+
+#include <fltk3/FileChooser.h>
+#include <fltk3/filename.h>
+#include <fltk3/ask.h>
+#include <fltk3/x.h>
+#include <fltk3/SharedImage.h>
+#include <fltk3/draw.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#if defined(WIN32) && ! defined (__CYGWIN__)
+#  include <direct.h>
+#  include <io.h>
+// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
+// on Windows, which is supposed to be POSIX compliant...
+#  define access _access
+#  define mkdir _mkdir
+// Apparently Borland C++ defines DIRECTORY in <direct.h>, which
+// interfers with the fltk3::FileIcon enumeration of the same name.
+#  ifdef DIRECTORY
+#    undef DIRECTORY
+#  endif // DIRECTORY
+#else
+#  include <unistd.h>
+#  include <pwd.h>
+#endif /* WIN32 */
+
+
+//
+// File chooser label strings and sort function...
+//
+
+fltk3::Preferences	fltk3::FileChooser::prefs_(fltk3::Preferences::USER, "fltk.org", "filechooser");
+
+const char	*fltk3::FileChooser::add_favorites_label = "Add to Favorites";
+const char	*fltk3::FileChooser::all_files_label = "All Files (*)";
+const char	*fltk3::FileChooser::custom_filter_label = "Custom Filter";
+const char	*fltk3::FileChooser::existing_file_label = "Please choose an existing file!";
+const char	*fltk3::FileChooser::favorites_label = "Favorites";
+const char	*fltk3::FileChooser::filename_label = "Filename:";
+#ifdef WIN32
+const char	*fltk3::FileChooser::filesystems_label = "My Computer";
+#else
+const char	*fltk3::FileChooser::filesystems_label = "File Systems";
+#endif // WIN32
+const char	*fltk3::FileChooser::manage_favorites_label = "Manage Favorites";
+const char	*fltk3::FileChooser::new_directory_label = "New Directory?";
+const char	*fltk3::FileChooser::new_directory_tooltip = "Create a new directory.";
+const char	*fltk3::FileChooser::preview_label = "Preview";
+const char	*fltk3::FileChooser::save_label = "Save";
+const char	*fltk3::FileChooser::show_label = "Show:";
+const char      *fltk3::FileChooser::hidden_label = "Show hidden files";
+fltk3::FileSortF	*fltk3::FileChooser::sort = fltk3::numericsort;
+
+
+//
+// Local functions...
+//
+
+static int	compare_dirnames(const char *a, const char *b);
+static void	quote_pathname(char *, const char *, int);
+static void	unquote_pathname(char *, const char *, int);
+
+
+//
+// 'fltk3::FileChooser::count()' - Return the number of selected files.
+//
+
+int				// O - Number of selected files
+fltk3::FileChooser::count() {
+  int		i;		// Looping var
+  int		fcount;		// Number of selected files
+  const char	*filename;	// Filename in input field or list
+
+
+  filename = fileName->value();
+
+  if (!(type_ & MULTI)) {
+    // Check to see if the file name input field is blank...
+    if (!filename || !filename[0]) return 0;
+    else return 1;
+  }
+
+  for (i = 1, fcount = 0; i <= fileList->size(); i ++)
+    if (fileList->selected(i)) {
+      // See if this file is a directory...
+      // matt: why would we do that? It is perfectly legal to select multiple
+      // directories in a DIR chooser. They are visually selected and value(i)
+      // returns all of them as expected
+      //filename = (char *)fileList->text(i);
+
+      //if (filename[strlen(filename) - 1] != '/')
+	fcount ++;
+    }
+
+  if (fcount) return fcount;
+  else if (!filename || !filename[0]) return 0;
+  else return 1;
+}
+
+
+//
+// 'fltk3::FileChooser::directory()' - Set the directory in the file chooser.
+//
+
+void
+fltk3::FileChooser::directory(const char *d)// I - Directory to change to
+{
+  char	*dirptr;			// Pointer into directory
+
+
+//  printf("fltk3::FileChooser::directory(\"%s\")\n", d == NULL ? "(null)" : d);
+
+  // NULL == current directory
+  if (d == NULL)
+    d = ".";
+
+#ifdef WIN32
+  // See if the filename contains backslashes...
+  char	*slash;				// Pointer to slashes
+  char	fixpath[FLTK3_PATH_MAX];			// Path with slashes converted
+  if (strchr(d, '\\')) {
+    // Convert backslashes to slashes...
+    strlcpy(fixpath, d, sizeof(fixpath));
+
+    for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
+      *slash = '/';
+
+    d = fixpath;
+  }
+#endif // WIN32
+
+  if (d[0] != '\0')
+  {
+    // Make the directory absolute...
+#if (defined(WIN32) && ! defined(__CYGWIN__))|| defined(__EMX__)
+    if (d[0] != '/' && d[0] != '\\' && d[1] != ':')
+#else
+    if (d[0] != '/' && d[0] != '\\')
+#endif /* WIN32 || __EMX__ */
+      fltk3::filename_absolute(directory_, d);
+    else
+      strlcpy(directory_, d, sizeof(directory_));
+
+    // Strip any trailing slash...
+    dirptr = directory_ + strlen(directory_) - 1;
+    if ((*dirptr == '/' || *dirptr == '\\') && dirptr > directory_)
+      *dirptr = '\0';
+
+    // See if we have a trailing .. or . in the filename...
+    dirptr = directory_ + strlen(directory_) - 3;
+    if (dirptr >= directory_ && strcmp(dirptr, "/..") == 0) {
+      // Yes, we have "..", so strip the trailing path...
+      *dirptr = '\0';
+      while (dirptr > directory_) {
+        if (*dirptr == '/') break;
+	dirptr --;
+      }
+
+      if (dirptr >= directory_ && *dirptr == '/')
+        *dirptr = '\0';
+    } else if ((dirptr + 1) >= directory_ && strcmp(dirptr + 1, "/.") == 0) {
+      // Strip trailing "."...
+      dirptr[1] = '\0';
+    }
+  }
+  else
+    directory_[0] = '\0';
+
+  if (shown()) {
+    // Rescan the directory...
+    rescan();
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::favoritesButtonCB()' - Handle favorites selections.
+//
+
+void
+fltk3::FileChooser::favoritesButtonCB()
+{
+  int		v;			// Current selection
+  char		pathname[FLTK3_PATH_MAX],		// Pathname
+		menuname[FLTK3_PATH_MAX];		// Menu name
+
+
+  v = favoritesButton->value();
+
+  if (!v) {
+    // Add current directory to favorites...
+    if (getenv("HOME")) v = favoritesButton->size() - 5;
+    else v = favoritesButton->size() - 4;
+
+    sprintf(menuname, "favorite%02d", v);
+
+    prefs_.set(menuname, directory_);
+    prefs_.flush();
+
+    quote_pathname(menuname, directory_, sizeof(menuname));
+    favoritesButton->add(menuname);
+
+    if (favoritesButton->size() > 104) {
+      ((fltk3::MenuItem *)favoritesButton->menu())[0].deactivate();
+    }
+  } else if (v == 1) {
+    // Manage favorites...
+    favoritesCB(0);
+  } else if (v == 2) {
+    // Filesystems/My Computer
+    directory("");
+  } else {
+    unquote_pathname(pathname, favoritesButton->text(v), sizeof(pathname));
+    directory(pathname);
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::favoritesCB()' - Handle favorites dialog.
+//
+
+void
+fltk3::FileChooser::favoritesCB(fltk3::Widget *w)
+					// I - Widget
+{
+  int		i;			// Looping var
+  char		name[32],		// Preference name
+		pathname[1024];		// Directory in list
+
+
+  if (!w) {
+    // Load the favorites list...
+    favList->clear();
+    favList->deselect();
+
+    for (i = 0; i < 100; i ++) {
+      // Get favorite directory 0 to 99...
+      sprintf(name, "favorite%02d", i);
+
+      prefs_.get(name, pathname, "", sizeof(pathname));
+
+      // Stop on the first empty favorite...
+      if (!pathname[0]) break;
+
+      // Add the favorite to the list...
+      favList->add(pathname,
+                   fltk3::FileIcon::find(pathname, fltk3::FileIcon::DIRECTORY));
+    }
+
+    favUpButton->deactivate();
+    favDeleteButton->deactivate();
+    favDownButton->deactivate();
+    favOkButton->deactivate();
+
+    favWindow->hotspot(favList);
+    favWindow->show();
+  } else if (w == favList) {
+    i = favList->value();
+    if (i) {
+      if (i > 1) favUpButton->activate();
+      else favUpButton->deactivate();
+
+      favDeleteButton->activate();
+
+      if (i < favList->size()) favDownButton->activate();
+      else favDownButton->deactivate();
+    } else {
+      favUpButton->deactivate();
+      favDeleteButton->deactivate();
+      favDownButton->deactivate();
+    }
+  } else if (w == favUpButton) {
+    i = favList->value();
+
+    favList->insert(i - 1, favList->text(i), favList->data(i));
+    favList->remove(i + 1);
+    favList->select(i - 1);
+
+    if (i == 2) favUpButton->deactivate();
+
+    favDownButton->activate();
+
+    favOkButton->activate();
+  } else if (w == favDeleteButton) {
+    i = favList->value();
+
+    favList->remove(i);
+
+    if (i > favList->size()) i --;
+    favList->select(i);
+
+    if (i < favList->size()) favDownButton->activate();
+    else favDownButton->deactivate();
+
+    if (i > 1) favUpButton->activate();
+    else favUpButton->deactivate();
+
+    if (!i) favDeleteButton->deactivate();
+
+    favOkButton->activate();
+  } else if (w == favDownButton) {
+    i = favList->value();
+
+    favList->insert(i + 2, favList->text(i), favList->data(i));
+    favList->remove(i);
+    favList->select(i + 1);
+
+    if ((i + 1) == favList->size()) favDownButton->deactivate();
+
+    favUpButton->activate();
+
+    favOkButton->activate();
+  } else if (w == favOkButton) {
+    // Copy the new list over...
+    for (i = 0; i < favList->size(); i ++) {
+      // Set favorite directory 0 to 99...
+      sprintf(name, "favorite%02d", i);
+
+      prefs_.set(name, favList->text(i + 1));
+    }
+
+    // Clear old entries as necessary...
+    for (; i < 100; i ++) {
+      // Clear favorite directory 0 to 99...
+      sprintf(name, "favorite%02d", i);
+
+      prefs_.get(name, pathname, "", sizeof(pathname));
+
+      if (pathname[0]) prefs_.set(name, "");
+      else break;
+    }
+
+    update_favorites();
+    prefs_.flush();
+
+    favWindow->hide();
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::fileListCB()' - Handle clicks (and double-clicks) in the
+//                                   fltk3::FileBrowser.
+//
+
+void
+fltk3::FileChooser::fileListCB()
+{
+  char	*filename,			// New filename
+	pathname[FLTK3_PATH_MAX];			// Full pathname to file
+
+
+  filename = (char *)fileList->text(fileList->value());
+  if (!filename)
+    return;
+
+  if (!directory_[0]) {
+    strlcpy(pathname, filename, sizeof(pathname));
+  } else if (strcmp(directory_, "/") == 0) {
+    snprintf(pathname, sizeof(pathname), "/%s", filename);
+  } else {
+    snprintf(pathname, sizeof(pathname), "%s/%s", directory_, filename);
+  }
+
+  if (fltk3::event_clicks()) {
+#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+    if ((strlen(pathname) == 2 && pathname[1] == ':') ||
+        fltk3::_filename_isdir_quick(pathname))
+#else
+    if (fltk3::_filename_isdir_quick(pathname))
+#endif /* WIN32 || __EMX__ */
+    {
+      // Change directories...
+      directory(pathname);
+
+      // Reset the click count so that a click in the same spot won't
+      // be treated as a triple-click.  We use a value of -1 because
+      // the next click will increment click count to 0, which is what
+      // we really want...
+      fltk3::event_clicks(-1);
+    }
+    else
+    {
+      // Hide the window - picked the file...
+      window->hide();
+      if (callback_) (*callback_)(this, data_);
+    }
+  }
+  else
+  {
+    // Check if the user clicks on a directory when picking files;
+    // if so, make sure only that item is selected...
+    filename = pathname + strlen(pathname) - 1;
+
+    if ((type_ & MULTI) && !(type_ & DIRECTORY)) {
+      if (*filename == '/') {
+	// Clicked on a directory, deselect everything else...
+	int i = fileList->value();
+	fileList->deselect();
+	fileList->select(i);
+      } else {
+        // Clicked on a file - see if there are other directories selected...
+        int i;
+	const char *temp;
+	for (i = 1; i <= fileList->size(); i ++) {
+	  if (i != fileList->value() && fileList->selected(i)) {
+	    temp = fileList->text(i);
+	    temp += strlen(temp) - 1;
+	    if (*temp == '/') break;	// Yes, selected directory
+	  }
+	}
+
+        if (i <= fileList->size()) {
+	  i = fileList->value();
+	  fileList->deselect();
+	  fileList->select(i);
+	}
+      }
+    }
+    // Strip any trailing slash from the directory name...
+    if (*filename == '/') *filename = '\0';
+
+//    puts("Setting fileName from fileListCB...");
+    fileName->value(pathname);
+
+    // Update the preview box...
+    fltk3::remove_timeout((fltk3::TimeoutHandler)previewCB, this);
+    fltk3::add_timeout(1.0, (fltk3::TimeoutHandler)previewCB, this);
+
+    // Do any callback that is registered...
+    if (callback_) (*callback_)(this, data_);
+
+    // Activate the OK button as needed...
+    if (!fltk3::_filename_isdir_quick(pathname) || (type_ & DIRECTORY))
+      okButton->activate();
+    else
+      okButton->deactivate();
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::fileNameCB()' - Handle text entry in the FileBrowser.
+//
+
+void
+fltk3::FileChooser::fileNameCB()
+{
+  char		*filename,	// New filename
+		*slash,		// Pointer to trailing slash
+		pathname[FLTK3_PATH_MAX],	// Full pathname to file
+		matchname[FLTK3_PATH_MAX];	// Matching filename
+  int		i,		// Looping var
+		min_match,	// Minimum number of matching chars
+		max_match,	// Maximum number of matching chars
+		num_files,	// Number of files in directory
+		first_line;	// First matching line
+  const char	*file;		// File from directory
+
+//  puts("fileNameCB()");
+//  printf("Event: %s\n", fl_eventnames[fltk3::event()]);
+
+  // Get the filename from the text field...
+  filename = (char *)fileName->value();
+
+  if (!filename || !filename[0]) {
+    okButton->deactivate();
+    return;
+  }
+
+  // Expand ~ and $ variables as needed...
+  if (strchr(filename, '~') || strchr(filename, '$')) {
+    fltk3::filename_expand(pathname, sizeof(pathname), filename);
+    filename = pathname;
+    value(pathname);
+  }
+
+  // Make sure we have an absolute path...
+#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__)
+  if (directory_[0] != '\0' && filename[0] != '/' &&
+      filename[0] != '\\' &&
+      !(isalpha(filename[0] & 255) && (!filename[1] || filename[1] == ':'))) {
+#else
+  if (directory_[0] != '\0' && filename[0] != '/') {
+#endif /* WIN32 || __EMX__ */
+    fltk3::filename_absolute(pathname, sizeof(pathname), filename);
+    value(pathname);
+    fileName->mark(fileName->position()); // no selection after expansion
+  } else if (filename != pathname) {
+    // Finally, make sure that we have a writable copy...
+    strlcpy(pathname, filename, sizeof(pathname));
+  }
+
+  filename = pathname;
+
+  // Now process things according to the key pressed...
+  if (fltk3::event_key() == fltk3::EnterKey || fltk3::event_key() == fltk3::KPEnterKey) {
+    // Enter pressed - select or change directory...
+#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+    if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) ||
+        (fltk3::_filename_isdir_quick(pathname) &&
+	 compare_dirnames(pathname, directory_))) {
+#else
+    if (fltk3::_filename_isdir_quick(pathname) &&
+	compare_dirnames(pathname, directory_)) {
+#endif /* WIN32 || __EMX__ */
+      directory(pathname);
+    } else if ((type_ & CREATE) || access(pathname, 0) == 0) {
+      if (!fltk3::_filename_isdir_quick(pathname) || (type_ & DIRECTORY)) {
+	// Update the preview box...
+	update_preview();
+
+	// Do any callback that is registered...
+	if (callback_) (*callback_)(this, data_);
+
+	// Hide the window to signal things are done...
+	window->hide();
+      }
+    } else {
+      // File doesn't exist, so beep at and alert the user...
+      fltk3::alert("%s",existing_file_label);
+    }
+  }
+  else if (fltk3::event_key() != fltk3::DeleteKey &&
+           fltk3::event_key() != fltk3::BackSpaceKey) {
+    // Check to see if the user has entered a directory...
+    if ((slash = strrchr(pathname, '/')) == NULL)
+      slash = strrchr(pathname, '\\');
+
+    if (!slash) return;
+
+    // Yes, change directories if necessary...
+    *slash++ = '\0';
+    filename = slash;
+
+#if defined(WIN32) || defined(__EMX__)
+    if (strcasecmp(pathname, directory_) &&
+        (pathname[0] || strcasecmp("/", directory_))) {
+#else
+    if (strcmp(pathname, directory_) &&
+        (pathname[0] || strcasecmp("/", directory_))) {
+#endif // WIN32 || __EMX__
+      int p = fileName->position();
+      int m = fileName->mark();
+
+      directory(pathname);
+
+      if (filename[0]) {
+	char tempname[FLTK3_PATH_MAX];
+
+	snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename);
+	fileName->value(tempname);
+	strlcpy(pathname, tempname, sizeof(pathname));
+      }
+
+      fileName->position(p, m);
+    }
+
+    // Other key pressed - do filename completion as possible...
+    num_files  = fileList->size();
+    min_match  = strlen(filename);
+    max_match  = min_match + 1;
+    first_line = 0;
+
+    for (i = 1; i <= num_files && max_match > min_match; i ++) {
+      file = fileList->text(i);
+
+#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+      if (strncasecmp(filename, file, min_match) == 0) {
+#else
+      if (strncmp(filename, file, min_match) == 0) {
+#endif // WIN32 || __EMX__
+        // OK, this one matches; check against the previous match
+	if (!first_line) {
+	  // First match; copy stuff over...
+	  strlcpy(matchname, file, sizeof(matchname));
+	  max_match = strlen(matchname);
+
+          // Strip trailing /, if any...
+	  if (matchname[max_match - 1] == '/') {
+	    max_match --;
+	    matchname[max_match] = '\0';
+	  }
+
+	  // And then make sure that the item is visible
+          fileList->topline(i);
+	  first_line = i;
+	} else {
+	  // Succeeding match; compare to find maximum string match...
+	  while (max_match > min_match)
+#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+	    if (strncasecmp(file, matchname, max_match) == 0)
+#else
+	    if (strncmp(file, matchname, max_match) == 0)
+#endif // WIN32 || __EMX__
+	      break;
+	    else
+	      max_match --;
+
+          // Truncate the string as needed...
+          matchname[max_match] = '\0';
+	}
+      }
+    }
+
+    // If we have any matches, add them to the input field...
+    if (first_line > 0 && min_match == max_match &&
+        max_match == (int)strlen(fileList->text(first_line))) {
+      // This is the only possible match...
+      fileList->deselect(0);
+      fileList->select(first_line);
+      fileList->redraw();
+    } else if (max_match > min_match && first_line) {
+      // Add the matching portion...
+      fileName->replace(filename - pathname, filename - pathname + min_match,
+                        matchname);
+
+      // Highlight it with the cursor at the end of the selection so
+      // s/he can press the right arrow to accept the selection
+      // (Tab and End also do this for both cases.)
+      fileName->position(filename - pathname + max_match,
+	                 filename - pathname + min_match);
+    } else if (max_match == 0) {
+      fileList->deselect(0);
+      fileList->redraw();
+    }
+
+    // See if we need to enable the OK button...
+    if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
+        (!fltk3::filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
+      okButton->activate();
+    } else {
+      okButton->deactivate();
+    }
+  } else {
+    // fltk3::DeleteKey or fltk3::BackSpaceKey
+    fileList->deselect(0);
+    fileList->redraw();
+    if (((type_ & CREATE) || !access(fileName->value(), 0)) &&
+        (!fltk3::filename_isdir(fileName->value()) || (type_ & DIRECTORY))) {
+      okButton->activate();
+    } else {
+      okButton->deactivate();
+    }
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::filter()' - Set the filter(s) for the chooser.
+//
+
+void
+fltk3::FileChooser::filter(const char *p)		// I - Pattern(s)
+{
+  char		*copyp,				// Copy of pattern
+		*start,				// Start of pattern
+		*end;				// End of pattern
+  int		allfiles;			// Do we have a "*" pattern?
+  char		temp[FLTK3_PATH_MAX];			// Temporary pattern string
+
+
+  // Make sure we have a pattern...
+  if (!p || !*p) p = "*";
+
+  // Copy the pattern string...
+  copyp = strdup(p);
+
+  // Separate the pattern string as necessary...
+  showChoice->clear();
+
+  for (start = copyp, allfiles = 0; start && *start; start = end) {
+    end = strchr(start, '\t');
+    if (end) *end++ = '\0';
+
+    if (strcmp(start, "*") == 0) {
+      showChoice->add(all_files_label);
+      allfiles = 1;
+    } else {
+      quote_pathname(temp, start, sizeof(temp));
+      showChoice->add(temp);
+      if (strstr(start, "(*)") != NULL) allfiles = 1;
+    }
+  }
+
+  free(copyp);
+
+  if (!allfiles) showChoice->add(all_files_label);
+
+  showChoice->add(custom_filter_label);
+  
+  showChoice->value(0);
+  showChoiceCB();
+}
+
+
+//
+// 'fltk3::FileChooser::newdir()' - Make a new directory.
+//
+
+void
+fltk3::FileChooser::newdir()
+{
+  const char	*dir;		// New directory name
+  char		pathname[FLTK3_PATH_MAX];	// Full path of directory
+
+
+  // Get a directory name from the user
+  if ((dir = fltk3::input("%s", NULL, new_directory_label)) == NULL)
+    return;
+
+  // Make it relative to the current directory as needed...
+#if (defined(WIN32) && ! defined (__CYGWIN__)) || defined(__EMX__)
+  if (dir[0] != '/' && dir[0] != '\\' && dir[1] != ':')
+#else
+  if (dir[0] != '/' && dir[0] != '\\')
+#endif /* WIN32 || __EMX__ */
+    snprintf(pathname, sizeof(pathname), "%s/%s", directory_, dir);
+  else
+    strlcpy(pathname, dir, sizeof(pathname));
+
+  // Create the directory; ignore EEXIST errors...
+#if defined(WIN32) && ! defined (__CYGWIN__)
+  if (mkdir(pathname))
+#else
+  if (mkdir(pathname, 0777))
+#endif /* WIN32 */
+    if (errno != EEXIST)
+    {
+      fltk3::alert("%s", strerror(errno));
+      return;
+    }
+
+  // Show the new directory...
+  directory(pathname);
+}
+
+
+
+/** Enable or disable the preview tile. 1 = enable preview, 0 = disable preview. */
+void fltk3::FileChooser::preview(int e)
+{
+  previewButton->value(e);
+  prefs_.set("preview", e);
+  prefs_.flush();
+
+  fltk3::Group *p = previewBox->parent();
+  if (e) {
+    int w = p->w() * 2 / 3;
+    fileList->resize(fileList->x(), fileList->y(),
+                     w, fileList->h());
+    previewBox->resize(fileList->x()+w, previewBox->y(),
+                       p->w()-w, previewBox->h());
+    previewBox->show();
+    update_preview();
+  } else {
+    fileList->resize(fileList->x(), fileList->y(),
+                     p->w(), fileList->h());
+    previewBox->resize(p->x()+p->w(), previewBox->y(),
+                       0, previewBox->h());
+    previewBox->hide();
+  }
+  p->init_sizes();
+
+  fileList->parent()->redraw();
+}
+
+
+//
+// 'fltk3::FileChooser::previewCB()' - Timeout handler for the preview box.
+//
+
+void
+fltk3::FileChooser::previewCB(fltk3::FileChooser *fc) {	// I - File chooser
+  fc->update_preview();
+}
+
+
+//
+// 'fltk3::FileChooser::rescan()' - Rescan the current directory.
+//
+
+void
+fltk3::FileChooser::rescan()
+{
+  char	pathname[FLTK3_PATH_MAX];		// New pathname for filename field
+
+
+  // Clear the current filename
+  strlcpy(pathname, directory_, sizeof(pathname));
+  if (pathname[0] && pathname[strlen(pathname) - 1] != '/') {
+    strlcat(pathname, "/", sizeof(pathname));
+  }
+//  puts("Setting fileName in rescan()");
+  fileName->value(pathname);
+
+  if (type_ & DIRECTORY)
+    okButton->activate();
+  else
+    okButton->deactivate();
+
+  // Build the file list...
+  fileList->load(directory_, sort);
+#ifndef WIN32	
+  if (!showHiddenButton->value()) remove_hidden_files();
+#endif
+  // Update the preview box...
+  update_preview();
+}
+
+//
+/**  
+  Rescan the current directory  without clearing the filename, 
+  then select the file if it is in the list
+*/
+void fltk3::FileChooser::rescan_keep_filename()
+{
+  // if no filename was set, this is likely a diretory browser
+  const char *fn = fileName->value();
+  if (!fn || !*fn || fn[strlen(fn) - 1]=='/') {
+    rescan();
+    return;
+  }
+
+  int   i;
+  char	pathname[FLTK3_PATH_MAX];		// New pathname for filename field
+  strlcpy(pathname, fn, sizeof(pathname));
+
+  // Build the file list...
+  fileList->load(directory_, sort);
+#ifndef WIN32	
+  if (!showHiddenButton->value()) remove_hidden_files();
+#endif
+  // Update the preview box...
+  update_preview();
+
+  // and select the chosen file
+  char found = 0;
+  char *slash = strrchr(pathname, '/');
+  if (slash) 
+    slash++;
+  else
+    slash = pathname;
+  for (i = 1; i <= fileList->size(); i ++)
+#if defined(WIN32) || defined(__EMX__)
+    if (strcasecmp(fileList->text(i), slash) == 0) {
+#else
+    if (strcmp(fileList->text(i), slash) == 0) {
+#endif // WIN32 || __EMX__
+      fileList->topline(i);
+      fileList->select(i);
+      found = 1;
+      break;
+    }
+
+  // update OK button activity
+  if (found || type_ & CREATE)
+    okButton->activate();
+  else
+    okButton->deactivate();
+}
+
+
+//
+// 'fltk3::FileChooser::showChoiceCB()' - Handle show selections.
+//
+
+void
+fltk3::FileChooser::showChoiceCB()
+{
+  const char	*item,			// Selected item
+		*patstart;		// Start of pattern
+  char		*patend;		// End of pattern
+  char		temp[FLTK3_PATH_MAX];		// Temporary string for pattern
+
+
+  item = showChoice->text(showChoice->value());
+
+  if (strcmp(item, custom_filter_label) == 0) {
+    if ((item = fltk3::input("%s", pattern_, custom_filter_label)) != NULL) {
+      strlcpy(pattern_, item, sizeof(pattern_));
+
+      quote_pathname(temp, item, sizeof(temp));
+      showChoice->add(temp);
+      showChoice->value(showChoice->size() - 2);
+    }
+  } else if ((patstart = strchr(item, '(')) == NULL) {
+    strlcpy(pattern_, item, sizeof(pattern_));
+  } else {
+    strlcpy(pattern_, patstart + 1, sizeof(pattern_));
+    if ((patend = strrchr(pattern_, ')')) != NULL) *patend = '\0';
+  }
+
+  fileList->filter(pattern_);
+
+  if (shown()) {
+    // Rescan the directory...
+    rescan_keep_filename();
+  }
+}
+
+
+//
+// 'fltk3::FileChooser::update_favorites()' - Update the favorites menu.
+//
+
+void
+fltk3::FileChooser::update_favorites()
+{
+  int		i;			// Looping var
+  char		pathname[FLTK3_PATH_MAX],		// Pathname
+		menuname[2048];		// Menu name
+  const char	*home;			// Home directory
+
+
+  favoritesButton->clear();
+  favoritesButton->add("bla");
+  favoritesButton->clear();
+  favoritesButton->add(add_favorites_label, fltk3::ALT + 'a', 0);
+  favoritesButton->add(manage_favorites_label, fltk3::ALT + 'm', 0, 0, fltk3::MENU_DIVIDER);
+  favoritesButton->add(filesystems_label, fltk3::ALT + 'f', 0);
+    
+  if ((home = getenv("HOME")) != NULL) {
+    quote_pathname(menuname, home, sizeof(menuname));
+    favoritesButton->add(menuname, fltk3::ALT + 'h', 0);
+  }
+
+  for (i = 0; i < 100; i ++) {
+    sprintf(menuname, "favorite%02d", i);
+    prefs_.get(menuname, pathname, "", sizeof(pathname));
+    if (!pathname[0]) break;
+
+    quote_pathname(menuname, pathname, sizeof(menuname));
+
+    if (i < 10) favoritesButton->add(menuname, fltk3::ALT + '0' + i, 0);
+    else favoritesButton->add(menuname);
+  }
+
+  if (i == 100) ((fltk3::MenuItem *)favoritesButton->menu())[0].deactivate();
+}
+
+
+//
+// 'fltk3::FileChooser::update_preview()' - Update the preview box...
+//
+
+void
+fltk3::FileChooser::update_preview()
+{
+  const char		*filename;	// Current filename
+  const char            *newlabel = 0;  // New label text
+  fltk3::SharedImage	*image = 0,     // New image
+			*oldimage;	// Old image
+  int			pbw, pbh;	// Width and height of preview box
+  int			w, h;		// Width and height of preview image
+  int                   set = 0;        // Set this flag as soon as a decent preview is found
+
+  if (!previewButton->value()) return;
+
+  filename = value();
+  if (filename == NULL) {
+    // no file name at all, so we have an empty preview
+    set = 1;
+  } else if (fltk3::filename_isdir(filename)) {
+    // filename is a directory, show a folder icon
+    newlabel = "@fileopen";
+    set = 1;
+  } else {
+    struct stat s;
+    if (fltk3::stat(filename, &s)==0) {
+      if ((s.st_mode&S_IFMT)!=S_IFREG) {
+        // this is no regular file, probably some kind of device
+        newlabel = "@-3refresh"; // a cross
+        set = 1;
+      } else if (s.st_size==0) {
+        // this file is emty
+        newlabel = "<empty file>";
+        set = 1;
+      } else {
+        // if this file is an image, try to load it
+        window->cursor(fltk3::CURSOR_WAIT);
+        fltk3::check();
+        
+        image = fltk3::SharedImage::get(filename);
+        
+        if (image) {
+          window->cursor(fltk3::CURSOR_DEFAULT);
+          fltk3::check();
+          set = 1;
+        }
+      }
+    }
+  }
+
+  oldimage = (fltk3::SharedImage *)previewBox->image();
+
+  if (oldimage) oldimage->release();
+
+  previewBox->image(0);
+
+  if (!set) {
+    FILE	*fp;
+    int		bytes;
+    char	*ptr;
+
+    if (filename) fp = fltk3::fopen(filename, "rb");
+    else fp = NULL;
+
+    if (fp != NULL) {
+      // Try reading the first 1k of data for a label...
+      bytes = fread(preview_text_, 1, sizeof(preview_text_) - 1, fp);
+      preview_text_[bytes] = '\0';
+      fclose(fp);
+    } else {
+      // Assume we can't read any data...
+      preview_text_[0] = '\0';
+    }
+
+    window->cursor(fltk3::CURSOR_DEFAULT);
+    fltk3::check();
+
+    // Scan the buffer for printable UTF8 chars...
+    for (ptr = preview_text_; *ptr; ptr++) {
+      uchar c = uchar(*ptr);
+      if ( (c&0x80)==0 ) {
+        if (!isprint(c&255) && !isspace(c&255)) break;
+      } else if ( (c&0xe0)==0xc0 ) {
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+      } else if ( (c&0xf0)==0xe0 ) {
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+      } else if ( (c&0xf8)==0xf0 ) {
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+        if (ptr[1] && (ptr[1]&0xc0)!=0x80) break;
+        ptr++;
+      }
+    } 
+//         *ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
+//	 ptr ++);
+
+    // Scan the buffer for printable characters in 8 bit
+    if (*ptr || ptr == preview_text_) {
+      for (ptr = preview_text_;
+         *ptr && (isprint(*ptr & 255) || isspace(*ptr & 255));
+	 ptr ++);
+    }
+
+    if (*ptr || ptr == preview_text_) {
+      // Non-printable file, just show a big ?...
+      previewBox->label(filename ? "?" : 0);
+      previewBox->align(fltk3::ALIGN_CLIP);
+      previewBox->labelsize(75);
+      previewBox->labelfont(fltk3::HELVETICA);
+    } else {
+      // Show the first 1k of text...
+      int size = previewBox->h() / 20;
+      if (size < 6) size = 6;
+      else if (size > fltk3::NORMAL_SIZE) size = fltk3::NORMAL_SIZE;
+
+      previewBox->label(preview_text_);
+      previewBox->align((fltk3::Align)(fltk3::ALIGN_CLIP | fltk3::ALIGN_INSIDE |
+                                   fltk3::ALIGN_LEFT | fltk3::ALIGN_TOP));
+      previewBox->labelsize(size);
+      previewBox->labelfont(fltk3::COURIER);
+    }
+  } else if (image) {
+    pbw = previewBox->w() - 20;
+    pbh = previewBox->h() - 20;
+
+    if (image->w() > pbw || image->h() > pbh) {
+      w   = pbw;
+      h   = w * image->h() / image->w();
+
+      if (h > pbh) {
+	h = pbh;
+	w = h * image->w() / image->h();
+      }
+
+      oldimage = (fltk3::SharedImage *)image->copy(w, h);
+      previewBox->image((fltk3::Image *)oldimage);
+
+      image->release();
+    } else {
+      previewBox->image((fltk3::Image *)image);
+    }
+
+    previewBox->align(fltk3::ALIGN_CLIP);
+    previewBox->label(0);
+  } else if (newlabel) {
+    previewBox->label(newlabel);
+    previewBox->align(fltk3::ALIGN_CLIP);
+    previewBox->labelsize(newlabel[0]=='@'?75:12);
+    previewBox->labelfont(fltk3::HELVETICA);
+  }
+
+  previewBox->redraw();
+}
+
+
+//
+// 'fltk3::FileChooser::value()' - Return a selected filename.
+//
+
+const char *			// O - Filename or NULL
+fltk3::FileChooser::value(int f)	// I - File number
+{
+  int		i;		// Looping var
+  int		fcount;		// Number of selected files
+  const char	*name;		// Current filename
+  static char	pathname[FLTK3_PATH_MAX];	// Filename + directory
+
+
+  name = fileName->value();
+
+  if (!(type_ & MULTI)) {
+    // Return the filename in the filename field...
+    if (!name || !name[0]) return NULL;
+    else return name;
+  }
+
+  // Return a filename from the list...
+  for (i = 1, fcount = 0; i <= fileList->size(); i ++)
+    if (fileList->selected(i)) {
+      // See if this file is a selected file/directory...
+      name = fileList->text(i);
+
+      fcount ++;
+
+      if (fcount == f) {
+	if (directory_[0]) {
+	  snprintf(pathname, sizeof(pathname), "%s/%s", directory_, name);
+	} else {
+	  strlcpy(pathname, name, sizeof(pathname));
+	}
+
+	return pathname;
+      }
+    }
+
+  // If nothing is selected, use the filename field...
+  if (!name || !name[0]) return NULL;
+  else return name;
+}
+
+
+//
+// 'fltk3::FileChooser::value()' - Set the current filename.
+//
+
+void
+fltk3::FileChooser::value(const char *filename)
+					// I - Filename + directory
+{
+  int	i,				// Looping var
+  	fcount;				// Number of items in list
+  char	*slash;				// Directory separator
+  char	pathname[FLTK3_PATH_MAX];		// Local copy of filename
+
+
+//  printf("fltk3::FileChooser::value(\"%s\")\n", filename == NULL ? "(null)" : filename);
+
+  // See if the filename is the "My System" directory...
+  if (filename == NULL || !filename[0]) {
+    // Yes, just change the current directory...
+    directory(filename);
+    fileName->value("");
+    okButton->deactivate();
+    return;
+  }
+
+#ifdef WIN32
+  // See if the filename contains backslashes...
+  char	fixpath[FLTK3_PATH_MAX];			// Path with slashes converted
+  if (strchr(filename, '\\')) {
+    // Convert backslashes to slashes...
+    strlcpy(fixpath, filename, sizeof(fixpath));
+
+    for (slash = strchr(fixpath, '\\'); slash; slash = strchr(slash + 1, '\\'))
+      *slash = '/';
+
+    filename = fixpath;
+  }
+#endif // WIN32
+
+  // See if there is a directory in there...
+  fltk3::filename_absolute(pathname, sizeof(pathname), filename);
+
+  if ((slash = strrchr(pathname, '/')) != NULL) {
+    // Yes, change the display to the directory... 
+    if (!fltk3::filename_isdir(pathname)) *slash++ = '\0';
+
+    directory(pathname);
+    if (*slash == '/') slash = pathname;
+  } else {
+    directory(".");
+    slash = pathname;
+  }
+
+  // Set the input field to the absolute path...
+  if (slash > pathname) slash[-1] = '/';
+
+  fileName->value(pathname);
+  fileName->position(0, strlen(pathname));
+  okButton->activate();
+
+  // Then find the file in the file list and select it...
+  fcount = fileList->size();
+
+  fileList->deselect(0);
+  fileList->redraw();
+
+  for (i = 1; i <= fcount; i ++)
+#if defined(WIN32) || defined(__EMX__)
+    if (strcasecmp(fileList->text(i), slash) == 0) {
+#else
+    if (strcmp(fileList->text(i), slash) == 0) {
+#endif // WIN32 || __EMX__
+//      printf("Selecting line %d...\n", i);
+      fileList->topline(i);
+      fileList->select(i);
+      break;
+    }
+}
+  
+void fltk3::FileChooser::show()
+{
+  window->hotspot(fileList);
+  window->show();
+  fltk3::flush();
+  fltk3::cursor(fltk3::CURSOR_WAIT);
+  rescan_keep_filename();
+  fltk3::cursor(fltk3::CURSOR_DEFAULT);
+  fileName->take_focus();
+#ifdef WIN32
+  showHiddenButton->hide();
+#endif
+}
+  
+void fltk3::FileChooser::showHidden(int value)
+{
+  if (value) {
+    fileList->load(directory());
+  } else {
+    remove_hidden_files();
+    fileList->redraw();
+  }
+}
+
+void fltk3::FileChooser::remove_hidden_files()
+{
+  int count = fileList->size();
+  for(int num = count; num >= 1; num--) {
+    const char *p = fileList->text(num);
+    if (*p == '.' && strcmp(p, "../") != 0) fileList->remove(num);
+  }
+  fileList->topline(1);
+}
+  
+
+
+//
+// 'compare_dirnames()' - Compare two directory names.
+//
+
+static int
+compare_dirnames(const char *a, const char *b) {
+  int alen, blen;
+
+  // Get length of each string...
+  alen = strlen(a) - 1;
+  blen = strlen(b) - 1;
+
+  if (alen < 0 || blen < 0) return alen - blen;
+
+  // Check for trailing slashes...
+  if (a[alen] != '/') alen ++;
+  if (b[blen] != '/') blen ++;
+
+  // If the lengths aren't the same, then return the difference...
+  if (alen != blen) return alen - blen;
+
+  // Do a comparison of the first N chars (alen == blen at this point)...
+#ifdef WIN32
+  return strncasecmp(a, b, alen);
+#else
+  return strncmp(a, b, alen);
+#endif // WIN32
+}
+
+
+//
+// 'quote_pathname()' - Quote a pathname for a menu.
+//
+
+static void
+quote_pathname(char       *dst,		// O - Destination string
+               const char *src,		// I - Source string
+	       int        dstsize)	// I - Size of destination string
+{
+  dstsize --;
+
+  while (*src && dstsize > 1) {
+    if (*src == '\\') {
+      // Convert backslash to forward slash...
+      *dst++ = '\\';
+      *dst++ = '/';
+      src ++;
+    } else {
+      if (*src == '/') *dst++ = '\\';
+
+      *dst++ = *src++;
+    }
+  }
+
+  *dst = '\0';
+}
+
+
+//
+// 'unquote_pathname()' - Unquote a pathname from a menu.
+//
+
+static void
+unquote_pathname(char       *dst,	// O - Destination string
+                 const char *src,	// I - Source string
+	         int        dstsize)	// I - Size of destination string
+{
+  dstsize --;
+
+  while (*src && dstsize > 1) {
+    if (*src == '\\') src ++;
+    *dst++ = *src++;
+  }
+
+  *dst = '\0';
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/FileIcon.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Icon.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/FileIcon.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileIcon.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,490 @@
+//
+// "$Id$"
+//
+// fltk3::FileIcon routines.
+//
+// KDE icon code donated by Maarten De Boer.
+//
+// Copyright 1999-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::FileIcon::fltk3::FileIcon()       - Create a new file icon.
+//   fltk3::FileIcon::~Fl_File_Icon()      - Remove a file icon.
+//   fltk3::FileIcon::add()               - Add data to an icon.
+//   fltk3::FileIcon::find()              - Find an icon based upon a given file.
+//   fltk3::FileIcon::draw()              - Draw an icon.
+//   fltk3::FileIcon::label()             - Set the widgets label to an icon.
+//   fltk3::FileIcon::labeltype()         - Draw the icon label.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
+#  include <io.h>
+#  define F_OK	0
+#else
+#  include <unistd.h>
+#endif /* WIN32 || __EMX__ */
+
+#include <fltk3/FileIcon.h>
+#include <fltk3/Widget.h>
+#include <fltk3/draw.h>
+#include <fltk3/filename.h>
+
+
+//
+// Define missing POSIX/XPG4 macros as needed...
+//
+
+#ifndef S_ISDIR
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif /* !S_ISDIR */
+
+
+//
+// Icon cache...
+//
+
+fltk3::FileIcon	*fltk3::FileIcon::first_ = (fltk3::FileIcon *)0;
+
+
+/**
+  Creates a new fltk3::FileIcon with the specified information.
+  \param[in] p filename pattern
+  \param[in] t file type
+  \param[in] nd number of data values
+  \param[in] d data values
+*/
+fltk3::FileIcon::FileIcon(const char *p,	/* I - Filename pattern */
+                	   int        t,	/* I - File type */
+			   int        nd,	/* I - Number of data values */
+			   short      *d)	/* I - Data values */
+{
+  // Initialize the pattern and type...
+  pattern_ = p;
+  type_    = t;
+
+  // Copy icon data as needed...
+  if (nd)
+  {
+    num_data_   = nd;
+    alloc_data_ = nd + 1;
+    data_       = (short *)calloc(sizeof(short), nd + 1);
+    memcpy(data_, d, nd * sizeof(short));
+  }
+  else
+  {
+    num_data_   = 0;
+    alloc_data_ = 0;
+  }
+
+  // And add the icon to the list of icons...
+  next_  = first_;
+  first_ = this;
+}
+
+
+/**
+  The destructor destroys the icon and frees all memory that has been
+  allocated for it.
+*/
+fltk3::FileIcon::~FileIcon() {
+  fltk3::FileIcon	*current,	// Current icon in list
+		*prev;		// Previous icon in list
+
+
+  // Find the icon in the list...
+  for (current = first_, prev = (fltk3::FileIcon *)0;
+       current != this && current != (fltk3::FileIcon *)0;
+       prev = current, current = current->next_);
+
+  // Remove the icon from the list as needed...
+  if (current)
+  {
+    if (prev)
+      prev->next_ = current->next_;
+    else
+      first_ = current->next_;
+  }
+
+  // Free any memory used...
+  if (alloc_data_)
+    free(data_);
+}
+
+
+/**
+  Adds a keyword value to the icon array, returning a pointer to it.
+  \param[in] d data value
+*/
+short *				// O - Pointer to new data value
+fltk3::FileIcon::add(short d)	// I - Data to add
+{
+  short	*dptr;			// Pointer to new data value
+
+
+  // Allocate/reallocate memory as needed
+  if ((num_data_ + 1) >= alloc_data_)
+  {
+    alloc_data_ += 128;
+
+    if (alloc_data_ == 128)
+      dptr = (short *)malloc(sizeof(short) * alloc_data_);
+    else
+      dptr = (short *)realloc(data_, sizeof(short) * alloc_data_);
+
+    if (dptr == NULL)
+      return (NULL);
+
+    data_ = dptr;
+  }
+
+  // Store the new data value and return
+  data_[num_data_++] = d;
+  data_[num_data_]   = END;
+
+  return (data_ + num_data_ - 1);
+}
+
+
+/**
+  Finds an icon that matches the given filename and file type.
+  \param[in] filename name of file
+  \param[in] filetype enumerated file type
+  \return matching file icon or NULL
+*/
+fltk3::FileIcon *				// O - Matching file icon or NULL
+fltk3::FileIcon::find(const char *filename,// I - Name of file */
+                   int        filetype)	// I - Enumerated file type
+{
+  fltk3::FileIcon	*current;		// Current file in list
+#ifndef WIN32
+  struct stat	fileinfo;		// Information on file
+#endif // !WIN32
+  const char	*name;			// Base name of filename
+
+
+  // Get file information if needed...
+  if (filetype == ANY)
+  {
+#ifdef WIN32
+    if (filename[strlen(filename) - 1] == '/')
+      filetype = DIRECTORY;
+    else if (fltk3::filename_isdir(filename))
+      filetype = DIRECTORY;
+    else
+      filetype = PLAIN;
+#else
+    if (!fltk3::stat(filename, &fileinfo))
+    {
+      if (S_ISDIR(fileinfo.st_mode))
+        filetype = DIRECTORY;
+#  ifdef S_IFIFO
+      else if (S_ISFIFO(fileinfo.st_mode))
+        filetype = FIFO;
+#  endif // S_IFIFO
+#  if defined(S_ICHR) && defined(S_IBLK)
+      else if (S_ISCHR(fileinfo.st_mode) || S_ISBLK(fileinfo.st_mode))
+        filetype = DEVICE;
+#  endif // S_ICHR && S_IBLK
+#  ifdef S_ILNK
+      else if (S_ISLNK(fileinfo.st_mode))
+        filetype = LINK;
+#  endif // S_ILNK
+      else
+        filetype = PLAIN;
+    }
+    else
+      filetype = PLAIN;
+#endif // WIN32
+  }
+
+  // Look at the base name in the filename
+  name = fltk3::filename_name(filename);
+
+  // Loop through the available file types and return any match that
+  // is found...
+  for (current = first_; current != (fltk3::FileIcon *)0; current = current->next_)
+    if ((current->type_ == filetype || current->type_ == ANY) &&
+        (fltk3::filename_match(filename, current->pattern_) ||
+	 fltk3::filename_match(name, current->pattern_)))
+      break;
+
+  // Return the match (if any)...
+  return (current);
+}
+
+/**
+  Draws an icon in the indicated area.
+  \param[in] x, y, w, h position and size
+  \param[in] ic icon color
+  \param[in] active status, default is active [non-zero]
+*/
+void
+fltk3::FileIcon::draw(int      x,		// I - Upper-lefthand X
+        	   int      y,		// I - Upper-lefthand Y
+		   int      w,		// I - Width of bounding box
+		   int      h,		// I - Height of bounding box
+        	   fltk3::Color ic,		// I - Icon color...
+        	   int      active)	// I - Active or inactive?
+{
+  fltk3::Color	c,		// Current color
+		oc;		// Outline color
+  short		*d,		// Pointer to data
+		*dend;		// End of data...
+  short		*prim;		// Pointer to start of primitive...
+  double	scale;		// Scale of icon
+
+
+  // Don't try to draw a NULL array!
+  if (num_data_ == 0)
+    return;
+
+  // Setup the transform matrix as needed...
+  scale = w < h ? w : h;
+
+  fltk3::push_matrix();
+  fltk3::translate((float)x + 0.5 * ((float)w - scale),
+               (float)y + 0.5 * ((float)h + scale));
+  fltk3::scale(scale, -scale);
+
+  // Loop through the array until we see an unmatched END...
+  d    = data_;
+  dend = data_ + num_data_;
+  prim = NULL;
+  c    = ic;
+
+  if (active)
+    fltk3::color(c);
+  else
+    fltk3::color(fltk3::inactive(c));
+
+  while (d < dend)
+    switch (*d)
+    {
+      case END :
+          if (prim)
+            switch (*prim)
+	    {
+	      case LINE :
+		  fltk3::end_line();
+		  break;
+
+	      case CLOSEDLINE :
+		  fltk3::end_loop();
+		  break;
+
+	      case POLYGON :
+		  fltk3::end_complex_polygon();
+		  break;
+
+	      case OUTLINEPOLYGON :
+		  fltk3::end_complex_polygon();
+
+        	  oc = (fltk3::Color)((((unsigned short *)prim)[1] << 16) | 
+	                	  ((unsigned short *)prim)[2]);
+                  if (active)
+		  {
+                    if (oc == fltk3::ICON_COLOR)
+		      fltk3::color(ic);
+		    else
+		      fltk3::color(oc);
+		  }
+		  else
+		  {
+                    if (oc == fltk3::ICON_COLOR)
+		      fltk3::color(fltk3::inactive(ic));
+		    else
+		      fltk3::color(fltk3::inactive(oc));
+		  }
+
+		  fltk3::begin_loop();
+
+		  prim += 3;
+		  while (*prim == VERTEX)
+		  {
+		    fltk3::vertex(prim[1] * 0.0001, prim[2] * 0.0001);
+		    prim += 3;
+		  }
+
+        	  fltk3::end_loop();
+		  fltk3::color(c);
+		  break;
+	    }
+
+          prim = NULL;
+	  d ++;
+	  break;
+
+      case COLOR :
+          c = (fltk3::Color)((((unsigned short *)d)[1] << 16) | 
+	                   ((unsigned short *)d)[2]);
+
+          if (c == fltk3::ICON_COLOR)
+	    c = ic;
+
+          if (!active)
+	    c = fltk3::inactive(c);
+
+          fltk3::color(c);
+	  d += 3;
+	  break;
+
+      case LINE :
+          prim = d;
+	  d ++;
+	  fltk3::begin_line();
+	  break;
+
+      case CLOSEDLINE :
+          prim = d;
+	  d ++;
+	  fltk3::begin_loop();
+	  break;
+
+      case POLYGON :
+          prim = d;
+	  d ++;
+	  fltk3::begin_complex_polygon();
+	  break;
+
+      case OUTLINEPOLYGON :
+          prim = d;
+	  d += 3;
+	  fltk3::begin_complex_polygon();
+	  break;
+
+      case VERTEX :
+          if (prim)
+	    fltk3::vertex(d[1] * 0.0001, d[2] * 0.0001);
+	  d += 3;
+	  break;
+
+      default : // Ignore invalid data...
+          d ++;
+    }
+
+  // If we still have an open primitive, close it...
+  if (prim)
+    switch (*prim)
+    {
+      case LINE :
+	  fltk3::end_line();
+	  break;
+
+      case CLOSEDLINE :
+	  fltk3::end_loop();
+	  break;
+
+      case POLYGON :
+	  fltk3::end_polygon();
+	  break;
+
+      case OUTLINEPOLYGON :
+	  fltk3::end_polygon();
+
+          oc = (fltk3::Color)((((unsigned short *)prim)[1] << 16) | 
+	                  ((unsigned short *)prim)[2]);
+          if (active)
+	  {
+            if (oc == fltk3::ICON_COLOR)
+	      fltk3::color(ic);
+	    else
+	      fltk3::color(oc);
+	  }
+	  else
+	  {
+            if (oc == fltk3::ICON_COLOR)
+	      fltk3::color(fltk3::inactive(ic));
+	    else
+	      fltk3::color(fltk3::inactive(oc));
+	  }
+
+	  fltk3::begin_loop();
+
+	  prim += 3;
+	  while (*prim == VERTEX)
+	  {
+	    fltk3::vertex(prim[1] * 0.0001, prim[2] * 0.0001);
+	    prim += 3;
+	  }
+
+          fltk3::end_loop();
+	  fltk3::color(c);
+	  break;
+    }
+
+  // Restore the transform matrix
+  fltk3::pop_matrix();
+}
+
+/**
+  Applies the icon to the widget, registering the fltk3::FileIcon
+  label type as needed.
+  \param[in] w widget for which this icon will become the label
+*/
+void fltk3::FileIcon::label(fltk3::Widget *w)	// I - Widget to label
+{
+  w->label(fltk3::ICON_LABEL, (const char*)this);
+}
+
+
+/**
+  Draw the icon label.
+  \param[in] o label data
+  \param[in] x, y, w, h position and size of label
+  \param[in] a label alignment [not used]
+*/
+void fl_icon_labeltype(const fltk3::Label *o,	// I - Label data
+                	int            x,	// I - X position of label
+			int            y,	// I - Y position of label
+			int            w,	// I - Width of label
+			int            h,	// I - Height of label
+			fltk3::Align       a)	// I - Label alignment (not used)
+{
+  fltk3::FileIcon *icon;			// Pointer to icon data
+
+
+  (void)a;
+
+  icon = (fltk3::FileIcon *)(o->value);
+  if (icon) icon->draw(x, y, w, h, (fltk3::Color)(o->color));
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/FileInput.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Input.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/FileInput.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/FileInput.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,302 @@
+//
+// "$Id$"
+//
+// File_Input header file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Original version Copyright 1998 by Curtis Edwards.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/FileInput.h>
+#include <fltk3/Window.h>
+#include <fltk3/draw.h>
+#include <fltk3/filename.h>
+#include <stdio.h>
+#include "flstring.h"
+
+
+//
+// Height of directory buttons...
+//
+
+#define DIR_HEIGHT	10
+
+
+//
+// Redraw bit for directory bar...
+//
+
+namespace fltk3 {
+  const unsigned int DAMAGE_BAR = 0x10;
+};
+
+
+/**
+  Creates a new fltk3::FileInput widget using the given position,
+  size, and label string. The default boxtype is fltk3::DOWN_BOX.
+  \param[in] X, Y, W, H position and size of the widget
+  \param[in] L widget label, default is no label
+*/
+fltk3::FileInput::FileInput(int X, int Y, int W, int H, const char *L)
+  : fltk3::Input(X, Y, W, H, L) {
+  buttons_[0] = 0;
+  errorcolor_ = fltk3::RED;
+  ok_entry_   = 1;
+  pressed_    = -1;
+
+  down_box(fltk3::UP_BOX);
+}
+
+/**
+  Draw directory buttons.
+*/
+void fltk3::FileInput::draw_buttons() {
+  int	i,					// Looping var
+	X;					// Current X position
+
+
+  if (damage() & (fltk3::DAMAGE_BAR | fltk3::DAMAGE_ALL)) {
+    update_buttons();
+  }
+
+  for (X = 0, i = 0; buttons_[i]; i ++)
+  {
+    if ((X + buttons_[i]) > xscroll()) {
+      if (X < xscroll()) {
+        draw_box(pressed_ == i ? fltk3::down(down_box()) : down_box(),
+                 x(), y(), X + buttons_[i] - xscroll(), DIR_HEIGHT, fltk3::GRAY);
+      } else if ((X + buttons_[i] - xscroll()) > w()) {
+	draw_box(pressed_ == i ? fltk3::down(down_box()) : down_box(),
+        	 x() + X - xscroll(), y(), w() - X + xscroll(), DIR_HEIGHT,
+		 fltk3::GRAY);
+      } else {
+        draw_box(pressed_ == i ? fltk3::down(down_box()) : down_box(),
+	         x() + X - xscroll(), y(), buttons_[i], DIR_HEIGHT, fltk3::GRAY);
+      }
+    }
+
+    X += buttons_[i];
+  }
+
+  if (X < w()) {
+    draw_box(pressed_ == i ? fltk3::down(down_box()) : down_box(),
+             x() + X - xscroll(), y(), w() - X + xscroll(), DIR_HEIGHT, fltk3::GRAY);
+  }
+}
+
+/**
+  Update the sizes of the directory buttons.
+*/
+void fltk3::FileInput::update_buttons() {
+  int		i;				// Looping var
+  const char	*start,				// Start of path component
+		*end;				// End of path component
+
+
+//  puts("update_buttons()");
+
+  // Set the current font & size...
+  fltk3::font(textfont(), textsize());
+
+  // Loop through the value string, setting widths...
+  for (i = 0, start = value();
+       start && i < (int)(sizeof(buttons_) / sizeof(buttons_[0]) - 1);
+       start = end, i ++) {
+//    printf("    start = \"%s\"\n", start);
+    if ((end = strchr(start, '/')) == NULL)
+#if defined(WIN32) || defined(__EMX__)
+      if ((end = strchr(start, '\\')) == NULL)
+#endif // WIN32 || __EMX__
+      break;
+
+    end ++;
+
+    buttons_[i] = (short)fltk3::width(start, end - start);
+    if (!i) buttons_[i] += fltk3::box_dx(box()) + 6;
+  }
+
+//  printf("    found %d components/buttons...\n", i);
+
+  buttons_[i] = 0;
+}
+
+
+/**
+  Sets the value of the widget given a new string value and its length.
+  Returns non 0 on success.
+  \param[in] str new string value
+  \param[in] len lengh of value
+*/
+int						// O - TRUE on success
+fltk3::FileInput::value(const char *str,		// I - New string value
+                     int        len) {		// I - Length of value
+  damage(fltk3::DAMAGE_BAR);
+  return Input::value(str,len);
+}
+
+
+/**
+  Sets the value of the widget given a new string value.
+  Returns non 0 on success.
+  \param[in] str new string value
+*/
+int						// O - TRUE on success
+fltk3::FileInput::value(const char *str) {		// I - New string value
+  damage(fltk3::DAMAGE_BAR);
+  return Input::value(str);
+}
+
+
+/**
+  Draws the file input widget
+*/
+void fltk3::FileInput::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  fltk3::Boxtype b = box();
+  if (damage() & (fltk3::DAMAGE_BAR | fltk3::DAMAGE_ALL)) draw_buttons();
+  // this flag keeps fltk3::Input_::drawtext from drawing a bogus box!
+  char must_trick_fl_input_ = 
+    fltk3::focus()!=this && !size() && !(damage()&fltk3::DAMAGE_ALL);
+  if ((damage() & fltk3::DAMAGE_ALL) || must_trick_fl_input_) 
+    draw_box(b,x(),y()+DIR_HEIGHT,w(),h()-DIR_HEIGHT,color());
+  if (!must_trick_fl_input_) 
+    Input_::drawtext(x()+fltk3::box_dx(b)+3, y()+fltk3::box_dy(b)+DIR_HEIGHT,
+		        w()-fltk3::box_dw(b)-6, h()-fltk3::box_dh(b)-DIR_HEIGHT);
+}
+
+
+
+/**
+  Handle events in the widget.
+  Return non zero if event is handled.
+  \param[in] event
+*/
+int						// O - TRUE if we handled event
+fltk3::FileInput::handle(int event) 		// I - Event
+{
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+//  printf("handle(event = %d)\n", event);
+  static char inButtonBar = 0;
+
+  switch (event) {
+    case fltk3::MOVE :
+    case fltk3::ENTER :
+      if (active_r()) {
+	if (fltk3::event_y() < (y() + DIR_HEIGHT)) 
+          window()->cursor(fltk3::CURSOR_DEFAULT);
+	else 
+          window()->cursor(fltk3::CURSOR_INSERT);
+      }
+
+      return 1;
+
+    case fltk3::PUSH :
+      inButtonBar = (fltk3::event_y() < (y() + DIR_HEIGHT));
+    case fltk3::RELEASE :
+    case fltk3::DRAG :
+      if (inButtonBar) 
+        return handle_button(event);
+      else
+        return Input::handle(event);
+
+    default :
+      { fltk3::WidgetTracker wp(this);
+	if (Input::handle(event)) {
+	  if (wp.exists())
+	    damage(fltk3::DAMAGE_BAR);
+	  return 1;
+	}
+      }
+      return 0;
+  }
+}
+
+
+
+/**
+  Handles button events in the widget.
+  Return non zero if event is handled.
+  \param[in] event
+*/
+int						// O - TRUE if we handled event
+fltk3::FileInput::handle_button(int event)		// I - Event
+{
+  int		i,				// Looping var
+		X;				// Current X position
+  char		*start,				// Start of path component
+		*end;				// End of path component
+  char		newvalue[FLTK3_PATH_MAX];		// New value
+
+
+  // Figure out which button is being pressed...
+  for (X = 0, i = 0; buttons_[i]; i ++)
+  {
+    X += buttons_[i];
+
+    if (X > xscroll() && fltk3::event_x() < (x() + X - xscroll())) break;
+  }
+
+//  printf("handle_button(event = %d), button = %d\n", event, i);
+
+  // Redraw the directory bar...
+  if (event == fltk3::RELEASE) pressed_ = -1;
+  else pressed_ = (short)i;
+
+  window()->make_current();
+  draw_buttons();
+
+  // Return immediately if the user is clicking on the last button or
+  // has not released the mouse button...
+  if (!buttons_[i] || event != fltk3::RELEASE) return 1;
+
+  // Figure out where to truncate the path...
+  strlcpy(newvalue, value(), sizeof(newvalue));
+
+  for (start = newvalue, end = start; start && i >= 0; start = end, i --) {
+//    printf("    start = \"%s\"\n", start);
+    if ((end = strchr(start, '/')) == NULL)
+#if defined(WIN32) || defined(__EMX__)
+      if ((end = strchr(start, '\\')) == NULL)
+#endif // WIN32 || __EMX__
+      break;
+
+    end ++;
+  }
+
+  if (i < 0) {
+    // Found the end; truncate the value and update the buttons...
+    *start = '\0';
+    value(newvalue, start - newvalue);
+
+    // Then do the callbacks, if necessary...
+    set_changed();
+    if (when() & (fltk3::WHEN_CHANGED|fltk3::WHEN_RELEASE) ) do_callback();
+  }
+
+  return 1;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/GDIPrinter.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_GDI_Printer.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/GDIPrinter.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/GDIPrinter.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,285 @@
+//
+// "$Id$"
+//
+// Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef WIN32
+#include <fltk3/Printer.h>
+
+
+#include <fltk3/ask.h>
+#include <fltk3/math.h>
+
+extern HWND fl_window;
+
+fltk3::SystemPrinter::SystemPrinter(void) : fltk3::PagedDevice() {
+  hPr = NULL;
+  driver(fltk3::DisplayDevice::display_device()->driver());
+}
+
+fltk3::SystemPrinter::~SystemPrinter(void) {
+  if (hPr) end_job();
+}
+
+static void WIN_SetupPrinterDeviceContext(HDC prHDC)
+{
+  if ( !prHDC ) return;
+  
+  fl_window = 0;
+  fl_gc = prHDC;
+  SetGraphicsMode(prHDC, GM_ADVANCED); // to allow for rotations
+  SetMapMode(prHDC, MM_ANISOTROPIC);
+  SetTextAlign(prHDC, TA_BASELINE|TA_LEFT);
+  SetBkMode(prHDC, TRANSPARENT);	
+  // this matches 720 logical units to the number of device units in 10 inches of paper
+  // thus the logical unit is the point (= 1/72 inch)
+  SetWindowExtEx(prHDC, 720, 720, NULL);
+  SetViewportExtEx(prHDC, 10*GetDeviceCaps(prHDC, LOGPIXELSX), 10*GetDeviceCaps(prHDC, LOGPIXELSY), NULL);
+}
+
+
+int fltk3::SystemPrinter::start_job (int pagecount, int *frompage, int *topage)
+// returns 0 iff OK
+{
+  DWORD       commdlgerr;
+  DOCINFO     di;
+  char        docName [256];
+  int err = 0;
+  
+  abortPrint = FALSE;
+  memset (&pd, 0, sizeof (PRINTDLG));
+  pd.lStructSize = sizeof (PRINTDLG);
+  pd.hwndOwner = GetForegroundWindow();
+  pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE | PD_NOSELECTION;
+  pd.nMinPage = 1;
+  pd.nMaxPage = pagecount;
+  if (PrintDlg (&pd) != 0) {
+    hPr = pd.hDC;
+    if (hPr != NULL) {
+      strcpy (docName, "FLTK");
+      memset(&di, 0, sizeof(DOCINFO));
+      di.cbSize = sizeof (DOCINFO);
+      di.lpszDocName = (LPCSTR) docName;
+      prerr = StartDoc (hPr, &di);
+      if (prerr < 1) {
+	abortPrint = TRUE;
+	//fltk3::alert ("StartDoc error %d", prerr);
+	err = 1;
+      }
+    } else {
+      commdlgerr = CommDlgExtendedError ();
+      fltk3::alert ("Unable to create print context, error %lu",
+		(unsigned long) commdlgerr);
+      err = 1;
+    }
+  } else {
+    err = 1;
+  }
+  if(!err) {
+    if((pd.Flags & PD_PAGENUMS) != 0 ) {
+      if (frompage) *frompage = pd.nFromPage;
+      if (topage) *topage = pd.nToPage;
+    }
+    else {
+      if (frompage) *frompage = 1;
+      if (topage) *topage = pagecount;
+    }
+    x_offset = 0;
+    y_offset = 0;
+    WIN_SetupPrinterDeviceContext (hPr);
+    gc = (void *)fl_gc;
+    this->set_current();
+  }
+  return err;
+}
+
+void fltk3::SystemPrinter::end_job (void)
+{
+  fltk3::DisplayDevice::display_device()->set_current();
+  if (hPr != NULL) {
+    if (! abortPrint) {
+      prerr = EndDoc (hPr);
+      if (prerr < 0) {
+	fltk3::alert ("EndDoc error %d", prerr);
+      }
+    }
+    DeleteDC (hPr);
+    if (pd.hDevMode != NULL) {
+      GlobalFree (pd.hDevMode);
+    }
+    if (pd.hDevNames != NULL) {
+      GlobalFree (pd.hDevNames);
+    }
+  }
+  hPr = NULL;
+}
+
+void fltk3::SystemPrinter::absolute_printable_rect(int *x, int *y, int *w, int *h)
+{
+  POINT         physPageSize;
+  POINT         pixelsPerInch;
+    
+  if (hPr == NULL) return;
+  SetWindowOrgEx(fl_gc, 0, 0, NULL);
+  
+  physPageSize.x = GetDeviceCaps(hPr, HORZRES);
+  physPageSize.y = GetDeviceCaps(hPr, VERTRES);
+  DPtoLP(hPr, &physPageSize, 1);
+  *w = physPageSize.x + 1;
+  *h = physPageSize.y + 1;
+  pixelsPerInch.x = GetDeviceCaps(hPr, LOGPIXELSX);
+  pixelsPerInch.y = GetDeviceCaps(hPr, LOGPIXELSY);
+  DPtoLP(hPr, &pixelsPerInch, 1);
+  left_margin = (pixelsPerInch.x / 4);
+  *w -= (pixelsPerInch.x / 2);
+  top_margin = (pixelsPerInch.y / 4);
+  *h -= (pixelsPerInch.y / 2);
+  
+  *x = left_margin;
+  *y = top_margin;
+  origin(x_offset, y_offset);
+}
+
+void fltk3::SystemPrinter::margins(int *left, int *top, int *right, int *bottom)
+{
+  int x, y, w, h;
+  absolute_printable_rect(&x, &y, &w, &h);
+  if (left) *left = x;
+  if (top) *top = y;
+  if (right) *right = x;
+  if (bottom) *bottom = y;
+}
+
+int fltk3::SystemPrinter::printable_rect(int *w, int *h)
+{
+  int x, y;
+  absolute_printable_rect(&x, &y, w, h);
+  return 0;
+}
+
+int fltk3::SystemPrinter::start_page (void)
+{
+  int  rsult, w, h;
+  
+  rsult = 0;
+  if (hPr != NULL) {
+    WIN_SetupPrinterDeviceContext (hPr);
+    prerr = StartPage (hPr);
+    if (prerr < 0) {
+      fltk3::alert ("StartPage error %d", prerr);
+      rsult = 1;
+    }
+    printable_rect(&w, &h);
+    origin(0, 0);
+    fltk3::clip_region(0);
+    gc = (void *)fl_gc;
+  }
+  return rsult;
+}
+
+void fltk3::SystemPrinter::origin (int deltax, int deltay)
+{
+  SetWindowOrgEx(fl_gc, - left_margin - deltax, - top_margin - deltay, NULL);
+  x_offset = deltax;
+  y_offset = deltay;
+}
+
+void fltk3::SystemPrinter::scale (float scalex, float scaley)
+{
+  if (scaley == 0.) scaley = scalex;
+  int w, h;
+  SetWindowExtEx(fl_gc, (int)(720 / scalex + 0.5), (int)(720 / scaley + 0.5), NULL);
+  printable_rect(&w, &h);
+  origin(0, 0);
+}
+
+void fltk3::SystemPrinter::rotate (float rot_angle)
+{
+  XFORM mat;
+  float angle;
+  angle = - rot_angle * M_PI / 180.;
+  mat.eM11 = cos(angle);
+  mat.eM12 = sin(angle);
+  mat.eM21 = - mat.eM12;
+  mat.eM22 = mat.eM11;
+  mat.eDx = mat.eDy = 0;
+  SetWorldTransform(fl_gc, &mat);
+}
+
+int fltk3::SystemPrinter::end_page (void)
+{
+  int  rsult;
+  
+  rsult = 0;
+  if (hPr != NULL) {
+    prerr = EndPage (hPr);
+    if (prerr < 0) {
+      abortPrint = TRUE;
+      fltk3::alert ("EndPage error %d", prerr);
+      rsult = 1;
+    }
+  }
+  gc = NULL;
+  return rsult;
+}
+
+static int translate_stack_depth = 0;
+const int translate_stack_max = 5;
+static int translate_stack_x[translate_stack_max];
+static int translate_stack_y[translate_stack_max];
+
+static void do_translate(int x, int y)
+{
+  XFORM tr;
+  tr.eM11 = tr.eM22 = 1;
+  tr.eM12 = tr.eM21 = 0;
+  tr.eDx =  x;
+  tr.eDy =  y;
+  ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY);
+}
+
+void fltk3::SystemPrinter::translate (int x, int y)
+{
+  do_translate(x, y);
+  if (translate_stack_depth < translate_stack_max) {
+    translate_stack_x[translate_stack_depth] = x;
+    translate_stack_y[translate_stack_depth] = y;
+    translate_stack_depth++;
+    }
+}
+
+void fltk3::SystemPrinter::untranslate (void)
+{
+  if (translate_stack_depth > 0) {
+    translate_stack_depth--;
+    do_translate( - translate_stack_x[translate_stack_depth], - translate_stack_y[translate_stack_depth] );
+    }
+}
+
+#endif // WIN32
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Group.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Group.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Group.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Group.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,873 @@
+//
+// "$Id$"
+//
+// Group widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// The fltk3::Group is the only defined container type in FLTK.
+
+// fltk3::Window itself is a subclass of this, and most of the event
+// handling is designed so windows themselves work correctly.
+
+#include <stdio.h>
+#include <fltk3/run.h>
+#include <fltk3/Group.h>
+#include <fltk3/Window.h>
+#include <fltk3/draw.h>
+#include <stdlib.h>
+
+fltk3::Group* fltk3::Group::current_;
+
+// Hack: A single child is stored in the pointer to the array, while
+// multiple children are stored in an allocated array:
+
+/**
+  Returns a pointer to the array of children. <I>This pointer is only
+  valid until the next time a child is added or removed.</I>
+*/
+fltk3::Widget*const* fltk3::Group::array() const {
+  return children_ <= 1 ? (fltk3::Widget**)(&array_) : array_;
+}
+
+/**
+  Searches the child array for the widget and returns the index. Returns children()
+  if the widget is NULL or not found.
+*/
+int fltk3::Group::find(const fltk3::Widget* o) const {
+  fltk3::Widget*const* a = array();
+  int i; for (i=0; i < children_; i++) if (*a++ == o) break;
+  return i;
+}
+
+// Metrowerks CodeWarrior and others can't export the static
+// class member: current_, so these methods can't be inlined...
+
+/**
+  Sets the current group so you can build the widget
+  tree by just constructing the widgets.
+
+  begin() is automatically called by the constructor for fltk3::Group (and thus for
+  fltk3::Window as well). begin() <I>is exactly the same as</I> current(this).
+  <I>Don't forget to end() the group or window!</I>
+*/
+void fltk3::Group::begin() {current_ = this;}
+
+/**
+  <I>Exactly the same as</I> current(this->parent()). Any new widgets
+  added to the widget tree will be added to the parent of the group.
+*/
+void fltk3::Group::end() {current_ = parent();}
+
+/**
+  Returns the currently active group.
+  
+  The fltk3::Widget constructor automatically does current()->add(widget) if this
+  is not null. To prevent new widgets from being added to a group, call
+  fltk3::Group::current(0).
+*/
+fltk3::Group *fltk3::Group::current() {return current_;}
+
+/**
+  Sets the current group.
+  \see fltk3::Group::current() 
+*/
+void fltk3::Group::current(fltk3::Group *g) {current_ = g;}
+
+extern fltk3::Widget* fl_oldfocus; // set by fltk3::focus
+
+// For back-compatibility, we must adjust all events sent to child
+// windows so they are relative to that window.
+
+static int send(fltk3::Widget* o, int event) {
+  if (o->type() < fltk3::WINDOW) return o->handle(event);
+  switch ( event )
+  {
+  case fltk3::DND_ENTER: /* FALLTHROUGH */
+  case fltk3::DND_DRAG:
+    // figure out correct type of event:
+    event = (o->contains(fltk3::belowmouse())) ? fltk3::DND_DRAG : fltk3::DND_ENTER;
+  }
+  int save_x = fltk3::e_x; fltk3::e_x -= o->x();
+  int save_y = fltk3::e_y; fltk3::e_y -= o->y();
+  int ret = o->handle(event);
+  fltk3::e_y = save_y;
+  fltk3::e_x = save_x;
+  switch ( event )
+  {
+  case fltk3::ENTER: /* FALLTHROUGH */
+  case fltk3::DND_ENTER:
+    // Successful completion of fltk3::ENTER means the widget is now the
+    // belowmouse widget, but only call fltk3::belowmouse if the child
+    // widget did not do so:
+    if (!o->contains(fltk3::belowmouse())) fltk3::belowmouse(o);
+    break;
+  }
+  return ret;
+}
+
+// translate the current keystroke into up/down/left/right for navigation:
+#define ctrl(x) (x^0x40)
+static int navkey() {
+  switch (fltk3::event_key()) {
+  case 0: // not an fltk3::KEYBOARD/fltk3::SHORTCUT event
+    break;
+  case fltk3::TabKey:
+    if (!fltk3::event_state(fltk3::SHIFT)) return fltk3::RightKey;
+    return fltk3::LeftKey;
+  case fltk3::RightKey:
+    return fltk3::RightKey;
+  case fltk3::LeftKey:
+    return fltk3::LeftKey;
+  case fltk3::UpKey:
+    return fltk3::UpKey;
+  case fltk3::DownKey:
+    return fltk3::DownKey;
+  }
+  return 0;
+}
+
+int fltk3::Group::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  fltk3::Widget*const* a = array();
+  int i;
+  fltk3::Widget* o;
+
+  switch (event) {
+
+  case fltk3::FOCUS:
+    switch (navkey()) {
+    default:
+      if (savedfocus_ && savedfocus_->take_focus()) return 1;
+    case fltk3::RightKey:
+    case fltk3::DownKey:
+      for (i = children(); i--;) if ((*a++)->take_focus()) return 1;
+      break;
+    case fltk3::LeftKey:
+    case fltk3::UpKey:
+      for (i = children(); i--;) if (a[i]->take_focus()) return 1;
+      break;
+    }
+    return 0;
+
+  case fltk3::UNFOCUS:
+    savedfocus_ = fl_oldfocus;
+    return 0;
+
+  case fltk3::KEYBOARD:
+    return navigation(navkey());
+
+  case fltk3::SHORTCUT:
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && fltk3::event_inside(o) && send(o,fltk3::SHORTCUT))
+	return 1;
+    }
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && !fltk3::event_inside(o) && send(o,fltk3::SHORTCUT))
+	return 1;
+    }
+    if ((fltk3::event_key() == fltk3::EnterKey || fltk3::event_key() == fltk3::KPEnterKey)) return navigation(fltk3::DownKey);
+    return 0;
+
+  case fltk3::ENTER:
+  case fltk3::MOVE:
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->visible() && fltk3::event_inside(o)) {
+	if (o->contains(fltk3::belowmouse())) {
+	  return send(o,fltk3::MOVE);
+	} else {
+	  fltk3::belowmouse(o);
+	  if (send(o,fltk3::ENTER)) return 1;
+	}
+      }
+    }
+    fltk3::belowmouse(this);
+    return 1;
+
+  case fltk3::DND_ENTER:
+  case fltk3::DND_DRAG:
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && fltk3::event_inside(o)) {
+	if (o->contains(fltk3::belowmouse())) {
+	  return send(o,fltk3::DND_DRAG);
+	} else if (send(o,fltk3::DND_ENTER)) {
+	  if (!o->contains(fltk3::belowmouse())) fltk3::belowmouse(o);
+	  return 1;
+	}
+      }
+    }
+    fltk3::belowmouse(this);
+    return 0;
+
+  case fltk3::PUSH:
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && fltk3::event_inside(o)) {
+	fltk3::WidgetTracker wp(o);
+	if (send(o,fltk3::PUSH)) {
+	  if (fltk3::pushed() && wp.exists() && !o->contains(fltk3::pushed())) fltk3::pushed(o);
+	  return 1;
+	}
+      }
+    }
+    return 0;
+
+  case fltk3::RELEASE:
+  case fltk3::DRAG:
+    o = fltk3::pushed();
+    if (o == this) return 0;
+    else if (o) send(o,event);
+    else {
+      for (i = children(); i--;) {
+	o = a[i];
+	if (o->takesevents() && fltk3::event_inside(o)) {
+	  if (send(o,event)) return 1;
+	}
+      }
+    }
+    return 0;
+
+  case fltk3::MOUSEWHEEL:
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && fltk3::event_inside(o) && send(o,fltk3::MOUSEWHEEL))
+	return 1;
+    }
+    for (i = children(); i--;) {
+      o = a[i];
+      if (o->takesevents() && !fltk3::event_inside(o) && send(o,fltk3::MOUSEWHEEL))
+	return 1;
+    }
+    return 0;
+
+  case fltk3::DEACTIVATE:
+  case fltk3::ACTIVATE:
+    for (i = children(); i--;) {
+      o = *a++;
+      if (o->active()) o->handle(event);
+    }
+    return 1;
+
+  case fltk3::SHOW:
+  case fltk3::HIDE:
+    for (i = children(); i--;) {
+      o = *a++;
+      if (event == fltk3::HIDE && o == fltk3::focus()) {
+        // Give up input focus...
+	int old_event = fltk3::e_number;
+        o->handle(fltk3::e_number = fltk3::UNFOCUS);
+	fltk3::e_number = old_event;
+	fltk3::focus(0);
+      }
+      if (o->visible()) o->handle(event);
+    }
+    return 1;
+
+  default:
+    // For all other events, try to give to each child, starting at focus:
+    for (i = 0; i < children(); i ++)
+      if (fltk3::focus_ == a[i]) break;
+
+    if (i >= children()) i = 0;
+
+    if (children()) {
+      for (int j = i;;) {
+        if (a[j]->takesevents()) if (send(a[j], event)) return 1;
+        j++;
+        if (j >= children()) j = 0;
+        if (j == i) break;
+      }
+    }
+
+    return 0;
+  }
+}
+
+//void fltk3::Group::focus(fltk3::Widget *o) {fltk3::focus(o); o->handle(fltk3::FOCUS);}
+
+#if 0
+const char *nameof(fltk3::Widget *o) {
+  if (!o) return "NULL";
+  if (!o->label()) return "<no label>";
+  return o->label();
+}
+#endif
+
+// try to move the focus in response to a keystroke:
+int fltk3::Group::navigation(int key) {
+  if (children() <= 1) return 0;
+  int i;
+  for (i = 0; ; i++) {
+    if (i >= children_) return 0;
+    if (array_[i]->contains(fltk3::focus())) break;
+  }
+  fltk3::Widget *previous = array_[i];
+
+  for (;;) {
+    switch (key) {
+    case fltk3::RightKey:
+    case fltk3::DownKey:
+      i++;
+      if (i >= children_) {
+	if (parent()) return 0;
+	i = 0;
+      }
+      break;
+    case fltk3::LeftKey:
+    case fltk3::UpKey:
+      if (i) i--;
+      else {
+	if (parent()) return 0;
+	i = children_-1;
+      }
+      break;
+    default:
+      return 0;
+    }
+    fltk3::Widget* o = array_[i];
+    if (o == previous) return 0;
+    switch (key) {
+    case fltk3::DownKey:
+    case fltk3::UpKey:
+      // for up/down, the widgets have to overlap horizontally:
+      if (o->x() >= previous->x()+previous->w() ||
+	  o->x()+o->w() <= previous->x()) continue;
+    }
+    if (o->take_focus()) return 1;
+  }
+}
+
+////////////////////////////////////////////////////////////////
+
+fltk3::Group::Group(int X,int Y,int W,int H,const char *l)
+: fltk3::Widget(X,Y,W,H,l) {
+  align(fltk3::ALIGN_TOP);
+  children_ = 0;
+  array_ = 0;
+  savedfocus_ = 0;
+  resizable_ = this;
+  sizes_ = 0; // this is allocated when first resize() is done
+  // Subclasses may want to construct child objects as part of their
+  // constructor, so make sure they are add()'d to this object.
+  // But you must end() the object!
+  begin();
+}
+
+/**
+  Deletes all child widgets from memory recursively.
+
+  This method differs from the remove() method in that it
+  affects all child widgets and deletes them from memory.
+*/
+void fltk3::Group::clear() {
+  savedfocus_ = 0;
+  resizable_ = this;
+  init_sizes();
+
+  // we must change the fltk3::pushed() widget, if it is one of
+  // the group's children. Otherwise fl_fix_focus() would send
+  // lots of events to children that are about to be deleted
+  // anyway.
+
+  fltk3::Widget *pushed = fltk3::pushed();	// save pushed() widget
+  if (contains(pushed)) pushed = this;	// set it to be the group, if it's a child
+  fltk3::pushed(this);			// for fl_fix_focus etc.
+
+  // okay, now it is safe to destroy the children:
+
+#define REVERSE_CHILDREN
+#ifdef  REVERSE_CHILDREN
+  // Reverse the order of the children. Doing this and deleting
+  // always the last child is much faster than the other way around.
+  if (children_ > 1) {
+    fltk3::Widget *temp;
+    fltk3::Widget **a = (fltk3::Widget**)array();
+    for (int i=0,j=children_-1; i<children_/2; i++,j--) {
+      temp = a[i];
+      a[i] = a[j];
+      a[j] = temp;
+    }
+  }
+#endif // REVERSE_CHILDREN
+
+  while (children_) {			// delete all children
+    int idx = children_-1;		// last child's index
+    fltk3::Widget* w = child(idx);		// last child widget
+    if (w->parent()==this) {		// should always be true
+      if (children_>2) {		// optimized removal
+        w->parent_ = 0;			// reset child's parent
+        children_--;			// update counter
+      } else {				// slow removal
+        remove(idx);
+      }
+      delete w;				// delete the child
+    } else {				// should never happen
+      remove(idx);			// remove it anyway
+    }
+  }
+
+  if (pushed != this) fltk3::pushed(pushed); // reset pushed() widget
+
+}
+
+/**
+  The destructor <I>also deletes all the children</I>. This allows a
+  whole tree to be deleted at once, without having to keep a pointer to
+  all the children in the user code.
+  
+  It is allowed that the fltk3::Group and all of its children are automatic
+  (local) variables, but you must declare the fltk3::Group \e first, so that
+  it is destroyed last.
+  
+  If you add static or automatic (local) variables to an fltk3::Group, then it
+  is your responsibility to remove (or delete) all such static or automatic
+  child widgets \e \b before destroying the group - otherwise the child
+  widgets' destructors would be called twice!
+*/
+fltk3::Group::~Group() {
+  clear();
+}
+
+/**
+  The widget is removed from its current group (if any) and then
+  inserted into this group. It is put at index n - or at the end,
+  if n >= children(). This can also be used to rearrange
+  the widgets inside a group.
+*/
+void fltk3::Group::insert(fltk3::Widget &o, int index) {
+  if (o.parent()) {
+    fltk3::Group* g = o.parent();
+    int n = g->find(o);
+    if (g == this) {
+      if (index > n) index--;
+      if (index == n) return;
+    }
+    g->remove(n);
+  }
+  o.parent_ = this;
+  if (children_ == 0) { // use array pointer to point at single child
+    array_ = (fltk3::Widget**)&o;
+  } else if (children_ == 1) { // go from 1 to 2 children
+    fltk3::Widget* t = (fltk3::Widget*)array_;
+    array_ = (fltk3::Widget**)malloc(2*sizeof(fltk3::Widget*));
+    if (index) {array_[0] = t; array_[1] = &o;}
+    else {array_[0] = &o; array_[1] = t;}
+  } else {
+    if (!(children_ & (children_-1))) // double number of children
+      array_ = (fltk3::Widget**)realloc((void*)array_,
+				    2*children_*sizeof(fltk3::Widget*));
+    int j; for (j = children_; j > index; j--) array_[j] = array_[j-1];
+    array_[j] = &o;
+  }
+  children_++;
+  init_sizes();
+}
+
+/**
+  The widget is removed from its current group (if any) and then added
+  to the end of this group.
+*/
+void fltk3::Group::add(fltk3::Widget &o) {insert(o, children_);}
+
+/**
+  Removes the widget at \p index from the group but does not delete it.
+
+  This method does nothing if \p index is out of bounds.
+
+  This method differs from the clear() method in that it only affects
+  a single widget and does not delete it from memory.
+  
+  \since FLTK 1.3.0
+*/
+void fltk3::Group::remove(int index) {
+  if (index < 0 || index >= children_) return;
+  fltk3::Widget &o = *child(index);
+  if (&o == savedfocus_) savedfocus_ = 0;
+  if (o.parent_ == this) {	// this should always be true
+    o.parent_ = 0;
+  } 
+
+  // remove the widget from the group
+
+  children_--;
+  if (children_ == 1) { // go from 2 to 1 child
+    fltk3::Widget *t = array_[!index];
+    free((void*)array_);
+    array_ = (fltk3::Widget**)t;
+  } else if (children_ > 1) { // delete from array
+    for (; index < children_; index++) array_[index] = array_[index+1];
+  }
+  init_sizes();
+}
+
+/**
+  Removes a widget from the group but does not delete it.
+
+  This method does nothing if the widget is not a child of the group.
+
+  This method differs from the clear() method in that it only affects
+  a single widget and does not delete it from memory.
+  
+  \note If you have the child's index anyway, use remove(int index)
+  instead, because this doesn't need a child lookup in the group's
+  table of children. This can be much faster, if there are lots of
+  children.
+*/
+void fltk3::Group::remove(fltk3::Widget &o) {
+  if (!children_) return;
+  int i = find(o);
+  if (i < children_) remove(i);
+}
+
+////////////////////////////////////////////////////////////////
+
+// Rather lame kludge here, I need to detect windows and ignore the
+// changes to X,Y, since all children are relative to X,Y.  That
+// is why I check type():
+
+// sizes array stores the initial positions of widgets as
+// left,right,top,bottom quads.  The first quad is the group, the
+// second is the resizable (clipped to the group), and the
+// rest are the children.  This is a convenient order for the
+// algorithm.  If you change this be sure to fix fltk3::TiledGroup which
+// also uses this array!
+
+/**
+  Resets the internal array of widget sizes and positions.
+
+  The fltk3::Group widget keeps track of the original widget sizes and
+  positions when resizing occurs so that if you resize a window back to its
+  original size the widgets will be in the correct places. If you rearrange
+  the widgets in your group, call this method to register the new arrangement
+  with the fltk3::Group that contains them.
+  
+  If you add or remove widgets, this will be done automatically.
+  
+  \note The internal array of widget sizes and positions will be allocated and
+  filled when the next resize() occurs.
+  
+  \sa sizes()
+*/
+void fltk3::Group::init_sizes() {
+  delete[] sizes_; sizes_ = 0;
+}
+
+/**
+  Returns the internal array of widget sizes and positions.
+
+  If the sizes() array does not exist, it will be allocated and filled
+  with the current widget sizes and positions.
+
+  \note You should never need to use this method directly, unless you have
+  special needs to rearrange the children of a fltk3::Group. fltk3::TiledGroup uses
+  this to rearrange its widget positions.
+  
+  \sa init_sizes()
+
+  \todo Should the internal representation of the sizes() array be documented?
+*/
+int* fltk3::Group::sizes() {
+  if (!sizes_) {
+    int* p = sizes_ = new int[4*(children_+2)];
+    // first thing in sizes array is the group's size:
+    if (type() < fltk3::WINDOW) {p[0] = x(); p[2] = y();} else {p[0] = p[2] = 0;}
+    p[1] = p[0]+w(); p[3] = p[2]+h();
+    // next is the resizable's size:
+    p[4] = p[0]; // init to the group's size
+    p[5] = p[1];
+    p[6] = p[2];
+    p[7] = p[3];
+    fltk3::Widget* r = resizable();
+    if (r && r != this) { // then clip the resizable to it
+      int t;
+      t = r->x(); if (t > p[0]) p[4] = t;
+      t +=r->w(); if (t < p[1]) p[5] = t;
+      t = r->y(); if (t > p[2]) p[6] = t;
+      t +=r->h(); if (t < p[3]) p[7] = t;
+    }
+    // next is all the children's sizes:
+    p += 8;
+    fltk3::Widget*const* a = array();
+    for (int i=children_; i--;) {
+      fltk3::Widget* o = *a++;
+      *p++ = o->x();
+      *p++ = o->x()+o->w();
+      *p++ = o->y();
+      *p++ = o->y()+o->h();
+    }
+  }
+  return sizes_;
+}
+
+/**
+  Resizes the fltk3::Group widget and all of its children.
+
+  The fltk3::Group widget first resizes itself, and then it moves and resizes
+  all its children according to the rules documented for
+  fltk3::Group::resizable(fltk3::Widget*)
+
+  \sa fltk3::Group::resizable(fltk3::Widget*)
+  \sa fltk3::Group::resizable()
+  \sa fltk3::Widget::resize(int,int,int,int)
+*/
+void fltk3::Group::resize(int X, int Y, int W, int H) {
+
+  int dx = X-x();
+  int dy = Y-y();
+  int dw = W-w();
+  int dh = H-h();
+  
+  int *p = sizes(); // save initial sizes and positions
+
+  Widget::resize(X,Y,W,H); // make new xywh values visible for children
+
+  if (!resizable() || (dw==0 && dh==0) ) {
+
+    if (type() < fltk3::WINDOW) {
+      fltk3::Widget*const* a = array();
+      for (int i=children_; i--;) {
+	fltk3::Widget* o = *a++;
+	o->resize(o->x()+dx, o->y()+dy, o->w(), o->h());
+      }
+    }
+
+  } else if (children_) {
+
+    // get changes in size/position from the initial size:
+    dx = X - p[0];
+    dw = W - (p[1]-p[0]);
+    dy = Y - p[2];
+    dh = H - (p[3]-p[2]);
+    if (type() >= fltk3::WINDOW) dx = dy = 0;
+    p += 4;
+
+    // get initial size of resizable():
+    int IX = *p++;
+    int IR = *p++;
+    int IY = *p++;
+    int IB = *p++;
+
+    fltk3::Widget*const* a = array();
+    for (int i=children_; i--;) {
+      fltk3::Widget* o = *a++;
+#if 1
+      int XX = *p++;
+      if (XX >= IR) XX += dw;
+      else if (XX > IX) XX = IX+((XX-IX)*(IR+dw-IX)+(IR-IX)/2)/(IR-IX);
+      int R = *p++;
+      if (R >= IR) R += dw;
+      else if (R > IX) R = IX+((R-IX)*(IR+dw-IX)+(IR-IX)/2)/(IR-IX);
+
+      int YY = *p++;
+      if (YY >= IB) YY += dh;
+      else if (YY > IY) YY = IY+((YY-IY)*(IB+dh-IY)+(IB-IY)/2)/(IB-IY);
+      int B = *p++;
+      if (B >= IB) B += dh;
+      else if (B > IY) B = IY+((B-IY)*(IB+dh-IY)+(IB-IY)/2)/(IB-IY);
+#else // much simpler code from Francois Ostiguy:
+      int XX = *p++;
+      if (XX >= IR) XX += dw;
+      else if (XX > IX) XX += dw * (XX-IX)/(IR-IX);
+      int R = *p++;
+      if (R >= IR) R += dw;
+      else if (R > IX) R = R + dw * (R-IX)/(IR-IX);
+
+      int YY = *p++;
+      if (YY >= IB) YY += dh;
+      else if (YY > IY) YY = YY + dh*(YY-IY)/(IB-IY);
+      int B = *p++;
+      if (B >= IB) B += dh;
+      else if (B > IY) B = B + dh*(B-IY)/(IB-IY);
+#endif
+      o->resize(XX+dx, YY+dy, R-XX, B-YY);
+    }
+  }
+}
+
+/**
+  Draws all children of the group.
+
+  This is useful, if you derived a widget from fltk3::Group and want to draw a special
+  border or background. You can call draw_children() from the derived draw() method
+  after drawing the box, border, or background.
+*/
+void fltk3::Group::draw_children() {
+  fltk3::Widget*const* a = array();
+
+  if (clip_children()) {
+    fltk3::push_clip(x() + fltk3::box_dx(box()),
+                 y() + fltk3::box_dy(box()),
+		 w() - fltk3::box_dw(box()),
+		 h() - fltk3::box_dh(box()));
+  }
+
+  if (damage() & ~fltk3::DAMAGE_CHILD) { // redraw the entire thing:
+    for (int i=children_; i--;) {
+      fltk3::Widget& o = **a++;
+      draw_child(o);
+      draw_outside_label(o);
+    }
+  } else {	// only redraw the children that need it:
+    for (int i=children_; i--;) update_child(**a++);
+  }
+
+  if (clip_children()) fltk3::pop_clip();
+}
+
+void fltk3::Group::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (damage() & ~fltk3::DAMAGE_CHILD) { // redraw the entire thing:
+    draw_box();
+    draw_label();
+  }
+  draw_children();
+}
+
+/**
+  Draws a child only if it needs it.
+
+  This draws a child widget, if it is not clipped \em and if any damage() bits
+  are set. The damage bits are cleared after drawing.
+
+  \sa fltk3::Group::draw_child(fltk3::Widget& widget) const
+*/
+void fltk3::Group::update_child(fltk3::Widget& widget) const {
+  if (widget.damage() && widget.visible() && widget.type() < fltk3::WINDOW &&
+      fltk3::not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
+    widget.draw();	
+    widget.clear_damage();
+  }
+}
+
+/**
+  Forces a child to redraw.
+
+  This draws a child widget, if it is not clipped.
+  The damage bits are cleared after drawing.
+*/
+void fltk3::Group::draw_child(fltk3::Widget& widget) const {
+  if (widget.visible() && widget.type() < fltk3::WINDOW &&
+      fltk3::not_clipped(widget.x(), widget.y(), widget.w(), widget.h())) {
+    widget.clear_damage(fltk3::DAMAGE_ALL);
+    widget.draw();
+    widget.clear_damage();
+  }
+}
+
+extern char fltk3::draw_shortcut;
+
+/** Parents normally call this to draw outside labels of child widgets. */
+void fltk3::Group::draw_outside_label(const fltk3::Widget& widget) const {
+  if (!widget.visible()) return;
+  // skip any labels that are inside the widget:
+  if (!(widget.align()&15) || (widget.align() & fltk3::ALIGN_INSIDE)) return;
+  // invent a box that is outside the widget:
+  fltk3::Align a = widget.align();
+  int X = widget.x();
+  int Y = widget.y();
+  int W = widget.w();
+  int H = widget.h();
+  int wx, wy;
+  if (const_cast<fltk3::Group*>(this)->as_window()) {
+    wx = wy = 0;
+  } else {
+    wx = x(); wy = y();
+  }
+  if ( (a & 0x0f) == fltk3::ALIGN_LEFT_TOP ) {
+    a = (a &~0x0f ) | fltk3::ALIGN_TOP_RIGHT;
+    X = wx;
+    W = widget.x()-X-3;
+  } else if ( (a & 0x0f) == fltk3::ALIGN_LEFT_BOTTOM ) {
+    a = (a &~0x0f ) | fltk3::ALIGN_BOTTOM_RIGHT; 
+    X = wx;
+    W = widget.x()-X-3;
+  } else if ( (a & 0x0f) == fltk3::ALIGN_RIGHT_TOP ) {
+    a = (a &~0x0f ) | fltk3::ALIGN_TOP_LEFT; 
+    X = X+W+3;
+    W = wx+this->w()-X;
+  } else if ( (a & 0x0f) == fltk3::ALIGN_RIGHT_BOTTOM ) {
+    a = (a &~0x0f ) | fltk3::ALIGN_BOTTOM_LEFT; 
+    X = X+W+3;
+    W = wx+this->w()-X;
+  } else if (a & fltk3::ALIGN_TOP) {
+    a ^= (fltk3::ALIGN_BOTTOM|fltk3::ALIGN_TOP);
+    Y = wy;
+    H = widget.y()-Y;
+  } else if (a & fltk3::ALIGN_BOTTOM) {
+    a ^= (fltk3::ALIGN_BOTTOM|fltk3::ALIGN_TOP);
+    Y = Y+H;
+    H = wy+h()-Y;
+  } else if (a & fltk3::ALIGN_LEFT) {
+    a ^= (fltk3::ALIGN_LEFT|fltk3::ALIGN_RIGHT);
+    X = wx;
+    W = widget.x()-X-3;
+  } else if (a & fltk3::ALIGN_RIGHT) {
+    a ^= (fltk3::ALIGN_LEFT|fltk3::ALIGN_RIGHT);
+    X = X+W+3;
+    W = wx+this->w()-X;
+  }
+  widget.draw_label(X,Y,W,H,(fltk3::Align)a);
+}
+
+void fltk3::Group::forms_end() {
+  // set the dimensions of a group to surround contents
+  if (children() && !w()) {
+    fltk3::Widget*const* a = array();
+    fltk3::Widget* o = *a++;
+    int rx = o->x();
+    int ry = o->y();
+    int rw = rx+o->w();
+    int rh = ry+o->h();
+    for (int i=children_-1; i--;) {
+      o = *a++;
+      if (o->x() < rx) rx = o->x();
+      if (o->y() < ry) ry = o->y();
+      if (o->x()+o->w() > rw) rw = o->x()+o->w();
+      if (o->y()+o->h() > rh) rh = o->y()+o->h();
+    }
+    x(rx);
+    y(ry);
+    w(rw-rx);
+    h(rh-ry);
+  }
+  // flip all the children's coordinate systems:
+  //if (fl_flip) {
+    fltk3::Widget* o = (type()>=fltk3::WINDOW) ? this : window();
+    int Y = o->h();
+    fltk3::Widget*const* a = array();
+    for (int i=children(); i--;) {
+      fltk3::Widget* ow = *a++;
+      int newy = Y-ow->y()-ow->h();
+      ow->y(newy);
+    }
+  //}
+  end();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/HelpView.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Help_View.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/HelpView.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/HelpView.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,3520 @@
+//
+// "$Id$"
+//
+// fltk3::HelpView widget routines.
+//
+// Copyright 1997-2010 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::HelpView::add_block()       - Add a text block to the list.
+//   fltk3::HelpView::add_link()        - Add a new link to the list.
+//   fltk3::HelpView::add_target()      - Add a new target to the list.
+//   fltk3::HelpView::compare_targets() - Compare two targets.
+//   fltk3::HelpView::do_align()        - Compute the alignment for a line in
+//                                     a block.
+//   fltk3::HelpView::draw()            - Draw the fltk3::HelpView widget.
+//   fltk3::HelpView::format()          - Format the help text.
+//   fltk3::HelpView::format_table()    - Format a table...
+//   fltk3::HelpView::free_data()       - Free memory used for the document.
+//   fltk3::HelpView::get_align()       - Get an alignment attribute.
+//   fltk3::HelpView::get_attr()        - Get an attribute value from the string.
+//   fltk3::HelpView::get_color()       - Get an alignment attribute.
+//   fltk3::HelpView::handle()          - Handle events in the widget.
+//   fltk3::HelpView::fltk3::HelpView()    - Build a fltk3::HelpView widget.
+//   fltk3::HelpView::~Fl_Help_View()   - Destroy a fltk3::HelpView widget.
+//   fltk3::HelpView::load()            - Load the specified file.
+//   fltk3::HelpView::resize()          - Resize the help widget.
+//   fltk3::HelpView::topline()         - Set the top line to the named target.
+//   fltk3::HelpView::topline()         - Set the top line by number.
+//   fltk3::HelpView::value()           - Set the help text directly.
+//   scrollbar_callback()            - A callback for the scrollbar.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/HelpView.h>
+#include <fltk3/Window.h>
+#include <fltk3/Pixmap.h>
+#include <fltk3/x.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include <fltk3/filename.h>	// fltk3::open_uri()
+#include "flstring.h"
+#include <ctype.h>
+#include <errno.h>
+#include <math.h>
+
+#if defined(WIN32) && ! defined(__CYGWIN__)
+#  include <io.h>
+#  include <direct.h>
+#else
+#  include <unistd.h>
+#endif // WIN32
+
+#define MAX_COLUMNS	200
+
+
+//
+// Typedef the C API sort function type the only way I know how...
+//
+
+extern "C"
+{
+  typedef int (*compare_func_t)(const void *, const void *);
+}
+
+
+//
+// Local functions...
+//
+
+static int	quote_char(const char *);
+static void	scrollbar_callback(fltk3::Widget *s, void *);
+static void	hscrollbar_callback(fltk3::Widget *s, void *);
+
+//
+// global flag for image loading (see get_image).
+//
+
+static char initial_load = 0;
+
+//
+// Broken image...
+//
+
+static const char *broken_xpm[] =
+		{
+		  "16 24 4 1",
+		  "@ c #000000",
+		  "  c #ffffff",
+		  "+ c none",
+		  "x c #ff0000",
+		  // pixels
+		  "@@@@@@@+++++++++",
+		  "@    @++++++++++",
+		  "@   @+++++++++++",
+		  "@   @++@++++++++",
+		  "@    @@+++++++++",
+		  "@     @+++@+++++",
+		  "@     @++@@++++@",
+		  "@ xxx  @@  @++@@",
+		  "@  xxx    xx@@ @",
+		  "@   xxx  xxx   @",
+		  "@    xxxxxx    @",
+		  "@     xxxx     @",
+		  "@    xxxxxx    @",
+		  "@   xxx  xxx   @",
+		  "@  xxx    xxx  @",
+		  "@ xxx      xxx @",
+		  "@              @",
+		  "@              @",
+		  "@              @",
+		  "@              @",
+		  "@              @",
+		  "@              @",
+		  "@              @",
+		  "@@@@@@@@@@@@@@@@",
+		  NULL
+		};
+
+static fltk3::Pixmap broken_image(broken_xpm);
+
+//
+// Simple margin stack for fltk3::HelpView::format()...
+//
+
+struct fl_margins {
+  int depth_;
+  int margins_[100];
+
+  fl_margins() { clear();  }
+
+  int clear() {
+//    puts("fl_margins::clear()");
+
+    depth_ = 0;
+    return margins_[0] = 4;
+  }
+
+  int current() { return margins_[depth_]; }
+
+  int pop() {
+//    printf("fl_margins::pop(): depth_=%d, xx=%d\n", depth_,
+//           depth_ > 0 ? margins_[depth_ - 1] : 4);
+
+    if (depth_ > 0) {
+      depth_ --;
+      return margins_[depth_];
+    } else return 4;
+  }
+
+  int push(int indent) {
+    int xx;
+
+    xx = margins_[depth_] + indent;
+
+//    printf("fl_margins::push(indent=%d): depth_=%d, xx=%d\n", indent,
+//           depth_ + 1, xx);
+
+    if (depth_ < 99) {
+      depth_ ++;
+      margins_[depth_] = xx;
+    }
+
+    return xx;
+  }
+};
+
+//
+// All the stuff needed to implement text selection in fltk3::HelpView
+//
+
+/* matt:
+ * We are trying to keep binary compatibility with previous versions
+ * of FLTK. This means that we are limited to adding static variables
+ * only to not enlarge the fltk3::HelpView class. Lucky for us, only one
+ * text can be selected system wide, so we can remember the selection
+ * in a single set of variables.
+ *
+ * Still to do:
+ * - &word; style characters mess up our count inside a word boundary
+ * - we can only select words, no individual characters
+ * - no dragging of the selection into another widget
+ * - selection must be cleared if another widget get focus!
+ * - write a comment for every new function
+ */
+
+/*
+The following functions are also used to draw stuff and should be replaced with
+local copies that are much faster when merely counting:
+
+fltk3::color(fltk3::Color);
+fltk3::rectf(int, int, int, int);
+fltk3::push_clip(int, int, int, int);
+fltk3::xyline(int, int, int);
+fltk3::rect()
+fltk3::line()
+img->draw()
+*/
+
+// We don't put the offscreen buffer in the help view class because
+// we'd need to include x.h in the header...
+static fltk3::Offscreen fl_help_view_buffer;
+int fltk3::HelpView::selection_first = 0;
+int fltk3::HelpView::selection_last = 0;
+int fltk3::HelpView::selection_push_first = 0;
+int fltk3::HelpView::selection_push_last = 0;
+int fltk3::HelpView::selection_drag_first = 0;
+int fltk3::HelpView::selection_drag_last = 0;
+int fltk3::HelpView::selected = 0;
+int fltk3::HelpView::draw_mode = 0;
+int fltk3::HelpView::mouse_x = 0;
+int fltk3::HelpView::mouse_y = 0;
+int fltk3::HelpView::current_pos = 0;
+fltk3::HelpView *fltk3::HelpView::current_view = 0L;
+fltk3::Color fltk3::HelpView::hv_selection_color;
+fltk3::Color fltk3::HelpView::hv_selection_text_color;
+
+/*
+ * Limitation: if a word contains &code; notations, we will calculate a wrong length.
+ *
+ * This function must be optimized for speed!
+ */
+void fltk3::HelpView::hv_draw(const char *t, int x, int y)
+{
+  if (selected && current_view==this && current_pos<selection_last && current_pos>=selection_first) {
+    fltk3::Color c = fltk3::color();
+    fltk3::color(hv_selection_color);
+    int w = (int)fltk3::width(t);
+    if (current_pos+(int)strlen(t)<selection_last) 
+      w += (int)fltk3::width(' ');
+    fltk3::rectf(x, y+fltk3::descent()-fltk3::height(), w, fltk3::height());
+    fltk3::color(hv_selection_text_color);
+    fltk3::draw(t, x, y);
+    fltk3::color(c);
+  } else {
+    fltk3::draw(t, x, y);
+  }
+  if (draw_mode) {
+    int w = (int)fltk3::width(t);
+    if (mouse_x>=x && mouse_x<x+w) {
+      if (mouse_y>=y-fltk3::height()+fltk3::descent()&&mouse_y<=y+fltk3::descent()) {
+        int f = current_pos;
+        int l = f+strlen(t); // use 'quote_char' to calculate the true length of the HTML string
+        if (draw_mode==1) {
+          selection_push_first = f;
+          selection_push_last = l;
+        } else {
+          selection_drag_first = f;
+          selection_drag_last = l;
+        }
+      }
+    }
+  }
+}
+
+
+/** Adds a text block to the list. */
+fltk3::HelpBlock *					// O - Pointer to new block
+fltk3::HelpView::add_block(const char   *s,	// I - Pointer to start of block text
+                	int           xx,	// I - X position of block
+			int           yy,	// I - Y position of block
+			int           ww,	// I - Right margin of block
+			int           hh,	// I - Height of block
+			unsigned char border)	// I - Draw border?
+{
+  fltk3::HelpBlock	*temp;				// New block
+
+
+//  printf("add_block(s = %p, xx = %d, yy = %d, ww = %d, hh = %d, border = %d)\n",
+//         s, xx, yy, ww, hh, border);
+
+  if (nblocks_ >= ablocks_)
+  {
+    ablocks_ += 16;
+
+    if (ablocks_ == 16)
+      blocks_ = (fltk3::HelpBlock *)malloc(sizeof(fltk3::HelpBlock) * ablocks_);
+    else
+      blocks_ = (fltk3::HelpBlock *)realloc(blocks_, sizeof(fltk3::HelpBlock) * ablocks_);
+  }
+
+  temp = blocks_ + nblocks_;
+  memset(temp, 0, sizeof(fltk3::HelpBlock));
+  temp->start   = s;
+  temp->end     = s;
+  temp->x       = xx;
+  temp->y       = yy;
+  temp->w       = ww;
+  temp->h       = hh;
+  temp->border  = border;
+  temp->bgcolor = bgcolor_;
+  nblocks_ ++;
+
+  return (temp);
+}
+
+
+/** Adds a new link to the list. */
+void fltk3::HelpView::add_link(const char *n,	// I - Name of link
+                      int        xx,	// I - X position of link
+		      int        yy,	// I - Y position of link
+		      int        ww,	// I - Width of link text
+		      int        hh)	// I - Height of link text
+{
+  fltk3::HelpLink	*temp;			// New link
+  char		*target;		// Pointer to target name
+
+
+  if (nlinks_ >= alinks_)
+  {
+    alinks_ += 16;
+
+    if (alinks_ == 16)
+      links_ = (fltk3::HelpLink *)malloc(sizeof(fltk3::HelpLink) * alinks_);
+    else
+      links_ = (fltk3::HelpLink *)realloc(links_, sizeof(fltk3::HelpLink) * alinks_);
+  }
+
+  temp = links_ + nlinks_;
+
+  temp->x       = xx;
+  temp->y       = yy;
+  temp->w       = xx + ww;
+  temp->h       = yy + hh;
+
+  strlcpy(temp->filename, n, sizeof(temp->filename));
+
+  if ((target = strrchr(temp->filename, '#')) != NULL)
+  {
+    *target++ = '\0';
+    strlcpy(temp->name, target, sizeof(temp->name));
+  }
+  else
+    temp->name[0] = '\0';
+
+  nlinks_ ++;
+}
+
+
+/** Adds a new target to the list. */
+void fltk3::HelpView::add_target(const char *n,	// I - Name of target
+			      int        yy)	// I - Y position of target
+{
+  fltk3::HelpTarget	*temp;			// New target
+
+
+  if (ntargets_ >= atargets_)
+  {
+    atargets_ += 16;
+
+    if (atargets_ == 16)
+      targets_ = (fltk3::HelpTarget *)malloc(sizeof(fltk3::HelpTarget) * atargets_);
+    else
+      targets_ = (fltk3::HelpTarget *)realloc(targets_, sizeof(fltk3::HelpTarget) * atargets_);
+  }
+
+  temp = targets_ + ntargets_;
+
+  temp->y = yy;
+  strlcpy(temp->name, n, sizeof(temp->name));
+
+  ntargets_ ++;
+}
+
+/** Compares two targets.*/
+int							// O - Result of comparison
+fltk3::HelpView::compare_targets(const fltk3::HelpTarget *t0,	// I - First target
+                             const fltk3::HelpTarget *t1)	// I - Second target
+{
+  return (strcasecmp(t0->name, t1->name));
+}
+
+/** Computes the alignment for a line in a block.*/
+int						// O - New line
+fltk3::HelpView::do_align(fltk3::HelpBlock *block,	// I - Block to add to
+                      int          line,	// I - Current line
+		      int          xx,		// I - Current X position
+		      int          a,		// I - Current alignment
+		      int          &l)		// IO - Starting link
+{
+  int	offset;					// Alignment offset
+
+
+  switch (a)
+  {
+    case RIGHT :	// Right align
+	offset = block->w - xx;
+	break;
+    case CENTER :	// Center
+	offset = (block->w - xx) / 2;
+	break;
+    default :		// Left align
+	offset = 0;
+	break;
+  }
+
+  block->line[line] = block->x + offset;
+
+  if (line < 31)
+    line ++;
+
+  while (l < nlinks_)
+  {
+    links_[l].x += offset;
+    links_[l].w += offset;
+    l ++;
+  }
+
+  return (line);
+}
+
+/** Draws the fltk3::HelpView widget. */
+void
+fltk3::HelpView::draw()
+{
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int			i;		// Looping var
+  const fltk3::HelpBlock	*block;		// Pointer to current block
+  const char		*ptr,		// Pointer to text in block
+			*attrs;		// Pointer to start of element attributes
+  char			*s,		// Pointer into buffer
+			buf[1024],	// Text buffer
+			attr[1024];	// Attribute buffer
+  int			xx, yy, ww, hh;	// Current positions and sizes
+  int			line;		// Current line
+  fltk3::Font               font;
+  fltk3::Fontsize           fsize;          // Current font and size
+  fltk3::Color              fcolor;         // current font color 
+  int			head, pre,	// Flags for text
+			needspace;	// Do we need whitespace?
+  fltk3::Boxtype		b = box() ? box() : fltk3::DOWN_BOX;
+					// Box to draw...
+  int			underline,	// Underline text?
+                        xtra_ww;        // Extra width for underlined space between words
+
+  // Draw the scrollbar(s) and box first...
+  ww = w();
+  hh = h();
+  i  = 0;
+
+  draw_box(b, x(), y(), ww, hh, bgcolor_);
+
+  if ( hscrollbar_.visible() || scrollbar_.visible() ) {
+    int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+    int hor_vis = hscrollbar_.visible();
+    int ver_vis = scrollbar_.visible();
+    // Scrollbar corner
+    int scorn_x = x() + ww - (ver_vis?scrollsize:0) - fltk3::box_dw(b) + fltk3::box_dx(b);
+    int scorn_y = y() + hh - (hor_vis?scrollsize:0) - fltk3::box_dh(b) + fltk3::box_dy(b);
+    if ( hor_vis ) {
+      if ( hscrollbar_.h() != scrollsize ) {		// scrollsize changed?
+	hscrollbar_.resize(x(), scorn_y, scorn_x - x(), scrollsize);
+	init_sizes();
+      }
+      draw_child(hscrollbar_);
+      hh -= scrollsize;
+    }
+    if ( ver_vis ) {
+      if ( scrollbar_.w() != scrollsize ) {		// scrollsize changed?
+	scrollbar_.resize(scorn_x, y(), scrollsize, scorn_y - y());
+	init_sizes();
+      }
+      draw_child(scrollbar_);
+      ww -= scrollsize;
+    }
+    if ( hor_vis && ver_vis ) {
+      // Both scrollbars visible? Draw little gray box in corner
+      fltk3::color(fltk3::GRAY);
+      fltk3::rectf(scorn_x, scorn_y, scrollsize, scrollsize);
+    }
+  }
+
+  if (!value_)
+    return;
+
+  if (current_view == this && selected) {
+    hv_selection_color      = fltk3::SELECTION_COLOR;
+    hv_selection_text_color = fltk3::contrast(textcolor_, fltk3::SELECTION_COLOR);
+  }
+  current_pos = 0;
+
+  // Clip the drawing to the inside of the box...
+  fltk3::push_clip(x() + fltk3::box_dx(b), y() + fltk3::box_dy(b),
+               ww - fltk3::box_dw(b), hh - fltk3::box_dh(b));
+  fltk3::color(textcolor_);
+
+  // Draw all visible blocks...
+  for (i = 0, block = blocks_; i < nblocks_; i ++, block ++)
+    if ((block->y + block->h) >= topline_ && block->y < (topline_ + h()))
+    {
+      line      = 0;
+      xx        = block->line[line];
+      yy        = block->y - topline_;
+      hh        = 0;
+      pre       = 0;
+      head      = 0;
+      needspace = 0;
+      underline = 0;
+
+      initfont(font, fsize, fcolor);
+
+      for (ptr = block->start, s = buf; ptr < block->end;)
+      {
+	if ((*ptr == '<' || isspace((*ptr)&255)) && s > buf)
+	{
+	  if (!head && !pre)
+	  {
+            // Check width...
+            *s = '\0';
+            s  = buf;
+            ww = (int)fltk3::width(buf);
+
+            if (needspace && xx > block->x)
+	      xx += (int)fltk3::width(' ');
+
+            if ((xx + ww) > block->w)
+	    {
+	      if (line < 31)
+	        line ++;
+	      xx = block->line[line];
+	      yy += hh;
+	      hh = 0;
+	    }
+
+            hv_draw(buf, xx + x() - leftline_, yy + y());
+	    if (underline) {
+              xtra_ww = isspace((*ptr)&255)?(int)fltk3::width(' '):0;
+              fltk3::xyline(xx + x() - leftline_, yy + y() + 1,
+	                xx + x() - leftline_ + ww + xtra_ww);
+            }
+            current_pos = ptr-value_;
+
+            xx += ww;
+	    if ((fsize + 2) > hh)
+	      hh = fsize + 2;
+
+	    needspace = 0;
+	  }
+	  else if (pre)
+	  {
+	    while (isspace((*ptr)&255))
+	    {
+	      if (*ptr == '\n')
+	      {
+	        *s = '\0';
+                s = buf;
+
+                hv_draw(buf, xx + x() - leftline_, yy + y());
+		if (underline) fltk3::xyline(xx + x() - leftline_, yy + y() + 1,
+	                        	 xx + x() - leftline_ +
+					     (int)fltk3::width(buf));
+
+                current_pos = ptr-value_;
+		if (line < 31)
+	          line ++;
+		xx = block->line[line];
+		yy += hh;
+		hh = fsize + 2;
+	      }
+	      else if (*ptr == '\t')
+	      {
+		// Do tabs every 8 columns...
+		while (((s - buf) & 7))
+	          *s++ = ' ';
+	      }
+	      else
+	        *s++ = ' ';
+
+              if ((fsize + 2) > hh)
+	        hh = fsize + 2;
+
+              ptr ++;
+	    }
+
+            if (s > buf)
+	    {
+	      *s = '\0';
+	      s = buf;
+
+              hv_draw(buf, xx + x() - leftline_, yy + y());
+	      ww = (int)fltk3::width(buf);
+	      if (underline) fltk3::xyline(xx + x() - leftline_, yy + y() + 1,
+	                               xx + x() - leftline_ + ww);
+              xx += ww;
+              current_pos = ptr-value_;
+	    }
+
+	    needspace = 0;
+	  }
+	  else
+	  {
+            s = buf;
+
+	    while (isspace((*ptr)&255))
+              ptr ++;
+            current_pos = ptr-value_;
+	  }
+	}
+
+	if (*ptr == '<')
+	{
+	  ptr ++;
+
+          if (strncmp(ptr, "!--", 3) == 0)
+	  {
+	    // Comment...
+	    ptr += 3;
+	    if ((ptr = strstr(ptr, "-->")) != NULL)
+	    {
+	      ptr += 3;
+	      continue;
+	    }
+	    else
+	      break;
+	  }
+
+	  while (*ptr && *ptr != '>' && !isspace((*ptr)&255))
+            if (s < (buf + sizeof(buf) - 1))
+	      *s++ = *ptr++;
+	    else
+	      ptr ++;
+
+	  *s = '\0';
+	  s = buf;
+
+	  attrs = ptr;
+	  while (*ptr && *ptr != '>')
+            ptr ++;
+
+	  if (*ptr == '>')
+            ptr ++;
+
+          // end of command reached, set the supposed start of printed eord here
+          current_pos = ptr-value_;
+	  if (strcasecmp(buf, "HEAD") == 0)
+            head = 1;
+	  else if (strcasecmp(buf, "BR") == 0)
+	  {
+	    if (line < 31)
+	      line ++;
+	    xx = block->line[line];
+            yy += hh;
+	    hh = 0;
+	  }
+	  else if (strcasecmp(buf, "HR") == 0)
+	  {
+	    fltk3::line(block->x + x(), yy + y(), block->w + x(),
+	            yy + y());
+
+	    if (line < 31)
+	      line ++;
+	    xx = block->line[line];
+            yy += 2 * hh;
+	    hh = 0;
+	  }
+	  else if (strcasecmp(buf, "CENTER") == 0 ||
+        	   strcasecmp(buf, "P") == 0 ||
+        	   strcasecmp(buf, "H1") == 0 ||
+		   strcasecmp(buf, "H2") == 0 ||
+		   strcasecmp(buf, "H3") == 0 ||
+		   strcasecmp(buf, "H4") == 0 ||
+		   strcasecmp(buf, "H5") == 0 ||
+		   strcasecmp(buf, "H6") == 0 ||
+		   strcasecmp(buf, "UL") == 0 ||
+		   strcasecmp(buf, "OL") == 0 ||
+		   strcasecmp(buf, "DL") == 0 ||
+		   strcasecmp(buf, "LI") == 0 ||
+		   strcasecmp(buf, "DD") == 0 ||
+		   strcasecmp(buf, "DT") == 0 ||
+		   strcasecmp(buf, "PRE") == 0)
+	  {
+            if (tolower(buf[0]) == 'h')
+	    {
+	      font  = fltk3::HELVETICA_BOLD;
+	      fsize = textsize_ + '7' - buf[1];
+	    }
+	    else if (strcasecmp(buf, "DT") == 0)
+	    {
+	      font  = textfont_ | fltk3::ITALIC;
+	      fsize = textsize_;
+	    }
+	    else if (strcasecmp(buf, "PRE") == 0)
+	    {
+	      font  = fltk3::COURIER;
+	      fsize = textsize_;
+	      pre   = 1;
+	    }
+
+            if (strcasecmp(buf, "LI") == 0)
+	    {
+//            fltk3::font(fltk3::SYMBOL, fsize); // The default SYMBOL font on my XP box is not Unicode...
+              char buf[8];
+              wchar_t b[] = {0x2022, 0x0};
+//            buf[fl_unicode2utf(b, 1, buf)] = 0;
+              unsigned dstlen = fltk3::utf8fromwc(buf, 8, b, 1);
+              buf[dstlen] = 0;
+              hv_draw(buf, xx - fsize + x() - leftline_, yy + y());
+	    }
+
+	    pushfont(font, fsize);
+	  }
+	  else if (strcasecmp(buf, "A") == 0 &&
+	           get_attr(attrs, "HREF", attr, sizeof(attr)) != NULL)
+	  {
+	    fltk3::color(linkcolor_);
+	    underline = 1;
+	  }
+	  else if (strcasecmp(buf, "/A") == 0)
+	  {
+	    fltk3::color(textcolor_);
+	    underline = 0;
+	  }
+	  else if (strcasecmp(buf, "FONT") == 0)
+	  {
+	    if (get_attr(attrs, "COLOR", attr, sizeof(attr)) != NULL) {
+	      textcolor_ = get_color(attr, textcolor_);
+	    }
+
+            if (get_attr(attrs, "FACE", attr, sizeof(attr)) != NULL) {
+	      if (!strncasecmp(attr, "helvetica", 9) ||
+	          !strncasecmp(attr, "arial", 5) ||
+		  !strncasecmp(attr, "sans", 4)) font = fltk3::HELVETICA;
+              else if (!strncasecmp(attr, "times", 5) ||
+	               !strncasecmp(attr, "serif", 5)) font = fltk3::TIMES;
+              else if (!strncasecmp(attr, "symbol", 6)) font = fltk3::SYMBOL;
+	      else font = fltk3::COURIER;
+            }
+
+            if (get_attr(attrs, "SIZE", attr, sizeof(attr)) != NULL) {
+              if (isdigit(attr[0] & 255)) {
+	        // Absolute size
+	        fsize = (int)(textsize_ * pow(1.2, atof(attr) - 3.0));
+	      } else {
+	        // Relative size
+	        fsize = (int)(fsize * pow(1.2, atof(attr) - 3.0));
+	      }
+	    }
+
+            pushfont(font, fsize);
+	  }
+	  else if (strcasecmp(buf, "/FONT") == 0)
+	  {
+	    popfont(font, fsize, textcolor_);
+	  }
+	  else if (strcasecmp(buf, "U") == 0)
+	    underline = 1;
+	  else if (strcasecmp(buf, "/U") == 0)
+	    underline = 0;
+	  else if (strcasecmp(buf, "B") == 0 ||
+	           strcasecmp(buf, "STRONG") == 0)
+	    pushfont(font |= fltk3::BOLD, fsize);
+	  else if (strcasecmp(buf, "TD") == 0 ||
+	           strcasecmp(buf, "TH") == 0)
+          {
+	    int tx, ty, tw, th;
+
+	    if (tolower(buf[1]) == 'h')
+	      pushfont(font |= fltk3::BOLD, fsize);
+	    else
+	      pushfont(font = textfont_, fsize);
+
+            tx = block->x - 4 - leftline_;
+	    ty = block->y - topline_ - fsize - 3;
+            tw = block->w - block->x + 7;
+	    th = block->h + fsize - 5;
+
+            if (tx < 0)
+	    {
+	      tw += tx;
+	      tx  = 0;
+	    }
+
+	    if (ty < 0)
+	    {
+	      th += ty;
+	      ty  = 0;
+	    }
+
+            tx += x();
+	    ty += y();
+
+            if (block->bgcolor != bgcolor_)
+	    {
+	      fltk3::color(block->bgcolor);
+              fltk3::rectf(tx, ty, tw, th);
+              fltk3::color(textcolor_);
+	    }
+
+            if (block->border)
+              fltk3::rect(tx, ty, tw, th);
+	  }
+	  else if (strcasecmp(buf, "I") == 0 ||
+                   strcasecmp(buf, "EM") == 0)
+	    pushfont(font |= fltk3::ITALIC, fsize);
+	  else if (strcasecmp(buf, "CODE") == 0 ||
+	           strcasecmp(buf, "TT") == 0)
+	    pushfont(font = fltk3::COURIER, fsize);
+	  else if (strcasecmp(buf, "KBD") == 0)
+	    pushfont(font = fltk3::COURIER_BOLD, fsize);
+	  else if (strcasecmp(buf, "VAR") == 0)
+	    pushfont(font = fltk3::COURIER_ITALIC, fsize);
+	  else if (strcasecmp(buf, "/HEAD") == 0)
+            head = 0;
+	  else if (strcasecmp(buf, "/H1") == 0 ||
+		   strcasecmp(buf, "/H2") == 0 ||
+		   strcasecmp(buf, "/H3") == 0 ||
+		   strcasecmp(buf, "/H4") == 0 ||
+		   strcasecmp(buf, "/H5") == 0 ||
+		   strcasecmp(buf, "/H6") == 0 ||
+		   strcasecmp(buf, "/B") == 0 ||
+		   strcasecmp(buf, "/STRONG") == 0 ||
+		   strcasecmp(buf, "/I") == 0 ||
+		   strcasecmp(buf, "/EM") == 0 ||
+		   strcasecmp(buf, "/CODE") == 0 ||
+		   strcasecmp(buf, "/TT") == 0 ||
+		   strcasecmp(buf, "/KBD") == 0 ||
+		   strcasecmp(buf, "/VAR") == 0)
+	    popfont(font, fsize, fcolor);
+	  else if (strcasecmp(buf, "/PRE") == 0)
+	  {
+	    popfont(font, fsize, fcolor);
+	    pre = 0;
+	  }
+	  else if (strcasecmp(buf, "IMG") == 0)
+	  {
+	    fltk3::SharedImage *img = 0;
+	    int		width, height;
+	    char	wattr[8], hattr[8];
+
+
+            get_attr(attrs, "WIDTH", wattr, sizeof(wattr));
+            get_attr(attrs, "HEIGHT", hattr, sizeof(hattr));
+	    width  = get_length(wattr);
+	    height = get_length(hattr);
+
+	    if (get_attr(attrs, "SRC", attr, sizeof(attr))) {
+	      img = get_image(attr, width, height);
+	      if (!width) width = img->w();
+	      if (!height) height = img->h();
+	    }
+
+	    if (!width || !height) {
+              if (get_attr(attrs, "ALT", attr, sizeof(attr)) == NULL) {
+	        strcpy(attr, "IMG");
+              }
+	    }
+
+	    ww = width;
+
+	    if (needspace && xx > block->x)
+	      xx += (int)fltk3::width(' ');
+
+	    if ((xx + ww) > block->w)
+	    {
+	      if (line < 31)
+		line ++;
+
+	      xx = block->line[line];
+	      yy += hh;
+	      hh = 0;
+	    }
+
+	    if (img) {
+	      img->draw(xx + x() - leftline_,
+	                yy + y() - fltk3::height() + fltk3::descent() + 2);
+	    }
+
+	    xx += ww;
+	    if ((height + 2) > hh)
+	      hh = height + 2;
+
+	    needspace = 0;
+	  }
+	}
+	else if (*ptr == '\n' && pre)
+	{
+	  *s = '\0';
+	  s = buf;
+
+          hv_draw(buf, xx + x() - leftline_, yy + y());
+
+	  if (line < 31)
+	    line ++;
+	  xx = block->line[line];
+	  yy += hh;
+	  hh = fsize + 2;
+	  needspace = 0;
+
+	  ptr ++;
+          current_pos = ptr-value_;
+	}
+	else if (isspace((*ptr)&255))
+	{
+	  if (pre)
+	  {
+	    if (*ptr == ' ')
+	      *s++ = ' ';
+	    else
+	    {
+	      // Do tabs every 8 columns...
+	      while (((s - buf) & 7))
+	        *s++ = ' ';
+            }
+	  }
+
+          ptr ++;
+          if (!pre) current_pos = ptr-value_;
+	  needspace = 1;
+	}
+	else if (*ptr == '&')
+	{
+	  ptr ++;
+
+          int qch = quote_char(ptr);
+
+	  if (qch < 0)
+	    *s++ = '&';
+	  else {
+            int l;
+            l = fltk3::utf8encode((unsigned int) qch, s);
+            if (l < 1) l = 1;
+            s += l;
+	    ptr = strchr(ptr, ';') + 1;
+	  }
+
+          if ((fsize + 2) > hh)
+	    hh = fsize + 2;
+	}
+	else
+	{
+	  *s++ = *ptr++;
+
+          if ((fsize + 2) > hh)
+	    hh = fsize + 2;
+        }
+      }
+
+      *s = '\0';
+
+      if (s > buf && !pre && !head)
+      {
+	ww = (int)fltk3::width(buf);
+
+        if (needspace && xx > block->x)
+	  xx += (int)fltk3::width(' ');
+
+	if ((xx + ww) > block->w)
+	{
+	  if (line < 31)
+	    line ++;
+	  xx = block->line[line];
+	  yy += hh;
+	  hh = 0;
+	}
+      }
+
+      if (s > buf && !head)
+      {
+        hv_draw(buf, xx + x() - leftline_, yy + y());
+	if (underline) fltk3::xyline(xx + x() - leftline_, yy + y() + 1,
+	                         xx + x() - leftline_ + ww);
+        current_pos = ptr-value_;
+      }
+    }
+
+  fltk3::pop_clip();
+}
+
+
+
+/** Finds the specified string \p s at starting position \p p.
+
+    \return the matching position or -1 if not found
+*/
+int						// O - Matching position or -1 if not found
+fltk3::HelpView::find(const char *s,		// I - String to find
+                   int        p)		// I - Starting position
+{
+  int		i,				// Looping var
+		c;				// Current character
+  fltk3::HelpBlock	*b;				// Current block
+  const char	*bp,				// Block matching pointer
+		*bs,				// Start of current comparison
+		*sp;				// Search string pointer
+
+
+  // Range check input and value...
+  if (!s || !value_) return -1;
+
+  if (p < 0 || p >= (int)strlen(value_)) p = 0;
+  else if (p > 0) p ++;
+
+  // Look for the string...
+  for (i = nblocks_, b = blocks_; i > 0; i --, b ++) {
+    if (b->end < (value_ + p))
+      continue;
+
+    if (b->start < (value_ + p)) bp = value_ + p;
+    else bp = b->start;
+
+    for (sp = s, bs = bp; *sp && *bp && bp < b->end; bp ++) {
+      if (*bp == '<') {
+        // skip to end of element...
+	while (*bp && bp < b->end && *bp != '>') bp ++;
+	continue;
+      } else if (*bp == '&') {
+        // decode HTML entity...
+	if ((c = quote_char(bp + 1)) < 0) c = '&';
+	else bp = strchr(bp + 1, ';') + 1;
+      } else c = *bp;
+
+      if (tolower(*sp) == tolower(c)) sp ++;
+      else {
+        // No match, so reset to start of search...
+	sp = s;
+	bs ++;
+	bp = bs;
+      }
+    }
+
+    if (!*sp) {
+      // Found a match!
+      topline(b->y - b->h);
+      return (b->end - value_);
+    }
+  }
+
+  // No match!
+  return (-1);
+}
+
+/** Formats the help text. */
+void fltk3::HelpView::format() {
+  int		i;		// Looping var
+  int		done;		// Are we done yet?
+  fltk3::HelpBlock	*block,		// Current block
+		*cell;		// Current table cell
+  int		cells[MAX_COLUMNS],
+				// Cells in the current row...
+		row;		// Current table row (block number)
+  const char	*ptr,		// Pointer into block
+		*start,		// Pointer to start of element
+		*attrs;		// Pointer to start of element attributes
+  char		*s,		// Pointer into buffer
+		buf[1024],	// Text buffer
+		attr[1024],	// Attribute buffer
+		wattr[1024],	// Width attribute buffer
+		hattr[1024],	// Height attribute buffer
+		linkdest[1024];	// Link destination
+  int		xx, yy, ww, hh;	// Size of current text fragment
+  int		line;		// Current line in block
+  int		links;		// Links for current line
+  fltk3::Font       font;
+  fltk3::Fontsize   fsize;          // Current font and size
+  fltk3::Color      fcolor;         // Current font color
+  unsigned char	border;		// Draw border?
+  int		talign,		// Current alignment
+		newalign,	// New alignment
+		head,		// In the <HEAD> section?
+		pre,		// <PRE> text?
+		needspace;	// Do we need whitespace?
+  int		table_width,	// Width of table
+		table_offset;	// Offset of table
+  int		column,		// Current table column number
+		columns[MAX_COLUMNS];
+				// Column widths
+  fltk3::Color	tc, rc;		// Table/row background color
+  fltk3::Boxtype	b = box() ? box() : fltk3::DOWN_BOX;
+				// Box to draw...
+  fl_margins	margins;	// Left margin stack...
+
+
+  // Reset document width...
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  hsize_ = w() - scrollsize - fltk3::box_dw(b);
+
+  done = 0;
+  while (!done)
+  {
+    // Reset state variables...
+    done       = 1;
+    nblocks_   = 0;
+    nlinks_    = 0;
+    ntargets_  = 0;
+    size_      = 0;
+    bgcolor_   = color();
+    textcolor_ = textcolor();
+    linkcolor_ = fltk3::contrast(fltk3::BLUE, color());
+
+    tc = rc = bgcolor_;
+
+    strcpy(title_, "Untitled");
+
+    if (!value_)
+      return;
+
+    // Setup for formatting...
+    initfont(font, fsize, fcolor);
+
+    line         = 0;
+    links        = 0;
+    xx           = margins.clear();
+    yy           = fsize + 2;
+    ww           = 0;
+    column       = 0;
+    border       = 0;
+    hh           = 0;
+    block        = add_block(value_, xx, yy, hsize_, 0);
+    row          = 0;
+    head         = 0;
+    pre          = 0;
+    talign       = LEFT;
+    newalign     = LEFT;
+    needspace    = 0;
+    linkdest[0]  = '\0';
+    table_offset = 0;
+
+    // Html text character loop
+    for (ptr = value_, s = buf; *ptr;)
+    {
+      // End of word?
+      if ((*ptr == '<' || isspace((*ptr)&255)) && s > buf)
+      {
+        // Get width of word parsed so far...
+        *s = '\0';
+        ww = (int)fltk3::width(buf);
+
+	if (!head && !pre)
+	{
+          // Check width...
+          if (ww > hsize_) {
+	    hsize_ = ww;
+	    done   = 0;
+	    break;
+	  }
+
+          if (needspace && xx > block->x)
+	    ww += (int)fltk3::width(' ');
+
+  //        printf("line = %d, xx = %d, ww = %d, block->x = %d, block->w = %d\n",
+  //	       line, xx, ww, block->x, block->w);
+
+          if ((xx + ww) > block->w)
+	  {
+            line     = do_align(block, line, xx, newalign, links);
+	    xx       = block->x;
+	    yy       += hh;
+	    block->h += hh;
+	    hh       = 0;
+	  }
+
+          if (linkdest[0])
+	    add_link(linkdest, xx, yy - fsize, ww, fsize);
+
+	  xx += ww;
+	  if ((fsize + 2) > hh)
+	    hh = fsize + 2;
+
+	  needspace = 0;
+	}
+	else if (pre)
+	{
+          // Add a link as needed...
+          if (linkdest[0])
+	    add_link(linkdest, xx, yy - hh, ww, hh);
+
+	  xx += ww;
+	  if ((fsize + 2) > hh)
+	    hh = fsize + 2;
+
+          // Handle preformatted text...
+	  while (isspace((*ptr)&255))
+	  {
+	    if (*ptr == '\n')
+	    {
+              if (xx > hsize_) break;
+
+              line     = do_align(block, line, xx, newalign, links);
+              xx       = block->x;
+	      yy       += hh;
+	      block->h += hh;
+	      hh       = fsize + 2;
+	    }
+	    else
+              xx += (int)fltk3::width(' ');
+
+            if ((fsize + 2) > hh)
+	      hh = fsize + 2;
+
+            ptr ++;
+	  }
+
+          if (xx > hsize_) {
+	    hsize_ = xx;
+	    done   = 0;
+	    break;
+	  }
+
+	  needspace = 0;
+	}
+	else
+	{
+          // Handle normal text or stuff in the <HEAD> section...
+	  while (isspace((*ptr)&255))
+            ptr ++;
+	}
+
+	s = buf;
+      }
+
+      if (*ptr == '<')
+      {
+	// Handle html tags..
+	start = ptr;
+	ptr ++;
+
+        if (strncmp(ptr, "!--", 3) == 0)
+	{
+	  // Comment...
+	  ptr += 3;
+	  if ((ptr = strstr(ptr, "-->")) != NULL)
+	  {
+	    ptr += 3;
+	    continue;
+	  }
+	  else
+	    break;
+	}
+
+	while (*ptr && *ptr != '>' && !isspace((*ptr)&255))
+          if (s < (buf + sizeof(buf) - 1))
+            *s++ = *ptr++;
+	  else
+	    ptr ++;
+
+	*s = '\0';
+	s = buf;
+
+//        puts(buf);
+
+	attrs = ptr;
+	while (*ptr && *ptr != '>')
+          ptr ++;
+
+	if (*ptr == '>')
+          ptr ++;
+
+	if (strcasecmp(buf, "HEAD") == 0)
+          head = 1;
+	else if (strcasecmp(buf, "/HEAD") == 0)
+          head = 0;
+	else if (strcasecmp(buf, "TITLE") == 0)
+	{
+          // Copy the title in the document...
+          for (s = title_;
+	       *ptr != '<' && *ptr && s < (title_ + sizeof(title_) - 1);
+	       *s++ = *ptr++);
+
+	  *s = '\0';
+	  s = buf;
+	}
+	else if (strcasecmp(buf, "A") == 0)
+	{
+          if (get_attr(attrs, "NAME", attr, sizeof(attr)) != NULL)
+	    add_target(attr, yy - fsize - 2);
+
+	  if (get_attr(attrs, "HREF", attr, sizeof(attr)) != NULL)
+	    strlcpy(linkdest, attr, sizeof(linkdest));
+	}
+	else if (strcasecmp(buf, "/A") == 0)
+          linkdest[0] = '\0';
+	else if (strcasecmp(buf, "BODY") == 0)
+	{
+          bgcolor_   = get_color(get_attr(attrs, "BGCOLOR", attr, sizeof(attr)),
+	                	 color());
+          textcolor_ = get_color(get_attr(attrs, "TEXT", attr, sizeof(attr)),
+	                	 textcolor());
+          linkcolor_ = get_color(get_attr(attrs, "LINK", attr, sizeof(attr)),
+	                	 fltk3::contrast(fltk3::BLUE, color()));
+	}
+	else if (strcasecmp(buf, "BR") == 0)
+	{
+          line     = do_align(block, line, xx, newalign, links);
+          xx       = block->x;
+	  block->h += hh;
+          yy       += hh;
+	  hh       = 0;
+	}
+	else if (strcasecmp(buf, "CENTER") == 0 ||
+        	 strcasecmp(buf, "P") == 0 ||
+        	 strcasecmp(buf, "H1") == 0 ||
+		 strcasecmp(buf, "H2") == 0 ||
+		 strcasecmp(buf, "H3") == 0 ||
+		 strcasecmp(buf, "H4") == 0 ||
+		 strcasecmp(buf, "H5") == 0 ||
+		 strcasecmp(buf, "H6") == 0 ||
+		 strcasecmp(buf, "UL") == 0 ||
+		 strcasecmp(buf, "OL") == 0 ||
+		 strcasecmp(buf, "DL") == 0 ||
+		 strcasecmp(buf, "LI") == 0 ||
+		 strcasecmp(buf, "DD") == 0 ||
+		 strcasecmp(buf, "DT") == 0 ||
+		 strcasecmp(buf, "HR") == 0 ||
+		 strcasecmp(buf, "PRE") == 0 ||
+		 strcasecmp(buf, "TABLE") == 0)
+	{
+          block->end = start;
+          line       = do_align(block, line, xx, newalign, links);
+	  newalign   = strcasecmp(buf, "CENTER") ? LEFT : CENTER;
+          xx         = block->x;
+          block->h   += hh;
+
+          if (strcasecmp(buf, "UL") == 0 ||
+	      strcasecmp(buf, "OL") == 0 ||
+	      strcasecmp(buf, "DL") == 0)
+          {
+	    block->h += fsize + 2;
+	    xx       = margins.push(4 * fsize);
+	  }
+          else if (strcasecmp(buf, "TABLE") == 0)
+	  {
+	    if (get_attr(attrs, "BORDER", attr, sizeof(attr)))
+	      border = (uchar)atoi(attr);
+	    else
+	      border = 0;
+
+            tc = rc = get_color(get_attr(attrs, "BGCOLOR", attr, sizeof(attr)), bgcolor_);
+
+	    block->h += fsize + 2;
+
+            format_table(&table_width, columns, start);
+
+            if ((xx + table_width) > hsize_) {
+#ifdef DEBUG
+              printf("xx=%d, table_width=%d, hsize_=%d\n", xx, table_width,
+	             hsize_);
+#endif // DEBUG
+	      hsize_ = xx + table_width;
+	      done   = 0;
+	      break;
+	    }
+
+            switch (get_align(attrs, talign))
+	    {
+	      default :
+	          table_offset = 0;
+	          break;
+
+	      case CENTER :
+	          table_offset = (hsize_ - table_width) / 2 - textsize_;
+	          break;
+
+	      case RIGHT :
+	          table_offset = hsize_ - table_width - textsize_;
+	          break;
+	    }
+
+	    column = 0;
+	  }
+
+          if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
+	  {
+	    font  = fltk3::HELVETICA_BOLD;
+	    fsize = textsize_ + '7' - buf[1];
+	  }
+	  else if (strcasecmp(buf, "DT") == 0)
+	  {
+	    font  = textfont_ | fltk3::ITALIC;
+	    fsize = textsize_;
+	  }
+	  else if (strcasecmp(buf, "PRE") == 0)
+	  {
+	    font  = fltk3::COURIER;
+	    fsize = textsize_;
+	    pre   = 1;
+	  }
+	  else
+	  {
+	    font  = textfont_;
+	    fsize = textsize_;
+	  }
+
+	  pushfont(font, fsize);
+
+          yy = block->y + block->h;
+          hh = 0;
+
+          if ((tolower(buf[0]) == 'h' && isdigit(buf[1])) ||
+	      strcasecmp(buf, "DD") == 0 ||
+	      strcasecmp(buf, "DT") == 0 ||
+	      strcasecmp(buf, "P") == 0)
+            yy += fsize + 2;
+	  else if (strcasecmp(buf, "HR") == 0)
+	  {
+	    hh += 2 * fsize;
+	    yy += fsize;
+	  }
+
+          if (row)
+	    block = add_block(start, xx, yy, block->w, 0);
+	  else
+	    block = add_block(start, xx, yy, hsize_, 0);
+
+	  needspace = 0;
+	  line      = 0;
+
+	  if (strcasecmp(buf, "CENTER") == 0)
+	    newalign = talign = CENTER;
+	  else
+	    newalign = get_align(attrs, talign);
+	}
+	else if (strcasecmp(buf, "/CENTER") == 0 ||
+		 strcasecmp(buf, "/P") == 0 ||
+		 strcasecmp(buf, "/H1") == 0 ||
+		 strcasecmp(buf, "/H2") == 0 ||
+		 strcasecmp(buf, "/H3") == 0 ||
+		 strcasecmp(buf, "/H4") == 0 ||
+		 strcasecmp(buf, "/H5") == 0 ||
+		 strcasecmp(buf, "/H6") == 0 ||
+		 strcasecmp(buf, "/PRE") == 0 ||
+		 strcasecmp(buf, "/UL") == 0 ||
+		 strcasecmp(buf, "/OL") == 0 ||
+		 strcasecmp(buf, "/DL") == 0 ||
+		 strcasecmp(buf, "/TABLE") == 0)
+	{
+          line       = do_align(block, line, xx, newalign, links);
+          xx         = block->x;
+          block->end = ptr;
+
+          if (strcasecmp(buf, "/UL") == 0 ||
+	      strcasecmp(buf, "/OL") == 0 ||
+	      strcasecmp(buf, "/DL") == 0)
+	  {
+	    xx       = margins.pop();
+	    block->h += fsize + 2;
+	  }
+          else if (strcasecmp(buf, "/TABLE") == 0) 
+          {
+	    block->h += fsize + 2;
+            xx       = margins.current();
+          }
+	  else if (strcasecmp(buf, "/PRE") == 0)
+	  {
+	    pre = 0;
+	    hh  = 0;
+	  }
+	  else if (strcasecmp(buf, "/CENTER") == 0)
+	    talign = LEFT;
+
+          popfont(font, fsize, fcolor);
+
+	  //#if defined(__GNUC__)
+          //#warning FIXME this isspace & 255 test will probably not work on a utf8 stream... And we use it everywhere!
+	  //#endif /*__GNUC__*/
+          while (isspace((*ptr)&255))
+	    ptr ++;
+
+          block->h += hh;
+          yy       += hh;
+
+          if (tolower(buf[2]) == 'l')
+            yy += fsize + 2;
+
+          if (row)
+	    block = add_block(ptr, xx, yy, block->w, 0);
+	  else
+	    block = add_block(ptr, xx, yy, hsize_, 0);
+
+	  needspace = 0;
+	  hh        = 0;
+	  line      = 0;
+	  newalign  = talign;
+	}
+	else if (strcasecmp(buf, "TR") == 0)
+	{
+          block->end = start;
+          line       = do_align(block, line, xx, newalign, links);
+          xx         = block->x;
+          block->h   += hh;
+
+          if (row)
+	  {
+            yy = blocks_[row].y + blocks_[row].h;
+
+	    for (cell = blocks_ + row + 1; cell <= block; cell ++)
+	      if ((cell->y + cell->h) > yy)
+		yy = cell->y + cell->h;
+
+            block = blocks_ + row;
+
+            block->h = yy - block->y + 2;
+
+	    for (i = 0; i < column; i ++)
+	      if (cells[i])
+	      {
+		cell = blocks_ + cells[i];
+		cell->h = block->h;
+	      }
+	  }
+
+          memset(cells, 0, sizeof(cells));
+
+	  yy        = block->y + block->h - 4;
+	  hh        = 0;
+          block     = add_block(start, xx, yy, hsize_, 0);
+	  row       = block - blocks_;
+	  needspace = 0;
+	  column    = 0;
+	  line      = 0;
+
+          rc = get_color(get_attr(attrs, "BGCOLOR", attr, sizeof(attr)), tc);
+	}
+	else if (strcasecmp(buf, "/TR") == 0 && row)
+	{
+          line       = do_align(block, line, xx, newalign, links);
+          block->end = start;
+	  block->h   += hh;
+	  talign     = LEFT;
+
+          xx = blocks_[row].x;
+          yy = blocks_[row].y + blocks_[row].h;
+
+	  for (cell = blocks_ + row + 1; cell <= block; cell ++)
+	    if ((cell->y + cell->h) > yy)
+	      yy = cell->y + cell->h;
+
+          block = blocks_ + row;
+
+          block->h = yy - block->y + 2;
+
+	  for (i = 0; i < column; i ++)
+	    if (cells[i])
+	    {
+	      cell = blocks_ + cells[i];
+	      cell->h = block->h;
+	    }
+
+	  yy        = block->y + block->h /*- 4*/;
+          block     = add_block(start, xx, yy, hsize_, 0);
+	  needspace = 0;
+	  row       = 0;
+	  line      = 0;
+	}
+	else if ((strcasecmp(buf, "TD") == 0 ||
+                  strcasecmp(buf, "TH") == 0) && row)
+	{
+          int	colspan;		// COLSPAN attribute
+
+
+          line       = do_align(block, line, xx, newalign, links);
+          block->end = start;
+	  block->h   += hh;
+
+          if (strcasecmp(buf, "TH") == 0)
+	    font = textfont_ | fltk3::BOLD;
+	  else
+	    font = textfont_;
+
+          fsize = textsize_;
+
+          xx = blocks_[row].x + fsize + 3 + table_offset;
+	  for (i = 0; i < column; i ++)
+	    xx += columns[i] + 6;
+
+          margins.push(xx - margins.current());
+
+          if (get_attr(attrs, "COLSPAN", attr, sizeof(attr)) != NULL)
+	    colspan = atoi(attr);
+	  else
+	    colspan = 1;
+
+          for (i = 0, ww = -6; i < colspan; i ++)
+	    ww += columns[column + i] + 6;
+
+          if (block->end == block->start && nblocks_ > 1)
+	  {
+	    nblocks_ --;
+	    block --;
+	  }
+
+	  pushfont(font, fsize);
+
+	  yy        = blocks_[row].y;
+	  hh        = 0;
+          block     = add_block(start, xx, yy, xx + ww, 0, border);
+	  needspace = 0;
+	  line      = 0;
+	  newalign  = get_align(attrs, tolower(buf[1]) == 'h' ? CENTER : LEFT);
+	  talign    = newalign;
+
+          cells[column] = block - blocks_;
+
+	  column += colspan;
+
+          block->bgcolor = get_color(get_attr(attrs, "BGCOLOR", attr,
+	                                      sizeof(attr)), rc);
+	}
+	else if ((strcasecmp(buf, "/TD") == 0 ||
+                  strcasecmp(buf, "/TH") == 0) && row)
+	{
+          line = do_align(block, line, xx, newalign, links);
+          popfont(font, fsize, fcolor);
+	  xx = margins.pop();
+	  talign = LEFT;
+	}
+	else if (strcasecmp(buf, "FONT") == 0)
+	{
+          if (get_attr(attrs, "FACE", attr, sizeof(attr)) != NULL) {
+	    if (!strncasecmp(attr, "helvetica", 9) ||
+	        !strncasecmp(attr, "arial", 5) ||
+		!strncasecmp(attr, "sans", 4)) font = fltk3::HELVETICA;
+            else if (!strncasecmp(attr, "times", 5) ||
+	             !strncasecmp(attr, "serif", 5)) font = fltk3::TIMES;
+            else if (!strncasecmp(attr, "symbol", 6)) font = fltk3::SYMBOL;
+	    else font = fltk3::COURIER;
+          }
+
+          if (get_attr(attrs, "SIZE", attr, sizeof(attr)) != NULL) {
+            if (isdigit(attr[0] & 255)) {
+	      // Absolute size
+	      fsize = (int)(textsize_ * pow(1.2, atoi(attr) - 3.0));
+	    } else {
+	      // Relative size
+	      fsize = (int)(fsize * pow(1.2, atoi(attr)));
+	    }
+	  }
+
+          pushfont(font, fsize);
+	}
+	else if (strcasecmp(buf, "/FONT") == 0)
+	  popfont(font, fsize, fcolor);
+	else if (strcasecmp(buf, "B") == 0 ||
+        	 strcasecmp(buf, "STRONG") == 0)
+	  pushfont(font |= fltk3::BOLD, fsize);
+	else if (strcasecmp(buf, "I") == 0 ||
+        	 strcasecmp(buf, "EM") == 0)
+	  pushfont(font |= fltk3::ITALIC, fsize);
+	else if (strcasecmp(buf, "CODE") == 0 ||
+	         strcasecmp(buf, "TT") == 0)
+	  pushfont(font = fltk3::COURIER, fsize);
+	else if (strcasecmp(buf, "KBD") == 0)
+	  pushfont(font = fltk3::COURIER_BOLD, fsize);
+	else if (strcasecmp(buf, "VAR") == 0)
+	  pushfont(font = fltk3::COURIER_ITALIC, fsize);
+	else if (strcasecmp(buf, "/B") == 0 ||
+		 strcasecmp(buf, "/STRONG") == 0 ||
+		 strcasecmp(buf, "/I") == 0 ||
+		 strcasecmp(buf, "/EM") == 0 ||
+		 strcasecmp(buf, "/CODE") == 0 ||
+		 strcasecmp(buf, "/TT") == 0 ||
+		 strcasecmp(buf, "/KBD") == 0 ||
+		 strcasecmp(buf, "/VAR") == 0)
+	  popfont(font, fsize, fcolor);
+	else if (strcasecmp(buf, "IMG") == 0)
+	{
+	  fltk3::SharedImage	*img = 0;
+	  int		width;
+	  int		height;
+
+
+          get_attr(attrs, "WIDTH", wattr, sizeof(wattr));
+          get_attr(attrs, "HEIGHT", hattr, sizeof(hattr));
+	  width  = get_length(wattr);
+	  height = get_length(hattr);
+
+	  if (get_attr(attrs, "SRC", attr, sizeof(attr))) {
+	    img    = get_image(attr, width, height);
+	    width  = img->w();
+	    height = img->h();
+	  }
+
+	  ww = width;
+
+          if (ww > hsize_) {
+	    hsize_ = ww;
+	    done   = 0;
+	    break;
+	  }
+
+	  if (needspace && xx > block->x)
+	    ww += (int)fltk3::width(' ');
+
+	  if ((xx + ww) > block->w)
+	  {
+	    line     = do_align(block, line, xx, newalign, links);
+	    xx       = block->x;
+	    yy       += hh;
+	    block->h += hh;
+	    hh       = 0;
+	  }
+
+	  if (linkdest[0])
+	    add_link(linkdest, xx, yy - height, ww, height);
+
+	  xx += ww;
+	  if ((height + 2) > hh)
+	    hh = height + 2;
+
+	  needspace = 0;
+	}
+      }
+      else if (*ptr == '\n' && pre)
+      {
+	if (linkdest[0])
+	  add_link(linkdest, xx, yy - hh, ww, hh);
+
+        if (xx > hsize_) {
+	  hsize_ = xx;
+          done   = 0;
+	  break;
+	}
+
+	line      = do_align(block, line, xx, newalign, links);
+	xx        = block->x;
+	yy        += hh;
+	block->h  += hh;
+	needspace = 0;
+	ptr ++;
+      }
+      else if (isspace((*ptr)&255))
+      {
+	needspace = 1;
+	if ( pre ) {
+	  xx += (int)fltk3::width(' ');
+        }
+	ptr ++;
+      }
+      else if (*ptr == '&' && s < (buf + sizeof(buf) - 1))
+      {
+        // Handle html '&' codes, eg. "&amp;"
+	ptr ++;
+
+        int qch = quote_char(ptr);
+
+	if (qch < 0)
+	  *s++ = '&';
+	else {
+          int l;
+          l = fltk3::utf8encode((unsigned int) qch, s);
+          if (l < 1) l = 1;
+          s += l;
+	  ptr = strchr(ptr, ';') + 1;
+	}
+
+	if ((fsize + 2) > hh)
+          hh = fsize + 2;
+      }
+      else
+      {
+	if (s < (buf + sizeof(buf) - 1))
+          *s++ = *ptr++;
+	else
+          ptr ++;
+
+	if ((fsize + 2) > hh)
+          hh = fsize + 2;
+      }
+    }
+
+    if (s > buf && !head)
+    {
+      *s = '\0';
+      ww = (int)fltk3::width(buf);
+
+  //    printf("line = %d, xx = %d, ww = %d, block->x = %d, block->w = %d\n",
+  //	   line, xx, ww, block->x, block->w);
+
+      if (ww > hsize_) {
+	hsize_ = ww;
+	done   = 0;
+	break;
+      }
+
+      if (needspace && xx > block->x)
+	ww += (int)fltk3::width(' ');
+
+      if ((xx + ww) > block->w)
+      {
+	line     = do_align(block, line, xx, newalign, links);
+	xx       = block->x;
+	yy       += hh;
+	block->h += hh;
+	hh       = 0;
+      }
+
+      if (linkdest[0])
+	add_link(linkdest, xx, yy - fsize, ww, fsize);
+
+      xx += ww;
+    }
+
+    do_align(block, line, xx, newalign, links);
+
+    block->end = ptr;
+    size_      = yy + hh;
+  }
+
+//  printf("margins.depth_=%d\n", margins.depth_);
+
+  if (ntargets_ > 1)
+    qsort(targets_, ntargets_, sizeof(fltk3::HelpTarget),
+          (compare_func_t)compare_targets);
+
+  int dx = fltk3::box_dw(b) - fltk3::box_dx(b);
+  int dy = fltk3::box_dh(b) - fltk3::box_dy(b);
+  int ss = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  int dw = fltk3::box_dw(b) + ss;
+  int dh = fltk3::box_dh(b);
+
+  if (hsize_ > (w() - dw)) {
+    hscrollbar_.show();
+
+    dh += ss;
+
+    if (size_ < (h() - dh)) {
+      scrollbar_.hide();
+      hscrollbar_.resize(x() + fltk3::box_dx(b), y() + h() - ss - dy,
+                         w() - fltk3::box_dw(b), ss);
+    } else {
+      scrollbar_.show();
+      scrollbar_.resize(x() + w() - ss - dx, y() + fltk3::box_dy(b),
+                        ss, h() - ss - fltk3::box_dh(b));
+      hscrollbar_.resize(x() + fltk3::box_dx(b), y() + h() - ss - dy,
+                         w() - ss - fltk3::box_dw(b), ss);
+    }
+  } else {
+    hscrollbar_.hide();
+
+    if (size_ < (h() - dh)) scrollbar_.hide();
+    else {
+      scrollbar_.resize(x() + w() - ss - dx, y() + fltk3::box_dy(b),
+                        ss, h() - fltk3::box_dh(b));
+      scrollbar_.show();
+    }
+  }
+
+  // Reset scrolling if it needs to be...
+  if (scrollbar_.visible()) {
+    int temph = h() - fltk3::box_dh(b);
+    if (hscrollbar_.visible()) temph -= ss;
+    if ((topline_ + temph) > size_) topline(size_ - temph);
+    else topline(topline_);
+  } else topline(0);
+
+  if (hscrollbar_.visible()) {
+    int tempw = w() - ss - fltk3::box_dw(b);
+    if ((leftline_ + tempw) > hsize_) leftline(hsize_ - tempw);
+    else leftline(leftline_);
+  } else leftline(0);
+}
+
+
+/** Formats a table */
+void
+fltk3::HelpView::format_table(int        *table_width,	// O - Total table width
+                           int        *columns,		// O - Column widths
+	                   const char *table)		// I - Pointer to start of table
+{
+  int		column,					// Current column
+		num_columns,				// Number of columns
+		colspan,				// COLSPAN attribute
+		width,					// Current width
+		temp_width,				// Temporary width
+		max_width,				// Maximum width
+		incell,					// In a table cell?
+		pre,					// <PRE> text?
+		needspace;				// Need whitespace?
+  char		*s,					// Pointer into buffer
+		buf[1024],				// Text buffer
+		attr[1024],				// Other attribute
+		wattr[1024],				// WIDTH attribute
+		hattr[1024];				// HEIGHT attribute
+  const char	*ptr,					// Pointer into table
+		*attrs,					// Pointer to attributes
+		*start;					// Start of element
+  int		minwidths[MAX_COLUMNS];			// Minimum widths for each column
+  fltk3::Font       font;
+  fltk3::Fontsize   fsize;				        // Current font and size
+  fltk3::Color      fcolor;                                 // Currrent font color
+
+  // Clear widths...
+  *table_width = 0;
+  for (column = 0; column < MAX_COLUMNS; column ++)
+  {
+    columns[column]   = 0;
+    minwidths[column] = 0;
+  }
+
+  num_columns = 0;
+  colspan     = 0;
+  max_width   = 0;
+  pre         = 0;
+  needspace   = 0;
+  fstack_.top(font, fsize, fcolor);
+
+  // Scan the table...
+  for (ptr = table, column = -1, width = 0, s = buf, incell = 0; *ptr;)
+  {
+    if ((*ptr == '<' || isspace((*ptr)&255)) && s > buf && incell)
+    {
+      // Check width...
+      if (needspace)
+      {
+        *s++      = ' ';
+	needspace = 0;
+      }
+
+      *s         = '\0';
+      temp_width = (int)fltk3::width(buf);
+      s          = buf;
+
+      if (temp_width > minwidths[column])
+        minwidths[column] = temp_width;
+
+      width += temp_width;
+
+      if (width > max_width)
+        max_width = width;
+    }
+
+    if (*ptr == '<')
+    {
+      start = ptr;
+
+      for (s = buf, ptr ++; *ptr && *ptr != '>' && !isspace((*ptr)&255);)
+        if (s < (buf + sizeof(buf) - 1))
+          *s++ = *ptr++;
+	else
+	  ptr ++;
+
+      *s = '\0';
+      s = buf;
+
+      attrs = ptr;
+      while (*ptr && *ptr != '>')
+        ptr ++;
+
+      if (*ptr == '>')
+        ptr ++;
+
+      if (strcasecmp(buf, "BR") == 0 ||
+	  strcasecmp(buf, "HR") == 0)
+      {
+        width     = 0;
+	needspace = 0;
+      }
+      else if (strcasecmp(buf, "TABLE") == 0 && start > table)
+        break;
+      else if (strcasecmp(buf, "CENTER") == 0 ||
+               strcasecmp(buf, "P") == 0 ||
+               strcasecmp(buf, "H1") == 0 ||
+	       strcasecmp(buf, "H2") == 0 ||
+	       strcasecmp(buf, "H3") == 0 ||
+	       strcasecmp(buf, "H4") == 0 ||
+	       strcasecmp(buf, "H5") == 0 ||
+	       strcasecmp(buf, "H6") == 0 ||
+	       strcasecmp(buf, "UL") == 0 ||
+	       strcasecmp(buf, "OL") == 0 ||
+	       strcasecmp(buf, "DL") == 0 ||
+	       strcasecmp(buf, "LI") == 0 ||
+	       strcasecmp(buf, "DD") == 0 ||
+	       strcasecmp(buf, "DT") == 0 ||
+	       strcasecmp(buf, "PRE") == 0)
+      {
+        width     = 0;
+	needspace = 0;
+
+        if (tolower(buf[0]) == 'h' && isdigit(buf[1]))
+	{
+	  font  = fltk3::HELVETICA_BOLD;
+	  fsize = textsize_ + '7' - buf[1];
+	}
+	else if (strcasecmp(buf, "DT") == 0)
+	{
+	  font  = textfont_ | fltk3::ITALIC;
+	  fsize = textsize_;
+	}
+	else if (strcasecmp(buf, "PRE") == 0)
+	{
+	  font  = fltk3::COURIER;
+	  fsize = textsize_;
+	  pre   = 1;
+	}
+	else if (strcasecmp(buf, "LI") == 0)
+	{
+	  width  += 4 * fsize;
+	  font   = textfont_;
+	  fsize  = textsize_;
+	}
+	else
+	{
+	  font  = textfont_;
+	  fsize = textsize_;
+	}
+
+	pushfont(font, fsize);
+      }
+      else if (strcasecmp(buf, "/CENTER") == 0 ||
+	       strcasecmp(buf, "/P") == 0 ||
+	       strcasecmp(buf, "/H1") == 0 ||
+	       strcasecmp(buf, "/H2") == 0 ||
+	       strcasecmp(buf, "/H3") == 0 ||
+	       strcasecmp(buf, "/H4") == 0 ||
+	       strcasecmp(buf, "/H5") == 0 ||
+	       strcasecmp(buf, "/H6") == 0 ||
+	       strcasecmp(buf, "/PRE") == 0 ||
+	       strcasecmp(buf, "/UL") == 0 ||
+	       strcasecmp(buf, "/OL") == 0 ||
+	       strcasecmp(buf, "/DL") == 0)
+      {
+        width     = 0;
+	needspace = 0;
+
+        popfont(font, fsize, fcolor);
+      }
+      else if (strcasecmp(buf, "TR") == 0 || strcasecmp(buf, "/TR") == 0 ||
+               strcasecmp(buf, "/TABLE") == 0)
+      {
+//        printf("%s column = %d, colspan = %d, num_columns = %d\n",
+//	       buf, column, colspan, num_columns);
+
+        if (column >= 0)
+	{
+	  // This is a hack to support COLSPAN...
+	  max_width /= colspan;
+
+	  while (colspan > 0)
+	  {
+	    if (max_width > columns[column])
+	      columns[column] = max_width;
+
+	    column ++;
+	    colspan --;
+	  }
+	}
+
+	if (strcasecmp(buf, "/TABLE") == 0)
+	  break;
+
+	needspace = 0;
+	column    = -1;
+	width     = 0;
+	max_width = 0;
+	incell    = 0;
+      }
+      else if (strcasecmp(buf, "TD") == 0 ||
+               strcasecmp(buf, "TH") == 0)
+      {
+//        printf("BEFORE column = %d, colspan = %d, num_columns = %d\n",
+//	       column, colspan, num_columns);
+
+        if (column >= 0)
+	{
+	  // This is a hack to support COLSPAN...
+	  max_width /= colspan;
+
+	  while (colspan > 0)
+	  {
+	    if (max_width > columns[column])
+	      columns[column] = max_width;
+
+	    column ++;
+	    colspan --;
+	  }
+	}
+	else
+	  column ++;
+
+        if (get_attr(attrs, "COLSPAN", attr, sizeof(attr)) != NULL)
+	  colspan = atoi(attr);
+	else
+	  colspan = 1;
+
+//        printf("AFTER column = %d, colspan = %d, num_columns = %d\n",
+//	       column, colspan, num_columns);
+
+        if ((column + colspan) >= num_columns)
+	  num_columns = column + colspan;
+
+	needspace = 0;
+	width     = 0;
+	incell    = 1;
+
+        if (strcasecmp(buf, "TH") == 0)
+	  font = textfont_ | fltk3::BOLD;
+	else
+	  font = textfont_;
+
+        fsize = textsize_;
+
+	pushfont(font, fsize);
+
+        if (get_attr(attrs, "WIDTH", attr, sizeof(attr)) != NULL)
+	  max_width = get_length(attr);
+	else
+	  max_width = 0;
+
+//        printf("max_width = %d\n", max_width);
+      }
+      else if (strcasecmp(buf, "/TD") == 0 ||
+               strcasecmp(buf, "/TH") == 0)
+      {
+	incell = 0;
+        popfont(font, fsize, fcolor);
+      }
+      else if (strcasecmp(buf, "B") == 0 ||
+               strcasecmp(buf, "STRONG") == 0)
+	pushfont(font |= fltk3::BOLD, fsize);
+      else if (strcasecmp(buf, "I") == 0 ||
+               strcasecmp(buf, "EM") == 0)
+	pushfont(font |= fltk3::ITALIC, fsize);
+      else if (strcasecmp(buf, "CODE") == 0 ||
+               strcasecmp(buf, "TT") == 0)
+	pushfont(font = fltk3::COURIER, fsize);
+      else if (strcasecmp(buf, "KBD") == 0)
+	pushfont(font = fltk3::COURIER_BOLD, fsize);
+      else if (strcasecmp(buf, "VAR") == 0)
+	pushfont(font = fltk3::COURIER_ITALIC, fsize);
+      else if (strcasecmp(buf, "/B") == 0 ||
+	       strcasecmp(buf, "/STRONG") == 0 ||
+	       strcasecmp(buf, "/I") == 0 ||
+	       strcasecmp(buf, "/EM") == 0 ||
+	       strcasecmp(buf, "/CODE") == 0 ||
+	       strcasecmp(buf, "/TT") == 0 ||
+	       strcasecmp(buf, "/KBD") == 0 ||
+	       strcasecmp(buf, "/VAR") == 0)
+	popfont(font, fsize, fcolor);
+      else if (strcasecmp(buf, "IMG") == 0 && incell)
+      {
+	fltk3::SharedImage	*img = 0;
+	int		iwidth, iheight;
+
+
+        get_attr(attrs, "WIDTH", wattr, sizeof(wattr));
+        get_attr(attrs, "HEIGHT", hattr, sizeof(hattr));
+	iwidth  = get_length(wattr);
+	iheight = get_length(hattr);
+
+        if (get_attr(attrs, "SRC", attr, sizeof(attr))) {
+	  img     = get_image(attr, iwidth, iheight);
+	  iwidth  = img->w();
+	  iheight = img->h();
+	}
+
+	if (iwidth > minwidths[column])
+          minwidths[column] = iwidth;
+
+        width += iwidth;
+	if (needspace)
+	  width += (int)fltk3::width(' ');
+
+	if (width > max_width)
+          max_width = width;
+
+	needspace = 0;
+      }
+    }
+    else if (*ptr == '\n' && pre)
+    {
+      width     = 0;
+      needspace = 0;
+      ptr ++;
+    }
+    else if (isspace((*ptr)&255))
+    {
+      needspace = 1;
+
+      ptr ++;
+    }
+    else if (*ptr == '&' && s < (buf + sizeof(buf) - 1))
+    {
+      ptr ++;
+
+      int qch = quote_char(ptr);
+
+      if (qch < 0)
+	*s++ = '&';
+      else {
+//        int l;
+//        l = fltk3::utf8encode((unsigned int) qch, s);
+//        if (l < 1) l = 1;
+//        s += l;
+	*s++ = qch;
+	ptr = strchr(ptr, ';') + 1;
+      }
+    }
+    else
+    {
+      if (s < (buf + sizeof(buf) - 1))
+        *s++ = *ptr++;
+      else
+        ptr ++;
+    }
+  }
+
+  // Now that we have scanned the entire table, adjust the table and
+  // cell widths to fit on the screen...
+  if (get_attr(table + 6, "WIDTH", attr, sizeof(attr)))
+    *table_width = get_length(attr);
+  else
+    *table_width = 0;
+
+#ifdef DEBUG
+  printf("num_columns = %d, table_width = %d\n", num_columns, *table_width);
+#endif // DEBUG
+
+  if (num_columns == 0)
+    return;
+
+  // Add up the widths...
+  for (column = 0, width = 0; column < num_columns; column ++)
+    width += columns[column];
+
+#ifdef DEBUG
+  printf("width = %d, w() = %d\n", width, w());
+  for (column = 0; column < num_columns; column ++)
+    printf("    columns[%d] = %d, minwidths[%d] = %d\n", column, columns[column],
+           column, minwidths[column]);
+#endif // DEBUG
+
+  // Adjust the width if needed...
+  int scale_width = *table_width;
+
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  if (scale_width == 0) {
+    if (width > (hsize_ - scrollsize)) scale_width = hsize_ - scrollsize;
+    else scale_width = width;
+  }
+
+  if (width < scale_width) {
+#ifdef DEBUG
+    printf("Scaling table up to %d from %d...\n", scale_width, width);
+#endif // DEBUG
+
+    *table_width = 0;
+
+    scale_width = (scale_width - width) / num_columns;
+
+#ifdef DEBUG
+    printf("adjusted scale_width = %d\n", scale_width);
+#endif // DEBUG
+
+    for (column = 0; column < num_columns; column ++) {
+      columns[column] += scale_width;
+
+      (*table_width) += columns[column];
+    }
+  }
+  else if (width > scale_width) {
+#ifdef DEBUG
+    printf("Scaling table down to %d from %d...\n", scale_width, width);
+#endif // DEBUG
+
+    for (column = 0; column < num_columns; column ++) {
+      width       -= minwidths[column];
+      scale_width -= minwidths[column];
+    }
+
+#ifdef DEBUG
+    printf("adjusted width = %d, scale_width = %d\n", width, scale_width);
+#endif // DEBUG
+
+    if (width > 0) {
+      for (column = 0; column < num_columns; column ++) {
+	columns[column] -= minwidths[column];
+	columns[column] = scale_width * columns[column] / width;
+	columns[column] += minwidths[column];
+      }
+    }
+
+    *table_width = 0;
+    for (column = 0; column < num_columns; column ++) {
+      (*table_width) += columns[column];
+    }
+  }
+  else if (*table_width == 0)
+    *table_width = width;
+
+#ifdef DEBUG
+  printf("FINAL table_width = %d\n", *table_width);
+  for (column = 0; column < num_columns; column ++)
+    printf("    columns[%d] = %d\n", column, columns[column]);
+#endif // DEBUG
+}
+
+
+/** Frees memory used for the document. */
+void
+fltk3::HelpView::free_data() {
+  // Release all images...
+  if (value_) {
+    const char	*ptr,		// Pointer into block
+		*attrs;		// Pointer to start of element attributes
+    char	*s,		// Pointer into buffer
+		buf[1024],	// Text buffer
+		attr[1024],	// Attribute buffer
+		wattr[1024],	// Width attribute buffer
+		hattr[1024];	// Height attribute buffer
+
+    for (ptr = value_; *ptr;)
+    {
+      if (*ptr == '<')
+      {
+	ptr ++;
+
+        if (strncmp(ptr, "!--", 3) == 0)
+	{
+	  // Comment...
+	  ptr += 3;
+	  if ((ptr = strstr(ptr, "-->")) != NULL)
+	  {
+	    ptr += 3;
+	    continue;
+	  }
+	  else
+	    break;
+	}
+
+        s = buf;
+
+	while (*ptr && *ptr != '>' && !isspace((*ptr)&255))
+          if (s < (buf + sizeof(buf) - 1))
+            *s++ = *ptr++;
+	  else
+	    ptr ++;
+
+	*s = '\0';
+
+	attrs = ptr;
+	while (*ptr && *ptr != '>')
+          ptr ++;
+
+	if (*ptr == '>')
+          ptr ++;
+
+	if (strcasecmp(buf, "IMG") == 0)
+	{
+	  fltk3::SharedImage	*img;
+	  int		width;
+	  int		height;
+
+          get_attr(attrs, "WIDTH", wattr, sizeof(wattr));
+          get_attr(attrs, "HEIGHT", hattr, sizeof(hattr));
+	  width  = get_length(wattr);
+	  height = get_length(hattr);
+
+	  if (get_attr(attrs, "SRC", attr, sizeof(attr))) {
+	    // Get and release the image to free it from memory...
+	    img = get_image(attr, width, height);
+	    if ((void*)img != &broken_image) {
+	      img->release();
+	    }
+	  }
+	}
+      }
+      else
+        ptr ++;
+    }
+
+    free((void *)value_);
+    value_ = 0;
+  }
+
+  // Free all of the arrays...
+  if (nblocks_) {
+    free(blocks_);
+
+    ablocks_ = 0;
+    nblocks_ = 0;
+    blocks_  = 0;
+  }
+
+  if (nlinks_) {
+    free(links_);
+
+    alinks_ = 0;
+    nlinks_ = 0;
+    links_  = 0;
+  }
+
+  if (ntargets_) {
+    free(targets_);
+
+    atargets_ = 0;
+    ntargets_ = 0;
+    targets_  = 0;
+  }
+}
+
+/** Gets an alignment attribute. */
+int					// O - Alignment
+fltk3::HelpView::get_align(const char *p,	// I - Pointer to start of attrs
+                        int        a)	// I - Default alignment
+{
+  char	buf[255];			// Alignment value
+
+
+  if (get_attr(p, "ALIGN", buf, sizeof(buf)) == NULL)
+    return (a);
+
+  if (strcasecmp(buf, "CENTER") == 0)
+    return (CENTER);
+  else if (strcasecmp(buf, "RIGHT") == 0)
+    return (RIGHT);
+  else
+    return (LEFT);
+}
+
+
+/** Gets an attribute value from the string. */
+const char *					// O - Pointer to buf or NULL
+fltk3::HelpView::get_attr(const char *p,		// I - Pointer to start of attributes
+                      const char *n,		// I - Name of attribute
+		      char       *buf,		// O - Buffer for attribute value
+		      int        bufsize)	// I - Size of buffer
+{
+  char	name[255],				// Name from string
+	*ptr,					// Pointer into name or value
+	quote;					// Quote
+
+
+  buf[0] = '\0';
+
+  while (*p && *p != '>')
+  {
+    while (isspace((*p)&255))
+      p ++;
+
+    if (*p == '>' || !*p)
+      return (NULL);
+
+    for (ptr = name; *p && !isspace((*p)&255) && *p != '=' && *p != '>';)
+      if (ptr < (name + sizeof(name) - 1))
+        *ptr++ = *p++;
+      else
+        p ++;
+
+    *ptr = '\0';
+
+    if (isspace((*p)&255) || !*p || *p == '>')
+      buf[0] = '\0';
+    else
+    {
+      if (*p == '=')
+        p ++;
+
+      for (ptr = buf; *p && !isspace((*p)&255) && *p != '>';)
+        if (*p == '\'' || *p == '\"')
+	{
+	  quote = *p++;
+
+	  while (*p && *p != quote)
+	    if ((ptr - buf + 1) < bufsize)
+	      *ptr++ = *p++;
+	    else
+	      p ++;
+
+          if (*p == quote)
+	    p ++;
+	}
+	else if ((ptr - buf + 1) < bufsize)
+	  *ptr++ = *p++;
+	else
+	  p ++;
+
+      *ptr = '\0';
+    }
+
+    if (strcasecmp(n, name) == 0)
+      return (buf);
+    else
+      buf[0] = '\0';
+
+    if (*p == '>')
+      return (NULL);
+  }
+
+  return (NULL);
+}
+
+
+/** Gets a color attribute. */
+fltk3::Color				// O - Color value
+fltk3::HelpView::get_color(const char *n,	// I - Color name
+                        fltk3::Color   c)	// I - Default color value
+{
+  int	i;				// Looping var
+  int	rgb, r, g, b;			// RGB values
+  static const struct {			// Color name table
+    const char *name;
+    int r, g, b;
+  }	colors[] = {
+    { "black",		0x00, 0x00, 0x00 },
+    { "red",		0xff, 0x00, 0x00 },
+    { "green",		0x00, 0x80, 0x00 },
+    { "yellow",		0xff, 0xff, 0x00 },
+    { "blue",		0x00, 0x00, 0xff },
+    { "magenta",	0xff, 0x00, 0xff },
+    { "fuchsia",	0xff, 0x00, 0xff },
+    { "cyan",		0x00, 0xff, 0xff },
+    { "aqua",		0x00, 0xff, 0xff },
+    { "white",		0xff, 0xff, 0xff },
+    { "gray",		0x80, 0x80, 0x80 },
+    { "grey",		0x80, 0x80, 0x80 },
+    { "lime",		0x00, 0xff, 0x00 },
+    { "maroon",		0x80, 0x00, 0x00 },
+    { "navy",		0x00, 0x00, 0x80 },
+    { "olive",		0x80, 0x80, 0x00 },
+    { "purple",		0x80, 0x00, 0x80 },
+    { "silver",		0xc0, 0xc0, 0xc0 },
+    { "teal",		0x00, 0x80, 0x80 }
+  };
+
+
+  if (!n || !n[0]) return c;
+
+  if (n[0] == '#') {
+    // Do hex color lookup
+    rgb = strtol(n + 1, NULL, 16);
+
+    if (strlen(n) > 4) {
+      r = rgb >> 16;
+      g = (rgb >> 8) & 255;
+      b = rgb & 255;
+    } else {
+      r = (rgb >> 8) * 17;
+      g = ((rgb >> 4) & 15) * 17;
+      b = (rgb & 15) * 17;
+    }
+    return (fltk3::rgb_color((uchar)r, (uchar)g, (uchar)b));
+  } else {
+    for (i = 0; i < (int)(sizeof(colors) / sizeof(colors[0])); i ++)
+      if (!strcasecmp(n, colors[i].name)) {
+        return fltk3::rgb_color(colors[i].r, colors[i].g, colors[i].b);
+      }
+    return c;
+  }
+}
+
+
+/** Gets an inline image.
+
+  The image reference count is maintained accordingly, such that
+  the image can be released exactly once when the document is closed.
+
+  \return a pointer to a cached fltk3::SharedImage, if the image can be loaded,
+  	  otherwise a pointer to an internal fltk3::Pixmap (broken_image).
+
+  \todo fltk3::HelpView::get_image() returns a pointer to the internal
+  fltk3::Pixmap broken_image, but this is _not_ compatible with the
+  return type fltk3::SharedImage (release() must not be called).
+*/
+
+/* Implementation note: (A.S. Apr 05, 2009)
+
+  fltk3::HelpView::get_image() uses a static global flag (initial_load)
+  to determine, if it is called from the initial loading of a document
+  (load() or value()), or from resize() or draw().
+
+  A better solution would be to manage all loaded images in an own
+  structure like fltk3::HelpTarget (Fl_Help_Image ?) to avoid using this
+  global flag, but this would break the ABI !
+
+  This should be fixed in FLTK 1.3 !
+
+
+  If initial_load is true, then fltk3::SharedImage::get() is called to
+  load the image, and the reference count of the shared image is
+  increased by one.
+
+  If initial_load is false, then fltk3::SharedImage::find() is called to
+  load the image, and the image is released immediately. This avoids
+  increasing the reference count when calling get_image() from draw()
+  or resize().
+
+  Calling fltk3::SharedImage::find() instead of fltk3::SharedImage::get() avoids
+  doing unnecessary i/o for "broken images" within each resize/redraw.
+
+  Each image must be released exactly once in the destructor or before
+  a new document is loaded: see free_data().
+*/
+
+fltk3::SharedImage *
+fltk3::HelpView::get_image(const char *name, int W, int H) {
+  const char	*localname;		// Local filename
+  char		dir[FLTK3_PATH_MAX];	// Current directory
+  char		temp[FLTK3_PATH_MAX],	// Temporary filename
+		*tempptr;		// Pointer into temporary name
+  fltk3::SharedImage *ip;			// Image pointer...
+
+  // See if the image can be found...
+  if (strchr(directory_, ':') != NULL && strchr(name, ':') == NULL) {
+    if (name[0] == '/') {
+      strlcpy(temp, directory_, sizeof(temp));
+
+      if ((tempptr = strrchr(strchr(directory_, ':') + 3, '/')) != NULL) {
+        strlcpy(tempptr, name, sizeof(temp) - (tempptr - temp));
+      } else {
+        strlcat(temp, name, sizeof(temp));
+      }
+    } else {
+      snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
+    }
+
+    if (link_) localname = (*link_)(this, temp);
+    else localname = temp;
+  } else if (name[0] != '/' && strchr(name, ':') == NULL) {
+    if (directory_[0]) snprintf(temp, sizeof(temp), "%s/%s", directory_, name);
+    else {
+      fltk3::getcwd(dir, sizeof(dir));
+      snprintf(temp, sizeof(temp), "file:%s/%s", dir, name);
+    }
+
+    if (link_) localname = (*link_)(this, temp);
+    else localname = temp;
+  } else if (link_) localname = (*link_)(this, name);
+  else localname = name;
+
+  if (!localname) return 0;
+
+  if (strncmp(localname, "file:", 5) == 0) localname += 5;
+
+  if (initial_load) {
+    if ((ip = fltk3::SharedImage::get(localname, W, H)) == NULL) {
+      ip = (fltk3::SharedImage *)&broken_image;
+    }
+  } else { // draw or resize
+    if ((ip = fltk3::SharedImage::find(localname, W, H)) == NULL) {
+      ip = (fltk3::SharedImage *)&broken_image;
+    } else {
+      ip->release();
+    }
+  }
+
+  return ip;
+}
+
+
+/** Gets a length value, either absolute or %. */
+int
+fltk3::HelpView::get_length(const char *l) {	// I - Value
+  int	val;					// Integer value
+
+  if (!l[0]) return 0;
+
+  val = atoi(l);
+  if (l[strlen(l) - 1] == '%') {
+    if (val > 100) val = 100;
+    else if (val < 0) val = 0;
+
+    int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+    val = val * (hsize_ - scrollsize) / 100;
+  }
+
+  return val;
+}
+
+
+fltk3::HelpLink *fltk3::HelpView::find_link(int xx, int yy)
+{
+  int		i;
+  fltk3::HelpLink	*linkp;
+  for (i = nlinks_, linkp = links_; i > 0; i --, linkp ++) {
+    if (xx >= linkp->x && xx < linkp->w &&
+        yy >= linkp->y && yy < linkp->h)
+      break;
+  }
+  return i ? linkp : 0L;
+}
+
+void fltk3::HelpView::follow_link(fltk3::HelpLink *linkp)
+{
+  char		target[32];	// Current target
+
+  clear_selection();
+
+  strlcpy(target, linkp->name, sizeof(target));
+
+  set_changed();
+
+  if (strcmp(linkp->filename, filename_) != 0 && linkp->filename[0])
+  {
+    char	dir[FLTK3_PATH_MAX];	// Current directory
+    char	temp[FLTK3_PATH_MAX],	// Temporary filename
+	      *tempptr;	// Pointer into temporary filename
+
+
+    if (strchr(directory_, ':') != NULL &&
+        strchr(linkp->filename, ':') == NULL)
+    {
+      if (linkp->filename[0] == '/')
+      {
+        strlcpy(temp, directory_, sizeof(temp));
+        if ((tempptr = strrchr(strchr(directory_, ':') + 3, '/')) != NULL)
+	  strlcpy(tempptr, linkp->filename, sizeof(temp));
+	else
+	  strlcat(temp, linkp->filename, sizeof(temp));
+      }
+      else
+	snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
+    }
+    else if (linkp->filename[0] != '/' && strchr(linkp->filename, ':') == NULL)
+    {
+      if (directory_[0])
+	snprintf(temp, sizeof(temp), "%s/%s", directory_, linkp->filename);
+      else
+      {
+	  fltk3::getcwd(dir, sizeof(dir));
+	snprintf(temp, sizeof(temp), "file:%s/%s", dir, linkp->filename);
+      }
+    }
+    else
+      strlcpy(temp, linkp->filename, sizeof(temp));
+
+    if (linkp->name[0])
+      snprintf(temp + strlen(temp), sizeof(temp) - strlen(temp), "#%s",
+	       linkp->name);
+
+    load(temp);
+  }
+  else if (target[0])
+    topline(target);
+  else
+    topline(0);
+
+  leftline(0);
+}
+
+/** Removes the current text selection. */
+void fltk3::HelpView::clear_selection()
+{
+  if (current_view==this)
+    clear_global_selection();
+}
+/** Selects all the text in the view. */
+void fltk3::HelpView::select_all()
+{
+  clear_global_selection();
+  if (!value_) return;
+  current_view = this;
+  selection_drag_last = selection_last = strlen(value_);
+  selected = 1;
+}
+
+void fltk3::HelpView::clear_global_selection()
+{
+  if (selected) redraw();
+  selection_push_first = selection_push_last = 0;
+  selection_drag_first = selection_drag_last = 0;
+  selection_first = selection_last = 0;
+  selected = 0;
+}
+
+char fltk3::HelpView::begin_selection()
+{
+  clear_global_selection();
+
+  if (!fl_help_view_buffer) fl_help_view_buffer = fl_create_offscreen(1, 1);
+
+  mouse_x = fltk3::event_x();
+  mouse_y = fltk3::event_y();
+  draw_mode = 1;
+
+    current_view = this;
+    fl_begin_offscreen(fl_help_view_buffer);
+    draw();
+    fl_end_offscreen();
+
+  draw_mode = 0;
+
+  if (selection_push_last) return 1;
+  else return 0;
+}
+
+char fltk3::HelpView::extend_selection()
+{
+  if (fltk3::event_is_click())
+    return 0;
+
+//  printf("old selection_first=%d, selection_last=%d\n",
+//         selection_first, selection_last);
+
+  int sf = selection_first, sl = selection_last;
+
+  selected = 1;
+  mouse_x = fltk3::event_x();
+  mouse_y = fltk3::event_y();
+  draw_mode = 2;
+
+    fl_begin_offscreen(fl_help_view_buffer);
+    draw();
+    fl_end_offscreen();
+
+  draw_mode = 0;
+
+  if (selection_push_first < selection_drag_first) {
+    selection_first = selection_push_first;
+  } else {
+    selection_first = selection_drag_first;
+  }
+
+  if (selection_push_last > selection_drag_last) {
+    selection_last = selection_push_last;
+  } else {
+    selection_last = selection_drag_last;
+  }
+
+//  printf("new selection_first=%d, selection_last=%d\n",
+//         selection_first, selection_last);
+
+  if (sf!=selection_first || sl!=selection_last) {
+//    puts("REDRAW!!!\n");
+    return 1;
+  } else {
+//    puts("");
+    return 0;
+  }
+}
+
+// convert a command with up to four letters into an unsigned int
+static unsigned int command(const char *cmd)
+{
+  unsigned int ret = (tolower(cmd[0])<<24);
+  char c = cmd[1];
+  if (c=='>' || c==' ' || c==0) return ret;
+  ret |= (tolower(c)<<16);
+  c = cmd[2];
+  if (c=='>' || c==' ' || c==0) return ret;
+  ret |= (tolower(c)<<8);
+  c = cmd[3];
+  if (c=='>' || c==' ' || c==0) return ret;
+  ret |= tolower(c);
+  c = cmd[4];
+  if (c=='>' || c==' ' || c==0) return ret;
+  return 0;
+}
+
+#define CMD(a, b, c, d) ((a<<24)|(b<<16)|(c<<8)|d)
+
+void fltk3::HelpView::end_selection(int clipboard) 
+{
+  if (!selected || current_view!=this) 
+    return;
+  // convert the select part of our html text into some kind of somewhat readable ASCII
+  // and store it in the selection buffer
+  char p = 0, pre = 0;;
+  int len = strlen(value_);
+  char *txt = (char*)malloc(len+1), *d = txt;
+  const char *s = value_, *cmd, *src;
+  for (;;) {
+    char c = *s++;
+    if (c==0) break;
+    if (c=='<') { // begin of some html command. Skip until we find a '>'
+      cmd = s;
+      for (;;) {
+        c = *s++;
+        if (c==0 || c=='>') break;
+      }
+      if (c==0) break;
+      // do something with this command... .
+      // the replacement string must not be longer that the command itself plus '<' and '>'
+      src = 0;
+      switch (command(cmd)) {
+        case CMD('p','r','e', 0 ): pre = 1; break;
+        case CMD('/','p','r','e'): pre = 0; break;
+        case CMD('t','d', 0 , 0 ):
+        case CMD('p', 0 , 0 , 0 ):
+        case CMD('/','p', 0 , 0 ):
+        case CMD('b','r', 0 , 0 ): src = "\n"; break;
+        case CMD('l','i', 0 , 0 ): src = "\n * "; break;
+        case CMD('/','h','1', 0 ):
+        case CMD('/','h','2', 0 ):
+        case CMD('/','h','3', 0 ):
+        case CMD('/','h','4', 0 ):
+        case CMD('/','h','5', 0 ):
+        case CMD('/','h','6', 0 ): src = "\n\n"; break;
+        case CMD('t','r', 0 , 0 ):
+        case CMD('h','1', 0 , 0 ):
+        case CMD('h','2', 0 , 0 ):
+        case CMD('h','3', 0 , 0 ):
+        case CMD('h','4', 0 , 0 ):
+        case CMD('h','5', 0 , 0 ):
+        case CMD('h','6', 0 , 0 ): src = "\n\n"; break;
+        case CMD('d','t', 0 , 0 ): src = "\n "; break;
+        case CMD('d','d', 0 , 0 ): src = "\n - "; break;
+      }
+      int n = s-value_;
+      if (src && n>selection_first && n<=selection_last) {
+        while (*src) {
+          *d++ = *src++;
+        }
+        c = src[-1];
+        p = isspace(c&255) ? ' ' : c;
+      }
+      continue;
+    }
+    if (c=='&') { // special characters
+      int xx = quote_char(s);
+      if (xx>=0) {
+        c = (char)xx;
+        for (;;) {
+          char cc = *s++;
+          if (!cc || cc==';') break;
+        }
+      }
+    }
+    int n = s-value_;
+    if (n>selection_first && n<=selection_last) {
+      if (!pre && isspace(c&255)) c = ' ';
+      if (p!=' '||c!=' ')
+        *d++ = c;
+      p = c;
+    }
+  }
+  *d = 0;
+  fltk3::copy(txt, strlen(txt), clipboard);
+  free(txt);
+}
+
+/** Handles events in the widget. */
+int				// O - 1 if we handled it, 0 otherwise
+fltk3::HelpView::handle(int event)	// I - Event to handle
+{
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  static fltk3::HelpLink *linkp;   // currently clicked link
+
+  int xx = fltk3::event_x() - x() + leftline_;
+  int yy = fltk3::event_y() - y() + topline_;
+
+  switch (event)
+  {
+    case fltk3::FOCUS:
+      redraw();
+      return 1;
+    case fltk3::UNFOCUS:
+      clear_selection();
+      redraw();
+      return 1;
+    case fltk3::ENTER :
+      Group::handle(event);
+      return 1;
+    case fltk3::LEAVE :
+      fltk3::cursor(fltk3::CURSOR_DEFAULT);
+      break;
+    case fltk3::MOVE:
+      if (find_link(xx, yy)) fltk3::cursor(fltk3::CURSOR_HAND);
+      else fltk3::cursor(fltk3::CURSOR_DEFAULT);
+      return 1;
+    case fltk3::PUSH:
+      if (Group::handle(event)) return 1;
+      linkp = find_link(xx, yy);
+      if (linkp) {
+        fltk3::cursor(fltk3::CURSOR_HAND);
+        return 1;
+      }
+      if (begin_selection()) {
+        fltk3::cursor(fltk3::CURSOR_INSERT);
+        return 1;
+      }
+      fltk3::cursor(fltk3::CURSOR_DEFAULT);
+      return 1;
+    case fltk3::DRAG:
+      if (linkp) {
+        if (fltk3::event_is_click()) {
+          fltk3::cursor(fltk3::CURSOR_HAND);
+        } else {
+          fltk3::cursor(fltk3::CURSOR_DEFAULT); // should be "fltk3::CURSOR_CANCEL" if we had it
+        }
+        return 1;
+      }
+      if (current_view==this && selection_push_last) {
+        if (extend_selection()) redraw();
+        fltk3::cursor(fltk3::CURSOR_INSERT);
+        return 1;
+      }
+      fltk3::cursor(fltk3::CURSOR_DEFAULT);
+      return 1;
+    case fltk3::RELEASE:
+      if (linkp) {
+        if (fltk3::event_is_click()) {
+          follow_link(linkp);
+        }
+        fltk3::cursor(fltk3::CURSOR_DEFAULT);
+        linkp = 0;
+        return 1;
+      }
+      if (current_view==this && selection_push_last) {
+        end_selection();
+        return 1;
+      }
+      return 1;
+    case fltk3::SHORTCUT: {
+      if (fltk3::event_state() == fltk3::COMMAND) {
+        switch ( fltk3::event_key() ) {
+          case 'a': select_all(); redraw(); return 1;
+          case 'c':
+          case 'x': end_selection(1); return 1;
+        }
+      }
+      break; }
+  }
+  return (Group::handle(event));
+}
+
+/** 
+  The constructor creates the fltk3::HelpView widget at the specified
+  position and size.
+*/
+fltk3::HelpView::HelpView(int        xx,	// I - Left position
+                	   int        yy,	// I - Top position
+			   int        ww,	// I - Width in pixels
+			   int        hh,	// I - Height in pixels
+			   const char *l)
+    : fltk3::Group(xx, yy, ww, hh, l),
+      scrollbar_(xx + ww - fltk3::scrollbar_size(), yy,
+                 fltk3::scrollbar_size(), hh - fltk3::scrollbar_size()),
+      hscrollbar_(xx, yy + hh - fltk3::scrollbar_size(),
+                  ww - fltk3::scrollbar_size(), fltk3::scrollbar_size())
+{
+  color(fltk3::BACKGROUND2_COLOR, fltk3::SELECTION_COLOR);
+
+  title_[0]     = '\0';
+  defcolor_     = fltk3::FOREGROUND_COLOR;
+  bgcolor_      = fltk3::BACKGROUND_COLOR;
+  textcolor_    = fltk3::FOREGROUND_COLOR;
+  linkcolor_    = fltk3::SELECTION_COLOR;
+  textfont_     = fltk3::TIMES;
+  textsize_     = 12;
+  value_        = NULL;
+
+  ablocks_      = 0;
+  nblocks_      = 0;
+  blocks_       = (fltk3::HelpBlock *)0;
+
+  link_         = (fltk3::HelpFunc *)0;
+
+  alinks_       = 0;
+  nlinks_       = 0;
+  links_        = (fltk3::HelpLink *)0;
+
+  atargets_     = 0;
+  ntargets_     = 0;
+  targets_      = (fltk3::HelpTarget *)0;
+
+  directory_[0] = '\0';
+  filename_[0]  = '\0';
+
+  topline_      = 0;
+  leftline_     = 0;
+  size_         = 0;
+  hsize_        = 0;
+  scrollbar_size_ = 0;
+
+  scrollbar_.value(0, hh, 0, 1);
+  scrollbar_.step(8.0);
+  scrollbar_.show();
+  scrollbar_.callback(scrollbar_callback);
+
+  hscrollbar_.value(0, ww, 0, 1);
+  hscrollbar_.step(8.0);
+  hscrollbar_.show();
+  hscrollbar_.callback(hscrollbar_callback);
+  hscrollbar_.type(fltk3::HORIZONTAL);
+  end();
+
+  resize(xx, yy, ww, hh);
+}
+
+
+/** Destroys the fltk3::HelpView widget.
+
+  The destructor destroys the widget and frees all memory that has been
+  allocated for the current document.
+*/
+fltk3::HelpView::~HelpView()
+{
+  clear_selection();
+  free_data();
+}
+
+
+/** Loads the specified file.
+
+  This method loads the specified file or URL.
+*/
+int				// O - 0 on success, -1 on error
+fltk3::HelpView::load(const char *f)// I - Filename to load (may also have target)
+{
+  FILE		*fp;		// File to read from
+  long		len;		// Length of file
+  char		*target;	// Target in file
+  char		*slash;		// Directory separator
+  const char	*localname;	// Local filename
+  char		error[1024];	// Error buffer
+  char		newname[FLTK3_PATH_MAX];	// New filename buffer
+
+  // printf("load(%s)\n",f); fflush(stdout);
+
+  if (strncmp(f, "ftp:", 4) == 0 ||
+      strncmp(f, "http:", 5) == 0 ||
+      strncmp(f, "https:", 6) == 0 ||
+      strncmp(f, "ipp:", 4) == 0 ||
+      strncmp(f, "mailto:";, 7) == 0 ||
+      strncmp(f, "news:";, 5) == 0) {
+    char urimsg[FLTK3_PATH_MAX];
+    if ( fltk3::open_uri(f, urimsg, sizeof(urimsg)) == 0 ) {
+      clear_selection();
+
+      strlcpy(newname, f, sizeof(newname));
+      if ((target = strrchr(newname, '#')) != NULL)
+	*target++ = '\0';
+
+      if (link_)
+	localname = (*link_)(this, newname);
+      else
+	localname = filename_;
+
+      if (!localname)
+	return (0);
+
+      free_data();
+
+      strlcpy(filename_, newname, sizeof(filename_));
+      strlcpy(directory_, newname, sizeof(directory_));
+
+      // Note: We do not support Windows backslashes, since they are illegal
+      //       in URLs...
+      if ((slash = strrchr(directory_, '/')) == NULL)
+	directory_[0] = '\0';
+      else if (slash > directory_ && slash[-1] != '/')
+	*slash = '\0';
+
+      snprintf(error, sizeof(error),
+	       "<HTML><HEAD><TITLE>Error</TITLE></HEAD>"
+	       "<BODY><H1>Error</H1>"
+	       "<P>Unable to follow the link \"%s\" - "
+	       "%s.</P></BODY>",
+	       f, urimsg);
+      value(error);
+      //return(-1);
+    }
+    return(0);
+  }
+
+  clear_selection();
+
+  strlcpy(newname, f, sizeof(newname));
+  if ((target = strrchr(newname, '#')) != NULL)
+    *target++ = '\0';
+
+  if (link_)
+    localname = (*link_)(this, newname);
+  else
+    localname = filename_;
+
+  if (!localname)
+    return (0);
+
+  free_data();
+
+  strlcpy(filename_, newname, sizeof(filename_));
+  strlcpy(directory_, newname, sizeof(directory_));
+
+  // Note: We do not support Windows backslashes, since they are illegal
+  //       in URLs...
+  if ((slash = strrchr(directory_, '/')) == NULL)
+    directory_[0] = '\0';
+  else if (slash > directory_ && slash[-1] != '/')
+    *slash = '\0';
+
+  if (strncmp(localname, "file:", 5) == 0)
+    localname += 5;	// Adjust for local filename...
+
+  if ((fp = fltk3::fopen(localname, "rb")) != NULL)
+  {
+    fseek(fp, 0, SEEK_END);
+    len = ftell(fp);
+    rewind(fp);
+
+    value_ = (const char *)calloc(len + 1, 1);
+    if (fread((void *)value_, 1, len, fp)==0) { /* use default 0 */ }
+    fclose(fp);
+  }
+  else
+  {
+    snprintf(error, sizeof(error),
+	     "<HTML><HEAD><TITLE>Error</TITLE></HEAD>"
+	     "<BODY><H1>Error</H1>"
+	     "<P>Unable to follow the link \"%s\" - "
+	     "%s.</P></BODY>",
+	     localname, strerror(errno));
+    value_ = strdup(error);
+  }
+
+  initial_load = 1;
+  format();
+  initial_load = 0;
+
+  if (target)
+    topline(target);
+  else
+    topline(0);
+
+  return (0);
+}
+
+
+/** Resizes the help widget. */
+
+void
+fltk3::HelpView::resize(int xx,	// I - New left position
+                     int yy,	// I - New top position
+		     int ww,	// I - New width
+		     int hh)	// I - New height
+{
+  fltk3::Boxtype		b = box() ? box() : fltk3::DOWN_BOX;
+					// Box to draw...
+
+
+  Widget::resize(xx, yy, ww, hh);
+
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  scrollbar_.resize(x() + w() - scrollsize - fltk3::box_dw(b) + fltk3::box_dx(b),
+                    y() + fltk3::box_dy(b), scrollsize, h() - scrollsize - fltk3::box_dh(b));
+  hscrollbar_.resize(x() + fltk3::box_dx(b),
+                     y() + h() - scrollsize - fltk3::box_dh(b) + fltk3::box_dy(b),
+                     w() - scrollsize - fltk3::box_dw(b), scrollsize);
+
+  format();
+}
+
+
+/** Scrolls the text to the indicated position, given a named destination.
+
+  \param[in] n target name
+*/
+void
+fltk3::HelpView::topline(const char *n)	// I - Target name
+{
+  fltk3::HelpTarget key,			// Target name key
+		*target;		// Pointer to matching target
+
+
+  if (ntargets_ == 0)
+    return;
+
+  strlcpy(key.name, n, sizeof(key.name));
+
+  target = (fltk3::HelpTarget *)bsearch(&key, targets_, ntargets_, sizeof(fltk3::HelpTarget),
+                                 (compare_func_t)compare_targets);
+
+  if (target != NULL)
+    topline(target->y);
+}
+
+
+/** Scrolls the text to the indicated position, given a pixel line.
+
+  If the given pixel value \p top is out of range, then the text is
+  scrolled to the top or bottom of the document, resp.
+
+  \param[in] top top line number in pixels (0 = start of document)
+*/
+void
+fltk3::HelpView::topline(int top)	// I - Top line number
+{
+  if (!value_)
+    return;
+
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  if (size_ < (h() - scrollsize) || top < 0)
+    top = 0;
+  else if (top > size_)
+    top = size_;
+
+  topline_ = top;
+
+  scrollbar_.value(topline_, h() - scrollsize, 0, size_);
+
+  do_callback();
+
+  redraw();
+}
+
+
+/** Scrolls the text to the indicated position, given a pixel column.
+
+  If the given pixel value \p left is out of range, then the text is
+  scrolled to the left or right side of the document, resp.
+
+  \param[in] left left column number in pixels (0 = left side)
+*/
+void
+fltk3::HelpView::leftline(int left)	// I - Left position
+{
+  if (!value_)
+    return;
+
+  int scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+  if (hsize_ < (w() - scrollsize) || left < 0)
+    left = 0;
+  else if (left > hsize_)
+    left = hsize_;
+
+  leftline_ = left;
+
+  hscrollbar_.value(leftline_, w() - scrollsize, 0, hsize_);
+
+  redraw();
+}
+
+
+/** Sets the current help text buffer to the string provided and reformats the text.
+
+  The provided character string \p val is copied internally and will be
+  freed when value() is called again, or when the widget is destroyed.
+
+  If \p val is NULL, then the widget is cleared.
+*/
+void
+fltk3::HelpView::value(const char *val)	// I - Text to view
+{
+  clear_selection();
+  free_data();
+  set_changed();
+
+  if (!val)
+    return;
+
+  value_ = strdup(val);
+
+  initial_load = 1;
+  format();
+  initial_load = 0;
+
+  topline(0);
+  leftline(0);
+}
+
+
+#ifdef ENC
+# undef ENC
+#endif
+// part b in the table seems to be mac_roman - beku
+# define ENC(a, b) a
+
+
+/** Returns the character code associated with a quoted char. */
+static int			// O - Code or -1 on error
+quote_char(const char *p) {	// I - Quoted string
+  int	i;			// Looping var
+  static struct {
+    const char	*name;
+    int		namelen;
+    int		code;
+  }	*nameptr,		// Pointer into name array
+	names[] = {		// Quoting names
+    { "Aacute;", 7, ENC(193,231) },
+    { "aacute;", 7, ENC(225,135) },
+    { "Acirc;",  6, ENC(194,229) },
+    { "acirc;",  6, ENC(226,137) },
+    { "acute;",  6, ENC(180,171) },
+    { "AElig;",  6, ENC(198,174) },
+    { "aelig;",  6, ENC(230,190) },
+    { "Agrave;", 7, ENC(192,203) },
+    { "agrave;", 7, ENC(224,136) },
+    { "amp;",    4, ENC('&','&') },
+    { "Aring;",  6, ENC(197,129) },
+    { "aring;",  6, ENC(229,140) },
+    { "Atilde;", 7, ENC(195,204) },
+    { "atilde;", 7, ENC(227,139) },
+    { "Auml;",   5, ENC(196,128) },
+    { "auml;",   5, ENC(228,138) },
+    { "brvbar;", 7, ENC(166, -1) },
+    { "bull;",   5, ENC(149,165) },
+    { "Ccedil;", 7, ENC(199,199) },
+    { "ccedil;", 7, ENC(231,141) },
+    { "cedil;",  6, ENC(184,252) },
+    { "cent;",   5, ENC(162,162) },
+    { "copy;",   5, ENC(169,169) },
+    { "curren;", 7, ENC(164, -1) },
+    { "deg;",    4, ENC(176,161) },
+    { "divide;", 7, ENC(247,214) },
+    { "Eacute;", 7, ENC(201,131) },
+    { "eacute;", 7, ENC(233,142) },
+    { "Ecirc;",  6, ENC(202,230) },
+    { "ecirc;",  6, ENC(234,144) },
+    { "Egrave;", 7, ENC(200,233) },
+    { "egrave;", 7, ENC(232,143) },
+    { "ETH;",    4, ENC(208, -1) },
+    { "eth;",    4, ENC(240, -1) },
+    { "Euml;",   5, ENC(203,232) },
+    { "euml;",   5, ENC(235,145) },
+    { "euro;",   5, ENC(128,219) },
+    { "frac12;", 7, ENC(189, -1) },
+    { "frac14;", 7, ENC(188, -1) },
+    { "frac34;", 7, ENC(190, -1) },
+    { "gt;",     3, ENC('>','>') },
+    { "Iacute;", 7, ENC(205,234) },
+    { "iacute;", 7, ENC(237,146) },
+    { "Icirc;",  6, ENC(206,235) },
+    { "icirc;",  6, ENC(238,148) },
+    { "iexcl;",  6, ENC(161,193) },
+    { "Igrave;", 7, ENC(204,237) },
+    { "igrave;", 7, ENC(236,147) },
+    { "iquest;", 7, ENC(191,192) },
+    { "Iuml;",   5, ENC(207,236) },
+    { "iuml;",   5, ENC(239,149) },
+    { "laquo;",  6, ENC(171,199) },
+    { "lt;",     3, ENC('<','<') },
+    { "macr;",   5, ENC(175,248) },
+    { "micro;",  6, ENC(181,181) },
+    { "middot;", 7, ENC(183,225) },
+    { "nbsp;",   5, ENC(' ',' ') },
+    { "not;",    4, ENC(172,194) },
+    { "Ntilde;", 7, ENC(209,132) },
+    { "ntilde;", 7, ENC(241,150) },
+    { "Oacute;", 7, ENC(211,238) },
+    { "oacute;", 7, ENC(243,151) },
+    { "Ocirc;",  6, ENC(212,239) },
+    { "ocirc;",  6, ENC(244,153) },
+    { "Ograve;", 7, ENC(210,241) },
+    { "ograve;", 7, ENC(242,152) },
+    { "ordf;",   5, ENC(170,187) },
+    { "ordm;",   5, ENC(186,188) },
+    { "Oslash;", 7, ENC(216,175) },
+    { "oslash;", 7, ENC(248,191) },
+    { "Otilde;", 7, ENC(213,205) },
+    { "otilde;", 7, ENC(245,155) },
+    { "Ouml;",   5, ENC(214,133) },
+    { "ouml;",   5, ENC(246,154) },
+    { "para;",   5, ENC(182,166) },
+    { "premil;", 7, ENC(137,228) },
+    { "plusmn;", 7, ENC(177,177) },
+    { "pound;",  6, ENC(163,163) },
+    { "quot;",   5, ENC('\"','\"') },
+    { "raquo;",  6, ENC(187,200) },
+    { "reg;",    4, ENC(174,168) },
+    { "sect;",   5, ENC(167,164) },
+    { "shy;",    4, ENC(173,'-') },
+    { "sup1;",   5, ENC(185, -1) },
+    { "sup2;",   5, ENC(178, -1) },
+    { "sup3;",   5, ENC(179, -1) },
+    { "szlig;",  6, ENC(223,167) },
+    { "THORN;",  6, ENC(222, -1) },
+    { "thorn;",  6, ENC(254, -1) },
+    { "times;",  6, ENC(215,'x') },
+    { "trade;",  6, ENC(153,170) },
+    { "Uacute;", 7, ENC(218,242) },
+    { "uacute;", 7, ENC(250,156) },
+    { "Ucirc;",  6, ENC(219,243) },
+    { "ucirc;",  6, ENC(251,158) },
+    { "Ugrave;", 7, ENC(217,244) },
+    { "ugrave;", 7, ENC(249,157) },
+    { "uml;",    4, ENC(168,172) },
+    { "Uuml;",   5, ENC(220,134) },
+    { "uuml;",   5, ENC(252,159) },
+    { "Yacute;", 7, ENC(221, -1) },
+    { "yacute;", 7, ENC(253, -1) },
+    { "yen;",    4, ENC(165,180) },
+    { "Yuml;",   5, ENC(159,217) },
+    { "yuml;",   5, ENC(255,216) }
+  };
+
+  if (!strchr(p, ';')) return -1;
+  if (*p == '#') {
+    if (*(p+1) == 'x' || *(p+1) == 'X') return strtol(p+2, NULL, 16);
+    else return atoi(p+1);
+  }
+  for (i = (int)(sizeof(names) / sizeof(names[0])), nameptr = names; i > 0; i --, nameptr ++)
+    if (strncmp(p, nameptr->name, nameptr->namelen) == 0)
+      return nameptr->code;
+
+  return -1;
+}
+
+
+/** The vertical scrollbar callback. */
+static void
+scrollbar_callback(fltk3::Widget *s, void *)
+{
+  ((fltk3::HelpView *)(s->parent()))->topline(int(((fltk3::Scrollbar*)s)->value()));
+}
+
+
+/** The horizontal scrollbar callback. */
+static void
+hscrollbar_callback(fltk3::Widget *s, void *)
+{
+  ((fltk3::HelpView *)(s->parent()))->leftline(int(((fltk3::Scrollbar*)s)->value()));
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Image.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,592 @@
+//
+// "$Id$"
+//
+// Image drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <fltk3/Widget.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/Image.h>
+#include "flstring.h"
+
+#ifdef WIN32
+void fl_release_dc(HWND, HDC); // from Fl_win32.cxx
+#endif
+
+namespace fltk3 {
+  void restore_clip(); // from fltk3::rect.cxx
+}
+
+//
+// Base image class...
+//
+
+/**
+  The destructor is a virtual method that frees all memory used
+  by the image.
+*/
+fltk3::Image::~Image() {
+}
+
+/**
+  If the image has been cached for display, delete the cache
+  data. This allows you to change the data used for the image and
+  then redraw it without recreating an image object.
+*/
+void fltk3::Image::uncache() {
+}
+
+void fltk3::Image::draw(int XP, int YP, int, int, int, int) {
+  draw_empty(XP, YP);
+}
+
+/**
+  The protected method draw_empty() draws a box with
+  an X in it. It can be used to draw any image that lacks image
+  data.
+*/
+void fltk3::Image::draw_empty(int X, int Y) {
+  if (w() > 0 && h() > 0) {
+    fltk3::color(fltk3::FOREGROUND_COLOR);
+    fltk3::rect(X, Y, w(), h());
+    fltk3::line(X, Y, X + w() - 1, Y + h() - 1);
+    fltk3::line(X, Y + h() - 1, X + w() - 1, Y);
+  }
+}
+
+/**
+  The copy() method creates a copy of the specified
+  image. If the width and height are provided, the image is
+  resized to the specified size. The image should be deleted (or in
+  the case of fltk3::SharedImage, released) when you are done
+  with it.
+*/
+fltk3::Image *fltk3::Image::copy(int W, int H) {
+  return new fltk3::Image(W, H, d());
+}
+
+/**
+  The color_average() method averages the colors in
+  the image with the FLTK color value c. The i
+  argument specifies the amount of the original image to combine
+  with the color, so a value of 1.0 results in no color blend, and
+  a value of 0.0 results in a constant image of the specified
+  color. <I>The original image data is not altered by this
+  method.</I>
+*/
+void fltk3::Image::color_average(fltk3::Color, float) {
+}
+
+/**
+  The desaturate() method converts an image to
+  grayscale. If the image contains an alpha channel (depth = 4),
+  the alpha channel is preserved. <I>This method does not alter
+  the original image data.</I>
+*/
+void fltk3::Image::desaturate() {
+}
+
+/**
+  The label() methods are an obsolete way to set the
+  image attribute of a widget or menu item. Use the
+  image() or deimage() methods of the
+  fltk3::Widget and fltk3::MenuItem classes
+  instead.
+*/
+void fltk3::Image::label(fltk3::Widget* widget) {
+  widget->image(this);
+}
+
+/**
+  The label() methods are an obsolete way to set the
+  image attribute of a widget or menu item. Use the
+  image() or deimage() methods of the
+  fltk3::Widget and fltk3::MenuItem classes
+  instead.
+*/
+void fltk3::Image::label(fltk3::MenuItem* m) {
+  fltk3::set_labeltype(fltk3::IMAGE_LABEL, labeltype, measure);
+  m->label(fltk3::IMAGE_LABEL, (const char*)this);
+}
+
+void
+fltk3::Image::labeltype(const fltk3::Label *lo,		// I - Label
+                    int            lx,		// I - X position
+		    int            ly,		// I - Y position
+		    int            lw,		// I - Width of label
+		    int            lh,		// I - Height of label
+		    fltk3::Align       la) {	// I - Alignment
+  fltk3::Image	*img;				// Image pointer
+  int		cx, cy;				// Image position
+
+  img = (fltk3::Image *)(lo->value);
+
+  if (la & fltk3::ALIGN_LEFT) cx = 0;
+  else if (la & fltk3::ALIGN_RIGHT) cx = img->w() - lw;
+  else cx = (img->w() - lw) / 2;
+
+  if (la & fltk3::ALIGN_TOP) cy = 0;
+  else if (la & fltk3::ALIGN_BOTTOM) cy = img->h() - lh;
+  else cy = (img->h() - lh) / 2;
+
+  fltk3::color((fltk3::Color)lo->color);
+
+  img->draw(lx, ly, lw, lh, cx, cy);
+}
+
+void
+fltk3::Image::measure(const fltk3::Label *lo,		// I - Label
+                  int            &lw,		// O - Width of image
+		  int            &lh) {		// O - Height of image
+  fltk3::Image *img;				// Image pointer
+
+  img = (fltk3::Image *)(lo->value);
+
+  lw = img->w();
+  lh = img->h();
+}
+
+
+//
+// RGB image class...
+//
+/**  The destructor free all memory and server resources that are used by  the image. */
+fltk3::RGBImage::~RGBImage() {
+  uncache();
+  if (alloc_array) delete[] (uchar *)array;
+}
+
+void fltk3::RGBImage::uncache() {
+#ifdef __APPLE_QUARTZ__
+  if (id_) {
+    CGImageRelease((CGImageRef)id_);
+    id_ = 0;
+  }
+#else
+  if (id_) {
+    fl_delete_offscreen((fltk3::Offscreen)id_);
+    id_ = 0;
+  }
+
+  if (mask_) {
+    fl_delete_bitmask((fltk3::Bitmask)mask_);
+    mask_ = 0;
+  }
+#endif
+}
+
+fltk3::Image *fltk3::RGBImage::copy(int W, int H) {
+  fltk3::RGBImage	*new_image;	// New RGB image
+  uchar		*new_array;	// New array for image data
+
+  // Optimize the simple copy where the width and height are the same,
+  // or when we are copying an empty image...
+  if ((W == w() && H == h()) ||
+      !w() || !h() || !d() || !array) {
+    if (array) {
+      // Make a copy of the image data and return a new fltk3::RGBImage...
+      new_array = new uchar[w() * h() * d()];
+      if (ld() && ld()!=w()*d()) {
+        const uchar *src = array;
+        uchar *dst = new_array;
+        int dy, dh = h(), wd = w()*d(), wld = ld();
+        for (dy=0; dy<dh; dy++) {
+          memcpy(dst, src, wd);
+          src += wld;
+          dst += wd;
+        }
+      } else {
+        memcpy(new_array, array, w() * h() * d());
+      }
+      new_image = new fltk3::RGBImage(new_array, w(), h(), d());
+      new_image->alloc_array = 1;
+
+      return new_image;
+    } else return new fltk3::RGBImage(array, w(), h(), d(), ld());
+  }
+  if (W <= 0 || H <= 0) return 0;
+
+  // OK, need to resize the image data; allocate memory and 
+  uchar		*new_ptr;	// Pointer into new array
+  const uchar	*old_ptr;	// Pointer into old array
+  int		c,		// Channel number
+		sy,		// Source coordinate
+		dx, dy,		// Destination coordinates
+		xerr, yerr,	// X & Y errors
+		xmod, ymod,	// X & Y moduli
+		xstep, ystep,	// X & Y step increments
+    line_d; // stride from line to line
+
+
+  // Figure out Bresenheim step/modulus values...
+  xmod   = w() % W;
+  xstep  = (w() / W) * d();
+  ymod   = h() % H;
+  ystep  = h() / H;
+  line_d = ld() ? ld() : w() * d();
+
+  // Allocate memory for the new image...
+  new_array = new uchar [W * H * d()];
+  new_image = new fltk3::RGBImage(new_array, W, H, d());
+  new_image->alloc_array = 1;
+
+  // Scale the image using a nearest-neighbor algorithm...
+  for (dy = H, sy = 0, yerr = H, new_ptr = new_array; dy > 0; dy --) {
+    for (dx = W, xerr = W, old_ptr = array + sy * line_d; dx > 0; dx --) {
+      for (c = 0; c < d(); c ++) *new_ptr++ = old_ptr[c];
+
+      old_ptr += xstep;
+      xerr    -= xmod;
+
+      if (xerr <= 0) {
+	xerr    += W;
+	old_ptr += d();
+      }
+    }
+
+    sy   += ystep;
+    yerr -= ymod;
+    if (yerr <= 0) {
+      yerr += H;
+      sy ++;
+    }
+  }
+
+  return new_image;
+}
+
+void fltk3::RGBImage::color_average(fltk3::Color c, float i) {
+  // Don't average an empty image...
+  if (!w() || !h() || !d() || !array) return;
+
+  // Delete any existing pixmap/mask objects...
+  uncache();
+
+  // Allocate memory as needed...
+  uchar		*new_array,
+		*new_ptr;
+
+  if (!alloc_array) new_array = new uchar[h() * w() * d()];
+  else new_array = (uchar *)array;
+
+  // Get the color to blend with...
+  uchar		r, g, b;
+  unsigned	ia, ir, ig, ib;
+
+  fltk3::get_color(c, r, g, b);
+  if (i < 0.0f) i = 0.0f;
+  else if (i > 1.0f) i = 1.0f;
+
+  ia = (unsigned)(256 * i);
+  ir = r * (256 - ia);
+  ig = g * (256 - ia);
+  ib = b * (256 - ia);
+
+  // Update the image data to do the blend...
+  const uchar	*old_ptr;
+  int		x, y;
+  int   line_i = ld() ? ld() - (w()*d()) : 0; // increment from line end to beginning of next line
+
+  if (d() < 3) {
+    ig = (r * 31 + g * 61 + b * 8) / 100 * (256 - ia);
+
+    for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += line_i)
+      for (x = 0; x < w(); x ++) {
+	*new_ptr++ = (*old_ptr++ * ia + ig) >> 8;
+	if (d() > 1) *new_ptr++ = *old_ptr++;
+      }
+  } else {
+    for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += line_i)
+      for (x = 0; x < w(); x ++) {
+	*new_ptr++ = (*old_ptr++ * ia + ir) >> 8;
+	*new_ptr++ = (*old_ptr++ * ia + ig) >> 8;
+	*new_ptr++ = (*old_ptr++ * ia + ib) >> 8;
+	if (d() > 3) *new_ptr++ = *old_ptr++;
+      }
+  }
+
+  // Set the new pointers/values as needed...
+  if (!alloc_array) {
+    array       = new_array;
+    alloc_array = 1;
+
+    ld(0);
+  }
+}
+
+void fltk3::RGBImage::desaturate() {
+  // Don't desaturate an empty image...
+  if (!w() || !h() || !d() || !array) return;
+
+  // Can only desaturate color images...
+  if (d() < 3) return;
+
+  // Delete any existing pixmap/mask objects...
+  uncache();
+
+  // Allocate memory for a grayscale image...
+  uchar		*new_array,
+		*new_ptr;
+  int		new_d;
+
+  new_d     = d() - 2;
+  new_array = new uchar[h() * w() * new_d];
+
+  // Copy the image data, converting to grayscale...
+  const uchar	*old_ptr;
+  int		x, y;
+  int   line_i = ld() ? ld() - (w()*d()) : 0; // increment from line end to beginning of next line
+
+  for (new_ptr = new_array, old_ptr = array, y = 0; y < h(); y ++, old_ptr += line_i)
+    for (x = 0; x < w(); x ++, old_ptr += d()) {
+      *new_ptr++ = (uchar)((31 * old_ptr[0] + 61 * old_ptr[1] + 8 * old_ptr[2]) / 100);
+      if (d() > 3) *new_ptr++ = old_ptr[3];
+    }
+
+  // Free the old array as needed, and then set the new pointers/values...
+  if (alloc_array) delete[] (uchar *)array;
+
+  array       = new_array;
+  alloc_array = 1;
+
+  ld(0);
+  d(new_d);
+}
+
+#if !defined(WIN32) && !defined(__APPLE_QUARTZ__)
+// Composite an image with alpha on systems that don't have accelerated
+// alpha compositing...
+static void alpha_blend(fltk3::RGBImage *img, int X, int Y, int W, int H, int cx, int cy) {
+  int ld = img->ld();
+  if (ld == 0) ld = img->w() * img->d();
+  uchar *srcptr = (uchar*)img->array + cy * ld + cx * img->d();
+  int srcskip = ld - img->d() * W;
+
+  uchar *dst = new uchar[W * H * 3];
+  uchar *dstptr = dst;
+
+  fltk3::read_image(dst, X, Y, W, H, 0);
+
+  uchar srcr, srcg, srcb, srca;
+  uchar dstr, dstg, dstb, dsta;
+
+  if (img->d() == 2) {
+    // Composite grayscale + alpha over RGB...
+    for (int y = H; y > 0; y--, srcptr+=srcskip)
+      for (int x = W; x > 0; x--) {
+	srcg = *srcptr++;
+	srca = *srcptr++;
+
+	dstr = dstptr[0];
+	dstg = dstptr[1];
+	dstb = dstptr[2];
+	dsta = 255 - srca;
+
+	*dstptr++ = (srcg * srca + dstr * dsta) >> 8;
+	*dstptr++ = (srcg * srca + dstg * dsta) >> 8;
+	*dstptr++ = (srcg * srca + dstb * dsta) >> 8;
+      }
+  } else {
+    // Composite RGBA over RGB...
+    for (int y = H; y > 0; y--, srcptr+=srcskip)
+      for (int x = W; x > 0; x--) {
+	srcr = *srcptr++;
+	srcg = *srcptr++;
+	srcb = *srcptr++;
+	srca = *srcptr++;
+
+	dstr = dstptr[0];
+	dstg = dstptr[1];
+	dstb = dstptr[2];
+	dsta = 255 - srca;
+
+	*dstptr++ = (srcr * srca + dstr * dsta) >> 8;
+	*dstptr++ = (srcg * srca + dstg * dsta) >> 8;
+	*dstptr++ = (srcb * srca + dstb * dsta) >> 8;
+      }
+  }
+
+  fltk3::draw_image(dst, X, Y, W, H, 3, 0);
+
+  delete[] dst;
+}
+#endif // !WIN32 && !__APPLE_QUARTZ__
+
+void fltk3::RGBImage::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+  fltk3::graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+static int start(fltk3::RGBImage *img, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, 
+		 int &X, int &Y, int &W, int &H)
+{
+  // account for current clip region (faster on Irix):
+  fltk3::clip_box(XP,YP,WP,HP,X,Y,W,H);
+  cx += X-XP; cy += Y-YP;
+  // clip the box down to the size of image, quit if empty:
+  if (cx < 0) {W += cx; X -= cx; cx = 0;}
+  if (cx+W > w) W = w-cx;
+  if (W <= 0) return 1;
+  if (cy < 0) {H += cy; Y -= cy; cy = 0;}
+  if (cy+H > h) H = h-cy;
+  if (H <= 0) return 1;
+  return 0;
+}
+
+#ifdef __APPLE__
+void fltk3::QuartzGraphicsDriver::draw(fltk3::RGBImage *img, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  // Don't draw an empty image...
+  if (!img->d() || !img->array) {
+    img->draw_empty(XP, YP);
+    return;
+  }
+  if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+    return;
+  }
+  if (!img->id_) {
+    CGColorSpaceRef lut = 0;
+    if (img->d()<=2)
+      lut = CGColorSpaceCreateDeviceGray();
+    else
+      lut = CGColorSpaceCreateDeviceRGB();
+    CGDataProviderRef src = CGDataProviderCreateWithData( 0L, img->array, img->w()*img->h()*img->d(), 0L);
+    img->id_ = CGImageCreate( img->w(), img->h(), 8, img->d()*8, img->ld()?img->ld():img->w()*img->d(),
+			lut, (img->d()&1)?kCGImageAlphaNone:kCGImageAlphaLast,
+			src, 0L, false, kCGRenderingIntentDefault);
+    CGColorSpaceRelease(lut);
+    CGDataProviderRelease(src);
+  }
+  if (img->id_ && fl_gc) {
+    CGRect rect = { { X, Y }, { W, H } };
+    Fl_X::q_begin_image(rect, cx, cy, img->w(), img->h());
+    CGContextDrawImage(fl_gc, rect, (CGImageRef)img->id_);
+    Fl_X::q_end_image();
+  }
+}
+
+#elif defined(WIN32)
+void fltk3::GDIGraphicsDriver::draw(fltk3::RGBImage *img, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  // Don't draw an empty image...
+  if (!img->d() || !img->array) {
+    img->draw_empty(XP, YP);
+    return;
+  }
+  if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+    return;
+  }
+  if (!img->id_) {
+    img->id_ = fl_create_offscreen(img->w(), img->h());
+    if ((img->d() == 2 || img->d() == 4) && fltk3::can_do_alpha_blending()) {
+      fl_begin_offscreen((fltk3::Offscreen)img->id_);
+      fltk3::draw_image(img->array, 0, 0, img->w(), img->h(), img->d()|fltk3::IMAGE_WITH_ALPHA, img->ld());
+      fl_end_offscreen();
+    } else {
+      fl_begin_offscreen((fltk3::Offscreen)img->id_);
+      fltk3::draw_image(img->array, 0, 0, img->w(), img->h(), img->d(), img->ld());
+      fl_end_offscreen();
+      if (img->d() == 2 || img->d() == 4) {
+        img->mask_ = fl_create_alphamask(img->w(), img->h(), img->d(), img->ld(), img->array);
+      }
+    }
+  }
+  if (img->mask_) {
+    HDC new_gc = CreateCompatibleDC(fl_gc);
+    int save = SaveDC(new_gc);
+    SelectObject(new_gc, (void*)img->mask_);
+    BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
+    SelectObject(new_gc, (void*)img->id_);
+    BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
+    RestoreDC(new_gc,save);
+    DeleteDC(new_gc);
+  } else if (img->d()==2 || img->d()==4) {
+    fl_copy_offscreen_with_alpha(X, Y, W, H, (fltk3::Offscreen)img->id_, cx, cy);
+  } else {
+    fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)img->id_, cx, cy);
+  }
+}
+
+#else
+void fltk3::XlibGraphicsDriver::draw(fltk3::RGBImage *img, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  // Don't draw an empty image...
+  if (!img->d() || !img->array) {
+    img->draw_empty(XP, YP);
+    return;
+  }
+  if (start(img, XP, YP, WP, HP, img->w(), img->h(), cx, cy, X, Y, W, H)) {
+    return;
+  }
+  if (!img->id_) {
+    if (img->d() == 1 || img->d() == 3) {
+      img->id_ = fl_create_offscreen(img->w(), img->h());
+      fl_begin_offscreen((fltk3::Offscreen)img->id_);
+      fltk3::draw_image(img->array, 0, 0, img->w(), img->h(), img->d(), img->ld());
+      fl_end_offscreen();
+    }
+  }
+  if (img->id_) {
+    if (img->mask_) {
+      // I can't figure out how to combine a mask with existing region,
+      // so cut the image down to a clipped rectangle:
+      int nx, ny; fltk3::clip_box(X,Y,W,H,nx,ny,W,H);
+      cx += nx-X; X = nx;
+      cy += ny-Y; Y = ny;
+      // make X use the bitmap as a mask:
+      XSetClipMask(fl_display, fl_gc, img->mask_);
+      int ox = X-cx; if (ox < 0) ox += img->w();
+      int oy = Y-cy; if (oy < 0) oy += img->h();
+      XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
+    }
+    
+    fl_copy_offscreen(X, Y, W, H, img->id_, cx, cy);
+    
+    if (img->mask_) {
+      // put the old clip region back
+      XSetClipOrigin(fl_display, fl_gc, 0, 0);
+      fltk3::restore_clip();
+    }
+  } else {
+    // Composite image with alpha manually each time...
+    alpha_blend(img, X, Y, W, H, cx, cy);
+  }
+}
+
+#endif
+
+void fltk3::RGBImage::label(fltk3::Widget* widget) {
+  widget->image(this);
+}
+
+void fltk3::RGBImage::label(fltk3::MenuItem* m) {
+  m->label(fltk3::IMAGE_LABEL, (const char*)this);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Input.cxx (from rev 9004, branches/branch-3.0/src/core/Fl_Input.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Input.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Input.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,830 @@
+//
+// "$Id$"
+//
+// Input widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This is the "user interface", it decodes user actions into what to
+// do to the text.  See also fltk3::Input_.cxx, where the text is actually
+// manipulated (and some ui, in particular the mouse, is done...).
+// In theory you can replace this code with another subclass to change
+// the keybindings.
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/run.h>
+#include <fltk3/Window.h>
+#include <fltk3/Input.h>
+#include <fltk3/draw.h>
+#include <fltk3/ask.h>
+#include "flstring.h"
+
+#if defined(FL_DLL)	// really needed for c'tors for MS VC++ only
+#include <fltk3/FloatInput.H>
+#include <fltk3/IntInput.H>
+#include <fltk3/MultilineInput.H>
+#include <fltk3/Output.H>
+#include <fltk3/MultilineOutput.H>
+#include <fltk3/SecretInput.H>
+#endif
+
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+
+void fltk3::Input::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (input_type() == fltk3::HIDDEN_INPUT) return;
+  fltk3::Boxtype b = box();
+  if (damage() & fltk3::DAMAGE_ALL) draw_box(b, color());
+  Input_::drawtext(x()+fltk3::box_dx(b), y()+fltk3::box_dy(b),
+		      w()-fltk3::box_dw(b), h()-fltk3::box_dh(b));
+}
+
+// kludge so shift causes selection to extend:
+int fltk3::Input::shift_position(int p) {
+  return position(p, fltk3::event_state(fltk3::SHIFT) ? mark() : p);
+}
+
+int fltk3::Input::shift_up_down_position(int p) {
+  return up_down_position(p, fltk3::event_state(fltk3::SHIFT));
+}
+
+// Old text from FLTK 1.1 for reference:
+// If you define NORMAL_INPUT_MOVE as zero you will get the peculiar fltk
+// behavior where moving off the end of an input field will move the
+// cursor into the next field:
+// define it as 1 to prevent cursor movement from going to next field:
+//
+// Note: this has been replaced by fltk3::option(fltk3::OPTION_ARROW_FOCUS)
+// in FLTK 1.3.  This option has "inverted" values:
+//   1 = Arrow keys move focus (previously 0)
+//   0 = Arrow keys don't move focus (previously 1)
+// Hence we define ...
+//
+#define NORMAL_INPUT_MOVE (fltk3::option(fltk3::OPTION_ARROW_FOCUS) ? 0 : 1)
+
+#define ctrl(x) ((x)^0x40)
+
+// List of characters that are legal in a floating point input field.
+// This text string is created at run-time to take the current locale
+// into account (for example, continental Europe uses a comma instead
+// of a decimal point). For back compatibility reasons, we always 
+// allow the decimal point.
+#ifdef HAVE_LOCALECONV
+static const char *standard_fp_chars = ".eE+-"; 
+static const char *legal_fp_chars = 0L;
+#else
+static const char *legal_fp_chars = ".eE+-"; 
+#endif
+
+// Move cursor up specified #lines
+//    If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation.
+//
+int fltk3::Input::kf_lines_up(int repeat_num) {
+  int i = position();
+  if (!line_start(i)) {
+    //UNNEEDED if (input_type()==fltk3::MULTILINE_INPUT && !fltk3::option(fltk3::OPTION_ARROW_FOCUS)) return 1;
+    return NORMAL_INPUT_MOVE;
+  }
+  while(repeat_num--) {
+    i = line_start(i);
+    if (!i) break;
+    i--;
+  }
+  shift_up_down_position(line_start(i));
+  return 1;
+}
+
+// Move cursor down specified #lines
+//    If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation.
+//
+int fltk3::Input::kf_lines_down(int repeat_num) {
+  int i = position();
+  if (line_end(i) >= size()) {
+    //UNNEEDED if (input_type()==fltk3::MULTILINE_INPUT && !fltk3::option(fltk3::OPTION_ARROW_FOCUS)) return 1;
+    return NORMAL_INPUT_MOVE;
+  }
+  while (repeat_num--) {  
+    i = line_end(i);
+    if (i >= size()) break;
+    i++;
+  }
+  shift_up_down_position(i);
+  return 1;
+}
+
+// Move up a page
+int fltk3::Input::kf_page_up() {
+  return kf_lines_up(linesPerPage());
+}
+
+// Move down a page
+int fltk3::Input::kf_page_down() {
+  return kf_lines_down(linesPerPage());
+}
+
+// Toggle insert mode
+int fltk3::Input::kf_insert_toggle() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  return 1;				// \todo: needs insert mode
+}
+
+// Delete word right
+int fltk3::Input::kf_delete_word_right() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) return cut();
+  cut(position(), word_end(position()));
+  return 1;
+}
+
+// Delete word left
+int fltk3::Input::kf_delete_word_left() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) return cut();
+  cut(word_start(position()), position());
+  return 1;
+}
+
+// Delete to start of line
+int fltk3::Input::kf_delete_sol() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) return cut();
+  cut(line_start(position()), position());
+  return 1;
+}
+
+// Delete to end of line
+int fltk3::Input::kf_delete_eol() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) return cut();
+  cut(position(), line_end(position()));
+  return 1;
+}
+
+int fltk3::Input::kf_delete_char_right() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) return cut();
+  else return cut(1);
+}
+
+int fltk3::Input::kf_delete_char_left() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (mark() != position()) cut();
+  else cut(-1);
+  return 1;
+}
+
+// Move cursor to start of line
+int fltk3::Input::kf_move_sol() {
+  return shift_position(line_start(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Move cursor to end of line
+int fltk3::Input::kf_move_eol() {
+  return shift_position(line_end(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Clear to end of line
+int fltk3::Input::kf_clear_eol() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  if (position()>=size()) return 0;
+  int i = line_end(position());
+  if (i == position() && i < size()) i++;
+  cut(position(), i);
+  return copy_cuts();
+}
+
+// Move cursor one character to the left
+//    If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation.
+//
+int fltk3::Input::kf_move_char_left() {
+  int i = shift_position(position()-1) + NORMAL_INPUT_MOVE;
+  return fltk3::option(fltk3::OPTION_ARROW_FOCUS) ? i : 1;
+}
+
+// Move cursor one character to the right
+//    If OPTION_ARROW_FOCUS is disabled, return 1 to prevent focus navigation.
+//
+int fltk3::Input::kf_move_char_right() {
+  int i = shift_position(position()+1) + NORMAL_INPUT_MOVE;
+  return fltk3::option(fltk3::OPTION_ARROW_FOCUS) ? i : 1;
+}
+
+// Move cursor word-left
+int fltk3::Input::kf_move_word_left() {
+  shift_position(word_start(position()));
+  return 1; 
+}
+
+// Move cursor word-right
+int fltk3::Input::kf_move_word_right() {
+  shift_position(word_end(position()));
+  return 1;
+}
+
+// Move cursor up one line and to the start of line (paragraph up)
+int fltk3::Input::kf_move_up_and_sol() {
+  if (line_start(position())==position() && position()>0)
+    return shift_position(line_start(position()-1)) + NORMAL_INPUT_MOVE;
+  else
+    return shift_position(line_start(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Move cursor down one line and to the end of line (paragraph down)
+int fltk3::Input::kf_move_down_and_eol() {
+  if (line_end(position())==position() && position()<size())
+    return shift_position(line_end(position()+1)) + NORMAL_INPUT_MOVE;
+  else
+    return shift_position(line_end(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Move to top of document
+int fltk3::Input::kf_top() {
+  shift_position(0);
+  return 1;
+}
+
+// Move to bottom of document
+int fltk3::Input::kf_bottom() {
+  shift_position(size());
+  return 1; 
+}
+
+// Select all text in the widget
+int fltk3::Input::kf_select_all() {
+  position(0,size());
+  return 1;
+}
+
+// Undo.
+int fltk3::Input::kf_undo() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  return undo();
+}
+
+// Redo. (currently unimplemented.. toggles undo() instead)
+int fltk3::Input::kf_redo() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  return kf_undo();			// currently we don't support multilevel undo
+}
+
+// Do a copy operation
+int fltk3::Input::kf_copy() {
+  return copy(1);
+}
+
+// Do a paste operation
+int fltk3::Input::kf_paste() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  fltk3::paste(*this, 1);
+  return 1;
+}
+
+// Do a cut with copy
+int fltk3::Input::kf_copy_cut() {
+  if (readonly()) { fltk3::beep(); return 1; }
+  copy(1);
+  return cut();
+}
+
+// Handle a keystroke.
+//     Returns 1 if handled by us, 0 if not.
+//
+int fltk3::Input::handle_key() {
+  
+  char ascii = fltk3::event_text()[0];
+  
+  int del;
+  if (fltk3::compose(del)) {
+    
+    // Insert characters into numeric fields after checking for legality:
+    if (input_type() == fltk3::FLOAT_INPUT || input_type() == fltk3::INT_INPUT) {
+      fltk3::compose_reset(); // ignore any foreign letters...
+      
+      // initialize the list of legal characters inside a floating point number
+#ifdef HAVE_LOCALECONV
+      if (!legal_fp_chars) {
+        int len = strlen(standard_fp_chars);
+        struct lconv *lc = localeconv();
+        if (lc) {
+          if (lc->decimal_point) len += strlen(lc->decimal_point);
+          if (lc->mon_decimal_point) len += strlen(lc->mon_decimal_point);
+          if (lc->positive_sign) len += strlen(lc->positive_sign);
+          if (lc->negative_sign) len += strlen(lc->negative_sign);
+        }
+        // the following line is not a true memory leak because the array is only
+        // allocated once if required, and automatically freed when the program quits
+        char *chars = (char*)malloc(len+1);
+	legal_fp_chars = chars;
+        strcpy(chars, standard_fp_chars);
+        if (lc) {
+          if (lc->decimal_point) strcat(chars, lc->decimal_point);
+          if (lc->mon_decimal_point) strcat(chars, lc->mon_decimal_point);
+          if (lc->positive_sign) strcat(chars, lc->positive_sign);
+          if (lc->negative_sign) strcat(chars, lc->negative_sign);
+        }
+      }
+#endif // HAVE_LOCALECONV
+      
+      // find the insert position
+      int ip = position()<mark() ? position() : mark();
+      // This is complex to allow "0xff12" hex to be typed:
+      if (   (!ip && (ascii == '+' || ascii == '-')) 
+          || (ascii >= '0' && ascii <= '9') 
+          || (ip==1 && index(0)=='0' && (ascii=='x' || ascii == 'X')) 
+          || (ip>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X') 
+              && ((ascii>='A'&& ascii<='F') || (ascii>='a'&& ascii<='f'))) 
+          || (input_type()==fltk3::FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii))) 
+      {
+	if (readonly()) fltk3::beep();
+	else replace(position(), mark(), &ascii, 1);
+      }
+      return 1;
+    }
+    
+    if (del || fltk3::event_length()) {
+      if (readonly()) fltk3::beep();
+      else replace(position(), del ? position()-del : mark(),
+	           fltk3::event_text(), fltk3::event_length());
+    }
+    return 1;
+  }
+  
+  unsigned int mods = fltk3::event_state() & (fltk3::META|fltk3::CTRL|fltk3::ALT);
+  unsigned int shift = fltk3::event_state() & fltk3::SHIFT;
+  unsigned int multiline = (input_type() == fltk3::MULTILINE_INPUT) ? 1 : 0;
+  //
+  // The following lists apps that support these keypresses.
+  // Prefixes: '!' indicates NOT supported, '?' indicates un-verified.
+  //
+  //    HIG=Human Interface Guide, 
+  //    TE=TextEdit.app, SA=Safari.app, WOX=MS Word/OSX -- OSX 10.4.x
+  //    NP=Notepad, WP=WordPad, WOW=MS Word/Windows     -- WinXP
+  //    GE=gedit, KE=kedit                              -- Ubuntu8.04
+  //    OF=old FLTK behavior (<=1.1.10)
+  //
+  // Example: (NP,WP,!WO) means supported in notepad + wordpad, but NOT word.
+  //
+  switch (fltk3::event_key()) {
+
+    case fltk3::InsertKey:
+      // Note: Mac has no "Insert" key; it's the "Help" key.
+      //       This keypress is apparently not possible on macs.
+      //
+      if (mods==0 && shift) return kf_paste();			// Shift-Insert   (WP,NP,WOW,GE,KE,OF)
+      if (mods==0)          return kf_insert_toggle();		// Insert         (Standard)
+      if (mods==fltk3::CTRL)    return kf_copy();			// Ctrl-Insert    (WP,NP,WOW,GE,KE,OF)
+      return 0;							// ignore other combos, pass to parent
+
+    case fltk3::DeleteKey: {
+#ifdef __APPLE__
+      if (mods==0)          return kf_delete_char_right();	// Delete         (OSX-HIG,TE,SA,WOX)
+      if (mods==fltk3::CTRL)    return kf_delete_char_right();	// Ctrl-Delete    (??? TE,!SA,!WOX)
+      if (mods==fltk3::ALT)     return kf_delete_word_right();	// Alt-Delete     (OSX-HIG,TE,SA)
+      return 0;							// ignore other combos, pass to parent
+#else
+      int selected = (position() != mark()) ? 1 : 0;
+      if (mods==0 && shift && selected)
+                            return kf_copy_cut();		// Shift-Delete with selection (WP,NP,WOW,GE,KE,OF)
+      if (mods==0 && shift && !selected)
+                            return kf_delete_char_right();	// Shift-Delete no selection (WP,NP,WOW,GE,KE,!OF)
+      if (mods==0)          return kf_delete_char_right();	// Delete         (Standard)
+      if (mods==fltk3::CTRL)    return kf_delete_word_right();	// Ctrl-Delete    (WP,!NP,WOW,GE,KE,!OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+    }
+
+    case fltk3::LeftKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_move_char_left();		// Left           (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_move_word_left();		// Alt-Left       (OSX-HIG)
+      if (mods==fltk3::META)    return kf_move_sol();		// Meta-Left      (OSX-HIG)
+      if (mods==fltk3::CTRL)    return kf_move_sol();		// Ctrl-Left      (TE/SA)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_move_char_left();		// Left           (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_move_word_left();		// Ctrl-Left      (WP,NP,WOW,GE,KE,!OF)
+      if (mods==fltk3::META)    return kf_move_char_left();		// Meta-Left      (WP,NP,?WOW,GE,KE)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::RightKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_move_char_right();	// Right          (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_move_word_right();	// Alt-Right      (OSX-HIG)
+      if (mods==fltk3::META)    return kf_move_eol();		// Meta-Right     (OSX-HIG)
+      if (mods==fltk3::CTRL)    return kf_move_eol();		// Ctrl-Right     (TE/SA)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_move_char_right();	// Right          (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_move_word_right();	// Ctrl-Right     (WP,NP,WOW,GE,KE,!OF)
+      if (mods==fltk3::META)    return kf_move_char_right();	// Meta-Right     (WP,NP,?WOW,GE,KE,!OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::UpKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_lines_up(1);		// Up             (OSX-HIG)
+      if (mods==fltk3::CTRL)    return kf_page_up();		// Ctrl-Up        (TE !HIG)
+      if (mods==fltk3::ALT)     return kf_move_up_and_sol();	// Alt-Up         (OSX-HIG)
+      if (mods==fltk3::META)    return kf_top();			// Meta-Up        (OSX-HIG)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_lines_up(1);		// Up             (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_move_up_and_sol();	// Ctrl-Up        (WP,!NP,WOW,GE,!KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::DownKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_lines_down(1);		// Dn             (OSX-HIG)
+      if (mods==fltk3::CTRL)    return kf_page_down();		// Ctrl-Dn        (TE !HIG)
+      if (mods==fltk3::ALT)     return kf_move_down_and_eol();	// Alt-Dn         (OSX-HIG)
+      if (mods==fltk3::META)    return kf_bottom();			// Meta-Dn        (OSX-HIG)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_lines_down(1);		// Dn             (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_move_down_and_eol();	// Ctrl-Down      (WP,!NP,WOW,GE,!KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::PageUpKey:
+      // fltk3::Input has no scroll control, so instead we move the cursor by one page
+      // OSX-HIG recommends Alt increase one semantic unit, Meta next higher..
+#ifdef __APPLE__
+      if (mods==0)          return kf_page_up();		// PgUp           (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_page_up();		// Alt-PageUp     (OSX-HIG)
+      if (mods==fltk3::META)    return kf_top();			// Meta-PageUp    (OSX-HIG,!TE)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_page_up();		// PageUp         (WP,NP,WOW,GE,KE)
+      if (mods==fltk3::CTRL)    return kf_page_up();		// Ctrl-PageUp    (!WP,!NP,!WOW,!GE,KE,OF)
+      if (mods==fltk3::ALT)     return kf_page_up();		// Alt-PageUp     (!WP,!NP,!WOW,!GE,KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::PageDownKey:
+#ifdef __APPLE__
+      // fltk3::Input has no scroll control, so instead we move the cursor by one page
+      // OSX-HIG recommends Alt increase one semantic unit, Meta next higher..
+      if (mods==0)          return kf_page_down();		// PgDn           (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_page_down();		// Alt-PageDn     (OSX-HIG)
+      if (mods==fltk3::META)    return kf_bottom();			// Meta-PageDn    (OSX-HIG,!TE)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_page_down();		// PageDn         (WP,NP,WOW,GE,KE)
+      if (mods==fltk3::CTRL)    return kf_page_down();		// Ctrl-PageDn    (!WP,!NP,!WOW,!GE,KE,OF)
+      if (mods==fltk3::ALT)     return kf_page_down();		// Alt-PageDn     (!WP,!NP,!WOW,!GE,KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::HomeKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_top();			// Home           (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_top();			// Alt-Home       (???)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_move_sol();		// Home           (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_top();			// Ctrl-Home      (WP,NP,WOW,GE,KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::EndKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_bottom();			// End            (OSX-HIG)
+      if (mods==fltk3::ALT)     return kf_bottom();			// Alt-End        (???)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_move_eol();		// End            (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_bottom();			// Ctrl-End       (WP,NP,WOW,GE,KE,OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::BackSpaceKey:
+#ifdef __APPLE__
+      if (mods==0)          return kf_delete_char_left();	// Backspace      (OSX-HIG)
+      if (mods==fltk3::CTRL)    return kf_delete_char_left();	// Ctrl-Backspace (TE/SA)
+      if (mods==fltk3::ALT)     return kf_delete_word_left();	// Alt-Backspace  (OSX-HIG)
+      if (mods==fltk3::META)    return kf_delete_sol();		// Meta-Backspace (OSX-HIG,!TE)
+      return 0;							// ignore other combos, pass to parent
+#else
+      if (mods==0)          return kf_delete_char_left();	// Backspace      (WP,NP,WOW,GE,KE,OF)
+      if (mods==fltk3::CTRL)    return kf_delete_word_left();	// Ctrl-Backspace (WP,!NP,WOW,GE,KE,!OF)
+      return 0;							// ignore other combos, pass to parent
+#endif
+
+    case fltk3::EnterKey:
+    case fltk3::KPEnterKey:
+      if (when() & fltk3::WHEN_ENTER_KEY) {
+        position(size(), 0);
+        maybe_do_callback();
+        return 1;
+      } else if (multiline && !readonly()) {
+        return replace(position(), mark(), "\n", 1);
+      } return 0;			// reserved for shortcuts
+
+    case fltk3::TabKey:
+      // Handle special case for multiline input with 'old tab behavior';
+      // tab handled as a normal insertable character.
+      //
+      if (mods==0 && !shift 		// Tab?
+	   && !tab_nav()		// old tab behavior enabled?
+	   && multiline) {		// multiline input?
+        break;				// insert tab character
+      }
+      if (mods==0) return 0;					// Tab, Shift-Tab? nav focus      (Standard/OSX-HIG)
+      return 0;							// ignore other combos, pass to parent
+
+    case 'a':
+      if (mods==fltk3::COMMAND) return kf_select_all();		// Ctrl-A, Mac:Meta-A             (Standard/OSX-HIG)
+      break;							// handle other combos elsewhere
+    case 'c':
+      if (mods==fltk3::COMMAND) return kf_copy();			// Ctrl-C, Mac:Meta-C             (Standard/OSX-HIG)
+      break;							// handle other combos elsewhere
+    case 'v':
+      if (mods==fltk3::COMMAND) return kf_paste();			// Ctrl-V, Mac:Meta-V             (Standard/OSX-HIG)
+      break;							// handle other combos elsewhere
+    case 'x':
+      if (mods==fltk3::COMMAND) return kf_copy_cut();		// Ctrl-X, Mac:Meta-X             (Standard/OSX-HIG)
+      break;
+    case 'z':
+      if (mods==fltk3::COMMAND && !shift) return kf_undo();		// Ctrl-Z, Mac:Meta-Z             (Standard/OSX-HIG)
+      if (mods==fltk3::COMMAND && shift)  return kf_redo();		// Shift-Ctrl-Z, Mac:Shift-Meta-Z (Standard/OSX-HIG)
+      break;							// handle other combos elsewhere
+  }
+  
+  switch (ascii) {
+    case ctrl('H'):
+      return kf_delete_char_left();				// Ctrl-H                           (!WP,!NP,!WOW,!WOX,TE,SA,GE,KE,OF)
+    case ctrl('I'): 						// Ctrl-I (literal Tab)             (!WP,NP,!WOW,!GE,KE,OF)
+    case ctrl('J'):						// Ctrl-J (literal Line Feed/Enter) (Standard)
+    case ctrl('L'):						// Ctrl-L (literal Form Feed)       (Standard)
+    case ctrl('M'):						// Ctrl-M (literal Cr)              (Standard)
+      if (readonly()) { fltk3::beep(); return 1; }
+      // insert a few selected control characters literally:
+      if (input_type() != fltk3::FLOAT_INPUT && input_type() != fltk3::INT_INPUT)
+        return replace(position(), mark(), &ascii, 1);
+      break;
+  }
+  
+  return 0;		// ignored
+}
+
+int fltk3::Input::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
+  static fltk3::Widget *dnd_save_focus;
+  switch (event) {
+    case fltk3::FOCUS:
+      switch (fltk3::event_key()) {
+        case fltk3::RightKey:
+          position(0);
+          break;
+        case fltk3::LeftKey:
+          position(size());
+          break;
+        case fltk3::DownKey:
+          up_down_position(0);
+          break;
+        case fltk3::UpKey:
+          up_down_position(line_start(size()));
+          break;
+        case fltk3::TabKey:
+          position(size(),0);
+          break;
+        default:
+          position(position(),mark());// turns off the saved up/down arrow position
+          break;
+      }
+      break;
+      
+    case fltk3::KEYBOARD:
+      // Handle special case for multiline input with 'old tab behavior'
+      // where tab is entered as a character: make sure user attempt to 'tab over'
+      // widget doesn't destroy the field, replacing it with a tab character.
+      //
+      if (fltk3::event_key() == fltk3::TabKey 			// Tab key?
+          && !fltk3::event_state(fltk3::SHIFT)			// no shift?
+          && !tab_nav()					// with tab navigation disabled?
+	  && input_type() == fltk3::MULTILINE_INPUT		// with a multiline input?
+          && (mark()==0 && position()==size())) {	// while entire field selected?
+        // Set cursor to the end of the selection...
+        if (mark() > position())
+          position(mark());
+        else
+          position(position());
+        return (1);
+      } else {
+        if (active_r() && window() && this == fltk3::belowmouse()) 
+          window()->cursor(fltk3::CURSOR_NONE);
+        return handle_key();
+      }
+      //NOTREACHED
+      
+    case fltk3::PUSH:
+      
+      if (((unsigned)fltk3::event_buttons())==fltk3::BUTTON3) {
+        handle_menu_event();
+        return 1;
+      }
+
+      if (fltk3::dnd_text_ops()) {
+        int oldpos = position(), oldmark = mark();
+        fltk3::Boxtype b = box();
+        Input_::handle_mouse(x()+fltk3::box_dx(b), y()+fltk3::box_dy(b),
+                                w()-fltk3::box_dw(b), h()-fltk3::box_dh(b), 0);
+        newpos = position(); 
+        position( oldpos, oldmark );
+        if (fltk3::focus()==this && !fltk3::event_state(fltk3::SHIFT) && input_type()!=fltk3::SECRET_INPUT &&
+           ( (newpos >= mark() && newpos < position()) || 
+             (newpos >= position() && newpos < mark()) ) ) {
+          // user clicked in the selection, may be trying to drag
+          drag_start = newpos;
+          return 1;
+        }
+        drag_start = -1;
+      }
+      
+      if (fltk3::focus() != this) {
+        fltk3::focus(this);
+        handle(fltk3::FOCUS);
+      }
+      break;
+      
+    case fltk3::DRAG:
+      if (fltk3::dnd_text_ops()) {
+        if (drag_start >= 0) {
+          if (fltk3::event_is_click()) return 1; // debounce the mouse
+                                              // save the position because sometimes we don't get DND_ENTER:
+          dnd_save_position = position();
+          dnd_save_mark = mark();
+          // drag the data:
+          copy(0); fltk3::dnd();
+          return 1;
+        }
+      }
+      break;
+      
+    case fltk3::RELEASE:
+      if (fltk3::event_button() == 2) {
+        fltk3::event_is_click(0); // stop double click from picking a word
+        fltk3::paste(*this, 0);
+      } else if (!fltk3::event_is_click()) {
+        // copy drag-selected text to the clipboard.
+        copy(0);
+      } else if (fltk3::event_is_click() && drag_start >= 0) {
+        // user clicked in the field and wants to reset the cursor position...
+        position(drag_start, drag_start);
+        drag_start = -1;
+      } else if (fltk3::event_clicks()) {
+        // user double or triple clicked to select word or whole text
+        copy(0);
+      }
+      
+      // For output widgets, do the callback so the app knows the user
+      // did something with the mouse...
+      if (readonly()) do_callback();
+      
+      return 1;
+      
+    case fltk3::DND_ENTER:
+      fltk3::belowmouse(this); // send the leave events first
+      dnd_save_position = position();
+      dnd_save_mark = mark();
+      dnd_save_focus = fltk3::focus();
+      if (dnd_save_focus != this) {
+        fltk3::focus(this);
+        handle(fltk3::FOCUS);
+      }
+      // fall through:
+    case fltk3::DND_DRAG: 
+      //int p = mouse_position(X, Y, W, H);
+#if DND_OUT_XXXX
+      if (fltk3::focus()==this && (p>=dnd_save_position && p<=dnd_save_mark ||
+                                p>=dnd_save_mark && p<=dnd_save_position)) {
+        position(dnd_save_position, dnd_save_mark);
+        return 0;
+      }
+#endif
+      {
+        fltk3::Boxtype b = box();
+        Input_::handle_mouse(x()+fltk3::box_dx(b), y()+fltk3::box_dy(b),
+                                w()-fltk3::box_dw(b), h()-fltk3::box_dh(b), 0);
+      }
+      return 1;
+      
+    case fltk3::DND_LEAVE:
+      position(dnd_save_position, dnd_save_mark);
+#if DND_OUT_XXXX
+      if (!focused())
+#endif
+        if (dnd_save_focus != this) {
+          fltk3::focus(dnd_save_focus);
+          handle(fltk3::UNFOCUS);
+        }
+#if !(defined(__APPLE__) || defined(WIN32))
+      fltk3::first_window()->cursor(fltk3::CURSOR_MOVE);
+#endif
+      return 1;
+      
+    case fltk3::DND_RELEASE:
+      take_focus();
+      return 1;
+      
+      /* TODO: this will scroll the area, but stop if the cursor would become invisible.
+       That clipping happens in drawtext(). Do we change the clipping or should 
+       we move the cursor (ouch)?
+       case fltk3::MOUSEWHEEL:
+       if (fltk3::e_dy > 0) {
+       yscroll( yscroll() - fltk3::e_dy*15 );
+       } else if (fltk3::e_dy < 0) {
+       yscroll( yscroll() - fltk3::e_dy*15 );
+       }
+       return 1;
+       */
+  }
+  fltk3::Boxtype b = box();
+  return Input_::handletext(event,
+                               x()+fltk3::box_dx(b), y()+fltk3::box_dy(b),
+                               w()-fltk3::box_dw(b), h()-fltk3::box_dh(b));
+}
+
+/**
+ Creates a new fltk3::Input widget using the given position, size,
+ and label string. The default boxtype is fltk3::DOWN_BOX.
+ */
+fltk3::Input::Input(int X, int Y, int W, int H, const char *l)
+: fltk3::Input_(X, Y, W, H, l) {
+}
+
+/*
+ The following constructors must not be in the header file(s) if we
+ build a shared object (DLL). Instead they are defined here to force
+ the constructor (and default destructor as well) to be defined in
+ the DLL and exported (STR #2632).
+ 
+ Note: if you change any of them, do the same changes in the specific
+ header file as well.  This redundant definition was chosen to enable
+ inline constructors in the header files (for static linking) as well
+ as those here for dynamic linking (Windows DLL).
+ */
+#if defined(FL_DLL)
+
+fltk3::FloatInput::FloatInput(int X,int Y,int W,int H,const char *l)
+: fltk3::Input(X,Y,W,H,l) {
+  type(fltk3::FLOAT_INPUT);
+}
+
+fltk3::IntInput::IntInput(int X,int Y,int W,int H,const char *l)
+: fltk3::Input(X,Y,W,H,l) {
+  type(fltk3::INT_INPUT);
+}
+
+fltk3::MultilineInput::MultilineInput(int X,int Y,int W,int H,const char *l)
+: fltk3::Input(X,Y,W,H,l) {
+  type(fltk3::MULTILINE_INPUT);
+}
+
+fltk3::Output::Output(int X,int Y,int W,int H, const char *l)
+: fltk3::Input(X, Y, W, H, l) {
+  type(fltk3::NORMAL_OUTPUT);
+}
+
+fltk3::MultilineOutput::MultilineOutput(int X,int Y,int W,int H,const char *l)
+: fltk3::Output(X,Y,W,H,l) {
+  type(fltk3::MULTILINE_OUTPUT);
+}
+
+fltk3::SecretInput::SecretInput(int X,int Y,int W,int H,const char *l)
+: fltk3::Input(X,Y,W,H,l) {
+  type(fltk3::SECRET_INPUT);
+}
+
+#endif // FL_DLL
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Input_.cxx (from rev 9006, branches/branch-3.0/src/core/Fl_Input_.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Input_.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Input_.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1331 @@
+//
+// "$Id$"
+//
+// Common input widget routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Input_.h>
+#include <fltk3/Window.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/draw.h>
+#include <fltk3/ask.h>
+#include <math.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <stdlib.h>
+#include <ctype.h>
+
+#define MAXBUF 1024
+#if defined(USE_X11) && !USE_XFT
+const int secret_char = '*'; // asterisk to hide secret input
+#else
+const int secret_char = 0x2022; // bullet to hide secret input
+#endif
+static int l_secret;
+
+namespace fltk3 {
+  extern void draw(const char*, int, float, float);
+}
+
+////////////////////////////////////////////////////////////////
+
+/** \internal
+  Converts a given text segment into the text that will be rendered on screen.
+
+  This copies the text from \p p to \p buf, replacing characters with <tt>^X</tt>
+  and <tt>\\nnn</tt> as necessary.
+
+  The destination buffer is limited to \c MAXBUF (currently at 1024). All
+  following text is truncated.
+
+  \param [in] p pointer to source buffer
+  \param [in] buf pointer to destination buffer
+  \return pointer to the end of the destination buffer
+*/
+const char* fltk3::Input_::expand(const char* p, char* buf) const {
+  char* o = buf;
+  char* e = buf+(MAXBUF-4);
+  const char* lastspace = p;
+  char* lastspace_out = o;
+  int width_to_lastspace = 0;
+  int word_count = 0;
+  int word_wrap;
+//  const char *pe = p + strlen(p);
+
+  if (input_type()==fltk3::SECRET_INPUT) {
+    while (o<e && p < value_+size_) {
+      if (fltk3::utf8len((char)p[0]) >= 1) {
+	l_secret = fltk3::utf8encode(secret_char, o);
+	o += l_secret;
+      }
+      p++;
+    }
+
+  } else while (o<e) {
+    if (wrap() && (p >= value_+size_ || isspace(*p & 255))) {
+      word_wrap = w() - fltk3::box_dw(box()) - 2;
+      width_to_lastspace += (int)fltk3::width(lastspace_out, o-lastspace_out);
+      if (p > lastspace+1) {
+	if (word_count && width_to_lastspace > word_wrap) {
+	  p = lastspace; o = lastspace_out; break;
+	}
+	word_count++;
+      }
+      lastspace = p;
+      lastspace_out = o;
+    }
+
+    if (p >= value_+size_) break;
+    int c = *p++ & 255;
+    if (c < ' ' || c == 127) {
+      if (c=='\n' && input_type()==fltk3::MULTILINE_INPUT) {p--; break;}
+      if (c == '\t' && input_type()==fltk3::MULTILINE_INPUT) {
+        for (c = fltk3::utf_nb_char((uchar*)buf, o-buf)%8; c<8 && o<e; c++) {
+          *o++ = ' ';
+        }
+      } else {
+	*o++ = '^';
+	*o++ = c ^ 0x40;
+      }
+    } else {
+      *o++ = c;
+    }
+  }
+  *o = 0;
+  return p;
+}
+
+/** \internal
+  Calculates the width in pixels of part of a text buffer.
+
+  This call takes a string, usually created by expand, and calculates
+  the width of the string when rendered with the given font.
+
+  \param [in] p pointer to the start of the original string
+  \param [in] e pointer to the end of the original string
+  \param [in] buf pointer to the buffer as returned by expand()
+  \return width of string in pixels
+*/
+double fltk3::Input_::expandpos(
+  const char* p,	// real string
+  const char* e,	// pointer into real string
+  const char* buf,	// conversion of real string by expand()
+  int* returnn		// return offset into buf here
+) const {
+  int n = 0;
+  int chr = 0;
+  int l;
+  if (input_type()==fltk3::SECRET_INPUT) {
+    while (p<e) {
+      l = fltk3::utf8len((char)p[0]);
+      if (l >= 1) n += l_secret;
+      p += l;
+    }
+  } else while (p<e) {
+    int c = *p & 255;
+    if (c < ' ' || c == 127) {
+      if (c == '\t' && input_type()==fltk3::MULTILINE_INPUT) {
+         n += 8-(chr%8);
+         chr += 7-(chr%8);
+      } else n += 2;
+    } else {
+      n++;
+    }
+    chr += fltk3::utf8len((char)p[0]) >= 1;
+    p++;
+  }
+  if (returnn) *returnn = n;
+  return fltk3::width(buf, n);
+}
+
+////////////////////////////////////////////////////////////////
+
+/** \internal
+  Marks a range of characters for update.
+
+  This call marks all characters from \p to the end of the 
+  text buffer for update. At least these characters
+  will be redrawn in the next update cycle.
+
+  Characters from \p mu_p to end of widget are redrawn.
+  If \p erase_cursor_only, small part at \p mu_p is redrawn.
+  Right now minimal update just keeps unchanged characters from
+  being erased, so they don't blink.
+
+  \param [in] p start of update range
+*/
+void fltk3::Input_::minimal_update(int p) {
+  if (damage() & fltk3::DAMAGE_ALL) return; // don't waste time if it won't be done
+  if (damage() & fltk3::DAMAGE_EXPOSE) {
+    if (p < mu_p) mu_p = p;
+  } else {
+    mu_p = p;
+  }
+
+  damage(fltk3::DAMAGE_EXPOSE);
+  erase_cursor_only = 0;
+}
+
+/** \internal
+  Marks a range of characters for update.
+
+  This call marks a text range for update. At least all characters
+  from \p p to \p q will be redrawn in the next update cycle.
+
+  \param [in] p start of update range
+  \param [in] q end of update range
+*/
+void fltk3::Input_::minimal_update(int p, int q) {
+  if (q < p) p = q;
+  minimal_update(p);
+}
+
+////////////////////////////////////////////////////////////////
+
+/* Horizontal cursor position in pixels while moving up or down. */
+double fltk3::Input_::up_down_pos = 0;
+
+/* Flag to remember last cursor move. */
+int fltk3::Input_::was_up_down = 0;
+
+/**
+  Sets the current font and font size.
+*/
+void fltk3::Input_::setfont() const {
+  fltk3::font(textfont(), textsize());
+}
+
+/**
+  Draws the text in the passed bounding box.  
+
+  If <tt>damage() & fltk3::DAMAGE_ALL</tt> is true, this assumes the 
+  area has already been erased to color(). Otherwise it does
+  minimal update and erases the area itself.
+
+  \param X, Y, W, H area that must be redrawn
+*/
+void fltk3::Input_::drawtext(int X, int Y, int W, int H) {
+  int do_mu = !(damage()&fltk3::DAMAGE_ALL);
+
+  if (fltk3::focus()!=this && !size()) {
+    if (do_mu) { // we have to erase it if cursor was there
+      draw_box(box(), X-fltk3::box_dx(box()), Y-fltk3::box_dy(box()),
+               W+fltk3::box_dw(box()), H+fltk3::box_dh(box()), color());
+    }
+    return;
+  }
+
+  int selstart, selend;
+  if (fltk3::focus()!=this && /*fltk3::selection_owner()!=this &&*/ fltk3::pushed()!=this)
+    selstart = selend = 0;
+  else if (position() <= mark()) {
+    selstart = position(); selend = mark();
+  } else {
+    selend = position(); selstart = mark();
+  }
+
+  setfont();
+  const char *p, *e;
+  char buf[MAXBUF];
+
+  // count how many lines and put the last one into the buffer:
+  // And figure out where the cursor is:
+  int height = fltk3::height();
+  int threshold = height/2;
+  int lines;
+  int curx, cury;
+  for (p=value(), curx=cury=lines=0; ;) {
+    e = expand(p, buf);
+    if (position() >= p-value() && position() <= e-value()) {
+      curx = int(expandpos(p, value()+position(), buf, 0)+.5);
+      if (fltk3::focus()==this && !was_up_down) up_down_pos = curx;
+      cury = lines*height;
+      int newscroll = xscroll_;
+      if (curx > newscroll+W-threshold) {
+	// figure out scrolling so there is space after the cursor:
+	newscroll = curx+threshold-W;
+	// figure out the furthest left we ever want to scroll:
+	int ex = int(expandpos(p, e, buf, 0))+2-W;
+	// use minimum of both amounts:
+	if (ex < newscroll) newscroll = ex;
+      } else if (curx < newscroll+threshold) {
+	newscroll = curx-threshold;
+      }
+      if (newscroll < 0) newscroll = 0;
+      if (newscroll != xscroll_) {
+	xscroll_ = newscroll;
+	mu_p = 0; erase_cursor_only = 0;
+      }
+    }
+    lines++;
+    if (e >= value_+size_) break;
+    p = e+1;
+  }
+
+  // adjust the scrolling:
+  if (input_type()==fltk3::MULTILINE_INPUT) {
+    int newy = yscroll_;
+    if (cury < newy) newy = cury;
+    if (cury > newy+H-height) newy = cury-H+height;
+    if (newy < -1) newy = -1;
+    if (newy != yscroll_) {yscroll_ = newy; mu_p = 0; erase_cursor_only = 0;}
+  } else {
+    yscroll_ = -(H-height)/2;
+  }
+
+  fltk3::push_clip(X, Y, W, H);
+  fltk3::Color tc = active_r() ? textcolor() : fltk3::inactive(textcolor());
+
+  p = value();
+  // visit each line and draw it:
+  int desc = height-fltk3::descent();
+  float xpos = (float)(X - xscroll_ + 1);
+  int ypos = -yscroll_;
+  for (; ypos < H;) {
+
+    // re-expand line unless it is the last one calculated above:
+    if (lines>1) e = expand(p, buf);
+
+    if (ypos <= -height) goto CONTINUE; // clipped off top
+
+    if (do_mu) {	// for minimal update:
+      const char* pp = value()+mu_p; // pointer to where minimal update starts
+      if (e < pp) goto CONTINUE2; // this line is before the changes
+      if (readonly()) erase_cursor_only = 0; // this isn't the most efficient way
+      if (erase_cursor_only && p > pp) goto CONTINUE2; // this line is after
+      // calculate area to erase:
+      float r = (float)(X+W);
+      float xx;
+      if (p >= pp) {
+	xx = (float)X;
+	if (erase_cursor_only) r = xpos+2;
+	else if (readonly()) xx -= 3;
+      } else {
+	xx = xpos + (float)expandpos(p, pp, buf, 0);
+	if (erase_cursor_only) r = xx+2;
+	else if (readonly()) xx -= 3;
+      }
+      // clip to and erase it:
+      fltk3::push_clip((int)xx-1-height/8, Y+ypos, (int)(r-xx+2+height/4), height);
+      draw_box(box(), X-fltk3::box_dx(box()), Y-fltk3::box_dy(box()),
+               W+fltk3::box_dw(box()), H+fltk3::box_dh(box()), color());
+      // it now draws entire line over it
+      // this should not draw letters to left of erased area, but
+      // that is nyi.
+    }
+
+    // Draw selection area if required:
+    if (selstart < selend && selstart <= e-value() && selend > p-value()) {
+      const char* pp = value()+selstart;
+      float x1 = xpos;
+      int offset1 = 0;
+      if (pp > p) {
+	fltk3::color(tc);
+	x1 += (float)expandpos(p, pp, buf, &offset1);
+	fltk3::draw(buf, offset1, xpos, (float)(Y+ypos+desc));
+      }
+      pp = value()+selend;
+      float x2 = (float)(X+W);
+      int offset2;
+      if (pp <= e) x2 = xpos + (float)expandpos(p, pp, buf, &offset2);
+      else offset2 = strlen(buf);
+      fltk3::color(selection_color());
+      fltk3::rectf((int)(x1+0.5), Y+ypos, (int)(x2-x1+0.5), height);
+      fltk3::color(fltk3::contrast(textcolor(), selection_color()));
+      fltk3::draw(buf+offset1, offset2-offset1, x1, (float)(Y+ypos+desc));
+      if (pp < e) {
+	fltk3::color(tc);
+	fltk3::draw(buf+offset2, strlen(buf+offset2), x2, (float)(Y+ypos+desc));
+      }
+    } else {
+      // draw unselected text
+      fltk3::color(tc);
+      fltk3::draw(buf, strlen(buf), xpos, (float)(Y+ypos+desc));
+    }
+
+    if (do_mu) fltk3::pop_clip();
+
+  CONTINUE2:
+    // draw the cursor:
+    if (fltk3::focus() == this && selstart == selend &&
+	position() >= p-value() && position() <= e-value()) {
+      fltk3::color(cursor_color());
+      // cursor position may need to be recomputed (see STR #2486)
+      curx = int(expandpos(p, value()+position(), buf, 0)+.5);
+      if (readonly()) {
+        fltk3::line((int)(xpos+curx-2.5f), Y+ypos+height-1,
+	        (int)(xpos+curx+0.5f), Y+ypos+height-4,
+	        (int)(xpos+curx+3.5f), Y+ypos+height-1);
+      } else {
+        fltk3::rectf((int)(xpos+curx+0.5), Y+ypos, 2, height);
+      }
+    }
+
+  CONTINUE:
+    ypos += height;
+    if (e >= value_+size_) break;
+    if (*e == '\n' || *e == ' ') e++;
+    p = e;
+  }
+
+  // for minimal update, erase all lines below last one if necessary:
+  if (input_type()==fltk3::MULTILINE_INPUT && do_mu && ypos<H
+      && (!erase_cursor_only || p <= value()+mu_p)) {
+    if (ypos < 0) ypos = 0;
+    fltk3::push_clip(X, Y+ypos, W, H-ypos);
+    draw_box(box(), X-fltk3::box_dx(box()), Y-fltk3::box_dy(box()),
+             W+fltk3::box_dw(box()), H+fltk3::box_dh(box()), color());
+    fltk3::pop_clip();
+  }
+
+  fltk3::pop_clip();
+  if (fltk3::focus() == this) {
+       fltk3::set_spot(textfont(), textsize(),
+               (int)xpos+curx, Y+ypos-fltk3::descent(), W, H, window());
+  }
+}
+
+/** \internal
+  Simple function that determines if a character could be part of a word.
+  \todo This function is not ucs4-aware.
+*/
+static int isword(char c) {
+  return (c&128 || isalnum(c) || strchr("#%&-/@\\_~", c));
+}
+
+/**
+  Finds the end of a word.
+
+  This call calculates the end of a word based on the given 
+  index \p i. Calling this function repeatedly will move
+  forwards to the end of the text.
+ 
+  \param [in] i starting index for the search
+  \return end of the word
+*/
+int fltk3::Input_::word_end(int i) const {
+  if (input_type() == fltk3::SECRET_INPUT) return size();
+  //while (i < size() && !isword(index(i))) i++;
+  while (i < size() && !isword(index(i))) i++;
+  while (i < size() && isword(index(i))) i++;
+  return i;
+}
+
+/**
+  Finds the start of a word.
+
+  This call calculates the start of a word based on the given 
+  index \p i. Calling this function repeatedly will move
+  backwards to the beginning of the text.
+ 
+  \param [in] i starting index for the search
+  \return start of the word
+*/
+int fltk3::Input_::word_start(int i) const {
+  if (input_type() == fltk3::SECRET_INPUT) return 0;
+//   if (i >= size() || !isword(index(i)))
+//     while (i > 0 && !isword(index(i-1))) i--;
+  while (i > 0 && !isword(index(i-1))) i--;
+  while (i > 0 && isword(index(i-1))) i--;
+  return i;
+}
+
+/**
+  Finds the end of a line.
+
+  This call calculates the end of a line based on the given 
+  index \p i. 
+ 
+  \param [in] i starting index for the search
+  \return end of the line
+*/
+int fltk3::Input_::line_end(int i) const {
+  if (input_type() != fltk3::MULTILINE_INPUT) return size();
+
+  if (wrap()) {
+    // go to the start of the paragraph:
+    int j = i;
+    while (j > 0 && index(j-1) != '\n') j--;
+    // now measure lines until we get past i, end of that line is real eol:
+    setfont();
+    for (const char* p=value()+j; ;) {
+      char buf[MAXBUF];
+      p = expand(p, buf);
+      if (p-value() >= i) return p-value();
+      p++;
+    }
+  } else {
+    while (i < size() && index(i) != '\n') i++;
+    return i;
+  }
+}
+
+/**
+  Finds the start of a line.
+
+  This call calculates the start of a line based on the given 
+  index \p i. 
+ 
+  \param [in] i starting index for the search
+  \return start of the line
+*/
+int fltk3::Input_::line_start(int i) const {
+  if (input_type() != fltk3::MULTILINE_INPUT) return 0;
+  int j = i;
+  while (j > 0 && index(j-1) != '\n') j--;
+  if (wrap()) {
+    // now measure lines until we get past i, start of that line is real eol:
+    setfont();
+    for (const char* p=value()+j; ;) {
+      char buf[MAXBUF];
+      const char* e = expand(p, buf);
+      if (e-value() >= i) return p-value();
+      p = e+1;
+    }
+  } else return j;
+}
+
+
+static fltk3::MenuItem ccp_menu[] = {
+  { "Cut", fltk3::COMMAND|'x', 0, (void*)1 },
+  { "Copy", fltk3::COMMAND|'c', 0, (void*)2 },
+  { "Paste", fltk3::COMMAND|'v', 0, (void*)3 },
+  { 0 }
+};
+
+/**
+ Handles right mouse button clicks.
+ */
+void fltk3::Input_::handle_menu_event() {
+
+  if (fltk3::focus() != this) {
+    fltk3::focus(this);
+    handle(fltk3::FOCUS);
+  }
+
+  int m = mark(), p = position();
+  if (m<p) { int x=p; p=m; m=x; }
+  handle_mouse(x()+fltk3::box_dx(box()), y()+fltk3::box_dy(box()), 0, 0, 0);
+  if ( ( (p==m && p!=position()) || position()<p || position()>m ) && (input_type()!=fltk3::SECRET_INPUT)) {
+    handle_mouse(x()+fltk3::box_dx(box()), y()+fltk3::box_dy(box()), 0, 0, 0); 
+    p = word_start(position()); 
+    m = word_end(position());
+  }
+  position(p, m);
+  if (p!=m && (input_type()!=fltk3::SECRET_INPUT) && !readonly())
+    ccp_menu[0].activate();
+  else
+    ccp_menu[0].deactivate();
+  if (p!=m && (input_type()!=fltk3::SECRET_INPUT))
+    ccp_menu[1].activate();
+  else
+    ccp_menu[1].deactivate();
+  if (!readonly() /*&& paste_buffer && *paste_buffer*/ ) // TODO: provide a function that can check if data is in the paste buffer
+    ccp_menu[2].activate();
+  else 
+    ccp_menu[2].deactivate();
+  redraw();
+  fltk3::flush();
+  const fltk3::MenuItem *mi = ccp_menu->popup(fltk3::event_x(), fltk3::event_y());
+  if (mi) {
+    switch (mi->argument()) {
+      case 1: copy(1); cut(); break;
+      case 2: copy(1); break;
+      case 3: 
+        paste(*this, 1); 
+        break;
+    }
+  }
+  return;
+}
+
+/** 
+  Handles mouse clicks and mouse moves.
+  \todo Add comment and parameters
+*/
+void fltk3::Input_::handle_mouse(int X, int Y, int /*W*/, int /*H*/, int drag) {
+  
+  was_up_down = 0;
+  if (!size()) return;
+  setfont();
+
+  const char *p, *e;
+  char buf[MAXBUF];
+
+  int theline = (input_type()==fltk3::MULTILINE_INPUT) ?
+    (fltk3::event_y()-Y+yscroll_)/fltk3::height() : 0;
+
+  int newpos = 0;
+  for (p=value();; ) {
+    e = expand(p, buf);
+    theline--; if (theline < 0) break;
+    if (e >= value_+size_) break;
+    p = e+1;
+  }
+  const char *l, *r, *t; double f0 = fltk3::event_x()-X+xscroll_;
+  for (l = p, r = e; l<r; ) {
+    double f;
+    int cw = fltk3::utf8len((char)l[0]);
+    if (cw < 1) cw = 1;
+    t = l+cw;
+    f = X-xscroll_+expandpos(p, t, buf, 0);
+    if (f <= fltk3::event_x()) {l = t; f0 = fltk3::event_x()-f;}
+    else r = t-cw;
+  }
+  if (l < e) { // see if closer to character on right:
+    double f1;
+    int cw = fltk3::utf8len((char)l[0]);
+    if (cw > 0) {
+      f1 = X-xscroll_+expandpos(p, l + cw, buf, 0) - fltk3::event_x();
+      if (f1 < f0) l = l+cw;
+    }
+  }
+  newpos = l-value();
+
+  int newmark = drag ? mark() : newpos;
+  if (fltk3::event_clicks()) {
+    if (newpos >= newmark) {
+      if (newpos == newmark) {
+	if (newpos < size()) newpos++;
+	else newmark--;
+      }
+      if (fltk3::event_clicks() > 1) {
+	newpos = line_end(newpos);
+	newmark = line_start(newmark);
+      } else {
+	newpos = word_end(newpos);
+	newmark = word_start(newmark);
+      }
+    } else {
+      if (fltk3::event_clicks() > 1) {
+	newpos = line_start(newpos);
+	newmark = line_end(newmark);
+      } else {
+	newpos = word_start(newpos);
+	newmark = word_end(newmark);
+      }
+    }
+    // if the multiple click does not increase the selection, revert
+    // to single-click behavior:
+    if (!drag && (mark() > position() ?
+                  (newmark >= position() && newpos <= mark()) :
+                  (newmark >= mark() && newpos <= position()))) {
+      fltk3::event_clicks(0);
+      newmark = newpos = l-value();
+    }
+  }
+  position(newpos, newmark);
+}
+
+/**
+  Sets the index for the cursor and mark.
+
+  The input widget maintains two pointers into the string. The
+  \e position (\c p) is where the cursor is. The
+  \e mark (\c m) is the other end of the selected text. If they
+  are equal then there is no selection. Changing this does not
+  affect the clipboard (use copy() to do that).
+    
+  Changing these values causes a redraw(). The new
+  values are bounds checked. 
+
+  \param p index for the cursor position
+  \param m index for the mark
+  \return 0 if no positions changed
+  \see position(int), position(), mark(int)
+*/
+int fltk3::Input_::position(int p, int m) {
+  int is_same = 0;
+  was_up_down = 0;
+  if (p<0) p = 0;
+  if (p>size()) p = size();
+  if (m<0) m = 0;
+  if (m>size()) m = size();
+  if (p == m) is_same = 1;
+
+  while (p < position_ && p > 0 && (size() - p) > 0 &&
+       (fltk3::utf8len((char)(value() + p)[0]) < 1)) { p--; }
+  int ul = fltk3::utf8len((char)(value() + p)[0]);
+  while (p < size() && p > position_ && ul < 0) {
+       p++;
+       ul = fltk3::utf8len((char)(value() + p)[0]);
+  }
+
+  while (m < mark_ && m > 0 && (size() - m) > 0 &&
+       (fltk3::utf8len((char)(value() + m)[0]) < 1)) { m--; }
+  ul = fltk3::utf8len((char)(value() + m)[0]);
+  while (m < size() && m > mark_ && ul < 0) {
+       m++;
+       ul = fltk3::utf8len((char)(value() + m)[0]);
+  }
+  if (is_same) m = p;
+  if (p == position_ && m == mark_) return 0;
+
+
+  //if (fltk3::selection_owner() == this) fltk3::selection_owner(0);
+  if (p != m) {
+    if (p != position_) minimal_update(position_, p);
+    if (m != mark_) minimal_update(mark_, m);
+  } else {
+    // new position is a cursor
+    if (position_ == mark_) {
+      // old position was just a cursor
+      if (fltk3::focus() == this && !(damage()&fltk3::DAMAGE_EXPOSE)) {
+	minimal_update(position_); erase_cursor_only = 1;
+      }
+    } else { // old position was a selection
+      minimal_update(position_, mark_);
+    }
+  }
+  position_ = p;
+  mark_ = m;
+  return 1;
+}
+
+/**
+  Moves the cursor to the column given by \p up_down_pos.
+
+  This function is helpful when implementing up and down 
+  cursor movement. It moves the cursor from the beginning
+  of a line to the column indicated by the global variable
+  \p up_down_pos in pixel units.
+
+  \param [in] i index into the beginning of a line of text
+  \param [in] keepmark if set, move only the cursor, but not the mark
+  \return index to new cursor position
+*/
+int fltk3::Input_::up_down_position(int i, int keepmark) {
+  // unlike before, i must be at the start of the line already!
+
+  setfont();
+  char buf[MAXBUF];
+  const char* p = value()+i;
+  const char* e = expand(p, buf);
+  const char *l, *r, *t;
+  for (l = p, r = e; l<r; ) {
+    t = l+(r-l+1)/2;
+    int f = (int)expandpos(p, t, buf, 0);
+    if (f <= up_down_pos) l = t; else r = t-1;
+  }
+  int j = l-value();
+  j = position(j, keepmark ? mark_ : j);
+  was_up_down = 1;
+  return j;
+}
+
+/**
+  Put the current selection into the clipboard.
+
+  This function copies the current selection between mark() and
+  position() into the specified \c clipboard. This does not
+  replace the old clipboard contents if position() and
+  mark() are equal. Clipboard 0 maps to the current text
+  selection and clipboard 1 maps to the cut/paste clipboard.
+
+  \param clipboard the clipboard destination 0 or 1
+  \return 0 if no text is selected, 1 if the selection was copied
+  \see fltk3::copy(const char *, int, int)
+*/
+int fltk3::Input_::copy(int clipboard) {
+  int b = position();
+  int e = mark();
+  if (b != e) {
+    if (b > e) {b = mark(); e = position();}
+    if (input_type() == fltk3::SECRET_INPUT) e = b;
+    fltk3::copy(value()+b, e-b, clipboard);
+    return 1;
+  }
+  return 0;
+}
+
+#define MAXFLOATSIZE 40
+
+static char* undobuffer;
+static int undobufferlength;
+static fltk3::Input_* undowidget;
+static int undoat;	// points after insertion
+static int undocut;	// number of characters deleted there
+static int undoinsert;	// number of characters inserted
+static int yankcut;	// length of valid contents of buffer, even if undocut=0
+
+static void undobuffersize(int n) {
+  if (n > undobufferlength) {
+    if (undobuffer) {
+      do {undobufferlength *= 2;} while (undobufferlength < n);
+      undobuffer = (char*)realloc(undobuffer, undobufferlength);
+    } else {
+      undobufferlength = n+9;
+      undobuffer = (char*)malloc(undobufferlength);
+    }
+  }
+}
+
+/**
+  Deletes text from \p b to \p e and inserts the new string \p text.
+
+  All changes to the text buffer go through this function.
+  It deletes the region between \p a and \p b (either one may be less or
+  equal to the other), and then inserts the string \p text
+  at that point and moves the mark() and
+  position() to the end of the insertion. Does the callback if
+  <tt>when() & fltk3::WHEN_CHANGED</tt> and there is a change.
+
+  Set \p b and \p e equal to not delete anything.
+  Set \p text to \c NULL to not insert anything.
+
+  \p ilen can be zero or <tt>strlen(text)</tt>, which
+  saves a tiny bit of time if you happen to already know the
+  length of the insertion, or can be used to insert a portion of a
+  string.
+  
+  \p b and \p e are clamped to the
+  <tt>0..size()</tt> range, so it is safe to pass any values.
+  
+  cut() and insert() are just inline functions that call replace().
+
+  \param [in] b beginning index of text to be deleted
+  \param [in] e ending index of text to be deleted and insertion position
+  \param [in] text string that will be inserted
+  \param [in] ilen length of \p text or 0 for \c nul terminated strings
+  \return 0 if nothing changed
+*/
+int fltk3::Input_::replace(int b, int e, const char* text, int ilen) {
+  int ul, om, op;
+  was_up_down = 0;
+
+  if (b<0) b = 0;
+  if (e<0) e = 0;
+  if (b>size_) b = size_;
+  if (e>size_) e = size_;
+  if (e<b) {int t=b; b=e; e=t;}
+  while (b != e && b > 0 && (size_ - b) > 0 &&
+       (fltk3::utf8len((value_ + b)[0]) < 1)) { b--; }
+  ul = fltk3::utf8len((char)(value_ + e)[0]);
+  while (e < size_ && e > 0 && ul < 0) {
+       e++;
+       ul = fltk3::utf8len((char)(value_ + e)[0]);
+  }
+  if (text && !ilen) ilen = strlen(text);
+  if (e<=b && !ilen) return 0; // don't clobber undo for a null operation
+  if (size_+ilen-(e-b) > maximum_size_) {
+    ilen = maximum_size_-size_+(e-b);
+    if (ilen < 0) ilen = 0;
+  }
+
+  put_in_buffer(size_+ilen);
+
+  if (e>b) {
+    if (undowidget == this && b == undoat) {
+      undobuffersize(undocut+(e-b));
+      memcpy(undobuffer+undocut, value_+b, e-b);
+      undocut += e-b;
+    } else if (undowidget == this && e == undoat && !undoinsert) {
+      undobuffersize(undocut+(e-b));
+      memmove(undobuffer+(e-b), undobuffer, undocut);
+      memcpy(undobuffer, value_+b, e-b);
+      undocut += e-b;
+    } else if (undowidget == this && e == undoat && (e-b)<undoinsert) {
+      undoinsert -= e-b;
+    } else {
+      undobuffersize(e-b);
+      memcpy(undobuffer, value_+b, e-b);
+      undocut = e-b;
+      undoinsert = 0;
+    }
+    memmove(buffer+b, buffer+e, size_-e+1);
+    size_ -= e-b;
+    undowidget = this;
+    undoat = b;
+    if (input_type() == fltk3::SECRET_INPUT) yankcut = 0; else yankcut = undocut;
+  }
+
+  if (ilen) {
+    if (undowidget == this && b == undoat)
+      undoinsert += ilen;
+    else {
+      undocut = 0;
+      undoinsert = ilen;
+    }
+    memmove(buffer+b+ilen, buffer+b, size_-b+1);
+    memcpy(buffer+b, text, ilen);
+    size_ += ilen;
+  }
+  undowidget = this;
+  om = mark_;
+  op = position_;
+  mark_ = position_ = undoat = b+ilen;
+
+  // Insertions into the word at the end of the line will cause it to
+  // wrap to the next line, so we must indicate that the changes may start
+  // right after the whitespace before the current word.  This will
+  // result in sub-optimal update when such wrapping does not happen
+  // but it is too hard to figure out for now...
+  if (wrap()) {
+    // if there is a space in the pasted text, the whole line may have rewrapped
+    int i;
+    for (i=0; i<ilen; i++)
+      if (text[i]==' ') break;
+    if (i==ilen)
+      while (b > 0 && !isspace(index(b) & 255) && index(b)!='\n') b--;
+    else
+      while (b > 0 && index(b)!='\n') b--;
+  }
+
+  // make sure we redraw the old selection or cursor:
+  if (om < b) b = om;
+  if (op < b) b = op;
+
+  minimal_update(b);
+
+  mark_ = position_ = undoat;
+
+  set_changed();
+  if (when()&fltk3::WHEN_CHANGED) do_callback();
+  return 1;
+}
+
+/**
+  Undoes previous changes to the text buffer.
+
+  This call undoes a number of previous calls to replace().
+
+  \return non-zero if any change was made.
+*/
+int fltk3::Input_::undo() {
+  was_up_down = 0;
+  if ( undowidget != this || (!undocut && !undoinsert) ) return 0;
+
+  int ilen = undocut;
+  int xlen = undoinsert;
+  int b = undoat-xlen;
+  int b1 = b;
+
+  put_in_buffer(size_+ilen);
+
+  if (ilen) {
+    memmove(buffer+b+ilen, buffer+b, size_-b+1);
+    memcpy(buffer+b, undobuffer, ilen);
+    size_ += ilen;
+    b += ilen;
+  }
+
+  if (xlen) {
+    undobuffersize(xlen);
+    memcpy(undobuffer, buffer+b, xlen);
+    memmove(buffer+b, buffer+b+xlen, size_-xlen-b+1);
+    size_ -= xlen;
+  }
+
+  undocut = xlen;
+  if (xlen) yankcut = xlen;
+  undoinsert = ilen;
+  undoat = b;
+  mark_ = b /* -ilen */;
+  position_ = b;
+
+  if (wrap())
+    while (b1 > 0 && index(b1)!='\n') b1--;
+  minimal_update(b1);
+  set_changed();
+  if (when()&fltk3::WHEN_CHANGED) do_callback();
+  return 1;
+}
+
+/**
+  Copies the \e yank buffer to the clipboard.
+
+  This method copies all the previous contiguous cuts from the undo
+  information to the clipboard. This function implements 
+  the \c ^K shortcut key.
+
+  \return 0 if the operation did not change the clipboard
+  \see copy(int), cut()
+*/
+int fltk3::Input_::copy_cuts() {
+  // put the yank buffer into the X clipboard
+  if (!yankcut || input_type()==fltk3::SECRET_INPUT) return 0;
+  fltk3::copy(undobuffer, yankcut, 1);
+  return 1;
+}
+
+/** \internal
+  Checks the when() field and does a callback if indicated.
+*/
+void fltk3::Input_::maybe_do_callback() {
+  if (changed() || (when()&fltk3::WHEN_NOT_CHANGED)) {
+    do_callback();
+  }
+}
+
+/** 
+  Handles all kinds of text field related events.
+
+  This is called by derived classes.
+  \todo Add comment and parameters
+*/
+int fltk3::Input_::handletext(int event, int X, int Y, int W, int H) {
+  switch (event) {
+
+  case fltk3::ENTER:
+  case fltk3::MOVE:
+    if (active_r() && window()) window()->cursor(fltk3::CURSOR_INSERT);
+    return 1;
+
+  case fltk3::LEAVE:
+    if (active_r() && window()) window()->cursor(fltk3::CURSOR_DEFAULT);
+    return 1;
+
+  case fltk3::FOCUS:
+    fltk3::set_spot(textfont(), textsize(), x(), y(), w(), h(), window());
+    if (mark_ == position_) {
+      minimal_update(size()+1);
+    } else //if (fltk3::selection_owner() != this)
+      minimal_update(mark_, position_);
+    return 1;
+
+  case fltk3::UNFOCUS:
+    if (active_r() && window()) window()->cursor(fltk3::CURSOR_DEFAULT);
+    if (mark_ == position_) {
+      if (!(damage()&fltk3::DAMAGE_EXPOSE)) {minimal_update(position_); erase_cursor_only = 1;}
+    } else //if (fltk3::selection_owner() != this)
+      minimal_update(mark_, position_);
+  case fltk3::HIDE:
+    fltk3::reset_spot();
+    if (!readonly() && (when() & fltk3::WHEN_RELEASE))
+      maybe_do_callback();
+    return 1;
+
+  case fltk3::PUSH:
+      
+    if (active_r() && window()) window()->cursor(fltk3::CURSOR_INSERT);
+
+    handle_mouse(X, Y, W, H, fltk3::event_state(fltk3::SHIFT));
+
+    if (fltk3::focus() != this) {
+      fltk3::focus(this);
+      handle(fltk3::FOCUS);
+    }
+    return 1;
+
+  case fltk3::DRAG:
+    handle_mouse(X, Y, W, H, 1);
+    return 1;
+
+  case fltk3::RELEASE:
+    copy(0);
+    return 1;
+
+  case fltk3::PASTE: {
+    // Don't allow pastes into readonly widgets...
+    if (readonly()) {
+      fltk3::beep(fltk3::BEEP_ERROR);
+      return 1;
+    }
+
+    // See if we have anything to paste...
+    if (!fltk3::event_text() || !fltk3::event_length()) return 1;
+
+    // strip trailing control characters and spaces before pasting:
+    const char* t = fltk3::event_text();
+    const char* e = t+fltk3::event_length();
+    if (input_type() != fltk3::MULTILINE_INPUT) while (e > t && isspace(*(e-1) & 255)) e--;
+    if (!t || e <= t) return 1; // Int/float stuff will crash without this test
+    if (input_type() == fltk3::INT_INPUT) {
+      while (isspace(*t & 255) && t < e) t ++;
+      const char *p = t;
+      if (*p == '+' || *p == '-') p ++;
+      if (strncmp(p, "0x", 2) == 0) {
+        p += 2;
+        while (isxdigit(*p & 255) && p < e) p ++;
+      } else {
+        while (isdigit(*p & 255) && p < e) p ++;
+      }
+      if (p < e) {
+        fltk3::beep(fltk3::BEEP_ERROR);
+        return 1;
+      } else return replace(0, size(), t, e - t);
+    } else if (input_type() == fltk3::FLOAT_INPUT) {
+      while (isspace(*t & 255) && t < e) t ++;
+      const char *p = t;
+      if (*p == '+' || *p == '-') p ++;
+      while (isdigit(*p & 255) && p < e) p ++;
+      if (*p == '.') {
+        p ++;
+        while (isdigit(*p & 255) && p < e) p ++;
+	if (*p == 'e' || *p == 'E') {
+	  p ++;
+	  if (*p == '+' || *p == '-') p ++;
+	  while (isdigit(*p & 255) && p < e) p ++;
+	}
+      }
+      if (p < e) {
+        fltk3::beep(fltk3::BEEP_ERROR);
+        return 1;
+      } else return replace(0, size(), t, e - t);
+    }
+    return replace(position(), mark(), t, e-t);}
+
+  case fltk3::SHORTCUT:
+    if (!(shortcut() ? fltk3::test_shortcut(shortcut()) : test_shortcut())) 
+      return 0;
+    if (fltk3::visible_focus() && handle(fltk3::FOCUS)) {
+      fltk3::focus(this);
+      return 1;
+    } // else fall through
+
+  default:
+    return 0;
+  }
+}
+
+/*------------------------------*/
+
+/**
+  Creates a new fltk3::Input_ widget.
+
+  This function creates a new fltk3::Input_ widget and adds it to the current
+  fltk3::Group. The value() is set to \c NULL.
+  The default boxtype is \c fltk3::DOWN_BOX.
+
+  \param X, Y, W, H the dimensions of the new widget
+  \param l an optional label text
+*/
+fltk3::Input_::Input_(int X, int Y, int W, int H, const char* l)
+: fltk3::Widget(X, Y, W, H, l) {
+  box(fltk3::DOWN_BOX);
+  color(fltk3::BACKGROUND2_COLOR, fltk3::SELECTION_COLOR);
+  align(fltk3::ALIGN_LEFT);
+  textsize(fltk3::NORMAL_SIZE);
+  textfont(fltk3::HELVETICA);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  cursor_color_ = fltk3::FOREGROUND_COLOR; // was fltk3::BLUE
+  mark_ = position_ = size_ = 0;
+  bufsize = 0;
+  buffer  = 0;
+  value_ = "";
+  xscroll_ = yscroll_ = 0;
+  maximum_size_ = 32767;
+  shortcut_ = 0;
+  set_flag(SHORTCUT_LABEL);
+  tab_nav(1);
+}
+
+/**
+ Copies the value from a possibly static entry into the internal buffer.
+
+ \param [in] len size of the current text
+*/
+void fltk3::Input_::put_in_buffer(int len) {
+  if (value_ == buffer && bufsize > len) {
+    buffer[size_] = 0;
+    return;
+  }
+  if (!bufsize) {
+    if (len > size_) len += 9; // let a few characters insert before realloc
+    bufsize = len+1; 
+    buffer = (char*)malloc(bufsize);
+  } else if (bufsize <= len) {
+    // we may need to move old value in case it points into buffer:
+    int moveit = (value_ >= buffer && value_ < buffer+bufsize);
+    // enlarge current buffer
+    if (len > size_) {
+      do {bufsize *= 2;} while (bufsize <= len);
+    } else {
+      bufsize = len+1;
+    }
+    // Note: the following code is equivalent to:
+    //
+    //   if (moveit) value_ = value_ - buffer;
+    //   char* nbuffer = (char*)realloc(buffer, bufsize);
+    //   if (moveit) value_ = value_ + nbuffer;
+    //   buffer = nbuffer;
+    //
+    // We just optimized the pointer arithmetic for value_...
+    //
+    char* nbuffer = (char*)realloc(buffer, bufsize);
+    if (moveit) value_ += (nbuffer-buffer);
+    buffer = nbuffer;
+  }
+  memmove(buffer, value_, size_); buffer[size_] = 0;
+  value_ = buffer;
+}
+
+/**
+  Changes the widget text.
+
+  This function changes the text and sets the mark and the point to 
+  the end of it. The string is \e not copied. If the user edits the
+  string it is copied to the internal buffer then. This can save a
+  great deal of time and memory if your program is rapidly
+  changing the values of text fields, but this will only work if
+  the passed string remains unchanged until either the
+  fltk3::Input is destroyed or value() is called again.
+
+  You can use the \p len parameter to directly set the length
+  if you know it already or want to put \c nul characters in the text.
+
+  \param [in] str the new text 
+  \param [in] len the length of the new text
+  \return non-zero if the new value is different than the current one
+*/
+int fltk3::Input_::static_value(const char* str, int len) {
+  clear_changed();
+  if (undowidget == this) undowidget = 0;
+  if (str == value_ && len == size_) return 0;
+  if (len) { // non-empty new value:
+    if (xscroll_ || yscroll_) {
+      xscroll_ = yscroll_ = 0;
+      minimal_update(0);
+    } else {
+      int i = 0;
+      // find first different character:
+      if (value_) {
+	for (; i<size_ && i<len && str[i]==value_[i]; i++);
+	if (i==size_ && i==len) return 0;
+      }
+      minimal_update(i);
+    }
+    value_ = str;
+    size_ = len;
+  } else { // empty new value:
+    if (!size_) return 0; // both old and new are empty.
+    size_ = 0;
+    value_ = "";
+    xscroll_ = yscroll_ = 0;
+    minimal_update(0);
+  }
+  position(readonly() ? 0 : size());
+  return 1;
+}
+
+/**
+  Changes the widget text.
+
+  This function changes the text and sets the mark and the point to 
+  the end of it. The string is \e not copied. If the user edits the
+  string it is copied to the internal buffer then. This can save a
+  great deal of time and memory if your program is rapidly
+  changing the values of text fields, but this will only work if
+  the passed string remains unchanged until either the
+  fltk3::Input is destroyed or value() is called again.
+
+  \param [in] str the new text 
+  \return non-zero if the new value is different than the current one
+*/
+int fltk3::Input_::static_value(const char* str) {
+  return static_value(str, str ? strlen(str) : 0);
+}
+
+/**
+  Changes the widget text.
+
+  This function changes the text and sets the mark and the
+  point to the end of it. The string is copied to the internal
+  buffer. Passing \c NULL is the same as "". 
+
+  You can use the \p length parameter to directly set the length
+  if you know it already or want to put \c nul characters in the text.
+
+  \param [in] str the new text 
+  \param [in] len the length of the new text
+  \return non-zero if the new value is different than the current one
+  \see fltk3::Input_::value(const char* str), fltk3::Input_::value()
+*/
+int fltk3::Input_::value(const char* str, int len) {
+  int r = static_value(str, len);
+  if (len) put_in_buffer(len);
+  return r;
+}
+
+/** 
+  Changes the widget text.
+
+  This function changes the text and sets the mark and the
+  point to the end of it. The string is copied to the internal
+  buffer. Passing \c NULL is the same as \c "". 
+
+  \param [in] str the new text 
+  \return non-zero if the new value is different than the current one
+  \see fltk3::Input_::value(const char* str, int len), fltk3::Input_::value()
+*/
+int fltk3::Input_::value(const char* str) {
+  return value(str, str ? strlen(str) : 0);
+}
+
+/**
+  Changes the size of the widget.
+  This call updates the text layout so that the cursor is visible.
+  \param [in] X, Y, W, H new size of the widget
+  \see fltk3::Widget::resize(int, int, int, int)
+*/
+void fltk3::Input_::resize(int X, int Y, int W, int H) {
+  if (W != w()) xscroll_ = 0;
+  if (H != h()) yscroll_ = 0;
+  Widget::resize(X, Y, W, H);
+}
+
+/**
+  Destroys the widget.
+
+  The destructor clears all allocated buffers and removes the widget
+  from the parent fltk3::Group.
+*/
+fltk3::Input_::~Input_() {
+  if (undowidget == this) undowidget = 0;
+  if (bufsize) free((void*)buffer);
+}
+
+/** \internal
+  Returns the number of lines displayed on a single page.
+  \return widget height divided by the font height
+*/
+int fltk3::Input_::linesPerPage() {
+  int n = 1;
+  if (input_type() == fltk3::MULTILINE_INPUT) {
+    fltk3::font(textfont(),textsize()); //ensure current font is set to ours
+    n = h()/fltk3::height(); // number of lines to scroll
+    if (n<=0) n = 1;
+  }
+  return n;
+}
+
+/**
+  Returns the character at index \p i.
+
+  This function returns the UTF-8 character at \p i 
+  as a ucs4 character code.
+
+  \param [in] i index into the value field
+  \return the character at index \p i
+*/
+unsigned int fltk3::Input_::index(int i) const 
+{
+  int len = 0;
+  return fltk3::utf8decode(value_+i, value_+size_, &len);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/LightButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Light_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/LightButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/LightButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,182 @@
+//
+// "$Id$"
+//
+// Lighted button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Subclass of fltk3::Button where the "box" indicates whether it is
+// pushed or not, and the "down box" is drawn small and square on
+// the left to indicate the current state.
+
+// The default down_box of zero draws a rectangle designed to look
+// just like Flame's buttons.
+
+#include <fltk3/run.h>
+#include <fltk3/LightButton.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+
+void fltk3::LightButton::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  fltk3::Color col;
+  if (this==fltk3::pushed()) {
+    col = fltk3::color_average(fltk3::BLACK, color(), 0.2f);
+  } else {
+    col = color();
+  }
+  if (box()) draw_box(this==fltk3::pushed() ? fltk3::down(box()) : box(), col);
+  col = value() ? (active_r() ? selection_color() :
+                            fltk3::inactive(selection_color())) : color();
+  int W;
+  int dx, dy;
+
+  W  = labelsize();
+  dx = fltk3::box_dx(box()) + 2;
+  dy = (h() - W) / 2;
+  // if (dy < 0) dy = 0;         // neg. offset o.k. for vertical centering
+
+  if (down_box()) {
+    // draw other down_box() styles:
+    switch (down_box()) {
+      case fltk3::DOWN_BOX :
+      case fltk3::UP_BOX :
+      case fltk3::PLASTIC_DOWN_BOX :
+      case fltk3::PLASTIC_UP_BOX :
+        // Check box...
+        draw_box(down_box(), x()+dx, y()+dy, W, W, fltk3::BACKGROUND2_COLOR);
+	if (value()) {
+	  if (!fltk3::scheme()) {
+	    fltk3::color(fltk3::SELECTION_COLOR);
+	  } else {
+	    fltk3::color(col);
+	  }
+	  int tx = x() + dx + 3;
+	  int tw = W - 6;
+	  int d1 = tw/3;
+	  int d2 = tw-d1;
+	  int ty = y() + dy + (W+d2)/2-d1-2;
+	  for (int n = 0; n < 3; n++, ty++) {
+	    fltk3::line(tx, ty, tx+d1, ty+d1);
+	    fltk3::line(tx+d1, ty+d1, tx+tw-1, ty+d1-d2+1);
+	  }
+	}
+        break;
+      case fltk3::ROUND_DOWN_BOX :
+      case fltk3::ROUND_UP_BOX :
+        // Radio button...
+        draw_box(down_box(), x()+dx, y()+dy, W, W, fltk3::BACKGROUND2_COLOR);
+	if (value()) {
+	  int tW = (W - fltk3::box_dw(down_box())) / 2 + 1;
+	  if ((W - tW) & 1) tW++; // Make sure difference is even to center
+	  int tdx = dx + (W - tW) / 2;
+	  int tdy = dy + (W - tW) / 2;
+
+	  if (!fltk3::scheme()) {
+	    fltk3::color(fltk3::SELECTION_COLOR);
+	    tW --;
+	    fltk3::pie(x() + tdx - 1, y() + tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
+	    fltk3::arc(x() + tdx - 1, y() + tdy - 1, tW + 3, tW + 3, 0.0, 360.0);
+	    fltk3::color(fltk3::color_average(fltk3::WHITE, fltk3::SELECTION_COLOR, 0.2f));
+	  } else fltk3::color(col);
+
+	  switch (tW) {
+	    // Larger circles draw fine...
+	    default :
+              fltk3::pie(x() + tdx, y() + tdy, tW, tW, 0.0, 360.0);
+	      break;
+
+            // Small circles don't draw well on many systems...
+	    case 6 :
+	      fltk3::rectf(x() + tdx + 2, y() + tdy, tW - 4, tW);
+	      fltk3::rectf(x() + tdx + 1, y() + tdy + 1, tW - 2, tW - 2);
+	      fltk3::rectf(x() + tdx, y() + tdy + 2, tW, tW - 4);
+	      break;
+
+	    case 5 :
+	    case 4 :
+	    case 3 :
+	      fltk3::rectf(x() + tdx + 1, y() + tdy, tW - 2, tW);
+	      fltk3::rectf(x() + tdx, y() + tdy + 1, tW, tW - 2);
+	      break;
+
+	    case 2 :
+	    case 1 :
+	      fltk3::rectf(x() + tdx, y() + tdy, tW, tW);
+	      break;
+	  }
+
+	  if (!fltk3::scheme()) {
+	    fltk3::color(fltk3::color_average(fltk3::WHITE, fltk3::SELECTION_COLOR, 0.5));
+	    fltk3::arc(x() + tdx, y() + tdy, tW + 1, tW + 1, 60.0, 180.0);
+	  }
+	}
+        break;
+      default :
+        draw_box(down_box(), x()+dx, y()+dy, W, W, col);
+        break;
+    }
+  } else {
+    // if down_box() is zero, draw light button style:
+    int hh = h()-2*dy - 2;
+    int ww = W/2+1;
+    int xx = dx;
+    if (w()<ww+2*xx) xx = (w()-ww)/2;
+    if (fltk3::scheme() && !strcmp(fltk3::scheme(), "plastic")) {
+      col = active_r() ? selection_color() : fltk3::inactive(selection_color());
+      fltk3::color(value() ? col : fltk3::color_average(col, fltk3::BLACK, 0.5f));
+      fltk3::pie(x()+xx, y()+dy+1, ww, hh, 0, 360);
+    } else {
+      draw_box(fltk3::THIN_DOWN_BOX, x()+xx, y()+dy+1, ww, hh, col);
+    }
+    dx = (ww + 2 * dx - W) / 2;
+  }
+  draw_label(x()+W+2*dx, y(), w()-W-2*dx, h());
+  if (fltk3::focus() == this) draw_focus();
+}
+
+int fltk3::LightButton::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  switch (event) {
+  case fltk3::RELEASE:
+    if (box()) redraw();
+  default:
+    return Button::handle(event);
+  }
+}
+
+/**
+  Creates a new fltk3::LightButton widget using the given
+  position, size, and label string.
+  <P>The destructor deletes the check button.
+*/
+fltk3::LightButton::LightButton(int X, int Y, int W, int H, const char* l)
+: fltk3::Button(X, Y, W, H, l) {
+  type(fltk3::TOGGLE_BUTTON);
+  selection_color(fltk3::YELLOW);
+  align(fltk3::ALIGN_LEFT|fltk3::ALIGN_INSIDE);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Menu.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Menu.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Menu.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1060 @@
+//
+// "$Id$"
+//
+// Menu code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Warning: this menu code is quite a mess!
+
+// This file contains code for implementing fltk3::MenuItem, and for
+// methods for bringing up popup menu hierarchies without using the
+// fltk3::Menu_ widget.
+
+#include <fltk3/run.h>
+#include <fltk3/MenuWindow.h>
+#include <fltk3/Menu_.h>
+#include <fltk3/draw.h>
+#include <stdio.h>
+#include "flstring.h"
+
+/** Size of the menu starting from this menu item */
+int fltk3::MenuItem::size() const {
+  const fltk3::MenuItem* m = this;
+  int nest = 0;
+  for (;;) {
+    if (!m->text) {
+      if (!nest) return (m-this+1);
+      nest--;
+    } else if (m->flags & fltk3::SUBMENU) {
+      nest++;
+    }
+    m++;
+  }
+}
+
+// Advance a pointer to next visible or invisible item of a menu array, 
+// skipping the contents of submenus.
+static const fltk3::MenuItem* next_visible_or_not(const fltk3::MenuItem* m) {
+  int nest = 0;
+  do {
+    if (!m->text) {
+      if (!nest) return m;
+      nest--;
+    } else if (m->flags&fltk3::SUBMENU) {
+      nest++;
+    }
+    m++;
+  }
+  while (nest);
+  return m;
+}
+
+/**
+  Advance a pointer by n items through a menu array, skipping
+  the contents of submenus and invisible items.  There are two calls so
+  that you can advance through const and non-const data.
+*/
+const fltk3::MenuItem* fltk3::MenuItem::next(int n) const {
+  if (n < 0) return 0; // this is so selected==-1 returns NULL
+  const fltk3::MenuItem* m = this;
+  if (!m->visible()) n++;
+  while (n) {
+    m = next_visible_or_not(m);
+    if (m->visible() || !m->text) n--;
+  }
+  return m;
+}
+
+// appearance of current menus are pulled from this parent widget:
+static const fltk3::Menu_* button=0;
+
+////////////////////////////////////////////////////////////////
+
+// tiny window for title of menu:
+class menutitle : public fltk3::MenuWindow {
+  void draw();
+public:
+  const fltk3::MenuItem* menu;
+  menutitle(int X, int Y, int W, int H, const fltk3::MenuItem*);
+};
+
+// each vertical menu has one of these:
+class menuwindow : public fltk3::MenuWindow {
+  void draw();
+  void drawentry(const fltk3::MenuItem*, int i, int erase);
+public:
+  menutitle* title;
+  int handle(int);
+#if defined (__APPLE__) || defined (USE_X11)
+  int early_hide_handle(int);
+#endif
+  int itemheight;	// zero == menubar
+  int numitems;
+  int selected;
+  int drawn_selected;	// last redraw has this selected
+  int shortcutWidth;
+  const fltk3::MenuItem* menu;
+  menuwindow(const fltk3::MenuItem* m, int X, int Y, int W, int H,
+	     const fltk3::MenuItem* picked, const fltk3::MenuItem* title,
+	     int menubar = 0, int menubar_title = 0, int right_edge = 0);
+  ~menuwindow();
+  void set_selected(int);
+  int find_selected(int mx, int my);
+  int titlex(int);
+  void autoscroll(int);
+  void position(int x, int y);
+  int is_inside(int x, int y);
+};
+
+#define LEADING 4 // extra vertical leading
+
+extern char fltk3::draw_shortcut;
+
+/** 
+  Measures width of label, including effect of & characters. 
+  Optionally, can get height if hp is not NULL. 
+*/
+int fltk3::MenuItem::measure(int* hp, const fltk3::Menu_* m) const {
+  fltk3::Label l;
+  l.value   = text;
+  l.image   = 0;
+  l.deimage = 0;
+  l.type    = labeltype_;
+  l.font    = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : fltk3::HELVETICA);
+  l.size    = labelsize_ ? labelsize_ : m ? m->textsize() : fltk3::NORMAL_SIZE;
+  l.color   = fltk3::FOREGROUND_COLOR; // this makes no difference?
+  fltk3::draw_shortcut = 1;
+  int w = 0; int h = 0;
+  l.measure(w, hp ? *hp : h);
+  fltk3::draw_shortcut = 0;
+  if (flags & (fltk3::MENU_TOGGLE|fltk3::MENU_RADIO)) w += 14;
+  return w;
+}
+
+/** Draws the menu item in bounding box x,y,w,h, optionally selects the item. */
+void fltk3::MenuItem::draw(int x, int y, int w, int h, const fltk3::Menu_* m,
+			int selected) const {
+  fltk3::Label l;
+  l.value   = text;
+  l.image   = 0;
+  l.deimage = 0;
+  l.type    = labeltype_;
+  l.font    = labelsize_ || labelfont_ ? labelfont_ : (m ? m->textfont() : fltk3::HELVETICA);
+  l.size    = labelsize_ ? labelsize_ : m ? m->textsize() : fltk3::NORMAL_SIZE;
+  l.color   = labelcolor_ ? labelcolor_ : m ? m->textcolor() : int(fltk3::FOREGROUND_COLOR);
+  if (!active()) l.color = fltk3::inactive((fltk3::Color)l.color);
+  fltk3::Color color = m ? m->color() : fltk3::GRAY;
+  if (selected) {
+    fltk3::Color r = m ? m->selection_color() : fltk3::SELECTION_COLOR;
+    fltk3::Boxtype b = m && m->down_box() ? m->down_box() : fltk3::FLAT_BOX;
+    if (fltk3::contrast(r,color)!=r) { // back compatibility boxtypes
+      if (selected == 2) { // menu title
+	r = color;
+	b = m ? m->box() : fltk3::UP_BOX;
+      } else {
+	r = (fltk3::Color)(fltk3::COLOR_CUBE-1); // white
+	l.color = fltk3::contrast((fltk3::Color)labelcolor_, r);
+      }
+    } else {
+      l.color = fltk3::contrast((fltk3::Color)labelcolor_, r);
+    }
+    if (selected == 2) { // menu title
+      fltk3::draw_box(b, x, y, w, h, r);
+      x += 3;
+      w -= 8;
+    } else {
+      fltk3::draw_box(b, x+1, y-(LEADING-2)/2, w-2, h+(LEADING-2), r);
+    }
+  }
+
+  if (flags & (fltk3::MENU_TOGGLE|fltk3::MENU_RADIO)) {
+    int d = (h - fltk3::NORMAL_SIZE + 1) / 2;
+    int W = h - 2 * d;
+
+    if (flags & fltk3::MENU_RADIO) {
+      fltk3::draw_box(fltk3::ROUND_DOWN_BOX, x+2, y+d, W, W, fltk3::BACKGROUND2_COLOR);
+      if (value()) {
+	int tW = (W - fltk3::box_dw(fltk3::ROUND_DOWN_BOX)) / 2 + 1;
+	if ((W - tW) & 1) tW++;	// Make sure difference is even to center
+	int td = fltk3::box_dx(fltk3::ROUND_DOWN_BOX) + 1;
+        if (!fltk3::scheme() || !strcmp(fltk3::scheme(), "classic")) {
+	  // Offset the radio circle...
+	  td ++;
+
+	  if (!fltk3::scheme()) {
+	    fltk3::color(fltk3::SELECTION_COLOR);
+	    tW --;
+	    fltk3::pie(x + td + 1, y + d + td - 1, tW + 3, tW + 3, 0.0, 360.0);
+	    fltk3::arc(x + td + 1, y + d + td - 1, tW + 3, tW + 3, 0.0, 360.0);
+	    fltk3::color(fltk3::color_average(fltk3::WHITE, fltk3::SELECTION_COLOR, 0.2f));
+	  } else fltk3::color(labelcolor_);
+	} else fltk3::color(labelcolor_);
+
+	switch (tW) {
+	  // Larger circles draw fine...
+	  default :
+            fltk3::pie(x + td + 2, y + d + td, tW, tW, 0.0, 360.0);
+	    break;
+
+          // Small circles don't draw well on many systems...
+	  case 6 :
+	    fltk3::rectf(x + td + 4, y + d + td, tW - 4, tW);
+	    fltk3::rectf(x + td + 3, y + d + td + 1, tW - 2, tW - 2);
+	    fltk3::rectf(x + td + 2, y + d + td + 2, tW, tW - 4);
+	    break;
+
+	  case 5 :
+	  case 4 :
+	  case 3 :
+	    fltk3::rectf(x + td + 3, y + d + td, tW - 2, tW);
+	    fltk3::rectf(x + td + 2, y + d + td + 1, tW, tW - 2);
+	    break;
+
+	  case 2 :
+	  case 1 :
+	    fltk3::rectf(x + td + 2, y + d + td, tW, tW);
+	    break;
+	}
+
+	if (!fltk3::scheme()) {
+	  fltk3::color(fltk3::color_average(fltk3::WHITE, fltk3::SELECTION_COLOR, 0.5));
+	  fltk3::arc(x + td + 2, y + d + td, tW + 1, tW + 1, 60.0, 180.0);
+	}
+      }
+    } else {
+      fltk3::draw_box(fltk3::DOWN_BOX, x+2, y+d, W, W, fltk3::BACKGROUND2_COLOR);
+      if (value()) {
+	if (!fltk3::scheme()) {
+	  fltk3::color(fltk3::SELECTION_COLOR);
+	} else {
+	  fltk3::color(labelcolor_);
+	}
+	int tx = x + 5;
+	int tw = W - 6;
+	int d1 = tw/3;
+	int d2 = tw-d1;
+	int ty = y + d + (W+d2)/2-d1-2;
+	for (int n = 0; n < 3; n++, ty++) {
+	  fltk3::line(tx, ty, tx+d1, ty+d1);
+	  fltk3::line(tx+d1, ty+d1, tx+tw-1, ty+d1-d2+1);
+	}
+      }
+    }
+    x += W + 3;
+    w -= W + 3;
+  }
+
+  if (!fltk3::draw_shortcut) fltk3::draw_shortcut = 1;
+  l.draw(x+3, y, w>6 ? w-6 : 0, h, fltk3::ALIGN_LEFT);
+  fltk3::draw_shortcut = 0;
+}
+
+menutitle::menutitle(int X, int Y, int W, int H, const fltk3::MenuItem* L) :
+  fltk3::MenuWindow(X, Y, W, H, 0) {
+  end();
+  set_modal();
+  clear_border();
+  set_menu_window();
+  menu = L;
+  if (L->labelcolor_ || fltk3::scheme() || L->labeltype_ > fltk3::NO_LABEL) clear_overlay();
+}
+
+menuwindow::menuwindow(const fltk3::MenuItem* m, int X, int Y, int Wp, int Hp,
+		       const fltk3::MenuItem* picked, const fltk3::MenuItem* t, 
+		       int menubar, int menubar_title, int right_edge)
+  : fltk3::MenuWindow(X, Y, Wp, Hp, 0)
+{
+  int scr_x, scr_y, scr_w, scr_h;
+  int tx = X, ty = Y;
+
+  fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+  if (!right_edge || right_edge > scr_x+scr_w) right_edge = scr_x+scr_w;
+
+  end();
+  set_modal();
+  clear_border();
+  set_menu_window();
+  menu = m;
+  if (m) m = m->first(); // find the first item that needs to be rendered
+  drawn_selected = -1;
+  if (button) {
+    box(button->box());
+    if (box() == fltk3::NO_BOX || box() == fltk3::FLAT_BOX) box(fltk3::UP_BOX);
+  } else {
+    box(fltk3::UP_BOX);
+  }
+  color(button && !fltk3::scheme() ? button->color() : fltk3::GRAY);
+  selected = -1;
+  {
+    int j = 0;
+    if (m) for (const fltk3::MenuItem* m1=m; ; m1 = m1->next(), j++) {
+      if (picked) {
+        if (m1 == picked) {selected = j; picked = 0;}
+        else if (m1 > picked) {selected = j-1; picked = 0; Wp = Hp = 0;}
+    }
+    if (!m1->text) break;
+  }
+  numitems = j;}
+
+  if (menubar) {
+    itemheight = 0;
+    title = 0;
+    return;
+  }
+
+  itemheight = 1;
+
+  int hotKeysw = 0;
+  int hotModsw = 0;
+  int Wtitle = 0;
+  int Htitle = 0;
+  if (t) Wtitle = t->measure(&Htitle, button) + 12;
+  int W = 0;
+  if (m) for (; m->text; m = m->next()) {
+    int hh; 
+    int w1 = m->measure(&hh, button);
+    if (hh+LEADING>itemheight) itemheight = hh+LEADING;
+    if (m->flags&(fltk3::SUBMENU|fltk3::SUBMENU_POINTER)) w1 += 14;
+    if (w1 > W) W = w1;
+    // calculate the maximum width of all shortcuts
+    if (m->shortcut_) {
+      // s is a pointerto the utf8 string for the entire shortcut
+      // k points only to the key part (minus the modifier keys)
+      const char *k, *s = fltk3::shortcut_label(m->shortcut_, &k);
+      if (fltk3::utf_nb_char((const unsigned char*)k, strlen(k))<=4) {
+        // a regular shortcut has a right-justified modifier followed by a left-justified key
+        w1 = int(fltk3::width(s, k-s));
+        if (w1 > hotModsw) hotModsw = w1;
+        w1 = int(fltk3::width(k))+4;
+        if (w1 > hotKeysw) hotKeysw = w1;
+      } else {
+        // a shortcut with a long modifier is right-justified to the menu
+        w1 = int(fltk3::width(s))+4;
+        if (w1 > (hotModsw+hotKeysw)) {
+          hotModsw = w1-hotKeysw;
+        }
+      }
+    }
+    if (m->labelcolor_ || fltk3::scheme() || m->labeltype_ > fltk3::NO_LABEL) clear_overlay();
+  }
+  shortcutWidth = hotKeysw;
+  if (selected >= 0 && !Wp) X -= W/2;
+  int BW = fltk3::box_dx(box());
+  W += hotKeysw+hotModsw+2*BW+7;
+  if (Wp > W) W = Wp;
+  if (Wtitle > W) W = Wtitle;
+
+  if (X < scr_x) X = scr_x; if (X > scr_x+scr_w-W) X = right_edge-W; //X= scr_x+scr_w-W;
+  x(X); w(W);
+  h((numitems ? itemheight*numitems-LEADING : 0)+2*BW+3);
+  if (selected >= 0) {
+    Y = Y+(Hp-itemheight)/2-selected*itemheight-BW;
+  } else {
+    Y = Y+Hp;
+    // if the menu hits the bottom of the screen, we try to draw
+    // it above the menubar instead. We will not adjust any menu
+    // that has a selected item.
+    if (Y+h()>scr_y+scr_h && Y-h()>=scr_y) {
+      if (Hp>1) {
+        // if we know the height of the fltk3::Menu_, use it
+        Y = Y-Hp-h();
+      } else if (t) {
+        // assume that the menubar item height relates to the first
+        // menuitem as well
+        Y = Y-itemheight-h()-fltk3::box_dh(box());
+      } else {
+        // draw the menu to the right
+        Y = Y-h()+itemheight+fltk3::box_dy(box());
+      }
+    }
+  }
+  if (m) y(Y); else {y(Y-2); w(1); h(1);}
+
+  if (t) {
+    if (menubar_title) {
+      int dy = fltk3::box_dy(button->box())+1;
+      int ht = button->h()-dy*2;
+      title = new menutitle(tx, ty-ht-dy, Wtitle, ht, t);
+    } else {
+      int dy = 2;
+      int ht = Htitle+2*BW+3;
+      title = new menutitle(X, Y-ht-dy, Wtitle, ht, t);
+    }
+  } else {
+    title = 0;
+  }
+}
+
+menuwindow::~menuwindow() {
+  hide();
+  delete title;
+}
+
+void menuwindow::position(int X, int Y) {
+  if (title) {title->position(X, title->y()+Y-y());}
+  MenuWindow::position(X, Y);
+  // x(X); y(Y); // don't wait for response from X
+}
+
+// scroll so item i is visible on screen
+void menuwindow::autoscroll(int n) {
+  int scr_x, scr_y, scr_w, scr_h;
+  int Y = y()+fltk3::box_dx(box())+2+n*itemheight;
+
+  fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+  if (Y <= scr_y) Y = scr_y-Y+10;
+  else {
+    Y = Y+itemheight-scr_h-scr_y;
+    if (Y < 0) return;
+    Y = -Y-10;
+  }
+  MenuWindow::position(x(), y()+Y);
+  // y(y()+Y); // don't wait for response from X
+}
+
+////////////////////////////////////////////////////////////////
+
+void menuwindow::drawentry(const fltk3::MenuItem* m, int n, int eraseit) {
+  if (!m) return; // this happens if -1 is selected item and redrawn
+
+  int BW = fltk3::box_dx(box());
+  int xx = BW;
+  int W = w();
+  int ww = W-2*BW-1;
+  int yy = BW+1+n*itemheight;
+  int hh = itemheight - LEADING;
+
+  if (eraseit && n != selected) {
+    fltk3::push_clip(xx+1, yy-(LEADING-2)/2, ww-2, hh+(LEADING-2));
+    draw_box(box(), 0, 0, w(), h(), button ? button->color() : color());
+    fltk3::pop_clip();
+  }
+
+  m->draw(xx, yy, ww, hh, button, n==selected);
+
+  // the shortcuts and arrows assume fltk3::color() was left set by draw():
+  if (m->submenu()) {
+    int sz = (hh-7)&-2;
+    int y1 = yy+(hh-sz)/2;
+    int x1 = xx+ww-sz-3;
+    fltk3::polygon(x1+2, y1, x1+2, y1+sz, x1+sz/2+2, y1+sz/2);
+  } else if (m->shortcut_) {
+    fltk3::Font f = m->labelsize_ || m->labelfont_ ? (fltk3::Font)m->labelfont_ :
+                    button ? button->textfont() : fltk3::HELVETICA;
+    fltk3::font(f, m->labelsize_ ? m->labelsize_ :
+                   button ? button->textsize() : fltk3::NORMAL_SIZE);
+    const char *k, *s = fltk3::shortcut_label(m->shortcut_, &k);
+    if (fltk3::utf_nb_char((const unsigned char*)k, strlen(k))<=4) {
+      // righ-align the modifiers and left-align the key
+      char buf[32]; strcpy(buf, s); buf[k-s] = 0;
+      fltk3::draw(buf, xx, yy, ww-shortcutWidth, hh, fltk3::ALIGN_RIGHT);
+      fltk3::draw(  k, xx+ww-shortcutWidth, yy, shortcutWidth, hh, fltk3::ALIGN_LEFT);
+    } else {
+      // right-align to the menu
+      fltk3::draw(s, xx, yy, ww-4, hh, fltk3::ALIGN_RIGHT);
+    }
+  }
+
+  if (m->flags & fltk3::MENU_DIVIDER) {
+    fltk3::color(fltk3::DARK3);
+    fltk3::xyline(BW-1, yy+hh+(LEADING-2)/2, W-2*BW+2);
+    fltk3::color(fltk3::LIGHT3);
+    fltk3::xyline(BW-1, yy+hh+((LEADING-2)/2+1), W-2*BW+2);
+  }
+}
+
+void menutitle::draw() {
+  menu->draw(0, 0, w(), h(), button, 2);
+}
+
+void menuwindow::draw() {
+  if (damage() != fltk3::DAMAGE_CHILD) {	// complete redraw
+    fltk3::draw_box(box(), 0, 0, w(), h(), button ? button->color() : color());
+    if (menu) {
+      const fltk3::MenuItem* m; int j;
+      for (m=menu->first(), j=0; m->text; j++, m = m->next()) drawentry(m, j, 0);
+    }
+  } else {
+    if (damage() & fltk3::DAMAGE_CHILD && selected!=drawn_selected) { // change selection
+      drawentry(menu->next(drawn_selected), drawn_selected, 1);
+      drawentry(menu->next(selected), selected, 1);
+    }
+  }	    
+  drawn_selected = selected;
+}
+
+void menuwindow::set_selected(int n) {
+  if (n != selected) {selected = n; damage(fltk3::DAMAGE_CHILD);}
+}
+
+////////////////////////////////////////////////////////////////
+
+int menuwindow::find_selected(int mx, int my) {
+  if (!menu || !menu->text) return -1;
+  mx -= x();
+  my -= y();
+  if (my < 0 || my >= h()) return -1;
+  if (!itemheight) { // menubar
+    int xx = 3; int n = 0;
+    const fltk3::MenuItem* m = menu ? menu->first() : 0;
+    for (; ; m = m->next(), n++) {
+      if (!m->text) return -1;
+      xx += m->measure(0, button) + 16;
+      if (xx > mx) break;
+    }
+    return n;
+  }
+  if (mx < fltk3::box_dx(box()) || mx >= w()) return -1;
+  int n = (my-fltk3::box_dx(box())-1)/itemheight;
+  if (n < 0 || n>=numitems) return -1;
+  return n;
+}
+
+// return horizontal position for item n in a menubar:
+int menuwindow::titlex(int n) {
+  const fltk3::MenuItem* m;
+  int xx = 3;
+  for (m=menu->first(); n--; m = m->next()) xx += m->measure(0, button) + 16;
+  return xx;
+}
+
+// return 1, if the given root coordinates are inside the window
+int menuwindow::is_inside(int mx, int my) {
+  if ( mx < x_root() || mx >= x_root() + w() ||
+       my < y_root() || my >= y_root() + h()) {
+    return 0;
+  }
+  if (itemheight == 0 && find_selected(mx, my) == -1) {
+    // in the menubar but out from any menu header
+    return 0;
+    }
+  return 1;
+}
+
+////////////////////////////////////////////////////////////////
+// fltk3::MenuItem::popup(...)
+
+// Because fltk3::grab() is done, all events go to one of the menu windows.
+// But the handle method needs to look at all of them to find out
+// what item the user is pointing at.  And it needs a whole lot
+// of other state variables to determine what is going on with
+// the currently displayed menus.
+// So the main loop (handlemenu()) puts all the state in a structure
+// and puts a pointer to it in a static location, so the handle()
+// on menus can refer to it and alter it.  The handle() method
+// changes variables in this state to indicate what item is
+// picked, but does not actually alter the display, instead the
+// main loop does that.  This is because the X mapping and unmapping
+// of windows is slow, and we don't want to fall behind the events.
+
+// values for menustate.state:
+#define INITIAL_STATE 0	// no mouse up or down since popup() called
+#define PUSH_STATE 1	// mouse has been pushed on a normal item
+#define DONE_STATE 2	// exit the popup, the current item was picked
+#define MENU_PUSH_STATE 3 // mouse has been pushed on a menu title
+
+struct menustate {
+  const fltk3::MenuItem* current_item; // what mouse is pointing at
+  int menu_number; // which menu it is in
+  int item_number; // which item in that menu, -1 if none
+  menuwindow* p[20]; // pointers to menus
+  int nummenus;
+  int menubar; // if true p[0] is a menubar
+  int state;
+  menuwindow* fakemenu; // kludge for buttons in menubar
+  int is_inside(int mx, int my);
+};
+static menustate* p=0;
+
+// return 1 if the coordinates are inside any of the menuwindows
+int menustate::is_inside(int mx, int my) {
+  int i;
+  for (i=nummenus-1; i>=0; i--) {
+    if (p[i]->is_inside(mx, my))
+      return 1;
+  }
+  return 0;
+}
+
+static inline void setitem(const fltk3::MenuItem* i, int m, int n) {
+  p->current_item = i;
+  p->menu_number = m;
+  p->item_number = n;
+}
+
+static void setitem(int m, int n) {
+  menustate &pp = *p;
+  pp.current_item = (n >= 0) ? pp.p[m]->menu->next(n) : 0;
+  pp.menu_number = m;
+  pp.item_number = n;
+}
+
+static int forward(int menu) { // go to next item in menu menu if possible
+  menustate &pp = *p;
+  // fltk3::MenuButton can generate menu=-1. This line fixes it and selectes the first item.
+  if (menu==-1) 
+    menu = 0;
+  menuwindow &m = *(pp.p[menu]);
+  int item = (menu == pp.menu_number) ? pp.item_number : m.selected;
+  while (++item < m.numitems) {
+    const fltk3::MenuItem* m1 = m.menu->next(item);
+    if (m1->activevisible()) {setitem(m1, menu, item); return 1;}
+  }
+  return 0;
+}
+
+static int backward(int menu) { // previous item in menu menu if possible
+  menustate &pp = *p;
+  menuwindow &m = *(pp.p[menu]);
+  int item = (menu == pp.menu_number) ? pp.item_number : m.selected;
+  if (item < 0) item = m.numitems;
+  while (--item >= 0) {
+    const fltk3::MenuItem* m1 = m.menu->next(item);
+    if (m1->activevisible()) {setitem(m1, menu, item); return 1;}
+  }
+  return 0;
+}
+
+int menuwindow::handle(int e) {
+#if defined (__APPLE__) || defined (USE_X11)
+  // This off-route takes care of the "detached menu" bug on OS X.
+  // Apple event handler requires that we hide all menu windows right
+  // now, so that Carbon can continue undisturbed with handling window
+  // manager events, like dragging the application window.
+  int ret = early_hide_handle(e);
+  menustate &pp = *p;
+  if (pp.state == DONE_STATE) {
+    hide();
+    if (pp.fakemenu) {
+      pp.fakemenu->hide();
+      if (pp.fakemenu->title)
+        pp.fakemenu->title->hide();
+    }
+    int i = pp.nummenus;
+    while (i>0) {
+      menuwindow *mw = pp.p[--i];
+      if (mw) {
+        mw->hide();
+        if (mw->title) 
+          mw->title->hide();
+      }
+    }
+  }
+  return ret;
+}
+
+int menuwindow::early_hide_handle(int e) {
+#endif
+  menustate &pp = *p;
+  switch (e) {
+  case fltk3::KEYBOARD:
+    switch (fltk3::event_key()) {
+    case fltk3::BackSpaceKey:
+    BACKTAB:
+      if (!backward(pp.menu_number)) {pp.item_number = -1;backward(pp.menu_number);}
+      return 1;
+    case fltk3::UpKey:
+      if (pp.menubar && pp.menu_number == 0) {
+        // Do nothing...
+      } else if (backward(pp.menu_number)) {
+        // Do nothing...
+      } else if (pp.menubar && pp.menu_number==1) {
+        setitem(0, pp.p[0]->selected);
+      }
+      return 1;
+    case fltk3::TabKey:
+      if (fltk3::event_shift()) goto BACKTAB;
+    case fltk3::DownKey:
+      if (pp.menu_number || !pp.menubar) {
+        if (!forward(pp.menu_number) && fltk3::event_key()==fltk3::TabKey) {
+          pp.item_number = -1;
+          forward(pp.menu_number);
+        }
+      } else if (pp.menu_number < pp.nummenus-1) {
+        forward(pp.menu_number+1);
+      }
+      return 1;
+    case fltk3::RightKey:
+      if (pp.menubar && (pp.menu_number<=0 || (pp.menu_number==1 && pp.nummenus==2)))
+	forward(0);
+      else if (pp.menu_number < pp.nummenus-1) forward(pp.menu_number+1);
+      return 1;
+    case fltk3::LeftKey:
+      if (pp.menubar && pp.menu_number<=1) backward(0);
+      else if (pp.menu_number>0)
+	setitem(pp.menu_number-1, pp.p[pp.menu_number-1]->selected);
+      return 1;
+    case fltk3::EnterKey:
+    case fltk3::KPEnterKey:
+    case ' ':
+      pp.state = DONE_STATE;
+      return 1;
+    case fltk3::EscapeKey:
+      setitem(0, -1, 0);
+      pp.state = DONE_STATE;
+      return 1;
+    }
+    break;
+  case fltk3::SHORTCUT: 
+    {
+      for (int mymenu = pp.nummenus; mymenu--;) {
+	menuwindow &mw = *(pp.p[mymenu]);
+	int item; const fltk3::MenuItem* m = mw.menu->find_shortcut(&item);
+	if (m) {
+	  setitem(m, mymenu, item);
+	  if (!m->submenu()) pp.state = DONE_STATE;
+	  return 1;
+	}
+      }
+    }
+    break;
+    case fltk3::MOVE:
+#if ! (defined(WIN32) || defined(__APPLE__))
+      if (pp.state == DONE_STATE) {
+	return 1; // Fix for STR #2619
+      }
+      /* FALLTHROUGH */
+#endif
+  case fltk3::ENTER:
+  case fltk3::PUSH:
+  case fltk3::DRAG:
+    {
+      int mx = fltk3::event_x_root();
+      int my = fltk3::event_y_root();
+      int item=0; int mymenu = pp.nummenus-1;
+      // Clicking or dragging outside menu cancels it...
+      if ((!pp.menubar || mymenu) && !pp.is_inside(mx, my)) {
+	setitem(0, -1, 0);
+	if (e==fltk3::PUSH)
+	  pp.state = DONE_STATE;
+	return 1;
+      }
+      for (mymenu = pp.nummenus-1; ; mymenu--) {
+	item = pp.p[mymenu]->find_selected(mx, my);
+	if (item >= 0) 
+	  break;
+	if (mymenu <= 0) {
+	  // buttons in menubars must be deselected if we move outside of them!
+	  if (pp.menu_number==-1 && e==fltk3::PUSH) {
+	    pp.state = DONE_STATE;
+	    return 1;
+	  }
+	  if (pp.current_item && pp.menu_number==0 && !pp.current_item->submenu()) {
+	    if (e==fltk3::PUSH)
+	      pp.state = DONE_STATE;
+	    setitem(0, -1, 0);
+	    return 1;
+	  }
+	  // all others can stay selected
+	  return 0;
+	}
+      }
+      if (my == 0 && item > 0) setitem(mymenu, item - 1);
+      else setitem(mymenu, item);
+      if (e == fltk3::PUSH) {
+	if (pp.current_item && pp.current_item->submenu() // this is a menu title
+	    && item != pp.p[mymenu]->selected // and it is not already on
+	    && !pp.current_item->callback_) // and it does not have a callback
+	  pp.state = MENU_PUSH_STATE;
+	else
+	  pp.state = PUSH_STATE;
+      }
+    }
+    return 1;
+  case fltk3::RELEASE:
+    // Mouse must either be held down/dragged some, or this must be
+    // the second click (not the one that popped up the menu):
+    if (   !fltk3::event_is_click() 
+        || pp.state == PUSH_STATE 
+        || (pp.menubar && pp.current_item && !pp.current_item->submenu()) // button
+	) {
+#if 0 // makes the check/radio items leave the menu up
+      const fltk3::MenuItem* m = pp.current_item;
+      if (m && button && (m->flags & (fltk3::MENU_TOGGLE|fltk3::MENU_RADIO))) {
+	((fltk3::Menu_*)button)->picked(m);
+	pp.p[pp.menu_number]->redraw();
+      } else
+#endif
+      // do nothing if they try to pick inactive items
+      if (!pp.current_item || pp.current_item->activevisible())
+	pp.state = DONE_STATE;
+    }
+    return 1;
+  }
+  return Window::handle(e);
+}
+
+/**
+  Pulldown() is similar to popup(), but a rectangle is
+  provided to position the menu.  The menu is made at least W
+  wide, and the picked item is centered over the rectangle
+  (like fltk3::Choice uses).  If picked is zero or not
+  found, the menu is aligned just below the rectangle (like a pulldown
+  menu).
+  <P>The title and menubar arguments are used
+  internally by the fltk3::MenuBar widget.
+*/
+const fltk3::MenuItem* fltk3::MenuItem::pulldown(
+    int X, int Y, int W, int H,
+    const fltk3::MenuItem* initial_item,
+    const fltk3::Menu_* pbutton,
+    const fltk3::MenuItem* t,
+    int menubar) const {
+  fltk3::Group::current(0); // fix possible user error...
+
+  button = pbutton;
+  if (pbutton && pbutton->window()) {
+    for (fltk3::Window* w = pbutton->window(); w; w = w->window()) {
+      X += w->x();
+      Y += w->y();
+    }
+  } else {
+    X += fltk3::event_x_root()-fltk3::event_x();
+    Y += fltk3::event_y_root()-fltk3::event_y();
+  }
+  menuwindow mw(this, X, Y, W, H, initial_item, t, menubar);
+  fltk3::grab(mw);
+  menustate pp; p = &pp;
+  pp.p[0] = &mw;
+  pp.nummenus = 1;
+  pp.menubar = menubar;
+  pp.state = INITIAL_STATE;
+  pp.fakemenu = 0; // kludge for buttons in menubar
+
+  // preselected item, pop up submenus if necessary:
+  if (initial_item && mw.selected >= 0) {
+    setitem(0, mw.selected);
+    goto STARTUP;
+  }
+
+  pp.current_item = 0; pp.menu_number = 0; pp.item_number = -1;
+  if (menubar) {
+    // find the initial menu
+    if (!mw.handle(fltk3::DRAG)) {
+      fltk3::grab(0);
+      return 0;
+    }
+  }
+  initial_item = pp.current_item;
+  if (initial_item) goto STARTUP;
+
+  // the main loop, runs until p.state goes to DONE_STATE:
+  for (;;) {
+
+    // make sure all the menus are shown:
+    {
+      for (int k = menubar; k < pp.nummenus; k++) {
+        if (!pp.p[k]->shown()) {
+	  if (pp.p[k]->title) pp.p[k]->title->show();
+	  pp.p[k]->show();
+        }
+      }
+    }
+
+    // get events:
+    {
+      const fltk3::MenuItem* oldi = pp.current_item;
+      fltk3::wait();
+      if (pp.state == DONE_STATE) break; // done.
+      if (pp.current_item == oldi) continue;
+    }
+
+    // only do rest if item changes:
+    if(pp.fakemenu) {delete pp.fakemenu; pp.fakemenu = 0;} // turn off "menubar button"
+
+    if (!pp.current_item) { // pointing at nothing
+      // turn off selection in deepest menu, but don't erase other menus:
+      pp.p[pp.nummenus-1]->set_selected(-1);
+      continue;
+    }
+
+    if(pp.fakemenu) {delete pp.fakemenu; pp.fakemenu = 0;}
+    initial_item = 0; // stop the startup code
+    pp.p[pp.menu_number]->autoscroll(pp.item_number);
+
+  STARTUP:
+    menuwindow& cw = *pp.p[pp.menu_number];
+    const fltk3::MenuItem* m = pp.current_item;
+    if (!m->activevisible()) { // pointing at inactive item
+      cw.set_selected(-1);
+      initial_item = 0; // turn off startup code
+      continue;
+    }
+    cw.set_selected(pp.item_number);
+
+    if (m==initial_item) initial_item=0; // stop the startup code if item found
+    if (m->submenu()) {
+      const fltk3::MenuItem* title = m;
+      const fltk3::MenuItem* menutable;
+      if (m->flags&fltk3::SUBMENU) menutable = m+1;
+      else menutable = (fltk3::MenuItem*)(m)->user_data_;
+      // figure out where new menu goes:
+      int nX, nY;
+      if (!pp.menu_number && pp.menubar) {	// menu off a menubar:
+	nX = cw.x() + cw.titlex(pp.item_number);
+	nY = cw.y() + cw.h();
+	initial_item = 0;
+      } else {
+	nX = cw.x() + cw.w();
+	nY = cw.y() + pp.item_number * cw.itemheight;
+	title = 0;
+      }
+      if (initial_item) { // bring up submenu containing initial item:
+	menuwindow* n = new menuwindow(menutable,X,Y,W,H,initial_item,title,0,0,cw.x());
+	pp.p[pp.nummenus++] = n;
+	// move all earlier menus to line up with this new one:
+	if (n->selected>=0) {
+	  int dy = n->y()-nY;
+	  int dx = n->x()-nX;
+	  for (int menu = 0; menu <= pp.menu_number; menu++) {
+	    menuwindow* tt = pp.p[menu];
+	    int nx = tt->x()+dx; if (nx < 0) {nx = 0; dx = -tt->x();}
+	    int ny = tt->y()+dy; if (ny < 0) {ny = 0; dy = -tt->y();}
+	    tt->position(nx, ny);
+	  }
+	  setitem(pp.nummenus-1, n->selected);
+	  goto STARTUP;
+	}
+      } else if (pp.nummenus > pp.menu_number+1 &&
+		 pp.p[pp.menu_number+1]->menu == menutable) {
+	// the menu is already up:
+	while (pp.nummenus > pp.menu_number+2) delete pp.p[--pp.nummenus];
+	pp.p[pp.nummenus-1]->set_selected(-1);
+      } else {
+	// delete all the old menus and create new one:
+	while (pp.nummenus > pp.menu_number+1) delete pp.p[--pp.nummenus];
+	pp.p[pp.nummenus++]= new menuwindow(menutable, nX, nY,
+					  title?1:0, 0, 0, title, 0, menubar, cw.x());
+      }
+    } else { // !m->submenu():
+      while (pp.nummenus > pp.menu_number+1) delete pp.p[--pp.nummenus];
+      if (!pp.menu_number && pp.menubar) {
+	// kludge so "menubar buttons" turn "on" by using menu title:
+	pp.fakemenu = new menuwindow(0,
+				  cw.x()+cw.titlex(pp.item_number),
+				  cw.y()+cw.h(), 0, 0,
+				  0, m, 0, 1);
+	pp.fakemenu->title->show();
+      }
+    }
+  }
+  const fltk3::MenuItem* m = pp.current_item;
+  delete pp.fakemenu;
+  while (pp.nummenus>1) delete pp.p[--pp.nummenus];
+  mw.hide();
+  fltk3::grab(0);
+  return m;
+}
+
+/**
+  This method is called by widgets that want to display menus.
+
+  The menu stays up until the user picks an item or dismisses it.
+  The selected item (or NULL if none) is returned. <I>This does not
+  do the callbacks or change the state of check or radio items.</I>
+
+  X,Y is the position of the mouse cursor, relative to the
+  window that got the most recent event (usually you can pass 
+  fltk3::event_x() and fltk3::event_y() unchanged here).
+
+  \p title is a character string title for the menu.  If
+  non-zero a small box appears above the menu with the title in it.
+
+  The menu is positioned so the cursor is centered over the item 
+  picked.  This will work even if \p picked is in a submenu.
+  If \p picked is zero or not in the menu item table the menu is
+  positioned with the cursor in the top-left corner.
+
+  \p button is a pointer to an fltk3::Menu_ from which the color and
+  boxtypes for the menu are pulled.  If NULL then defaults are used.
+*/
+const fltk3::MenuItem* fltk3::MenuItem::popup(
+  int X, int Y,
+  const char* title,
+  const fltk3::MenuItem* picked,
+  const fltk3::Menu_* button
+  ) const {
+  static fltk3::MenuItem dummy; // static so it is all zeros
+  dummy.text = title;
+  return pulldown(X, Y, 0, 0, picked, button, title ? &dummy : 0);
+}
+
+/**
+  Search only the top level menu for a shortcut.  
+  Either &x in the label or the shortcut fields are used.
+
+  This tests the current event, which must be an fltk3::KEYBOARD or 
+  fltk3::SHORTCUT, against a shortcut value.
+
+  \param ip returns the index of the item, if \p ip is not NULL.
+  \param require_alt if true: match only if Alt key is pressed.
+
+  \return found fltk3::MenuItem or NULL
+*/
+const fltk3::MenuItem* fltk3::MenuItem::find_shortcut(int* ip, const bool require_alt) const {
+  const fltk3::MenuItem* m = this;
+  if (m) for (int ii = 0; m->text; m = next_visible_or_not(m), ii++) {
+    if (m->active()) {
+      if (fltk3::test_shortcut(m->shortcut_)
+	 || fltk3::Widget::test_shortcut(m->text, require_alt)) {
+	if (ip) *ip=ii;
+	return m;
+      }
+    }
+  }
+  return 0;
+}
+
+// Recursive search of all submenus for anything with this key as a
+// shortcut.  Only uses the shortcut field, ignores &x in the labels:
+/**
+  This is designed to be called by a widgets handle() method in
+  response to a fltk3::SHORTCUT event.  If the current event matches
+  one of the items shortcut, that item is returned.  If the keystroke
+  does not match any shortcuts then NULL is returned.  This only
+  matches the shortcut() fields, not the letters in the title
+  preceeded by '
+*/
+const fltk3::MenuItem* fltk3::MenuItem::test_shortcut() const {
+  const fltk3::MenuItem* m = this;
+  const fltk3::MenuItem* ret = 0;
+  if (m) for (; m->text; m = next_visible_or_not(m)) {
+    if (m->active()) {
+      // return immediately any match of an item in top level menu:
+      if (fltk3::test_shortcut(m->shortcut_)) return m;
+      // if (fltk3::Widget::test_shortcut(m->text)) return m;
+      // only return matches from lower menu if nothing found in top menu:
+      if (!ret && m->submenu()) {
+	const fltk3::MenuItem* s =
+	  (m->flags&fltk3::SUBMENU) ? m+1:(const fltk3::MenuItem*)m->user_data_;
+	ret = s->test_shortcut();
+      }
+    }
+  }
+  return ret;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/MenuBar.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_Bar.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/MenuBar.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/MenuBar.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,80 @@
+//
+// "$Id$"
+//
+// Menu bar widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/MenuBar.h>
+#include <fltk3/draw.h>
+
+void fltk3::MenuBar::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  draw_box();
+  if (!menu() || !menu()->text) return;
+  const fltk3::MenuItem* m;
+  int X = x()+6;
+  for (m=menu()->first(); m->text; m = m->next()) {
+    int W = m->measure(0,this) + 16;
+    m->draw(X, y(), W, h(), this);
+    X += W;
+    if (m->flags & fltk3::MENU_DIVIDER) {
+      int y1 = y() + fltk3::box_dy(box());
+      int y2 = y1 + h() - fltk3::box_dh(box()) - 1;
+
+      // Draw a vertical divider between menus...
+      fltk3::color(fltk3::DARK3);
+      fltk3::yxline(X - 6, y1, y2);
+      fltk3::color(fltk3::LIGHT3);
+      fltk3::yxline(X - 5, y1, y2);
+    }
+  }
+}
+
+int fltk3::MenuBar::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  const fltk3::MenuItem* v;
+  if (menu() && menu()->text) switch (event) {
+  case fltk3::ENTER:
+  case fltk3::LEAVE:
+    return 1;
+  case fltk3::PUSH:
+    v = 0;
+  J1:
+    v = menu()->pulldown(x(), y(), w(), h(), v, this, 0, 1);
+    picked(v);
+    return 1;
+  case fltk3::SHORTCUT:
+    if (visible_r()) {
+      v = menu()->find_shortcut(0, true);
+      if (v && v->submenu()) goto J1;
+    }
+    return test_shortcut() != 0;
+  }
+  return 0;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/MenuButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/MenuButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/MenuButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,125 @@
+//
+// "$Id$"
+//
+// Menu button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/MenuButton.h>
+#include <fltk3/draw.h>
+#include <fltk3/Wrapper.h>
+
+
+static fltk3::MenuButton	*pressed_menu_button_ = 0;
+
+void fltk3::MenuButton::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (!box() || type()) return;
+  draw_box(pressed_menu_button_ == this ? fltk3::down(box()) : box(), color());
+  draw_label();
+  if (fltk3::focus() == this) draw_focus();
+  // ** if (box() == fltk3::FLAT_BOX) return; // for XForms compatibility
+  int H = (labelsize()-3)&-2;
+  int X = x()+w()-H*2;
+  int Y = y()+(h()-H)/2;
+  fltk3::color(active_r() ? fltk3::DARK3 : fltk3::inactive(fltk3::DARK3));
+  fltk3::line(X+H/2, Y+H, X, Y, X+H, Y);
+  fltk3::color(active_r() ? fltk3::LIGHT3 : fltk3::inactive(fltk3::LIGHT3));
+  fltk3::line(X+H, Y, X+H/2, Y+H);
+}
+
+/**
+  Act exactly as though the user clicked the button or typed the
+  shortcut key.  The menu appears, it waits for the user to pick an item,
+  and if they pick one it sets value() and does the callback or
+  sets changed() as described above.  The menu item is returned
+  or NULL if the user dismisses the menu.
+*/
+const fltk3::MenuItem* fltk3::MenuButton::popup() {
+  const fltk3::MenuItem* m;
+  pressed_menu_button_ = this;
+  redraw();
+  fltk3::WidgetTracker mb(this);
+  if (!box() || type()) {
+    m = menu()->popup(fltk3::event_x(), fltk3::event_y(), label(), mvalue(), this);
+  } else {
+    m = menu()->pulldown(x(), y(), w(), h(), 0, this);
+  }
+  picked(m);
+  pressed_menu_button_ = 0;
+  if (mb.exists()) redraw();
+  return m;
+}
+
+int fltk3::MenuButton::handle(int e) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+  if (!menu() || !menu()->text) return 0;
+  switch (e) {
+  case fltk3::ENTER: /* FALLTHROUGH */
+  case fltk3::LEAVE:
+    return (box() && !type()) ? 1 : 0;
+  case fltk3::PUSH:
+    if (!box()) {
+      if (fltk3::event_button() != 3) return 0;
+    } else if (type()) {
+      if (!(type() & (1 << (fltk3::event_button()-1)))) return 0;
+    }
+    if (fltk3::visible_focus()) fltk3::focus(this);
+    popup();
+    return 1;
+  case fltk3::KEYBOARD:
+    if (!box()) return 0;
+    if (fltk3::event_key() == ' ' &&
+        !(fltk3::event_state() & (fltk3::SHIFT | fltk3::CTRL | fltk3::ALT | fltk3::META))) {
+      popup();
+      return 1;
+    } else return 0;
+  case fltk3::SHORTCUT:
+    if (Widget::test_shortcut()) {popup(); return 1;}
+    return test_shortcut() != 0;
+  case fltk3::FOCUS: /* FALLTHROUGH */
+  case fltk3::UNFOCUS:
+    if (box() && fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    }
+  default:
+    return 0;
+  }
+}
+
+/**
+  Creates a new fltk3::MenuButton widget using the given position,
+  size, and label string. The default boxtype is fltk3::UP_BOX.
+  <P>The constructor sets menu() to NULL.  See 
+  fltk3::Menu_ for the methods to set or change the menu.
+*/
+fltk3::MenuButton::MenuButton(int X,int Y,int W,int H,const char *l)
+: fltk3::Menu_(X,Y,W,H,l) {
+  down_box(fltk3::NO_BOX);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/MenuWindow.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_Window.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/MenuWindow.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/MenuWindow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,110 @@
+//
+// "$Id$"
+//
+// Menu window code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This is the window type used by Fl_Menu to make the pop-ups.
+// It draws in the overlay planes if possible.
+
+// Also here is the implementation of the mouse & keyboard grab,
+// which are used so that clicks outside the program's windows
+// can be used to dismiss the menus.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+#include <fltk3/MenuWindow.h>
+
+// WIN32 note: HAVE_OVERLAY is false
+#if HAVE_OVERLAY
+extern XVisualInfo *fl_find_overlay_visual();
+extern XVisualInfo *fl_overlay_visual;
+extern Colormap fl_overlay_colormap;
+extern unsigned long fl_transparent_pixel;
+static GC gc;	// the GC used by all X windows
+extern uchar fl_overlay; // changes how fltk3::color(x) works
+#endif
+
+#include <stdio.h>
+
+void fltk3::MenuWindow::show() {
+#if HAVE_OVERLAY
+  if (!shown() && overlay() && fl_find_overlay_visual()) {
+    XInstallColormap(fl_display, fl_overlay_colormap);
+    fl_background_pixel = int(fl_transparent_pixel);
+    Fl_X::make_xid(this, fl_overlay_visual, fl_overlay_colormap);
+    fl_background_pixel = -1;
+  } else
+#endif
+    SingleWindow::show();
+}
+
+void fltk3::MenuWindow::flush() {
+#if HAVE_OVERLAY
+  if (!fl_overlay_visual || !overlay()) {fltk3::SingleWindow::flush(); return;}
+  Fl_X *myi = Fl_X::i(this);
+  fl_window = myi->xid;
+  if (!gc) {
+	  gc = XCreateGC(fl_display, myi->xid, 0, 0);
+# if defined(FLTK_USE_CAIRO)
+	  if(fltk3::autolink_context()) fltk3::cairo_make_current(gc); // capture gc changes automatically to update the cairo context adequately
+# endif
+  }
+  fl_gc = gc;
+  fl_overlay = 1;
+  fltk3::clip_region(myi->region); myi->region = 0; current_ = this;
+  draw();
+  fl_overlay = 0;
+#else
+  SingleWindow::flush();
+#endif
+}
+
+/** Erases the window, does nothing if HAVE_OVERLAY is not defined config.h */
+void fltk3::MenuWindow::erase() {
+#if HAVE_OVERLAY
+  if (!gc || !shown()) return;
+//XSetForeground(fl_display, gc, 0);
+//XFillRectangle(fl_display, fl_xid(this), gc, 0, 0, w(), h());
+  XClearWindow(fl_display, fl_xid(this));
+#endif
+}
+
+// Fix the colormap flashing on Maximum Impact Graphics by erasing the
+// menu before unmapping it:
+void fltk3::MenuWindow::hide() {
+  erase();
+  SingleWindow::hide();
+}
+
+/**  Destroys the window and all of its children.*/
+fltk3::MenuWindow::~MenuWindow() {
+  hide();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Menu_.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Menu_.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Menu_.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,437 @@
+//
+// "$Id$"
+//
+// Common menu code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// This is a base class for all items that have a menu:
+//	fltk3::MenuBar, fltk3::MenuButton, fltk3::Choice
+// This provides storage for a menu item, functions to add/modify/delete
+// items, and a call for when the user picks a menu item.
+
+// More code in Fl_Menu_add.cxx
+
+#include <fltk3/run.h>
+#include <fltk3/Menu_.h>
+#include "flstring.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+#define SAFE_STRCAT(s) { len += strlen(s); if ( len >= namelen ) { *name='\0'; return(-2); } else strcat(name,(s)); }
+
+/** Get the menu 'pathname' for the specified menuitem.
+
+    If finditem==NULL, mvalue() is used (the most recently picked menuitem).
+
+    \b Example:
+    \code
+      fltk3::MenuBar *menubar = 0;
+      void my_menu_callback(fltk3::Widget*,void*) {
+        char name[80];
+        if ( menubar->item_pathname(name, sizeof(name)-1) == 0 ) {   // recently picked item
+          if ( strcmp(name, "File/&Open") == 0 ) { .. }              // open invoked
+          if ( strcmp(name, "File/&Save") == 0 ) { .. }              // save invoked
+          if ( strcmp(name, "Edit/&Copy") == 0 ) { .. }              // copy invoked
+        }
+      }
+      int main() {
+        [..]
+        menubar = new fltk3::MenuBar(..);
+        menubar->add("File/&Open",  0, my_menu_callback);
+        menubar->add("File/&Save",  0, my_menu_callback);
+        menubar->add("Edit/&Copy",  0, my_menu_callback);
+        [..]
+      }
+    \endcode
+
+    \returns
+	-   0 : OK (name has menuitem's pathname)
+	-  -1 : item not found (name="")
+	-  -2 : 'name' not large enough (name="")
+    \see find_item()
+*/
+int fltk3::Menu_::item_pathname(char *name, int namelen, const fltk3::MenuItem *finditem) const {
+    int len = 0;
+    finditem = finditem ? finditem : mvalue();    
+    name[0] = '\0';
+    for ( int t=0; t<size(); t++ ) {
+        const fltk3::MenuItem *m = &(menu()[t]);
+	if ( m->submenu() ) {				// submenu? descend
+	    if (*name) SAFE_STRCAT("/");
+	    if (m->label()) SAFE_STRCAT(m->label());
+	    if ( m == finditem ) return(0);		// found? done.
+	} else {
+	    if (m->label()) {				// menu item?
+		if ( m == finditem ) {			// found? tack on itemname, done.
+		    SAFE_STRCAT("/");
+		    SAFE_STRCAT(m->label());
+		    return(0);
+		}
+	    } else {					// end of submenu? pop
+	        char *ss = strrchr(name, '/');
+		if ( ss ) { *ss = 0; len = strlen(name); }	// "File/Edit" -> "File"
+		else { name[0] = '\0'; len = 0; }		// "File" -> ""
+		continue;
+	    }
+	}
+    }
+    *name = '\0';
+    return(-1);						// item not found
+}
+
+/**
+ Find the menu item for a given menu \p pathname, such as "Edit/Copy".
+ 
+ This method finds a menu item in the menu array, also traversing submenus, but
+ not submenu pointers.
+
+ To get the menu item's index, use find_index(const char*)
+
+  \b Example:
+  \code
+    fltk3::MenuBar *menubar = new fltk3::MenuBar(..);
+    menubar->add("File/&Open");
+    menubar->add("File/&Save");
+    menubar->add("Edit/&Copy");
+    // [..]
+    fltk3::MenuItem *item;
+    if ( ( item = (fltk3::MenuItem*)menubar->find_item("File/&Open") ) != NULL ) {
+	item->labelcolor(fltk3::RED);
+    }
+    if ( ( item = (fltk3::MenuItem*)menubar->find_item("Edit/&Copy") ) != NULL ) {
+	item->labelcolor(fltk3::GREEN);
+    }
+  \endcode
+
+  \param pathname The path and name of the menu item
+  \returns The item found, or NULL if not found
+  \see find_index(const char*), find_item(fltk3::Callback*), item_pathname() 
+*/
+const fltk3::MenuItem * fltk3::Menu_::find_item(const char *pathname) {
+  int i = find_index(pathname);
+  return( (i==-1) ? 0 : (const fltk3::MenuItem*)(menu_+i));
+}
+
+/**
+ Find the index the menu array for given \p item.
+ 
+ A way to convert a menu item pointer into an index.
+
+ Current implementation is fast and not expensive.
+
+ \code
+   // Convert an index-to-item
+   int index = 12;
+   const fltk3::MenuItem *item = mymenu->menu() + index;
+
+   // Convert an item-to-index
+   int index = mymenu->find_index(item);
+   if ( index == -1 ) { ..error.. }
+ \endcode
+
+ \param item The *item to be found
+ \returns    The index of the item, or -1 if not found.
+ \see        menu()
+*/
+int fltk3::Menu_::find_index(const fltk3::MenuItem *item) const {
+  fltk3::MenuItem *max = menu_+size();
+  if (item<menu_ || item>=max) return(-1);
+  return(item-menu_);
+}
+
+/**
+ Find the index into the menu array for a given callback \p cb.
+ 
+ This method finds a menu item's index position, also traversing submenus, but
+ not submenu pointers. This is useful if an application uses internationalisation
+ and a menu item can not be found using its label. This search is also much faster.
+ 
+ \param cb Find the first item with this callback
+ \returns  The index of the item with the specific callback, or -1 if not found
+ \see      find_index(const char*)
+ */
+int fltk3::Menu_::find_index(fltk3::Callback *cb) const {
+  for ( int t=0; t < size(); t++ )
+    if (menu_[t].callback_==cb)
+      return(t);
+  return(-1);
+}
+
+/**
+ Find the menu item index for a given menu \p pathname, such as "Edit/Copy".
+ 
+ This method finds a menu item's index position for the given menu pathname,
+ also traversing submenus, but not submenu pointers.
+
+ To get the menu item pointer for a pathname, use find_item()
+
+ \param pathname The path and name of the menu item index to find
+ \returns        The index of the matching item, or -1 if not found.
+ \see            item_pathname()
+
+*/
+int fltk3::Menu_::find_index(const char *pathname) const {
+  char menupath[1024] = "";	// File/Export
+  for ( int t=0; t < size(); t++ ) {
+    fltk3::MenuItem *m = menu_ + t;
+    if (m->flags&fltk3::SUBMENU) {
+      // IT'S A SUBMENU
+      // we do not support searches through fltk3::SUBMENU_POINTER links
+      if (menupath[0]) strlcat(menupath, "/", sizeof(menupath));
+      strlcat(menupath, m->label(), sizeof(menupath));
+      if (!strcmp(menupath, pathname)) return(t);
+    } else {
+      if (!m->label()) {
+	// END OF SUBMENU? Pop back one level.
+	char *ss = strrchr(menupath, '/');
+	if ( ss ) *ss = 0;
+	else menupath[0] = '\0';
+	continue;
+      }
+      // IT'S A MENU ITEM
+      char itempath[1024];	// eg. Edit/Copy
+      strcpy(itempath, menupath);
+      if (itempath[0]) strlcat(itempath, "/", sizeof(itempath));
+      strlcat(itempath, m->label(), sizeof(itempath));
+      if (!strcmp(itempath, pathname)) return(t);
+    }
+  }
+  return(-1);
+}
+
+/**
+ Find the menu item for the given callback \p cb.
+ 
+ This method finds a menu item in a menu array, also traversing submenus, but
+ not submenu pointers. This is useful if an application uses 
+ internationalisation and a menu item can not be found using its label. This
+ search is also much faster.
+ 
+ \param cb find the first item with this callback
+ \returns The item found, or NULL if not found
+ \see find_item(const char*)
+ */
+const fltk3::MenuItem * fltk3::Menu_::find_item(fltk3::Callback *cb) {
+  for ( int t=0; t < size(); t++ ) {
+    const fltk3::MenuItem *m = menu_ + t;
+    if (m->callback_==cb) {
+      return m;
+    }
+  }
+  return (const fltk3::MenuItem *)0;
+}
+
+/**
+  The value is the index into menu() of the last item chosen by
+  the user.  It is zero initially.  You can set it as an integer, or set
+  it with a pointer to a menu item.  The set routines return non-zero if
+  the new value is different than the old one.
+*/
+int fltk3::Menu_::value(const fltk3::MenuItem* m) {
+  clear_changed();
+  if (value_ != m) {value_ = m; return 1;}
+  return 0;
+}
+
+/** 
+ When user picks a menu item, call this.  It will do the callback.
+ Unfortunately this also casts away const for the checkboxes, but this
+ was necessary so non-checkbox menus can really be declared const...
+*/
+const fltk3::MenuItem* fltk3::Menu_::picked(const fltk3::MenuItem* v) {
+  if (v) {
+    if (v->radio()) {
+      if (!v->value()) { // they are turning on a radio item
+	set_changed();
+	((fltk3::MenuItem*)v)->setonly();
+      }
+      redraw();
+    } else if (v->flags & fltk3::MENU_TOGGLE) {
+      set_changed();
+      ((fltk3::MenuItem*)v)->flags ^= fltk3::MENU_VALUE;
+      redraw();
+    } else if (v != value_) { // normal item
+      set_changed();
+    }
+    value_ = v;
+    if (when()&(fltk3::WHEN_CHANGED|fltk3::WHEN_RELEASE)) {
+      if (changed() || when()&fltk3::WHEN_NOT_CHANGED) {
+	if (value_ && value_->callback_) value_->do_callback((fltk3::Widget*)this);
+	else do_callback();
+      }
+    }
+  }
+  return v;
+}
+
+/** Turns the radio item "on" for the menu item and turns off adjacent radio items set. */
+void fltk3::MenuItem::setonly() {
+  flags |= fltk3::MENU_RADIO | fltk3::MENU_VALUE;
+  fltk3::MenuItem* j;
+  for (j = this; ; ) {	// go down
+    if (j->flags & fltk3::MENU_DIVIDER) break; // stop on divider lines
+    j++;
+    if (!j->text || !j->radio()) break; // stop after group
+    j->clear();
+  }
+  for (j = this-1; ; j--) { // go up
+    if (!j->text || (j->flags&fltk3::MENU_DIVIDER) || !j->radio()) break;
+    j->clear();
+  }
+}
+
+/**
+ Creates a new fltk3::Menu_ widget using the given position, size,
+ and label string.  menu() is initialized to null.
+ */
+fltk3::Menu_::Menu_(int X,int Y,int W,int H,const char* l)
+: fltk3::Widget(X,Y,W,H,l) {
+  set_flag(SHORTCUT_LABEL);
+  box(fltk3::UP_BOX);
+  when(fltk3::WHEN_RELEASE_ALWAYS);
+  value_ = menu_ = 0;
+  alloc = 0;
+  selection_color(fltk3::SELECTION_COLOR);
+  textfont(fltk3::HELVETICA);
+  textsize(fltk3::NORMAL_SIZE);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  down_box(fltk3::NO_BOX);
+}
+
+/**
+  This returns the number of fltk3::MenuItem structures that make up the
+  menu, correctly counting submenus.  This includes the "terminator"
+  item at the end.  To copy a menu array you need to copy
+  size()*sizeof(fltk3::MenuItem) bytes.  If the menu is
+  NULL this returns zero (an empty menu will return 1).
+*/
+int fltk3::Menu_::size() const {
+  if (!menu_) return 0;
+  return menu_->size();
+}
+
+/**
+    Sets the menu array pointer directly.  If the old menu is private it is
+    deleted.  NULL is allowed and acts the same as a zero-length
+    menu.  If you try to modify the array (with add(), replace(), or
+    remove()) a private copy is automatically done.
+*/
+void fltk3::Menu_::menu(const fltk3::MenuItem* m) {
+  clear();
+  value_ = menu_ = (fltk3::MenuItem*)m;
+}
+
+// this version is ok with new Fl_Menu_add code with fltk3::menu_array_owner:
+
+/** 
+  Sets the menu array pointer with a copy of m that will be automatically deleted. 
+  If userdata \p ud is not NULL, then all user data pointers are changed in the menus as well.
+  See void fltk3::Menu_::menu(const fltk3::MenuItem* m). 
+*/
+void fltk3::Menu_::copy(const fltk3::MenuItem* m, void* ud) {
+  int n = m->size();
+  fltk3::MenuItem* newMenu = new fltk3::MenuItem[n];
+  memcpy(newMenu, m, n*sizeof(fltk3::MenuItem));
+  menu(newMenu);
+  alloc = 1; // make destructor free array, but not strings
+  // for convenience, provide way to change all the user data pointers:
+  if (ud) for (; n--;) {
+    if (newMenu->callback_) newMenu->user_data_ = ud;
+    newMenu++;
+  }
+}
+
+fltk3::Menu_::~Menu_() {
+  clear();
+}
+
+// Fl_Menu::add() uses this to indicate the owner of the dynamically-
+// expanding array.  We must not free this array:
+namespace fltk3 {
+  fltk3::Menu_* menu_array_owner = 0;
+}
+
+/**
+  Same as menu(NULL), set the array pointer to null, indicating
+  a zero-length menu.
+  
+  Menus must not be cleared during a callback to the same menu.
+*/
+void fltk3::Menu_::clear() {
+  if (alloc) {
+    if (alloc>1) for (int i = size(); i--;)
+      if (menu_[i].text) free((void*)menu_[i].text);
+    if (this == fltk3::menu_array_owner)
+      fltk3::menu_array_owner = 0;
+    else
+      delete[] menu_;
+    menu_ = 0;
+    value_ = 0;
+    alloc = 0;
+  }
+}
+
+/**
+ Clears the specified submenu pointed to by \p index of all menu items.
+
+ This method is useful for clearing a submenu so that it can be
+ re-populated with new items. Example: a "File/Recent Files/..." submenu
+ that shows the last few files that have been opened.
+
+ The specified \p index must point to a submenu.
+ 
+ The submenu is cleared with remove().
+ If the menu array was directly set with menu(x), then copy() 
+ is done to make a private array.
+
+ \warning Since this method can change the internal menu array, any menu
+ item pointers or indecies the application may have cached can become
+ stale, and should be recalculated/refreshed.
+
+ \b Example:
+ \code
+   int index = menubar->find_index("File/Recent");    // get index of "File/Recent" submenu
+   if ( index != -1 ) menubar->clear_submenu(index);  // clear the submenu
+   menubar->add("File/Recent/Aaa");
+   menubar->add("File/Recent/Bbb");
+   [..]
+ \endcode
+
+ \param index The index of the submenu to be cleared
+ \returns 0 on success, -1 if the index is out of range or not a submenu
+ \see remove(int)
+ */
+int fltk3::Menu_::clear_submenu(int index) {
+  if ( index < 0 || index >= size() ) return(-1);
+  if ( ! (menu_[index].flags & fltk3::SUBMENU) ) return(-1);
+  ++index;					// advance to first item in submenu
+  while ( index < size() ) {                    // keep remove()ing top item until end is reached
+    if ( menu_[index].text == 0 ) break;	// end of this submenu? done
+    remove(index);				// remove items/submenus
+  }
+  return(0);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Menu_add.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_add.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Menu_add.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Menu_add.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,499 @@
+//
+// "$Id$"
+//
+// Menu utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Methods to alter the menu in an fltk3::Menu_ widget.
+
+// These are for Forms emulation and for dynamically changing the
+// menus.  They are in this source file so they are not linked in if
+// not used, which is what will happen if the program only uses
+// constant menu tables.
+
+// Not at all guaranteed to be Forms compatible, especially with any
+// string with a % sign in it!
+
+#include <fltk3/Menu_.h>
+#include "flstring.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+// If the array is this, we will double-reallocate as necessary:
+static fltk3::MenuItem* local_array = 0;
+static int local_array_alloc = 0; // number allocated
+static int local_array_size = 0; // == size(local_array)
+
+namespace fltk3 {
+  extern fltk3::Menu_* menu_array_owner; // in fltk3::Menu_.cxx
+}
+
+// For historical reasons there are matching methods that work on a
+// user-allocated array of fltk3::MenuItem.  These methods are quite
+// depreciated and should not be used.  These old methods use the
+// above pointers to detect if the array belongs to an fltk3::Menu_
+// widget, and if so it reallocates as necessary.
+
+
+
+// Insert a single fltk3::MenuItem into an array of size at offset n,
+// if this is local_array it will be reallocated if needed.
+static fltk3::MenuItem* array_insert(
+  fltk3::MenuItem* array,  // array to modify
+  int size,             // size of array
+  int n,                // index of new insert position
+  const char *text,     // text of new item (copy is made)
+  int flags             // flags for new item
+) {
+  if (array == local_array && size >= local_array_alloc) {
+    local_array_alloc = 2*size;
+    fltk3::MenuItem* newarray = new fltk3::MenuItem[local_array_alloc];
+    memmove(newarray, array, size*sizeof(fltk3::MenuItem));
+    delete[] local_array;
+    local_array = array = newarray;
+  }
+  // move all the later items:
+  memmove(array+n+1, array+n, sizeof(fltk3::MenuItem)*(size-n));
+  // create the new item:
+  fltk3::MenuItem* m = array+n;
+  m->text = text ? strdup(text) : 0;
+  m->shortcut_ = 0;
+  m->callback_ = 0;
+  m->user_data_ = 0;
+  m->flags = flags;
+  m->labeltype_ = m->labelsize_ = m->labelcolor_ = 0;
+  m->labelfont_ = fltk3::HELVETICA; 
+  return array;
+}
+
+
+
+// Comparison that does not care about deleted '&' signs:
+static int compare(const char* a, const char* b) {
+  for (;;) {
+    int n = *a-*b;
+    if (n) {
+      if (*a == '&') a++;
+      else if (*b == '&') b++;
+      else return n;
+    } else if (*a) {
+      a++; b++;
+    } else {
+      return 0;
+    }
+  }
+}
+
+
+
+/** Adds an item.  The text is split at '/' characters to automatically
+   produce submenus (actually a totally unnecessary feature as you can
+   now add submenu titles directly by setting SUBMENU in the flags):
+*/
+int fltk3::MenuItem::add(
+  const char *mytext,
+  unsigned int sc,
+  fltk3::Callback *cb,	
+  void *data,
+  int myflags
+) {
+  return(insert(-1,mytext,sc,cb,data,myflags));		// -1: append
+}
+
+
+
+/** 
+ Inserts an item at position \p index.
+    
+ If \p index is -1, the item is added the same way as fltk3::MenuItem::add().
+
+ If 'mytext' contains any un-escaped front slashes (/), it's assumed 
+ a menu pathname is being specified, and the value of \p index 
+ will be ignored.
+
+ In all other aspects, the behavior of insert() is the same as add().
+ 
+ \param index insert new items here
+ \param mytext new label string, details see above
+ \param sc keyboard shortcut for new item
+ \param cb callback function for new item
+ \param data user data for new item
+ \param myflags menu flags as described in fltk3::Menu_Item
+ \returns the index into the menu() array, where the entry was added
+*/
+int fltk3::MenuItem::insert(
+  int index,
+  const char *mytext,
+  int sc,
+  fltk3::Callback *cb,	
+  void *data,
+  int myflags
+) {
+  fltk3::MenuItem *array = this;
+  fltk3::MenuItem *m = this;
+  const char *p;
+  char *q;
+  char buf[1024];
+
+  int msize = array==local_array ? local_array_size : array->size();
+  int flags1 = 0;
+  const char* item;
+
+  // split at slashes to make submenus:
+  for (;;) {
+
+    // leading slash makes us assume it is a filename:
+    if (*mytext == '/') {item = mytext; break;}
+
+    // leading underscore causes divider line:
+    if (*mytext == '_') {mytext++; flags1 = fltk3::MENU_DIVIDER;}
+
+    // copy to buf, changing \x to x:
+    q = buf;
+    for (p=mytext; *p && *p != '/'; *q++ = *p++) if (*p=='\\' && p[1]) p++;
+    *q = 0;
+
+    item = buf;
+    if (*p != '/') break; /* not a menu title */
+    index = -1;           /* any submenu specified overrides insert position */
+    mytext = p+1;         /* point at item title */
+
+    /* find a matching menu title: */
+    for (; m->text; m = m->next())
+      if (m->flags&fltk3::SUBMENU && !compare(item, m->text)) break;
+
+    if (!m->text) { /* create a new menu */
+      int n = (index==-1) ? m-array : index;
+      array = array_insert(array, msize, n, item, fltk3::SUBMENU|flags1);
+      msize++;
+      array = array_insert(array, msize, n+1, 0, 0);
+      msize++;
+      m = array+n;
+    }
+    m++;	/* go into the submenu */
+    flags1 = 0;
+  }
+
+  /* find a matching menu item: */
+  for (; m->text; m = m->next())
+    if (!(m->flags&fltk3::SUBMENU) && !compare(m->text,item)) break;
+
+  if (!m->text) {	/* add a new menu item */
+    int n = (index==-1) ? m-array : index;
+    array = array_insert(array, msize, n, item, myflags|flags1);
+    msize++;
+    if (myflags & fltk3::SUBMENU) { // add submenu delimiter
+      array = array_insert(array, msize, n+1, 0, 0);
+      msize++;
+    }
+    m = array+n;
+  }
+
+  /* fill it in */
+  m->shortcut_ = sc;
+  m->callback_ = cb;
+  m->user_data_ = data;
+  m->flags = myflags|flags1;
+
+  if (array == local_array) local_array_size = msize;
+  return m-array;
+}
+
+
+
+/**
+  Adds a new menu item.
+  
+  \param[in] label    The text label for the menu item.
+  \param[in] shortcut Optional keyboard shortcut that can be an int or string; (fltk3::CTRL+'a') or "^a". Default 0 if none.
+  \param[in] callback Optional callback invoked when user clicks the item. Default 0 if none.
+  \param[in] userdata Optional user data passed as an argument to the callback. Default 0 if none.
+  \param[in] flags    Optional flags that control the type of menu item; see below. Default is 0 for none.
+  \returns            The index into the menu() array, where the entry was added.
+  
+  \par Description
+  If the menu array was directly set with menu(x), then copy() is done 
+  to make a private array.
+  \par 
+  Since this method can change the internal menu array, any menu item
+  pointers or indecies the application may have cached can become stale,
+  and should be recalculated/refreshed.
+  \par
+  A menu item's callback must not add() items to its parent menu during the callback.
+
+  <B>Detailed Description of Parameters</B>
+  \par label
+  The menu item's label. This option is required.
+  \par
+  The characters "&", "/", "\", and "_" are treated as special characters in the label string. 
+  The "&" character specifies that the following character is an accelerator and will be underlined.
+  The "\" character is used to escape the next character in the string. 
+  Labels starting with the "_" character cause a divider to be placed after that menu item.
+  \par 
+  A label of the form "File/Quit" will create the submenu "File"
+  with a menu item called "Quit". The "/" character is ignored if it appears
+  as the first character of the label string, e.g.  "/File/Quit".
+  \par 
+  The label string is copied to new memory and can be freed.
+  The other arguments (including the shortcut) are copied into the
+  menu item unchanged.
+  \par 
+  If an item exists already with that name then it is replaced with
+  this new one.  Otherwise this new one is added to the end of the
+  correct menu or submenu.  The return value is the offset into the array
+  that the new entry was placed at.
+  
+  \par shortcut
+  The keyboard shortcut for this menu item. 
+  \par 
+  This parameter is optional, and defaults to 0 to indicate no shortcut.
+  \par
+  The shortcut can either be a raw integer value (eg. fltk3::CTRL+'A')
+  or a string (eg. "^c" or "^97").
+  \par
+  Raw integer shortcuts can be a combination of keyboard chars (eg. 'A')
+  and optional keyboard modifiers (see fltk3::event_state(), e.g. fltk3::SHIFT, etc).
+  In addition, fltk3::COMMAND can be used to denote fltk3::META under Mac OS X and
+  fltk3::CTRL under other platforms.
+  \par
+  String shortcuts can be specified in one of two ways:
+  \par
+  \verbatim
+   [#+^]<ascii_value>    e.g. "97", "^97", "+97", "#97"
+   [#+^]<ascii_char>     e.g. "a", "^a", "+a", "#a"
+  \endverbatim
+  \par
+  ..where \<ascii_value\> is a decimal value representing an
+  ascii character (eg. 97 is the ascii code for 'a'), and the optional
+  prefixes enhance the value that follows. Multiple prefixes must
+  appear in the order below.
+  \par
+  \verbatim
+   # - Alt
+   + - Shift
+   ^ - Control
+  \endverbatim
+  \par
+  Internally, the text shortcuts are converted to integer values using
+  fltk3::old_shortcut(const char*).
+
+  \par callback
+  The callback to invoke when this menu item is selected. 
+  \par 
+  This parameter is optional, and defaults to 0 for no callback.
+
+  \par userdata
+  The callback's 'user data' that is passed to the callback. 
+  \par 
+  This parameter is optional, and defaults to 0.
+
+  \par flags
+  These are bit flags to define what kind of menu item this is. 
+  \par
+  This parameter is optional, and defaults to 0 to define a 'regular' menu item.
+  \par 
+  These flags can be 'OR'ed together:
+  \code
+      fltk3::MENU_INACTIVE     // Deactivate menu item (gray out)
+      fltk3::MENU_TOGGLE       // Item is a checkbox toggle (shows checkbox for on/off state)
+      fltk3::MENU_VALUE        // The on/off state for checkbox/radio buttons (if set, state is 'on')
+      fltk3::MENU_RADIO        // Item is a radio button (one checkbox of many can be on)
+      fltk3::MENU_INVISIBLE    // Item will not show up (shortcut will work)
+      fltk3::SUBMENU_POINTER   // Indicates user_data() is a pointer to another menu array
+      fltk3::SUBMENU           // This item is a submenu to other items
+      fltk3::MENU_DIVIDER      // Creates divider line below this item. Also ends a group of radio buttons.
+  \endcode
+
+  \todo Raw integer shortcut needs examples. 
+        Dependent on responses to http://fltk.org/newsgroups.php?gfltk.development+v:10086 and results of STR#2344
+ */
+int fltk3::Menu_::add(const char *label,unsigned int shortcut,fltk3::Callback *callback,void *userdata,int flags) {
+  return(insert(-1,label,shortcut,callback,userdata,flags));	// -1: append
+}
+
+
+
+/**
+  Inserts a new menu item at the specified \p index position.
+
+  If \p index is -1, the menu item is appended; same behavior as add().
+
+  To properly insert a menu item, \p label must be the name of the item (eg. "Quit"),
+  and not a 'menu pathname' (eg. "File/Quit").  If a menu pathname is specified, 
+  the value of \p index is \em ignored, the new item's position defined by the pathname.
+  
+  For more details, see add(). Except for the \p index parameter, add()
+  has more detailed information on parameters and behavior, and is
+  functionally equivalent.
+
+  \param[in] index    The menu array's index position where the new item
+                      is inserted. If -1, behavior is the same as add().
+  \param[in] label    The text label for the menu item. If the label 
+                      is a menu pathname, \p index is ignored, and the pathname
+		      indicates the position of the new item.
+  \param[in] shortcut Optional keyboard shortcut. Can be an int (fltk3::CTRL+'a')
+                      or a string ("^a"). Default is 0.
+  \param[in] callback Optional callback invoked when user clicks the item.
+                      Default 0 if none.
+  \param[in] userdata Optional user data passed as an argument to the callback.
+                      Default 0 if none.
+  \param[in] flags    Optional flags that control the type of menu item; 
+                      see add() for more info. Default is 0 for none.
+  \returns            The index into the menu() array, where the entry was added.
+
+  \see                add()
+
+ */
+int fltk3::Menu_::insert(
+  int index,
+  const char *label,
+  unsigned int shortcut,
+  fltk3::Callback *callback,
+  void *userdata,
+  int flags
+) {
+  // make this widget own the local array:
+  if (this != fltk3::menu_array_owner) {
+    if (fltk3::menu_array_owner) {
+      fltk3::Menu_* o = fltk3::menu_array_owner;
+      // the previous owner get's its own correctly-sized array:
+      int value_offset = o->value_-local_array;
+      int n = local_array_size;
+      fltk3::MenuItem* newMenu = o->menu_ = new fltk3::MenuItem[n];
+      memcpy(newMenu, local_array, n*sizeof(fltk3::MenuItem));
+      if (o->value_) o->value_ = newMenu+value_offset;
+    }
+    if (menu_) {
+      // this already has a menu array, use it as the local one:
+      delete[] local_array;
+      if (!alloc) copy(menu_); // duplicate a user-provided static array
+      // add to the menu's current array:
+      local_array_alloc = local_array_size = size();
+      local_array = menu_;
+    } else {
+      // start with a blank array:
+      alloc = 2; // indicates that the strings can be freed
+      if (local_array) {
+	menu_ = local_array;
+      } else {
+	local_array_alloc = 15;
+	local_array = menu_ = new fltk3::MenuItem[local_array_alloc];
+        memset(local_array, 0, sizeof(fltk3::MenuItem) * local_array_alloc);
+      }
+      memset(menu_, 0, sizeof(fltk3::MenuItem));
+      local_array_size = 1;
+    }
+    fltk3::menu_array_owner = this;
+  }
+  int r = menu_->insert(index,label,shortcut,callback,userdata,flags);
+  // if it rellocated array we must fix the pointer:
+  int value_offset = value_-menu_;
+  menu_ = local_array; // in case it reallocated it
+  if (value_) value_ = menu_+value_offset;
+  return r;
+}
+
+
+
+/**
+  This is a Forms (and SGI GL library) compatible add function, it
+  adds many menu items, with '|' separating the menu items, and tab
+  separating the menu item names from an optional shortcut string.
+
+  The passed string is split at any '|' characters and then
+  add(s,0,0,0,0) is done with each section. This is
+  often useful if you are just using the value, and is compatible
+  with Forms and other GL programs. The section strings use the
+  same special characters as described for the long version of add().
+
+  No items must be added to a menu during a callback to the same menu.
+ 
+  \param str string containing multiple menu labels as described above
+  \returns the index into the menu() array, where the entry was added
+*/
+int fltk3::Menu_::add(const char *str) {
+  char buf[1024];
+  int r = 0;
+  while (*str) {
+    int sc = 0;
+    char *c;
+    for (c = buf; c < (buf + sizeof(buf) - 2) && *str && *str != '|'; str++) {
+      if (*str == '\t') {*c++ = 0; sc = fltk3::old_shortcut(str);}
+      else *c++ = *str;
+    }
+    *c = 0;
+    r = add(buf, sc, 0, 0, 0);
+    if (*str) str++;
+  }
+  return r;
+}
+
+
+
+/**
+  Changes the text of item \p i.  This is the only way to get
+  slash into an add()'ed menu item.  If the menu array was directly set
+  with menu(x) then copy() is done to make a private array.
+ 
+  \param i index into menu array
+  \param str new label for menu item at index i
+*/
+void fltk3::Menu_::replace(int i, const char *str) {
+  if (i<0 || i>=size()) return;
+  if (!alloc) copy(menu_);
+  if (alloc > 1) {
+    free((void *)menu_[i].text);
+    str = strdup(str);
+  }
+  menu_[i].text = str;
+}
+
+
+
+/**
+  Deletes item \p i from the menu.  If the menu array was directly
+  set with menu(x) then copy() is done to make a private array.
+  
+  No items must be removed from a menu during a callback to the same menu.
+ 
+  \param i index into menu array
+*/
+void fltk3::Menu_::remove(int i) {
+  int n = size();
+  if (i<0 || i>=n) return;
+  if (!alloc) copy(menu_);
+  // find the next item, skipping submenus:
+  fltk3::MenuItem* item = menu_+i;
+  const fltk3::MenuItem* next_item = item->next();
+  // delete the text only if all items were created with add():
+  if (alloc > 1) {
+    for (fltk3::MenuItem* m = item; m < next_item; m++)
+      if (m->text) free((void*)(m->text));
+  }
+  // MRS: "n" is the menu size(), which includes the trailing NULL entry...
+  memmove(item, next_item, (menu_+n-next_item)*sizeof(fltk3::MenuItem));
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Menu_global.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Menu_global.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Menu_global.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Menu_global.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,60 @@
+//
+// "$Id$"
+//
+// Global menu shortcut code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Make all the shortcuts in this menu global.
+// Currently only one menu at a time and you cannot destruct the menu,
+// is this sufficient?
+
+#include <fltk3/run.h>
+#include <fltk3/Menu_.h>
+
+static fltk3::Menu_* the_widget;
+
+static int handler(int e) {
+  if (e != fltk3::SHORTCUT || fltk3::modal()) return 0;
+  fltk3::first_window(the_widget->window());
+  return the_widget->handle(e);
+}
+
+/**
+  Make the shortcuts for this menu work no matter what window has the
+  focus when you type it.  This is done by using 
+  fltk3::add_handler().  This fltk3::Menu_ widget does not
+  have to be visible (ie the window it is in can be hidden, or it does
+  not have to be put in a window at all).
+  <P>Currently there can be only one global()menu.  Setting a new
+  one will replace the old one.  There is no way to remove the 
+  global() setting (so don't destroy the widget!)
+*/
+void fltk3::Menu_::global() {
+  if (!the_widget) fltk3::add_handler(handler);
+  the_widget = this;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/MultiLabel.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Multi_Label.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/MultiLabel.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/MultiLabel.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,77 @@
+//
+// "$Id$"
+//
+// Multi-label widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Allows two labels to be used on a widget (by having one of them
+// be one of these it allows an infinte number!)
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/MultiLabel.h>
+
+void fl_multi_labeltype(const fltk3::Label* o, int x, int y, int w, int h, fltk3::Align a)
+{
+  fltk3::MultiLabel* b = (fltk3::MultiLabel*)(o->value);
+  fltk3::Label local = *o;
+  local.value = b->labela;
+  local.type = b->typea;
+  int W = w; int H = h; local.measure(W, H);
+  local.draw(x,y,w,h,a);
+  if (a & fltk3::ALIGN_BOTTOM) h -= H;
+  else if (a & fltk3::ALIGN_TOP) {y += H; h -= H;}
+  else if (a & fltk3::ALIGN_RIGHT) w -= W;
+  else if (a & fltk3::ALIGN_LEFT) {x += W; w -= W;}
+  else {int d = (h+H)/2; y += d; h -= d;}
+  local.value = b->labelb;
+  local.type = b->typeb;
+  local.draw(x,y,w,h,a);
+}
+
+// measurement is only correct for left-to-right appending...
+void fl_multi_measure(const fltk3::Label* o, int& w, int& h) {
+  fltk3::MultiLabel* b = (fltk3::MultiLabel*)(o->value);
+  fltk3::Label local = *o;
+  local.value = b->labela;
+  local.type = b->typea;
+  local.measure(w,h);
+  local.value = b->labelb;
+  local.type = b->typeb;
+  int W = 0; int H = 0; local.measure(W,H);
+  w += W; if (H>h) h = H;
+}
+
+void fltk3::MultiLabel::label(fltk3::Widget* o) {
+  o->label(fltk3::MULTI_LABEL, (const char*)this);
+}
+
+void fltk3::MultiLabel::label(fltk3::MenuItem* o) {
+  o->label(fltk3::MULTI_LABEL, (const char*)this);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/NativeFileChooser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Native_File_Chooser.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/NativeFileChooser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/NativeFileChooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,47 @@
+// "$Id$"
+//
+// FLTK native OS file chooser widget
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 2004 Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Use Windows' chooser
+#ifdef WIN32
+#include "Fl_Native_File_Chooser_WIN32.cxx"
+#endif
+
+// Use Apple's chooser
+#ifdef __APPLE__
+#include <fltk3/NativeFileChooser.h>
+#endif
+
+// All else falls back to FLTK's own chooser
+#if ! defined(__APPLE__) && !defined(WIN32)
+#include "Fl_Native_File_Chooser_FLTK.cxx"
+#endif
+
+const char *fltk3::NativeFileChooser::file_exists_message = "File exists. Are you sure you want to overwrite?";
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/NativeFileChooser_common.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Native_File_Chooser_common.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/NativeFileChooser_common.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/NativeFileChooser_common.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,85 @@
+// "$Id$"
+//
+// FLTK native OS file chooser widget
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 2004 Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <string.h>
+#include <fltk3/enumerations.h>
+
+// COPY A STRING WITH 'new'
+//    Value can be NULL
+//
+static char *strnew(const char *val) {
+  if ( val == NULL ) return(NULL);
+  char *s = new char[strlen(val)+1];
+  strcpy(s, val);
+  return(s);
+}
+
+// FREE STRING CREATED WITH strnew(), NULLS OUT STRING
+//    Value can be NULL
+//
+static char *strfree(char *val) {
+  if ( val ) delete [] val;
+  return(NULL);
+}
+
+// 'DYNAMICALLY' APPEND ONE STRING TO ANOTHER
+//    Returns newly allocated string, or NULL 
+//    if s && val == NULL.
+//    's' can be NULL; returns a strnew(val).
+//    'val' can be NULL; s is returned unmodified.
+//
+//    Usage:
+//	char *s = strnew("foo");	// s = "foo"
+//      s = strapp(s, "bar");		// s = "foobar"
+//
+#if !defined(WIN32)
+static char *strapp(char *s, const char *val) {
+  if ( ! val ) {
+    return(s);			// Nothing to append? return s
+  }
+  if ( ! s ) {
+    return(strnew(val));	// New string? return copy of val
+  }
+  char *news = new char[strlen(s)+strlen(val)+1];
+  strcpy(news, s);
+  strcat(news, val);
+  delete [] s;			// delete old string
+  return(news);			// return new copy
+}
+#endif
+
+// APPEND A CHARACTER TO A STRING
+//     This does NOT allocate space for the new character.
+//
+static void chrcat(char *s, char c) {
+  char tmp[2] = { c, '\0' };
+  strcat(s, tmp);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/OverlayWindow.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Overlay_Window.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/OverlayWindow.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/OverlayWindow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,176 @@
+//
+// "$Id$"
+//
+// Overlay window code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/** \fn virtual void fltk3::OverlayWindow::draw_overlay() = 0
+  You must subclass fltk3::OverlayWindow and provide this method.
+  It is just like a draw() method, except it draws the overlay.
+  The overlay will have already been "cleared" when this is called.  You
+  can use any of the routines described in &lt;fltk3/draw.h&gt;.
+*/
+
+// A window using double-buffering and able to draw an overlay
+// on top of that.  Uses the hardware to draw the overlay if
+// possible, otherwise it just draws in the front buffer.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/OverlayWindow.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+
+void fltk3::OverlayWindow::show() {
+  DoubleWindow::show();
+  if (overlay_ && overlay_ != this) overlay_->show();
+}
+
+void fltk3::OverlayWindow::hide() {
+  DoubleWindow::hide();
+}
+
+void fltk3::OverlayWindow::flush() {
+#ifdef BOXX_BUGS
+  if (overlay_ && overlay_ != this && overlay_->shown()) {
+    // all drawing to windows hidden by overlay windows is ignored, fix this
+    XUnmapWindow(fl_display, fl_xid(overlay_));
+    fltk3::DoubleWindow::flush(0);
+    XMapWindow(fl_display, fl_xid(overlay_));
+    return;
+  }
+#endif
+  int erase_overlay = (damage()&fltk3::DAMAGE_OVERLAY) | (overlay_ == this);
+  clear_damage((uchar)(damage()&~fltk3::DAMAGE_OVERLAY));
+  DoubleWindow::flush(erase_overlay);
+  if (overlay_ == this) draw_overlay();
+}
+
+void fltk3::OverlayWindow::resize(int X, int Y, int W, int H) {
+  DoubleWindow::resize(X,Y,W,H);
+  if (overlay_ && overlay_!=this) overlay_->resize(0,0,w(),h());
+}
+
+/**
+  Destroys the window and all child widgets.
+*/
+fltk3::OverlayWindow::~OverlayWindow() {
+  hide();
+//  delete overlay; this is done by ~Fl_Group
+}
+
+#if !HAVE_OVERLAY
+
+int fltk3::OverlayWindow::can_do_overlay() {return 0;}
+
+/**
+  Call this to indicate that the overlay data has changed and needs to
+  be redrawn.  The overlay will be clear until the first time this is
+  called, so if you want an initial display you must call this after
+  calling show().
+*/
+void fltk3::OverlayWindow::redraw_overlay() {
+  overlay_ = this;
+  clear_damage((uchar)(damage()|fltk3::DAMAGE_OVERLAY));
+  fltk3::damage(fltk3::DAMAGE_CHILD);
+}
+
+#else
+
+extern XVisualInfo *fl_find_overlay_visual();
+extern XVisualInfo *fl_overlay_visual;
+extern Colormap fl_overlay_colormap;
+extern unsigned long fl_transparent_pixel;
+static GC gc;	// the GC used by all X windows
+extern uchar fl_overlay; // changes how fltk3::color(x) works
+
+class _Fl_Overlay : public fltk3::Window {
+  friend class fltk3::OverlayWindow;
+  void flush();
+  void show();
+public:
+  _Fl_Overlay(int x, int y, int w, int h) :
+    fltk3::Window(x,y,w,h) {set_flag(INACTIVE);}
+};
+
+int fltk3::OverlayWindow::can_do_overlay() {
+  return fl_find_overlay_visual() != 0;
+}
+
+void _Fl_Overlay::show() {
+  if (shown()) {fltk3::Window::show(); return;}
+  fl_background_pixel = int(fl_transparent_pixel);
+  Fl_X::make_xid(this, fl_overlay_visual, fl_overlay_colormap);
+  fl_background_pixel = -1;
+  // find the outermost window to tell wm about the colormap:
+  fltk3::Window *w = window();
+  for (;;) {fltk3::Window *w1 = w->window(); if (!w1) break; w = w1;}
+  XSetWMColormapWindows(fl_display, fl_xid(w), &(Fl_X::i(this)->xid), 1);
+}
+
+void _Fl_Overlay::flush() {
+  fl_window = fl_xid(this);
+  if (!gc) {
+	  gc = XCreateGC(fl_display, fl_xid(this), 0, 0);
+  }
+  fl_gc = gc;
+#if defined(FLTK_USE_CAIRO)
+      if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+#endif
+  fl_overlay = 1;
+  fltk3::OverlayWindow *w = (fltk3::OverlayWindow *)parent();
+  Fl_X *myi = Fl_X::i(this);
+  if (damage() != fltk3::DAMAGE_EXPOSE) XClearWindow(fl_display, fl_xid(this));
+  fltk3::clip_region(myi->region); myi->region = 0;
+  w->draw_overlay();
+  fl_overlay = 0;
+}
+
+void fltk3::OverlayWindow::redraw_overlay() {
+  if (!fl_display) return; // this prevents fluid -c from opening display
+  if (!overlay_) {
+    if (can_do_overlay()) {
+      fltk3::Group::current(this);
+      overlay_ = new _Fl_Overlay(0,0,w(),h());
+      fltk3::Group::current(0);
+    } else {
+      overlay_ = this;	// fake the overlay
+    }
+  }
+  if (shown()) {
+    if (overlay_ == this) {
+      clear_damage(damage()|fltk3::DAMAGE_OVERLAY);
+      fltk3::damage(fltk3::DAMAGE_CHILD);
+    } else if (!overlay_->shown())
+      overlay_->show();
+    else
+      overlay_->redraw();
+  }
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/PackedGroup.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Pack.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/PackedGroup.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/PackedGroup.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,186 @@
+//
+// "$Id$"
+//
+// Packing widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Based on code by Curtis Edwards
+// Group that compresses all it's children together and resizes to surround
+// them on each redraw (only if box() is zero)
+// Bugs: ?
+
+#include <fltk3/run.h>
+#include <fltk3/PackedGroup.h>
+#include <fltk3/draw.h>
+
+/**
+  Creates a new fltk3::PackedGroup widget using the given position, size,
+  and label string. The default boxtype is fltk3::NO_BOX.
+  <P>The destructor <I>also deletes all the children</I>. This allows a
+  whole tree to be deleted at once, without having to keep a pointer to
+  all the children in the user code. A kludge has been done so the 
+  fltk3::PackedGroup and all of it's children can be automatic (local)
+  variables, but you must declare the fltk3::PackedGroup<I>first</I>, so
+  that it is destroyed last.
+*/
+fltk3::PackedGroup::PackedGroup(int X, int Y, int W, int H,const char *l)
+: fltk3::Group(X, Y, W, H, l) {
+  resizable(0);
+  spacing_ = 0;
+  // type(VERTICAL); // already set like this
+}
+
+// calculate the height and width of this widget.
+// FIXME: do not move any children. "draw()" does that for now.
+void fltk3::PackedGroup::layout() {
+  //int tx = x()+fltk3::box_dx(box());
+  //int ty = y()+fltk3::box_dy(box());
+  int tw = w()-fltk3::box_dw(box());
+  int th = h()-fltk3::box_dh(box());
+  int rw, rh;
+  if (horizontal()) {
+    rw = -spacing_;
+    rh = th;    
+    for (int i = children(); i--;)
+      if (child(i)->visible()) {
+        if (child(i) != this->resizable()) rw += child(i)->w();
+        rw += spacing_;
+      }
+  } else {
+    rw = tw;
+    rh = -spacing_;    
+    for (int i = children(); i--;)
+      if (child(i)->visible()) {
+        if (child(i) != this->resizable()) rh += child(i)->h();
+        rh += spacing_;
+      }
+  }
+  size(rw+fltk3::box_dw(box()), rh+fltk3::box_dh(box()));
+}
+
+void fltk3::PackedGroup::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int tx = x()+fltk3::box_dx(box());
+  int ty = y()+fltk3::box_dy(box());
+  int tw = w()-fltk3::box_dw(box());
+  int th = h()-fltk3::box_dh(box());
+  int rw, rh;
+  int current_position = horizontal() ? tx : ty;
+  int maximum_position = current_position;
+  uchar d = damage();
+  fltk3::Widget*const* a = array();
+  if (horizontal()) {
+    rw = -spacing_;
+    rh = th;
+    
+    for (int i = children(); i--;)
+      if (child(i)->visible()) {
+        if (child(i) != this->resizable()) rw += child(i)->w();
+        rw += spacing_;
+      }
+  } else {
+    rw = tw;
+    rh = -spacing_;
+    
+    for (int i = children(); i--;)
+      if (child(i)->visible()) {
+        if (child(i) != this->resizable()) rh += child(i)->h();
+        rh += spacing_;
+      }
+  }
+  for (int i = children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (o->visible()) {
+      int X,Y,W,H;
+      if (horizontal()) {
+        X = current_position;
+        W = o->w();
+        Y = ty;
+        H = th;
+      } else {
+        X = tx;
+        W = tw;
+        Y = current_position;
+        H = o->h();
+      }
+      // Last child, if resizable, takes all remaining room
+      if(i == 0 && o == this->resizable()) {
+        if(horizontal())
+          W = tw - rw;
+        else
+          H = th - rh;
+      }
+      if (spacing_ && current_position>maximum_position && box() &&
+        (X != o->x() || Y != o->y() || d&fltk3::DAMAGE_ALL)) {
+        fltk3::color(color());
+        if (horizontal())
+          fltk3::rectf(maximum_position, ty, spacing_, th);
+        else
+          fltk3::rectf(tx, maximum_position, tw, spacing_);
+      }
+      if (X != o->x() || Y != o->y() || W != o->w() || H != o->h()) {
+        o->resize(X,Y,W,H);
+        o->clear_damage(fltk3::DAMAGE_ALL);
+      }
+      if (d&fltk3::DAMAGE_ALL) {
+        draw_child(*o);
+        draw_outside_label(*o);
+      } else update_child(*o);
+      // child's draw() can change it's size, so use new size:
+      current_position += (horizontal() ? o->w() : o->h());
+      if (current_position > maximum_position)
+        maximum_position = current_position;
+      current_position += spacing_;
+    }
+  }
+  
+  if (horizontal()) {
+    if (maximum_position < tx+tw && box()) {
+      fltk3::color(color());
+      fltk3::rectf(maximum_position, ty, tx+tw-maximum_position, th);
+    }
+    tw = maximum_position-tx;
+  } else {
+    if (maximum_position < ty+th && box()) {
+      fltk3::color(color());
+      fltk3::rectf(tx, maximum_position, tw, ty+th-maximum_position);
+    }
+    th = maximum_position-ty;
+  }
+  
+  tw += fltk3::box_dw(box()); if (tw <= 0) tw = 1;
+  th += fltk3::box_dh(box()); if (th <= 0) th = 1;
+  if (tw != w() || th != h()) {
+    Widget::resize(x(),y(),tw,th);
+    d = fltk3::DAMAGE_ALL;
+  }
+  if (d&fltk3::DAMAGE_ALL) {
+    draw_box();
+    draw_label();
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/PagedDevice.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Paged_Device.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/PagedDevice.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/PagedDevice.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,297 @@
+//
+// "$Id$"
+//
+// implementation of fltk3::PagedDevice class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+/** \file Fl_Paged_Device.cxx
+ \brief implementation of class fltk3::PagedDevice.
+ */
+
+#include <fltk3/PagedDevice.h>
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+const char *fltk3::PagedDevice::class_id = "fltk3::PagedDevice";
+
+
+/**
+ @brief Draws the widget on the printed page.
+ *
+ The widget's position on the printed page is determined by the last call to origin()
+ and by the optional delta_x and delta_y arguments.
+ Its dimensions are in points unless there was a previous call to scale().
+ @param[in] widget Any FLTK widget (e.g., standard, custom, window).
+ @param[in] delta_x Optional horizontal offset for positioning the widget relatively
+ to the current origin of graphics functions.
+ @param[in] delta_y Same as above, vertically.
+ */
+void fltk3::PagedDevice::print_widget(fltk3::Widget* widget, int delta_x, int delta_y) 
+{ 
+  int old_x, old_y, new_x, new_y, is_window;
+  if ( ! widget->visible() ) return;
+  is_window = (widget->as_window() != NULL);
+  widget->damage(fltk3::DAMAGE_ALL);
+  // set origin to the desired top-left position of the widget
+  origin(&old_x, &old_y);
+  new_x = old_x + delta_x;
+  new_y = old_y + delta_y;
+  if (!is_window) {
+    new_x -= widget->x();
+    new_y -= widget->y();
+  }
+  if (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) fltk3::push_clip(0, 0, widget->w(), widget->h() );
+  // we do some trickery to recognize OpenGL windows and draw them via a plugin
+  int drawn_by_plugin = 0;
+  if (widget->as_gl_window()) {
+    fltk3::PluginManager pm("fltk:device");  
+    fltk3::DevicePlugin *pi = (fltk3::DevicePlugin*)pm.plugin("opengl.device.fltk.org");
+    if (pi) {
+      int width, height;
+      this->printable_rect(&width, &height);
+      drawn_by_plugin = pi->print(widget, 0, 0, height);
+    }
+  }
+  if (!drawn_by_plugin) {
+    widget->draw();
+  }
+  if (is_window) fltk3::pop_clip();
+  // find subwindows of widget and print them
+  traverse(widget);
+  // reset origin to where it was
+  if (new_x != old_x || new_y != old_y) {
+    untranslate();
+  }
+}
+
+
+void fltk3::PagedDevice::traverse(fltk3::Widget *widget)
+{
+  fltk3::Group *g = widget->as_group();
+  if (!g) return;
+  int n = g->children();
+  for (int i = 0; i < n; i++) {
+    fltk3::Widget *c = g->child(i);
+    if ( !c->visible() ) continue;
+    if ( c->as_window() ) {
+      print_widget(c, c->x(), c->y());
+    }
+    else traverse(c);
+  }
+}
+
+/**
+ @brief Computes the page coordinates of the current origin of graphics functions.
+ *
+ @param[out] x If non-null, *x is set to the horizontal page offset of graphics origin.
+ @param[out] y Same as above, vertically.
+ */
+void fltk3::PagedDevice::origin(int *x, int *y)
+{
+  if (x) *x = x_offset;
+  if (y) *y = y_offset;
+}
+
+/**
+ @brief Prints a rectangular part of an on-screen window.
+
+ @param win The window from where to capture.
+ @param x The rectangle left
+ @param y The rectangle top
+ @param w The rectangle width
+ @param h The rectangle height
+ @param delta_x Optional horizontal offset from current graphics origin where to print the captured rectangle.
+ @param delta_y As above, vertically.
+ */
+void fltk3::PagedDevice::print_window_part(fltk3::Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
+{
+  fltk3::SurfaceDevice *current = fltk3::SurfaceDevice::surface();
+  fltk3::DisplayDevice::display_device()->set_current();
+  fltk3::Window *save_front = fltk3::first_window();
+  win->show();
+  fl_gc = NULL;
+  fltk3::check();
+  win->make_current();
+  uchar *image_data;
+  image_data = fltk3::read_image(NULL, x, y, w, h);
+  if (save_front != win) save_front->show();
+  current->set_current();
+  fltk3::draw_image(image_data, delta_x, delta_y, w, h, 3);
+  delete[] image_data;
+#ifdef WIN32
+  fl_gc = GetDC(fl_xid(win));
+  ReleaseDC(fl_xid(win), fl_gc);
+#endif
+}
+
+/**
+ @brief Starts a print job.
+
+ @param[in] pagecount the total number of pages of the job
+ @param[out] frompage if non-null, *frompage is set to the first page the user wants printed
+ @param[out] topage if non-null, *topage is set to the last page the user wants printed
+ @return 0 if OK, non-zero if any error
+ */
+int fltk3::PagedDevice::start_job(int pagecount, int *frompage, int *topage) {return 1;}
+
+/**
+ @brief Starts a new printed page
+
+ The page coordinates are initially in points, i.e., 1/72 inch, 
+ and with origin at the top left of the printable page area.
+ @return 0 if OK, non-zero if any error
+ */
+int fltk3::PagedDevice::start_page (void) {return 1;}
+
+/**
+ @brief Computes the width and height of the printable area of the page.
+
+ Values are in the same unit as that used by FLTK drawing functions,
+ are unchanged by calls to origin(), but are changed by scale() calls.
+ Values account for the user-selected paper type and print orientation.
+ @return 0 if OK, non-zero if any error
+ */
+int fltk3::PagedDevice::printable_rect(int *w, int *h) {return 1;}
+
+/**
+ @brief Computes the dimensions of margins that lie between the printable page area and
+ the full page.
+
+ Values are in the same unit as that used by FLTK drawing functions. They are changed
+ by scale() calls.
+ @param[out] left If non-null, *left is set to the left margin size.
+ @param[out] top If non-null, *top is set to the top margin size.
+ @param[out] right If non-null, *right is set to the right margin size.
+ @param[out] bottom If non-null, *bottom is set to the bottom margin size.
+ */
+void fltk3::PagedDevice::margins(int *left, int *top, int *right, int *bottom) {}
+
+/**
+ @brief Sets the position in page coordinates of the origin of graphics functions.
+
+ Arguments should be expressed relatively to the result of a previous printable_rect() call.
+ That is, <tt>printable_rect(&w, &h); origin(w/2, 0);</tt> sets the graphics origin at the
+ top center of the page printable area.
+ Origin() calls are not affected by rotate() calls.
+ Successive origin() calls don't combine their effects.
+ @param[in] x Horizontal position in page coordinates of the desired origin of graphics functions.
+ @param[in] y Same as above, vertically.
+ */
+void fltk3::PagedDevice::origin(int x, int y) {}
+
+/**
+ @brief Changes the scaling of page coordinates.
+
+ This function also resets the origin of graphics functions at top left of printable page area.
+ After a scale() call, do a printable_rect() call to get the new dimensions of the printable page area.
+ Successive scale() calls don't combine their effects.
+ @param scale_x Horizontal dimensions of plot are multiplied by this quantity.
+ @param scale_y Same as above, vertically. 
+  The value 0. is equivalent to setting \p scale_y = \p scale_x. Thus, scale(factor);
+  is equivalent to scale(factor, factor);
+ */
+void fltk3::PagedDevice::scale (float scale_x, float scale_y) {}
+
+/**
+ @brief Rotates the graphics operations relatively to paper.
+
+ The rotation is centered on the current graphics origin. 
+ Successive rotate() calls don't combine their effects.
+ @param angle Rotation angle in counter-clockwise degrees.
+ */
+void fltk3::PagedDevice::rotate(float angle) {}
+
+/**
+ @brief To be called at the end of each page.
+
+ @return 0 if OK, non-zero if any error.
+ */
+int fltk3::PagedDevice::end_page (void) {return 1;}
+
+/**
+ @brief To be called at the end of a print job.
+ */
+void fltk3::PagedDevice::end_job (void) {}
+
+/**
+ @brief Translates the current graphics origin accounting for the current rotation.
+
+ This function is only useful after a rotate() call. 
+ Each translate() call must be matched by an untranslate() call.
+ Successive translate() calls add up their effects.
+ */
+void fltk3::PagedDevice::translate(int x, int y) {}
+
+/**
+ @brief Undoes the effect of a previous translate() call.
+ */
+void fltk3::PagedDevice::untranslate(void) {}
+
+const fltk3::PagedDevice::page_format fltk3::PagedDevice::page_formats[NO_PAGE_FORMATS] = { 
+  // order of enum Page_Format
+  // comes from appendix B of 5003.PPD_Spec_v4.3.pdf
+  
+  // A* // index(Ai) = i
+  {2384, 3370, "A0"},
+  {1684, 2384, "A1"},
+  {1191, 1684, "A2"},
+  { 842, 1191, "A3"},
+  { 595,  842, "A4"},
+  { 420,  595, "A5"},
+  { 297,  420, "A6"},
+  { 210,  297, "A7"},
+  { 148,  210, "A8"},
+  { 105,  148, "A9"},
+  
+  // B* // index(Bi) = i+10
+  {2920, 4127, "B0"},
+  {2064, 2920, "B1"},
+  {1460, 2064, "B2"},
+  {1032, 1460, "B3"},
+  { 729, 1032, "B4"},
+  { 516,  729, "B5"},
+  { 363,  516, "B6"},
+  { 258,  363, "B7"},
+  { 181,  258, "B8"},
+  { 127,  181, "B9"},
+  {  91,  127, "B10"},
+  
+  // others
+  { 459,  649, "EnvC5"}, // envelope
+  { 312,  624, "EnvDL"}, // envelope
+  { 522,  756, "Executive"},
+  { 595,  935, "Folio"},
+  {1224,  792, "Ledger"}, // landscape
+  { 612, 1008, "Legal"},
+  { 612,  792, "Letter"},
+  { 792, 1224, "Tabloid"},
+  { 297,  684, "Env10"} // envelope
+};
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Pixmap.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Pixmap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Pixmap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Pixmap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,565 @@
+//
+// "$Id$"
+//
+// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/** \fn fltk3::Pixmap::fltk3::Pixmap(const char **data)
+  The constructors create a new pixmap from the specified XPM data.*/
+
+/** \fn fltk3::Pixmap::fltk3::Pixmap(const unsigned char * const *data)
+  The constructors create a new pixmap from the specified XPM data.*/
+
+/** \fn fltk3::Pixmap::fltk3::Pixmap(const unsigned char **data)
+  The constructors create a new pixmap from the specified XPM data.*/
+
+// Draws X pixmap data, keeping it stashed in a server pixmap so it
+// redraws fast.
+
+// See fltk3::draw_pixmap.cxx for code used to get the actual data into pixmap.
+// Implemented without using the xpm library (which I can't use because
+// it interferes with the color cube used by fltk3::draw_image).
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <fltk3/Widget.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/Pixmap.h>
+#include <fltk3/Printer.h>
+
+#include <stdio.h>
+#include "flstring.h"
+#include <ctype.h>
+
+#ifdef WIN32
+extern void fl_release_dc(HWND, HDC);      // located in Fl_win32.cxx
+#endif
+
+#ifdef __APPLE_QUARTZ__
+extern fltk3::Offscreen fl_create_offscreen_with_alpha(int w, int h);
+#endif
+
+extern uchar **fl_mask_bitmap; // used by fltk3::draw_pixmap.cxx to store mask
+
+namespace fltk3 {
+  void restore_clip(); // in fltk3::rect.cxx
+}
+
+void fltk3::Pixmap::measure() {
+  int W, H;
+
+  // ignore empty or bad pixmap data:
+  if (w()<0 && data()) {
+    fltk3::measure_pixmap(data(), W, H);
+    w(W); h(H);
+  }
+}
+
+void fltk3::Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
+  fltk3::graphics_driver->draw(this, XP, YP, WP, HP, cx, cy);
+}
+
+static int start(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int w, int h, int &cx, int &cy, 
+		 int &X, int &Y, int &W, int &H)
+{
+  // ignore empty or bad pixmap data:
+  if (!pxm->data()) {
+    return 2;
+  }
+  if (WP == -1) {
+    WP = w;
+    HP = h;
+  }
+  if (!w) {
+    return 2;
+  }
+  // account for current clip region (faster on Irix):
+  fltk3::clip_box(XP,YP,WP,HP,X,Y,W,H);
+  cx += X-XP; cy += Y-YP;
+  // clip the box down to the size of image, quit if empty:
+  if (cx < 0) {W += cx; X -= cx; cx = 0;}
+  if (cx+W > w) W = w-cx;
+  if (W <= 0) return 1;
+  if (cy < 0) {H += cy; Y -= cy; cy = 0;}
+  if (cy+H > h) H = h-cy;
+  if (H <= 0) return 1;
+  return 0;
+}
+
+#ifdef __APPLE__
+void fltk3::QuartzGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  if (pxm->w() < 0) pxm->measure();
+  int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W, H);
+  if (code) {
+    if (code == 2) pxm->draw_empty(XP, YP);
+    return;
+    }
+  if (!pxm->id_) {
+    pxm->id_ = fl_create_offscreen_with_alpha(pxm->w(), pxm->h());
+    fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
+    fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::GREEN);
+    fl_end_offscreen();
+    }
+  fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+}
+
+#elif defined(WIN32)
+void fltk3::GDIGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  if (pxm->w() < 0) pxm->measure();
+  int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W, H);
+  if (code) {
+    if (code == 2) pxm->draw_empty(XP, YP);
+    return;
+  }
+  if (!pxm->id_) {
+    pxm->id_ = fl_create_offscreen(pxm->w(), pxm->h());
+    fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
+    uchar *bitmap = 0;
+    fl_mask_bitmap = &bitmap;
+    fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::BLACK);
+    fl_mask_bitmap = 0;
+    if (bitmap) {
+      pxm->mask_ = fl_create_bitmask(pxm->w(), pxm->h(), bitmap);
+      delete[] bitmap;
+    }
+    fl_end_offscreen();
+  }
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+    typedef BOOL (WINAPI* fl_transp_func)  (HDC,int,int,int,int,HDC,int,int,int,int,UINT);
+    static HMODULE hMod = NULL;
+    static fl_transp_func fl_TransparentBlt = NULL;
+    if (!hMod) {
+      hMod = LoadLibrary("MSIMG32.DLL");
+      if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
+    }
+    if (fl_TransparentBlt) {
+      fltk3::Offscreen tmp_id = fl_create_offscreen(pxm->w(), pxm->h());
+      fl_begin_offscreen(tmp_id);
+      uchar *bitmap = 0;
+      fl_mask_bitmap = &bitmap;
+      // draw pixmap to offscreen
+      fltk3::draw_pixmap(pxm->data(), 0, 0); 
+      fl_end_offscreen();
+      HDC new_gc = CreateCompatibleDC(fl_gc);
+      int save = SaveDC(new_gc);
+      SelectObject(new_gc, (void*)tmp_id);
+      // print all of offscreen but its parts in background color
+      extern UINT win_pixmap_bg_color; // computed by fltk3::draw_pixmap()
+      fl_TransparentBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, pxm->w(), pxm->h(), win_pixmap_bg_color );
+      RestoreDC(new_gc,save);
+      DeleteDC(new_gc);
+      fl_delete_offscreen(tmp_id);
+    }
+    else {
+      fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+    }
+  }
+  else if (pxm->mask_) {
+    HDC new_gc = CreateCompatibleDC(fl_gc);
+    int save = SaveDC(new_gc);
+    SelectObject(new_gc, (void*)pxm->mask_);
+    BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCAND);
+    SelectObject(new_gc, (void*)pxm->id_);
+    BitBlt(fl_gc, X, Y, W, H, new_gc, cx, cy, SRCPAINT);
+    RestoreDC(new_gc,save);
+    DeleteDC(new_gc);
+  } else {
+    fl_copy_offscreen(X, Y, W, H, (fltk3::Offscreen)pxm->id_, cx, cy);
+  }
+}
+
+#else // Xlib
+void fltk3::XlibGraphicsDriver::draw(fltk3::Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy) {
+  int X, Y, W, H;
+  if (pxm->w() < 0) pxm->measure();
+  int code = start(pxm, XP, YP, WP, HP, pxm->w(), pxm->h(), cx, cy, X, Y, W, H);
+  if (code) {
+    if (code == 2) pxm->draw_empty(XP, YP);
+    return;
+  }
+  if (!pxm->id_) {
+    pxm->id_ = fl_create_offscreen(pxm->w(), pxm->h());
+    fl_begin_offscreen((fltk3::Offscreen)pxm->id_);
+    uchar *bitmap = 0;
+    fl_mask_bitmap = &bitmap;
+    fltk3::draw_pixmap(pxm->data(), 0, 0, fltk3::BLACK);
+    fl_mask_bitmap = 0;
+    if (bitmap) {
+      pxm->mask_ = fl_create_bitmask(pxm->w(), pxm->h(), bitmap);
+      delete[] bitmap;
+    }
+    fl_end_offscreen();
+  }
+  if (pxm->mask_) {
+    // I can't figure out how to combine a mask with existing region,
+    // so cut the image down to a clipped rectangle:
+    int nx, ny; fltk3::clip_box(X,Y,W,H,nx,ny,W,H);
+    cx += nx-X; X = nx;
+    cy += ny-Y; Y = ny;
+    // make X use the bitmap as a mask:
+    XSetClipMask(fl_display, fl_gc, pxm->mask_);
+    int ox = X-cx; if (ox < 0) ox += pxm->w();
+    int oy = Y-cy; if (oy < 0) oy += pxm->h();
+    XSetClipOrigin(fl_display, fl_gc, X-cx, Y-cy);
+  }
+  fl_copy_offscreen(X, Y, W, H, pxm->id_, cx, cy);
+  if (pxm->mask_) {
+    // put the old clip region back
+    XSetClipOrigin(fl_display, fl_gc, 0, 0);
+    fltk3::restore_clip();
+  }
+}
+
+#endif
+
+/**
+  The destructor free all memory and server resources that are used by
+  the pixmap.
+*/
+fltk3::Pixmap::~Pixmap() {
+  uncache();
+  delete_data();
+}
+
+void fltk3::Pixmap::uncache() {
+  if (id_) {
+    fl_delete_offscreen((fltk3::Offscreen)id_);
+    id_ = 0;
+  }
+
+  if (mask_) {
+    fl_delete_bitmask((fltk3::Bitmask)mask_);
+    mask_ = 0;
+  }
+}
+
+void fltk3::Pixmap::label(fltk3::Widget* widget) {
+  widget->image(this);
+}
+
+void fltk3::Pixmap::label(fltk3::MenuItem* m) {
+  m->label(fltk3::IMAGE_LABEL, (const char*)this);
+}
+
+void fltk3::Pixmap::copy_data() {
+  if (alloc_data) return;
+
+  char		**new_data,	// New data array
+		**new_row;	// Current row in image
+  int		i,		// Looping var
+		ncolors,	// Number of colors in image
+		chars_per_pixel,// Characters per color
+		chars_per_line;	// Characters per line 
+
+  // Figure out how many colors there are, and how big they are...
+  sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel);
+  chars_per_line = chars_per_pixel * w() + 1;
+
+  // Allocate memory for the new array...
+  if (ncolors < 0) new_data = new char *[h() + 2];
+  else new_data = new char *[h() + ncolors + 1];
+
+  new_data[0] = new char[strlen(data()[0]) + 1];
+  strcpy(new_data[0], data()[0]);
+
+  // Copy colors...
+  if (ncolors < 0) {
+    // Copy FLTK colormap values...
+    ncolors = -ncolors;
+    new_row = new_data + 1;
+    *new_row = new char[ncolors * 4];
+    memcpy(*new_row, data()[1], ncolors * 4);
+    ncolors = 1;
+    new_row ++;
+  } else {
+    // Copy standard XPM colormap values...
+    for (i = 0, new_row = new_data + 1; i < ncolors; i ++, new_row ++) {
+      *new_row = new char[strlen(data()[i + 1]) + 1];
+      strcpy(*new_row, data()[i + 1]);
+    }
+  }
+
+  // Copy image data...
+  for (i = 0; i < h(); i ++, new_row ++) {
+    *new_row = new char[chars_per_line];
+    memcpy(*new_row, data()[i + ncolors + 1], chars_per_line);
+  }
+
+  // Update pointers...
+  data((const char **)new_data, h() + ncolors + 1);
+  alloc_data = 1;  
+}
+
+fltk3::Image *fltk3::Pixmap::copy(int W, int H) {
+  fltk3::Pixmap	*new_image;	// New pixmap
+
+  // Optimize the simple copy where the width and height are the same...
+  if (W == w() && H == h()) {
+    // Make an exact copy of the image and return it...
+    new_image = new fltk3::Pixmap(data());
+    new_image->copy_data();
+    return new_image;
+  }
+  if (W <= 0 || H <= 0) return 0;
+
+  // OK, need to resize the image data; allocate memory and 
+  char		**new_data,	// New array for image data
+		**new_row,	// Pointer to row in image data
+		*new_ptr,	// Pointer into new array
+		new_info[255];	// New information line
+  const char	*old_ptr;	// Pointer into old array
+  int		i,		// Looping var
+		c,		// Channel number
+		sy,		// Source coordinate
+		dx, dy,		// Destination coordinates
+		xerr, yerr,	// X & Y errors
+		xmod, ymod,	// X & Y moduli
+		xstep, ystep;	// X & Y step increments
+  int		ncolors,	// Number of colors in image
+		chars_per_pixel,// Characters per color
+		chars_per_line;	// Characters per line 
+
+  // Figure out how many colors there are, and how big they are...
+  sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel);
+  chars_per_line = chars_per_pixel * W + 1;
+
+  sprintf(new_info, "%d %d %d %d", W, H, ncolors, chars_per_pixel);
+
+  // Figure out Bresenheim step/modulus values...
+  xmod   = w() % W;
+  xstep  = (w() / W) * chars_per_pixel;
+  ymod   = h() % H;
+  ystep  = h() / H;
+
+  // Allocate memory for the new array...
+  if (ncolors < 0) new_data = new char *[H + 2];
+  else new_data = new char *[H + ncolors + 1];
+  new_data[0] = new char[strlen(new_info) + 1];
+  strcpy(new_data[0], new_info);
+
+  // Copy colors...
+  if (ncolors < 0) {
+    // Copy FLTK colormap values...
+    ncolors = -ncolors;
+    new_row = new_data + 1;
+    *new_row = new char[ncolors * 4];
+    memcpy(*new_row, data()[1], ncolors * 4);
+    ncolors = 1;
+    new_row ++;
+  } else {
+    // Copy standard XPM colormap values...
+    for (i = 0, new_row = new_data + 1; i < ncolors; i ++, new_row ++) {
+      *new_row = new char[strlen(data()[i + 1]) + 1];
+      strcpy(*new_row, data()[i + 1]);
+    }
+  }
+
+  // Scale the image using a nearest-neighbor algorithm...
+  for (dy = H, sy = 0, yerr = H; dy > 0; dy --, new_row ++) {
+    *new_row = new char[chars_per_line];
+    new_ptr  = *new_row;
+
+    for (dx = W, xerr = W, old_ptr = data()[sy + ncolors + 1];
+	 dx > 0;
+	 dx --) {
+      for (c = 0; c < chars_per_pixel; c ++) *new_ptr++ = old_ptr[c];
+
+      old_ptr += xstep;
+      xerr    -= xmod;
+
+      if (xerr <= 0) {
+	xerr    += W;
+	old_ptr += chars_per_pixel;
+      }
+    }
+
+    *new_ptr = '\0';
+    sy       += ystep;
+    yerr     -= ymod;
+    if (yerr <= 0) {
+      yerr += H;
+      sy ++;
+    }
+  }
+
+  new_image = new fltk3::Pixmap((char*const*)new_data);
+  new_image->alloc_data = 1;
+
+  return new_image;
+}
+
+void fltk3::Pixmap::color_average(fltk3::Color c, float i) {
+  // Delete any existing pixmap/mask objects...
+  uncache();
+
+  // Allocate memory as needed...
+  copy_data();
+
+  // Get the color to blend with...
+  uchar		r, g, b;
+  unsigned	ia, ir, ig, ib;
+
+  fltk3::get_color(c, r, g, b);
+  if (i < 0.0f) i = 0.0f;
+  else if (i > 1.0f) i = 1.0f;
+
+  ia = (unsigned)(256 * i);
+  ir = r * (256 - ia);
+  ig = g * (256 - ia);
+  ib = b * (256 - ia);
+
+  // Update the colormap to do the blend...
+  char		line[255];	// New colormap line
+  int		color,		// Looping var
+		ncolors,	// Number of colors in image
+		chars_per_pixel;// Characters per color
+
+
+  sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel);
+
+  if (ncolors < 0) {
+    // Update FLTK colormap...
+    ncolors = -ncolors;
+    uchar *cmap = (uchar *)(data()[1]);
+    for (color = 0; color < ncolors; color ++, cmap += 4) {
+      cmap[1] = (ia * cmap[1] + ir) >> 8;
+      cmap[2] = (ia * cmap[2] + ig) >> 8;
+      cmap[3] = (ia * cmap[3] + ib) >> 8;
+    }
+  } else {
+    // Update standard XPM colormap...
+    for (color = 0; color < ncolors; color ++) {
+      // look for "c word", or last word if none:
+      const char *p = data()[color + 1] + chars_per_pixel + 1;
+      const char *previous_word = p;
+      for (;;) {
+	while (*p && isspace(*p)) p++;
+	char what = *p++;
+	while (*p && !isspace(*p)) p++;
+	while (*p && isspace(*p)) p++;
+	if (!*p) {p = previous_word; break;}
+	if (what == 'c') break;
+	previous_word = p;
+	while (*p && !isspace(*p)) p++;
+      }
+
+      if (fl_parse_color(p, r, g, b)) {
+        r = (ia * r + ir) >> 8;
+        g = (ia * g + ig) >> 8;
+        b = (ia * b + ib) >> 8;
+
+        if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X",
+	                                 data()[color + 1][0],
+	                                 data()[color + 1][1], r, g, b);
+        else sprintf(line, "%c c #%02X%02X%02X", data()[color + 1][0], r, g, b);
+
+        delete[] (char *)data()[color + 1];
+	((char **)data())[color + 1] = new char[strlen(line) + 1];
+	strcpy((char *)data()[color + 1], line);
+      }
+    }
+  }
+}
+
+void fltk3::Pixmap::delete_data() {
+  if (alloc_data) {
+    for (int i = 0; i < count(); i ++) delete[] (char *)data()[i];
+    delete[] (char **)data();
+  }
+}
+
+void fltk3::Pixmap::set_data(const char * const * p) {
+  int	height,		// Number of lines in image
+	ncolors;	// Number of colors in image
+
+  if (p) {
+    sscanf(p[0],"%*d%d%d", &height, &ncolors);
+    if (ncolors < 0) data(p, height + 2);
+    else data(p, height + ncolors + 1);
+  }
+}
+
+
+void fltk3::Pixmap::desaturate() {
+  // Delete any existing pixmap/mask objects...
+  uncache();
+
+  // Allocate memory as needed...
+  copy_data();
+
+  // Update the colormap to grayscale...
+  char		line[255];	// New colormap line
+  int		i,		// Looping var
+		ncolors,	// Number of colors in image
+		chars_per_pixel;// Characters per color
+  uchar		r, g, b;
+
+  sscanf(data()[0],"%*d%*d%d%d", &ncolors, &chars_per_pixel);
+
+  if (ncolors < 0) {
+    // Update FLTK colormap...
+    ncolors = -ncolors;
+    uchar *cmap = (uchar *)(data()[1]);
+    for (i = 0; i < ncolors; i ++, cmap += 4) {
+      g = (uchar)((cmap[1] * 31 + cmap[2] * 61 + cmap[3] * 8) / 100);
+      cmap[1] = cmap[2] = cmap[3] = g;
+    }
+  } else {
+    // Update standard XPM colormap...
+    for (i = 0; i < ncolors; i ++) {
+      // look for "c word", or last word if none:
+      const char *p = data()[i + 1] + chars_per_pixel + 1;
+      const char *previous_word = p;
+      for (;;) {
+	while (*p && isspace(*p)) p++;
+	char what = *p++;
+	while (*p && !isspace(*p)) p++;
+	while (*p && isspace(*p)) p++;
+	if (!*p) {p = previous_word; break;}
+	if (what == 'c') break;
+	previous_word = p;
+	while (*p && !isspace(*p)) p++;
+      }
+
+      if (fl_parse_color(p, r, g, b)) {
+        g = (uchar)((r * 31 + g * 61 + b * 8) / 100);
+
+        if (chars_per_pixel > 1) sprintf(line, "%c%c c #%02X%02X%02X", data()[i + 1][0],
+	                                 data()[i + 1][1], g, g, g);
+        else sprintf(line, "%c c #%02X%02X%02X", data()[i + 1][0], g, g, g);
+
+        delete[] (char *)data()[i + 1];
+	((char **)data())[i + 1] = new char[strlen(line) + 1];
+	strcpy((char *)data()[i + 1], line);
+      }
+    }
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Positioner.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Positioner.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Positioner.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Positioner.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,164 @@
+//
+// "$Id$"
+//
+// Positioner widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+// The positioner widget from Forms, gives 2D input
+// Written by: Mark Overmars
+
+#include <fltk3/run.h>
+#include <fltk3/Positioner.h>
+#include <fltk3/draw.h>
+#include <fltk3/Wrapper.h>
+
+static double flinear(double val, double smin, double smax, double gmin, double gmax)
+{
+  if (smin == smax) return gmax;
+  else return gmin + (gmax - gmin) * (val - smin) / (smax - smin);
+}
+
+void fltk3::Positioner::draw(int X, int Y, int W, int H) {
+  int x1 = X + 4;
+  int y1 = Y + 4;
+  int w1 = W - 2 * 4;
+  int h1 = H - 2 * 4;
+  int xx = int(flinear(xvalue(), xmin, xmax, x1, x1+w1-1)+.5);
+  int yy = int(flinear(yvalue(), ymin, ymax, y1, y1+h1-1)+.5);
+  draw_box(box(), X, Y, W, H, color());
+  fltk3::color(selection_color());
+  fltk3::xyline(x1, yy, x1+w1);
+  fltk3::yxline(xx, y1, y1+h1);
+}
+
+void fltk3::Positioner::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  draw(x(), y(), w(), h());
+  draw_label();
+}
+
+/** Returns the current position in x and y.*/
+int fltk3::Positioner::value(double X, double Y) {
+  clear_changed();
+  if (X == xvalue_ && Y == yvalue_) return 0;
+  xvalue_ = X; yvalue_ = Y;
+  redraw();
+  return 1;
+}
+
+/** Sets the X axis coordinate.*/
+int fltk3::Positioner::xvalue(double X) {
+  return(value(X, yvalue_));
+}
+
+/** Sets the Y axis coordinate.*/
+int fltk3::Positioner::yvalue(double Y) {
+  return(value(xvalue_, Y));
+}
+
+int fltk3::Positioner::handle(int event, int X, int Y, int W, int H) {
+  switch (event) {
+  case fltk3::PUSH:
+  case fltk3::DRAG:
+  case fltk3::RELEASE: {
+    double x1 = X + 4;
+    double y1 = Y + 4;
+    double w1 = W - 2 * 4;
+    double h1 = H - 2 * 4;
+    double xx = flinear(fltk3::event_x(), x1, x1+w1-1.0, xmin, xmax);
+    if (xstep_) xx = int(xx/xstep_+0.5) * xstep_;
+    if (xmin < xmax) {
+      if (xx < xmin) xx = xmin;
+      if (xx > xmax) xx = xmax;
+    } else {
+      if (xx > xmin) xx = xmin;
+      if (xx < xmax) xx = xmax;
+    }
+    double yy = flinear(fltk3::event_y(), y1, y1+h1-1.0, ymin, ymax);
+    if (ystep_) yy = int(yy/ystep_+0.5) * ystep_;
+    if (ymin < ymax) {
+      if (yy < ymin) yy = ymin;
+      if (yy > ymax) yy = ymax;
+    } else {
+      if (yy > ymin) yy = ymin;
+      if (yy < ymax) yy = ymax;
+    }
+    if (xx != xvalue_ || yy != yvalue_) {
+      xvalue_ = xx; yvalue_ = yy;
+      set_changed();
+      redraw();
+                   } }
+    if (!(when() & fltk3::WHEN_CHANGED ||
+	  (when() & fltk3::WHEN_RELEASE && event == fltk3::RELEASE))) return 1;
+    if (changed() || when()&fltk3::WHEN_NOT_CHANGED) {
+      if (event == fltk3::RELEASE) clear_changed();
+      do_callback();
+    }
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+int fltk3::Positioner::handle(int e) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+  return handle(e, x(), y(), w(), h());
+}
+
+/**
+  Creates a new fltk3::Positioner widget using the given position,
+  size, and label string. The default boxtype is fltk3::NO_BOX.
+*/
+fltk3::Positioner::Positioner(int X, int Y, int W, int H, const char* l)
+: fltk3::Widget(X, Y, W, H, l) {
+  box(fltk3::DOWN_BOX);
+  selection_color(fltk3::RED);
+  align(fltk3::ALIGN_BOTTOM);
+  when(fltk3::WHEN_CHANGED);
+  xmin = ymin = 0;
+  xmax = ymax = 1;
+  xvalue_ = yvalue_ = .5;
+  xstep_ = ystep_ = 0;
+}
+
+/** Sets the X axis bounds.*/
+void fltk3::Positioner::xbounds(double a, double b) {
+  if (a != xmin || b != xmax) {
+    xmin = a; xmax = b;
+    redraw();
+  }
+}
+
+/** Sets the Y axis bounds.*/
+void fltk3::Positioner::ybounds(double a, double b) {
+  if (a != ymin || b != ymax) {
+    ymin = a; ymax = b;
+    redraw();
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/PostScript.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_PostScript.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/PostScript.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/PostScript.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1603 @@
+//
+// "$Id$"
+//
+// PostScript device support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/ask.h>
+#include <fltk3/draw.h>
+#include <stdio.h>
+#include <fltk3/PostScript.h>
+#include <fltk3/NativeFileChooser.h>
+#if defined(USE_X11)
+#include "Fl_Font.H"
+#if USE_XFT
+#include <X11/Xft/Xft.h>
+#endif
+#endif
+
+const char *fltk3::PostScriptGraphicsDriver::class_id = "fltk3::PostScriptGraphicsDriver";
+const char *fltk3::PostScriptFileDevice::class_id = "fltk3::PostScriptFileDevice";
+/** \brief Label of the PostScript file chooser window */
+const char *fltk3::PostScriptFileDevice::file_chooser_title = "Select a .ps file";
+
+/**
+ @brief The constructor.
+ */
+fltk3::PostScriptGraphicsDriver::PostScriptGraphicsDriver(void)
+{
+  close_cmd_ = 0;
+  //lang_level_ = 3;
+  lang_level_ = 2;
+  mask = 0;
+  ps_filename_ = NULL;
+  scale_x = scale_y = 1.;
+  bg_r = bg_g = bg_b = 255;
+}
+
+/** \brief The destructor. */
+fltk3::PostScriptGraphicsDriver::~PostScriptGraphicsDriver() {
+  if(ps_filename_) free(ps_filename_);
+}
+
+/**
+ @brief The constructor.
+ */
+fltk3::PostScriptFileDevice::PostScriptFileDevice(void)
+{
+#ifdef __APPLE__
+  gc = fl_gc; // the display context is used by fltk3::text_extents()
+#endif
+  SurfaceDevice::driver( new fltk3::PostScriptGraphicsDriver() );
+}
+
+/**
+ \brief Returns the PostScript driver of this drawing surface.
+ */
+fltk3::PostScriptGraphicsDriver *fltk3::PostScriptFileDevice::driver()
+{
+  return (PostScriptGraphicsDriver*)SurfaceDevice::driver();
+}
+
+
+/**
+ @brief Begins the session where all graphics requests will go to a local PostScript file.
+ *
+ Opens a file dialog entitled with fltk3::PostScriptFileDevice::file_chooser_title to select an output PostScript file.
+ @param pagecount The total number of pages to be created.
+ @param format Desired page format.
+ @param layout Desired page layout.
+ @return 0 if OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
+ */
+int fltk3::PostScriptFileDevice::start_job (int pagecount, enum fltk3::PagedDevice::Page_Format format, 
+					  enum fltk3::PagedDevice::Page_Layout layout)
+{
+  fltk3::NativeFileChooser fnfc;
+  fnfc.title(fltk3::PostScriptFileDevice::file_chooser_title);
+  fnfc.type(fltk3::NativeFileChooser::BROWSE_SAVE_FILE);
+  fnfc.options(fltk3::NativeFileChooser::SAVEAS_CONFIRM);
+  fnfc.filter("PostScript\t*.ps\n");
+  // Show native chooser
+  if ( fnfc.show() ) return 1;
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->output = fopen(fnfc.filename(), "w");
+  if(ps->output == NULL) return 2;
+  ps->ps_filename_ = strdup(fnfc.filename());
+  ps->start_postscript(pagecount, format, layout);
+  this->set_current();
+  return 0;
+}
+
+static int dont_close(FILE *f) 
+{
+  return 0;
+}
+
+/**
+ @brief Begins the session where all graphics requests will go to FILE pointer.
+ *
+ @param ps_output A writable FILE pointer that will receive PostScript output and that should not be closed
+ until after end_job() has been called.
+ @param pagecount The total number of pages to be created.
+ @param format Desired page format.
+ @param layout Desired page layout.
+ @return always 0.
+ */
+int fltk3::PostScriptFileDevice::start_job (FILE *ps_output, int pagecount, 
+    enum fltk3::PagedDevice::Page_Format format, enum fltk3::PagedDevice::Page_Layout layout)
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->output = ps_output;
+  ps->ps_filename_ = NULL;
+  ps->start_postscript(pagecount, format, layout);
+  ps->close_command(dont_close); // so that end_job() doesn't close the file
+  this->set_current();
+  return 0;
+}
+
+/**
+ @brief The destructor.
+ */
+fltk3::PostScriptFileDevice::~PostScriptFileDevice() {
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  if (ps) delete ps;
+}
+
+#ifndef FLTK3_DOXYGEN
+
+#if ! (defined(__APPLE__) || defined(WIN32) )
+  #include "print_panel.cxx"
+#endif
+
+//  Prolog string 
+
+static const char * prolog =
+"%%BeginProlog\n"
+"/L { /y2 exch def\n"
+"/x2 exch def\n"
+"/y1 exch def\n"
+"/x1 exch def\n"
+"newpath   x1 y1 moveto x2 y2 lineto\n"
+"stroke}\n"
+"bind def\n"
+
+
+"/R { /dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath stroke\n"
+"} bind def\n"
+
+"/CL {\n"
+"/dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath\n"
+"clip\n"
+"} bind def\n"
+
+"/FR { /dy exch def\n"
+"/dx exch def\n"
+"/y exch def\n"
+"/x exch def\n"
+"currentlinewidth 0 setlinewidth newpath\n"
+"x y moveto\n"
+"dx 0 rlineto\n"
+"0 dy rlineto\n"
+"dx neg 0 rlineto\n"
+"closepath fill setlinewidth\n"
+"} bind def\n"
+
+"/GS { gsave } bind  def\n"
+"/GR { grestore } bind def\n"
+
+"/SP { showpage } bind def\n"
+"/LW { setlinewidth } bind def\n"
+"/CF /Courier def\n"
+"/SF { /CF exch def } bind def\n"
+"/fsize 12 def\n"
+"/FS { /fsize exch def fsize CF findfont exch scalefont setfont }def \n"
+
+
+"/GL { setgray } bind def\n"
+"/SRGB { setrgbcolor } bind def\n"
+
+//  color images 
+
+"/CI { GS /py exch def /px exch def /sy exch def /sx exch def\n"
+"translate \n"
+"sx sy scale px py 8 \n"
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n false 3"
+" colorimage GR\n"
+"} bind def\n"
+
+//  gray images 
+
+"/GI { GS /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale px py 8 \n"
+
+
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n"
+"image GR\n"
+"} bind def\n"
+
+// single-color bitmask 
+
+"/MI { GS /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale px py true \n"
+"[ px 0 0 py neg 0 py ]\n"
+"currentfile /ASCIIHexDecode filter\n"
+"imagemask GR\n"
+"} bind def\n"
+
+
+//  path 
+
+"/BFP { newpath moveto }  def\n"
+"/BP { newpath } bind def \n"
+"/PL { lineto } bind def \n"
+"/PM { moveto } bind def \n"
+"/MT { moveto } bind def \n"
+"/LT { lineto } bind def \n"
+"/EFP { closepath fill } bind def\n"  //was:stroke
+"/ELP { stroke } bind def\n"  
+"/ECP { closepath stroke } bind def\n"  // Closed (loop)
+"/LW { setlinewidth } bind def\n"
+
+// ////////////////////////// misc ////////////////
+"/TR { translate } bind def\n"
+"/CT { concat } bind def\n"
+"/RCT { matrix invertmatrix concat} bind def\n"
+"/SC { scale } bind def\n"
+//"/GPD { currentpagedevice /PageSize get} def\n"
+
+// show at position with desired width
+// usage:
+// width (string) x y show_pos_width
+"/show_pos_width {GS moveto dup dup stringwidth pop exch length 2 div dup 2 le {pop 9999} if "
+"1 sub exch 3 index exch sub exch "
+"div 0 2 index 1 -1 scale ashow pop pop GR} bind def\n" // spacing altered to match desired width
+//"/show_pos_width {GS moveto dup stringwidth pop 3 2 roll exch div -1 matrix scale concat "
+//"show GR } bind def\n" // horizontally scaled text to match desired width
+
+;
+
+
+static const char * prolog_2 =  // prolog relevant only if lang_level >1
+
+// color image dictionaries
+"/CII {GS /inter exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceRGB setcolorspace\n"
+"/IDD 8 dict def\n"
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+"/Decode [ 0 1 0 1 0 1 ] def\n"
+"end\n"
+"IDD image GR} bind def\n"
+
+// gray image dict 
+"/GII {GS /inter exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceGray setcolorspace\n"
+"/IDD 8 dict def\n"
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+"/Decode [ 0 1 ] def\n"
+"end\n"
+"IDD image GR} bind def\n"
+
+// Create a custom PostScript font derived from PostScript standard text fonts
+// The encoding of this custom font is as follows:
+// 0000-00FF  coincides with Unicode, that is to ASCII + Latin-1
+// 0100-017F  coincides with Unicode, that is to Latin Extended-A
+// 0180-01A6  encodes miscellaneous characters present in PostScript standard text fonts
+
+// use ISOLatin1Encoding for all text fonts
+"/ToISO { dup findfont dup length dict copy begin /Encoding ISOLatin1Encoding def currentdict end definefont pop } def\n"
+"/Helvetica ToISO /Helvetica-Bold ToISO /Helvetica-Oblique ToISO /Helvetica-BoldOblique ToISO \n"
+"/Courier ToISO /Courier-Bold ToISO /Courier-Oblique ToISO /Courier-BoldOblique ToISO \n"
+"/Times-Roman ToISO /Times-Bold ToISO /Times-Italic ToISO /Times-BoldItalic ToISO \n"
+
+// define LatinExtA, the encoding of Latin-extended-A + some additional characters
+// see http://www.adobe.com/devnet/opentype/archives/glyphlist.txt for their names
+"/LatinExtA \n"
+"[ "
+" /Amacron /amacron /Abreve /abreve /Aogonek /aogonek\n" // begin of Latin Extended-A code page
+" /Cacute  /cacute  /Ccircumflex  /ccircumflex  /Cdotaccent  /cdotaccent  /Ccaron  /ccaron \n"
+" /Dcaron  /dcaron   /Dcroat  /dcroat\n"
+" /Emacron  /emacron  /Ebreve  /ebreve  /Edotaccent  /edotaccent  /Eogonek  /eogonek  /Ecaron  /ecaron\n"
+" /Gcircumflex  /gcircumflex  /Gbreve  /gbreve  /Gdotaccent  /gdotaccent  /Gcommaaccent  /gcommaaccent \n"
+" /Hcircumflex /hcircumflex  /Hbar  /hbar  \n"
+" /Itilde  /itilde  /Imacron  /imacron  /Ibreve  /ibreve  /Iogonek  /iogonek /Idotaccent  /dotlessi  \n"
+" /IJ  /ij  /Jcircumflex  /jcircumflex\n"
+" /Kcommaaccent  /kcommaaccent  /kgreenlandic  \n"
+" /Lacute  /lacute  /Lcommaaccent  /lcommaaccent   /Lcaron  /lcaron  /Ldotaccent /ldotaccent   /Lslash  /lslash \n"
+" /Nacute  /nacute  /Ncommaaccent  /ncommaaccent  /Ncaron  /ncaron  /napostrophe  /Eng  /eng  \n"
+" /Omacron  /omacron /Obreve  /obreve  /Ohungarumlaut  /ohungarumlaut  /OE  /oe \n"
+" /Racute  /racute  /Rcommaaccent  /rcommaaccent  /Rcaron  /rcaron \n"
+" /Sacute /sacute  /Scircumflex  /scircumflex  /Scedilla /scedilla /Scaron  /scaron \n"
+" /Tcommaaccent  /tcommaaccent  /Tcaron  /tcaron  /Tbar  /tbar \n"
+" /Utilde  /utilde /Umacron /umacron  /Ubreve  /ubreve  /Uring  /uring  /Uhungarumlaut  /uhungarumlaut  /Uogonek /uogonek \n"
+" /Wcircumflex  /wcircumflex  /Ycircumflex  /ycircumflex  /Ydieresis \n"
+" /Zacute /zacute /Zdotaccent /zdotaccent /Zcaron /zcaron \n"
+" /longs \n" // end of Latin Extended-A code page
+" /florin  /circumflex  /caron  /breve  /dotaccent  /ring \n" // remaining characters from PostScript standard text fonts
+" /ogonek  /tilde  /hungarumlaut  /endash /emdash \n"
+" /quoteleft  /quoteright  /quotesinglbase  /quotedblleft  /quotedblright \n"
+" /quotedblbase  /dagger  /daggerdbl  /bullet  /ellipsis \n"
+" /perthousand  /guilsinglleft  /guilsinglright  /fraction  /Euro \n"
+" /trademark /partialdiff  /Delta /summation  /radical \n"
+" /infinity /notequal /lessequal /greaterequal /lozenge \n"
+" /fi /fl /apple \n"
+" ] def \n"
+// deal with alternative PostScript names of some characters
+" /mycharstrings /Helvetica findfont /CharStrings get def\n"
+" /PSname2 { dup mycharstrings exch known {LatinExtA 3 -1 roll 3 -1 roll put}{pop pop} ifelse } def \n"
+" 16#20 /Gdot PSname2 16#21 /gdot PSname2 16#30 /Idot PSname2 16#3F /Ldot PSname2 16#40 /ldot PSname2 16#7F /slong PSname2 \n"
+
+// proc that gives LatinExtA encoding to a font
+"/ToLatinExtA { findfont dup length dict copy begin /Encoding LatinExtA def currentdict end definefont pop } def\n"
+// create Ext-versions of standard fonts that use LatinExtA encoding \n"
+"/HelveticaExt /Helvetica ToLatinExtA \n"
+"/Helvetica-BoldExt /Helvetica-Bold ToLatinExtA /Helvetica-ObliqueExt /Helvetica-Oblique ToLatinExtA  \n"
+"/Helvetica-BoldObliqueExt /Helvetica-BoldOblique ToLatinExtA  \n"
+"/CourierExt /Courier ToLatinExtA /Courier-BoldExt /Courier-Bold ToLatinExtA  \n"
+"/Courier-ObliqueExt /Courier-Oblique ToLatinExtA /Courier-BoldObliqueExt /Courier-BoldOblique ToLatinExtA \n"
+"/Times-RomanExt /Times-Roman ToLatinExtA /Times-BoldExt /Times-Bold ToLatinExtA  \n"
+"/Times-ItalicExt /Times-Italic ToLatinExtA /Times-BoldItalicExt /Times-BoldItalic ToLatinExtA \n"
+
+// proc to create a Type 0 font with 2-byte encoding 
+// that merges a text font with ISO encoding + same font with LatinExtA encoding
+"/To2byte { 6 dict begin /FontType 0 def \n"
+"/FDepVector 3 1 roll findfont exch findfont 2 array astore def \n"
+"/FontMatrix [1  0  0  1  0  0] def /FMapType 6 def /Encoding [ 0 1 0 ] def\n"
+// 100: Hexa count of ISO array; A7: hexa count of LatinExtA array
+"/SubsVector < 01 0100 00A7 > def\n" 
+"currentdict end definefont pop } def\n"
+// create Type 0 versions of standard fonts
+"/Helvetica2B /HelveticaExt /Helvetica To2byte \n"
+"/Helvetica-Bold2B /Helvetica-BoldExt /Helvetica-Bold To2byte \n"
+"/Helvetica-Oblique2B /Helvetica-ObliqueExt /Helvetica-Oblique To2byte \n"
+"/Helvetica-BoldOblique2B /Helvetica-BoldObliqueExt /Helvetica-BoldOblique To2byte \n"
+"/Courier2B /CourierExt /Courier To2byte \n"
+"/Courier-Bold2B /Courier-BoldExt /Courier-Bold To2byte \n"
+"/Courier-Oblique2B /Courier-ObliqueExt /Courier-Oblique To2byte \n"
+"/Courier-BoldOblique2B /Courier-BoldObliqueExt /Courier-BoldOblique To2byte \n"
+"/Times-Roman2B /Times-RomanExt /Times-Roman To2byte \n"
+"/Times-Bold2B /Times-BoldExt /Times-Bold To2byte \n"
+"/Times-Italic2B /Times-ItalicExt /Times-Italic To2byte \n"
+"/Times-BoldItalic2B /Times-BoldItalicExt /Times-BoldItalic To2byte \n"
+;
+
+static const char * prolog_2_pixmap =  // prolog relevant only if lang_level == 2 for pixmaps/masked color images
+"/pixmap_mat {[ pixmap_sx 0 0 pixmap_sy neg 0 pixmap_sy ]}  bind def\n"
+
+"/pixmap_dict {"
+"<< /PatternType 1 "
+"/PaintType 1 "
+"/TilingType 2 "
+"/BBox [0  0  pixmap_sx  pixmap_sy] "
+"/XStep pixmap_sx "
+"/YStep pixmap_sy\n"
+"/PaintProc "
+"{ begin "
+"pixmap_w pixmap_h scale "
+"pixmap_sx pixmap_sy 8 "
+"pixmap_mat "
+"currentfile /ASCIIHexDecode filter "
+"false 3 "
+"colorimage "
+"end "
+"} bind "
+">>\n"
+"} bind def\n"
+
+"/pixmap_plot {"
+"GS "
+"/pixmap_sy exch def /pixmap_sx exch def\n"
+"/pixmap_h exch def /pixmap_w exch def\n"
+"translate\n"
+"pixmap_dict matrix makepattern setpattern\n"
+"pixmap_w pixmap_h scale\n"
+"pixmap_sx pixmap_sy\n"
+"true\n"
+"pixmap_mat\n"
+"currentfile /ASCIIHexDecode filter\n"
+"imagemask\n"
+"GR\n"
+"} bind def\n"
+;
+
+static const char * prolog_3 = // prolog relevant only if lang_level >2
+
+// masked color images 
+"/CIM {GS /inter exch def /my exch def /mx exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceRGB setcolorspace\n"
+
+"/IDD 8 dict def\n"
+
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+
+"/Decode [ 0 1 0 1 0 1 ] def\n"
+"end\n"
+
+"/IMD 8 dict def\n"
+"IMD begin\n"
+"/ImageType 1 def\n"
+"/Width mx def\n"           
+"/Height my def\n"
+"/BitsPerComponent 1 def\n"
+//  "/Interpolate inter def\n"
+"/ImageMatrix [ mx 0 0 my neg 0 my ] def\n"
+"/Decode [ 1 0 ] def\n"
+"end\n"
+
+"<<\n"
+"/ImageType 3\n"
+"/InterleaveType 2\n"
+"/MaskDict IMD\n"
+"/DataDict IDD\n"
+">> image GR\n"
+"} bind def\n"
+
+
+//  masked gray images 
+"/GIM {GS /inter exch def /my exch def /mx exch def /py exch def /px exch def /sy exch def /sx exch def \n"
+"translate \n"
+"sx sy scale\n"
+"/DeviceGray setcolorspace\n"
+
+"/IDD 8 dict def\n"
+
+"IDD begin\n"
+"/ImageType 1 def\n"
+"/Width px def\n"
+"/Height py def\n"
+"/BitsPerComponent 8 def\n"
+"/Interpolate inter def\n"
+"/DataSource currentfile /ASCIIHexDecode filter def\n"
+"/MultipleDataSources false def\n"
+"/ImageMatrix [ px 0 0 py neg 0 py ] def\n"
+
+"/Decode [ 0 1 ] def\n"
+"end\n"
+
+"/IMD 8 dict def\n"
+
+"IMD begin\n"
+"/ImageType 1 def\n"
+"/Width mx def\n"           
+"/Height my def\n"
+"/BitsPerComponent 1 def\n"
+"/ImageMatrix [ mx 0 0 my neg 0 my ] def\n"
+"/Decode [ 1 0 ] def\n"
+"end\n"
+
+"<<\n"
+"/ImageType 3\n"
+"/InterleaveType 2\n"
+"/MaskDict IMD\n"
+"/DataDict IDD\n"
+">> image GR\n"
+"} bind def\n"
+
+
+"\n"
+;
+
+// end prolog 
+
+int fltk3::PostScriptGraphicsDriver::start_postscript (int pagecount, 
+    enum fltk3::PagedDevice::Page_Format format, enum fltk3::PagedDevice::Page_Layout layout)
+//returns 0 iff OK
+{
+  int w, h, x;
+  if (format == fltk3::PagedDevice::A4) {
+    left_margin = 18;
+    top_margin = 18;
+  }
+  else {
+    left_margin = 12;
+    top_margin = 12;
+  }
+  page_format_ = (enum fltk3::PagedDevice::Page_Format)(format | layout);
+  if (layout & fltk3::PagedDevice::LANDSCAPE){
+    ph_ = fltk3::PagedDevice::page_formats[format].width;
+    pw_ = fltk3::PagedDevice::page_formats[format].height;
+  } else {
+    pw_ = fltk3::PagedDevice::page_formats[format].width;
+    ph_ = fltk3::PagedDevice::page_formats[format].height;
+  }
+  
+  fputs("%!PS-Adobe-3.0\n", output);
+  fputs("%%Creator: FLTK\n", output);
+  if (lang_level_>1)
+    fprintf(output, "%%%%LanguageLevel: %i\n" , lang_level_);
+  if ((pages_ = pagecount))
+    fprintf(output, "%%%%Pages: %i\n", pagecount);
+  else
+    fputs("%%Pages: (atend)\n", output);
+  fprintf(output, "%%%%BeginFeature: *PageSize %s\n", fltk3::PagedDevice::page_formats[format].name );
+  w = fltk3::PagedDevice::page_formats[format].width;
+  h = fltk3::PagedDevice::page_formats[format].height;
+  if (lang_level_ == 3 && (layout & fltk3::PagedDevice::LANDSCAPE) ) { x = w; w = h; h = x; }
+  fprintf(output, "<</PageSize[%d %d]>>setpagedevice\n", w, h );
+  fputs("%%EndFeature\n", output);
+  fputs("%%EndComments\n", output);
+  fputs(prolog, output);
+  if (lang_level_ > 1) {
+    fputs(prolog_2, output);
+    }
+  if (lang_level_ == 2) {
+    fputs(prolog_2_pixmap, output);
+    }
+  if (lang_level_ > 2)
+    fputs(prolog_3, output);
+  if (lang_level_ >= 3) {
+    fputs("/CS { clipsave } bind def\n", output);
+    fputs("/CR { cliprestore } bind def\n", output);
+  } else {
+    fputs("/CS { GS } bind def\n", output);
+    fputs("/CR { GR } bind def\n", output);
+  }
+  page_policy_ = 1;
+  
+  
+  fputs("%%EndProlog\n",output);
+  if (lang_level_ >= 2)
+    fprintf(output,"<< /Policies << /Pagesize 1 >> >> setpagedevice\n");
+  
+  reset();
+  nPages=0;
+  return 0;
+}
+
+void fltk3::PostScriptGraphicsDriver::recover(){
+  color(cr_,cg_,cb_);
+  line_style(linestyle_,linewidth_,linedash_);
+  font(GraphicsDriver::font(), GraphicsDriver::size());
+}
+
+void fltk3::PostScriptGraphicsDriver::reset(){
+  gap_=1;
+  clip_=0;
+  cr_=cg_=cb_=0;
+  GraphicsDriver::font(fltk3::HELVETICA, 12);
+  linewidth_=0;
+  linestyle_=fltk3::SOLID;
+  strcpy(linedash_,"");
+  Clip *c=clip_;   ////just not to have memory leaks for badly writen code (forgotten clip popping)
+  
+  while(c){
+    clip_=clip_->prev;
+    delete c;
+    c=clip_;
+  }
+  
+}
+
+void fltk3::PostScriptGraphicsDriver::page_policy(int p){
+  page_policy_ = p;
+  if(lang_level_>=2)
+    fprintf(output,"<< /Policies << /Pagesize %i >> >> setpagedevice\n", p);
+}
+
+// //////////////////// paging //////////////////////////////////////////
+
+
+
+void fltk3::PostScriptGraphicsDriver::page(double pw, double ph, int media) {
+  
+  if (nPages){
+    fprintf(output, "CR\nGR\nGR\nGR\nSP\nrestore\n");
+  }
+  ++nPages;
+  fprintf(output, "%%%%Page: %i %i\n" , nPages , nPages);
+  fprintf(output, "%%%%PageBoundingBox: 0 0 %d %d\n", (int)pw, (int)ph);
+  if (pw>ph){
+    fprintf(output, "%%%%PageOrientation: Landscape\n");
+  }else{
+    fprintf(output, "%%%%PageOrientation: Portrait\n");
+  }
+  
+  fprintf(output, "%%%%BeginPageSetup\n");
+  if((media & fltk3::PagedDevice::MEDIA) &&(lang_level_>1)){
+    int r = media & fltk3::PagedDevice::REVERSED;
+    if(r) r = 2;
+    fprintf(output, "<< /PageSize [%i %i] /Orientation %i>> setpagedevice\n", (int)(pw+.5), (int)(ph+.5), r);
+  }
+  fprintf(output, "%%%%EndPageSetup\n");
+  
+  //pw_ = pw;
+  //ph_ = ph;
+  reset();
+  
+  fprintf(output, "save\n");
+  fprintf(output, "GS\n");
+  fprintf(output, "%g %g TR\n", (double)0 /*lm_*/ , ph_ /* - tm_*/);
+  fprintf(output, "1 -1 SC\n");
+  line_style(0);
+  fprintf(output, "GS\n");
+  
+  if (!((media & fltk3::PagedDevice::MEDIA) &&(lang_level_>1))){
+    if (pw > ph) {
+      if(media & fltk3::PagedDevice::REVERSED) {
+        fprintf(output, "-90 rotate %i 0 translate\n", int(-pw));
+	}
+      else {
+        fprintf(output, "90 rotate -%i -%i translate\n", (lang_level_ == 2 ? int(pw - ph) : 0), int(ph));
+	}
+      }
+      else {
+	if(media & fltk3::PagedDevice::REVERSED)
+	  fprintf(output, "180 rotate %i %i translate\n", int(-pw), int(-ph));
+	}
+  }
+  fprintf(output, "GS\nCS\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::page(int format){
+/*  if(format &  fltk3::PagedDevice::LANDSCAPE){
+    ph_=fltk3::PagedDevice::page_formats[format & 0xFF].width;
+    pw_=fltk3::PagedDevice::page_formats[format & 0xFF].height;
+  }else{
+    pw_=fltk3::PagedDevice::page_formats[format & 0xFF].width;
+    ph_=fltk3::PagedDevice::page_formats[format & 0xFF].height;
+  }*/
+  page(pw_,ph_,format & 0xFF00);//,orientation only;
+}
+
+void fltk3::PostScriptGraphicsDriver::rect(int x, int y, int w, int h) {
+  // Commented code does not work, i can't find the bug ;-(
+  // fprintf(output, "GS\n");
+  //  fprintf(output, "%i, %i, %i, %i R\n", x , y , w, h);
+  //  fprintf(output, "GR\n");
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y);
+  fprintf(output, "%i %i LT\n", x+w-1 , y);
+  fprintf(output, "%i %i LT\n", x+w-1 , y+h-1);
+  fprintf(output, "%i %i LT\n", x , y+h-1);
+  fprintf(output, "ECP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::rectf(int x, int y, int w, int h) {
+  fprintf(output, "%g %g %i %i FR\n", x-0.5, y-0.5, w, h);
+}
+
+void fltk3::PostScriptGraphicsDriver::line(int x1, int y1, int x2, int y2) {
+  fprintf(output, "GS\n");
+  fprintf(output, "%i %i %i %i L\n", x1 , y1, x2 ,y2);
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::line(int x0, int y0, int x1, int y1, int x2, int y2) {
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x0 , y0);
+  fprintf(output, "%i %i LT\n", x1 , y1);
+  fprintf(output, "%i %i LT\n", x2 , y2);
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::xyline(int x, int y, int x1, int y2, int x3){
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y );
+  fprintf(output, "%i %i LT\n", x1 , y );
+  fprintf(output, "%i %i LT\n", x1 , y2);
+  fprintf(output,"%i %i LT\n", x3 , y2);
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+
+void fltk3::PostScriptGraphicsDriver::xyline(int x, int y, int x1, int y2){
+  
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y);
+  fprintf(output,"%i %i LT\n", x1 , y);
+  fprintf(output, "%i %i LT\n", x1 , y2 );
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::xyline(int x, int y, int x1){
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y);
+  fprintf(output, "%i %i LT\n", x1 , y );
+  fprintf(output, "ELP\n");
+  
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::yxline(int x, int y, int y1, int x2, int y3){
+  fprintf(output, "GS\n");
+  
+  fprintf(output,"BP\n");
+  fprintf(output,"%i %i MT\n", x , y);
+  fprintf(output, "%i %i LT\n", x , y1 );
+  fprintf(output, "%i %i LT\n", x2 , y1 );
+  fprintf(output , "%i %i LT\n", x2 , y3);
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::yxline(int x, int y, int y1, int x2){
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y);
+  fprintf(output, "%i %i LT\n", x , y1);
+  fprintf(output, "%i %i LT\n", x2 , y1);
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::yxline(int x, int y, int y1){
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x , y);
+  fprintf(output, "%i %i LT\n", x , y1);
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::loop(int x0, int y0, int x1, int y1, int x2, int y2) {
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x0 , y0);
+  fprintf(output, "%i %i LT\n", x1 , y1);
+  fprintf(output, "%i %i LT\n", x2 , y2);
+  fprintf(output, "ECP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::loop(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x0 , y0);
+  fprintf(output, "%i %i LT\n", x1 , y1);
+  fprintf(output, "%i %i LT\n", x2 , y2);
+  fprintf(output, "%i %i LT\n", x3 , y3);
+  fprintf(output, "ECP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::polygon(int x0, int y0, int x1, int y1, int x2, int y2) {
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x0 , y0);
+  fprintf(output,"%i %i LT\n", x1 , y1);
+  fprintf(output, "%i %i LT\n", x2 , y2);
+  fprintf(output, "EFP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::polygon(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3) {
+  fprintf(output, "GS\n");
+  fprintf(output,"BP\n");
+  fprintf(output, "%i %i MT\n", x0 , y0 );
+  fprintf(output, "%i %i LT\n", x1 , y1 );
+  fprintf(output, "%i %i LT\n", x2 , y2 );
+  fprintf(output, "%i %i LT\n", x3 , y3 );
+  
+  fprintf(output, "EFP\n");
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::point(int x, int y){
+  rectf(x,y,1,1);
+}
+
+static int dashes_flat[5][7]={
+{-1,0,0,0,0,0,0},
+{3,1,-1,0,0,0,0},
+{1,1,-1,0,0,0,0},
+{3,1,1,1,-1,0,0},
+{3,1,1,1,1,1,-1}
+};
+
+
+//yeah, hack...
+static double dashes_cap[5][7]={
+{-1,0,0,0,0,0,0},
+{2,2,-1,0,0,0,0},
+{0.01,1.99,-1,0,0,0,0},
+{2,2,0.01,1.99,-1,0,0},
+{2,2,0.01,1.99,0.01,1.99,-1}
+};
+
+
+void fltk3::PostScriptGraphicsDriver::line_style(int style, int width, char* dashes){
+  //line_styled_=1;
+  
+  linewidth_=width;
+  linestyle_=style;
+  //dashes_= dashes;
+  if(dashes){
+    if(dashes != linedash_)
+      strcpy(linedash_,dashes);
+    
+  }else
+    linedash_[0]=0;
+  char width0 = 0;
+  if(!width){
+    width=1; //for screen drawing compatibility
+    width0=1;
+  }
+  
+  fprintf(output, "%i setlinewidth\n", width);
+  
+  if(!style && (!dashes || !(*dashes)) && width0) //system lines
+    style = fltk3::CAP_SQUARE;
+  
+  int cap = (style &0xf00) >> 8;
+  if(cap) cap--;
+  fprintf(output,"%i setlinecap\n", cap);
+  
+  int join = (style & 0xf000) >> 12;
+  
+  if(join) join--;
+  fprintf(output,"%i setlinejoin\n", join);
+  
+  
+  fprintf(output, "[");
+  if(dashes && *dashes){
+    while(*dashes){
+      fprintf(output, "%i ", *dashes);
+      dashes++;
+    }
+  }else{
+    int * ds; 
+    if(style & 0x200){ // round and square caps, dash length need to be adjusted
+      double *dt = dashes_cap[style & 0xff];
+      while (*dt >= 0){
+	fprintf(output, "%g ",width * (*dt));
+	dt++;
+      }
+    }else{
+      
+      ds = dashes_flat[style & 0xff];
+      while (*ds >= 0){
+	fprintf(output, "%i ",width * (*ds));
+        ds++;
+      }
+    }
+  }
+  fprintf(output, "] 0 setdash\n");
+}
+
+static const char *_fontNames[] = {
+"Helvetica2B", 
+"Helvetica-Bold2B",
+"Helvetica-Oblique2B",
+"Helvetica-BoldOblique2B",
+"Courier2B",
+"Courier-Bold2B",
+"Courier-Oblique2B",
+"Courier-BoldOblique2B",
+"Times-Roman2B",
+"Times-Bold2B",
+"Times-Italic2B",
+"Times-BoldItalic2B",
+"Symbol",
+"Courier2B",
+"Courier-Bold2B",
+"ZapfDingbats"
+};
+
+void fltk3::PostScriptGraphicsDriver::font(int f, int s) {
+  fltk3::GraphicsDriver *driver = fltk3::DisplayDevice::display_device()->driver();
+  driver->font(f,s); // Use display fonts for font measurement
+  GraphicsDriver::font(f, s);
+  Fl_Font_Descriptor *desc = driver->font_descriptor();
+  this->font_descriptor(desc);
+  if (f < fltk3::FREE_FONT) {
+    float ps_size = s;
+    fprintf(output, "/%s SF\n" , _fontNames[f]);
+#if defined(USE_X11) 
+#if USE_XFT
+    // Xft font height is sometimes larger than the required size (see STR 2566).
+    // Increase the PostScript font size by 15% without exceeding the display font height 
+    int max = desc->font->height;
+    ps_size = s * 1.15;
+    if (ps_size > max) ps_size = max;
+#else
+    // Non-Xft fonts can be smaller than required.
+    // Set the PostScript font size to the display font height 
+    char *name = desc->font->font_name_list[0];
+    char *p = strstr(name, "--");
+    if (p) {
+      sscanf(p + 2, "%f", &ps_size);
+    }
+#endif // USE_XFT
+#endif // USE_X11
+    fprintf(output,"%.1f FS\n", ps_size);
+  }
+}
+
+double fltk3::PostScriptGraphicsDriver::width(const char *s, int n) {
+  return fltk3::DisplayDevice::display_device()->driver()->width(s, n);
+}
+
+int fltk3::PostScriptGraphicsDriver::height() {
+  return fltk3::DisplayDevice::display_device()->driver()->height();
+}
+
+int fltk3::PostScriptGraphicsDriver::descent() {
+  return fltk3::DisplayDevice::display_device()->driver()->descent();
+}
+
+void fltk3::PostScriptGraphicsDriver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
+  fltk3::DisplayDevice::display_device()->driver()->text_extents(c, n, dx, dy, w, h);
+}
+
+
+void fltk3::PostScriptGraphicsDriver::color(fltk3::Color c) {
+  fltk3::get_color(c, cr_, cg_, cb_);
+  color(cr_, cg_, cb_);
+}
+
+void fltk3::PostScriptGraphicsDriver::color(unsigned char r, unsigned char g, unsigned char b) {
+  GraphicsDriver::color( fltk3::rgb_color(r, g, b) );
+  cr_ = r; cg_ = g; cb_ = b;
+  if (r == g && g == b) {
+    double gray = r/255.0;
+    fprintf(output, "%g GL\n", gray);
+  } else {
+    double fr, fg, fb;
+    fr = r/255.0;
+    fg = g/255.0;
+    fb = b/255.0;
+    fprintf(output, "%g %g %g SRGB\n", fr , fg , fb);
+  }
+}
+
+void fltk3::PostScriptGraphicsDriver::draw(int angle, const char *str, int n, int x, int y)
+{
+  fprintf(output, "GS %d %d translate %d rotate\n", x, y, - angle);
+  this->transformed_draw(str, n, 0, 0);
+  fprintf(output, "GR\n");
+}
+
+
+// computes the mask for the RGB image img of all pixels with color != bg
+static uchar *calc_mask(uchar *img, int w, int h, fltk3::Color bg)
+{
+  uchar red, green, blue, r, g, b;
+  uchar bit, byte, *q;
+  fltk3::get_color(bg, red, green, blue);
+  int W = (w+7)/8; // width of mask
+  uchar* mask = new uchar[W * h];
+  q = mask;
+  while (h-- > 0) { // for each row
+    bit = 0x80; // byte with last bit set
+    byte = 0; // next mask byte to compute
+    for (int j = 0; j < w; j++) { // for each column
+      r = *img++; // the pixel color components
+      g = *img++;
+      b = *img++;
+      // if pixel doesn't have bg color, put it in mask
+      if (r != red || g != green || b != blue) byte |= bit;
+      bit = bit>>1; // shift bit one step to the right
+      if (bit == 0) { // single set bit has fallen out
+	*q++ = byte; // enter byte in mask
+	byte = 0; // reset next mask byte to zero
+	bit = 0x80; // and this byte
+	}
+      }
+    if (bit != 0x80) *q++ = byte; // enter last columns' byte in mask
+    }
+  return mask;
+}
+
+// write to PostScript a bitmap image of a UTF8 string
+static void transformed_draw_extra(const char* str, int n, double x, double y, int w, 
+      FILE *output, fltk3::GraphicsDriver *driver, bool rtl) {
+  // scale for bitmask computation
+#if defined(USE_X11) && !USE_XFT
+  float scale = 1; // don't scale because we can't expect to have scalable fonts
+#else
+  float scale = 2;
+#endif
+  fltk3::Fontsize old_size = driver->size();
+  fltk3::Font fontnum = driver->font();
+  int w_scaled =  (int)(w * (scale + 0.5));
+  int h = (int)(driver->height() * scale);
+  // create an offscreen image of the string
+  fltk3::Color text_color = driver->color();
+  fltk3::Color bg_color = fltk3::contrast(fltk3::WHITE, text_color);
+  fltk3::Offscreen off = fl_create_offscreen(w_scaled, (int)(h+3*scale) );
+  fl_begin_offscreen(off);
+  fltk3::color(bg_color);
+  // color offscreen background with a shade contrasting with the text color
+  fltk3::rectf(0, 0, w_scaled, (int)(h+3*scale) );
+  fltk3::color(text_color);
+#if defined(USE_X11) && !USE_XFT
+  // force seeing this font as new so it's applied to the offscreen graphics context
+  fltk3::graphics_driver->font_descriptor(NULL);
+  fltk3::font(fontnum, 0);
+#endif
+  fltk3::font(fontnum, (fltk3::Fontsize)(scale * old_size) );
+  int w2 = (int)fltk3::width(str, n);
+  // draw string in offscreen
+  if (rtl) fltk3::rtl_draw(str, n, w2, (int)(h * 0.8) );
+  else fltk3::draw(str, n, 1, (int)(h * 0.8) );
+  // read (most of) the offscreen image
+  uchar *img = fltk3::read_image(NULL, 1, 1, w2, h, 0);
+  fl_end_offscreen();
+  driver->font(fontnum, old_size);
+  fl_delete_offscreen(off);
+  // compute the mask of what is not the background
+  uchar *mask = calc_mask(img, w2, h, bg_color);
+  delete[] img;
+  // write the string image to PostScript as a scaled bitmask
+  scale = w2 / float(w);
+  fprintf(output, "%g %g %g %g %d %d MI\n", x, y - h*0.77/scale, w2/scale, h/scale, w2, h);
+  uchar *di;
+  int wmask = (w2+7)/8;
+  for (int j = h - 1; j >= 0; j--){
+    di = mask + j * wmask;
+    for (int i = 0; i < wmask; i++){
+      //if (!(i%80)) fprintf(output, "\n"); // don't have lines longer than 255 chars
+      fprintf(output, "%2.2x", *di );
+      di++;
+    }
+    fprintf(output,"\n");
+  }
+  fprintf(output,">\n");
+  delete[] mask;
+}
+
+static int is_in_table(unsigned utf) {
+  unsigned i;
+  static unsigned extra_table_roman[] = { // unicodes/*names*/ of other characters from PostScript standard fonts
+    0x192/*florin*/, 0x2C6/*circumflex*/, 0x2C7/*caron*/, 
+    0x2D8/*breve*/, 0x2D9/*dotaccent*/, 0x2DA/*ring*/, 0x2DB/*ogonek*/, 0x2DC/*tilde*/, 0x2DD/*hungarumlaut*/,
+    0x2013/*endash*/, 0x2014/*emdash*/, 0x2018/*quoteleft*/, 0x2019/*quoteright*/, 
+    0x201A/*quotesinglbase*/, 0x201C/*quotedblleft*/, 0x201D/*quotedblright*/, 0x201E/*quotedblbase*/, 
+    0x2020/*dagger*/, 0x2021/*daggerdbl*/, 0x2022/*bullet*/,
+    0x2026/*ellipsis*/, 0x2030/*perthousand*/, 0x2039/*guilsinglleft*/, 0x203A/*guilsinglright*/, 
+    0x2044/*fraction*/, 0x20AC/*Euro*/, 0x2122/*trademark*/, 
+    0x2202/*partialdiff*/, 0x2206/*Delta*/, 0x2211/*summation*/, 0x221A/*radical*/,
+    0x221E/*infinity*/, 0x2260/*notequal*/, 0x2264/*lessequal*/, 
+    0x2265/*greaterequal*/, 
+    0x25CA/*lozenge*/, 0xFB01/*fi*/, 0xFB02/*fl*/,
+    0xF8FF/*apple*/
+  };
+  for ( i = 0; i < sizeof(extra_table_roman)/sizeof(int); i++) {
+    if (extra_table_roman[i] == utf) return i + 0x180;
+  }
+  return 0;
+}
+
+// outputs in PostScript a UTF8 string using the same width in points as on display
+void fltk3::PostScriptGraphicsDriver::transformed_draw(const char* str, int n, double x, double y) {
+  int len, code;
+  if (!n || !str || !*str) return;
+  // compute display width of string
+  int w = (int)width(str, n);
+  if (w == 0) return;
+  if (GraphicsDriver::font() >= fltk3::FREE_FONT) {
+    transformed_draw_extra(str, n, x, y, w, output, this, false);
+    return;
+    }
+  fprintf(output, "%d <", w);
+  // transforms UTF8 encoding to our custom PostScript encoding as follows:
+  // extract each unicode character
+  // if unicode <= 0x17F, unicode and PostScript codes are identical
+  // if unicode is one of the values listed in extra_table_roman above
+  //    its PostScript code is 0x180 + the character's rank in extra_table_roman
+  // if unicode is something else, draw all string as bitmap image
+
+  const char *last = str + n;
+  const char *str2 = str;
+  while (str2 < last) {
+    // Extract each unicode character of string.
+    unsigned utf = fltk3::utf8decode(str2, last, &len);
+    str2 += len;
+    if (utf <= 0x17F) { // until Latin Extended-A
+      ;
+      }
+    else if ( (code = is_in_table(utf)) != 0) { // other handled characters
+      utf = code;
+      }
+    else { // unhandled character: draw all string as bitmap image
+      fprintf(output, "> pop pop\n"); // close and ignore the opened hex string
+      transformed_draw_extra(str, n, x, y, w, output, this, false);
+      return;
+    }
+    fprintf(output, "%4.4X", utf);
+  }
+  fprintf(output, "> %g %g show_pos_width\n", x, y);
+}
+
+void fltk3::PostScriptGraphicsDriver::rtl_draw(const char* str, int n, int x, int y) {
+  int w = (int)width(str, n);
+  transformed_draw_extra(str, n, x - w, y, w, output, this, true);
+}
+
+void fltk3::PostScriptGraphicsDriver::concat(){
+  fprintf(output,"[%g %g %g %g %g %g] CT\n", fl_matrix->a , fl_matrix->b , fl_matrix->c , fl_matrix->d , fl_matrix->x , fl_matrix->y);
+}
+
+void fltk3::PostScriptGraphicsDriver::reconcat(){
+  fprintf(output, "[%g %g %g %g %g %g] RCT\n" , fl_matrix->a , fl_matrix->b , fl_matrix->c , fl_matrix->d , fl_matrix->x , fl_matrix->y);
+}
+
+/////////////////  transformed (double) drawings ////////////////////////////////
+
+
+void fltk3::PostScriptGraphicsDriver::begin_points(){
+  fprintf(output, "GS\n");
+  concat();
+  
+  fprintf(output, "BP\n");
+  gap_=1;
+  shape_=POINTS;
+}
+
+void fltk3::PostScriptGraphicsDriver::begin_line(){
+  fprintf(output, "GS\n");
+  concat();
+  fprintf(output, "BP\n");
+  gap_=1;
+  shape_=LINE;
+}
+
+void fltk3::PostScriptGraphicsDriver::begin_loop(){
+  fprintf(output, "GS\n");
+  concat();
+  fprintf(output, "BP\n");
+  gap_=1;
+  shape_=LOOP;
+}
+
+void fltk3::PostScriptGraphicsDriver::begin_polygon(){
+  fprintf(output, "GS\n");
+  concat();
+  fprintf(output, "BP\n");
+  gap_=1;
+  shape_=POLYGON;
+}
+
+void fltk3::PostScriptGraphicsDriver::vertex(double x, double y){
+  if(shape_==POINTS){
+    fprintf(output,"%g %g MT\n", x , y);
+    gap_=1;
+    return;
+  }
+  if(gap_){
+    fprintf(output,"%g %g MT\n", x , y);
+    gap_=0;
+  }else
+    fprintf(output, "%g %g LT\n", x , y);
+}
+
+void fltk3::PostScriptGraphicsDriver::curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3){
+  if(shape_==NONE) return;
+  if(gap_)
+    fprintf(output,"%g %g MT\n", x , y);
+  else
+    fprintf(output, "%g %g LT\n", x , y);
+  gap_=0;
+  
+  fprintf(output, "%g %g %g %g %g %g curveto \n", x1 , y1 , x2 , y2 , x3 , y3);
+}
+
+
+void fltk3::PostScriptGraphicsDriver::circle(double x, double y, double r){
+  if(shape_==NONE){
+    fprintf(output, "GS\n");
+    concat();
+    //    fprintf(output, "BP\n");
+    fprintf(output,"%g %g %g 0 360 arc\n", x , y , r);
+    reconcat();
+    //    fprintf(output, "ELP\n");
+    fprintf(output, "GR\n");
+  }else
+    
+    fprintf(output, "%g %g %g 0 360 arc\n", x , y , r);
+  
+}
+
+void fltk3::PostScriptGraphicsDriver::arc(double x, double y, double r, double start, double a){
+  if(shape_==NONE) return;
+  gap_=0;
+  if(start>a)
+    fprintf(output, "%g %g %g %g %g arc\n", x , y , r , -start, -a);
+  else
+    fprintf(output, "%g %g %g %g %g arcn\n", x , y , r , -start, -a);
+  
+}
+
+void fltk3::PostScriptGraphicsDriver::arc(int x, int y, int w, int h, double a1, double a2) {
+  fprintf(output, "GS\n");
+  //fprintf(output, "BP\n");
+  begin_line();
+  fprintf(output, "%g %g TR\n", x + w/2.0 -0.5 , y + h/2.0 - 0.5);
+  fprintf(output, "%g %g SC\n", (w-1)/2.0 , (h-1)/2.0 );
+  arc(0,0,1,a2,a1);
+  //  fprintf(output, "0 0 1 %g %g arc\n" , -a1 , -a2);
+  fprintf(output, "%g %g SC\n", 2.0/(w-1) , 2.0/(h-1) );
+  fprintf(output, "%g %g TR\n", -x - w/2.0 +0.5 , -y - h/2.0 +0.5);
+  end_line();
+  
+  //  fprintf(output, "%g setlinewidth\n",  2/sqrt(w*h));
+  //  fprintf(output, "ELP\n");
+  //  fprintf(output, 2.0/w , 2.0/w , " SC\n";
+  //  fprintf(output, (-x - w/2.0) , (-y - h/2)  , " TR\n";
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::pie(int x, int y, int w, int h, double a1, double a2) {
+  
+  fprintf(output, "GS\n");
+  fprintf(output, "%g %g TR\n", x + w/2.0 -0.5 , y + h/2.0 - 0.5);
+  fprintf(output, "%g %g SC\n", (w-1)/2.0 , (h-1)/2.0 );
+  begin_polygon();
+  vertex(0,0);
+  arc(0.0,0.0, 1, a2, a1);
+  end_polygon();
+  fprintf(output, "GR\n");
+}
+
+void fltk3::PostScriptGraphicsDriver::end_points(){
+  gap_=1;
+  reconcat();
+  fprintf(output, "ELP\n"); //??
+  fprintf(output, "GR\n");
+  shape_=NONE;
+}
+
+void fltk3::PostScriptGraphicsDriver::end_line(){
+  gap_=1;
+  reconcat();
+  fprintf(output, "ELP\n");
+  fprintf(output, "GR\n");
+  shape_=NONE;
+}
+void fltk3::PostScriptGraphicsDriver::end_loop(){
+  gap_=1;
+  reconcat();
+  fprintf(output, "ECP\n");
+  fprintf(output, "GR\n");
+  shape_=NONE;
+}
+
+void fltk3::PostScriptGraphicsDriver::end_polygon(){
+  
+  gap_=1;
+  reconcat();
+  fprintf(output, "EFP\n");
+  fprintf(output, "GR\n");
+  shape_=NONE;
+}
+
+void fltk3::PostScriptGraphicsDriver::transformed_vertex(double x, double y){
+  reconcat();
+  if(gap_){
+    fprintf(output, "%g %g MT\n", x , y);
+    gap_=0;
+  }else
+    fprintf(output, "%g %g LT\n", x , y);
+  concat();
+}
+
+/////////////////////////////   Clipping /////////////////////////////////////////////
+
+void fltk3::PostScriptGraphicsDriver::push_clip(int x, int y, int w, int h) {
+  Clip * c=new Clip();
+  clip_box(x,y,w,h,c->x,c->y,c->w,c->h);
+  c->prev=clip_;
+  clip_=c;
+  fprintf(output, "CR\nCS\n");
+  if(lang_level_<3)
+    recover();
+  fprintf(output, "%g %g %i %i CL\n", clip_->x-0.5 , clip_->y-0.5 , clip_->w  , clip_->h);
+  
+}
+
+void fltk3::PostScriptGraphicsDriver::push_no_clip() {
+  Clip * c = new Clip();
+  c->prev=clip_;
+  clip_=c;
+  clip_->x = clip_->y = clip_->w = clip_->h = -1;
+  fprintf(output, "CR\nCS\n");
+  if(lang_level_<3)
+    recover();
+}
+
+void fltk3::PostScriptGraphicsDriver::pop_clip() {
+  if(!clip_)return;
+  Clip * c=clip_;
+  clip_=clip_->prev;
+  delete c;
+  fprintf(output, "CR\nCS\n");
+  if(clip_ && clip_->w >0)
+    fprintf(output, "%g %g %i %i CL\n", clip_->x - 0.5, clip_->y - 0.5, clip_->w  , clip_->h);
+  // uh, -0.5 is to match screen clipping, for floats there should be something beter
+  if(lang_level_<3)
+    recover();
+}
+
+int fltk3::PostScriptGraphicsDriver::clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H){
+  if(!clip_){
+    X=x;Y=y;W=w;H=h;
+    return 1;
+  }
+  if(clip_->w < 0){
+    X=x;Y=y;W=w;H=h;
+    return 1;
+  }
+  int ret=0;
+  if (x > (X=clip_->x)) {X=x; ret=1;}
+  if (y > (Y=clip_->y)) {Y=y; ret=1;}
+  if ((x+w) < (clip_->x+clip_->w)) {
+    W=x+w-X;
+    
+    ret=1;
+    
+  }else
+    W = clip_->x + clip_->w - X;
+  if(W<0){
+    W=0;
+    return 1;
+  }
+  if ((y+h) < (clip_->y+clip_->h)) {
+    H=y+h-Y;
+    ret=1;
+  }else
+    H = clip_->y + clip_->h - Y;
+  if(H<0){
+    W=0;
+    H=0;
+    return 1;
+  }
+  return ret;
+}
+
+int fltk3::PostScriptGraphicsDriver::not_clipped(int x, int y, int w, int h){
+  if(!clip_) return 1;
+  if(clip_->w < 0) return 1;
+  int X, Y, W, H;
+  clip_box(x, y, w, h, X, Y, W, H);
+  if(W) return 1;
+  return 0;
+}
+
+
+void fltk3::PostScriptFileDevice::margins(int *left, int *top, int *right, int *bottom) // to implement
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  if(left) *left = (int)(ps->left_margin / ps->scale_x + .5);
+  if(right) *right = (int)(ps->left_margin / ps->scale_x + .5);
+  if(top) *top = (int)(ps->top_margin / ps->scale_y + .5);
+  if(bottom) *bottom = (int)(ps->top_margin / ps->scale_y + .5);
+}
+
+int fltk3::PostScriptFileDevice::printable_rect(int *w, int *h)
+//returns 0 iff OK
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  if(w) *w = (int)((ps->pw_ - 2 * ps->left_margin) / ps->scale_x + .5);
+  if(h) *h = (int)((ps->ph_ - 2 * ps->top_margin) / ps->scale_y + .5);
+  return 0;
+}
+
+void fltk3::PostScriptFileDevice::origin(int *x, int *y)
+{
+  PagedDevice::origin(x, y);
+}
+
+void fltk3::PostScriptFileDevice::origin(int x, int y)
+{
+  x_offset = x;
+  y_offset = y;
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  fprintf(ps->output, "GR GR GS %d %d TR  %f %f SC %d %d TR %f rotate GS\n", 
+	  ps->left_margin, ps->top_margin, ps->scale_x, ps->scale_y, x, y, ps->angle);
+}
+
+void fltk3::PostScriptFileDevice::scale (float s_x, float s_y)
+{
+  if (s_y == 0.) s_y = s_x;
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->scale_x = s_x;
+  ps->scale_y = s_y;
+  fprintf(ps->output, "GR GR GS %d %d TR  %f %f SC %f rotate GS\n", 
+	  ps->left_margin, ps->top_margin, ps->scale_x, ps->scale_y, ps->angle);
+}
+
+void fltk3::PostScriptFileDevice::rotate (float rot_angle)
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->angle = - rot_angle;
+  fprintf(ps->output, "GR GR GS %d %d TR  %f %f SC %d %d TR %f rotate GS\n", 
+	  ps->left_margin, ps->top_margin, ps->scale_x, ps->scale_y, x_offset, y_offset, ps->angle);
+}
+
+void fltk3::PostScriptFileDevice::translate(int x, int y)
+{
+  fprintf(driver()->output, "GS %d %d translate GS\n", x, y);
+}
+
+void fltk3::PostScriptFileDevice::untranslate(void)
+{
+  fprintf(driver()->output, "GR GR\n");
+}
+
+int fltk3::PostScriptFileDevice::start_page (void)
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->page(ps->page_format_);
+  x_offset = 0;
+  y_offset = 0;
+  ps->scale_x = ps->scale_y = 1.;
+  ps->angle = 0;
+  fprintf(ps->output, "GR GR GS %d %d translate GS\n", ps->left_margin, ps->top_margin);
+  return 0;
+}
+
+int fltk3::PostScriptFileDevice::end_page (void)
+{
+  return 0;
+}
+
+void fltk3::PostScriptFileDevice::end_job (void)
+// finishes PostScript & closes file
+{
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  if (ps->nPages) {  // for eps nPages is 0 so it is fine ....
+    fprintf(ps->output, "CR\nGR\nGR\nGR\nSP\n restore\n");
+    if (!ps->pages_){
+      fprintf(ps->output, "%%%%Trailer\n");
+      fprintf(ps->output, "%%%%Pages: %i\n" , ps->nPages);
+    };
+  } else
+    fprintf(ps->output, "GR\n restore\n");
+  fputs("%%EOF",ps->output);
+  ps->reset();
+  fflush(ps->output);
+  if(ferror(ps->output)) {
+    fltk3::alert ("Error during PostScript data output.");
+    }
+  if (ps->close_cmd_) {
+    (*ps->close_cmd_)(ps->output);
+  } else {
+    fclose(ps->output);
+    }
+  while (ps->clip_){
+    fltk3::PostScriptGraphicsDriver::Clip * c= ps->clip_;
+    ps->clip_= ps->clip_->prev;
+    delete c;
+  }
+  fltk3::DisplayDevice::display_device()->set_current();
+}
+
+#if ! (defined(__APPLE__) || defined(WIN32) )
+int fltk3::PostScriptPrinter::start_job(int pages, int *firstpage, int *lastpage) {
+  enum fltk3::PagedDevice::Page_Format format;
+  enum fltk3::PagedDevice::Page_Layout layout;
+
+  // first test version for print dialog
+  if (!print_panel) make_print_panel();
+  print_load();
+  print_selection->deactivate();
+  print_all->setonly();
+  print_all->do_callback();
+  print_from->value("1");
+  { char tmp[10]; snprintf(tmp, sizeof(tmp), "%d", pages); print_to->value(tmp); }
+  print_panel->show(); // this is modal
+  while (print_panel->shown()) fltk3::wait();
+  
+  if (!print_start) // user clicked cancel
+    return 1;
+
+  // get options
+
+  format = print_page_size->value() ? fltk3::PagedDevice::A4 : fltk3::PagedDevice::LETTER;
+  { // page range choice
+    int from = 1, to = pages;
+    if (print_pages->value()) {
+      sscanf(print_from->value(), "%d", &from);
+      sscanf(print_to->value(), "%d", &to);
+    }
+    if (from < 1) from = 1;
+    if (to > pages) to = pages;
+    if (to < from) to = from;
+    if (firstpage) *firstpage = from;
+    if (lastpage) *lastpage = to;
+    pages = to - from + 1;
+  }
+  
+  if (print_output_mode[0]->value()) layout = fltk3::PagedDevice::PORTRAIT;
+  else if (print_output_mode[1]->value()) layout = fltk3::PagedDevice::LANDSCAPE;
+  else if (print_output_mode[2]->value()) layout = fltk3::PagedDevice::PORTRAIT;
+  else layout = fltk3::PagedDevice::LANDSCAPE;
+
+  int print_pipe = print_choice->value();	// 0 = print to file, >0 = printer (pipe)
+
+  const char *media = print_page_size->text(print_page_size->value());
+  const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+  if (!print_pipe) printer = "<File>";
+
+  if (!print_pipe) // fall back to file printing
+    return fltk3::PostScriptFileDevice::start_job (pages, format, layout);
+
+  // Print: pipe the output into the lp command...
+
+  char command[1024];
+  snprintf(command, sizeof(command), "lp -s -d %s -n %d -t '%s' -o media=%s",
+             printer, print_collate_button->value() ? 1 : (int)(print_copies->value() + 0.5),
+	     "FLTK", media);
+
+  fltk3::PostScriptGraphicsDriver *ps = driver();
+  ps->output = popen(command, "w");
+  if (!ps->output) {
+    fltk3::alert("could not run command: %s\n",command);
+    return 1;
+  }
+  ps->close_command(pclose);
+  this->set_current();
+  return ps->start_postscript(pages, format, layout); // start printing
+}
+
+#endif // ! (defined(__APPLE__) || defined(WIN32) )
+
+#endif // FLTK3_DOXYGEN
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Preferences.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Preferences.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Preferences.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Preferences.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1803 @@
+//
+// "$Id$"
+//
+// Preferences methods for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2002-2010 by Matthias Melcher.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Preferences.h>
+#include <fltk3/Plugin.h>
+#include <fltk3/filename.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <sys/stat.h>
+#include <time.h>
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#  include <windows.h>
+#  include <direct.h>
+#  include <io.h>
+// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
+// on Windows, which is supposed to be POSIX compliant...
+#  define access _access
+#  define mkdir _mkdir
+#elif defined (__APPLE__)
+#  include <ApplicationServices/ApplicationServices.h>
+#  include <unistd.h>
+#  include <dlfcn.h>
+#else
+#  include <unistd.h>
+#  include <dlfcn.h>
+#endif
+
+#ifdef WIN32
+#  include <windows.h>
+#  include <rpc.h>
+// function pointer for the UuidCreate Function
+// RPC_STATUS RPC_ENTRY UuidCreate(UUID __RPC_FAR *Uuid);
+typedef RPC_STATUS (WINAPI* uuid_func)(UUID __RPC_FAR *Uuid);
+#else
+#  include <sys/time.h>
+#endif // WIN32
+
+#ifdef __CYGWIN__
+#  include <wchar.h>
+#endif
+
+char fltk3::Preferences::nameBuffer[128];
+char fltk3::Preferences::uuidBuffer[40];
+fltk3::Preferences *fltk3::Preferences::runtimePrefs = 0;
+
+/**
+ * Returns a UUID as generated by the system.
+ *
+ * A UUID is a "universally unique identifier" which is commonly used in
+ * configuration files to create identities. A UUID in ASCII looks like this:
+ * <tt>937C4900-51AA-4C11-8DD3-7AB59944F03E</tt>. It has always 36 bytes plus
+ * a trailing zero.
+ *
+ * \return a pointer to a static buffer containing the new UUID in ASCII format.
+ *         The buffer is overwritten during every call to this function!
+ */
+const char *fltk3::Preferences::newUUID() {
+#ifdef __APPLE__
+  CFUUIDRef theUUID = CFUUIDCreate(NULL);
+  CFUUIDBytes b = CFUUIDGetUUIDBytes(theUUID);
+  sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+          b.byte0, b.byte1, b.byte2, b.byte3, b.byte4, b.byte5, b.byte6, b.byte7,
+          b.byte8, b.byte9, b.byte10, b.byte11, b.byte12, b.byte13, b.byte14, b.byte15);
+  CFRelease(theUUID);
+#elif defined (WIN32)
+  // First try and use the win API function UuidCreate(), but if that is not
+  // available, fall back to making something up from scratch.
+  // We do not want to link against the Rpcrt4.dll, as we will rarely use it,
+  // so we load the DLL dynamically, if it is available, and work from there.
+  static HMODULE hMod = NULL;
+  UUID ud;
+  UUID *pu = &ud;
+  int got_uuid = 0;
+
+  if (!hMod) {		// first time in?
+    hMod = LoadLibrary("Rpcrt4.dll");
+  }
+
+  if (hMod) {		// do we have a usable handle to Rpcrt4.dll?
+    uuid_func uuid_crt = (uuid_func)GetProcAddress(hMod, "UuidCreate");
+    if (uuid_crt != NULL) {
+      RPC_STATUS rpc_res = uuid_crt(pu);
+      if ( // is the return status OK for our needs?
+          (rpc_res == RPC_S_OK) ||		// all is well
+          (rpc_res == RPC_S_UUID_LOCAL_ONLY) || // only unique to this machine
+          (rpc_res == RPC_S_UUID_NO_ADDRESS)	// probably only locally unique
+        ) {
+        got_uuid = -1;
+        sprintf(uuidBuffer, "%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+            pu->Data1, pu->Data2, pu->Data3, pu->Data4[0], pu->Data4[1],
+            pu->Data4[2], pu->Data4[3], pu->Data4[4],
+            pu->Data4[5], pu->Data4[6], pu->Data4[7]);
+      }
+    }
+  }
+  if (got_uuid == 0) {		// did not make a UUID - use fallback logic
+    unsigned char b[16];
+    time_t t = time(0);		// first 4 byte
+    b[0] = (unsigned char)t;
+    b[1] = (unsigned char)(t>>8);
+    b[2] = (unsigned char)(t>>16);
+    b[3] = (unsigned char)(t>>24);
+    int r = rand();		// four more bytes
+    b[4] = (unsigned char)r;
+    b[5] = (unsigned char)(r>>8);
+    b[6] = (unsigned char)(r>>16);
+    b[7] = (unsigned char)(r>>24);
+    // Now we try to find 4 more "random" bytes. We extract the
+    // lower 4 bytes from the address of t - it is created on the
+    // stack so *might* be in a different place each time...
+    // This is now done via a union to make it compile OK on 64-bit systems.
+    union { void *pv; unsigned char a[sizeof(void*)]; } v;
+    v.pv = (void *)(&t);
+    // NOTE: This assume that all WinXX systems are little-endian
+    b[8] = v.a[0];
+    b[9] = v.a[1];
+    b[10] = v.a[2];
+    b[11] = v.a[3];
+    TCHAR name[MAX_COMPUTERNAME_LENGTH + 1]; // only used to make last four bytes
+    DWORD nSize = MAX_COMPUTERNAME_LENGTH + 1;
+    // GetComputerName() does not depend on any extra libs, and returns something
+    // analogous to gethostname()
+    GetComputerName(name, &nSize);
+    //  use the first 4 TCHAR's of the name to create the last 4 bytes of our UUID
+    for (int ii = 0; ii < 4; ii++) {
+      b[12 + ii] = (unsigned char)name[ii];
+    }
+    sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+            b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
+            b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]);
+  }
+#else
+  // warning Unix implementation of fltk3::Preferences::newUUID() incomplete!
+  // #include <uuid/uuid.h>
+  // void uuid_generate(uuid_t out);
+  unsigned char b[16];
+  time_t t = time(0);			// first 4 byte
+  b[0] = (unsigned char)t;
+  b[1] = (unsigned char)(t>>8);
+  b[2] = (unsigned char)(t>>16);
+  b[3] = (unsigned char)(t>>24);
+  int r = rand(); 			// four more bytes
+  b[4] = (unsigned char)r;
+  b[5] = (unsigned char)(r>>8);
+  b[6] = (unsigned char)(r>>16);
+  b[7] = (unsigned char)(r>>24);
+  unsigned long a = (unsigned long)&t;	// four more bytes
+  b[8] = (unsigned char)a;
+  b[9] = (unsigned char)(a>>8);
+  b[10] = (unsigned char)(a>>16);
+  b[11] = (unsigned char)(a>>24);
+  // Now we try to find 4 more "random" bytes. We extract the
+  // lower 4 bytes from the address of t - it is created on the
+  // stack so *might* be in a different place each time...
+  // This is now done via a union to make it compile OK on 64-bit systems.
+  union { void *pv; unsigned char a[sizeof(void*)]; } v;
+  v.pv = (void *)(&t);
+  // NOTE: May need to handle big- or little-endian systems here
+# if WORDS_BIGENDIAN
+  b[8] = v.a[sizeof(void*) - 1];
+  b[9] = v.a[sizeof(void*) - 2];
+  b[10] = v.a[sizeof(void*) - 3];
+  b[11] = v.a[sizeof(void*) - 4];
+# else /* data ordered for a little-endian system */
+  b[8] = v.a[0];
+  b[9] = v.a[1];
+  b[10] = v.a[2];
+  b[11] = v.a[3];
+# endif
+  char name[80];			// last four bytes
+  gethostname(name, 79);
+  memcpy(b+12, name, 4);
+  sprintf(uuidBuffer, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
+          b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7],
+          b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]);
+#endif
+
+  return uuidBuffer;
+}
+
+/**
+   The constructor creates a group that manages name/value pairs and
+   child groups. Groups are ready for reading and writing at any time.
+   The root argument is either fltk3::Preferences::USER
+   or fltk3::Preferences::SYSTEM.
+
+   This constructor creates the <i>base</i> instance for all
+   following entries and reads existing databases into memory. The
+   vendor argument is a unique text string identifying the
+   development team or vendor of an application.  A domain name or
+   an EMail address are great unique names, e.g.
+   "researchATmatthiasm.com" or "fltk.org". The
+   application argument can be the working title or final
+   name of your application. Both vendor and
+   application must be valid relative UNIX pathnames and
+   may contain '/'s to create deeper file structures.
+
+   A set of Preferences marked "run-time" exists exactly one per application and
+   only as long as the application runs. It can be used as a database for
+   volatile information. FLTK uses it to register plugins at run-time.
+
+   \param[in] root can be \c USER or \c SYSTEM for user specific or system wide
+              preferences
+   \param[in] vendor unique text describing the company or author of this file
+   \param[in] application unique text describing the application
+*/
+fltk3::Preferences::Preferences( Root root, const char *vendor, const char *application ) {
+  node = new Node( "." );
+  rootNode = new RootNode( this, root, vendor, application );
+  node->setRoot(rootNode);
+}
+
+/**
+   \brief Use this constructor to create or read a preferences file at an
+   arbitrary position in the file system.
+
+   The file name is generated in the form
+   <tt><i>path</i>/<i>application</i>.prefs</tt>. If \p application
+   is \c NULL, \p path must contain the full file name.
+
+   \param[in] path path to the directory that contains the preferences file
+   \param[in] vendor unique text describing the company or author of this file
+   \param[in] application unique text describing the application
+ */
+fltk3::Preferences::Preferences( const char *path, const char *vendor, const char *application ) {
+  node = new Node( "." );
+  rootNode = new RootNode( this, path, vendor, application );
+  node->setRoot(rootNode);
+}
+
+/**
+   \brief Generate or read a new group of entries within another group.
+
+   Use the \p group argument to name the group that you would like to access.
+   \p Group can also contain a path to a group further down the hierarchy by
+   separating group names with a forward slash '/'.
+
+   \param[in] parent reference object for the new group
+   \param[in] group name of the group to access (may contain '/'s)
+ */
+fltk3::Preferences::Preferences( fltk3::Preferences &parent, const char *group ) {
+  rootNode = parent.rootNode;
+  node = parent.node->addChild( group );
+}
+
+/**
+   \brief Create or access a group of preferences using a name.
+   \param[in] parent the parameter parent is a pointer to the parent group.
+              \p Parent may be \p NULL. It then refers to an application internal
+              database which exists only once, and remains in RAM only until the
+              application quits. This database is used to manage plugins and other
+              data indexes by strings.
+   \param[in] group a group name that is used as a key into the database
+   \see fltk3::Preferences( fltk3::Preferences&, const char *group )
+ */
+fltk3::Preferences::Preferences( fltk3::Preferences *parent, const char *group ) {
+  if (parent==0) {
+    if (!runtimePrefs) {
+      runtimePrefs = new fltk3::Preferences();
+      runtimePrefs->node = new Node( "." );
+      runtimePrefs->rootNode = new RootNode( runtimePrefs );
+      runtimePrefs->node->setRoot(rootNode);
+    }
+    parent = runtimePrefs;
+  }
+  rootNode = parent->rootNode;
+  node = parent->node->addChild( group );
+}
+
+/**
+ \brief Open a child group using a given index.
+
+ Use the \p groupIndex argument to find the group that you would like to access.
+ If the given index is invalid (negative or too high), a new group is created
+ with a UUID as a name.
+
+ The index needs to be fixed. It is currently backward. Index 0 points
+ to the last member in the 'list' of preferences.
+
+ \param[in] parent reference object for the new group
+ \param[in] groupIndex zero based index into child groups
+ */
+fltk3::Preferences::Preferences( fltk3::Preferences &parent, int groupIndex ) {
+  rootNode = parent.rootNode;
+  if (groupIndex<0 || groupIndex>=parent.groups()) {
+    node = parent.node->addChild( newUUID() );
+  } else {
+    node = parent.node->childNode( groupIndex );
+  }
+}
+
+/**
+ \see fltk3::Preferences( fltk3::Preferences&, int groupIndex )
+ */
+fltk3::Preferences::Preferences( fltk3::Preferences *parent, int groupIndex ) {
+  rootNode = parent->rootNode;
+  if (groupIndex<0 || groupIndex>=parent->groups()) {
+    node = parent->node->addChild( newUUID() );
+  } else {
+    node = parent->node->childNode( groupIndex );
+  }
+}
+
+/**
+ Create a new dataset access point using a dataset ID.
+
+ ID's are a great way to remember shortcuts to database entries that are deeply
+ nested in a preferences database, as long as the database root is not deleted.
+ An ID can be retrieved from any fltk3::Preferences dataset, and can then be used
+ to create multiple new references to the same dataset.
+
+ ID's can be put very helpful when put into the <tt>user_data()</tt> field of
+ widget callbacks.
+ */
+fltk3::Preferences::Preferences( fltk3::Preferences::ID id ) {
+  node = (Node*)id;
+  rootNode = node->findRoot();
+}
+
+/**
+ Create another reference to a Preferences group.
+ */
+fltk3::Preferences::Preferences(const fltk3::Preferences &rhs)
+: node(rhs.node),
+  rootNode(rhs.rootNode)
+{ }
+
+/**
+ Assign another reference to a Preference group.
+ */
+fltk3::Preferences &fltk3::Preferences::operator=(const fltk3::Preferences &rhs) {
+  if (&rhs != this) {
+    node = rhs.node;
+    rootNode = rhs.rootNode;
+  }
+  return *this;
+}
+
+/**
+   The destructor removes allocated resources. When used on the
+   \em base preferences group, the destructor flushes all
+   changes to the preferences file and deletes all internal
+   databases.
+
+   The destructor does not remove any data from the database. It merely
+   deletes your reference to the database.
+ */
+fltk3::Preferences::~Preferences() {
+  if (node && !node->parent()) delete rootNode;
+  // DO NOT delete nodes! The root node will do that after writing the preferences
+  // zero all pointer to avoid memory errors, even though
+  // Valgrind does not complain (Cygwind does though)
+  node = 0L;
+  rootNode = 0L;
+}
+
+/**
+   Returns the number of groups that are contained within a group.
+
+   \return 0 for no groups at all
+ */
+int fltk3::Preferences::groups() {
+  return node->nChildren();
+}
+
+/**
+   Returns the name of the Nth (\p num_group) group.
+   There is no guaranteed order of group names. The index must
+   be within the range given by groups().
+
+   \param[in] num_group number indexing the requested group
+   \return 'C' string pointer to the group name
+ */
+const char *fltk3::Preferences::group( int num_group ) {
+  return node->child( num_group );
+}
+
+/**
+   Returns non-zero if a group with this name exists.
+   Group names are relative to the Preferences node and can contain a path.
+   "." describes the current node, "./" describes the topmost node.
+   By preceding a groupname with a "./", its path becomes relative to the topmost node.
+
+   \param[in] key name of group that is searched for
+   \return 0 if no group by that name was found
+ */
+char fltk3::Preferences::groupExists( const char *key ) {
+  return node->search( key ) ? 1 : 0 ;
+}
+
+/**
+   Deletes a group.
+
+   Removes a group and all keys and groups within that group
+   from the database.
+
+   \param[in] group name of the group to delete
+   \return 0 if call failed
+ */
+char fltk3::Preferences::deleteGroup( const char *group ) {
+  Node *nd = node->search( group );
+  if ( nd ) return nd->remove();
+  return 0;
+}
+
+/**
+ Delete all groups.
+ */
+char fltk3::Preferences::deleteAllGroups() {
+  node->deleteAllChildren();
+  return 1;
+}
+
+/**
+   Returns the number of entries (name/value pairs) in a group.
+
+   \return number of entries
+ */
+int fltk3::Preferences::entries() {
+  return node->nEntry();
+}
+
+/**
+   Returns the name of an entry. There is no guaranteed order of
+   entry names. The index must be within the range given by
+   entries().
+
+   \param[in] index number indexing the requested entry
+   \return pointer to value cstring
+ */
+const char *fltk3::Preferences::entry( int index ) {
+  return node->entry(index).name;
+}
+
+/**
+   Returns non-zero if an entry with this name exists.
+
+   \param[in] key name of entry that is searched for
+   \return 0 if entry was not found
+ */
+char fltk3::Preferences::entryExists( const char *key ) {
+  return node->getEntry( key )>=0 ? 1 : 0 ;
+}
+
+/**
+   Deletes a single name/value pair.
+
+   This function removes the entry \p key from the database.
+
+   \param[in] key name of entry to delete
+   \return 0 if deleting the entry failed
+ */
+char fltk3::Preferences::deleteEntry( const char *key ) {
+  return node->deleteEntry( key );
+}
+
+/**
+ Delete all entries.
+ */
+char fltk3::Preferences::deleteAllEntries() {
+  node->deleteAllEntries();
+  return 1;
+}
+
+/**
+ Delete all groups and all entries.
+ */
+char fltk3::Preferences::clear() {
+  char ret1 = deleteAllGroups();
+  char ret2 = deleteAllEntries();
+  return ret1 & ret2;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, int &value, int defaultValue ) {
+  const char *v = node->get( key );
+  value = v ? atoi( v ) : defaultValue;
+  return ( v != 0 );
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, int value ) {
+  sprintf( nameBuffer, "%d", value );
+  node->set( key, nameBuffer );
+  return 1;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, float &value, float defaultValue ) {
+  const char *v = node->get( key );
+  value = v ? (float)atof( v ) : defaultValue;
+  return ( v != 0 );
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, float value ) {
+  sprintf( nameBuffer, "%g", value );
+  node->set( key, nameBuffer );
+  return 1;
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \param[in] precision number of decimal digits to represent value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, float value, int precision ) {
+  sprintf( nameBuffer, "%.*g", precision, value );
+  node->set( key, nameBuffer );
+  return 1;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+
+ \param[in] key name of entry
+ \param[out] value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, double &value, double defaultValue ) {
+  const char *v = node->get( key );
+  value = v ? atof( v ) : defaultValue;
+  return ( v != 0 );
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, double value ) {
+  sprintf( nameBuffer, "%g", value );
+  node->set( key, nameBuffer );
+  return 1;
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] value set this entry to \p value
+ \param[in] precision number of decimal digits to represent value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, double value, int precision ) {
+  sprintf( nameBuffer, "%.*g", precision, value );
+  node->set( key, nameBuffer );
+  return 1;
+}
+
+// remove control sequences from a string
+static char *decodeText( const char *src ) {
+  int len = 0;
+  const char *s = src;
+  for ( ; *s; s++, len++ ) {
+    if ( *s == '\\' ) {
+      if ( isdigit( s[1] ) ) {
+        s+=3; 
+      } else { 
+        s+=1;
+      }
+    }
+  }
+  char *dst = (char*)malloc( len+1 ), *d = dst;
+  for ( s = src; *s; s++ ) {
+    char c = *s;
+    if ( c == '\\' ) {
+      if ( s[1] == '\\' ) { *d++ = c; s++; }
+      else if ( s[1] == 'n' ) { *d++ = '\n'; s++; }
+      else if ( s[1] == 'r' ) { *d++ = '\r'; s++; }
+      else if ( isdigit( s[1] ) ) { *d++ = ((s[1]-'0')<<6) + ((s[2]-'0')<<3) + (s[3]-'0'); s+=3; }
+      else s++; // error
+    }
+    else
+      *d++ = c;
+  }
+  *d = 0;
+  return dst;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+ 'maxSize' is the maximum length of text that will be read.
+ The text buffer must allow for one additional byte for a trailling zero.
+
+ \param[in] key name of entry
+ \param[out] text returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] maxSize maximum length of value plus one byte for a trailing zero
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, char *text, const char *defaultValue, int maxSize ) {
+  const char *v = node->get( key );
+  if ( v && strchr( v, '\\' ) ) {
+    char *w = decodeText( v );
+    strlcpy(text, w, maxSize);
+    free( w );
+    return 1;
+  }
+  if ( !v ) v = defaultValue;
+  if ( v ) strlcpy(text, v, maxSize);
+  else text = 0;
+  return ( v != defaultValue );
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0). get() allocates memory of
+ sufficient size to hold the value. The buffer must be free'd by
+ the developer using 'free(value)'.
+
+ \param[in] key name of entry
+ \param[out] text returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, char *&text, const char *defaultValue ) {
+  const char *v = node->get( key );
+  if ( v && strchr( v, '\\' ) ) {
+    text = decodeText( v );
+    return 1;
+  }
+  if ( !v ) v = defaultValue;
+  if ( v )
+    text = strdup( v );
+  else
+    text = 0;
+  return ( v != defaultValue );
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] text set this entry to \p value
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, const char *text ) {
+  const char *s = text ? text : "";
+  int n=0, ns=0;
+  for ( ; *s; s++ ) { n++; if ( *s<32 || *s=='\\' || *s==0x7f ) ns+=4; }
+  if ( ns ) {
+    char *buffer = (char*)malloc( n+ns+1 ), *d = buffer;
+    for ( s=text; *s; ) {
+      char c = *s;
+      if ( c=='\\' ) { *d++ = '\\'; *d++ = '\\'; s++; }
+      else if ( c=='\n' ) { *d++ = '\\'; *d++ = 'n'; s++; }
+      else if ( c=='\r' ) { *d++ = '\\'; *d++ = 'r'; s++; }
+      else if ( c<32 || c==0x7f )
+	{ *d++ = '\\'; *d++ = '0'+((c>>6)&3); *d++ = '0'+((c>>3)&7); *d++ = '0'+(c&7);  s++; }
+      else *d++ = *s++;
+    }
+    *d = 0;
+    node->set( key, buffer );
+    free( buffer );
+  }
+  else
+    node->set( key, text );
+  return 1;
+}
+
+// convert a hex string to binary data
+static void *decodeHex( const char *src, int &size ) {
+  size = strlen( src )/2;
+  unsigned char *data = (unsigned char*)malloc( size ), *d = data;
+  const char *s = src;
+  for ( int i=size; i>0; i-- ) {
+    int v;
+    char x = tolower(*s++);
+    if ( x >= 'a' ) v = x-'a'+10; else v = x-'0';
+    v = v<<4;
+    x = tolower(*s++);
+    if ( x >= 'a' ) v += x-'a'+10; else v += x-'0';
+    *d++ = (uchar)v;
+  }
+  return (void*)data;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0).
+ 'maxSize' is the maximum length of text that will be read.
+
+ \param[in] key name of entry
+ \param[out] data value returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] defaultSize size of default value array
+ \param[in] maxSize maximum length of value
+ \return 0 if the default value was used
+
+ \todo maxSize should receive the number of bytes that were read.
+ */
+char fltk3::Preferences::get( const char *key, void *data, const void *defaultValue, int defaultSize, int maxSize ) {
+  const char *v = node->get( key );
+  if ( v ) {
+    int dsize;
+    void *w = decodeHex( v, dsize );
+    memmove( data, w, dsize>maxSize?maxSize:dsize );
+    free( w );
+    return 1;
+  }
+  if ( defaultValue )
+    memmove( data, defaultValue, defaultSize>maxSize?maxSize:defaultSize );
+  return 0;
+}
+
+/**
+ Reads an entry from the group. A default value must be
+ supplied. The return value indicates if the value was available
+ (non-zero) or the default was used (0). get() allocates memory of
+ sufficient size to hold the value. The buffer must be free'd by
+ the developer using 'free(value)'.
+
+ \param[in] key name of entry
+ \param[out] data returned from preferences or default value if none was set
+ \param[in] defaultValue default value to be used if no preference was set
+ \param[in] defaultSize size of default value array
+ \return 0 if the default value was used
+ */
+char fltk3::Preferences::get( const char *key, void *&data, const void *defaultValue, int defaultSize ) {
+  const char *v = node->get( key );
+  if ( v ) {
+    int dsize;
+    data = decodeHex( v, dsize );
+    return 1;
+  }
+  if ( defaultValue ) {
+    data = (void*)malloc( defaultSize );
+    memmove( data, defaultValue, defaultSize );
+  }
+  else
+    data = 0;
+  return 0;
+}
+
+/**
+ Sets an entry (name/value pair). The return value indicates if there
+ was a problem storing the data in memory. However it does not
+ reflect if the value was actually stored in the preferences
+ file.
+
+ \param[in] key name of entry
+ \param[in] data set this entry to \p value
+ \param[in] dsize size of data array
+ \return 0 if setting the value failed
+ */
+char fltk3::Preferences::set( const char *key, const void *data, int dsize ) {
+  char *buffer = (char*)malloc( dsize*2+1 ), *d = buffer;;
+  unsigned char *s = (unsigned char*)data;
+  for ( ; dsize>0; dsize-- ) {
+    static char lu[] = "0123456789abcdef";
+    unsigned char v = *s++;
+    *d++ = lu[v>>4];
+    *d++ = lu[v&0xf];
+  }
+  *d = 0;
+  node->set( key, buffer );
+  free( buffer );
+  return 1;
+}
+
+/**
+ Returns the size of the value part of an entry.
+
+ \param[in] key name of entry
+ \return size of value
+ */
+int fltk3::Preferences::size( const char *key ) {
+  const char *v = node->get( key );
+  return v ? strlen( v ) : 0 ;
+}
+
+/**
+ \brief Creates a path that is related to the preferences file and
+ that is usable for additional application data.
+
+ This function creates a directory that is named after the preferences
+ database without the \c .prefs extension and located in the same directory.
+ It then fills the given buffer with the complete path name.
+
+ Exmaple:
+ \code
+ fltk3::Preferences prefs( USER, "matthiasm.com", "test" );
+ char path[FLTK3_PATH_MAX];
+ prefs.getUserdataPath( path );
+ \endcode
+ creates the preferences database in (MS Windows):
+ \code
+ c:/Documents and Settings/matt/Application Data/matthiasm.com/test.prefs
+ \endcode
+ and returns the userdata path:
+ \code
+ c:/Documents and Settings/matt/Application Data/matthiasm.com/test/
+ \endcode
+
+ \param[out] path buffer for user data path
+ \param[in] pathlen size of path buffer (should be at least \c FLTK3_PATH_MAX)
+ \return 0 if path was not created or pathname can't fit into buffer
+ */
+char fltk3::Preferences::getUserdataPath( char *path, int pathlen ) {
+  if ( rootNode )
+    return rootNode->getPath( path, pathlen );
+  return 0;
+}
+
+/**
+ Writes all preferences to disk. This function works only with
+ the base preferences group. This function is rarely used as
+ deleting the base preferences flushes automatically.
+ */
+void fltk3::Preferences::flush() {
+  if ( rootNode && node->dirty() )
+    rootNode->write();
+}
+
+//-----------------------------------------------------------------------------
+// helper class to create dynamic group and entry names on the fly
+//
+
+/**
+   Creates a group name or entry name on the fly.
+
+   This version creates a simple unsigned integer as an entry name.
+
+   \code
+     int n, i;
+     fltk3::Preferences prev( appPrefs, "PreviousFiles" );
+     prev.get( "n", 0 );
+     for ( i=0; i<n; i++ )
+       prev.get( fltk3::Preferences::Name(i), prevFile[i], "" );
+   \endcode
+ */
+fltk3::Preferences::Name::Name( unsigned int n ) {
+  data_ = (char*)malloc(20);
+  sprintf(data_, "%u", n);
+}
+
+/**
+   Creates a group name or entry name on the fly.
+
+   This version creates entry names as in 'printf'.
+
+   \code
+     int n, i;
+     fltk3::Preferences prefs( USER, "matthiasm.com", "test" );
+     prev.get( "nFiles", 0 );
+     for ( i=0; i<n; i++ )
+       prev.get( fltk3::Preferences::Name( "File%d", i ), prevFile[i], "" );
+    \endcode
+ */
+fltk3::Preferences::Name::Name( const char *format, ... ) {
+  data_ = (char*)malloc(1024);
+  va_list args;
+  va_start(args, format);
+  vsnprintf(data_, 1024, format, args);
+  va_end(args);
+}
+
+// delete the name
+fltk3::Preferences::Name::~Name() {
+  if (data_) {
+    free(data_);
+    data_ = 0L;
+  }
+}
+
+//-----------------------------------------------------------------------------
+// internal methods, do not modify or use as they will change without notice
+//
+
+int fltk3::Preferences::Node::lastEntrySet = -1;
+
+// recursively create a path in the file system
+static char makePath( const char *path ) {
+  if (access(path, 0)) {
+    const char *s = strrchr( path, '/' );
+    if ( !s ) return 0;
+    int len = s-path;
+    char *p = (char*)malloc( len+1 );
+    memcpy( p, path, len );
+    p[len] = 0;
+    makePath( p );
+    free( p );
+#if defined(WIN32) && !defined(__CYGWIN__)
+    return ( mkdir( path ) == 0 );
+#else
+    return ( mkdir( path, 0777 ) == 0 );
+#endif // WIN32 && !__CYGWIN__
+  }
+  return 1;
+}
+
+#if 0
+// strip the filename and create a path
+static void makePathForFile( const char *path ) {
+  const char *s = strrchr( path, '/' );
+  if ( !s ) return;
+  int len = s-path;
+  char *p = (char*)malloc( len+1 );
+  memcpy( p, path, len );
+  p[len] = 0;
+  makePath( p );
+  free( p );
+}
+#endif
+
+// create the root node
+// - construct the name of the file that will hold our preferences
+fltk3::Preferences::RootNode::RootNode( fltk3::Preferences *prefs, Root root, const char *vendor, const char *application )
+: prefs_(prefs),
+  filename_(0L),
+  vendor_(0L),
+  application_(0L) {
+
+  char filename[ FLTK3_PATH_MAX ]; filename[0] = 0;
+#ifdef WIN32
+#  define FLPREFS_RESOURCE	"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+#  define FLPREFS_RESOURCEW	L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
+  int appDataLen = strlen(vendor) + strlen(application) + 8;
+  DWORD type, nn;
+  LONG err;
+  HKEY key;
+
+  switch (root) {
+    case SYSTEM:
+      err = RegOpenKeyW( HKEY_LOCAL_MACHINE, FLPREFS_RESOURCEW, &key );
+      if (err == ERROR_SUCCESS) {
+        nn = FLTK3_PATH_MAX - appDataLen; 
+        err = RegQueryValueExW( key, L"Common AppData", 0L, &type,
+                                (BYTE*)filename, &nn ); 
+        if ( ( err != ERROR_SUCCESS ) && ( type == REG_SZ ) ) {
+          filename[0] = 0;
+          filename[1] = 0;
+        }
+        RegCloseKey(key);
+      }
+      break;
+    case USER:
+      err = RegOpenKeyW( HKEY_CURRENT_USER, FLPREFS_RESOURCEW, &key );
+      if (err == ERROR_SUCCESS) {
+        nn = FLTK3_PATH_MAX - appDataLen;
+        err = RegQueryValueExW( key, L"AppData", 0L, &type,
+                                (BYTE*)filename, &nn ); 
+        if ( ( err != ERROR_SUCCESS ) && ( type == REG_SZ ) ) {
+          filename[0] = 0;
+          filename[1] = 0;
+	}
+        RegCloseKey(key);
+      }
+      break;
+  } 
+  if (!filename[1] && !filename[0]) {
+    strcpy(filename, "C:\\FLTK");
+  } else {
+#if 0
+    xchar *b = (xchar*)_wcsdup((xchar *)filename);
+#else
+    // cygwin does not come with _wcsdup. Use malloc +  wcscpy.
+    // For implementation of wcsdup functionality See
+    // - http://linenum.info/p/glibc/2.7/wcsmbs/wcsdup.c
+    xchar *b = (xchar*) malloc((wcslen((xchar *) filename) + 1) * sizeof(xchar));
+    wcscpy(b, (xchar *) filename);
+#endif
+    //  filename[fl_unicode2utf(b, wcslen((xchar*)b), filename)] = 0;
+    unsigned len = fltk3::utf8fromwc(filename, (FLTK3_PATH_MAX-1), b, wcslen(b));
+    filename[len] = 0;
+    free(b);
+  }
+  snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
+           "/%s/%s.prefs", vendor, application);
+  for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
+#elif defined ( __APPLE__ )
+  // TODO: verify that this is the Apple sanctioned way of finding these folders
+  // (On MSWindows, this frequently leads to issues with internationalized systems)
+  // Carbon: err = FindFolder( kLocalDomain, kPreferencesFolderType, 1, &spec.vRefNum, &spec.parID );
+  switch (root) {
+    case SYSTEM:
+      strcpy(filename, "/Library/Preferences");
+      break;
+    case USER:
+      sprintf(filename, "%s/Library/Preferences", fltk3::getenv("HOME"));
+      break;
+  }
+  snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
+           "/%s/%s.prefs", vendor, application );
+#else
+  const char *e;
+  switch (root) {
+    case USER:
+      if ((e = fltk3::getenv("HOME")) != NULL) {
+	strlcpy(filename, e, sizeof(filename));
+
+	if (filename[strlen(filename)-1] != '/') {
+	  strlcat(filename, "/.fltk/", sizeof(filename));
+	} else {
+	  strlcat(filename, ".fltk/", sizeof(filename));
+	}
+	break;
+      } 
+    case SYSTEM:
+      strcpy(filename, "/etc/fltk/");
+      break;
+  } 
+  snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
+           "%s/%s.prefs", vendor, application);
+#endif 
+  filename_    = strdup(filename);
+  vendor_      = strdup(vendor);
+  application_ = strdup(application); 
+  read();
+}
+
+// create the root node
+// - construct the name of the file that will hold our preferences
+fltk3::Preferences::RootNode::RootNode( fltk3::Preferences *prefs, const char *path, const char *vendor, const char *application )
+: prefs_(prefs),
+  filename_(0L),
+  vendor_(0L),
+  application_(0L) {
+
+  if (!vendor)
+    vendor = "unknown";
+  if (!application) {
+    application = "unknown";
+    filename_ = strdup(path);
+  } else {
+    char filename[ FLTK3_PATH_MAX ]; filename[0] = 0;
+    snprintf(filename, sizeof(filename), "%s/%s.prefs", path, application);
+    filename_  = strdup(filename);
+  }
+  vendor_      = strdup(vendor);
+  application_ = strdup(application); 
+  read();
+}
+
+// create a root node that exists only on RAM and can not be read or written to
+// a file
+fltk3::Preferences::RootNode::RootNode( fltk3::Preferences *prefs )
+: prefs_(prefs),
+  filename_(0L),
+  vendor_(0L),
+  application_(0L) {
+}
+
+// destroy the root node and all depending nodes
+fltk3::Preferences::RootNode::~RootNode() {
+  if ( prefs_->node->dirty() )
+    write();
+  if ( filename_ ) {
+    free( filename_ );
+    filename_ = 0L;
+  }
+  if ( vendor_ ) {
+    free( vendor_ );
+    vendor_ = 0L;
+  }
+  if ( application_ ) {
+    free( application_ );
+    application_ = 0L;
+  }
+  delete prefs_->node;
+  prefs_->node = 0L;
+}
+
+// read a preferences file and construct the group tree and with all entry leafs
+int fltk3::Preferences::RootNode::read() {
+  if (!filename_)   // RUNTIME preferences
+    return -1; 
+  char buf[1024];
+  FILE *f = fltk3::fopen( filename_, "rb" );
+  if ( !f )
+    return -1; 
+  if (fgets( buf, 1024, f )==0) { /* ignore */ }
+  if (fgets( buf, 1024, f )==0) { /* ignore */ }
+  if (fgets( buf, 1024, f )==0) { /* ignore */ }
+  Node *nd = prefs_->node;
+  for (;;) {
+    if ( !fgets( buf, 1024, f ) ) break;	// EOF or Error
+    if ( buf[0]=='[' ) {			// read a new group
+      int end = strcspn( buf+1, "]\n\r" );
+      buf[ end+1 ] = 0;
+      nd = prefs_->node->find( buf+1 );
+    } else if ( buf[0]=='+' ) {			// value of previous name/value pair spans multiple lines
+      int end = strcspn( buf+1, "\n\r" );
+      if ( end != 0 ) {				// if entry is not empty
+	buf[ end+1 ] = 0;
+	nd->add( buf+1 );
+      }
+    } else {					 // read a name/value pair
+      int end = strcspn( buf, "\n\r" );
+      if ( end != 0 ) {				// if entry is not empty
+	buf[ end ] = 0;
+	nd->set( buf );
+      }
+    }
+  }
+  fclose( f );
+  return 0;
+}
+
+// write the group tree and all entry leafs
+int fltk3::Preferences::RootNode::write() {
+  if (!filename_)   // RUNTIME preferences
+    return -1; 
+  fltk3::make_path_for_file(filename_);
+  FILE *f = fltk3::fopen( filename_, "wb" );
+  if ( !f )
+    return -1; 
+  fprintf( f, "; FLTK preferences file format 1.0\n" );
+  fprintf( f, "; vendor: %s\n", vendor_ );
+  fprintf( f, "; application: %s\n", application_ );
+  prefs_->node->write( f );
+  fclose( f );
+#if !(defined(__APPLE__) || defined(WIN32))
+  // unix: make sure that system prefs are user-readable
+  if (strncmp(filename_, "/etc/fltk/", 10) == 0) {
+    char *p;
+    p = filename_ + 9;
+    do {			 // for each directory to the pref file
+      *p = 0;
+      fltk3::chmod(filename_, 0755); // rwxr-xr-x
+      *p = '/';
+      p = strchr(p+1, '/');
+    } while (p);
+    fltk3::chmod(filename_, 0644);   // rw-r--r--
+  }
+#endif
+  return 0;
+}
+
+// get the path to the preferences directory
+char fltk3::Preferences::RootNode::getPath( char *path, int pathlen ) {
+  if (!filename_)   // RUNTIME preferences
+    return -1; 
+  strlcpy( path, filename_, pathlen); 
+
+  char *s;
+  for ( s = path; *s; s++ ) if ( *s == '\\' ) *s = '/';
+  s = strrchr( path, '.' );
+  if ( !s ) return 0;
+  *s = 0;
+  char ret = fltk3::make_path( path );
+#if !(defined(__APPLE__) || defined(WIN32))
+  // unix: make sure that system prefs dir. is user-readable
+  if (strncmp(path, "/etc/fltk/", 10) == 0) {
+    fltk3::chmod(path, 0755); // rwxr-xr-x
+  }
+#endif
+  strcpy( s, "/" );
+  return ret;
+}
+
+// create a node that represents a group
+// - path must be a single word, prferable alnum(), dot and underscore only. Space is ok.
+fltk3::Preferences::Node::Node( const char *path ) {
+  if ( path ) path_ = strdup( path ); else path_ = 0;
+  child_ = 0; next_ = 0; parent_ = 0;
+  entry_ = 0;
+  nEntry_ = NEntry_ = 0;
+  dirty_ = 0;
+  top_ = 0;
+  indexed_ = 0;
+  index_ = 0;
+  nIndex_ = NIndex_ = 0;
+}
+
+void fltk3::Preferences::Node::deleteAllChildren() {
+  Node *nx;
+  for ( Node *nd = child_; nd; nd = nx ) {
+    nx = nd->next_;
+    delete nd;
+  }
+  child_ = 0L;
+  dirty_ = 1;
+  updateIndex();
+}
+
+void fltk3::Preferences::Node::deleteAllEntries() {
+  if ( entry_ ) {
+    for ( int i = 0; i < nEntry_; i++ ) {
+      if ( entry_[i].name ) {
+	free( entry_[i].name );
+	entry_[i].name = 0L;
+      }
+      if ( entry_[i].value ) {
+	free( entry_[i].value );
+	entry_[i].value = 0L;
+      }
+    }
+    free( entry_ );
+    entry_ = 0L;
+    nEntry_ = 0;
+    NEntry_ = 0;
+  }
+  dirty_ = 1;
+}
+
+// delete this and all depending nodes
+fltk3::Preferences::Node::~Node() {
+  deleteAllChildren();
+  deleteAllEntries();
+  deleteIndex();
+  if ( path_ ) {
+    free( path_ );
+    path_ = 0L;
+  }
+  next_ = 0L;
+  parent_ = 0L;
+}
+
+// recursively check if any entry is dirty (was changed after loading a fresh prefs file)
+char fltk3::Preferences::Node::dirty() {
+  if ( dirty_ ) return 1;
+  if ( next_ && next_->dirty() ) return 1;
+  if ( child_ && child_->dirty() ) return 1;
+  return 0;
+}
+
+// write this node (recursively from the last neighbor back to this)
+// write all entries
+// write all children
+int fltk3::Preferences::Node::write( FILE *f ) {
+  if ( next_ ) next_->write( f );
+  fprintf( f, "\n[%s]\n\n", path_ );
+  for ( int i = 0; i < nEntry_; i++ ) {
+    char *src = entry_[i].value;
+    if ( src ) {		// hack it into smaller pieces if needed
+      fprintf( f, "%s:", entry_[i].name );
+      int cnt, written;
+      for ( cnt = 0; cnt < 60; cnt++ )
+	if ( src[cnt]==0 ) break;
+      written = fwrite( src, cnt, 1, f );
+      fprintf( f, "\n" );
+      src += cnt;
+      for (;*src;) {
+	for ( cnt = 0; cnt < 80; cnt++ )
+	  if ( src[cnt]==0 ) break;
+        fputc( '+', f );
+	written = fwrite( src, cnt, 1, f );
+        fputc( '\n', f );
+	src += cnt;
+      }
+    }
+    else
+      fprintf( f, "%s\n", entry_[i].name );
+  }
+  if ( child_ ) child_->write( f );
+  dirty_ = 0;
+  return 0;
+}
+
+// set the parent node and create the full path
+void fltk3::Preferences::Node::setParent( Node *pn ) {
+  parent_ = pn;
+  next_ = pn->child_;
+  pn->child_ = this;
+  sprintf( nameBuffer, "%s/%s", pn->path_, path_ );
+  free( path_ );
+  path_ = strdup( nameBuffer );
+}
+
+// find the corresponding root node
+fltk3::Preferences::RootNode *fltk3::Preferences::Node::findRoot() {
+  Node *n = this;
+  do {
+    if (n->top_)
+      return n->root_;
+    n = n->parent();
+  } while (n);
+  return 0L;
+}
+
+// add a child to this node and set its path (try to find it first...)
+fltk3::Preferences::Node *fltk3::Preferences::Node::addChild( const char *path ) {
+  sprintf( nameBuffer, "%s/%s", path_, path );
+  char *name = strdup( nameBuffer );
+  Node *nd = find( name );
+  free( name );
+  dirty_ = 1;
+  updateIndex();
+  return nd;
+}
+
+// create and set, or change an entry within this node
+void fltk3::Preferences::Node::set( const char *name, const char *value )
+{
+  for ( int i=0; i<nEntry_; i++ ) {
+    if ( strcmp( name, entry_[i].name ) == 0 ) {
+      if ( !value ) return; // annotation
+      if ( strcmp( value, entry_[i].value ) != 0 ) {
+	if ( entry_[i].value )
+	  free( entry_[i].value );
+	entry_[i].value = strdup( value );
+	dirty_ = 1;
+      }
+      lastEntrySet = i;
+      return;
+    }
+  }
+  if ( NEntry_==nEntry_ ) {
+    NEntry_ = NEntry_ ? NEntry_*2 : 10;
+    entry_ = (Entry*)realloc( entry_, NEntry_ * sizeof(Entry) );
+  }
+  entry_[ nEntry_ ].name = strdup( name );
+  entry_[ nEntry_ ].value = value?strdup( value ):0;
+  lastEntrySet = nEntry_;
+  nEntry_++;
+  dirty_ = 1;
+}
+
+// create or set a value (or annotation) from a single line in the file buffer
+void fltk3::Preferences::Node::set( const char *line ) {
+  // hmm. If we assume that we always read this file in the beginning,
+  // we can handle the dirty flag 'quick and dirty'
+  char dirt = dirty_;
+  if ( line[0]==';' || line[0]==0 || line[0]=='#' ) {
+    set( line, 0 );
+  } else {
+    const char *c = strchr( line, ':' );
+    if ( c ) {
+      unsigned int len = c-line+1;
+      if ( len >= sizeof( nameBuffer ) )
+        len = sizeof( nameBuffer );
+      strlcpy( nameBuffer, line, len );
+      set( nameBuffer, c+1 );
+    } else {
+      set( line, "" );
+    }
+  }
+  dirty_ = dirt;
+}
+
+// add more data to an existing entry
+void fltk3::Preferences::Node::add( const char *line ) {
+  if ( lastEntrySet<0 || lastEntrySet>=nEntry_ ) return;
+  char *&dst = entry_[ lastEntrySet ].value;
+  int a = strlen( dst );
+  int b = strlen( line );
+  dst = (char*)realloc( dst, a+b+1 );
+  memcpy( dst+a, line, b+1 );
+  dirty_ = 1;
+}
+
+// get the value for a name, returns 0 if no such name
+const char *fltk3::Preferences::Node::get( const char *name ) {
+  int i = getEntry( name );
+  return i>=0 ? entry_[i].value : 0 ;
+}
+
+// find the index of an entry, returns -1 if no such entry
+int fltk3::Preferences::Node::getEntry( const char *name ) {
+  for ( int i=0; i<nEntry_; i++ ) {
+    if ( strcmp( name, entry_[i].name ) == 0 ) {
+      return i;
+    }
+  }
+  return -1;
+}
+
+// remove one entry form this group
+char fltk3::Preferences::Node::deleteEntry( const char *name ) {
+  int ix = getEntry( name );
+  if ( ix == -1 ) return 0;
+  memmove( entry_+ix, entry_+ix+1, (nEntry_-ix-1) * sizeof(Entry) );
+  nEntry_--;
+  dirty_ = 1;
+  return 1;
+}
+
+// find a group somewhere in the tree starting here
+// - this method will always return a valid node (except for memory allocation problems)
+// - if the node was not found, 'find' will create the required branch
+fltk3::Preferences::Node *fltk3::Preferences::Node::find( const char *path ) {
+  int len = strlen( path_ );
+  if ( strncmp( path, path_, len ) == 0 ) {
+    if ( path[ len ] == 0 )
+      return this;
+    if ( path[ len ] == '/' ) {
+      Node *nd;
+      for ( nd = child_; nd; nd = nd->next_ ) {
+	Node *nn = nd->find( path );
+	if ( nn ) return nn;
+      }
+      const char *s = path+len+1;
+      const char *e = strchr( s, '/' );
+      if (e) strlcpy( nameBuffer, s, e-s+1 );
+      else strlcpy( nameBuffer, s, sizeof(nameBuffer));
+      nd = new Node( nameBuffer );
+      nd->setParent( this );
+      return nd->find( path );
+    }
+  }
+  return 0;
+}
+
+// find a group somewhere in the tree starting here
+// caller must not set 'offset' argument
+// - if the node does not exist, 'search' returns NULL
+// - if the pathname is "." (current node) return this node
+// - if the pathname is "./" (root node) return the topmost node
+// - if the pathname starts with "./", start the search at the root node instead
+fltk3::Preferences::Node *fltk3::Preferences::Node::search( const char *path, int offset ) { 
+  if ( offset == 0 ) {
+    if ( path[0] == '.' ) {
+      if ( path[1] == 0 ) {
+	return this; // user was searching for current node
+      } else if ( path[1] == '/' ) {
+	Node *nn = this;
+	while ( nn->parent() ) nn = nn->parent();
+	if ( path[2]==0 ) {		// user is searching for root ( "./" )
+	  return nn;
+	}
+	return nn->search( path+2, 2 ); // do a relative search on the root node
+      }
+    }
+    offset = strlen( path_ ) + 1;
+  }
+  int len = strlen( path_ );
+  if ( len < offset-1 ) return 0;
+  len -= offset;
+  if ( ( len <= 0 ) || ( strncmp( path, path_+offset, len ) == 0 ) ) {
+    if ( len > 0 && path[ len ] == 0 )
+      return this;
+    if ( len <= 0 || path[ len ] == '/' ) {
+      for ( Node *nd = child_; nd; nd = nd->next_ ) {
+	Node *nn = nd->search( path, offset );
+	if ( nn ) return nn;
+      }
+      return 0;
+    }
+  }
+  return 0;
+}
+
+// return the number of child nodes (groups)
+int fltk3::Preferences::Node::nChildren() {
+  if (indexed_) {
+    return nIndex_;
+  } else {
+    int cnt = 0;
+    for ( Node *nd = child_; nd; nd = nd->next_ )
+      cnt++;
+    return cnt;
+  }
+}
+
+// return the node name
+const char *fltk3::Preferences::Node::name() {
+  if ( path_ ) {
+    char *r = strrchr( path_, '/' );
+    return r ? r+1 : path_ ;
+  } else {
+    return 0L ;
+  }
+}
+
+// return the n'th child node's name
+const char *fltk3::Preferences::Node::child( int ix ) {
+  Node *nd = childNode( ix );
+  if ( nd )
+    return nd->name();
+  else
+    return 0L ;
+}
+
+// return the n'th child node
+fltk3::Preferences::Node *fltk3::Preferences::Node::childNode( int ix ) {
+  createIndex();
+  if (indexed_) {
+    // usually faster access in correct order, but needing more memory
+    return index_[ix];
+  } else {
+    // slow access and reverse order
+    int n = nChildren();
+    ix = n - ix -1;
+    Node *nd;
+    for ( nd = child_; nd; nd = nd->next_ ) {
+      if ( !ix-- ) break;
+      if ( !nd ) break;
+    }
+    return nd;
+  }
+}
+
+// remove myself from the list and delete me (and all children)
+char fltk3::Preferences::Node::remove() {
+  Node *nd = 0, *np;
+  if ( parent() ) {
+    nd = parent()->child_; np = 0L;
+    for ( ; nd; np = nd, nd = nd->next_ ) {
+      if ( nd == this ) {
+	if ( np )
+	  np->next_ = nd->next_;
+	else
+	  parent()->child_ = nd->next_;
+	break;
+      }
+    }
+    parent()->dirty_ = 1;
+    parent()->updateIndex();
+  }
+  delete this;
+  return ( nd != 0 );
+}
+
+void fltk3::Preferences::Node::createIndex() {
+  if (indexed_) return;
+  int n = nChildren();
+  if (n>NIndex_) {
+    NIndex_ = n + 16;
+    index_ = (Node**)realloc(index_, NIndex_*sizeof(Node**));
+  }
+  Node *nd;
+  int i = 0;
+  for (nd = child_; nd; nd = nd->next_, i++) {
+    index_[n-i-1] = nd;
+  }
+  nIndex_ = n;
+  indexed_ = 1;
+}
+
+void fltk3::Preferences::Node::updateIndex() {
+  indexed_ = 0;
+}
+
+void fltk3::Preferences::Node::deleteIndex() {
+  if (index_) free(index_);
+  NIndex_ = nIndex_ = 0;
+  index_ = 0;
+  indexed_ = 0;
+}
+
+/**
+ * \brief Create a plugin.
+ *
+ * \param[in] klass plugins are grouped in classes
+ * \param[in] name every plugin should have a unique name
+ */
+fltk3::Plugin::Plugin(const char *klass, const char *name)
+: id(0) {
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: creating a plugin, class \"%s\", name \"%s\"\n",
+         klass, name);
+#endif
+  fltk3::PluginManager pm(klass);
+  id = pm.addPlugin(name, this);
+}
+
+/**
+ * \brief Clear the plugin and remove it from the database.
+ */
+fltk3::Plugin::~Plugin() {
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: deleting a plugin\n");
+#endif
+  if (id)
+    fltk3::PluginManager::remove(id);
+}
+
+/**
+ * \brief Manage all plugins belonging to one class.
+ */
+fltk3::PluginManager::PluginManager(const char *klass)
+: fltk3::Preferences(0, fltk3::Preferences::Name("%s/%s", "plugins", klass)) {
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: creating a plugin manager for class \"%s\"\n", klass);
+#endif
+}
+
+/**
+ * \brief Remove the plugin manager.
+ *
+ * Calling this does not remove the database itself or any plugins. It just
+ * removes the reference to the database.
+ */
+fltk3::PluginManager::~PluginManager() {
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: deleting a plugin manager\n");
+#endif
+}
+
+static unsigned char x2i(char hi, char lo) {
+  return ((hi-'A')<<4) | (lo-'A');
+}
+
+static void i2x(unsigned char v, char *d) {
+  d[0] = ((v>>4)&0x0f)+'A'; d[1] = (v&0x0f)+'A';
+}
+
+static void *a2p(const char *s) {
+  union { void *ret; unsigned char d[sizeof(void*)]; } v;
+  v.ret = 0L;
+  int i=0, n=sizeof(void*);
+  for (i=0; i<n; i++) {
+    v.d[i] = x2i(s[2*i], s[2*i+1]);
+  }
+  return v.ret;
+}
+
+static void p2a(void *vp, char *d) {
+  union { void *vp; unsigned char s[sizeof(void*)]; } v;
+  v.vp = vp;
+  int i=0, n=sizeof(void*);
+  for (i=0; i<n; i++) {
+    i2x(v.s[i], d+i*2);
+  }
+  d[2*i] = 0;
+}
+
+/**
+ * \brief Return the address of a plugin by index.
+ */
+fltk3::Plugin *fltk3::PluginManager::plugin(int index) {
+  char buf[34];
+  fltk3::Plugin *ret = 0;
+  fltk3::Preferences pin(this, index);
+  pin.get("address", buf, "", 34);
+  if (buf[0]=='@') ret = (fltk3::Plugin*)a2p(buf+1);
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: returning plugin at index %d: (%s) %p\n", index, buf, ret);
+#endif
+  return ret;
+}
+
+/**
+ * \brief Return the address of a plugin by name.
+ */
+fltk3::Plugin *fltk3::PluginManager::plugin(const char *name) {
+  char buf[34];
+  fltk3::Plugin *ret = 0;
+  if (groupExists(name)) {
+    fltk3::Preferences pin(this, name);
+    pin.get("address", buf, "", 34);
+    if (buf[0]=='@') ret = (fltk3::Plugin*)a2p(buf+1);
+#ifdef FL_PLUGIN_VERBOSE
+    printf("fltk3::Plugin: returning plugin named \"%s\": (%s) %p\n", name, buf, ret);
+#endif
+    return ret;
+  } else {
+#ifdef FL_PLUGIN_VERBOSE
+    printf("fltk3::Plugin: no plugin found named \"%s\"\n", name);
+#endif
+    return 0L;
+  }
+}
+
+/**
+ * \brief This function adds a new plugin to the database.
+ *
+ * There is no need to call this function explicitly. Every fltk3::Plugin constructor
+ * will call this function at initialization time.
+ */
+fltk3::Preferences::ID fltk3::PluginManager::addPlugin(const char *name, fltk3::Plugin *plugin) {
+  char buf[34];
+#ifdef FL_PLUGIN_VERBOSE
+  printf("fltk3::Plugin: adding plugin named \"%s\" at 0x%p\n", name, plugin);
+#endif
+  fltk3::Preferences pin(this, name);
+  buf[0] = '@'; p2a(plugin, buf+1);
+  pin.set("address", buf);
+  return pin.id();
+}
+
+/**
+ * \brief Remove any plugin.
+ *
+ * There is no need to call this function explicitly. Every fltk3::Plugin destructor
+ * will call this function at destruction time.
+ */
+void fltk3::PluginManager::removePlugin(fltk3::Preferences::ID id) {
+  fltk3::Preferences::remove(id);
+}
+
+/**
+ * \brief Load a module from disk.
+ *
+ * A module must be a dynamically linkable file for the given operating system.
+ * When loading a module, its +init function will be called which in turn calls
+ * the constructor of all statically initialized fltk3::Plugin classes and adds
+ * them to the database.
+ */
+int fltk3::PluginManager::load(const char *filename) {
+  // the functions below will autmaticaly load plugins that are defined:
+  // Fl_My_Plugin plugin();
+#if defined(WIN32) && !defined(__CYGWIN__)
+  HMODULE dl = LoadLibrary(filename);
+#else
+  void * dl = dlopen(filename, RTLD_LAZY);
+#endif
+  // There is no way of unloading a plugin!
+  return (dl!=0) ? 0 : -1;
+}
+
+/**
+ * \brief Use this function to load a whole directory full of modules.
+ */
+int fltk3::PluginManager::loadAll(const char *filepath, const char *pattern) {
+  struct dirent **dir;
+  int i, n = fltk3::filename_list(filepath, &dir);
+  for (i=0; i<n; i++) {
+    struct dirent *e = dir[i];
+    if (pattern==0 || fltk3::filename_match(e->d_name, pattern)) {
+      load(fltk3::Preferences::Name("%s%s", filepath, e->d_name));
+    }
+    free(e);
+  }
+  free(dir);
+  return 0;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Printer.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Printer.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Printer.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Printer.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,202 @@
+//
+// "$Id$"
+//
+// Encompasses platform-specific printing-support code and 
+// PostScript output code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/Printer.h>
+
+#ifdef __APPLE__
+//#include "Fl_Quartz_Printer.mm"
+#elif defined(WIN32)
+#include "GDIPrinter.cxx"
+#endif
+
+#include "PostScript.cxx"
+
+// print dialog customization strings
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_title = "Print";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_printer = "Printer:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_range = "Print Range";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_copies = "Copies";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_all = "All";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_pages = "Pages";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_from = "From:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_to = "To:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_properties = "Properties...";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_copyNo = "# Copies:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_print_button = "Print";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_cancel_button = "Cancel";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::dialog_print_to_file = "Print To File";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_title = "Printer Properties";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_pagesize = "Page Size:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_mode = "Output Mode:";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_use = "Use";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_save = "Save";
+/** [this text may be customized at run-time] */
+const char *fltk3::Printer::property_cancel = "Cancel";
+
+const char *fltk3::Printer::class_id = "fltk3::Printer";
+#if defined(__APPLE__) || defined(WIN32) || defined(FLTK3_DOXYGEN)
+const char *fltk3::SystemPrinter::class_id = fltk3::Printer::class_id;
+#endif
+#if !( defined(__APPLE__) || defined(WIN32) )
+const char *fltk3::PostScriptPrinter::class_id = fltk3::Printer::class_id;
+#endif
+
+#if defined(__APPLE__) || defined(WIN32)
+void fltk3::SystemPrinter::set_current(void)
+{
+#ifdef __APPLE__
+  fl_gc = (CGContextRef)gc;
+#elif defined(WIN32)
+  fl_gc = (HDC)gc;
+#endif
+  this->SurfaceDevice::set_current();
+}
+
+void fltk3::SystemPrinter::origin(int *x, int *y)
+{
+  PagedDevice::origin(x, y);
+}
+
+#endif
+
+fltk3::Printer::Printer(void) {
+#if defined(WIN32) || defined(__APPLE__)
+  printer = new fltk3::SystemPrinter();
+#else
+  printer = new fltk3::PostScriptPrinter();
+#endif
+  SurfaceDevice::driver(printer->driver());
+}
+
+int fltk3::Printer::start_job(int pagecount, int *frompage, int *topage)
+{
+  return printer->start_job(pagecount, frompage, topage);
+}
+
+int fltk3::Printer::start_page(void)
+{
+  return printer->start_page();
+}
+
+int fltk3::Printer::printable_rect(int *w, int *h)
+{
+  return printer->printable_rect(w, h);
+}
+
+void fltk3::Printer::margins(int *left, int *top, int *right, int *bottom)
+{
+  printer->margins(left, top, right, bottom);
+}
+
+void fltk3::Printer::origin(int *x, int *y)
+{
+  printer->origin(x, y);
+}
+
+void fltk3::Printer::origin(int x, int y)
+{
+  printer->origin(x, y);
+}
+
+void fltk3::Printer::scale(float scale_x, float scale_y)
+{
+  printer->scale(scale_x, scale_y);
+}
+
+void fltk3::Printer::rotate(float angle)
+{
+  printer->rotate(angle);
+}
+
+void fltk3::Printer::translate(int x, int y)
+{
+  printer->translate(x, y);
+}
+
+void fltk3::Printer::untranslate(void)
+{
+  printer->untranslate();
+}
+
+int fltk3::Printer::end_page (void)
+{
+  return printer->end_page();
+}
+
+void fltk3::Printer::end_job (void)
+{
+  printer->end_job();
+}
+
+void fltk3::Printer::print_widget(fltk3::Widget* widget, int delta_x, int delta_y)
+{
+  printer->print_widget(widget, delta_x, delta_y);
+}
+
+void fltk3::Printer::print_window_part(fltk3::Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
+{
+  printer->print_window_part(win, x, y, w, h, delta_x, delta_y);
+}
+
+void fltk3::Printer::set_current(void)
+{
+  printer->set_current();
+}
+
+fltk3::GraphicsDriver* fltk3::Printer::driver(void)
+{
+  return printer->driver();
+}
+
+fltk3::Printer::~Printer(void)
+{
+  delete printer;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Progress.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Progress.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Progress.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Progress.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,124 @@
+//
+// "$Id$"
+//
+// Progress bar widget routines.
+//
+// Copyright 2000-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+
+//
+//   fltk3::Progress::draw()        - Draw the check button.
+//   fltk3::Progress::fltk3::Progress() - Construct a fltk3::Progress widget.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Progress.h>
+#include <fltk3/draw.h>
+
+
+//
+// fltk3::Progress is a progress bar widget based off fltk3::Widget that shows a
+// standard progress bar...
+//
+
+
+//
+// 'fltk3::Progress::draw()' - Draw the progress bar.
+//
+
+/** Draws the progress bar. */
+void fltk3::Progress::draw()
+{
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int	progress;	// Size of progress bar...
+  int	bx, by, bw, bh;	// Box areas...
+  int	tx, tw;		// Temporary X + width
+
+
+  // Get the box borders...
+  bx = fltk3::box_dx(box());
+  by = fltk3::box_dy(box());
+  bw = fltk3::box_dw(box());
+  bh = fltk3::box_dh(box());
+
+  tx = x() + bx;
+  tw = w() - bw;
+
+  // Draw the progress bar...
+  if (maximum_ > minimum_)
+    progress = (int)(w() * (value_ - minimum_) / (maximum_ - minimum_) + 0.5f);
+  else
+    progress = 0;
+
+  // Draw the box and label...
+  if (progress > 0) {
+    fltk3::Color c = labelcolor();
+    labelcolor(fltk3::contrast(labelcolor(), selection_color()));
+
+    fltk3::push_clip(x(), y(), progress + bx, h());
+      draw_box(box(), x(), y(), w(), h(), active_r() ? selection_color() : fltk3::inactive(selection_color()));
+      draw_label(tx, y() + by, tw, h() - bh);
+    fltk3::pop_clip();
+
+    labelcolor(c);
+
+    if (progress<w()) {
+      fltk3::push_clip(tx + progress, y(), w() - progress, h());
+        draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fltk3::inactive(color()));
+        draw_label(tx, y() + by, tw, h() - bh);
+      fltk3::pop_clip();
+    }
+  } else {
+    draw_box(box(), x(), y(), w(), h(), active_r() ? color() : fltk3::inactive(color()));
+    draw_label(tx, y() + by, tw, h() - bh);
+  }
+}
+
+
+/**  
+    The constructor creates the progress bar using the position, size, and label.
+    
+    You can set the background color with color() and the
+    progress bar color with selection_color(), or you can set both colors
+    together with color(unsigned bg, unsigned sel).
+    
+    The default colors are fltk3::BACKGROUND2_COLOR and fltk3::YELLOW, resp.
+*/
+fltk3::Progress::Progress(int X, int Y, int W, int H, const char* L)
+: fltk3::Widget(X, Y, W, H, L) {
+  align(fltk3::ALIGN_INSIDE);
+  box(fltk3::DOWN_BOX);
+  color(fltk3::BACKGROUND2_COLOR, fltk3::YELLOW);
+  minimum(0.0f);
+  maximum(100.0f);
+  value(0.0f);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/RepeatButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Repeat_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/RepeatButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/RepeatButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,71 @@
+//
+// "$Id$"
+//
+// Repeat button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/RepeatButton.h>
+
+#define INITIALREPEAT .5
+#define REPEAT .1
+
+void fltk3::RepeatButton::repeat_callback(void *v) {
+  fltk3::Button *b = (fltk3::Button*)v;
+  fltk3::add_timeout(REPEAT,repeat_callback,b);
+  b->do_callback();
+}
+
+int fltk3::RepeatButton::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  int newval;
+  switch (event) {
+  case fltk3::HIDE:
+  case fltk3::DEACTIVATE:
+  case fltk3::RELEASE:
+    newval = 0; goto J1;
+  case fltk3::PUSH:
+  case fltk3::DRAG:
+    if (fltk3::visible_focus()) fltk3::focus(this);
+    newval = fltk3::event_inside(this);
+  J1:
+    if (!active()) 
+      newval = 0;
+    if (value(newval)) {
+      if (newval) {
+	fltk3::add_timeout(INITIALREPEAT,repeat_callback,this);
+	do_callback();
+      } else {
+	fltk3::remove_timeout(repeat_callback,this);
+      }
+    }
+    return 1;
+  default:
+    return Button::handle(event);
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ReturnButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Return_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ReturnButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ReturnButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,75 @@
+//
+// "$Id$"
+//
+// Return button widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/ReturnButton.h>
+#include <fltk3/draw.h>
+
+int fl_return_arrow(int x, int y, int w, int h) {
+  int size = w; if (h<size) size = h;
+  int d = (size+2)/4; if (d<3) d = 3;
+  int t = (size+9)/12; if (t<1) t = 1;
+  int x0 = x+(w-2*d-2*t-1)/2;
+  int x1 = x0+d;
+  int y0 = y+h/2;
+  fltk3::color(fltk3::LIGHT3);
+  fltk3::line(x0, y0, x1, y0+d);
+  fltk3::yxline(x1, y0+d, y0+t, x1+d+2*t, y0-d);
+  fltk3::yxline(x1, y0-t, y0-d);
+  fltk3::color(fltk3::gray_ramp(0));
+  fltk3::line(x0, y0, x1, y0-d);
+  fltk3::color(fltk3::DARK3);
+  fltk3::xyline(x1+1, y0-t, x1+d, y0-d, x1+d+2*t);
+  return 1;
+}
+
+void fltk3::ReturnButton::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (type() == fltk3::HIDDEN_BUTTON) return;
+  draw_box(value() ? (down_box()?down_box():fltk3::down(box())) : box(),
+	   value() ? selection_color() : color());
+  int W = h();
+  if (w()/3 < W) W = w()/3;
+  fl_return_arrow(x()+w()-W-4, y(), W, h());
+  draw_label(x(), y(), w()-W+4, h());
+  if (fltk3::focus() == this) draw_focus();
+}
+
+int fltk3::ReturnButton::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (event == fltk3::SHORTCUT &&
+      (fltk3::event_key() == fltk3::EnterKey || fltk3::event_key() == fltk3::KPEnterKey)) {
+    simulate_key_action();
+    do_callback();
+    return 1;
+  } else
+    return Button::handle(event);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Roller.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Roller.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Roller.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Roller.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,187 @@
+//
+// "$Id$"
+//
+// Roller widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Rapid-App style knob
+
+#include <fltk3/run.h>
+#include <fltk3/Roller.h>
+#include <fltk3/draw.h>
+#include <math.h>
+
+int fltk3::Roller::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  static int ipos;
+  int newpos = horizontal() ? fltk3::event_x() : fltk3::event_y();
+  switch (event) {
+  case fltk3::PUSH:
+    if (fltk3::visible_focus()) {
+      fltk3::focus(this);
+      redraw();
+    }
+    handle_push();
+    ipos = newpos;
+    return 1;
+  case fltk3::DRAG:
+    handle_drag(clamp(round(increment(previous_value(),newpos-ipos))));
+    return 1;
+  case fltk3::RELEASE:
+    handle_release();
+    return 1;
+  case fltk3::KEYBOARD :
+    switch (fltk3::event_key()) {
+      case fltk3::UpKey:
+        if (horizontal()) return 0;
+	handle_drag(clamp(increment(value(),-1)));
+	return 1;
+      case fltk3::DownKey:
+        if (horizontal()) return 0;
+	handle_drag(clamp(increment(value(),1)));
+	return 1;
+      case fltk3::LeftKey:
+        if (!horizontal()) return 0;
+	handle_drag(clamp(increment(value(),-1)));
+	return 1;
+      case fltk3::RightKey:
+        if (!horizontal()) return 0;
+	handle_drag(clamp(increment(value(),1)));
+	return 1;
+      default:
+        return 0;
+    }
+    // break not required because of switch...
+  case fltk3::FOCUS :
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    } else return 0;
+  case fltk3::ENTER :
+  case fltk3::LEAVE :
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+void fltk3::Roller::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  int X = x()+fltk3::box_dx(box());
+  int Y = y()+fltk3::box_dy(box());
+  int W = w()-fltk3::box_dw(box())-1;
+  int H = h()-fltk3::box_dh(box())-1;
+  if (W<=0 || H <=0) return;
+  int offset = step() ? int(value()/step()) : 0;
+  const double ARC = 1.5; // 1/2 the number of radians visible
+  const double delta = .2; // radians per knurl
+  if (horizontal()) { // horizontal one
+    // draw shaded ends of wheel:
+    int h1 = W/4+1; // distance from end that shading starts
+    fltk3::color(color()); fltk3::rectf(X+h1,Y,W-2*h1,H);
+    for (int i=0; h1; i++) {
+      fltk3::color((fltk3::Color)(fltk3::GRAY-i-1));
+      int h2 = fltk3::GRAY-i-1 > fltk3::DARK3 ? 2*h1/3+1 : 0;
+      fltk3::rectf(X+h2,Y,h1-h2,H);
+      fltk3::rectf(X+W-h1,Y,h1-h2,H);
+      h1 = h2;
+    }
+    if (active_r()) {
+      // draw ridges:
+      double junk;
+      for (double yy = -ARC+modf(offset*sin(ARC)/(W/2)/delta,&junk)*delta;;
+	   yy += delta) {
+	int yy1 = int((sin(yy)/sin(ARC)+1)*W/2);
+	if (yy1 <= 0) continue; else if (yy1 >= W-1) break;
+	fltk3::color(fltk3::DARK3); fltk3::yxline(X+yy1,Y+1,Y+H-1);
+	if (yy < 0) yy1--; else yy1++;
+	fltk3::color(fltk3::LIGHT1);fltk3::yxline(X+yy1,Y+1,Y+H-1);
+      }
+      // draw edges:
+      h1 = W/8+1; // distance from end the color inverts
+      fltk3::color(fltk3::DARK2);
+      fltk3::xyline(X+h1,Y+H-1,X+W-h1);
+      fltk3::color(fltk3::DARK3);
+      fltk3::yxline(X,Y+H,Y,X+h1);
+      fltk3::xyline(X+W-h1,Y,X+W);
+      fltk3::color(fltk3::LIGHT2);
+      fltk3::xyline(X+h1,Y-1,X+W-h1);
+      fltk3::yxline(X+W,Y,Y+H,X+W-h1);
+      fltk3::xyline(X+h1,Y+H,X);
+    }
+  } else { // vertical one
+    // draw shaded ends of wheel:
+    int h1 = H/4+1; // distance from end that shading starts
+    fltk3::color(color()); fltk3::rectf(X,Y+h1,W,H-2*h1);
+    for (int i=0; h1; i++) {
+      fltk3::color((fltk3::Color)(fltk3::GRAY-i-1));
+      int h2 = fltk3::GRAY-i-1 > fltk3::DARK3 ? 2*h1/3+1 : 0;
+      fltk3::rectf(X,Y+h2,W,h1-h2);
+      fltk3::rectf(X,Y+H-h1,W,h1-h2);
+      h1 = h2;
+    }
+    if (active_r()) {
+      // draw ridges:
+      double junk;
+      for (double yy = -ARC+modf(offset*sin(ARC)/(H/2)/delta,&junk)*delta;
+	   ; yy += delta) {
+	int yy1 = int((sin(yy)/sin(ARC)+1)*H/2);
+	if (yy1 <= 0) continue; else if (yy1 >= H-1) break;
+	fltk3::color(fltk3::DARK3); fltk3::xyline(X+1,Y+yy1,X+W-1);
+	if (yy < 0) yy1--; else yy1++;
+	fltk3::color(fltk3::LIGHT1);fltk3::xyline(X+1,Y+yy1,X+W-1);
+      }
+      // draw edges:
+      h1 = H/8+1; // distance from end the color inverts
+      fltk3::color(fltk3::DARK2);
+      fltk3::yxline(X+W-1,Y+h1,Y+H-h1);
+      fltk3::color(fltk3::DARK3);
+      fltk3::xyline(X+W,Y,X,Y+h1);
+      fltk3::yxline(X,Y+H-h1,Y+H);
+      fltk3::color(fltk3::LIGHT2);
+      fltk3::yxline(X,Y+h1,Y+H-h1);
+      fltk3::xyline(X,Y+H,X+W,Y+H-h1);
+      fltk3::yxline(X+W,Y+h1,Y);
+    }
+  }
+
+  if (fltk3::focus() == this) draw_focus(fltk3::THIN_UP_FRAME, x(), y(), w(), h());
+}
+
+/**
+  Creates a new fltk3::Roller widget using the given position,
+  size, and label string. The default boxtype is fltk3::NO_BOX.
+  <P>Inherited destructor destroys the valuator.
+*/
+fltk3::Roller::Roller(int X,int Y,int W,int H,const char* L)
+  : fltk3::Valuator(X,Y,W,H,L) {
+  box(fltk3::UP_BOX);
+  step(1,1000);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/RoundButton.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Round_Button.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/RoundButton.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/RoundButton.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,48 @@
+//
+// "$Id$"
+//
+// Round button for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// A subclass of fltk3::Button that always draws as a round circle.  This
+// circle is smaller than the widget size and can be surrounded by
+// another box type, for compatibility with Forms.
+
+#include <fltk3/run.h>
+#include <fltk3/RoundButton.h>
+
+/**
+  Creates a new fltk3::RoundButton widget using the given
+  position, size, and label string.
+*/
+fltk3::RoundButton::RoundButton(int X,int Y,int W,int H, const char *l)
+: fltk3::LightButton(X,Y,W,H,l) {
+  box(fltk3::NO_BOX);
+  down_box(fltk3::ROUND_DOWN_BOX);
+  selection_color(fltk3::FOREGROUND_COLOR);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ScrollGroup.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Scroll.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ScrollGroup.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ScrollGroup.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,422 @@
+//
+// "$Id$"
+//
+// Scroll widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/TiledImage.h>
+#include <fltk3/ScrollGroup.h>
+#include <fltk3/draw.h>
+
+/** Clear all but the scrollbars... */
+void fltk3::ScrollGroup::clear() {
+  // Note: the scrollbars are removed from the group before calling
+  // fltk3::Group::clear() to take advantage of the optimized widget removal
+  // and deletion. Finally they are added to fltk3::ScrollGroup's group again. This
+  // is MUCH faster than removing the widgets one by one (STR #2409).
+
+  remove(scrollbar);
+  remove(hscrollbar);
+  Group::clear();
+  add(hscrollbar);
+  add(scrollbar);
+}
+
+/** Insure the scrollbars are the last children */
+void fltk3::ScrollGroup::fix_scrollbar_order() {
+  fltk3::Widget** a = (fltk3::Widget**)array();
+  if (a[children()-1] != &scrollbar) {
+    int i,j; for (i = j = 0; j < children(); j++)
+      if (a[j] != &hscrollbar && a[j] != &scrollbar) a[i++] = a[j];
+    a[i++] = &hscrollbar;
+    a[i++] = &scrollbar;
+  }
+}
+
+// Draw widget's background and children within a specific clip region
+//    So widget can just redraw damaged parts.
+//
+void fltk3::ScrollGroup::draw_clip(void* v,int X, int Y, int W, int H) {
+  fltk3::push_clip(X,Y,W,H);
+  fltk3::ScrollGroup* s = (fltk3::ScrollGroup*)v;
+  // erase background as needed...
+  switch (s->box()) {
+    case fltk3::NO_BOX :
+    case fltk3::UP_FRAME :
+    case fltk3::DOWN_FRAME :
+    case fltk3::THIN_UP_FRAME :
+    case fltk3::THIN_DOWN_FRAME :
+    case fltk3::ENGRAVED_FRAME :
+    case fltk3::EMBOSSED_FRAME :
+    case fltk3::BORDER_FRAME :
+    case fltk3::SHADOW_FRAME :
+    case fltk3::ROUNDED_FRAME :
+    case fltk3::OVAL_FRAME :
+    case fltk3::PLASTIC_UP_FRAME :
+    case fltk3::PLASTIC_DOWN_FRAME :
+        if (s->parent() == (fltk3::Group *)s->window() && fltk3::scheme_bg_) {
+	  fltk3::scheme_bg_->draw(X-(X%((fltk3::TiledImage *)fltk3::scheme_bg_)->image()->w()),
+	                       Y-(Y%((fltk3::TiledImage *)fltk3::scheme_bg_)->image()->h()),
+	                       W+((fltk3::TiledImage *)fltk3::scheme_bg_)->image()->w(),
+			       H+((fltk3::TiledImage *)fltk3::scheme_bg_)->image()->h());
+	  break;
+        }
+
+    default :
+	fltk3::color(s->color());
+	fltk3::rectf(X,Y,W,H);
+	break;
+  }
+  fltk3::Widget*const* a = s->array();
+  for (int i=s->children()-2; i--;) {
+    fltk3::Widget& o = **a++;
+    s->draw_child(o);
+    s->draw_outside_label(o);
+  }
+  fltk3::pop_clip();
+}
+
+/**
+   Calculate visibility/size/position of scrollbars, find children's bounding box.
+   The \p si paramater will be filled with data from the calculations.
+   Derived classes can make use of this call to figure out the scrolling area
+   eg. during resize() handling.
+   \param[in] si -- ScrollInfo structure
+   \returns Structure containing the calculated info.
+*/
+void fltk3::ScrollGroup::recalc_scrollbars(ScrollInfo &si) {
+
+  // inner box of widget (excluding scrollbars)
+  si.innerbox_x = x()+fltk3::box_dx(box());
+  si.innerbox_y = y()+fltk3::box_dy(box());
+  si.innerbox_w = w()-fltk3::box_dw(box());
+  si.innerbox_h = h()-fltk3::box_dh(box());
+
+  // accumulate a bounding box for all the children
+  si.child_l = si.innerbox_x;
+  si.child_r = si.innerbox_x;
+  si.child_b = si.innerbox_y;
+  si.child_t = si.innerbox_y;
+  int first = 1;
+  fltk3::Widget*const* a = array();
+  for (int i=children()-2; i--;) {
+    fltk3::Widget* o = *a++;
+    if ( first ) {
+        first = 0;
+	si.child_l = o->x();
+	si.child_r = o->x()+o->w();
+	si.child_b = o->y()+o->h();
+	si.child_t = o->y();
+    } else {
+	if (o->x() < si.child_l) si.child_l = o->x();
+	if (o->y() < si.child_t) si.child_t = o->y();
+	if (o->x()+o->w() > si.child_r) si.child_r = o->x()+o->w();
+	if (o->y()+o->h() > si.child_b) si.child_b = o->y()+o->h();
+    }
+  }
+
+  // Turn the scrollbars on and off as necessary.
+  // See if children would fit if we had no scrollbars...
+  {
+    int X = si.innerbox_x;
+    int Y = si.innerbox_y;
+    int W = si.innerbox_w;
+    int H = si.innerbox_h;
+
+    si.scrollsize = scrollbar_size_ ? scrollbar_size_ : fltk3::scrollbar_size();
+    si.vneeded = 0;
+    si.hneeded = 0;
+    if (type() & VERTICAL) {
+      if ((type() & ALWAYS_ON) || si.child_t < Y || si.child_b > Y+H) {
+	si.vneeded = 1;
+	W -= si.scrollsize;
+	if (scrollbar.align() & fltk3::ALIGN_LEFT) X += si.scrollsize;
+      }
+    }
+    if (type() & HORIZONTAL) {
+      if ((type() & ALWAYS_ON) || si.child_l < X || si.child_r > X+W) {
+	si.hneeded = 1;
+	H -= si.scrollsize;
+	if (scrollbar.align() & fltk3::ALIGN_TOP) Y += si.scrollsize;
+	// recheck vertical since we added a horizontal scrollbar
+	if (!si.vneeded && (type() & VERTICAL)) {
+	  if ((type() & ALWAYS_ON) || si.child_t < Y || si.child_b > Y+H) {
+	    si.vneeded = 1;
+	    W -= si.scrollsize;
+	    if (scrollbar.align() & fltk3::ALIGN_LEFT) X += si.scrollsize;
+	  }
+	}
+      }
+    }
+    si.innerchild_x = X;
+    si.innerchild_y = Y;
+    si.innerchild_w = W;
+    si.innerchild_h = H;
+  }
+
+  // calculate hor scrollbar position
+  si.hscroll_x = si.innerchild_x;
+  si.hscroll_y = (scrollbar.align() & fltk3::ALIGN_TOP) 
+		     ? si.innerbox_y
+		     : si.innerbox_y + si.innerbox_h - si.scrollsize;
+  si.hscroll_w = si.innerchild_w;
+  si.hscroll_h = si.scrollsize;
+
+  // calculate ver scrollbar position
+  si.vscroll_x = (scrollbar.align() & fltk3::ALIGN_LEFT)
+                     ? si.innerbox_x
+		     : si.innerbox_x + si.innerbox_w - si.scrollsize;
+  si.vscroll_y = si.innerchild_y;
+  si.vscroll_w = si.scrollsize;
+  si.vscroll_h = si.innerchild_h;
+
+  // calculate h/v scrollbar values (pos/size/first/total)
+  si.hpos = si.innerchild_x - si.child_l;
+  si.hsize = si.innerchild_w;
+  si.hfirst = 0;
+  si.htotal = si.child_r - si.child_l;
+  if ( si.hpos < 0 ) { si.htotal += (-si.hpos); si.hfirst = si.hpos; }
+
+  si.vpos = si.innerchild_y - si.child_t;
+  si.vsize = si.innerchild_h;
+  si.vfirst = 0;
+  si.vtotal = si.child_b - si.child_t;
+  if ( si.vpos < 0 ) { si.vtotal += (-si.vpos); si.vfirst = si.vpos; }
+
+//  printf("DEBUG --- ScrollInfo ---\n");
+//  printf("DEBUG        scrollsize: %d\n", si.scrollsize);
+//  printf("DEBUG  hneeded, vneeded: %d %d\n", si.hneeded, si.vneeded);
+//  printf("DEBUG     innerbox xywh: %d %d %d %d\n", si.innerbox_x,   si.innerbox_y,   si.innerbox_w,   si.innerbox_h);
+//  printf("DEBUG   innerchild xywh: %d %d %d %d\n", si.innerchild_x, si.innerchild_y, si.innerchild_w, si.innerchild_h);
+//  printf("DEBUG        child lrbt: %d %d %d %d\n", si.child_l, si.child_r, si.child_b, si.child_t);
+//  printf("DEBUG      hscroll xywh: %d %d %d %d\n", si.hscroll_x, si.hscroll_y, si.hscroll_w, si.hscroll_h);
+//  printf("DEBUG      vscroll xywh: %d %d %d %d\n", si.vscroll_x, si.vscroll_y, si.vscroll_w, si.vscroll_h);
+//  printf("DEBUG  horz scroll vals: %d %d %d %d\n", si.hpos, si.hsize, si.hfirst, si.htotal);
+//  printf("DEBUG  vert scroll vals: %d %d %d %d\n", si.vpos, si.vsize, si.vfirst, si.vtotal);
+//  printf("DEBUG \n");
+}
+
+/**
+  Returns the bounding box for the interior of the scrolling area, inside
+  the scrollbars.
+  
+  Currently this is only reliable after draw(), and before any resizing of
+  the fltk3::ScrollGroup or any child widgets occur.
+  
+  \todo The visibility of the scrollbars ought to be checked/calculated
+  outside of the draw() method (STR #1895).
+*/
+void fltk3::ScrollGroup::bbox(int& X, int& Y, int& W, int& H) {
+  X = x()+fltk3::box_dx(box());
+  Y = y()+fltk3::box_dy(box());
+  W = w()-fltk3::box_dw(box());
+  H = h()-fltk3::box_dh(box());
+  if (scrollbar.visible()) {
+    W -= scrollbar.w();
+    if (scrollbar.align() & fltk3::ALIGN_LEFT) X += scrollbar.w();
+  }
+  if (hscrollbar.visible()) {
+    H -= hscrollbar.h();
+    if (scrollbar.align() & fltk3::ALIGN_TOP) Y += hscrollbar.h();
+  }
+}
+
+void fltk3::ScrollGroup::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  fix_scrollbar_order();
+  int X,Y,W,H; bbox(X,Y,W,H);
+
+  uchar d = damage();
+
+  if (d & fltk3::DAMAGE_ALL) { // full redraw
+    draw_box(box(),x(),y(),w(),h(),color());
+    draw_clip(this, X, Y, W, H);
+  } else {
+    if (d & fltk3::DAMAGE_SCROLL) {
+      // scroll the contents:
+      fltk3::scroll(X, Y, W, H, oldx-xposition_, oldy-yposition_, draw_clip, this);
+
+      // Erase the background as needed...
+      fltk3::Widget*const* a = array();
+      int L, R, T, B;
+      L = 999999;
+      R = 0;
+      T = 999999;
+      B = 0;
+      for (int i=children()-2; i--; a++) {
+        if ((*a)->x() < L) L = (*a)->x();
+	if (((*a)->x() + (*a)->w()) > R) R = (*a)->x() + (*a)->w();
+        if ((*a)->y() < T) T = (*a)->y();
+	if (((*a)->y() + (*a)->h()) > B) B = (*a)->y() + (*a)->h();
+      }
+      if (L > X) draw_clip(this, X, Y, L - X, H);
+      if (R < (X + W)) draw_clip(this, R, Y, X + W - R, H);
+      if (T > Y) draw_clip(this, X, Y, W, T - Y);
+      if (B < (Y + H)) draw_clip(this, X, B, W, Y + H - B);
+    }
+    if (d & fltk3::DAMAGE_CHILD) { // draw damaged children
+      fltk3::push_clip(X, Y, W, H);
+      fltk3::Widget*const* a = array();
+      for (int i=children()-2; i--;) update_child(**a++);
+      fltk3::pop_clip();
+    }
+  }
+
+  // Calculate where scrollbars should go, and draw them
+  {
+      ScrollInfo si;
+      recalc_scrollbars(si);
+
+      // Now that we know what's needed, make it so.
+      if (si.vneeded && !scrollbar.visible()) {
+	scrollbar.set_visible();
+	d = fltk3::DAMAGE_ALL;
+      }
+      else if (!si.vneeded && scrollbar.visible()) {
+	scrollbar.clear_visible();
+	draw_clip(this, si.vscroll_x, si.vscroll_y, si.vscroll_w, si.vscroll_h);
+	d = fltk3::DAMAGE_ALL;
+      }
+      if (si.hneeded && !hscrollbar.visible()) {
+	hscrollbar.set_visible();
+	d = fltk3::DAMAGE_ALL;
+      }
+      else if (!si.hneeded && hscrollbar.visible()) {
+	hscrollbar.clear_visible();
+	draw_clip(this, si.hscroll_x, si.hscroll_y, si.hscroll_w, si.hscroll_h);
+	d = fltk3::DAMAGE_ALL;
+      }
+      else if ( hscrollbar.h() != si.scrollsize || scrollbar.w() != si.scrollsize ) {
+         // scrollsize changed
+         d = fltk3::DAMAGE_ALL;
+      }
+
+      scrollbar.resize(si.vscroll_x, si.vscroll_y, si.vscroll_w, si.vscroll_h);
+      oldy = yposition_ = si.vpos;	// si.innerchild_y - si.child_t;
+      scrollbar.value(si.vpos, si.vsize, si.vfirst, si.vtotal);
+
+      hscrollbar.resize(si.hscroll_x, si.hscroll_y, si.hscroll_w, si.hscroll_h);
+      oldx = xposition_ = si.hpos;	// si.innerchild_x - si.child_l;
+      hscrollbar.value(si.hpos, si.hsize, si.hfirst, si.htotal);
+  }
+
+  // draw the scrollbars:
+  if (d & fltk3::DAMAGE_ALL) {
+    draw_child(scrollbar);
+    draw_child(hscrollbar);
+    if (scrollbar.visible() && hscrollbar.visible()) {
+      // fill in the little box in the corner
+      fltk3::color(color());
+      fltk3::rectf(scrollbar.x(), hscrollbar.y(), scrollbar.w(), hscrollbar.h());
+    }
+  } else {
+    update_child(scrollbar);
+    update_child(hscrollbar);
+  }
+}
+
+void fltk3::ScrollGroup::resize(int X, int Y, int W, int H) {
+  int dx = X-x(), dy = Y-y();
+  int dw = W-w(), dh = H-h();
+  Widget::resize(X,Y,W,H); // resize _before_ moving children around
+  fix_scrollbar_order();
+  // move all the children:
+  fltk3::Widget*const* a = array();
+  for (int i=children()-2; i--;) {
+    fltk3::Widget* o = *a++;
+    o->position(o->x()+dx, o->y()+dy);
+  }
+  if (dw==0 && dh==0) {
+    char pad = ( scrollbar.visible() && hscrollbar.visible() );
+    char al = ( (scrollbar.align() & fltk3::ALIGN_LEFT) != 0 );
+    char at = ( (scrollbar.align() & fltk3::ALIGN_TOP)  !=0 );
+    scrollbar.position(al?X:X+W-scrollbar.w(), (at&&pad)?Y+hscrollbar.h():Y);
+    hscrollbar.position((al&&pad)?X+scrollbar.w():X, at?Y:Y+H-hscrollbar.h());
+  } else {
+    // FIXME recalculation of scrollbars needs to be moved out fo "draw()" (STR #1895)
+    redraw(); // need full recalculation of scrollbars
+  }
+}
+
+/**  Moves the contents of the scroll group to a new position.*/
+void fltk3::ScrollGroup::scroll_to(int X, int Y) {
+  int dx = xposition_-X;
+  int dy = yposition_-Y;
+  if (!dx && !dy) return;
+  xposition_ = X;
+  yposition_ = Y;
+  fltk3::Widget*const* a = array();
+  for (int i=children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (o == &hscrollbar || o == &scrollbar) continue;
+    o->position(o->x()+dx, o->y()+dy);
+  }
+  if (parent() == (fltk3::Group *)window() && fltk3::scheme_bg_) damage(fltk3::DAMAGE_ALL);
+  else damage(fltk3::DAMAGE_SCROLL);
+}
+
+void fltk3::ScrollGroup::hscrollbar_cb(fltk3::Widget* o, void*) {
+  fltk3::ScrollGroup* s = (fltk3::ScrollGroup*)(o->parent());
+  s->scroll_to(int(((fltk3::Scrollbar*)o)->value()), s->yposition());
+}
+
+void fltk3::ScrollGroup::scrollbar_cb(fltk3::Widget* o, void*) {
+  fltk3::ScrollGroup* s = (fltk3::ScrollGroup*)(o->parent());
+  s->scroll_to(s->xposition(), int(((fltk3::Scrollbar*)o)->value()));
+}
+/**
+  Creates a new fltk3::ScrollGroup widget using the given position,
+  size, and label string. The default boxtype is fltk3::NO_BOX.
+  <P>The destructor <I>also deletes all the children</I>. This allows a
+  whole tree to be deleted at once, without having to keep a pointer to
+  all the children in the user code. A kludge has been done so the 
+  fltk3::ScrollGroup and all of its children can be automatic (local)
+  variables, but you must declare the fltk3::ScrollGroup<I>first</I>, so
+  that it is destroyed last.
+*/
+fltk3::ScrollGroup::ScrollGroup(int X,int Y,int W,int H,const char* L)
+  : fltk3::Group(X,Y,W,H,L), 
+    scrollbar(X+W-fltk3::scrollbar_size(),Y,
+              fltk3::scrollbar_size(),H-fltk3::scrollbar_size()),
+    hscrollbar(X,Y+H-fltk3::scrollbar_size(),
+               W-fltk3::scrollbar_size(),fltk3::scrollbar_size()) {
+  type(BOTH);
+  xposition_ = oldx = 0;
+  yposition_ = oldy = 0;
+  scrollbar_size_ = 0;
+  hscrollbar.type(fltk3::HORIZONTAL);
+  hscrollbar.callback(hscrollbar_cb);
+  scrollbar.callback(scrollbar_cb);
+}
+
+int fltk3::ScrollGroup::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  fix_scrollbar_order();
+  return Group::handle(event);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Scrollbar.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Scrollbar.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Scrollbar.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Scrollbar.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,294 @@
+//
+// "$Id$"
+//
+// Scroll bar widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+#include <fltk3/run.h>
+#include <fltk3/Scrollbar.h>
+#include <fltk3/draw.h>
+#include <math.h>
+#include "flstring.h"
+
+#define INITIALREPEAT .5
+#define REPEAT .05
+
+void fltk3::Scrollbar::increment_cb() {
+  char inv = maximum()<minimum();
+  int ls = inv ? -linesize_ : linesize_;
+  int i;
+  switch (pushed_) {
+    case 1: // clicked on arrow left
+      i = -ls;
+      break;
+    default: // clicked on arrow right
+      i =  ls;
+      break;
+    case 5: // clicked into the box next to the slider on the left
+      i = -(int((maximum()-minimum())*slider_size()/(1.0-slider_size())));
+      if (inv) {
+        if (i<-ls) i = -ls;
+      } else {
+        if (i>-ls) i = -ls; // err
+      }
+      break;
+    case 6: // clicked into the box next to the slider on the right
+      i = (int((maximum()-minimum())*slider_size()/(1.0-slider_size())));
+      if (inv) {
+        if (i>ls) i = ls;
+      } else {
+        if (i<ls) i = ls; // err
+      }
+      break;
+  }
+  handle_drag(clamp(value() + i));
+}
+
+void fltk3::Scrollbar::timeout_cb(void* v) {
+  fltk3::Scrollbar* s = (fltk3::Scrollbar*)v;
+  s->increment_cb();
+  fltk3::add_timeout(REPEAT, timeout_cb, s);
+}
+
+int fltk3::Scrollbar::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  // area of scrollbar:
+  int area;
+  int X=x(); int Y=y(); int W=w(); int H=h();
+
+  // adjust slider area to be inside the arrow buttons:
+  if (horizontal()) {
+    if (W >= 3*H) {X += H; W -= 2*H;}
+  } else {
+    if (H >= 3*W) {Y += W; H -= 2*W;}
+  }
+
+  // which widget part is highlighted?
+  int relx;
+  int ww;
+  if (horizontal()) {
+    relx = fltk3::event_x()-X;
+    ww = W;
+  } else {
+    relx = fltk3::event_y()-Y;
+    ww = H;
+  }
+  if (relx < 0) area = 1;
+  else if (relx >= ww) area = 2;
+  else {
+    int S = int(slider_size()*ww+.5);
+    int T = (horizontal() ? H : W)/2+1;
+    if (type()==fltk3::VERT_NICE_SLIDER || type()==fltk3::HOR_NICE_SLIDER) T += 4;
+    if (S < T) S = T;
+    double val =
+      (maximum()-minimum()) ? (value()-minimum())/(maximum()-minimum()) : 0.5;
+    int sliderx;
+    if (val >= 1.0) sliderx = ww-S;
+    else if (val <= 0.0) sliderx = 0;
+    else sliderx = int(val*(ww-S)+.5);
+    if (fltk3::event_button() == fltk3::MIDDLE_MOUSE) area = 8;
+    else if (relx < sliderx) area = 5;
+    else if (relx >= sliderx+S) area = 6;
+    else area = 8;
+  }
+
+  switch (event) {
+  case fltk3::ENTER:
+  case fltk3::LEAVE:
+    return 1;
+  case fltk3::RELEASE:
+      damage(fltk3::DAMAGE_ALL);
+    if (pushed_) {
+      fltk3::remove_timeout(timeout_cb, this);
+      pushed_ = 0;
+    }
+    handle_release();
+    return 1;
+  case fltk3::PUSH:
+    if (pushed_) return 1;
+    if (area != 8) pushed_ = area;
+    if (pushed_) {
+      handle_push();
+      fltk3::add_timeout(INITIALREPEAT, timeout_cb, this);
+      increment_cb();
+      damage(fltk3::DAMAGE_ALL);
+      return 1;
+    }
+    return Slider::handle(event, X,Y,W,H);
+  case fltk3::DRAG:
+    if (pushed_) return 1;
+    return Slider::handle(event, X,Y,W,H);
+  case fltk3::MOUSEWHEEL :
+    if (horizontal()) {
+      if (fltk3::e_dx==0) return 0;
+      int ls = maximum()>=minimum() ? linesize_ : -linesize_;
+      handle_drag(clamp(value() + ls * fltk3::e_dx));
+      return 1;
+    } else {
+      if (fltk3::e_dy==0) return 0;
+      int ls = maximum()>=minimum() ? linesize_ : -linesize_;
+      handle_drag(clamp(value() + ls * fltk3::e_dy));
+      return 1;
+    }
+  case fltk3::SHORTCUT:
+  case fltk3::KEYBOARD: {
+    int v = value();
+    int ls = maximum()>=minimum() ? linesize_ : -linesize_;
+    if (horizontal()) {
+      switch (fltk3::event_key()) {
+      case fltk3::LeftKey:
+	v -= ls;
+	break;
+      case fltk3::RightKey:
+	v += ls;
+	break;
+      default:
+	return 0;
+      }
+    } else { // vertical
+      switch (fltk3::event_key()) {
+      case fltk3::UpKey:
+	v -= ls;
+	break;
+      case fltk3::DownKey:
+	v += ls;
+	break;
+      case fltk3::PageUpKey:
+	if (slider_size() >= 1.0) return 0;
+	v -= int((maximum()-minimum())*slider_size()/(1.0-slider_size()));
+	v += ls;
+	break;
+      case fltk3::PageDownKey:
+	if (slider_size() >= 1.0) return 0;
+	v += int((maximum()-minimum())*slider_size()/(1.0-slider_size()));
+	v -= ls;
+	break;
+      case fltk3::HomeKey:
+	v = int(minimum());
+	break;
+      case fltk3::EndKey:
+	v = int(maximum());
+	break;
+      default:
+	return 0;
+      }
+    }
+    v = int(clamp(v));
+    if (v != value()) {
+      Slider::value(v);
+      value_damage();
+      set_changed();
+      do_callback();
+    }
+    return 1;}
+  }
+  return 0;
+}
+
+void fltk3::Scrollbar::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  int X = x()+fltk3::box_dx(box());
+  int Y = y()+fltk3::box_dy(box());
+  int W = w()-fltk3::box_dw(box());
+  int H = h()-fltk3::box_dh(box());
+  if (horizontal()) {
+    if (W < 3*H) {Slider::draw(X,Y,W,H); return;}
+    Slider::draw(X+H,Y,W-2*H,H);
+    if (damage()&fltk3::DAMAGE_ALL) {
+      draw_box((pushed_==1) ? fltk3::down(slider()) : slider(),
+	       X, Y, H, H, selection_color());
+      draw_box((pushed_==2) ? fltk3::down(slider()) : slider(),
+	       X+W-H, Y, H, H, selection_color());
+      if (active_r())
+        fltk3::color(labelcolor());
+      else
+        fltk3::color(fltk3::inactive(labelcolor()));
+      int w1 = (H-4)/3; if (w1 < 1) w1 = 1;
+      int x1 = X+(H-w1-1)/2;
+      int yy1 = Y+(H-2*w1-1)/2;
+      if (!fltk3::scheme()) {
+	fltk3::polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1-1, yy1+w1, x1+w1, yy1);
+	x1 += (W-H);
+	fltk3::polygon(x1, yy1, x1+1, yy1+w1, x1, yy1+2*w1, x1+w1, yy1+w1);
+      } else {
+	fltk3::polygon(x1, yy1+w1, x1+w1, yy1+2*w1, x1+w1, yy1);
+	x1 += (W-H);
+	fltk3::polygon(x1, yy1, x1, yy1+2*w1, x1+w1, yy1+w1);
+      }
+    }
+  } else { // vertical
+    if (H < 3*W) {Slider::draw(X,Y,W,H); return;}
+    Slider::draw(X,Y+W,W,H-2*W);
+    if (damage()&fltk3::DAMAGE_ALL) {
+      draw_box((pushed_==1) ? fltk3::down(slider()) : slider(),
+	       X, Y, W, W, selection_color());
+      draw_box((pushed_==2) ? fltk3::down(slider()) : slider(),
+	       X, Y+H-W, W, W, selection_color());
+      if (active_r())
+        fltk3::color(labelcolor());
+      else
+        fltk3::color(fltk3::inactive(labelcolor()));
+      int w1 = (W-4)/3; if (w1 < 1) w1 = 1;
+      int x1 = X+(W-2*w1-1)/2;
+      int yy1 = Y+(W-w1-1)/2;
+      if (!fltk3::scheme()) {
+	fltk3::polygon(x1, yy1+w1, x1+w1, yy1+w1-1, x1+2*w1, yy1+w1, x1+w1, yy1);
+	yy1 += H-W;
+	fltk3::polygon(x1, yy1, x1+w1, yy1+1, x1+w1, yy1+w1);
+	fltk3::polygon(x1+w1, yy1+1, x1+2*w1, yy1, x1+w1, yy1+w1);
+      } else {
+	fltk3::polygon(x1, yy1+w1, x1+2*w1, yy1+w1, x1+w1, yy1);
+	yy1 += H-W;
+	fltk3::polygon(x1, yy1, x1+w1, yy1+w1, x1+2*w1, yy1);
+      }
+    }
+  }
+}
+
+/**
+  Creates a new fltk3::Scrollbar widget with given position, size, and label.
+  You need to do type(fltk3::HORIZONTAL) if you want a horizontal scrollbar.
+*/
+fltk3::Scrollbar::Scrollbar(int X, int Y, int W, int H, const char* L)
+  : fltk3::Slider(X, Y, W, H, L) {
+  box(fltk3::FLAT_BOX);
+  color(fltk3::DARK2);
+  slider(fltk3::UP_BOX);
+  linesize_ = 16;
+  pushed_ = 0;
+  step(1);
+}
+
+/**  Destroys the Scrollbar. */
+fltk3::Scrollbar::~Scrollbar() {
+  if (pushed_)
+    fltk3::remove_timeout(timeout_cb, this);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/SharedImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Shared_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/SharedImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/SharedImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,476 @@
+//
+// "$Id$"
+//
+// Shared image code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+
+#include <fltk3/run.h>
+#include <fltk3/SharedImage.h>
+#include <fltk3/XBMImage.h>
+#include <fltk3/XPMImage.h>
+
+
+//
+// Global class vars...
+//
+
+fltk3::SharedImage **fltk3::SharedImage::images_ = 0;	// Shared images
+int	fltk3::SharedImage::num_images_ = 0;	// Number of shared images
+int	fltk3::SharedImage::alloc_images_ = 0;	// Allocated shared images
+
+fltk3::SharedHandler *fltk3::SharedImage::handlers_ = 0;// Additional format handlers
+int	fltk3::SharedImage::num_handlers_ = 0;	// Number of format handlers
+int	fltk3::SharedImage::alloc_handlers_ = 0;	// Allocated format handlers
+
+
+//
+// Typedef the C API sort function type the only way I know how...
+//
+
+extern "C" {
+  typedef int (*compare_func_t)(const void *, const void *);
+}
+
+
+/** Returns the fltk3::SharedImage* array */
+fltk3::SharedImage **fltk3::SharedImage::images() {
+  return images_;
+}
+/** Returns the total number of shared images in the array. */
+int fltk3::SharedImage::num_images() {
+  return num_images_;
+}
+
+
+//
+// 'fltk3::SharedImage::compare()' - Compare two shared images...
+//
+
+int
+fltk3::SharedImage::compare(fltk3::SharedImage **i0,		// I - First image
+                         fltk3::SharedImage **i1) {	// I - Second image
+  int i = strcmp((*i0)->name(), (*i1)->name());
+
+  if (i) return i;
+  else if (((*i0)->w() == 0 && (*i1)->original_) ||
+           ((*i1)->w() == 0 && (*i0)->original_)) return 0;
+  else if ((*i0)->w() != (*i1)->w()) return (*i0)->w() - (*i1)->w();
+  else return (*i0)->h() - (*i1)->h();
+}
+
+
+/** 
+  Creates an empty shared image.
+  The constructors create a new shared image record in the image cache.
+  
+  <P>The constructors are protected and cannot be used directly
+  from a program. Use the get() method instead.
+*/
+fltk3::SharedImage::SharedImage() : fltk3::Image(0,0,0) {
+  name_        = 0;
+  refcount_    = 1;
+  original_    = 0;
+  image_       = 0;
+  alloc_image_ = 0;
+}
+
+
+/** 
+  Creates a shared image from its filename and its corresponding fltk3::Image* img.
+  The constructors create a new shared image record in the image cache.
+  
+  <P>The constructors are protected and cannot be used directly
+  from a program. Use the get() method instead.
+*/
+fltk3::SharedImage::SharedImage(const char *n,		// I - Filename
+                                 fltk3::Image   *img)	// I - Image
+  : fltk3::Image(0,0,0) {
+  name_ = new char[strlen(n) + 1];
+  strcpy((char *)name_, n);
+
+  refcount_    = 1;
+  image_       = img;
+  alloc_image_ = !img;
+  original_    = 1;
+
+  if (!img) reload();
+  else update();
+}
+
+
+//
+// 'fltk3::SharedImage::add()' - Add a shared image to the array.
+//
+
+void
+fltk3::SharedImage::add() {
+  fltk3::SharedImage	**temp;		// New image pointer array...
+
+  if (num_images_ >= alloc_images_) {
+    // Allocate more memory...
+    temp = new fltk3::SharedImage *[alloc_images_ + 32];
+
+    if (alloc_images_) {
+      memcpy(temp, images_, alloc_images_ * sizeof(fltk3::SharedImage *));
+
+      delete[] images_;
+    }
+
+    images_       = temp;
+    alloc_images_ += 32;
+  }
+
+  images_[num_images_] = this;
+  num_images_ ++;
+
+  if (num_images_ > 1) {
+    qsort(images_, num_images_, sizeof(fltk3::SharedImage *),
+          (compare_func_t)compare);
+  }
+}
+
+
+//
+// 'fltk3::SharedImage::update()' - Update the dimensions of the shared images.
+//
+
+void
+fltk3::SharedImage::update() {
+  if (image_) {
+    w(image_->w());
+    h(image_->h());
+    d(image_->d());
+    data(image_->data(), image_->count());
+  }
+}
+
+/**
+  The destructor free all memory and server resources that are
+  used by the image. The destructor is protected and cannot be
+  used directly from a program. Use the fltk3::SharedImage::release() method
+  instead.
+*/
+fltk3::SharedImage::~SharedImage() {
+  if (name_) delete[] (char *)name_;
+  if (alloc_image_) delete image_;
+}
+
+
+//
+/** 
+  Releases and possibly destroys (if refcount <=0) a shared image. 
+  In the latter case, it will reorganize the shared image array so that no hole will occur.
+*/
+void fltk3::SharedImage::release() {
+  int	i;	// Looping var...
+
+  refcount_ --;
+  if (refcount_ > 0) return;
+
+  for (i = 0; i < num_images_; i ++)
+    if (images_[i] == this) {
+      num_images_ --;
+
+      if (i < num_images_) {
+        memmove(images_ + i, images_ + i + 1,
+               (num_images_ - i) * sizeof(fltk3::SharedImage *));
+      }
+
+      break;
+    }
+
+  delete this;
+
+  if (num_images_ == 0 && images_) {
+    delete[] images_;
+
+    images_       = 0;
+    alloc_images_ = 0;
+  }
+}
+
+
+//
+/** Reloads the shared image from disk */
+void fltk3::SharedImage::reload() {
+  // Load image from disk...
+  int		i;		// Looping var
+  FILE		*fp;		// File pointer
+  uchar		header[64];	// Buffer for auto-detecting files
+  fltk3::Image	*img;		// New image
+
+  if (!name_) return;
+
+  if ((fp = fltk3::fopen(name_, "rb")) != NULL) {
+    if (fread(header, 1, sizeof(header), fp)==0) { /* ignore */ }
+    fclose(fp);
+  } else {
+    return;
+  }
+
+  // Load the image as appropriate...
+  if (memcmp(header, "#define", 7) == 0) // XBM file
+    img = new fltk3::XBMImage(name_);
+  else if (memcmp(header, "/* XPM */", 9) == 0) // XPM file
+    img = new fltk3::XPMImage(name_);
+  else {
+    // Not a standard format; try an image handler...
+    for (i = 0, img = 0; i < num_handlers_; i ++) {
+      img = (handlers_[i])(name_, header, sizeof(header));
+
+      if (img) break;
+    }
+  }
+
+  if (img) {
+    if (alloc_image_) delete image_;
+
+    alloc_image_ = 1;
+
+    if ((img->w() != w() && w()) || (img->h() != h() && h())) {
+      // Make sure the reloaded image is the same size as the existing one.
+      fltk3::Image *temp = img->copy(w(), h());
+      delete img;
+      image_ = temp;
+    } else {
+      image_ = img;
+    }
+
+    update();
+  }
+}
+
+
+//
+// 'fltk3::SharedImage::copy()' - Copy and resize a shared image...
+//
+
+fltk3::Image *
+fltk3::SharedImage::copy(int W, int H) {
+  fltk3::Image		*temp_image;	// New image file
+  fltk3::SharedImage	*temp_shared;	// New shared image
+
+  // Make a copy of the image we're sharing...
+  if (!image_) temp_image = 0;
+  else temp_image = image_->copy(W, H);
+
+  // Then make a new shared image...
+  temp_shared = new fltk3::SharedImage();
+
+  temp_shared->name_ = new char[strlen(name_) + 1];
+  strcpy((char *)temp_shared->name_, name_);
+
+  temp_shared->refcount_    = 1;
+  temp_shared->image_       = temp_image;
+  temp_shared->alloc_image_ = 1;
+
+  temp_shared->update();
+
+  return temp_shared;
+}
+
+
+//
+// 'fltk3::SharedImage::color_average()' - Blend colors...
+//
+
+void
+fltk3::SharedImage::color_average(fltk3::Color c,	// I - Color to blend with
+                               float    i) {	// I - Blend fraction
+  if (!image_) return;
+
+  image_->color_average(c, i);
+  update();
+}
+
+
+//
+// 'fltk3::SharedImage::desaturate()' - Convert the image to grayscale...
+//
+
+void
+fltk3::SharedImage::desaturate() {
+  if (!image_) return;
+
+  image_->desaturate();
+  update();
+}
+
+
+//
+// 'fltk3::SharedImage::draw()' - Draw a shared image...
+//
+
+void
+fltk3::SharedImage::draw(int X, int Y, int W, int H, int cx, int cy) {
+  if (image_) image_->draw(X, Y, W, H, cx, cy);
+  else Image::draw(X, Y, W, H, cx, cy);
+}
+
+
+//
+// 'fltk3::SharedImage::uncache()' - Uncache the shared image...
+//
+
+void fltk3::SharedImage::uncache()
+{
+  if (image_) image_->uncache();
+}
+
+
+
+/** Finds a shared image from its named and size specifications */
+fltk3::SharedImage* fltk3::SharedImage::find(const char *n, int W, int H) {
+  fltk3::SharedImage	*key,		// Image key
+			**match;	// Matching image
+
+  if (num_images_) {
+    key = new fltk3::SharedImage();
+    key->name_ = new char[strlen(n) + 1];
+    strcpy((char *)key->name_, n);
+    key->w(W);
+    key->h(H);
+
+    match = (fltk3::SharedImage **)bsearch(&key, images_, num_images_,
+                                        sizeof(fltk3::SharedImage *),
+                                        (compare_func_t)compare);
+
+    delete key;
+
+    if (match) {
+      (*match)->refcount_ ++;
+      return *match;
+    }
+  }
+
+  return 0;
+}
+
+
+/** 
+ \brief Find or load an image that can be shared by multiple widgets.
+ 
+ Gets a shared image, if it exists already ; it will return it.
+ If it does not exist or if it exist but with other size, 
+ then the existing image is deleted and replaced
+ by a new image from the n filename of the proper dimension.
+ If n is not a valid image filename, then get() will return NULL.
+ 
+ Shared JPEG and PNG images can also be created from memory by using their 
+ named memory access constructor.
+ 
+ \param n name of the image
+ \param W, H desired size
+ 
+ \see fltk3::SharedImage::find(const char *n, int W, int H)
+ \see fltk3::SharedImage::release() 
+ \see fltk3::JPEGImage::JPEGImage(const char *name, const unsigned char *data)
+ \see fltk3::PNGImage::fltk3::PNGImage (const char *name_png, const unsigned char *buffer, int maxsize)
+*/
+fltk3::SharedImage* fltk3::SharedImage::get(const char *n, int W, int H) {
+  fltk3::SharedImage	*temp;		// Image
+
+  if ((temp = find(n, W, H)) != NULL) return temp;
+
+  if ((temp = find(n)) == NULL) {
+    temp = new fltk3::SharedImage(n);
+
+    if (!temp->image_) {
+      delete temp;
+      return NULL;
+    }
+
+    temp->add();
+  }
+
+  if ((temp->w() != W || temp->h() != H) && W && H) {
+    temp = (fltk3::SharedImage *)temp->copy(W, H);
+    temp->add();
+  }
+
+  return temp;
+}
+
+
+
+/** Adds a shared image handler, which is basically a test function for adding new formats */
+void fltk3::SharedImage::add_handler(fltk3::SharedHandler f) {
+  int			i;		// Looping var...
+  fltk3::SharedHandler	*temp;		// New image handler array...
+
+  // First see if we have already added the handler...
+  for (i = 0; i < num_handlers_; i ++) {
+    if (handlers_[i] == f) return;
+  }
+
+  if (num_handlers_ >= alloc_handlers_) {
+    // Allocate more memory...
+    temp = new fltk3::SharedHandler [alloc_handlers_ + 32];
+
+    if (alloc_handlers_) {
+      memcpy(temp, handlers_, alloc_handlers_ * sizeof(fltk3::SharedHandler));
+
+      delete[] handlers_;
+    }
+
+    handlers_       = temp;
+    alloc_handlers_ += 32;
+  }
+
+  handlers_[num_handlers_] = f;
+  num_handlers_ ++;
+}
+
+
+
+/** Removes a shared image handler */
+void fltk3::SharedImage::remove_handler(fltk3::SharedHandler f) {
+  int	i;				// Looping var...
+
+  // First see if the handler has been added...
+  for (i = 0; i < num_handlers_; i ++) {
+    if (handlers_[i] == f) break;
+  }
+
+  if (i >= num_handlers_) return;
+
+  // OK, remove the handler from the array...
+  num_handlers_ --;
+
+  if (i < num_handlers_) {
+    // Shift later handlers down 1...
+    memmove(handlers_ + i, handlers_ + i + 1,
+           (num_handlers_ - i) * sizeof(fltk3::SharedHandler ));
+  }
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/SingleWindow.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Single_Window.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/SingleWindow.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/SingleWindow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,41 @@
+//
+// "$Id$"
+//
+// Single-buffered window for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//	A window with a single-buffered context
+//
+//	This is provided for systems where the base class is double
+//	buffered.  You can turn it off using this subclass in case
+//	your display looks better without it.
+
+#include <fltk3/SingleWindow.h>
+
+void fltk3::SingleWindow::show() {Window::show();}
+void fltk3::SingleWindow::flush() {Window::flush();}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Slider.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Slider.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Slider.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Slider.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,394 @@
+//
+// "$Id$"
+//
+// Slider widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Slider.h>
+#include <fltk3/draw.h>
+#include <math.h>
+#include "flstring.h"
+
+#if defined(FL_DLL)	// really needed for c'tors for MS VC++ only
+#include <fltk3/HorSlider.h>
+#endif
+
+void fltk3::Slider::_Slider() {
+  slider_size_ = 0;
+  slider_ = 0; // fltk3::UP_BOX;
+}
+
+/**
+  Creates a new fltk3::Slider widget using the given position,
+  size, and label string. The default boxtype is fltk3::DOWN_BOX.
+*/
+fltk3::Slider::Slider(int X, int Y, int W, int H, const char* L)
+: fltk3::Valuator(X, Y, W, H, L) {
+  box(fltk3::DOWN_BOX);
+  _Slider();
+}
+
+/**
+  Creates a new fltk3::Slider widget using the given box type, position,
+  size, and label string.
+*/
+fltk3::Slider::Slider(uchar t, int X, int Y, int W, int H, const char* L)
+  : fltk3::Valuator(X, Y, W, H, L) {
+  type(t);
+  box(t==fltk3::HOR_NICE_SLIDER || t==fltk3::VERT_NICE_SLIDER ?
+      fltk3::FLAT_BOX : fltk3::DOWN_BOX);
+  _Slider();
+}
+
+void fltk3::Slider::slider_size(double v) {
+  if (v <  0) v = 0;
+  if (v > 1) v = 1;
+  if (slider_size_ != float(v)) {
+    slider_size_ = float(v); 
+    damage(fltk3::DAMAGE_EXPOSE);
+  }
+}
+
+/** 
+  Sets the minimum (a) and maximum (b) values for the valuator widget. 
+  if at least one of the values is changed, a partial redraw is asked.
+*/
+void fltk3::Slider::bounds(double a, double b) {
+  if (minimum() != a || maximum() != b) {
+    Valuator::bounds(a, b); 
+    damage(fltk3::DAMAGE_EXPOSE);
+  }
+}
+
+/**
+  Sets the size and position of the sliding knob in the box.
+  \param[in] pos position of first line displayed
+  \param[in] size size of window in lines
+  \param[in] first number of first line
+  \param[in] total total number of lines
+  Returns fltk3::Valuator::value(p)
+ */
+int fltk3::Slider::scrollvalue(int pos, int size, int first, int total) {
+  step(1, 1);
+  if (pos+size > first+total) total = pos+size-first;
+  slider_size(size >= total ? 1.0 : double(size)/double(total));
+  bounds(first, total-size+first);
+  return value(pos);
+}
+
+// All slider interaction is done as though the slider ranges from
+// zero to one, and the left (bottom) edge of the slider is at the
+// given position.  Since when the slider is all the way to the
+// right (top) the left (bottom) edge is not all the way over, a
+// position on the widget itself covers a wider range than 0-1,
+// actually it ranges from 0 to 1/(1-size).
+
+void fltk3::Slider::draw_bg(int X, int Y, int W, int H) {
+  fltk3::push_clip(X, Y, W, H);
+  draw_box();
+  fltk3::pop_clip();
+
+  fltk3::Color black = active_r() ? fltk3::FOREGROUND_COLOR : fltk3::INACTIVE_COLOR;
+  if (type() == fltk3::VERT_NICE_SLIDER) {
+    draw_box(fltk3::THIN_DOWN_BOX, X+W/2-2, Y, 4, H, black);
+  } else if (type() == fltk3::HOR_NICE_SLIDER) {
+    draw_box(fltk3::THIN_DOWN_BOX, X, Y+H/2-2, W, 4, black);
+  }
+}
+
+void fltk3::Slider::draw(int X, int Y, int W, int H) {
+
+  double val;
+  if (minimum() == maximum())
+    val = 0.5;
+  else {
+    val = (value()-minimum())/(maximum()-minimum());
+    if (val > 1.0) val = 1.0;
+    else if (val < 0.0) val = 0.0;
+  }
+
+  int ww = (horizontal() ? W : H);
+  int xx, S;
+  if (type()==fltk3::HOR_FILL_SLIDER || type() == fltk3::VERT_FILL_SLIDER) {
+    S = int(val*ww+.5);
+    if (minimum()>maximum()) {S = ww-S; xx = ww-S;}
+    else xx = 0;
+  } else {
+    S = int(slider_size_*ww+.5);
+    int T = (horizontal() ? H : W)/2+1;
+    if (type()==fltk3::VERT_NICE_SLIDER || type()==fltk3::HOR_NICE_SLIDER) T += 4;
+    if (S < T) S = T;
+    xx = int(val*(ww-S)+.5);
+  }
+  int xsl, ysl, wsl, hsl;
+  if (horizontal()) {
+    xsl = X+xx;
+    wsl = S;
+    ysl = Y;
+    hsl = H;
+  } else {
+    ysl = Y+xx;
+    hsl = S;
+    xsl = X;
+    wsl = W;
+  }
+
+  draw_bg(X, Y, W, H);
+
+  fltk3::Boxtype box1 = slider();
+  if (!box1) {box1 = (fltk3::Boxtype)(box()&-2); if (!box1) box1 = fltk3::UP_BOX;}
+  if (type() == fltk3::VERT_NICE_SLIDER) {
+    draw_box(box1, xsl, ysl, wsl, hsl, fltk3::GRAY);
+    int d = (hsl-4)/2;
+    draw_box(fltk3::THIN_DOWN_BOX, xsl+2, ysl+d, wsl-4, hsl-2*d,selection_color());
+  } else if (type() == fltk3::HOR_NICE_SLIDER) {
+    draw_box(box1, xsl, ysl, wsl, hsl, fltk3::GRAY);
+    int d = (wsl-4)/2;
+    draw_box(fltk3::THIN_DOWN_BOX, xsl+d, ysl+2, wsl-2*d, hsl-4,selection_color());
+  } else {
+    if (wsl>0 && hsl>0) draw_box(box1, xsl, ysl, wsl, hsl, selection_color());
+
+    if (type()!=fltk3::HOR_FILL_SLIDER && type() != fltk3::VERT_FILL_SLIDER &&
+        !fltk3::scheme_) {
+      if (W>H && wsl>(hsl+8)) {
+        // Draw horizontal grippers
+	int yy, hh;
+	hh = hsl-8;
+	xx = xsl+(wsl-hsl-4)/2;
+	yy = ysl+3;
+
+	fltk3::color(fltk3::darker(selection_color()));
+	fltk3::line(xx, yy+hh, xx+hh, yy);
+	fltk3::line(xx+6, yy+hh, xx+hh+6, yy);
+	fltk3::line(xx+12, yy+hh, xx+hh+12, yy);
+
+        xx++;
+	fltk3::color(fltk3::lighter(selection_color()));
+	fltk3::line(xx, yy+hh, xx+hh, yy);
+	fltk3::line(xx+6, yy+hh, xx+hh+6, yy);
+	fltk3::line(xx+12, yy+hh, xx+hh+12, yy);
+      } else if (H>W && hsl>(wsl+8)) {
+        // Draw vertical grippers
+	int yy;
+	xx = xsl+4;
+	ww = wsl-8;
+	yy = ysl+(hsl-wsl-4)/2;
+
+	fltk3::color(fltk3::darker(selection_color()));
+	fltk3::line(xx, yy+ww, xx+ww, yy);
+	fltk3::line(xx, yy+ww+6, xx+ww, yy+6);
+	fltk3::line(xx, yy+ww+12, xx+ww, yy+12);
+
+        yy++;
+	fltk3::color(fltk3::lighter(selection_color()));
+	fltk3::line(xx, yy+ww, xx+ww, yy);
+	fltk3::line(xx, yy+ww+6, xx+ww, yy+6);
+	fltk3::line(xx, yy+ww+12, xx+ww, yy+12);
+      }
+    }
+  }
+
+  draw_label(xsl, ysl, wsl, hsl);
+  if (fltk3::focus() == this) {
+    if (type() == fltk3::HOR_FILL_SLIDER || type() == fltk3::VERT_FILL_SLIDER) draw_focus();
+    else draw_focus(box1, xsl, ysl, wsl, hsl);
+  }
+}
+
+void fltk3::Slider::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (damage()&fltk3::DAMAGE_ALL) draw_box();
+  draw(x()+fltk3::box_dx(box()),
+       y()+fltk3::box_dy(box()),
+       w()-fltk3::box_dw(box()),
+       h()-fltk3::box_dh(box()));
+}
+
+int fltk3::Slider::handle(int event, int X, int Y, int W, int H) {
+  // fltk3::WidgetTracker wp(this);
+  switch (event) {
+  case fltk3::PUSH: {
+    fltk3::WidgetTracker wp(this);
+    if (!fltk3::event_inside(X, Y, W, H)) return 0;
+    handle_push();
+    if (wp.deleted()) return 1; }
+    // fall through ...
+  case fltk3::DRAG: {
+
+    double val;
+    if (minimum() == maximum())
+      val = 0.5;
+    else {
+      val = (value()-minimum())/(maximum()-minimum());
+      if (val > 1.0) val = 1.0;
+      else if (val < 0.0) val = 0.0;
+    }
+
+    int ww = (horizontal() ? W : H);
+    int mx = (horizontal() ? fltk3::event_x()-X : fltk3::event_y()-Y);
+    int S;
+    static int offcenter;
+
+    if (type() == fltk3::HOR_FILL_SLIDER || type() == fltk3::VERT_FILL_SLIDER) {
+
+      S = 0;
+      if (event == fltk3::PUSH) {
+	int xx = int(val*ww+.5);
+	offcenter = mx-xx;
+	if (offcenter < -10 || offcenter > 10) offcenter = 0;
+	else return 1;
+      }
+
+    } else {
+
+      S = int(slider_size_*ww+.5); if (S >= ww) return 0;
+      int T = (horizontal() ? H : W)/2+1;
+      if (type()==fltk3::VERT_NICE_SLIDER || type()==fltk3::HOR_NICE_SLIDER) T += 4;
+      if (S < T) S = T;
+      if (event == fltk3::PUSH) {
+	int xx = int(val*(ww-S)+.5);
+	offcenter = mx-xx;
+	if (offcenter < 0) offcenter = 0;
+	else if (offcenter > S) offcenter = S;
+	else return 1;
+      }
+    }
+
+    int xx = mx-offcenter;
+    double v;
+    char tryAgain = 1;
+    while (tryAgain)
+    {
+      tryAgain = 0;
+      if (xx < 0) {
+        xx = 0;
+        offcenter = mx; if (offcenter < 0) offcenter = 0;
+      } else if (xx > (ww-S)) {
+        xx = ww-S;
+        offcenter = mx-xx; if (offcenter > S) offcenter = S;
+      }
+      v = round(xx*(maximum()-minimum())/(ww-S) + minimum());
+      // make sure a click outside the sliderbar moves it:
+      if (event == fltk3::PUSH && v == value()) {
+        offcenter = S/2;
+        event = fltk3::DRAG;
+        tryAgain = 1;
+      }
+    }
+    handle_drag(clamp(v));
+    } return 1;
+  case fltk3::RELEASE:
+    handle_release();
+    return 1;
+  case fltk3::KEYBOARD:
+    { fltk3::WidgetTracker wp(this);
+      switch (fltk3::event_key()) {
+	case fltk3::UpKey:
+	  if (horizontal()) return 0;
+	  handle_push();
+	  if (wp.deleted()) return 1;
+	  handle_drag(clamp(increment(value(),-1)));
+	  if (wp.deleted()) return 1;
+	  handle_release();
+	  return 1;
+	case fltk3::DownKey:
+	  if (horizontal()) return 0;
+	  handle_push();
+	  if (wp.deleted()) return 1;
+	  handle_drag(clamp(increment(value(),1)));
+	  if (wp.deleted()) return 1;
+	  handle_release();
+	  return 1;
+	case fltk3::LeftKey:
+	  if (!horizontal()) return 0;
+	  handle_push();
+	  if (wp.deleted()) return 1;
+	  handle_drag(clamp(increment(value(),-1)));
+	  if (wp.deleted()) return 1;
+	  handle_release();
+	  return 1;
+	case fltk3::RightKey:
+	  if (!horizontal()) return 0;
+	  handle_push();
+	  if (wp.deleted()) return 1;
+	  handle_drag(clamp(increment(value(),1)));
+	  if (wp.deleted()) return 1;
+	  handle_release();
+	  return 1;
+	default:
+	  return 0;
+      }
+    }
+    // break not required because of switch...
+  case fltk3::FOCUS :
+  case fltk3::UNFOCUS :
+    if (fltk3::visible_focus()) {
+      redraw();
+      return 1;
+    } else return 0;
+  case fltk3::ENTER :
+  case fltk3::LEAVE :
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+int fltk3::Slider::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (event == fltk3::PUSH && fltk3::visible_focus()) {
+    fltk3::focus(this);
+    redraw();
+  }
+
+  return handle(event,
+		x()+fltk3::box_dx(box()),
+		y()+fltk3::box_dy(box()),
+		w()-fltk3::box_dw(box()),
+		h()-fltk3::box_dh(box()));
+}
+
+/*
+ The following constructor must not be in the header file if we
+ build a shared object (DLL). Instead it is defined here to force
+ the constructor (and default destructor as well) to be defined
+ in the DLL and exported (STR #2632).
+ 
+ Note: if you the ctor here, do the same changes in the specific
+ header file as well.  This redundant definition was chosen to enable
+ inline constructors in the header files (for static linking) as well
+ as the one here for dynamic linking (Windows DLL).
+ */
+
+#if defined(FL_DLL)
+
+fltk3::HorSlider::HorSlider(int X,int Y,int W,int H,const char *l)
+: fltk3::Slider(X,Y,W,H,l) {type(fltk3::HOR_SLIDER);}
+
+#endif // FL_DLL
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Style.cxx (from rev 9002, branches/branch-3.0/src/core/Style.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Style.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Style.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,34 @@
+//
+// "$Id$"
+//
+// Base widget class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/Style.h>
+
+// nothing to see here yet
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/SysMenuBar.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Sys_Menu_Bar.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/SysMenuBar.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/SysMenuBar.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,288 @@
+//
+// "$Id$"
+//
+// MacOS system menu bar widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+ * This code is a quick hack! It was written as a proof of concept.
+ * It has been tested on the "menubar" sample program and provides
+ * basic functionality. 
+ * 
+ * To use the System Menu Bar, simply replace the main fltk3::MenuBar
+ * in an application with fltk3::SysMenuBar.
+ *
+ * FLTK features not supported by the Mac System menu
+ *
+ * - no invisible menu items
+ * - no symbolic labels
+ * - embossed labels will be underlined instead
+ * - no font sizes
+ * - Shortcut Characters should be English alphanumeric only, no modifiers yet
+ * - no disable main menus
+ * - changes to menubar in run-time don't update! 
+ *     (disable, etc. - toggle and radio button do!)
+ *
+ * No care was taken to clean up the menu bar after destruction!
+ * ::menu(bar) should only be called once!
+ * Many other calls of the parent class don't work.
+ * Changing the menu items has no effect on the menu bar.
+ * Starting with OS X 10.5, FLTK applications must be created as
+ * a bundle for the System Menu Bar (and maybe other features) to work!
+ */
+
+#if defined(__APPLE__) || defined(FLTK3_DOXYGEN)
+
+#include <fltk3/x.h>
+#include <fltk3/run.h>
+#include <fltk3/SysMenuBar.h>
+
+#include "flstring.h"
+#include <stdio.h>
+#include <ctype.h>
+#include <stdarg.h>
+
+#define MenuHandle void *
+
+typedef const fltk3::MenuItem *pFl_Menu_Item;
+ 
+
+/*
+ * Set a shortcut for an Apple menu item using the FLTK shortcut descriptor.
+ */
+static void setMenuShortcut( MenuHandle mh, int miCnt, const fltk3::MenuItem *m )
+{
+  if ( !m->shortcut_ ) 
+    return;
+  if ( m->flags & fltk3::SUBMENU )
+    return;
+  if ( m->flags & fltk3::SUBMENU_POINTER )
+    return;
+  char key = m->shortcut_ & 0xff;
+  if ( !isalnum( key ) )
+    return;
+  
+  void *menuItem = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::itemAtIndex, mh, miCnt);
+  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setKeyEquivalent, menuItem, m->shortcut_ & 0xff );
+  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setKeyEquivalentModifierMask, menuItem, m->shortcut_ );
+}
+
+
+/*
+ * Set the Toggle and Radio flag based on FLTK flags
+ */
+static void setMenuFlags( MenuHandle mh, int miCnt, const fltk3::MenuItem *m )
+{
+  if ( m->flags & fltk3::MENU_TOGGLE )
+  {
+	void *menuItem = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::itemAtIndex, mh, miCnt);
+	fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setState, menuItem, m->flags & fltk3::MENU_VALUE );
+  }
+  else if ( m->flags & fltk3::MENU_RADIO ) {
+    void *menuItem = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::itemAtIndex, mh, miCnt);
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setState, menuItem, m->flags & fltk3::MENU_VALUE );
+  }
+}
+
+
+/*
+ * create a sub menu for a specific menu handle
+ */
+static void createSubMenu( void * mh, pFl_Menu_Item &mm )
+{
+  void *submenu;
+  int miCnt, flags;
+  
+  void *menuItem;
+  submenu = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::initWithTitle, mm->text);
+  int cnt;
+  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::numberOfItems, mh, &cnt);
+  cnt--;
+  menuItem = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::itemAtIndex, mh, cnt);
+  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setSubmenu, menuItem, submenu);
+  if ( mm->flags & fltk3::MENU_INACTIVE ) {
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setEnabled, menuItem, 0);
+  }
+  mm++;
+  
+  while ( mm->text )
+  {
+    int flRank = mm - fltk3::sys_menu_bar->fltk3::Menu_::menu();
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::addNewItem, submenu, flRank, &miCnt);
+    setMenuFlags( submenu, miCnt, mm );
+    setMenuShortcut( submenu, miCnt, mm );
+    if ( mm->flags & fltk3::MENU_INACTIVE ) {
+      void *item = fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::itemAtIndex, submenu, miCnt);
+      fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setEnabled, item, 0);
+    }
+    flags = mm->flags;
+    if ( mm->flags & fltk3::SUBMENU )
+    {
+      createSubMenu( submenu, mm );
+    }
+    else if ( mm->flags & fltk3::SUBMENU_POINTER )
+    {
+      const fltk3::MenuItem *smm = (fltk3::MenuItem*)mm->user_data_;
+      createSubMenu( submenu, smm );
+    }
+    if ( flags & fltk3::MENU_DIVIDER ) {
+      fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::addSeparatorItem, submenu);
+      }
+    mm++;
+  }
+}
+ 
+
+/*
+ * convert a complete fltk3::MenuItem array into a series of menus in the top menu bar
+ * ALL PREVIOUS SYSTEM MENUS, EXCEPT APPLICATION MENU, ARE REPLACED BY THE NEW DATA
+ */
+static void convertToMenuBar(const fltk3::MenuItem *mm)
+{
+  int count;//first, delete all existing system menus
+  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::numberOfItems, fl_system_menu, &count);
+  for(int i = count - 1; i > 0; i--) {
+	  fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::removeItem, fl_system_menu, i);
+  }
+  //now convert FLTK stuff into MacOS menus
+  for (;;)
+  {
+    if ( !mm || !mm->text )
+      break;
+    char visible = mm->visible() ? 1 : 0;
+    int flRank = mm - fltk3::sys_menu_bar->fltk3::Menu_::menu();
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::addNewItem, fl_system_menu, flRank, NULL);
+		
+    if ( mm->flags & fltk3::SUBMENU )
+      createSubMenu( fl_system_menu, mm );
+    else if ( mm->flags & fltk3::SUBMENU_POINTER ) {
+      const fltk3::MenuItem *smm = (fltk3::MenuItem*)mm->user_data_;
+      createSubMenu( fl_system_menu, smm );
+    }
+    if ( visible ) {
+      //      InsertMenu( mh, 0 );
+    }
+    mm++;
+  }
+}
+
+
+/**
+ * @brief create a system menu bar using the given list of menu structs
+ *
+ * \author Matthias Melcher
+ *
+ * @param m list of fltk3::MenuItem
+ */
+void fltk3::SysMenuBar::menu(const fltk3::MenuItem *m) 
+{
+  fl_open_display();
+  fltk3::MenuBar::menu( m );
+  convertToMenuBar(m);
+}
+
+
+/**
+ * @brief add to the system menu bar a new menu item
+ *
+ * add to the system menu bar a new menu item, with a title string, shortcut int,
+ * callback, argument to the callback, and flags.
+ *
+ * @see fltk3::Menu_::add(const char* label, int shortcut, fltk3::Callback *cb, void *user_data, int flags) 
+ */
+int fltk3::SysMenuBar::add(const char* label, unsigned int shortcut, fltk3::Callback *cb, void *user_data, int flags)
+{
+  fl_open_display();
+  int rank = fltk3::Menu_::add(label, shortcut, cb, user_data, flags);
+  convertToMenuBar(fltk3::Menu_::menu());
+  return rank;
+}
+
+/**
+ * @brief insert in the system menu bar a new menu item
+ *
+ * insert in the system menu bar a new menu item, with a title string, shortcut int,
+ * callback, argument to the callback, and flags.
+ *
+ * @see fltk3::Menu_::insert(int index, const char* label, int shortcut, fltk3::Callback *cb, void *user_data, int flags) 
+ */
+int fltk3::SysMenuBar::insert(int index, const char* label, unsigned int shortcut, fltk3::Callback *cb, void *user_data, int flags)
+{
+  fl_open_display();
+  int rank = fltk3::Menu_::insert(index, label, shortcut, cb, user_data, flags);
+  convertToMenuBar(fltk3::Menu_::menu());
+  return rank;
+}
+
+void fltk3::SysMenuBar::clear()
+{
+  fltk3::Menu_::clear();
+  convertToMenuBar(NULL);
+}
+
+int fltk3::SysMenuBar::clear_submenu(int index)
+{
+  int retval = fltk3::Menu_::clear_submenu(index);
+  if (retval != -1) convertToMenuBar(fltk3::Menu_::menu());
+  return retval;
+}
+
+/**
+ * @brief remove an item from the system menu bar
+ *
+ * @param rank		the rank of the item to remove
+ */
+void fltk3::SysMenuBar::remove(int rank)
+{
+  fltk3::Menu_::remove(rank);
+  convertToMenuBar(fltk3::Menu_::menu());
+}
+
+
+/**
+ * @brief rename an item from the system menu bar
+ *
+ * @param rank		the rank of the item to rename
+ * @param name		the new item name as a UTF8 string
+ */
+void fltk3::SysMenuBar::replace(int rank, const char *name)
+{
+  doMenuOrItemOperation(renameItem, rank, name);
+  fltk3::sys_menu_bar->fltk3::Menu_::replace(rank, name);
+}
+
+
+/*
+ * Draw the menu bar. 
+ * Nothing here because the OS does this for us.
+ */
+void fltk3::SysMenuBar::draw() {
+}
+
+
+#endif /* __APPLE__ */
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TabGroup.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tabs.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TabGroup.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TabGroup.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,533 @@
+//
+// "$Id$"
+//
+// Tab widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+// This is the "file card tabs" interface to allow you to put lots and lots
+// of buttons and switches in a panel, as popularized by many toolkits.
+
+// Each child widget is a card, and its label() is printed on the card tab.
+// Clicking the tab makes that card visible.
+
+#include <stdio.h>
+#include <fltk3/run.h>
+#include <fltk3/TabGroup.h>
+#include <fltk3/draw.h>
+#include <fltk3/Tooltip.h>
+
+#define BORDER 2
+#define EXTRASPACE 10
+#define SELECTION_BORDER 5
+
+// Return the left edges of each tab (plus a fake left edge for a tab
+// past the right-hand one).  These positions are actually of the left
+// edge of the slope.  They are either separated by the correct distance
+// or by EXTRASPACE or by zero.
+// These positions are updated in the private arrays tab_pos[] and
+// tab_width[], resp.. If needed, these arrays are (re)allocated.
+// Return value is the index of the selected item.
+
+int fltk3::TabGroup::tab_positions() {
+  int nc = children();
+  if (nc != tab_count) {
+    clear_tab_positions();
+    if (nc) {
+      tab_pos   = (int*)malloc((nc+1)*sizeof(int));
+      tab_width = (int*)malloc((nc+1)*sizeof(int));
+    }
+    tab_count = nc;
+  }
+  if (nc == 0) return 0;
+  int selected = 0;
+  fltk3::Widget*const* a = array();
+  int i;
+  char prev_draw_shortcut = fltk3::draw_shortcut;
+  fltk3::draw_shortcut = 1;
+
+  tab_pos[0] = fltk3::box_dx(box());
+  for (i=0; i<nc; i++) {
+    fltk3::Widget* o = *a++;
+    if (o->visible()) selected = i;
+
+    int wt = 0; int ht = 0;
+    o->measure_label(wt,ht);
+
+    tab_width[i] = wt + EXTRASPACE;
+    tab_pos[i+1] = tab_pos[i] + tab_width[i] + BORDER;
+  }
+  fltk3::draw_shortcut = prev_draw_shortcut;
+
+  int r = w();
+  if (tab_pos[i] <= r) return selected;
+  // uh oh, they are too big:
+  // pack them against right edge:
+  tab_pos[i] = r;
+  for (i = nc; i--;) {
+    int l = r-tab_width[i];
+    if (tab_pos[i+1] < l) l = tab_pos[i+1];
+    if (tab_pos[i] <= l) break;
+    tab_pos[i] = l;
+    r -= EXTRASPACE;
+  }
+  // pack them against left edge and truncate width if they still don't fit:
+  for (i = 0; i<nc; i++) {
+    if (tab_pos[i] >= i*EXTRASPACE) break;
+    tab_pos[i] = i*EXTRASPACE;
+    int W = w()-1-EXTRASPACE*(children()-i) - tab_pos[i];
+    if (tab_width[i] > W) tab_width[i] = W;
+  }
+  // adjust edges according to visiblity:
+  for (i = nc; i > selected; i--) {
+    tab_pos[i] = tab_pos[i-1] + tab_width[i-1];
+  }
+  return selected;
+}
+
+// Returns space (height) in pixels needed for tabs. Negative to put them on the bottom.
+// Returns full height, if children() = 0.
+int fltk3::TabGroup::tab_height() {
+  if (children() == 0) return h();
+  int H = h();
+  int H2 = y();
+  fltk3::Widget*const* a = array();
+  for (int i=children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (o->y() < y()+H) H = o->y()-y();
+    if (o->y()+o->h() > H2) H2 = o->y()+o->h();
+  }
+  H2 = y()+h()-H2;
+  if (H2 > H) return (H2 <= 0) ? 0 : -H2;
+  else return (H <= 0) ? 0 : H;
+}
+
+// This is used for event handling (clicks) and by fluid to pick tabs.
+// Returns 0, if children() = 0, or if the event is outside of the tabs area.
+fltk3::Widget *fltk3::TabGroup::which(int event_x, int event_y) {
+  if (children() == 0) return 0;
+  int H = tab_height();
+  if (H < 0) {
+    if (event_y > y()+h() || event_y < y()+h()+H) return 0;
+  } else {
+    if (event_y > y()+H || event_y < y()) return 0;
+  }
+  if (event_x < x()) return 0;
+  fltk3::Widget *ret = 0L;
+  int nc = children();
+  tab_positions();
+  for (int i=0; i<nc; i++) {
+    if (event_x < x()+tab_pos[i+1]) {
+      ret = child(i);
+      break;
+    }
+  }
+  return ret;
+}
+
+void fltk3::TabGroup::redraw_tabs()
+{
+  int H = tab_height();
+  if (H >= 0) {
+    H += fltk3::box_dy(box());
+    damage(fltk3::DAMAGE_SCROLL, x(), y(), w(), H);
+  } else {
+    H = fltk3::box_dy(box()) - H;
+    damage(fltk3::DAMAGE_SCROLL, x(), y() + h() - H, w(), H);
+  }
+}
+
+int fltk3::TabGroup::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+
+  fltk3::Widget *o;
+  int i;
+
+  switch (event) {
+
+  case fltk3::PUSH: {
+    int H = tab_height();
+    if (H >= 0) {
+      if (fltk3::event_y() > y()+H) return Group::handle(event);
+    } else {
+      if (fltk3::event_y() < y()+h()+H) return Group::handle(event);
+    }}
+    /* FALLTHROUGH */
+  case fltk3::DRAG:
+  case fltk3::RELEASE:
+    o = which(fltk3::event_x(), fltk3::event_y());
+    if (event == fltk3::RELEASE) {
+      push(0);
+      if (o && fltk3::visible_focus() && fltk3::focus()!=this) { 
+        fltk3::focus(this);
+        redraw_tabs();
+      }
+      if (o && value(o)) {
+        fltk3::WidgetTracker wp(o);
+        set_changed();
+	do_callback();
+	if (wp.deleted()) return 1;
+      }
+      fltk3::Tooltip::current(o);
+    } else {
+      push(o);
+    }
+    return 1;
+  case fltk3::MOVE: {
+    int ret = Group::handle(event);
+    fltk3::Widget *o = fltk3::Tooltip::current(), *n = o;
+    int H = tab_height();
+    if ( (H>=0) && (fltk3::event_y()>y()+H) )
+      return ret;
+    else if ( (H<0) && (fltk3::event_y() < y()+h()+H) )
+      return ret;
+    else { 
+      n = which(fltk3::event_x(), fltk3::event_y());
+      if (!n) n = this;
+    }
+    if (n!=o)
+      fltk3::Tooltip::enter(n);
+    return ret; }
+  case fltk3::FOCUS:
+  case fltk3::UNFOCUS:
+    if (!fltk3::visible_focus()) return Group::handle(event);
+    if (fltk3::event() == fltk3::RELEASE ||
+	fltk3::event() == fltk3::SHORTCUT ||
+	fltk3::event() == fltk3::KEYBOARD ||
+	fltk3::event() == fltk3::FOCUS ||
+	fltk3::event() == fltk3::UNFOCUS) {
+      redraw_tabs();
+      if (fltk3::event() == fltk3::FOCUS) return Group::handle(event);
+      if (fltk3::event() == fltk3::UNFOCUS) return 0;
+      else return 1;
+    } else return Group::handle(event);
+  case fltk3::KEYBOARD:
+    switch (fltk3::event_key()) {
+      case fltk3::LeftKey:
+        if (child(0)->visible()) return 0;
+	for (i = 1; i < children(); i ++)
+	  if (child(i)->visible()) break;
+	value(child(i - 1));
+	set_changed();
+	do_callback();
+        return 1;
+      case fltk3::RightKey:
+        if (child(children() - 1)->visible()) return 0;
+	for (i = 0; i < children(); i ++)
+	  if (child(i)->visible()) break;
+	value(child(i + 1));
+	set_changed();
+	do_callback();
+        return 1;
+      case fltk3::DownKey:
+        redraw();
+        return Group::handle(fltk3::FOCUS);
+      default:
+        break;
+    }
+    return Group::handle(event);
+  case fltk3::SHORTCUT:
+    for (i = 0; i < children(); ++i) {
+      fltk3::Widget *c = child(i);
+      if (c->test_shortcut(c->label())) {
+        char sc = !c->visible();
+        value(c);
+        if (sc) set_changed();
+        do_callback();
+        return 1;
+      }
+    }
+    return Group::handle(event);
+  case fltk3::SHOW:
+    value(); // update visibilities and fall through
+  default:
+    return Group::handle(event);
+
+  }
+}
+
+int fltk3::TabGroup::push(fltk3::Widget *o) {
+  if (push_ == o) return 0;
+  if ( (push_ && !push_->visible()) || (o && !o->visible()) )
+    redraw_tabs();
+  push_ = o;
+  return 1;
+}
+
+/**  
+   Gets the currently visible widget/tab.
+   The value() is the first visible child (or the last child if none
+   are visible) and this also hides any other children.
+   This allows the tabs to be deleted, moved to other groups, and
+   show()/hide() called without it screwing up.
+*/
+fltk3::Widget* fltk3::TabGroup::value() {
+  fltk3::Widget* v = 0;
+  fltk3::Widget*const* a = array();
+  for (int i=children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (v) o->hide();
+    else if (o->visible()) v = o;
+    else if (!i) {o->show(); v = o;}
+  }
+  return v;
+}
+
+/**
+  Sets the widget to become the current visible widget/tab.
+  Setting the value hides all other children, and makes this one
+  visible, if it is really a child.
+*/
+int fltk3::TabGroup::value(fltk3::Widget *newvalue) {
+  fltk3::Widget*const* a = array();
+  int ret = 0;
+  for (int i=children(); i--;) {
+    fltk3::Widget* o = *a++;
+    if (o == newvalue) {
+      if (!o->visible()) ret = 1;
+      o->show();
+    } else {
+      o->hide();
+    }
+  }
+  return ret;
+}
+
+enum {LEFT, RIGHT, SELECTED};
+
+void fltk3::TabGroup::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  fltk3::Widget *v = value();
+  int H = tab_height();
+
+  if (damage() & fltk3::DAMAGE_ALL) { // redraw the entire thing:
+    fltk3::Color c = v ? v->color() : color();
+
+    draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), c);
+
+    if (selection_color() != c) {
+      // Draw the top or bottom SELECTION_BORDER lines of the tab pane in the
+      // selection color so that the user knows which tab is selected...
+      int clip_y = (H >= 0) ? y() + H : y() + h() + H - SELECTION_BORDER;
+      fltk3::push_clip(x(), clip_y, w(), SELECTION_BORDER);
+      draw_box(box(), x(), clip_y, w(), SELECTION_BORDER, selection_color());
+      fltk3::pop_clip();
+    }
+    if (v) draw_child(*v);
+  } else { // redraw the child
+    if (v) update_child(*v);
+  }
+  if (damage() & (fltk3::DAMAGE_SCROLL|fltk3::DAMAGE_ALL)) {
+    int nc = children();
+    int selected = tab_positions();
+    int i;
+    fltk3::Widget*const* a = array();
+    for (i=0; i<selected; i++)
+      draw_tab(x()+tab_pos[i], x()+tab_pos[i+1],
+               tab_width[i], H, a[i], LEFT);
+    for (i=nc-1; i > selected; i--)
+      draw_tab(x()+tab_pos[i], x()+tab_pos[i+1],
+               tab_width[i], H, a[i], RIGHT);
+    if (v) {
+      i = selected;
+      draw_tab(x()+tab_pos[i], x()+tab_pos[i+1],
+               tab_width[i], H, a[i], SELECTED);
+    }
+  }
+}
+
+void fltk3::TabGroup::draw_tab(int x1, int x2, int W, int H, fltk3::Widget* o, int what) {
+  int sel = (what == SELECTED);
+  int dh = fltk3::box_dh(box());
+  int dy = fltk3::box_dy(box());
+  char prev_draw_shortcut = fltk3::draw_shortcut;
+  fltk3::draw_shortcut = 1;
+
+  fltk3::Boxtype bt = (o==push_ &&!sel) ? fltk3::down(box()) : box();
+
+  // compute offsets to make selected tab look bigger
+  int yofs = sel ? 0 : BORDER;
+
+  if ((x2 < x1+W) && what == RIGHT) x1 = x2 - W;
+
+  if (H >= 0) {
+    if (sel) fltk3::push_clip(x1, y(), x2 - x1, H + dh - dy);
+    else fltk3::push_clip(x1, y(), x2 - x1, H);
+
+    H += dh;
+
+    fltk3::Color c = sel ? selection_color() : o->selection_color();
+
+    draw_box(bt, x1, y() + yofs, W, H + 10 - yofs, c);
+
+    // Save the previous label color
+    fltk3::Color oc = o->labelcolor();
+
+    // Draw the label using the current color...
+    o->labelcolor(sel ? labelcolor() : o->labelcolor());    
+    o->draw_label(x1, y() + yofs, W, H - yofs, fltk3::ALIGN_CENTER);
+
+    // Restore the original label color...
+    o->labelcolor(oc);
+
+    if (fltk3::focus() == this && o->visible())
+      draw_focus(box(), x1, y(), W, H);
+
+    fltk3::pop_clip();
+  } else {
+    H = -H;
+
+    if (sel) fltk3::push_clip(x1, y() + h() - H - dy, x2 - x1, H + dy);
+    else fltk3::push_clip(x1, y() + h() - H, x2 - x1, H);
+
+    H += dh;
+
+    fltk3::Color c = sel ? selection_color() : o->selection_color();
+
+    draw_box(bt, x1, y() + h() - H - 10, W, H + 10 - yofs, c);
+
+    // Save the previous label color
+    fltk3::Color oc = o->labelcolor();
+
+    // Draw the label using the current color...
+    o->labelcolor(sel ? labelcolor() : o->labelcolor());
+    o->draw_label(x1, y() + h() - H, W, H - yofs, fltk3::ALIGN_CENTER);
+
+    // Restore the original label color...
+    o->labelcolor(oc);
+
+    if (fltk3::focus() == this && o->visible())
+      draw_focus(box(), x1, y() + h() - H, W, H);
+
+    fltk3::pop_clip();
+  }
+  fltk3::draw_shortcut = prev_draw_shortcut;
+}
+
+/**
+    Creates a new fltk3::TabGroup widget using the given position, size,
+    and label string. The default boxtype is fltk3::THIN_UP_BOX.
+
+    Use add(fltk3::Widget*) to add each child, which are usually
+    fltk3::Group widgets. The children should be sized to stay
+    away from the top or bottom edge of the fltk3::TabGroup widget,
+    which is where the tabs will be drawn.
+
+    All children of fltk3::TabGroup should have the same size and exactly fit on top of 
+    each other. They should only leave space above or below where that tabs will 
+    go, but not on the sides. If the first child of fltk3::TabGroup is set to 
+    "resizable()", the riders will not resize when the tabs are resized.
+
+    The destructor <I>also deletes all the children</I>. This
+    allows a whole tree to be deleted at once, without having to
+    keep a pointer to all the children in the user code. A kludge
+    has been done so the fltk3::TabGroup and all of its children
+    can be automatic (local) variables, but you must declare the
+    fltk3::TabGroup widget <I>first</I> so that it is destroyed last.
+*/
+fltk3::TabGroup::TabGroup(int X,int Y,int W, int H, const char *l) :
+  fltk3::Group(X,Y,W,H,l)
+{
+  box(fltk3::THIN_UP_BOX);
+  push_ = 0;
+  tab_pos = 0;
+  tab_width = 0;
+  tab_count = 0;
+}
+
+fltk3::TabGroup::~TabGroup() {
+  clear_tab_positions();
+}
+
+/**
+    Returns the position and size available to be used by its children.
+
+    If there isn't any child yet the \p tabh parameter will be used to
+    calculate the return values. This assumes that the children's labelsize
+    is the same as the fltk3::TabGroup' labelsize and adds a small border.
+
+    If there are already children, the values of child(0) are returned, and
+    \p tabh is ignored.
+
+    \note Children should always use the same positions and sizes.
+
+    \p tabh can be one of
+    \li    0: calculate label size, tabs on top
+    \li   -1: calculate label size, tabs on bottom
+    \li >  0: use given \p tabh value, tabs on top (height = tabh)
+    \li < -1: use given \p tabh value, tabs on bottom (height = -tabh)
+
+    \param[in]	tabh		position and optional height of tabs (see above)
+    \param[out]	rx,ry,rw,rh	(x,y,w,h) of client area for children
+
+    \since	FLTK 1.3.0
+*/
+void fltk3::TabGroup::client_area(int &rx, int &ry, int &rw, int &rh, int tabh) {
+
+  if (children()) {			// use existing values
+
+    rx = child(0)->x();
+    ry = child(0)->y();
+    rw = child(0)->w();
+    rh = child(0)->h();
+
+  } else {				// calculate values
+
+    int y_offset;
+    int label_height = fltk3::height(labelfont(), labelsize()) + BORDER*2;
+
+    if (tabh == 0)			// use default (at top)
+      y_offset = label_height;
+    else if (tabh == -1)	 	// use default (at bottom)
+      y_offset = -label_height;
+    else
+      y_offset = tabh;			// user given value
+
+    rx = x();
+    rw = w();
+
+    if (y_offset >= 0) {		// labels at top
+      ry = y() + y_offset;
+      rh = h() - y_offset;
+    } else {				// labels at bottom
+      ry = y();
+      rh = h() + y_offset;
+    }
+  }
+}
+
+void fltk3::TabGroup::clear_tab_positions() {
+  if (tab_pos) {
+    free(tab_pos);
+    tab_pos = 0;
+  }
+  if (tab_width){
+    free(tab_width);
+    tab_width = 0;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Table.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Table.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Table.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Table.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1262 @@
+//
+// "$Id$"
+//
+// fltk3::Table -- A table widget
+//
+// Copyright 2002 by Greg Ercolano.
+// Copyright (c) 2004 O'ksi'D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+// 
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+#include <stdio.h>		// fprintf
+#include <fltk3/draw.h>
+#include <fltk3/Table.h>
+
+#if defined(USE_UTF8) && ( defined(MICROSOFT) || defined(LINUX) )
+#include <fltk3/fl_utf8.h>	// currently only Windows and Linux
+#endif
+
+#define SCROLLBAR_SIZE	(fltk3::scrollbar_size())
+
+// Scroll display so 'row' is at top
+void fltk3::Table::row_position(int row) {
+  if ( _row_position == row ) return;		// OPTIMIZATION: no change? avoid redraw
+  if ( row < 0 ) row = 0;
+  else if ( row >= rows() ) row = rows() - 1;
+  if ( table_h <= tih ) return;			// don't scroll if table smaller than window
+  double newtop = row_scroll_position(row);
+  if ( newtop > vscrollbar->maximum() ) {
+    newtop = vscrollbar->maximum();
+  }
+  vscrollbar->Slider::value(newtop);
+  table_scrolled();
+  redraw();
+  _row_position = row;	// HACK: override what table_scrolled() came up with
+}
+
+// Scroll display so 'col' is at left
+void fltk3::Table::col_position(int col) {
+  if ( _col_position == col ) return;	// OPTIMIZATION: no change? avoid redraw
+  if ( col < 0 ) col = 0;
+  else if ( col >= cols() ) col = cols() - 1;
+  if ( table_w <= tiw ) return;		// don't scroll if table smaller than window
+  double newleft = col_scroll_position(col);
+  if ( newleft > hscrollbar->maximum() ) {
+    newleft = hscrollbar->maximum();
+  }
+  hscrollbar->Slider::value(newleft);
+  table_scrolled();
+  redraw();
+  _col_position = col;	// HACK: override what table_scrolled() came up with
+}
+
+// Find scroll position of a row (in pixels)
+long fltk3::Table::row_scroll_position(int row) {
+  int startrow = 0;
+  long scroll = 0; 
+  // OPTIMIZATION: 
+  //     Attempt to use precomputed row scroll position
+  //
+  if ( toprow_scrollpos != -1 && row >= toprow ) {
+    scroll = toprow_scrollpos;
+    startrow = toprow;
+  }
+  for ( int t=startrow; t<row; t++ ) {
+    scroll += row_height(t);
+  }
+  return(scroll);
+}
+
+// Find scroll position of a column (in pixels)
+long fltk3::Table::col_scroll_position(int col) {
+  int startcol = 0;
+  long scroll = 0;
+  // OPTIMIZATION: 
+  //     Attempt to use precomputed row scroll position
+  //
+  if ( leftcol_scrollpos != -1 && col >= leftcol ) {
+    scroll = leftcol_scrollpos;
+    startcol = leftcol;
+  }
+  for ( int t=startcol; t<col; t++ ) {
+    scroll += col_width(t);
+  }
+  return(scroll);
+}
+
+// Ctor
+fltk3::Table::Table(int X, int Y, int W, int H, const char *l) : fltk3::Group(X,Y,W,H,l) {
+  _rows             = 0;
+  _cols             = 0;
+  _row_header_w     = 40;
+  _col_header_h     = 18;
+  _row_header       = 0;
+  _col_header       = 0;
+  _row_header_color = color();
+  _col_header_color = color();
+  _row_resize       = 0;
+  _col_resize       = 0;
+  _row_resize_min   = 1;
+  _col_resize_min   = 1;
+  _redraw_toprow    = -1;
+  _redraw_botrow    = -1;
+  _redraw_leftcol   = -1;
+  _redraw_rightcol  = -1;
+  table_w           = 0;
+  table_h           = 0;
+  toprow            = 0;
+  botrow            = 0;
+  leftcol           = 0;
+  rightcol          = 0;
+  toprow_scrollpos  = -1;
+  leftcol_scrollpos = -1;
+  _last_cursor      = fltk3::CURSOR_DEFAULT;
+  _resizing_col     = -1;
+  _resizing_row     = -1;
+  _dragging_x       = -1;
+  _dragging_y       = -1;
+  _last_row         = -1;
+  _auto_drag        = 0;
+  current_col	      = -1;
+  current_row       = -1;
+  select_row        = -1;
+  select_col        = -1;
+  
+  box(fltk3::THIN_DOWN_FRAME);
+  
+  vscrollbar = new fltk3::Scrollbar(x()+w()-SCROLLBAR_SIZE, y(),
+                                SCROLLBAR_SIZE, h()-SCROLLBAR_SIZE);
+  vscrollbar->type(fltk3::VERTICAL);
+  vscrollbar->callback(scroll_cb, (void*)this);
+  
+  hscrollbar = new fltk3::Scrollbar(x(), y()+h()-SCROLLBAR_SIZE,
+                                w(), SCROLLBAR_SIZE);
+  hscrollbar->type(fltk3::HORIZONTAL);
+  hscrollbar->callback(scroll_cb, (void*)this);
+  
+  table = new fltk3::ScrollGroup(x(), y(), w(), h());
+  table->box(fltk3::NO_BOX);
+  table->type(0);		// don't show fltk3::ScrollGroup's scrollbars -- use our own
+  table->hide();		// hide unless children are present
+  table->end();
+  
+  table_resized();
+  redraw();
+  
+  Group::end();		// end the group's begin()
+  
+  table->begin();		// leave with fltk children getting added to the scroll
+}
+
+// Dtor
+fltk3::Table::~Table() {
+  // The parent fltk3::Group takes care of destroying scrollbars
+}
+
+// Set height of a row
+void fltk3::Table::row_height(int row, int height) {
+  if ( row < 0 ) return;
+  if ( row < (int)_rowheights.size() && _rowheights[row] == height ) {
+    return;		// OPTIMIZATION: no change? avoid redraw
+  }
+  // Add row heights, even if none yet
+  int now_size = (int)_rowheights.size();
+  if ( row >= now_size ) {
+    _rowheights.size(row);
+    while (now_size < row)
+      _rowheights[now_size++] = height;
+  }
+  _rowheights[row] = height;
+  table_resized();
+  if ( row <= botrow ) {	// OPTIMIZATION: only redraw if onscreen or above screen
+    redraw();
+  }
+  // ROW RESIZE CALLBACK
+  if ( Widget::callback() && when() & fltk3::WHEN_CHANGED ) {
+    do_callback(CONTEXT_RC_RESIZE, row, 0);
+  }
+}
+
+// Set width of a column
+void fltk3::Table::col_width(int col, int width)
+{
+  if ( col < 0 ) return;
+  if ( col < (int)_colwidths.size() && _colwidths[col] == width ) {
+    return;			// OPTIMIZATION: no change? avoid redraw
+  }
+  // Add column widths, even if none yet
+  int now_size = (int)_colwidths.size();
+  if ( col >= now_size ) {
+    _colwidths.size(col);
+    while (now_size < col) {
+      _colwidths[now_size++] = width;
+    }
+  }
+  _colwidths[col] = width;
+  table_resized();
+  if ( col <= rightcol ) {	// OPTIMIZATION: only redraw if onscreen or to the left
+    redraw();
+  }
+  // COLUMN RESIZE CALLBACK
+  if ( Widget::callback() && when() & fltk3::WHEN_CHANGED ) {
+    do_callback(CONTEXT_RC_RESIZE, 0, col);
+  }
+}
+
+// Return row/col clamped to reality
+int fltk3::Table::row_col_clamp(TableContext context, int &R, int &C) {
+  int clamped = 0;
+  if ( R < 0 ) { R = 0; clamped = 1; }
+  if ( C < 0 ) { C = 0; clamped = 1; }
+  switch ( context ) {
+    case CONTEXT_COL_HEADER:
+      // Allow col headers to draw even if no rows
+      if ( R >= _rows && R != 0 ) { R = _rows - 1; clamped = 1; }
+      break;
+      
+    case CONTEXT_ROW_HEADER:
+      // Allow row headers to draw even if no columns
+      if ( C >= _cols && C != 0 ) { C = _cols - 1; clamped = 1; }
+      break;
+      
+    case CONTEXT_CELL:
+    default:
+      // CLAMP R/C TO _rows/_cols
+      if ( R >= _rows ) { R = _rows - 1; clamped = 1; }
+      if ( C >= _cols ) { C = _cols - 1; clamped = 1; }
+      break;
+  }
+  return(clamped);
+}
+
+// Return bounding region for given context
+void fltk3::Table::get_bounds(TableContext context, int &X, int &Y, int &W, int &H) {
+  switch ( context ) {
+    case CONTEXT_COL_HEADER:
+      // Column header clipping.
+      X = tox;
+      Y = wiy;
+      W = tow;
+      H = col_header_height();
+      return;
+      
+    case CONTEXT_ROW_HEADER:
+      // Row header clipping.
+      X = wix;
+      Y = toy;
+      W = row_header_width();
+      H = toh;
+      return;
+      
+    case CONTEXT_TABLE:
+      // Table inner dimensions
+      X = tix; Y = tiy; W = tiw; H = tih;
+      return;
+      
+      // TODO: Add other contexts..
+    default:
+      fprintf(stderr, "fltk3::Table::get_bounds(): context %d unimplemented\n", (int)context);
+      return;
+  }
+  //NOTREACHED
+}
+
+// Find row/col beneath cursor
+//
+//    Returns R/C and context.
+//    Also returns resizeflag, if mouse is hovered over a resize boundary.
+//
+fltk3::Table::TableContext fltk3::Table::cursor2rowcol(int &R, int &C, ResizeFlag &resizeflag) {
+  // return values
+  R = C = 0;
+  resizeflag = RESIZE_NONE;
+  // Row header?
+  int X, Y, W, H;
+  if ( row_header() ) {
+    // Inside a row heading?
+    get_bounds(CONTEXT_ROW_HEADER, X, Y, W, H);
+    if ( fltk3::event_inside(X, Y, W, H) ) {
+      // Scan visible rows until found
+      for ( R = toprow; R <= botrow; R++ ) {
+        find_cell(CONTEXT_ROW_HEADER, R, 0, X, Y, W, H);
+        if ( fltk3::event_y() >= Y && fltk3::event_y() < (Y+H) ) {
+          // Found row?
+          //     If cursor over resize boundary, and resize enabled,
+          //     enable the appropriate resize flag.
+          //
+          if ( row_resize() ) {
+            if ( fltk3::event_y() <= (Y+3-0) ) { resizeflag = RESIZE_ROW_ABOVE; }
+            if ( fltk3::event_y() >= (Y+H-3) ) { resizeflag = RESIZE_ROW_BELOW; }
+          }
+          return(CONTEXT_ROW_HEADER);
+        }
+      }
+      // Must be in row header dead zone
+      return(CONTEXT_NONE);
+    }
+  }
+  // Column header?
+  if ( col_header() ) {
+    // Inside a column heading?
+    get_bounds(CONTEXT_COL_HEADER, X, Y, W, H);
+    if ( fltk3::event_inside(X, Y, W, H) ) {
+      // Scan visible columns until found
+      for ( C = leftcol; C <= rightcol; C++ ) {
+        find_cell(CONTEXT_COL_HEADER, 0, C, X, Y, W, H);
+        if ( fltk3::event_x() >= X && fltk3::event_x() < (X+W) ) {
+          // Found column?
+          //     If cursor over resize boundary, and resize enabled,
+          //     enable the appropriate resize flag.
+          //
+          if ( col_resize() ) {
+            if ( fltk3::event_x() <= (X+3-0) ) { resizeflag = RESIZE_COL_LEFT; }
+            if ( fltk3::event_x() >= (X+W-3) ) { resizeflag = RESIZE_COL_RIGHT; }
+          }
+          return(CONTEXT_COL_HEADER);
+        }
+      }
+      // Must be in column header dead zone
+      return(CONTEXT_NONE);
+    }
+  }
+  // Mouse somewhere in table?
+  //     Scan visible r/c's until we find it.
+  //
+  if ( fltk3::event_inside(tox, toy, tow, toh) ) {
+    for ( R = toprow; R <= botrow; R++ ) {
+      find_cell(CONTEXT_CELL, R, C, X, Y, W, H);
+      if ( fltk3::event_y() < Y ) break;		// OPT: thanks lars
+      if ( fltk3::event_y() >= (Y+H) ) continue;	// OPT: " "
+      for ( C = leftcol; C <= rightcol; C++ ) {
+        find_cell(CONTEXT_CELL, R, C, X, Y, W, H);
+        if ( fltk3::event_inside(X, Y, W, H) ) {
+          return(CONTEXT_CELL);			// found it
+        }
+      }
+    }
+    // Must be in a dead zone of the table
+    R = C = 0;
+    return(CONTEXT_TABLE);
+  }
+  // Somewhere else
+  return(CONTEXT_NONE);
+}
+
+// Find X/Y/W/H for cell at R/C
+//     If R or C are out of range, returns -1 
+//     with X/Y/W/H set to zero.
+//
+int fltk3::Table::find_cell(TableContext context, int R, int C, int &X, int &Y, int &W, int &H) {
+  if ( row_col_clamp(context, R, C) ) {		// row or col out of range? error
+    X=Y=W=H=0;
+    return(-1);
+  }
+  X = col_scroll_position(C) - hscrollbar->value() + tix;
+  Y = row_scroll_position(R) - vscrollbar->value() + tiy;
+  W = col_width(C);
+  H = row_height(R);
+  
+  switch ( context ) {
+    case CONTEXT_COL_HEADER:
+      Y = wiy;
+      H = col_header_height();
+      return(0);
+      
+    case CONTEXT_ROW_HEADER:
+      X = wix;
+      W = row_header_width();
+      return(0);
+      
+    case CONTEXT_CELL:
+      return(0);
+      
+    case CONTEXT_TABLE:
+      return(0);
+      
+      // TODO -- HANDLE OTHER CONTEXTS
+    default:
+      fprintf(stderr, "fltk3::Table::find_cell: unknown context %d\n", (int)context);
+      return(-1);
+  }
+  //NOTREACHED
+}
+
+// Enable automatic scroll-selection
+void fltk3::Table::_start_auto_drag() {
+  if (_auto_drag) return;
+  _auto_drag = 1;
+  fltk3::add_timeout(0.3, _auto_drag_cb2, this);
+}
+
+// Disable automatic scroll-selection
+void fltk3::Table::_stop_auto_drag() {
+  if (!_auto_drag) return;
+  fltk3::remove_timeout(_auto_drag_cb2, this);
+  _auto_drag = 0;
+}
+
+void fltk3::Table::_auto_drag_cb2(void *d) {
+  ((fltk3::Table*)d)->_auto_drag_cb();
+}
+
+// Handle automatic scroll-selection if mouse selection dragged off table edge
+void fltk3::Table::_auto_drag_cb() {
+  int lx = fltk3::e_x;
+  int ly = fltk3::e_y;
+  if (_selecting == CONTEXT_COL_HEADER)
+  { ly = y() + col_header_height(); }
+  else if (_selecting == CONTEXT_ROW_HEADER)
+  { lx = x() + row_header_width(); }
+  if (lx > x() + w() - 20) {
+    fltk3::e_x = x() + w() - 20;
+    if (hscrollbar->visible())
+      ((fltk3::Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() + 30));
+    hscrollbar->do_callback();
+    _dragging_x = fltk3::e_x - 30;
+  }
+  else if (lx < (x() + row_header_width())) {
+    fltk3::e_x = x() + row_header_width() + 1;
+    if (hscrollbar->visible()) {
+      ((fltk3::Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() - 30));
+    }
+    hscrollbar->do_callback();
+    _dragging_x = fltk3::e_x + 30;
+  }
+  if (ly > y() + h() - 20) {
+    fltk3::e_y = y() + h() - 20;
+    if (vscrollbar->visible()) {
+      ((fltk3::Slider*)vscrollbar)->value(vscrollbar->clamp(vscrollbar->value() + 30));
+    }
+    vscrollbar->do_callback();
+    _dragging_y = fltk3::e_y - 30;
+  }
+  else if (ly < (y() + col_header_height())) {
+    fltk3::e_y = y() + col_header_height() + 1;
+    if (vscrollbar->visible()) {
+      ((fltk3::Slider*)vscrollbar)->value(vscrollbar->clamp(vscrollbar->value() - 30));
+    }
+    vscrollbar->do_callback();
+    _dragging_y = fltk3::e_y + 30;
+  }
+  _auto_drag = 2;
+  handle(fltk3::DRAG);
+  _auto_drag = 1;
+  fltk3::e_x = lx;
+  fltk3::e_y = ly;
+  fltk3::check();
+  fltk3::flush();
+  if (fltk3::event_buttons() && _auto_drag) {
+    fltk3::add_timeout(0.05, _auto_drag_cb2, this);
+  }
+}
+
+// Recalculate the window dimensions
+void fltk3::Table::recalc_dimensions() {
+  // Recalc to* (Table Outer), ti* (Table Inner), wi* ( Widget Inner)
+  wix = ( x() + fltk3::box_dx(box())); tox = wix; tix = tox + fltk3::box_dx(table->box());
+  wiy = ( y() + fltk3::box_dy(box())); toy = wiy; tiy = toy + fltk3::box_dy(table->box());
+  wiw = ( w() - fltk3::box_dw(box())); tow = wiw; tiw = tow - fltk3::box_dw(table->box());
+  wih = ( h() - fltk3::box_dh(box())); toh = wih; tih = toh - fltk3::box_dh(table->box());
+  // Trim window if headers enabled
+  if ( col_header() ) {
+    tiy += col_header_height(); toy += col_header_height();
+    tih -= col_header_height(); toh -= col_header_height();
+  }
+  if ( row_header() ) {
+    tix += row_header_width(); tox += row_header_width();
+    tiw -= row_header_width(); tow -= row_header_width();
+  } 
+  // Make scroll bars disappear if window large enough
+  {
+    // First pass: can hide via window size?
+    int hidev = (table_h <= tih);
+    int hideh = (table_w <= tiw); 
+    // Second pass: Check for interference
+    if ( !hideh & hidev ) { hidev = (( table_h - tih + SCROLLBAR_SIZE ) <= 0 ); } 
+    if ( !hidev & hideh ) { hideh = (( table_w - tiw + SCROLLBAR_SIZE ) <= 0 ); } 
+    // Determine scrollbar visibility, trim ti[xywh]/to[xywh]
+    if ( hidev ) { vscrollbar->hide(); } 
+    else { vscrollbar->show(); tiw -= SCROLLBAR_SIZE; tow -= SCROLLBAR_SIZE; }
+    if ( hideh ) { hscrollbar->hide(); } 
+    else { hscrollbar->show(); tih -= SCROLLBAR_SIZE; toh -= SCROLLBAR_SIZE; }
+  } 
+  // Resize the child table
+  table->resize(tox, toy, tow, toh);
+  table->init_sizes();
+}
+
+// Recalculate internals after a scroll.
+//
+//    Call this if table has been scrolled or resized.
+//    Does not handle redraw().
+//    TODO: Assumes ti[xywh] has already been recalculated.
+//
+void fltk3::Table::table_scrolled() {
+  // Find top row
+  int y, row, voff = vscrollbar->value();
+  for ( row=y=0; row < _rows; row++ ) {
+    y += row_height(row);
+    if ( y > voff ) { y -= row_height(row); break; }
+  }
+  _row_position = toprow = ( row >= _rows ) ? (row - 1) : row;
+  toprow_scrollpos = y;		// OPTIMIZATION: save for later use 
+  // Find bottom row
+  voff = vscrollbar->value() + tih;
+  for ( ; row < _rows; row++ ) {
+    y += row_height(row);
+    if ( y >= voff ) { break; }
+  }
+  botrow = ( row >= _rows ) ? (row - 1) : row; 
+  // Left column
+  int x, col, hoff = hscrollbar->value();
+  for ( col=x=0; col < _cols; col++ ) {
+    x += col_width(col);
+    if ( x > hoff ) { x -= col_width(col); break; }
+  }
+  _col_position = leftcol = ( col >= _cols ) ? (col - 1) : col;
+  leftcol_scrollpos = x;	// OPTIMIZATION: save for later use 
+  // Right column
+  //    Work with data left over from leftcol calculation
+  //
+  hoff = hscrollbar->value() + tiw;
+  for ( ; col < _cols; col++ ) {
+    x += col_width(col);
+    if ( x >= hoff ) { break; }
+  }
+  rightcol = ( col >= _cols ) ? (col - 1) : col; 
+  // First tell children to scroll
+  draw_cell(CONTEXT_RC_RESIZE, 0,0,0,0,0,0);
+}
+
+// Table resized: recalc internal data
+//    Call this whenever the window is resized.
+//    Recalculates the scrollbar sizes.
+//    Makes no assumptions about any pre-initialized data.
+//
+void fltk3::Table::table_resized() {
+  table_h = row_scroll_position(rows());
+  table_w = col_scroll_position(cols()); 
+  recalc_dimensions(); 
+  // Recalc scrollbar sizes
+  //    Clamp scrollbar value() after a resize.
+  //    Resize scrollbars to enforce a constant trough width after a window resize.
+  //
+  {
+    // Vertical scrollbar
+    float vscrolltab = ( table_h == 0 || tih > table_h ) ? 1 : (float)tih / table_h;
+    float hscrolltab = ( table_w == 0 || tiw > table_w ) ? 1 : (float)tiw / table_w;
+    vscrollbar->bounds(0, table_h-tih);
+    vscrollbar->precision(10);
+    vscrollbar->slider_size(vscrolltab);
+    vscrollbar->resize(wix+wiw-SCROLLBAR_SIZE, wiy,
+                       SCROLLBAR_SIZE, 
+                       wih - ((hscrollbar->visible())?SCROLLBAR_SIZE:0));
+    vscrollbar->Valuator::value(vscrollbar->clamp(vscrollbar->value()));	
+    // Horizontal scrollbar
+    hscrollbar->bounds(0, table_w-tiw);
+    hscrollbar->precision(10);
+    hscrollbar->slider_size(hscrolltab);
+    hscrollbar->resize(wix, wiy+wih-SCROLLBAR_SIZE,
+                       wiw - ((vscrollbar->visible())?SCROLLBAR_SIZE:0), 
+                       SCROLLBAR_SIZE);
+    hscrollbar->Valuator::value(hscrollbar->clamp(hscrollbar->value()));
+  }
+  
+  // Tell FLTK child widgets were resized
+  Group::init_sizes();
+  
+  // Recalc top/bot/left/right
+  table_scrolled();
+  
+  // DO *NOT* REDRAW -- LEAVE THIS UP TO THE CALLER
+  // redraw();
+}
+
+// Someone moved a scrollbar
+void fltk3::Table::scroll_cb(fltk3::Widget*w, void *data) {
+  fltk3::Table *o = (fltk3::Table*)data;
+  o->recalc_dimensions();	// recalc tix, tiy, etc.
+  o->table_scrolled();
+  o->redraw();
+}
+
+// Set number of rows
+void fltk3::Table::rows(int val) {
+  int oldrows = _rows;
+  _rows = val;
+  {
+    int default_h = ( _rowheights.size() > 0 ) ? _rowheights.back() : 25;
+    int now_size = _rowheights.size();
+    _rowheights.size(val);			// enlarge or shrink as needed
+    while ( now_size < val ) {
+      _rowheights[now_size++] = default_h;	// fill new
+    }
+  }
+  table_resized();
+  
+  // OPTIMIZATION: redraw only if change is visible.
+  if ( val >= oldrows && oldrows > botrow ) {
+    // NO REDRAW
+  } else {
+    redraw();
+  }
+}
+
+// Set number of cols
+void fltk3::Table::cols(int val) {
+  _cols = val;
+  {
+    int default_w = ( _colwidths.size() > 0 ) ? _colwidths[_colwidths.size()-1] : 80;
+    int now_size = _colwidths.size();
+    _colwidths.size(val);			// enlarge or shrink as needed
+    while ( now_size < val ) {
+      _colwidths[now_size++] = default_w;	// fill new
+    }
+  }
+  table_resized();
+  redraw();
+}
+
+// Change mouse cursor to different type
+void fltk3::Table::change_cursor(fltk3::Cursor newcursor) {
+  if ( newcursor != _last_cursor ) {
+    fltk3::cursor(newcursor, fltk3::BLACK, fltk3::WHITE);
+    _last_cursor = newcursor;
+  }
+}
+
+void fltk3::Table::damage_zone(int r1, int c1, int r2, int c2, int r3, int c3) {
+  int R1 = r1, C1 = c1;
+  int R2 = r2, C2 = c2;
+  if (r1 > R2) R2 = r1;
+  if (r2 < R1) R1 = r2;
+  if (r3 > R2) R2 = r3;
+  if (r3 < R1) R1 = r3;
+  if (c1 > C2) C2 = c1;
+  if (c2 < C1) C1 = c2;
+  if (c3 > C2) C2 = c3;
+  if (c3 < C1) C1 = c3;
+  if (R1 < 0) {
+    if (R2 < 0) return;
+    R1 = 0;
+  }
+  if (C1 < 0) {
+    if (C2 < 0) return;
+    C1 = 0;
+  }
+  if (R1 < toprow) R1 = toprow;
+  if (R2 > botrow) R2 = botrow;
+  if (C1 < leftcol) C1 = leftcol;
+  if (C2 > rightcol) C2 = rightcol;
+  redraw_range(R1, R2, C1, C2);
+}
+
+int fltk3::Table::move_cursor(int R, int C) {
+  if (select_row == -1) R++;
+  if (select_col == -1) C++;
+  R += select_row;
+  C += select_col;
+  if (R < 0) R = 0;
+  if (R >= rows()) R = rows() - 1;
+  if (C < 0) C = 0;
+  if (C >= cols()) C = cols() - 1;
+  if (R == select_row && C == select_col) return 0;
+  damage_zone(current_row, current_col, select_row, select_col, R, C);
+  select_row = R;
+  select_col = C;
+  if (!fltk3::event_state(fltk3::SHIFT)) {
+    current_row = R;
+    current_col = C;
+  }
+  if (R < toprow + 1 || R > botrow - 1) row_position(R);
+  if (C < leftcol + 1 || C > rightcol - 1) col_position(C);
+  return 1;
+}
+
+// #define DEBUG 1
+#ifdef DEBUG
+#include "eventnames.h"
+#define PRINTEVENT \
+fprintf(stderr,"Table %s: ** Event: %s --\n", (label()?label():"none"), eventnames[event]);
+#else
+#define PRINTEVENT
+#endif
+
+// Handle FLTK events
+int fltk3::Table::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  PRINTEVENT;
+  int ret = Group::handle(event);	// let FLTK group handle events first
+  if (ret) {
+    if (fltk3::event_inside(hscrollbar) || fltk3::event_inside(vscrollbar)) return 1;
+    if (fltk3::focus() != this && contains(fltk3::focus())) return 1;
+  }
+  // Which row/column are we over?
+  int R, C;  				// row/column being worked on
+  ResizeFlag resizeflag;		// which resizing area are we over? (0=none)
+  TableContext context = cursor2rowcol(R, C, resizeflag);
+  switch ( event ) {
+    case fltk3::PUSH:
+      if (fltk3::event_button() == 1 && !fltk3::event_clicks()) {
+        if (fltk3::focus() != this) {
+          take_focus();
+          do_callback(CONTEXT_TABLE, -1, -1);
+          ret = 1;
+        }
+        damage_zone(current_row, current_col, select_row, select_col, R, C);
+        if (context == CONTEXT_CELL) {
+          current_row = select_row = R;
+          current_col = select_col = C;
+          _selecting = CONTEXT_CELL;
+        } else {
+          current_row = select_row = -1;
+          current_col = select_col = -1;
+        }
+      }
+      // Need this for eg. right click to pop up a menu
+      if ( Widget::callback() &&		// callback defined?
+          resizeflag == RESIZE_NONE ) {	// not resizing?
+        do_callback(context, R, C);		// do callback
+      }
+      switch ( context ) {
+        case CONTEXT_CELL:
+          // fltk3::PUSH on a cell?
+          ret = 1; 			// express interest in fltk3::RELEASE
+          break;
+          
+        case CONTEXT_NONE:
+          // fltk3::PUSH on table corner?
+          if ( fltk3::event_button() == 1 && 
+              fltk3::event_x() < x() + row_header_width()) {
+            current_col = 0;
+            select_col = cols() - 1;
+            current_row = 0;
+            select_row = rows() - 1;				
+            damage_zone(current_row, current_col, select_row, select_col);
+            ret = 1;
+          }
+          break;
+          
+        case CONTEXT_COL_HEADER:
+          // fltk3::PUSH on a column header?
+          if ( fltk3::event_button() == 1) {
+            // Resizing? Handle it
+            if ( resizeflag ) {
+              // Start resize if left click on column border.
+              //    "ret=1" ensures we get drag events from now on.
+              //    (C-1) is used if mouse is over the left hand side 
+              //    of cell, so we resize the next column on the left.
+              //
+              _resizing_col = ( resizeflag & RESIZE_COL_LEFT ) ? C-1 : C; 
+              _resizing_row = -1;
+              _dragging_x = fltk3::event_x(); 
+              ret = 1;
+            } else {
+              // Not resizing? Select the column
+              current_col = select_col = C;
+              current_row = 0;
+              select_row = rows() - 1;
+              _selecting = CONTEXT_COL_HEADER;
+              damage_zone(current_row, current_col, select_row, select_col);
+              ret = 1;
+            }
+          }
+          break;
+          
+        case CONTEXT_ROW_HEADER:
+          // fltk3::PUSH on a row header?
+          if ( fltk3::event_button() == 1 ) {
+            // Resizing? Handle it
+            if ( resizeflag ) {
+              // Start resize if left mouse clicked on row border.
+              //    "ret = 1" ensures we get drag events from now on.
+              //    (R-1) is used if mouse is over the top of the cell,
+              //    so that we resize the row above.
+              //
+              _resizing_row = ( resizeflag & RESIZE_ROW_ABOVE ) ? R-1 : R; 
+              _resizing_col = -1;
+              _dragging_y = fltk3::event_y(); 
+              ret = 1;
+            } else {
+              // Not resizing? Select the row
+              current_row = select_row = R;
+              current_col = 0;
+              select_col = cols() - 1;
+              _selecting = CONTEXT_ROW_HEADER;
+              damage_zone(current_row, current_col, select_row, select_col);
+              ret = 1;
+            }
+          }
+          break;
+          
+        default:
+          ret = 0;		// express disinterest
+          break;
+      }
+      _last_row = R;
+      break;
+      
+    case fltk3::DRAG:
+      if (_auto_drag == 1) {
+        ret = 1;
+        break;
+      } 
+      if ( _resizing_col > -1 ) {
+        // Dragging column?
+        //
+        //    Let user drag even /outside/ the row/col widget.
+        //    Don't allow column width smaller than 1.
+        //    Continue to show fltk3::CURSOR_WE at all times during drag.
+        //
+        int offset = _dragging_x - fltk3::event_x();
+        int new_w = col_width(_resizing_col) - offset;
+        if ( new_w < _col_resize_min ) new_w = _col_resize_min;
+        col_width(_resizing_col, new_w);
+        _dragging_x = fltk3::event_x();
+        table_resized();
+        redraw();
+        change_cursor(fltk3::CURSOR_WE);
+        ret = 1;
+        if ( Widget::callback() && when() & fltk3::WHEN_CHANGED ) {
+          do_callback(CONTEXT_RC_RESIZE, R, C);
+        }
+      }
+      else if ( _resizing_row > -1 ) {
+        // Dragging row?
+        //
+        //    Let user drag even /outside/ the row/col widget.
+        //    Don't allow row width smaller than 1.
+        //    Continue to show fltk3::CURSOR_NS at all times during drag.
+        //
+        int offset = _dragging_y - fltk3::event_y();
+        int new_h = row_height(_resizing_row) - offset;
+        if ( new_h < _row_resize_min ) new_h = _row_resize_min;
+        row_height(_resizing_row, new_h);
+        _dragging_y = fltk3::event_y();
+        table_resized();
+        redraw();
+        change_cursor(fltk3::CURSOR_NS);
+        ret = 1;
+        if ( Widget::callback() && when() & fltk3::WHEN_CHANGED ) {
+          do_callback(CONTEXT_RC_RESIZE, R, C);
+        }
+      } else {
+        if (fltk3::event_button() == 1 && 
+            _selecting == CONTEXT_CELL &&
+            context == CONTEXT_CELL) {
+          if (select_row != R || select_col != C) {
+            damage_zone(current_row, current_col, select_row, select_col, R, C);
+          }
+          select_row = R;
+          select_col = C;
+          ret = 1;
+        }
+        else if (fltk3::event_button() == 1 && 
+                 _selecting == CONTEXT_ROW_HEADER && 
+                 context & (CONTEXT_ROW_HEADER|CONTEXT_COL_HEADER|CONTEXT_CELL)) {
+          if (select_row != R) {
+            damage_zone(current_row, current_col, select_row, select_col, R, C);
+          }
+          select_row = R;
+          ret = 1;
+        }
+        else if (fltk3::event_button() == 1 && 
+                 _selecting == CONTEXT_COL_HEADER 
+                 && context & (CONTEXT_ROW_HEADER|CONTEXT_COL_HEADER|CONTEXT_CELL)) {
+          if (select_col != C) {
+            damage_zone(current_row, current_col, select_row, select_col, R, C);
+          }
+          select_col = C;
+          ret = 1;
+        }
+      }
+      // Enable autodrag if not resizing, and mouse has moved off table edge
+      if ( _resizing_row < 0 && _resizing_col < 0 && _auto_drag == 0 && 
+          ( fltk3::event_x() > x() + w() - 20 ||
+           fltk3::event_x() < x() + row_header_width() || 
+           fltk3::event_y() > y() + h() - 20 ||
+           fltk3::event_y() < y() + col_header_height()
+           ) ) {
+            _start_auto_drag();
+          }
+      break;
+      
+    case fltk3::RELEASE:
+      _stop_auto_drag();
+      switch ( context ) {
+        case CONTEXT_ROW_HEADER:		// release on row header
+        case CONTEXT_COL_HEADER:		// release on col header
+        case CONTEXT_CELL:			// release on a cell
+        case CONTEXT_TABLE:			// release on dead zone
+          if ( _resizing_col == -1 &&		// not resizing a column
+              _resizing_row == -1 &&		// not resizing a row
+              Widget::callback() && 	// callback defined
+              when() & fltk3::WHEN_RELEASE && 	// on button release
+              _last_row == R ) {		// release on same row PUSHed?
+            // Need this for eg. left clicking on a cell to select it
+            do_callback(context, R, C);
+          }
+          break;
+          
+        default:
+          break;
+      }
+      if ( fltk3::event_button() == 1 ) {
+        change_cursor(fltk3::CURSOR_DEFAULT);
+        _resizing_col = -1;
+        _resizing_row = -1;
+        ret = 1;
+      }
+      break;
+      
+    case fltk3::MOVE:
+      if ( context == CONTEXT_COL_HEADER && 		// in column header?
+          resizeflag ) {				// resize + near boundary?
+        change_cursor(fltk3::CURSOR_WE);			// show resize cursor
+      }
+      else if ( context == CONTEXT_ROW_HEADER && 	// in row header?
+               resizeflag ) {				// resize + near boundary?
+        change_cursor(fltk3::CURSOR_NS);			// show resize cursor
+      } else {
+        change_cursor(fltk3::CURSOR_DEFAULT);		// normal cursor
+      }
+      ret = 1;
+      break;
+      
+    case fltk3::ENTER:		// See FLTK event docs on the fltk3::ENTER widget
+      if (!ret) take_focus();
+      ret = 1;
+      //FALLTHROUGH
+      
+    case fltk3::LEAVE:		// We want to track the mouse if resizing is allowed.
+      if ( resizeflag ) {
+        ret = 1;
+      }
+      if ( event == fltk3::LEAVE ) {
+        _stop_auto_drag();
+        change_cursor(fltk3::CURSOR_DEFAULT);
+      }
+      break;
+      
+    case fltk3::FOCUS:
+      fltk3::focus(this);
+      //FALLTHROUGH
+      
+    case fltk3::UNFOCUS:
+      _stop_auto_drag();
+      ret = 1;
+      break;
+      
+    case fltk3::KEYBOARD: {
+      ret = 0;
+      int is_row = select_row;
+      int is_col = select_col;
+      switch(fltk3::event_key()) {
+        case fltk3::HomeKey:
+          ret = move_cursor(0, -1000000);
+          break;
+        case fltk3::EndKey:
+          ret = move_cursor(0, 1000000);
+          break;
+        case fltk3::PageUpKey:
+          ret = move_cursor(-(botrow - toprow - 1), 0);
+          break;
+        case fltk3::PageDownKey:
+          ret = move_cursor(botrow - toprow - 1 , 0);
+          break;
+        case fltk3::LeftKey:
+          ret = move_cursor(0, -1);
+          break;
+        case fltk3::RightKey:
+          ret = move_cursor(0, 1);
+          break;
+        case fltk3::UpKey:
+          ret = move_cursor(-1, 0);
+          break;
+        case fltk3::DownKey:
+          ret = move_cursor(1, 0);
+          break;
+	case fltk3::TabKey:
+	  if ( fltk3::event_state() & fltk3::SHIFT ) {
+            ret = move_cursor(0, -1);		// shift-tab -> left
+	  } else {
+	    ret = move_cursor(0, 1);		// tab -> right
+	  }
+          break;
+      }
+      if (ret && fltk3::focus() != this) {
+        do_callback(CONTEXT_TABLE, -1, -1);
+        take_focus();
+      }
+      //if (!ret && fltk3::Widget::callback() && when() & fltk3::WHEN_NOT_CHANGED  )
+      if ( Widget::callback() && 
+          (
+           ( !ret && when() & fltk3::WHEN_NOT_CHANGED ) || 
+           ( is_row!= select_row || is_col!= select_col ) 
+           )
+          ) {
+        do_callback(CONTEXT_CELL, select_row, select_col); 
+        //damage_zone(current_row, current_col, select_row, select_col);
+        ret = 1;
+      }
+      break;
+    }
+      
+    default:
+      change_cursor(fltk3::CURSOR_DEFAULT);
+      break;
+  }
+  return(ret);
+}
+
+// Resize FLTK override
+//     Handle resize events if user resizes parent window.
+//
+void fltk3::Table::resize(int X, int Y, int W, int H) {
+  // Tell group to resize, and recalc our own widget as well
+  Group::resize(X, Y, W, H);
+  table_resized();
+  redraw();
+}
+
+// Draw a cell
+void fltk3::Table::_redraw_cell(TableContext context, int r, int c) {
+  if ( r < 0 || c < 0 ) return;
+  int X,Y,W,H;
+  find_cell(context, r, c, X, Y, W, H);	// find positions of cell
+  draw_cell(context, r, c, X, Y, W, H);	// call users' function to draw it
+}
+
+/**
+ See if the cell at row \p r and column \p c is selected.
+ \returns 1 if the cell is selected, 0 if not.
+ */
+int fltk3::Table::is_selected(int r, int c) {
+  int s_left, s_right, s_top, s_bottom;
+  
+  if (select_col > current_col) {
+    s_left = current_col;
+    s_right = select_col;
+  } else {
+    s_right = current_col;
+    s_left = select_col;
+  }
+  if (select_row > current_row) {
+    s_top = current_row;
+    s_bottom = select_row;
+  } else {
+    s_bottom = current_row;
+    s_top = select_row;
+  }
+  if (r >= s_top && r <= s_bottom && c >= s_left && c <= s_right) {
+    return 1;
+  }
+  return 0;
+}
+
+/**
+  Gets the region of cells selected (highlighted).
+
+  \param[in] row_top   Returns the top row of selection area
+  \param[in] col_left  Returns the left column of selection area
+  \param[in] row_bot   Returns the bottom row of selection area
+  \param[in] col_right Returns the right column of selection area
+*/
+void fltk3::Table::get_selection(int& row_top, int& col_left, int& row_bot, int& col_right) {
+  if (select_col > current_col) {
+    col_left  = current_col;
+    col_right = select_col;
+  } else {
+    col_right = current_col;
+    col_left  = select_col;
+  }
+  if (select_row > current_row) {
+    row_top = current_row;
+    row_bot = select_row;
+  } else {
+    row_bot = current_row;
+    row_top = select_row;
+  }
+}
+
+/**
+  Sets the region of cells to be selected (highlighted).
+
+  So for instance, set_selection(0,0,0,0) selects the top/left cell in the table.
+  And set_selection(0,0,1,1) selects the four cells in rows 0 and 1, column 0 and 1.
+
+  \param[in] row_top   Top row of selection area
+  \param[in] col_left  Left column of selection area
+  \param[in] row_bot   Bottom row of selection area
+  \param[in] col_right Right column of selection area
+*/
+void fltk3::Table::set_selection(int row_top, int col_left, int row_bot, int col_right) {
+  damage_zone(current_row, current_col, select_row, select_col);
+  current_col = col_left;
+  current_row = row_top;
+  select_col  = col_right;
+  select_row  = row_bot;
+  damage_zone(current_row, current_col, select_row, select_col);
+}
+
+// Draw the entire fltk3::Table
+//    Override the draw() routine to draw the table.
+//    Then tell the group to draw over us.
+//
+void fltk3::Table::draw() {   
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  // Check if scrollbar size changed
+  if ( ( vscrollbar && (SCROLLBAR_SIZE != vscrollbar->w()) ) || 
+       ( hscrollbar && (SCROLLBAR_SIZE != hscrollbar->h()) ) ) {
+    // handle size change, min/max, table dim's, etc
+  table_resized();
+  }
+  
+  draw_cell(CONTEXT_STARTPAGE, 0, 0,	 	// let user's drawing routine
+            tix, tiy, tiw, tih);		// prep new page
+  
+  // Let fltk widgets draw themselves first. Do this after
+  // draw_cell(CONTEXT_STARTPAGE) in case user moves widgets around.
+  // Use window 'inner' clip to prevent drawing into table border.
+  // (unfortunately this clips FLTK's border, so we must draw it explicity below)
+  //
+  fltk3::push_clip(wix, wiy, wiw, wih);
+  {
+    Group::draw();
+  }
+  fltk3::pop_clip();
+  
+  // Explicitly draw border around widget, if any
+  draw_box(box(), x(), y(), w(), h(), color());
+  
+  // If fltk3::ScrollGroup 'table' is hidden, draw its box
+  //    Do this after fltk3::Group::draw() so we draw over scrollbars
+  //    that leak around the border.
+  //
+  if ( ! table->visible() ) {
+    if ( damage() & fltk3::DAMAGE_ALL || damage() & fltk3::DAMAGE_CHILD ) {
+      draw_box(table->box(), tox, toy, tow, toh, table->color());
+    }
+  } 
+  // Clip all further drawing to the inner widget dimensions
+  fltk3::push_clip(wix, wiy, wiw, wih);
+  {
+    // Only redraw a few cells?
+    if ( ! ( damage() & fltk3::DAMAGE_ALL ) && _redraw_leftcol != -1 ) {
+      fltk3::push_clip(tix, tiy, tiw, tih);
+      for ( int c = _redraw_leftcol; c <= _redraw_rightcol; c++ ) {
+        for ( int r = _redraw_toprow; r <= _redraw_botrow; r++ ) { 
+          _redraw_cell(CONTEXT_CELL, r, c);
+        }
+      }
+      fltk3::pop_clip();
+    }
+    if ( damage() & fltk3::DAMAGE_ALL ) {
+      int X,Y,W,H;
+      // Draw row headers, if any
+      if ( row_header() ) {
+        get_bounds(CONTEXT_ROW_HEADER, X, Y, W, H);
+        fltk3::push_clip(X,Y,W,H);
+        for ( int r = toprow; r <= botrow; r++ ) {
+          _redraw_cell(CONTEXT_ROW_HEADER, r, 0);
+        }
+        fltk3::pop_clip();
+      }
+      // Draw column headers, if any
+      if ( col_header() ) {
+        get_bounds(CONTEXT_COL_HEADER, X, Y, W, H);
+        fltk3::push_clip(X,Y,W,H);
+        for ( int c = leftcol; c <= rightcol; c++ ) {
+          _redraw_cell(CONTEXT_COL_HEADER, 0, c);
+        }
+        fltk3::pop_clip();
+      } 
+      // Draw all cells.
+      //    This includes cells partially obscured off edges of table.
+      //    No longer do this last; you might think it would be nice
+      //    to draw over dead zones, but on redraws it flickers. Avoid
+      //    drawing over deadzones; prevent deadzones by sizing columns.
+      //
+      fltk3::push_clip(tix, tiy, tiw, tih); {
+        for ( int r = toprow; r <= botrow; r++ ) {
+          for ( int c = leftcol; c <= rightcol; c++ ) {
+            _redraw_cell(CONTEXT_CELL, r, c); 
+          }
+        }
+      }
+      fltk3::pop_clip(); 
+      // Draw little rectangle in corner of headers
+      if ( row_header() && col_header() ) {
+        fltk3::rectf(wix, wiy, row_header_width(), col_header_height(), color());
+      }
+      
+      // Table has a boxtype? Close those few dead pixels
+      if ( table->box() ) {
+        if ( col_header() ) {
+          fltk3::rectf(tox, wiy, fltk3::box_dx(table->box()), col_header_height(), color());
+        }
+        if ( row_header() ) {
+          fltk3::rectf(wix, toy, row_header_width(), fltk3::box_dx(table->box()), color());
+        }
+      }
+      
+      // Table width smaller than window? Fill remainder with rectangle
+      if ( table_w < tiw ) {
+        fltk3::rectf(tix + table_w, tiy, tiw - table_w, tih, color()); 
+        // Col header? fill that too
+        if ( col_header() ) {
+          fltk3::rectf(tix + table_w, 
+                   wiy, 
+                   // get that corner just right..
+                   (tiw - table_w + fltk3::box_dw(table->box()) - 
+                    fltk3::box_dx(table->box())),
+                   col_header_height(),
+                   color());
+        }
+      } 
+      // Table height smaller than window? Fill remainder with rectangle
+      if ( table_h < tih ) {
+        fltk3::rectf(tix, tiy + table_h, tiw, tih - table_h, color()); 
+        if ( row_header() ) {
+          // NOTE:
+          //     Careful with that lower corner; don't use tih; when eg. 
+          //     table->box(fltk3::THIN_UPFRAME) and hscrollbar hidden, 
+          //     leaves a row of dead pixels.
+          //
+          fltk3::rectf(wix, tiy + table_h, row_header_width(), 
+                   (wiy+wih) - (tiy+table_h) - 
+                   ( hscrollbar->visible() ? SCROLLBAR_SIZE : 0),
+                   color());
+        }
+      }
+    } 
+    // Both scrollbars? Draw little box in lower right
+    if ( vscrollbar->visible() && hscrollbar->visible() ) {
+      fltk3::rectf(vscrollbar->x(), hscrollbar->y(), 
+               vscrollbar->w(), hscrollbar->h(), color());
+    } 
+    draw_cell(CONTEXT_ENDPAGE, 0, 0,		// let user's drawing
+              tix, tiy, tiw, tih);		// routines cleanup
+    
+    _redraw_leftcol = _redraw_rightcol = _redraw_toprow = _redraw_botrow = -1;
+  }
+  fltk3::pop_clip();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TableRow.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Table_Row.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TableRow.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TableRow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,317 @@
+//
+// "$Id$"
+//
+// fltk3::TableRow -- A row oriented table widget
+//
+//    A class specializing in a table of rows.
+//    Handles row-specific selection behavior.
+//
+// Copyright 2002 by Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to "erco at seriss dot com".
+//
+//
+// TODO:
+//    o Row headings (only column headings supported currently)
+//
+
+#include <stdio.h>		// for debugging
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/TableRow.h>
+
+// Is row selected?
+int fltk3::TableRow::row_selected(int row) {
+  if ( row < 0 || row >= rows() ) return(-1);
+  return(_rowselect[row]);
+}
+
+// Change row selection type
+void fltk3::TableRow::type(TableRowSelectMode val) {
+  _selectmode = val;
+  switch ( _selectmode ) {
+    case SELECT_NONE: {
+      for ( int row=0; row<rows(); row++ ) {
+        _rowselect[row] = 0;
+      }
+      redraw();
+      break;
+    }
+    case SELECT_SINGLE: {
+      int count = 0;
+      for ( int row=0; row<rows(); row++ ) {
+        if ( _rowselect[row] ) {
+          if ( ++count > 1 ) {	// only one allowed
+            _rowselect[row] = 0;
+          }
+        }
+      }
+      redraw();
+      break;
+    }
+    case SELECT_MULTI:
+      break;
+  }
+}
+
+// Change selection state for row
+//
+//     flag:
+//        0 - clear selection
+//        1 - set selection
+//        2 - toggle selection
+//
+//     Returns:
+//        0 - selection state did not change
+//        1 - selection state changed
+//       -1 - row out of range or incorrect selection mode
+//
+int fltk3::TableRow::select_row(int row, int flag) {
+  int ret = 0;
+  if ( row < 0 || row >= rows() ) { return(-1); }
+  switch ( _selectmode ) {
+    case SELECT_NONE:
+      return(-1);
+      
+    case SELECT_SINGLE: {
+      int oldval;
+      for ( int t=0; t<rows(); t++ ) {
+        if ( t == row ) {
+          oldval = _rowselect[row];
+          if ( flag == 2 ) { _rowselect[row] ^= 1; }
+          else             { _rowselect[row] = flag; }
+          if ( oldval != _rowselect[row] ) {
+            redraw_range(row, row, leftcol, rightcol);
+            ret = 1;
+          }
+        }
+        else if ( _rowselect[t] ) {
+          _rowselect[t] = 0;
+          redraw_range(t, t, leftcol, rightcol);
+        }
+      }
+      break;
+    }
+      
+    case SELECT_MULTI: {
+      int oldval = _rowselect[row];
+      if ( flag == 2 ) { _rowselect[row] ^= 1; }
+      else             { _rowselect[row] = flag; }
+      if ( _rowselect[row] != oldval ) {		// select state changed?
+        if ( row >= toprow && row <= botrow ) {		// row visible?
+          // Extend partial redraw range
+          redraw_range(row, row, leftcol, rightcol);
+        }
+        ret = 1;
+      }
+    }
+  }
+  return(ret);
+}
+
+// Select all rows to a known state
+void fltk3::TableRow::select_all_rows(int flag) {
+  switch ( _selectmode ) {
+    case SELECT_NONE:
+      return;
+      
+    case SELECT_SINGLE:
+      if ( flag != 0 ) return;
+      //FALLTHROUGH
+      
+    case SELECT_MULTI: {
+      char changed = 0;
+      if ( flag == 2 ) {
+        for ( int row=0; row<(int)_rowselect.size(); row++ ) {
+          _rowselect[row] ^= 1;
+        }
+        changed = 1;
+      } else {
+        for ( int row=0; row<(int)_rowselect.size(); row++ ) {
+          changed |= (_rowselect[row] != flag)?1:0;
+          _rowselect[row] = flag; 
+        }
+      }
+      if ( changed ) {
+        redraw();
+      }
+    }
+  }
+}
+
+// Set number of rows
+void fltk3::TableRow::rows(int val) {
+  Table::rows(val);
+  while ( val > (int)_rowselect.size() ) { _rowselect.push_back(0); }	// enlarge
+  while ( val < (int)_rowselect.size() ) { _rowselect.pop_back(); }	// shrink
+}
+
+// #include "eventnames.h"		// debugging
+// #include <stdio.h>
+
+// Handle events
+int fltk3::TableRow::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  
+  //  fprintf(stderr, "** EVENT: %s: EVENT XY=%d,%d\n", 
+  //      eventnames[event], fltk3::event_x(), fltk3::event_y());	// debugging
+  
+  // Let base class handle event
+  int ret = Table::handle(event);
+  
+  // The following code disables cell selection.. why was it added? -erco 05/18/03
+  // if ( ret ) { _last_y = fltk3::event_y(); return(1); }	// base class 'handled' it (eg. column resize)
+  
+  int shiftstate = (fltk3::event_state() & fltk3::CTRL) ? fltk3::CTRL :
+  (fltk3::event_state() & fltk3::SHIFT) ? fltk3::SHIFT : 0;
+  
+  // Which row/column are we over?
+  int R, C;  				// row/column being worked on
+  ResizeFlag resizeflag;		// which resizing area are we over? (0=none)
+  TableContext context = cursor2rowcol(R, C, resizeflag);
+  switch ( event ) {
+    case fltk3::PUSH:
+      if ( fltk3::event_button() == 1 ) {
+        _last_push_x = fltk3::event_x();	// save regardless of context
+        _last_push_y = fltk3::event_y();	// " "
+        
+        // Handle selection in table.
+        //     Select cell under cursor, and enable drag selection mode.
+        //
+        if ( context == CONTEXT_CELL ) {
+          // Ctrl key? Toggle selection state
+          switch ( shiftstate ) {
+            case fltk3::CTRL:
+              select_row(R, 2);		// toggle
+              break;
+              
+            case fltk3::SHIFT: {
+              select_row(R, 1);
+              if ( _last_row > -1 ) {
+                int srow = R, erow = _last_row;
+                if ( srow > erow ) {
+                  srow = _last_row;
+                  erow = R;
+                }
+                for ( int row = srow; row <= erow; row++ ) {
+                  select_row(row, 1);
+                }
+              }
+              break;
+            }
+              
+            default:
+              select_all_rows(0);	// clear all previous selections
+              select_row(R, 1);
+              break;
+          }
+          
+          _last_row = R;
+          _dragging_select = 1;
+          ret = 1;      // fltk3::PUSH handled (ensures fltk3::DRAG will be sent)
+          // redraw();  // redraw() handled by select_row()
+        }
+      } 
+      break;
+      
+    case fltk3::DRAG: {
+      if ( _dragging_select ) {
+        // Dragged off table edges? Handle scrolling
+        int offtop = toy - _last_y;			// >0 if off top of table
+        int offbot = _last_y - (toy + toh);		// >0 if off bottom of table
+        
+        if ( offtop > 0 && row_position() > 0 ) {
+          // Only scroll in upward direction
+          int diff = _last_y - fltk3::event_y();
+          if ( diff < 1 ) {
+            ret = 1;
+            break;
+          }
+          row_position(row_position() - diff);
+          context = CONTEXT_CELL; C = 0; R = row_position();  // HACK: fake it
+          if ( R < 0 || R > rows() ) { ret = 1; break; }      // HACK: ugly
+        }
+        else if ( offbot > 0 && botrow < rows() ) {
+          // Only scroll in downward direction
+          int diff = fltk3::event_y() - _last_y;
+          if ( diff < 1 ) {
+            ret = 1;
+            break;
+          }
+          row_position(row_position() + diff);
+          context = CONTEXT_CELL; C = 0; R = botrow;		// HACK: fake it
+          if ( R < 0 || R > rows() ) { ret = 1; break; }	// HACK: ugly
+        }
+        if ( context == CONTEXT_CELL ) {
+          switch ( shiftstate ) {
+            case fltk3::CTRL:
+              if ( R != _last_row ) {		// toggle if dragged to new row
+                select_row(R, 2);		// 2=toggle
+              }
+              break;
+              
+            case fltk3::SHIFT:
+            default:
+              select_row(R, 1);
+              if ( _last_row > -1 ) {
+                int srow = R, erow = _last_row;
+                if ( srow > erow ) {
+                  srow = _last_row;
+                  erow = R;
+                }
+                for ( int row = srow; row <= erow; row++ ) {
+                  select_row(row, 1);
+                }
+              }
+              break;
+          }
+          ret = 1;				// drag handled
+          _last_row = R;
+        }
+      }
+      break;
+    }
+      
+    case fltk3::RELEASE:
+      if ( fltk3::event_button() == 1 ) {
+        _dragging_select = 0;
+        ret = 1;			// release handled
+        // Clicked off edges of data table? 
+        //    A way for user to clear the current selection.
+        //
+        int databot = tiy + table_h,
+        dataright = tix + table_w;
+        if ( 
+            ( _last_push_x > dataright && fltk3::event_x() > dataright ) ||
+            ( _last_push_y > databot && fltk3::event_y() > databot )
+            ) {
+          select_all_rows(0);			// clear previous selections
+        }
+      }
+      break;
+      
+    default:
+      break;
+  }
+  _last_y = fltk3::event_y();
+  return(ret);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TextBuffer.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Text_Buffer.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TextBuffer.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TextBuffer.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1794 @@
+//
+// "$Id$"
+//
+// Copyright 2001-2010 by Bill Spitzak and others.
+// Original code Copyright Mark Edel.  Permission to distribute under
+// the LGPL for the FLTK library granted by Mark Edel.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <ctype.h>
+#include <fltk3/run.h>
+#include <fltk3/TextBuffer.h>
+#include <fltk3/ask.h>
+
+
+/*
+ This file is based on a port of NEdit to FLTK many years ago. NEdit at that
+ point was already stretched beyond the task it was designed for which explains
+ why the source code is sometimes pretty convoluted. It still is a very useful
+ widget for FLTK, and we are thankful that the nedit team allowed us to 
+ integrate their code.
+
+ With the introduction of Unicode and UTF-8, Fl_Text_... has to go into a whole
+ new generation of code. Originally designed for monospaced fonts only, many
+ features make less sense in the multibyte and multiwidth world of UTF-8.
+
+ Columns are a good example. There is simply no such thing. The new Fl_Text_...
+ widget converts columns to pixels by multiplying them with the average 
+ character width for a given font.
+
+ Rectangular selections were rarely used (if at all) and make little sense when
+ using variable width fonts. They have been removed.
+
+ Using multiple spaces to emulate tab stops has been replaced by pixel counting
+ routines. They are slower, but give the expected result for proportional fonts.
+
+ And constantly recalculating character widths is just much too expensive. Lines
+ of text are now subdivided into blocks of text which are measured at once 
+ instead of individual characters. 
+ */
+
+
+#ifndef min
+
+static int max(int i1, int i2)
+{
+  return i1 >= i2 ? i1 : i2;
+}
+
+static int min(int i1, int i2)
+{
+  return i1 <= i2 ? i1 : i2;
+}
+
+#endif
+
+
+static char *undobuffer;
+static int undobufferlength;
+static fltk3::TextBuffer *undowidget;
+static int undoat;		// points after insertion
+static int undocut;		// number of characters deleted there
+static int undoinsert;		// number of characters inserted
+static int undoyankcut;		// length of valid contents of buffer, even if undocut=0
+
+/*
+ Resize the undo buffer to match at least the requested size.
+ */
+static void undobuffersize(int n)
+{
+  if (n > undobufferlength) {
+    if (undobuffer) {
+      do {
+	undobufferlength *= 2;
+      } while (undobufferlength < n);
+      undobuffer = (char *) realloc(undobuffer, undobufferlength);
+    } else {
+      undobufferlength = n + 9;
+      undobuffer = (char *) malloc(undobufferlength);
+    }
+  }
+}
+
+static void def_transcoding_warning_action(fltk3::TextBuffer *text)
+{
+  fltk3::alert("%s", text->file_encoding_warning_message);
+}
+
+/*
+ Initialize all variables.
+ */
+fltk3::TextBuffer::TextBuffer(int requestedSize, int preferredGapSize)
+{
+  mLength = 0;
+  mPreferredGapSize = preferredGapSize;
+  mBuf = (char *) malloc(requestedSize + mPreferredGapSize);
+  mGapStart = 0;
+  mGapEnd = mPreferredGapSize;
+  mTabDist = 8;
+  mPrimary.mSelected = 0;
+  mPrimary.mStart = mPrimary.mEnd = 0;
+  mSecondary.mSelected = 0;
+  mSecondary.mStart = mSecondary.mEnd = 0;
+  mHighlight.mSelected = 0;
+  mHighlight.mStart = mHighlight.mEnd = 0;
+  mModifyProcs = NULL;
+  mCbArgs = NULL;
+  mNModifyProcs = 0;
+  mNPredeleteProcs = 0;
+  mPredeleteProcs = NULL;
+  mPredeleteCbArgs = NULL;
+  mCursorPosHint = 0;
+  mCanUndo = 1;
+  input_file_was_transcoded = 0;
+  transcoding_warning_action = def_transcoding_warning_action;
+}
+
+
+/*
+ Free all resources.
+ */
+fltk3::TextBuffer::~TextBuffer()
+{
+  free(mBuf);
+  if (mNModifyProcs != 0) {
+    delete[]mModifyProcs;
+    delete[]mCbArgs;
+  }
+  if (mNPredeleteProcs != 0) {
+    delete[]mPredeleteProcs;
+    delete[]mPredeleteCbArgs;
+  }
+}
+
+
+/*
+ This function copies verbose whatever is in front and after the gap into a
+ single buffer.
+ */
+char *fltk3::TextBuffer::text() const {
+  char *t = (char *) malloc(mLength + 1);
+  memcpy(t, mBuf, mGapStart);
+  memcpy(t+mGapStart, mBuf+mGapEnd, mLength - mGapStart);
+  t[mLength] = '\0';
+  return t;
+} 
+
+
+/*
+ Set the text buffer to a new string.
+ */
+void fltk3::TextBuffer::text(const char *t)
+{
+  IS_UTF8_ALIGNED(t)
+  
+  call_predelete_callbacks(0, length());
+  
+  /* Save information for redisplay, and get rid of the old buffer */
+  const char *deletedText = text();
+  int deletedLength = mLength;
+  free((void *) mBuf);
+  
+  /* Start a new buffer with a gap of mPreferredGapSize at the end */
+  int insertedLength = strlen(t);
+  mBuf = (char *) malloc(insertedLength + mPreferredGapSize);
+  mLength = insertedLength;
+  mGapStart = insertedLength;
+  mGapEnd = mGapStart + mPreferredGapSize;
+  memcpy(mBuf, t, insertedLength);
+  
+  /* Zero all of the existing selections */
+  update_selections(0, deletedLength, 0);
+  
+  /* Call the saved display routine(s) to update the screen */
+  call_modify_callbacks(0, deletedLength, insertedLength, 0, deletedText);
+  free((void *) deletedText);
+}
+
+
+/*
+ Creates a range of text to a new buffer and copies verbose from around the gap.
+ */
+char *fltk3::TextBuffer::text_range(int start, int end) const {
+  IS_UTF8_ALIGNED2(this, (start))
+  IS_UTF8_ALIGNED2(this, (end))
+  
+  char *s = NULL;
+  
+  /* Make sure start and end are ok, and allocate memory for returned string.
+   If start is bad, return "", if end is bad, adjust it. */
+  if (start < 0 || start > mLength)
+  {
+    s = (char *) malloc(1);
+    s[0] = '\0';
+    return s;
+  }
+  if (end < start) {
+    int temp = start;
+    start = end;
+    end = temp;
+  }
+  if (end > mLength)
+    end = mLength;
+  int copiedLength = end - start;
+  s = (char *) malloc(copiedLength + 1);
+  
+  /* Copy the text from the buffer to the returned string */
+  if (end <= mGapStart) {
+    memcpy(s, mBuf + start, copiedLength);
+  } else if (start >= mGapStart) {
+    memcpy(s, mBuf + start + (mGapEnd - mGapStart), copiedLength);
+  } else {
+    int part1Length = mGapStart - start;
+    memcpy(s, mBuf + start, part1Length);
+    memcpy(s + part1Length, mBuf + mGapEnd, copiedLength - part1Length);
+  }
+  s[copiedLength] = '\0';
+  return s;
+}
+
+/*
+ Return a UCS-4 character at the given index.
+ Pos must be at a character boundary.
+ */
+unsigned int fltk3::TextBuffer::char_at(int pos) const {  
+  if (pos < 0 || pos >= mLength)
+    return '\0';
+  
+  IS_UTF8_ALIGNED2(this, (pos))
+  
+  const char *src = address(pos);
+  return fltk3::utf8decode(src, 0, 0);
+} 
+
+
+/*
+ Return the raw byte at the given index.
+ This function ignores all unicode encoding.
+ */
+char fltk3::TextBuffer::byte_at(int pos) const {
+  if (pos < 0 || pos >= mLength)
+    return '\0';
+  const char *src = address(pos);
+  return *src;
+} 
+
+
+/*
+ Insert some text at the given index.
+ Pos must be at a character boundary.
+*/
+void fltk3::TextBuffer::insert(int pos, const char *text)
+{
+  IS_UTF8_ALIGNED2(this, (pos))
+  IS_UTF8_ALIGNED(text)
+  
+  /* check if there is actually any text */
+  if (!text || !*text)
+    return;
+  
+  /* if pos is not contiguous to existing text, make it */
+  if (pos > mLength)
+    pos = mLength;
+  if (pos < 0)
+    pos = 0;
+  
+  /* Even if nothing is deleted, we must call these callbacks */
+  call_predelete_callbacks(pos, 0);
+  
+  /* insert and redisplay */
+  int nInserted = insert_(pos, text);
+  mCursorPosHint = pos + nInserted;
+  IS_UTF8_ALIGNED2(this, (mCursorPosHint))
+  call_modify_callbacks(pos, 0, nInserted, 0, NULL);
+}
+
+
+/*
+ Replace a range of text with new text.
+ Start and end must be at a character boundary.
+*/
+void fltk3::TextBuffer::replace(int start, int end, const char *text)
+{
+  // Range check...
+  if (!text)
+    return;
+  if (start < 0)
+    start = 0;
+  if (end > mLength)
+    end = mLength;
+
+  IS_UTF8_ALIGNED2(this, (start))
+  IS_UTF8_ALIGNED2(this, (end))
+  IS_UTF8_ALIGNED(text)
+  
+  call_predelete_callbacks(start, end - start);
+  const char *deletedText = text_range(start, end);
+  remove_(start, end);
+  int nInserted = insert_(start, text);
+  mCursorPosHint = start + nInserted;
+  call_modify_callbacks(start, end - start, nInserted, 0, deletedText);
+  free((void *) deletedText);
+}
+
+
+/*
+ Remove a range of text.
+ Start and End must be at a character boundary.
+*/
+void fltk3::TextBuffer::remove(int start, int end)
+{
+  /* Make sure the arguments make sense */
+  if (start > end) {
+    int temp = start;
+    start = end;
+    end = temp;
+  }
+  if (start > mLength)
+    start = mLength;
+  if (start < 0)
+    start = 0;
+  if (end > mLength)
+    end = mLength;
+  if (end < 0)
+    end = 0;
+
+  IS_UTF8_ALIGNED2(this, (start))
+  IS_UTF8_ALIGNED2(this, (end))  
+  
+  if (start == end)
+    return;
+  
+  call_predelete_callbacks(start, end - start);
+  /* Remove and redisplay */
+  const char *deletedText = text_range(start, end);
+  remove_(start, end);
+  mCursorPosHint = start;
+  call_modify_callbacks(start, end - start, 0, 0, deletedText);
+  free((void *) deletedText);
+}
+
+
+/*
+ Copy a range of text from another text buffer.
+ fromStart, fromEnd, and toPos must be at a character boundary.
+ */
+void fltk3::TextBuffer::copy(fltk3::TextBuffer * fromBuf, int fromStart,
+			  int fromEnd, int toPos)
+{
+  IS_UTF8_ALIGNED2(fromBuf, fromStart)
+  IS_UTF8_ALIGNED2(fromBuf, fromEnd)
+  IS_UTF8_ALIGNED2(this, (toPos))
+  
+  int copiedLength = fromEnd - fromStart;
+  
+  /* Prepare the buffer to receive the new text.  If the new text fits in
+   the current buffer, just move the gap (if necessary) to where
+   the text should be inserted.  If the new text is too large, reallocate
+   the buffer with a gap large enough to accomodate the new text and a
+   gap of mPreferredGapSize */
+  if (copiedLength > mGapEnd - mGapStart)
+    reallocate_with_gap(toPos, copiedLength + mPreferredGapSize);
+  else if (toPos != mGapStart)
+    move_gap(toPos);
+  
+  /* Insert the new text (toPos now corresponds to the start of the gap) */
+  if (fromEnd <= fromBuf->mGapStart) {
+    memcpy(&mBuf[toPos], &fromBuf->mBuf[fromStart], copiedLength);
+  } else if (fromStart >= fromBuf->mGapStart) {
+    memcpy(&mBuf[toPos],
+	   &fromBuf->mBuf[fromStart + (fromBuf->mGapEnd - fromBuf->mGapStart)],
+	   copiedLength);
+  } else {
+    int part1Length = fromBuf->mGapStart - fromStart;
+    memcpy(&mBuf[toPos], &fromBuf->mBuf[fromStart], part1Length);
+    memcpy(&mBuf[toPos + part1Length],
+	   &fromBuf->mBuf[fromBuf->mGapEnd], copiedLength - part1Length);
+  }
+  mGapStart += copiedLength;
+  mLength += copiedLength;
+  update_selections(toPos, 0, copiedLength);
+}
+
+
+/*
+ Take the previous changes and undo them. Return the previous
+ cursor position in cursorPos. Returns 1 if the undo was applied.
+ CursorPos will be at a character boundary.
+ */ 
+int fltk3::TextBuffer::undo(int *cursorPos)
+{
+  if (undowidget != this || (!undocut && !undoinsert && !mCanUndo))
+    return 0;
+  
+  int ilen = undocut;
+  int xlen = undoinsert;
+  int b = undoat - xlen;
+  
+  if (xlen && undoyankcut && !ilen) {
+    ilen = undoyankcut;
+  }
+  
+  if (xlen && ilen) {
+    undobuffersize(ilen + 1);
+    undobuffer[ilen] = 0;
+    char *tmp = strdup(undobuffer);
+    replace(b, undoat, tmp);
+    if (cursorPos)
+      *cursorPos = mCursorPosHint;
+    free(tmp);
+  } else if (xlen) {
+    remove(b, undoat);
+    if (cursorPos)
+      *cursorPos = mCursorPosHint;
+  } else if (ilen) {
+    undobuffersize(ilen + 1);
+    undobuffer[ilen] = 0;
+    insert(undoat, undobuffer);
+    if (cursorPos)
+      *cursorPos = mCursorPosHint;
+    undoyankcut = 0;
+  }
+  
+  return 1;
+}
+
+
+/*
+ Set a flag if undo function will work.
+ */
+void fltk3::TextBuffer::canUndo(char flag)
+{
+  mCanUndo = flag;
+  // disabling undo also clears the last undo operation!
+  if (!mCanUndo && undowidget==this) 
+    undowidget = 0;
+}
+
+
+/*
+ Change the tab width. This will cause a couple of callbacks and a complete 
+ redisplay. 
+ Matt: I am not entirely sure why we need to trigger callbacks because
+ tabs are only a graphical hint, not changing any text at all, but I leave
+ this in here for back compatibility. 
+ */
+void fltk3::TextBuffer::tab_distance(int tabDist)
+{
+  /* First call the pre-delete callbacks with the previous tab setting 
+   still active. */
+  call_predelete_callbacks(0, mLength);
+  
+  /* Change the tab setting */
+  mTabDist = tabDist;
+  
+  /* Force any display routines to redisplay everything (unfortunately,
+   this means copying the whole buffer contents to provide "deletedText" */
+  const char *deletedText = text();
+  call_modify_callbacks(0, mLength, mLength, 0, deletedText);
+  free((void *) deletedText);
+}
+
+
+/*
+ Select a range of text.
+ Start and End must be at a character boundary.
+ */
+void fltk3::TextBuffer::select(int start, int end)
+{
+  IS_UTF8_ALIGNED2(this, (start))
+  IS_UTF8_ALIGNED2(this, (end))  
+  
+  fltk3::TextSelection oldSelection = mPrimary;
+  
+  mPrimary.set(start, end);
+  redisplay_selection(&oldSelection, &mPrimary);
+}
+
+
+/*
+ Clear the primary selection.
+ */
+void fltk3::TextBuffer::unselect()
+{
+  fltk3::TextSelection oldSelection = mPrimary;
+  
+  mPrimary.mSelected = 0;
+  redisplay_selection(&oldSelection, &mPrimary);
+}
+
+  
+/*
+ Return the primary selection range.
+ */
+int fltk3::TextBuffer::selection_position(int *start, int *end)
+{
+  return mPrimary.position(start, end);
+}
+
+
+/*
+ Return a copy of the selected text.
+ */
+char *fltk3::TextBuffer::selection_text()
+{
+  return selection_text_(&mPrimary);
+}
+
+
+/*
+ Remove the selected text.
+ */
+void fltk3::TextBuffer::remove_selection()
+{
+  remove_selection_(&mPrimary);
+}
+
+
+/*
+ Replace the selected text.
+ */
+void fltk3::TextBuffer::replace_selection(const char *text)
+{
+  replace_selection_(&mPrimary, text);
+}
+
+
+/*
+ Select text.
+ Start and End must be at a character boundary.
+ */
+void fltk3::TextBuffer::secondary_select(int start, int end)
+{
+  fltk3::TextSelection oldSelection = mSecondary;
+  
+  mSecondary.set(start, end);
+  redisplay_selection(&oldSelection, &mSecondary);
+}
+
+
+/*
+ Deselect text.
+ */
+void fltk3::TextBuffer::secondary_unselect()
+{
+  fltk3::TextSelection oldSelection = mSecondary;
+  
+  mSecondary.mSelected = 0;
+  redisplay_selection(&oldSelection, &mSecondary);
+}
+
+  
+/*
+ Return the selected range.
+ */
+int fltk3::TextBuffer::secondary_selection_position(int *start, int *end)
+{
+  return mSecondary.position(start, end);
+}
+
+
+/*
+ Return a copy of the text in this selection.
+ */
+char *fltk3::TextBuffer::secondary_selection_text()
+{
+  return selection_text_(&mSecondary);
+}
+
+
+/*
+ Remove the selected text.
+ */
+void fltk3::TextBuffer::remove_secondary_selection()
+{
+  remove_selection_(&mSecondary);
+}
+
+
+/*
+ Replace selected text.
+ */
+void fltk3::TextBuffer::replace_secondary_selection(const char *text)
+{
+  replace_selection_(&mSecondary, text);
+}
+
+
+/*
+ Highlight a range of text.
+ Start and End must be at a character boundary.
+ */
+void fltk3::TextBuffer::highlight(int start, int end)
+{
+  fltk3::TextSelection oldSelection = mHighlight;
+  
+  mHighlight.set(start, end);
+  redisplay_selection(&oldSelection, &mHighlight);
+}
+
+
+/*
+ Remove text highlighting.
+ */
+void fltk3::TextBuffer::unhighlight()
+{
+  fltk3::TextSelection oldSelection = mHighlight;
+  
+  mHighlight.mSelected = 0;
+  redisplay_selection(&oldSelection, &mHighlight);
+}
+
+  
+/*
+ Return position of highlight.
+ */
+int fltk3::TextBuffer::highlight_position(int *start, int *end)
+{
+  return mHighlight.position(start, end);
+}
+
+
+/*
+ Return a copy of highlighted text.
+ */
+char *fltk3::TextBuffer::highlight_text()
+{
+  return selection_text_(&mHighlight);
+}
+
+
+/*
+ Add a callback that is called whenever text is modified.
+ */
+void fltk3::TextBuffer::add_modify_callback(fltk3::TextModifyCb bufModifiedCB,
+					 void *cbArg)
+{
+  fltk3::TextModifyCb *newModifyProcs =
+  new fltk3::TextModifyCb[mNModifyProcs + 1];
+  void **newCBArgs = new void *[mNModifyProcs + 1];
+  for (int i = 0; i < mNModifyProcs; i++) {
+    newModifyProcs[i + 1] = mModifyProcs[i];
+    newCBArgs[i + 1] = mCbArgs[i];
+  }
+  if (mNModifyProcs != 0) {
+    delete[]mModifyProcs;
+    delete[]mCbArgs;
+  }
+  newModifyProcs[0] = bufModifiedCB;
+  newCBArgs[0] = cbArg;
+  mNModifyProcs++;
+  mModifyProcs = newModifyProcs;
+  mCbArgs = newCBArgs;
+}
+
+
+/*
+ Remove a callback.
+ */
+void fltk3::TextBuffer::remove_modify_callback(fltk3::TextModifyCb bufModifiedCB, 
+                                            void *cbArg)
+{
+  int i, toRemove = -1;
+  
+  /* find the matching callback to remove */
+  for (i = 0; i < mNModifyProcs; i++) {
+    if (mModifyProcs[i] == bufModifiedCB && mCbArgs[i] == cbArg) {
+      toRemove = i;
+      break;
+    }
+  }
+  if (toRemove == -1) {
+    fltk3::error
+    ("fltk3::TextBuffer::remove_modify_callback(): Can't find modify CB to remove");
+    return;
+  }
+  
+  /* Allocate new lists for remaining callback procs and args (if
+   any are left) */
+  mNModifyProcs--;
+  if (mNModifyProcs == 0) {
+    mNModifyProcs = 0;
+    delete[]mModifyProcs;
+    mModifyProcs = NULL;
+    delete[]mCbArgs;
+    mCbArgs = NULL;
+    return;
+  }
+  fltk3::TextModifyCb *newModifyProcs = new fltk3::TextModifyCb[mNModifyProcs];
+  void **newCBArgs = new void *[mNModifyProcs];
+  
+  /* copy out the remaining members and free the old lists */
+  for (i = 0; i < toRemove; i++) {
+    newModifyProcs[i] = mModifyProcs[i];
+    newCBArgs[i] = mCbArgs[i];
+  }
+  for (; i < mNModifyProcs; i++) {
+    newModifyProcs[i] = mModifyProcs[i + 1];
+    newCBArgs[i] = mCbArgs[i + 1];
+  }
+  delete[]mModifyProcs;
+  delete[]mCbArgs;
+  mModifyProcs = newModifyProcs;
+  mCbArgs = newCBArgs;
+}
+
+
+/*
+ Add a callback that is called before deleting text.
+ */
+void fltk3::TextBuffer::add_predelete_callback(fltk3::TextPredeleteCb bufPreDeleteCB, 
+                                            void *cbArg)
+{
+  fltk3::TextPredeleteCb *newPreDeleteProcs =
+  new fltk3::TextPredeleteCb[mNPredeleteProcs + 1];
+  void **newCBArgs = new void *[mNPredeleteProcs + 1];
+  for (int i = 0; i < mNPredeleteProcs; i++) {
+    newPreDeleteProcs[i + 1] = mPredeleteProcs[i];
+    newCBArgs[i + 1] = mPredeleteCbArgs[i];
+  }
+  if (!mNPredeleteProcs != 0) {
+    delete[]mPredeleteProcs;
+    delete[]mPredeleteCbArgs;
+  }
+  newPreDeleteProcs[0] = bufPreDeleteCB;
+  newCBArgs[0] = cbArg;
+  mNPredeleteProcs++;
+  mPredeleteProcs = newPreDeleteProcs;
+  mPredeleteCbArgs = newCBArgs;
+}
+
+
+/*
+ Remove a callback.
+ */
+void fltk3::TextBuffer::remove_predelete_callback(fltk3::TextPredeleteCb bufPreDeleteCB, void *cbArg)
+{
+  int i, toRemove = -1;
+  /* find the matching callback to remove */
+  for (i = 0; i < mNPredeleteProcs; i++) {
+    if (mPredeleteProcs[i] == bufPreDeleteCB &&
+	mPredeleteCbArgs[i] == cbArg) {
+      toRemove = i;
+      break;
+    }
+  }
+  if (toRemove == -1) {
+    fltk3::error
+    ("fltk3::TextBuffer::remove_predelete_callback(): Can't find pre-delete CB to remove");
+    return;
+  }
+  
+  /* Allocate new lists for remaining callback procs and args (if
+   any are left) */
+  mNPredeleteProcs--;
+  if (mNPredeleteProcs == 0) {
+    mNPredeleteProcs = 0;
+    delete[]mPredeleteProcs;
+    mPredeleteProcs = NULL;
+    delete[]mPredeleteCbArgs;
+    mPredeleteCbArgs = NULL;
+    return;
+  }
+  fltk3::TextPredeleteCb *newPreDeleteProcs =
+  new fltk3::TextPredeleteCb[mNPredeleteProcs];
+  void **newCBArgs = new void *[mNPredeleteProcs];
+  
+  /* copy out the remaining members and free the old lists */
+  for (i = 0; i < toRemove; i++) {
+    newPreDeleteProcs[i] = mPredeleteProcs[i];
+    newCBArgs[i] = mPredeleteCbArgs[i];
+  }
+  for (; i < mNPredeleteProcs; i++) {
+    newPreDeleteProcs[i] = mPredeleteProcs[i + 1];
+    newCBArgs[i] = mPredeleteCbArgs[i + 1];
+  }
+  delete[]mPredeleteProcs;
+  delete[]mPredeleteCbArgs;
+  mPredeleteProcs = newPreDeleteProcs;
+  mPredeleteCbArgs = newCBArgs;
+}
+
+
+/*
+ Return a copy of the line that contains a given index.
+ Pos must be at a character boundary.
+ */
+char *fltk3::TextBuffer::line_text(int pos) const {
+  return text_range(line_start(pos), line_end(pos));
+} 
+
+
+/*
+ Find the beginning of the line.
+ */
+int fltk3::TextBuffer::line_start(int pos) const 
+{
+  if (!findchar_backward(pos, '\n', &pos))
+    return 0;
+  return pos + 1;
+} 
+
+
+/*
+ Find the end of the line.
+ */
+int fltk3::TextBuffer::line_end(int pos) const {
+  if (!findchar_forward(pos, '\n', &pos))
+    pos = mLength;
+  return pos;
+} 
+
+
+/*
+ Find the beginning of a word.
+ NOT UNICODE SAFE.
+ */
+int fltk3::TextBuffer::word_start(int pos) const {
+  // FIXME: character is ucs-4
+  while (pos>0 && (isalnum(char_at(pos)) || char_at(pos) == '_')) {
+    pos = prev_char(pos);
+  } 
+  // FIXME: character is ucs-4
+  if (!(isalnum(char_at(pos)) || char_at(pos) == '_'))
+    pos = next_char(pos);
+  return pos;
+}
+
+
+/*
+ Find the end of a word.
+ NOT UNICODE SAFE.
+ */
+int fltk3::TextBuffer::word_end(int pos) const {
+  // FIXME: character is ucs-4
+  while (pos < length() && (isalnum(char_at(pos)) || char_at(pos) == '_'))
+  {
+    pos = next_char(pos);
+  }
+  return pos;
+}
+
+
+/*
+ Count the number of characters between two positions.
+ */
+int fltk3::TextBuffer::count_displayed_characters(int lineStartPos,
+					       int targetPos) const
+{
+  IS_UTF8_ALIGNED2(this, (lineStartPos))
+  IS_UTF8_ALIGNED2(this, (targetPos))
+  
+  int charCount = 0;
+  
+  int pos = lineStartPos;
+  while (pos < targetPos) {
+    pos = next_char(pos);
+    charCount++;
+  }
+  return charCount;
+} 
+
+
+/*
+ Skip ahead a number of characters from a given index.
+ This function breaks early if it encounters a newline character.
+ */
+int fltk3::TextBuffer::skip_displayed_characters(int lineStartPos, int nChars)
+{
+  IS_UTF8_ALIGNED2(this, (lineStartPos))
+
+  int pos = lineStartPos;
+  
+  for (int charCount = 0; charCount < nChars && pos < mLength; charCount++) {
+    unsigned int c = char_at(pos);
+    if (c == '\n')
+      return pos;
+    pos = next_char(pos);
+  }
+  return pos;
+}
+
+
+/*
+ Count the number of newline characters between start and end.
+ startPos and endPos must be at a character boundary.
+ This function is optimized for speed by not using UTF-8 calls.
+ */
+int fltk3::TextBuffer::count_lines(int startPos, int endPos) const {
+  IS_UTF8_ALIGNED2(this, (startPos))
+  IS_UTF8_ALIGNED2(this, (endPos))
+  
+  int gapLen = mGapEnd - mGapStart;
+  int lineCount = 0;
+  
+  int pos = startPos;
+  while (pos < mGapStart)
+  {
+    if (pos == endPos)
+      return lineCount;
+    if (mBuf[pos++] == '\n')
+      lineCount++;
+  } 
+  while (pos < mLength) {
+    if (pos == endPos)
+      return lineCount;
+    if (mBuf[pos++ + gapLen] == '\n')
+      lineCount++;
+  }
+  return lineCount;
+}
+
+
+/*
+ Skip to the first character, n lines ahead.
+ StartPos must be at a character boundary.
+ This function is optimized for speed by not using UTF-8 calls.
+ */
+int fltk3::TextBuffer::skip_lines(int startPos, int nLines)
+{
+  IS_UTF8_ALIGNED2(this, (startPos))
+  
+  if (nLines == 0)
+    return startPos;
+  
+  int gapLen = mGapEnd - mGapStart;
+  int pos = startPos;
+  int lineCount = 0;
+  while (pos < mGapStart) {
+    if (mBuf[pos++] == '\n') {
+      lineCount++;
+      if (lineCount == nLines) {
+        IS_UTF8_ALIGNED2(this, (pos))
+	return pos;
+      }
+    }
+  }
+  while (pos < mLength) {
+    if (mBuf[pos++ + gapLen] == '\n') {
+      lineCount++;
+      if (lineCount >= nLines) {
+        IS_UTF8_ALIGNED2(this, (pos))
+	return pos;
+      }
+    }
+  }
+  IS_UTF8_ALIGNED2(this, (pos))
+  return pos;
+}
+
+
+/*
+ Skip to the first character, n lines back.
+ StartPos must be at a character boundary.
+ This function is optimized for speed by not using UTF-8 calls.
+ */
+int fltk3::TextBuffer::rewind_lines(int startPos, int nLines)
+{
+  IS_UTF8_ALIGNED2(this, (startPos))
+  
+  int pos = startPos - 1;
+  if (pos <= 0)
+    return 0;
+  
+  int gapLen = mGapEnd - mGapStart;
+  int lineCount = -1;
+  while (pos >= mGapStart) {
+    if (mBuf[pos + gapLen] == '\n') {
+      if (++lineCount >= nLines) {
+        IS_UTF8_ALIGNED2(this, (pos+1))
+	return pos + 1;
+      }
+    }
+    pos--;
+  }
+  while (pos >= 0) {
+    if (mBuf[pos] == '\n') {
+      if (++lineCount >= nLines) {
+        IS_UTF8_ALIGNED2(this, (pos+1))
+	return pos + 1;
+      }
+    }
+    pos--;
+  }
+  return 0;
+}
+
+
+/*
+ Find a matching string in the buffer.
+ */
+int fltk3::TextBuffer::search_forward(int startPos, const char *searchString,
+				   int *foundPos, int matchCase) const 
+{
+  IS_UTF8_ALIGNED2(this, (startPos))
+  IS_UTF8_ALIGNED(searchString)
+  
+  if (!searchString)
+    return 0;
+  int bp;
+  const char *sp;
+  if (matchCase) {
+    while (startPos < length()) {
+      bp = startPos;
+      sp = searchString;
+      for (;;) {
+        char c = *sp;
+        // we reached the end of the "needle", so we found the string!
+        if (!c) {
+          *foundPos = startPos;
+          return 1;
+        }
+        int l = fltk3::utf8len1(c);
+        if (memcmp(sp, address(bp), l))
+          break;
+        sp += l; bp += l;
+      }
+      startPos = next_char(startPos);
+    }
+  } else {
+    while (startPos < length()) {
+      bp = startPos;
+      sp = searchString;
+      for (;;) {
+        // we reached the end of the "needle", so we found the string!
+        if (!*sp) {
+          *foundPos = startPos;
+          return 1;
+        }
+        int l;
+        unsigned int b = char_at(bp);
+        unsigned int s = fltk3::utf8decode(sp, 0, &l);
+        if (fltk3::tolower(b)!=fltk3::tolower(s))
+          break;
+        sp += l; 
+        bp = next_char(bp);
+      }
+      startPos = next_char(startPos);
+    }
+  }  
+  return 0;
+}
+
+int fltk3::TextBuffer::search_backward(int startPos, const char *searchString,
+				    int *foundPos, int matchCase) const 
+{
+  IS_UTF8_ALIGNED2(this, (startPos))
+  IS_UTF8_ALIGNED(searchString)
+  
+  if (!searchString)
+    return 0;
+  int bp;
+  const char *sp;
+  if (matchCase) {
+    while (startPos >= 0) {
+      bp = startPos;
+      sp = searchString;
+      for (;;) {
+        char c = *sp;
+        // we reached the end of the "needle", so we found the string!
+        if (!c) {
+          *foundPos = startPos;
+          return 1;
+        }
+        int l = fltk3::utf8len1(c);
+        if (memcmp(sp, address(bp), l))
+          break;
+        sp += l; bp += l;
+      }
+      startPos = prev_char(startPos);
+    }
+  } else {
+    while (startPos >= 0) {
+      bp = startPos;
+      sp = searchString;
+      for (;;) {
+        // we reached the end of the "needle", so we found the string!
+        if (!*sp) {
+          *foundPos = startPos;
+          return 1;
+        }
+        int l;
+        unsigned int b = char_at(bp);
+        unsigned int s = fltk3::utf8decode(sp, 0, &l);
+        if (fltk3::tolower(b)!=fltk3::tolower(s))
+          break;
+        sp += l; 
+        bp = next_char(bp);
+      }
+      startPos = prev_char(startPos);
+    }
+  }  
+  return 0;
+}
+
+
+
+/*
+ Insert a string into the buffer.
+ Pos must be at a character boundary. Text must be a correct UTF-8 string.
+ */
+int fltk3::TextBuffer::insert_(int pos, const char *text)
+{
+  if (!text || !*text)
+    return 0;
+  
+  int insertedLength = strlen(text);
+  
+  /* Prepare the buffer to receive the new text.  If the new text fits in
+   the current buffer, just move the gap (if necessary) to where
+   the text should be inserted.  If the new text is too large, reallocate
+   the buffer with a gap large enough to accomodate the new text and a
+   gap of mPreferredGapSize */
+  if (insertedLength > mGapEnd - mGapStart)
+    reallocate_with_gap(pos, insertedLength + mPreferredGapSize);
+  else if (pos != mGapStart)
+    move_gap(pos);
+  
+  /* Insert the new text (pos now corresponds to the start of the gap) */
+  memcpy(&mBuf[pos], text, insertedLength);
+  mGapStart += insertedLength;
+  mLength += insertedLength;
+  update_selections(pos, 0, insertedLength);
+  
+  if (mCanUndo) {
+    if (undowidget == this && undoat == pos && undoinsert) {
+      undoinsert += insertedLength;
+    } else {
+      undoinsert = insertedLength;
+      undoyankcut = (undoat == pos) ? undocut : 0;
+    }
+    undoat = pos + insertedLength;
+    undocut = 0;
+    undowidget = this;
+  }
+  
+  return insertedLength;
+}
+
+
+/*
+ Remove a string from the buffer.
+ Unicode safe. Start and end must be at a character boundary.
+ */
+void fltk3::TextBuffer::remove_(int start, int end)
+{
+  /* if the gap is not contiguous to the area to remove, move it there */
+  
+  if (mCanUndo) {
+    if (undowidget == this && undoat == end && undocut) {
+      undobuffersize(undocut + end - start + 1);
+      memmove(undobuffer + end - start, undobuffer, undocut);
+      undocut += end - start;
+    } else {
+      undocut = end - start;
+      undobuffersize(undocut);
+    }
+    undoat = start;
+    undoinsert = 0;
+    undoyankcut = 0;
+    undowidget = this;
+  }
+  
+  if (start > mGapStart) {
+    if (mCanUndo)
+      memcpy(undobuffer, mBuf + (mGapEnd - mGapStart) + start,
+	     end - start);
+    move_gap(start);
+  } else if (end < mGapStart) {
+    if (mCanUndo)
+      memcpy(undobuffer, mBuf + start, end - start);
+    move_gap(end);
+  } else {
+    int prelen = mGapStart - start;
+    if (mCanUndo) {
+      memcpy(undobuffer, mBuf + start, prelen);
+      memcpy(undobuffer + prelen, mBuf + mGapEnd, end - start - prelen);
+    }
+  }
+  
+  /* expand the gap to encompass the deleted characters */
+  mGapEnd += end - mGapStart;
+  mGapStart -= mGapStart - start;
+  
+  /* update the length */
+  mLength -= end - start;
+  
+  /* fix up any selections which might be affected by the change */
+  update_selections(start, end - start, 0);
+}
+
+  
+/*
+ simple setter.
+ Unicode safe. Start and end must be at a character boundary.
+ */
+void fltk3::TextSelection::set(int startpos, int endpos)
+{
+  mSelected = startpos != endpos;
+  mStart = min(startpos, endpos);
+  mEnd = max(startpos, endpos);
+}
+
+
+/*
+ simple getter.
+ Unicode safe. Start and end will be at a character boundary.
+ */
+int fltk3::TextSelection::position(int *startpos, int *endpos) const {
+  if (!mSelected)
+    return 0;
+  *startpos = mStart;
+  *endpos = mEnd;
+  
+  return 1;
+} 
+
+
+/*
+ Return if a position is inside the selected area.
+ Unicode safe. Pos must be at a character boundary.
+ */
+int fltk3::TextSelection::includes(int pos) const {
+  return (selected() && pos >= start() && pos < end() );
+}
+
+
+/*
+ Return a duplicate of the selected text, or an empty string.
+ Unicode safe.
+ */
+char *fltk3::TextBuffer::selection_text_(fltk3::TextSelection * sel) const {
+  int start, end;
+  
+  /* If there's no selection, return an allocated empty string */
+  if (!sel->position(&start, &end))
+  {
+    char *s = (char *) malloc(1);
+    *s = '\0';
+    return s;
+  }
+  
+  /* Return the selected range */
+    return text_range(start, end);
+}
+
+
+/*
+ Remove the selected text.
+ Unicode safe.
+ */
+void fltk3::TextBuffer::remove_selection_(fltk3::TextSelection * sel)
+{
+  int start, end;
+  
+  if (!sel->position(&start, &end))
+    return;
+  remove(start, end);
+  //undoyankcut = undocut;
+}
+
+
+/*
+ Replace selection with text.
+ Unicode safe.
+ */
+void fltk3::TextBuffer::replace_selection_(fltk3::TextSelection * sel,
+					const char *text)
+{
+  fltk3::TextSelection oldSelection = *sel;
+  
+  /* If there's no selection, return */
+  int start, end;
+  if (!sel->position(&start, &end))
+    return;
+  
+  /* Do the appropriate type of replace */
+    replace(start, end, text);
+  
+  /* Unselect (happens automatically in BufReplace, but BufReplaceRect
+   can't detect when the contents of a selection goes away) */
+  sel->mSelected = 0;
+  redisplay_selection(&oldSelection, sel);
+}
+
+  
+/*
+ Call all callbacks.
+ Unicode safe.
+ */
+void fltk3::TextBuffer::call_modify_callbacks(int pos, int nDeleted,
+					   int nInserted, int nRestyled,
+					   const char *deletedText) const {
+  IS_UTF8_ALIGNED2(this, pos)
+  for (int i = 0; i < mNModifyProcs; i++)
+    (*mModifyProcs[i]) (pos, nInserted, nDeleted, nRestyled,
+			deletedText, mCbArgs[i]);
+} 
+
+
+/*
+ Call all callbacks.
+ Unicode safe.
+ */
+void fltk3::TextBuffer::call_predelete_callbacks(int pos, int nDeleted) const {
+  for (int i = 0; i < mNPredeleteProcs; i++)
+    (*mPredeleteProcs[i]) (pos, nDeleted, mPredeleteCbArgs[i]);
+} 
+
+
+/*
+ Redisplay a new selected area.
+ Unicode safe.
+ */
+void fltk3::TextBuffer::redisplay_selection(fltk3::TextSelection *
+					   oldSelection,
+					   fltk3::TextSelection *
+					   newSelection) const
+{
+  int oldStart, oldEnd, newStart, newEnd, ch1Start, ch1End, ch2Start,
+  ch2End;
+  
+  /* If either selection is rectangular, add an additional character to
+   the end of the selection to request the redraw routines to wipe out
+   the parts of the selection beyond the end of the line */
+  oldStart = oldSelection->mStart;
+  newStart = newSelection->mStart;
+  oldEnd = oldSelection->mEnd;
+  newEnd = newSelection->mEnd;
+  
+  /* If the old or new selection is unselected, just redisplay the
+   single area that is (was) selected and return */
+  if (!oldSelection->mSelected && !newSelection->mSelected)
+    return;
+  if (!oldSelection->mSelected)
+  {
+    call_modify_callbacks(newStart, 0, 0, newEnd - newStart, NULL);
+    return;
+  }
+  if (!newSelection->mSelected) {
+    call_modify_callbacks(oldStart, 0, 0, oldEnd - oldStart, NULL);
+    return;
+  }
+  
+  /* If the selections are non-contiguous, do two separate updates
+   and return */
+  if (oldEnd < newStart || newEnd < oldStart) {
+    call_modify_callbacks(oldStart, 0, 0, oldEnd - oldStart, NULL);
+    call_modify_callbacks(newStart, 0, 0, newEnd - newStart, NULL);
+    return;
+  }
+  
+  /* Otherwise, separate into 3 separate regions: ch1, and ch2 (the two
+   changed areas), and the unchanged area of their intersection,
+   and update only the changed area(s) */
+  ch1Start = min(oldStart, newStart);
+  ch2End = max(oldEnd, newEnd);
+  ch1End = max(oldStart, newStart);
+  ch2Start = min(oldEnd, newEnd);
+  if (ch1Start != ch1End)
+    call_modify_callbacks(ch1Start, 0, 0, ch1End - ch1Start, NULL);
+  if (ch2Start != ch2End)
+    call_modify_callbacks(ch2Start, 0, 0, ch2End - ch2Start, NULL);
+}
+
+
+/*
+ Move the gap around without changing buffer content.
+ Unicode safe. Pos must be at a character boundary.
+ */
+void fltk3::TextBuffer::move_gap(int pos)
+{
+  int gapLen = mGapEnd - mGapStart;
+  
+  if (pos > mGapStart)
+    memmove(&mBuf[mGapStart], &mBuf[mGapEnd], pos - mGapStart);
+  else
+    memmove(&mBuf[pos + gapLen], &mBuf[pos], mGapStart - pos);
+  mGapEnd += pos - mGapStart;
+  mGapStart += pos - mGapStart;
+}
+
+
+/*
+ Create a larger gap.
+ Unicode safe. Start must be at a character boundary.
+ */
+void fltk3::TextBuffer::reallocate_with_gap(int newGapStart, int newGapLen)
+{
+  char *newBuf = (char *) malloc(mLength + newGapLen);
+  int newGapEnd = newGapStart + newGapLen;
+  
+  if (newGapStart <= mGapStart) {
+    memcpy(newBuf, mBuf, newGapStart);
+    memcpy(&newBuf[newGapEnd], &mBuf[newGapStart],
+	   mGapStart - newGapStart);
+    memcpy(&newBuf[newGapEnd + mGapStart - newGapStart],
+	   &mBuf[mGapEnd], mLength - mGapStart);
+  } else {			/* newGapStart > mGapStart */
+    memcpy(newBuf, mBuf, mGapStart);
+    memcpy(&newBuf[mGapStart], &mBuf[mGapEnd], newGapStart - mGapStart);
+    memcpy(&newBuf[newGapEnd],
+	   &mBuf[mGapEnd + newGapStart - mGapStart],
+	   mLength - newGapStart);
+  }
+  free((void *) mBuf);
+  mBuf = newBuf;
+  mGapStart = newGapStart;
+  mGapEnd = newGapEnd;
+  }
+
+
+/*
+ Update selection range if characters were inserted.
+ Unicode safe. Pos must be at a character boundary.
+ */
+void fltk3::TextBuffer::update_selections(int pos, int nDeleted,
+				       int nInserted)
+{
+  mPrimary.update(pos, nDeleted, nInserted);
+  mSecondary.update(pos, nDeleted, nInserted);
+  mHighlight.update(pos, nDeleted, nInserted);
+}
+
+
+// unicode safe, assuming the arguments are on character boundaries
+void fltk3::TextSelection::update(int pos, int nDeleted, int nInserted)
+{
+  if (!mSelected || pos > mEnd)
+    return;
+  if (pos + nDeleted <= mStart) {
+    mStart += nInserted - nDeleted;
+    mEnd += nInserted - nDeleted;
+  } else if (pos <= mStart && pos + nDeleted >= mEnd) {
+    mStart = pos;
+    mEnd = pos;
+    mSelected = 0;
+  } else if (pos <= mStart && pos + nDeleted < mEnd) {
+    mStart = pos;
+    mEnd = nInserted + mEnd - nDeleted;
+  } else if (pos < mEnd) {
+    mEnd += nInserted - nDeleted;
+    if (mEnd <= mStart)
+      mSelected = 0;
+  }
+}
+
+
+/*
+ Find a UCS-4 character.
+ StartPos must be at a character boundary, searchChar is UCS-4 encoded.
+ */
+int fltk3::TextBuffer::findchar_forward(int startPos, unsigned searchChar,
+				     int *foundPos) const 
+{
+  if (startPos >= mLength) {
+    *foundPos = mLength;
+    return 0;
+  }
+  
+  if (startPos<0)
+    startPos = 0;
+  
+  for ( ; startPos<mLength; startPos = next_char(startPos)) {
+    if (searchChar == char_at(startPos)) {
+      *foundPos = startPos;
+      return 1;
+    }
+  }
+  
+  *foundPos = mLength;
+  return 0;
+}
+
+  
+/*
+ Find a UCS-4 character.
+ StartPos must be at a character boundary, searchChar is UCS-4 encoded.
+ */
+int fltk3::TextBuffer::findchar_backward(int startPos, unsigned int searchChar,
+				      int *foundPos) const {
+  if (startPos <= 0) {
+    *foundPos = 0;
+    return 0;
+  }
+  
+  if (startPos > mLength)
+    startPos = mLength;
+  
+  for (startPos = prev_char(startPos); startPos>=0; startPos = prev_char(startPos)) {
+    if (searchChar == char_at(startPos)) {
+      *foundPos = startPos;
+      return 1;
+    }
+  }
+  
+  *foundPos = 0;
+  return 0;
+}
+
+//#define EXAMPLE_ENCODING // shows how to process any encoding for which a decoding function exists
+#ifdef EXAMPLE_ENCODING 
+
+// returns the UCS equivalent of *p in CP1252 and advances p by 1
+unsigned cp1252toucs(char* &p)
+{
+  // Codes 0x80..0x9f from the Microsoft CP1252 character set, translated
+  // to Unicode
+  static unsigned cp1252[32] = {
+    0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
+    0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
+    0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
+    0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178
+  };
+  unsigned char uc = *(unsigned char*)p;
+  p++;
+  return (uc < 0x80 || uc >= 0xa0 ? uc : cp1252[uc - 0x80]);
+}
+
+// returns the UCS equivalent of *p in UTF-16 and advances p by 2 (or more for surrogates)
+unsigned utf16toucs(char* &p)
+{
+  union {
+#if WORDS_BIGENDIAN
+    struct { unsigned char a, b;} chars;
+#else
+    struct { unsigned char b, a;} chars;
+#endif
+    U16 short_val;
+  } u;
+  u.chars.a = *(unsigned char*)p++;
+  u.chars.b = *(unsigned char*)p++;
+  return u.short_val;
+}
+
+// filter that produces, from an input stream fed by reading from fp,
+// a UTF-8-encoded output stream written in buffer.
+// Input can be any (e.g., 8-bit, UTF-16) encoding.
+// Output is true UTF-8.
+// p_trf points to a function that transforms encoded byte(s) into one UCS
+// and that increases the pointer by the adequate quantity
+static int general_input_filter(char *buffer, int buflen, 
+				 char *line, int sline, char* &endline, 
+				 unsigned (*p_trf)(char* &),
+				 FILE *fp)
+{
+  char *p, *q, multibyte[5];
+  int lq, r, offset;
+  p = endline = line;
+  q = buffer;
+  while (q < buffer + buflen) {
+    if (p >= endline) {
+      r = fread(line, 1, sline, fp);
+      endline = line + r; 
+      if (r == 0) return q - buffer;
+      p = line;
+    }
+    if (q + 4 /*max width of utf-8 char*/ > buffer + buflen) {
+      memmove(line, p, endline - p);
+      endline -= (p - line);
+      return q - buffer;
+    }
+    lq = fltk3::utf8encode( p_trf(p), multibyte );
+    memcpy(q, multibyte, lq);
+    q += lq; 
+  }
+  memmove(line, p, endline - p);
+  endline -= (p - line);
+  return q - buffer;
+}
+#endif // EXAMPLE_ENCODING
+
+/*
+ filter that produces, from an input stream fed by reading from fp,
+ a UTF-8-encoded output stream written in buffer.
+ Input can be UTF-8. If it is not, it is decoded with CP1252.
+ Output is UTF-8.
+ *input_was_changed is set to true if the input was not strict UTF-8 so output
+ differs from input.
+ */
+static int utf8_input_filter(char *buffer, int buflen, char *line, int sline, char* &endline, 
+	      FILE *fp, int *input_was_changed)
+{
+  char *p, *q, multibyte[5];
+  int l, lp, lq, r;
+  unsigned u;
+  p = endline = line;
+  q = buffer;
+  while (q < buffer + buflen) {
+    if (p >= endline) {
+      r = fread(line, 1, sline, fp);
+      endline = line + r; 
+      if (r == 0) return q - buffer;
+      p = line;
+    }
+    l = fltk3::utf8len1(*p);
+    if (p + l > endline) {
+      memmove(line, p, endline - p);
+      endline -= (p - line);
+      r = fread(endline, 1, sline - (endline - line), fp);
+      endline += r;
+      p = line;
+      if (endline - line < l) break;
+    }
+    while ( l > 0) {
+      u = fltk3::utf8decode(p, p+l, &lp);
+      lq = fltk3::utf8encode(u, multibyte);
+      if (lp != l || lq != l) *input_was_changed = true;
+      if (q + lq > buffer + buflen) {
+	memmove(line, p, endline - p);
+	endline -= (p - line);
+	return q - buffer;
+      }
+      memcpy(q, multibyte, lq);
+      q += lq; 
+      p += lp;
+      l -= lp;
+    }
+  }
+  memmove(line, p, endline - p);
+  endline -= (p - line);
+  return q - buffer;
+}
+
+const char *fltk3::TextBuffer::file_encoding_warning_message = 
+"Displayed text contains the UTF-8 transcoding\n"
+"of the input file which was not UTF-8 encoded.\n"
+"Some changes may have occurred.";
+
+/*
+ Insert text from a file.
+ Input file can be of various encodings according to what input fiter is used.
+ utf8_input_filter accepts UTF-8 or CP1252 as input encoding.
+ Output is always UTF-8.
+ */
+ int fltk3::TextBuffer::insertfile(const char *file, int pos, int buflen)
+{
+  FILE *fp;
+  if (!(fp = fltk3::fopen(file, "r")))
+    return 1;
+  char *buffer = new char[buflen + 1];  
+  char *endline, line[100];
+  int l;
+  input_file_was_transcoded = false;
+  endline = line;
+  while (true) {
+#ifdef EXAMPLE_ENCODING
+    // example of 16-bit encoding: UTF-16
+    l = general_input_filter(buffer, buflen, 
+				  line, sizeof(line), endline, 
+				  utf16toucs, // use cp1252toucs to read CP1252-encoded files
+				  fp);
+    input_file_was_transcoded = true;
+#else
+    l = utf8_input_filter(buffer, buflen, line, sizeof(line), endline, 
+			  fp, &input_file_was_transcoded);
+#endif
+    if (l == 0) break;
+    buffer[l] = 0;
+    insert(pos, buffer);
+    pos += l;
+    }
+  int e = ferror(fp) ? 2 : 0;
+  fclose(fp);
+  delete[]buffer;
+  if ( (!e) && input_file_was_transcoded && transcoding_warning_action) {
+    transcoding_warning_action(this);
+    }
+  return e;
+}
+
+
+/*
+ Write text to file.
+ Unicode safe.
+ */
+int fltk3::TextBuffer::outputfile(const char *file,
+			       int start, int end,
+			       int buflen) {
+  FILE *fp;
+  if (!(fp = fltk3::fopen(file, "w")))
+    return 1;
+  for (int n; (n = min(end - start, buflen)); start += n) {
+    const char *p = text_range(start, start + n);
+    int r = fwrite(p, 1, n, fp);
+    free((void *) p);
+    if (r != n)
+      break;
+  }
+  
+  int e = ferror(fp) ? 2 : 0;
+  fclose(fp);
+  return e;
+}
+
+
+/*
+ Return the previous character position.
+ Unicode safe.
+ */
+int fltk3::TextBuffer::prev_char_clipped(int pos) const
+{
+  if (pos<=0)
+    return 0;
+
+  IS_UTF8_ALIGNED2(this, (pos))  
+
+  char c;
+  do {
+    pos--;
+    if (pos==0)
+      return 0;
+    c = byte_at(pos);
+  } while ( (c&0xc0) == 0x80);
+  
+  IS_UTF8_ALIGNED2(this, (pos))  
+  return pos;
+}
+
+
+/*
+ Return the previous character position.
+ Returns -1 if the beginning of the buffer is reached.
+ */
+int fltk3::TextBuffer::prev_char(int pos) const
+{
+  if (pos==0) return -1;
+  return prev_char_clipped(pos);
+}
+
+
+/*
+ Return the next character position.
+ Returns length() if the end of the buffer is reached.
+ */
+int fltk3::TextBuffer::next_char(int pos) const
+{
+  IS_UTF8_ALIGNED2(this, (pos))  
+  int n = fltk3::utf8len1(byte_at(pos));
+  pos += n;
+  if (pos>=mLength)
+    return mLength;
+  IS_UTF8_ALIGNED2(this, (pos))  
+  return pos;
+}
+
+
+/*
+ Return the next character position.
+ If the end of the buffer is reached, it returns the current position.
+ */
+int fltk3::TextBuffer::next_char_clipped(int pos) const
+{
+  return next_char(pos);
+}
+
+/*
+ Align an index to the current UTF-8 boundary.
+ */
+int fltk3::TextBuffer::utf8_align(int pos) const 
+{
+  char c = byte_at(pos);
+  while ( (c&0xc0) == 0x80) {
+    pos--;
+    c = byte_at(pos);
+  }
+  return pos;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TextDisplay.cxx (from rev 9006, branches/branch-3.0/src/core/Fl_Text_Display.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TextDisplay.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TextDisplay.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,3860 @@
+//
+// "$Id$"
+//
+// Copyright 2001-2010 by Bill Spitzak and others.
+// Original code Copyright Mark Edel.  Permission to distribute under
+// the LGPL for the FLTK library granted by Mark Edel.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// TODO: rendering of the "optional hyphen"
+// TODO: make line numbering work again
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <limits.h>
+#include <ctype.h>
+#include <fltk3/run.h>
+#include <fltk3/TextBuffer.h>
+#include <fltk3/TextDisplay.h>
+#include <fltk3/MenuItem.h>
+#include <fltk3/Window.h>
+#include <fltk3/Printer.h>
+
+#undef min
+#undef max
+
+// Text area margins.  Left & right margins should be at least 3 so that
+// there is some room for the overhanging parts of the cursor!
+#define TOP_MARGIN 1
+#define BOTTOM_MARGIN 1
+#define LEFT_MARGIN 3
+#define RIGHT_MARGIN 3
+
+#define NO_HINT -1
+
+/* Masks for text drawing methods.  These are or'd together to form an
+ integer which describes what drawing calls to use to draw a string */
+#define FILL_MASK         0x0100
+#define SECONDARY_MASK    0x0200
+#define PRIMARY_MASK      0x0400
+#define HIGHLIGHT_MASK    0x0800
+#define BG_ONLY_MASK      0x1000
+#define TEXT_ONLY_MASK    0x2000
+#define STYLE_LOOKUP_MASK   0xff
+
+/* Maximum displayable line length (how many characters will fit across the
+ widest window).  This amount of memory is temporarily allocated from the
+ stack in the draw_vline() method for drawing strings */
+#define MAX_DISP_LINE_LEN 1000
+
+static int max( int i1, int i2 );
+static int min( int i1, int i2 );
+static int countlines( const char *string );
+
+/* The variables below are used in a timer event to allow smooth
+ scrolling of the text area when the pointer has left the area. */
+static int scroll_direction = 0;
+static int scroll_amount = 0;
+static int scroll_y = 0;
+static int scroll_x = 0;
+
+// CET - FIXME
+#define TMPFONTWIDTH 6
+
+
+
+/**  
+ \brief Creates a new text display widget.
+ 
+ \param X, Y, W, H position and size of widget
+ \param l label text, defaults to none
+ */
+fltk3::TextDisplay::TextDisplay(int X, int Y, int W, int H, const char* l)
+: fltk3::Group(X, Y, W, H, l) {
+  int i;
+  
+  mMaxsize = 0;
+  damage_range1_start = damage_range1_end = -1;
+  damage_range2_start = damage_range2_end = -1;
+  dragPos = dragging = 0;
+  dragType = DRAG_CHAR;
+  display_insert_position_hint = 0;
+  shortcut_ = 0;
+  
+  color(fltk3::BACKGROUND2_COLOR, fltk3::SELECTION_COLOR);
+  box(fltk3::DOWN_FRAME);
+  textsize(fltk3::NORMAL_SIZE);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  textfont(fltk3::HELVETICA);
+  set_flag(SHORTCUT_LABEL);
+  
+  text_area.x = 0;
+  text_area.y = 0;
+  text_area.w = 0;
+  text_area.h = 0;
+  
+  mVScrollBar = new fltk3::Scrollbar(0,0,1,1);
+  mVScrollBar->callback((fltk3::Callback*)v_scrollbar_cb, this);
+  mHScrollBar = new fltk3::Scrollbar(0,0,1,1);
+  mHScrollBar->callback((fltk3::Callback*)h_scrollbar_cb, this);
+  mHScrollBar->type(fltk3::HORIZONTAL);
+  
+  end();
+  
+  scrollbar_width(fltk3::scrollbar_size());
+  scrollbar_align(fltk3::ALIGN_BOTTOM_RIGHT);
+  
+  mCursorOn = 0;
+  mCursorPos = 0;
+  mCursorOldY = -100;
+  mCursorToHint = NO_HINT;
+  mCursorStyle = NORMAL_CURSOR;
+  mCursorPreferredXPos = -1;
+  mBuffer = 0;
+  mFirstChar = 0;
+  mLastChar = 0;
+  mNBufferLines = 0;
+  mTopLineNum = mTopLineNumHint = 1;
+  mAbsTopLineNum = 1;
+  mNeedAbsTopLineNum = 0;
+  mHorizOffset = mHorizOffsetHint = 0;
+  
+  mCursor_color = fltk3::FOREGROUND_COLOR;
+  
+  mStyleBuffer = 0;
+  mStyleTable = 0;
+  mNStyles = 0;
+  mNVisibleLines = 1;
+  mLineStarts = new int[mNVisibleLines];
+  mLineStarts[0] = 0;
+  for (i=1; i<mNVisibleLines; i++)
+    mLineStarts[i] = -1;
+  mSuppressResync = 0;
+  mNLinesDeleted = 0;
+  mModifyingTabDistance = 0;
+  
+  mUnfinishedStyle = 0;
+  mUnfinishedHighlightCB = 0;
+  mHighlightCBArg = 0;
+  
+  mLineNumLeft = mLineNumWidth = 0;
+  mContinuousWrap = 0;
+  mWrapMarginPix = 0;
+  mSuppressResync = mNLinesDeleted = mModifyingTabDistance = 0;
+}
+
+
+
+/**
+ Free a text display and release its associated memory.
+ 
+ Note, the text BUFFER that the text display displays is a separate
+ entity and is not freed, nor are the style buffer or style table.
+ */
+fltk3::TextDisplay::~TextDisplay() {
+  if (scroll_direction) {
+    fltk3::remove_timeout(scroll_timer_cb, this);
+    scroll_direction = 0;
+  }
+  if (mBuffer) {
+    mBuffer->remove_modify_callback(buffer_modified_cb, this);
+    mBuffer->remove_predelete_callback(buffer_predelete_cb, this);
+  }
+  if (mLineStarts) delete[] mLineStarts;
+}
+
+
+
+/**  
+ Attach a text buffer to display, replacing the current buffer (if any)
+ \param buf attach this text buffer
+ */
+void fltk3::TextDisplay::buffer( fltk3::TextBuffer *buf ) {
+  /* If the text display is already displaying a buffer, clear it off
+   of the display and remove our callback from it */
+  if ( buf == mBuffer) return;
+  if ( mBuffer != 0 ) {
+    // we must provide a copy of the buffer that we are deleting!
+    char *deletedText = mBuffer->text();
+    buffer_modified_cb( 0, 0, mBuffer->length(), 0, deletedText, this );
+    free(deletedText);
+    mNBufferLines = 0;
+    mBuffer->remove_modify_callback( buffer_modified_cb, this );
+    mBuffer->remove_predelete_callback( buffer_predelete_cb, this );
+  }
+  
+  /* Add the buffer to the display, and attach a callback to the buffer for
+   receiving modification information when the buffer contents change */
+  mBuffer = buf;
+  if (mBuffer) {
+    mBuffer->add_modify_callback( buffer_modified_cb, this );
+    mBuffer->add_predelete_callback( buffer_predelete_cb, this );
+    
+    /* Update the display */
+    buffer_modified_cb( 0, buf->length(), 0, 0, 0, this );
+  }
+  
+  /* Resize the widget to update the screen... */
+  resize(x(), y(), w(), h());
+}
+
+
+
+/**   
+ \brief Attach (or remove) highlight information in text display and redisplay.
+ 
+ Highlighting information consists of a style buffer which parallels the
+ normal text buffer, but codes font and color information for the display;
+ a style table which translates style buffer codes (indexed by buffer
+ character - 'A') into fonts and colors; and a callback mechanism for
+ as-needed highlighting, triggered by a style buffer entry of
+ "unfinishedStyle".  Style buffer can trigger additional redisplay during
+ a normal buffer modification if the buffer contains a primary fltk3::TextSelection
+ (see extendRangeForStyleMods for more information on this protocol).
+ 
+ Style buffers, tables and their associated memory are managed by the caller.
+ 
+ Styles are ranged from 65 ('A') to 126.
+ 
+ \param styleBuffer this buffer works in parallel to the text buffer. For every
+   character in the text buffer, the stye buffer has a byte at the same offset 
+   that contains an index into an array of possible styles. 
+ \param styleTable a list of styles indexed by the style buffer
+ \param nStyles number of styles in the style table
+ \param unfinishedStyle if this style is found, the callback below is called
+ \param unfinishedHighlightCB if a character with an unfinished style is found,
+   this callback will be called
+ \param cbArg and optional argument for the callback above, usually a pointer
+   to the Text Display.
+ */
+void fltk3::TextDisplay::highlight_data(fltk3::TextBuffer *styleBuffer,
+                                     const StyleTableEntry *styleTable,
+                                     int nStyles, char unfinishedStyle,
+                                     UnfinishedStyleCb unfinishedHighlightCB,
+                                     void *cbArg ) {
+  mStyleBuffer = styleBuffer;
+  mStyleTable = styleTable;
+  mNStyles = nStyles;
+  mUnfinishedStyle = unfinishedStyle;
+  mUnfinishedHighlightCB = unfinishedHighlightCB;
+  mHighlightCBArg = cbArg;
+  mColumnScale = 0;
+  
+  mStyleBuffer->canUndo(0);
+  damage(fltk3::DAMAGE_EXPOSE);
+}
+
+
+
+/**
+ \brief Find the longest line of all visible lines.
+ \return the width of the longest visible line in pixels
+ */
+int fltk3::TextDisplay::longest_vline() const {
+  int longest = 0;
+  for (int i = 0; i < mNVisibleLines; i++)
+    longest = max(longest, measure_vline(i));
+  return longest;
+}
+
+
+
+/**
+ \brief Change the size of the displayed text area.
+ Calling this function will trigger a recalculation of all lines visible and
+ of all scrollbar sizes.
+ \param X, Y, W, H new position and size of this widget
+ */
+void fltk3::TextDisplay::resize(int X, int Y, int W, int H) {
+#ifdef DEBUG
+  printf("fltk3::TextDisplay::resize(X=%d, Y=%d, W=%d, H=%d)\n", X, Y, W, H);
+#endif // DEBUG
+  const int oldWidth = w();
+#ifdef DEBUG
+  printf("    oldWidth=%d, mContinuousWrap=%d, mWrapMargin=%d\n", oldWidth, mContinuousWrap, mWrapMargin);
+#endif // DEBUG
+  Widget::resize(X,Y,W,H);
+  if (!buffer()) return;
+  X += fltk3::box_dx(box());
+  Y += fltk3::box_dy(box());
+  W -= fltk3::box_dw(box());
+  H -= fltk3::box_dh(box());
+  
+  text_area.x = X+LEFT_MARGIN;
+  text_area.y = Y+TOP_MARGIN;
+  text_area.w = W-LEFT_MARGIN-RIGHT_MARGIN;
+  text_area.h = H-TOP_MARGIN-BOTTOM_MARGIN;
+  int i;
+  
+  /* Find the new maximum font height for this text display */
+  for (i = 0, mMaxsize = fltk3::height(textfont(), textsize()); i < mNStyles; i++)
+    mMaxsize = max(mMaxsize, fltk3::height(mStyleTable[i].font, mStyleTable[i].size));
+  
+  // did we have scrollbars initially?
+  unsigned int hscrollbarvisible = mHScrollBar->visible();
+  unsigned int vscrollbarvisible = mVScrollBar->visible();
+  
+  // try without scrollbars first
+  mVScrollBar->clear_visible();
+  mHScrollBar->clear_visible();
+  
+  for (int again = 1; again;) {
+    again = 0;
+    /* In continuous wrap mode, a change in width affects the total number of
+     lines in the buffer, and can leave the top line number incorrect, and
+     the top character no longer pointing at a valid line start */
+    if (mContinuousWrap && !mWrapMarginPix && W!=oldWidth) {
+      int oldFirstChar = mFirstChar;
+      mNBufferLines = count_lines(0, buffer()->length(), true);
+      mFirstChar = line_start(mFirstChar);
+      mTopLineNum = count_lines(0, mFirstChar, true)+1;
+      absolute_top_line_number(oldFirstChar);      
+#ifdef DEBUG
+      printf("    mNBufferLines=%d\n", mNBufferLines);
+#endif // DEBUG
+    }
+    
+    /* reallocate and update the line starts array, which may have changed
+     size and / or contents.  */
+    int nvlines = (text_area.h + mMaxsize - 1) / mMaxsize;
+    if (nvlines < 1) nvlines = 1;
+    if (mNVisibleLines != nvlines) {
+      mNVisibleLines = nvlines;
+      if (mLineStarts) delete[] mLineStarts;
+      mLineStarts = new int [mNVisibleLines];
+    }
+    
+    calc_line_starts(0, mNVisibleLines);
+    calc_last_char();
+    
+    // figure the scrollbars
+    if (scrollbar_width()) {
+      /* Decide if the vertical scrollbar needs to be visible */
+      if (scrollbar_align() & (fltk3::ALIGN_LEFT|fltk3::ALIGN_RIGHT) &&
+          mNBufferLines >= mNVisibleLines - 1)
+      {
+        mVScrollBar->set_visible();
+        if (scrollbar_align() & fltk3::ALIGN_LEFT) {
+          text_area.x = X+scrollbar_width()+LEFT_MARGIN;
+          text_area.w = W-scrollbar_width()-LEFT_MARGIN-RIGHT_MARGIN;
+          mVScrollBar->resize(X, text_area.y-TOP_MARGIN, scrollbar_width(),
+                              text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
+        } else {
+          text_area.x = X+LEFT_MARGIN;
+          text_area.w = W-scrollbar_width()-LEFT_MARGIN-RIGHT_MARGIN;
+          mVScrollBar->resize(X+W-scrollbar_width(), text_area.y-TOP_MARGIN,
+                              scrollbar_width(), text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
+        }
+      }
+      
+      /*
+       Decide if the horizontal scrollbar needs to be visible.  If there
+       is a vertical scrollbar, a horizontal is always created too.  This
+       is because the alternatives are unattractive:
+       * Dynamically creating a horizontal scrollbar based on the currently
+       visible lines is what the original nedit does, but it always wastes
+       space for the scrollbar even when it's not used.  Since the FLTK
+       widget dynamically allocates the space for the scrollbar and
+       rearranges the widget to make room for it, this would create a very
+       visually displeasing "bounce" effect when the vertical scrollbar is
+       dragged.  Trust me, I tried it and it looks really bad.
+       * The other alternative would be to keep track of what the longest
+       line in the entire buffer is and base the scrollbar on that.  I
+       didn't do this because I didn't see any easy way to do that using
+       the nedit code and this could involve a lengthy calculation for
+       large buffers.  If an efficient and non-costly way of doing this
+       can be found, this might be a way to go.
+       */
+      /* WAS: Suggestion: Try turning the horizontal scrollbar on when
+       you first see a line that is too wide in the window, but then
+       don't turn it off (ie mix both of your solutions). */
+      if (scrollbar_align() & (fltk3::ALIGN_TOP|fltk3::ALIGN_BOTTOM) &&
+          (mVScrollBar->visible() || longest_vline() > text_area.w))
+      {
+        if (!mHScrollBar->visible()) {
+          mHScrollBar->set_visible();
+          again = 1; // loop again to see if we now need vert. & recalc sizes
+        }
+        if (scrollbar_align() & fltk3::ALIGN_TOP) {
+          text_area.y = Y + scrollbar_width()+TOP_MARGIN;
+          text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+          mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y,
+                              text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
+        } else {
+          text_area.y = Y+TOP_MARGIN;
+          text_area.h = H - scrollbar_width()-TOP_MARGIN-BOTTOM_MARGIN;
+          mHScrollBar->resize(text_area.x-LEFT_MARGIN, Y+H-scrollbar_width(),
+                              text_area.w+LEFT_MARGIN+RIGHT_MARGIN, scrollbar_width());
+        }
+      }
+    }
+  }
+  
+  // user request to change viewport
+  if (mTopLineNumHint != mTopLineNum || mHorizOffsetHint != mHorizOffset)
+    scroll_(mTopLineNumHint, mHorizOffsetHint);
+  
+  // everything will fit in the viewport
+  if (mNBufferLines < mNVisibleLines || mBuffer == NULL || mBuffer->length() == 0) {
+    scroll_(1, mHorizOffset);
+  /* if empty lines become visible, there may be an opportunity to
+   display more text by scrolling down */
+  } else {
+    while (   mNVisibleLines>=2
+           && (mLineStarts[mNVisibleLines-2]==-1) 
+           && scroll_(mTopLineNum-1, mHorizOffset))
+    { }
+  }
+  
+  // user request to display insert position
+  if (display_insert_position_hint)
+    display_insert();
+  
+  // in case horizontal offset is now greater than longest line
+  int maxhoffset = max(0, longest_vline()-text_area.w);
+  if (mHorizOffset > maxhoffset)
+    scroll_(mTopLineNumHint, maxhoffset);
+  
+  mTopLineNumHint = mTopLineNum;
+  mHorizOffsetHint = mHorizOffset;
+  display_insert_position_hint = 0;
+  
+  if (mContinuousWrap ||
+      hscrollbarvisible != mHScrollBar->visible() ||
+      vscrollbarvisible != mVScrollBar->visible())
+    redraw();
+  
+  update_v_scrollbar();
+  update_h_scrollbar();
+}
+
+
+
+/**
+ \brief Refresh a rectangle of the text display.  
+ \param left, top are in coordinates of the text drawing window.
+ \param width, height size in pixels 
+ */
+void fltk3::TextDisplay::draw_text( int left, int top, int width, int height ) {
+  int fontHeight, firstLine, lastLine, line;
+  
+  /* find the line number range of the display */
+  fontHeight = mMaxsize ? mMaxsize : textsize();
+  firstLine = ( top - text_area.y - fontHeight + 1 ) / fontHeight;
+  lastLine = ( top + height - text_area.y ) / fontHeight + 1;
+  
+  fltk3::push_clip( left, top, width, height );
+  
+  /* draw the lines */
+  for ( line = firstLine; line <= lastLine; line++ )
+    draw_vline( line, left, left + width, 0, INT_MAX );
+  
+  /* draw the line numbers if exposed area includes them */
+  if (mLineNumWidth != 0 && left <= mLineNumLeft + mLineNumWidth)
+    draw_line_numbers(false);
+  
+  fltk3::pop_clip();
+}
+
+
+
+/**  
+ \brief Marks text from start to end as needing a redraw.
+ This function will trigger a damage event and later a redraw of parts of 
+ the widget.
+ \param startpos index of first character needing redraw
+ \param endpos index after last character needing redraw
+ */
+void fltk3::TextDisplay::redisplay_range(int startpos, int endpos) {
+  IS_UTF8_ALIGNED2(buffer(), startpos)
+  IS_UTF8_ALIGNED2(buffer(), endpos)
+  
+  if (damage_range1_start == -1 && damage_range1_end == -1) {
+    damage_range1_start = startpos;
+    damage_range1_end = endpos;
+  } else if ((startpos >= damage_range1_start && startpos <= damage_range1_end) ||
+             (endpos >= damage_range1_start && endpos <= damage_range1_end)) {
+    damage_range1_start = min(damage_range1_start, startpos);
+    damage_range1_end = max(damage_range1_end, endpos);
+  } else if (damage_range2_start == -1 && damage_range2_end == -1) {
+    damage_range2_start = startpos;
+    damage_range2_end = endpos;
+  } else {
+    damage_range2_start = min(damage_range2_start, startpos);
+    damage_range2_end = max(damage_range2_end, endpos);
+  }
+  damage(fltk3::DAMAGE_SCROLL);
+}
+
+
+
+/**
+ \brief Draw a range of text.
+
+ Refresh all of the text between buffer positions \p startpos and
+ \p endpos not including the character at the position \p endpos.
+
+ If \p endpos points beyond the end of the buffer, refresh the whole display
+ after \p startpos, including blank lines which are not technically part of
+ any range of characters.
+
+ \param startpos index of first character to draw
+ \param endpos index after last character to draw
+ */
+void fltk3::TextDisplay::draw_range(int startpos, int endpos) {
+  startpos = buffer()->utf8_align(startpos);
+  endpos = buffer()->utf8_align(endpos);
+  
+  int i, startLine, lastLine, startIndex, endIndex;
+  
+  /* If the range is outside of the displayed text, just return */
+  if ( endpos < mFirstChar || ( startpos > mLastChar && !empty_vlines() ) ) 
+    return;
+  
+  /* Clean up the starting and ending values */
+  if ( startpos < 0 ) startpos = 0;
+  if ( startpos > mBuffer->length() ) startpos = mBuffer->length();
+  if ( endpos < 0 ) endpos = 0;
+  if ( endpos > mBuffer->length() ) endpos = mBuffer->length();
+  
+  /* Get the starting and ending lines */
+  if ( startpos < mFirstChar )
+    startpos = mFirstChar;
+  if ( !position_to_line( startpos, &startLine ) )
+    startLine = mNVisibleLines - 1;
+  if ( endpos >= mLastChar ) {
+    lastLine = mNVisibleLines - 1;
+  } else {
+    if ( !position_to_line( endpos, &lastLine ) ) {
+      /* shouldn't happen */
+      lastLine = mNVisibleLines - 1;
+    }
+  }
+  
+  /* Get the starting and ending positions within the lines */
+  startIndex = mLineStarts[ startLine ] == -1 ? 0 : startpos - mLineStarts[ startLine ];
+  if ( endpos >= mLastChar )
+    endIndex = INT_MAX;
+  else if ( mLineStarts[ lastLine ] == -1 )
+    endIndex = 0;
+  else
+    endIndex = endpos - mLineStarts[ lastLine ];
+  
+  /* If the starting and ending lines are the same, redisplay the single
+   line between "start" and "end" */
+  if ( startLine == lastLine ) {
+    draw_vline( startLine, 0, INT_MAX, startIndex, endIndex );
+    return;
+  }
+
+  /* Redisplay the first line from "start" */
+  draw_vline( startLine, 0, INT_MAX, startIndex, INT_MAX );
+
+  /* Redisplay the lines in between at their full width */
+  for ( i = startLine + 1; i < lastLine; i++ )
+    draw_vline( i, 0, INT_MAX, 0, INT_MAX );
+
+  /* Redisplay the last line to "end" */
+  draw_vline( lastLine, 0, INT_MAX, 0, endIndex );
+}
+
+
+
+/** 
+ \brief Sets the position of the text insertion cursor for text display.
+ Move the insertion cursor in front of the character at \p newPos.
+ This function may trigger a redraw.
+ \param newPos new caret position
+ */
+void fltk3::TextDisplay::insert_position( int newPos ) {
+  IS_UTF8_ALIGNED2(buffer(), newPos)
+  
+  /* make sure new position is ok, do nothing if it hasn't changed */
+  if ( newPos == mCursorPos ) return;
+  if ( newPos < 0 ) newPos = 0;
+  if ( newPos > mBuffer->length() ) newPos = mBuffer->length();
+  
+  /* cursor movement cancels vertical cursor motion column */
+  mCursorPreferredXPos = -1;
+  
+  /* erase the cursor at its previous position */
+  redisplay_range(buffer()->prev_char_clipped(mCursorPos), buffer()->next_char(mCursorPos));
+  
+  mCursorPos = newPos;
+  
+  /* draw cursor at its new position */
+  redisplay_range(buffer()->prev_char_clipped(mCursorPos), buffer()->next_char(mCursorPos));
+}
+
+
+
+/** 
+ \brief Shows the text cursor.
+ This function may trigger a redraw.
+ \param b show(1) or hide(0) the text cursor (caret).
+ */
+void fltk3::TextDisplay::show_cursor(int b) {
+  mCursorOn = b;
+  redisplay_range(buffer()->prev_char_clipped(mCursorPos), buffer()->next_char(mCursorPos));
+}
+
+
+
+/**
+ \brief Sets the text cursor style.
+ Sets the text cursor style to one of the following:
+ 
+ \li fltk3::TextDisplay::NORMAL_CURSOR - Shows an I beam.
+ \li fltk3::TextDisplay::CARET_CURSOR - Shows a caret under the text.
+ \li fltk3::TextDisplay::DIM_CURSOR - Shows a dimmed I beam.
+ \li fltk3::TextDisplay::BLOCK_CURSOR - Shows an unfilled box around the current
+      character.
+ \li fltk3::TextDisplay::HEAVY_CURSOR - Shows a thick I beam.
+ 
+ This call also switches the cursor on and may trigger a redraw.
+ 
+ \param style new cursor style
+ */
+void fltk3::TextDisplay::cursor_style(int style) {
+  mCursorStyle = style;
+  if (mCursorOn) show_cursor();
+}
+
+
+
+/**
+ \brief Set the new text wrap mode.
+ 
+ If \p wrap mode is not zero, this call enables automatic word wrapping at column
+ \p wrapMargin. Word-wrapping does not change the text buffer itself, only the way
+ the text is displayed. Different Text Displays can have different wrap modes,
+ even if they share the same Text Buffer.
+
+ \param wrap new wrap mode is WRAP_NONE (don't wrap text at all), WRAP_AT_COLUMN
+      (wrap text at the given text column), WRAP_AT_PIXEL (wrap text at a pixel 
+      position), or WRAP_AT_BOUNDS (wrap text so that it fits into the 
+      widget width)
+ \param wrapMargin in WRAP_AT_COLUMN mode, text will wrap at the n'th character.
+      For variable width fonts, an average character width is calculated. The
+      column width is calculated using the current textfont or the first style
+      when this function is called. If the font size changes, this function
+      must be called again. In WRAP_AT_PIXEL mode, this is the pixel position.
+ \todo we need new wrap modes to wrap at the window edge and based on pixel width
+   or average character width.
+ */
+void fltk3::TextDisplay::wrap_mode(int wrap, int wrapMargin) {
+  switch (wrap) {
+    case WRAP_NONE: 
+      mWrapMarginPix = 0;
+      mContinuousWrap = 0;
+      break;
+    case WRAP_AT_COLUMN: 
+    default:
+      mWrapMarginPix = int(col_to_x(wrapMargin));
+      mContinuousWrap = 1;
+      break;
+    case WRAP_AT_PIXEL: 
+      mWrapMarginPix = wrapMargin;
+      mContinuousWrap = 1;
+      break;
+    case WRAP_AT_BOUNDS: 
+      mWrapMarginPix = 0;
+      mContinuousWrap = 1;
+      break;
+  }
+  
+  if (buffer()) {
+    /* wrapping can change the total number of lines, re-count */
+    mNBufferLines = count_lines(0, buffer()->length(), true);
+    
+    /* changing wrap margins or changing from wrapped mode to non-wrapped
+     can leave the character at the top no longer at a line start, and/or
+     change the line number */
+    mFirstChar = line_start(mFirstChar);
+    mTopLineNum = count_lines(0, mFirstChar, true) + 1;
+    
+    reset_absolute_top_line_number();
+    
+    /* update the line starts array */
+    calc_line_starts(0, mNVisibleLines);
+    calc_last_char();
+  } else {
+    // No buffer, so just clear the state info for later...
+    mNBufferLines  = 0;
+    mFirstChar     = 0;
+    mTopLineNum    = 1;
+    mAbsTopLineNum = 0;
+  }
+  
+  resize(x(), y(), w(), h());
+}
+
+
+
+/**
+ \brief Inserts "text" at the current cursor location.  
+ 
+ This has the same effect as inserting the text into the buffer using BufInsert 
+ and then moving the insert position after the newly inserted text, except
+ that it's optimized to do less redrawing.
+ 
+ \param text new text in UTF-8 encoding.
+ */
+void fltk3::TextDisplay::insert(const char* text) {
+  IS_UTF8_ALIGNED2(buffer(), mCursorPos)
+  IS_UTF8_ALIGNED(text)
+  
+  int pos = mCursorPos;
+  
+  mCursorToHint = pos + strlen( text );
+  mBuffer->insert( pos, text );
+  mCursorToHint = NO_HINT;
+}
+
+
+
+/**  
+ \brief Replaces text at the current insert position.
+ \param text new text in UTF-8 encoding
+ 
+ \todo Unicode? Find out exactly what we do here and simplify.
+ */
+void fltk3::TextDisplay::overstrike(const char* text) {
+  IS_UTF8_ALIGNED2(buffer(), mCursorPos)
+  IS_UTF8_ALIGNED(text)
+  
+  int startPos = mCursorPos;
+  fltk3::TextBuffer *buf = mBuffer;
+  int lineStart = buf->line_start( startPos );
+  int textLen = strlen( text );
+  int i, p, endPos, indent, startIndent, endIndent;
+  const char *c;
+  unsigned int ch;
+  char *paddedText = NULL;
+  
+  /* determine how many displayed character positions are covered */
+  startIndent = mBuffer->count_displayed_characters( lineStart, startPos );
+  indent = startIndent;
+  for ( c = text; *c != '\0'; c += fltk3::utf8len1(*c) )
+    indent++;
+  endIndent = indent;
+  
+  /* find which characters to remove, and if necessary generate additional
+   padding to make up for removed control characters at the end */
+  indent = startIndent;
+  for ( p = startPos; ; p=buffer()->next_char(p) ) {
+    if ( p == buf->length() )
+      break;
+    ch = buf->char_at( p );
+    if ( ch == '\n' )
+      break;
+    indent++;
+    if ( indent == endIndent ) {
+      p++;
+      break;
+    } else if ( indent > endIndent ) {
+      if ( ch != '\t' ) {
+        p++;
+        paddedText = new char [ textLen + 20 + 1 ];
+        strcpy( paddedText, text );
+        for ( i = 0; i < indent - endIndent; i++ )
+          paddedText[ textLen + i ] = ' ';
+        paddedText[ textLen + i ] = '\0';
+      }
+      break;
+    }
+  }
+  endPos = p;
+  
+  mCursorToHint = startPos + textLen;
+  buf->replace( startPos, endPos, paddedText == NULL ? text : paddedText );
+  mCursorToHint = NO_HINT;
+  if ( paddedText != NULL )
+    delete [] paddedText;
+}
+
+
+
+/**
+ \brief Convert a character index into a pixel position.
+ 
+ Translate a buffer text position to the XY location where the top left of the 
+ cursor would be positioned to point to that character. Returns 0 if the 
+ position is not displayed because it is \e \b vertically out of view.
+ If the position is horizontally out of view, returns the X coordinate where
+ the position would be if it were visible.
+
+ \param pos character index
+ \param[out] X, Y pixel position of character on screen
+ \return 0 if character vertically out of view, X position otherwise
+ */
+int fltk3::TextDisplay::position_to_xy( int pos, int* X, int* Y ) const {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int lineStartPos, fontHeight, lineLen;
+  int visLineNum;
+  
+  /* If position is not displayed, return false */
+  if (pos < mFirstChar || (pos > mLastChar && !empty_vlines())) {
+    return 0;
+  }
+  
+  /* Calculate Y coordinate */
+  if (!position_to_line(pos, &visLineNum)) {
+    return 0;
+  }
+  if (visLineNum < 0 || visLineNum > mNBufferLines) {
+    return 0;
+  }
+  
+  fontHeight = mMaxsize;
+  *Y = text_area.y + visLineNum * fontHeight;
+  
+  /* Get the text, length, and buffer position of the line. If the position
+   is beyond the end of the buffer and should be at the first position on
+   the first empty line, don't try to get or scan the text  */
+  lineStartPos = mLineStarts[visLineNum];
+  if ( lineStartPos == -1 ) {
+    *X = text_area.x - mHorizOffset;
+    return 1;
+  }
+  lineLen = vline_length( visLineNum );
+  *X = text_area.x + handle_vline(GET_WIDTH, lineStartPos, pos-lineStartPos, 0, 0, 0, 0, 0, 0) - mHorizOffset;
+  return 1;
+}
+
+
+
+/**
+ \brief Find the line and column number of position \p pos.  
+
+ This only works for displayed lines. If the line is not displayed, the 
+ function returns 0 (without the mLineStarts array it could turn in to very long
+ calculation involving scanning large amounts of text in the buffer).
+ If continuous wrap mode is on, returns the absolute line number (as opposed
+ to the wrapped line number which is used for scrolling).
+ 
+ \param pos character index
+ \param[out] lineNum absolute (unwrapped) line number
+ \param[out] column character offset to the beginning of the line
+ \return 0 if \p pos is off screen, line number otherwise
+ \todo a column number makes little sense in the UTF-8/variable font width 
+    environment. We will have to further define what exactly we want to return. 
+    Please check the functions that call this particular function.
+ */
+int fltk3::TextDisplay::position_to_linecol( int pos, int* lineNum, int* column ) const {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+  
+  int retVal;
+  
+  /* In continuous wrap mode, the absolute (non-wrapped) line count is
+   maintained separately, as needed.  Only return it if we're actually
+   keeping track of it and pos is in the displayed text */
+  if (mContinuousWrap) {
+    if (!maintaining_absolute_top_line_number() || pos < mFirstChar || pos > mLastChar)
+      return 0;
+    *lineNum = mAbsTopLineNum + buffer()->count_lines(mFirstChar, pos);
+    *column = buffer()->count_displayed_characters(buffer()->line_start(pos), pos);
+    return 1;
+  }
+  
+  retVal = position_to_line( pos, lineNum );
+  if ( retVal ) {
+    *column = mBuffer->count_displayed_characters( mLineStarts[ *lineNum ], pos );
+    *lineNum += mTopLineNum;
+  }
+  return retVal;
+}
+
+
+
+/**
+ \brief Check if a pixel position is within the primary selection.
+ \param X, Y pixel position to test
+ \return 1 if position (X, Y) is inside of the primary fltk3::TextSelection
+ */
+int fltk3::TextDisplay::in_selection( int X, int Y ) const {
+  int pos = xy_to_position( X, Y, CHARACTER_POS );
+  IS_UTF8_ALIGNED2(buffer(), pos)
+  fltk3::TextBuffer *buf = mBuffer;
+  return buf->primary_selection()->includes(pos);
+}
+
+
+
+/**
+ \brief Nobody knows what this function does.
+ 
+ Correct a column number based on an unconstrained position (as returned by
+ TextDXYToUnconstrainedPosition) to be relative to the last actual newline
+ in the buffer before the row and column position given, rather than the
+ last line start created by line wrapping.  This is an adapter
+ for rectangular selections and code written before continuous wrap mode,
+ which thinks that the unconstrained column is the number of characters
+ from the last newline.  Obviously this is time consuming, because it
+ invloves character re-counting.
+ 
+ \param row
+ \param column
+ \return something unknown
+ \todo What does this do and how is it useful? Column numbers mean little in 
+    this context. Which functions depend on this one?
+ 
+ \todo Unicode?
+ */
+int fltk3::TextDisplay::wrapped_column(int row, int column) const {
+  int lineStart, dispLineStart;
+  
+  if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
+    return column;
+  dispLineStart = mLineStarts[row];
+  if (dispLineStart == -1)
+    return column;
+  lineStart = buffer()->line_start(dispLineStart);
+  return column + buffer()->count_displayed_characters(lineStart, dispLineStart);
+}
+
+
+
+/**
+ \brief Nobody knows what this function does.
+ 
+ Correct a row number from an unconstrained position (as returned by
+ TextDXYToUnconstrainedPosition) to a straight number of newlines from the
+ top line of the display.  Because rectangular selections are based on
+ newlines, rather than display wrapping, and anywhere a rectangular selection
+ needs a row, it needs it in terms of un-wrapped lines.
+ 
+ \param row
+ \return something unknown
+ \todo What does this do and how is it useful? Column numbers mean little in 
+ this context. Which functions depend on this one?
+ */
+int fltk3::TextDisplay::wrapped_row(int row) const {
+  if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
+    return row;
+  return buffer()->count_lines(mFirstChar, mLineStarts[row]);
+}
+
+
+
+/**
+ \brief Scroll the display to bring insertion cursor into view.
+
+ Note: it would be nice to be able to do this without counting lines twice
+ (scroll_() counts them too) and/or to count from the most efficient
+ starting point, but the efficiency of this routine is not as important to
+ the overall performance of the text display.
+ 
+ \todo Unicode?
+ */
+void fltk3::TextDisplay::display_insert() {
+  int hOffset, topLine, X, Y;
+  hOffset = mHorizOffset;
+  topLine = mTopLineNum;
+  
+  if (insert_position() < mFirstChar) {
+    topLine -= count_lines(insert_position(), mFirstChar, false);
+  } else if (mNVisibleLines>=2 && mLineStarts[mNVisibleLines-2] != -1) {
+    int lastChar = line_end(mLineStarts[mNVisibleLines-2],true);
+    if (insert_position() >= lastChar)
+      topLine += count_lines(lastChar - (wrap_uses_character(mLastChar) ? 0 : 1),
+                             insert_position(), false);
+  }
+  
+  /* Find the new setting for horizontal offset (this is a bit ungraceful).
+   If the line is visible, just use PositionToXY to get the position
+   to scroll to, otherwise, do the vertical scrolling first, then the
+   horizontal */
+  if (!position_to_xy( mCursorPos, &X, &Y )) {
+    scroll_(topLine, hOffset);
+    if (!position_to_xy( mCursorPos, &X, &Y )) {
+#ifdef DEBUG
+      printf ("*** display_insert/position_to_xy # GIVE UP !\n"); fflush(stdout);
+#endif // DEBUG
+      return;   /* Give up, it's not worth it (but why does it fail?) */
+    }
+  }
+  if (X > text_area.x + text_area.w)
+    hOffset += X-(text_area.x + text_area.w);
+  else if (X < text_area.x)
+    hOffset += X-text_area.x;
+  
+  /* Do the scroll */
+  if (topLine != mTopLineNum || hOffset != mHorizOffset)
+    scroll_(topLine, hOffset);
+}
+
+
+/**  
+ \brief Scrolls the text buffer to show the current insert position.
+ This function triggers a complete recalculation, ending in a call to 
+ fltk3::TextDisplay::display_insert()
+ */
+void fltk3::TextDisplay::show_insert_position() {
+  display_insert_position_hint = 1;
+  resize(x(), y(), w(), h());
+}
+
+
+/*
+ Cursor movement functions
+ */
+
+/**  
+ \brief Moves the current insert position right one character.
+ \return 1 if the cursor moved, 0 if the end of the text was reached
+ */
+int fltk3::TextDisplay::move_right() {
+  if ( mCursorPos >= mBuffer->length() )
+    return 0;
+  int p = insert_position();
+  int q = buffer()->next_char(p);
+  insert_position(q);
+  return 1;
+}
+
+
+
+/**  
+ \brief Moves the current insert position left one character.
+ \return 1 if the cursor moved, 0 if the beginning of the text was reached
+ */
+int fltk3::TextDisplay::move_left() {
+  if ( mCursorPos <= 0 )
+    return 0;
+  int p = insert_position();
+  int q = buffer()->prev_char_clipped(p);
+  insert_position(q);
+  return 1;
+}
+
+
+
+/** 
+ \brief Moves the current insert position up one line.
+ \return 1 if the cursor moved, 0 if the beginning of the text was reached
+ */
+int fltk3::TextDisplay::move_up() {
+  int lineStartPos, xPos, prevLineStartPos, newPos, visLineNum;
+  
+  /* Find the position of the start of the line.  Use the line starts array
+   if possible */
+  if ( position_to_line( mCursorPos, &visLineNum ) )
+    lineStartPos = mLineStarts[ visLineNum ];
+  else {
+    lineStartPos = line_start( mCursorPos );
+    visLineNum = -1;
+  }
+  if ( lineStartPos == 0 )
+    return 0;
+  
+  /* Decide what column to move to, if there's a preferred column use that */
+  if (mCursorPreferredXPos >= 0)
+    xPos = mCursorPreferredXPos;
+  else
+    xPos = handle_vline(GET_WIDTH, lineStartPos, mCursorPos-lineStartPos, 
+                        0, 0, 0, 0, 0, INT_MAX);
+  
+  /* count forward from the start of the previous line to reach the column */
+  if ( visLineNum != -1 && visLineNum != 0 )
+    prevLineStartPos = mLineStarts[ visLineNum - 1 ];
+  else
+    prevLineStartPos = rewind_lines( lineStartPos, 1 );
+  
+  int lineEnd = line_end(prevLineStartPos, true);
+  newPos = handle_vline(FIND_INDEX_FROM_ZERO, prevLineStartPos, lineEnd-prevLineStartPos, 
+                        0, 0, 0, 0, 0, xPos);
+  
+  /* move the cursor */
+  insert_position( newPos );
+  
+  /* if a preferred column wasn't aleady established, establish it */
+  mCursorPreferredXPos = xPos;
+  return 1;
+}
+
+
+
+/** 
+ \brief Moves the current insert position down one line.
+ \return 1 if the cursor moved, 0 if the beginning of the text was reached
+ */
+int fltk3::TextDisplay::move_down() {
+  int lineStartPos, xPos, newPos, visLineNum;
+  
+  if ( mCursorPos == mBuffer->length() )
+    return 0;
+  
+  if ( position_to_line( mCursorPos, &visLineNum ) )
+    lineStartPos = mLineStarts[ visLineNum ];
+  else {
+    lineStartPos = line_start( mCursorPos );
+    visLineNum = -1;
+  }
+  if (mCursorPreferredXPos >= 0) {
+    xPos = mCursorPreferredXPos;
+  } else {
+    xPos = handle_vline(GET_WIDTH, lineStartPos, mCursorPos-lineStartPos, 
+                        0, 0, 0, 0, 0, INT_MAX);
+  }
+  
+  int nextLineStartPos = skip_lines( lineStartPos, 1, true );
+  int lineEnd = line_end(nextLineStartPos, true);
+  newPos = handle_vline(FIND_INDEX_FROM_ZERO, nextLineStartPos, lineEnd-nextLineStartPos, 
+                        0, 0, 0, 0, 0, xPos);
+  
+  insert_position( newPos );
+  mCursorPreferredXPos = xPos;
+  return 1;
+}
+
+
+
+/**
+ \brief Count the number of lines between two positions.
+
+ Same as BufCountLines, but takes into account wrapping if wrapping is
+ turned on.  If the caller knows that \p startPos is at a line start, it
+ can pass \p startPosIsLineStart as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
+
+ \param startPos index to first character
+ \param endPos index after last character
+ \param startPosIsLineStart avoid scanning back to the line start
+ \return number of lines
+ */
+int fltk3::TextDisplay::count_lines(int startPos, int endPos,
+                                 bool startPosIsLineStart) const {
+  IS_UTF8_ALIGNED2(buffer(), startPos)
+  IS_UTF8_ALIGNED2(buffer(), endPos)
+  
+  int retLines, retPos, retLineStart, retLineEnd;
+  
+#ifdef DEBUG
+  printf("fltk3::TextDisplay::count_lines(startPos=%d, endPos=%d, startPosIsLineStart=%d\n",
+         startPos, endPos, startPosIsLineStart);
+#endif // DEBUG
+  
+  /* If we're not wrapping use simple (and more efficient) BufCountLines */
+  if (!mContinuousWrap)
+    return buffer()->count_lines(startPos, endPos);
+  
+  wrapped_line_counter(buffer(), startPos, endPos, INT_MAX,
+                       startPosIsLineStart, 0, &retPos, &retLines, &retLineStart,
+                       &retLineEnd);
+  
+#ifdef DEBUG
+  printf("   # after WLC: retPos=%d, retLines=%d, retLineStart=%d, retLineEnd=%d\n",
+         retPos, retLines, retLineStart, retLineEnd);
+#endif // DEBUG
+  
+  return retLines;
+}
+
+
+
+/**
+ \brief Skip a number of lines forward.
+
+ Same as BufCountForwardNLines, but takes into account line breaks when
+ wrapping is turned on. If the caller knows that startPos is at a line start,
+ it can pass "startPosIsLineStart" as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
+ 
+ \param startPos index to starting character
+ \param nLines number of lines to skip ahead
+ \param startPosIsLineStart avoid scanning back to the line start
+ \return new position as index
+ */
+int fltk3::TextDisplay::skip_lines(int startPos, int nLines,
+                                bool startPosIsLineStart) {
+  IS_UTF8_ALIGNED2(buffer(), startPos)
+
+  int retLines, retPos, retLineStart, retLineEnd;
+  
+  /* if we're not wrapping use more efficient BufCountForwardNLines */
+  if (!mContinuousWrap)
+    return buffer()->skip_lines(startPos, nLines);
+  
+  /* wrappedLineCounter can't handle the 0 lines case */
+  if (nLines == 0)
+    return startPos;
+  
+  /* use the common line counting routine to count forward */
+  wrapped_line_counter(buffer(), startPos, buffer()->length(),
+                       nLines, startPosIsLineStart, 0, 
+                       &retPos, &retLines, &retLineStart, &retLineEnd);
+  IS_UTF8_ALIGNED2(buffer(), retPos)
+  return retPos;
+}
+
+
+
+/**
+ \brief Returns the end of a line.
+ 
+ Same as BufEndOfLine, but takes into account line breaks when wrapping
+ is turned on.  If the caller knows that \p startPos is at a line start, it
+ can pass "startPosIsLineStart" as True to make the call more efficient
+ by avoiding the additional step of scanning back to the last newline.
+
+ Note that the definition of the end of a line is less clear when continuous
+ wrap is on.  With continuous wrap off, it's just a pointer to the newline
+ that ends the line.  When it's on, it's the character beyond the last
+ \b displayable character on the line, where a whitespace character which has
+ been "converted" to a newline for wrapping is not considered displayable.
+ Also note that a line can be wrapped at a non-whitespace character if the
+ line had no whitespace.  In this case, this routine returns a pointer to
+ the start of the next line.  This is also consistent with the model used by
+ visLineLength.
+ 
+ \param startPos index to starting character
+ \param startPosIsLineStart avoid scanning back to the line start
+ \return new position as index
+ */
+int fltk3::TextDisplay::line_end(int startPos, bool startPosIsLineStart) const {
+  IS_UTF8_ALIGNED2(buffer(), startPos)
+
+  int retLines, retPos, retLineStart, retLineEnd;
+  
+  /* If we're not wrapping use more efficient BufEndOfLine */
+  if (!mContinuousWrap)
+    return buffer()->line_end(startPos);
+  
+  if (startPos == buffer()->length())
+    return startPos;
+  
+  wrapped_line_counter(buffer(), startPos, buffer()->length(), 1,
+                       startPosIsLineStart, 0, &retPos, &retLines, &retLineStart,
+                       &retLineEnd);
+  
+  IS_UTF8_ALIGNED2(buffer(), retLineEnd)
+  return retLineEnd;
+}
+
+
+
+/**
+ \brief Return the beginning of a line.
+
+ Same as BufStartOfLine, but returns the character after last wrap point
+ rather than the last newline.
+ 
+ \param pos index to starting character
+ \return new position as index
+ */
+int fltk3::TextDisplay::line_start(int pos) const {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int retLines, retPos, retLineStart, retLineEnd;
+  
+  /* If we're not wrapping, use the more efficient BufStartOfLine */
+  if (!mContinuousWrap)
+    return buffer()->line_start(pos);
+  
+  wrapped_line_counter(buffer(), buffer()->line_start(pos), pos, INT_MAX, true, 0,
+                       &retPos, &retLines, &retLineStart, &retLineEnd);
+
+  IS_UTF8_ALIGNED2(buffer(), retLineStart)
+  return retLineStart;
+}
+
+
+
+/**
+ \brief Skip a number of lines back.
+
+ Same as BufCountBackwardNLines, but takes into account line breaks when
+ wrapping is turned on.
+
+ \param startPos index to starting character
+ \param nLines number of lines to skip back
+ \return new position as index
+ */
+int fltk3::TextDisplay::rewind_lines(int startPos, int nLines) {
+  IS_UTF8_ALIGNED2(buffer(), startPos)
+
+  fltk3::TextBuffer *buf = buffer();
+  int pos, lineStart, retLines, retPos, retLineStart, retLineEnd;
+  
+  /* If we're not wrapping, use the more efficient BufCountBackwardNLines */
+  if (!mContinuousWrap)
+    return buf->rewind_lines(startPos, nLines);
+  
+  pos = startPos;
+  for (;;) {
+    lineStart = buf->line_start(pos);
+    wrapped_line_counter(buf, lineStart, pos, INT_MAX, true, 0, 
+                         &retPos, &retLines, &retLineStart, &retLineEnd, false);
+    if (retLines > nLines)
+      return skip_lines(lineStart, retLines-nLines, true);
+    nLines -= retLines;
+    pos = lineStart - 1;
+    if (pos < 0)
+      return 0;
+    nLines -= 1;
+  }
+}
+
+
+
+static inline int fl_isseparator(unsigned int c) {
+  // FIXME: this does not take UCS-4 encoding into account
+  return c != '$' && c != '_' && (isspace(c) || ispunct(c));
+}
+
+
+
+/**   
+ \brief Moves the current insert position right one word.
+ */
+void fltk3::TextDisplay::next_word() {
+  int pos = insert_position();
+
+  while (pos < buffer()->length() && !fl_isseparator(buffer()->char_at(pos))) {
+    pos = buffer()->next_char(pos);
+  }
+
+  while (pos < buffer()->length() && fl_isseparator(buffer()->char_at(pos))) {
+    pos = buffer()->next_char(pos);
+  }
+  
+  insert_position( pos );
+}
+
+
+
+/**  
+ \brief Moves the current insert position left one word.
+ */
+void fltk3::TextDisplay::previous_word() {
+  int pos = insert_position();
+  if (pos==0) return;
+  pos = buffer()->prev_char(pos);
+
+  while (pos && fl_isseparator(buffer()->char_at(pos))) {
+    pos = buffer()->prev_char(pos);
+  }
+
+  while (pos && !fl_isseparator(buffer()->char_at(pos))) {
+    pos = buffer()->prev_char(pos);
+  }
+
+  if (fl_isseparator(buffer()->char_at(pos))) {
+    pos = buffer()->next_char(pos);
+  }
+  
+  insert_position( pos );
+}
+
+
+
+/**
+ \brief This is called before any characters are deleted.
+ 
+ Callback attached to the text buffer to receive delete information before
+ the modifications are actually made.
+ 
+ \param pos starting index of deletion
+ \param nDeleted number of bytes we will delete (must be UTF-8 aligned!)
+ \param cbArg "this" pointer for static callback function
+ */
+void fltk3::TextDisplay::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) {
+  fltk3::TextDisplay *textD = (fltk3::TextDisplay *)cbArg;
+  if (textD->mContinuousWrap) {
+  /* Note: we must perform this measurement, even if there is not a
+   single character deleted; the number of "deleted" lines is the
+   number of visual lines spanned by the real line in which the
+   modification takes place.
+   Also, a modification of the tab distance requires the same
+   kind of calculations in advance, even if the font width is "fixed",
+   because when the width of the tab characters changes, the layout
+   of the text may be completely different. */
+    IS_UTF8_ALIGNED2(textD->buffer(), pos)
+    textD->measure_deleted_lines(pos, nDeleted);
+  } else {
+    textD->mSuppressResync = 0; /* Probably not needed, but just in case */
+  }
+}
+
+
+
+/**
+ \brief This is called whenever the buffer is modified.
+ 
+ Callback attached to the text buffer to receive modification information
+
+ \param pos starting index of modification
+ \param nInserted number of bytes we inserted (must be UTF-8 aligned!)
+ \param nDeleted number of bytes deleted (must be UTF-8 aligned!)
+ \param nRestyled ??
+ \param deletedText this is what was removed, must not be NULL if nDeleted is set
+ \param cbArg "this" pointer for static callback function
+ */
+void fltk3::TextDisplay::buffer_modified_cb( int pos, int nInserted, int nDeleted,
+                                         int nRestyled, const char *deletedText, void *cbArg ) {
+  int linesInserted, linesDeleted, startDispPos, endDispPos;
+  fltk3::TextDisplay *textD = ( fltk3::TextDisplay * ) cbArg;
+  fltk3::TextBuffer *buf = textD->mBuffer;
+  int oldFirstChar = textD->mFirstChar;
+  int scrolled, origCursorPos = textD->mCursorPos;
+  int wrapModStart = 0, wrapModEnd = 0;
+
+  IS_UTF8_ALIGNED2(buf, pos)
+  IS_UTF8_ALIGNED2(buf, oldFirstChar)
+  
+  /* buffer modification cancels vertical cursor motion column */
+  if ( nInserted != 0 || nDeleted != 0 )
+    textD->mCursorPreferredXPos = -1;
+  
+  /* Count the number of lines inserted and deleted, and in the case
+   of continuous wrap mode, how much has changed */
+  if (textD->mContinuousWrap) {
+    textD->find_wrap_range(deletedText, pos, nInserted, nDeleted,
+                           &wrapModStart, &wrapModEnd, &linesInserted, &linesDeleted);
+  } else {
+    linesInserted = nInserted == 0 ? 0 : buf->count_lines( pos, pos + nInserted );
+    linesDeleted = nDeleted == 0 ? 0 : countlines( deletedText );
+  }
+  
+  /* Update the line starts and mTopLineNum */
+  if ( nInserted != 0 || nDeleted != 0 ) {
+    if (textD->mContinuousWrap) {
+      textD->update_line_starts( wrapModStart, wrapModEnd-wrapModStart,
+                                nDeleted + pos-wrapModStart + (wrapModEnd-(pos+nInserted)),
+                                linesInserted, linesDeleted, &scrolled );
+    } else {
+      textD->update_line_starts( pos, nInserted, nDeleted, linesInserted,
+                                linesDeleted, &scrolled );
+    }
+  } else
+    scrolled = 0;
+  
+  /* If we're counting non-wrapped lines as well, maintain the absolute
+   (non-wrapped) line number of the text displayed */
+  if (textD->maintaining_absolute_top_line_number() &&
+      (nInserted != 0 || nDeleted != 0)) {
+    if (deletedText && (pos + nDeleted < oldFirstChar))
+      textD->mAbsTopLineNum += buf->count_lines(pos, pos + nInserted) -
+                               countlines(deletedText);
+    else if (pos < oldFirstChar)
+      textD->reset_absolute_top_line_number();
+  }    	    
+  
+  /* Update the line count for the whole buffer */
+  textD->mNBufferLines += linesInserted - linesDeleted;
+  
+  /* Update the cursor position */
+  if ( textD->mCursorToHint != NO_HINT ) {
+    textD->mCursorPos = textD->mCursorToHint;
+    textD->mCursorToHint = NO_HINT;
+  } else if ( textD->mCursorPos > pos ) {
+    if ( textD->mCursorPos < pos + nDeleted )
+      textD->mCursorPos = pos;
+    else
+      textD->mCursorPos += nInserted - nDeleted;
+  }
+  
+  // refigure scrollbars & stuff
+  textD->resize(textD->x(), textD->y(), textD->w(), textD->h());
+  
+  // don't need to do anything else if not visible?
+  if (!textD->visible_r()) return;
+  
+  /* If the changes caused scrolling, re-paint everything and we're done. */
+  if ( scrolled ) {
+    textD->damage(fltk3::DAMAGE_EXPOSE);
+    if ( textD->mStyleBuffer )   /* See comments in extendRangeForStyleMods */
+      textD->mStyleBuffer->primary_selection()->selected(0);
+    return;
+  }
+  
+  /* If the changes didn't cause scrolling, decide the range of characters
+   that need to be re-painted.  Also if the cursor position moved, be
+   sure that the redisplay range covers the old cursor position so the
+   old cursor gets erased, and erase the bits of the cursor which extend
+   beyond the left and right edges of the text. */
+  startDispPos = textD->mContinuousWrap ? wrapModStart : pos;
+  IS_UTF8_ALIGNED2(buf, startDispPos)
+  
+  if ( origCursorPos == startDispPos && textD->mCursorPos != startDispPos )
+    startDispPos = min( startDispPos, buf->prev_char_clipped(origCursorPos) );
+  IS_UTF8_ALIGNED2(buf, startDispPos)
+  
+  if ( linesInserted == linesDeleted ) {
+    if ( nInserted == 0 && nDeleted == 0 )
+      endDispPos = pos + nRestyled;
+    else {
+      if (textD->mContinuousWrap)
+        endDispPos = wrapModEnd;
+      else
+        endDispPos = buf->next_char(buf->line_end( pos + nInserted ));
+      
+      // CET - FIXME      if ( origCursorPos >= startDispPos &&
+      //                ( origCursorPos <= endDispPos || endDispPos == buf->length() ) )
+    }
+    
+    if (linesInserted > 1) textD->draw_line_numbers(false);
+  } else {
+    endDispPos = buf->next_char(textD->mLastChar);
+    // CET - FIXME   if ( origCursorPos >= pos )
+    /* If more than one line is inserted/deleted, a line break may have
+     been inserted or removed in between, and the line numbers may
+     have changed. If only one line is altered, line numbers cannot
+     be affected (the insertion or removal of a line break always 
+     results in at least two lines being redrawn). */
+    textD->draw_line_numbers(false);
+  }
+  IS_UTF8_ALIGNED2(buf, startDispPos)
+  IS_UTF8_ALIGNED2(buf, endDispPos)
+  
+  /* If there is a style buffer, check if the modification caused additional
+   changes that need to be redisplayed.  (Redisplaying separately would
+   cause double-redraw on almost every modification involving styled
+   text).  Extend the redraw range to incorporate style changes */
+  if ( textD->mStyleBuffer )
+    textD->extend_range_for_styles( &startDispPos, &endDispPos );
+  IS_UTF8_ALIGNED2(buf, startDispPos)
+  IS_UTF8_ALIGNED2(buf, endDispPos)
+  
+  /* Redisplay computed range */
+  textD->redisplay_range( startDispPos, endDispPos );
+}
+
+
+
+/**
+ \brief Line numbering stuff, currently unused.
+ 
+ In continuous wrap mode, internal line numbers are calculated after
+ wrapping.  A separate non-wrapped line count is maintained when line
+ numbering is turned on.  There is some performance cost to maintaining this
+ line count, so normally absolute line numbers are not tracked if line
+ numbering is off.  This routine allows callers to specify that they still
+ want this line count maintained (for use via TextDPosToLineAndCol).
+ More specifically, this allows the line number reported in the statistics
+ line to be calibrated in absolute lines, rather than post-wrapped lines.
+ */
+void fltk3::TextDisplay::maintain_absolute_top_line_number(int state) {
+  mNeedAbsTopLineNum = state;
+  reset_absolute_top_line_number();
+}
+
+
+
+/**
+ \brief Line numbering stuff, currently unused.
+ 
+ Returns the absolute (non-wrapped) line number of the first line displayed.
+ Returns 0 if the absolute top line number is not being maintained.
+ */
+int fltk3::TextDisplay::get_absolute_top_line_number() const {
+  if (!mContinuousWrap)
+    return mTopLineNum;
+  if (maintaining_absolute_top_line_number())
+    return mAbsTopLineNum;
+  return 0;
+}
+
+
+
+/**
+ \brief Line numbering stuff, currently unused.
+ 
+ Re-calculate absolute top line number for a change in scroll position.
+ */
+void fltk3::TextDisplay::absolute_top_line_number(int oldFirstChar) {
+  if (maintaining_absolute_top_line_number()) {
+    if (mFirstChar < oldFirstChar)
+      mAbsTopLineNum -= buffer()->count_lines(mFirstChar, oldFirstChar);
+    else
+      mAbsTopLineNum += buffer()->count_lines(oldFirstChar, mFirstChar);
+  }
+}
+
+
+
+/**
+ \brief Line numbering stuff, currently unused.
+ 
+ Return true if a separate absolute top line number is being maintained
+ (for displaying line numbers or showing in the statistics line).
+ */
+int fltk3::TextDisplay::maintaining_absolute_top_line_number() const {
+  return mContinuousWrap &&
+  (mLineNumWidth != 0 || mNeedAbsTopLineNum);
+}
+
+
+
+/**
+ \brief Line numbering stuff, probably unused.
+ 
+ Count lines from the beginning of the buffer to reestablish the
+ absolute (non-wrapped) top line number.  If mode is not continuous wrap,
+ or the number is not being maintained, does nothing.
+ */
+void fltk3::TextDisplay::reset_absolute_top_line_number() {
+  mAbsTopLineNum = 1;
+  absolute_top_line_number(0);
+}
+
+
+
+/**
+ \brief Convert a position index into a line number offset.
+ 
+ Find the line number of position \p pos relative to the first line of
+ displayed text. Returns 0 if the line is not displayed.
+ 
+ \param pos ??
+ \param[out] lineNum ??
+ \return ??
+ \todo What does this do?
+ */
+int fltk3::TextDisplay::position_to_line( int pos, int *lineNum ) const {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int i;
+  
+  *lineNum = 0;
+  if ( pos < mFirstChar ) return 0;
+  if ( pos > mLastChar ) {
+    if ( empty_vlines() ) {
+      if ( mLastChar < mBuffer->length() ) {
+        if ( !position_to_line( mLastChar, lineNum ) ) {
+          fltk3::error("fltk3::TextDisplay::position_to_line(): Consistency check ptvl failed");
+          return 0;
+        }
+        return ++( *lineNum ) <= mNVisibleLines - 1;
+      } else {
+        position_to_line( buffer()->prev_char_clipped(mLastChar), lineNum );
+        return 1;
+      }
+    }
+    return 0;
+  }
+  
+  for ( i = mNVisibleLines - 1; i >= 0; i-- ) {
+    if ( mLineStarts[ i ] != -1 && pos >= mLineStarts[ i ] ) {
+      *lineNum = i;
+      return 1;
+    }
+  }
+  return 0;   /* probably never be reached */
+}
+
+
+/**
+ Universal pixel machine.
+
+ We use a single function that handles all line layout, measuring, and drawing
+  \li draw a text range
+  \li return the width of a text range in pixels
+  \li return the index of a character that is at a pixel position
+
+ \param[in] mode DRAW_LINE, GET_WIDTH, FIND_INDEX
+ \param[in] lineStartPos index of first character
+ \param[in] lineLen size of string in bytes
+ \param[in] leftChar, rightChar
+ \param[in] Y drawing position
+ \param[in] bottomClip, leftClip, rightClip stop work when we reach the clipped 
+            area. rightClip is the X position that we search in FIND_INDEX.
+ \retval DRAW_LINE index of last drawn character
+ \retval GET_WIDTH width in pixels of text segment if we would draw it
+ \retval FIND_INDEX index of character at given x position in window coordinates
+ \retval FIND_INDEX_FROM_ZERO index of character at given x position without scrolling and widget offsets
+ \todo we need to handle hidden hyphens and tabs here!
+ \todo we handle all styles and selections 
+ \todo we must provide code to get pixel positions of the middle of a character as well
+ */
+int fltk3::TextDisplay::handle_vline(
+                                  int mode, 
+                                  int lineStartPos, int lineLen, int leftChar, int rightChar,
+                                  int Y, int bottomClip,
+                                  int leftClip, int rightClip) const
+{
+  IS_UTF8_ALIGNED2(buffer(), lineStartPos)
+
+  // FIXME: we need to allow two modes for FIND_INDEX: one on the edge of the 
+  // FIXME: character for selection, and one on the character center for cursors.
+  int i, X, startX, startIndex, style, charStyle;
+  char *lineStr;
+  
+  if ( lineStartPos == -1 ) {
+    lineStr = NULL;
+  } else {
+    lineStr = mBuffer->text_range( lineStartPos, lineStartPos + lineLen );
+  }
+  
+  if (mode==GET_WIDTH) {
+    X = 0;
+  } else if (mode==FIND_INDEX_FROM_ZERO) {
+    X = 0; 
+    mode = FIND_INDEX;
+  } else {
+    X = text_area.x - mHorizOffset;
+  }
+  
+  startX = X;
+  startIndex = 0;
+  if (!lineStr) {
+    // just clear the background
+    if (mode==DRAW_LINE) {
+      style = position_style(lineStartPos, lineLen, -1);
+      draw_string( style|BG_ONLY_MASK, text_area.x, Y, text_area.x+text_area.w, lineStr, lineLen );
+    }
+    if (mode==FIND_INDEX) {
+      IS_UTF8_ALIGNED2(buffer(), lineStartPos)
+      return lineStartPos;
+    }
+    return 0;
+  }
+  
+  char currChar = 0, prevChar = 0;
+  // draw the line
+  style = position_style(lineStartPos, lineLen, 0);
+  for (i=0; i<lineLen; ) {
+    currChar = lineStr[i]; // one byte is enough to handele tabs and other cases
+    int len = fltk3::utf8len1(currChar);
+    if (len<=0) len = 1; // OUCH!
+    charStyle = position_style(lineStartPos, lineLen, i);
+    if (charStyle!=style || currChar=='\t' || prevChar=='\t') {
+      // draw a segment whenever the style changes or a Tab is found
+      int w = 0;
+      if (prevChar=='\t') {
+        // draw a single Tab space
+        int tab = (int)col_to_x(mBuffer->tab_distance());
+        int xAbs = (mode==GET_WIDTH) ? startX : startX+mHorizOffset-text_area.x;
+        w = (((xAbs/tab)+1)*tab) - xAbs;
+        if (mode==DRAW_LINE)
+          draw_string( style|BG_ONLY_MASK, startX, Y, startX+w, 0, 0 );
+        if (mode==FIND_INDEX && startX+w>rightClip) {
+          // find x pos inside block
+          free(lineStr);
+          return lineStartPos + startIndex;
+        }
+      } else {
+        // draw a text segment
+        w = int( string_width( lineStr+startIndex, i-startIndex, style ) );
+        if (mode==DRAW_LINE)
+          draw_string( style, startX, Y, startX+w, lineStr+startIndex, i-startIndex );
+        if (mode==FIND_INDEX && startX+w>rightClip) {
+          // find x pos inside block
+          int di = find_x(lineStr+startIndex, i-startIndex, style, rightClip-startX);
+          free(lineStr);
+          IS_UTF8_ALIGNED2(buffer(), (lineStartPos+startIndex+di))
+          return lineStartPos + startIndex + di;
+        }
+      }
+      style = charStyle;
+      startX += w;
+      startIndex = i;
+    }
+    i += len;
+    prevChar = currChar;
+  }
+  int w = 0;
+  if (currChar=='\t') {
+    // draw a single Tab space
+    int tab = (int)col_to_x(mBuffer->tab_distance());
+    int xAbs = (mode==GET_WIDTH) ? startX : startX+mHorizOffset-text_area.x;
+    w = (((xAbs/tab)+1)*tab) - xAbs;
+    if (mode==DRAW_LINE)
+      draw_string( style|BG_ONLY_MASK, startX, Y, startX+w, 0, 0 );
+    if (mode==FIND_INDEX) {
+      // find x pos inside block
+      free(lineStr);
+      return lineStartPos + startIndex + ( rightClip-startX>w ? 1 : 0 );
+    }
+  } else {
+    w = int( string_width( lineStr+startIndex, i-startIndex, style ) );
+    if (mode==DRAW_LINE)
+      draw_string( style, startX, Y, startX+w, lineStr+startIndex, i-startIndex );
+    if (mode==FIND_INDEX) {
+      // find x pos inside block
+      int di = find_x(lineStr+startIndex, i-startIndex, style, rightClip-startX);
+      free(lineStr);
+      IS_UTF8_ALIGNED2(buffer(), (lineStartPos+startIndex+di))
+      return lineStartPos + startIndex + di;
+    }
+  }
+  if (mode==GET_WIDTH) {
+    free(lineStr);
+    return startX+w;
+  }
+  
+  // clear the rest of the line
+  startX += w;
+  style = position_style(lineStartPos, lineLen, i);
+  if (mode==DRAW_LINE)
+    draw_string( style|BG_ONLY_MASK, startX, Y, text_area.x+text_area.w, lineStr, lineLen );
+  
+  free(lineStr);
+  IS_UTF8_ALIGNED2(buffer(), (lineStartPos+lineLen))
+  return lineStartPos + lineLen;
+}
+
+
+/**
+ \brief Find the index of the character that lies at the given x position.
+ \param s UTF-8 text string
+ \param len length of string
+ \param style index into style lookup table
+ \param x position in pixels
+ \return index into buffer
+ */
+int fltk3::TextDisplay::find_x(const char *s, int len, int style, int x) const {
+  IS_UTF8_ALIGNED(s)
+
+  // TODO: use binary search which may be quicker.
+  int i = 0;
+  while (i<len) {
+    int cl = fltk3::utf8len1(s[i]);
+    int w = int( string_width(s, i+cl, style) );
+    if (w>x) 
+      return i;
+    i += cl;
+  }  
+  return len;
+}
+
+
+
+/**
+ \brief Draw a single line of text.
+ 
+ Draw the text on a single line represented by \p visLineNum (the
+ number of lines down from the top of the display), limited by
+ \p leftClip and \p rightClip window coordinates and \p leftCharIndex and
+ \p rightCharIndex character positions (not including the character at
+ position \p rightCharIndex).
+ 
+ \param visLineNum index of line in the visible line number lookup
+ \param leftClip, rightClip pixel position of clipped area
+ \param leftCharIndex, rightCharIndex index into line of segment that we want to draw
+ */
+void fltk3::TextDisplay::draw_vline(int visLineNum, int leftClip, int rightClip,
+                                 int leftCharIndex, int rightCharIndex) {
+  int Y, lineStartPos, lineLen, fontHeight;
+  
+  //  printf("draw_vline(visLineNum=%d, leftClip=%d, rightClip=%d, leftCharIndex=%d, rightCharIndex=%d)\n",
+  //         visLineNum, leftClip, rightClip, leftCharIndex, rightCharIndex);
+  //  printf("nNVisibleLines=%d\n", mNVisibleLines);
+  
+  /* If line is not displayed, skip it */
+  if ( visLineNum < 0 || visLineNum >= mNVisibleLines )
+    return;
+  
+  /* Calculate Y coordinate of the string to draw */
+  fontHeight = mMaxsize;
+  Y = text_area.y + visLineNum * fontHeight;
+  
+  /* Get the text, length, and  buffer position of the line to display */
+  lineStartPos = mLineStarts[ visLineNum ];
+  if ( lineStartPos == -1 ) {
+    lineLen = 0;
+  } else {
+    lineLen = vline_length( visLineNum );
+  }
+  
+  /* Shrink the clipping range to the active display area */
+  leftClip = max( text_area.x, leftClip );
+  rightClip = min( rightClip, text_area.x + text_area.w );
+  
+  handle_vline(DRAW_LINE, 
+               lineStartPos, lineLen, leftCharIndex, rightCharIndex,
+               Y, Y+fontHeight, leftClip, rightClip);
+  return;
+}
+
+
+
+/**
+ \brief Draw a text segment in a single style.
+ 
+ Draw a string or blank area according to parameter \p style, using the
+ appropriate colors and drawing method for that style, with top left
+ corner at \p X, \p Y.  If style says to draw text, use \p string as
+ source of characters, and draw \p nChars, if style is FILL, erase
+ rectangle where text would have drawn from \p X to \p toX and from
+ \p Y to the maximum y extent of the current font(s).
+ 
+ \param style index into style lookup table
+ \param X, Y drawing origin
+ \param toX rightmost position if this is a fill operation
+ \param string text if this is a drawing operation
+ \param nChars number of characters to draw
+ */
+void fltk3::TextDisplay::draw_string(int style, 
+                                  int X, int Y, int toX,
+                                  const char *string, int nChars) const {
+  IS_UTF8_ALIGNED(string)
+
+  const StyleTableEntry * styleRec;
+  
+  /* Draw blank area rather than text, if that was the request */
+  if ( style & FILL_MASK ) {
+    if (style & TEXT_ONLY_MASK) return;
+    clear_rect( style, X, Y, toX - X, mMaxsize );
+    return;
+  }
+  /* Set font, color, and gc depending on style.  For normal text, GCs
+   for normal drawing, or drawing within a fltk3::TextSelection or highlight are
+   pre-allocated and pre-configured.  For syntax highlighting, GCs are
+   configured here, on the fly. */
+  
+  fltk3::Font font = textfont();
+  int fsize = textsize();
+  fltk3::Color foreground;
+  fltk3::Color background;
+  
+  if ( style & STYLE_LOOKUP_MASK ) {
+    int si = (style & STYLE_LOOKUP_MASK) - 'A';
+    if (si < 0) si = 0;
+    else if (si >= mNStyles) si = mNStyles - 1;
+    
+    styleRec = mStyleTable + si;
+    font  = styleRec->font;
+    fsize = styleRec->size;
+    
+    if (style & PRIMARY_MASK) {
+      if (fltk3::focus() == (fltk3::Widget*)this) background = selection_color();
+      else background = fltk3::color_average(color(), selection_color(), 0.4f);
+    } else if (style & HIGHLIGHT_MASK) {
+      if (fltk3::focus() == (fltk3::Widget*)this) background = fltk3::color_average(color(), selection_color(), 0.5f);
+      else background = fltk3::color_average(color(), selection_color(), 0.6f);
+    } else background = color();
+    foreground = fltk3::contrast(styleRec->color, background);
+  } else if (style & PRIMARY_MASK) {
+    if (fltk3::focus() == (fltk3::Widget*)this) background = selection_color();
+    else background = fltk3::color_average(color(), selection_color(), 0.4f);
+    foreground = fltk3::contrast(textcolor(), background);
+  } else if (style & HIGHLIGHT_MASK) {
+    if (fltk3::focus() == (fltk3::Widget*)this) background = fltk3::color_average(color(), selection_color(), 0.5f);
+    else background = fltk3::color_average(color(), selection_color(), 0.6f);
+    foreground = fltk3::contrast(textcolor(), background);
+  } else {
+    foreground = textcolor();
+    background = color();
+  }
+  
+  if (!(style & TEXT_ONLY_MASK)) {
+    fltk3::color( background );
+    fltk3::rectf( X, Y, toX - X, mMaxsize );
+  }
+  if (!(style & BG_ONLY_MASK)) {
+    fltk3::color( foreground );
+    fltk3::font( font, fsize );
+#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
+    // makes sure antialiased ÄÖÜ do not leak on line above
+    fltk3::push_clip(X, Y, toX - X, mMaxsize);
+#endif
+    fltk3::draw( string, nChars, X, Y + mMaxsize - fltk3::descent());
+#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
+    fltk3::pop_clip();
+#endif
+  }
+  
+  // CET - FIXME
+  /* If any space around the character remains unfilled (due to use of
+   different sized fonts for highlighting), fill in above or below
+   to erase previously drawn characters */
+  /*
+   if (fs->ascent < mAscent)
+   clear_rect( style, X, Y, toX - X, mAscent - fs->ascent);
+   if (fs->descent < mDescent)
+   clear_rect( style, X, Y + mAscent + fs->descent, toX - x,
+   mDescent - fs->descent);
+   */
+  /* Underline if style is secondary fltk3::TextSelection */
+  
+  /*
+   if (style & SECONDARY_MASK)
+   XDrawLine(XtDisplay(mW), XtWindow(mW), gc, x,
+   y + mAscent, toX - 1, Y + fs->ascent);
+   */
+}
+
+
+
+/**
+ \brief Clear a rectangle with the appropriate background color for \p style.
+ 
+ \param style index into style table
+ \param X, Y, width, height size and position of background area
+ */
+void fltk3::TextDisplay::clear_rect(int style, 
+                                 int X, int Y,
+                                 int width, int height) const {
+  /* A width of zero means "clear to end of window" to XClearArea */
+  if ( width == 0 )
+    return;
+  
+  if (style & PRIMARY_MASK) {
+    if (fltk3::focus()==(fltk3::Widget*)this) {
+      fltk3::color(selection_color());
+    } else {
+      fltk3::color(fltk3::color_average(color(), selection_color(), 0.4f));
+    }
+  } else if (style & HIGHLIGHT_MASK) {
+    if (fltk3::focus()==(fltk3::Widget*)this) {
+      fltk3::color(fltk3::color_average(color(), selection_color(), 0.5f));
+    } else {
+      fltk3::color(fltk3::color_average(color(), selection_color(), 0.6f));
+    }
+  } else {
+    fltk3::color( color() );
+  }
+  fltk3::rectf( X, Y, width, height );
+}
+
+
+
+/**
+ \brief Draw a cursor with top center at \p X, \p Y.
+ 
+ \param X, Y cursor position in pixels
+ */
+void fltk3::TextDisplay::draw_cursor( int X, int Y ) {
+
+  typedef struct {
+    int x1, y1, x2, y2;
+  }
+  Segment;
+
+  Segment segs[ 5 ];
+  int left, right, cursorWidth, midY;
+  //    int fontWidth = mFontStruct->min_bounds.width, nSegs = 0;
+  int fontWidth = TMPFONTWIDTH; // CET - FIXME
+  int nSegs = 0;
+  int fontHeight = mMaxsize;
+  int bot = Y + fontHeight - 1;
+  
+  if ( X < text_area.x - 1 || X > text_area.x + text_area.w )
+    return;
+  
+  /* For cursors other than the block, make them around 2/3 of a character
+   width, rounded to an even number of pixels so that X will draw an
+   odd number centered on the stem at x. */
+  cursorWidth = 4;   //(fontWidth/3) * 2;
+  left = X - cursorWidth / 2;
+  right = left + cursorWidth;
+  
+  /* Create segments and draw cursor */
+  if ( mCursorStyle == CARET_CURSOR ) {
+    midY = bot - fontHeight / 5;
+    segs[ 0 ].x1 = left; segs[ 0 ].y1 = bot; segs[ 0 ].x2 = X; segs[ 0 ].y2 = midY;
+    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
+    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = midY - 1;
+    segs[ 3 ].x1 = X; segs[ 3 ].y1 = midY - 1; segs[ 3 ].x2 = right; segs[ 3 ].y2 = bot;
+    nSegs = 4;
+  } else if ( mCursorStyle == NORMAL_CURSOR ) {
+    segs[ 0 ].x1 = left; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
+    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
+    segs[ 2 ].x1 = left; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = right; segs[ 2 ].y2 = bot;
+    nSegs = 3;
+  } else if ( mCursorStyle == HEAVY_CURSOR ) {
+    segs[ 0 ].x1 = X - 1; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X - 1; segs[ 0 ].y2 = bot;
+    segs[ 1 ].x1 = X; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = X; segs[ 1 ].y2 = bot;
+    segs[ 2 ].x1 = X + 1; segs[ 2 ].y1 = Y; segs[ 2 ].x2 = X + 1; segs[ 2 ].y2 = bot;
+    segs[ 3 ].x1 = left; segs[ 3 ].y1 = Y; segs[ 3 ].x2 = right; segs[ 3 ].y2 = Y;
+    segs[ 4 ].x1 = left; segs[ 4 ].y1 = bot; segs[ 4 ].x2 = right; segs[ 4 ].y2 = bot;
+    nSegs = 5;
+  } else if ( mCursorStyle == DIM_CURSOR ) {
+    midY = Y + fontHeight / 2;
+    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = X; segs[ 0 ].y2 = Y;
+    segs[ 1 ].x1 = X; segs[ 1 ].y1 = midY; segs[ 1 ].x2 = X; segs[ 1 ].y2 = midY;
+    segs[ 2 ].x1 = X; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
+    nSegs = 3;
+  } else if ( mCursorStyle == BLOCK_CURSOR ) {
+    right = X + fontWidth;
+    segs[ 0 ].x1 = X; segs[ 0 ].y1 = Y; segs[ 0 ].x2 = right; segs[ 0 ].y2 = Y;
+    segs[ 1 ].x1 = right; segs[ 1 ].y1 = Y; segs[ 1 ].x2 = right; segs[ 1 ].y2 = bot;
+    segs[ 2 ].x1 = right; segs[ 2 ].y1 = bot; segs[ 2 ].x2 = X; segs[ 2 ].y2 = bot;
+    segs[ 3 ].x1 = X; segs[ 3 ].y1 = bot; segs[ 3 ].x2 = X; segs[ 3 ].y2 = Y;
+    nSegs = 4;
+  }
+  fltk3::color( mCursor_color );
+  
+  for ( int k = 0; k < nSegs; k++ ) {
+    fltk3::line( segs[ k ].x1, segs[ k ].y1, segs[ k ].x2, segs[ k ].y2 );
+  }
+}
+
+
+
+/**
+ \brief Find the correct style for a character.
+
+ Determine the drawing method to use to draw a specific character from "buf".
+ \p lineStartPos gives the character index where the line begins, \p lineIndex,
+ the number of characters past the beginning of the line, and \p lineIndex
+ the number of displayed characters past the beginning of the line.  Passing
+ \p lineStartPos of -1 returns the drawing style for "no text".
+
+ Why not just: position_style(pos)?  Because style applies to blank areas
+ of the window beyond the text boundaries, and because this routine must also
+ decide whether a position is inside of a rectangular fltk3::TextSelection, and do
+ so efficiently, without re-counting character positions from the start of the
+ line.
+
+ Note that style is a somewhat incorrect name, drawing method would
+ be more appropriate.
+
+ \param lineStartPos beginning of this line
+ \param lineLen number of bytes in line
+ \param lineIndex position of character within line
+ \return style for the given character
+ */
+int fltk3::TextDisplay::position_style( int lineStartPos, int lineLen, int lineIndex) const 
+{
+  IS_UTF8_ALIGNED2(buffer(), lineStartPos)
+
+  fltk3::TextBuffer * buf = mBuffer;
+  fltk3::TextBuffer *styleBuf = mStyleBuffer;
+  int pos, style = 0;
+  
+  if ( lineStartPos == -1 || buf == NULL )
+    return FILL_MASK;
+  
+  pos = lineStartPos + min( lineIndex, lineLen );
+  
+  if ( lineIndex >= lineLen )
+    style = FILL_MASK;
+  else if ( styleBuf != NULL ) {
+    style = ( unsigned char ) styleBuf->byte_at( pos );
+    if (style == mUnfinishedStyle && mUnfinishedHighlightCB) {
+      /* encountered "unfinished" style, trigger parsing */
+      (mUnfinishedHighlightCB)( pos, mHighlightCBArg);
+      style = (unsigned char) styleBuf->byte_at( pos);
+    }
+  }
+  if (buf->primary_selection()->includes(pos))
+    style |= PRIMARY_MASK;
+  if (buf->highlight_selection()->includes(pos))
+    style |= HIGHLIGHT_MASK;
+  if (buf->secondary_selection()->includes(pos))
+    style |= SECONDARY_MASK;
+  return style;
+}
+
+
+/**
+ \brief Find the width of a string in the font of a particular style.
+ 
+ \param string the text
+ \param length number of bytes in string
+ \param style index into style table
+ \return width of text segment in pixels
+ */
+double fltk3::TextDisplay::string_width( const char *string, int length, int style ) const {
+  IS_UTF8_ALIGNED(string)
+
+  fltk3::Font font;
+  fltk3::Fontsize fsize;
+  
+  if ( mNStyles && (style & STYLE_LOOKUP_MASK) ) {
+    int si = (style & STYLE_LOOKUP_MASK) - 'A';
+    if (si < 0) si = 0;
+    else if (si >= mNStyles) si = mNStyles - 1;
+    
+    font  = mStyleTable[si].font;
+    fsize = mStyleTable[si].size;
+  } else {
+    font  = textfont();
+    fsize = textsize();
+  }
+  fltk3::font( font, fsize );
+  return fltk3::width( string, length );
+}
+
+
+
+/**
+ \brief Translate a pixel position into a character index.
+
+ Translate window coordinates to the nearest (insert cursor or character
+ cell) text position.  The parameter \p posType specifies how to interpret the
+ position: CURSOR_POS means translate the coordinates to the nearest cursor
+ position, and CHARACTER_POS means return the position of the character
+ closest to (\p X, \p Y).
+
+ \param X, Y pixel position
+ \param posType CURSOR_POS or CHARACTER_POS
+ \return index into text buffer
+ */
+int fltk3::TextDisplay::xy_to_position( int X, int Y, int posType ) const {
+  int lineStart, lineLen, fontHeight;
+  int visLineNum;
+  
+  /* Find the visible line number corresponding to the Y coordinate */
+  fontHeight = mMaxsize;
+  visLineNum = ( Y - text_area.y ) / fontHeight;
+  if ( visLineNum < 0 )
+    return mFirstChar;
+  if ( visLineNum >= mNVisibleLines )
+    visLineNum = mNVisibleLines - 1;
+  
+  /* Find the position at the start of the line */
+  lineStart = mLineStarts[ visLineNum ];
+  
+  /* If the line start was empty, return the last position in the buffer */
+  if ( lineStart == -1 )
+    return mBuffer->length();
+  
+  /* Get the line text and its length */
+  lineLen = vline_length( visLineNum );
+  
+  return handle_vline(FIND_INDEX, 
+                      lineStart, lineLen, 0, 0, 
+                      0, 0,
+                      text_area.x, X);
+}
+
+
+
+/**
+ \brief Translate pixel coordinates into row and column.
+ 
+ Translate window coordinates to the nearest row and column number for
+ positioning the cursor.  This, of course, makes no sense when the font is
+ proportional, since there are no absolute columns.  The parameter posType
+ specifies how to interpret the position: CURSOR_POS means translate the
+ coordinates to the nearest position between characters, and CHARACTER_POS
+ means translate the position to the nearest character cell.
+ 
+ \param X, Y pixel coordinates
+ \param[out] row, column neares row and column
+ \param posType CURSOR_POS or CHARACTER_POS
+ */
+void fltk3::TextDisplay::xy_to_rowcol( int X, int Y, int *row,
+                                   int *column, int posType ) const {
+  int fontHeight = mMaxsize;
+  int fontWidth = TMPFONTWIDTH;   //mFontStruct->max_bounds.width;
+  
+  /* Find the visible line number corresponding to the Y coordinate */
+  *row = ( Y - text_area.y ) / fontHeight;
+  if ( *row < 0 ) *row = 0;
+  if ( *row >= mNVisibleLines ) *row = mNVisibleLines - 1;
+  
+  *column = ( ( X - text_area.x ) + mHorizOffset +
+             ( posType == CURSOR_POS ? fontWidth / 2 : 0 ) ) / fontWidth;
+  if ( *column < 0 ) * column = 0;
+}
+
+
+
+/**
+ \brief Offset line start counters for a new vertical scroll position.
+ 
+ Offset the line starts array, mTopLineNum, mFirstChar and lastChar, for a new
+ vertical scroll position given by newTopLineNum.  If any currently displayed
+ lines will still be visible, salvage the line starts values, otherwise,
+ count lines from the nearest known line start (start or end of buffer, or
+ the closest value in the mLineStarts array)
+ 
+ \param newTopLineNum index into buffer
+ */
+void fltk3::TextDisplay::offset_line_starts( int newTopLineNum ) {
+  int oldTopLineNum = mTopLineNum;
+  int oldFirstChar = mFirstChar;
+  int lineDelta = newTopLineNum - oldTopLineNum;
+  int nVisLines = mNVisibleLines;
+  int *lineStarts = mLineStarts;
+  int i, lastLineNum;
+  fltk3::TextBuffer *buf = mBuffer;
+  
+  /* If there was no offset, nothing needs to be changed */
+  if ( lineDelta == 0 )
+    return;
+  
+  /* Find the new value for mFirstChar by counting lines from the nearest
+   known line start (start or end of buffer, or the closest value in the
+   lineStarts array) */
+  lastLineNum = oldTopLineNum + nVisLines - 1;
+  if ( newTopLineNum < oldTopLineNum && newTopLineNum < -lineDelta ) {
+    mFirstChar = skip_lines( 0, newTopLineNum - 1, true );
+  } else if ( newTopLineNum < oldTopLineNum ) {
+    mFirstChar = rewind_lines( mFirstChar, -lineDelta );
+  } else if ( newTopLineNum < lastLineNum ) {
+    mFirstChar = lineStarts[ newTopLineNum - oldTopLineNum ];
+  } else if ( newTopLineNum - lastLineNum < mNBufferLines - newTopLineNum ) {
+    mFirstChar = skip_lines( lineStarts[ nVisLines - 1 ],
+                            newTopLineNum - lastLineNum, true );
+  } else {
+    mFirstChar = rewind_lines( buf->length(), mNBufferLines - newTopLineNum + 1 );
+  }
+  
+  /* Fill in the line starts array */
+  if ( lineDelta < 0 && -lineDelta < nVisLines ) {
+    for ( i = nVisLines - 1; i >= -lineDelta; i-- )
+      lineStarts[ i ] = lineStarts[ i + lineDelta ];
+    calc_line_starts( 0, -lineDelta );
+  } else if ( lineDelta > 0 && lineDelta < nVisLines ) {
+    for ( i = 0; i < nVisLines - lineDelta; i++ )
+      lineStarts[ i ] = lineStarts[ i + lineDelta ];
+    calc_line_starts( nVisLines - lineDelta, nVisLines - 1 );
+  } else
+    calc_line_starts( 0, nVisLines );
+  
+  /* Set lastChar and mTopLineNum */
+  calc_last_char();
+  mTopLineNum = newTopLineNum;
+  
+  /* If we're numbering lines or being asked to maintain an absolute line
+   number, re-calculate the absolute line number */
+  absolute_top_line_number(oldFirstChar);
+}
+
+
+
+/**
+ \brief Update line start arrays and variables.
+
+ Update the line starts array, mTopLineNum, mFirstChar and lastChar for this
+ text display after a modification to the text buffer, given by the
+ position \p pos where the change began, and the numbers of characters
+ and lines inserted and deleted.
+
+ \param pos index into buffer of recent changes
+ \param charsInserted number of bytes(!) inserted
+ \param charsDeleted number of bytes(!) deleted
+ \param linesInserted number of lines
+ \param linesDeleted number of lines
+ \param[out] scrolled set to 1 if the text display needs to be scrolled
+ */
+void fltk3::TextDisplay::update_line_starts(int pos, int charsInserted,
+                                         int charsDeleted, int linesInserted, 
+                                         int linesDeleted, int *scrolled ) {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int *lineStarts = mLineStarts;
+  int i, lineOfPos, lineOfEnd, nVisLines = mNVisibleLines;
+  int charDelta = charsInserted - charsDeleted;
+  int lineDelta = linesInserted - linesDeleted;
+  
+  /* If all of the changes were before the displayed text, the display
+   doesn't change, just update the top line num and offset the line
+   start entries and first and last characters */
+  if ( pos + charsDeleted < mFirstChar ) {
+    mTopLineNum += lineDelta;
+    for ( i = 0; i < nVisLines && lineStarts[i] != -1; i++ )
+      lineStarts[ i ] += charDelta;
+    mFirstChar += charDelta;
+    mLastChar += charDelta;
+    *scrolled = 0;
+    return;
+  }
+  
+  /* The change began before the beginning of the displayed text, but
+   part or all of the displayed text was deleted */
+  if ( pos < mFirstChar ) {
+    /* If some text remains in the window, anchor on that  */
+    if ( position_to_line( pos + charsDeleted, &lineOfEnd ) &&
+        ++lineOfEnd < nVisLines && lineStarts[ lineOfEnd ] != -1 ) {
+      mTopLineNum = max( 1, mTopLineNum + lineDelta );
+      mFirstChar = rewind_lines(lineStarts[ lineOfEnd ] + charDelta, lineOfEnd );
+      /* Otherwise anchor on original line number and recount everything */
+    } else {
+      if ( mTopLineNum > mNBufferLines + lineDelta ) {
+        mTopLineNum = 1;
+        mFirstChar = 0;
+      } else
+        mFirstChar = skip_lines( 0, mTopLineNum - 1, true );
+    }
+    calc_line_starts( 0, nVisLines - 1 );
+    /* calculate lastChar by finding the end of the last displayed line */
+    calc_last_char();
+    *scrolled = 1;
+    return;
+  }
+  
+  /* If the change was in the middle of the displayed text (it usually is),
+   salvage as much of the line starts array as possible by moving and
+   offsetting the entries after the changed area, and re-counting the
+   added lines or the lines beyond the salvaged part of the line starts
+   array */
+  if ( pos <= mLastChar ) {
+    /* find line on which the change began */
+    position_to_line( pos, &lineOfPos );
+    /* salvage line starts after the changed area */
+    if ( lineDelta == 0 ) {
+      for ( i = lineOfPos + 1; i < nVisLines && lineStarts[ i ] != -1; i++ )
+        lineStarts[ i ] += charDelta;
+    } else if ( lineDelta > 0 ) {
+      for ( i = nVisLines - 1; i >= lineOfPos + lineDelta + 1; i-- )
+        lineStarts[ i ] = lineStarts[ i - lineDelta ] +
+        ( lineStarts[ i - lineDelta ] == -1 ? 0 : charDelta );
+    } else /* (lineDelta < 0) */ {
+      for ( i = max( 0, lineOfPos + 1 ); i < nVisLines + lineDelta; i++ )
+        lineStarts[ i ] = lineStarts[ i - lineDelta ] +
+        ( lineStarts[ i - lineDelta ] == -1 ? 0 : charDelta );
+    }
+    /* fill in the missing line starts */
+    if ( linesInserted >= 0 )
+      calc_line_starts( lineOfPos + 1, lineOfPos + linesInserted );
+    if ( lineDelta < 0 )
+      calc_line_starts( nVisLines + lineDelta, nVisLines );
+    /* calculate lastChar by finding the end of the last displayed line */
+    calc_last_char();
+    *scrolled = 0;
+    return;
+  }
+  
+  /* Change was past the end of the displayed text, but displayable by virtue
+   of being an insert at the end of the buffer into visible blank lines */
+  if ( empty_vlines() ) {
+    position_to_line( pos, &lineOfPos );
+    calc_line_starts( lineOfPos, lineOfPos + linesInserted );
+    calc_last_char();
+    *scrolled = 0;
+    return;
+  }
+  
+  /* Change was beyond the end of the buffer and not visible, do nothing */
+  *scrolled = 0;
+}
+
+
+
+/**
+ \brief Update the line start arrays.
+ 
+ Scan through the text in the "textD"'s buffer and recalculate the line
+ starts array values beginning at index "startLine" and continuing through
+ (including) "endLine".  It assumes that the line starts entry preceding
+ "startLine" (or mFirstChar if startLine is 0) is good, and re-counts
+ newlines to fill in the requested entries.  Out of range values for
+ "startLine" and "endLine" are acceptable.
+ 
+ \param startLine, endLine range of lines to scan as line numbers
+ */
+void fltk3::TextDisplay::calc_line_starts( int startLine, int endLine ) {
+  int startPos, bufLen = mBuffer->length();
+  int line, lineEnd, nextLineStart, nVis = mNVisibleLines;
+  int *lineStarts = mLineStarts;
+  
+  /* Clean up (possibly) messy input parameters */
+  if ( endLine < 0 ) endLine = 0;
+  if ( endLine >= nVis ) endLine = nVis - 1;
+  if ( startLine < 0 ) startLine = 0;
+  if ( startLine >= nVis ) startLine = nVis - 1;
+  if ( startLine > endLine )
+    return;
+  
+  /* Find the last known good line number -> position mapping */
+  if ( startLine == 0 ) {
+    lineStarts[ 0 ] = mFirstChar;
+    startLine = 1;
+  }
+  startPos = lineStarts[ startLine - 1 ];
+  
+  /* If the starting position is already past the end of the text,
+   fill in -1's (means no text on line) and return */
+  if ( startPos == -1 ) {
+    for ( line = startLine; line <= endLine; line++ )
+      lineStarts[ line ] = -1;
+    return;
+  }
+  
+  /* Loop searching for ends of lines and storing the positions of the
+   start of the next line in lineStarts */
+  for ( line = startLine; line <= endLine; line++ ) {
+    find_line_end(startPos, true, &lineEnd, &nextLineStart);
+    startPos = nextLineStart;
+    if ( startPos >= bufLen ) {
+      /* If the buffer ends with a newline or line break, put
+       buf->length() in the next line start position (instead of
+       a -1 which is the normal marker for an empty line) to
+       indicate that the cursor may safely be displayed there */
+      if ( line == 0 || ( lineStarts[ line - 1 ] != bufLen &&
+                         lineEnd != nextLineStart ) ) {
+        lineStarts[ line ] = bufLen;
+        line++;
+      }
+      break;
+    }
+    lineStarts[ line ] = startPos;
+  }
+  
+  /* Set any entries beyond the end of the text to -1 */
+  for ( ; line <= endLine; line++ )
+    lineStarts[ line ] = -1;
+}
+
+
+
+/**
+ \brief Update last display character index.
+ 
+ Given a fltk3::TextDisplay with a complete, up-to-date lineStarts array, update
+ the lastChar entry to point to the last buffer position displayed.
+ */
+void fltk3::TextDisplay::calc_last_char() {
+  int i;
+  for (i = mNVisibleLines - 1; i >= 0 && mLineStarts[i] == -1; i--) ;
+  mLastChar = i < 0 ? 0 : line_end(mLineStarts[i], true);
+}
+
+
+
+/**  
+ \brief Scrolls the current buffer to start at the specified line and column.
+ \param topLineNum top line number
+ \param horizOffset column number
+ \todo Column numbers make little sense here.
+ */
+void fltk3::TextDisplay::scroll(int topLineNum, int horizOffset) {
+  mTopLineNumHint = topLineNum;
+  mHorizOffsetHint = horizOffset;
+  resize(x(), y(), w(), h());
+}
+
+
+
+/**  
+ \brief Scrolls the current buffer to start at the specified line and column.
+ \param topLineNum top line number
+ \param horizOffset in pixels
+ \return 0 if nothing changed, 1 if we scrolled
+ */
+int fltk3::TextDisplay::scroll_(int topLineNum, int horizOffset) {
+  /* Limit the requested scroll position to allowable values */
+  if (topLineNum > mNBufferLines + 3 - mNVisibleLines)
+    topLineNum = mNBufferLines + 3 - mNVisibleLines;
+  if (topLineNum < 1) topLineNum = 1;
+  
+  if (horizOffset > longest_vline() - text_area.w)
+    horizOffset = longest_vline() - text_area.w;
+  if (horizOffset < 0) horizOffset = 0;
+  
+  /* Do nothing if scroll position hasn't actually changed or there's no
+   window to draw in yet */
+  if (mHorizOffset == horizOffset && mTopLineNum == topLineNum)
+    return 0;
+  
+  /* If the vertical scroll position has changed, update the line
+   starts array and related counters in the text display */
+  offset_line_starts(topLineNum);
+  
+  /* Just setting mHorizOffset is enough information for redisplay */
+  mHorizOffset = horizOffset;
+  
+  // redraw all text
+  damage(fltk3::DAMAGE_EXPOSE);
+  return 1;
+}
+
+
+
+/**
+ \brief Update vertical scrollbar.
+ 
+ Update the minimum, maximum, slider size, page increment, and value
+ for vertical scrollbar.
+ */
+void fltk3::TextDisplay::update_v_scrollbar() {
+  /* The vertical scrollbar value and slider size directly represent the top
+   line number, and the number of visible lines respectively.  The scroll
+   bar maximum value is chosen to generally represent the size of the whole
+   buffer, with minor adjustments to keep the scrollbar widget happy */
+#ifdef DEBUG
+  printf("fltk3::TextDisplay::update_v_scrollbar():\n"
+         "    mTopLineNum=%d, mNVisibleLines=%d, mNBufferLines=%d\n",
+	 mTopLineNum, mNVisibleLines, mNBufferLines);
+#endif // DEBUG
+  
+  mVScrollBar->value(mTopLineNum, mNVisibleLines, 1, mNBufferLines+2);
+  mVScrollBar->linesize(3);
+}
+
+
+/**
+ \brief Update vertical scrollbar.
+ 
+ Update the minimum, maximum, slider size, page increment, and value
+ for the horizontal scrollbar.
+ */
+void fltk3::TextDisplay::update_h_scrollbar() {
+  int sliderMax = max(longest_vline(), text_area.w + mHorizOffset);
+  mHScrollBar->value( mHorizOffset, text_area.w, 0, sliderMax );
+}
+
+
+
+/**
+ \brief Callbacks for drag or valueChanged on scrollbars.
+ */
+void fltk3::TextDisplay::v_scrollbar_cb(fltk3::Scrollbar* b, fltk3::TextDisplay* textD) {
+  if (b->value() == textD->mTopLineNum) return;
+  textD->scroll(b->value(), textD->mHorizOffset);
+}
+
+
+
+/**
+ \brief Callbacks for drag or valueChanged on scrollbars.
+ */
+void fltk3::TextDisplay::h_scrollbar_cb(fltk3::Scrollbar* b, fltk3::TextDisplay* textD) {
+  if (b->value() == textD->mHorizOffset) return;
+  textD->scroll(textD->mTopLineNum, b->value());
+}
+
+
+
+/**
+ \brief Refresh the line number area.  
+ 
+ If clearAll is False, writes only over the character cell areas.  Setting 
+ clearAll to True will clear out any stray marks outside of the character cell 
+ area, which might have been left from before a resize or font change.
+ 
+ This function is not used.
+ */
+void fltk3::TextDisplay::draw_line_numbers(bool /*clearAll*/) {
+#if 0
+  int y, line, visLine, nCols, lineStart;
+  char lineNumString[12];
+  int lineHeight = mMaxsize ? mMaxsize : textsize();
+  int charWidth = TMPFONTWIDTH;   //mFontStruct->max_bounds.width;
+  
+  /* Don't draw if mLineNumWidth == 0 (line numbers are hidden), or widget is
+   not yet realized */
+  if (mLineNumWidth == 0 || visible_r())
+    return;
+  
+  /* GC is allocated on demand, since not everyone will use line numbering */
+  if (textD->lineNumGC == NULL) {
+    XGCValues values;
+    values.foreground = textD->lineNumFGPixel;
+    values.background = textD->bgPixel;
+    values.font = textD->fontStruct->fid;
+    textD->lineNumGC = XtGetGC(textD->w,
+                               GCFont| GCForeground | GCBackground, &values);
+  }
+  
+  /* Erase the previous contents of the line number area, if requested */
+  if (clearAll)
+    XClearArea(XtDisplay(textD->w), XtWindow(textD->w), textD->lineNumLeft,
+               textD->top, textD->lineNumWidth, textD->height, False);
+  
+  /* Draw the line numbers, aligned to the text */
+  nCols = min(11, textD->lineNumWidth / charWidth);
+  y = textD->top;
+  line = getAbsTopLineNum(textD);
+  for (visLine=0; visLine < textD->nVisibleLines; visLine++) {
+    lineStart = textD->lineStarts[visLine];
+    if (lineStart != -1 && (lineStart==0 ||
+                            BufGetCharacter(textD->buffer, lineStart-1)=='\n')) {
+      sprintf(lineNumString, "%*d", nCols, line);
+      XDrawImageString(XtDisplay(textD->w), XtWindow(textD->w),
+                       textD->lineNumGC, textD->lineNumLeft, y + textD->ascent,
+                       lineNumString, strlen(lineNumString));
+      line++;
+    } else {
+      XClearArea(XtDisplay(textD->w), XtWindow(textD->w),
+                 textD->lineNumLeft, y, textD->lineNumWidth,
+                 textD->ascent + textD->descent, False);
+      if (visLine == 0)
+        line++;
+    }
+    y += lineHeight;
+  }
+#endif
+}
+
+static int max( int i1, int i2 ) {
+  return i1 >= i2 ? i1 : i2;
+}
+
+static int min( int i1, int i2 ) {
+  return i1 <= i2 ? i1 : i2;
+}
+
+
+
+/**
+ Count the number of newlines in a null-terminated text string;
+ */
+static int countlines( const char *string ) {
+  IS_UTF8_ALIGNED(string)
+
+  const char * c;
+  int lineCount = 0;
+  
+  if (!string) return 0;
+  
+  for ( c = string; *c != '\0'; c++ )
+    if ( *c == '\n' ) lineCount++;
+  return lineCount;
+}
+
+
+
+
+/**
+ \brief Returns the width in pixels of the displayed line pointed to by "visLineNum".
+ \param visLineNum index into visible lines array
+ \return width of line in pixels
+ */
+int fltk3::TextDisplay::measure_vline( int visLineNum ) const {
+  int lineLen = vline_length( visLineNum );
+  int lineStartPos = mLineStarts[ visLineNum ];
+  if (lineStartPos < 0 || lineLen == 0) return 0;
+  return handle_vline(GET_WIDTH, lineStartPos, lineLen, 0, 0, 0, 0, 0, 0);
+}
+
+
+
+/**
+ \brief Return true if there are lines visible with no corresponding buffer text.
+ \return 1 if there are empty lines
+ */
+int fltk3::TextDisplay::empty_vlines() const {
+  return (mNVisibleLines > 0) && (mLineStarts[ mNVisibleLines - 1 ] == -1);
+}
+
+
+
+/**
+ \brief Count number of bytes in a visible line.
+ 
+ Return the length of a line (number of bytes) by examining
+ entries in the line starts array rather than by scanning for newlines.
+ 
+ \param visLineNum index of line in visible line array
+ \return number of bytes in this line
+ */
+int fltk3::TextDisplay::vline_length( int visLineNum ) const {
+  int nextLineStart, lineStartPos;
+  
+  if (visLineNum < 0 || visLineNum >= mNVisibleLines)
+    return (0);
+  
+  lineStartPos = mLineStarts[ visLineNum ];
+  
+  if ( lineStartPos == -1 )
+    return 0;
+  
+  if ( visLineNum + 1 >= mNVisibleLines )
+    return mLastChar - lineStartPos;
+  
+  nextLineStart = mLineStarts[ visLineNum + 1 ];
+  if ( nextLineStart == -1 )
+    return mLastChar - lineStartPos;
+  
+  int nextLineStartMinus1 = buffer()->prev_char(nextLineStart);
+  if (wrap_uses_character(nextLineStartMinus1))
+    return nextLineStartMinus1 - lineStartPos;
+  
+  return nextLineStart - lineStartPos;
+}
+
+
+
+/**
+ \brief Wrapping calculations.
+ 
+ When continuous wrap is on, and the user inserts or deletes characters,
+ wrapping can happen before and beyond the changed position.  This routine
+ finds the extent of the changes, and counts the deleted and inserted lines
+ over that range.  It also attempts to minimize the size of the range to
+ what has to be counted and re-displayed, so the results can be useful
+ both for delimiting where the line starts need to be recalculated, and
+ for deciding what part of the text to redisplay.
+ 
+ \param deletedText
+ \param pos
+ \param nInserted
+ \param nDeleted
+ \param modRangeStart
+ \param modRangeEnd
+ \param linesInserted
+ \param linesDeleted
+ */
+void fltk3::TextDisplay::find_wrap_range(const char *deletedText, int pos,
+                                      int nInserted, int nDeleted, 
+                                      int *modRangeStart, int *modRangeEnd,
+                                      int *linesInserted, int *linesDeleted) {
+  IS_UTF8_ALIGNED(deletedText)
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int length, retPos, retLines, retLineStart, retLineEnd;
+  fltk3::TextBuffer *deletedTextBuf, *buf = buffer();
+  int nVisLines = mNVisibleLines;
+  int *lineStarts = mLineStarts;
+  int countFrom, countTo, lineStart, adjLineStart, i;
+  int visLineNum = 0, nLines = 0;
+  
+  /*
+   ** Determine where to begin searching: either the previous newline, or
+   ** if possible, limit to the start of the (original) previous displayed
+   ** line, using information from the existing line starts array
+   */
+  if (pos >= mFirstChar && pos <= mLastChar) {
+    for (i=nVisLines-1; i>0; i--) {
+      if (lineStarts[i] != -1 && pos >= lineStarts[i]) {
+        break;
+      }
+    }
+    if (i > 0) {
+      countFrom = lineStarts[i-1];
+      visLineNum = i-1;
+    } else {
+      countFrom = buf->line_start(pos);
+    }
+  } else {
+    countFrom = buf->line_start(pos);
+  }
+  
+  IS_UTF8_ALIGNED2(buf, countFrom)
+  
+  /*
+   ** Move forward through the (new) text one line at a time, counting
+   ** displayed lines, and looking for either a real newline, or for the
+   ** line starts to re-sync with the original line starts array
+   */
+  lineStart = countFrom;
+  *modRangeStart = countFrom;
+  for (;;) {
+    
+    /* advance to the next line.  If the line ended in a real newline
+     or the end of the buffer, that's far enough */
+    wrapped_line_counter(buf, lineStart, buf->length(), 1, true, 0,
+                         &retPos, &retLines, &retLineStart, &retLineEnd);
+    if (retPos >= buf->length()) {
+      countTo = buf->length();
+      *modRangeEnd = countTo;
+      if (retPos != retLineEnd)
+        nLines++;
+      break;
+    } else {
+      lineStart = retPos;
+    }
+    nLines++;
+    if (lineStart > pos + nInserted && buf->char_at(buf->prev_char(lineStart)) == '\n') {
+      countTo = lineStart;
+      *modRangeEnd = lineStart;
+      break;
+    }
+    
+    /* Don't try to resync in continuous wrap mode with non-fixed font
+     sizes; it would result in a chicken-and-egg dependency between
+     the calculations for the inserted and the deleted lines. 
+     If we're in that mode, the number of deleted lines is calculated in
+     advance, without resynchronization, so we shouldn't resynchronize
+     for the inserted lines either. */
+    if (mSuppressResync)
+      continue;
+    
+    /* check for synchronization with the original line starts array
+     before pos, if so, the modified range can begin later */
+    if (lineStart <= pos) {
+      while (visLineNum<nVisLines && lineStarts[visLineNum] < lineStart)
+        visLineNum++;
+      if (visLineNum < nVisLines && lineStarts[visLineNum] == lineStart) {
+        countFrom = lineStart;
+        nLines = 0;
+        if (visLineNum+1 < nVisLines && lineStarts[visLineNum+1] != -1)
+          *modRangeStart = min(pos, buf->prev_char(lineStarts[visLineNum+1]));
+        else
+          *modRangeStart = countFrom;
+      } else
+        *modRangeStart = min(*modRangeStart, buf->prev_char(lineStart));
+    }
+    
+    /* check for synchronization with the original line starts array
+     after pos, if so, the modified range can end early */
+    else if (lineStart > pos + nInserted) {
+      adjLineStart = lineStart - nInserted + nDeleted;
+      while (visLineNum<nVisLines && lineStarts[visLineNum]<adjLineStart)
+        visLineNum++;
+      if (visLineNum < nVisLines && lineStarts[visLineNum] != -1 &&
+          lineStarts[visLineNum] == adjLineStart) {
+        countTo = line_end(lineStart, true);
+        *modRangeEnd = lineStart;
+        break;
+      }
+    }
+  }
+  *linesInserted = nLines;
+  
+  
+  /* Count deleted lines between countFrom and countTo as the text existed
+   before the modification (that is, as if the text between pos and
+   pos+nInserted were replaced by "deletedText").  This extra context is
+   necessary because wrapping can occur outside of the modified region
+   as a result of adding or deleting text in the region. This is done by
+   creating a textBuffer containing the deleted text and the necessary
+   additional context, and calling the wrappedLineCounter on it.
+   
+   NOTE: This must not be done in continuous wrap mode when the font
+   width is not fixed. In that case, the calculation would try
+   to access style information that is no longer available (deleted
+   text), or out of date (updated highlighting), possibly leading 
+   to completely wrong calculations and/or even crashes eventually.
+   (This is not theoretical; it really happened.)
+   
+   In that case, the calculation of the number of deleted lines
+   has happened before the buffer was modified (only in that case,
+   because resynchronization of the line starts is impossible
+   in that case, which makes the whole calculation less efficient).
+   */
+  if (mSuppressResync) {
+    *linesDeleted = mNLinesDeleted;
+    mSuppressResync = 0;
+    return;
+  }
+  
+  length = (pos-countFrom) + nDeleted +(countTo-(pos+nInserted));
+  deletedTextBuf = new fltk3::TextBuffer(length);
+  deletedTextBuf->copy(buffer(), countFrom, pos, 0);
+  if (nDeleted != 0)
+    deletedTextBuf->insert(pos-countFrom, deletedText);
+  deletedTextBuf->copy(buffer(), pos+nInserted, countTo, pos-countFrom+nDeleted);
+  /* Note that we need to take into account an offset for the style buffer:
+   the deletedTextBuf can be out of sync with the style buffer. */
+  wrapped_line_counter(deletedTextBuf, 0, length, INT_MAX, true, countFrom, 
+                       &retPos, &retLines, &retLineStart, &retLineEnd, false);
+  delete deletedTextBuf;
+  *linesDeleted = retLines;
+  mSuppressResync = 0;
+}
+
+
+
+/**
+ \brief Wrapping calculations.
+ 
+ This is a stripped-down version of the findWrapRange() function above,
+ intended to be used to calculate the number of "deleted" lines during
+ a buffer modification. It is called _before_ the modification takes place.
+ 
+ This function should only be called in continuous wrap mode with a
+ non-fixed font width. In that case, it is impossible to calculate
+ the number of deleted lines, because the necessary style information 
+ is no longer available _after_ the modification. In other cases, we
+ can still perform the calculation afterwards (possibly even more
+ efficiently).
+
+ \param pos
+ \param nDeleted
+ */
+void fltk3::TextDisplay::measure_deleted_lines(int pos, int nDeleted) {
+  IS_UTF8_ALIGNED2(buffer(), pos)
+
+  int retPos, retLines, retLineStart, retLineEnd;
+  fltk3::TextBuffer *buf = buffer();
+  int nVisLines = mNVisibleLines;
+  int *lineStarts = mLineStarts;
+  int countFrom, lineStart;
+  int visLineNum = 0, nLines = 0, i;
+  /*
+   ** Determine where to begin searching: either the previous newline, or
+   ** if possible, limit to the start of the (original) previous displayed
+   ** line, using information from the existing line starts array
+   */
+  if (pos >= mFirstChar && pos <= mLastChar) {
+    for (i=nVisLines-1; i>0; i--)
+      if (lineStarts[i] != -1 && pos >= lineStarts[i])
+        break;
+    if (i > 0) {
+      countFrom = lineStarts[i-1];
+      visLineNum = i-1;
+    } else
+      countFrom = buf->line_start(pos);
+  } else
+    countFrom = buf->line_start(pos);
+  
+  /*
+   ** Move forward through the (new) text one line at a time, counting
+   ** displayed lines, and looking for either a real newline, or for the
+   ** line starts to re-sync with the original line starts array
+   */
+  lineStart = countFrom;
+  for (;;) {
+    /* advance to the next line.  If the line ended in a real newline
+     or the end of the buffer, that's far enough */
+    wrapped_line_counter(buf, lineStart, buf->length(), 1, true, 0,
+                         &retPos, &retLines, &retLineStart, &retLineEnd);
+    if (retPos >= buf->length()) {
+      if (retPos != retLineEnd)
+        nLines++;
+      break;
+    } else
+      lineStart = retPos;
+    nLines++;
+    if (lineStart > pos + nDeleted && buf->char_at(lineStart-1) == '\n') {
+      break;
+    }
+    
+    /* Unlike in the findWrapRange() function above, we don't try to 
+     resync with the line starts, because we don't know the length 
+     of the inserted text yet, nor the updated style information. 
+     
+     Because of that, we also shouldn't resync with the line starts
+     after the modification either, because we must perform the
+     calculations for the deleted and inserted lines in the same way. 
+     
+     This can result in some unnecessary recalculation and redrawing
+     overhead, and therefore we should only use this two-phase mode
+     of calculation when it's really needed (continuous wrap + variable
+     font width). */
+  }
+  mNLinesDeleted = nLines;
+  mSuppressResync = 1;
+}
+
+
+
+/**
+ \brief Wrapping calculations.
+ 
+ Count forward from startPos to either maxPos or maxLines (whichever is
+ reached first), and return all relevant positions and line count.
+ The provided textBuffer may differ from the actual text buffer of the
+ widget. In that case it must be a (partial) copy of the actual text buffer
+ and the styleBufOffset argument must indicate the starting position of the
+ copy, to take into account the correct style information.
+
+ \param buf
+ \param startPos
+ \param maxPos
+ \param maxLines
+ \param startPosIsLineStart
+ \param styleBufOffset
+
+ \param[out] retPos Position where counting ended.  When counting lines, the
+    position returned is the start of the line "maxLines" lines 
+    beyond "startPos".
+ \param[out] retLines Number of line breaks counted
+ \param[out] retLineStart Start of the line where counting ended
+ \param[out] retLineEnd End position of the last line traversed
+ \param[out] countLastLineMissingNewLine
+ */
+void fltk3::TextDisplay::wrapped_line_counter(fltk3::TextBuffer *buf, int startPos,
+                                           int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset,
+                                           int *retPos, int *retLines, int *retLineStart, int *retLineEnd,
+                                           bool countLastLineMissingNewLine) const {
+  IS_UTF8_ALIGNED2(buf, startPos)
+  IS_UTF8_ALIGNED2(buf, maxPos)
+
+  int lineStart, newLineStart = 0, b, p, colNum, wrapMarginPix;
+  int i, foundBreak;
+  double width;
+  int nLines = 0;
+  unsigned int c;
+  
+  /* Set the wrap margin to the wrap column or the view width */
+  if (mWrapMarginPix != 0) {
+    wrapMarginPix = mWrapMarginPix;
+  } else {
+    wrapMarginPix = text_area.w;
+  }
+  
+  /* Find the start of the line if the start pos is not marked as a
+   line start. */
+  if (startPosIsLineStart)
+    lineStart = startPos;
+  else
+    lineStart = line_start(startPos);
+  
+  /*
+   ** Loop until position exceeds maxPos or line count exceeds maxLines.
+   ** (actually, continues beyond maxPos to end of line containing maxPos,
+   ** in case later characters cause a word wrap back before maxPos)
+   */
+  colNum = 0;
+  width = 0;
+  for (p=lineStart; p<buf->length(); p=buf->next_char(p)) {
+    c = buf->char_at(p);  // UCS-4
+    
+    /* If the character was a newline, count the line and start over,
+     otherwise, add it to the width and column counts */
+    if (c == '\n') {
+      if (p >= maxPos) {
+        *retPos = maxPos;
+        *retLines = nLines;
+        *retLineStart = lineStart;
+        *retLineEnd = maxPos;
+        return;
+      }
+      nLines++;
+      int p1 = buf->next_char(p);
+      if (nLines >= maxLines) {
+        *retPos = p1;
+        *retLines = nLines;
+        *retLineStart = p1;
+        *retLineEnd = p;
+        return;
+      }
+      lineStart = p1;
+      colNum = 0;
+      width = 0;
+    } else {
+      const char *s = buf->address(p);
+      colNum++;
+      // FIXME: it is not a good idea to simply add character widths because on
+      // some platforms, the width is a floating point value and depends on the 
+      // previous character as well.
+      width += measure_proportional_character(s, (int)width, p+styleBufOffset);
+    }
+    
+    /* If character exceeded wrap margin, find the break point and wrap there */
+    if (width > wrapMarginPix) {
+      foundBreak = false;
+      for (b=p; b>=lineStart; b=buf->prev_char(b)) {
+        c = buf->char_at(b);
+        if (c == '\t' || c == ' ') {
+          newLineStart = buf->next_char(b);
+          colNum = 0;
+          width = 0;
+          int iMax = buf->next_char(p);
+          for (i=buf->next_char(b); i<iMax; i = buf->next_char(i)) {
+            width += measure_proportional_character(buf->address(i), (int)width, 
+                                                    i+styleBufOffset);
+            colNum++;
+          }
+          foundBreak = true;
+          break;
+        }
+      }
+      if (!foundBreak) { /* no whitespace, just break at margin */
+        newLineStart = max(p, buf->next_char(lineStart));
+        const char *s = buf->address(b);
+        colNum++;
+        width = measure_proportional_character(s, 0, p+styleBufOffset);
+      }
+      if (p >= maxPos) {
+        *retPos = maxPos;
+        *retLines = maxPos < newLineStart ? nLines : nLines + 1;
+        *retLineStart = maxPos < newLineStart ? lineStart : newLineStart;
+        *retLineEnd = maxPos;
+        return;
+      }
+      nLines++;
+      if (nLines >= maxLines) {
+        *retPos = foundBreak ? buf->next_char(b) : max(p, buf->next_char(lineStart));
+        *retLines = nLines;
+        *retLineStart = lineStart;
+        *retLineEnd = foundBreak ? b : p;
+        return;
+      }
+      lineStart = newLineStart;
+    }
+  }
+  
+  /* reached end of buffer before reaching pos or line target */
+  *retPos = buf->length();
+  *retLines = nLines;
+  if (countLastLineMissingNewLine && colNum > 0) 
+    *retLines = buf->next_char(*retLines);
+  *retLineStart = lineStart;
+  *retLineEnd = buf->length();
+}
+
+
+
+/**
+ \brief Wrapping calculations.
+ 
+ Measure the width in pixels of the first character of string "s" at a
+ particular column "colNum" and buffer position "pos".  This is for measuring
+ characters in proportional or mixed-width highlighting fonts.
+
+ A note about proportional and mixed-width fonts: the mixed width and
+ proportional font code in nedit does not get much use in general editing,
+ because nedit doesn't allow per-language-mode fonts, and editing programs
+ in a proportional font is usually a bad idea, so very few users would
+ choose a proportional font as a default.  There are still probably mixed-
+ width syntax highlighting cases where things don't redraw properly for
+ insertion/deletion, though static display and wrapping and resizing
+ should now be solid because they are now used for online help display.
+ 
+ \param s text string
+ \param xPix x pixel position needed for calculating tab widths
+ \param pos offset within string
+ \return width of character in pixels
+ */
+double fltk3::TextDisplay::measure_proportional_character(const char *s, int xPix, int pos) const {
+  IS_UTF8_ALIGNED(s)
+  
+  if (*s=='\t') {
+    int tab = (int)col_to_x(mBuffer->tab_distance());
+    return (((xPix/tab)+1)*tab) - xPix;
+  }
+  
+  int charLen = fltk3::utf8len1(*s), style = 0;
+  if (mStyleBuffer) {
+    style = mStyleBuffer->byte_at(pos);
+  }
+  return string_width(s, charLen, style);
+}
+
+
+
+/**
+ \brief Finds both the end of the current line and the start of the next line.  
+ 
+ Why?
+ In continuous wrap mode, if you need to know both, figuring out one from the
+ other can be expensive or error prone.  The problem comes when there's a
+ trailing space or tab just before the end of the buffer.  To translate an
+ end of line value to or from the next lines start value, you need to know
+ whether the trailing space or tab is being used as a line break or just a
+ normal character, and to find that out would otherwise require counting all
+ the way back to the beginning of the line.
+ 
+ \param startPos
+ \param startPosIsLineStart
+ \param[out] lineEnd
+ \param[out] nextLineStart
+ */
+void fltk3::TextDisplay::find_line_end(int startPos, bool startPosIsLineStart,
+                                    int *lineEnd, int *nextLineStart) const {
+  IS_UTF8_ALIGNED2(buffer(), startPos)
+
+  int retLines, retLineStart;
+  
+  /* if we're not wrapping use more efficient BufEndOfLine */
+  if (!mContinuousWrap) {
+    int le = buffer()->line_end(startPos);
+    int ls = buffer()->next_char(le);
+    *lineEnd = le;
+    *nextLineStart = min(buffer()->length(), ls);
+    return;
+  }
+  
+  /* use the wrapped line counter routine to count forward one line */
+  wrapped_line_counter(buffer(), startPos, buffer()->length(),
+                       1, startPosIsLineStart, 0, nextLineStart, &retLines,
+                       &retLineStart, lineEnd);
+}
+
+
+
+/**
+ \brief Check if the line break is caused by a \\n or by line wrapping.
+ 
+ Line breaks in continuous wrap mode usually happen at newlines or
+ whitespace.  This line-terminating character is not included in line
+ width measurements and has a special status as a non-visible character.
+ However, lines with no whitespace are wrapped without the benefit of a
+ line terminating character, and this distinction causes endless trouble
+ with all of the text display code which was originally written without
+ continuous wrap mode and always expects to wrap at a newline character.
+
+ Given the position of the end of the line, as returned by TextDEndOfLine
+ or BufEndOfLine, this returns true if there is a line terminating
+ character, and false if there's not.  On the last character in the
+ buffer, this function can't tell for certain whether a trailing space was
+ used as a wrap point, and just guesses that it wasn't.  So if an exact
+ accounting is necessary, don't use this function.
+ 
+ \param lineEndPos index of character where the line wraps
+ \return 1 if a \\n character causes the line wrap
+ */ 
+int fltk3::TextDisplay::wrap_uses_character(int lineEndPos) const {
+  IS_UTF8_ALIGNED2(buffer(), lineEndPos)
+
+  unsigned int c;
+  
+  if (!mContinuousWrap || lineEndPos == buffer()->length())
+    return 1;
+  
+  c = buffer()->char_at(lineEndPos);
+  return c == '\n' || ((c == '\t' || c == ' ') &&
+                       lineEndPos + 1 < buffer()->length());
+}
+
+
+
+/**
+ \brief I don't know what this does!
+ 
+ Extend the range of a redraw request (from *start to *end) with additional
+ redraw requests resulting from changes to the attached style buffer (which
+ contains auxiliary information for coloring or styling text).
+ 
+ \param startpos ??
+ \param endpos ??
+ 
+ \todo Unicode?
+ */
+void fltk3::TextDisplay::extend_range_for_styles( int *startpos, int *endpos ) {
+  IS_UTF8_ALIGNED2(buffer(), (*startpos))  
+  IS_UTF8_ALIGNED2(buffer(), (*endpos))  
+  
+  fltk3::TextSelection * sel = mStyleBuffer->primary_selection();
+  int extended = 0;
+  
+  /* The peculiar protocol used here is that modifications to the style
+   buffer are marked by selecting them with the buffer's primary fltk3::TextSelection.
+   The style buffer is usually modified in response to a modify callback on
+   the text buffer BEFORE fltk3::TextDisplay.c's modify callback, so that it can keep
+   the style buffer in step with the text buffer.  The style-update
+   callback can't just call for a redraw, because fltk3::TextDisplay hasn't processed
+   the original text changes yet.  Anyhow, to minimize redrawing and to
+   avoid the complexity of scheduling redraws later, this simple protocol
+   tells the text display's buffer modify callback to extend its redraw
+   range to show the text color/and font changes as well. */
+  if ( sel->selected() ) {
+    if ( sel->start() < *startpos ) {
+      *startpos = sel->start();
+      // somewhere while deleting, alignment is lost. We do this just to be sure.
+      *startpos = buffer()->utf8_align(*startpos);
+      IS_UTF8_ALIGNED2(buffer(), (*startpos))  
+      extended = 1;
+    }
+    if ( sel->end() > *endpos ) {
+      *endpos = sel->end();
+      *endpos = buffer()->utf8_align(*endpos);
+      IS_UTF8_ALIGNED2(buffer(), (*endpos))  
+      extended = 1;
+    }
+  }
+  
+  /* If the fltk3::TextSelection was extended due to a style change, and some of the
+   fonts don't match in spacing, extend redraw area to end of line to
+   redraw characters exposed by possible font size changes */
+  if ( extended )
+    *endpos = mBuffer->line_end( *endpos ) + 1;
+  
+  IS_UTF8_ALIGNED2(buffer(), (*endpos))
+}
+
+
+
+/**
+ \brief Draw the widget.
+ 
+ This function tries to limit drawing to smaller areas if possible.
+ */
+void fltk3::TextDisplay::draw(void) {
+  // don't even try if there is no associated text buffer!
+  if (!buffer()) { draw_box(); return; }
+  
+  fltk3::push_clip(x(),y(),w(),h());	// prevent drawing outside widget area
+  
+  // draw the non-text, non-scrollbar areas.
+  if (damage() & fltk3::DAMAGE_ALL) {
+    //    printf("drawing all (box = %d)\n", box());
+    if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+      // if to printer, draw the background
+      fltk3::rectf(text_area.x, text_area.y, text_area.w, text_area.h, color() );
+    }
+    // draw the box()
+    int W = w(), H = h();
+    draw_box(box(), x(), y(), W, H, color());
+    
+    if (mHScrollBar->visible())
+      W -= scrollbar_width();
+    if (mVScrollBar->visible())
+      H -= scrollbar_width();
+    
+    // left margin
+    fltk3::rectf(text_area.x-LEFT_MARGIN, text_area.y-TOP_MARGIN,
+             LEFT_MARGIN, text_area.h+TOP_MARGIN+BOTTOM_MARGIN,
+             color());
+    
+    // right margin
+    fltk3::rectf(text_area.x+text_area.w, text_area.y-TOP_MARGIN,
+             RIGHT_MARGIN, text_area.h+TOP_MARGIN+BOTTOM_MARGIN,
+             color());
+    
+    // top margin
+    fltk3::rectf(text_area.x, text_area.y-TOP_MARGIN,
+             text_area.w, TOP_MARGIN, color());
+    
+    // bottom margin
+    fltk3::rectf(text_area.x, text_area.y+text_area.h,
+             text_area.w, BOTTOM_MARGIN, color());
+    
+    // draw that little box in the corner of the scrollbars
+    if (mVScrollBar->visible() && mHScrollBar->visible())
+      fltk3::rectf(mVScrollBar->x(), mHScrollBar->y(),
+               mVScrollBar->w(), mHScrollBar->h(),
+               fltk3::GRAY);
+    
+    // blank the previous cursor protrusions
+  }
+  else if (damage() & (fltk3::DAMAGE_SCROLL | fltk3::DAMAGE_EXPOSE)) {
+    //    printf("blanking previous cursor extrusions at Y: %d\n", mCursorOldY);
+    // CET - FIXME - save old cursor position instead and just draw side needed?
+    fltk3::push_clip(text_area.x-LEFT_MARGIN,
+                 text_area.y,
+                 text_area.w+LEFT_MARGIN+RIGHT_MARGIN,
+                 text_area.h);
+    fltk3::rectf(text_area.x-LEFT_MARGIN, mCursorOldY,
+             LEFT_MARGIN, mMaxsize, color());
+    fltk3::rectf(text_area.x+text_area.w, mCursorOldY,
+             RIGHT_MARGIN, mMaxsize, color());
+    fltk3::pop_clip();
+  }
+  
+  // draw the scrollbars
+  if (damage() & (fltk3::DAMAGE_ALL | fltk3::DAMAGE_CHILD)) {
+    mVScrollBar->damage(fltk3::DAMAGE_ALL);
+    mHScrollBar->damage(fltk3::DAMAGE_ALL);
+  }
+  update_child(*mVScrollBar);
+  update_child(*mHScrollBar);
+  
+  // draw all of the text
+  if (damage() & (fltk3::DAMAGE_ALL | fltk3::DAMAGE_EXPOSE)) {
+    //printf("drawing all text\n");
+    int X, Y, W, H;
+    if (fltk3::clip_box(text_area.x, text_area.y, text_area.w, text_area.h,
+                    X, Y, W, H)) {
+      // Draw text using the intersected clipping box...
+      // (this sets the clipping internally)
+      draw_text(X, Y, W, H);
+    } else {
+      // Draw the whole area...
+      draw_text(text_area.x, text_area.y, text_area.w, text_area.h);
+    }
+  }
+  else if (damage() & fltk3::DAMAGE_SCROLL) {
+    // draw some lines of text
+    fltk3::push_clip(text_area.x, text_area.y,
+                 text_area.w, text_area.h);
+    //printf("drawing text from %d to %d\n", damage_range1_start, damage_range1_end);
+    draw_range(damage_range1_start, damage_range1_end);
+    if (damage_range2_end != -1) {
+      //printf("drawing text from %d to %d\n", damage_range2_start, damage_range2_end);
+      draw_range(damage_range2_start, damage_range2_end);
+    }
+    damage_range1_start = damage_range1_end = -1;
+    damage_range2_start = damage_range2_end = -1;
+    fltk3::pop_clip();
+  }
+  
+  // draw the text cursor
+  if (damage() & (fltk3::DAMAGE_ALL | fltk3::DAMAGE_SCROLL | fltk3::DAMAGE_EXPOSE)
+      && !buffer()->primary_selection()->selected() &&
+      mCursorOn && fltk3::focus() == (fltk3::Widget*)this ) {
+    fltk3::push_clip(text_area.x-LEFT_MARGIN,
+                 text_area.y,
+                 text_area.w+LEFT_MARGIN+RIGHT_MARGIN,
+                 text_area.h);
+    
+    int X, Y;
+    if (position_to_xy(mCursorPos, &X, &Y)) draw_cursor(X, Y);
+    //    else puts("position_to_xy() failed - unable to draw cursor!");
+    //printf("drew cursor at pos: %d (%d,%d)\n", mCursorPos, X, Y);
+    mCursorOldY = Y;
+    fltk3::pop_clip();
+  }
+  fltk3::pop_clip();
+}
+
+
+namespace fltk3 {
+// this processes drag events due to mouse for fltk3::TextDisplay and
+// also drags due to cursor movement with shift held down for
+// fltk3::TextEditor
+void text_drag_me(int pos, fltk3::TextDisplay* d) {
+  if (d->dragType == fltk3::TextDisplay::DRAG_CHAR) {
+    if (pos >= d->dragPos) {
+      d->buffer()->select(d->dragPos, pos);
+    } else {
+      d->buffer()->select(pos, d->dragPos);
+    }
+    d->insert_position(pos);
+  } else if (d->dragType == fltk3::TextDisplay::DRAG_WORD) {
+    if (pos >= d->dragPos) {
+      d->insert_position(d->word_end(pos));
+      d->buffer()->select(d->word_start(d->dragPos), d->word_end(pos));
+    } else {
+      d->insert_position(d->word_start(pos));
+      d->buffer()->select(d->word_start(pos), d->word_end(d->dragPos));
+    }
+  } else if (d->dragType == fltk3::TextDisplay::DRAG_LINE) {
+    if (pos >= d->dragPos) {
+      d->insert_position(d->buffer()->line_end(pos)+1);
+      d->buffer()->select(d->buffer()->line_start(d->dragPos),
+                          d->buffer()->line_end(pos)+1);
+    } else {
+      d->insert_position(d->buffer()->line_start(pos));
+      d->buffer()->select(d->buffer()->line_start(pos),
+                          d->buffer()->line_end(d->dragPos)+1);
+    }
+  }
+}
+
+}
+
+
+/**
+ \brief Timer callback for scroll events.
+ 
+ This timer event scrolls the text view proportionally to
+ how far the mouse pointer has left the text area. This 
+ allows for smooth scrolling without "wiggeling" the mouse.
+ */
+void fltk3::TextDisplay::scroll_timer_cb(void *user_data) {
+  fltk3::TextDisplay *w = (fltk3::TextDisplay*)user_data;
+  int pos;
+  switch (scroll_direction) {
+    case 1: // mouse is to the right, scroll left
+      w->scroll(w->mTopLineNum, w->mHorizOffset + scroll_amount);
+      pos = w->xy_to_position(w->text_area.x + w->text_area.w, scroll_y, CURSOR_POS);
+      break;
+    case 2: // mouse is to the left, scroll right
+      w->scroll(w->mTopLineNum, w->mHorizOffset + scroll_amount);
+      pos = w->xy_to_position(w->text_area.x, scroll_y, CURSOR_POS);
+      break;
+    case 3: // mouse is above, scroll down
+      w->scroll(w->mTopLineNum + scroll_amount, w->mHorizOffset);
+      pos = w->xy_to_position(scroll_x, w->text_area.y, CURSOR_POS);
+      break;
+    case 4: // mouse is below, scroll up
+      w->scroll(w->mTopLineNum + scroll_amount, w->mHorizOffset);
+      pos = w->xy_to_position(scroll_x, w->text_area.y + w->text_area.h, CURSOR_POS);
+      break;
+    default:
+      return;
+  }
+  fltk3::text_drag_me(pos, w);
+  fltk3::repeat_timeout(.1, scroll_timer_cb, user_data);
+}
+
+
+static fltk3::MenuItem ccp_menu[] = {
+  { "Cut", fltk3::COMMAND|'x', 0, (void*)1 },
+  { "Copy", fltk3::COMMAND|'c', 0, (void*)2 },
+  { "Paste", fltk3::COMMAND|'v', 0, (void*)3 },
+  { 0 }
+};
+
+/**
+ Handles right mouse button clicks.
+ */
+void fltk3::TextDisplay::handle_menu_event() {
+  fltk3::TextBuffer *buf = mBuffer;
+  if (!buf) return;
+  int m = buf->primary_selection()->end(), p = buf->primary_selection()->start();
+  int pc = xy_to_position(fltk3::event_x(), fltk3::event_y(), CHARACTER_POS);
+  if (!buf->primary_selection()->selected()) { p = m = insert_position(); }
+  if ( ( (p==m && p!=pc) || pc<p || pc>m )) {
+    p = word_start(pc); 
+    m = word_end(pc);
+    buf->primary_selection()->set(p, m);
+    insert_position(pc);
+  }
+  if (p!=m && !readonly())
+    ccp_menu[0].activate();
+  else
+    ccp_menu[0].deactivate();
+  if (p!=m)
+    ccp_menu[1].activate();
+  else
+    ccp_menu[1].deactivate();
+  if (!readonly() /*&& paste_buffer && *paste_buffer*/ ) // TODO: how do we know that this is read-only? provide a function that can check if data is in the paste buffer
+    ccp_menu[2].activate();
+  else 
+    ccp_menu[2].deactivate();
+  redraw();
+  fltk3::flush();
+  const fltk3::MenuItem *mi = ccp_menu->popup(fltk3::event_x(), fltk3::event_y());
+  if (mi) {
+    const char *copy;
+    switch (mi->argument()) {
+      case 1:
+        copy = buf->selection_text();
+        if (*copy) fltk3::copy(copy, strlen(copy), 1);
+        free((void*)copy);
+        buf->remove_selection();
+        break;
+      case 2: 
+        copy = buf->selection_text();
+        if (*copy) fltk3::copy(copy, strlen(copy), 1);
+        free((void*)copy);
+        break;
+      case 3: 
+        paste(*this, 1); 
+        break;
+    }
+  }
+}
+
+
+/**
+ \brief Event handling.
+ */
+int fltk3::TextDisplay::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (!buffer()) return 0;
+  // This isn't very elegant!
+  if (!fltk3::event_inside(text_area.x, text_area.y, text_area.w, text_area.h) &&
+      !dragging && event != fltk3::LEAVE && event != fltk3::ENTER &&
+      event != fltk3::MOVE && event != fltk3::FOCUS && event != fltk3::UNFOCUS &&
+      event != fltk3::KEYBOARD && event != fltk3::KEYUP) {
+    return Group::handle(event);
+  }
+  
+  switch (event) {
+    case fltk3::ENTER:
+    case fltk3::MOVE:
+      if (active_r()) {
+        if (fltk3::event_inside(text_area.x, text_area.y, text_area.w,
+	                     text_area.h)) window()->cursor(fltk3::CURSOR_INSERT);
+	else window()->cursor(fltk3::CURSOR_DEFAULT);
+	return 1;
+      } else {
+        return 0;
+      }
+      
+    case fltk3::LEAVE:
+    case fltk3::HIDE:
+      if (active_r() && window()) {
+        window()->cursor(fltk3::CURSOR_DEFAULT);
+        
+	return 1;
+      } else {
+	return 0;
+      }
+      
+    case fltk3::PUSH: {
+      if (active_r() && window()) {
+        if (fltk3::event_inside(text_area.x, text_area.y, text_area.w,
+                             text_area.h)) window()->cursor(fltk3::CURSOR_INSERT);
+        else window()->cursor(fltk3::CURSOR_DEFAULT);
+      }
+      
+      if (fltk3::focus() != this) {
+        fltk3::focus(this);
+        handle(fltk3::FOCUS);
+      }
+      if (((unsigned)fltk3::event_buttons())==fltk3::BUTTON3) {
+        handle_menu_event();
+        return 1;
+      }
+      if (Group::handle(event)) return 1;
+      if (fltk3::event_state()&fltk3::SHIFT) return handle(fltk3::DRAG);
+      dragging = 1;
+      int pos = xy_to_position(fltk3::event_x(), fltk3::event_y(), CURSOR_POS);
+      dragPos = pos;
+      if (buffer()->primary_selection()->includes(pos)) {
+        dragType = DRAG_START_DND;
+        return 1;
+      }
+      dragType = fltk3::event_clicks();
+      if (dragType == DRAG_CHAR) {
+        buffer()->unselect();
+//	Fl::copy("", 0, 0); /* removed for STR 2668 */
+      }
+      else if (dragType == DRAG_WORD) {
+        buffer()->select(word_start(pos), word_end(pos));
+	dragPos = word_start(pos);
+	}
+      
+      if (buffer()->primary_selection()->selected())
+        insert_position(buffer()->primary_selection()->end());
+      else
+        insert_position(pos);
+      show_insert_position();
+      return 1;
+    }
+      
+    case fltk3::DRAG: {
+      if (dragType==DRAG_NONE)
+        return 1;
+      if (dragType==DRAG_START_DND) {
+        if (!fltk3::event_is_click() && fltk3::dnd_text_ops()) {
+          const char* copy = buffer()->selection_text();
+          fltk3::dnd();
+          free((void*)copy);
+        }
+        return 1;
+      }
+      int X = fltk3::event_x(), Y = fltk3::event_y(), pos = insert_position();
+      // if we leave the text_area, we start a timer event
+      // that will take care of scrolling and selecting
+      if (Y < text_area.y) {
+        scroll_x = X;
+        scroll_amount = (Y - text_area.y) / 5 - 1;
+        if (!scroll_direction) {
+          fltk3::add_timeout(.01, scroll_timer_cb, this);
+        }
+        scroll_direction = 3;
+      } else if (Y >= text_area.y+text_area.h) {
+        scroll_x = X;
+        scroll_amount = (Y - text_area.y - text_area.h) / 5 + 1;
+        if (!scroll_direction) {
+          fltk3::add_timeout(.01, scroll_timer_cb, this);
+        }
+        scroll_direction = 4;
+      } else if (X < text_area.x) {
+        scroll_y = Y;
+        scroll_amount = (X - text_area.x) / 2 - 1;
+        if (!scroll_direction) {
+          fltk3::add_timeout(.01, scroll_timer_cb, this);
+        }
+        scroll_direction = 2;
+      } else if (X >= text_area.x+text_area.w) {
+        scroll_y = Y;
+        scroll_amount = (X - text_area.x - text_area.w) / 2 + 1;
+        if (!scroll_direction) {
+          fltk3::add_timeout(.01, scroll_timer_cb, this);
+        }
+        scroll_direction = 1;
+      } else {
+        if (scroll_direction) {
+          fltk3::remove_timeout(scroll_timer_cb, this);
+          scroll_direction = 0;
+        }
+        pos = xy_to_position(X, Y, CURSOR_POS);
+        pos = buffer()->next_char(pos);
+      }
+      fltk3::text_drag_me(pos, this);
+      return 1;
+    }
+      
+    case fltk3::RELEASE: {
+      if (fltk3::event_is_click() && (! fltk3::event_clicks()) && 
+	  buffer()->primary_selection()->includes(dragPos) && !(fltk3::event_state()&fltk3::SHIFT) ) {
+	buffer()->unselect(); // clicking in the selection: unselect and move cursor
+	insert_position(dragPos);
+	return 1;
+      } else if (fltk3::event_clicks() == DRAG_LINE && fltk3::event_button() == fltk3::LEFT_MOUSE) {
+        buffer()->select(buffer()->line_start(dragPos), buffer()->next_char(buffer()->line_end(dragPos)));
+	dragPos = line_start(dragPos);
+	dragType = DRAG_CHAR;
+      } else {
+	dragging = 0;
+	if (scroll_direction) {
+	  fltk3::remove_timeout(scroll_timer_cb, this);
+	  scroll_direction = 0;
+	}
+	
+	// convert from WORD or LINE selection to CHAR
+	/*if (insert_position() >= dragPos)
+	  dragPos = buffer()->primary_selection()->start();
+	else
+	  dragPos = buffer()->primary_selection()->end();*/
+	dragType = DRAG_CHAR;
+      }
+      
+      const char* copy = buffer()->selection_text();
+      if (*copy) fltk3::copy(copy, strlen(copy), 0);
+      free((void*)copy);
+      return 1;
+    }
+      
+    case fltk3::MOUSEWHEEL:
+      if (fltk3::event_dy()) return mVScrollBar->handle(event);
+      else return mHScrollBar->handle(event);
+      
+    case fltk3::UNFOCUS:
+      if (active_r() && window()) window()->cursor(fltk3::CURSOR_DEFAULT);
+    case fltk3::FOCUS:
+      if (buffer()->selected()) {
+        int start, end;
+        if (buffer()->selection_position(&start, &end))
+          redisplay_range(start, end);
+      }
+      if (buffer()->secondary_selected()) {
+        int start, end;
+        if (buffer()->secondary_selection_position(&start, &end))
+          redisplay_range(start, end);
+      }
+      if (buffer()->highlight()) {
+        int start, end;
+        if (buffer()->highlight_position(&start, &end))
+          redisplay_range(start, end);
+      }
+      return 1;
+      
+    case fltk3::KEYBOARD:
+      // Copy?
+      if ((fltk3::event_state()&(fltk3::CTRL|fltk3::COMMAND)) && fltk3::event_key()=='c') {
+        if (!buffer()->selected()) return 1;
+        const char *copy = buffer()->selection_text();
+        if (*copy) fltk3::copy(copy, strlen(copy), 1);
+        free((void*)copy);
+        return 1;
+      }
+      
+      // Select all ?
+      if ((fltk3::event_state()&(fltk3::CTRL|fltk3::COMMAND)) && fltk3::event_key()=='a') {
+        buffer()->select(0,buffer()->length());
+        const char *copy = buffer()->selection_text();
+        if (*copy) fltk3::copy(copy, strlen(copy), 0);
+        free((void*)copy);
+        return 1;
+      }
+      
+      if (mVScrollBar->handle(event)) return 1;
+      if (mHScrollBar->handle(event)) return 1;
+      
+      break;
+      
+    case fltk3::SHORTCUT:
+      if (!(shortcut() ? fltk3::test_shortcut(shortcut()) : test_shortcut()))
+        return 0;
+      if (fltk3::visible_focus() && handle(fltk3::FOCUS)) {
+        fltk3::focus(this);
+        return 1;
+      }
+      break;
+      
+  }
+  
+  return 0;
+}
+
+
+/*
+ Convert an x pixel position into a column number.
+ */
+double fltk3::TextDisplay::x_to_col(double y) const
+{
+  if (!mColumnScale) {
+    mColumnScale = string_width("Mitg", 4, 'A') / 4.0;
+  }
+  return (y/mColumnScale)+0.5;
+}
+
+
+/**
+ Convert a column number into an x pixel position.
+ */
+double fltk3::TextDisplay::col_to_x(double col) const
+{
+  if (!mColumnScale) {
+    // recalculate column scale value
+    x_to_col(0); 
+  }
+  return col*mColumnScale;
+}
+
+
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TextEditor.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Text_Editor.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TextEditor.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TextEditor.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,656 @@
+//
+// "$Id$"
+//
+// Copyright 2001-2010 by Bill Spitzak and others.
+// Original code Copyright Mark Edel.  Permission to distribute under
+// the LGPL for the FLTK library granted by Mark Edel.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <ctype.h>
+#include <fltk3/run.h>
+#include <fltk3/Window.h>
+#include <fltk3/TextEditor.h>
+#include <fltk3/ask.h>
+
+
+/* Keyboard Control Matrix
+
+key\modifier   plain  Ctrl   Alt  Meta  
+  left          1/1  13/9   0/13  0/9  
+  right         2/2  14/10  0/14  0/10  
+  up            3/19 21/7   0/15  0/17 
+  down          4/20 22/8   0/16  0/18
+  home          9/5  17/0   0/0   0/0
+  end          10/6  18/0   0/0   0/0
+  page up      11/7  23/0   0/11  0/0
+  page down    12/8  24/0   0/12  0/0
+    (FLTK action / OS X action)
+    (adding the shift key extends the selection, all other combinations are no-op)
+
+  0: no-op
+  1: move cursor to the left, at line beginning wrap to end of prev line, at doc start no-op
+  2: move cursor to the right, at line end move to beginning of the next line, at doc end no-op
+  3: move cursor up, at doc top no-op
+  4: move cursor down, at doc bottom no-op
+  5: scroll display to top of text (cursor unchanged)
+  6: scroll display to end of text (cursor unchanged)
+  7: scroll text down one page (cursor unchanged)
+  8: scroll text up one page (cursor unchanged)
+  9: move cursor to beginning of line
+ 10: move cursor to end of line
+ 11: move cursor up one page and scroll down
+ 12: move cursor down one page and scroll up
+ 13: move to the beginning of the word or the previous word
+ 14: move to the end of the word or the next word
+ 15: if start of line: start of prev line, else start of this line
+ 16: if end of line: end of next line, else end of this line
+ 17: move cursor to the beginning of the document
+ 18: move cursor to the end of the document
+ 19: move cursor up, at doc top: home, at doc start: no-op)
+ 20: move cursor down, at doc bot: end, at doc end: no-op)
+ 21: scroll text down one line (cursor unchanged)
+ 22: scroll text up one line (cursor unchanged)
+ 23: move cursor to the beginning of the top of the screen
+ 24: move cursor to the beginning of the bottom of the window
+*/
+
+/**  The constructor creates a new text editor widget.*/
+fltk3::TextEditor::TextEditor(int X, int Y, int W, int H,  const char* l)
+    : fltk3::TextDisplay(X, Y, W, H, l) {
+  mCursorOn = 1;
+  insert_mode_ = 1;
+  key_bindings = 0;
+
+  // handle the default key bindings
+  add_default_key_bindings(&key_bindings);
+
+  // handle everything else
+  default_key_function(kf_default);
+}
+
+#ifndef FLTK3_DOXYGEN
+fltk3::TextEditor::KeyBinding* fltk3::TextEditor::global_key_bindings = 0;
+#endif
+
+// These are the default key bindings every widget should start with
+static struct {
+  int key;
+  int state;
+  fltk3::TextEditor::KeyFunc func;
+} default_key_bindings[] = {
+  { fltk3::EscapeKey,    fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_ignore     },
+  { fltk3::EnterKey,     fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_enter      },
+  { fltk3::KPEnterKey,  fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_enter      },
+  { fltk3::BackSpaceKey, fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_backspace  },
+  { fltk3::InsertKey,    fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_insert     },
+  { fltk3::DeleteKey,    fltk3::TEXT_EDITOR_ANY_STATE, fltk3::TextEditor::kf_delete     },
+  { fltk3::HomeKey,      0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::EndKey,       0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::LeftKey,      0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::UpKey,        0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::RightKey,     0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::DownKey,      0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::PageUpKey,   0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::PageDownKey, 0,                        fltk3::TextEditor::kf_move       },
+  { fltk3::HomeKey,      fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::EndKey,       fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::LeftKey,      fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::UpKey,        fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::RightKey,     fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::DownKey,      fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::PageUpKey,   fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::PageDownKey, fltk3::SHIFT,                 fltk3::TextEditor::kf_shift_move },
+  { fltk3::HomeKey,      fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::EndKey,       fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::LeftKey,      fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::UpKey,        fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::RightKey,     fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::DownKey,      fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::PageUpKey,   fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::PageDownKey, fltk3::CTRL,                  fltk3::TextEditor::kf_ctrl_move  },
+  { fltk3::HomeKey,      fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::EndKey,       fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::LeftKey,      fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::UpKey,        fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::RightKey,     fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::DownKey,      fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::PageUpKey,   fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+  { fltk3::PageDownKey, fltk3::CTRL|fltk3::SHIFT,         fltk3::TextEditor::kf_c_s_move   },
+//{ FL_Clear,	  0,                        fltk3::TextEditor::delete_to_eol },
+  { 'z',          fltk3::CTRL,                  fltk3::TextEditor::kf_undo	  },
+  { '/',          fltk3::CTRL,                  fltk3::TextEditor::kf_undo	  },
+  { 'x',          fltk3::CTRL,                  fltk3::TextEditor::kf_cut        },
+  { fltk3::DeleteKey,    fltk3::SHIFT,                 fltk3::TextEditor::kf_cut        },
+  { 'c',          fltk3::CTRL,                  fltk3::TextEditor::kf_copy       },
+  { fltk3::InsertKey,    fltk3::CTRL,                  fltk3::TextEditor::kf_copy       },
+  { 'v',          fltk3::CTRL,                  fltk3::TextEditor::kf_paste      },
+  { fltk3::InsertKey,    fltk3::SHIFT,                 fltk3::TextEditor::kf_paste      },
+  { 'a',          fltk3::CTRL,                  fltk3::TextEditor::kf_select_all },
+
+#ifdef __APPLE__
+  // Define CMD+key accelerators...
+  { 'z',          fltk3::COMMAND,               fltk3::TextEditor::kf_undo       },
+  { 'x',          fltk3::COMMAND,               fltk3::TextEditor::kf_cut        },
+  { 'c',          fltk3::COMMAND,               fltk3::TextEditor::kf_copy       },
+  { 'v',          fltk3::COMMAND,               fltk3::TextEditor::kf_paste      },
+  { 'a',          fltk3::COMMAND,               fltk3::TextEditor::kf_select_all },
+  { fltk3::LeftKey,      fltk3::COMMAND,               fltk3::TextEditor::kf_meta_move  },
+  { fltk3::RightKey,     fltk3::COMMAND,               fltk3::TextEditor::kf_meta_move  },
+  { fltk3::UpKey,        fltk3::COMMAND,               fltk3::TextEditor::kf_meta_move  },
+  { fltk3::DownKey,      fltk3::COMMAND,               fltk3::TextEditor::kf_meta_move  },
+  { fltk3::LeftKey,      fltk3::COMMAND|fltk3::SHIFT,      fltk3::TextEditor::kf_m_s_move   },
+  { fltk3::RightKey,     fltk3::COMMAND|fltk3::SHIFT,      fltk3::TextEditor::kf_m_s_move   },
+  { fltk3::UpKey,        fltk3::COMMAND|fltk3::SHIFT,      fltk3::TextEditor::kf_m_s_move   },
+  { fltk3::DownKey,      fltk3::COMMAND|fltk3::SHIFT,      fltk3::TextEditor::kf_m_s_move   },
+#endif // __APPLE__
+
+  { 0,            0,                        0                             }
+};
+
+/**  Adds all of the default editor key bindings to the specified key binding list.*/
+void fltk3::TextEditor::add_default_key_bindings(KeyBinding** list) {
+  for (int i = 0; default_key_bindings[i].key; i++) {
+    add_key_binding(default_key_bindings[i].key,
+                    default_key_bindings[i].state,
+                    default_key_bindings[i].func,
+                    list);
+  }
+}
+
+/**  Returns the function associated with a key binding.*/
+fltk3::TextEditor::KeyFunc fltk3::TextEditor::bound_key_function(unsigned int key, unsigned int state, KeyBinding* list) {
+  KeyBinding* cur;
+  for (cur = list; cur; cur = cur->next)
+    if (cur->key == key)
+      if (cur->state == fltk3::TEXT_EDITOR_ANY_STATE || cur->state == state)
+        break;
+  if (!cur) return 0;
+  return cur->function;
+}
+
+/**  Removes all of the key bindings associated with the text editor or list.*/
+void fltk3::TextEditor::remove_all_key_bindings(KeyBinding** list) {
+  KeyBinding *cur, *next;
+  for (cur = *list; cur; cur = next) {
+    next = cur->next;
+    delete cur;
+  }
+  *list = 0;
+}
+
+/** Removes the key binding associated with the key "key" of state "state" */
+void fltk3::TextEditor::remove_key_binding(unsigned int key, unsigned int state, KeyBinding** list) {
+  KeyBinding *cur, *last = 0;
+  for (cur = *list; cur; last = cur, cur = cur->next)
+    if (cur->key == key && cur->state == state) break;
+  if (!cur) return;
+  if (last) last->next = cur->next;
+  else *list = cur->next;
+  delete cur;
+}
+/** Adds a key of state "state" with the function "function" */
+void fltk3::TextEditor::add_key_binding(unsigned key, unsigned state, KeyFunc function,
+                                KeyBinding** list) {
+  KeyBinding* kb = new KeyBinding;
+  kb->key = key;
+  kb->state = state;
+  kb->function = function;
+  kb->next = *list;
+  *list = kb;
+}
+
+////////////////////////////////////////////////////////////////
+
+static void kill_selection(fltk3::TextEditor* e) {
+  if (e->buffer()->selected()) {
+    e->insert_position(e->buffer()->primary_selection()->start());
+    e->buffer()->remove_selection();
+  }
+}
+
+/** Inserts the text associated with the key */
+int fltk3::TextEditor::kf_default(unsigned c, fltk3::TextEditor* e) {
+  // FIXME: this function is a mess! Fix this!
+  if (!c || (!isprint(c) && c != '\t')) return 0;
+  char s[2] = "\0";
+  s[0] = (char)c;
+  kill_selection(e);
+  if (e->insert_mode()) e->insert(s);
+  else e->overstrike(s);
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+/** Ignores the keypress */
+int fltk3::TextEditor::kf_ignore(unsigned, fltk3::TextEditor*) {
+  return 0; // don't handle
+}
+/**  Does a backspace in the current buffer.*/
+int fltk3::TextEditor::kf_backspace(unsigned, fltk3::TextEditor* e) {
+  if (!e->buffer()->selected() && e->move_left()) {
+    int p1 = e->insert_position();
+    int p2 = e->buffer()->next_char(p1);
+    e->buffer()->select(p1, p2);
+  }
+  kill_selection(e);
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+/** Inserts a newline at the current cursor position */
+int fltk3::TextEditor::kf_enter(unsigned, fltk3::TextEditor* e) {
+  kill_selection(e);
+  e->insert("\n");
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+namespace fltk3 {
+  extern void text_drag_me(int pos, fltk3::TextDisplay* d);
+}
+
+/**  Moves the text cursor in the direction indicated by key c.*/
+int fltk3::TextEditor::kf_move(unsigned c, fltk3::TextEditor* e) {
+  int i;
+  int selected = e->buffer()->selected();
+  if (!selected)
+    e->dragPos = e->insert_position();
+  e->buffer()->unselect();
+  fltk3::copy("", 0, 0);
+  switch (c) {
+  case fltk3::HomeKey:
+      e->insert_position(e->buffer()->line_start(e->insert_position()));
+      break;
+    case fltk3::EndKey:
+      e->insert_position(e->buffer()->line_end(e->insert_position()));
+      break;
+    case fltk3::LeftKey:
+      e->move_left();
+      break;
+    case fltk3::RightKey:
+      e->move_right();
+      break;
+    case fltk3::UpKey:
+      e->move_up();
+      break;
+    case fltk3::DownKey:
+      e->move_down();
+      break;
+    case fltk3::PageUpKey:
+      for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_up();
+      break;
+    case fltk3::PageDownKey:
+      for (i = 0; i < e->mNVisibleLines - 1; i++) e->move_down();
+      break;
+  }
+  e->show_insert_position();
+  return 1;
+}
+
+/**  Extends the current selection in the direction of key c.*/
+int fltk3::TextEditor::kf_shift_move(unsigned c, fltk3::TextEditor* e) {
+  kf_move(c, e);
+  fltk3::text_drag_me(e->insert_position(), e);
+  char *copy = e->buffer()->selection_text();
+  if (copy) {
+    fltk3::copy(copy, strlen(copy), 0);
+    free(copy);
+    }
+  return 1;
+}
+/** Moves the current text cursor in the direction indicated by control key */
+int fltk3::TextEditor::kf_ctrl_move(unsigned c, fltk3::TextEditor* e) {
+  if (!e->buffer()->selected())
+    e->dragPos = e->insert_position();
+  if (c != fltk3::UpKey && c != fltk3::DownKey) {
+    e->buffer()->unselect();
+    fltk3::copy("", 0, 0);
+    e->show_insert_position();
+  }
+  switch (c) {
+    case fltk3::HomeKey:
+      e->insert_position(0);
+      e->scroll(0, 0);
+      break;
+    case fltk3::EndKey:
+      e->insert_position(e->buffer()->length());
+      e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
+      break;
+    case fltk3::LeftKey:
+      e->previous_word();
+      break;
+    case fltk3::RightKey:
+      e->next_word();
+      break;
+    case fltk3::UpKey:
+      e->scroll(e->mTopLineNum-1, e->mHorizOffset);
+      break;
+    case fltk3::DownKey:
+      e->scroll(e->mTopLineNum+1, e->mHorizOffset);
+      break;
+    case fltk3::PageUpKey:
+      e->insert_position(e->mLineStarts[0]);
+      break;
+    case fltk3::PageDownKey:
+      e->insert_position(e->mLineStarts[e->mNVisibleLines-2]);
+      break;
+  }
+  return 1;
+}
+
+/** Moves the current text cursor in the direction indicated by meta key */
+int fltk3::TextEditor::kf_meta_move(unsigned c, fltk3::TextEditor* e) {
+  if (!e->buffer()->selected())
+    e->dragPos = e->insert_position();
+  if (c != fltk3::UpKey && c != fltk3::DownKey) {
+    e->buffer()->unselect();
+    fltk3::copy("", 0, 0);
+    e->show_insert_position();
+  }
+  switch (c) {
+    case fltk3::UpKey:				// top of buffer
+      e->insert_position(0);
+      e->scroll(0, 0);
+      break;
+    case fltk3::DownKey:			// end of buffer
+      e->insert_position(e->buffer()->length());
+      e->scroll(e->count_lines(0, e->buffer()->length(), 1), 0);
+      break;
+    case fltk3::LeftKey:			// beginning of line
+      kf_move(fltk3::HomeKey, e);
+      break;
+    case fltk3::RightKey:			// end of line
+      kf_move(fltk3::EndKey, e);
+      break;
+  }
+  return 1;
+}
+
+/** Extends the current selection in the direction indicated by meta key c. */
+int fltk3::TextEditor::kf_m_s_move(unsigned c, fltk3::TextEditor* e) {
+  kf_meta_move(c, e);
+  fltk3::text_drag_me(e->insert_position(), e);
+  return 1;
+}
+
+/** Extends the current selection in the direction indicated by control key c. */
+int fltk3::TextEditor::kf_c_s_move(unsigned c, fltk3::TextEditor* e) {
+  kf_ctrl_move(c, e);
+  fltk3::text_drag_me(e->insert_position(), e);
+  return 1;
+}
+
+/**  Moves the text cursor to the beginning of the current line.*/
+int fltk3::TextEditor::kf_home(unsigned int, fltk3::TextEditor* e) {
+    return kf_move(fltk3::HomeKey, e);
+}
+
+/**  Moves the text cursor to the end of the current line.*/
+int fltk3::TextEditor::kf_end(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::EndKey, e);
+}
+
+/**  Moves the text cursor one character to the left.*/
+int fltk3::TextEditor::kf_left(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::LeftKey, e);
+}
+
+/**  Moves the text cursor one line up.*/
+int fltk3::TextEditor::kf_up(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::UpKey, e);
+}
+
+/**  Moves the text cursor one character to the right.*/
+int fltk3::TextEditor::kf_right(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::RightKey, e);
+}
+/**  Moves the text cursor one line down.*/
+int fltk3::TextEditor::kf_down(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::DownKey, e);
+}
+
+/**  Moves the text cursor up one page.*/
+int fltk3::TextEditor::kf_page_up(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::PageUpKey, e);
+}
+
+/**  Moves the text cursor down one page.*/
+int fltk3::TextEditor::kf_page_down(unsigned int, fltk3::TextEditor* e) {
+  return kf_move(fltk3::PageDownKey, e);
+}
+/**  Toggles the insert mode in the text editor.*/
+int fltk3::TextEditor::kf_insert(unsigned int, fltk3::TextEditor* e) {
+  e->insert_mode(e->insert_mode() ? 0 : 1);
+  return 1;
+}
+
+/**  Does a delete of selected text or the current character in the current buffer.*/
+int fltk3::TextEditor::kf_delete(unsigned int, fltk3::TextEditor* e) {
+  if (!e->buffer()->selected()) {
+    int p1 = e->insert_position();
+    int p2 = e->buffer()->next_char(p1);
+    e->buffer()->select(p1, p2);
+  }
+
+  kill_selection(e);
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+/**  Does a copy of selected text or the current character in the current buffer.*/
+int fltk3::TextEditor::kf_copy(unsigned int, fltk3::TextEditor* e) {
+  if (!e->buffer()->selected()) return 1;
+  const char *copy = e->buffer()->selection_text();
+  if (*copy) fltk3::copy(copy, strlen(copy), 1);
+  free((void*)copy);
+  e->show_insert_position();
+  return 1;
+}
+
+/**  Does a cut of selected text in the current buffer.*/
+int fltk3::TextEditor::kf_cut(unsigned int c, fltk3::TextEditor* e) {
+  kf_copy(c, e);
+  kill_selection(e);
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+/**  Does a paste of selected text in the current buffer.*/
+int fltk3::TextEditor::kf_paste(unsigned int, fltk3::TextEditor* e) {
+  kill_selection(e);
+  fltk3::paste(*e, 1);
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return 1;
+}
+
+/**  Selects all text in the current buffer.*/
+int fltk3::TextEditor::kf_select_all(unsigned int, fltk3::TextEditor* e) {
+  e->buffer()->select(0, e->buffer()->length());
+  const char *copy = e->buffer()->selection_text();
+  if (*copy) fltk3::copy(copy, strlen(copy), 0);
+  free((void*)copy);
+  return 1;
+}
+/**  Undo last edit in the current buffer. Also deselect previous selection. */
+int fltk3::TextEditor::kf_undo(unsigned int , fltk3::TextEditor* e) {
+  e->buffer()->unselect();
+  fltk3::copy("", 0, 0);
+  int crsr;
+  int ret = e->buffer()->undo(&crsr);
+  e->insert_position(crsr);
+  e->show_insert_position();
+  e->set_changed();
+  if (e->when()&fltk3::WHEN_CHANGED) e->do_callback();
+  return ret;
+}
+
+/** Handles a key press in the editor */
+int fltk3::TextEditor::handle_key() {
+  // Call FLTK's rules to try to turn this into a printing character.
+  // This uses the right-hand ctrl key as a "compose prefix" and returns
+  // the changes that should be made to the text, as a number of
+  // bytes to delete and a string to insert:
+  int del = 0;
+  if (fltk3::compose(del)) {
+    if (del) {
+      int dp = insert_position(), di = del;
+      while (di--) dp = buffer()->prev_char_clipped(dp);
+      buffer()->select(dp, insert_position());
+    }
+    kill_selection(this);
+    if (fltk3::event_length()) {
+      if (insert_mode()) insert(fltk3::event_text());
+      else overstrike(fltk3::event_text());
+    }
+    show_insert_position();
+    set_changed();
+    if (when()&fltk3::WHEN_CHANGED) do_callback();
+    return 1;
+  }
+
+  int key = fltk3::event_key(), state = fltk3::event_state(), c = fltk3::event_text()[0];
+  state &= fltk3::SHIFT|fltk3::CTRL|fltk3::ALT|fltk3::META; // only care about these states
+  KeyFunc f;
+  f = bound_key_function(key, state, global_key_bindings);
+  if (!f) f = bound_key_function(key, state, key_bindings);
+  if (f) return f(key, this);
+  if (default_key_function_ && !state) return default_key_function_(c, this);
+  return 0;
+}
+
+/** does or does not a callback according to changed() and when() settings */
+void fltk3::TextEditor::maybe_do_callback() {
+//  printf("fltk3::TextEditor::maybe_do_callback()\n");
+//  printf("changed()=%d, when()=%x\n", changed(), when());
+  if (changed() || (when()&fltk3::WHEN_NOT_CHANGED)) do_callback();
+}
+
+int fltk3::TextEditor::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  static int dndCursorPos;
+  
+  if (!buffer()) return 0;
+
+  switch (event) {
+    case fltk3::FOCUS:
+      show_cursor(mCursorOn); // redraws the cursor
+      if (buffer()->selected()) redraw(); // Redraw selections...
+      fltk3::focus(this);
+      return 1;
+
+    case fltk3::UNFOCUS:
+      show_cursor(mCursorOn); // redraws the cursor
+      if (buffer()->selected()) redraw(); // Redraw selections...
+    case fltk3::HIDE:
+      if (when() & fltk3::WHEN_RELEASE) maybe_do_callback();
+      return 1;
+
+    case fltk3::KEYBOARD:
+      if (active_r() && window() && this == fltk3::belowmouse()) 
+        window()->cursor(fltk3::CURSOR_NONE);
+      return handle_key();
+
+    case fltk3::PASTE:
+      if (!fltk3::event_text()) {
+        fltk3::beep();
+	return 1;
+      }
+      buffer()->remove_selection();
+      if (insert_mode()) insert(fltk3::event_text());
+      else overstrike(fltk3::event_text());
+      show_insert_position();
+      set_changed();
+      if (when()&fltk3::WHEN_CHANGED) do_callback();
+      return 1;
+
+    case fltk3::ENTER:
+// MRS: WIN32 only?  Need to test!
+//    case fltk3::MOVE:
+      show_cursor(mCursorOn);
+      return 1;
+
+    case fltk3::PUSH:
+      if (fltk3::event_button() == 2) {
+        // don't let the text_display see this event
+        if (Group::handle(event)) return 1;
+        dragType = DRAG_NONE;
+	if(buffer()->selected()) {
+	  buffer()->unselect();
+	  }
+	int pos = xy_to_position(fltk3::event_x(), fltk3::event_y(), CURSOR_POS);
+        insert_position(pos);
+        fltk3::paste(*this, 0);
+        fltk3::focus(this);
+        set_changed();
+        if (when()&fltk3::WHEN_CHANGED) do_callback();
+        return 1;
+      }
+      break;
+
+    case fltk3::SHORTCUT:
+      if (!(shortcut() ? fltk3::test_shortcut(shortcut()) : test_shortcut()))
+        return 0;
+      if (fltk3::visible_focus() && handle(fltk3::FOCUS)) {
+        fltk3::focus(this);
+        return 1;
+      }
+      break;
+      
+      // Handle drag'n'drop attempt by the user. This is a simplified 
+      // implementation which allows dnd operations onto the scroll bars.
+    case fltk3::DND_ENTER: // save the current cursor position
+      if (fltk3::visible_focus() && handle(fltk3::FOCUS))
+        fltk3::focus(this);
+      show_cursor(mCursorOn);
+      dndCursorPos = insert_position();
+      /* fall through */
+    case fltk3::DND_DRAG: // show a temporary insertion cursor
+      insert_position(xy_to_position(fltk3::event_x(), fltk3::event_y(), CURSOR_POS));
+      return 1;      
+    case fltk3::DND_LEAVE: // restore original cursor
+      insert_position(dndCursorPos);
+      return 1;      
+    case fltk3::DND_RELEASE: // keep insertion cursor and wait for the fltk3::PASTE event
+      buffer()->unselect(); // fltk3::PASTE must not destroy current selection!
+      return 1;
+  }
+
+  return TextDisplay::handle(event);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TiledGroup.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tile.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TiledGroup.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TiledGroup.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,215 @@
+//
+// "$Id$"
+//
+// Tile widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+// Group of 2 or 4 "tiles" that can be resized by dragging border
+// The size of the first child determines where the resize border is.
+// The resizebox is used to limit where the border can be dragged to.
+
+#include <fltk3/run.h>
+#include <fltk3/TiledGroup.h>
+#include <fltk3/Window.h>
+#include <stdlib.h>
+
+// Drag the edges that were initially at oldx,oldy to newx,newy:
+// pass zero as oldx or oldy to disable drag in that direction:
+/** 
+  Drag the intersection at from_x,from_y to to_x,to_y.
+  This redraws all the necessary children.
+*/
+void fltk3::TiledGroup::position(int oix, int oiy, int newx, int newy) {
+  fltk3::Widget*const* a = array();
+  int *p = sizes();
+  p += 8; // skip group & resizable's saved size
+  for (int i=children(); i--; p += 4) {
+    fltk3::Widget* o = *a++;
+    if (o == resizable()) continue;
+    int X = o->x();
+    int R = X+o->w();
+    if (oix) {
+      int t = p[0];
+      if (t == oix || (t>oix && X<newx) || (t<oix && X>newx) ) X = newx;
+      t = p[1];
+      if (t == oix || (t>oix && R<newx) || (t<oix && R>newx) ) R = newx;
+    }
+    int Y = o->y();
+    int B = Y+o->h();
+    if (oiy) {
+      int t = p[2];
+      if (t == oiy || (t>oiy && Y<newy) || (t<oiy && Y>newy) ) Y = newy;
+      t = p[3];
+      if (t == oiy || (t>oiy && B<newy) || (t<oiy && B>newy) ) B = newy;
+    }
+    o->damage_resize(X,Y,R-X,B-Y);
+  }
+}
+
+// move the lower-right corner (sort of):
+void fltk3::TiledGroup::resize(int X,int Y,int W,int H) {
+  //fltk3::Group::resize(X, Y, W, H);
+  //return;
+  // remember how much to move the child widgets:
+  int dx = X-x();
+  int dy = Y-y();
+  int dw = W-w();
+  int dh = H-h();
+  int *p = sizes();
+  // resize this (skip the fltk3::Group resize):
+  Widget::resize(X,Y,W,H);
+  // find bottom-right of resiable:
+  int OR = p[5];
+  int NR = X+W-(p[1]-OR);
+  int OB = p[7];
+  int NB = Y+H-(p[3]-OB);
+  // move everything to be on correct side of new resizable:
+  fltk3::Widget*const* a = array();
+  p += 8;
+  for (int i=children(); i--;) {
+    fltk3::Widget* o = *a++;
+    int xx = o->x()+dx;
+    int R = xx+o->w();
+    if (*p++ >= OR) xx += dw; else if (xx > NR) xx = NR;
+    if (*p++ >= OR) R += dw; else if (R > NR) R = NR;
+    int yy = o->y()+dy;
+    int B = yy+o->h();
+    if (*p++ >= OB) yy += dh; else if (yy > NB) yy = NB;
+    if (*p++ >= OB) B += dh; else if (B > NB) B = NB;
+    o->resize(xx,yy,R-xx,B-yy);
+    // do *not* call o->redraw() here! If you do, and the tile is inside a 
+    // scroll, it'll set the damage areas wrong for all children!
+  }
+}
+
+static void set_cursor(fltk3::TiledGroup*t, fltk3::Cursor c) {
+  static fltk3::Cursor cursor;
+  if (cursor == c || !t->window()) return;
+  cursor = c;
+#ifdef __sgi
+  t->window()->cursor(c,fltk3::RED,fltk3::WHITE);
+#else
+  t->window()->cursor(c);
+#endif
+}
+
+static fltk3::Cursor cursors[4] = {
+  fltk3::CURSOR_DEFAULT,
+  fltk3::CURSOR_WE,
+  fltk3::CURSOR_NS,
+  fltk3::CURSOR_MOVE};
+
+int fltk3::TiledGroup::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  static int sdrag;
+  static int sdx, sdy;
+  static int sx, sy;
+#define DRAGH 1
+#define DRAGV 2
+#define GRABAREA 4
+
+  int mx = fltk3::event_x();
+  int my = fltk3::event_y();
+
+  switch (event) {
+
+  case fltk3::MOVE:
+  case fltk3::ENTER:
+  case fltk3::PUSH:
+    // don't potentially change the mouse cursor if inactive:
+    if (!active()) break; // will cascade inherited handle()
+    {
+    int mindx = 100;
+    int mindy = 100;
+    int oldx = 0;
+    int oldy = 0;
+    fltk3::Widget*const* a = array();
+    int *q = sizes();
+    int *p = q+8;
+    for (int i=children(); i--; p += 4) {
+      fltk3::Widget* o = *a++;
+      if (o == resizable()) continue;
+      if (p[1]<q[1] && o->y()<=my+GRABAREA && o->y()+o->h()>=my-GRABAREA) {
+	int t = mx - (o->x()+o->w());
+	if (abs(t) < mindx) {
+	  sdx = t;
+	  mindx = abs(t);
+	  oldx = p[1];
+	}
+      }
+      if (p[3]<q[3] && o->x()<=mx+GRABAREA && o->x()+o->w()>=mx-GRABAREA) {
+	int t = my - (o->y()+o->h());
+	if (abs(t) < mindy) {
+	  sdy = t;
+	  mindy = abs(t);
+	  oldy = p[3];
+	}
+      }
+    }
+    sdrag = 0; sx = sy = 0;
+    if (mindx <= GRABAREA) {sdrag = DRAGH; sx = oldx;}
+    if (mindy <= GRABAREA) {sdrag |= DRAGV; sy = oldy;}
+    set_cursor(this, cursors[sdrag]);
+    if (sdrag) return 1;
+    return Group::handle(event);
+  }
+
+  case fltk3::LEAVE:
+    set_cursor(this, fltk3::CURSOR_DEFAULT);
+    break;
+
+  case fltk3::DRAG:
+    // This is necessary if CONSOLIDATE_MOTION in Fl_x.cxx is turned off:
+    // if (damage()) return 1; // don't fall behind
+  case fltk3::RELEASE: {
+    if (!sdrag) return 0; // should not happen
+    fltk3::Widget* r = resizable(); if (!r) r = this;
+    int newx;
+    if (sdrag&DRAGH) {
+      newx = fltk3::event_x()-sdx;
+      if (newx < r->x()) newx = r->x();
+      else if (newx > r->x()+r->w()) newx = r->x()+r->w();
+    } else
+      newx = sx;
+    int newy;
+    if (sdrag&DRAGV) {
+      newy = fltk3::event_y()-sdy;
+      if (newy < r->y()) newy = r->y();
+      else if (newy > r->y()+r->h()) newy = r->y()+r->h();
+    } else
+      newy = sy;
+    position(sx,sy,newx,newy);
+    if (event == fltk3::DRAG) set_changed();
+    do_callback();
+    return 1;}
+
+  }
+
+  return Group::handle(event);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TiledImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tiled_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TiledImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TiledImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,135 @@
+//
+// "$Id$"
+//
+// Tiled image code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+#include <fltk3/run.h>
+#include <fltk3/TiledImage.h>
+#include <fltk3/draw.h>
+
+/**
+  The constructors create a new tiled image containing the specified image.
+  Use a width and height of 0 to tile the whole window/widget.
+*/
+fltk3::TiledImage::TiledImage(fltk3::Image *i,	// I - Image to tile
+                               int      W,	// I - Width of tiled area
+			       int      H) :	// I - Height of tiled area
+  fltk3::Image(W,H,0) {
+  image_       = i;
+  alloc_image_ = 0;
+
+  if (W == 0) w(fltk3::w());
+  if (H == 0) h(fltk3::h());
+}
+/**
+  The destructor frees all memory and server resources that are used by
+  the tiled image.
+*/
+  fltk3::TiledImage::~TiledImage() {
+  if (alloc_image_) delete image_;
+}
+
+
+//
+// 'fltk3::TiledImage::copy()' - Copy and resize a tiled image...
+//
+
+fltk3::Image *			// O - New image
+fltk3::TiledImage::copy(int W,	// I - New width
+                     int H) {	// I - New height
+  if (W == w() && H == h()) return this;
+  else return new fltk3::TiledImage(image_, W, H);
+}
+
+
+//
+// 'fltk3::TiledImage::color_average()' - Blend colors...
+//
+
+void
+fltk3::TiledImage::color_average(fltk3::Color c,	// I - Color to blend with
+                              float    i) {	// I - Blend fraction
+  if (!alloc_image_) {
+    image_       = image_->copy();
+    alloc_image_ = 1;
+  }
+
+  image_->color_average(c, i);
+}
+
+
+//
+// 'fltk3::TiledImage::desaturate()' - Convert the image to grayscale...
+//
+
+void
+fltk3::TiledImage::desaturate() {
+  if (!alloc_image_) {
+    image_       = image_->copy();
+    alloc_image_ = 1;
+  }
+
+  image_->desaturate();
+}
+
+
+//
+// 'fltk3::TiledImage::draw()' - Draw a shared image...
+//
+
+void
+fltk3::TiledImage::draw(int X,	// I - Starting X position
+                     int Y,	// I - Starting Y position
+		     int W,	// I - Width of area to be filled
+		     int H,	// I - Height of area to be filled
+		     int cx,	// I - "Source" X position
+		     int cy) {	// I - "Source" Y position
+  if (!image_->w() || !image_->h()) return;
+  if (W == 0) W = fltk3::w();
+  if (H == 0) H = fltk3::h();
+
+  fltk3::push_clip(X, Y, W, H);
+
+  X += cx;
+  Y += cy;
+
+  X = X - (X % image_->w());
+  Y = Y - (Y % image_->h());
+
+  W += X;
+  H += Y;
+
+  for (int yy = Y; yy < H; yy += image_->h())
+    for (int xx = X; xx < W; xx += image_->w())
+      image_->draw(xx, yy);
+
+  fltk3::pop_clip();
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Tooltip.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tooltip.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Tooltip.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Tooltip.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,350 @@
+//
+// "$Id$"
+//
+// Tooltip source file for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/Tooltip.h>
+#include <fltk3/draw.h>
+#include <fltk3/MenuWindow.h>
+
+#include <stdio.h>
+#include <string.h>	// strdup()
+
+float		fltk3::Tooltip::delay_ = 1.0f;
+float		fltk3::Tooltip::hoverdelay_ = 0.2f;
+fltk3::Color	fltk3::Tooltip::color_ = fltk3::color_cube(fltk3::NUM_RED - 1,
+		                                   fltk3::NUM_GREEN - 1,
+						   fltk3::NUM_BLUE - 2);
+fltk3::Color	fltk3::Tooltip::textcolor_ = fltk3::BLACK;
+fltk3::Font         fltk3::Tooltip::font_ = fltk3::HELVETICA;
+fltk3::Fontsize     fltk3::Tooltip::size_ = -1;
+
+#define MAX_WIDTH 400
+
+static const char* tip;
+/**
+    This widget creates a tooltip box window, with no caption.
+*/
+class Fl_TooltipBox : public fltk3::MenuWindow {
+public:
+  /** Creates the box window */
+  Fl_TooltipBox() : fltk3::MenuWindow(0, 0) {
+    set_override();
+    set_tooltip_window();
+    end();
+  }
+  void draw();
+  void layout();
+  /** Shows the tooltip windows only if a tooltip text is available. */
+  void show() {
+    if (!tip) return;
+    MenuWindow::show();
+  }
+};
+
+fltk3::Widget* fltk3::Tooltip::widget_ = 0;
+static Fl_TooltipBox *window = 0;
+static int Y,H;
+
+#ifdef __APPLE__
+// returns the unique tooltip window
+fltk3::Window *fltk3::Tooltip::current_window(void)
+{
+  return (fltk3::Window*)window;
+}
+#endif
+
+void Fl_TooltipBox::layout() {
+  fltk3::font(fltk3::Tooltip::font(), fltk3::Tooltip::size());
+  int ww, hh;
+  ww = MAX_WIDTH;
+  fltk3::measure(tip, ww, hh, fltk3::ALIGN_LEFT|fltk3::ALIGN_WRAP|fltk3::ALIGN_INSIDE);
+  ww += 6; hh += 6;
+
+  // find position on the screen of the widget:
+  int ox = fltk3::event_x_root();
+  int oy = Y + H+2;
+  for (fltk3::Widget* p = fltk3::Tooltip::current(); p; p = p->window()) {
+    oy += p->y();
+  }
+  int scr_x, scr_y, scr_w, scr_h;
+  fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+  if (ox+ww > scr_x+scr_w) ox = scr_x+scr_w - ww;
+  if (ox < scr_x) ox = scr_x;
+  if (H > 30) {
+    oy = fltk3::event_y_root()+13;
+    if (oy+hh > scr_y+scr_h) oy -= 23+hh;
+  } else {
+    if (oy+hh > scr_y+scr_h) oy -= (4+hh+H);
+  }
+  if (oy < scr_y) oy = scr_y;
+
+  resize(ox, oy, ww, hh);
+}
+
+void Fl_TooltipBox::draw() {
+  draw_box(fltk3::BORDER_BOX, 0, 0, w(), h(), fltk3::Tooltip::color());
+  fltk3::color(fltk3::Tooltip::textcolor());
+  fltk3::font(fltk3::Tooltip::font(), fltk3::Tooltip::size());
+  fltk3::draw(tip, 3, 3, w()-6, h()-6, fltk3::Align(fltk3::ALIGN_LEFT|fltk3::ALIGN_WRAP));
+}
+
+static char recent_tooltip;
+
+static void recent_timeout(void*) {
+#ifdef DEBUG
+  puts("recent_timeout();");
+#endif // DEBUG
+
+  recent_tooltip = 0;
+}
+
+static char recursion;
+
+static void tooltip_timeout(void*) {
+#ifdef DEBUG
+  puts("tooltip_timeout();");
+#endif // DEBUG
+
+  if (recursion) return;
+  recursion = 1;
+  if (!tip || !*tip) {
+    if (window) window->hide();
+  } else {
+    int condition = 1;
+#if !(defined(__APPLE__) || defined(WIN32))
+    condition = (fltk3::grab() == NULL);
+#endif
+    if ( condition ) {
+      if (!window) window = new Fl_TooltipBox;
+      // this cast bypasses the normal fltk3::Window label() code:
+      ((fltk3::Widget*)window)->label(tip);
+      window->layout();
+      window->redraw();
+  //    printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n",
+  //           window, tip ? tip : "(null)");
+      window->show();
+    }
+  }
+
+  fltk3::remove_timeout(recent_timeout);
+  recent_tooltip = 1;
+  recursion = 0;
+}
+
+/**
+   This method is called when the mouse pointer enters a widget.
+   <P>If this widget or one of its parents has a tooltip, enter it. This
+   will do nothing if this is the current widget (even if the mouse moved
+   out so an exit() was done and then moved back in). If no tooltip can
+   be found do fltk3::Tooltip::exit_(). If you don't want this behavior (for instance
+   if you want the tooltip to reappear when the mouse moves back in)
+   call the fancier enter_area() below.
+*/
+void fltk3::Tooltip::enter_(fltk3::Widget* w) {
+#ifdef DEBUG
+  printf("fltk3::Tooltip::enter_(w=%p)\n", w);
+  printf("    window=%p\n", window);
+#endif // DEBUG
+
+  // find the enclosing group with a tooltip:
+  fltk3::Widget* tw = w;
+  for (;;) {
+    if (!tw) {exit_(0); return;}
+    if (tw == widget_) return;
+    if (tw->tooltip()) break;
+    tw = tw->parent();
+  }
+  enter_area(w, 0, 0, w->w(), w->h(), tw->tooltip());
+}
+/** 
+     Sets the current widget target. 
+     Acts as though enter(widget) was done but does not pop up a
+     tooltip.  This is useful to prevent a tooltip from reappearing when
+     a modal overlapping window is deleted. FLTK does this automatically
+     when you click the mouse button.
+*/
+void fltk3::Tooltip::current(fltk3::Widget* w) {
+#ifdef DEBUG
+  printf("fltk3::Tooltip::current(w=%p)\n", w);
+#endif // DEBUG
+
+  exit_(0);
+  // find the enclosing group with a tooltip:
+  fltk3::Widget* tw = w;
+  for (;;) {
+    if (!tw) return;
+    if (tw->tooltip()) break;
+    tw = tw->parent();
+  }
+  // act just like fltk3::Tooltip::enter_() except we can remember a zero:
+  widget_ = w;
+}
+
+// Hide any visible tooltip.
+/**  This method is called when the mouse pointer leaves a  widget. */
+void fltk3::Tooltip::exit_(fltk3::Widget *w) {
+#ifdef DEBUG
+  printf("fltk3::Tooltip::exit_(w=%p)\n", w);
+  printf("    widget=%p, window=%p\n", widget_, window);
+#endif // DEBUG
+
+  if (!widget_ || (w && w == window)) return;
+  widget_ = 0;
+  fltk3::remove_timeout(tooltip_timeout);
+  fltk3::remove_timeout(recent_timeout);
+  if (window && window->visible()) window->hide();
+  if (recent_tooltip) {
+    if (fltk3::event_state() & fltk3::BUTTONS) recent_tooltip = 0;
+    else fltk3::add_timeout(fltk3::Tooltip::hoverdelay(), recent_timeout);
+  }
+}
+
+// Get ready to display a tooltip. The widget and the xywh box inside
+// it define an area the tooltip is for, this along with the current
+// mouse position places the tooltip (the mouse is assumed to point
+// inside or near the box).
+/**
+  You may be able to use this to provide tooltips for internal pieces
+  of your widget. Call this after setting fltk3::belowmouse() to
+  your widget (because that calls the above enter() method). Then figure
+  out what thing the mouse is pointing at, and call this with the widget
+  (this pointer is used to remove the tooltip if the widget is deleted
+  or hidden, and to locate the tooltip), the rectangle surrounding the
+  area, relative to the top-left corner of the widget (used to calculate
+  where to put the tooltip), and the text of the tooltip (which must be
+  a pointer to static data as it is not copied).
+*/
+void fltk3::Tooltip::enter_area(fltk3::Widget* wid, int x,int y,int w,int h, const char* t)
+{
+  (void)x;
+  (void)w;
+
+#ifdef DEBUG
+  printf("fltk3::Tooltip::enter_area(wid=%p, x=%d, y=%d, w=%d, h=%d, t=\"%s\")\n",
+         wid, x, y, w, h, t ? t : "(null)");
+  printf("    recursion=%d, window=%p\n", recursion, window);
+#endif // DEBUG
+
+  if (recursion) return;
+  if (!t || !*t || !enabled()) {
+    exit_(0);
+    return;
+  }
+  // do nothing if it is the same:
+  if (wid==widget_ /*&& x==X && y==Y && w==W && h==H*/ && t==tip) return;
+  fltk3::remove_timeout(tooltip_timeout);
+  fltk3::remove_timeout(recent_timeout);
+  // remember it:
+  widget_ = wid; Y = y; H = h; tip = t;
+  // popup the tooltip immediately if it was recently up:
+  if (recent_tooltip) {
+    if (window) window->hide();
+    fltk3::add_timeout(fltk3::Tooltip::hoverdelay(), tooltip_timeout);
+  } else if (fltk3::Tooltip::delay() < .1) {
+#ifdef WIN32
+    // possible fix for the Windows titlebar, it seems to want the
+    // window to be destroyed, moving it messes up the parenting:
+    if (window && window->visible()) window->hide();
+#endif // WIN32
+    tooltip_timeout(0);
+  } else {
+    if (window && window->visible()) window->hide();
+    fltk3::add_timeout(fltk3::Tooltip::delay(), tooltip_timeout);
+  }
+
+#ifdef DEBUG
+  printf("    tip=\"%s\", window->shown()=%d\n", tip ? tip : "(null)",
+         window ? window->shown() : 0);
+#endif // DEBUG
+}
+
+void fltk3::Tooltip::set_enter_exit_once_() {
+  static char beenhere = 0;
+  if (!beenhere) {
+    beenhere          = 1;
+    fltk3::Tooltip::enter = fltk3::Tooltip::enter_;
+    fltk3::Tooltip::exit  = fltk3::Tooltip::exit_;
+  }
+}
+
+/**
+  Sets the current tooltip text. 
+
+  Sets a string of text to display in a popup tooltip window when the user 
+  hovers the mouse over the widget. The string is <I>not</I> copied, so 
+  make sure any formatted string is stored in a static, global, 
+  or allocated buffer. If you want a copy made and managed for you,
+  use the copy_tooltip() method, which will manage the tooltip string
+  automatically.
+
+  If no tooltip is set, the tooltip of the parent is inherited. Setting a 
+  tooltip for a group and setting no tooltip for a child will show the 
+  group's tooltip instead. To avoid this behavior, you can set the child's 
+  tooltip to an empty string ("").
+  \param[in] text New tooltip text (no copy is made)
+  \see copy_tooltip(const char*), tooltip()
+*/
+void fltk3::Widget::tooltip(const char *text) {
+  fltk3::Tooltip::set_enter_exit_once_();
+  if (flags() & COPIED_TOOLTIP) {
+    // reassigning a copied tooltip remains the same copied tooltip
+    if (tooltip_ == text) return;
+    free((void*)(tooltip_));            // free maintained copy
+    clear_flag(COPIED_TOOLTIP);         // disable copy flag (WE don't make copies)
+  }
+  tooltip_ = text;
+}
+
+/**
+  Sets the current tooltip text. 
+  Unlike tooltip(), this method allocates a copy of the tooltip 
+  string instead of using the original string pointer.
+
+  The internal copy will automatically be freed whenever you assign
+  a new tooltip or when the widget is destroyed.
+
+  If no tooltip is set, the tooltip of the parent is inherited. Setting a 
+  tooltip for a group and setting no tooltip for a child will show the 
+  group's tooltip instead. To avoid this behavior, you can set the child's 
+  tooltip to an empty string ("").
+  \param[in] text New tooltip text (an internal copy is made and managed)
+  \see tooltip(const char*), tooltip()
+*/
+void fltk3::Widget::copy_tooltip(const char *text) {
+  fltk3::Tooltip::set_enter_exit_once_();
+  if (flags() & COPIED_TOOLTIP) free((void *)(tooltip_));
+  if (text) {
+    set_flag(COPIED_TOOLTIP);
+    tooltip_ = strdup(text);
+  } else {
+    clear_flag(COPIED_TOOLTIP);
+    tooltip_ = (char *)0;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Tree.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tree.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Tree.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Tree.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,979 @@
+//
+// "$Id$"
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <fltk3/Tree.h>
+#include <fltk3/Preferences.h>
+#include <fltk3/Wrapper.h>
+
+//////////////////////
+// fltk3::Tree.cxx
+//////////////////////
+//
+// fltk3::Tree -- This file is part of the fltk3::Tree widget for FLTK
+// Copyright (C) 2009-2010 by Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+// INTERNAL: scroller callback
+static void scroll_cb(fltk3::Widget*,void *data) {
+  ((fltk3::Tree*)data)->redraw();
+}
+
+// INTERNAL: Parse elements from path into an array of null terminated strings
+//    Handles escape characters.
+//    Path="/aa/bb"
+//    Return: arr[0]="aa", arr[1]="bb", arr[2]=0
+//    Caller must call free_path(arr).
+//
+static char **parse_path(const char *path) {
+  while ( *path == '/' ) path++;	// skip leading '/' 
+                                        // First pass: identify, null terminate, and count separators
+  int seps = 1;				// separator count (1: first item)
+  int arrsize = 1;			// array size (1: first item)
+  char *save = strdup(path);		// make copy we can modify
+  char *sin = save, *sout = save;
+  while ( *sin ) {
+    if ( *sin == '\\' ) {		// handle escape character
+      *sout++ = *++sin;
+      if ( *sin ) ++sin;
+    } else if ( *sin == '/' ) {		// handle submenu
+      *sout++ = 0;
+      sin++;
+      seps++;
+      arrsize++;
+    } else {				// all other chars
+      *sout++ = *sin++;
+    }
+  }
+  *sout = 0;
+  arrsize++;				// (room for terminating NULL) 
+                                        // Second pass: create array, save nonblank elements
+  char **arr = (char**)malloc(sizeof(char*) * arrsize);
+  int t = 0;
+  sin = save;
+  while ( seps-- > 0 ) {
+    if ( *sin ) { arr[t++] = sin; }	// skips empty fields, e.g. '//'
+    sin += (strlen(sin) + 1);
+  }
+  arr[t] = 0;
+  return(arr);
+}
+
+// INTERNAL: Free the array returned by parse_path()
+static void free_path(char **arr) {
+  if ( arr ) {
+    if ( arr[0] ) { free((void*)arr[0]); }
+    free((void*)arr);
+  }
+}
+
+// INTERNAL: Recursively descend tree hierarchy, accumulating total child count
+static int find_total_children(fltk3::TreeItem *item, int count=0) {
+  count++;
+  for ( int t=0; t<item->children(); t++ ) {
+    count = find_total_children(item->child(t), count);
+  }
+  return(count);
+}
+
+/// Constructor.
+fltk3::Tree::Tree(int X, int Y, int W, int H, const char *L) : fltk3::Group(X,Y,W,H,L) { 
+  _root = new fltk3::TreeItem(_prefs);
+  _root->parent(0);				// we are root of tree
+  _root->label("ROOT");
+  _item_focus      = 0;
+  _callback_item   = 0;
+  _callback_reason = fltk3::TREE_REASON_NONE;
+  _scrollbar_size  = 0;				// 0: uses fltk3::scrollbar_size()
+  box(fltk3::DOWN_BOX);
+  color(fltk3::BACKGROUND2_COLOR, fltk3::SELECTION_COLOR);
+  when(fltk3::WHEN_CHANGED);
+  _vscroll = new fltk3::Scrollbar(0,0,0,0);		// will be resized by draw()
+  _vscroll->hide();
+  _vscroll->type(fltk3::VERTICAL);
+  _vscroll->step(1);
+  _vscroll->callback(scroll_cb, (void*)this);
+  end();
+}
+
+/// Destructor.
+fltk3::Tree::~Tree() {
+  if ( _root ) { delete _root; _root = 0; }
+}
+
+/// Adds a new item, given a 'menu style' path, eg: "/Parent/Child/item".
+/// Any parent nodes that don't already exist are created automatically.
+/// Adds the item based on the value of sortorder().
+///
+/// To specify items or submenus that contain slashes ('/' or '\')
+/// use an escape character to protect them, e.g.
+///
+/// \code
+///     tree->add("/Holidays/Photos/12\\/25\\2010");          // Adds item "12/25/2010"
+///     tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"
+/// \endcode
+///
+/// \returns the child item created, or 0 on error.
+///
+fltk3::TreeItem* fltk3::Tree::add(const char *path) {
+  if ( ! _root ) {					// Create root if none
+    _root = new fltk3::TreeItem(_prefs);
+    _root->parent(0);
+    _root->label("ROOT");
+  }
+  char **arr = parse_path(path);
+  fltk3::TreeItem *item = _root->add(_prefs, arr);
+  free_path(arr);
+  return(item);
+}
+
+/// Inserts a new item above the specified fltk3::TreeItem, with the label set to 'name'.
+/// \param[in] above -- the item above which to insert the new item. Must not be NULL.
+/// \param[in] name -- the name of the new item
+/// \returns the item that was added, or 0 if 'above' could not be found.
+/// 
+fltk3::TreeItem* fltk3::Tree::insert_above(fltk3::TreeItem *above, const char *name) {
+  return(above->insert_above(_prefs, name));
+}
+
+/// Insert a new item into a tree-item's children at a specified position.
+///
+/// \param[in] item The existing item to insert new child into. Must not be NULL.
+/// \param[in] name The label for the new item
+/// \param[in] pos The position of the new item in the child list
+/// \returns the item that was added.
+///
+fltk3::TreeItem* fltk3::Tree::insert(fltk3::TreeItem *item, const char *name, int pos) {
+  return(item->insert(_prefs, name, pos));
+}
+
+/// Add a new child to a tree-item.
+///
+/// \param[in] item The existing item to add new child to. Must not be NULL.
+/// \param[in] name The label for the new item
+/// \returns the item that was added.
+///
+fltk3::TreeItem* fltk3::Tree::add(fltk3::TreeItem *item, const char *name) {
+  return(item->add(_prefs, name));
+}
+
+/// Find the item, given a menu style path, eg: "/Parent/Child/item".
+/// There is both a const and non-const version of this method.
+/// Const version allows pure const methods to use this method 
+/// to do lookups without causing compiler errors.
+///
+/// To specify items or submenus that contain slashes ('/' or '\')
+/// use an escape character to protect them, e.g.
+///
+/// \code
+///     tree->add("/Holidays/Photos/12\\/25\\2010");          // Adds item "12/25/2010"
+///     tree->add("/Pathnames/c:\\\\Program Files\\\\MyApp"); // Adds item "c:\Program Files\MyApp"
+/// \endcode
+///
+/// \param[in] path -- the tree item's pathname to be found (e.g. "Flintstones/Fred")
+/// \returns the item, or NULL if not found.
+///
+/// \see item_pathname()
+///
+fltk3::TreeItem *fltk3::Tree::find_item(const char *path) {
+  if ( ! _root ) return(NULL);
+  char **arr = parse_path(path);
+  fltk3::TreeItem *item = _root->find_item(arr);
+  free_path(arr);
+  return(item);
+}
+
+/// A const version of fltk3::Tree::find_item(const char *path)
+const fltk3::TreeItem *fltk3::Tree::find_item(const char *path) const {
+  if ( ! _root ) return(NULL);
+  char **arr = parse_path(path);
+  const fltk3::TreeItem *item = _root->find_item(arr);
+  free_path(arr);
+  return(item);
+}
+
+// Handle safe 'reverse string concatenation'.
+//   In the following we build the pathname from right-to-left,
+//   since we start at the child and work our way up to the root.
+//
+#define SAFE_RCAT(c) { \
+slen += 1; if ( slen >= pathnamelen ) { pathname[0] = '\0'; return(-2); } \
+*s-- = c; \
+}
+
+/// Find the pathname for the specified \p item.
+/// If \p item is NULL, root() is used.
+/// The tree's root will be included in the pathname of showroot() is on.
+/// Menu items or submenus that contain slashes ('/' or '\') in their names
+/// will be escaped with a backslash. This is symmetrical with the add()
+/// function which uses the same escape pattern to set names.
+/// \param[in] pathname The string to use to return the pathname
+/// \param[in] pathnamelen The maximum length of the string (including NULL). Must not be zero.
+/// \param[in] item The item whose pathname is to be returned.
+/// \returns
+///	-   0 : OK (\p pathname returns the item's pathname)
+///	-  -1 : item not found (pathname="")
+///	-  -2 : pathname not large enough (pathname="")
+/// \see find_item()
+///
+int fltk3::Tree::item_pathname(char *pathname, int pathnamelen, const fltk3::TreeItem *item) const {
+  pathname[0] = '\0';
+  item = item ? item : _root;
+  if ( !item ) return(-1);
+  // Build pathname starting at end
+  char *s = (pathname+pathnamelen-1);
+  int slen = 0;			// length of string compiled so far (including NULL)
+  SAFE_RCAT('\0');
+  while ( item ) {
+    if ( item->is_root() && showroot() == 0 ) break;		// don't include root in path if showroot() off
+                                                                // Find name of current item
+    const char *name = item->label() ? item->label() : "???";	// name for this item
+    int len = strlen(name);
+    // Add name to end of pathname[]
+    for ( --len; len>=0; len-- ) {
+      SAFE_RCAT(name[len]);					// rcat name of item
+      if ( name[len] == '/' || name[len] == '\\' ) {
+        SAFE_RCAT('\\');					// escape front or back slashes within name
+      }
+    }
+    SAFE_RCAT('/');						// rcat leading slash
+    item = item->parent();					// move up tree (NULL==root)
+  }
+  if ( *(++s) == '/' ) ++s;				// leave off leading slash from pathname
+  if ( s != pathname ) memmove(pathname, s, slen);	// Shift down right-aligned string
+  return(0);
+}
+
+/// Standard FLTK draw() method, handles draws the tree widget.
+void fltk3::Tree::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  // Let group draw box+label but *NOT* children.
+  // We handle drawing children ourselves by calling each item's draw()
+  //
+  // Handle group's bg
+  Group::draw_box();
+  Group::draw_label();
+  // Handle tree
+  if ( ! _root ) return;
+  int cx = x() + fltk3::box_dx(box());
+  int cy = y() + fltk3::box_dy(box());
+  int cw = w() - fltk3::box_dw(box());
+  int ch = h() - fltk3::box_dh(box());
+  // These values are changed during drawing
+  // 'Y' will be the lowest point on the tree
+  int X = cx + _prefs.marginleft();
+  int Y = cy + _prefs.margintop() - (_vscroll->visible() ? _vscroll->value() : 0);
+  int W = cw - _prefs.marginleft();			// - _prefs.marginright();
+  int Ysave = Y;
+  fltk3::push_clip(cx,cy,cw,ch);
+  {
+    fltk3::font(_prefs.labelfont(), _prefs.labelsize());
+    _root->draw(X, Y, W, this,
+                (fltk3::focus()==this)?_item_focus:0,	// show focus item ONLY if fltk3::Tree has focus
+		_prefs);
+  }
+  fltk3::pop_clip();
+  
+  // Show vertical scrollbar?
+  int ydiff = (Y+_prefs.margintop())-Ysave;		// ydiff=size of tree
+  int ytoofar = (cy+ch) - Y;				// ytoofar -- scrolled beyond bottom (e.g. stow)
+  
+  //printf("ydiff=%d ch=%d Ysave=%d ytoofar=%d value=%d\n",
+  //int(ydiff),int(ch),int(Ysave),int(ytoofar), int(_vscroll->value()));
+  
+  if ( ytoofar > 0 ) ydiff += ytoofar;
+  if ( Ysave<cy || ydiff > ch || int(_vscroll->value()) > 1 ) {
+    _vscroll->visible();
+    
+    int scrollsize = _scrollbar_size ? _scrollbar_size : fltk3::scrollbar_size();
+    int sx = x()+w()-fltk3::box_dx(box())-scrollsize;
+    int sy = y()+fltk3::box_dy(box());
+    int sw = scrollsize;
+    int sh = h()-fltk3::box_dh(box());
+    _vscroll->show();
+    _vscroll->range(0.0,ydiff-ch);
+    _vscroll->resize(sx,sy,sw,sh);
+    _vscroll->slider_size(float(ch)/float(ydiff));
+  } else {
+    _vscroll->Slider::value(0);
+    _vscroll->hide();
+  }
+  fltk3::push_clip(cx,cy,cw,ch);
+  Group::draw_children();	// draws any FLTK children set via fltk3::Tree::widget()
+  fltk3::pop_clip();
+}
+
+/// Returns next visible item above (dir==Fl_Up) or below (dir==Fl_Down) the specified \p item.
+/// If \p item is 0, returns first() if \p dir is Fl_Up, or last() if \p dir is fltk3::DownKey.
+///
+/// \param[in] item The item above/below which we'll find the next visible item
+/// \param[in] dir The direction to search. Can be fltk3::UpKey or fltk3::DownKey.
+/// \returns The item found, or 0 if there's no visible items above/below the specified \p item.
+///
+fltk3::TreeItem *fltk3::Tree::next_visible_item(fltk3::TreeItem *item, unsigned int dir) {
+  if ( ! item ) {				// no start item?
+    item = ( dir == fltk3::UpKey ) ? last() : first();	// start at top or bottom
+    if ( ! item ) return(0);
+    if ( item->visible_r() ) return(item);	// return first/last visible item
+  }
+  switch ( dir ) {
+    case fltk3::UpKey:   return(item->prev_displayed(_prefs));
+    case fltk3::DownKey: return(item->next_displayed(_prefs));
+    default:      return(item->next_displayed(_prefs));
+  }
+}
+
+/// Set the item that currently should have keyboard focus.
+/// Handles calling redraw() to update the focus box (if it is visible).
+///
+/// \param[in] item The item that should take focus. If NULL, none will have focus.
+///
+void fltk3::Tree::set_item_focus(fltk3::TreeItem *item) {
+  if ( _item_focus != item ) {		// changed?
+    _item_focus = item;			// update
+    if ( visible_focus() ) redraw();	// redraw to update focus box
+  }
+}
+
+/// Find the item that was clicked.
+/// You should use callback_item() instead, which is fast,
+/// and is meant to be used within a callback to determine the item clicked.
+///
+/// This method walks the entire tree looking for the first item that is
+/// under the mouse (ie. at fltk3::event_x()/Fl:event_y().
+///
+/// Use this method /only/ if you've subclassed fltk3::Tree, and are receiving
+/// events before fltk3::Tree has been able to process and update callback_item().
+/// 
+/// \returns the item clicked, or 0 if no item was under the current event.
+///
+const fltk3::TreeItem* fltk3::Tree::find_clicked() const {
+  if ( ! _root ) return(NULL);
+  return(_root->find_clicked(_prefs));
+}
+
+/// Set the item that was last clicked.
+/// Should only be used by subclasses needing to change this value.
+/// Normally fltk3::Tree manages this value.
+///
+/// Deprecated: use callback_item() instead.
+///
+void fltk3::Tree::item_clicked(fltk3::TreeItem* val) {
+  _callback_item = val;
+}
+
+/// Returns the first item in the tree.
+///
+/// Use this to walk the tree in the forward direction, eg:
+/// \code
+/// for ( fltk3::TreeItem *item = tree->first(); item; item = tree->next(item) ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \returns first item in tree, or 0 if none (tree empty).
+/// \see first(),next(),last(),prev()
+///
+fltk3::TreeItem* fltk3::Tree::first() {
+  return(_root);					// first item always root
+}
+
+/// Return the next item after \p item, or 0 if no more items.
+///
+/// Use this code to walk the entire tree:
+/// \code
+/// for ( fltk3::TreeItem *item = tree->first(); item; item = tree->next(item) ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \param[in] item The item to use to find the next item. If NULL, returns 0.
+/// \returns Next item in tree, or 0 if at last item.
+///
+/// \see first(),next(),last(),prev()
+///
+fltk3::TreeItem *fltk3::Tree::next(fltk3::TreeItem *item) {
+  if ( ! item ) return(0);
+  return(item->next());
+}
+
+/// Return the previous item before \p item, or 0 if no more items.
+///
+/// This can be used to walk the tree in reverse, eg:
+///
+/// \code
+/// for ( fltk3::TreeItem *item = tree->first(); item; item = tree->prev(item) ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \param[in] item The item to use to find the previous item. If NULL, returns 0.
+/// \returns Previous item in tree, or 0 if at first item.
+///
+/// \see first(),next(),last(),prev()
+///
+fltk3::TreeItem *fltk3::Tree::prev(fltk3::TreeItem *item) {
+  if ( ! item ) return(0);
+  return(item->prev());
+}
+
+/// Returns the last item in the tree.
+///
+/// This can be used to walk the tree in reverse, eg:
+///
+/// \code
+/// for ( fltk3::TreeItem *item = tree->last(); item; item = tree->prev() ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \returns last item in the tree, or 0 if none (tree empty).
+///
+/// \see first(),next(),last(),prev()
+///
+fltk3::TreeItem* fltk3::Tree::last() {
+  if ( ! _root ) return(0);
+  fltk3::TreeItem *item = _root;
+  while ( item->has_children() ) {
+    item = item->child(item->children()-1);
+  }
+  return(item);
+}
+
+/// Returns the first selected item in the tree.
+///
+/// Use this to walk the tree looking for all the selected items, eg:
+///
+/// \code
+/// for ( fltk3::TreeItem *item = tree->first_selected_item(); item; item = tree->next_selected_item(item) ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \returns The next selected item, or 0 if there are no more selected items.
+///     
+fltk3::TreeItem *fltk3::Tree::first_selected_item() {
+  return(next_selected_item(0));
+}
+
+/// Returns the next selected item after \p item.
+/// If \p item is 0, search starts at the first item (root).
+///
+/// Use this to walk the tree looking for all the selected items, eg:
+/// \code
+/// for ( fltk3::TreeItem *item = tree->first_selected_item(); item; item = tree->next_selected_item(item) ) {
+///     printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// \param[in] item The item to use to find the next selected item. If NULL, first() is used.
+/// \returns The next selected item, or 0 if there are no more selected items.
+///     
+fltk3::TreeItem *fltk3::Tree::next_selected_item(fltk3::TreeItem *item) {
+  if ( ! item ) {
+    if ( ! (item = first()) ) return(0);
+    if ( item->is_selected() ) return(item);
+  }
+  while ( (item = item->next()) )
+    if ( item->is_selected() )
+      return(item);
+  return(0);
+}
+
+/// Standard FLTK event handler for this widget.
+int fltk3::Tree::handle(int e) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+  int ret = 0;
+  // Developer note: fltk3::Browser_::handle() used for reference here..
+  // #include <fltk3/names.h>	// for event debugging
+  // fprintf(stderr, "DEBUG: %s (%d)\n", fl_eventnames[e], e);
+  if (e == fltk3::ENTER || e == fltk3::LEAVE) return(1);
+  switch (e) {
+    case fltk3::FOCUS: {
+      // FLTK tests if we want focus. 
+      //     If a nav key was used to give us focus, and we've got no saved
+      //     focus widget, determine which item gets focus depending on nav key.
+      //
+      if ( ! _item_focus ) {					// no focus established yet?
+	switch (fltk3::event_key()) {				// determine if focus was navigated..
+	  case fltk3::TabKey: {					// received focus via TAB?
+	    if ( fltk3::event_state(fltk3::SHIFT) ) {			// SHIFT-TAB similar to fltk3::UpKey
+	      set_item_focus(next_visible_item(0, fltk3::UpKey));
+	    } else {						// TAB similar to fltk3::DownKey
+	      set_item_focus(next_visible_item(0, fltk3::DownKey));
+	    }
+	    break;
+	  }
+	  case fltk3::LeftKey:		// received focus via LEFT or UP?
+	  case fltk3::UpKey: { 	// XK_ISO_Left_Tab
+	    set_item_focus(next_visible_item(0, fltk3::UpKey));
+	    break;
+	  }
+	  case fltk3::RightKey: 	// received focus via RIGHT or DOWN?
+	  case fltk3::DownKey:
+	  default: {
+	    set_item_focus(next_visible_item(0, fltk3::DownKey));
+	    break;
+	  }
+	}
+      }
+      if ( visible_focus() ) redraw();	// draw focus change
+      return(1);
+    }
+    case fltk3::UNFOCUS: {		// FLTK telling us some other widget took focus.
+      if ( visible_focus() ) redraw();	// draw focus change
+      return(1);
+    }
+    case fltk3::KEYBOARD: {		// keyboard shortcut
+                                        // Do shortcuts first or scrollbar will get them...
+      if (_prefs.selectmode() > fltk3::TREE_SELECT_NONE ) {
+	if ( !_item_focus ) {
+	  set_item_focus(first());
+	}
+	if ( _item_focus ) {
+	  unsigned int ekey = fltk3::event_key();
+	  switch (ekey) {
+	    case fltk3::EnterKey:	// ENTER: selects current item only
+	    case fltk3::KPEnterKey:
+	      if ( when() & ~fltk3::WHEN_ENTER_KEY) {
+		select_only(_item_focus);
+		show_item(_item_focus);		// STR #2426
+		return(1);
+	      }
+	      break;
+	    case ' ':		// toggle selection state
+	      switch ( _prefs.selectmode() ) {
+		case fltk3::TREE_SELECT_NONE:
+		  break;
+		case fltk3::TREE_SELECT_SINGLE:
+		  if ( ! _item_focus->is_selected() )		// not selected?
+		    select_only(_item_focus);			// select only this
+		  else
+		    deselect_all();				// select nothing
+		  break;
+		case fltk3::TREE_SELECT_MULTI:
+		  select_toggle(_item_focus);
+		  break;
+	      }
+	      break;
+	    case fltk3::RightKey:  	// open children (if any)
+	    case fltk3::LeftKey: {	// close children (if any)
+	      if ( _item_focus ) {
+		if ( ekey == fltk3::RightKey && _item_focus->is_close() ) {
+		  // Open closed item
+		  open(_item_focus);
+		  redraw();
+		  ret = 1;
+		} else if ( ekey == fltk3::LeftKey && _item_focus->is_open() ) {
+		  // Close open item
+		  close(_item_focus);
+		  redraw();	
+		  ret = 1;
+		}
+		return(1);
+	      }
+	      break;
+	    }
+	    case fltk3::UpKey:		// next item up
+	    case fltk3::DownKey: {	// next item down
+	      set_item_focus(next_visible_item(_item_focus, ekey));	// next item up|dn
+	      if ( _item_focus ) {					// item in focus?
+                                                                        // Autoscroll
+		int itemtop = _item_focus->y();
+		int itembot = _item_focus->y()+_item_focus->h();
+		if ( itemtop < y() ) { show_item_top(_item_focus); }
+		if ( itembot > y()+h() ) { show_item_bottom(_item_focus); }
+		// Extend selection
+		if ( _prefs.selectmode() == fltk3::TREE_SELECT_MULTI &&	// multiselect on?
+                    (fltk3::event_state() & fltk3::SHIFT) &&			// shift key?
+                    ! _item_focus->is_selected() ) {			// not already selected?
+                  select(_item_focus);				// extend selection..
+		}
+		return(1);
+	      }
+	      break;
+	    }
+	  }
+	}
+      }
+      break;
+    }
+  }
+  
+  // Let fltk3::Group take a shot at handling the event
+  if (Group::handle(e)) {
+    return(1);			// handled? don't continue below
+  }
+  
+  // Handle events the child FLTK widgets didn't need
+  
+  static fltk3::TreeItem *lastselect = 0;
+  // fprintf(stderr, "ERCODEBUG: fltk3::Tree::handle(): Event was %s (%d)\n", fl_eventnames[e], e); // DEBUGGING
+  if ( ! _root ) return(ret);
+  switch ( e ) {
+    case fltk3::PUSH: {					// clicked on a tree item?
+      if (fltk3::visible_focus() && handle(fltk3::FOCUS)) {
+        fltk3::focus(this);
+      }
+      lastselect = 0;
+      fltk3::TreeItem *o = _root->find_clicked(_prefs);
+      if ( ! o ) break;
+      set_item_focus(o);				// becomes new focus widget
+      redraw();
+      ret |= 1;						// handled
+      if ( fltk3::event_button() == fltk3::LEFT_MOUSE ) {
+	if ( o->event_on_collapse_icon(_prefs) ) {	// collapse icon clicked?
+	  open_toggle(o);
+	} else if ( o->event_on_label(_prefs) && 	// label clicked?
+                   (!o->widget() || !fltk3::event_inside(o->widget())) &&		// not inside widget
+                   (!_vscroll->visible() || !fltk3::event_inside(_vscroll)) ) {	// not on scroller
+	  switch ( _prefs.selectmode() ) {
+	    case fltk3::TREE_SELECT_NONE:
+	      break;
+	    case fltk3::TREE_SELECT_SINGLE:
+	      select_only(o);
+	      break;
+	    case fltk3::TREE_SELECT_MULTI: {
+	      if ( fltk3::event_state() & fltk3::SHIFT ) {		// SHIFT+PUSH?
+	        select(o);					// add to selection
+	      } else if ( fltk3::event_state() & fltk3::CTRL ) {	// CTRL+PUSH?
+		select_toggle(o);				// toggle selection state
+		lastselect = o;					// save toggled item (prevent oscillation)
+	      } else {
+		select_only(o);
+	      }
+	      break;
+	    }
+	  }
+	}
+      }
+      break;
+    }
+    case fltk3::DRAG: {
+      // do the scrolling first:
+      int my = fltk3::event_y();
+      if ( my < y() ) {				// above top?
+        int p = vposition()-(y()-my);
+	if ( p < 0 ) p = 0;
+        vposition(p);
+      } else if ( my > (y()+h()) ) {		// below bottom?
+        int p = vposition()+(my-y()-h());
+	if ( p > (int)_vscroll->maximum() ) p = (int)_vscroll->maximum();
+        vposition(p);
+      }
+      if ( fltk3::event_button() != fltk3::LEFT_MOUSE ) break;
+      fltk3::TreeItem *o = _root->find_clicked(_prefs);
+      if ( ! o ) break;
+      set_item_focus(o);			// becomes new focus widget
+      redraw();
+      ret |= 1;
+      // Item's label clicked?
+      if ( o->event_on_label(_prefs) && 
+          (!o->widget() || !fltk3::event_inside(o->widget())) &&
+          (!_vscroll->visible() || !fltk3::event_inside(_vscroll)) ) {
+	// Handle selection behavior
+	switch ( _prefs.selectmode() ) {
+	  case fltk3::TREE_SELECT_NONE: break;	// no selection changes
+	  case fltk3::TREE_SELECT_SINGLE:
+	    select_only(o);
+	    break;
+	  case fltk3::TREE_SELECT_MULTI:
+	    if ( fltk3::event_state() & fltk3::CTRL &&	// CTRL-DRAG: toggle?
+                lastselect != o ) {		// not already toggled from last microdrag?
+	      select_toggle(o);			// toggle selection
+	      lastselect = o;			// save we toggled it (prevents oscillation)
+	    } else {
+	      select(o);			// select this
+	    }
+	    break;
+	}
+      }
+      break;
+    }
+  }
+  return(ret);
+}
+
+/// Deselect \p item and all its children.
+/// If item is NULL, first() is used.
+/// Handles calling redraw() if anything was changed.
+/// Invokes the callback depending on the value of optional parameter \p docallback.
+///
+/// The callback can use callback_item() and callback_reason() respectively to determine 
+/// the item changed and the reason the callback was called.
+///
+/// \param[in] item The item that will be deselected (along with all its children).
+///                 If NULL, first() is used.
+/// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+///     -   0 - the callback() is not invoked
+///     -   1 - the callback() is invoked for each item that changed state,
+///             callback_reason() will be fltk3::TREE_REASON_DESELECTED
+///
+/// \returns count of how many items were actually changed to the deselected state.
+///
+int fltk3::Tree::deselect_all(fltk3::TreeItem *item, int docallback) {
+  item = item ? item : first();			// NULL? use first()
+  if ( ! item ) return(0);
+  int count = 0;
+  // Deselect item
+  if ( item->is_selected() )
+    if ( deselect(item, docallback) )
+      ++count;
+  // Deselect its children
+  for ( int t=0; t<item->children(); t++ ) {
+    count += deselect_all(item->child(t), docallback);	// recurse
+  }
+  return(count);
+}
+
+/// Select \p item and all its children.
+/// If item is NULL, first() is used.
+/// Handles calling redraw() if anything was changed.
+/// Invokes the callback depending on the value of optional parameter \p docallback.
+///
+/// The callback can use callback_item() and callback_reason() respectively to determine 
+/// the item changed and the reason the callback was called.
+///
+/// \param[in] item The item that will be selected (along with all its children). 
+///            If NULL, first() is used.
+/// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+///     -   0 - the callback() is not invoked
+///     -   1 - the callback() is invoked for each item that changed state,
+///             callback_reason() will be fltk3::TREE_REASON_SELECTED
+/// \returns count of how many items were actually changed to the selected state.
+///
+int fltk3::Tree::select_all(fltk3::TreeItem *item, int docallback) {
+  item = item ? item : first();			// NULL? use first()
+  if ( ! item ) return(0);
+  int count = 0;
+  // Select item
+  if ( !item->is_selected() )
+    if ( select(item, docallback) )
+      ++count;
+  // Select its children
+  for ( int t=0; t<item->children(); t++ ) {
+    count += select_all(item->child(t), docallback);	// recurse
+  }
+  return(count);
+}
+
+/// Select only the specified \p item, deselecting all others that might be selected.
+/// If item is 0, first() is used.
+/// Handles calling redraw() if anything was changed.
+/// Invokes the callback depending on the value of optional parameter \p docallback.
+///
+/// The callback can use callback_item() and callback_reason() respectively to determine 
+/// the item changed and the reason the callback was called.
+///
+/// \param[in] selitem The item to be selected. If NULL, first() is used.
+/// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+///     -   0 - the callback() is not invoked
+///     -   1 - the callback() is invoked for each item that changed state, 
+///             callback_reason() will be either fltk3::TREE_REASON_SELECTED or 
+///             fltk3::TREE_REASON_DESELECTED
+/// \returns the number of items whose selection states were changed, if any.
+///
+int fltk3::Tree::select_only(fltk3::TreeItem *selitem, int docallback) {
+  selitem = selitem ? selitem : first();	// NULL? use first()
+  if ( ! selitem ) return(0);
+  int changed = 0;
+  for ( fltk3::TreeItem *item = first(); item; item = item->next() ) {
+    if ( item == selitem ) {
+      if ( item->is_selected() ) continue;	// don't count if already selected
+      select(item, docallback);
+      ++changed;
+    } else {
+      if ( item->is_selected() ) {
+        deselect(item, docallback);
+        ++changed;
+      }
+    }
+  }
+  return(changed);
+}
+
+/// Adjust the vertical scroll bar so that \p item is visible
+/// \p yoff pixels from the top of the fltk3::Tree widget's display.
+///
+/// For instance, yoff=0 will position the item at the top.
+///
+/// If yoff is larger than the vertical scrollbar's limit,
+/// the value will be clipped. So if yoff=100, but scrollbar's max
+/// is 50, then 50 will be used.
+///
+/// \param[in] item The item to be shown. If NULL, first() is used.
+/// \param[in] yoff The pixel offset from the top for the displayed position.
+///
+/// \see show_item_top(), show_item_middle(), show_item_bottom()
+///
+void fltk3::Tree::show_item(fltk3::TreeItem *item, int yoff) {
+  item = item ? item : first();
+  if (!item) return;
+  int newval = item->y() - y() - yoff + (int)_vscroll->value();
+  if ( newval < _vscroll->minimum() ) newval = (int)_vscroll->minimum();
+  if ( newval > _vscroll->maximum() ) newval = (int)_vscroll->maximum();
+  _vscroll->value(newval);
+  redraw();
+}
+
+/// See if \p item is currently displayed on-screen (visible within the widget).
+/// This can be used to detect if the item is scrolled off-screen.
+/// Checks to see if the item's vertical position is within the top and bottom
+/// edges of the display window. This does NOT take into account the hide()/show()
+/// or open()/close() status of the item.
+///
+/// \param[in] item The item to be checked. If NULL, first() is used.
+/// \returns 1 if displayed, 0 if scrolled off screen or no items are in tree.
+///
+int fltk3::Tree::displayed(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (!item) return(0);
+  return( (item->y() >= y()) && (item->y() <= (y()+h()-item->h())) ? 1 : 0);
+}
+
+/// Adjust the vertical scroll bar to show \p item at the top
+/// of the display IF it is currently off-screen (e.g. show_item_top()).
+/// If it is already on-screen, no change is made.
+///
+/// \param[in] item The item to be shown. If NULL, first() is used.
+///
+/// \see show_item_top(), show_item_middle(), show_item_bottom()
+///
+void fltk3::Tree::show_item(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (!item) return;
+  if ( displayed(item) ) return;
+  show_item_top(item);
+}
+
+/// Adjust the vertical scrollbar so that \p item is at the top of the display.
+///
+/// \param[in] item The item to be shown. If NULL, first() is used.
+///
+void fltk3::Tree::show_item_top(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (item) show_item(item, 0);
+}
+
+/// Adjust the vertical scrollbar so that \p item is in the middle of the display.
+///
+/// \param[in] item The item to be shown. If NULL, first() is used.
+///
+void fltk3::Tree::show_item_middle(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (item) show_item(item, (h()/2)-(item->h()/2));
+}
+
+/// Adjust the vertical scrollbar so that \p item is at the bottom of the display.
+///
+/// \param[in] item The item to be shown. If NULL, first() is used.
+///
+void fltk3::Tree::show_item_bottom(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (item) show_item(item, h()-item->h());
+}
+
+/// Returns the vertical scroll position as a pixel offset.
+/// The position returned is how many pixels of the tree are scrolled off the top edge
+/// of the screen.  Example: A position of '3' indicates the top 3 pixels of 
+/// the tree are scrolled off the top edge of the screen.
+/// \see vposition(), hposition()
+///
+int fltk3::Tree::vposition() const {
+  return((int)_vscroll->value());
+}
+
+///  Sets the vertical scroll offset to position \p pos.
+///  The position is how many pixels of the tree are scrolled off the top edge
+///  of the screen. Example: A position of '3' scrolls the top three pixels of
+///  the tree off the top edge of the screen.
+///  \param[in] pos The vertical position (in pixels) to scroll the browser to.
+///
+void fltk3::Tree::vposition(int pos) {
+  if (pos < 0) pos = 0;
+  if (pos > _vscroll->maximum()) pos = (int)_vscroll->maximum();
+  if (pos == _vscroll->value()) return;
+  _vscroll->value(pos);
+  redraw();
+}
+
+/// Displays \p item, scrolling the tree as necessary.
+/// \param[in] item The item to be displayed. If NULL, first() is used.
+///
+void fltk3::Tree::display(fltk3::TreeItem *item) {
+  item = item ? item : first();
+  if (item) show_item_middle(item);
+}
+
+/**
+ * Read a preferences database into the tree widget.
+ * A preferences database is a hierarchical collection of data which can be
+ * directly loaded into the tree view for inspection.
+ * \param[in] prefs the fltk3::Preferences database
+ */
+void fltk3::Tree::load(fltk3::Preferences &prefs) 
+{
+  int i, j, n, pn = strlen(prefs.path());
+  char *p;
+  const char *path = prefs.path();
+  if (strcmp(path, ".")==0)
+    path += 1; // root path is empty
+  else
+    path += 2; // child path starts with "./"
+  n = prefs.groups();
+  for (i=0; i<n; i++) {
+    fltk3::Preferences prefsChild(prefs, i);
+    add(prefsChild.path()+2); // children always start with "./"
+    load(prefsChild);
+  }
+  n = prefs.entries();
+  for (i=0; i<n; i++) {
+    // We must remove all fwd slashes in the key and value strings. Replace with backslash.
+    char *key = strdup(prefs.entry(i));
+    int kn = strlen(key);
+    for (j=0; j<kn; j++) {
+      if (key[j]=='/') key[j]='\\'; 
+    }
+    char *val;  prefs.get(key, val, "");
+    int vn = strlen(val);
+    for (j=0; j<vn; j++) {
+      if (val[j]=='/') val[j]='\\'; 
+    }
+    if (vn<40) {
+      int sze = pn + strlen(key) + vn;
+      p = (char*)malloc(sze+5);
+      sprintf(p, "%s/%s = %s", path, key, val);
+    } else {
+      int sze = pn + strlen(key) + 40;
+      p = (char*)malloc(sze+5);
+      sprintf(p, "%s/%s = %.40s...", path, key, val);
+    }
+    add(p[0]=='/'?p+1:p);
+    free(p);
+    free(val);
+    free(key);
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TreeItem.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tree_Item.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TreeItem.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TreeItem.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,929 @@
+//
+// "$Id$"
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fltk3/Widget.h>
+#include <fltk3/TreeItem.h>
+#include <fltk3/TreePrefs.h>
+
+//////////////////////
+// fltk3::TreeItem.cxx
+//////////////////////
+//
+// fltk3::Tree -- This file is part of the fltk3::Tree widget for FLTK
+// Copyright (C) 2009-2010 by Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+// Was the last event inside the specified xywh?
+static int event_inside(const int xywh[4]) {
+  return(fltk3::event_inside(xywh[0],xywh[1],xywh[2],xywh[3]));
+}
+
+/// Constructor.
+///     Makes a new instance of fltk3::TreeItem using defaults from 'prefs'.
+///
+fltk3::TreeItem::TreeItem(const fltk3::TreePrefs &prefs) {
+  _label        = 0;
+  _labelfont    = prefs.labelfont();
+  _labelsize    = prefs.labelsize();
+  _labelfgcolor = prefs.labelfgcolor();
+  _labelbgcolor = prefs.labelbgcolor();
+  _widget       = 0;
+  _open         = 1;
+  _visible      = 1;
+  _active       = 1;
+  _selected     = 0;
+  _xywh[0]      = 0;
+  _xywh[1]      = 0;
+  _xywh[2]      = 0;
+  _xywh[3]      = 0;
+  _collapse_xywh[0] = 0;
+  _collapse_xywh[1] = 0;
+  _collapse_xywh[2] = 0;
+  _collapse_xywh[3] = 0;
+  _label_xywh[0]    = 0;
+  _label_xywh[1]    = 0;
+  _label_xywh[2]    = 0;
+  _label_xywh[3]    = 0;
+  _usericon         = 0;
+  _userdata         = 0;
+  _parent           = 0;
+}
+
+// DTOR
+fltk3::TreeItem::~TreeItem() {
+  if ( _label ) { 
+    free((void*)_label);
+    _label = 0;
+  }
+  _widget = 0;			// fltk3::Group will handle destruction
+  _usericon = 0;		// user handled allocation
+  //_children.clear();		// array's destructor handles itself
+}
+
+/// Copy constructor.
+fltk3::TreeItem::TreeItem(const fltk3::TreeItem *o) {
+  _label        = o->label() ? strdup(o->label()) : 0;
+  _labelfont    = o->labelfont();
+  _labelsize    = o->labelsize();
+  _labelfgcolor = o->labelfgcolor();
+  _labelbgcolor = o->labelbgcolor();
+  _widget       = o->widget();
+  _open         = o->_open;
+  _visible      = o->_visible;
+  _active       = o->_active;
+  _selected     = o->_selected;
+  _xywh[0]      = o->_xywh[0];
+  _xywh[1]      = o->_xywh[1];
+  _xywh[2]      = o->_xywh[2];
+  _xywh[3]      = o->_xywh[3];
+  _collapse_xywh[0] = o->_collapse_xywh[0];
+  _collapse_xywh[1] = o->_collapse_xywh[1];
+  _collapse_xywh[2] = o->_collapse_xywh[2];
+  _collapse_xywh[3] = o->_collapse_xywh[3];
+  _label_xywh[0]    = o->_label_xywh[0];
+  _label_xywh[1]    = o->_label_xywh[1];
+  _label_xywh[2]    = o->_label_xywh[2];
+  _label_xywh[3]    = o->_label_xywh[3];
+  _usericon         = o->usericon();
+  _userdata         = o->user_data();
+  _parent           = o->_parent;
+}
+
+/// Print the tree as 'ascii art' to stdout.
+/// Used mainly for debugging.
+///
+void fltk3::TreeItem::show_self(const char *indent) const {
+  if ( label() ) {
+    printf("%s-%s (%d children, this=%p, parent=%p depth=%d)\n",
+           indent,label(),children(),(void*)this, (void*)_parent, depth());
+  }
+  if ( children() ) {
+    char *i2 = (char*)malloc(strlen(indent) + 2);
+    strcpy(i2, indent);
+    strcat(i2, " |");
+    for ( int t=0; t<children(); t++ ) {
+      child(t)->show_self(i2);
+    }
+  }
+  fflush(stdout);
+}
+
+/// Set the label. Makes a copy of the name.
+void fltk3::TreeItem::label(const char *name) {
+  if ( _label ) { free((void*)_label); _label = 0; }
+  _label = name ? strdup(name) : 0;
+}
+
+/// Return the label.
+const char *fltk3::TreeItem::label() const {
+  return(_label);
+}
+
+/// Return child item for the specified 'index'.
+const fltk3::TreeItem *fltk3::TreeItem::child(int index) const {
+  return(_children[index]);
+}
+
+/// Clear all the children for this item.
+void fltk3::TreeItem::clear_children() {
+  _children.clear();
+}
+
+/// Return the index of the immediate child of this item that has the label 'name'.
+///
+/// \returns index of found item, or -1 if not found.
+///
+int fltk3::TreeItem::find_child(const char *name) {
+  if ( name ) {
+    for ( int t=0; t<children(); t++ ) {
+      if ( child(t)->label() ) {
+        if ( strcmp(child(t)->label(), name) == 0 ) {
+          return(t);
+        }
+      }
+    }
+  }
+  return(-1);
+}
+
+/// Find child item by descending array of names. Does not include self in search.
+/// Only fltk3::Tree should need this method.
+///
+/// \returns item, or 0 if not found
+///
+const fltk3::TreeItem *fltk3::TreeItem::find_child_item(char **arr) const {
+  for ( int t=0; t<children(); t++ ) {
+    if ( child(t)->label() ) {
+      if ( strcmp(child(t)->label(), *arr) == 0 ) {	// match?
+        if ( *(arr+1) ) {				// more in arr? descend
+          return(_children[t]->find_item(arr+1));
+        } else {					// end of arr? done
+          return(_children[t]);
+        }
+      }
+    }
+  }
+  return(0);
+}
+
+/// Find child item by descending array of names. Does not include self in search.
+/// Only fltk3::Tree should need this method. Use fltk3::Tree::find_item() instead.
+///
+/// \returns item, or 0 if not found
+///
+fltk3::TreeItem *fltk3::TreeItem::find_child_item(char **arr) {
+  for ( int t=0; t<children(); t++ ) {
+    if ( child(t)->label() ) {
+      if ( strcmp(child(t)->label(), *arr) == 0 ) {	// match?
+        if ( *(arr+1) ) {				// more in arr? descend
+          return(_children[t]->find_item(arr+1));
+        } else {					// end of arr? done
+          return(_children[t]);
+        }
+      }
+    }
+  }
+  return(0);
+}
+
+/// Find item by descending array of \p names. Includes self in search.
+/// Only fltk3::Tree should need this method. Use fltk3::Tree::find_item() instead.
+///
+/// \returns item, or 0 if not found
+///
+const fltk3::TreeItem *fltk3::TreeItem::find_item(char **names) const {
+  if ( label() && strcmp(label(), *names) == 0 ) {	// match self?
+    if ( *(names+1) == 0 ) {				// end of names,
+      return(this);					// found ourself.
+    }
+  }
+  if ( children() ) {					// check children..
+    return(find_child_item(names));
+  }
+  return(0);
+}
+
+/// Find item by descending array of \p names. Includes self in search.
+/// Only fltk3::Tree should need this method.
+///
+/// \returns item, or 0 if not found
+///
+fltk3::TreeItem *fltk3::TreeItem::find_item(char **names) {
+  if ( label() && strcmp(label(), *names) == 0 ) {	// match self?
+    if ( *(names+1) == 0 ) {				// end of names,
+      return(this);					// found ourself.
+    }
+  }
+  if ( children() ) {					// check children..
+    return(find_child_item(names));
+  }
+  return(0);
+}
+
+/// Find the index number for the specified 'item'
+/// in the current item's list of children.
+///
+/// \returns the index, or -1 if not found.
+///
+int fltk3::TreeItem::find_child(fltk3::TreeItem *item) {
+  for ( int t=0; t<children(); t++ ) {
+    if ( item == child(t) ) {
+      return(t);
+    }
+  }
+  return(-1);
+}
+
+/// Add a new child to this item with the name 'new_label', with defaults from 'prefs'.
+/// An internally managed copy is made of the label string.
+/// Adds the item based on the value of prefs.sortorder().
+///
+fltk3::TreeItem *fltk3::TreeItem::add(const fltk3::TreePrefs &prefs, const char *new_label) {
+  fltk3::TreeItem *item = new fltk3::TreeItem(prefs);
+  item->label(new_label);
+  item->_parent = this;
+  switch ( prefs.sortorder() ) {
+    case fltk3::TREE_SORT_NONE: {
+      _children.add(item);
+      return(item);
+    }
+    case fltk3::TREE_SORT_ASCENDING: {
+      for ( int t=0; t<_children.total(); t++ ) {
+        fltk3::TreeItem *c = _children[t];
+        if ( c->label() && strcmp(c->label(), new_label) > 0 ) {
+          _children.insert(t, item);
+          return(item);
+        }
+      }
+      _children.add(item);
+      return(item);
+    }
+    case fltk3::TREE_SORT_DESCENDING: {
+      for ( int t=0; t<_children.total(); t++ ) {
+        fltk3::TreeItem *c = _children[t];
+        if ( c->label() && strcmp(c->label(), new_label) < 0 ) {
+          _children.insert(t, item);
+          return(item);
+        }
+      }
+      _children.add(item);
+      return(item);
+    }
+  }
+  return(item);
+}
+
+/// Descend into the path specified by \p arr, and add a new child there.
+/// Should be used only by fltk3::Tree's internals.
+/// Adds the item based on the value of prefs.sortorder().
+/// \returns the item added.
+///
+fltk3::TreeItem *fltk3::TreeItem::add(const fltk3::TreePrefs &prefs, char **arr) {
+  int t = find_child(*arr);
+  fltk3::TreeItem *item = 0;
+  if ( t == -1 ) {
+    item = (fltk3::TreeItem*)add(prefs, *arr);
+  } else {
+    item = (fltk3::TreeItem*)child(t);
+  }
+  if ( *(arr+1) ) {		// descend?
+    return(item->add(prefs, arr+1));
+  } else {
+    return(item);		// end? done
+  }
+}
+
+/// Insert a new item into current item's children at a specified position.
+/// \returns the new item inserted.
+///
+fltk3::TreeItem *fltk3::TreeItem::insert(const fltk3::TreePrefs &prefs, const char *new_label, int pos) {
+  fltk3::TreeItem *item = new fltk3::TreeItem(prefs);
+  item->label(new_label);
+  item->_parent = this;
+  _children.insert(pos, item);
+  return(item);
+}
+
+/// Insert a new item above this item.
+/// \returns the new item inserted, or 0 if an error occurred.
+///
+fltk3::TreeItem *fltk3::TreeItem::insert_above(const fltk3::TreePrefs &prefs, const char *new_label) {
+  fltk3::TreeItem *p = _parent;
+  if ( ! p ) return(0);
+  // Walk our parent's children to find ourself
+  for ( int t=0; t<p->children(); t++ ) {
+    fltk3::TreeItem *c = p->child(t);
+    if ( this == c ) {
+      return(p->insert(prefs, new_label, t));
+    }
+  }
+  return(0);
+}
+
+/// Remove child by item.
+///    \returns 0 if removed, -1 if item not an immediate child.
+///
+int fltk3::TreeItem::remove_child(fltk3::TreeItem *item) {
+  for ( int t=0; t<children(); t++ ) {
+    if ( child(t) == item ) {
+      item->clear_children();
+      _children.remove(t);
+      return(0);
+    }
+  }
+  return(-1);
+}
+
+/// Remove immediate child (and its children) by its label 'name'.
+/// \returns 0 if removed, -1 if not found.
+///
+int fltk3::TreeItem::remove_child(const char *name) {
+  for ( int t=0; t<children(); t++ ) {
+    if ( child(t)->label() ) {
+      if ( strcmp(child(t)->label(), name) == 0 ) {
+        _children.remove(t);
+        return(0);
+      }
+    }
+  }
+  return(-1);
+}
+
+/// Swap two of our children, given two child index values.
+/// Use this eg. for sorting.
+///
+/// This method is FAST, and does not involve lookups.
+///
+/// No range checking is done on either index value.
+///
+/// \returns
+///    -    0 : OK
+///    -   -1 : failed: 'a' or 'b' is not our immediate child
+///
+void fltk3::TreeItem::swap_children(int ax, int bx) {
+  _children.swap(ax, bx);
+}
+
+/// Swap two of our children, given item pointers.
+/// Use this eg. for sorting. 
+///
+/// This method is SLOW because it involves linear lookups.
+/// For speed, use swap_children(int,int) instead.
+///
+/// \returns
+///    -    0 : OK
+///    -   -1 : failed: 'a' or 'b' is not our immediate child
+///
+int fltk3::TreeItem::swap_children(fltk3::TreeItem *a, fltk3::TreeItem *b) {
+  int ax = -1, bx = -1;
+  for ( int t=0; t<children(); t++ ) {	// find index for a and b
+    if ( _children[t] == a ) { ax = t; if ( bx != -1 ) break; else continue; }
+    if ( _children[t] == b ) { bx = t; if ( ax != -1 ) break; else continue; }
+  }
+  if ( ax == -1 || bx == -1 ) return(-1);	// not found? fail
+  swap_children(ax,bx);
+  return(0);
+}
+
+/// Internal: Horizontal connector line based on preference settings.
+void fltk3::TreeItem::draw_horizontal_connector(int x1, int x2, int y, const fltk3::TreePrefs &prefs) {
+  fltk3::color(prefs.connectorcolor());
+  switch ( prefs.connectorstyle() ) {
+    case fltk3::TREE_CONNECTOR_SOLID:
+      y |= 1;				// force alignment w/dot pattern
+      fltk3::line(x1,y,x2,y);
+      return;
+    case fltk3::TREE_CONNECTOR_DOTTED: 
+        {
+            y |= 1;				// force alignment w/dot pattern
+            for ( int xx=x1; xx<=x2; xx++ ) {
+                if ( !(xx & 1) ) fltk3::point(xx, y);
+            }
+        }
+      return;
+    case fltk3::TREE_CONNECTOR_NONE:
+      return;
+  }
+}
+
+/// Internal: Vertical connector line based on preference settings.
+void fltk3::TreeItem::draw_vertical_connector(int x, int y1, int y2, const fltk3::TreePrefs &prefs) {
+  fltk3::color(prefs.connectorcolor());
+  switch ( prefs.connectorstyle() ) {
+    case fltk3::TREE_CONNECTOR_SOLID:
+      y1 |= 1;				// force alignment w/dot pattern
+      y2 |= 1;				// force alignment w/dot pattern
+      fltk3::line(x,y1,x,y2);
+      return;
+    case fltk3::TREE_CONNECTOR_DOTTED:
+        {
+            y1 |= 1;				// force alignment w/dot pattern
+            y2 |= 1;				// force alignment w/dot pattern
+            for ( int yy=y1; yy<=y2; yy++ ) {
+                if ( yy & 1 ) fltk3::point(x, yy);
+            }
+        }
+        return;
+    case fltk3::TREE_CONNECTOR_NONE:
+      return;
+  }
+}
+
+/// Find the item that the last event was over.
+///
+///    Returns the item if it is visible, and mouse is over it.
+///    Works even if widget deactivated.
+///    Use event_on_collapse_icon() to determine if collapse button was pressed.
+///
+///    \returns const visible item under the event if found, or 0 if none.
+///
+const fltk3::TreeItem *fltk3::TreeItem::find_clicked(const fltk3::TreePrefs &prefs) const {
+  if ( ! _visible ) return(0);
+  if ( is_root() && !prefs.showroot() ) {
+    // skip event check if we're root but root not being shown
+  } else {
+    // See if event is over us
+    if ( ::event_inside(_xywh) ) {		// event within this item?
+      return(this);				// found
+    }
+  }
+  if ( is_open() ) {				// open? check children of this item
+    for ( int t=0; t<children(); t++ ) {
+      const fltk3::TreeItem *item;
+      if ( ( item = _children[t]->find_clicked(prefs) ) != NULL) {	// check child and its descendents
+        return(item);							// found?
+      }
+    }
+  }
+  return(0);
+}
+
+/// Non-const version of the above.
+/// Find the item that the last event was over.
+///
+///    Returns the item if it is visible, and mouse is over it.
+///    Works even if widget deactivated.
+///    Use event_on_collapse_icon() to determine if collapse button was pressed.
+///
+///    \returns the visible item under the event if found, or 0 if none.
+///
+fltk3::TreeItem *fltk3::TreeItem::find_clicked(const fltk3::TreePrefs &prefs) {
+  if ( ! _visible ) return(0);
+  if ( is_root() && !prefs.showroot() ) {
+    // skip event check if we're root but root not being shown
+  } else {
+    // See if event is over us
+    if ( ::event_inside(_xywh) ) {		// event within this item?
+      return(this);				// found
+    }
+  }
+  if ( is_open() ) {				// open? check children of this item
+    for ( int t=0; t<children(); t++ ) {
+      fltk3::TreeItem *item;
+      if ( ( item = _children[t]->find_clicked(prefs) ) != NULL ) {	// check child and its descendents
+        return(item);							// found?
+      }
+    }
+  }
+  return(0);
+}
+
+static void draw_item_focus(fltk3::Boxtype B, fltk3::Color C, int X, int Y, int W, int H) {
+  if (!fltk3::visible_focus()) return;
+  switch (B) {
+    case fltk3::DOWN_BOX:
+    case fltk3::DOWN_FRAME:
+    case fltk3::THIN_DOWN_BOX:
+    case fltk3::THIN_DOWN_FRAME:
+      X ++;
+      Y ++;
+    default:
+      break;
+  }
+  fltk3::color(fltk3::contrast(fltk3::BLACK, C));
+
+#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
+  fltk3::line_style(fltk3::DOT);
+  fltk3::rect(X + fltk3::box_dx(B), Y + fltk3::box_dy(B),
+          W - fltk3::box_dw(B) - 1, H - fltk3::box_dh(B) - 1);
+  fltk3::line_style(fltk3::SOLID);
+#else
+  // Some platforms don't implement dotted line style, so draw
+  // every other pixel around the focus area...
+  //
+  // Also, QuickDraw (MacOS) does not support line styles specifically,
+  // and the hack we use in fltk3::line_style() will not draw horizontal lines
+  // on odd-numbered rows...
+  int i, xx, yy;
+
+  X += fltk3::box_dx(B);
+  Y += fltk3::box_dy(B);
+  W -= fltk3::box_dw(B) + 2;
+  H -= fltk3::box_dh(B) + 2;
+
+  for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fltk3::point(X + xx, Y);
+  for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fltk3::point(X + W, Y + yy);
+  for (xx = W; xx > 0; xx --, i ++) if (i & 1) fltk3::point(X + xx, Y + H);
+  for (yy = H; yy > 0; yy --, i ++) if (i & 1) fltk3::point(X, Y + yy);
+#endif
+}
+
+/// Draw this item and its children.
+void fltk3::TreeItem::draw(int X, int &Y, int W, fltk3::Widget *tree,
+			fltk3::TreeItem *itemfocus,
+                        const fltk3::TreePrefs &prefs, int lastchild) {
+  if ( ! _visible ) return; 
+  fltk3::font(_labelfont, _labelsize);
+  int H = _labelsize;
+  if(usericon() && H < usericon()->h()) H = usericon()->h(); 
+  H += prefs.linespacing() + fltk3::descent();
+  // adjust horizontally if we draw no connecting lines
+  if ( is_root() && prefs.connectorstyle() == fltk3::TREE_CONNECTOR_NONE ) {
+    X -= prefs.openicon()->w();
+    W += prefs.openicon()->w();
+  }
+  // Colors, fonts
+  fltk3::Color fg = _selected ? fltk3::contrast(_labelfgcolor, tree->selection_color())
+                          : _active ? _labelfgcolor 
+			            : fltk3::inactive(_labelfgcolor);
+  fltk3::Color bg = _selected ? _active ? tree->selection_color() 
+                                    : fltk3::inactive(tree->selection_color())
+                          : _labelbgcolor;
+  // Update the xywh of this item
+  _xywh[0] = X;
+  _xywh[1] = Y;
+  _xywh[2] = W;
+  _xywh[3] = H;
+  // Text size
+  int textw=0, texth=0;
+  fltk3::measure(_label, textw, texth, 0);
+  int textycenter = Y+(H/2);
+  int &icon_w = _collapse_xywh[2] = prefs.openicon()->w();
+  int &icon_x = _collapse_xywh[0] = X + (icon_w + prefs.connectorwidth())/2 - 3;
+  int &icon_y = _collapse_xywh[1] = textycenter - (prefs.openicon()->h()/2);
+  _collapse_xywh[3] = prefs.openicon()->h();
+  // Horizontal connector values
+  int hstartx  = X+icon_w/2-1;
+  int hendx    = hstartx + prefs.connectorwidth();
+  int hcenterx = X + icon_w + ((hendx - (X + icon_w)) / 2);
+  
+  // See if we should draw this item
+  //    If this item is root, and showroot() is disabled, don't draw.
+  //
+  char drawthis = ( is_root() && prefs.showroot() == 0 ) ? 0 : 1;
+  if ( drawthis ) {
+    // Draw connectors
+    if ( prefs.connectorstyle() != fltk3::TREE_CONNECTOR_NONE ) {
+      // Horiz connector between center of icon and text
+      // if this is root, the connector should not dangle in thin air on the left
+      if (is_root())
+        draw_horizontal_connector(hcenterx, hendx, textycenter, prefs);
+      else
+        draw_horizontal_connector(hstartx, hendx, textycenter, prefs);
+      if ( has_children() && is_open() ) {
+        // Small vertical line down to children
+        draw_vertical_connector(hcenterx, textycenter, Y+H, prefs);
+      }
+      // Connectors for last child
+      if ( ! is_root() ) {
+        if ( lastchild ) {
+          draw_vertical_connector(hstartx, Y, textycenter, prefs);
+        } else {
+          draw_vertical_connector(hstartx, Y, Y+H, prefs);
+        }
+      }
+    } 
+    // Draw collapse icon
+    if ( has_children() && prefs.showcollapse() ) {
+      // Draw icon image
+      if ( is_open() ) {
+        prefs.closeicon()->draw(icon_x,icon_y);
+      } else {
+        prefs.openicon()->draw(icon_x,icon_y);
+      }
+    }
+    // Background for this item
+    int cw1 = icon_w+prefs.connectorwidth()/2, cw2 = prefs.connectorwidth();
+    int cwidth = cw1>cw2 ? cw1 : cw2;
+    int &bx = _label_xywh[0] = X+(icon_w/2-1+cwidth);
+    int &by = _label_xywh[1] = Y;
+    int &bw = _label_xywh[2] = W-(icon_w/2-1+cwidth);
+    int &bh = _label_xywh[3] = H;
+    // Draw bg only if different from tree's bg
+    if ( bg != tree->color() || is_selected() ) {
+      if ( is_selected() ) {
+        // Selected? Use selectbox() style
+        fltk3::draw_box(prefs.selectbox(), bx, by, bw, bh, bg);
+      } else {
+        // Not Selected? use plain filled rectangle
+        fltk3::color(bg);
+        fltk3::rectf(bx, by, bw, bh);
+      }
+    }
+    // Draw user icon (if any)
+    int useroff = (icon_w/2-1+cwidth);
+    if ( usericon() ) {
+      // Item has user icon? Use it
+      useroff += prefs.usericonmarginleft();
+      icon_y = textycenter - (usericon()->h() >> 1);
+      usericon()->draw(X+useroff,icon_y);
+      useroff += usericon()->w();
+    } else if ( prefs.usericon() ) {
+      // Prefs has user icon? Use it
+      useroff += prefs.usericonmarginleft();
+      icon_y = textycenter - (prefs.usericon()->h() >> 1);
+      prefs.usericon()->draw(X+useroff,icon_y);
+      useroff += prefs.usericon()->w();
+    }
+    useroff += prefs.labelmarginleft();
+    // Draw label
+    if ( widget() ) {
+      // Widget? Draw it
+      int lx = X+useroff;
+      int ly = by;
+      int lw = widget()->w();
+      int lh = bh;
+      if ( widget()->x() != lx || widget()->y() != ly ||
+          widget()->w() != lw || widget()->h() != lh ) {
+        widget()->resize(lx, ly, lw, lh);		// fltk will handle drawing this
+      }
+    } else {
+      // No label widget? Draw text label
+      if ( _label ) {
+        fltk3::color(fg);
+        fltk3::draw(_label, X+useroff, Y+H-fltk3::descent()-1);
+      }
+    }
+    if ( this == itemfocus && fltk3::visible_focus() && fltk3::focus() == tree) {
+      // Draw focus box around this item
+      draw_item_focus(fltk3::NO_BOX,bg,bx+1,by+1,bw-1,bh-1);
+    }
+    Y += H;
+  }			// end drawthis
+  // Draw children
+  if ( has_children() && is_open() ) {
+    int child_x = drawthis ? 				// offset children to right,
+    (hcenterx - (icon_w/2) + 1) : X;			// unless didn't drawthis
+    int child_w = W - (child_x-X);
+    int child_y_start = Y;
+    for ( int t=0; t<children(); t++ ) {
+      int lastchild = ((t+1)==children()) ? 1 : 0;
+      _children[t]->draw(child_x, Y, child_w, tree, itemfocus, prefs, lastchild);
+    }
+    if ( has_children() && is_open() ) {
+      Y += prefs.openchild_marginbottom();		// offset below open child tree
+    }
+    if ( ! lastchild ) {
+      draw_vertical_connector(hstartx, child_y_start, Y, prefs);
+    }
+  }
+}
+
+/// Was the event on the 'collapse' button?
+///
+int fltk3::TreeItem::event_on_collapse_icon(const fltk3::TreePrefs &prefs) const {
+  if ( _visible && _active && has_children() && prefs.showcollapse() ) {
+    return(::event_inside(_collapse_xywh) ? 1 : 0);
+  } else {
+    return(0);
+  }
+}
+
+/// Was event on the label()?
+///
+int fltk3::TreeItem::event_on_label(const fltk3::TreePrefs &prefs) const {
+  if ( _visible && _active ) {
+    return(::event_inside(_label_xywh) ? 1 : 0);
+  } else {
+    return(0);
+  }
+}
+
+/// Internal: Show the FLTK widget() for this item and all children.
+/// Used by open() to re-show widgets that were hidden by a previous close()
+///
+void fltk3::TreeItem::show_widgets() {
+  if ( _widget ) _widget->show();
+  if ( is_open() ) {
+    for ( int t=0; t<_children.total(); t++ ) {
+      _children[t]->show_widgets();
+    }
+  }
+}
+
+/// Internal: Hide the FLTK widget() for this item and all children.
+/// Used by close() to hide widgets.
+///
+void fltk3::TreeItem::hide_widgets() {
+  if ( _widget ) _widget->hide();
+  for ( int t=0; t<_children.total(); t++ ) {
+    _children[t]->hide_widgets();
+  }
+}
+
+/// Open this item and all its children.
+void fltk3::TreeItem::open() {
+  _open = 1;
+  // Tell children to show() their widgets
+  for ( int t=0; t<_children.total(); t++ ) {
+    _children[t]->show_widgets();
+  }
+}
+
+/// Close this item and all its children.
+void fltk3::TreeItem::close() {
+  _open = 0;
+  // Tell children to hide() their widgets
+  for ( int t=0; t<_children.total(); t++ ) {
+    _children[t]->hide_widgets();
+  }
+}
+
+/// Returns how many levels deep this item is in the hierarchy.
+///
+/// For instance; root has a depth of zero, and its immediate children
+/// would have a depth of 1, and so on.
+///
+int fltk3::TreeItem::depth() const {
+  int count = 0;
+  const fltk3::TreeItem *item = parent();
+  while ( item ) {
+    ++count;
+    item = item->parent();
+  }
+  return(count);
+}
+
+/// Return the next item in the tree.
+///
+/// This method can be used to walk the tree forward.
+/// For an example of how to use this method, see fltk3::Tree::first().
+/// 
+/// \returns the next item in the tree, or 0 if there's no more items.
+///
+fltk3::TreeItem *fltk3::TreeItem::next() {
+  fltk3::TreeItem *p, *c = this;
+  if ( c->has_children() ) {
+    return(c->child(0));
+  }
+  while ( ( p = c->parent() ) != NULL ) {	// loop upwards through parents
+    int t = p->find_child(c);			// find our position in parent's children[] array
+    if ( ++t < p->children() )			// not last child?
+      return(p->child(t));			// return next child
+    c = p;					// child becomes parent to move up generation
+  }						// loop: moves up to next parent
+  return(0);					// hit root? done
+}
+
+/// Return the previous item in the tree.
+///
+/// This method can be used to walk the tree backwards.
+/// For an example of how to use this method, see fltk3::Tree::last().
+/// 
+/// \returns the previous item in the tree, or 0 if there's no item above this one (hit the root).
+///
+fltk3::TreeItem *fltk3::TreeItem::prev() {
+  fltk3::TreeItem *p=parent();		// start with parent
+  if ( ! p ) return(0);			// hit root? done
+  int t = p->find_child(this);		// find our position in parent's children[] array
+  if ( --t == -1 ) {	 		// are we first child?
+    return(p);				// return immediate parent
+  }
+  p = p->child(t);			// take parent's previous child
+  while ( p->has_children() ) {		// has children?
+    p = p->child(p->children()-1);	// take last child
+  }
+  return(p);
+}
+
+/// Return this item's next sibling.
+///
+/// Moves to the next item below us at the same level (sibling).
+/// Use this to move down the tree without moving deeper into the tree,
+/// effectively skipping over this item's children/descendents.
+/// 
+/// \returns item's next sibling, or 0 if none.
+///
+fltk3::TreeItem *fltk3::TreeItem::next_sibling() {
+  if ( !parent() ) return(0);			// No parent (root)? We have no siblings
+  int index = parent()->find_child(this);	// find our position in parent's child() array
+  if ( index == -1 ) return(0);			// parent doesn't know us? weird
+  if ( (index+1) < parent()->children() )	// is there a next child?
+    return(parent()->child(index+1));		// return next child if there's one below us
+  return(0);					// no siblings below us
+}
+
+/// Return this item's previous sibling.
+///
+/// Moves to the previous item above us at the same level (sibling).
+/// Use this to move up the tree without moving deeper into the tree.
+/// 
+/// \returns This item's previous sibling, or 0 if none.
+///
+fltk3::TreeItem *fltk3::TreeItem::prev_sibling() {
+  if ( !parent() ) return(0);				// No parent (root)? We have no siblings
+  int index = parent()->find_child(this);		// find next position up in parent's child() array
+  if ( index == -1 ) return(0);				// parent doesn't know us? weird
+  if ( index > 0 ) return(parent()->child(index-1));	// return previous child if there's one above us
+  return(0);						// no siblings above us
+}
+
+/// Return the next visible item. (If this item has children and is closed, children are skipped)
+///
+/// This method can be used to walk the tree forward, skipping items
+/// that are not currently visible to the user.
+/// 
+/// \returns the next visible item below us, or 0 if there's no more items.
+///
+fltk3::TreeItem *fltk3::TreeItem::next_displayed(fltk3::TreePrefs &prefs) {
+  fltk3::TreeItem *c = this;
+  while ( c ) {
+    if ( c->is_root() && !prefs.showroot() ) {		// on root and can't show it?
+      c = c->next();					// skip ahead, try again
+      continue;
+    }
+    if ( c->has_children() && c->is_close() ) {		// item has children and: invisible or closed?
+      // Skip children, take next sibling. If none, try parent's sibling, repeat
+      while ( c ) {
+	fltk3::TreeItem *sib = c->next_sibling();		// get sibling
+	if ( sib ) { c = sib; break; }			// Found? let outer loop test it
+	c = c->parent();				// No sibling? move up tree, try parent's sibling
+      }
+    } else {						// has children and isn't closed, or no children
+      c = c->next();					// use normal 'next'
+    }
+    if ( !c ) return(0);				// no more? done
+    // Check all parents to be sure none are closed.
+    // If closed, move up to that level and repeat until sure none are closed.
+    fltk3::TreeItem *p = c->parent();
+    while (1) {
+      if ( !p || p->is_root() ) return(c);		// hit top? then we're displayed, return c
+      if ( p->is_close() ) c = p;			// found closed parent? make it current
+      p = p->parent();					// continue up tree
+    }
+    if ( c && c->visible() ) return(c);			// item visible? return it
+  }
+  return(0);						// hit end: no more items
+}
+
+/// Return the previous visible item. (If this item above us has children and is closed, its children are skipped)
+///
+/// This method can be used to walk the tree backward, 
+/// skipping items that are not currently visible to the user.
+/// 
+/// \returns the previous visible item above us, or 0 if there's no more items.
+///
+fltk3::TreeItem *fltk3::TreeItem::prev_displayed(fltk3::TreePrefs &prefs) {
+  fltk3::TreeItem *c = this;
+  while ( c ) {
+    c = c->prev();					// previous item
+    if ( !c ) break;					// no more items? done
+    if ( c->is_root() )					// root
+      return((prefs.showroot()&&c->visible()) ? c : 0);	// return root if visible
+    if ( !c->visible() ) continue;			// item not visible? skip
+    // Check all parents to be sure none are closed.
+    // If closed, move up to that level and repeat until sure none are closed.
+    fltk3::TreeItem *p = c->parent();
+    while (1) {
+      if ( !p || p->is_root() ) return(c);		// hit top? then we're displayed, return c
+      if ( p->is_close() ) c = p;			// found closed parent? make it current
+      p = p->parent();					// continue up tree
+    }
+  }
+  return(0);						// hit end: no more items
+}
+
+/// Returns if item and all its parents are visible.
+/// Also takes into consideration if any parent is close()ed.
+/// \returns
+///    1 -- item and its parents are visible/open()
+///    0 -- item (or parents) invisible or close()ed.
+///
+int fltk3::TreeItem::visible_r() const {
+  for (const fltk3::TreeItem *p=this; p; p=p->parent())	// move up through parents
+    if (!p->visible() || p->is_close()) return(0);	// any parent not visible or closed?
+  return(1);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TreeItemArray.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tree_Item_Array.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TreeItemArray.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TreeItemArray.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,157 @@
+//
+// "$Id$"
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <fltk3/TreeItemArray.h>
+#include <fltk3/TreeItem.h>
+
+//////////////////////
+// fltk3::TreeItemArray.cxx
+//////////////////////
+//
+// fltk3::Tree -- This file is part of the fltk3::Tree widget for FLTK
+// Copyright (C) 2009-2010 by Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+/// Constructor; creates an empty array.
+///
+///     The optional 'chunksize' can be specified to optimize
+///     memory allocation for potentially large arrays. Default chunksize is 10.
+/// 
+fltk3::TreeItemArray::TreeItemArray(int new_chunksize) {
+  _items     = 0;
+  _total     = 0;
+  _size      = 0;
+  _chunksize = new_chunksize;
+}
+
+/// Destructor. Calls each item's destructor, destroys internal _items array.
+fltk3::TreeItemArray::~TreeItemArray() {
+  clear();
+}
+
+/// Copy constructor. Makes new copy of array, with new instances of each item.
+fltk3::TreeItemArray::TreeItemArray(const fltk3::TreeItemArray* o) {
+  _items = (fltk3::TreeItem**)malloc(o->_size * sizeof(fltk3::TreeItem*));
+  _total     = o->_total;
+  _size      = o->_size;
+  _chunksize = o->_chunksize;
+  for ( int t=0; t<o->_total; t++ ) {
+    _items[t] = new fltk3::TreeItem(o->_items[t]);
+  }
+}
+
+/// Clear the entire array.
+///
+///     Each item will be deleted (destructors will be called),
+///     and the array will be cleared. total() will return 0.
+///
+void fltk3::TreeItemArray::clear() {
+  if ( _items ) {
+    for ( int t=0; t<_total; t++ ) {
+      delete _items[t];
+      _items[t] = 0;
+    }
+    free((void*)_items); _items = 0;
+  }
+  _total = _size = 0;
+}
+
+// Internal: Enlarge the items array.
+//
+//    Adjusts size/items memory allocation as needed.
+//    Does NOT change total.
+//
+void fltk3::TreeItemArray::enlarge(int count) {
+  int newtotal = _total + count;	// new total
+  if ( newtotal >= _size ) {		// more than we have allocated?
+    // Increase size of array
+    int newsize = _size + _chunksize;
+    fltk3::TreeItem **newitems = (fltk3::TreeItem**)malloc(newsize * sizeof(fltk3::TreeItem*));
+    if ( _items ) { 
+      // Copy old array -> new, delete old
+      memmove(newitems, _items, _size * sizeof(fltk3::TreeItem*));
+      free((void*)_items); _items = 0;
+    }
+    // Adjust items/sizeitems
+    _items = newitems;
+    _size = newsize;
+  }
+}
+
+/// Insert an item at index position \p pos.
+///
+///     Handles enlarging array if needed, total increased by 1.
+///     If \p pos == total(), an empty item is appended to the array.
+///
+void fltk3::TreeItemArray::insert(int pos, fltk3::TreeItem *new_item) {
+  enlarge(1);
+  // printf("*** POS=%d TOTAL-1=%d NITEMS=%d\n", pos, _total-1, (_total-pos));
+  if ( pos <= (_total - 1) ) {	// need to move memory around?
+    int nitems = _total - pos;
+    memmove(&_items[pos+1], &_items[pos], sizeof(fltk3::TreeItem*) * nitems);
+  } 
+  _items[pos] = new_item;
+  _total++;
+}
+
+/// Add an item* to the end of the array.
+///
+///     Assumes the item was created with 'new', and will remain
+///     allocated.. fltk3::TreeItemArray will handle calling the
+///     item's destructor when the array is cleared or the item remove()'ed.
+///
+void fltk3::TreeItemArray::add(fltk3::TreeItem *val) {
+  insert(_total, val);
+}
+
+/// Remove the item at \param[in] index from the array.
+///
+///     The item will be delete'd (if non-NULL), so its destructor will be called.
+///
+void fltk3::TreeItemArray::remove(int index) {
+  if ( _items[index] ) {		// delete if non-zero
+    delete _items[index];
+  }
+  _items[index] = 0;
+  for ( _total--; index<_total; index++ ) {
+    _items[index] = _items[index+1];
+  }
+}
+
+/// Remove the item from the array.
+///
+///     \returns 0 if removed, or -1 if the item was not in the array.
+///
+int fltk3::TreeItemArray::remove(fltk3::TreeItem *item) {
+  for ( int t=0; t<_total; t++ ) {
+    if ( item == _items[t] ) {
+      remove(t);
+      return(0);
+    }
+  }
+  return(-1);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/TreePrefs.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Tree_Prefs.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/TreePrefs.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/TreePrefs.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,168 @@
+//
+// "$Id$"
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Pixmap.h>
+#include <fltk3/TreePrefs.h>
+#include <string.h>
+
+//////////////////////
+// fltk3::TreePrefs.cxx
+//////////////////////
+//
+// fltk3::Tree -- This file is part of the fltk3::Tree widget for FLTK
+// Copyright (C) 2009-2010 by Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+// INTERNAL: BUILT IN OPEN/STOW XPMS
+//    These can be replaced via prefs.openicon()/closeicon()
+//
+static const char *L_open_xpm[] = {
+#ifdef __APPLE__
+  "11 11 2 1",
+  ".  c None",
+  "@  c #000000",
+  "...@.......",
+  "...@@......",
+  "...@@@.....",
+  "...@@@@....",
+  "...@@@@@...",
+  "...@@@@@@..",
+  "...@@@@@...",
+  "...@@@@....",
+  "...@@@.....",
+  "...@@......",
+  "...@......."
+#else
+  "11 11 3 1",
+  ".	c #fefefe",
+  "#	c #444444",
+  "@	c #000000",
+  "###########",
+  "#.........#",
+  "#.........#",
+  "#....@....#",
+  "#....@....#",
+  "#..@@@@@..#",
+  "#....@....#",
+  "#....@....#",
+  "#.........#",
+  "#.........#",
+  "###########"
+#endif
+};
+static fltk3::Pixmap L_openpixmap(L_open_xpm);
+
+static const char *L_close_xpm[] = {
+#ifdef __APPLE__
+  "11 11 2 1",
+  ".  c None",
+  "@  c #000000",
+  "...........",
+  "...........",
+  "...........",
+  "...........",
+  "...........",
+  "@@@@@@@@@@@",
+  ".@@@@@@@@@.",
+  "..@@@@@@@..",
+  "...@@@@@...",
+  "....@@@....",
+  ".....@....."
+#else
+  "11 11 3 1",
+  ".	c #fefefe",
+  "#	c #444444",
+  "@	c #000000",
+  "###########",
+  "#.........#",
+  "#.........#",
+  "#.........#",
+  "#.........#",
+  "#..@@@@@..#",
+  "#.........#",
+  "#.........#",
+  "#.........#",
+  "#.........#",
+  "###########"
+#endif
+};
+static fltk3::Pixmap L_closepixmap(L_close_xpm);
+
+/// Sets the default icon to be used as the 'open' icon
+/// when items are add()ed to the tree.
+/// This overrides the built in default '[+]' icon.
+///
+/// \param[in] val -- The new image, or zero to use the default [+] icon.
+///
+void fltk3::TreePrefs::openicon(fltk3::Image *val) {
+  _openimage = val ? val : &L_openpixmap;
+}
+
+/// Sets the icon to be used as the 'close' icon.
+/// This overrides the built in default '[-]' icon.
+///
+/// \param[in] val -- The new image, or zero to use the default [-] icon.
+///
+void fltk3::TreePrefs::closeicon(fltk3::Image *val) {
+  _closeimage = val ? val : &L_closepixmap;
+}
+
+/// fltk3::TreePrefs constructor
+fltk3::TreePrefs::TreePrefs() {
+  _labelfont              = fltk3::HELVETICA;
+  _labelsize              = fltk3::NORMAL_SIZE;
+  _marginleft             = 6;
+  _margintop              = 3;
+  //_marginright          = 3;
+  //_marginbottom         = 3;
+  _openchild_marginbottom = 0;
+  _usericonmarginleft     = 3;
+  _labelmarginleft        = 3;
+  _linespacing            = 0;
+  _labelfgcolor           = fltk3::BLACK;
+  _labelbgcolor           = fltk3::WHITE;
+  _connectorcolor         = fltk3::Color(43);
+#ifdef __APPLE__
+  _connectorstyle         = fltk3::TREE_CONNECTOR_NONE;
+#else
+  _connectorstyle         = fltk3::TREE_CONNECTOR_DOTTED;
+#endif
+  _openimage              = &L_openpixmap;
+  _closeimage             = &L_closepixmap;
+  _userimage              = 0;
+  _showcollapse           = 1;
+  _showroot               = 1;
+  _connectorwidth         = 17;
+  _sortorder              = fltk3::TREE_SORT_NONE;
+  _selectbox              = fltk3::FLAT_BOX;
+  _selectmode             = fltk3::TREE_SELECT_SINGLE;
+  // Let fltk's current 'scheme' affect defaults
+  if ( fltk3::scheme() ) {
+    if ( strcmp(fltk3::scheme(), "plastic") == 0 ) {
+      _selectbox = fltk3::PLASTIC_THIN_UP_BOX;
+    }
+  } else {
+    _selectbox = fltk3::GTK_THIN_UP_BOX;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Valuator.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Valuator.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Valuator.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Valuator.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,196 @@
+//
+// "$Id$"
+//
+// Valuator widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+// Base class for sliders and all other one-value "knobs"
+
+#include <fltk3/run.h>
+#include <fltk3/Valuator.h>
+#include <fltk3/math.h>
+#include <stdio.h>
+#include "flstring.h"
+
+fltk3::Valuator::Valuator(int X, int Y, int W, int H, const char* L)
+/**
+  Creates a new fltk3::Valuator widget using the given position,
+  size, and label string. The default boxtype is fltk3::NO_BOX.
+*/
+: fltk3::Widget(X,Y,W,H,L) {
+  align(fltk3::ALIGN_BOTTOM);
+  when(fltk3::WHEN_CHANGED);
+  value_ = 0;
+  previous_value_ = 1;
+  min = 0;
+  max = 1;
+  A = 0.0;
+  B = 1;
+}
+
+const double epsilon = 4.66e-10;
+
+/**  See double fltk3::Valuator::step() const */
+void fltk3::Valuator::step(double s) {
+  if (s < 0) s = -s;
+  A = rint(s);
+  B = 1;
+  while (fabs(s-A/B) > epsilon && B<=(0x7fffffff/10)) {B *= 10; A = rint(s*B);}
+}
+
+/**  Sets the step value to 1/10<SUP>digits</SUP>.*/
+void fltk3::Valuator::precision(int p) {
+  A = 1.0;
+  for (B = 1; p--;) B *= 10;
+}
+/** Asks for partial redraw */
+void fltk3::Valuator::value_damage() {damage(fltk3::DAMAGE_EXPOSE);} // by default do partial-redraw
+
+/**
+    Sets the current value. The new value is <I>not</I>
+    clamped or otherwise changed before storing it. Use
+    clamp() or round() to modify the value before
+    calling value(). The widget is redrawn if the new value
+    is different than the current one. The initial value is zero.
+    <P>changed() will return true if the user has moved the slider,
+    but it will be turned off by value(x) and just before doing a callback
+    (the callback can turn it back on if desired).
+*/
+int fltk3::Valuator::value(double v) {
+  clear_changed();
+  if (v == value_) return 0;
+  value_ = v;
+  value_damage();
+  return 1;
+}
+/** Clamps the value, but accepts v if the previous value is not already out of range */
+double fltk3::Valuator::softclamp(double v) {
+  int which = (min<=max);
+  double p = previous_value_;
+  if ((v<min)==which && p!=min && (p<min)!=which) return min;
+  else if ((v>max)==which && p!=max && (p>max)!=which) return max;
+  else return v;
+}
+
+// inline void fltk3::Valuator::handle_push() {previous_value_ = value_;}
+/** Called during a drag operation, after an fltk3::WHEN_CHANGED event is received and before the callback. */
+void fltk3::Valuator::handle_drag(double v) {
+  if (v != value_) {
+    value_ = v;
+    value_damage();
+    set_changed();
+    if (when() & fltk3::WHEN_CHANGED) do_callback();
+  }
+}
+/** Called after an fltk3::WHEN_RELEASE event is received and before the callback. */
+void fltk3::Valuator::handle_release() {
+  if (when()&fltk3::WHEN_RELEASE) {
+    // insure changed() is off even if no callback is done.  It may have
+    // been turned on by the drag, and then the slider returned to it's
+    // initial position:
+    clear_changed();
+    // now do the callback only if slider in new position or always is on:
+    if (value_ != previous_value_ || when() & fltk3::WHEN_NOT_CHANGED) {
+      do_callback();
+    }
+  }
+}
+
+/**
+  Round the passed value to the nearest step increment.  Does
+  nothing if step is zero.
+*/
+double fltk3::Valuator::round(double v) {
+  if (A) return rint(v*B/A)*A/B;
+  else return v;
+}
+
+/**  Clamps the passed value to the valuator range.*/
+double fltk3::Valuator::clamp(double v) {
+  if ((v<min)==(min<=max)) return min;
+  else if ((v>max)==(min<=max)) return max;
+  else return v;
+}
+
+/**
+  Adds n times the step value to the passed value. If
+  step was set to zero it uses fabs(maximum() - minimum()) /
+  100.
+*/
+double fltk3::Valuator::increment(double v, int n) {
+  if (!A) return v+n*(max-min)/100;
+  if (min > max) n = -n;
+  return (rint(v*B/A)+n)*A/B;
+}
+
+/**
+  Uses internal rules to format the fields numerical value into
+  the character array pointed to by the passed parameter.</P>
+  
+  <P>The actual format used depends on the current step value. If
+  the step value has been set to zero then a %g format is used.
+  If the step value is non-zero, then a %.*f format is used,
+  where the precision is calculated to show sufficient digits
+  for the current step value. An integer step value, such as 1
+  or 1.0, gives a precision of 0, so the formatted value will
+  appear as an integer.</P>
+  
+  <P>This method is used by the Fl_Value_... group of widgets to 
+  format the current value into a text string. 
+  The return value is the length of the formatted text.
+  The formatted value is written into in <i>buffer</i>. 
+  <i>buffer</i> should have space for at least 128 bytes.</P>
+  
+  <P>You may override this function to create your own text formatting.
+*/
+int fltk3::Valuator::format(char* buffer) {
+  double v = value();
+  // MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT
+  if (!A || !B) return snprintf(buffer, 128, "%g", v);
+
+  // Figure out how many digits are required to correctly format the
+  // value.
+  int i, c = 0;
+  char temp[32];
+  // output a number with many digits after the decimal point. This
+  // seems to be needed to get high precission
+  snprintf(temp, sizeof(temp), "%.12f", A/B);
+  // strip all trailing 0's
+  for (i=strlen(temp)-1; i>0; i--) {
+    if (temp[i]!='0') break;
+  }
+  // count digits until we find the decimal point (or comma or whatever
+  // letter is set in the current locale)
+  for (; i>0; i--, c++) {
+    if (!isdigit(temp[i])) break;
+  }
+
+  // MRS: THIS IS A HACK - RECOMMEND ADDING BUFFER SIZE ARGUMENT
+  return snprintf(buffer, 128, "%.*f", c, v);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ValueInput.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Value_Input.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ValueInput.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ValueInput.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,151 @@
+//
+// "$Id$"
+//
+// Value input widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// FLTK widget for drag-adjusting a floating point value.
+// Warning: this works by making a child fltk3::Input object, even
+// though this object is *not* an fltk3::Group.  May be a kludge?
+
+#include <fltk3/run.h>
+#include <fltk3/ValueInput.h>
+#include <fltk3/Group.h>
+#include <stdlib.h>
+#include <fltk3/math.h>
+
+
+void fltk3::ValueInput::input_cb(fltk3::Widget*, void* v) {
+  fltk3::ValueInput& t = *(fltk3::ValueInput*)v;
+  double nv;
+  if ((t.step() - floor(t.step()))>0.0 || t.step() == 0.0) nv = strtod(t.input.value(), 0);
+  else nv = strtol(t.input.value(), 0, 0);
+  if (nv != t.value() || t.when() & fltk3::WHEN_NOT_CHANGED) {
+    t.set_value(nv);
+    t.set_changed();
+    if (t.when()) t.do_callback();
+  }
+}
+
+void fltk3::ValueInput::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  if (damage()&~fltk3::DAMAGE_CHILD) input.clear_damage(fltk3::DAMAGE_ALL);
+  input.box(box());
+  input.color(color(), selection_color());
+  fltk3::Widget *i = &input; i->draw(); // calls protected input.draw()
+  input.clear_damage();
+}
+
+void fltk3::ValueInput::resize(int X, int Y, int W, int H) {
+  Valuator::resize(X, Y, W, H);
+  input.resize(X, Y, W, H);
+}
+
+void fltk3::ValueInput::value_damage() {
+  char buf[128];
+  format(buf);
+  input.value(buf);
+  input.mark(input.position()); // turn off selection highlight
+}
+
+int fltk3::ValueInput::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  double v;
+  int delta;
+  int mx = fltk3::event_x_root();
+  static int ix, drag;
+  input.when(when());
+  switch (event) {
+  case fltk3::PUSH:
+    if (!step()) goto DEFAULT;
+    ix = mx;
+    drag = fltk3::event_button();
+    handle_push();
+    return 1;
+  case fltk3::DRAG:
+    if (!step()) goto DEFAULT;
+    delta = mx-ix;
+    if (delta > 5) delta -= 5;
+    else if (delta < -5) delta += 5;
+    else delta = 0;
+    switch (drag) {
+    case 3: v = increment(previous_value(), delta*100); break;
+    case 2: v = increment(previous_value(), delta*10); break;
+    default:v = increment(previous_value(), delta); break;
+    }
+    v = round(v);
+    handle_drag(soft()?softclamp(v):clamp(v));;
+    return 1;
+  case fltk3::RELEASE:
+    if (!step()) goto DEFAULT;
+    if (value() != previous_value() || !fltk3::event_is_click())
+      handle_release();
+    else {
+      fltk3::WidgetTracker wp(&input);
+      input.handle(fltk3::PUSH);
+      if (wp.exists())
+	input.handle(fltk3::RELEASE);
+    }
+    return 1;
+  case fltk3::FOCUS:
+    return input.take_focus();
+  case fltk3::SHORTCUT:
+    return input.handle(event);
+  default:
+  DEFAULT:
+    input.type(((step() - floor(step()))>0.0 || step() == 0.0) ? fltk3::FLOAT_INPUT : fltk3::INT_INPUT);
+    return input.handle(event);
+  }
+}
+
+/**
+  Creates a new fltk3::ValueInput widget using the given
+  position, size, and label string. The default boxtype is
+  fltk3::DOWN_BOX.
+*/
+fltk3::ValueInput::ValueInput(int X, int Y, int W, int H, const char* l)
+: fltk3::Valuator(X, Y, W, H, l), input(X, Y, W, H, 0) {
+  soft_ = 0;
+  if (input.parent())  // defeat automatic-add
+    input.parent()->remove(input);
+  input.parent((fltk3::Group *)this); // kludge!
+  input.callback(input_cb, this);
+  input.when(fltk3::WHEN_CHANGED);
+  box(input.box());
+  color(input.color());
+  selection_color(input.selection_color());
+  align(fltk3::ALIGN_LEFT);
+  value_damage();
+  set_flag(SHORTCUT_LABEL);
+}
+
+fltk3::ValueInput::~ValueInput() {
+
+  if (input.parent() == (fltk3::Group *)this)
+    input.parent(0);   // *revert* ctor kludge!
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ValueOutput.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Value_Output.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ValueOutput.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ValueOutput.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,110 @@
+//
+// "$Id$"
+//
+// Value output widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Fltk widget for drag-adjusting a floating point value.
+// This is much lighter than fltk3::ValueInput because it has no text editor
+// If step() is zero then it can be used to display a floating-point value
+
+#include <fltk3/run.h>
+#include <fltk3/ValueOutput.h>
+#include <fltk3/draw.h>
+
+void fltk3::ValueOutput::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  fltk3::Boxtype b = box() ? box() : fltk3::DOWN_BOX;
+  int X = x()+fltk3::box_dx(b);
+  int Y = y()+fltk3::box_dy(b);
+  int W = w()-fltk3::box_dw(b);
+  int H = h()-fltk3::box_dh(b);
+  if (damage()&~fltk3::DAMAGE_CHILD)
+    draw_box(b, color());
+  else {
+    fltk3::color(color());
+    fltk3::rectf(X, Y, W, H);
+  }
+  char buf[128];
+  format(buf);
+  fltk3::color(active_r() ? textcolor() : fltk3::inactive(textcolor()));
+  fltk3::font(textfont(), textsize());
+  fltk3::draw(buf,X,Y,W,H,fltk3::ALIGN_LEFT);
+}
+
+int fltk3::ValueOutput::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (!step()) return 0;
+  double v;
+  int delta;
+  int mx = fltk3::event_x();
+  static int ix, drag;
+  switch (event) {
+  case fltk3::PUSH:
+    ix = mx;
+    drag = fltk3::event_button();
+    handle_push();
+    return 1;
+  case fltk3::DRAG:
+    delta = fltk3::event_x()-ix;
+    if (delta > 5) delta -= 5;
+    else if (delta < -5) delta += 5;
+    else delta = 0;
+    switch (drag) {
+    case 3: v = increment(previous_value(),delta*100); break;
+    case 2: v = increment(previous_value(),delta*10); break;
+    default:v = increment(previous_value(),delta); break;
+    }
+    v = round(v);
+    handle_drag(soft()?softclamp(v):clamp(v));;
+    return 1;
+  case fltk3::RELEASE:
+    handle_release();
+    return 1;
+  case fltk3::ENTER :
+  case fltk3::LEAVE :
+    return 1;
+  default:
+    return 0;
+  }
+}
+
+/**
+  Creates a new fltk3::ValueOutput widget using the given
+  position, size, and label string. The default boxtype is fltk3::NO_BOX.
+  <P> Inherited destructor destroys the Valuator.
+*/
+fltk3::ValueOutput::ValueOutput(int X, int Y, int W, int H,const char *l)
+: fltk3::Valuator(X,Y,W,H,l) {
+  box(fltk3::NO_BOX);
+  align(fltk3::ALIGN_LEFT);
+  textfont(fltk3::HELVETICA);
+  textsize(fltk3::NORMAL_SIZE);
+  textcolor(fltk3::FOREGROUND_COLOR);
+  soft_ = 0;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ValueSlider.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Value_Slider.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ValueSlider.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ValueSlider.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,88 @@
+//
+// "$Id$"
+//
+// Value slider widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/ValueSlider.h>
+#include <fltk3/draw.h>
+#include <math.h>
+
+/**
+  Creates a new fltk3::ValueSlider widget using the given
+  position, size, and label string. The default boxtype is fltk3::DOWN_BOX.
+*/
+fltk3::ValueSlider::ValueSlider(int X, int Y, int W, int H, const char*l)
+: fltk3::Slider(X,Y,W,H,l) {
+  step(1,100);
+  textfont(fltk3::HELVETICA);
+  textsize(10);
+  textcolor(fltk3::FOREGROUND_COLOR);
+}
+
+void fltk3::ValueSlider::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+  int sxx = x(), syy = y(), sww = w(), shh = h();
+  int bxx = x(), byy = y(), bww = w(), bhh = h();
+  if (horizontal()) {
+    bww = 35; sxx += 35; sww -= 35;
+  } else {
+    syy += 25; bhh = 25; shh -= 25;
+  }
+  if (damage()&fltk3::DAMAGE_ALL) draw_box(box(),sxx,syy,sww,shh,color());
+  Slider::draw(sxx+fltk3::box_dx(box()),
+		  syy+fltk3::box_dy(box()),
+		  sww-fltk3::box_dw(box()),
+		  shh-fltk3::box_dh(box()));
+  draw_box(box(),bxx,byy,bww,bhh,color());
+  char buf[128];
+  format(buf);
+  fltk3::font(textfont(), textsize());
+  fltk3::color(active_r() ? textcolor() : fltk3::inactive(textcolor()));
+  fltk3::draw(buf, bxx, byy, bww, bhh, fltk3::ALIGN_CLIP);
+}
+
+int fltk3::ValueSlider::handle(int event) {
+  FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(event), Handle)
+  if (event == fltk3::PUSH && fltk3::visible_focus()) {
+    fltk3::focus(this);
+    redraw();
+  }
+  int sxx = x(), syy = y(), sww = w(), shh = h();
+  if (horizontal()) {
+    sxx += 35; sww -= 35;
+  } else {
+    syy += 25; shh -= 25;
+  }
+  return Slider::handle(event,
+			   sxx+fltk3::box_dx(box()),
+			   syy+fltk3::box_dy(box()),
+			   sww-fltk3::box_dw(box()),
+			   shh-fltk3::box_dh(box()));
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Widget.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Widget.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Widget.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Widget.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,459 @@
+//
+// "$Id$"
+//
+// Base widget class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/Wrapper.h>
+#include <fltk3/Group.h>
+#include <fltk3/Tooltip.h>
+#include <fltk3/draw.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+
+////////////////////////////////////////////////////////////////
+// for compatibility with Forms, all widgets without callbacks are
+// inserted into a "queue" when they are activated, and the forms
+// compatibility interaction functions (fl_do_events, etc.) will
+// read one widget at a time from this queue and return it:
+
+const int QUEUE_SIZE = 20;
+
+static fltk3::Widget *obj_queue[QUEUE_SIZE];
+static int obj_head, obj_tail;
+
+void fltk3::Widget::default_callback(fltk3::Widget *o, void * /*v*/) {
+#if 0
+  // This is necessary for strict forms compatibility but is confusing.
+  // Use the parent's callback if this widget does not have one.
+  for (fltk3::Widget *p = o->parent(); p; p = p->parent())
+    if (p->callback() != default_callback) {
+      p->do_callback(o,v);
+      return;
+    }
+#endif
+  obj_queue[obj_head++] = o;
+  if (obj_head >= QUEUE_SIZE) obj_head = 0;
+  if (obj_head == obj_tail) {
+    obj_tail++;
+    if (obj_tail >= QUEUE_SIZE) obj_tail = 0;
+  }
+}
+/**
+    All Fl_Widgets that don't have a callback defined use a
+    default callback that puts a pointer to the widget in this queue,
+    and this method reads the oldest widget out of this queue.
+*/
+fltk3::Widget *fltk3::readqueue() {
+  if (obj_tail==obj_head) return 0;
+  fltk3::Widget *o = obj_queue[obj_tail++];
+  if (obj_tail >= QUEUE_SIZE) obj_tail = 0;
+  return o;
+}
+/*
+    This static internal function removes all pending callbacks for a
+    specific widget from the default callback queue (fltk3::readqueue()).
+    It is only called from fltk3::Widget's destructor if the widget
+    doesn't have an own callback.
+    Note: There's no need to have this in the fltk3:: namespace.
+*/
+static void cleanup_readqueue(fltk3::Widget *w) {
+
+  if (obj_tail==obj_head) return;
+  
+  // Read the entire queue and copy over all valid entries.
+  // The new head will be determined after the last copied entry.
+
+  int old_head = obj_head;	// save newest entry
+  int entry = obj_tail;		// oldest entry
+  obj_head = obj_tail;		// new queue start
+  for (;;) {
+    fltk3::Widget *o = obj_queue[entry++];
+    if (entry >= QUEUE_SIZE) entry = 0;
+    if (o != w) { // valid entry
+      obj_queue[obj_head++] = o;
+      if (obj_head >= QUEUE_SIZE) obj_head = 0;
+    } // valid entry
+    if (entry == old_head) break;
+  }
+  return;
+}
+////////////////////////////////////////////////////////////////
+
+int fltk3::Widget::handle(int event) {
+  return 0;
+}
+
+/** Default font size for widgets */
+fltk3::Fontsize fltk3::NORMAL_SIZE = 14;
+
+fltk3::Widget::Widget(int X, int Y, int W, int H, const char* L) {
+
+  x_ = X; y_ = Y; w_ = W; h_ = H;
+
+  label_.value	 = L;
+  label_.image   = 0;
+  label_.deimage = 0;
+  label_.type	 = fltk3::NORMAL_LABEL;
+  label_.font	 = fltk3::HELVETICA;
+  label_.size	 = fltk3::NORMAL_SIZE;
+  label_.color	 = fltk3::FOREGROUND_COLOR;
+  label_.align_	 = fltk3::ALIGN_CENTER;
+  tooltip_       = 0;
+  callback_	 = default_callback;
+  user_data_ 	 = 0;
+  type_		 = 0;
+  flags_	 = VISIBLE_FOCUS;
+  damage_	 = 0;
+  box_		 = fltk3::NO_BOX;
+  color_	 = fltk3::GRAY;
+  color2_	 = fltk3::GRAY;
+  when_		 = fltk3::WHEN_RELEASE;
+
+  parent_ = 0;
+  if (fltk3::Group::current()) fltk3::Group::current()->add(this);
+}
+
+void fltk3::Widget::resize(int X, int Y, int W, int H) {
+  x_ = X; y_ = Y; w_ = W; h_ = H;
+}
+
+// this is useful for parent widgets to call to resize children:
+int fltk3::Widget::damage_resize(int X, int Y, int W, int H) {
+  if (x() == X && y() == Y && w() == W && h() == H) return 0;
+  resize(X, Y, W, H);
+  redraw();
+  return 1;
+}
+
+int fltk3::Widget::take_focus() {
+  if (!takesevents()) return 0;
+  if (!visible_focus()) return 0;
+  if (!handle(fltk3::FOCUS)) return 0; // see if it wants it
+  if (contains(fltk3::focus())) return 1; // it called fltk3::focus for us
+  fltk3::focus(this);
+  return 1;
+}
+
+extern void fl_throw_focus(fltk3::Widget*); // in Fl_x.cxx
+
+/**
+   Destroys the widget, taking care of throwing focus before if any.
+   Destruction removes the widget from any parent group! And groups when
+   destroyed destroy all their children. This is convenient and fast.
+*/
+fltk3::Widget::~Widget() {
+  fltk3::clear_widget_pointer(this);
+  if (flags() & COPIED_LABEL) free((void *)(label_.value));
+  if (flags() & COPIED_TOOLTIP) free((void *)(tooltip_));
+  // remove from parent group
+  if (parent_) parent_->remove(this);
+#ifdef DEBUG_DELETE
+  if (parent_) { // this should never happen
+    printf("*** fltk3::Widget: parent_->remove(this) failed [%p,%p]\n",parent_,this);
+  }
+#endif // DEBUG_DELETE
+  parent_ = 0; // Don't throw focus to a parent widget.
+  fl_throw_focus(this);
+  // remove stale entries from default callback queue (fltk3::readqueue())
+  if (callback_ == default_callback) cleanup_readqueue(this);
+}
+
+/** Draws a focus box for the widget at the given position and size */
+void
+fltk3::Widget::draw_focus(fltk3::Boxtype B, int X, int Y, int W, int H) const {
+  if (!fltk3::visible_focus()) return;
+  switch (B) {
+    case fltk3::DOWN_BOX:
+    case fltk3::DOWN_FRAME:
+    case fltk3::THIN_DOWN_BOX:
+    case fltk3::THIN_DOWN_FRAME:
+      X ++;
+      Y ++;
+    default:
+      break;
+  }
+
+  fltk3::color(fltk3::contrast(fltk3::BLACK, color()));
+
+#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
+  fltk3::line_style(fltk3::DOT);
+  fltk3::rect(X + fltk3::box_dx(B), Y + fltk3::box_dy(B),
+          W - fltk3::box_dw(B) - 1, H - fltk3::box_dh(B) - 1);
+  fltk3::line_style(fltk3::SOLID);
+#elif defined(WIN32) 
+  // Windows 95/98/ME do not implement the dotted line style, so draw
+  // every other pixel around the focus area...
+  //
+  // Also, QuickDraw (MacOS) does not support line styles specifically,
+  // and the hack we use in fltk3::line_style() will not draw horizontal lines
+  // on odd-numbered rows...
+  int i, xx, yy;
+
+  X += fltk3::box_dx(B);
+  Y += fltk3::box_dy(B);
+  W -= fltk3::box_dw(B) + 2;
+  H -= fltk3::box_dh(B) + 2;
+
+  for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fltk3::point(X + xx, Y);
+  for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fltk3::point(X + W, Y + yy);
+  for (xx = W; xx > 0; xx --, i ++) if (i & 1) fltk3::point(X + xx, Y + H);
+  for (yy = H; yy > 0; yy --, i ++) if (i & 1) fltk3::point(X, Y + yy);
+#else
+# error unsupported platform
+#endif // WIN32
+}
+
+
+void fltk3::Widget::activate() {
+  if (!active()) {
+    clear_flag(INACTIVE);
+    if (active_r()) {
+      redraw();
+      redraw_label();
+      handle(fltk3::ACTIVATE);
+      if (inside(fltk3::focus())) fltk3::focus()->take_focus();
+    }
+  }
+}
+
+void fltk3::Widget::deactivate() {
+  if (active_r()) {
+    set_flag(INACTIVE);
+    redraw();
+    redraw_label();
+    handle(fltk3::DEACTIVATE);
+    fl_throw_focus(this);
+  } else {
+    set_flag(INACTIVE);
+  }
+}
+
+int fltk3::Widget::active_r() const {
+  for (const fltk3::Widget* o = this; o; o = o->parent())
+    if (!o->active()) return 0;
+  return 1;
+}
+
+void fltk3::Widget::show() {
+  if (!visible()) {
+    clear_flag(INVISIBLE);
+    if (visible_r()) {
+      redraw();
+      redraw_label();
+      handle(fltk3::SHOW);
+      if (inside(fltk3::focus())) fltk3::focus()->take_focus();
+    }
+  }
+}
+
+void fltk3::Widget::hide() {
+  if (visible_r()) {
+    set_flag(INVISIBLE);
+    for (fltk3::Widget *p = parent(); p; p = p->parent())
+      if (p->box() || !p->parent()) {p->redraw(); break;}
+    handle(fltk3::HIDE);
+    fl_throw_focus(this);
+  } else {
+    set_flag(INVISIBLE);
+  }
+}
+
+int fltk3::Widget::visible_r() const {
+  for (const fltk3::Widget* o = this; o; o = o->parent())
+    if (!o->visible()) return 0;
+  return 1;
+}
+
+// return true if widget is inside (or equal to) this:
+// Returns false for null widgets.
+int fltk3::Widget::contains(const fltk3::Widget *o) const {
+  for (; o; o = o->parent_) if (o == this) return 1;
+  return 0;
+}
+
+
+void
+fltk3::Widget::label(const char *a) {
+  if (flags() & COPIED_LABEL) {
+    // reassigning a copied label remains the same copied label
+    if (label_.value == a)
+      return;
+    free((void *)(label_.value));
+    clear_flag(COPIED_LABEL);
+  }
+  label_.value=a;
+  redraw_label();
+}
+
+
+void
+fltk3::Widget::copy_label(const char *a) {
+  if (flags() & COPIED_LABEL) free((void *)(label_.value));
+  if (a) {
+    set_flag(COPIED_LABEL);
+    label_.value=strdup(a);
+  } else {
+    clear_flag(COPIED_LABEL);
+    label_.value=(char *)0;
+  }
+  redraw_label();
+}
+
+/** Calls the widget callback.
+
+  Causes a widget to invoke its callback function with arbitrary arguments.
+
+  \param[in] o call the callback with \p o as the widget argument
+  \param[in] arg use \p arg as the user data argument
+  \see callback()
+*/
+void
+fltk3::Widget::do_callback(fltk3::Widget* o,void* arg) {
+  fltk3::WidgetTracker wp(this);
+  if (o && o->pWrapper && o->callback_!=default_callback) {
+    callback_((fltk3::Widget*)o->pWrapper, arg);
+  } else {
+    callback_(o,arg);
+  }
+  if (wp.deleted()) return;
+  if (callback_ != default_callback)
+    clear_changed();
+}
+
+/** Draw a box.
+ */
+void fltk3::Widget::draw() {
+  draw_box();
+  draw_label();
+}
+
+
+// ========================= Wrapper Support ===================================
+
+fltk3::Object::~Object() {
+  if ( pWrapper && !(pWrapper->pVCalls&Wrapper::pVCallDtor) ) {
+    pWrapper->pVCalls |= Wrapper::pVCallDtor;
+    delete pWrapper;
+  }
+}
+
+fltk3::Wrapper::~Wrapper() {
+  if ( !(pVCalls&pVCallDtor) ) {
+    pVCalls |= pVCallDtor;
+    delete _p;
+  }
+}
+
+
+// ========================= Rectangle Support ===================================
+
+/*! \class fltk3::Rectangle
+  Describes an integer-sized rectangle. This is the base class of
+  Widget, and also used a lot to pass rectangular areas to drawing
+  functions. Almost all the functions are inline.
+
+  Negative w() or h() is supposed to mean an empty and thus
+  invisible rectangle, but some code will treat the rectangle as
+  reflected about x or y. Set the size to zero to make sure you
+  have an empty one.
+*/
+
+/*! \fn Rectangle::Rectangle()
+  The default constructor does not put anything into the fields!
+  You can either call set() or just modify the x_, y_, w_, and h_
+  variables directly.
+*/
+
+/** Initialize to the size w,h. The rectangle is placed inside the
+    source rectangle \a r either centered or against an edge depending
+    on the ALIGN values in \a flags. For centered alignment if the
+    difference in sizes is odd, it always rounds up and left.
+    Default value for \a flags is to center in both directions.
+ */
+void fltk3::Rectangle::set(const fltk3::Rectangle& r, int w, int h, int flags) {
+  if (flags & ALIGN_LEFT) {
+    if (flags & ALIGN_RIGHT &&  w > r.w()) x_ = r.r()-w;
+    else x_ = r.x();
+  } else if (flags & ALIGN_RIGHT) {
+    x_ = r.r()-w;
+  } else {
+    x_ = r.x()+((r.w()-w)>>1);
+    // fabien: shouldn't it  consider the case r is smaller to avoid negative values ?
+    // WAS: no, it is supposed to center at all times. The right-shift
+    // instead of divide-by-2 is to avoid shifting as it goes negative.
+    // fabien : well while debugging i observed the shift doesn't avoid
+    //    to get negative value at least on Win32
+    // WAS: no, it is *supposed* to return a negative value! I want the
+    // rectangle "centered" even if it is *bigger*.
+    // if (x_<0) x_=0;
+  }
+  if (flags & ALIGN_TOP) {
+    if (flags & ALIGN_BOTTOM && h > r.h()) y_ = r.b()-h;
+    else y_ = r.y();
+  } else if (flags & ALIGN_BOTTOM) {
+    y_ = r.b()-h;
+  } else {
+    y_ = r.y()+((r.h()-h)>>1);
+    // see above
+    // if (y_<0) y_=0;
+  }
+  w_ = w;
+  h_ = h;
+}
+
+/**
+  Replace the value with the union of this rectangle and \a R
+  (ie the rectangle that surrounds both of these rectangles).
+  If one rectangle is empty(), the other is returned unchanged
+  (ie it does not union in the degenerate point of that rectangle).
+*/
+void fltk3::Rectangle::merge(const fltk3::Rectangle& R) {
+  if (R.empty()) return;
+  if (empty()) {*this = R; return;}
+  if (R.x() < x()) set_x(R.x());
+  if (R.r() > r()) set_r(R.r());
+  if (R.y() < y()) set_y(R.y());
+  if (R.b() > b()) set_b(R.b());
+}
+
+/**
+  Replace the value with the intersection of this rectangle and \a R.
+  If the rectangles do not intersect, the result may have negative
+  width and/or height, this means empty() will return true, but some
+  code may still draw this rectangle.
+*/
+void fltk3::Rectangle::intersect(const fltk3::Rectangle& R) {
+  if (R.x() > x()) set_x(R.x());
+  if (R.r() < r()) set_r(R.r());
+  if (R.y() > y()) set_y(R.y());
+  if (R.b() < b()) set_b(R.b());
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Window.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Window.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Window.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Window.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,326 @@
+//
+// "$Id$"
+//
+// Window widget class for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// The fltk3::Window is a window in the fltk library.
+// This is the system-independent portions.  The huge amount of 
+// crap you need to do to communicate with X is in Fl_x.cxx, the
+// equivalent (but totally different) crap for MSWindows is in Fl_win32.cxx
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/Window.h>
+#include <fltk3/Wrapper.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+#ifdef __APPLE_QUARTZ__
+#include <fltk3/draw.h>
+#endif
+
+char *fltk3::Window::default_xclass_ = 0L;
+
+void fltk3::Window::_Fl_Window() {
+  type(fltk3::WINDOW);
+  box(fltk3::FLAT_BOX);
+  if (fltk3::scheme_bg_) {
+    labeltype(fltk3::NORMAL_LABEL);
+    align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+    image(fltk3::scheme_bg_);
+  } else {
+    labeltype(fltk3::NO_LABEL);
+  }
+  i = 0;
+  xclass_ = 0;
+  icon_ = 0;
+  iconlabel_ = 0;
+  resizable(0);
+  size_range_set = 0;
+  minw = maxw = minh = maxh = 0;
+  callback((fltk3::Callback*)default_callback);
+}
+
+fltk3::Window::Window(int X,int Y,int W, int H, const char *l)
+: fltk3::Group(X, Y, W, H, l) {
+  cursor_default = fltk3::CURSOR_DEFAULT;
+  cursor_fg      = fltk3::BLACK;
+  cursor_bg      = fltk3::WHITE;
+
+  _Fl_Window();
+  set_flag(FORCE_POSITION);
+}
+
+fltk3::Window::Window(int W, int H, const char *l)
+// fix common user error of a missing end() with current(0):
+  : fltk3::Group((fltk3::Group::current(0),0), 0, W, H, l) {
+  cursor_default = fltk3::CURSOR_DEFAULT;
+  cursor_fg      = fltk3::BLACK;
+  cursor_bg      = fltk3::WHITE;
+
+  _Fl_Window();
+  clear_visible();
+}
+
+fltk3::Window *fltk3::Widget::window() const {
+  for (fltk3::Widget *o = parent(); o; o = o->parent())
+    if (o->type() >= fltk3::WINDOW) return (fltk3::Window*)o;
+  return 0;
+}
+/** Gets the x position of the window on the screen */
+int fltk3::Window::x_root() const {
+  fltk3::Window *p = window();
+  if (p) return p->x_root() + x();
+  return x();
+}
+/** Gets the y position of the window on the screen */
+int fltk3::Window::y_root() const {
+  fltk3::Window *p = window();
+  if (p) return p->y_root() + y();
+  return y();
+}
+
+void fltk3::Window::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+
+  // The following is similar to fltk3::Group::draw(), but ...
+  //  - we draw the box with x=0 and y=0 instead of x() and y()
+  //  - we don't draw a label
+
+  if (damage() & ~fltk3::DAMAGE_CHILD) {	 // draw the entire thing
+    draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
+  }
+  draw_children();
+
+#ifdef __APPLE_QUARTZ__
+  // on OS X, windows have no frame. To resize a window, we drag the lower right
+  // corner. This code draws a little ribbed triangle for dragging.
+  // Starting with 10.7, OS X windows have a hidden frame and the corner is no longer needed
+  static signed char showCorner = -1;
+  if (showCorner==-1) {
+    SInt32 majorVersion, minorVersion;
+    Gestalt(gestaltSystemVersionMajor, &majorVersion);
+    Gestalt(gestaltSystemVersionMinor, &minorVersion);
+    showCorner = 1;
+    if (majorVersion>10 || (majorVersion==10 && minorVersion>=7)) {
+      showCorner = 0;
+    }
+  }
+  if (showCorner==1) {
+    extern CGContextRef fl_gc;
+    if (fl_gc && !parent() && resizable() && (!size_range_set || minh!=maxh || minw!=maxw)) {
+      int dx = fltk3::box_dw(box())-fltk3::box_dx(box());
+      int dy = fltk3::box_dh(box())-fltk3::box_dy(box());
+      if (dx<=0) dx = 1;
+      if (dy<=0) dy = 1;
+      int x1 = w()-dx-1, x2 = x1, y1 = h()-dx-1, y2 = y1;
+      fltk3::Color c[4] = {
+        color(),
+        fltk3::color_average(color(), fltk3::WHITE, 0.7f),
+        fltk3::color_average(color(), fltk3::BLACK, 0.6f),
+        fltk3::color_average(color(), fltk3::BLACK, 0.8f),
+      };
+      int i;
+      for (i=dx; i<12; i++) {
+        fltk3::color(c[i&3]);
+        fltk3::line(x1--, y1, x2, y2--);
+      }
+    }
+  }
+#endif
+
+# if defined(FLTK_USE_CAIRO)
+  fltk3::cairo_make_current(this); // checkout if an update is necessary
+# endif
+}
+
+void fltk3::Window::label(const char *name) {
+  label(name, iconlabel());
+}
+
+void fltk3::Window::copy_label(const char *a) {
+  if (flags() & COPIED_LABEL) {
+    free((void *)label());
+    clear_flag(COPIED_LABEL);
+  }
+  if (a) a = strdup(a);
+  label(a, iconlabel());
+  set_flag(COPIED_LABEL);
+}
+
+
+void fltk3::Window::iconlabel(const char *iname) {
+  label(label(), iname);
+}
+
+// the fltk3::atclose pointer is provided for back compatibility.  You
+// can now just change the callback for the window instead.
+
+/** Default callback for window widgets. It hides the window and then calls the default widget callback. */
+void fltk3::default_atclose(fltk3::Window* window, void* v) {
+  window->hide();
+  fltk3::Widget::default_callback(window, v); // put on fltk3::read_queue()
+}
+/** Back compatibility: default window callback handler \see fltk3::set_atclose() */
+namespace fltk3 {
+	void (*atclose)(fltk3::Window*, void*) = default_atclose;
+}
+/** Back compatibility: Sets the default callback v for win to call on close event */
+void fltk3::Window::default_callback(fltk3::Window* win, void* v) {
+  fltk3::atclose(win, v);
+}
+
+/**  Returns the last window that was made current. \see fltk3::Window::make_current() */
+fltk3::Window *fltk3::Window::current() {
+  return current_;
+}
+
+/** Returns the default xclass.
+
+  \see fltk3::Window::default_xclass(const char *)
+
+ */
+const char *fltk3::Window::default_xclass()
+{
+  if (default_xclass_) {
+    return default_xclass_;
+  } else {
+    return "FLTK";
+  }
+}
+
+/** Sets the default window xclass.
+
+  The default xclass is used for all windows that don't have their
+  own xclass set before show() is called. You can change the default
+  xclass whenever you want, but this only affects windows that are
+  created (and shown) after this call.
+
+  The given string \p xc is copied. You can use a local variable or
+  free the string immediately after this call.
+
+  If you don't call this, the default xclass for all windows will be "FLTK".
+  You can reset the default xclass by specifying NULL for \p xc.
+
+  If you call fltk3::Window::xclass(const char *) for any window, then
+  this also sets the default xclass, unless it has been set before.
+
+  \param[in] xc default xclass for all windows subsequently created
+
+  \see fltk3::Window::xclass(const char *)
+*/
+void fltk3::Window::default_xclass(const char *xc)
+{
+  if (default_xclass_) {
+    free(default_xclass_);
+    default_xclass_ = 0L;
+  }
+  if (xc) {
+    default_xclass_ = strdup(xc);
+  }
+}
+
+/** Sets the xclass for this window.
+
+  A string used to tell the system what type of window this is. Mostly
+  this identifies the picture to draw in the icon. This only works if
+  called \e before calling show().
+
+  <I>Under X</I>, this is turned into a XA_WM_CLASS pair by truncating at
+  the first non-alphanumeric character and capitalizing the first character,
+  and the second one if the first is 'x'.  Thus "foo" turns into "foo, Foo",
+  and "xprog.1" turns into "xprog, XProg".
+
+  <I>Under Microsoft Windows</I>, this string is used as the name of the
+  WNDCLASS structure, though it is not clear if this can have any
+  visible effect.
+
+  \since FLTK 1.3 the passed string is copied. You can use a local
+  variable or free the string immediately after this call. Note that
+  FLTK 1.1 stores the \e pointer without copying the string.
+
+  If the default xclass has not yet been set, this also sets the
+  default xclass for all windows created subsequently.
+
+  \see fltk3::Window::default_xclass(const char *)
+*/
+void fltk3::Window::xclass(const char *xc) 
+{
+  if (xclass_) {
+    free(xclass_);
+    xclass_ = 0L;
+  }
+  if (xc) {
+    xclass_ = strdup(xc);
+    if (!default_xclass_) {
+      default_xclass(xc);
+    }
+  }
+}
+
+/** Returns the xclass for this window, or a default.
+
+  \see fltk3::Window::default_xclass(const char *)
+  \see fltk3::Window::xclass(const char *)
+*/
+const char *fltk3::Window::xclass() const
+{
+  if (xclass_) {
+    return xclass_;
+  } else {
+    return default_xclass();
+  }
+}
+
+/** Gets the current icon window target dependent data. */
+const void *fltk3::Window::icon() const {
+  return icon_;
+}
+
+/** Sets the current icon window target dependent data. */
+void fltk3::Window::icon(const void * ic) {
+  icon_ = ic;
+}
+
+
+// =================== FLTK 1 compatibility ====================================
+
+class Fl_Widget;
+class Fl_Window;
+class Fl_Group;
+
+namespace fltk3 {
+  void *_wrapper(Widget *w) { return w->wrapper(); }
+  void *_wrapper(Window *w) { return w->wrapper(); }
+  void *_wrapper(Group *w)  { return w->wrapper(); }
+  void *_object(Fl_Widget *w) { return ((Wrapper*)w)->_p; }
+  void *_object(Fl_Window *w) { return ((Wrapper*)w)->_p; }
+  void *_object(Fl_Group *w) { return ((Wrapper*)w)->_p; }
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Window_fullscreen.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Window_fullscreen.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Window_fullscreen.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Window_fullscreen.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,98 @@
+//
+// "$Id$"
+//
+// Fullscreen window support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Turning the border on/off by changing the motif_wm_hints property
+// works on Irix 4DWM.  Does not appear to work for any other window
+// manager.  Fullscreen still works on some window managers (fvwm is one)
+// because they allow the border to be placed off-screen.
+
+// Unfortunately most X window managers ignore changes to the border
+// and refuse to position the border off-screen, so attempting to make
+// the window full screen will lose the size of the border off the
+// bottom and right.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+#include <config.h>
+
+void fltk3::Window::border(int b) {
+  if (b) {
+    if (border()) return;
+    clear_flag(NOBORDER);
+  } else {
+    if (!border()) return;
+    set_flag(NOBORDER);
+  }
+#if defined(USE_X11)
+  if (shown()) Fl_X::i(this)->sendxjunk();
+#elif defined(WIN32)
+  // not yet implemented, but it's possible
+  // for full fullscreen we have to make the window topmost as well
+#elif defined(__APPLE_QUARTZ__)
+  // warning: not implemented in Quartz/Carbon
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::Window::fullscreen() {
+#ifndef WIN32
+  //this would clobber the fake wm, since it relies on the border flags to
+  //determine its thickness
+  border(0);
+#endif
+#if defined(__APPLE__) || defined(WIN32) || defined(USE_X11)
+  int sx, sy, sw, sh;
+  fltk3::screen_xywh(sx, sy, sw, sh, x(), y(), w(), h());
+  // if we are on the main screen, we will leave the system menu bar unobstructed
+  if (fltk3::x()>=sx && fltk3::y()>=sy && fltk3::x()+fltk3::w()<=sx+sw && fltk3::y()+fltk3::h()<=sy+sh) {
+    sx = fltk3::x(); sy = fltk3::y(); 
+    sw = fltk3::w(); sh = fltk3::h();
+  }
+  if (x()==sx) x(sx+1); // make sure that we actually execute the resize
+#if defined(USE_X11)
+  resize(0, 0, w(), h()); // work around some quirks in X11
+#endif
+  resize(sx, sy, sw, sh);
+#else
+  if (!x()) x(1); // make sure that we actually execute the resize
+  resize(0,0,fltk3::w(),fltk3::h());
+#endif
+}
+
+void fltk3::Window::fullscreen_off(int X,int Y,int W,int H) {
+  // this order produces less blinking on IRIX:
+  resize(X,Y,W,H);
+#ifndef WIN32
+  border(1);
+#endif
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Window_hotspot.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Window_hotspot.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Window_hotspot.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Window_hotspot.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,100 @@
+//
+// "$Id$"
+//
+// Common hotspot routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Window.h>
+#include <fltk3/x.h>
+#include <stdio.h>
+
+void fltk3::Window::hotspot(int X, int Y, int offscreen) {
+  int mx,my;
+
+  // Update the screen position based on the mouse position.
+  fltk3::get_mouse(mx,my);
+  X = mx-X; Y = my-Y;
+
+  // If offscreen is 0 (the default), make sure that the window
+  // stays on the screen, if possible.
+  if (!offscreen) {
+    int scr_x, scr_y, scr_w, scr_h;
+    fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+
+    int top = 0;
+    int left = 0;
+    int right = 0;
+    int bottom = 0;
+
+    if (border()) {
+#ifdef WIN32
+      if (size_range_set && (maxw != minw || maxh != minh)) {
+        left = right = GetSystemMetrics(SM_CXSIZEFRAME);
+        top = bottom = GetSystemMetrics(SM_CYSIZEFRAME);
+      } else {
+        left = right = GetSystemMetrics(SM_CXFIXEDFRAME); 
+        top = bottom = GetSystemMetrics(SM_CYFIXEDFRAME);
+      }
+      top += GetSystemMetrics(SM_CYCAPTION);
+#elif defined(__APPLE__)
+      top = 24;
+      left = 2;
+      right = 2;
+      bottom = 2;
+#else
+      // Ensure border is on screen; these values are generic enough
+      // to work with many window managers, and are based on KDE defaults.
+      top = 20;
+      left = 4;
+      right = 4;
+      bottom = 8;
+#endif
+    }
+    // now insure contents are on-screen (more important than border):
+    if (X+w()+right > scr_w-scr_x) X = scr_w-scr_x-right-w();
+    if (X-left < scr_x) X = left;
+    if (Y+h()+bottom > scr_h-scr_y) Y = scr_h-scr_y-bottom-h();
+    if (Y-top < scr_y) Y = top;
+    // make sure that we will force this position
+    if (X==x()) x(X-1);
+  }
+
+  position(X,Y);
+}
+
+void fltk3::Window::hotspot(const fltk3::Widget *o, int offscreen) {
+  int X = o->w()/2;
+  int Y = o->h()/2;
+  while (o != this && o) {
+    X += o->x(); Y += o->y();
+    o = o->window();
+  }
+  hotspot(X,Y,offscreen);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Window_iconize.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Window_iconize.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Window_iconize.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Window_iconize.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,49 @@
+//
+// "$Id$"
+//
+// Window minification code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/x.h>
+
+extern char fl_show_iconic; // in Fl_x.cxx
+
+void fltk3::Window::iconize() {
+  if (!shown()) {
+    fl_show_iconic = 1;
+    show();
+  } else {
+#ifdef WIN32
+    ShowWindow(i->xid, SW_SHOWMINNOACTIVE);
+#elif defined(__APPLE__)
+    i->collapse();
+#else
+    XIconifyWindow(fl_display, i->xid, fl_screen);
+#endif
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/Wizard.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Wizard.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/Wizard.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/Wizard.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,197 @@
+//
+// "$Id$"
+//
+// fltk3::WizardGroup widget routines.
+//
+// Copyright 1997-2010 by Easy Software Products.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+
+//
+//   fltk3::WizardGroup::fltk3::WizardGroup() - Create an fltk3::WizardGroup widget.
+//   fltk3::WizardGroup::draw()      - Draw the wizard border and visible child.
+//   fltk3::WizardGroup::next()      - Show the next child.
+//   fltk3::WizardGroup::prev()      - Show the previous child.
+//   fltk3::WizardGroup::value()     - Return the current visible child.
+//   fltk3::WizardGroup::value()     - Set the visible child.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/WizardGroup.h>
+#include <fltk3/Window.h>
+#include <fltk3/draw.h>
+
+
+//
+// 'fltk3::WizardGroup::fltk3::WizardGroup()' - Create an fltk3::WizardGroup widget.
+//
+
+/**
+  The constructor creates the fltk3::WizardGroup widget at the specified
+  position and size.
+  <P>The inherited destructor destroys the widget and its children.
+*/
+fltk3::WizardGroup::WizardGroup(int        xx,	// I - Lefthand position
+                     int        yy,	// I - Upper position
+		     int        ww,	// I - Width
+		     int        hh,	// I - Height
+		     const char *l) :	// I - Label
+    fltk3::Group(xx, yy, ww, hh, l)
+{
+  box(fltk3::THIN_UP_BOX);
+
+  value_ = (fltk3::Widget *)0;
+}
+
+
+//
+/** Draws the wizard border and visible child. */
+void fltk3::WizardGroup::draw() {
+  FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+
+  fltk3::Widget	*kid;	// Visible child
+
+
+  kid = value();
+
+  if (damage() & fltk3::DAMAGE_ALL)
+  {
+    // Redraw everything...
+    if (kid)
+    {
+      draw_box(box(), x(), y(), w(), h(), kid->color());
+      draw_child(*kid);
+    }
+    else
+      draw_box(box(), x(), y(), w(), h(), color());
+
+  }
+  else if (kid)
+    update_child(*kid);
+}
+
+
+/**
+  This method shows the next child of the wizard. If the last child
+  is already visible, this function does nothing.
+*/
+void fltk3::WizardGroup::next() {
+  int			num_kids;
+  fltk3::Widget	* const *kids;
+
+
+  if ((num_kids = children()) == 0)
+    return;
+
+  for (kids = array(); num_kids > 0; kids ++, num_kids --)
+    if ((*kids)->visible())
+      break;
+
+  if (num_kids > 1)
+    value(kids[1]);
+}
+
+/** Shows the previous child.*/
+void fltk3::WizardGroup::prev()
+{
+  int			num_kids;
+  fltk3::Widget	* const *kids;
+
+
+  if ((num_kids = children()) == 0)
+    return;
+
+  for (kids = array(); num_kids > 0; kids ++, num_kids --)
+    if ((*kids)->visible())
+      break;
+
+  if (num_kids > 0 && num_kids < children())
+    value(kids[-1]);
+}
+
+/**  Gets the current visible child widget. */
+fltk3::Widget* fltk3::WizardGroup::value()
+{
+  int			num_kids;
+  fltk3::Widget	* const *kids;
+  fltk3::Widget		*kid;
+
+
+  if ((num_kids = children()) == 0)
+    return ((fltk3::Widget *)0);
+
+  for (kids = array(), kid = (fltk3::Widget *)0; num_kids > 0; kids ++, num_kids --)
+  {
+    if ((*kids)->visible())
+    {
+      if (kid)
+        (*kids)->hide();
+      else
+        kid = *kids;
+    }
+  }
+
+  if (!kid)
+  {
+    kids --;
+    kid = *kids;
+    kid->show();
+  }
+
+  return (kid);
+}
+
+/**  Sets the child widget that is visible.*/
+void fltk3::WizardGroup::value(fltk3::Widget *kid)
+{
+  int			num_kids;
+  fltk3::Widget	* const *kids;
+
+
+  if ((num_kids = children()) == 0)
+    return;
+
+  for (kids = array(); num_kids > 0; kids ++, num_kids --)
+  {
+    if (*kids == kid)
+    {
+      if (!kid->visible())
+        kid->show();
+    }
+    else
+      (*kids)->hide();
+  }
+
+  // This will restore the mouse pointer to the window's default cursor
+  // whenever the wizard pane is changed.  Otherwise text widgets that
+  // show the next pane may leave the cursor set to the I beam, etc...
+  if (window()) window()->cursor(fltk3::CURSOR_DEFAULT);
+}
+
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/XBMImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_XBM_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/XBMImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/XBMImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,112 @@
+//
+// "$Id$"
+//
+// fltk3::XBMImage routines.
+//
+// Copyright 1997-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::XBMImage::fltk3::XBMImage() - Load an XBM file.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3/XBMImage.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+
+//
+// 'fltk3::XBMImage::fltk3::XBMImage()' - Load an XBM file.
+//
+
+/**  
+  The constructor loads the named XBM file from the given name filename.
+  <P>The destructor free all memory and server resources that are used by 
+  the image.
+*/
+fltk3::XBMImage::XBMImage(const char *name) : fltk3::Bitmap((const char *)0,0,0) {
+  FILE	*f;
+  uchar	*ptr;
+
+  if ((f = fltk3::fopen(name, "rb")) == NULL) return;
+
+  char buffer[1024];
+  char junk[1024];
+  int wh[2]; // width and height
+  int i;
+  for (i = 0; i<2; i++) {
+    for (;;) {
+      if (!fgets(buffer,1024,f)) {
+        fclose(f);
+	return;
+      }
+      int r = sscanf(buffer,"#define %s %d",junk,&wh[i]);
+      if (r >= 2) break;
+    }
+  }
+
+  // skip to data array:
+  for (;;) {
+    if (!fgets(buffer,1024,f)) {
+      fclose(f);
+      return;
+    }
+    if (!strncmp(buffer,"static ",7)) break;
+  }
+
+  // Allocate memory...
+  w(wh[0]);
+  h(wh[1]);
+
+  int n = ((wh[0]+7)/8)*wh[1];
+  array = new uchar[n];
+
+  // read the data:
+  for (i = 0, ptr = (uchar *)array; i < n;) {
+    if (!fgets(buffer,1024,f)) {
+      fclose(f);
+      return;
+    }
+    const char *a = buffer;
+    while (*a && i<n) {
+      unsigned int t;
+      if (sscanf(a," 0x%x",&t)>0) {
+        *ptr++ = (uchar)t;
+	i ++;
+      }
+      while (*a && *a++ != ',');
+    }
+  }
+
+  fclose(f);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/XPMImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_XPM_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/XPMImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/XPMImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,136 @@
+//
+// "$Id$"
+//
+// fltk3::XPMImage routines.
+//
+// Copyright 1997-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3/XPMImage.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+
+
+//
+// 'hexdigit()' - Convert a hex digit to an integer.
+//
+
+static int hexdigit(int x) {	// I - Hex digit...
+  if (isdigit(x)) return x-'0';
+  if (isupper(x)) return x-'A'+10;
+  if (islower(x)) return x-'a'+10;
+  return 20;
+}
+
+#define MAXSIZE 2048
+#define INITIALLINES 256
+/**
+  The constructor loads the XPM image from the name filename.
+  <P>The destructor free all memory and server resources that are used by
+  the image.
+*/
+fltk3::XPMImage::XPMImage(const char *name) : fltk3::Pixmap((char *const*)0) {
+  FILE *f;
+
+  if ((f = fltk3::fopen(name, "rb")) == NULL) return;
+
+  // read all the c-strings out of the file:
+  char** new_data = new char *[INITIALLINES];
+  char** temp_data;
+  int malloc_size = INITIALLINES;
+  char buffer[MAXSIZE+20];
+  int i = 0;
+  while (fgets(buffer,MAXSIZE+20,f)) {
+    if (buffer[0] != '\"') continue;
+    char *myp = buffer;
+    char *q = buffer+1;
+    while (*q != '\"' && myp < buffer+MAXSIZE) {
+      if (*q == '\\') switch (*++q) {
+      case '\r':
+      case '\n':
+	if (!fgets(q,(buffer+MAXSIZE+20)-q,f)) { /* no problem if we hit EOF */ } break;
+      case 0:
+	break;
+      case 'x': {
+	q++;
+	int n = 0;
+	for (int x = 0; x < 3; x++) {
+	  int xd = hexdigit(*q);
+	  if (xd > 15) break;
+	  n = (n<<4)+xd;
+	  q++;
+	}
+	*myp++ = n;
+      } break;
+      default: {
+	int c = *q++;
+	if (c>='0' && c<='7') {
+	  c -= '0';
+	  for (int x=0; x<2; x++) {
+	    int xd = hexdigit(*q);
+	    if (xd>7) break;
+	    c = (c<<3)+xd;
+	    q++;
+	  }
+	}
+	*myp++ = c;
+      } break;
+      } else {
+	*myp++ = *q++;
+      }
+    }
+    *myp++ = 0;
+    if (i >= malloc_size) {
+      temp_data = new char *[malloc_size + INITIALLINES];
+      memcpy(temp_data, new_data, sizeof(char *) * malloc_size);
+      delete[] new_data;
+      new_data = temp_data;
+      malloc_size += INITIALLINES;
+    }
+    new_data[i] = new char[myp-buffer+1];
+    memcpy(new_data[i], buffer,myp-buffer);
+    new_data[i][myp-buffer] = 0;
+    i++;
+  }
+
+  fclose(f);
+
+  data((const char **)new_data, i);
+  alloc_data = 1;
+
+  measure();
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/abort.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_abort.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/abort.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/abort.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,102 @@
+//
+// "$Id$"
+//
+// Warning/error message code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This method is in its own source file so that stdlib and stdio
+// do not need to be included in Fl.cxx:
+// You can also override this by redefining all of these.
+
+#include <fltk3/run.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include "flstring.h"
+
+#ifdef WIN32
+#  include <windows.h>
+
+static void warning(const char *, ...) {
+  // Show nothing for warnings under WIN32...
+}
+
+static void error(const char *format, ...) {
+  va_list args;
+  char buf[1024];
+  va_start(args, format);
+  vsnprintf(buf, 1024, format, args);
+  va_end(args);
+  MessageBox(0,buf,"Error",MB_ICONEXCLAMATION|MB_SYSTEMMODAL);
+}
+
+static void fatal(const char *format, ...) {
+  va_list args;
+  char buf[1024];
+  va_start(args, format);
+  vsnprintf(buf, 1024, format, args);
+  va_end(args);
+  MessageBox(0,buf,"Error",MB_ICONSTOP|MB_SYSTEMMODAL);
+  ::exit(1);
+}
+
+#else
+
+static void warning(const char *format, ...) {
+  va_list args;
+  va_start(args, format);
+  vfprintf(stderr, format, args);
+  va_end(args);
+  fputc('\n', stderr);
+  fflush(stderr);
+}
+
+static void error(const char *format, ...) {
+  va_list args;
+  va_start(args, format);
+  vfprintf(stderr, format, args);
+  va_end(args);
+  fputc('\n', stderr);
+  fflush(stderr);
+}
+
+static void fatal(const char *format, ...) {
+  va_list args;
+  va_start(args, format);
+  vfprintf(stderr, format, args);
+  va_end(args);
+  fputc('\n', stderr);
+  fflush(stderr);
+  ::exit(1);
+}
+
+#endif
+
+void (*fltk3::warning)(const char* format, ...) = ::warning;
+void (*fltk3::error)(const char* format, ...) = ::error;
+void (*fltk3::fatal)(const char* format, ...) = ::fatal;
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/add_idle.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_add_idle.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/add_idle.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/add_idle.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,123 @@
+//
+// "$Id$"
+//
+// Idle routine support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Allows you to manage an arbitrary set of idle() callbacks.
+// Replaces the older set_idle() call (which is used to implement this)
+
+#include <fltk3/run.h>
+
+struct idle_cb {
+  void (*cb)(void*);
+  void* data;
+  idle_cb *next;
+};
+
+// the callbacks are stored linked in a ring.  last points at the one
+// just called, first at the next to call.  last->next == first.
+
+static idle_cb* first;
+static idle_cb* last;
+static idle_cb* freelist;
+
+static void call_idle() {
+  idle_cb* p = first;
+  last = p; first = p->next;
+  p->cb(p->data); // this may call add_idle() or remove_idle()!
+}
+
+/**
+  Adds a callback function that is called every time by fltk3::wait() and also
+  makes it act as though the timeout is zero (this makes fltk3::wait() return
+  immediately, so if it is in a loop it is called repeatedly, and thus the
+  idle fucntion is called repeatedly).  The idle function can be used to get
+  background processing done.
+    
+  You can have multiple idle callbacks. To remove an idle callback use
+  fltk3::remove_idle().
+    
+  fltk3::wait() and fltk3::check() call idle callbacks, but fltk3::ready() does not.
+    
+  The idle callback can call any FLTK functions, including fltk3::wait(),
+  fltk3::check(), and fltk3::ready().
+
+  FLTK will not recursively call the idle callback.
+*/
+void fltk3::add_idle(fltk3::IdleHandler cb, void* data) {
+  idle_cb* p = freelist;
+  if (p) freelist = p->next;
+  else p = new idle_cb;
+  p->cb = cb;
+  p->data = data;
+  if (first) {
+    last->next = p;
+    last = p;
+    p->next = first;
+  } else {
+    first = last = p;
+    p->next = p;
+    set_idle(call_idle);
+  }
+}
+
+/**
+  Returns true if the specified idle callback is currently installed.
+*/
+int fltk3::has_idle(fltk3::IdleHandler cb, void* data) {
+  idle_cb* p = first;
+  if (!p) return 0;
+  for (;; p = p->next) {
+    if (p->cb == cb && p->data == data) return 1;
+    if (p==last) return 0;
+  }
+}
+
+/**
+  Removes the specified idle callback, if it is installed.
+*/
+void fltk3::remove_idle(fltk3::IdleHandler cb, void* data) {
+  idle_cb* p = first;
+  if (!p) return;
+  idle_cb* l = last;
+  for (;; p = p->next) {
+    if (p->cb == cb && p->data == data) break;
+    if (p==last) return; // not found
+    l = p;
+  }
+  if (l == p) { // only one
+    first = last = 0;
+    set_idle(0);
+  } else {
+    last = l;
+    first = l->next = p->next;
+  }
+  p->next = freelist;
+  freelist = p;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/aimm.h (from rev 9002, branches/branch-3.0/src/core/aimm.h)
===================================================================
--- branches/branch-3.0/src/fltk3/aimm.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/aimm.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,431 @@
+//
+// "$Id$"
+//
+// Standard dialog header file for the UTF-8 Fast Light Tool Kit (FLTK-UTF8).
+//
+// Copyright 2009-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version
+// with exceptions that allow sub-classing and static linking in
+// non-LGPL compliant software. These exceptions are subject to
+// conditions, see the FLTK License for more details.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the FLTK
+// License for more details.
+//
+// You should have received a copy of the FLTK License along with
+// this library; if not, write to  OksiD Software, Jean-Marc Lienher,
+// Rue de la Cheminee 1, CH-2065 Savagnier, Switzerland.
+//
+// Please report all bugs and problems to "oksid@bluewin.ch".
+//
+
+#ifndef AIMM_H
+#  define AIMM_H
+//#  define HANDLE_PTR HANDLE* 
+//#  define DWORD_PTR DWORD*
+//#  define CLSCTX_INPROC_SERVER 0x1
+const GUID IID_IActiveIMMApp = { 0x8c0e040, 0x62d1, 0x11d1, {0x93, 0x26, 0x00, 0x60, 0xb0, 0x67, 0xb8, 0x6e}};
+const GUID CLSID_CActiveIMM = { 0x4955dd33, 0xb159, 0x11d0, {0x8f, 0xcf, 0x00, 0xaa, 0x00, 0x6b, 0xcc, 0x59}};
+/*
+	class IUnknown
+    {
+    public:
+        
+        virtual long __stdcall QueryInterface( 
+            const GUID & riid,
+            void **ppvObject) = 0;
+        
+        virtual ULONG __stdcall AddRef( void) = 0;
+        
+        virtual ULONG __stdcall Release( void) = 0;
+    };
+
+extern "C" __declspec(dllimport) long __stdcall CoInitialize(void far *pvReserved);
+extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID & rclsid, IUnknown * pUnkOuter,
+                    DWORD dwClsContext, const GUID & riid, LPVOID FAR* ppv);
+
+*/
+
+    class IActiveIMMApp : public IUnknown
+    {
+    public:
+        virtual long __stdcall AssociateContext( 
+             HWND hWnd,
+             HIMC hIME,
+             HIMC  *phPrev) = 0;
+        
+        virtual long __stdcall ConfigureIMEA( 
+             HKL hKL,
+             HWND hWnd,
+             DWORD dwMode,
+             void  *pData) = 0;
+        
+        virtual long __stdcall ConfigureIMEW( 
+             HKL hKL,
+             HWND hWnd,
+             DWORD dwMode,
+             void  *pData) = 0;
+        
+        virtual long __stdcall CreateContext( 
+             HIMC  *phIMC) = 0;
+        
+        virtual long __stdcall DestroyContext( 
+             HIMC hIME) = 0;
+        
+        virtual long __stdcall EnumRegisterWordA( 
+             HKL hKL,
+             LPSTR szReading,
+             DWORD dwStyle,
+             LPSTR szRegister,
+             LPVOID pData,
+             void  **pEnum) = 0;
+        
+        virtual long __stdcall EnumRegisterWordW( 
+             HKL hKL,
+             LPWSTR szReading,
+             DWORD dwStyle,
+             LPWSTR szRegister,
+             LPVOID pData,
+             void  **pEnum) = 0;
+        
+        virtual long __stdcall EscapeA( 
+             HKL hKL,
+             HIMC hIMC,
+             UINT uEscape,
+            /* [out][in] */ LPVOID pData,
+             LRESULT  *plResult) = 0;
+        
+        virtual long __stdcall EscapeW( 
+             HKL hKL,
+             HIMC hIMC,
+             UINT uEscape,
+            /* [out][in] */ LPVOID pData,
+             LRESULT  *plResult) = 0;
+        
+        virtual long __stdcall GetCandidateListA( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             UINT uBufLen,
+             void  *pCandList,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetCandidateListW( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             UINT uBufLen,
+             void  *pCandList,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetCandidateListCountA( 
+             HIMC hIMC,
+             DWORD  *pdwListSize,
+             DWORD  *pdwBufLen) = 0;
+        
+        virtual long __stdcall GetCandidateListCountW( 
+             HIMC hIMC,
+             DWORD  *pdwListSize,
+             DWORD  *pdwBufLen) = 0;
+        
+        virtual long __stdcall GetCandidateWindow( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             void  *pCandidate) = 0;
+        
+        virtual long __stdcall GetCompositionFontA( 
+             HIMC hIMC,
+             LOGFONTA  *plf) = 0;
+        
+        virtual long __stdcall GetCompositionFontW( 
+             HIMC hIMC,
+             LOGFONTW  *plf) = 0;
+        
+        virtual long __stdcall GetCompositionStringA( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             DWORD dwBufLen,
+             LONG  *plCopied,
+             LPVOID pBuf) = 0;
+        
+        virtual long __stdcall GetCompositionStringW( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             DWORD dwBufLen,
+             LONG  *plCopied,
+             LPVOID pBuf) = 0;
+        
+        virtual long __stdcall GetCompositionWindow( 
+             HIMC hIMC,
+             void  *pCompForm) = 0;
+        
+        virtual long __stdcall GetContext( 
+             HWND hWnd,
+             HIMC  *phIMC) = 0;
+        
+        virtual long __stdcall GetConversionListA( 
+             HKL hKL,
+             HIMC hIMC,
+             LPSTR pSrc,
+             UINT uBufLen,
+             UINT uFlag,
+             void  *pDst,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetConversionListW( 
+             HKL hKL,
+             HIMC hIMC,
+             LPWSTR pSrc,
+             UINT uBufLen,
+             UINT uFlag,
+             void  *pDst,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetConversionStatus( 
+             HIMC hIMC,
+             DWORD  *pfdwConversion,
+             DWORD  *pfdwSentence) = 0;
+        
+        virtual long __stdcall GetDefaultIMEWnd( 
+             HWND hWnd,
+             HWND  *phDefWnd) = 0;
+        
+        virtual long __stdcall GetDescriptionA( 
+             HKL hKL,
+             UINT uBufLen,
+             LPSTR szDescription,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetDescriptionW( 
+             HKL hKL,
+             UINT uBufLen,
+             LPWSTR szDescription,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetGuideLineA( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             DWORD dwBufLen,
+             LPSTR pBuf,
+             DWORD  *pdwResult) = 0;
+        
+        virtual long __stdcall GetGuideLineW( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             DWORD dwBufLen,
+             LPWSTR pBuf,
+             DWORD  *pdwResult) = 0;
+        
+        virtual long __stdcall GetIMEFileNameA( 
+             HKL hKL,
+             UINT uBufLen,
+             LPSTR szFileName,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetIMEFileNameW( 
+             HKL hKL,
+             UINT uBufLen,
+             LPWSTR szFileName,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetOpenStatus( 
+             HIMC hIMC) = 0;
+        
+        virtual long __stdcall GetProperty( 
+             HKL hKL,
+             DWORD fdwIndex,
+             DWORD  *pdwProperty) = 0;
+        
+        virtual long __stdcall GetRegisterWordStyleA( 
+             HKL hKL,
+             UINT nItem,
+             STYLEBUFA  *pStyleBuf,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetRegisterWordStyleW( 
+             HKL hKL,
+             UINT nItem,
+             STYLEBUFW  *pStyleBuf,
+             UINT  *puCopied) = 0;
+        
+        virtual long __stdcall GetStatusWindowPos( 
+             HIMC hIMC,
+             POINT  *pptPos) = 0;
+        
+        virtual long __stdcall GetVirtualKey( 
+             HWND hWnd,
+             UINT  *puVirtualKey) = 0;
+        
+        virtual long __stdcall InstallIMEA( 
+             LPSTR szIMEFileName,
+             LPSTR szLayoutText,
+             HKL  *phKL) = 0;
+        
+        virtual long __stdcall InstallIMEW( 
+             LPWSTR szIMEFileName,
+             LPWSTR szLayoutText,
+             HKL  *phKL) = 0;
+        
+        virtual long __stdcall IsIME( 
+             HKL hKL) = 0;
+        
+        virtual long __stdcall IsUIMessageA( 
+             HWND hWndIME,
+             UINT msg,
+             WPARAM wParam,
+             LPARAM lParam) = 0;
+        
+        virtual long __stdcall IsUIMessageW( 
+             HWND hWndIME,
+             UINT msg,
+             WPARAM wParam,
+             LPARAM lParam) = 0;
+        
+        virtual long __stdcall NotifyIME( 
+             HIMC hIMC,
+             DWORD dwAction,
+             DWORD dwIndex,
+             DWORD dwValue) = 0;
+        
+        virtual long __stdcall RegisterWordA( 
+             HKL hKL,
+             LPSTR szReading,
+             DWORD dwStyle,
+             LPSTR szRegister) = 0;
+        
+        virtual long __stdcall RegisterWordW( 
+             HKL hKL,
+             LPWSTR szReading,
+             DWORD dwStyle,
+             LPWSTR szRegister) = 0;
+        
+        virtual long __stdcall ReleaseContext( 
+             HWND hWnd,
+             HIMC hIMC) = 0;
+        
+        virtual long __stdcall SetCandidateWindow( 
+             HIMC hIMC,
+             void  *pCandidate) = 0;
+        
+        virtual long __stdcall SetCompositionFontA( 
+             HIMC hIMC,
+             LOGFONTA  *plf) = 0;
+        
+        virtual long __stdcall SetCompositionFontW( 
+             HIMC hIMC,
+             LOGFONTW  *plf) = 0;
+        
+        virtual long __stdcall SetCompositionStringA( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             LPVOID pComp,
+             DWORD dwCompLen,
+             LPVOID pRead,
+             DWORD dwReadLen) = 0;
+        
+        virtual long __stdcall SetCompositionStringW( 
+             HIMC hIMC,
+             DWORD dwIndex,
+             LPVOID pComp,
+             DWORD dwCompLen,
+             LPVOID pRead,
+             DWORD dwReadLen) = 0;
+        
+        virtual long __stdcall SetCompositionWindow( 
+             HIMC hIMC,
+             void  *pCompForm) = 0;
+        
+        virtual long __stdcall SetConversionStatus( 
+             HIMC hIMC,
+             DWORD fdwConversion,
+             DWORD fdwSentence) = 0;
+        
+        virtual long __stdcall SetOpenStatus( 
+             HIMC hIMC,
+             BOOL fOpen) = 0;
+        
+        virtual long __stdcall SetStatusWindowPos( 
+             HIMC hIMC,
+             POINT  *pptPos) = 0;
+        
+        virtual long __stdcall SimulateHotKey( 
+             HWND hWnd,
+             DWORD dwHotKeyID) = 0;
+        
+        virtual long __stdcall UnregisterWordA( 
+             HKL hKL,
+             LPSTR szReading,
+             DWORD dwStyle,
+             LPSTR szUnregister) = 0;
+        
+        virtual long __stdcall UnregisterWordW( 
+             HKL hKL,
+             LPWSTR szReading,
+             DWORD dwStyle,
+             LPWSTR szUnregister) = 0;
+        
+        virtual long __stdcall Activate( 
+             BOOL fRestoreLayout) = 0;
+        
+        virtual long __stdcall Deactivate( void) = 0;
+        
+        virtual long __stdcall OnDefWindowProc( 
+             HWND hWnd,
+             UINT Msg,
+             WPARAM wParam,
+             LPARAM lParam,
+             LRESULT  *plResult) = 0;
+        
+        virtual long __stdcall FilterClientWindows( 
+             ATOM  *aaClassList,
+             UINT uSize) = 0;
+        
+        virtual long __stdcall GetCodePageA( 
+             HKL hKL,
+             UINT  *uCodePage) = 0;
+        
+        virtual long __stdcall GetLangId( 
+             HKL hKL,
+             WORD  *plid) = 0;
+        
+        virtual long __stdcall AssociateContextEx( 
+             HWND hWnd,
+             HIMC hIMC,
+             DWORD dwFlags) = 0;
+        
+        virtual long __stdcall DisableIME( 
+             DWORD idThread) = 0;
+        
+        virtual long __stdcall GetImeMenuItemsA( 
+             HIMC hIMC,
+             DWORD dwFlags,
+             DWORD dwType,
+             void  *pImeParentMenu,
+             void  *pImeMenu,
+             DWORD dwSize,
+             DWORD  *pdwResult) = 0;
+        
+        virtual long __stdcall GetImeMenuItemsW( 
+             HIMC hIMC,
+             DWORD dwFlags,
+             DWORD dwType,
+             void  *pImeParentMenu,
+            void  *pImeMenu,
+             DWORD dwSize,
+             DWORD  *pdwResult) = 0;
+        
+        virtual long __stdcall EnumInputContext( 
+             DWORD idThread,
+             void  **ppEnum) = 0;
+        
+    };
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/allfiles.xbm (from rev 9002, branches/branch-3.0/src/core/allfiles.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/allfiles.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/allfiles.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define allfiles_width 16
+#define allfiles_height 16
+static unsigned char allfiles_bits[] = {
+   0xfc, 0x3f, 0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0x84, 0x21, 0xa4, 0x25,
+   0xc4, 0x23, 0xf4, 0x2f, 0xf4, 0x2f, 0xc4, 0x23, 0xa4, 0x25, 0x84, 0x21,
+   0x04, 0x20, 0x04, 0x20, 0x04, 0x20, 0xfc, 0x3f};

Copied: branches/branch-3.0/src/fltk3/arc.cxx (from rev 9002, branches/branch-3.0/src/core/fl_arc.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/arc.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/arc.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,91 @@
+//
+// "$Id$"
+//
+// Arc functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_arc.cxx
+  \brief Utility functions for drawing arcs and circles.
+*/
+
+// Utility for drawing arcs and circles.  They are added to
+// the current fl_begin/fltk3::vertex/fl_end path.
+// Incremental math implementation:
+
+#include <fltk3/draw.h>
+#include <fltk3/math.h>
+
+// avoid problems with some platforms that don't 
+// implement hypot.
+static double _fl_hypot(double x, double y) {
+  return sqrt(x*x + y*y);
+}
+
+void fltk3::GraphicsDriver::arc(double x, double y, double r, double start, double end) {
+
+  // draw start point accurately:
+  
+  double A = start*(M_PI/180);		// Initial angle (radians)
+  double X =  r*cos(A);			// Initial displacement, (X,Y)
+  double Y = -r*sin(A);			//   from center to initial point
+  fltk3::vertex(x+X,y+Y);			// Insert initial point
+
+  // Maximum arc length to approximate with chord with error <= 0.125
+  
+  double epsilon; {
+    double r1 = _fl_hypot(fltk3::transform_dx(r,0), // Horizontal "radius"
+		          fltk3::transform_dy(r,0));
+    double r2 = _fl_hypot(fltk3::transform_dx(0,r), // Vertical "radius"
+		          fltk3::transform_dy(0,r));
+		      
+    if (r1 > r2) r1 = r2;		// r1 = minimum "radius"
+    if (r1 < 2.) r1 = 2.;		// radius for circa 9 chords/circle
+    
+    epsilon = 2*acos(1.0 - 0.125/r1);	// Maximum arc angle
+  }
+  A = end*(M_PI/180) - A;		// Displacement angle (radians)
+  int i = int(ceil(fabs(A)/epsilon));	// Segments in approximation
+  
+  if (i) {
+    epsilon = A/i;			// Arc length for equal-size steps
+    double cos_e = cos(epsilon);	// Rotation coefficients
+    double sin_e = sin(epsilon);
+    do {
+      double Xnew =  cos_e*X + sin_e*Y;
+		Y = -sin_e*X + cos_e*Y;
+      fltk3::vertex(x + (X=Xnew), y + Y);
+    } while (--i);
+  }
+}
+
+#if 0 // portable version.  X-specific one in fltk3::vertex.cxx
+void fltk3::circle(double x,double y,double r) {
+  _fl_arc(x, y, r, r, 0, 360);
+}
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/arci.cxx (from rev 9002, branches/branch-3.0/src/core/fl_arci.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/arci.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/arci.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,131 @@
+//
+// "$Id$"
+//
+// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_arci.cxx
+  \brief Utility functions for drawing circles using integers
+*/
+
+// "integer" circle drawing functions.  These draw the limited
+// circle types provided by X and NT graphics.  The advantage of
+// these is that small ones draw quite nicely (probably due to stored
+// hand-drawn bitmaps of small circles!) and may be implemented by
+// hardware and thus are fast.
+
+// Probably should add fltk3::chord.
+
+// 3/10/98: created
+
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#ifdef WIN32
+#  include <fltk3/math.h>
+#endif
+#include <config.h>
+
+void fltk3::GraphicsDriver::arc(int x,int y,int w,int h,double a1,double a2) {
+  if (w <= 0 || h <= 0) return;
+
+#if defined(USE_X11)
+  XDrawArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
+#elif defined(WIN32)
+  int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
+  int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
+  int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
+  int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
+  if (fabs(a1 - a2) < 90) {
+    if (xa == xb && ya == yb) SetPixel(fl_gc, xa, ya, fl_RGB());
+    else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
+  } else Arc(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
+#elif defined(__APPLE_QUARTZ__)
+  a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
+  float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
+  CGContextSetShouldAntialias(fl_gc, true);
+  if (w!=h) {
+    CGContextSaveGState(fl_gc);
+    CGContextTranslateCTM(fl_gc, cx, cy);
+    CGContextScaleCTM(fl_gc, w-1.0f, h-1.0f);
+    CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
+    CGContextRestoreGState(fl_gc);
+  } else {
+    float r = (w+h)*0.25f-0.5f;
+    CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
+  }
+  CGContextStrokePath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::pie(int x,int y,int w,int h,double a1,double a2) {
+  if (w <= 0 || h <= 0) return;
+
+#if defined(USE_X11)
+  XFillArc(fl_display, fl_window, fl_gc, x,y,w-1,h-1, int(a1*64),int((a2-a1)*64));
+#elif defined(WIN32)
+  if (a1 == a2) return;
+  int xa = x+w/2+int(w*cos(a1/180.0*M_PI));
+  int ya = y+h/2-int(h*sin(a1/180.0*M_PI));
+  int xb = x+w/2+int(w*cos(a2/180.0*M_PI));
+  int yb = y+h/2-int(h*sin(a2/180.0*M_PI));
+  SelectObject(fl_gc, fl_brush());
+  if (fabs(a1 - a2) < 90) {
+    if (xa == xb && ya == yb) {
+      MoveToEx(fl_gc, x+w/2, y+h/2, 0L); 
+      LineTo(fl_gc, xa, ya);
+      SetPixel(fl_gc, xa, ya, fl_RGB());
+    } else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb);
+  } else Pie(fl_gc, x, y, x+w, y+h, xa, ya, xb, yb); 
+#elif defined(__APPLE_QUARTZ__)
+  a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
+  float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
+  CGContextSetShouldAntialias(fl_gc, true);
+  if (w!=h) {
+    CGContextSaveGState(fl_gc);
+    CGContextTranslateCTM(fl_gc, cx, cy);
+    CGContextScaleCTM(fl_gc, w, h);
+    CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
+    CGContextAddLineToPoint(fl_gc, 0, 0);
+    CGContextClosePath(fl_gc);
+    CGContextRestoreGState(fl_gc);
+  } else {
+    float r = (w+h)*0.25f;
+    CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
+    CGContextAddLineToPoint(fl_gc, cx, cy);
+    CGContextClosePath(fl_gc);
+  }
+  CGContextFillPath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/arg.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_arg.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/arg.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/arg.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,550 @@
+//
+// "$Id$"
+//
+// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// OPTIONAL initialization code for a program using fltk.
+// You do not need to call this!  Feel free to make up your own switches.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/Window.h>
+#include <fltk3/Tooltip.h>
+#include <fltk3/filename.h>
+#include <fltk3/draw.h>
+#include <ctype.h>
+#include "flstring.h"
+
+#if defined(WIN32) || defined(__APPLE__)
+int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*);
+#  define NoValue	0x0000
+#  define XValue  	0x0001
+#  define YValue	0x0002
+#  define WidthValue  	0x0004
+#  define HeightValue  	0x0008
+#  define AllValues 	0x000F
+#  define XNegative 	0x0010
+#  define YNegative 	0x0020
+#endif
+
+static int fl_match(const char *a, const char *s, int atleast = 1) {
+  const char *b = s;
+  while (*a && (*a == *b || tolower(*a) == *b)) {a++; b++;}
+  return !*a && b >= s+atleast;
+}
+
+// flags set by previously parsed arguments:
+extern char fl_show_iconic; // in Fl_x.cxx
+static char arg_called;
+static char return_i;
+static const char *name;
+static const char *geometry;
+static const char *title;
+// these are in Fl_get_system_colors and are set by the switches:
+extern const char *fl_fg;
+extern const char *fl_bg;
+extern const char *fl_bg2;
+
+/**
+  Parse a single switch from \p argv, starting at word \p i.
+  Returns the number of words eaten (1 or 2, or 0 if it is not
+  recognized) and adds the same value to \p i. 
+  
+  This is the default argument handler used internally by fltk3::args(...),
+  but you can use this function if you prefer to step through the
+  standard FLTK switches yourself.
+  
+  All standard FLTK switches except -bg2 may be abbreviated to just
+  one letter and case is ignored:
+  
+  \li -bg color or -background color
+  <br>
+  Sets the background color using fltk3::background().
+  
+  \li -bg2 color or -background2 color
+  <br>
+  Sets the secondary background color using fltk3::background2().
+  
+  \li -display host:n.n
+  <br>
+  Sets the X display to use; this option is silently
+  ignored under WIN32 and MacOS.
+  
+  \li -dnd and -nodnd
+  <br>
+  Enables or disables drag and drop text operations
+  using fltk3::dnd_text_ops().
+  
+  \li -fg color or -foreground color
+  <br>
+  Sets the foreground color using fltk3::foreground().
+  
+  \li -geometry WxH+X+Y
+  <br>
+  Sets the initial window position and size according
+  to the standard X geometry string.
+  
+  \li -iconic
+  <br>
+  Iconifies the window using fltk3::Window::iconize().
+  
+  \li -kbd and -nokbd
+  <br>
+  Enables or disables visible keyboard focus for
+  non-text widgets using fltk3::visible_focus().
+  
+  \li -name string
+  <br>
+  Sets the window class using fltk3::Window::xclass().
+  
+  \li -scheme string
+  <br>
+  Sets the widget scheme using fltk3::scheme().
+  
+  \li -title string
+  <br>
+  Sets the window title using fltk3::Window::label().
+  
+  \li -tooltips and -notooltips
+  <br>
+  Enables or disables tooltips using fltk3::Tooltip::enable().
+  
+  
+  If your program requires other switches in addition to the standard
+  FLTK options, you will need to pass your own argument handler to
+  fltk3::args(int,char**,int&,fltk3::ArgsHandler) explicitly.
+*/
+int fltk3::arg(int argc, char **argv, int &i) {
+  arg_called = 1;
+  const char *s = argv[i];
+
+  if (!s) {i++; return 1;}	// something removed by calling program?
+
+  // a word that does not start with '-', or a word after a '--', or
+  // the word '-' by itself all start the "non-switch arguments" to
+  // a program.  Return 0 to indicate that we don't understand the
+  // word, but set a flag (return_i) so that args() will return at
+  // that point:
+  if (s[0] != '-' || s[1] == '-' || !s[1]) {return_i = 1; return 0;}
+  s++; // point after the dash
+
+  if (fl_match(s, "iconic")) {
+    fl_show_iconic = 1;
+    i++;
+    return 1;
+  } else if (fl_match(s, "kbd")) {
+    fltk3::visible_focus(1);
+    i++;
+    return 1;
+  } else if (fl_match(s, "nokbd", 3)) {
+    fltk3::visible_focus(0);
+    i++;
+    return 1;
+  } else if (fl_match(s, "dnd", 2)) {
+    fltk3::dnd_text_ops(1);
+    i++;
+    return 1;
+  } else if (fl_match(s, "nodnd", 3)) {
+    fltk3::dnd_text_ops(0);
+    i++;
+    return 1;
+  } else if (fl_match(s, "tooltips", 2)) {
+    fltk3::Tooltip::enable();
+    i++;
+    return 1;
+  } else if (fl_match(s, "notooltips", 3)) {
+    fltk3::Tooltip::disable();
+    i++;
+    return 1;
+  }
+#ifdef __APPLE__
+  // The Finder application in MacOS X passes the "-psn_N_NNNNN" option
+  // to all apps...
+  else if (strncmp(s, "psn_", 4) == 0) {
+    i++;
+    return 1;
+  }
+#endif // __APPLE__
+
+  const char *v = argv[i+1];
+  if (i >= argc-1 || !v)
+    return 0;	// all the rest need an argument, so if missing it is an error
+
+  if (fl_match(s, "geometry")) {
+
+    int flags, gx, gy; unsigned int gw, gh;
+    flags = XParseGeometry(v, &gx, &gy, &gw, &gh);
+    if (!flags) return 0;
+    geometry = v;
+
+#if !defined(WIN32) && !defined(__APPLE__)
+  } else if (fl_match(s, "display", 2)) {
+    fltk3::display(v);
+#endif
+
+  } else if (fl_match(s, "title", 2)) {
+    title = v;
+
+  } else if (fl_match(s, "name", 2)) {
+    name = v;
+
+  } else if (fl_match(s, "bg2", 3) || fl_match(s, "background2", 11)) {
+    fl_bg2 = v;
+
+  } else if (fl_match(s, "bg", 2) || fl_match(s, "background", 10)) {
+    fl_bg = v;
+
+  } else if (fl_match(s, "fg", 2) || fl_match(s, "foreground", 10)) {
+    fl_fg = v;
+
+  } else if (fl_match(s, "scheme", 1)) {
+    fltk3::scheme(v);
+
+  } else return 0; // unrecognized
+
+  i += 2;
+  return 2;
+}
+
+
+/**
+  Parse command line switches using the \p cb argument handler.
+  
+  Returns 0 on error, or the number of words processed.
+  
+  FLTK provides this as an <i>entirely optional</i> command line
+  switch parser. You don't have to call it if you don't want to.
+  Everything it can do can be done with other calls to FLTK.
+  
+  To use the switch parser, call fltk3::args(...) near the start
+  of your program.  This does \b not open the display, instead
+  switches that need the display open are stashed into static
+  variables. Then you \b must display your first window by calling
+  <tt>window->show(argc,argv)</tt>, which will do anything stored
+  in the static variables.
+  
+  Providing an argument handler callback \p cb lets you define
+  your own switches. It is called with the same \p argc and \p argv,
+  and with \p i set to the index of the switch to be processed.
+  The \p cb handler should return zero if the switch is unrecognized,
+  and not change \p i. It should return non-zero to indicate the
+  number of words processed if the switch is recognized, i.e. 1 for
+  just the switch, and more than 1 for the switch plus associated
+  parameters. \p i should be incremented by the same amount.
+  
+  The \p cb handler is called \b before any other tests, so
+  <i>you can also override any standard FLTK switch</i>
+  (this is why FLTK can use very short switches instead of
+  the long ones all other toolkits force you to use).
+  See fltk3::arg() for descriptions of the standard switches.
+ 
+  On return \p i is set to the index of the first non-switch.
+  This is either:
+  
+  \li The first word that does not start with '-'.
+  \li The word '-' (used by many programs to name stdin as a file)
+  \li The first unrecognized switch (return value is 0).
+  \li \p argc
+  
+  The return value is \p i unless an unrecognized switch is found,
+  in which case it is zero. If your program takes no arguments other
+  than switches you should produce an error if the return value is less
+  than \p argc.
+  
+  
+  A usage string is displayed if fltk3::args() detects an invalid argument
+  on the command-line. You can change the message by setting the
+  fltk3::help pointer.
+  
+  A very simple command line parser can be found in <tt>examples/howto-parse-args.cxx</tt>
+  
+  The simpler fltk3::args(int argc, char **argv) form is useful if your program
+  does not have command line switches of its own.
+*/
+
+int fltk3::args(int argc, char** argv, int& i, fltk3::ArgsHandler cb) {
+  arg_called = 1;
+  i = 1; // skip argv[0]
+  while (i < argc) {
+    if (cb && cb(argc,argv,i)) continue;
+    if (!arg(argc,argv,i)) return return_i ? i : 0;
+  }
+  return i;
+}
+
+// show a main window, use any parsed arguments
+void fltk3::Window::show(int argc, char **argv) {
+  if (argc && !arg_called) fltk3::args(argc,argv);
+
+  fltk3::get_system_colors();
+
+#if !defined(WIN32) && !defined(__APPLE__)
+  // Get defaults for drag-n-drop and focus...
+  const char *key = 0, *val;
+
+  if (fltk3::first_window()) key = fltk3::first_window()->xclass();
+  if (!key) key = "fltk";
+
+  val = XGetDefault(fl_display, key, "dndTextOps");
+  if (val) fltk3::dnd_text_ops(strcasecmp(val, "true") == 0 ||
+                            strcasecmp(val, "on") == 0 ||
+                            strcasecmp(val, "yes") == 0);
+
+  val = XGetDefault(fl_display, key, "tooltips");
+  if (val) fltk3::Tooltip::enable(strcasecmp(val, "true") == 0 ||
+                              strcasecmp(val, "on") == 0 ||
+                              strcasecmp(val, "yes") == 0);
+
+  val = XGetDefault(fl_display, key, "visibleFocus");
+  if (val) fltk3::visible_focus(strcasecmp(val, "true") == 0 ||
+                             strcasecmp(val, "on") == 0 ||
+                             strcasecmp(val, "yes") == 0);
+#endif // !WIN32 && !__APPLE__
+
+  // set colors first, so background_pixel is correct:
+  static char beenhere;
+  if (!beenhere) {
+    if (geometry) {
+      int fl = 0, gx = x(), gy = y(); unsigned int gw = w(), gh = h();
+      fl = XParseGeometry(geometry, &gx, &gy, &gw, &gh);
+      if (fl & XNegative) gx = fltk3::w()-w()+gx;
+      if (fl & YNegative) gy = fltk3::h()-h()+gy;
+      //  int mw,mh; minsize(mw,mh);
+      //  if (mw > gw) gw = mw;
+      //  if (mh > gh) gh = mh;
+      fltk3::Widget *r = resizable();
+      if (!r) resizable(this);
+      // for WIN32 we assume window is not mapped yet:
+      if (fl & (XValue | YValue))
+	x(-1), resize(gx,gy,gw,gh);
+      else
+	size(gw,gh);
+      resizable(r);
+    }
+  }
+
+  // set the class, which is used by X version of get_system_colors:
+  if (name) {xclass(name); name = 0;}
+  else if (!xclass()) xclass(fltk3::filename_name(argv[0]));
+
+  if (title) {label(title); title = 0;}
+  else if (!label()) label(xclass());
+
+  if (!beenhere) {
+    beenhere = 1;
+    fltk3::scheme(fltk3::scheme()); // opens display!  May call fltk3::fatal()
+  }
+
+  // Show the window AFTER we have set the colors and scheme.
+  show();
+
+#if !defined(WIN32) && !defined(__APPLE__)
+  // set the command string, used by state-saving window managers:
+  int j;
+  int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
+  char *buffer = new char[n];
+  char *p = buffer;
+  for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
+  XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0,
+		  (unsigned char *)buffer, p-buffer-1);
+  delete[] buffer;
+#endif // !WIN32 && !__APPLE__
+}
+
+// Calls useful for simple demo programs, with automatic help message:
+
+static const char * const helpmsg =
+"options are:\n"
+" -bg2 color\n"
+" -bg color\n"
+" -di[splay] host:n.n\n"
+" -dn[d]\n"
+" -fg color\n"
+" -g[eometry] WxH+X+Y\n"
+" -i[conic]\n"
+" -k[bd]\n"
+" -na[me] classname\n"
+" -nod[nd]\n"
+" -nok[bd]\n"
+" -not[ooltips]\n"
+" -s[cheme] scheme\n"
+" -ti[tle] windowtitle\n"
+" -to[oltips]";
+
+const char * const fltk3::help = helpmsg+13;
+
+/**
+ Parse all command line switches matching standard FLTK options only.
+ 
+ It parses all the switches, and if any are not recognized it calls
+ fltk3::abort(fltk3::help), i.e. unlike the long form, an unrecognized
+ switch generates an error message and causes the program to exit.
+ 
+ */
+void fltk3::args(int argc, char **argv) {
+  int i; if (fltk3::args(argc,argv,i) < argc) fltk3::error(helpmsg);
+}
+
+#if defined(WIN32) || defined(__APPLE__)
+
+/* the following function was stolen from the X sources as indicated. */
+
+/* Copyright 	Massachusetts Institute of Technology  1985, 1986, 1987 */
+/* $XConsortium: XParseGeom.c,v 11.18 91/02/21 17:23:05 rws Exp $ */
+
+/*
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of M.I.T. not be used in advertising or
+publicity pertaining to distribution of the software without specific,
+written prior permission.  M.I.T. makes no representations about the
+suitability of this software for any purpose.  It is provided "as is"
+without express or implied warranty.
+*/
+
+/*
+ *    XParseGeometry parses strings of the form
+ *   "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
+ *   width, height, xoffset, and yoffset are unsigned integers.
+ *   Example:  "=80x24+300-49"
+ *   The equal sign is optional.
+ *   It returns a bitmask that indicates which of the four values
+ *   were actually found in the string.  For each value found,
+ *   the corresponding argument is updated;  for each value
+ *   not found, the corresponding argument is left unchanged. 
+ */
+
+static int ReadInteger(char* string, char** NextString)
+{
+  register int Result = 0;
+  int Sign = 1;
+    
+  if (*string == '+')
+    string++;
+  else if (*string == '-') {
+    string++;
+    Sign = -1;
+  }
+  for (; (*string >= '0') && (*string <= '9'); string++) {
+    Result = (Result * 10) + (*string - '0');
+  }
+  *NextString = string;
+  if (Sign >= 0)
+    return (Result);
+  else
+    return (-Result);
+}
+
+int XParseGeometry(const char* string, int* x, int* y,
+		   unsigned int* width, unsigned int* height)
+{
+  int mask = NoValue;
+  register char *strind;
+  unsigned int tempWidth = 0, tempHeight = 0;
+  int tempX = 0, tempY = 0;
+  char *nextCharacter;
+
+  if ( (string == NULL) || (*string == '\0')) return(mask);
+  if (*string == '=')
+    string++;  /* ignore possible '=' at beg of geometry spec */
+
+  strind = (char *)string;
+  if (*strind != '+' && *strind != '-' && *strind != 'x') {
+    tempWidth = ReadInteger(strind, &nextCharacter);
+    if (strind == nextCharacter) 
+      return (0);
+    strind = nextCharacter;
+    mask |= WidthValue;
+  }
+
+  if (*strind == 'x' || *strind == 'X') {	
+    strind++;
+    tempHeight = ReadInteger(strind, &nextCharacter);
+    if (strind == nextCharacter)
+      return (0);
+    strind = nextCharacter;
+    mask |= HeightValue;
+  }
+
+  if ((*strind == '+') || (*strind == '-')) {
+    if (*strind == '-') {
+      strind++;
+      tempX = -ReadInteger(strind, &nextCharacter);
+      if (strind == nextCharacter)
+	return (0);
+      strind = nextCharacter;
+      mask |= XNegative;
+
+    } else {
+      strind++;
+      tempX = ReadInteger(strind, &nextCharacter);
+      if (strind == nextCharacter)
+	return(0);
+      strind = nextCharacter;
+      }
+    mask |= XValue;
+    if ((*strind == '+') || (*strind == '-')) {
+      if (*strind == '-') {
+	strind++;
+	tempY = -ReadInteger(strind, &nextCharacter);
+	if (strind == nextCharacter)
+	  return(0);
+	strind = nextCharacter;
+	mask |= YNegative;
+
+      } else {
+	strind++;
+	tempY = ReadInteger(strind, &nextCharacter);
+	if (strind == nextCharacter)
+	  return(0);
+	strind = nextCharacter;
+      }
+      mask |= YValue;
+    }
+  }
+	
+  /* If strind isn't at the end of the string the it's an invalid
+     geometry specification. */
+
+  if (*strind != '\0') return (0);
+
+  if (mask & XValue)
+    *x = tempX;
+  if (mask & YValue)
+    *y = tempY;
+  if (mask & WidthValue)
+    *width = tempWidth;
+  if (mask & HeightValue)
+    *height = tempHeight;
+  return (mask);
+}
+
+#endif // ifdef WIN32
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ask.cxx (from rev 9002, branches/branch-3.0/src/core/fl_ask.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ask.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ask.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,579 @@
+//
+// "$Id$"
+//
+// Standard dialog functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Implementation of fltk3::message, fltk3::ask, fltk3::choice, fltk3::input
+// The three-message fl_show_x functions are for forms compatibility
+// mostly.  In most cases it is easier to get a multi-line message
+// by putting newlines in the message.
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "flstring.h"
+
+#include <fltk3/run.h>
+
+#include <fltk3/ask.h>
+
+#include <fltk3/Box.h>
+#include <fltk3/Button.h>
+#include <fltk3/ReturnButton.h>
+#include <fltk3/Window.h>
+#include <fltk3/Input.h>
+#include <fltk3/SecretInput.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+
+static fltk3::Window *message_form;
+static fltk3::Box *message;
+static fltk3::Box *icon;
+static fltk3::Button *button[3];
+static fltk3::Input *input;
+static int ret_val;
+static const char *iconlabel = "?";
+static const char *message_title_default_;
+fltk3::Font fltk3::message_font_ = fltk3::HELVETICA;
+fltk3::Fontsize fltk3::message_size_ = -1;
+static int enableHotspot = 1;
+#ifdef __APPLE__
+extern "C" void NSBeep(void);
+#endif
+
+static char avoidRecursion = 0;
+
+// Sets the global return value (ret_val) and closes the window.
+// Note: this is used for the button callbacks and the window
+// callback (closing the window with the close button or menu).
+// The first argument (fltk3::Widget *) can either be an fltk3::Button*
+// pointer to one of the buttons or an fltk3::Window* pointer to the
+// message window (message_form).
+static void button_cb(fltk3::Widget *, void *val) {
+  ret_val = (fl_intptr_t)val;
+  message_form->hide();
+}
+
+static fltk3::Window *makeform() {
+ if (message_form) {
+   message_form->size(410,103);
+   return message_form;
+ }
+ // make sure that the dialog does not become the child of some
+ // current group
+ fltk3::Group *previously_current_group = fltk3::Group::current();
+ fltk3::Group::current(0);
+ // create a new top level window
+ fltk3::Window *w = message_form = new fltk3::Window(410,103);
+ message_form->callback(button_cb,(void *)0);
+ // w->clear_border();
+ // w->box(fltk3::UP_BOX);
+ (message = new fltk3::Box(60, 25, 340, 20))
+   ->align(fltk3::ALIGN_LEFT|fltk3::ALIGN_INSIDE|fltk3::ALIGN_WRAP);
+ (input = new fltk3::Input(60, 37, 340, 23))->hide();
+ {fltk3::Box* o = icon = new fltk3::Box(10, 10, 50, 50);
+  o->box(fltk3::THIN_UP_BOX);
+  o->labelfont(fltk3::TIMES_BOLD);
+  o->labelsize(34);
+  o->color(fltk3::WHITE);
+  o->labelcolor(fltk3::BLUE);
+ }
+ w->end(); // don't add the buttons automatically
+ // create the buttons (right to left)
+ int b, x;
+ for (b=0, x=310; b<3; b++, x -= 100) {
+   if (b==1)
+     button[b] = new fltk3::ReturnButton(x, 70, 90, 23);
+   else
+     button[b] = new fltk3::Button(x, 70, 90, 23);
+   button[b]->align(fltk3::ALIGN_INSIDE|fltk3::ALIGN_WRAP);
+   button[b]->callback(button_cb,(void *)b);
+ }
+ button[0]->shortcut(fltk3::EscapeKey);
+ // add the buttons (left to right)
+ for (b=2; b>=0; b--)
+   w->add(button[b]);
+ w->begin();
+ w->resizable(new fltk3::Box(60,10,110-60,27));
+ w->end();
+ w->set_modal();
+ fltk3::Group::current(previously_current_group);
+ return w;
+}
+
+/*
+ * 'resizeform()' - Resize the form and widgets so that they hold everything
+ *                  that is asked of them...
+ */
+
+void resizeform() {
+  int	i;
+  int	message_w, message_h;
+  int	text_height;
+  int	button_w[3], button_h[3];
+  int	x, w, h, max_w, max_h;
+	const int icon_size = 50;
+
+  fltk3::font(message->labelfont(), message->labelsize());
+  message_w = message_h = 0;
+  fltk3::measure(message->label(), message_w, message_h);
+
+  message_w += 10;
+  message_h += 10;
+  if (message_w < 340)
+    message_w = 340;
+  if (message_h < 30)
+    message_h = 30;
+
+  fltk3::font(button[0]->labelfont(), button[0]->labelsize());
+
+  memset(button_w, 0, sizeof(button_w));
+  memset(button_h, 0, sizeof(button_h));
+
+  for (max_h = 25, i = 0; i < 3; i ++)
+    if (button[i]->visible())
+    {
+      fltk3::measure(button[i]->label(), button_w[i], button_h[i]);
+
+      if (i == 1)
+        button_w[1] += 20;
+
+      button_w[i] += 30;
+      button_h[i] += 10;
+
+      if (button_h[i] > max_h)
+        max_h = button_h[i];
+    }
+
+  if (input->visible()) text_height = message_h + 25;
+  else text_height = message_h;
+
+  max_w = message_w + 10 + icon_size;
+  w     = button_w[0] + button_w[1] + button_w[2] - 10;
+
+  if (w > max_w)
+    max_w = w;
+
+  message_w = max_w - 10 - icon_size;
+
+  w = max_w + 20;
+  h = max_h + 30 + text_height;
+
+  message_form->size(w, h);
+  message_form->size_range(w, h, w, h);
+
+  message->resize(20 + icon_size, 10, message_w, message_h);
+  icon->resize(10, 10, icon_size, icon_size);
+  icon->labelsize(icon_size - 10);
+  input->resize(20 + icon_size, 10 + message_h, message_w, 25);
+
+  for (x = w, i = 0; i < 3; i ++)
+    if (button_w[i])
+    {
+      x -= button_w[i];
+      button[i]->resize(x, h - 10 - max_h, button_w[i] - 10, max_h);
+
+//      printf("button %d (%s) is %dx%d+%d,%d\n", i, button[i]->label(),
+//             button[i]->w(), button[i]->h(),
+//	     button[i]->x(), button[i]->y());
+    }
+}
+
+static int innards(const char* fmt, va_list ap,
+  const char *b0,
+  const char *b1,
+  const char *b2)
+{
+  fltk3::pushed(0); // stop dragging (STR #2159)
+
+  avoidRecursion = 1;
+
+  makeform();
+  char buffer[1024];
+  if (!strcmp(fmt,"%s")) {
+    message->label(va_arg(ap, const char*));
+  } else {
+    ::vsnprintf(buffer, 1024, fmt, ap);
+    message->label(buffer);
+  }
+
+  message->labelfont(fltk3::message_font_);
+  if (fltk3::message_size_ == -1)
+    message->labelsize(fltk3::NORMAL_SIZE);
+  else
+    message->labelsize(fltk3::message_size_);
+  if (b0) {button[0]->show(); button[0]->label(b0); button[1]->position(210,70);}
+  else {button[0]->hide(); button[1]->position(310,70);}
+  if (b1) {button[1]->show(); button[1]->label(b1);}
+  else button[1]->hide();
+  if (b2) {button[2]->show(); button[2]->label(b2);}
+  else button[2]->hide();
+  const char* prev_icon_label = icon->label();
+  if (!prev_icon_label) icon->label(iconlabel);
+
+  resizeform();
+
+  if (button[1]->visible() && !input->visible())
+    button[1]->take_focus();
+  if (enableHotspot)
+    message_form->hotspot(button[0]);
+  if (b0 && fltk3::Widget::label_shortcut(b0))
+    button[0]->shortcut((unsigned)0);
+  else
+    button[0]->shortcut(fltk3::EscapeKey);
+
+  // set default window title, if defined and a specific title is not set
+  if (!message_form->label() && message_title_default_)
+    message_form->label(message_title_default_);
+
+  // deactivate fltk3::grab(), because it is incompatible with modal windows
+  fltk3::Window* g = fltk3::grab();
+  if (g) fltk3::grab(0);
+  message_form->show();
+  while (message_form->shown()) fltk3::wait();
+  if (g) // regrab the previous popup menu, if there was one
+    fltk3::grab(g);
+  icon->label(prev_icon_label);
+  message_form->label(0); // reset window title
+
+  avoidRecursion = 0;
+  return ret_val;
+}
+
+ /** \addtogroup group_comdlg
+    @{ */
+
+// pointers you can use to change FLTK to another language:
+const char* fltk3::no = "No";        ///< string pointer used in common dialogs, you can change it to another language
+const char* fltk3::yes= "Yes";       ///< string pointer used in common dialogs, you can change it to another language
+const char* fltk3::ok = "OK";        ///< string pointer used in common dialogs, you can change it to another language
+const char* fltk3::cancel= "Cancel"; ///< string pointer used in common dialogs, you can change it to another language
+const char* fltk3::close= "Close";   ///< string pointer used in common dialogs, you can change it to another language
+
+// fltk functions:
+/**
+   Emits a system beep message.
+   \note \#include <fltk3/ask.h>
+ */
+void fltk3::beep(int type) {
+#ifdef WIN32
+  switch (type) {
+    case fltk3::BEEP_QUESTION :
+    case fltk3::BEEP_PASSWORD :
+      MessageBeep(MB_ICONQUESTION);
+      break;
+    case fltk3::BEEP_MESSAGE :
+      MessageBeep(MB_ICONASTERISK);
+      break;
+    case fltk3::BEEP_NOTIFICATION :
+      MessageBeep(MB_ICONASTERISK);
+      break;
+    case fltk3::BEEP_ERROR :
+      MessageBeep(MB_ICONERROR);
+      break;
+    default :
+      MessageBeep(0xFFFFFFFF);
+      break;
+  }
+#elif defined(__APPLE__)
+  switch (type) {
+    case fltk3::BEEP_DEFAULT :
+    case fltk3::BEEP_ERROR :
+      NSBeep();
+      break;
+    default :
+      break;
+  }
+#else
+  switch (type) {
+    case fltk3::BEEP_DEFAULT :
+    case fltk3::BEEP_ERROR :
+      if (!fl_display) fl_open_display();
+
+      XBell(fl_display, 100);
+      break;
+    default :
+      if (!fl_display) fl_open_display();
+
+      XBell(fl_display, 50);
+      break;
+  }
+#endif // WIN32
+}
+
+/** Shows an information message dialog box.
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+   can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+ */
+void fltk3::message(const char *fmt, ...) {
+  va_list ap;
+  va_start(ap, fmt);
+  vmessage(fmt, ap);
+  va_end(ap);
+}
+
+void fltk3::vmessage(const char *fmt, va_list ap) {
+  if (avoidRecursion) return;
+  fltk3::beep(fltk3::BEEP_MESSAGE);
+  iconlabel = "i";
+  innards(fmt, ap, 0, fltk3::close, 0);
+  iconlabel = "?";
+}
+
+/** Shows an alert message dialog box
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+   can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+ */
+void fltk3::alert(const char *fmt, ...) {
+  va_list ap;
+  va_start(ap, fmt);
+  valert(fmt, ap);
+  va_end(ap);
+}
+
+void fltk3::valert(const char *fmt, va_list ap) {
+  if (avoidRecursion) return;
+  fltk3::beep(fltk3::BEEP_ERROR);
+  iconlabel = "!";
+  innards(fmt, ap, 0, fltk3::close, 0);
+  iconlabel = "?";
+}
+
+/** Shows a dialog displaying the \p fmt message,
+    this dialog features 2 yes/no buttons
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+   can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+   \retval 0 if the no button is selected or another dialog box is still open
+   \retval 1 if yes is selected
+ */
+int fltk3::ask(const char *fmt, ...) {
+  va_list ap;
+  va_start(ap, fmt);
+  int ret = vask(fmt, ap);
+  va_end(ap);
+  return ret;
+}
+
+int fltk3::vask(const char *fmt, va_list ap) {
+  if (avoidRecursion) return 0;
+  fltk3::beep(fltk3::BEEP_QUESTION);
+  int r = innards(fmt, ap, fltk3::no, fltk3::yes, 0);
+  return r;
+}
+
+/** Shows a dialog displaying the \p fmt message,
+    this dialog features up to 3 customizable choice buttons
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+    can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+   \param[in] b0 text label of button 0
+   \param[in] b1 text label of button 1
+   \param[in] b2 text label of button 2
+   \retval 0 if the first button with \p b0 text is selected or another dialog box is still open
+   \retval 1 if the second button with \p b1 text is selected
+   \retval 2 if the third button with \p b2 text is selected
+ */
+int fltk3::choice(const char*fmt,const char *b0,const char *b1,const char *b2,...) {
+  va_list ap;
+  va_start(ap, b2);
+  int ret = vchoice(fmt, b0, b1, b2, ap);
+  va_end(ap);
+  return ret;
+}
+  
+int fltk3::vchoice(const char*fmt,const char *b0,const char *b1,const char *b2, va_list ap) {
+  if (avoidRecursion) return 0;
+  fltk3::beep(fltk3::BEEP_QUESTION);
+  int r = innards(fmt, ap, b0, b1, b2);
+  return r;
+}
+
+/** Gets the fltk3::Box icon container of the current default dialog used in
+    many common dialogs like fltk3::message(), fltk3::alert(),
+    fltk3::ask(), fltk3::choice(), fltk3::input(), fltk3::password()
+    \note \#include <fltk3/ask.h>
+*/
+fltk3::Widget *fltk3::message_icon() {makeform(); return icon;}
+
+static const char* input_innards(const char* fmt, va_list ap,
+				 const char* defstr, uchar type) {
+  makeform();
+  message->position(60,10);
+  input->type(type);
+  input->show();
+  input->value(defstr);
+  input->take_focus();
+
+  int r = innards(fmt, ap, fltk3::cancel, fltk3::ok, 0);
+  input->hide();
+  message->position(60,25);
+  return r ? input->value() : 0;
+}
+
+/** Shows an input dialog displaying the \p fmt message
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+   can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+   \param[in] defstr defines the default returned string if no text is entered
+   \return the user string input if OK was pushed, NULL if Cancel was pushed or another dialog box was still open
+ */
+const char* fltk3::input(const char *fmt, const char *defstr, ...) {
+  va_list ap;
+  va_start(ap, defstr);
+  const char *ret = vinput(fmt, defstr, ap);
+  va_end(ap);
+  return ret;
+}
+
+const char* fltk3::vinput(const char *fmt, const char *defstr, va_list ap) {
+  if (avoidRecursion) return 0;
+  fltk3::beep(fltk3::BEEP_QUESTION);
+  const char* r = input_innards(fmt, ap, defstr, fltk3::NORMAL_INPUT);
+  return r;
+}
+
+/** Shows an input dialog displaying the \p fmt message.
+
+    Like fltk3::input() except the input text is not shown,
+    '*' characters are displayed instead.
+
+   \note Common dialog boxes are application modal. No more than one common dialog box
+   can be open at any time. Requests for additional dialog boxes are ignored.
+   \note \#include <fltk3/ask.h>
+
+   \param[in] fmt can be used as an sprintf-like format and variables for the message text
+   \param[in] defstr defines the default returned string if no text is entered
+   \return the user string input if OK was pushed, NULL if Cancel was pushed or aother dialog box was still open
+ */
+const char *fltk3::password(const char *fmt, const char *defstr, ...) {
+  va_list ap;
+  va_start(ap, defstr);
+  const char *ret = vpassword(fmt, defstr, ap);
+  va_end(ap);
+  return ret;
+}
+
+const char *fltk3::vpassword(const char *fmt, const char *defstr, va_list ap) {
+  if (avoidRecursion) return 0;
+  fltk3::beep(fltk3::BEEP_PASSWORD);
+  const char* r = input_innards(fmt, ap, defstr, fltk3::SECRET_INPUT);
+  return r;
+}
+
+/** Sets whether or not to move the common message box used in
+    many common dialogs like fltk3::message(), fltk3::alert(),
+    fltk3::ask(), fltk3::choice(), fltk3::input(), fltk3::password() to follow
+    the mouse pointer.
+
+    The default is \e enabled, so that the default button is the
+    hotspot and appears at the mouse position.
+    \note \#include <fltk3/ask.h>
+    \param[in]	enable	non-zero enables hotspot behavior,
+			0 disables hotspot
+ */
+void fltk3::message_hotspot(int enable) {
+  enableHotspot = enable ? 1 : 0;
+}
+
+/** Gets whether or not to move the common message box used in
+    many common dialogs like fltk3::message(), fltk3::alert(),
+    fltk3::ask(), fltk3::choice(), fltk3::input(), fltk3::password() to follow
+    the mouse pointer.
+    \note \#include <fltk3/ask.h>
+    \return	0 if disable, non-zero otherwise
+    \see fltk3::message_hotspot(int)
+ */
+int fltk3::message_hotspot(void) {
+  return enableHotspot;
+}
+
+/** Sets the title of the dialog window used in many common dialogs.
+
+    This window \p title will be used in the next call of one of the
+    common dialogs like fltk3::message(), fltk3::alert(), fltk3::ask(), fltk3::choice(),
+    fltk3::input(), fltk3::password().
+
+    The \p title string is copied internally, so that you can use a
+    local variable or free the string immediately after this call. It
+    applies only to the \b next call of one of the common dialogs and
+    will be reset to an empty title (the default for all dialogs) after
+    that call.
+
+    \note \#include <fltk3/ask.h>
+    \param[in] title	window label, string copied internally
+*/
+void fltk3::message_title(const char *title) {
+  makeform();
+  message_form->copy_label(title);
+}
+
+/** Sets the default title of the dialog window used in many common dialogs.
+
+    This window \p title will be used in all subsequent calls of one of the
+    common dialogs like fltk3::message(), fltk3::alert(), fltk3::ask(), fltk3::choice(),
+    fltk3::input(), fltk3::password(), unless a specific title has been set
+    with fltk3::message_title(const char *title).
+    
+    The default is no title. You can override the default title for a
+    single dialog with fltk3::message_title(const char *title).
+
+    The \p title string is copied internally, so that you can use a
+    local variable or free the string immediately after this call.
+
+    \note \#include <fltk3/ask.h>
+    \param[in] title	default window label, string copied internally
+*/
+void fltk3::message_title_default(const char *title) {
+  if (message_title_default_) {
+    free ((void *)message_title_default);
+    message_title_default_ = 0;
+  }
+  if (title)
+    message_title_default_ = strdup(title);
+}
+
+/** @} */
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/boxtype.cxx (from rev 9002, branches/branch-3.0/src/core/fl_boxtype.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/boxtype.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/boxtype.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,476 @@
+//
+// "$Id$"
+//
+// Box drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_boxtype.cxx
+  \brief drawing code for common box types.
+*/
+
+// Box drawing code for the common box types and the table of
+// boxtypes.  Other box types are in separate files so they are not
+// linked in if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/draw.h>
+#include <config.h>
+
+////////////////////////////////////////////////////////////////
+
+static uchar active_ramp[24] = {
+  fltk3::GRAY_RAMP+0, fltk3::GRAY_RAMP+1, fltk3::GRAY_RAMP+2, fltk3::GRAY_RAMP+3,
+  fltk3::GRAY_RAMP+4, fltk3::GRAY_RAMP+5, fltk3::GRAY_RAMP+6, fltk3::GRAY_RAMP+7,
+  fltk3::GRAY_RAMP+8, fltk3::GRAY_RAMP+9, fltk3::GRAY_RAMP+10,fltk3::GRAY_RAMP+11,
+  fltk3::GRAY_RAMP+12,fltk3::GRAY_RAMP+13,fltk3::GRAY_RAMP+14,fltk3::GRAY_RAMP+15,
+  fltk3::GRAY_RAMP+16,fltk3::GRAY_RAMP+17,fltk3::GRAY_RAMP+18,fltk3::GRAY_RAMP+19,
+  fltk3::GRAY_RAMP+20,fltk3::GRAY_RAMP+21,fltk3::GRAY_RAMP+22,fltk3::GRAY_RAMP+23};
+static uchar inactive_ramp[24] = {
+  43, 43, 44, 44,
+  44, 45, 45, 46,
+  46, 46, 47, 47,
+  48, 48, 48, 49,
+  49, 49, 50, 50,
+  51, 51, 52, 52};
+static int draw_it_active = 1;
+
+/**
+  Determines if the current draw box is active or inactive. 
+  If inactive, the box color is changed by the inactive color.
+*/
+int fltk3::draw_box_active() { return draw_it_active; }
+
+namespace fltk3 {
+  uchar *gray_ramp() {return (draw_it_active?active_ramp:inactive_ramp)-'A';}
+}
+
+/**
+  Draws a series of line segments around the given box.
+  The string \p s must contain groups of 4 letters which specify one of 24
+  standard grayscale values, where 'A' is black and 'X' is white.
+  The order of each set of 4 characters is: top, left, bottom, right.
+  The result of calling fltk3::frame() with a string that is not a multiple
+  of 4 characters in length is undefined.
+  The only difference between this function and fltk3::frame2() is the order
+  of the line segments.
+  \param[in] s sets of 4 grayscale values in top, left, bottom, right order
+  \param[in] x, y, w, h position and size
+*/
+void fltk3::frame(const char* s, int x, int y, int w, int h) {
+  uchar *g = fltk3::gray_ramp();
+  if (h > 0 && w > 0) for (;*s;) {
+    // draw top line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::xyline(x, y, x+w-1);
+    y++; if (--h <= 0) break;
+    // draw left line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::yxline(x, y+h-1, y);
+    x++; if (--w <= 0) break;
+    // draw bottom line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::xyline(x, y+h-1, x+w-1);
+    if (--h <= 0) break;
+    // draw right line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::yxline(x+w-1, y+h-1, y);
+    if (--w <= 0) break;
+  }
+}
+
+/**
+  Draws a series of line segments around the given box.
+  The string \p s must contain groups of 4 letters which specify one of 24
+  standard grayscale values, where 'A' is black and 'X' is white.
+  The order of each set of 4 characters is: bottom, right, top, left.
+  The result of calling fltk3::frame2() with a string that is not a multiple
+  of 4 characters in length is undefined.
+  The only difference between this function and fltk3::frame() is the order
+  of the line segments.
+  \param[in] s sets of 4 grayscale values in bottom, right, top, left order
+  \param[in] x, y, w, h position and size
+*/
+void fltk3::frame2(const char* s, int x, int y, int w, int h) {
+  uchar *g = fltk3::gray_ramp();
+  if (h > 0 && w > 0) for (;*s;) {
+    // draw bottom line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::xyline(x, y+h-1, x+w-1);
+    if (--h <= 0) break;
+    // draw right line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::yxline(x+w-1, y+h-1, y);
+    if (--w <= 0) break;
+    // draw top line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::xyline(x, y, x+w-1);
+    y++; if (--h <= 0) break;
+    // draw left line:
+    fltk3::color(g[(int)*s++]);
+    fltk3::yxline(x, y+h-1, y);
+    x++; if (--w <= 0) break;
+  }
+}
+
+/** Draws a box of type fltk3::NO_BOX */
+void fl_no_box(int, int, int, int, fltk3::Color, fltk3::Boxtype) {}
+
+void fl_flat_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::rectf(x, y, w, h, c);
+}
+
+/** Draws a frame of type fltk3::THIN_DOWN_FRAME */
+void fl_classic_thin_down_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+  fltk3::frame2("WWHH",x,y,w,h);
+}
+
+/** Draws a box of type fltk3::THIN_DOWN_BOX */
+void fl_classic_thin_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_classic_thin_down_frame(x,y,w,h,c,t);
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rectf(x+1, y+1, w-2, h-2);
+}
+
+/** Draws a frame of type fltk3::THIN_UP_FRAME */
+void fl_classic_thin_up_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+  fltk3::frame2("HHWW",x,y,w,h);
+}
+
+/** Draws a box of type fltk3::THIN_UP_BOX */
+void fl_classic_thin_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_classic_thin_up_frame(x,y,w,h,c,t);
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rectf(x+1, y+1, w-2, h-2);
+}
+
+/** Draws a frame of type fltk3::UP_FRAME */
+void fl_classic_up_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+#if BORDER_WIDTH == 1
+  fltk3::frame2("HHWW",x,y,w,h);
+#else
+#if BORDER_WIDTH == 2
+  fltk3::frame2("AAWWMMTT",x,y,w,h);
+#else
+  fltk3::frame("AAAAWWJJUTNN",x,y,w,h);
+#endif
+#endif
+}
+
+#define D1 BORDER_WIDTH
+#define D2 (BORDER_WIDTH+BORDER_WIDTH)
+
+/** Draws a box of type fltk3::UP_BOX */
+void fl_classic_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_classic_up_frame(x,y,w,h,c,t);
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rectf(x+D1, y+D1, w-D2, h-D2);
+}
+
+/** Draws a frame of type fltk3::DOWN_FRAME */
+void fl_classic_down_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+#if BORDER_WIDTH == 1
+  fltk3::frame2("WWHH",x,y,w,h);
+#else
+#if BORDER_WIDTH == 2
+  fltk3::frame2("WWMMPPAA",x,y,w,h);
+#else
+  fltk3::frame("NNTUJJWWAAAA",x,y,w,h);
+#endif
+#endif
+}
+
+/** Draws a box of type fltk3::DOWN_BOX */
+void fl_classic_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_classic_down_frame(x,y,w,h,c,t);
+  fltk3::color(c); fltk3::rectf(x+D1, y+D1, w-D2, h-D2);
+}
+
+/** Draws a frame of type fltk3::ENGRAVED_FRAME */
+void fl_engraved_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+  fltk3::frame("HHWWWWHH",x,y,w,h);
+}
+
+/** Draws a box of type fltk3::ENGRAVED_BOX */
+void fl_engraved_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_engraved_frame(x,y,w,h,c,t);
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rectf(x+2, y+2, w-4, h-4);
+}
+
+/** Draws a frame of type fltk3::EMBOSSED_FRAME */
+void fl_embossed_frame(int x, int y, int w, int h, fltk3::Color, fltk3::Boxtype) {
+  fltk3::frame("WWHHHHWW",x,y,w,h);
+}
+
+/** Draws a box of type fltk3::EMBOSSED_BOX */
+void fl_embossed_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_embossed_frame(x,y,w,h,c,t);
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rectf(x+2, y+2, w-4, h-4);
+}
+
+/**
+  Draws a bounded rectangle with a given position, size and color.
+  Equivalent to drawing a box of type fltk3::BORDER_BOX.
+*/
+void fl_rectbound(int x, int y, int w, int h, fltk3::Color bgcolor, fltk3::Boxtype) {
+  fltk3::color(draw_it_active ? fltk3::BLACK : fltk3::inactive(fltk3::BLACK));
+  fltk3::rect(x, y, w, h);
+  fltk3::color(draw_it_active ? bgcolor : fltk3::inactive(bgcolor));
+  fltk3::rectf(x+1, y+1, w-2, h-2);
+}
+#define fl_border_box fl_rectbound	/**< allow consistent naming */
+
+/**
+  Draws a frame of type fltk3::BORDER_FRAME.
+*/
+void fl_border_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(draw_it_active ? c : fltk3::inactive(c));
+  fltk3::rect(x, y, w, h);
+}
+
+////////////////////////////////////////////////////////////////
+
+void fl_diamond_down_box(int x,int y,int w,int h,fltk3::Color bgcolor, fltk3::Boxtype);
+void fl_diamond_up_box(int x,int y,int w,int h,fltk3::Color bgcolor, fltk3::Boxtype);
+void fl_shadow_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_shadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+
+void fl_classic_round_up_box(int x, int y, int w, int h, fltk3::Color bgcolor, fltk3::Boxtype);
+void fl_classic_round_down_box(int x, int y, int w, int h, fltk3::Color bgcolor, fltk3::Boxtype);
+void fl_rflat_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_rounded_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_rounded_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_rshadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+
+void fl_oval_shadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_oval_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_oval_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_oval_flat_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+
+void fl_plastic_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_thin_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_up_round(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_plastic_down_round(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+
+void fl_gtk_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_thin_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_thin_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_thin_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_thin_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_round_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+void fl_gtk_round_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype);
+
+static struct {
+  fltk3::BoxDrawF *f;
+  uchar dx, dy, dw, dh;
+  int set;
+} fl_box_table[256] = {
+// must match list in enumerations.h!!!
+  {fl_no_box,                   0,0,0,0,1},		
+  {fl_flat_box,                 0,0,0,0,1}, // fltk3::FLAT_BOX
+  {fl_gtk_up_box,		2,2,4,4,0}, // FL_GTK_UP_BOX,
+  {fl_gtk_down_box,		2,2,4,4,0}, // FL_GTK_DOWN_BOX,
+  {fl_gtk_up_frame,		2,2,4,4,0}, // FL_GTK_UP_FRAME,
+  {fl_gtk_down_frame,           2,2,4,4,0}, // FL_GTK_DOWN_FRAME,
+  {fl_gtk_thin_up_box,		1,1,2,2,0}, // FL_GTK_THIN_ROUND_UP_BOX,
+  {fl_gtk_thin_down_box,	1,1,2,2,0}, // FL_GTK_THIN_ROUND_DOWN_BOX,
+  {fl_gtk_thin_up_frame,	1,1,2,2,0}, // FL_GTK_THIN_UP_FRAME,
+  {fl_gtk_thin_down_frame,	1,1,2,2,0}, // FL_GTK_THIN_DOWN_FRAME,
+  {fl_engraved_box,             2,2,4,4,1},
+  {fl_embossed_box,             2,2,4,4,1},
+  {fl_engraved_frame,           2,2,4,4,1},
+  {fl_embossed_frame,           2,2,4,4,1},
+  {fl_border_box,               1,1,2,2,1},
+  {fl_shadow_box,               1,1,5,5,0}, // FL_SHADOW_BOX,
+  {fl_border_frame,             1,1,2,2,1},
+  {fl_shadow_frame,             1,1,5,5,0}, // FL_SHADOW_FRAME,
+  
+  {fl_rounded_box,              1,1,2,2,0}, // FL_ROUNDED_BOX,
+  {fl_rshadow_box,              1,1,2,2,0}, // FL_RSHADOW_BOX,
+  {fl_rounded_frame,            1,1,2,2,0}, // FL_ROUNDED_FRAME
+  {fl_rflat_box,		0,0,0,0,0}, // FL_RFLAT_BOX,
+  {fl_gtk_round_up_box,		2,2,4,4,0}, // FL_GTK_ROUND_UP_BOX,
+  {fl_gtk_round_down_box,	2,2,4,4,0}, // FL_GTK_ROUND_DOWN_BOX,
+  {fl_diamond_up_box,		0,0,0,0,0}, // FL_DIAMOND_UP_BOX
+  {fl_diamond_down_box,		0,0,0,0,0}, // FL_DIAMOND_DOWN_BOX
+  
+  {fl_oval_box,                 1,1,2,2,0}, // FL_OVAL_BOX,
+  {fl_oval_shadow_box,          1,1,2,2,0}, // FL_OVAL_SHADOW_BOX,
+  {fl_oval_frame,               1,1,2,2,0}, // FL_OVAL_FRAME
+  {fl_oval_flat_box,		0,0,0,0,0}, // FL_OVAL_FLAT_BOX,
+  
+  {fl_plastic_up_box,		4,4,8,8,0}, // FL_PLASTIC_UP_BOX,
+  {fl_plastic_down_box,		2,2,4,4,0}, // FL_PLASTIC_DOWN_BOX,
+  {fl_plastic_up_frame,		2,2,4,4,0}, // FL_PLASTIC_UP_FRAME,
+  {fl_plastic_down_frame,	2,2,4,4,0}, // FL_PLASTIC_DOWN_FRAME,
+  {fl_plastic_thin_up_box,	2,2,4,4,0}, // FL_PLASTIC_THIN_UP_BOX,
+  {fl_plastic_down_box,		2,2,4,4,0}, // FL_PLASTIC_THIN_DOWN_BOX,
+  {fl_plastic_up_round,		2,2,4,4,0}, // FL_PLASTIC_ROUND_UP_BOX,
+  {fl_plastic_down_round,	2,2,4,4,0}, // FL_PLASTIC_ROUND_DOWN_BOX,
+  
+  {fl_classic_up_box,           D1,D1,D2,D2,1},
+  {fl_classic_down_box,         D1,D1,D2,D2,1},
+  {fl_classic_up_frame,         D1,D1,D2,D2,1},
+  {fl_classic_down_frame,       D1,D1,D2,D2,1},
+  {fl_classic_thin_up_box,      1,1,2,2,1},
+  {fl_classic_thin_down_box,    1,1,2,2,1},
+  {fl_classic_thin_up_frame,    1,1,2,2,1},
+  {fl_classic_thin_down_frame,  1,1,2,2,1},
+  {fl_classic_round_up_box,     2,2,4,4,0},
+  {fl_classic_round_down_box,   2,2,4,4,0},
+  
+  {fl_gtk_up_box,               3,3,6,6,0}, // FL_FREE_BOX+0
+  {fl_gtk_down_box,             3,3,6,6,0}, // FL_FREE_BOX+1
+  {fl_gtk_up_box,               3,3,6,6,0}, // FL_FREE_BOX+2
+  {fl_gtk_down_box,             3,3,6,6,0}, // FL_FREE_BOX+3
+  {fl_gtk_up_box,               3,3,6,6,0}, // FL_FREE_BOX+4
+  {fl_gtk_down_box,             3,3,6,6,0}, // FL_FREE_BOX+5
+  {fl_gtk_up_box,               3,3,6,6,0}, // FL_FREE_BOX+6
+  {fl_gtk_down_box,             3,3,6,6,0}, // FL_FREE_BOX+7
+};
+
+/**
+  Returns the X offset for the given boxtype.
+  \see box_dy()
+*/
+int fltk3::box_dx(fltk3::Boxtype t) {return fl_box_table[t&255].dx;}
+
+/**
+    Returns the Y offset for the given boxtype.
+
+    These functions return the offset values necessary for a given
+    boxtype, useful for computing the area inside a box's borders, to
+    prevent overdrawing the borders.
+
+    For instance, in the case of a boxtype like fltk3::DOWN_BOX
+    where the border width might be 2 pixels all around, the above 
+    functions would return 2, 2, 4, and 4 for box_dx, 
+    box_dy, box_dw, and box_dh respectively.
+
+    An example to compute the area inside a widget's box():
+    \code
+         int X = yourwidget->x() + fltk3::box_dx(yourwidget->box());
+         int Y = yourwidget->y() + fltk3::box_dy(yourwidget->box());
+         int W = yourwidget->w() - fltk3::box_dw(yourwidget->box());
+         int H = yourwidget->h() - fltk3::box_dh(yourwidget->box());
+    \endcode
+    These functions are mainly useful in the draw() code 
+    for deriving custom widgets, where one wants to avoid drawing 
+    over the widget's own border box().
+*/
+int fltk3::box_dy(fltk3::Boxtype t) {return fl_box_table[t&255].dy;}
+
+/**
+  Returns the width offset for the given boxtype.
+  \see box_dy().
+*/
+int fltk3::box_dw(fltk3::Boxtype t) {return fl_box_table[t&255].dw;}
+
+/**
+  Returns the height offset for the given boxtype.
+  \see box_dy().
+*/
+int fltk3::box_dh(fltk3::Boxtype t) {return fl_box_table[t&255].dh;}
+
+/**
+  Sets the drawing function for a given box type.
+  \param[in] t box type
+  \param[in] f box drawing function
+*/
+void fl_internal_boxtype(fltk3::Boxtype t, fltk3::BoxDrawF* f) {
+  if (!fl_box_table[t&255].set) {
+    fl_box_table[t&255].f   = f;
+    fl_box_table[t&255].set = 1;
+  }
+}
+
+/** Gets the current box drawing function for the specified box type. */
+fltk3::BoxDrawF *fltk3::get_boxtype(fltk3::Boxtype t) {
+  return fl_box_table[t&255].f;
+}
+/** Sets the function to call to draw a specific boxtype. */
+void fltk3::set_boxtype(fltk3::Boxtype t, fltk3::BoxDrawF* f,
+		      uchar a, uchar b, uchar c, uchar d) {
+  fl_box_table[t&255].f   = f;
+  fl_box_table[t&255].set = 1;
+  fl_box_table[t&255].dx  = a;
+  fl_box_table[t&255].dy  = b;
+  fl_box_table[t&255].dw  = c;
+  fl_box_table[t&255].dh  = d;
+}
+/** Copies the from boxtype. */
+void fltk3::set_boxtype(fltk3::Boxtype to, fltk3::Boxtype from) {
+  fl_box_table[to&255] = fl_box_table[from&255];
+}
+
+/**
+  Draws a box using given type, position, size and color.
+  \param[in] t box type
+  \param[in] x, y, w, h position and size
+  \param[in] c color
+*/
+void fltk3::draw_box(fltk3::Boxtype t, int x, int y, int w, int h, fltk3::Color c) {
+  if (t && fl_box_table[t&255].f) fl_box_table[t&255].f(x,y,w,h,c,t);
+}
+
+//extern fltk3::Widget *fl_boxcheat; // hack set by fltk3::Window.cxx
+/** Draws the widget box according its box style */
+void fltk3::Widget::draw_box() const {
+  if (box_) draw_box((fltk3::Boxtype)box_, x_, y_, w_, h_, color_);
+  draw_backdrop();
+}
+/** If fltk3::ALIGN_IMAGE_BACKDROP is set, the image or deimage will be drawn */
+void fltk3::Widget::draw_backdrop() const {
+  if (align() & fltk3::ALIGN_IMAGE_BACKDROP) {
+    const fltk3::Image *img = image();
+    // if there is no image, we will not draw the deimage either
+    if (img && deimage() && !active_r())
+      img = deimage();
+    if (img) 
+      ((fltk3::Image*)img)->draw(x_+(w_-img->w())/2, y_+(h_-img->h())/2);
+  }
+}
+/** Draws a box of type t, of color c at the widget's position and size. */
+void fltk3::Widget::draw_box(fltk3::Boxtype t, fltk3::Color c) const {
+  draw_box(t, x_, y_, w_, h_, c);
+}
+/** Draws a box of type t, of color c at the position X,Y and size W,H. */
+void fltk3::Widget::draw_box(fltk3::Boxtype t, int X, int Y, int W, int H, fltk3::Color c) const {
+  draw_it_active = active_r();
+  fl_box_table[t&255].f(X, Y, W, H, c, t);
+  draw_it_active = 1;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/call_main.cxx (from rev 9002, branches/branch-3.0/src/core/fl_call_main.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/call_main.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/call_main.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,143 @@
+/*
+ * "$Id$"
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * fl_call_main() calls main() for you Windows people.  Needs to be done in C
+ * because Borland C++ won't let you call main() from C++.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+/*
+ * This WinMain() function can be overridden by an application and
+ * is provided for compatibility with programs written for other
+ * operating systems that conform to the ANSI standard entry point
+ * "main()".  This will allow you to build a WIN32 Application
+ * without any special settings.
+ *
+ * Because of problems with the Microsoft Visual C++ header files
+ * and/or compiler, you cannot have a WinMain function in a DLL.
+ * I don't know why.  Thus, this nifty feature is only available
+ * if you link to the static library.
+ *
+ * Currently the debug version of this library will create a
+ * console window for your application so you can put printf()
+ * statements for debugging or informational purposes.  Ultimately
+ * we want to update this to always use the parent's console,
+ * but at present we have not identified a function or API in
+ * Microsoft(r) Windows(r) that allows for it.
+ */
+
+#if defined(WIN32) && !defined(FL_DLL) && !defined (__GNUC__)
+
+#  include <windows.h>
+#  include <stdio.h>
+#  include <stdlib.h>
+#  include <fltk3/utf8.h>
+
+extern int main(int, char *[]);
+
+#  ifdef BORLAND5
+#    define __argc _argc
+#    define __argv _argv
+#  endif /* BORLAND5 */
+
+/* static int mbcs2utf(const char *s, int l, char *dst, unsigned dstlen) */
+static int mbcs2utf(const char *s, int l, char *dst)
+{
+  static xchar *mbwbuf;
+  unsigned dstlen = 0;
+  if (!s) return 0;
+  dstlen = (l * 6) + 6;
+  mbwbuf = (xchar*)malloc(dstlen * sizeof(xchar));
+  l = mbstowcs(mbwbuf, s, l);
+/* l = fl_unicode2utf(mbwbuf, l, dst); */
+  l = fltk3::utf8fromwc(dst, dstlen, mbwbuf, l);
+  dst[l] = 0;
+  free(mbwbuf);
+  return l;
+}
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                             LPSTR lpCmdLine, int nCmdShow) {
+  int rc, i;
+  char **ar;
+
+#  ifdef _DEBUG
+ /*
+  * If we are using compiling in debug mode, open a console window so
+  * we can see any printf's, etc...
+  *
+  * While we can detect if the program was run from the command-line -
+  * look at the CMDLINE environment variable, it will be "WIN" for
+  * programs started from the GUI - the shell seems to run all WIN32
+  * applications in the background anyways...
+  */
+
+  AllocConsole();
+  freopen("conin$", "r", stdin);
+  freopen("conout$", "w", stdout);
+  freopen("conout$", "w", stderr);
+#  endif /* _DEBUG */
+
+  ar = (char**) malloc(sizeof(char*) * (__argc + 1));
+  i = 0;
+  while (i < __argc) {
+    int l;
+    unsigned dstlen;
+    if (__wargv ) {
+      for (l = 0; __wargv[i] && __wargv[i][l]; l++) {}; /* is this just wstrlen??? */
+      dstlen = (l * 5) + 1;
+      ar[i] = (char*) malloc(dstlen);
+/*    ar[i][fl_unicode2utf(__wargv[i], l, ar[i])] = 0; */
+      dstlen = fltk3::utf8fromwc(ar[i], dstlen, __wargv[i], l);
+      ar[i][dstlen] = 0;
+    } else {
+      for (l = 0; __argv[i] && __argv[i][l]; l++) {};
+      dstlen = (l * 5) + 1;
+      ar[i] = (char*) malloc(dstlen);
+/*      ar[i][mbcs2utf(__argv[i], l, ar[i], dstlen)] = 0; */
+      ar[i][mbcs2utf(__argv[i], l, ar[i])] = 0;
+    }
+    i++;
+  }
+  ar[__argc] = 0;
+  /* Run the standard main entry point function... */
+  rc = main(__argc, ar);
+
+#  ifdef _DEBUG
+  fclose(stdin);
+  fclose(stdout);
+  fclose(stderr);
+#  endif /* _DEBUG */
+
+  return rc;
+}
+
+#elif defined(__hpux)
+/* This code to prevent "empty translation unit" or similar warnings... */
+static void dummy(void) {}
+#endif /* WIN32 && !FL_DLL && !__GNUC__ */
+
+/*
+ * End of "$Id$".
+ */
+

Copied: branches/branch-3.0/src/fltk3/cgdebug.h (from rev 9002, branches/branch-3.0/src/core/cgdebug.h)
===================================================================
--- branches/branch-3.0/src/fltk3/cgdebug.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cgdebug.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,215 @@
+//
+// "$Id$"
+//
+// OS X Core Graphics debugging help for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This file allows easier debugging of Mac OS X Core Graphics 
+// code. This file is normally not included into any FLTK builds,
+// but since it has proven to be tremendously useful in debugging
+// the FLTK port to "Quartz", I decided to add this file in case
+// more bugs show up.
+//
+// This header is activated by adding the following
+// line to "config.h"
+//   #include "src/cgdebug.h"
+//
+// Running "./configure" will remove this line from "config.h".
+//
+// When used erreanously, Core Graphics prints warnings to 
+// stderr. This is helpful, however it is not possible to 
+// associate a line number or source file with the warning message.
+// This headr file outputs a trace of CG calls, interweaveing
+// them with CG warnings.
+//
+// Matthias
+
+#ifndef CGDEBUG
+#define CGDEBUG
+
+#include <stdio.h>
+#include <Carbon/Carbon.h>
+
+//+BitmapContextCreate
+//+BitmapContextGetData
+// ClipCGContextToRegion
+// QDBeginCGContext
+// QDEndCGContext
+
+//+AddArc
+//+AddLineToPoint
+// ClipToRect
+// ClosePath
+//+ConcatCTM
+//+DrawImage
+// FillPath
+// FillRect
+// Flush
+//+GetCTM
+// MoveToPoint
+//+Release
+// RestoreGState
+// SaveGState
+//+ScaleCTM
+//+SetLineCap
+//+SetLineDash
+//+SetLineJoin
+//+SetLineWidth
+//+SetRGBFillColor
+//+SetRGBStrokeColor
+//+SetShouldAntialias
+//+SetTextMatrix
+//+StrokePath
+//+TranslateCTM
+
+inline OSStatus dbgLocation(const char *file, int line) 
+{
+  fprintf(stderr, "%s:%d ", file, line);
+  return 0;
+}
+
+inline OSStatus dbgEndl()     
+{
+  fprintf(stderr, "\n");
+  return 0;
+}
+
+
+inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
+{
+  CGContextClipToRect(a, b);
+}
+
+#define CGContextClipToRect(a, b) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextClipToRect(a, b); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFillRect(CGContextRef a, CGRect b)
+{
+  CGContextFillRect(a, b);
+}
+
+#define CGContextFillRect(a, b) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextFillRect(a, b); \
+  fprintf(stderr, "\n"); }
+
+inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b) 
+{
+  return QDEndCGContext(a, b);
+}
+
+#define QDEndCGContext(a, b) ( \
+  dbgLocation(__FILE__, __LINE__) + \
+  dbgQDEndCGContext(a, b) + \
+  dbgEndl() )
+
+inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b) 
+{
+  return QDBeginCGContext(a, b);
+}
+
+#define QDBeginCGContext(a, b) ( \
+  dbgLocation(__FILE__, __LINE__) + \
+  dbgQDBeginCGContext(a, b) + \
+  dbgEndl() )
+
+inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c) 
+{
+  ClipCGContextToRegion(a, b, c);
+}
+
+#define ClipCGContextToRegion(a, b, c) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgClipCGContextToRegion(a, b, c); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextMoveToPoint(CGContextRef context, float x, float y)
+{
+  CGContextMoveToPoint(context, x, y);
+}
+
+#define CGContextMoveToPoint(a, b, c) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextMoveToPoint(a, b, c); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFillPath(CGContextRef context)
+{ 
+  CGContextFillPath(context);
+}
+
+#define CGContextFillPath(a) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextFillPath(a); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextClosePath(CGContextRef context)
+{ 
+  CGContextClosePath(context);
+}
+
+#define CGContextClosePath(a) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextClosePath(a); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextFlush(CGContextRef context)
+{ 
+  CGContextFlush(context);
+}
+
+#define CGContextFlush(a) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextFlush(a); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextSaveGState(CGContextRef context)
+{ 
+  CGContextSaveGState(context);
+}
+
+#define CGContextSaveGState(a) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextSaveGState(a); \
+  fprintf(stderr, "\n"); }
+
+inline void dbgCGContextRestoreGState(CGContextRef context)
+{ 
+  CGContextRestoreGState(context);
+}
+
+#define CGContextRestoreGState(a) { \
+  fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
+  dbgCGContextRestoreGState(a); \
+  fprintf(stderr, "\n"); }
+
+
+#endif
+
+//
+// End of "$Id$".
+//
+

Copied: branches/branch-3.0/src/fltk3/cmap.cxx (from rev 9002, branches/branch-3.0/src/core/cmap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cmap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cmap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,183 @@
+//
+// "$Id$"
+//
+// Colormap generation program for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This program produces the contents of "fl_cmap.h" as stdout
+
+// #include <gl/gl.h>
+#include <stdio.h>
+
+// This table is initialized with color values I got by reading the
+// colormap on an IRIX 4.3 machine:
+
+// "full intensity colors" have been turned down some to make white
+// background less intense by default.  The hope is that this will make
+// fltk programs more friendly on color-adjusted screens.  If you want
+// pure colors you should get them out of the colormap.
+
+//#define III 244 // maximum intensity of the basic colors
+
+// that results in errors and unshared colormap entries, so full intensity:
+#define III 255 // maximum intensity of the basic colors
+
+static short cmap[256][3] = {
+// 3-bit colormap:
+  {  0,  0,  0},	// black
+  {III,  0,  0},	// red
+  {  0,III,  0},	// green
+  {III,III,  0},	// yellow
+  {  0,  0,III},	// blue
+  {III,  0,III},	// magenta
+  {  0,III,III},	// cyan
+  {III,III,III},	// white
+// pastel versions of those colors, from SGI's standard color map:
+  { 85, 85, 85},	// 1/3 gray
+  {198,113,113},	// salmon? pale red?
+  {113,198,113},	// pale green
+  {142,142, 56},	// khaki
+  {113,113,198},	// pale blue
+  {142, 56,142},	// purple, orchid, pale magenta
+  { 56,142,142},	// cadet blue, aquamarine, pale cyan
+// The next location is used for fltk3::SELECTION_COLOR. It formerly was 2/3 gray
+// but this is changed to be the Windows blue color. This allows the default
+// behavior on both X and Windows to match:
+  {  0,  0,128},
+//{170,170,170},	// old 2/3 gray color
+// These next 16 are the fltk3::FREE_COLOR area. In some versions of fltk
+// these were filled with random colors that a Irix 5.3 machine placed
+// in these locations. Other versions of fltk filled this with the 1/3
+// gray above to discourage their use. This newest version uses colors
+// that NewTek has assigned for their GUI:
+#if 0
+  // The Irix 5.3 colors:
+  { 16, 16, 16},
+  {128, 40,128},
+  {198, 30, 30},
+  { 66, 30, 30},
+  {176,140,140},
+  {  0, 20, 20},
+  { 20, 10, 10},
+  { 40, 20, 20},
+  { 60, 30, 30},
+  {  0, 80, 80},
+  {  0, 40, 40},
+  { 20, 20,  0},
+  { 40, 40,  0},
+  { 80, 80, 10},
+  {150,150, 20},
+  {160, 10, 10},
+#else
+  // The NewTek colors: (from George Yohng)
+  {168,168,152},
+  {232,232,216},
+  {104,104, 88},
+  {152,168,168},
+  {216,232,232},
+  { 88,104,104},
+  {156,156,168},
+  {220,220,232},
+  { 92, 92,104},
+  {156,168,156},
+  {220,232,220},
+  { 92,104, 92},
+  {144,144,144},
+  {192,192,192},
+  { 80, 80, 80},
+  {160,160,160},
+#endif
+// The rest of the colormap is a gray ramp and table, filled in below:
+};
+
+// This is fltk3::background from Fl_get_system_colors.cxx, with modifications:
+
+namespace fltk3 {
+  const unsigned int GRAY_RAMP = 32;
+  const unsigned int NUM_GRAY  = 24;
+  const unsigned int GRAY = 49; // old value is 47
+}
+typedef unsigned char uchar;
+#include <math.h>
+
+void background(uchar r, uchar g, uchar b) {
+  // replace the gray ramp so that color 47 (by default 2/3) is this color
+  if (!r) r = 1; else if (r==255) r = 254;
+  double powr = log(r/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  if (!g) g = 1; else if (g==255) g = 254;
+  double powg = log(g/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  if (!b) b = 1; else if (b==255) b = 254;
+  double powb = log(b/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  for (int i = 0; i < fltk3::NUM_GRAY; i++) {
+    double gray = i/(fltk3::NUM_GRAY-1.0);
+    cmap[i+fltk3::GRAY_RAMP][0] = uchar(pow(gray,powr)*255+.5);
+    cmap[i+fltk3::GRAY_RAMP][1] = uchar(pow(gray,powg)*255+.5);
+    cmap[i+fltk3::GRAY_RAMP][2] = uchar(pow(gray,powb)*255+.5);
+  }
+}
+
+int main() {
+  int i,r,g,b;
+#if 0
+  /* Read colormap colors into internal table */
+  long cmwin;
+  noport();
+  cmwin = winopen("CM");
+  for (i=0; i<256; i++)
+    getmcolor(i,&cmap[i][0],&cmap[i][1],&cmap[i][2]);
+  winclose(cmwin);
+#endif
+// overwrite the X allocation area with one color so people are
+// discouraged from using it:
+  //for (i=16; i<32; i++) {cmap[i][0]=cmap[i][1]=cmap[i][2] = 85;}
+
+  // fill in the gray ramp:
+  background(0xc0, 0xc0, 0xc0); // microsoft colors
+  // background(170, 170, 170); // old fltk colors
+  // copy the 1/3 and 2/3 gray to the closest locations in gray ramp:
+  cmap[39][0] = cmap[39][1] = cmap[39][2] = 85;
+  cmap[47][0] = cmap[47][1] = cmap[47][2] = 170;
+
+  // fill in the color cube
+  i = 56;
+  for (b=0; b<5; b++)
+    for (r=0; r<5; r++)
+      for (g=0; g<8; g++) {
+	cmap[i][0] = r*255/4;
+	cmap[i][1] = g*255/7;
+	cmap[i][2] = b*255/4;
+	i++;
+      }
+
+  for (i=0; i<256; i++) {
+    printf("\t0x%02x%02x%02x00",cmap[i][0],cmap[i][1],cmap[i][2]);
+    if (i < 255) printf(",\n");
+  }
+  printf("\n");
+  return 0;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cmap.h (from rev 9002, branches/branch-3.0/src/core/fl_cmap.h)
===================================================================
--- branches/branch-3.0/src/fltk3/cmap.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cmap.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,256 @@
+	0x00000000,
+	0xff000000,
+	0x00ff0000,
+	0xffff0000,
+	0x0000ff00,
+	0xff00ff00,
+	0x00ffff00,
+	0xffffff00,
+	0x55555500,
+	0xc6717100,
+	0x71c67100,
+	0x8e8e3800,
+	0x7171c600,
+	0x8e388e00,
+	0x388e8e00,
+	0x00008000,
+	0xa8a89800,
+	0xe8e8d800,
+	0x68685800,
+	0x98a8a800,
+	0xd8e8e800,
+	0x58686800,
+	0x9c9ca800,
+	0xdcdce800,
+	0x5c5c6800,
+	0x9ca89c00,
+	0xdce8dc00,
+	0x5c685c00,
+	0x90909000,
+	0xc0c0c000,
+	0x50505000,
+	0xa0a0a000,
+	0x00000000,
+	0x0d0d0d00,
+	0x1a1a1a00,
+	0x26262600,
+	0x31313100,
+	0x3d3d3d00,
+	0x48484800,
+	0x55555500,
+	0x5f5f5f00,
+	0x6a6a6a00,
+	0x75757500,
+	0x80808000,
+	0x8a8a8a00,
+	0x95959500,
+	0xa0a0a000,
+	0xaaaaaa00,
+	0xb5b5b500,
+	0xc0c0c000,
+	0xcbcbcb00,
+	0xd5d5d500,
+	0xe0e0e000,
+	0xeaeaea00,
+	0xf5f5f500,
+	0xffffff00,
+	0x00000000,
+	0x00240000,
+	0x00480000,
+	0x006d0000,
+	0x00910000,
+	0x00b60000,
+	0x00da0000,
+	0x00ff0000,
+	0x3f000000,
+	0x3f240000,
+	0x3f480000,
+	0x3f6d0000,
+	0x3f910000,
+	0x3fb60000,
+	0x3fda0000,
+	0x3fff0000,
+	0x7f000000,
+	0x7f240000,
+	0x7f480000,
+	0x7f6d0000,
+	0x7f910000,
+	0x7fb60000,
+	0x7fda0000,
+	0x7fff0000,
+	0xbf000000,
+	0xbf240000,
+	0xbf480000,
+	0xbf6d0000,
+	0xbf910000,
+	0xbfb60000,
+	0xbfda0000,
+	0xbfff0000,
+	0xff000000,
+	0xff240000,
+	0xff480000,
+	0xff6d0000,
+	0xff910000,
+	0xffb60000,
+	0xffda0000,
+	0xffff0000,
+	0x00003f00,
+	0x00243f00,
+	0x00483f00,
+	0x006d3f00,
+	0x00913f00,
+	0x00b63f00,
+	0x00da3f00,
+	0x00ff3f00,
+	0x3f003f00,
+	0x3f243f00,
+	0x3f483f00,
+	0x3f6d3f00,
+	0x3f913f00,
+	0x3fb63f00,
+	0x3fda3f00,
+	0x3fff3f00,
+	0x7f003f00,
+	0x7f243f00,
+	0x7f483f00,
+	0x7f6d3f00,
+	0x7f913f00,
+	0x7fb63f00,
+	0x7fda3f00,
+	0x7fff3f00,
+	0xbf003f00,
+	0xbf243f00,
+	0xbf483f00,
+	0xbf6d3f00,
+	0xbf913f00,
+	0xbfb63f00,
+	0xbfda3f00,
+	0xbfff3f00,
+	0xff003f00,
+	0xff243f00,
+	0xff483f00,
+	0xff6d3f00,
+	0xff913f00,
+	0xffb63f00,
+	0xffda3f00,
+	0xffff3f00,
+	0x00007f00,
+	0x00247f00,
+	0x00487f00,
+	0x006d7f00,
+	0x00917f00,
+	0x00b67f00,
+	0x00da7f00,
+	0x00ff7f00,
+	0x3f007f00,
+	0x3f247f00,
+	0x3f487f00,
+	0x3f6d7f00,
+	0x3f917f00,
+	0x3fb67f00,
+	0x3fda7f00,
+	0x3fff7f00,
+	0x7f007f00,
+	0x7f247f00,
+	0x7f487f00,
+	0x7f6d7f00,
+	0x7f917f00,
+	0x7fb67f00,
+	0x7fda7f00,
+	0x7fff7f00,
+	0xbf007f00,
+	0xbf247f00,
+	0xbf487f00,
+	0xbf6d7f00,
+	0xbf917f00,
+	0xbfb67f00,
+	0xbfda7f00,
+	0xbfff7f00,
+	0xff007f00,
+	0xff247f00,
+	0xff487f00,
+	0xff6d7f00,
+	0xff917f00,
+	0xffb67f00,
+	0xffda7f00,
+	0xffff7f00,
+	0x0000bf00,
+	0x0024bf00,
+	0x0048bf00,
+	0x006dbf00,
+	0x0091bf00,
+	0x00b6bf00,
+	0x00dabf00,
+	0x00ffbf00,
+	0x3f00bf00,
+	0x3f24bf00,
+	0x3f48bf00,
+	0x3f6dbf00,
+	0x3f91bf00,
+	0x3fb6bf00,
+	0x3fdabf00,
+	0x3fffbf00,
+	0x7f00bf00,
+	0x7f24bf00,
+	0x7f48bf00,
+	0x7f6dbf00,
+	0x7f91bf00,
+	0x7fb6bf00,
+	0x7fdabf00,
+	0x7fffbf00,
+	0xbf00bf00,
+	0xbf24bf00,
+	0xbf48bf00,
+	0xbf6dbf00,
+	0xbf91bf00,
+	0xbfb6bf00,
+	0xbfdabf00,
+	0xbfffbf00,
+	0xff00bf00,
+	0xff24bf00,
+	0xff48bf00,
+	0xff6dbf00,
+	0xff91bf00,
+	0xffb6bf00,
+	0xffdabf00,
+	0xffffbf00,
+	0x0000ff00,
+	0x0024ff00,
+	0x0048ff00,
+	0x006dff00,
+	0x0091ff00,
+	0x00b6ff00,
+	0x00daff00,
+	0x00ffff00,
+	0x3f00ff00,
+	0x3f24ff00,
+	0x3f48ff00,
+	0x3f6dff00,
+	0x3f91ff00,
+	0x3fb6ff00,
+	0x3fdaff00,
+	0x3fffff00,
+	0x7f00ff00,
+	0x7f24ff00,
+	0x7f48ff00,
+	0x7f6dff00,
+	0x7f91ff00,
+	0x7fb6ff00,
+	0x7fdaff00,
+	0x7fffff00,
+	0xbf00ff00,
+	0xbf24ff00,
+	0xbf48ff00,
+	0xbf6dff00,
+	0xbf91ff00,
+	0xbfb6ff00,
+	0xbfdaff00,
+	0xbfffff00,
+	0xff00ff00,
+	0xff24ff00,
+	0xff48ff00,
+	0xff6dff00,
+	0xff91ff00,
+	0xffb6ff00,
+	0xffdaff00,
+	0xffffff00

Copied: branches/branch-3.0/src/fltk3/cocoa.mm (from rev 9010, branches/branch-3.0/src/core/Fl_cocoa.mm)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa.mm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa.mm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,3480 @@
+//
+// "$Id$"
+//
+// MacOS-Cocoa specific code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//// From the inner edge of a MetroWerks CodeWarrior CD:
+// (without permission)
+//
+// "Three Compiles for 68Ks under the sky,
+// Seven Compiles for PPCs in their fragments of code,
+// Nine Compiles for Mortal Carbon doomed to die,
+// One Compile for Mach-O Cocoa on its Mach-O throne,
+// in the Land of MacOS X where the Drop-Shadows lie.
+// 
+// One Compile to link them all, One Compile to merge them,
+// One Compile to copy them all and in the bundle bind them,
+// in the Land of MacOS X where the Drop-Shadows lie."
+
+#ifdef __APPLE__
+
+#define CONSOLIDATE_MOTION 0
+extern "C" {
+#include <pthread.h>
+}
+
+
+#include <fltk3/run.h>
+#include <fltk3/filename.h>
+#include <fltk3/x.h>
+#include <fltk3/Window.h>
+#include <fltk3/Tooltip.h>
+#include <fltk3/SysMenuBar.h>
+#include <fltk3/Printer.h>
+#include <fltk3/Input_.h>
+#include <fltk3/TextDisplay.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <unistd.h>
+#include <stdarg.h>
+
+#import <Cocoa/Cocoa.h>
+
+#ifndef NSINTEGER_DEFINED // appears with 10.5 in NSObjCRuntime.h
+#if defined(__LP64__) && __LP64__
+typedef long NSInteger;
+typedef unsigned long NSUInteger;
+#else
+typedef long NSInteger;
+typedef unsigned int NSUInteger;
+#endif
+#endif
+
+
+// #define DEBUG_SELECT		// UNCOMMENT FOR SELECT()/THREAD DEBUGGING
+#ifdef DEBUG_SELECT
+#include <stdio.h>		// testing
+#define DEBUGMSG(msg)		if ( msg ) fprintf(stderr, msg);
+#define DEBUGPERRORMSG(msg)	if ( msg ) perror(msg)
+#define DEBUGTEXT(txt)		txt
+#else
+#define DEBUGMSG(msg)
+#define DEBUGPERRORMSG(msg)
+#define DEBUGTEXT(txt)		NULL
+#endif /*DEBUG_SELECT*/
+
+// external functions
+extern void fl_fix_focus();
+extern fltk3::Offscreen fl_create_offscreen_with_alpha(int w, int h);
+
+// forward definition of functions in this file
+// converting cr lf converter function
+static void convert_crlf(char * string, size_t len);
+static void createAppleMenu(void);
+static fltk3::Region MacRegionMinusRect(fltk3::Region r, int x,int y,int w,int h);
+static void cocoaMouseHandler(NSEvent *theEvent);
+
+static fltk3::QuartzGraphicsDriver fl_quartz_driver;
+static fltk3::DisplayDevice fl_quartz_display(&fl_quartz_driver);
+FLTK3_EXPORT fltk3::GraphicsDriver *fltk3::graphics_driver = (fltk3::GraphicsDriver*)&fl_quartz_driver; // the current target device of graphics operations
+fltk3::SurfaceDevice* fltk3::SurfaceDevice::_surface = (fltk3::SurfaceDevice*)&fl_quartz_display; // the current target surface of graphics operations
+fltk3::DisplayDevice *fltk3::DisplayDevice::_display = &fl_quartz_display; // the platform display
+
+// public variables
+int fl_screen;
+CGContextRef fl_gc = 0;
+void *fl_system_menu;                   // this is really a NSMenu*
+fltk3::SysMenuBar *fltk3::sys_menu_bar = 0;
+void *fl_default_cursor;		// this is really a NSCursor*
+void *fl_capture = 0;			// (NSWindow*) we need this to compensate for a missing(?) mouse capture
+bool fl_show_iconic;                    // true if called from iconize() - shows the next created window in collapsed state
+//int fl_disable_transient_for;           // secret method of removing TRANSIENT_FOR
+Window fl_window;
+fltk3::Window *fltk3::Window::current_;
+int fl_mac_os_version = 0;		// the version number of the running Mac OS X (e.g., 100604 for 10.6.4)
+
+// forward declarations of variables in this file
+static int got_events = 0;
+static fltk3::Window* resize_from_system;
+
+#if CONSOLIDATE_MOTION
+static fltk3::Window* send_motion;
+extern fltk3::Window* fl_xmousewin;
+#endif
+
+enum { FLTKTimerEvent = 1, FLTKDataReadyEvent };
+
+
+/* fltk-utf8 placekeepers */
+void fltk3::reset_spot()
+{
+}
+
+void fltk3::set_spot(int font, int size, int X, int Y, int W, int H, fltk3::Window *win)
+{
+}
+
+void fltk3::set_status(int x, int y, int w, int h)
+{
+}
+
+/*
+ * Mac keyboard lookup table
+ * See also the inverse converter vktab in Fl_get_key_mac.cxx
+ */
+static unsigned short macKeyLookUp[128] =
+{
+  'a', 's', 'd', 'f', 'h', 'g', 'z', 'x',
+  'c', 'v', '^', 'b', 'q', 'w', 'e', 'r',
+  
+  'y', 't', '1', '2', '3', '4', '6', '5',
+  '=', '9', '7', '-', '8', '0', ']', 'o',
+  
+  'u', '[', 'i', 'p', fltk3::EnterKey, 'l', 'j', '\'',
+  'k', ';', '\\', ',', '/', 'n', 'm', '.',
+  
+  fltk3::TabKey, ' ', '`', fltk3::BackSpaceKey, 
+  fltk3::KPEnterKey, fltk3::EscapeKey, fltk3::MetaRKey, fltk3::MetaLKey,
+  fltk3::ShiftLKey, fltk3::CapsLockKey, fltk3::AltLKey, fltk3::ControlLKey, 
+  fltk3::ShiftRKey, fltk3::AltRKey, fltk3::ControlRKey, 0/*fltk3::FKey*/,
+  
+  0, fltk3::KPKey+'.', fltk3::RightKey, fltk3::KPKey+'*', 0, fltk3::KPKey+'+', fltk3::LeftKey, fltk3::NumLockKey,
+  fltk3::DownKey, 0, 0, fltk3::KPKey+'/', fltk3::KPEnterKey, fltk3::UpKey, fltk3::KPKey+'-', 0,
+  
+  0, fltk3::KPKey+'=', fltk3::KPKey+'0', fltk3::KPKey+'1', fltk3::KPKey+'2', fltk3::KPKey+'3', fltk3::KPKey+'4', fltk3::KPKey+'5',
+  fltk3::KPKey+'6', fltk3::KPKey+'7', 0, fltk3::KPKey+'8', fltk3::KPKey+'9', 0, 0, 0,
+  
+  fltk3::FKey+5, fltk3::FKey+6, fltk3::FKey+7, fltk3::FKey+3, fltk3::FKey+8, fltk3::FKey+9, 0, fltk3::FKey+11,
+  0, fltk3::FKey+13, fltk3::FKey+16, fltk3::FKey+14, 0, fltk3::FKey+10, fltk3::MenuKey, fltk3::FKey+12,
+  
+  0, fltk3::FKey+15, fltk3::HelpKey, fltk3::HomeKey, fltk3::PageUpKey, fltk3::DeleteKey, fltk3::FKey+4, fltk3::EndKey,
+  fltk3::FKey+2, fltk3::PageDownKey, fltk3::FKey+1, fltk3::LeftKey, fltk3::RightKey, fltk3::DownKey, fltk3::UpKey, 0/*FL_Power*/,
+};
+
+/*
+ * convert the current mouse chord into the FLTK modifier state
+ */
+static unsigned int mods_to_e_state( NSUInteger mods )
+{
+  long state = 0;
+  if ( mods & NSCommandKeyMask ) state |= fltk3::META;
+  if ( mods & NSAlternateKeyMask ) state |= fltk3::ALT;
+  if ( mods & NSControlKeyMask ) state |= fltk3::CTRL;
+  if ( mods & NSShiftKeyMask ) state |= fltk3::SHIFT;
+  if ( mods & NSAlphaShiftKeyMask ) state |= fltk3::CAPS_LOCK;
+  unsigned int ret = ( fltk3::e_state & 0xff000000 ) | state;
+  fltk3::e_state = ret;
+  //printf( "State 0x%08x (%04x)\n", fltk3::e_state, mods );
+  return ret;
+}
+
+// these pointers are set by the fltk3::lock() function:
+static void nothing() {}
+void (*fl_lock_function)() = nothing;
+void (*fl_unlock_function)() = nothing;
+
+//
+// Select interface -- how it's implemented:
+//     When the user app configures one or more file descriptors to monitor
+//     with fltk3::add_fd(), we start a separate thread to select() the  data,
+//     sending a custom OSX 'FLTK data ready event' to the parent  thread's
+//     RunApplicationLoop(), so that it triggers the data  ready  callbacks
+//     in the parent thread.                               -erco 04/04/04
+//     
+#define POLLIN  1
+#define POLLOUT 4
+#define POLLERR 8
+
+// Class to handle select() 'data ready'
+class DataReady
+{
+  struct FD
+  {
+    int fd;
+    short events;
+    void (*cb)(int, void*);
+    void* arg;
+  };
+  int nfds, fd_array_size;
+  FD *fds;
+  pthread_t tid;		// select()'s thread id
+  
+  // Data that needs to be locked (all start with '_')
+  pthread_mutex_t _datalock;	// data lock
+  fd_set _fdsets[3];		// r/w/x sets user wants to monitor
+  int _maxfd;			// max fd count to monitor
+  int _cancelpipe[2];		// pipe used to help cancel thread
+  
+public:
+  DataReady()
+  {
+    nfds = 0;
+    fd_array_size = 0;
+    fds = 0;
+    tid = 0;
+    
+    pthread_mutex_init(&_datalock, NULL);
+    FD_ZERO(&_fdsets[0]); FD_ZERO(&_fdsets[1]); FD_ZERO(&_fdsets[2]);
+    _cancelpipe[0] = _cancelpipe[1] = 0;
+    _maxfd = -1;
+  }
+  
+  ~DataReady()
+  {
+    CancelThread(DEBUGTEXT("DESTRUCTOR\n"));
+    if (fds) { free(fds); fds = 0; }
+    nfds = 0;
+  }
+  
+  // Locks
+  //    The convention for locks: volatile vars start with '_',
+  //    and must be locked before use. Locked code is prefixed 
+  //    with /*LOCK*/ to make painfully obvious esp. in debuggers. -erco
+  //
+  void DataLock() { pthread_mutex_lock(&_datalock); }
+  void DataUnlock() { pthread_mutex_unlock(&_datalock); }
+  
+  // Accessors
+  int IsThreadRunning() { return(tid ? 1 : 0); }
+  int GetNfds() { return(nfds); }
+  int GetCancelPipe(int ix) { return(_cancelpipe[ix]); }
+  fd_set GetFdset(int ix) { return(_fdsets[ix]); }
+  
+  // Methods
+  void AddFD(int n, int events, void (*cb)(int, void*), void *v);
+  void RemoveFD(int n, int events);
+  int CheckData(fd_set& r, fd_set& w, fd_set& x);
+  void HandleData(fd_set& r, fd_set& w, fd_set& x);
+  static void* DataReadyThread(void *self);
+  void StartThread(void);
+  void CancelThread(const char *reason);
+};
+
+static DataReady dataready;
+
+void DataReady::AddFD(int n, int events, void (*cb)(int, void*), void *v)
+{
+  RemoveFD(n, events);
+  int i = nfds++;
+  if (i >= fd_array_size) 
+  {
+    fl_open_display(); // necessary for NSApp to be defined and the event loop to work
+    FD *temp;
+    fd_array_size = 2*fd_array_size+1;
+    if (!fds) { temp = (FD*)malloc(fd_array_size*sizeof(FD)); }
+    else { temp = (FD*)realloc(fds, fd_array_size*sizeof(FD)); }
+    if (!temp) return;
+    fds = temp;
+  }
+  fds[i].cb  = cb;
+  fds[i].arg = v;
+  fds[i].fd  = n;
+  fds[i].events = events;
+  DataLock();
+  /*LOCK*/  if (events & POLLIN)  FD_SET(n, &_fdsets[0]);
+  /*LOCK*/  if (events & POLLOUT) FD_SET(n, &_fdsets[1]);
+  /*LOCK*/  if (events & POLLERR) FD_SET(n, &_fdsets[2]);
+  /*LOCK*/  if (n > _maxfd) _maxfd = n;
+  DataUnlock();
+}
+
+// Remove an FD from the array
+void DataReady::RemoveFD(int n, int events)
+{
+  int i,j;
+  _maxfd = -1; // recalculate maxfd on the fly
+  for (i=j=0; i<nfds; i++) {
+    if (fds[i].fd == n) {
+      int e = fds[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      fds[i].events = e;
+    }
+    if (fds[i].fd > _maxfd) _maxfd = fds[i].fd;
+    // move it down in the array if necessary:
+    if (j<i) {
+      fds[j] = fds[i];
+    }
+    j++;
+  }
+  nfds = j;
+  DataLock();
+  /*LOCK*/  if (events & POLLIN)  FD_CLR(n, &_fdsets[0]);
+  /*LOCK*/  if (events & POLLOUT) FD_CLR(n, &_fdsets[1]);
+  /*LOCK*/  if (events & POLLERR) FD_CLR(n, &_fdsets[2]);
+  DataUnlock();
+}
+
+// CHECK IF USER DATA READY, RETURNS r/w/x INDICATING WHICH IF ANY
+int DataReady::CheckData(fd_set& r, fd_set& w, fd_set& x)
+{
+  int ret;
+  DataLock();
+  /*LOCK*/  timeval t = { 0, 1 };		// quick check
+  /*LOCK*/  r = _fdsets[0], w = _fdsets[1], x = _fdsets[2];
+  /*LOCK*/  ret = ::select(_maxfd+1, &r, &w, &x, &t);
+  DataUnlock();
+  if ( ret == -1 ) {
+    DEBUGPERRORMSG("CheckData(): select()");
+  }
+  return(ret);
+}
+
+// HANDLE DATA READY CALLBACKS
+void DataReady::HandleData(fd_set& r, fd_set& w, fd_set& x)
+{
+  for (int i=0; i<nfds; i++) {
+    int f = fds[i].fd;
+    short revents = 0;
+    if (FD_ISSET(f, &r)) revents |= POLLIN;
+    if (FD_ISSET(f, &w)) revents |= POLLOUT;
+    if (FD_ISSET(f, &x)) revents |= POLLERR;
+    if (fds[i].events & revents) {
+      DEBUGMSG("DOING CALLBACK: ");
+      fds[i].cb(f, fds[i].arg);
+      DEBUGMSG("DONE\n");
+    }
+  }
+}
+
+// DATA READY THREAD
+//    This thread watches for changes in user's file descriptors.
+//    Sends a 'data ready event' to the main thread if any change.
+//
+void* DataReady::DataReadyThread(void *o)
+{
+  DataReady *self = (DataReady*)o;
+  NSAutoreleasePool *localPool;
+  localPool = [[NSAutoreleasePool alloc] init]; 
+  while ( 1 ) {					// loop until thread cancel or error
+    // Thread safe local copies of data before each select()
+    self->DataLock();
+    /*LOCK*/  int maxfd = self->_maxfd;
+    /*LOCK*/  fd_set r = self->GetFdset(0);
+    /*LOCK*/  fd_set w = self->GetFdset(1);
+    /*LOCK*/  fd_set x = self->GetFdset(2);
+    /*LOCK*/  int cancelpipe = self->GetCancelPipe(0);
+    /*LOCK*/  if ( cancelpipe > maxfd ) maxfd = cancelpipe;
+    /*LOCK*/  FD_SET(cancelpipe, &r);		// add cancelpipe to fd's to watch
+    /*LOCK*/  FD_SET(cancelpipe, &x);
+    self->DataUnlock();
+    // timeval t = { 1000, 0 };	// 1000 seconds;
+    timeval t = { 2, 0 };	// HACK: 2 secs prevents 'hanging' problem
+    int ret = ::select(maxfd+1, &r, &w, &x, &t);
+    pthread_testcancel();	// OSX 10.0.4 and older: needed for parent to cancel
+    switch ( ret ) {
+      case 0:	// NO DATA
+        continue;
+      case -1:	// ERROR
+      {
+        DEBUGPERRORMSG("CHILD THREAD: select() failed");
+        return(NULL);		// error? exit thread
+      }
+      default:	// DATA READY
+      {
+        if (FD_ISSET(cancelpipe, &r) || FD_ISSET(cancelpipe, &x)) 	// cancel?
+	  { return(NULL); }						// just exit
+        DEBUGMSG("CHILD THREAD: DATA IS READY\n");
+        NSPoint pt={0,0};
+        NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:pt 
+				       modifierFlags:0
+                                           timestamp:0
+                                        windowNumber:0 context:NULL 
+					     subtype:FLTKDataReadyEvent data1:0 data2:0];
+        [NSApp postEvent:event atStart:NO];
+        return(NULL);		// done with thread
+      }
+    }
+  }
+}
+
+// START 'DATA READY' THREAD RUNNING, CREATE INTER-THREAD PIPE
+void DataReady::StartThread(void)
+{
+  CancelThread(DEBUGTEXT("STARTING NEW THREAD\n"));
+  DataLock();
+  /*LOCK*/  pipe(_cancelpipe);	// pipe for sending cancel msg to thread
+  DataUnlock();
+  DEBUGMSG("*** START THREAD\n");
+  pthread_create(&tid, NULL, DataReadyThread, (void*)this);
+}
+
+// CANCEL 'DATA READY' THREAD, CLOSE PIPE
+void DataReady::CancelThread(const char *reason)
+{
+  if ( tid ) {
+    DEBUGMSG("*** CANCEL THREAD: ");
+    DEBUGMSG(reason);
+    if ( pthread_cancel(tid) == 0 ) {		// cancel first
+      DataLock();
+      /*LOCK*/  write(_cancelpipe[1], "x", 1);	// wake thread from select
+      DataUnlock();
+      pthread_join(tid, NULL);			// wait for thread to finish
+    }
+    tid = 0;
+    DEBUGMSG("(JOINED) OK\n");
+  }
+  // Close pipe if open
+  DataLock();
+  /*LOCK*/  if ( _cancelpipe[0] ) { close(_cancelpipe[0]); _cancelpipe[0] = 0; }
+  /*LOCK*/  if ( _cancelpipe[1] ) { close(_cancelpipe[1]); _cancelpipe[1] = 0; }
+  DataUnlock();
+}
+
+void fltk3::add_fd( int n, int events, void (*cb)(int, void*), void *v )
+{
+  dataready.AddFD(n, events, cb, v);
+}
+
+void fltk3::add_fd(int fd, void (*cb)(int, void*), void* v)
+{
+  dataready.AddFD(fd, POLLIN, cb, v);
+}
+
+void fltk3::remove_fd(int n, int events)
+{
+  dataready.RemoveFD(n, events);
+}
+
+void fltk3::remove_fd(int n)
+{
+  dataready.RemoveFD(n, -1);
+}
+
+/*
+ * Check if there is actually a message pending!
+ */
+int fl_ready()
+{
+  NSEvent *retval = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
+				    inMode:NSDefaultRunLoopMode dequeue:NO];
+  return retval != nil;
+}
+
+
+static void processFLTKEvent(void) {
+  fl_lock_function();
+  dataready.CancelThread(DEBUGTEXT("DATA READY EVENT\n"));
+  
+  // CHILD THREAD TELLS US DATA READY
+  //     Check to see what's ready, and invoke user's cb's
+  //
+  fd_set r,w,x;
+  switch(dataready.CheckData(r,w,x)) {
+    case 0:	// NO DATA
+      break;
+    case -1:	// ERROR
+      break;
+    default:	// DATA READY
+      dataready.HandleData(r,w,x);
+      break;
+  }
+  fl_unlock_function();
+  return;
+}
+
+
+/*
+ * break the current event loop
+ */
+static void breakMacEventLoop()
+{
+  fl_lock_function();
+  
+  NSPoint pt={0,0};
+  NSEvent *event = [NSEvent otherEventWithType:NSApplicationDefined location:pt 
+				 modifierFlags:0
+                                     timestamp:0
+                                  windowNumber:0 context:NULL 
+				       subtype:FLTKTimerEvent data1:0 data2:0];
+  [NSApp postEvent:event atStart:NO];
+  fl_unlock_function();
+}
+
+//
+// MacOS X timers
+//
+
+struct MacTimeout {
+  fltk3::TimeoutHandler callback;
+  void* data;
+  CFRunLoopTimerRef timer;
+  char pending; 
+};
+static MacTimeout* mac_timers;
+static int mac_timer_alloc;
+static int mac_timer_used;
+
+static void realloc_timers()
+{
+  if (mac_timer_alloc == 0) {
+    mac_timer_alloc = 8;
+    fl_open_display(); // needed because the timer creates an event
+  }
+  mac_timer_alloc *= 2;
+  MacTimeout* new_timers = new MacTimeout[mac_timer_alloc];
+  memset(new_timers, 0, sizeof(MacTimeout)*mac_timer_alloc);
+  memcpy(new_timers, mac_timers, sizeof(MacTimeout) * mac_timer_used);
+  MacTimeout* delete_me = mac_timers;
+  mac_timers = new_timers;
+  delete [] delete_me;
+}
+
+static void delete_timer(MacTimeout& t)
+{
+  if (t.timer) {
+    CFRunLoopRemoveTimer(CFRunLoopGetCurrent(),
+		      t.timer,
+		      kCFRunLoopDefaultMode);
+    CFRelease(t.timer);
+    memset(&t, 0, sizeof(MacTimeout));
+  }
+}
+
+static void do_timer(CFRunLoopTimerRef timer, void* data)
+{
+  for (int i = 0;  i < mac_timer_used;  ++i) {
+    MacTimeout& t = mac_timers[i];
+    if (t.timer == timer  &&  t.data == data) {
+      t.pending = 0;
+      (*t.callback)(data);
+      if (t.pending==0)
+        delete_timer(t);
+      break;
+    }
+  }
+  breakMacEventLoop();
+}
+
+@interface FLWindow : NSWindow {
+  fltk3::Window *w;
+  BOOL containsGLsubwindow;
+}
+- (FLWindow*)initWithFl_W:(fltk3::Window *)flw 
+	      contentRect:(NSRect)rect 
+		styleMask:(NSUInteger)windowStyle;
+- (fltk3::Window *)getFl_Window;
+- (BOOL)windowShouldClose:(FLWindow *)w;
+- (BOOL)containsGLsubwindow;
+- (void)setContainsGLsubwindow:(BOOL)contains;
+@end
+
+@implementation FLWindow
+- (FLWindow*)initWithFl_W:(fltk3::Window *)flw 
+	      contentRect:(NSRect)rect 
+		styleMask:(NSUInteger)windowStyle 
+{
+  self = [super initWithContentRect:rect styleMask:windowStyle backing:NSBackingStoreBuffered defer:NO];
+  if (self) {
+    w = flw;
+    containsGLsubwindow = NO;
+  }
+  return self;
+}
+- (fltk3::Window *)getFl_Window;
+{
+  return w;
+}
+- (BOOL)windowShouldClose:(FLWindow *)fl
+{
+  fl_lock_function();
+  fltk3::handle( fltk3::CLOSE, [fl getFl_Window] ); // this might or might not close the window
+  if (!Fl_X::first) return YES;
+  fltk3::Window *l = fltk3::first_window();
+  while( l != NULL && l != [fl getFl_Window]) l = fltk3::next_window(l);
+  fl_unlock_function();
+  return (l == NULL ? YES : NO);
+}
+- (BOOL)containsGLsubwindow
+{
+  return containsGLsubwindow;
+}
+- (void)setContainsGLsubwindow:(BOOL)contains
+{
+  containsGLsubwindow = contains;
+}
+@end
+
+@interface FLApplication : NSObject
+{
+}
++ (void)sendEvent:(NSEvent *)theEvent;
+@end
+
+/*
+ * This function is the central event handler.
+ * It reads events from the event queue using the given maximum time
+ * Funny enough, it returns the same time that it got as the argument. 
+ */
+static double do_queued_events( double time = 0.0 ) 
+{
+  got_events = 0;
+  
+  // Check for re-entrant condition
+  if ( dataready.IsThreadRunning() ) {
+    dataready.CancelThread(DEBUGTEXT("AVOID REENTRY\n"));
+  }
+  
+  // Start thread to watch for data ready
+  if ( dataready.GetNfds() ) {
+    dataready.StartThread();
+  }
+  
+  fl_unlock_function();
+  NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask 
+                                      untilDate:[NSDate dateWithTimeIntervalSinceNow:time] 
+                                         inMode:NSDefaultRunLoopMode dequeue:YES];  
+  if (event != nil) {
+    got_events = 1;
+    [FLApplication sendEvent:event]; // will then call [NSApplication sendevent:]
+  }
+  fl_lock_function();
+  
+#if CONSOLIDATE_MOTION
+  if (send_motion && send_motion == fl_xmousewin) {
+    send_motion = 0;
+    fltk3::handle(fltk3::MOVE, fl_xmousewin);
+  }
+#endif
+  
+  return time;
+}
+
+/*
+ * This public function handles all events. It wait a maximum of 
+ * 'time' seconds for an event. This version returns 1 if events
+ * other than the timeout timer were processed.
+ *
+ * \todo there is no socket handling in this code whatsoever
+ */
+int fl_wait( double time ) 
+{
+  do_queued_events( time );
+  return (got_events);
+}
+
+double fl_mac_flush_and_wait(double time_to_wait, char in_idle) {
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+  fltk3::flush();
+  if (fltk3::idle && !in_idle) // 'idle' may have been set within flush()
+    time_to_wait = 0.0;
+  double retval = fl_wait(time_to_wait);
+  [pool release];
+  return retval;
+}
+
+// updates fltk3::e_x, fltk3::e_y, fltk3::e_x_root, and fltk3::e_y_root
+static void update_e_xy_and_e_xy_root(NSWindow *nsw)
+{
+  NSPoint pt;
+  pt = [nsw mouseLocationOutsideOfEventStream];
+  fltk3::e_x = int(pt.x);
+  fltk3::e_y = int([[nsw contentView] frame].size.height - pt.y);
+  pt = [NSEvent mouseLocation];
+  fltk3::e_x_root = int(pt.x);
+  fltk3::e_y_root = int([[nsw screen] frame].size.height - pt.y);
+}
+
+/*
+ * Cocoa Mousewheel handler
+ */
+static void cocoaMouseWheelHandler(NSEvent *theEvent)
+{
+  // Handle the new "MightyMouse" mouse wheel events. Please, someone explain
+  // to me why Apple changed the API on this even though the current API
+  // supports two wheels just fine. Matthias,
+  fl_lock_function();
+  
+  fltk3::Window *window = (fltk3::Window*)[(FLWindow*)[theEvent window] getFl_Window];
+  if ( !window->shown() ) {
+    fl_unlock_function();
+    return;
+  }
+  fltk3::first_window(window);
+  
+  // Under OSX, single mousewheel increments are 0.1,
+  // so make sure they show up as at least 1..
+  //
+  float dx = [theEvent deltaX]; if ( fabs(dx) < 1.0 ) dx = (dx > 0) ? 1.0 : -1.0;
+  float dy = [theEvent deltaY]; if ( fabs(dy) < 1.0 ) dy = (dy > 0) ? 1.0 : -1.0;
+  if ([theEvent deltaX] != 0) {
+    fltk3::e_dx = (int)-dx;
+    fltk3::e_dy = 0;
+    if ( fltk3::e_dx) fltk3::handle( fltk3::MOUSEWHEEL, window );
+  } else if ([theEvent deltaY] != 0) {
+    fltk3::e_dx = 0;
+    fltk3::e_dy = (int)-dy;
+    if ( fltk3::e_dy) fltk3::handle( fltk3::MOUSEWHEEL, window );
+  } else {
+    fl_unlock_function();
+    return;
+  }
+  
+  fl_unlock_function();
+  
+  //  return noErr;
+}
+
+/*
+ * Cocoa Mouse Button Handler
+ */
+static void cocoaMouseHandler(NSEvent *theEvent)
+{
+  static int keysym[] = { 0, fltk3::MouseButton+1, fltk3::MouseButton+3, fltk3::MouseButton+2 };
+  static int px, py;
+  static char suppressed = 0;
+  
+  fl_lock_function();
+  
+  fltk3::Window *window = (fltk3::Window*)[(FLWindow*)[theEvent window] getFl_Window];
+  if ( !window->shown() ) {
+    fl_unlock_function();
+    return;
+  }
+  fltk3::Window *first = fltk3::first_window();
+  if (first != window && !(first->modal() || first->non_modal())) fltk3::first_window(window);
+  NSPoint pos = [theEvent locationInWindow];
+  pos.y = window->h() - pos.y;
+  NSInteger btn = [theEvent buttonNumber]  + 1;
+  NSUInteger mods = [theEvent modifierFlags];  
+  int sendEvent = 0;
+  
+  NSEventType etype = [theEvent type];
+  if (etype == NSLeftMouseDown || etype == NSRightMouseDown || etype == NSOtherMouseDown) {
+    if (btn == 1) fltk3::e_state |= fltk3::BUTTON1;
+    else if (btn == 3) fltk3::e_state |= fltk3::BUTTON2;
+    else if (btn == 2) fltk3::e_state |= fltk3::BUTTON3;
+  }
+  else if (etype == NSLeftMouseUp || etype == NSRightMouseUp || etype == NSOtherMouseUp) {
+    if (btn == 1) fltk3::e_state &= ~fltk3::BUTTON1;
+    else if (btn == 3) fltk3::e_state &= ~fltk3::BUTTON2;
+    else if (btn == 2) fltk3::e_state &= ~fltk3::BUTTON3;
+    }
+    
+  switch ( etype ) {
+    case NSLeftMouseDown:
+    case NSRightMouseDown:
+    case NSOtherMouseDown:
+      suppressed = 0;
+      sendEvent = fltk3::PUSH;
+      fltk3::e_is_click = 1; 
+      px = (int)pos.x; py = (int)pos.y;
+      if ([theEvent clickCount] > 1) 
+        fltk3::e_clicks++;
+      else
+        fltk3::e_clicks = 0;
+      // fall through
+    case NSLeftMouseUp:
+    case NSRightMouseUp:
+    case NSOtherMouseUp:
+      if (suppressed) {
+        suppressed = 0;
+        break;
+      }
+      if ( !window ) break;
+      if ( !sendEvent ) {
+        sendEvent = fltk3::RELEASE; 
+      }
+      fltk3::e_keysym = keysym[ btn ];
+      // fall through
+    case NSMouseMoved:
+      suppressed = 0;
+      if ( !sendEvent ) { 
+        sendEvent = fltk3::MOVE; 
+      }
+      // fall through
+    case NSLeftMouseDragged:
+    case NSRightMouseDragged:
+    case NSOtherMouseDragged: {
+      if (suppressed) break;
+      if ( !sendEvent ) {
+        sendEvent = fltk3::MOVE; // fltk3::handle will convert into fltk3::DRAG
+        if (fabs(pos.x-px)>5 || fabs(pos.y-py)>5) 
+          fltk3::e_is_click = 0;
+      }
+      mods_to_e_state( mods );
+      update_e_xy_and_e_xy_root([theEvent window]);
+      fltk3::handle( sendEvent, window );
+      }
+      break;
+    default:
+      break;
+  }
+  
+  fl_unlock_function();
+  
+  return;
+}
+
+@interface FLTextView : NSTextView 
+// this subclass is needed under OS X <= 10.5 but not under >= 10.6 where the base class is enough
+{
+}
+@end
+@implementation FLTextView
+- (void)insertText:(id)aString
+{
+  [[[NSApp keyWindow] contentView] insertText:aString];
+}
+- (void)doCommandBySelector:(SEL)aSelector
+{
+  [[[NSApp keyWindow] contentView] doCommandBySelector:aSelector];
+}
+@end
+
+/*
+Handle cocoa keyboard events
+Events during a character composition sequence:
+ - keydown with deadkey -> [[theEvent characters] length] is 0
+ - keyup -> [theEvent characters] contains the deadkey
+ - keydown with next key -> [theEvent characters] contains the composed character
+ - keyup -> [theEvent characters] contains the standard character
+ */
+static void cocoaKeyboardHandler(NSEvent *theEvent)
+{
+  NSUInteger mods;
+  
+  // get the modifiers
+  mods = [theEvent modifierFlags];
+  // get the key code
+  UInt32 keyCode = 0, maskedKeyCode = 0;
+  unsigned short sym = 0;
+  keyCode = [theEvent keyCode];
+  NSString *s = [theEvent characters];  
+  if ( (mods & NSShiftKeyMask) && (mods & NSCommandKeyMask) ) {
+    s = [s uppercaseString]; // US keyboards return lowercase letter in s if cmd-shift-key is hit
+  }
+  // extended keyboards can also send sequences on key-up to generate Kanji etc. codes.
+  // Some observed prefixes are 0x81 to 0x83, followed by an 8 bit keycode.
+  // In this mode, there seem to be no key-down codes
+  // printf("%08x %08x %08x\n", keyCode, mods, key);
+  maskedKeyCode = keyCode & 0x7f;
+
+  if ([theEvent type] == NSKeyUp) {
+    fltk3::e_state &= 0xbfffffff; // clear the deadkey flag
+  }
+
+  mods_to_e_state( mods ); // process modifier keys
+  sym = macKeyLookUp[maskedKeyCode];
+  if (sym < 0xff00) { // a "simple" key
+    // find the result of this key without modifier
+    NSString *sim = [theEvent charactersIgnoringModifiers];
+    UniChar one;
+    CFStringGetCharacters((CFStringRef)sim, CFRangeMake(0, 1), &one);
+    // charactersIgnoringModifiers doesn't ignore shift, remove it when it's on
+    if(one >= 'A' && one <= 'Z') one += 32;
+    if (one > 0 && one <= 0x7f && (sym<'0' || sym>'9') ) sym = one;
+  }
+  fltk3::e_keysym = fltk3::e_original_keysym = sym;
+
+  //NSLog(@"cocoaKeyboardHandler: keycode=%08x keysym=%08x mods=%08x symbol=%@ (%@)",
+  //  keyCode, sym, mods, [theEvent characters], [theEvent charactersIgnoringModifiers]);
+
+  // If there is text associated with this key, it will be filled in later.
+  fltk3::e_length = 0;
+  fltk3::e_text = (char*)"";
+}
+
+
+/*
+ * Open callback function to call...
+ */
+
+static void	(*open_cb)(const char *) = 0;
+
+
+/*
+ * Install an open documents event handler...
+ */
+@interface FLAppleEventHandler : NSObject
+{
+}
+- (void)handleAppleEvent:(NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent;
+@end
+@implementation FLAppleEventHandler
+- (void)handleAppleEvent:(NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent
+{
+  NSAppleEventDescriptor *single = [event descriptorAtIndex:1];
+  const AEDesc *document = [single aeDesc];
+  long i, n;
+  FSRef fileRef;
+  AEKeyword keyWd;
+  DescType typeCd;
+  Size actSz;
+  char filename[1024];
+  // Lock access to FLTK in this thread...
+  fl_lock_function();
+  
+  // Open the documents via the callback...
+  if (AECountItems(document, &n) == noErr) {
+    for (i = 1; i <= n; i ++) {
+      AEGetNthPtr(document, i, typeFSRef, &keyWd, &typeCd,
+                  (Ptr)&fileRef, sizeof(fileRef),
+                  (actSz = sizeof(fileRef), &actSz));
+      FSRefMakePath( &fileRef, (UInt8*)filename, sizeof(filename) );
+      
+      (*open_cb)(filename);
+    }
+  }
+  // Unlock access to FLTK for all threads...
+  fl_unlock_function();
+}
+@end
+
+void fl_open_callback(void (*cb)(const char *)) {
+  static NSAppleEventManager *aeventmgr = nil;
+  static FLAppleEventHandler *handler;
+  fl_open_display();
+  if (!aeventmgr) {
+    aeventmgr = [NSAppleEventManager sharedAppleEventManager];
+    handler = [[FLAppleEventHandler alloc] init];
+  }
+  
+  open_cb = cb;
+  if (cb) {
+    [aeventmgr setEventHandler:handler andSelector:@selector(handleAppleEvent:withReplyEvent:) 
+                 forEventClass:kCoreEventClass andEventID:kAEOpenDocuments];
+  } else {
+    [aeventmgr removeEventHandlerForEventClass:kCoreEventClass andEventID:kAEOpenDocuments];  
+  }
+}
+
+
+/*
+ * initialize the Mac toolboxes, dock status, and set the default menubar
+ */
+
+extern "C" {
+  extern OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn, UInt32 _arg2,
+                                            UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+}
+
+
+@interface FLDelegate : NSObject 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+<NSWindowDelegate, NSApplicationDelegate>
+#endif
+{
+}
+- (void)windowDidMove:(NSNotification *)notif;
+- (void)windowDidResize:(NSNotification *)notif;
+- (void)windowDidResignKey:(NSNotification *)notif;
+- (void)windowDidBecomeKey:(NSNotification *)notif;
+- (void)windowDidBecomeMain:(NSNotification *)notif;
+- (void)windowDidDeminiaturize:(NSNotification *)notif;
+- (void)windowDidMiniaturize:(NSNotification *)notif;
+- (void)windowWillClose:(NSNotification *)notif;
+- (void)anywindowwillclosenotif:(NSNotification *)notif;
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender;
+- (void)applicationDidBecomeActive:(NSNotification *)notify;
+- (void)applicationWillResignActive:(NSNotification *)notify;
+- (void)applicationWillHide:(NSNotification *)notify;
+- (void)applicationWillUnhide:(NSNotification *)notify;
+- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client;
+@end
+@implementation FLDelegate
+- (void)windowDidMove:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  NSPoint pt, pt2; 
+  pt.x = 0;
+  pt.y = [[nsw contentView] frame].size.height;
+  pt2 = [nsw convertBaseToScreen:pt];
+  update_e_xy_and_e_xy_root(nsw);
+  window->position((int)pt2.x, (int)([[nsw screen] frame].size.height - pt2.y));
+  if ([nsw containsGLsubwindow] ) {
+    [nsw display];// redraw window after moving if it contains OpenGL subwindows
+  }
+  fl_unlock_function();
+}
+- (void)windowDidResize:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  NSRect r = [[nsw contentView] frame];
+  NSPoint pt, pt2; 
+  pt.x = 0;
+  pt.y = [[nsw contentView] frame].size.height;
+  pt2 = [nsw convertBaseToScreen:pt];
+  resize_from_system = window;
+  update_e_xy_and_e_xy_root(nsw);
+  window->resize((int)pt2.x, 
+                 (int)([[nsw screen] frame].size.height - pt2.y),
+		 (int)r.size.width,
+		 (int)r.size.height);
+  fl_unlock_function();
+}
+- (void)windowDidResignKey:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  fltk3::handle( fltk3::UNFOCUS, window);
+  fl_unlock_function();
+}
+- (void)windowDidBecomeKey:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *w = [nsw getFl_Window];
+  if ( w->border() || (!w->modal() && !w->tooltip_window()) ) fltk3::handle( fltk3::FOCUS, w);
+  fl_unlock_function();
+}
+- (void)windowDidBecomeMain:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  fltk3::first_window(window);
+  update_e_xy_and_e_xy_root(nsw);
+  fl_unlock_function();
+}
+- (void)windowDidDeminiaturize:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  fltk3::handle(fltk3::SHOW, window);
+  update_e_xy_and_e_xy_root(nsw);
+  fl_unlock_function();
+}
+- (void)windowDidMiniaturize:(NSNotification *)notif
+{
+  fl_lock_function();
+  FLWindow *nsw = (FLWindow*)[notif object];
+  fltk3::Window *window = [nsw getFl_Window];
+  fltk3::handle(fltk3::HIDE, window);
+  fl_unlock_function();
+}
+- (void)windowWillClose:(NSNotification *)notif
+{
+  fl_lock_function();
+  fltk3::Window *w = fltk3::first_window();
+  if (w) {
+    NSWindow *cw = (NSWindow*)Fl_X::i(w)->xid;
+    if ( ![cw isMiniaturized] && ([cw styleMask] & NSTitledWindowMask) ) {
+      if (![cw isKeyWindow]) {	// always make fltk3::first_window() the key widow
+	[cw makeKeyAndOrderFront:nil];
+      }
+      if (![cw isMainWindow]) {	// always make fltk3::first_window() the main widow
+	[cw makeMainWindow];
+      }
+    }
+  }
+  fl_unlock_function();
+}
+- (void)anywindowwillclosenotif:(NSNotification *)notif
+{
+  // necessary so that after closing a non-FLTK window (e.g., fltk3::NativeFileChooser)
+  // the front window turns key again
+  NSWindow *closing = (NSWindow*)[notif object];
+  if ([closing isMemberOfClass:[FLWindow class]]) return;
+  NSWindow *nsk = [NSApp keyWindow];
+  NSWindow *nsm = [NSApp mainWindow];
+  if ([nsm isMemberOfClass:[FLWindow class]] && nsk == nil) {
+    [nsm makeKeyAndOrderFront:nil];
+  }
+}
+- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
+{
+  fl_lock_function();
+  NSApplicationTerminateReply reply = NSTerminateNow;
+  while ( Fl_X::first ) {
+    Fl_X *x = Fl_X::first;
+    fltk3::handle( fltk3::CLOSE, x->w );
+    if ( Fl_X::first == x ) {
+      reply = NSTerminateCancel; // FLTK has not closed all windows, so we return to the main program now
+      break;
+    }
+  }
+  fl_unlock_function();
+  return reply;
+}
+/**
+ * Cocoa organizes the Z depth of windows on a global priority. FLTK however
+ * expects the window manager to organize Z level by application. The trickery
+ * below will change Z order during activation and deactivation.
+ */
+- (void)applicationDidBecomeActive:(NSNotification *)notify
+{
+  fl_lock_function();
+  Fl_X *x;
+  FLWindow *top = 0, *topModal = 0, *topNonModal = 0;
+  for (x = Fl_X::first;x;x = x->next) {
+    FLWindow *cw = (FLWindow*)x->xid;
+    fltk3::Window *win = x->w;
+    if (win && cw) {
+      if (win->modal()) {
+        [cw setLevel:NSModalPanelWindowLevel];
+        if (topModal) 
+          [cw orderWindow:NSWindowBelow relativeTo:[topModal windowNumber]];
+        else
+          topModal = cw;
+      } else if (win->non_modal()) {
+        [cw setLevel:NSFloatingWindowLevel];
+        if (topNonModal) 
+          [cw orderWindow:NSWindowBelow relativeTo:[topNonModal windowNumber]];
+        else
+          topNonModal = cw;
+      } else {
+        if (top) 
+          ;
+        else
+          top = cw;
+      }
+    }
+  }
+  fl_unlock_function();
+}
+- (void)applicationWillResignActive:(NSNotification *)notify
+{
+  fl_lock_function();
+  Fl_X *x;
+  FLWindow *top = 0;
+  // sort in all regular windows
+  for (x = Fl_X::first;x;x = x->next) {
+    FLWindow *cw = (FLWindow*)x->xid;
+    fltk3::Window *win = x->w;
+    if (win && cw) {
+      if (win->modal()) {
+      } else if (win->non_modal()) {
+      } else {
+        if (!top) top = cw;
+      }
+    }
+  }
+  // now sort in all modals
+  for (x = Fl_X::first;x;x = x->next) {
+    FLWindow *cw = (FLWindow*)x->xid;
+    fltk3::Window *win = x->w;
+    if (win && cw) {
+      if (win->modal()) {
+        [cw setLevel:NSNormalWindowLevel];
+        if (top) [cw orderWindow:NSWindowAbove relativeTo:[top windowNumber]];
+      }
+    }
+  }
+  // finally all non-modals
+  for (x = Fl_X::first;x;x = x->next) {
+    FLWindow *cw = (FLWindow*)x->xid;
+    fltk3::Window *win = x->w;
+    if (win && cw) {
+      if (win->non_modal()) {
+        [cw setLevel:NSNormalWindowLevel];
+        if (top) [cw orderWindow:NSWindowAbove relativeTo:[top windowNumber]];
+      }
+    }
+  }
+  fl_unlock_function();
+}
+- (void)applicationWillHide:(NSNotification *)notify
+{
+  fl_lock_function();
+  Fl_X *x;
+  for (x = Fl_X::first;x;x = x->next) {
+    fltk3::Window *window = x->w;
+    if ( !window->parent() ) fltk3::handle( fltk3::HIDE, window);
+    }
+  fl_unlock_function();
+}
+- (void)applicationWillUnhide:(NSNotification *)notify
+{
+  fl_lock_function();
+  Fl_X *x;
+  for (x = Fl_X::first;x;x = x->next) {
+    fltk3::Window *w = x->w;
+    if ( !w->parent() ) {
+      if ( w->border() || (!w->modal() && !w->tooltip_window()) ) fltk3::handle( fltk3::FOCUS, w);
+      fltk3::handle( fltk3::SHOW, w);
+      }
+  }
+  fl_unlock_function();
+}
+- (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)client
+{
+  if (fl_mac_os_version < 100600) {
+    static FLTextView *view = nil;
+    if (!view) {
+      NSRect rect={{0,0},{20,20}};
+      view = [[FLTextView alloc] initWithFrame:rect];
+    }
+    return view;
+  }
+  return nil;
+}
+@end
+
+@implementation FLApplication
++ (void)sendEvent:(NSEvent *)theEvent
+{
+  NSEventType type = [theEvent type];  
+  if (type == NSLeftMouseDown) {
+    fl_lock_function();
+    fltk3::Window *grab = fltk3::grab();
+    if (grab) {
+      FLWindow *win = (FLWindow *)[theEvent window];
+      if ( [win isKindOfClass:[FLWindow class]] && grab != [win getFl_Window]) {
+	// a click event out of a menu window, so we should close this menu
+	// done here to catch also clicks on window title bar/resize box 
+	cocoaMouseHandler(theEvent);
+      }
+    }
+    fl_unlock_function();
+  } else if (type == NSApplicationDefined) {
+    if ([theEvent subtype] == FLTKDataReadyEvent) {
+      processFLTKEvent();
+    }
+    return;
+  } else if (type == NSKeyUp) {
+    // The default sendEvent turns key downs into performKeyEquivalent when
+    // modifiers are down, but swallows the key up if the modifiers include
+    // command.  This one makes all modifiers consistent by always sending key ups.
+    // FLView treats performKeyEquivalent to keyDown, but performKeyEquivalent is
+    // still needed for the system menu.
+    [[NSApp keyWindow] sendEvent:theEvent];
+    return;
+    }
+  [NSApp sendEvent:theEvent]; 
+}
+@end
+
+static FLDelegate *mydelegate;
+
+void fl_open_display() {
+  static char beenHereDoneThat = 0;
+  if ( !beenHereDoneThat ) {
+    beenHereDoneThat = 1;
+
+    BOOL need_new_nsapp = (NSApp == nil);
+    if (need_new_nsapp) [NSApplication sharedApplication];
+    NSAutoreleasePool *localPool;
+    localPool = [[NSAutoreleasePool alloc] init]; // never released
+    mydelegate = [[FLDelegate alloc] init];
+    [NSApp setDelegate:mydelegate];
+    if (need_new_nsapp) [NSApp finishLaunching];
+
+    // empty the event queue but keep system events for drag&drop of files at launch
+    NSEvent *ign_event;
+    do ign_event = [NSApp nextEventMatchingMask:(NSAnyEventMask & ~NSSystemDefinedMask)
+					untilDate:[NSDate dateWithTimeIntervalSinceNow:0] 
+					   inMode:NSDefaultRunLoopMode 
+					  dequeue:YES];
+    while (ign_event);
+    
+    fl_default_cursor = [NSCursor arrowCursor];
+
+    // bring the application into foreground without a 'CARB' resource
+    Boolean same_psn;
+    ProcessSerialNumber cur_psn, front_psn;
+    if ( !GetCurrentProcess( &cur_psn ) && !GetFrontProcess( &front_psn ) &&
+         !SameProcess( &front_psn, &cur_psn, &same_psn ) && !same_psn ) {
+      // only transform the application type for unbundled apps
+      CFBundleRef bundle = CFBundleGetMainBundle();
+      if ( bundle ) {
+      	FSRef execFs;
+      	CFURLRef execUrl = CFBundleCopyExecutableURL( bundle );
+      	CFURLGetFSRef( execUrl, &execFs );
+        
+      	FSRef bundleFs;
+      	GetProcessBundleLocation( &cur_psn, &bundleFs );
+        
+      	if ( !FSCompareFSRefs( &execFs, &bundleFs ) )
+          bundle = NULL;
+        
+        CFRelease(execUrl);
+      }
+            
+      if ( !bundle )
+      {
+        // Earlier versions of this code tried to use weak linking, however it
+        // appears that this does not work on 10.2.  Since 10.3 and higher provide
+        // both TransformProcessType and CPSEnableForegroundOperation, the following
+        // conditional code compiled on 10.2 will still work on newer releases...
+        OSErr err;
+#if __LP64__
+        err = TransformProcessType(&cur_psn, kProcessTransformToForegroundApplication);
+#else
+        
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+        if (TransformProcessType != NULL) {
+          err = TransformProcessType(&cur_psn, kProcessTransformToForegroundApplication);
+        } else
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+          err = CPSEnableForegroundOperation(&cur_psn, 0x03, 0x3C, 0x2C, 0x1103);
+#endif // __LP64__
+        if (err == noErr) {
+          SetFrontProcess( &cur_psn );
+        }
+      }
+    }
+    if (![NSApp servicesMenu]) createAppleMenu();
+    fl_system_menu = [NSApp mainMenu];
+    
+    [[NSNotificationCenter defaultCenter] addObserver:mydelegate 
+	       selector:@selector(anywindowwillclosenotif:) 
+		   name:NSWindowWillCloseNotification 
+		 object:nil];
+  }
+}
+
+
+/*
+ * get rid of allocated resources
+ */
+void fl_close_display() {
+}
+
+
+// Gets the border sizes and the titlebar size
+static void get_window_frame_sizes(int &bx, int &by, int &bt) {
+  static bool first = true;
+  static int top, left, bottom;
+  if (first) {
+    first = false;
+    if (NSApp == nil) fl_open_display();
+    NSRect inside = { {20,20}, {100,100} };
+    NSRect outside = [NSWindow  frameRectForContentRect:inside styleMask:NSTitledWindowMask];
+    left = int(outside.origin.x - inside.origin.x);
+    bottom = int(outside.origin.y - inside.origin.y);
+    top = int(outside.size.height - inside.size.height) - bottom;
+    }
+  bx = left;
+  by = bottom;
+  bt = top;
+}
+
+/*
+ * smallest x ccordinate in screen space
+ */
+int fltk3::x() {
+  return int([[NSScreen mainScreen] visibleFrame].origin.x);
+}
+
+
+/*
+ * smallest y coordinate in screen space
+ */
+int fltk3::y() {
+  NSRect all = [[NSScreen mainScreen] frame];
+  NSRect visible = [[NSScreen mainScreen] visibleFrame];
+  return int(all.size.height - (visible.origin.y + visible.size.height));
+}
+
+
+/*
+ * screen width
+ */
+int fltk3::w() {
+  return int([[NSScreen mainScreen] visibleFrame].size.width);
+}
+
+
+/*
+ * screen height
+ */
+int fltk3::h() {
+  return int([[NSScreen mainScreen] visibleFrame].size.height);
+}
+
+
+/*
+ * get the current mouse pointer world coordinates
+ */
+void fltk3::get_mouse(int &x, int &y) 
+{
+  fl_open_display();
+  NSPoint pt = [NSEvent mouseLocation];
+  x = int(pt.x);
+  y = int([[NSScreen mainScreen] frame].size.height - pt.y);
+}
+
+
+/*
+ * Initialize the given port for redraw and call the window's flush() to actually draw the content
+ */ 
+void Fl_X::flush()
+{
+  w->flush();
+  if (fl_gc) CGContextFlush(fl_gc);
+}
+
+/*
+ * Gets called when a window is created, resized, or deminiaturized
+ */    
+static void handleUpdateEvent( fltk3::Window *window ) 
+{
+  if ( !window ) return;
+  Fl_X *i = Fl_X::i( window );
+  i->wait_for_expose = 0;
+
+  if ( i->region ) {
+    XDestroyRegion(i->region);
+    i->region = 0;
+  }
+  
+  for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) {
+    if ( cx->region ) {
+      XDestroyRegion(cx->region);
+      cx->region = 0;
+    }
+    cx->w->clear_damage(fltk3::DAMAGE_ALL);
+    cx->flush();
+    cx->w->clear_damage();
+  }
+  window->clear_damage(fltk3::DAMAGE_ALL);
+  i->flush();
+  window->clear_damage();
+}     
+
+
+int Fl_X::fake_X_wm(const fltk3::Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
+  int W, H, xoff, yoff, dx, dy;
+  int ret = bx = by = bt = 0;
+  if (w->border() && !w->parent()) {
+    if (w->maxw != w->minw || w->maxh != w->minh) {
+      ret = 2;
+    } else {
+      ret = 1;
+    }
+    get_window_frame_sizes(bx, by, bt);
+  }
+  // The coordinates of the whole window, including non-client area
+  xoff = bx;
+  yoff = by + bt;
+  dx = 2*bx;
+  dy = 2*by + bt;
+  X = w->x()-xoff;
+  Y = w->y()-yoff;
+  W = w->w()+dx;
+  H = w->h()+dy;
+  
+  // Proceed to positioning the window fully inside the screen, if possible
+  
+  // let's get a little elaborate here. Mac OS X puts a lot of stuff on the desk
+  // that we want to avoid when positioning our window, namely the Dock and the
+  // top menu bar (and even more stuff in 10.4 Tiger). So we will go through the
+  // list of all available screens and find the one that this window is most
+  // likely to go to, and then reposition it to fit withing the 'good' area.
+  //  Rect r;
+  // find the screen, that the center of this window will fall into
+  int R = X+W, B = Y+H; // right and bottom
+  int cx = (X+R)/2, cy = (Y+B)/2; // center of window;
+  NSScreen *gd = NULL;
+  NSArray *a = [NSScreen screens]; int count = (int)[a count]; NSRect r; int i;
+  for( i = 0; i < count; i++) {
+    r = [[a objectAtIndex:i] frame];
+    cy = int(r.size.height - cy);
+    if (   cx >= r.origin.x && cx <= r.origin.x + r.size.width
+        && cy >= r.origin.y && cy <= r.origin.y + r.size.height)
+      break;
+  }
+  if (i < count) gd = [a objectAtIndex:i];
+  
+  // if the center doesn't fall on a screen, try the top left
+  if (!gd) {
+    for( i = 0; i < count; i++) {
+      r = [[a objectAtIndex:i] frame];
+      if (    X >= r.origin.x && X <= r.origin.x + r.size.width
+          && r.size.height - Y >= r.origin.y  && r.size.height - Y <= r.origin.y + r.size.height)
+        break;
+    }
+    if (i < count) gd = [a objectAtIndex:i];
+  }
+  // if that doesn't fall on a screen, try the top right
+  if (!gd) {
+    for( i = 0; i < count; i++) {
+      r = [[a objectAtIndex:i] frame];
+      if (    R >= r.origin.x && R <= r.origin.x + r.size.width
+          && r.size.height - Y >= r.origin.y  && r.size.height - Y <= r.origin.y + r.size.height)
+        break;
+    }
+    if (i < count) gd = [a objectAtIndex:i];
+  }
+  // if that doesn't fall on a screen, try the bottom left
+  if (!gd) {
+    for( i = 0; i < count; i++) {
+      r = [[a objectAtIndex:i] frame];
+      if (    X >= r.origin.x && X <= r.origin.x + r.size.width
+          && Y-H >= r.origin.y  && Y-H <= r.origin.y + r.size.height)
+        break;
+    }
+    if (i < count) gd = [a objectAtIndex:i];
+  }
+  // last resort, try the bottom right
+  if (!gd) {
+    for( i = 0; i < count; i++) {
+      r = [[a objectAtIndex:i] frame];
+      if (    R >= r.origin.x && R <= r.origin.x + r.size.width
+          && Y-H >= r.origin.y  && Y-H <= r.origin.y + r.size.height)
+        break;
+    }
+    if (i < count) gd = [a objectAtIndex:i];
+  }
+  // if we still have not found a screen, we will use the main
+  // screen, the one that has the application menu bar.
+  if (!gd) gd = [a objectAtIndex:0];
+  if (gd) {
+    r = [gd visibleFrame];
+    int sh = int([gd frame].size.height);
+    if ( R > r.origin.x + r.size.width ) X -= int(R - (r.origin.x + r.size.width));
+    if ( B > sh - r.origin.y ) Y -= int(B - (sh - r.origin.y));
+    if ( X < r.origin.x ) X = int(r.origin.x);
+    if ( Y < sh - (r.origin.y + r.size.height) ) Y = int(sh - (r.origin.y + r.size.height));
+  }
+  
+  // Return the client area's top left corner in (X,Y)
+  X+=xoff;
+  Y+=yoff;
+  
+  return ret;
+}
+
+
+fltk3::Window *fl_dnd_target_window = 0;
+
+static void  q_set_window_title(NSWindow *nsw, const char * name, const char *mininame) {
+  CFStringRef title = CFStringCreateWithCString(NULL, (name ? name : ""), kCFStringEncodingUTF8);
+  if(!title) { // fallback when name contains malformed UTF-8
+    int l = strlen(name);
+    unsigned short* utf16 = new unsigned short[l + 1];
+    l = fltk3::utf8toUtf16(name, l, utf16, l + 1);
+    title = CFStringCreateWithCharacters(NULL, utf16, l);
+    delete[] utf16;
+    }
+  [nsw setTitle:(NSString*)title];
+  CFRelease(title);
+  if (mininame && strlen(mininame)) {
+    CFStringRef minititle = CFStringCreateWithCString(NULL, mininame, kCFStringEncodingUTF8);
+    if (minititle) {
+      [nsw setMiniwindowTitle:(NSString*)minititle];
+      CFRelease(minititle);
+    }
+  }
+}
+
+
+@interface FLView : NSView <NSTextInput> {
+  int next_compose_length;
+  bool in_key_event;
+}
++ (void)prepareEtext:(NSString*)aString;
+- (id)init;
+- (void)drawRect:(NSRect)rect;
+- (BOOL)acceptsFirstResponder;
+- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent;
+- (BOOL)performKeyEquivalent:(NSEvent*)theEvent;
+- (void)mouseUp:(NSEvent *)theEvent;
+- (void)rightMouseUp:(NSEvent *)theEvent;
+- (void)otherMouseUp:(NSEvent *)theEvent;
+- (void)mouseDown:(NSEvent *)theEvent;
+- (void)rightMouseDown:(NSEvent *)theEvent;
+- (void)otherMouseDown:(NSEvent *)theEvent;
+- (void)mouseMoved:(NSEvent *)theEvent;
+- (void)mouseDragged:(NSEvent *)theEvent;
+- (void)rightMouseDragged:(NSEvent *)theEvent;
+- (void)otherMouseDragged:(NSEvent *)theEvent;
+- (void)scrollWheel:(NSEvent *)theEvent;
+- (BOOL)handleKeyDown:(NSEvent *)theEvent;
+- (void)keyDown:(NSEvent *)theEvent;
+- (void)keyUp:(NSEvent *)theEvent;
+- (void)flagsChanged:(NSEvent *)theEvent;
+- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender;
+- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender;
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
+- (void)draggingExited:(id < NSDraggingInfo >)sender;
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
+@end
+
+@implementation FLView
+- (id)init
+{
+  self = [super init];
+  if (self) {
+    next_compose_length = -1;
+    in_key_event = false;
+    }
+  return self;
+}
+- (void)drawRect:(NSRect)rect
+{
+  fl_lock_function();
+  FLWindow *cw = (FLWindow*)[self window];
+  fltk3::Window *w = [cw getFl_Window];
+  handleUpdateEvent(w);
+  fl_unlock_function();
+}
+
+- (BOOL)acceptsFirstResponder
+{   
+  return YES;
+}
+- (BOOL)performKeyEquivalent:(NSEvent*)theEvent
+{   
+  //NSLog(@"performKeyEquivalent:");
+  return [self handleKeyDown:theEvent];
+}
+- (BOOL)acceptsFirstMouse:(NSEvent*)theEvent
+{   
+  fltk3::Window *w = [(FLWindow*)[theEvent window] getFl_Window];
+  fltk3::Window *first = fltk3::first_window();
+  return (first == w || !first->modal());
+}
+- (void)mouseUp:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)rightMouseUp:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)otherMouseUp:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)mouseDown:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)rightMouseDown:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)otherMouseDown:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)mouseMoved:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)mouseDragged:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)rightMouseDragged:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)otherMouseDragged:(NSEvent *)theEvent {
+  cocoaMouseHandler(theEvent);
+}
+- (void)scrollWheel:(NSEvent *)theEvent {
+  cocoaMouseWheelHandler(theEvent);
+}
+- (BOOL)handleKeyDown:(NSEvent *)theEvent {
+  //NSLog(@"handleKeyDown");
+  fl_lock_function();
+
+  fltk3::Window *window = (fltk3::Window*)[(FLWindow*)[theEvent window] getFl_Window];
+  fltk3::first_window(window);
+
+  next_compose_length = -1;
+  // First let's process the raw key press
+  cocoaKeyboardHandler(theEvent);
+
+  unsigned int no_text_key = false;
+  static const unsigned int notext[] = { // keys that don't emit text
+    fltk3::BackSpaceKey, fltk3::PrintKey, fltk3::ScrollLockKey, fltk3::PauseKey,
+    fltk3::InsertKey, fltk3::HomeKey, fltk3::PageUpKey, fltk3::DeleteKey, fltk3::EndKey, fltk3::PageDownKey,
+    fltk3::LeftKey, fltk3::UpKey, fltk3::RightKey, fltk3::DownKey, 
+    fltk3::MenuKey, fltk3::NumLockKey, fltk3::HelpKey 
+  };
+  static const int count = sizeof(notext)/sizeof(int);
+  if (fltk3::e_keysym > fltk3::FKey && fltk3::e_keysym <= fltk3::FLastKey) no_text_key = true;
+  else for (int i=0; i < count; i++) {
+    if (notext[i] == fltk3::e_keysym) {
+      no_text_key = true;
+      break;
+    }
+  }
+  if (!no_text_key && !(fltk3::e_state & fltk3::META) ) {
+    // Don't send cmd-<key> to interpretKeyEvents because it beeps.
+    // Then we can let the OS have a stab at it and see if it thinks it
+    // should result in some text
+    NSText *edit = [[theEvent window]  fieldEditor:YES forObject:nil];
+    in_key_event = true;
+    [edit interpretKeyEvents:[NSArray arrayWithObject:theEvent]];
+    in_key_event = false;
+  }
+  //NSLog(@"to text=%@ l=%d", [NSString stringWithUTF8String:fltk3::e_text], fltk3::e_length);
+  int handled = fltk3::handle(fltk3::KEYDOWN, window);
+  // We have to update this after fltk3::handle as it says what to do on the
+  // _next_ input
+  if (next_compose_length != -1)
+    fltk3::compose_state = next_compose_length;
+
+  fl_unlock_function();
+  return (handled ? YES : NO);
+}
+- (void)keyDown:(NSEvent *)theEvent {
+  //NSLog(@"keyDown: ");
+  [self handleKeyDown:theEvent];
+}
+- (void)keyUp:(NSEvent *)theEvent {
+  //NSLog(@"keyUp: ");
+  fl_lock_function();
+  fltk3::Window *window = (fltk3::Window*)[(FLWindow*)[theEvent window] getFl_Window];
+  fltk3::first_window(window);
+  cocoaKeyboardHandler(theEvent);
+  NSString *s = [theEvent characters];
+  if ([s length] >= 1) [FLView prepareEtext:[s substringToIndex:1]];
+  fltk3::handle(fltk3::KEYUP,window);
+  fl_unlock_function();
+}
+- (void)flagsChanged:(NSEvent *)theEvent {
+  //NSLog(@"flagsChanged: ");
+  fl_lock_function();
+  static UInt32 prevMods = 0;
+  NSUInteger mods = [theEvent modifierFlags];
+  fltk3::Window *window = (fltk3::Window*)[(FLWindow*)[theEvent window] getFl_Window];
+  UInt32 tMods = prevMods ^ mods;
+  int sendEvent = 0;
+  if ( tMods )
+  {
+    unsigned short keycode = [theEvent keyCode];
+    fltk3::e_keysym = fltk3::e_original_keysym = macKeyLookUp[keycode & 0x7f];
+    if ( fltk3::e_keysym ) 
+      sendEvent = ( prevMods<mods ) ? fltk3::KEYBOARD : fltk3::KEYUP;
+    fltk3::e_length = 0;
+    fltk3::e_text = (char*)"";
+    prevMods = mods;
+  }
+  mods_to_e_state( mods );
+  while (window->parent()) window = window->window();
+  if (sendEvent) fltk3::handle(sendEvent,window);
+  fl_unlock_function();
+}
+- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender
+{
+  fl_lock_function();
+  fltk3::Window *target = [(FLWindow*)[self window] getFl_Window];
+  update_e_xy_and_e_xy_root([self window]);
+  fl_dnd_target_window = target;
+  int ret = fltk3::handle( fltk3::DND_ENTER, target );
+  breakMacEventLoop();
+  fl_unlock_function();
+  return ret ? NSDragOperationCopy : NSDragOperationNone;
+}
+- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender
+{
+  fl_lock_function();
+  fltk3::Window *target = [(FLWindow*)[self window] getFl_Window];
+  update_e_xy_and_e_xy_root([self window]);
+  fl_dnd_target_window = target;
+  int ret = fltk3::handle( fltk3::DND_DRAG, target );
+  breakMacEventLoop();
+  fl_unlock_function();
+  return ret ? NSDragOperationCopy : NSDragOperationNone;
+}
+- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender 
+{
+  static char *DragData = NULL;
+  fl_lock_function();
+  fltk3::Window *target = [(FLWindow*)[self window] getFl_Window];
+  if ( !fltk3::handle( fltk3::DND_RELEASE, target ) ) { 
+    breakMacEventLoop();
+    fl_unlock_function();
+    return NO;
+  }
+  NSPasteboard *pboard;
+  // NSDragOperation sourceDragMask;
+  // sourceDragMask = [sender draggingSourceOperationMask];
+  pboard = [sender draggingPasteboard];
+  update_e_xy_and_e_xy_root([self window]);
+  if (DragData) { free(DragData); DragData = NULL; }
+  if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
+    CFArrayRef files = (CFArrayRef)[pboard propertyListForType:NSFilenamesPboardType];
+    CFStringRef all = CFStringCreateByCombiningStrings(NULL, files, CFSTR("\n"));
+    int l = CFStringGetMaximumSizeForEncoding(CFStringGetLength(all), kCFStringEncodingUTF8);
+    DragData = (char *)malloc(l + 1);
+    CFStringGetCString(all, DragData, l + 1, kCFStringEncodingUTF8);
+    CFRelease(all);
+  }
+  else if ( [[pboard types] containsObject:NSStringPboardType] ) {
+    NSData *data = [pboard dataForType:NSStringPboardType];
+    DragData = (char *)malloc([data length] + 1);
+    [data getBytes:DragData];
+    DragData[[data length]] = 0;
+    convert_crlf(DragData, strlen(DragData));
+  }
+  else {
+    breakMacEventLoop();
+    fl_unlock_function();
+    return NO;
+  }
+  fltk3::e_text = DragData;
+  fltk3::e_length = strlen(DragData);
+  int old_event = fltk3::e_number;
+  fltk3::belowmouse()->handle(fltk3::e_number = fltk3::PASTE);
+  fltk3::e_number = old_event;
+  if (DragData) { free(DragData); DragData = NULL; }
+  fltk3::e_text = NULL;
+  fltk3::e_length = 0;
+  fl_dnd_target_window = NULL;
+  breakMacEventLoop();
+  fl_unlock_function();
+  return YES;
+}
+- (void)draggingExited:(id < NSDraggingInfo >)sender
+{
+  fl_lock_function();
+  if ( fl_dnd_target_window ) {
+    fltk3::handle( fltk3::DND_LEAVE, fl_dnd_target_window );
+    fl_dnd_target_window = 0;
+  }
+  fl_unlock_function();
+}
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
+{
+  return NSDragOperationGeneric;
+}
+
++ (void)prepareEtext:(NSString*)aString {
+  // fills fltk3::e_text with UTF-8 encoded aString using an adequate memory allocation
+  static char *received_utf8 = NULL;
+  static int lreceived = 0;
+  char *p = (char*)[aString UTF8String];
+  int l = strlen(p);
+  if (l > 0) {
+    if (lreceived == 0) {
+      received_utf8 = (char*)malloc(l + 1);
+      lreceived = l;
+    }
+    else if (l > lreceived) {
+      received_utf8 = (char*)realloc(received_utf8, l + 1);
+      lreceived = l;
+    }
+    strcpy(received_utf8, p);
+    fltk3::e_text = received_utf8;
+  }
+  fltk3::e_length = l;
+}
+
+// These functions implement text input.
+// Only two-stroke character composition works at this point.
+// Needs much elaboration to fully support CJK text input,
+// but this is the way to go.
+- (void)doCommandBySelector:(SEL)aSelector {
+}
+
+- (void)insertText:(id)aString {
+  NSString *received;
+  if ([aString isKindOfClass:[NSAttributedString class]]) {
+    received = [(NSAttributedString*)aString string];
+  } else {
+    received = (NSString*)aString;
+  }
+  //NSLog(@"insertText: received=%@",received);
+
+  if (!in_key_event) fl_lock_function();
+  [FLView prepareEtext:received];
+  // We can get called outside of key events (e.g. from the character
+  // palette). Transform such actions to fltk3::PASTE events.
+  if (!in_key_event) {
+    fltk3::Window *target = [(FLWindow*)[self window] getFl_Window];
+    fltk3::handle(fltk3::PASTE, target);
+    // for some reason, the window does not redraw until the next mouse move or button push
+    // sending a 'redraw()' or 'awake()' does not solve the issue!
+    fltk3::flush();
+  }
+  if (!in_key_event) fl_unlock_function();
+}
+
+- (void)setMarkedText:(id)aString selectedRange:(NSRange)newSelection  {
+  NSString *received;
+  if (newSelection.location == 0) {
+    [self unmarkText];
+    return;
+  }
+  if ([aString isKindOfClass:[NSAttributedString class]]) {
+    received = [(NSAttributedString*)aString string];
+  } else {
+    received = (NSString*)aString;
+  }
+  //NSLog(@"setMarkedText: %@ %d %d",received,newSelection.location,newSelection.length);
+  // This code creates the OS X behaviour of seeing dead keys as things
+  // are being composed.
+  next_compose_length = newSelection.location;
+  [FLView prepareEtext:received];
+  //NSLog(@"fltk3::e_text=%@ fltk3::e_length=%d next_compose_length=%d", received, fltk3::e_length, next_compose_length);
+}
+
+- (void)unmarkText {
+  fl_lock_function();
+  fltk3::compose_state = 0;
+  fl_unlock_function();
+  //NSLog(@"unmarkText");
+}
+
+- (NSRange)selectedRange {
+  return NSMakeRange(NSNotFound, 0);
+}
+
+- (NSRange)markedRange {
+  //NSLog(@"markedRange ?");
+  return NSMakeRange(NSNotFound, fltk3::compose_state);
+}
+
+- (BOOL)hasMarkedText {
+  //NSLog(@"hasMarkedText %s", fltk3::compose_state > 0?"YES":"NO");
+  return (fltk3::compose_state > 0);
+}
+
+- (NSAttributedString *)attributedSubstringFromRange:(NSRange)aRange {
+  //NSLog(@"attributedSubstringFromRange: %d %d",aRange.location,aRange.length);
+  return nil;
+}
+
+- (NSArray *)validAttributesForMarkedText {
+  return nil;
+}
+
+- (NSRect)firstRectForCharacterRange:(NSRange)aRange {
+  NSRect glyphRect;
+  fl_lock_function();
+  fltk3::Widget *focus = fltk3::focus();
+  fltk3::Window *wfocus = focus->window();
+  while (wfocus->window()) wfocus = wfocus->window();
+  glyphRect.size.width = 0;
+  
+  if (dynamic_cast<fltk3::TextDisplay*>(focus) != NULL) {
+    int x, y;
+    fltk3::TextDisplay *current = (fltk3::TextDisplay*)focus;
+    current->position_to_xy( current->insert_position(), &x, &y );
+    glyphRect.origin.x = (CGFloat)x;
+    glyphRect.origin.y = (CGFloat)y + current->textsize();
+    glyphRect.size.height = current->textsize();
+  } else {
+    glyphRect.origin.x = focus->x();
+    glyphRect.origin.y = focus->y() + focus->h();
+    glyphRect.size.height = 12;
+  }
+  // Convert the rect to screen coordinates
+  glyphRect.origin.y = wfocus->h() - glyphRect.origin.y;
+  glyphRect.origin = [[self window] convertBaseToScreen:glyphRect.origin];
+  fl_unlock_function();
+  return glyphRect;
+}
+
+- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint {
+  return 0;
+}
+
+- (NSInteger)conversationIdentifier {
+  return (NSInteger)self;
+}
+
+@end
+
+
+/*
+ * go ahead, create that (sub)window
+ */
+void Fl_X::make(fltk3::Window* w)
+{
+  static int xyPos = 100;
+  if ( w->parent() ) {		// create a subwindow
+    fltk3::Group::current(0);
+    // our subwindow needs this structure to know about its clipping. 
+    Fl_X* x = new Fl_X;
+    x->subwindow = true;
+    x->other_xid = 0;
+    x->region = 0;
+    x->subRegion = 0;
+    x->cursor = fl_default_cursor;
+    x->gc = 0;			// stay 0 for Quickdraw; fill with CGContext for Quartz
+    fltk3::Window *win = w->window();
+    Fl_X *xo = Fl_X::i(win);
+    if (xo) {
+      x->xidNext = xo->xidChildren;
+      x->xidChildren = 0L;
+      xo->xidChildren = x;
+      x->xid = win->i->xid;
+      x->w = w; w->i = x;
+      x->wait_for_expose = 0;
+      {
+	Fl_X *z = xo->next;	// we don't want a subwindow in Fl_X::first
+	xo->next = x;
+	x->next = z;
+      }
+      int old_event = fltk3::e_number;
+      w->handle(fltk3::e_number = fltk3::SHOW);
+      fltk3::e_number = old_event;
+      w->redraw();		// force draw to happen
+    }
+    if (w->as_gl_window()) { // if creating a sub-GL-window
+      while (win->window()) win = win->window();
+      [(FLWindow*)Fl_X::i(win)->xid setContainsGLsubwindow:YES];
+    }
+    fl_show_iconic = 0;
+  }
+  else {			// create a desktop window
+    fltk3::Group::current(0);
+    fl_open_display();
+    NSInteger winlevel = NSNormalWindowLevel;
+    NSUInteger winstyle;
+    if (w->border()) winstyle = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask;
+    else winstyle = NSBorderlessWindowMask;
+    int xp = w->x();
+    int yp = w->y();
+    int wp = w->w();
+    int hp = w->h();
+    if (w->size_range_set) {
+      if ( w->minh != w->maxh || w->minw != w->maxw) {
+        winstyle |= NSResizableWindowMask;
+      }
+    } else {
+      if (w->resizable()) {
+        fltk3::Widget *o = w->resizable();
+        int minw = o->w(); if (minw > 100) minw = 100;
+        int minh = o->h(); if (minh > 100) minh = 100;
+        w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+	winstyle |= NSResizableWindowMask;
+      } else {
+        w->size_range(w->w(), w->h(), w->w(), w->h());
+      }
+    }
+    int xwm = xp, ywm = yp, bt, bx, by;
+    
+    if (!fake_X_wm(w, xwm, ywm, bt, bx, by)) {
+      // menu windows and tooltips
+      if (w->modal()||w->tooltip_window()) {
+        winstyle = NSBorderlessWindowMask;
+        winlevel = NSModalPanelWindowLevel;
+      } else {
+        winstyle = NSBorderlessWindowMask;
+      }
+    } else if (w->modal()) {
+      winstyle &= ~NSMiniaturizableWindowMask;
+      // winstyle &= ~(NSResizableWindowMask | NSMiniaturizableWindowMask);
+      winlevel = NSModalPanelWindowLevel;
+    }
+    else if (w->non_modal()) {
+      winlevel = NSFloatingWindowLevel;
+    }
+    
+    if (by+bt) {
+      wp += 2*bx;
+      hp += 2*by+bt;
+    }
+    if (!(w->flags() & fltk3::Window::FORCE_POSITION)) {
+      // use the Carbon functions below for default window positioning
+      w->x(xyPos+fltk3::x());
+      w->y(xyPos+fltk3::y());
+      xyPos += 25;
+      if (xyPos>200) xyPos = 100;
+    } else {
+      if (!fltk3::grab()) {
+        xp = xwm; yp = ywm;
+        w->x(xp);w->y(yp);
+      }
+      xp -= bx;
+      yp -= by+bt;
+    }
+    
+    if (w->non_modal() && Fl_X::first /*&& !fl_disable_transient_for*/) {
+      // find some other window to be "transient for":
+      fltk3::Window* w = Fl_X::first->w;
+      while (w->parent()) w = w->window(); // todo: this code does not make any sense! (w!=w??)
+    }
+        
+    Fl_X* x = new Fl_X;
+    x->subwindow = false;
+    x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows
+    x->region = 0;
+    x->subRegion = 0;
+    x->cursor = fl_default_cursor;
+    x->xidChildren = 0;
+    x->xidNext = 0;
+    x->gc = 0;
+	  
+    NSRect srect = [[NSScreen mainScreen] frame];
+    NSRect crect;
+    crect.origin.x = w->x(); 
+    crect.origin.y = srect.size.height - (w->y() + w->h());
+    crect.size.width=w->w(); 
+    crect.size.height=w->h();
+    FLWindow *cw = [[FLWindow alloc] initWithFl_W:w 
+				      contentRect:crect  
+					styleMask:winstyle];
+    [cw setHasShadow:YES];
+    [cw setAcceptsMouseMovedEvents:YES];
+    x->xid = cw;
+    FLView *myview = [[FLView alloc] init];
+    [cw setContentView:myview];
+    [cw setLevel:winlevel];
+    
+    q_set_window_title(cw, w->label(), w->iconlabel());
+    if (!(w->flags() & fltk3::Window::FORCE_POSITION)) {
+      if (w->modal()) {
+        [cw center];
+      } else if (w->non_modal()) {
+        [cw center];
+      } else {
+        static NSPoint delta = NSZeroPoint;
+        delta = [cw cascadeTopLeftFromPoint:delta];
+      }
+    }
+    if(w->menu_window()) { // make menu windows slightly transparent
+      [cw setAlphaValue:0.97];
+    }
+    x->w = w; w->i = x;
+    x->wait_for_expose = 1;
+    x->next = Fl_X::first;
+    Fl_X::first = x;
+    // Install DnD handlers 
+    [myview registerForDraggedTypes:[NSArray arrayWithObjects:
+                                     NSStringPboardType,  NSFilenamesPboardType, nil]];
+    if ( ! Fl_X::first->next ) {	
+      // if this is the first window, we need to bring the application to the front
+      ProcessSerialNumber psn = { 0, kCurrentProcess };
+      SetFrontProcess( &psn );
+    }
+    
+    if (w->size_range_set) w->size_range_();
+    
+    if ( w->border() || (!w->modal() && !w->tooltip_window()) ) {
+      fltk3::Tooltip::enter(0);
+    }
+    w->set_visible();
+    if ( w->border() || (!w->modal() && !w->tooltip_window()) ) fltk3::handle(fltk3::FOCUS, w);
+    fltk3::first_window(w);
+    [cw setDelegate:mydelegate];
+    if (fl_show_iconic) { 
+      fl_show_iconic = 0;
+      [cw miniaturize:nil];
+    } else {
+      [cw makeKeyAndOrderFront:nil];
+    }
+    
+    crect = [[cw contentView] frame];
+    w->w(int(crect.size.width));
+    w->h(int(crect.size.height));
+    crect = [cw frame];
+    w->x(int(crect.origin.x));
+    srect = [[cw screen] frame];
+    w->y(int(srect.size.height - (crect.origin.y + w->h())));
+    
+    int old_event = fltk3::e_number;
+    w->handle(fltk3::e_number = fltk3::SHOW);
+    fltk3::e_number = old_event;
+    
+    if (w->modal()) { fltk3::modal_ = w; fl_fix_focus(); }
+  }
+}
+
+
+/*
+ * Tell the OS what window sizes we want to allow
+ */
+void fltk3::Window::size_range_() {
+  int bx, by, bt;
+  get_window_frame_sizes(bx, by, bt);
+  size_range_set = 1;
+  NSSize minSize = { minw, minh + bt };
+  NSSize maxSize = { maxw?maxw:32000, maxh?maxh + bt:32000 };
+  if (i && i->xid) {
+    [(NSWindow*)i->xid setMinSize:minSize];
+    [(NSWindow*)i->xid setMaxSize:maxSize];
+  }
+}
+
+
+/*
+ * returns pointer to the filename, or null if name ends with ':'
+ */
+const char *fltk3::filename_name( const char *name ) 
+{
+  const char *p, *q;
+  if (!name) return (0);
+  for ( p = q = name ; *p ; ) {
+    if ( ( p[0] == ':' ) && ( p[1] == ':' ) ) {
+      q = p+2;
+      p++;
+    }
+    else if (p[0] == '/') {
+      q = p + 1;
+    }
+    p++;
+  }
+  return q;
+}
+
+
+/*
+ * set the window title bar name
+ */
+void fltk3::Window::label(const char *name, const char *mininame) {
+  fltk3::Widget::label(name);
+  iconlabel_ = mininame;
+  if (shown() || i) {
+    NSWindow* nsw = (NSWindow*)i->xid;
+    q_set_window_title(nsw, name, mininame);
+  }
+}
+
+
+/*
+ * make a window visible
+ */
+void fltk3::Window::show() {
+  image(fltk3::scheme_bg_);
+  if (fltk3::scheme_bg_) {
+    labeltype(fltk3::NORMAL_LABEL);
+    align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+  } else {
+    labeltype(fltk3::NO_LABEL);
+  }
+  fltk3::Tooltip::exit(this);
+  if (!shown() || !i) {
+    Fl_X::make(this);
+  } else {
+    if ( !parent() ) {
+      if ([(NSWindow*)i->xid isMiniaturized]) {
+	i->w->redraw();
+	[(NSWindow*)i->xid deminiaturize:nil];
+      }
+      if (!fl_capture) {
+	[(NSWindow*)i->xid makeKeyAndOrderFront:nil];
+      }
+    }
+  }
+}
+
+
+/*
+ * resize a window
+ */
+void fltk3::Window::resize(int X,int Y,int W,int H) {
+  if (W<=0) W = 1; // OS X does not like zero width windows
+  if (H<=0) H = 1;
+  int is_a_resize = (W != w() || H != h());
+  //  printf("fltk3::Window::resize(X=%d, Y=%d, W=%d, H=%d), is_a_resize=%d, resize_from_system=%p, this=%p\n",
+  //         X, Y, W, H, is_a_resize, resize_from_system, this);
+  if (X != x() || Y != y()) set_flag(FORCE_POSITION);
+  else if (!is_a_resize) return;
+  if ( (resize_from_system!=this) && (!parent()) && shown()) {
+    if (is_a_resize) {
+      if (resizable()) {
+        if (W<minw) minw = W; // user request for resize takes priority
+        if (maxw && W>maxw) maxw = W; // over a previously set size_range
+        if (H<minh) minh = H;
+        if (maxh && H>maxh) maxh = H;
+        size_range(minw, minh, maxw, maxh);
+      } else {
+        size_range(W, H, W, H);
+      }
+      int bx, by, bt;
+      if ( ! this->border() ) bt = 0;
+      else get_window_frame_sizes(bx, by, bt);
+      NSRect dim;
+      dim.origin.x = X;
+      dim.origin.y = [[(NSWindow*)i->xid screen] frame].size.height - (Y + H);
+      dim.size.width = W;
+      dim.size.height = H + bt;
+      [(NSWindow*)i->xid setFrame:dim display:YES];
+    } else {
+      NSPoint pt; 
+      pt.x = X; 
+      pt.y = [[(NSWindow*)i->xid screen] frame].size.height - (Y + h());
+      [(NSWindow*)i->xid setFrameOrigin:pt];
+    }
+  }
+  resize_from_system = 0;
+  if (is_a_resize) {
+    fltk3::Group::resize(X,Y,W,H);
+    if (shown()) { 
+      redraw(); 
+    }
+  } else {
+    x(X); y(Y); 
+  }
+}
+
+
+/*
+ * make all drawing go into this window (called by subclass flush() impl.)
+ */
+void fltk3::Window::make_current() 
+{
+  Fl_X::q_release_context();
+  fl_window = i->xid;
+  current_ = this;
+  
+  int xp = 0, yp = 0;
+  fltk3::Window *win = this;
+  while ( win ) {
+    if ( !win->window() )
+      break;
+    xp += win->x();
+    yp += win->y();
+    win = (fltk3::Window*)win->window();
+  }
+  
+  NSView *current_focus = [NSView focusView]; 
+  // sometimes current_focus is set to a non-FLTK view: don't touch that
+  if ( [current_focus isKindOfClass:[FLView class]] ) [current_focus unlockFocus];
+  [[(NSWindow*)i->xid contentView]  lockFocus];
+  i->gc = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+  fl_gc = i->gc;
+  fltk3::Region fl_window_region = XRectangleRegion(0,0,w(),h());
+  if ( ! this->window() ) {
+    for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext ) {	// clip-out all sub-windows
+      fltk3::Window *cw = cx->w;
+      fltk3::Region from = fl_window_region;
+      fl_window_region = MacRegionMinusRect(from, cw->x(), cw->y(), cw->w(), cw->h() );
+      XDestroyRegion(from);
+    }
+  }
+  
+  // antialiasing must be deactivated because it applies to rectangles too
+  // and escapes even clipping!!!
+  // it gets activated when needed (e.g., draw text)
+  CGContextSetShouldAntialias(fl_gc, false);  
+  CGFloat hgt = [[(NSWindow*)fl_window contentView] frame].size.height;
+  CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f);
+  CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the window
+  win = this;
+  while(win && win->window()) { // translate to subwindow origin if this is a subwindow context
+    CGContextTranslateCTM(fl_gc, win->x(), win->y());
+    win = win->window();
+  }
+  //apply window's clip
+  CGContextClipToRects(fl_gc, fl_window_region->rects, fl_window_region->count );
+  XDestroyRegion(fl_window_region);
+// this is the context with origin at top left of (sub)window clipped out of its subwindows if any
+  CGContextSaveGState(fl_gc); 
+#if defined(FLTK_USE_CAIRO)
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+#endif
+  fltk3::clip_region( 0 );
+  
+#if defined(FLTK_USE_CAIRO)
+  // update the cairo_t context
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this);
+#endif
+}
+
+// helper function to manage the current CGContext fl_gc
+extern void fl_quartz_restore_line_style_();
+
+// FLTK has only one global graphics state. This function copies the FLTK state into the
+// current Quartz context
+void Fl_X::q_fill_context() {
+  if (!fl_gc) return;
+  if ( ! fl_window) { // a bitmap context
+    size_t hgt = CGBitmapContextGetHeight(fl_gc);
+    CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f);
+    CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context
+    }
+  fltk3::color(fltk3::graphics_driver->color());
+  fl_quartz_restore_line_style_();
+}
+
+// The only way to reset clipping to its original state is to pop the current graphics
+// state and restore the global state.
+void Fl_X::q_clear_clipping() {
+  if (!fl_gc) return;
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+}
+
+// Give the Quartz context back to the system
+void Fl_X::q_release_context(Fl_X *x) {
+  if (x && x->gc!=fl_gc) return;
+  if (!fl_gc) return;
+  CGContextRestoreGState(fl_gc); // matches the CGContextSaveGState of make_current
+  fl_gc = 0;
+#if defined(FLTK_USE_CAIRO)
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current((fltk3::Window*) 0); // capture gc changes automatically to update the cairo context adequately
+#endif
+}
+
+void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
+  CGContextSaveGState(fl_gc);
+  CGRect r2 = rect;
+  r2.origin.x -= 0.5f;
+  r2.origin.y -= 0.5f;
+  CGContextClipToRect(fl_gc, r2);
+  // move graphics context to origin of vertically reversed image 
+  CGContextTranslateCTM(fl_gc, rect.origin.x - cx - 0.5, rect.origin.y - cy + h - 0.5);
+  CGContextScaleCTM(fl_gc, 1, -1);
+  rect.origin.x = rect.origin.y = 0;
+  rect.size.width = w;
+  rect.size.height = h;
+}
+
+void Fl_X::q_end_image() {
+  CGContextRestoreGState(fl_gc);
+}
+
+
+////////////////////////////////////////////////////////////////
+// Copy & Paste fltk implementation.
+////////////////////////////////////////////////////////////////
+
+static void convert_crlf(char * s, size_t len)
+{
+  // turn all \r characters into \n:
+  for (size_t x = 0; x < len; x++) if (s[x] == '\r') s[x] = '\n';
+}
+
+// fltk 1.3 clipboard support constant definitions:
+const CFStringRef	flavorNames[] = {
+  CFSTR("public.utf16-plain-text"), 
+  CFSTR("public.utf8-plain-text"),
+  CFSTR("com.apple.traditional-mac-plain-text") };
+const CFStringEncoding encodings[] = { 
+  kCFStringEncodingUnicode, 
+  kCFStringEncodingUTF8, 
+  kCFStringEncodingMacRoman};
+const size_t handledFlavorsCount = sizeof(encodings)/sizeof(CFStringEncoding);
+
+// clipboard variables definitions :
+char *fl_selection_buffer[2];
+int fl_selection_length[2];
+static int fl_selection_buffer_length[2];
+
+static PasteboardRef myPasteboard = 0;
+static void allocatePasteboard() {
+  if (!myPasteboard)
+    PasteboardCreate(kPasteboardClipboard, &myPasteboard);
+}
+
+
+/*
+ * create a selection
+ * owner: widget that created the selection
+ * stuff: pointer to selected data
+ * size of selected data
+ */
+void fltk3::copy(const char *stuff, int len, int clipboard) {
+  if (!stuff || len<0) return;
+  if (len+1 > fl_selection_buffer_length[clipboard]) {
+    delete[] fl_selection_buffer[clipboard];
+    fl_selection_buffer[clipboard] = new char[len+100];
+    fl_selection_buffer_length[clipboard] = len+100;
+  }
+  memcpy(fl_selection_buffer[clipboard], stuff, len);
+  fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
+  fl_selection_length[clipboard] = len;
+  if (clipboard) {
+    allocatePasteboard();
+    OSStatus err = PasteboardClear(myPasteboard);
+    if (err!=noErr) return; // clear did not work, maybe not owner of clipboard.
+    PasteboardSynchronize(myPasteboard);
+    CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[1], len);
+    if (text==NULL) return; // there was a pb creating the object, abort.
+    err=PasteboardPutItemFlavor(myPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), text, 0);
+    CFRelease(text);
+  }
+}
+
+// Call this when a "paste" operation happens:
+void fltk3::paste(fltk3::Widget &receiver, int clipboard) {
+  if (clipboard) {
+    // see if we own the selection, if not go get it:
+    fl_selection_length[1] = 0;
+    OSStatus err = noErr;
+    Boolean found = false;
+    CFDataRef flavorData = NULL;
+    CFStringEncoding encoding = 0;
+    
+    allocatePasteboard();
+    PasteboardSynchronize(myPasteboard);
+    ItemCount nFlavor = 0, i, j;
+    err = PasteboardGetItemCount(myPasteboard, &nFlavor);
+    if (err==noErr) {
+      for (i=1; i<=nFlavor; i++) {
+        PasteboardItemID itemID = 0;
+        CFArrayRef flavorTypeArray = NULL;
+        found = false;
+        err = PasteboardGetItemIdentifier(myPasteboard, i, &itemID);
+        if (err!=noErr) continue;
+        err = PasteboardCopyItemFlavors(myPasteboard, itemID, &flavorTypeArray);
+        if (err!=noErr) {
+          if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;}
+          continue;
+        }
+        CFIndex flavorCount = CFArrayGetCount(flavorTypeArray);
+        for (j = 0; j < handledFlavorsCount; j++) {
+          for (CFIndex flavorIndex=0; flavorIndex<flavorCount; flavorIndex++) {
+            CFStringRef flavorType = (CFStringRef)CFArrayGetValueAtIndex(flavorTypeArray, flavorIndex);
+            if (UTTypeConformsTo(flavorType, flavorNames[j])) {
+              err = PasteboardCopyItemFlavorData( myPasteboard, itemID, flavorNames[j], &flavorData );
+              if (err != noErr) continue;
+              encoding = encodings[j];
+              found = true;
+              break;
+            }
+          }
+          if (found) break;
+        }
+        if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;}
+        if (found) break;
+      }
+      if (found) {
+        CFIndex len = CFDataGetLength(flavorData);
+        CFStringRef mycfs = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(flavorData), len, encoding, false);
+        CFRelease(flavorData);
+        len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(mycfs), kCFStringEncodingUTF8) + 1;
+        if ( len >= fl_selection_buffer_length[1] ) {
+          fl_selection_buffer_length[1] = len;
+          delete[] fl_selection_buffer[1];
+          fl_selection_buffer[1] = new char[len];
+        }
+        CFStringGetCString(mycfs, fl_selection_buffer[1], len, kCFStringEncodingUTF8);
+        CFRelease(mycfs);
+        len = strlen(fl_selection_buffer[1]);
+        fl_selection_length[1] = len;
+        convert_crlf(fl_selection_buffer[1],len); // turn all \r characters into \n:
+      }
+    }
+  }
+  fltk3::e_text = fl_selection_buffer[clipboard];
+  fltk3::e_length = fl_selection_length[clipboard];
+  if (!fltk3::e_text) fltk3::e_text = (char *)"";
+  receiver.handle(fltk3::PASTE);
+}
+
+void fltk3::add_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+  // check, if this timer slot exists already
+  for (int i = 0; i < mac_timer_used; ++i) {
+    MacTimeout& t = mac_timers[i];
+    // if so, simply change the fire interval
+    if (t.callback == cb  &&  t.data == data) {
+      CFRunLoopTimerSetNextFireDate(t.timer, CFAbsoluteTimeGetCurrent() + time );
+      t.pending = 1;
+      return;
+    }
+  }
+  // no existing timer to use. Create a new one:
+  int timer_id = -1;
+  // find an empty slot in the timer array
+  for (int i = 0; i < mac_timer_used; ++i) {
+    if ( !mac_timers[i].timer ) {
+      timer_id = i;
+      break;
+    }
+  }
+  // if there was no empty slot, append a new timer
+  if (timer_id == -1) {
+    // make space if needed
+    if (mac_timer_used == mac_timer_alloc) {
+      realloc_timers();
+    }
+    timer_id = mac_timer_used++;
+  }
+  // now install a brand new timer
+  MacTimeout& t = mac_timers[timer_id];
+  CFRunLoopTimerContext context = {0, data, NULL,NULL,NULL};
+  CFRunLoopTimerRef timerRef = CFRunLoopTimerCreate(kCFAllocatorDefault, 
+						    CFAbsoluteTimeGetCurrent() + time,
+						    1E30,  
+						    0,
+						    0,
+						    do_timer,
+						    &context
+						    );
+  if (timerRef) {
+    CFRunLoopAddTimer(CFRunLoopGetCurrent(),
+		      timerRef,
+		      kCFRunLoopDefaultMode);
+    t.callback = cb;
+    t.data     = data;
+    t.timer    = timerRef;
+    t.pending  = 1;
+  }
+}
+
+void fltk3::repeat_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+  // currently, repeat_timeout does not subtract the trigger time of the previous timer event as it should.
+  add_timeout(time, cb, data);
+}
+
+int fltk3::has_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+  for (int i = 0; i < mac_timer_used; ++i) {
+    MacTimeout& t = mac_timers[i];
+    if (t.callback == cb  &&  t.data == data && t.pending) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+void fltk3::remove_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+  for (int i = 0; i < mac_timer_used; ++i) {
+    MacTimeout& t = mac_timers[i];
+    if (t.callback == cb  && ( t.data == data || data == NULL)) {
+      delete_timer(t);
+    }
+  }
+}
+
+int Fl_X::unlink(Fl_X *start) {
+  if (start) {
+    Fl_X *pc = start;
+    while (pc) {
+      if (pc->xidNext == this) {
+        pc->xidNext = xidNext;
+        return 1;
+      }
+      if (pc->xidChildren) {
+        if (pc->xidChildren == this) {
+          pc->xidChildren = xidNext;
+          return 1;
+        }
+        if (unlink(pc->xidChildren))
+          return 1;
+      }
+      pc = pc->xidNext;
+    }
+  } else {
+    for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next ) {
+      if (unlink(pc))
+        return 1;
+    }
+  }  
+  return 0;
+}
+
+void Fl_X::relink(fltk3::Window *w, fltk3::Window *wp) {
+  Fl_X *x = Fl_X::i(w);
+  Fl_X *p = Fl_X::i(wp);
+  if (!x || !p) return;
+  // first, check if 'x' is already registered as a child of 'p'
+  for (Fl_X *i = p->xidChildren; i; i=i->xidNext) {
+    if (i == x) return;
+  }
+  // now add 'x' as the first child of 'p'
+  x->xidNext = p->xidChildren;
+  p->xidChildren = x;
+}
+
+void Fl_X::destroy() {
+  // subwindows share their xid with their parent window, so should not close it
+  if (!subwindow && w && !w->parent() && xid) {
+    [[(NSWindow *)xid contentView] release];
+    [(NSWindow *)xid close];
+  }
+}
+
+void Fl_X::map() {
+  if (w && xid) {
+    [(NSWindow *)xid orderFront:nil];
+  }
+  //+ link to window list
+  if (w && w->parent()) {
+    Fl_X::relink(w, w->window() );
+    w->redraw();
+  }
+}
+
+void Fl_X::unmap() {
+  if (w && !w->parent() && xid) {
+    [(NSWindow *)xid orderOut:nil];
+  }
+  if (w && Fl_X::i(w)) 
+    Fl_X::i(w)->unlink();
+}
+
+
+// removes x,y,w,h rectangle from region r and returns result as a new fltk3::Region
+static fltk3::Region MacRegionMinusRect(fltk3::Region r, int x,int y,int w,int h)
+{
+  fltk3::Region outr = (fltk3::Region)malloc(sizeof(*outr));
+  outr->rects = (CGRect*)malloc(4 * r->count * sizeof(CGRect));
+  outr->count = 0;
+  CGRect rect = fl_cgrectmake_cocoa(x, y, w, h);
+  for( int i = 0; i < r->count; i++) {
+    CGRect A = r->rects[i];
+    CGRect test = CGRectIntersection(A, rect);
+    if (CGRectIsEmpty(test)) {
+      outr->rects[(outr->count)++] = A;
+    }
+    else {
+      const CGFloat verylarge = 100000.;
+      CGRect side = CGRectMake(0,0,rect.origin.x,verylarge);// W side
+      test = CGRectIntersection(A, side);
+      if ( ! CGRectIsEmpty(test)) {
+        outr->rects[(outr->count)++] = test;
+      }
+      side = CGRectMake(0,rect.origin.y + rect.size.height,verylarge,verylarge);// N side
+      test = CGRectIntersection(A, side);
+      if ( ! CGRectIsEmpty(test)) {
+        outr->rects[(outr->count)++] = test;
+      }
+      side = CGRectMake(rect.origin.x + rect.size.width, 0, verylarge, verylarge);// E side
+      test = CGRectIntersection(A, side);
+      if ( ! CGRectIsEmpty(test)) {
+        outr->rects[(outr->count)++] = test;
+      }
+      side = CGRectMake(0, 0, verylarge, rect.origin.y);// S side
+      test = CGRectIntersection(A, side);
+      if ( ! CGRectIsEmpty(test)) {
+        outr->rects[(outr->count)++] = test;
+      }
+    }
+  }
+  if (outr->count == 0) {
+    free(outr->rects);
+    free(outr);
+    outr = XRectangleRegion(0,0,0,0);
+  }
+  else outr->rects = (CGRect*)realloc(outr->rects, outr->count * sizeof(CGRect));
+  return outr;
+}
+
+// intersects current and x,y,w,h rectangle and returns result as a new fltk3::Region
+fltk3::Region Fl_X::intersect_region_and_rect(fltk3::Region current, int x,int y,int w, int h)
+{
+  if (current == NULL) return XRectangleRegion(x,y,w,h);
+  CGRect r = fl_cgrectmake_cocoa(x, y, w, h);
+  fltk3::Region outr = (fltk3::Region)malloc(sizeof(*outr));
+  outr->count = current->count;
+  outr->rects =(CGRect*)malloc(outr->count * sizeof(CGRect));
+  int j = 0;
+  for(int i = 0; i < current->count; i++) {
+    CGRect test = CGRectIntersection(current->rects[i], r);
+    if (!CGRectIsEmpty(test)) outr->rects[j++] = test;
+  }
+  if (j) {
+    outr->count = j;
+    outr->rects = (CGRect*)realloc(outr->rects, outr->count * sizeof(CGRect));
+  }
+  else {
+    XDestroyRegion(outr);
+    outr = XRectangleRegion(0,0,0,0);
+  }
+  return outr;
+}
+
+void Fl_X::collapse() {
+  [(NSWindow *)xid miniaturize:nil];
+}
+
+static NSImage *CGBitmapContextToNSImage(CGContextRef c)
+// the returned NSImage is autoreleased
+{
+  unsigned char *pdata = (unsigned char *)CGBitmapContextGetData(c);
+  NSBitmapImageRep *imagerep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:&pdata
+                                                                       pixelsWide:CGBitmapContextGetWidth(c)
+                                                                       pixelsHigh:CGBitmapContextGetHeight(c)
+                                                                    bitsPerSample:8
+                                                                  samplesPerPixel:4
+                                                                         hasAlpha:YES
+                                                                         isPlanar:NO
+                                                                   colorSpaceName:NSDeviceRGBColorSpace
+                                                                      bytesPerRow:CGBitmapContextGetBytesPerRow(c)
+                                                                     bitsPerPixel:CGBitmapContextGetBitsPerPixel(c)];
+  NSImage* image = [[NSImage alloc] initWithData: [imagerep TIFFRepresentation]];
+  [imagerep release];
+  return [image autorelease];
+}
+
+static NSCursor *PrepareCursor(NSCursor *cursor, CGContextRef (*f)() )
+{
+  if (cursor == nil) {
+    CGContextRef c = f();
+    NSImage *image = CGBitmapContextToNSImage(c);
+    fl_delete_offscreen( (fltk3::Offscreen)c ); 
+    NSPoint pt = {[image size].width/2, [image size].height/2};
+    cursor = [[NSCursor alloc] initWithImage:image hotSpot:pt];
+  }
+  return cursor;
+}
+
+void Fl_X::set_cursor(fltk3::Cursor c)
+{
+  NSCursor *icrsr;
+  switch (c) {
+    case fltk3::CURSOR_CROSS:  icrsr = [NSCursor crosshairCursor]; break;
+    case fltk3::CURSOR_WAIT:
+      static NSCursor *watch = nil;
+      watch = PrepareCursor(watch,  &Fl_X::watch_cursor_image);
+      icrsr = watch;
+      break;
+    case fltk3::CURSOR_INSERT: icrsr = [NSCursor IBeamCursor]; break;
+    case fltk3::CURSOR_N:      icrsr = [NSCursor resizeUpCursor]; break;
+    case fltk3::CURSOR_S:      icrsr = [NSCursor resizeDownCursor]; break;
+    case fltk3::CURSOR_NS:     icrsr = [NSCursor resizeUpDownCursor]; break;
+    case fltk3::CURSOR_HELP:   
+      static NSCursor *help = nil;
+      help = PrepareCursor(help,  &Fl_X::help_cursor_image);
+      icrsr = help;
+      break;
+    case fltk3::CURSOR_HAND:   icrsr = [NSCursor pointingHandCursor]; break;
+    case fltk3::CURSOR_MOVE:   icrsr = [NSCursor openHandCursor]; break;
+    case fltk3::CURSOR_NE:
+    case fltk3::CURSOR_SW:
+    case fltk3::CURSOR_NESW:   
+      static NSCursor *nesw = nil;
+      nesw = PrepareCursor(nesw,  &Fl_X::nesw_cursor_image);
+      icrsr = nesw;
+      break;
+    case fltk3::CURSOR_E:      icrsr = [NSCursor resizeRightCursor]; break;
+    case fltk3::CURSOR_W:      icrsr = [NSCursor resizeLeftCursor]; break;
+    case fltk3::CURSOR_WE:     icrsr = [NSCursor resizeLeftRightCursor]; break;
+    case fltk3::CURSOR_SE:
+    case fltk3::CURSOR_NW:
+    case fltk3::CURSOR_NWSE:   
+      static NSCursor *nwse = nil;
+      nwse = PrepareCursor(nwse,  &Fl_X::nwse_cursor_image);
+      icrsr = nwse;
+      break;
+    case fltk3::CURSOR_NONE:   
+      static NSCursor *none = nil;
+      none = PrepareCursor(none,  &Fl_X::none_cursor_image);
+      icrsr = none; 
+      break;
+    case fltk3::CURSOR_ARROW:
+    case fltk3::CURSOR_DEFAULT:
+    default:			   icrsr = [NSCursor arrowCursor];
+      break;
+  }
+  [icrsr set];
+  cursor = icrsr;
+}
+
+@interface FLaboutItemTarget : NSObject 
+{
+}
+- (void)showPanel;
+- (void)printPanel;
+@end
+@implementation FLaboutItemTarget
+- (void)showPanel
+{
+  NSDictionary *options;
+  options = [NSDictionary dictionaryWithObjectsAndKeys:
+             [[[NSAttributedString alloc] 
+               initWithString:[NSString stringWithFormat:@" GUI with FLTK %d.%d", 
+                               FL_MAJOR_VERSION, FL_MINOR_VERSION ]] autorelease], @"Credits",
+             nil];
+  [NSApp orderFrontStandardAboutPanelWithOptions:options];
+}
+//#include <fltk3/PostScript.h>
+- (void)printPanel
+{
+  fltk3::Printer printer;
+  //fltk3::PostScriptFileDevice printer;
+  int w, h, ww, wh;
+  fltk3::Window *win = fltk3::first_window();
+  if(!win) return;
+  if( printer.start_job(1) ) return;
+  if( printer.start_page() ) return;
+  fl_lock_function();
+  // scale the printer device so that the window fits on the page
+  float scale = 1;
+  printer.printable_rect(&w, &h);
+  ww = win->decorated_w();
+  wh = win->decorated_h();
+  if (ww>w || wh>h) {
+    scale = (float)w/win->w();
+    if ((float)h/wh < scale) scale = (float)h/wh;
+    printer.scale(scale);
+  }
+//#define ROTATE 1
+#ifdef ROTATE
+  printer.scale(scale * 0.8, scale * 0.8);
+  printer.printable_rect(&w, &h);
+  printer.origin(w/2, h/2 );
+  printer.rotate(20.);
+  printer.print_window( win, - win->w()/2, - win->h()/2 );
+#else
+  printer.print_window(win);
+#endif
+  printer.end_page();
+  printer.end_job();
+  fl_unlock_function();
+}
+@end
+
+static void createAppleMenu(void)
+{
+  static BOOL donethat = NO;
+  if (donethat) return;
+  donethat = YES;
+  NSMenu *mainmenu, *services, *appleMenu;
+  NSMenuItem *menuItem;
+  NSString *title;
+
+  NSString *nsappname = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
+  if (nsappname == nil)
+    nsappname = [[NSProcessInfo processInfo] processName];
+  appleMenu = [[NSMenu alloc] initWithTitle:@""];
+  /* Add menu items */
+  title = [[NSString stringWithUTF8String:Fl_Mac_App_Menu::about] stringByAppendingString:nsappname];
+  menuItem = [appleMenu addItemWithTitle:title action:@selector(showPanel) keyEquivalent:@""];
+  FLaboutItemTarget *about = [[FLaboutItemTarget alloc] init];
+  [menuItem setTarget:about];
+  [appleMenu addItem:[NSMenuItem separatorItem]];
+  // Print front window
+  if (strlen(Fl_Mac_App_Menu::print) > 0) {
+    menuItem = [appleMenu 
+		addItemWithTitle:[NSString stringWithUTF8String:Fl_Mac_App_Menu::print] 
+		action:@selector(printPanel) 
+		keyEquivalent:@""];
+    [menuItem setTarget:about];
+    [appleMenu setAutoenablesItems:NO];
+    [menuItem setEnabled:YES];
+    [appleMenu addItem:[NSMenuItem separatorItem]];
+    }
+  // Services Menu
+  services = [[NSMenu alloc] init];
+  menuItem = [appleMenu 
+	      addItemWithTitle:[NSString stringWithUTF8String:Fl_Mac_App_Menu::services] 
+	      action:nil 
+	      keyEquivalent:@""];
+  [appleMenu setSubmenu:services forItem:menuItem];
+  [appleMenu addItem:[NSMenuItem separatorItem]];
+  // Hide AppName
+  title = [[NSString stringWithUTF8String:Fl_Mac_App_Menu::hide] stringByAppendingString:nsappname];
+  [appleMenu addItemWithTitle:title 
+		       action:@selector(hide:) 
+		keyEquivalent:@"h"];
+  // Hide Others
+  menuItem = [appleMenu 
+	      addItemWithTitle:[NSString stringWithUTF8String:Fl_Mac_App_Menu::hide_others] 
+	      action:@selector(hideOtherApplications:) 
+	      keyEquivalent:@"h"];
+  [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
+  // Show All
+  [appleMenu addItemWithTitle:[NSString stringWithUTF8String:Fl_Mac_App_Menu::show] 
+		       action:@selector(unhideAllApplications:) keyEquivalent:@""];
+  [appleMenu addItem:[NSMenuItem separatorItem]];
+  // Quit AppName
+  title = [[NSString stringWithUTF8String:Fl_Mac_App_Menu::quit] 
+	   stringByAppendingString:nsappname];
+  [appleMenu addItemWithTitle:title 
+		       action:@selector(terminate:) 
+		keyEquivalent:@"q"];
+  /* Put menu into the menubar */
+  menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
+  [menuItem setSubmenu:appleMenu];
+  mainmenu = [[NSMenu alloc] initWithTitle:@""];
+  [mainmenu addItem:menuItem];
+  if (fl_mac_os_version < 100600) {
+    //	[NSApp setAppleMenu:appleMenu];
+    //	to avoid compiler warning raised by use of undocumented setAppleMenu	:
+    [NSApp performSelector:@selector(setAppleMenu:) withObject:appleMenu];
+  }
+  [NSApp setServicesMenu:services];
+  [NSApp setMainMenu:mainmenu];
+  [services release];
+  [mainmenu release];
+  [appleMenu release];
+  [menuItem release];
+}
+
+@interface FLMenuItem : NSMenuItem {
+}
+- (void) doCallback:(id)unused;
+- (void) directCallback:(id)unused;
+@end
+@implementation FLMenuItem
+- (void) doCallback:(id)unused
+{
+  fl_lock_function();
+  int flRank = [self tag];
+  const fltk3::MenuItem *items = fltk3::sys_menu_bar->fltk3::Menu_::menu();
+  const fltk3::MenuItem *item = items + flRank;
+  if (item) {
+    fltk3::sys_menu_bar->picked(item);
+    if ( item->flags & fltk3::MENU_TOGGLE ) {	// update the menu toggle symbol
+      [self setState:(item->value() ? NSOnState : NSOffState)];
+    }
+    else if ( item->flags & fltk3::MENU_RADIO ) {	// update the menu radio symbols
+      int from = flRank;
+      while( from > 0 && items[from - 1].label() && (items[from - 1].flags & fltk3::MENU_RADIO) &&
+            !(items[from - 1].flags & fltk3::MENU_DIVIDER) ) {
+        from--;
+      }
+      int to = flRank;
+      while( !(items[to].flags & fltk3::MENU_DIVIDER) && items[to + 1].label() && 
+            (items[to + 1].flags & fltk3::MENU_RADIO) ) {
+        to++;
+      }
+      NSMenu *nsmenu = [self menu];
+      int nsrank = (int)[nsmenu indexOfItem:self];
+      for(int i =  from - flRank + nsrank ; i <= to - flRank + nsrank; i++) {
+        NSMenuItem *nsitem = [nsmenu itemAtIndex:i];
+        if (nsitem != self) [nsitem setState:NSOffState];
+        else [nsitem setState:(item->value() ? NSOnState : NSOffState) ];
+      }
+    }
+  }
+  fl_unlock_function();
+}
+- (void) directCallback:(id)unused
+{
+  fl_lock_function();
+  fltk3::MenuItem *item = (fltk3::MenuItem *)[(NSData*)[self representedObject] bytes];
+  if ( item && item->callback() ) item->do_callback(NULL);
+  fl_unlock_function();
+}
+@end
+
+void fl_mac_set_about( fltk3::Callback *cb, void *user_data, unsigned int shortcut) 
+{
+  fl_open_display();
+  fltk3::MenuItem aboutItem;
+  memset(&aboutItem, 0, sizeof(fltk3::MenuItem));
+  aboutItem.callback(cb);
+  aboutItem.user_data(user_data);
+  aboutItem.shortcut(shortcut);
+  NSMenu *appleMenu = [[[NSApp mainMenu] itemAtIndex:0] submenu];
+  CFStringRef cfname = CFStringCreateCopy(NULL, (CFStringRef)[[appleMenu itemAtIndex:0] title]);
+  [appleMenu removeItemAtIndex:0];
+  FLMenuItem *item = [[[FLMenuItem alloc] initWithTitle:(NSString*)cfname 
+						 action:@selector(directCallback:) 
+					  keyEquivalent:@""] autorelease];
+  if (aboutItem.shortcut()) {
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setKeyEquivalent, item, aboutItem.shortcut() & 0xff);
+    fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::setKeyEquivalentModifierMask, item, aboutItem.shortcut() );
+  }
+  NSData *pointer = [NSData dataWithBytes:&aboutItem length:sizeof(fltk3::MenuItem)];
+  [item setRepresentedObject:pointer];
+  [appleMenu insertItem:item atIndex:0];
+  CFRelease(cfname);
+  [item setTarget:item];
+}
+
+static char *remove_ampersand(const char *s)
+{
+  char *ret = strdup(s);
+  const char *p = s;
+  char *q = ret;
+  while(*p != 0) {
+    if (p[0]=='&') {
+      if (p[1]=='&') {
+        *q++ = '&'; p+=2;
+      } else {
+        p++;
+      }
+    } else {
+      *q++ = *p++;
+    }
+  }
+  *q = 0;
+  return ret;
+}
+
+void *fltk3::SysMenuBar::doMenuOrItemOperation(fltk3::SysMenuBar::menuOrItemOperation operation, ...)
+/* these operations apply to menus, submenus, or menu items
+ */
+{
+  NSAutoreleasePool *localPool;
+  localPool = [[NSAutoreleasePool alloc] init]; 
+  NSMenu *menu;
+  NSMenuItem *item;
+  int value;
+  void *pter;
+  void *retval = NULL;
+  va_list ap;
+  va_start(ap, operation);
+  
+  if (operation == fltk3::SysMenuBar::itemAtIndex) {	// arguments: NSMenu*, int. Returns the item
+    menu = va_arg(ap, NSMenu*);
+    value = va_arg(ap, int);
+    retval = (void *)[menu itemAtIndex:value];
+  }
+  else if (operation == fltk3::SysMenuBar::setKeyEquivalent) {	// arguments: NSMenuItem*, int
+    item = va_arg(ap, NSMenuItem*);
+    value = va_arg(ap, int);
+    char key = value;
+    NSString *equiv = [[NSString alloc] initWithBytes:&key length:1 encoding:NSASCIIStringEncoding];
+    [item setKeyEquivalent:equiv];
+    [equiv release];
+  }
+  else if (operation == fltk3::SysMenuBar::setKeyEquivalentModifierMask) {		// arguments: NSMenuItem*, int
+    item = va_arg(ap, NSMenuItem*);
+    value = va_arg(ap, int);
+    NSUInteger macMod = 0;
+    if ( value & fltk3::META ) macMod = NSCommandKeyMask;
+    if ( value & fltk3::SHIFT || isupper(value) ) macMod |= NSShiftKeyMask;
+    if ( value & fltk3::ALT ) macMod |= NSAlternateKeyMask;
+    if ( value & fltk3::CTRL ) macMod |= NSControlKeyMask;
+    [item setKeyEquivalentModifierMask:macMod];
+  }
+  else if (operation == fltk3::SysMenuBar::setState) {	// arguments: NSMenuItem*, int
+    item = va_arg(ap, NSMenuItem*);
+    value = va_arg(ap, int);
+    [item setState:(value ? NSOnState : NSOffState)];
+  }
+  else if (operation == fltk3::SysMenuBar::initWithTitle) {	// arguments: const char*title. Returns the newly created menu
+                                                                // creates a new (sub)menu
+    char *ts = remove_ampersand(va_arg(ap, char *));
+    CFStringRef title = CFStringCreateWithCString(NULL, ts, kCFStringEncodingUTF8);
+    free(ts);
+    NSMenu *menu = [[NSMenu alloc] initWithTitle:(NSString*)title];
+    CFRelease(title);
+    [menu setAutoenablesItems:NO];
+    retval = (void *)menu;
+  }
+  else if (operation == fltk3::SysMenuBar::numberOfItems) {	// arguments: NSMenu *menu, int *pcount
+                                                                // upon return, *pcount is set to menu's item count
+    menu = va_arg(ap, NSMenu*);
+    pter = va_arg(ap, void *);
+    *(int*)pter = [menu numberOfItems];
+  }
+  else if (operation == fltk3::SysMenuBar::setSubmenu) {		// arguments: NSMenuItem *item, NSMenu *menu
+                                                        	// sets 'menu' as submenu attached to 'item'
+    item = va_arg(ap, NSMenuItem*);
+    menu = va_arg(ap, NSMenu*);
+    [item setSubmenu:menu];
+    [menu release];
+  }
+  else if (operation == fltk3::SysMenuBar::setEnabled) {		// arguments: NSMenuItem*, int
+    item = va_arg(ap, NSMenuItem*);
+    value = va_arg(ap, int);
+    [item setEnabled:(value ? YES : NO)];
+  }
+  else if (operation == fltk3::SysMenuBar::addSeparatorItem) {	// arguments: NSMenu*
+    menu = va_arg(ap, NSMenu*);
+    [menu addItem:[NSMenuItem separatorItem]];
+  }
+  else if (operation == fltk3::SysMenuBar::setTitle) {		// arguments: NSMenuItem*, const char *
+    item = va_arg(ap, NSMenuItem*);
+    char *ts = remove_ampersand(va_arg(ap, char *));
+    CFStringRef title = CFStringCreateWithCString(NULL, ts, kCFStringEncodingUTF8);
+    free(ts);
+    [item setTitle:(NSString*)title];
+    CFRelease(title);
+  }
+  else if (operation == fltk3::SysMenuBar::removeItem) {		// arguments: NSMenu*, int
+    menu = va_arg(ap, NSMenu*);
+    value = va_arg(ap, int);
+    [menu removeItem:[menu itemAtIndex:value]];
+  }
+  else if (operation == fltk3::SysMenuBar::addNewItem) {		// arguments: NSMenu *menu, int flrank, int *prank
+    // creates a new menu item at the end of 'menu'
+    // attaches the item of rank flrank (counted in fltk3::Menu_) of fltk3::sys_menu_bar to it
+    // upon return, puts the rank (counted in NSMenu) of the new item in *prank unless prank is NULL
+    menu = va_arg(ap, NSMenu*);
+    int flRank = va_arg(ap, int);
+    char *name = remove_ampersand( (fltk3::sys_menu_bar->fltk3::Menu_::menu() + flRank)->label());
+    int *prank = va_arg(ap, int*);
+    CFStringRef cfname = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
+    free(name);
+    FLMenuItem *item = [[FLMenuItem alloc] initWithTitle:(NSString*)cfname 
+						  action:@selector(doCallback:) 
+					   keyEquivalent:@""];
+    [item setTag:flRank];
+    [menu addItem:item];
+    CFRelease(cfname);
+    [item setTarget:item];
+    if (prank != NULL) *prank = [menu indexOfItem:item];
+    [item release];
+  }
+  else if (operation == fltk3::SysMenuBar::renameItem) {		// arguments: int rank, const char *newname
+    // renames the system menu item numbered rank in fltk3::sys_menu_bar->menu()
+    int rank = va_arg(ap, int);
+    char *newname = remove_ampersand( va_arg(ap, const char *) );
+    int countmenus = [[NSApp mainMenu] numberOfItems];
+    bool found = NO;
+    NSMenuItem *macitem = 0;
+    for(int i = 1; (!found) && i < countmenus; i++) {
+      NSMenuItem *item = [[NSApp mainMenu] itemAtIndex:i];
+      NSMenu *submenu = [item submenu];
+      if (submenu == nil) continue;
+      int countitems = [submenu numberOfItems];
+      for(int j = 0; j < countitems; j++) {
+	macitem = [submenu itemAtIndex:j];
+	if ([macitem tag] == rank) { found = YES; break; }
+      }
+    }
+    if (found) {
+      [macitem setTitle:[[[NSString alloc] initWithUTF8String:newname] autorelease]];
+    }
+    free(newname);
+  }
+  va_end(ap);
+  [localPool release];
+  return retval;
+}
+
+void Fl_X::set_key_window()
+{
+  [(NSWindow*)xid makeKeyWindow];
+}
+
+static NSImage *imageFromText(const char *text, int *pwidth, int *pheight)
+{
+  const char *p, *q;
+  int width = 0, height, w2, ltext = strlen(text);
+  fltk3::font(fltk3::HELVETICA, 10);
+  p = text;
+  int nl = 0;
+  while((q=strchr(p, '\n')) != NULL) { 
+    nl++; 
+    w2 = int(fltk3::width(p, q - p));
+    if (w2 > width) width = w2;
+    p = q + 1; 
+  }
+  if (text[ ltext - 1] != '\n') {
+    nl++;
+    w2 = int(fltk3::width(p));
+    if (w2 > width) width = w2;
+  }
+  height = nl * fltk3::height() + 3;
+  width += 6;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(width, height);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,width,height);
+  fltk3::color(fltk3::BLACK);
+  p = text;
+  int y = fltk3::height();
+  while(TRUE) {
+    q = strchr(p, '\n');
+    if (q) {
+      fltk3::draw(p, q - p, 3, y);
+    } else {
+      fltk3::draw(p, 3, y);
+      break;
+    }
+    y += fltk3::height();
+    p = q + 1;
+  }
+  fl_end_offscreen();
+  NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off );
+  fl_delete_offscreen( off );
+  *pwidth = width;
+  *pheight = height;
+  return image;
+}
+
+static NSImage *defaultDragImage(int *pwidth, int *pheight)
+{
+  const int width = 16, height = 16;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(width, height);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,width,height);
+  CGContextSetRGBStrokeColor( (CGContextRef)off, 0,0,0,0.6);
+  fltk3::rect(0,0,width,height);
+  fltk3::rect(2,2,width-4,height-4);
+  fl_end_offscreen();
+  NSImage* image = CGBitmapContextToNSImage( (CGContextRef)off );
+  fl_delete_offscreen( off );
+  *pwidth = width;
+  *pheight = height;
+  return image;
+}
+
+int fltk3::dnd(void)
+{
+  CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[0], fl_selection_length[0]);
+  if (text==NULL) return false;
+  NSAutoreleasePool *localPool;
+  localPool = [[NSAutoreleasePool alloc] init]; 
+  NSPasteboard *mypasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+  [mypasteboard declareTypes:[NSArray arrayWithObjects:@"public.utf8-plain-text", nil] owner:nil];
+  [mypasteboard setData:(NSData*)text forType:@"public.utf8-plain-text"];
+  CFRelease(text);
+  fltk3::Widget *w = fltk3::pushed();
+  fltk3::Window *win = w->window();
+  if (win == NULL) {
+    win = (fltk3::Window*)w;
+  } else { 
+    while(win->window()) win = win->window();
+  }
+  NSView *myview = [(NSWindow*)Fl_X::i(win)->xid contentView];
+  NSEvent *theEvent = [NSApp currentEvent];
+  
+  int width, height;
+  NSImage *image;
+  if ( dynamic_cast<fltk3::Input_*>(w) != NULL ||  dynamic_cast<fltk3::TextDisplay*>(w) != NULL) {
+    fl_selection_buffer[0][ fl_selection_length[0] ] = 0;
+    image = imageFromText(fl_selection_buffer[0], &width, &height);
+  } else {
+    image = defaultDragImage(&width, &height);
+  }
+  
+  static NSSize offset={0,0};
+  NSPoint pt = [theEvent locationInWindow];
+  pt.x -= width/2;
+  pt.y -= height/2;
+  [myview dragImage:image  at:pt  offset:offset 
+              event:theEvent  pasteboard:mypasteboard  
+             source:myview  slideBack:YES];
+  if ( w ) {
+    int old_event = fltk3::e_number;
+    w->handle(fltk3::e_number = fltk3::RELEASE);
+    fltk3::e_number = old_event;
+    fltk3::pushed( 0 );
+  }
+  [localPool release];
+  return true;
+}
+
+unsigned char *Fl_X::bitmap_from_window_rect(fltk3::Window *win, int x, int y, int w, int h, int *bytesPerPixel)
+// delete the returned pointer after use
+{
+  while(win->window()) {
+    x += win->x();
+    y += win->y();
+    win = win->window();
+  }
+  CGFloat epsilon = 0;
+  if (fl_mac_os_version >= 100600) epsilon = 0.001;
+  // The epsilon offset is absolutely necessary under 10.6. Without it, the top pixel row and
+  // left pixel column are not read, and bitmap is read shifted by one pixel in both directions. 
+  // Under 10.5, we want no offset.
+  NSRect rect = NSMakeRect(x - epsilon, y - epsilon, w, h);
+  NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithFocusedViewRect:rect];
+  *bytesPerPixel = [bitmap bitsPerPixel]/8;
+  int bpp = (int)[bitmap bytesPerPlane];
+  int bpr = (int)[bitmap bytesPerRow];
+  int hh = bpp/bpr; // sometimes hh = h-1 for unclear reason
+  int ww = bpr/(*bytesPerPixel); // sometimes ww = w-1
+  unsigned char *data = new unsigned char[w * h *  *bytesPerPixel];
+  if (w == ww) {
+    memcpy(data, [bitmap bitmapData], w * hh *  *bytesPerPixel);
+  } else {
+    unsigned char *p = [bitmap bitmapData];
+    unsigned char *q = data;
+    for(int i = 0;i < hh; i++) {
+      memcpy(q, p, *bytesPerPixel * ww);
+      p += bpr;
+      q += w * *bytesPerPixel;
+      }
+  }
+  [bitmap release];
+  return data;
+}
+
+static void imgProviderReleaseData (void *info, const void *data, size_t size)
+{
+  delete[] (unsigned char *)data;
+}
+
+CGImageRef Fl_X::CGImage_from_window_rect(fltk3::Window *win, int x, int y, int w, int h)
+// CFRelease the returned CGImageRef after use
+{
+  int bpp;
+  unsigned char *bitmap = bitmap_from_window_rect(win, x, y, w, h, &bpp);
+  CGImageRef img;
+  CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+  CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, w*h*bpp, imgProviderReleaseData);
+  img = CGImageCreate(w, h, 8, 8*bpp, w*bpp, lut,
+                      bpp == 3 ? kCGImageAlphaNone : kCGImageAlphaLast,
+                      provider, NULL, false, kCGRenderingIntentDefault);
+  CGColorSpaceRelease(lut);
+  CGDataProviderRelease(provider);
+  return img;
+}
+
+WindowRef Fl_X::window_ref()
+{
+  return (WindowRef)[(FLWindow*)xid windowRef];
+}
+
+// so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes
+CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h) {
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) return CGRectMake(x-0.5, y-0.5, w, h); 
+  return CGRectMake(x, y, w > 0 ? w - 0.9 : 0, h > 0 ? h - 0.9 : 0);
+}
+
+Window fl_xid(const fltk3::Window* w)
+{
+  Fl_X *temp = Fl_X::i(w);
+  return temp ? temp->xid : 0;
+}
+
+int fltk3::Window::decorated_w()
+{
+  if (!shown() || parent() || !border() || !visible()) return w();
+  int bx, by, bt;
+  get_window_frame_sizes(bx, by, bt);
+  return w() + 2 * bx;
+}
+
+int fltk3::Window::decorated_h()
+{
+  if (!shown() || parent() || !border() || !visible()) return h();
+  int bx, by, bt;
+  get_window_frame_sizes(bx, by, bt);
+  return h() + bt + by;
+}
+
+void fltk3::PagedDevice::print_window(fltk3::Window *win, int x_offset, int y_offset)
+{
+  if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
+    this->print_widget(win, x_offset, y_offset);
+    return;
+  }
+  int bx, by, bt;
+  get_window_frame_sizes(bx, by, bt);
+  fltk3::DisplayDevice::display_device()->set_current(); // send win to front and make it current
+  win->show();
+  fl_gc = NULL;
+  fltk3::check();
+  win->make_current();
+  this->set_current(); // back to the fltk3::PagedDevice
+  if (this->class_name() == fltk3::Printer::class_id) {
+    // capture as transparent image the window title bar from screen
+    CGImageRef img = Fl_X::CGImage_from_window_rect(win, 0, -bt, win->w(), bt);
+    CGRect rect = { { x_offset, y_offset }, { win->w(), bt } }; // print the title bar
+    Fl_X::q_begin_image(rect, 0, 0, win->w(), bt);
+    CGContextDrawImage(fl_gc, rect, img);
+    Fl_X::q_end_image();
+    CGImageRelease(img);
+  }
+  else {
+    // capture the window title bar from screen
+    uchar *top_image = fltk3::read_image(NULL, 0, -bt, win->w(), bt);
+    if (top_image) { // print the title bar
+      fltk3::draw_image(top_image, x_offset, y_offset, win->w(), bt, 3);
+      delete[] top_image;
+    }
+  }
+  this->print_widget(win, x_offset, y_offset + bt); // print the window inner part
+}
+
+#include <dlfcn.h>
+
+/* Returns the address of a Carbon function after dynamically loading the Carbon library if needed.
+ Supports old Mac OS X versions that may use a couple of Carbon calls:
+ GetKeys used by OS X 10.3 or before (in fltk3::get_key())
+ PMSessionPageSetupDialog and PMSessionPrintDialog used by 10.4 or before (in fltk3::Printer::start_job())
+ GetWindowPort used by 10.4 or before (in fltk3::GLChoice.cxx)
+ */
+void *Fl_X::get_carbon_function(const char *function_name) {
+  static void *carbon = NULL;
+  void *f = NULL;
+  if (!carbon) {
+    carbon = dlopen("/System/Library/Frameworks/Carbon.framework/Carbon", RTLD_LAZY);
+  }
+  if (carbon) {
+    f = dlsym(carbon, function_name);
+  }
+  return f;
+}
+  
+#endif // __APPLE__
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm (from rev 9002, branches/branch-3.0/src/core/Fl_Native_File_Chooser_MAC.mm)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoaNativeFileChooser.mm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,632 @@
+// "$Id$"
+//
+// FLTK native OS file chooser widget
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 2004 Greg Ercolano.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+// TODO:
+//	o When doing 'open file', only dir is preset, not filename.
+//        Possibly 'preset_file' could be used to select the filename.
+//
+
+#ifdef __APPLE__
+
+#include "NativeFileChooser_common.cxx"		// strnew/strfree/strapp/chrcat
+#include <libgen.h>		// dirname(3)
+#include <sys/types.h>		// stat(2)
+#include <sys/stat.h>		// stat(2)
+
+
+#include <fltk3/run.h>
+#include <fltk3/NativeFileChooser.h>
+#include <fltk3/FileChooser.h>
+#include <fltk3/filename.h>
+
+// FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS
+void fltk3::NativeFileChooser::clear_pathnames() {
+  if ( _pathnames ) {
+    while ( --_tpathnames >= 0 ) {
+      _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
+    }
+    delete [] _pathnames;
+    _pathnames = NULL;
+  }
+  _tpathnames = 0;
+}
+
+// SET A SINGLE PATHNAME
+void fltk3::NativeFileChooser::set_single_pathname(const char *s) {
+  clear_pathnames();
+  _pathnames = new char*[1];
+  _pathnames[0] = strnew(s);
+  _tpathnames = 1;
+}
+
+// CONSTRUCTOR
+fltk3::NativeFileChooser::NativeFileChooser(int val) {
+  _btype          = val;
+  _panel = NULL;
+  _options        = NO_OPTIONS;
+  _pathnames      = NULL;
+  _tpathnames     = 0;
+  _title          = NULL;
+  _filter         = NULL;
+  _filt_names     = NULL;
+  memset(_filt_patt, 0, sizeof(char*) * MAXFILTERS);
+  _filt_total     = 0;
+  _filt_value     = 0;
+  _directory      = NULL;
+  _preset_file    = NULL;
+  _errmsg         = NULL;
+}
+
+// DESTRUCTOR
+fltk3::NativeFileChooser::~NativeFileChooser() {
+  // _opts		// nothing to manage
+  // _options		// nothing to manage
+  // _keepstate		// nothing to manage
+  // _tempitem		// nothing to manage
+  clear_pathnames();
+  _directory   = strfree(_directory);
+  _title       = strfree(_title);
+  _preset_file = strfree(_preset_file);
+  _filter      = strfree(_filter);
+  //_filt_names		// managed by clear_filters()
+  //_filt_patt[i]	// managed by clear_filters()
+  //_filt_total		// managed by clear_filters()
+  clear_filters();
+  //_filt_value		// nothing to manage
+  _errmsg = strfree(_errmsg);
+}
+
+// GET TYPE OF BROWSER
+int fltk3::NativeFileChooser::type() const {
+  return(_btype);
+}
+
+// SET OPTIONS
+void fltk3::NativeFileChooser::options(int val) {
+  _options = val;
+}
+
+// GET OPTIONS
+int fltk3::NativeFileChooser::options() const {
+  return(_options);
+}
+
+// SHOW THE BROWSER WINDOW
+//     Returns:
+//         0 - user picked a file
+//         1 - user cancelled
+//        -1 - failed; errmsg() has reason
+//
+int fltk3::NativeFileChooser::show() {
+
+  // Make sure fltk interface updates before posting our dialog
+  fltk3::flush();
+  
+  // POST BROWSER
+  int err = post();
+
+  _filt_total = 0;
+
+  return(err);
+}
+
+// SET ERROR MESSAGE
+//     Internal use only.
+//
+void fltk3::NativeFileChooser::errmsg(const char *msg) {
+  _errmsg = strfree(_errmsg);
+  _errmsg = strnew(msg);
+}
+
+// RETURN ERROR MESSAGE
+const char *fltk3::NativeFileChooser::errmsg() const {
+  return(_errmsg ? _errmsg : "No error");
+}
+
+// GET FILENAME
+const char* fltk3::NativeFileChooser::filename() const {
+  if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]);
+  return("");
+}
+
+// GET FILENAME FROM LIST OF FILENAMES
+const char* fltk3::NativeFileChooser::filename(int i) const {
+  if ( _pathnames && i < _tpathnames ) return(_pathnames[i]);
+  return("");
+}
+
+// GET TOTAL FILENAMES CHOSEN
+int fltk3::NativeFileChooser::count() const {
+  return(_tpathnames);
+}
+
+// PRESET PATHNAME
+//     Value can be NULL for none.
+//
+void fltk3::NativeFileChooser::directory(const char *val) {
+  _directory = strfree(_directory);
+  _directory = strnew(val);
+}
+
+// GET PRESET PATHNAME
+//     Returned value can be NULL if none set.
+//
+const char* fltk3::NativeFileChooser::directory() const {
+  return(_directory);
+}
+
+// SET TITLE
+//     Value can be NULL if no title desired.
+//
+void fltk3::NativeFileChooser::title(const char *val) {
+  _title = strfree(_title);
+  _title = strnew(val);
+}
+
+// GET TITLE
+//     Returned value can be NULL if none set.
+//
+const char *fltk3::NativeFileChooser::title() const {
+  return(_title);
+}
+
+// SET FILTER
+//     Can be NULL if no filter needed
+//
+void fltk3::NativeFileChooser::filter(const char *val) {
+  _filter = strfree(_filter);
+  _filter = strnew(val);
+
+  // Parse filter user specified
+  //     IN: _filter = "C Files\t*.{cxx,h}\nText Files\t*.txt"
+  //    OUT: _filt_names   = "C Files\tText Files"
+  //         _filt_patt[0] = "*.{cxx,h}"
+  //         _filt_patt[1] = "*.txt"
+  //         _filt_total   = 2
+  //
+  parse_filter(_filter);
+}
+
+// GET FILTER
+//     Returned value can be NULL if none set.
+//
+const char *fltk3::NativeFileChooser::filter() const {
+  return(_filter);
+}
+
+// CLEAR ALL FILTERS
+//    Internal use only.
+//
+void fltk3::NativeFileChooser::clear_filters() {
+  _filt_names = strfree(_filt_names);
+  for (int i=0; i<_filt_total; i++) {
+    _filt_patt[i] = strfree(_filt_patt[i]);
+  }
+  _filt_total = 0;
+}
+
+// PARSE USER'S FILTER SPEC
+//    Parses user specified filter ('in'),
+//    breaks out into _filt_patt[], _filt_names, and _filt_total.
+//
+//    Handles:
+//    IN:                                   OUT:_filt_names    OUT: _filt_patt
+//    ------------------------------------  ------------------ ---------------
+//    "*.{ma,mb}"                           "*.{ma,mb} Files"  "*.{ma,mb}"
+//    "*.[abc]"                             "*.[abc] Files"    "*.[abc]"
+//    "*.txt"                               "*.txt Files"      "*.c"
+//    "C Files\t*.[ch]"                     "C Files"          "*.[ch]"
+//    "C Files\t*.[ch]\nText Files\t*.cxx"  "C Files"          "*.[ch]"
+//
+//    Parsing Mode:
+//         IN:"C Files\t*.{cxx,h}"
+//             |||||||  |||||||||
+//       mode: nnnnnnn  wwwwwwwww
+//             \_____/  \_______/
+//              Name     Wildcard
+//
+void fltk3::NativeFileChooser::parse_filter(const char *in) {
+  clear_filters();
+  if ( ! in ) return;
+  int has_name = strchr(in, '\t') ? 1 : 0;
+
+  char mode = has_name ? 'n' : 'w';	// parse mode: n=title, w=wildcard
+  char wildcard[1024] = "";		// parsed wildcard
+  char name[1024] = "";
+
+  // Parse filter user specified
+  for ( ; 1; in++ ) {
+
+    //// DEBUG
+    //// printf("WORKING ON '%c': mode=<%c> name=<%s> wildcard=<%s>\n",
+    ////                    *in,  mode,     name,     wildcard);
+    
+    switch (*in) {
+      // FINISHED PARSING NAME?
+      case '\t':
+	if ( mode != 'n' ) goto regchar;
+	mode = 'w';
+	break;
+
+      // ESCAPE NEXT CHAR
+      case '\\':
+	++in;
+	goto regchar;
+
+      // FINISHED PARSING ONE OF POSSIBLY SEVERAL FILTERS?
+      case '\r':
+      case '\n':
+      case '\0':
+	// TITLE
+	//     If user didn't specify a name, make one
+	//
+	if ( name[0] == '\0' ) {
+	  sprintf(name, "%.*s Files", (int)sizeof(name)-10, wildcard);
+	}
+	// APPEND NEW FILTER TO LIST
+	if ( wildcard[0] ) {
+	  // Add to filtername list
+	  //     Tab delimit if more than one. We later break
+	  //     tab delimited string into CFArray with 
+	  //     CFStringCreateArrayBySeparatingStrings()
+	  //
+	  if ( _filt_total ) {
+	      _filt_names = strapp(_filt_names, "\t");
+	  }
+	  _filt_names = strapp(_filt_names, name);
+
+	  // Add filter to the pattern array
+	  _filt_patt[_filt_total++] = strnew(wildcard);
+	}
+	// RESET
+	wildcard[0] = name[0] = '\0';
+	mode = strchr(in, '\t') ? 'n' : 'w';
+	// DONE?
+	if ( *in == '\0' ) return;	// done
+	else continue;			// not done yet, more filters
+
+      // Parse all other chars
+      default:				// handle all non-special chars
+      regchar:				// handle regular char
+	switch ( mode ) {
+	  case 'n': chrcat(name, *in);     continue;
+	  case 'w': chrcat(wildcard, *in); continue;
+	}
+	break;
+    }
+  }
+  //NOTREACHED
+}
+
+// SET PRESET FILE
+//     Value can be NULL for none.
+//
+void fltk3::NativeFileChooser::preset_file(const char* val) {
+  _preset_file = strfree(_preset_file);
+  _preset_file = strnew(val);
+}
+
+// PRESET FILE
+//     Returned value can be NULL if none set.
+//
+const char* fltk3::NativeFileChooser::preset_file() const {
+  return(_preset_file);
+}
+
+void fltk3::NativeFileChooser::filter_value(int val) {
+  _filt_value = val;
+}
+
+int fltk3::NativeFileChooser::filter_value() const {
+  return(_filt_value);
+}
+
+int fltk3::NativeFileChooser::filters() const {
+  return(_filt_total);
+}
+
+#import <Cocoa/Cocoa.h>
+#define UNLIKELYPREFIX "___fl_very_unlikely_prefix_"
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif
+
+int fltk3::NativeFileChooser::get_saveas_basename(void) {
+  char *q = strdup( [[(NSSavePanel*)_panel filename] fileSystemRepresentation] );
+  id delegate = [(NSSavePanel*)_panel delegate];
+  if (delegate != nil) {
+    const char *d = [[(NSSavePanel*)_panel directory] fileSystemRepresentation];
+    int l = strlen(d) + 1;
+    int lu = strlen(UNLIKELYPREFIX);
+    // Remove UNLIKELYPREFIX between directory and filename parts
+    memmove(q + l, q + l + lu, strlen(q + l + lu) + 1);
+  }
+  set_single_pathname( q );
+  free(q);
+  return 0;
+}
+
+// SET THE TYPE OF BROWSER
+void fltk3::NativeFileChooser::type(int val) {
+  _btype = val;
+}
+
+/* Input
+ filter=  "C files\t*.{c,h}\nText files\t*.txt\n"
+ patterns[0] = "*.{c,h}"
+ patterns[1] = "*.txt"
+ count = 2
+ Return:
+ "C files (*.{c,h})\nText files (*.txt)\n"
+ */
+static char *prepareMacFilter(int count, const char *filter, char **patterns) {
+  int rank = 0, l = 0;
+  for (int i = 0; i < count; i++) {
+    l += strlen(patterns[i]) + 3;
+  }
+  const char *p = filter;
+  char *q; q = new char[strlen(p) + l + 1];
+  const char *r, *s;
+  char *t;
+  t = q;
+  do {	// copy to t what is in filter removing what is between \t and \n, if any
+    r = strchr(p, '\n');
+    if (!r) r = p + strlen(p);
+    s = strchr(p, '\t');
+    if (s && s < r) { 
+      memcpy(q, p, s - p); 
+      q += s - p; 
+      if (rank < count) { sprintf(q, " (%s)", patterns[rank]); q += strlen(q); }
+    }
+    else { 
+      memcpy(q, p, r - p); 
+      q += r - p; 
+    }
+    rank++;
+    *(q++) = '\n'; 
+    if (*p) p = r + 1;
+  } while(*p);
+  *q = 0;
+  return t;
+}
+
+@interface FLopenDelegate : NSObject 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+<NSOpenSavePanelDelegate>
+#endif
+{
+  NSPopUpButton *nspopup;
+  char **filter_pattern;
+}
+- (FLopenDelegate*)setPopup:(NSPopUpButton*)popup filter_pattern:(char**)pattern;
+- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
+@end
+@implementation FLopenDelegate
+- (FLopenDelegate*)setPopup:(NSPopUpButton*)popup filter_pattern:(char**)pattern
+{
+  nspopup = popup;
+  filter_pattern = pattern;
+  return self;
+}
+- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
+{
+  if ( [nspopup indexOfSelectedItem] == [nspopup numberOfItems] - 1) return YES;
+  const char *pathname = [filename fileSystemRepresentation];
+  if ( fltk3::filename_isdir(pathname) ) return YES;
+  if ( fltk3::filename_match(pathname, filter_pattern[ [nspopup indexOfSelectedItem] ]) ) return YES;
+  return NO;
+}
+@end
+
+@interface FLsaveDelegate : NSObject 
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+<NSOpenSavePanelDelegate>
+#endif
+{
+}
+- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag;
+@end
+@implementation FLsaveDelegate
+- (NSString *)panel:(id)sender userEnteredFilename:(NSString *)filename confirmed:(BOOL)okFlag
+{
+  if (! okFlag) return filename;
+  // 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):
+  return [@ UNLIKELYPREFIX stringByAppendingString:filename];
+}
+@end
+  
+static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filter, const char *title, int rank)
+{
+  NSPopUpButton *popup;
+  NSRect rectview = NSMakeRect(5, 5, 350, 30 );
+  NSView *view = [[[NSView alloc] initWithFrame:rectview] autorelease];
+  NSRect rectbox = NSMakeRect(0, 3, 140, 20 );
+  NSBox *box = [[[NSBox alloc] initWithFrame:rectbox] autorelease];
+  NSRect rectpop = NSMakeRect(105, 0, 246, 30 );
+  popup = [[[NSPopUpButton alloc ] initWithFrame:rectpop pullsDown:NO] autorelease];
+  [view addSubview:box];
+  [view addSubview:popup];
+  [box setBorderType:NSNoBorder];
+  NSString *nstitle = [[NSString alloc] initWithUTF8String:title];
+  [box setTitle:nstitle];
+  [nstitle release];
+  NSFont *font = [NSFont controlContentFontOfSize:NSRegularControlSize];
+  [box setTitleFont:font];
+  [box sizeToFit];
+  // horizontally move box to fit the locale-dependent width of its title
+  NSRect r=[box frame];
+  NSPoint o = r.origin;
+  o.x = rectpop.origin.x - r.size.width + 15;
+  [box setFrameOrigin:o];
+  CFStringRef tab = CFSTR("\n");
+  CFStringRef tmp_cfs;
+  tmp_cfs = CFStringCreateWithCString(NULL, filter, kCFStringEncodingUTF8);
+  CFArrayRef array = CFStringCreateArrayBySeparatingStrings(NULL, tmp_cfs, tab);
+  CFRelease(tmp_cfs);
+  CFRelease(tab);
+  [popup addItemsWithTitles:(NSArray*)array];
+  NSMenuItem *item = [popup itemWithTitle:@""];
+  if (item) [popup removeItemWithTitle:@""];
+  CFRelease(array);
+  [popup selectItemAtIndex:rank];
+  [panel setAccessoryView:view];
+  return popup;
+}
+  
+// POST BROWSER
+//     Internal use only.
+//     Assumes '_opts' has been initialized.
+//
+//     Returns:
+//         0 - user picked a file
+//         1 - user cancelled
+//        -1 - failed; errmsg() has reason
+//     
+int fltk3::NativeFileChooser::post() {
+  // INITIALIZE BROWSER
+  if ( _filt_total == 0 ) {	// Make sure they match
+    _filt_value = 0;		// TBD: move to someplace more logical?
+  }
+  NSAutoreleasePool *localPool;
+  localPool = [[NSAutoreleasePool alloc] init];
+  switch (_btype) {
+    case BROWSE_FILE:
+    case BROWSE_MULTI_FILE:
+    case BROWSE_DIRECTORY:
+    case BROWSE_MULTI_DIRECTORY:
+      _panel =  [NSOpenPanel openPanel];
+      break;	  
+    case BROWSE_SAVE_DIRECTORY:
+    case BROWSE_SAVE_FILE:
+      _panel =  [NSSavePanel savePanel];
+      break;
+  }
+  int retval;
+  NSString *nstitle = [NSString stringWithUTF8String: (_title ? _title : "No Title")];
+  [(NSSavePanel*)_panel setTitle:nstitle];
+  switch (_btype) {
+    case BROWSE_MULTI_FILE:
+      [(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
+      break;
+    case BROWSE_MULTI_DIRECTORY:
+      [(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
+      /* FALLTHROUGH */
+    case BROWSE_DIRECTORY:
+      [(NSOpenPanel*)_panel setCanChooseDirectories:YES];
+      break;
+    case BROWSE_SAVE_DIRECTORY:
+      [(NSSavePanel*)_panel setCanCreateDirectories:YES];
+      break;
+  }
+  
+  // SHOW THE DIALOG
+  if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) {
+    NSPopUpButton *popup = nil;
+    if (_filt_total) {
+      char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
+      popup = createPopupAccessory((NSSavePanel*)_panel, t, fltk3::FileChooser::show_label, 0);
+      delete[] t;
+      [[popup menu] addItem:[NSMenuItem separatorItem]];
+      [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:fltk3::FileChooser::all_files_label]];
+      [popup setAction:@selector(validateVisibleColumns)];
+      [popup setTarget:(NSObject*)_panel];
+      static FLopenDelegate *openDelegate = nil;
+      if (openDelegate == nil) {
+	// not to be ever freed
+	openDelegate = [[FLopenDelegate alloc] init];
+      }
+      [openDelegate setPopup:popup filter_pattern:_filt_patt];
+      [(NSOpenPanel*)_panel setDelegate:openDelegate];
+    }
+    NSString *dir = nil;
+    NSString *fname = nil;
+    NSString *preset = nil;
+    if (_preset_file) {
+      preset = [[NSString alloc] initWithUTF8String:_preset_file];
+      if (strchr(_preset_file, '/') != NULL) 
+	dir = [[NSString alloc] initWithString:[preset stringByDeletingLastPathComponent]];
+      fname = [preset lastPathComponent];
+    }
+    if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory];
+    retval = [(NSOpenPanel*)_panel runModalForDirectory:dir file:fname types:nil];	
+    [dir release];
+    [preset release];
+    if (_filt_total) {
+      _filt_value = [popup indexOfSelectedItem];
+    }
+    if ( retval == NSOKButton ) {
+      clear_pathnames();
+      NSArray *array = [(NSOpenPanel*)_panel filenames];
+      _tpathnames = [array count];
+      _pathnames = new char*[_tpathnames];
+      for(int i = 0; i < _tpathnames; i++) {
+	_pathnames[i] = strnew([(NSString*)[array objectAtIndex:i] fileSystemRepresentation]);
+      }
+    }
+  }
+  else {
+    NSString *dir = nil;
+    NSString *fname = nil;
+    NSString *preset = nil;
+    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 (_preset_file) {
+      preset = [[NSString alloc] initWithUTF8String:_preset_file];
+      if (strchr(_preset_file, '/') != NULL) {
+	dir = [[NSString alloc] initWithString:[preset stringByDeletingLastPathComponent]];
+      }
+      fname = [preset lastPathComponent];
+    }
+    if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory];
+    if (_filt_total) {
+      char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
+      popup = createPopupAccessory((NSSavePanel*)_panel, t, [[(NSSavePanel*)_panel nameFieldLabel] UTF8String], _filt_value);
+      delete[] t;
+    }
+    retval = [(NSSavePanel*)_panel runModalForDirectory:dir file:fname];
+    if (_filt_total) {
+      _filt_value = [popup indexOfSelectedItem];
+    }
+    [dir release];
+    [preset release];
+    if ( retval == NSOKButton ) get_saveas_basename();
+  }
+  [localPool release];
+  return (retval == NSOKButton ? 0 : 1);
+}
+
+#endif // __APPLE__
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm (from rev 9002, branches/branch-3.0/src/core/Fl_Quartz_Printer.mm)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoaQuartzPrinter.mm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,308 @@
+//
+// "$Id$"
+//
+// Mac OS X-specific printing support (objective-c++) for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef __APPLE__
+#include <fltk3/Printer.h>
+
+#include <fltk3/run.h>
+#include <fltk3/ask.h>
+#include <fltk3/draw.h>
+#import <Cocoa/Cocoa.h>
+
+extern void fl_quartz_restore_line_style_();
+
+fltk3::SystemPrinter::SystemPrinter(void)
+{
+  x_offset = 0;
+  y_offset = 0;
+  scale_x = scale_y = 1.;
+  gc = 0;
+  driver(fltk3::DisplayDevice::display_device()->driver());
+}
+
+fltk3::SystemPrinter::~SystemPrinter(void) {}
+
+int fltk3::SystemPrinter::start_job (int pagecount, int *frompage, int *topage)
+//printing using a Quartz graphics context
+//returns 0 iff OK
+{
+  OSStatus status = 0;
+  Fl_X::q_release_context();
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  if( [NSPrintPanel instancesRespondToSelector:@selector(runModalWithPrintInfo:)] &&
+     [NSPrintInfo instancesRespondToSelector:@selector(PMPrintSession)] ) {
+    NSAutoreleasePool *localPool;
+    localPool = [[NSAutoreleasePool alloc] init]; 
+    NSPrintInfo *info = [NSPrintInfo sharedPrintInfo];
+    NSPageLayout *layout = [NSPageLayout pageLayout];
+    NSInteger retval = [layout runModal];
+    if(retval == NSOKButton) {
+      NSPrintPanel *panel = [NSPrintPanel printPanel];
+      retval = (NSInteger)[panel runModalWithPrintInfo:info];//from 10.5 only
+    }
+    if(retval != NSOKButton) {
+      fltk3::first_window()->show();
+      [localPool release];
+      return 1;
+    }
+    printSession = (PMPrintSession)[info PMPrintSession];
+    pageFormat = (PMPageFormat)[info PMPageFormat];
+    printSettings = (PMPrintSettings)[info PMPrintSettings];
+    UInt32 from32, to32;
+    PMGetFirstPage(printSettings, &from32); 
+    if (frompage) *frompage = (int)from32;
+    PMGetLastPage(printSettings, &to32); 
+    if (topage) *topage = (int)to32;
+    if(topage && *topage > pagecount) *topage = pagecount;
+    status = PMSessionBeginCGDocumentNoDialog(printSession, printSettings, pageFormat);
+    [localPool release];
+  }
+  else {
+#endif
+    
+#if !__LP64__
+    Boolean accepted;
+    status = PMCreateSession(&printSession);
+    if (status != noErr) return 1;
+    status = PMCreatePageFormat(&pageFormat);
+    status = PMSessionDefaultPageFormat(printSession, pageFormat);
+    if (status != noErr) return 1;
+    // get pointer to the PMSessionPageSetupDialog Carbon function
+    typedef OSStatus (*dialog_f)(PMPrintSession, PMPageFormat, Boolean *);
+    static dialog_f f = NULL;
+    if (!f) f = (dialog_f)Fl_X::get_carbon_function("PMSessionPageSetupDialog");
+    status = (*f)(printSession, pageFormat, &accepted);
+    if (status != noErr || !accepted) {
+      fltk3::first_window()->show();
+      return 1;
+    }
+    status = PMCreatePrintSettings(&printSettings);
+    if (status != noErr || printSettings == kPMNoPrintSettings) return 1;
+    status = PMSessionDefaultPrintSettings (printSession, printSettings);
+    if (status != noErr) return 1;
+    PMSetPageRange(printSettings, 1, (UInt32)kPMPrintAllPages);
+    // get pointer to the PMSessionPrintDialog Carbon function
+    typedef OSStatus (*dialog_f2)(PMPrintSession, PMPrintSettings, PMPageFormat, Boolean *);
+    static dialog_f2 f2 = NULL;
+    if (!f2) f2 = (dialog_f2)Fl_X::get_carbon_function("PMSessionPrintDialog");
+    status = (*f2)(printSession, printSettings, pageFormat, &accepted);
+    if (!accepted) status = kPMCancel;
+    if (status != noErr) {
+      fltk3::first_window()->show();
+      return 1;
+    }
+    UInt32 from32, to32;
+    PMGetFirstPage(printSettings, &from32); 
+    if (frompage) *frompage = (int)from32;
+    PMGetLastPage(printSettings, &to32); 
+    if (topage) *topage = (int)to32;
+    if(topage && *topage > pagecount) *topage = pagecount;
+    CFStringRef mystring[1];
+    mystring[0] = kPMGraphicsContextCoreGraphics;
+    CFArrayRef array = CFArrayCreate(NULL, (const void **)mystring, 1, &kCFTypeArrayCallBacks);
+    status = PMSessionSetDocumentFormatGeneration(printSession, kPMDocumentFormatDefault, array, NULL);
+    CFRelease(array);
+    status = PMSessionBeginDocumentNoDialog(printSession, printSettings, pageFormat);
+#endif //__LP64__
+    
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+  if (status != noErr) return 1;
+  y_offset = x_offset = 0;
+  this->set_current();
+  return 0;
+}
+
+void fltk3::SystemPrinter::margins(int *left, int *top, int *right, int *bottom)
+{
+  PMPaper paper;
+  PMGetPageFormatPaper(pageFormat, &paper);
+  PMOrientation orientation;
+  PMGetOrientation(pageFormat, &orientation);
+  PMPaperMargins margins;
+  PMPaperGetMargins(paper, &margins);
+  if(orientation == kPMPortrait) {
+    if (left) *left = (int)(margins.left / scale_x + 0.5);
+    if (top) *top = (int)(margins.top / scale_y + 0.5);
+    if (right) *right = (int)(margins.right / scale_x + 0.5);
+    if (bottom) *bottom = (int)(margins.bottom / scale_y + 0.5);
+    }
+  else {
+    if (left) *left = (int)(margins.top / scale_x + 0.5);
+    if (top) *top = (int)(margins.left / scale_y + 0.5);
+    if (right) *right = (int)(margins.bottom / scale_x + 0.5);
+    if (bottom) *bottom = (int)(margins.right / scale_y + 0.5);
+  }
+}
+
+int fltk3::SystemPrinter::printable_rect(int *w, int *h)
+//returns 0 iff OK
+{
+  OSStatus status;
+  PMRect pmRect;
+  int x, y;
+  
+  status = PMGetAdjustedPageRect(pageFormat, &pmRect);
+  if (status != noErr) return 1;
+  
+  x = (int)pmRect.left;
+  y = (int)pmRect.top;
+  *w = int((int)(pmRect.right - x) / scale_x + 1);
+  *h = int((int)(pmRect.bottom - y) / scale_y + 1);
+  return 0;
+}
+
+void fltk3::SystemPrinter::origin(int x, int y)
+{
+  x_offset = x;
+  y_offset = y;
+  CGContextRestoreGState(fl_gc);
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+  CGContextScaleCTM(fl_gc, scale_x, scale_y);
+  CGContextTranslateCTM(fl_gc, x, y);
+  CGContextRotateCTM(fl_gc, angle);
+  CGContextSaveGState(fl_gc);
+}
+
+void fltk3::SystemPrinter::scale (float s_x, float s_y)
+{
+  if (s_y == 0.) s_y = s_x;
+  scale_x = s_x;
+  scale_y = s_y;
+  CGContextRestoreGState(fl_gc);
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+  CGContextScaleCTM(fl_gc, scale_x, scale_y);
+  CGContextRotateCTM(fl_gc, angle);
+  x_offset = y_offset = 0;
+  CGContextSaveGState(fl_gc);
+}
+
+void fltk3::SystemPrinter::rotate (float rot_angle)
+{
+  angle = - rot_angle * M_PI / 180.;
+  CGContextRestoreGState(fl_gc);
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+  CGContextScaleCTM(fl_gc, scale_x, scale_y);
+  CGContextTranslateCTM(fl_gc, x_offset, y_offset);
+  CGContextRotateCTM(fl_gc, angle);
+  CGContextSaveGState(fl_gc);
+}
+
+void fltk3::SystemPrinter::translate(int x, int y)
+{
+  CGContextSaveGState(fl_gc);
+  CGContextTranslateCTM(fl_gc, x, y );
+  CGContextSaveGState(fl_gc);
+}
+
+void fltk3::SystemPrinter::untranslate(void)
+{
+  CGContextRestoreGState(fl_gc);
+  CGContextRestoreGState(fl_gc);
+}
+
+int fltk3::SystemPrinter::start_page (void)
+{	
+  OSStatus status = PMSessionBeginPageNoDialog(printSession, pageFormat, NULL);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  if ( PMSessionGetCGGraphicsContext != NULL ) {
+    status = PMSessionGetCGGraphicsContext(printSession, &fl_gc);
+  }
+  else {
+#endif
+#if ! __LP64__
+    status = PMSessionGetGraphicsContext(printSession,NULL,(void **)&fl_gc);
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  }
+#endif
+  PMRect pmRect;
+  float win_scale_x, win_scale_y;
+
+  PMPaper paper;
+  PMGetPageFormatPaper(pageFormat, &paper);
+  PMPaperMargins margins;
+  PMPaperGetMargins(paper, &margins);
+  PMOrientation orientation;
+  PMGetOrientation(pageFormat, &orientation);
+  
+  status = PMGetAdjustedPageRect(pageFormat, &pmRect);
+  double h = pmRect.bottom - pmRect.top;
+  x_offset = 0;
+  y_offset = 0; 
+  angle = 0;
+  scale_x = scale_y = 1;
+  win_scale_x = win_scale_y = 1;
+  if(orientation == kPMPortrait)
+    CGContextTranslateCTM(fl_gc, margins.left, margins.bottom + h);
+  else
+    CGContextTranslateCTM(fl_gc, margins.top, margins.right + h);
+  CGContextScaleCTM(fl_gc, win_scale_x, - win_scale_y);
+  fl_quartz_restore_line_style_();
+  CGContextSetShouldAntialias(fl_gc, false);
+  CGContextSaveGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+  fltk3::line_style(fltk3::SOLID);
+  fl_window = (void *)1; // TODO: something better
+  fltk3::clip_region(0);
+  if( status == noErr) gc = fl_gc;
+  return status != noErr;
+}
+
+int fltk3::SystemPrinter::end_page (void)
+{	
+  CGContextFlush(fl_gc);
+  CGContextRestoreGState(fl_gc);
+  CGContextRestoreGState(fl_gc);
+  OSStatus status = PMSessionEndPageNoDialog(printSession);
+  gc = NULL;
+  return status != noErr;
+}
+
+void fltk3::SystemPrinter::end_job (void)
+{
+  OSStatus status;
+  
+  status = PMSessionError(printSession);
+  if (status != noErr) {
+    fltk3::alert ("PM Session error %d", (int)status);
+  }
+  PMSessionEndDocumentNoDialog(printSession);
+  fltk3::DisplayDevice::display_device()->set_current();
+  fl_gc = 0;
+  fltk3::first_window()->show();
+}
+
+#endif // __APPLE__
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_color.cxx (from rev 9002, branches/branch-3.0/src/core/fl_color_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_color.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_color.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,92 @@
+//
+// "$Id$"
+//
+// MacOS color functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// The fltk "colormap".  This allows ui colors to be stored in 8-bit
+// locations, and provides a level of indirection so that global color
+// changes can be made.  Not to be confused with the X colormap, which
+// I try to hide completely.
+
+// matt: Neither Quartz nor Quickdraw support colormaps in this implementation
+// matt: Quartz support done
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+
+static unsigned fl_cmap[256] = {
+#include "cmap.h" // this is a file produced by "cmap.cxx":
+};
+
+// Translations to mac data structures:
+Fl_XMap fl_xmap[256];
+
+Fl_XMap* fl_current_xmap;
+
+void fltk3::QuartzGraphicsDriver::color(fltk3::Color i) {
+  fltk3::GraphicsDriver::color(i);
+  int index;
+  uchar r, g, b;
+  if (i & 0xFFFFFF00) {
+    // translate rgb colors into color index
+    r = i>>24;
+    g = i>>16;
+    b = i>> 8;
+  } else {
+    // translate index into rgb:
+    index = i;
+    unsigned c = fl_cmap[i];
+    r = c>>24;
+    g = c>>16;
+    b = c>> 8;
+  }
+  if (!fl_gc) return; // no context yet? We will assign the color later.
+  float fr = r/255.0f;
+  float fg = g/255.0f;
+  float fb = b/255.0f;
+  CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
+  CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
+}
+
+void fltk3::QuartzGraphicsDriver::color(uchar r, uchar g, uchar b) {
+  fltk3::GraphicsDriver::color( fltk3::rgb_color(r, g, b) );
+  float fr = r/255.0f;
+  float fg = g/255.0f;
+  float fb = b/255.0f;
+  CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
+  CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
+}
+
+void fltk3::set_color(fltk3::Color i, unsigned c) {
+  if (fl_cmap[i] != c) {
+    fl_cmap[i] = c;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_draw_image_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_draw_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,176 @@
+//
+// "$Id$"
+//
+// MacOS image drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+////////////////////////////////////////////////////////////////
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/Printer.h>
+#include <fltk3/x.h>
+
+#define MAXBUFFER 0x40000 // 256k
+
+static void dataReleaseCB(void *info, const void *data, size_t size)
+{
+  delete[] (uchar *)data;
+}
+
+/*
+ * draw an image based on the input parameters
+ *
+ * buf:       image source data
+ * X, Y:      position (in buffer?!)
+ * W, H:      size of picture (in pixel?)
+ * delta:     distance from pixel to pixel in buf in bytes
+ * linedelta: distance from line to line in buf in bytes
+ * mono:      if set, pixel is one byte - if zero, pixel is 3 byte
+ * cb:        callback to copy image data into (RGB?) buffer
+ *   buf:       pointer to first byte in image source
+ *   x, y:      position in buffer
+ *   w:         width (in bytes?)
+ *   dst:       destination buffer
+ * userdata:  ?
+ */
+static void innards(const uchar *buf, int X, int Y, int W, int H,
+		    int delta, int linedelta, int mono,
+		    fltk3::DrawImageCb cb, void* userdata)
+{
+  if (!linedelta) linedelta = W*delta;
+
+  const void *array = buf;
+  uchar *tmpBuf = 0;
+  if (cb || fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+    tmpBuf = new uchar[ H*W*delta ];
+    if (cb) {
+      for (int i=0; i<H; i++) {
+	cb(userdata, 0, i, W, tmpBuf+i*W*delta);
+      }
+    } else {
+      uchar *p = tmpBuf;
+      for (int i=0; i<H; i++) {
+	memcpy(p, buf+i*linedelta, W*delta);
+	p += W*delta;
+	}
+    }
+    array = (void*)tmpBuf;
+    linedelta = W*delta;
+  }
+  // create an image context
+  CGColorSpaceRef   lut = 0;
+  if (delta<=2) 
+    lut = CGColorSpaceCreateDeviceGray();
+  else
+    lut = CGColorSpaceCreateDeviceRGB();
+  // a release callback is necessary when the fl_gc is a print context because the image data
+  // must be kept until the page is closed. Thus tmpBuf can't be deleted here. It's too early.
+  CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H, 
+						       tmpBuf ? dataReleaseCB : NULL
+						       );
+  CGImageRef        img = CGImageCreate( W, H, 8, 8*delta, linedelta,
+                            lut, delta&1?kCGImageAlphaNone:kCGImageAlphaNoneSkipLast,
+                            //lut, delta&1?kCGImageAlphaNone:kCGImageAlphaLast,
+                            src, 0L, false, kCGRenderingIntentDefault);
+  // draw the image into the destination context
+  if (img) {
+    CGRect rect = { { X, Y }, { W, H } };
+    Fl_X::q_begin_image(rect, 0, 0, W, H);
+    CGContextDrawImage(fl_gc, rect, img);
+    Fl_X::q_end_image();
+    // release all allocated resources
+    CGImageRelease(img);
+  }
+  CGColorSpaceRelease(lut);
+  CGDataProviderRelease(src);
+  if (img) return; // else fall through to slow mode
+  // following the very save (and very slow) way to write the image into the give port
+  CGContextSetShouldAntialias(fl_gc, false);
+  if ( cb )
+  {
+    uchar *tmpBuf = new uchar[ W*4 ];
+    for ( int i=0; i<H; i++ )
+    {
+      uchar *src = tmpBuf;
+      cb( userdata, 0, i, W, tmpBuf );
+      for ( int j=0; j<W; j++ )
+      {
+        if ( mono )
+          { fltk3::color( src[0], src[0], src[0] ); }
+        else
+          { fltk3::color( src[0], src[1], src[2] ); }
+        CGContextMoveToPoint(fl_gc, X+j, Y+i);
+        CGContextAddLineToPoint(fl_gc, X+j, Y+i);
+        CGContextStrokePath(fl_gc);
+        src+=delta;
+      }
+    }
+    delete[] tmpBuf;
+  }
+  else
+  {
+    for ( int i=0; i<H; i++ )
+    {
+      const uchar *src = buf+i*linedelta;
+      for ( int j=0; j<W; j++ )
+      {
+        if ( mono )
+          fltk3::color( src[0], src[0], src[0] );
+        else
+          fltk3::color( src[0], src[1], src[2] );
+        CGContextMoveToPoint(fl_gc, X+j, Y+i);
+        CGContextAddLineToPoint(fl_gc, X+j, Y+i);
+        CGContextStrokePath(fl_gc);
+        src += delta;
+      }
+    }
+  }
+  CGContextSetShouldAntialias(fl_gc, true);
+}
+
+void fltk3::QuartzGraphicsDriver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
+}
+void fltk3::QuartzGraphicsDriver::draw_image(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+}
+void fltk3::QuartzGraphicsDriver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  innards(buf,x,y,w,h,d,l,1,0,0);
+}
+void fltk3::QuartzGraphicsDriver::draw_image_mono(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  innards(0,x,y,w,h,d,0,1,cb,data);
+}
+
+void fltk3::rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
+  fltk3::color(r,g,b);
+  fltk3::rectf(x,y,w,h);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_font_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,541 @@
+//
+// "$Id$"
+//
+// MacOS font selection routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+
+/* from fl_utf.c */
+extern unsigned fltk3::utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen);
+
+static CGAffineTransform font_mx = { 1, 0, 0, -1, 0, 0 };
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+static CFMutableDictionaryRef attributes = NULL;
+#endif
+
+Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, fltk3::Fontsize Size) {
+  next = 0;
+#  if HAVE_GL
+  listbase = 0;
+#  endif
+
+//  knowWidths = 0;
+    // OpenGL needs those for its font handling
+  q_name = strdup(name);
+  size = Size;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+if (fl_mac_os_version >= 100500) {//unfortunately, CTFontCreateWithName != NULL on 10.4 also!
+  CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingUTF8);
+  fontref = CTFontCreateWithName(str, size, NULL);
+  CGGlyph glyph[2];
+  const UniChar A[2]={'W','.'};
+  CTFontGetGlyphsForCharacters(fontref, A, glyph, 2);
+  CGSize advances[2];
+  double w;
+  CTFontGetAdvancesForGlyphs(fontref, kCTFontHorizontalOrientation, glyph, advances, 2);
+  w = advances[0].width;
+  if ( abs(advances[0].width - advances[1].width) < 1E-2 ) {//this is a fixed-width font
+    // slightly rescale fixed-width fonts so the character width has an integral value
+    CFRelease(fontref);
+    CGFloat fsize = size / ( w/floor(w + 0.5) );
+    fontref = CTFontCreateWithName(str, fsize, NULL);
+    w = CTFontGetAdvancesForGlyphs(fontref, kCTFontHorizontalOrientation, glyph, NULL, 1);
+  }
+  CFRelease(str);
+  ascent = (short)(CTFontGetAscent(fontref) + 0.5);
+  descent = (short)(CTFontGetDescent(fontref) + 0.5);
+  q_width = w + 0.5;
+  for (unsigned i = 0; i < sizeof(width)/sizeof(float*); i++) width[i] = NULL;
+  if (!attributes) {
+    static CFNumberRef zero_ref;
+    float zero = 0.;
+    zero_ref = CFNumberCreate(NULL, kCFNumberFloat32Type, &zero);
+    // deactivate kerning for all fonts, so that string width = sum of character widths
+    // which allows fast fltk3::width() implementation.
+    attributes = CFDictionaryCreateMutable(kCFAllocatorDefault,
+					   3,
+					   &kCFTypeDictionaryKeyCallBacks,
+					   &kCFTypeDictionaryValueCallBacks);
+    CFDictionarySetValue (attributes, kCTKernAttributeName, zero_ref);
+  }
+  if (ascent == 0) { // this may happen with some third party fonts
+    CFDictionarySetValue (attributes, kCTFontAttributeName, fontref);
+    CFAttributedStringRef mastr = CFAttributedStringCreate(kCFAllocatorDefault, CFSTR("Wj"), attributes);
+    CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
+    CFRelease(mastr);
+    CGFloat fascent, fdescent;
+    CTLineGetTypographicBounds(ctline, &fascent, &fdescent, NULL);
+    CFRelease(ctline);
+    ascent = (short)(fascent + 0.5);
+    descent = (short)(fdescent + 0.5);
+    }
+}
+else {
+#endif
+#if ! __LP64__
+  OSStatus err;
+    // fill our structure with a few default values
+  ascent = Size*3/4;
+  descent = Size-ascent;
+  q_width = Size*2/3;
+	// now use ATS to get the actual Glyph size information
+	// say that our passed-in name is encoded as UTF-8, since this works for plain ASCII names too...
+  CFStringRef cfname = CFStringCreateWithCString(0L, name, kCFStringEncodingUTF8);
+  ATSFontRef font = ATSFontFindFromName(cfname, kATSOptionFlagsDefault);
+  if (font) {
+    ATSFontMetrics m = { 0 };
+    ATSFontGetHorizontalMetrics(font, kATSOptionFlagsDefault, &m);
+    if (m.avgAdvanceWidth) q_width = int(m.avgAdvanceWidth*Size);
+      // playing with the offsets a little to make standard sizes fit
+    if (m.ascent) ascent  = int(m.ascent*Size-0.5f);
+    if (m.descent) descent = -int(m.descent*Size-1.5f);
+  }
+  CFRelease(cfname);
+    // now we allocate everything needed to render text in this font later
+    // get us the default layout and style
+  err = ATSUCreateTextLayout(&layout);
+  UniChar mTxt[2] = { 65, 0 };
+  err = ATSUSetTextPointerLocation(layout, mTxt, kATSUFromTextBeginning, 1, 1);
+  err = ATSUCreateStyle(&style);
+  err = ATSUSetRunStyle(layout, style, kATSUFromTextBeginning, kATSUToTextEnd);
+    // now set the actual font, size and attributes. We also set the font matrix to
+    // render our font up-side-down, so when rendered through our inverted CGContext,
+    // text will appear normal again.
+  Fixed fsize = IntToFixed(Size);
+//  ATSUFontID fontID = FMGetFontFromATSFontRef(font);
+  ATSUFontID fontID;
+  ATSUFindFontFromName(name, strlen(name), kFontFullName, kFontMacintoshPlatform, kFontRomanScript, kFontEnglishLanguage, &fontID);
+
+  // draw the font upside-down... Compensate for fltk/OSX origin differences
+  ATSUAttributeTag sTag[] = { kATSUFontTag, kATSUSizeTag, kATSUFontMatrixTag };
+  ByteCount sBytes[] = { sizeof(ATSUFontID), sizeof(Fixed), sizeof(CGAffineTransform) };
+  ATSUAttributeValuePtr sAttr[] = { &fontID, &fsize, &font_mx };
+  err = ATSUSetAttributes(style, 3, sTag, sBytes, sAttr);
+    // next, make sure that Quartz will only render at integer coordinates
+  ATSLineLayoutOptions llo = kATSLineUseDeviceMetrics | kATSLineDisableAllLayoutOperations;
+  ATSUAttributeTag aTag[] = { kATSULineLayoutOptionsTag };
+  ByteCount aBytes[] = { sizeof(ATSLineLayoutOptions) };
+  ATSUAttributeValuePtr aAttr[] = { &llo };
+  err = ATSUSetLineControls (layout, kATSUFromTextBeginning, 1, aTag, aBytes, aAttr);
+    // now we are finally ready to measure some letter to get the bounding box
+  Fixed bBefore, bAfter, bAscent, bDescent;
+  err = ATSUGetUnjustifiedBounds(layout, kATSUFromTextBeginning, 1, &bBefore, &bAfter, &bAscent, &bDescent);
+    // Requesting a certain height font on Mac does not guarantee that ascent+descent
+    // equal the requested height. fltk3::height will reflect the actual height that we got.
+    // The font "Apple Chancery" is a pretty extreme example of overlapping letters.
+  float fa = -FixedToFloat(bAscent), fd = -FixedToFloat(bDescent);
+  if (fa>0.0f && fd>0.0f) {
+    //float f = Size/(fa+fd);
+    ascent = int(fa); //int(fa*f+0.5f);
+    descent = int(fd); //Size - ascent;
+  }
+  int w = FixedToInt(bAfter);
+  if (w)
+    q_width = FixedToInt(bAfter);
+
+# define ENABLE_TRANSIENT_FONTS  1
+
+# ifdef ENABLE_TRANSIENT_FONTS
+  // Now, by way of experiment, try enabling Transient Font Matching, this will
+  // cause ATSU to find a suitable font to render any chars the current font can't do...
+  ATSUSetTransientFontMatching (layout, true);
+# endif
+#endif//__LP64__
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+}
+
+Fl_Font_Descriptor::~Fl_Font_Descriptor() {
+/*
+#if HAVE_GL
+ // ++ todo: remove OpenGL font alocations
+// Delete list created by gl_draw().  This is not done by this code
+// as it will link in GL unnecessarily.  There should be some kind
+// of "free" routine pointer, or a subclass?
+// if (listbase) {
+//  int base = font->min_char_or_byte2;
+//  int size = font->max_char_or_byte2-base+1;
+//  int base = 0; int size = 256;
+//  glDeleteLists(listbase+base,size);
+// }
+#endif
+  */
+  if (this == fltk3::graphics_driver->font_descriptor()) fltk3::graphics_driver->font_descriptor(NULL);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  if (fl_mac_os_version >= 100500)  {
+    CFRelease(fontref);
+    for (unsigned i = 0; i < sizeof(width)/sizeof(float*); i++) {
+      if (width[i]) free(width[i]);
+      }
+  }
+#endif
+}
+
+////////////////////////////////////////////////////////////////
+
+static Fl_Fontdesc built_in_table[] = {
+{"Arial"},
+{"Arial Bold"},
+{"Arial Italic"},
+{"Arial Bold Italic"},
+{"Courier New"},
+{"Courier New Bold"},
+{"Courier New Italic"},
+{"Courier New Bold Italic"},
+{"Times New Roman"},
+{"Times New Roman Bold"},
+{"Times New Roman Italic"},
+{"Times New Roman Bold Italic"},
+{"Symbol"},
+{"Monaco"},
+{"Andale Mono"}, // there is no bold Monaco font on standard Mac
+{"Webdings"},
+};
+
+static UniChar *utfWbuf = 0;
+static unsigned utfWlen = 0;
+
+static UniChar *mac_Utf8_to_Utf16(const char *txt, int len, int *new_len)
+{
+  unsigned wlen = fltk3::utf8toUtf16(txt, len, (unsigned short*)utfWbuf, utfWlen);
+  if (wlen >= utfWlen)
+  {
+    utfWlen = wlen + 100;
+	if (utfWbuf) free(utfWbuf);
+    utfWbuf = (UniChar*)malloc((utfWlen)*sizeof(UniChar));
+	wlen = fltk3::utf8toUtf16(txt, len, (unsigned short*)utfWbuf, utfWlen);
+  }
+  *new_len = wlen;
+  return utfWbuf;
+} // mac_Utf8_to_Utf16
+
+Fl_Fontdesc* fltk3::fonts = built_in_table;
+
+static Fl_Font_Descriptor* find(fltk3::Font fnum, fltk3::Fontsize size) {
+  Fl_Fontdesc* s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // use 0 if fnum undefined
+  Fl_Font_Descriptor* f;
+  for (f = s->first; f; f = f->next)
+    if (f->size == size) return f;
+  f = new Fl_Font_Descriptor(s->name, size);
+  f->next = s->first;
+  s->first = f;
+  return f;
+}
+
+////////////////////////////////////////////////////////////////
+// Public interface:
+
+void fltk3::QuartzGraphicsDriver::font(fltk3::Font fnum, fltk3::Fontsize size) {
+  if (fnum==-1) {
+    fltk3::GraphicsDriver::font(0, 0);
+    return;
+  }
+  fltk3::GraphicsDriver::font(fnum, size);
+  this->font_descriptor( find(fnum, size) );
+}
+
+int fltk3::QuartzGraphicsDriver::height() {
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  return fontsize->ascent + fontsize->descent;
+}
+
+int fltk3::QuartzGraphicsDriver::descent() {
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  return fontsize->descent+1;
+}
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+// returns width of a pair of UniChar's in the surrogate range
+static CGFloat surrogate_width(const UniChar *txt, Fl_Font_Descriptor *fontsize)
+{
+  CTFontRef font2 = fontsize->fontref;
+  bool must_release = false;
+  CGGlyph glyphs[2];
+  bool b = CTFontGetGlyphsForCharacters(font2, txt, glyphs, 2);
+  CGSize a;
+  if(!b) { // the current font doesn't contain this char
+    CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, txt, 2, kCFAllocatorNull);
+    // find a font that contains it
+    font2 = CTFontCreateForString(font2, str, CFRangeMake(0,2));
+    must_release = true;
+    CFRelease(str);
+    b = CTFontGetGlyphsForCharacters(font2, txt, glyphs, 2);
+  }
+  if (b) CTFontGetAdvancesForGlyphs(font2, kCTFontHorizontalOrientation, glyphs, &a, 1);
+  else a.width = fontsize->q_width;
+  if(must_release) CFRelease(font2);
+  return a.width;
+}
+#endif
+
+static double fl_mac_width(const UniChar* txt, int n, Fl_Font_Descriptor *fontsize) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+if (fl_mac_os_version >= 100500) {
+  double retval = 0;
+  UniChar uni;
+  int i;
+  for (i = 0; i < n; i++) { // loop over txt
+    uni = txt[i];
+    if (uni >= 0xD800 && uni <= 0xDBFF) { // handles the surrogate range
+      retval += surrogate_width(&txt[i], fontsize);
+      i++; // because a pair of UniChar's represent a single character
+      continue;
+    }
+    const int block = 0x10000 / (sizeof(fontsize->width)/sizeof(float*)); // block size
+    // r: index of the character block containing uni
+    unsigned int r = uni >> 7; // change 7 if sizeof(width) is changed
+    if (!fontsize->width[r]) { // this character block has not been hit yet
+//fprintf(stderr,"r=%d size=%d name=%s\n",r,fltk3::fontsize->size, fltk3::fontsize->q_name);
+      // allocate memory to hold width of each character in the block
+      fontsize->width[r] = (float*) malloc(sizeof(float) * block);
+      UniChar ii = r * block;
+      CGSize advance_size;
+      CGGlyph glyph;
+      for (int j = 0; j < block; j++) { // loop over the block
+	CTFontRef font2 = fontsize->fontref;
+	bool must_release = false;
+	// ii spans all characters of this block
+	bool b = CTFontGetGlyphsForCharacters(font2, &ii, &glyph, 1);
+	if (!b) { // the current font doesn't contain this char
+	  CFStringRef str = CFStringCreateWithCharactersNoCopy(NULL, &ii, 1, kCFAllocatorNull);
+	  // find a font that contains it
+	  font2 = CTFontCreateForString(font2, str, CFRangeMake(0,1));
+	  must_release = true;
+	  CFRelease(str);
+	  b = CTFontGetGlyphsForCharacters(font2, &ii, &glyph, 1);
+	  }
+	if (b) CTFontGetAdvancesForGlyphs(font2, kCTFontHorizontalOrientation, &glyph, &advance_size, 1);
+	else advance_size.width = 0.;
+	// the width of one character of this block of characters
+	fontsize->width[r][j] = advance_size.width;
+	if (must_release) CFRelease(font2);
+	ii++;
+      }
+    }
+    // sum the widths of all characters of txt
+    retval += fontsize->width[r][uni & (block-1)];
+  }
+  return retval;
+} else {
+#endif
+#if ! __LP64__
+  OSStatus err;
+  Fixed bBefore, bAfter, bAscent, bDescent;
+  ATSUTextLayout layout;
+  ByteCount iSize;
+  ATSUAttributeTag iTag;
+  ATSUAttributeValuePtr iValuePtr;
+
+  // Here's my ATSU text measuring attempt... This seems to do the Right Thing
+  // now collect our ATSU resources and measure our text string
+  layout = fltk3::fontsize->layout;
+  // activate the current GC
+  iSize = sizeof(CGContextRef);
+  iTag = kATSUCGContextTag;
+  iValuePtr = &fl_gc;
+  ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
+  // now measure the bounding box
+  err = ATSUSetTextPointerLocation(layout, txt, kATSUFromTextBeginning, n, n);
+  err = ATSUGetUnjustifiedBounds(layout, kATSUFromTextBeginning, n, &bBefore, &bAfter, &bAscent, &bDescent);
+  // If err is OK then return length, else return 0. Or something...
+  int len = FixedToInt(bAfter);
+  return len;
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+  return 0;
+}
+
+double fltk3::QuartzGraphicsDriver::width(const char* txt, int n) {
+  int wc_len = n;
+  UniChar *uniStr = mac_Utf8_to_Utf16(txt, n, &wc_len);
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  return fl_mac_width(uniStr, wc_len, font_descriptor());
+}
+
+double fltk3::QuartzGraphicsDriver::width(unsigned int wc) {
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+
+  UniChar utf16[3];
+  int l = 1;
+  if (wc <= 0xFFFF) {
+    *utf16 = wc;
+  }
+  else {
+//    char buf[4];
+//    l = fltk3::utf8encode(wc, buf);
+//    l = (int)fltk3::utf8toUtf16(buf, l, utf16, 3);
+    l = (int)fltk3::ucs_to_Utf16(wc, utf16, 3);
+  }
+  return fl_mac_width(utf16, l, font_descriptor());
+}
+
+// text extent calculation
+void fltk3::QuartzGraphicsDriver::text_extents(const char *str8, int n, int &dx, int &dy, int &w, int &h) {
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  UniChar *txt = mac_Utf8_to_Utf16(str8, n, &n);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+if (fl_mac_os_version >= 100500) {
+  CFStringRef str16 = CFStringCreateWithCharactersNoCopy(NULL, txt, n,  kCFAllocatorNull);
+  CFDictionarySetValue (attributes, kCTFontAttributeName, fontsize->fontref);
+  CFAttributedStringRef mastr = CFAttributedStringCreate(kCFAllocatorDefault, str16, attributes);
+  CFRelease(str16);
+  CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
+  CFRelease(mastr);
+  CGContextSetTextPosition(fl_gc, 0, 0);
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGRect rect = CTLineGetImageBounds(ctline, fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+  CFRelease(ctline);
+  dx = floor(rect.origin.x + 0.5);
+  dy = floor(- rect.origin.y - rect.size.height + 0.5);
+  w = rect.size.width + 0.5;
+  h = rect.size.height + 0.5;
+  }
+else {
+#endif
+#if ! __LP64__
+  OSStatus err;
+  ATSUTextLayout layout;
+  ByteCount iSize;
+  ATSUAttributeTag iTag;
+  ATSUAttributeValuePtr iValuePtr;
+
+// Here's my ATSU text measuring attempt... This seems to do the Right Thing
+  // now collect our ATSU resources and measure our text string
+  layout = fltk3::fontsize->layout;
+        // activate the current GC
+  iSize = sizeof(CGContextRef);
+  iTag = kATSUCGContextTag;
+  iValuePtr = &fl_gc;
+      ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
+        // now measure the bounding box
+  err = ATSUSetTextPointerLocation(layout, txt, kATSUFromTextBeginning, n, n);
+  Rect bbox;
+  err = ATSUMeasureTextImage(layout, kATSUFromTextBeginning, n, 0, 0, &bbox);
+  w = bbox.right - bbox.left;
+  h = bbox.bottom - bbox.top;
+  dx = bbox.left;
+  dy = -bbox.bottom;
+//printf("r: %d l: %d t: %d b: %d w: %d h: %d\n", bbox.right, bbox.left, bbox.top, bbox.bottom, w, h);
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+  return;
+} // fltk3::text_extents
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+static CGColorRef flcolortocgcolor(fltk3::Color i)
+{
+  uchar r, g, b;
+  fltk3::get_color(i, r, g, b);
+  CGFloat components[4] = {r/255.0f, g/255.0f, b/255.0f, 1.};
+  static CGColorSpaceRef cspace = NULL;
+  if (cspace == NULL) {
+    cspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
+    }
+  return CGColorCreate(cspace, components);
+}
+#endif
+
+static void fl_mac_draw(const char *str, int n, float x, float y, fltk3::GraphicsDriver *driver) {
+  // convert to UTF-16 first
+  UniChar *uniStr = mac_Utf8_to_Utf16(str, n, &n);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  if (fl_mac_os_version >= 100500) {
+    CFStringRef str16 = CFStringCreateWithCharactersNoCopy(NULL, uniStr, n,  kCFAllocatorNull);
+    if (str16 == NULL) return; // shd not happen
+    CGColorRef color = flcolortocgcolor(driver->color());
+    CFDictionarySetValue (attributes, kCTFontAttributeName, driver->font_descriptor()->fontref);
+    CFDictionarySetValue (attributes, kCTForegroundColorAttributeName, color);
+    CFAttributedStringRef mastr = CFAttributedStringCreate(kCFAllocatorDefault, str16, attributes);
+    CFRelease(str16);
+    CFRelease(color);
+    CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
+    CFRelease(mastr);
+    CGContextSetTextMatrix(fl_gc, font_mx);
+    CGContextSetTextPosition(fl_gc, x, y);
+    CGContextSetShouldAntialias(fl_gc, true);
+    CTLineDraw(ctline, fl_gc);
+    CGContextSetShouldAntialias(fl_gc, false);
+    CFRelease(ctline);
+  } else {
+#endif
+#if ! __LP64__
+  OSStatus err;
+  // now collect our ATSU resources
+  ATSUTextLayout layout = driver->font_descriptor()->layout;
+
+  ByteCount iSize = sizeof(CGContextRef);
+  ATSUAttributeTag iTag = kATSUCGContextTag;
+  ATSUAttributeValuePtr iValuePtr=&fl_gc;
+  ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
+
+  err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
+  CGContextSetShouldAntialias(fl_gc, true);
+  err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x), FloatToFixed(y));
+  CGContextSetShouldAntialias(fl_gc, false);
+#endif
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+}
+
+void fltk3::QuartzGraphicsDriver::draw(const char *str, int n, float x, float y) {
+  // avoid a crash if no font has been selected by user yet !
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  fl_mac_draw(str, n, x, y, this);
+}
+
+void fltk3::QuartzGraphicsDriver::draw(const char* str, int n, int x, int y) {
+  // avoid a crash if no font has been selected by user yet !
+  if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  fl_mac_draw(str, n, (float)x-0.0f, (float)y+0.5f, this);
+}
+
+void fltk3::QuartzGraphicsDriver::draw(int angle, const char *str, int n, int x, int y) {
+  CGContextSaveGState(fl_gc);
+  CGContextTranslateCTM(fl_gc, x, y);
+  CGContextRotateCTM(fl_gc, - angle*(M_PI/180) );
+  draw(str, n, 0, 0);
+  CGContextRestoreGState(fl_gc);
+}
+
+void fltk3::QuartzGraphicsDriver::rtl_draw(const char* c, int n, int x, int y) {
+  int dx, dy, w, h;
+  text_extents(c, n, dx, dy, w, h);
+  draw(c, n, x - w - dx, y);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_get_key.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_get_key_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_get_key.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_get_key.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,124 @@
+//
+// "$Id$"
+//
+// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Return the current state of a key.  Keys are named by fltk symbols,
+// which are actually X keysyms.  So this has to translate to macOS
+// symbols.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <config.h>
+
+// convert an FLTK (X) keysym to a MacOS symbol:
+// See also the inverse converter in table macKeyLookUp of Fl_cocoa.mm
+// This table is in numeric order by FLTK symbol order for binary search.
+// The list of Mac OS virtual keycodes appears with OS 10.5 in
+// ...../Carbon.framework/Frameworks/HIToolbox.framework/Headers/Events.h
+
+static const struct {unsigned short vk, fltk;} vktab[] = {
+  { 49, ' ' }, { 39, '\'' }, { 43, ',' }, { 27, '-' }, { 47, '.' }, { 44, '/' }, 
+  { 29, '0' }, { 18, '1'  }, { 19, '2'  }, { 20, '3'  }, 
+  { 21, '4' }, { 23, '5'  }, { 22, '6'  }, { 26, '7'  }, 
+  { 28, '8' }, { 25, '9'  }, { 41, ';'  }, { 24, '='  },
+  {  0, 'A' }, { 11, 'B'  }, {  8, 'C'  }, {  2, 'D'  }, 
+  { 14, 'E' }, {  3, 'F'  }, {  5, 'G'  }, {  4, 'H'  }, 
+  { 34, 'I' }, { 38, 'J'  }, { 40, 'K'  }, { 37, 'L'  }, 
+  { 46, 'M' }, { 45, 'N'  }, { 31, 'O'  }, { 35, 'P'  }, 
+  { 12, 'Q' }, { 15, 'R'  }, {  1, 'S'  }, { 17, 'T'  }, 
+  { 32, 'U' }, {  9, 'V'  }, { 13, 'W'  }, {  7, 'X'  }, 
+  { 16, 'Y' }, {  6, 'Z'  }, 
+  { 33, '[' }, { 30, ']' }, { 50, '`' },  { 42, '\\' },
+  { 51, fltk3::BackSpaceKey }, { 48, fltk3::TabKey }, { 36, fltk3::EnterKey }, { 0x7F, fltk3::PauseKey },
+  { 0x7F, fltk3::ScrollLockKey }, { 53, fltk3::EscapeKey }, { 0x73, fltk3::HomeKey }, { 123, fltk3::LeftKey },
+  { 126, fltk3::UpKey }, { 124, fltk3::RightKey }, { 125, fltk3::DownKey }, { 0x74, fltk3::PageUpKey },
+  { 0x79, fltk3::PageDownKey },  { 119, fltk3::EndKey }, { 0x7F, fltk3::PrintKey }, { 0x7F, fltk3::InsertKey },
+  { 0x6e, fltk3::MenuKey }, { 114, fltk3::HelpKey }, { 0x47, fltk3::NumLockKey },
+  { 76, fltk3::KPEnterKey }, { 67, fltk3::KPKey+'*' }, { 69, fltk3::KPKey+'+'}, { 78, fltk3::KPKey+'-' }, { 65, fltk3::KPKey+'.' }, { 75, fltk3::KPKey+'/' }, 
+  { 82, fltk3::KPKey+'0' }, { 83, fltk3::KPKey+'1' }, { 84, fltk3::KPKey+'2' }, { 85, fltk3::KPKey+'3' }, 
+  { 86, fltk3::KPKey+'4' }, { 87, fltk3::KPKey+'5' }, { 88, fltk3::KPKey+'6' }, { 89, fltk3::KPKey+'7' }, 
+  { 91, fltk3::KPKey+'8' }, { 92, fltk3::KPKey+'9' }, { 81, fltk3::KPKey+'=' }, 
+  { 0x7a, fltk3::FKey+1 }, { 0x78, fltk3::FKey+2  }, { 0x63, fltk3::FKey+3  }, { 0x76, fltk3::FKey+4  }, 
+  { 0x60, fltk3::FKey+5 }, { 0x61, fltk3::FKey+6  }, { 0x62, fltk3::FKey+7  }, { 0x64, fltk3::FKey+8  }, 
+  { 0x65, fltk3::FKey+9 }, { 0x6D, fltk3::FKey+10 }, { 0x67, fltk3::FKey+11 }, { 0x6f, fltk3::FKey+12 }, 
+  { 0x69, fltk3::FKey+13 }, { 0x6B, fltk3::FKey+14 }, { 0x71, fltk3::FKey+15 }, { 0x6A, fltk3::FKey+16 }, 
+  { 0x38, fltk3::ShiftLKey }, { 0x3C, fltk3::ShiftRKey }, { 0x3B, fltk3::ControlLKey }, { 0x3E, fltk3::ControlRKey }, 
+  { 0x39, fltk3::CapsLockKey }, { 0x37, fltk3::MetaLKey }, { 0x36, fltk3::MetaRKey },
+  { 0x3A, fltk3::AltLKey }, { 0x3D, fltk3::AltRKey }, { 0x75, fltk3::DeleteKey },
+};
+
+static int fltk2mac(int fltk) {
+  int a = 0;
+  int b = sizeof(vktab)/sizeof(*vktab);
+  while (a < b) {
+    int c = (a+b)/2;
+    if (vktab[c].fltk == fltk) return vktab[c].vk;
+    if (vktab[c].fltk < fltk) a = c+1; else b = c;
+  }
+  return 127;
+}
+
+//: returns true, if that key was pressed during the last event
+int fltk3::event_key(unsigned int k) {
+  return get_key(k);
+}
+
+//: returns true, if that key is pressed right now
+int fltk3::get_key(unsigned int k) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+  if(CGEventSourceKeyState != NULL) {
+    return (int)CGEventSourceKeyState(kCGEventSourceStateCombinedSessionState, fltk2mac(k) );
+    }
+  else 
+#endif
+  {
+  typedef UInt32 fl_KeyMap[4];
+  fl_KeyMap foo;
+  // use the GetKeys Carbon function
+  typedef void (*keymap_f)(fl_KeyMap);
+  static keymap_f f = NULL;
+  if (!f) f = ( keymap_f )Fl_X::get_carbon_function("GetKeys");
+  (*f)(foo);
+#ifdef MAC_TEST_FOR_KEYCODES
+ static int cnt = 0;
+ if (cnt++>1024) {
+  cnt = 0;
+  printf("%08x %08x %08x %08x\n", (ulong*)(foo)[3], (ulong*)(foo)[2], (ulong*)(foo)[1], (ulong*)(foo)[0]);
+ }
+#endif
+  unsigned char *b = (unsigned char*)foo;
+  // KP_Enter can be at different locations for Powerbooks vs. desktop Macs
+  if (k==fltk3::KPEnterKey) {
+    return (((b[0x34>>3]>>(0x34&7))&1)||((b[0x4c>>3]>>(0x4c&7))&1));
+  }
+  int i = fltk2mac(k);
+  return (b[i>>3]>>(i&7))&1;
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_interface.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_interface.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_interface.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,2870 @@
+//
+// "$Id$"
+//
+// MacOS specific code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//// From the inner edge of a MetroWerks CodeWarrior CD:
+// (without permission)
+//
+// "Three Compiles for 68Ks under the sky,
+// Seven Compiles for PPCs in their fragments of code,
+// Nine Compiles for Mortal Carbon doomed to die,
+// One Compile for Mach-O Cocoa on its Mach-O throne,
+// in the Land of MacOS X where the Drop-Shadows lie.
+// 
+// One Compile to link them all, One Compile to merge them,
+// One Compile to copy them all and in the bundle bind them,
+// in the Land of MacOS X where the Drop-Shadows lie."
+
+// warning: the Apple Quartz version still uses some Quickdraw calls,
+//          mostly to get around the single active context in QD and 
+//          to implement clipping. This should be changed into pure
+//          Quartz calls in the near future.
+
+// FIXME moving away from Carbon, I am replacing the Scrap manager calls with Pasteboard
+//       calls that support utf8 encoding. As soon as these function haven proven working
+//       the Scrap manager calls should be removed
+#define USE_PASTEBOARD 1
+
+// we don't need the following definition because we deliver only
+// true mouse moves.  On very slow systems however, this flag may
+// still be useful.
+#ifndef FLTK3_DOXYGEN
+
+#define CONSOLIDATE_MOTION 0
+extern "C" {
+#include <pthread.h>
+}
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/Window.h>
+#include <fltk3/Tooltip.h>
+#include <fltk3/SysMenuBar.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <unistd.h>
+
+// #define DEBUG_SELECT		// UNCOMMENT FOR SELECT()/THREAD DEBUGGING
+#ifdef DEBUG_SELECT
+#include <stdio.h>		// testing
+#define DEBUGMSG(msg)		if ( msg ) fprintf(stderr, msg);
+#define DEBUGPERRORMSG(msg)	if ( msg ) perror(msg)
+#define DEBUGTEXT(txt)		txt
+#else
+#define DEBUGMSG(msg)
+#define DEBUGPERRORMSG(msg)
+#define DEBUGTEXT(txt)		NULL
+#endif /*DEBUG_SELECT*/
+
+// external functions
+extern fltk3::Window* fl_find(Window);
+extern void fl_fix_focus();
+
+// forward definition of functions in this file
+static void handleUpdateEvent( WindowPtr xid );
+//+ int fl_handle(const EventRecord &event);
+static int FSSpec2UnixPath( FSSpec *fs, char *dst );
+// converting cr lf converter function
+static void convert_crlf(char * string, size_t len);
+
+// public variables
+int fl_screen;
+CGContextRef fl_gc = 0;
+Handle fl_system_menu;
+fltk3::SysMenuBar *fltk3::sys_menu_bar = 0;
+CursHandle fl_default_cursor;
+WindowRef fl_capture = 0;            // we need this to compensate for a missing(?) mouse capture
+ulong fl_event_time;                 // the last timestamp from an x event
+char fl_key_vector[32];              // used by fltk3::get_key()
+bool fl_show_iconic;                 // true if called from iconize() - shows the next created window in collapsed state
+int fl_disable_transient_for;        // secret method of removing TRANSIENT_FOR
+const fltk3::Window* fl_modal_for;       // parent of modal() window
+fltk3::Region fl_window_region = 0;
+Window fl_window;
+fltk3::Window *fltk3::Window::current_;
+EventRef fl_os_event;		// last (mouse) event
+
+// forward declarations of variables in this file
+static int got_events = 0;
+static fltk3::Window* resize_from_system;
+static CursPtr default_cursor_ptr;
+static Cursor default_cursor;
+static WindowRef fl_os_capture = 0; // the dispatch handler will redirect mose move and drag events to these windows
+
+#if CONSOLIDATE_MOTION
+static fltk3::Window* send_motion;
+extern fltk3::Window* fl_xmousewin;
+#endif
+
+enum { kEventClassFLTK = 'fltk' };
+enum { kEventFLTKBreakLoop = 1, kEventFLTKDataReady };
+
+/* fltk-utf8 placekeepers */
+void fltk3::reset_spot()
+{
+}
+
+void fltk3::set_spot(int font, int size, int X, int Y, int W, int H, fltk3::Window *win)
+{
+}
+
+void fltk3::set_status(int x, int y, int w, int h)
+{
+}
+
+/**
+* Mac keyboard lookup table
+ */
+static unsigned short macKeyLookUp[128] =
+{
+    'a', 's', 'd', 'f', 'h', 'g', 'z', 'x',
+    'c', 'v', '^', 'b', 'q', 'w', 'e', 'r',
+
+    'y', 't', '1', '2', '3', '4', '6', '5',
+    '=', '9', '7', '-', '8', '0', ']', 'o',
+
+    'u', '[', 'i', 'p', fltk3::EnterKey, 'l', 'j', '\'',
+    'k', ';', '\\', ',', '/', 'n', 'm', '.',
+
+    fltk3::TabKey, ' ', '`', fltk3::BackSpaceKey, 
+    fltk3::KPEnterKey, fltk3::EscapeKey, 0, 0/*fltk3::MetaLKey*/,
+    0/*fltk3::ShiftLKey*/, 0/*fltk3::CapsLockKey*/, 0/*fltk3::AltLKey*/, 0/*fltk3::ControlLKey*/, 
+    0/*fltk3::ShiftRKey*/, 0/*fltk3::AltRKey*/, 0/*fltk3::ControlRKey*/, 0,
+
+    0, fltk3::KPKey+'.', fltk3::RightKey, fltk3::KPKey+'*', 0, fltk3::KPKey+'+', fltk3::LeftKey, fltk3::DeleteKey,
+    fltk3::DownKey, 0, 0, fltk3::KPKey+'/', fltk3::KPEnterKey, fltk3::UpKey, fltk3::KPKey+'-', 0,
+
+    0, fltk3::KPKey+'=', fltk3::KPKey+'0', fltk3::KPKey+'1', fltk3::KPKey+'2', fltk3::KPKey+'3', fltk3::KPKey+'4', fltk3::KPKey+'5',
+    fltk3::KPKey+'6', fltk3::KPKey+'7', 0, fltk3::KPKey+'8', fltk3::KPKey+'9', 0, 0, 0,
+
+    fltk3::FKey+5, fltk3::FKey+6, fltk3::FKey+7, fltk3::FKey+3, fltk3::FKey+8, fltk3::FKey+9, 0, fltk3::FKey+11,
+    0, 0/*fltk3::FKey+13*/, fltk3::PrintKey, fltk3::ScrollLockKey, 0, fltk3::FKey+10, fltk3::MenuKey, fltk3::FKey+12,
+
+    0, fltk3::PauseKey, fltk3::HelpKey, fltk3::HomeKey, fltk3::PageUpKey, fltk3::DeleteKey, fltk3::FKey+4, fltk3::EndKey,
+    fltk3::FKey+2, fltk3::PageDownKey, fltk3::FKey+1, fltk3::LeftKey, fltk3::RightKey, fltk3::DownKey, fltk3::UpKey, 0/*FL_Power*/,
+};
+
+/**
+ * convert the current mouse chord into the FLTK modifier state
+ */
+static unsigned int mods_to_e_state( UInt32 mods )
+{
+  long state = 0;
+  if ( mods & kEventKeyModifierNumLockMask ) state |= fltk3::NUM_LOCK;
+  if ( mods & cmdKey ) state |= fltk3::META;
+  if ( mods & (optionKey|rightOptionKey) ) state |= fltk3::ALT;
+  if ( mods & (controlKey|rightControlKey) ) state |= fltk3::CTRL;
+  if ( mods & (shiftKey|rightShiftKey) ) state |= fltk3::SHIFT;
+  if ( mods & alphaLock ) state |= fltk3::CAPS_LOCK;
+  unsigned int ret = ( fltk3::e_state & 0xff000000 ) | state;
+  fltk3::e_state = ret;
+  //printf( "State 0x%08x (%04x)\n", fltk3::e_state, mods );
+  return ret;
+}
+
+
+/**
+ * convert the current mouse chord into the FLTK keysym
+ */
+static void mods_to_e_keysym( UInt32 mods )
+{
+  if ( mods & cmdKey ) fltk3::e_keysym = fltk3::MetaLKey;
+  else if ( mods & kEventKeyModifierNumLockMask ) fltk3::e_keysym = fltk3::NumLockKey;
+  else if ( mods & optionKey ) fltk3::e_keysym = fltk3::AltLKey;
+  else if ( mods & rightOptionKey ) fltk3::e_keysym = fltk3::AltRKey;
+  else if ( mods & controlKey ) fltk3::e_keysym = fltk3::ControlLKey;
+  else if ( mods & rightControlKey ) fltk3::e_keysym = fltk3::ControlRKey;
+  else if ( mods & shiftKey ) fltk3::e_keysym = fltk3::ShiftLKey;
+  else if ( mods & rightShiftKey ) fltk3::e_keysym = fltk3::ShiftRKey;
+  else if ( mods & alphaLock ) fltk3::e_keysym = fltk3::CapsLockKey;
+  else fltk3::e_keysym = 0;
+  //printf( "to sym 0x%08x (%04x)\n", fltk3::e_keysym, mods );
+}
+// these pointers are set by the fltk3::lock() function:
+static void nothing() {}
+void (*fl_lock_function)() = nothing;
+void (*fl_unlock_function)() = nothing;
+
+//
+// Select interface -- how it's implemented:
+//     When the user app configures one or more file descriptors to monitor
+//     with fltk3::add_fd(), we start a separate thread to select() the  data,
+//     sending a custom OSX 'FLTK data ready event' to the parent  thread's
+//     RunApplicationLoop(), so that it triggers the data  ready  callbacks
+//     in the parent thread.                               -erco 04/04/04
+//     
+#define POLLIN  1
+#define POLLOUT 4
+#define POLLERR 8
+
+// Class to handle select() 'data ready'
+class DataReady
+{
+    struct FD
+    {
+      int fd;
+      short events;
+      void (*cb)(int, void*);
+      void* arg;
+    };
+    int nfds, fd_array_size;
+    FD *fds;
+    pthread_t tid;		// select()'s thread id
+
+    // Data that needs to be locked (all start with '_')
+    pthread_mutex_t _datalock;	// data lock
+    fd_set _fdsets[3];		// r/w/x sets user wants to monitor
+    int _maxfd;			// max fd count to monitor
+    int _cancelpipe[2];		// pipe used to help cancel thread
+    void *_userdata;		// thread's userdata
+
+public:
+    DataReady()
+    {
+      nfds = 0;
+      fd_array_size = 0;
+      fds = 0;
+      tid = 0;
+
+      pthread_mutex_init(&_datalock, NULL);
+      FD_ZERO(&_fdsets[0]); FD_ZERO(&_fdsets[1]); FD_ZERO(&_fdsets[2]);
+      _cancelpipe[0] = _cancelpipe[1] = 0;
+      _userdata = 0;
+      _maxfd = 0;
+    }
+
+    ~DataReady()
+    {
+        CancelThread(DEBUGTEXT("DESTRUCTOR\n"));
+        if (fds) { free(fds); fds = 0; }
+	nfds = 0;
+    }
+
+    // Locks
+    //    The convention for locks: volatile vars start with '_',
+    //    and must be locked before use. Locked code is prefixed 
+    //    with /*LOCK*/ to make painfully obvious esp. in debuggers. -erco
+    //
+    void DataLock() { pthread_mutex_lock(&_datalock); }
+    void DataUnlock() { pthread_mutex_unlock(&_datalock); }
+
+    // Accessors
+    int IsThreadRunning() { return(tid ? 1 : 0); }
+    int GetNfds() { return(nfds); }
+    int GetCancelPipe(int ix) { return(_cancelpipe[ix]); }
+    fd_set GetFdset(int ix) { return(_fdsets[ix]); }
+
+    // Methods
+    void AddFD(int n, int events, void (*cb)(int, void*), void *v);
+    void RemoveFD(int n, int events);
+    int CheckData(fd_set& r, fd_set& w, fd_set& x);
+    void HandleData(fd_set& r, fd_set& w, fd_set& x);
+    static void* DataReadyThread(void *self);
+    void StartThread(void *userdata);
+    void CancelThread(const char *reason);
+};
+
+static DataReady dataready;
+
+void DataReady::AddFD(int n, int events, void (*cb)(int, void*), void *v)
+{
+  RemoveFD(n, events);
+  int i = nfds++;
+  if (i >= fd_array_size) 
+  {
+    FD *temp;
+    fd_array_size = 2*fd_array_size+1;
+    if (!fds) { temp = (FD*)malloc(fd_array_size*sizeof(FD)); }
+    else { temp = (FD*)realloc(fds, fd_array_size*sizeof(FD)); }
+    if (!temp) return;
+    fds = temp;
+  }
+  fds[i].cb  = cb;
+  fds[i].arg = v;
+  fds[i].fd  = n;
+  fds[i].events = events;
+  DataLock();
+  /*LOCK*/  if (events & POLLIN)  FD_SET(n, &_fdsets[0]);
+  /*LOCK*/  if (events & POLLOUT) FD_SET(n, &_fdsets[1]);
+  /*LOCK*/  if (events & POLLERR) FD_SET(n, &_fdsets[2]);
+  /*LOCK*/  if (n > _maxfd) _maxfd = n;
+  DataUnlock();
+}
+
+// Remove an FD from the array
+void DataReady::RemoveFD(int n, int events)
+{
+  int i,j;
+  for (i=j=0; i<nfds; i++)
+  {
+    if (fds[i].fd == n) 
+    {
+      int e = fds[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      fds[i].events = e;
+    }
+    // move it down in the array if necessary:
+    if (j<i)
+      { fds[j] = fds[i]; }
+    j++;
+  }
+  nfds = j;
+  DataLock();
+  /*LOCK*/  if (events & POLLIN)  FD_CLR(n, &_fdsets[0]);
+  /*LOCK*/  if (events & POLLOUT) FD_CLR(n, &_fdsets[1]);
+  /*LOCK*/  if (events & POLLERR) FD_CLR(n, &_fdsets[2]);
+  /*LOCK*/  if (n == _maxfd) _maxfd--;
+  DataUnlock();
+}
+
+// CHECK IF USER DATA READY, RETURNS r/w/x INDICATING WHICH IF ANY
+int DataReady::CheckData(fd_set& r, fd_set& w, fd_set& x)
+{
+  int ret;
+  DataLock();
+  /*LOCK*/  timeval t = { 0, 1 };		// quick check
+  /*LOCK*/  r = _fdsets[0], w = _fdsets[1], x = _fdsets[2];
+  /*LOCK*/  ret = ::select(_maxfd+1, &r, &w, &x, &t);
+  DataUnlock();
+  if ( ret == -1 )
+    { DEBUGPERRORMSG("CheckData(): select()"); }
+  return(ret);
+}
+
+// HANDLE DATA READY CALLBACKS
+void DataReady::HandleData(fd_set& r, fd_set& w, fd_set& x)
+{
+  for (int i=0; i<nfds; i++) 
+  {
+    int f = fds[i].fd;
+    short revents = 0;
+    if (FD_ISSET(f, &r)) revents |= POLLIN;
+    if (FD_ISSET(f, &w)) revents |= POLLOUT;
+    if (FD_ISSET(f, &x)) revents |= POLLERR;
+    if (fds[i].events & revents) 
+    {
+      DEBUGMSG("DOING CALLBACK: ");
+      fds[i].cb(f, fds[i].arg);
+      DEBUGMSG("DONE\n");
+    }
+  }
+}
+
+// DATA READY THREAD
+//    This thread watches for changes in user's file descriptors.
+//    Sends a 'data ready event' to the main thread if any change.
+//
+void* DataReady::DataReadyThread(void *o)
+{
+  DataReady *self = (DataReady*)o;
+  while ( 1 )					// loop until thread cancel or error
+  {
+    // Thread safe local copies of data before each select()
+    self->DataLock();
+    /*LOCK*/  int maxfd = self->_maxfd;
+    /*LOCK*/  fd_set r = self->GetFdset(0);
+    /*LOCK*/  fd_set w = self->GetFdset(1);
+    /*LOCK*/  fd_set x = self->GetFdset(2);
+    /*LOCK*/  void *userdata = self->_userdata;
+    /*LOCK*/  int cancelpipe = self->GetCancelPipe(0);
+    /*LOCK*/  if ( cancelpipe > maxfd ) maxfd = cancelpipe;
+    /*LOCK*/  FD_SET(cancelpipe, &r);		// add cancelpipe to fd's to watch
+    /*LOCK*/  FD_SET(cancelpipe, &x);
+    self->DataUnlock();
+    // timeval t = { 1000, 0 };	// 1000 seconds;
+    timeval t = { 2, 0 };	// HACK: 2 secs prevents 'hanging' problem
+    int ret = ::select(maxfd+1, &r, &w, &x, &t);
+    pthread_testcancel();	// OSX 10.0.4 and older: needed for parent to cancel
+    switch ( ret )
+    {
+      case 0:	// NO DATA
+        continue;
+      case -1:	// ERROR
+      {
+        DEBUGPERRORMSG("CHILD THREAD: select() failed");
+        return(NULL);		// error? exit thread
+      }
+      default:	// DATA READY
+      {
+	if (FD_ISSET(cancelpipe, &r) || FD_ISSET(cancelpipe, &x)) 	// cancel?
+	    { return(NULL); }						// just exit
+        DEBUGMSG("CHILD THREAD: DATA IS READY\n");
+        EventRef drEvent;
+        CreateEvent( 0, kEventClassFLTK, kEventFLTKDataReady,
+		     0, kEventAttributeUserEvent, &drEvent);
+        EventQueueRef eventqueue = (EventQueueRef)userdata;
+        PostEventToQueue(eventqueue, drEvent, kEventPriorityStandard );
+        ReleaseEvent( drEvent );
+        return(NULL);		// done with thread
+      }
+    }
+  }
+}
+
+// START 'DATA READY' THREAD RUNNING, CREATE INTER-THREAD PIPE
+void DataReady::StartThread(void *new_userdata)
+{
+  CancelThread(DEBUGTEXT("STARTING NEW THREAD\n"));
+  DataLock();
+  /*LOCK*/  pipe(_cancelpipe);	// pipe for sending cancel msg to thread
+  /*LOCK*/  _userdata = new_userdata;
+  DataUnlock();
+  DEBUGMSG("*** START THREAD\n");
+  pthread_create(&tid, NULL, DataReadyThread, (void*)this);
+}
+
+// CANCEL 'DATA READY' THREAD, CLOSE PIPE
+void DataReady::CancelThread(const char *reason)
+{
+  if ( tid )
+  {
+    DEBUGMSG("*** CANCEL THREAD: ");
+    DEBUGMSG(reason);
+    if ( pthread_cancel(tid) == 0 )		// cancel first
+    {
+      DataLock();
+      /*LOCK*/  write(_cancelpipe[1], "x", 1);	// wake thread from select
+      DataUnlock();
+      pthread_join(tid, NULL);			// wait for thread to finish
+    }
+    tid = 0;
+    DEBUGMSG("(JOINED) OK\n");
+  }
+  // Close pipe if open
+  DataLock();
+  /*LOCK*/  if ( _cancelpipe[0] ) { close(_cancelpipe[0]); _cancelpipe[0] = 0; }
+  /*LOCK*/  if ( _cancelpipe[1] ) { close(_cancelpipe[1]); _cancelpipe[1] = 0; }
+  DataUnlock();
+}
+
+void fltk3::add_fd( int n, int events, void (*cb)(int, void*), void *v )
+    { dataready.AddFD(n, events, cb, v); }
+
+void fltk3::add_fd(int fd, void (*cb)(int, void*), void* v)
+    { dataready.AddFD(fd, POLLIN, cb, v); }
+
+void fltk3::remove_fd(int n, int events)
+    { dataready.RemoveFD(n, events); }
+
+void fltk3::remove_fd(int n)
+    { dataready.RemoveFD(n, -1); }
+
+/**
+ * Check if there is actually a message pending!
+ */
+int fl_ready()
+{
+  EventRef event;
+  return !ReceiveNextEvent(0, NULL, 0.0, false, &event);
+}
+
+/**
+ * handle Apple Menu items (can be created using the fltk3::SysMenuBar
+ * returns eventNotHandledErr if the menu item could not be handled
+ */
+OSStatus HandleMenu( HICommand *cmd )
+{
+  OSStatus ret = eventNotHandledErr;
+  // attributes, commandIDm menu.menuRef, menu.menuItemIndex
+  UInt32 ref;
+  OSErr rrc = GetMenuItemRefCon( cmd->menu.menuRef, cmd->menu.menuItemIndex, &ref );
+  //printf( "%d, %08x, %08x, %d, %d, %8x\n", rrc, cmd->attributes, cmd->commandID, cmd->menu.menuRef, cmd->menu.menuItemIndex, rrc );
+  if ( rrc==noErr && ref )
+  {
+    fltk3::MenuItem *m = (fltk3::MenuItem*)ref;
+    //printf( "Menu: %s\n", m->label() );
+    fltk3::sys_menu_bar->picked( m );
+    if ( m->flags & fltk3::MENU_TOGGLE ) // update the menu toggle symbol
+      SetItemMark( cmd->menu.menuRef, cmd->menu.menuItemIndex, (m->flags & fltk3::MENU_VALUE ) ? 0x12 : 0 );
+    if ( m->flags & fltk3::MENU_RADIO ) // update all radio buttons in this menu
+    {
+      fltk3::MenuItem *j = m;
+      int i = cmd->menu.menuItemIndex;
+      for (;;)
+      {
+        if ( j->flags & fltk3::MENU_DIVIDER )
+          break;
+        j++; i++;
+        if ( !j->text || !j->radio() )
+          break;
+        SetItemMark( cmd->menu.menuRef, i, ( j->flags & fltk3::MENU_VALUE ) ? 0x13 : 0 );
+      }
+      j = m-1; i = cmd->menu.menuItemIndex-1;
+      for ( ; i>0; j--, i-- )
+      {
+        if ( !j->text || j->flags&fltk3::MENU_DIVIDER || !j->radio() )
+          break;
+        SetItemMark( cmd->menu.menuRef, i, ( j->flags & fltk3::MENU_VALUE ) ? 0x13 : 0 );
+      }
+      SetItemMark( cmd->menu.menuRef, cmd->menu.menuItemIndex, ( m->flags & fltk3::MENU_VALUE ) ? 0x13 : 0 );
+    }
+    ret = noErr; // done handling this event
+  }
+  HiliteMenu(0);
+  return ret;
+}
+
+
+/**
+ * We can make every event pass through this function
+ * - mouse events need to be manipulated to use a mouse focus window
+ * - keyboard, mouse and some window  events need to quit the Apple Event Loop
+ *   so FLTK can continue its own management
+ */
+static pascal OSStatus carbonDispatchHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  OSStatus ret = eventNotHandledErr;
+  HICommand cmd;
+
+  fl_lock_function();
+
+  got_events = 1;
+
+  switch ( GetEventClass( event ) )
+  {
+  case kEventClassMouse:
+    switch ( GetEventKind( event ) )
+    {
+    case kEventMouseUp:
+    case kEventMouseMoved:
+    case kEventMouseDragged:
+      if ( fl_capture )
+        ret = SendEventToEventTarget( event, GetWindowEventTarget( fl_capture ) );
+      else if ( fl_os_capture ){
+        ret = SendEventToEventTarget( event, GetWindowEventTarget( fl_os_capture ) );
+	fl_os_capture = 0;
+      }
+      break;
+    }
+    break;
+  case kEventClassCommand:
+    switch (GetEventKind( event ) )
+    {
+      case kEventCommandProcess:
+        ret = GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &cmd );
+        if (ret == noErr && (cmd.attributes & kHICommandFromMenu) != 0) 
+          ret = HandleMenu( &cmd );
+        else 
+          ret = eventNotHandledErr;
+        break;
+    }
+    break;
+  case kEventClassFLTK:
+    switch ( GetEventKind( event ) )
+    {
+    case kEventFLTKBreakLoop:
+      ret = noErr;
+      break;
+    case kEventFLTKDataReady:
+      {
+	dataready.CancelThread(DEBUGTEXT("DATA READY EVENT\n"));
+
+        // CHILD THREAD TELLS US DATA READY
+	//     Check to see what's ready, and invoke user's cb's
+	//
+	fd_set r,w,x;
+	switch(dataready.CheckData(r,w,x))
+	{
+	  case 0:	// NO DATA
+	    break;
+	  case -1:	// ERROR
+	    break;
+	  default:	// DATA READY
+	    dataready.HandleData(r,w,x);
+	    break;
+        }
+      }
+      ret = noErr;
+      break;
+    }
+  }
+  if ( ret == eventNotHandledErr )
+    ret = CallNextEventHandler( nextHandler, event ); // let the OS handle the activation, but continue to get a click-through effect
+
+  fl_unlock_function();
+
+  return ret;
+}
+
+
+/**
+ * break the current event loop
+ */
+static void breakMacEventLoop()
+{
+  EventRef breakEvent;
+
+  fl_lock_function();
+
+  CreateEvent( 0, kEventClassFLTK, kEventFLTKBreakLoop, 0, kEventAttributeUserEvent, &breakEvent );
+  PostEventToQueue( GetCurrentEventQueue(), breakEvent, kEventPriorityStandard );
+  ReleaseEvent( breakEvent );
+
+  fl_unlock_function();
+}
+
+//
+// MacOS X timers
+//
+
+struct MacTimeout {
+    fltk3::TimeoutHandler callback;
+    void* data;
+    EventLoopTimerRef timer;
+    EventLoopTimerUPP upp;
+    char pending; 
+};
+static MacTimeout* mac_timers;
+static int mac_timer_alloc;
+static int mac_timer_used;
+
+
+static void realloc_timers()
+{
+    if (mac_timer_alloc == 0) {
+        mac_timer_alloc = 8;
+    }
+    mac_timer_alloc *= 2;
+    MacTimeout* new_timers = new MacTimeout[mac_timer_alloc];
+    memset(new_timers, 0, sizeof(MacTimeout)*mac_timer_alloc);
+    memcpy(new_timers, mac_timers, sizeof(MacTimeout) * mac_timer_used);
+    MacTimeout* delete_me = mac_timers;
+    mac_timers = new_timers;
+    delete [] delete_me;
+}
+
+static void delete_timer(MacTimeout& t)
+{
+    if (t.timer) {
+        RemoveEventLoopTimer(t.timer);
+        DisposeEventLoopTimerUPP(t.upp);
+        memset(&t, 0, sizeof(MacTimeout));
+    }
+}
+
+
+static pascal void do_timer(EventLoopTimerRef timer, void* data)
+{
+   for (int i = 0;  i < mac_timer_used;  ++i) {
+        MacTimeout& t = mac_timers[i];
+        if (t.timer == timer  &&  t.data == data) {
+            t.pending = 0;
+            (*t.callback)(data);
+            if (t.pending==0)
+              delete_timer(t);
+            break;
+        }
+    }
+    breakMacEventLoop();
+}
+
+/**
+ * This function is the central event handler.
+ * It reads events from the event queue using the given maximum time
+ * Funny enough, it returns the same time that it got as the argument. 
+ */
+static double do_queued_events( double time = 0.0 ) 
+{
+  static bool been_here = false;
+  static RgnHandle rgn;
+  
+  // initialize events and a region that enables mouse move events
+  if (!been_here) {
+    rgn = NewRgn();
+    Point mp;
+    GetMouse(&mp);
+    SetRectRgn(rgn, mp.h, mp.v, mp.h, mp.v);
+    SetEventMask(everyEvent);
+    been_here = true;
+  }
+  OSStatus ret;
+  static EventTargetRef target = 0;
+  if ( !target ) 
+  {
+    target = GetEventDispatcherTarget();
+
+    EventHandlerUPP dispatchHandler = NewEventHandlerUPP( carbonDispatchHandler ); // will not be disposed by Carbon...
+    static EventTypeSpec dispatchEvents[] = {
+        { kEventClassWindow, kEventWindowShown },
+        { kEventClassWindow, kEventWindowHidden },
+        { kEventClassWindow, kEventWindowActivated },
+        { kEventClassWindow, kEventWindowDeactivated },
+        { kEventClassWindow, kEventWindowClose },
+        { kEventClassKeyboard, kEventRawKeyDown },
+        { kEventClassKeyboard, kEventRawKeyRepeat },
+        { kEventClassKeyboard, kEventRawKeyUp },
+        { kEventClassKeyboard, kEventRawKeyModifiersChanged },
+        { kEventClassMouse, kEventMouseDown },
+        { kEventClassMouse, kEventMouseUp },
+        { kEventClassMouse, kEventMouseMoved },
+        { kEventClassMouse, 11 }, // MightyMouse wheels
+        { kEventClassMouse, kEventMouseWheelMoved },
+        { kEventClassMouse, kEventMouseDragged },
+        { kEventClassFLTK, kEventFLTKBreakLoop },
+        { kEventClassFLTK, kEventFLTKDataReady } };
+    ret = InstallEventHandler( target, dispatchHandler, GetEventTypeCount(dispatchEvents), dispatchEvents, 0, 0L );
+    static EventTypeSpec appEvents[] = {
+        { kEventClassCommand, kEventCommandProcess } };
+    ret = InstallApplicationEventHandler( dispatchHandler, GetEventTypeCount(appEvents), appEvents, 0, 0L );
+  }
+
+  got_events = 0;
+
+  // Check for re-entrant condition
+  if ( dataready.IsThreadRunning() )
+    { dataready.CancelThread(DEBUGTEXT("AVOID REENTRY\n")); }
+
+  // Start thread to watch for data ready
+  if ( dataready.GetNfds() )
+      { dataready.StartThread((void*)GetCurrentEventQueue()); }
+
+  fl_unlock_function();
+
+  EventRef event;
+  EventTimeout timeout = time;
+  if (!ReceiveNextEvent(0, NULL, timeout, true, &event)) {
+    got_events = 1;
+    OSErr ret = SendEventToEventTarget( event, target );
+    if (ret!=noErr) {
+      EventRecord clevent;
+      ConvertEventRefToEventRecord(event, &clevent);
+      if (clevent.what==kHighLevelEvent) {
+        ret = AEProcessAppleEvent(&clevent);
+      }
+    }
+    if (   ret==eventNotHandledErr
+        && GetEventClass(event)==kEventClassMouse
+        && GetEventKind(event)==kEventMouseDown ) {
+      WindowRef win; Point pos;
+      GetEventParameter(event, kEventParamMouseLocation, typeQDPoint,
+        NULL, sizeof(pos), NULL, &pos);
+      if (MacFindWindow(pos, &win)==inMenuBar) {
+        MenuSelect(pos);
+      }
+    }
+    ReleaseEvent( event );
+  }
+
+  fl_lock_function();
+
+#if CONSOLIDATE_MOTION
+  if (send_motion && send_motion == fl_xmousewin) {
+    send_motion = 0;
+    fltk3::handle(fltk3::MOVE, fl_xmousewin);
+  }
+#endif
+
+  return time;
+}
+
+
+/**
+ * This public function handles all events. It wait a maximum of 
+ * 'time' secods for an event. This version returns 1 if events
+ * other than the timeout timer were processed.
+ *
+ * \todo there is no socket handling in this code whatsoever
+ */
+int fl_wait( double time ) 
+{
+  do_queued_events( time );
+  return (got_events);
+}
+
+
+/**
+ * event handler for Apple-Q key combination
+ * this is also called from the Carbon Window handler after all windows were closed
+ */
+static OSErr QuitAppleEventHandler( const AppleEvent *appleEvt, AppleEvent* reply, UInt32 refcon )
+{
+  fl_lock_function();
+
+  while ( Fl_X::first ) {
+    Fl_X *x = Fl_X::first;
+    fltk3::handle( fltk3::CLOSE, x->w );
+    if ( Fl_X::first == x ) {
+      fl_unlock_function();
+      return noErr; // FLTK has not close all windows, so we return to the main program now
+    }
+  }
+
+  fl_unlock_function();
+
+  return noErr;
+}
+
+
+/**
+ * Carbon Window handler
+ * This needs to be linked into all new window event handlers
+ */
+static pascal OSStatus carbonWindowHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  UInt32 kind = GetEventKind( event );
+  OSStatus ret = eventNotHandledErr;
+  fltk3::Window *window = (fltk3::Window*)userData;
+  fltk3::first_window(window);
+
+  Rect currentBounds, originalBounds;
+  WindowClass winClass;
+  static fltk3::Window *activeWindow = 0;
+  
+  fl_lock_function();
+  
+  switch ( kind )
+  {
+  case kEventWindowBoundsChanging:
+    GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &currentBounds );
+    GetEventParameter( event, kEventParamOriginalBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &originalBounds );
+    break;
+  case kEventWindowDrawContent:
+    handleUpdateEvent( fl_xid( window ) );
+    ret = noErr;
+    break;
+  case kEventWindowBoundsChanged: {
+    GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &currentBounds );
+    GetEventParameter( event, kEventParamOriginalBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &originalBounds );
+    int X = currentBounds.left, W = currentBounds.right-X;
+    int Y = currentBounds.top, H = currentBounds.bottom-Y;
+    resize_from_system = window;
+    window->resize( X, Y, W, H );
+    if ( ( originalBounds.right - originalBounds.left != W ) 
+      || ( originalBounds.bottom - originalBounds.top != H ) )
+    {
+      if ( window->shown() ) 
+        handleUpdateEvent( fl_xid( window ) );
+    } 
+    break; }
+  case kEventWindowShown:
+    if ( !window->parent() )
+    {
+      GetWindowClass( fl_xid( window ), &winClass );
+      if ( winClass != kHelpWindowClass ) {	// help windows can't get the focus!
+        fltk3::handle( fltk3::FOCUS, window);
+        activeWindow = window;
+      }
+      fltk3::handle( fltk3::SHOW, window);
+      mods_to_e_state(GetCurrentKeyModifiers());
+    }
+    break;
+  case kEventWindowHidden:
+    if ( !window->parent() ) fltk3::handle( fltk3::HIDE, window);
+    break;
+  case kEventWindowActivated:
+    if ( window->shown() && window!=activeWindow )
+    {
+      GetWindowClass( fl_xid( window ), &winClass );
+      if ( winClass != kHelpWindowClass ) {	// help windows can't get the focus!
+        fltk3::handle( fltk3::FOCUS, window);
+        activeWindow = window;
+      }
+    }
+    break;
+  case kEventWindowDeactivated:
+    if ( window==activeWindow ) 
+    {
+      fltk3::handle( fltk3::UNFOCUS, window);
+      activeWindow = 0;
+    }
+    break;
+  case kEventWindowClose:
+    fltk3::handle( fltk3::CLOSE, window ); // this might or might not close the window
+    // if there are no more windows, send a high-level quit event
+    if (!Fl_X::first) QuitAppleEventHandler( 0, 0, 0 );
+    ret = noErr; // returning noErr tells Carbon to stop following up on this event
+    break;
+  case kEventWindowCollapsed:
+    window->clear_visible();
+    break;
+  case kEventWindowExpanded:
+    window->set_visible();
+    break;
+  }
+
+  fl_unlock_function();
+
+  return ret;
+}
+
+
+/**
+ * Carbon Mousewheel handler
+ * This needs to be linked into all new window event handlers
+ */
+static pascal OSStatus carbonMousewheelHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  // Handle the new "MightyMouse" mouse wheel events. Please, someone explain
+  // to me why Apple changed the API on this even though the current API
+  // supports two wheels just fine. Matthias,
+  fl_lock_function();
+
+  fl_os_event = event;
+  fltk3::Window *window = (fltk3::Window*)userData;
+  if ( !window->shown() )
+  {
+    fl_unlock_function();
+    return noErr;
+  }
+  fltk3::first_window(window);
+
+  EventMouseWheelAxis axis;
+  GetEventParameter( event, kEventParamMouseWheelAxis, typeMouseWheelAxis, NULL, sizeof(EventMouseWheelAxis), NULL, &axis );
+  long delta;
+  GetEventParameter( event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(long), NULL, &delta );
+//  fprintf(stderr, "axis=%d, delta=%d\n", axis, delta);
+  if ( axis == kEventMouseWheelAxisX ) {
+    fltk3::e_dx = -delta;
+    fltk3::e_dy = 0;
+    if ( fltk3::e_dx) fltk3::handle( fltk3::MOUSEWHEEL, window );
+  } else if ( axis == kEventMouseWheelAxisY ) {
+    fltk3::e_dx = 0;
+    fltk3::e_dy = -delta;
+    if ( fltk3::e_dy) fltk3::handle( fltk3::MOUSEWHEEL, window );
+  } else {
+    fl_unlock_function();
+
+    return eventNotHandledErr;
+  }
+
+  fl_unlock_function();
+  
+  return noErr;
+}
+
+
+/**
+ * convert the current mouse chord into the FLTK modifier state
+ */
+static void chord_to_e_state( UInt32 chord )
+{
+  static ulong state[] = 
+  { 
+    0, fltk3::BUTTON1, fltk3::BUTTON3, fltk3::BUTTON1|fltk3::BUTTON3, fltk3::BUTTON2,
+    fltk3::BUTTON2|fltk3::BUTTON1, fltk3::BUTTON2|fltk3::BUTTON3, 
+    fltk3::BUTTON2|fltk3::BUTTON1|fltk3::BUTTON3
+  };
+  fltk3::e_state = ( fltk3::e_state & 0xff0000 ) | state[ chord & 0x07 ];
+}
+
+
+/**
+ * Carbon Mouse Button Handler
+ */
+static pascal OSStatus carbonMouseHandler( EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  static int keysym[] = { 0, fltk3::MouseButton+1, fltk3::MouseButton+3, fltk3::MouseButton+2 };
+  static int px, py;
+  static char suppressed = 0;
+
+  fl_lock_function();
+  
+  fl_os_event = event;
+  fltk3::Window *window = (fltk3::Window*)userData;
+  if ( !window->shown() )
+  {
+    fl_unlock_function();
+    return noErr;
+  }
+  fltk3::first_window(window);
+  Point pos;
+  GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, &pos );
+  EventMouseButton btn;
+  GetEventParameter( event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &btn );
+  UInt32 clickCount;
+  GetEventParameter( event, kEventParamClickCount, typeUInt32, NULL, sizeof(UInt32), NULL, &clickCount );
+  UInt32 chord;
+  GetEventParameter( event, kEventParamMouseChord, typeUInt32, NULL, sizeof(UInt32), NULL, &chord );
+  WindowRef xid = fl_xid(window), tempXid;
+  int sendEvent = 0, part = 0;
+  switch ( GetEventKind( event ) )
+  {
+  case kEventMouseDown:
+    part = FindWindow( pos, &tempXid );
+    if (!(fltk3::grab() && window!=fltk3::grab())) {
+      if ( part == inGrow ) {
+        fl_unlock_function();
+        suppressed = 1;
+        fltk3::Tooltip::current(0L);
+        return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
+      }
+      if ( part != inContent ) {
+        fl_unlock_function();
+        suppressed = 1;
+        fltk3::Tooltip::current(0L);
+        // anything else to here?
+        return CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
+      }
+    }
+    suppressed = 0;
+    if (part==inContent && !IsWindowActive( xid ) ) {
+      CallNextEventHandler( nextHandler, event ); // let the OS handle the activation, but continue to get a click-through effect
+    }
+    // normal handling of mouse-down follows
+    fl_os_capture = xid;
+    sendEvent = fltk3::PUSH;
+    fltk3::e_is_click = 1; px = pos.h; py = pos.v;
+    if (clickCount>1) 
+      fltk3::e_clicks++;
+    else
+      fltk3::e_clicks = 0;
+    // fall through
+  case kEventMouseUp:
+    if (suppressed) {
+      suppressed = 0;
+      break;
+    }
+    if ( !window ) break;
+    if ( !sendEvent ) {
+      sendEvent = fltk3::RELEASE; 
+    }
+    fltk3::e_keysym = keysym[ btn ];
+    // fall through
+  case kEventMouseMoved:
+    suppressed = 0;
+    if ( !sendEvent ) { 
+      sendEvent = fltk3::MOVE; chord = 0; 
+    }
+    // fall through
+  case kEventMouseDragged:
+    if (suppressed) break;
+    if ( !sendEvent ) {
+      sendEvent = fltk3::MOVE; // fltk3::handle will convert into fltk3::DRAG
+      if (abs(pos.h-px)>5 || abs(pos.v-py)>5) 
+        fltk3::e_is_click = 0;
+    }
+    chord_to_e_state( chord );
+    GrafPtr oldPort;
+    GetPort( &oldPort );
+    SetPort( GetWindowPort(xid) ); // \todo replace this! There must be some GlobalToLocal call that has a port as an argument
+    SetOrigin(0, 0);
+    fltk3::e_x_root = pos.h;
+    fltk3::e_y_root = pos.v;
+    GlobalToLocal( &pos );
+    fltk3::e_x = pos.h;
+    fltk3::e_y = pos.v;
+    SetPort( oldPort );
+    if (GetEventKind(event)==kEventMouseDown && part!=inContent) {
+      int used = fltk3::handle( sendEvent, window );
+      CallNextEventHandler( nextHandler, event ); // let the OS handle this for us
+      if (!used) 
+        suppressed = 1;
+    } else {
+      fltk3::handle( sendEvent, window );
+    }
+    break;
+  }
+
+  fl_unlock_function();
+  
+  return noErr;
+}
+
+
+/**
+ * convert the keyboard return code into the symbol on the keycaps
+ */
+static unsigned short keycode_to_sym( UInt32 keyCode, UInt32 mods, unsigned short deflt )
+{
+  static Ptr map = 0;
+  UInt32 state = 0;
+  if (!map) {
+    map = (Ptr)GetScriptManagerVariable(smKCHRCache);
+    if (!map) {
+      long kbID = GetScriptManagerVariable(smKeyScript);
+      map = *GetResource('KCHR', kbID);
+    }
+  }
+  if (map)
+    return KeyTranslate(map, keyCode|mods, &state );
+  return deflt;
+}
+
+/*
+ * keycode_function for post-10.5 systems, allows more sophisticated decoding of keys
+ */
+static int keycodeToUnicode(
+                char * uniChars, int maxChars,
+                EventKind eKind,
+                UInt32 keycode, UInt32 modifiers,
+                UInt32 * deadKeyStatePtr,
+                unsigned char,  // not used in this function
+                unsigned short) // not used in this function
+{
+  // first get the keyboard mapping in a post 10.2 way
+  
+  Ptr resource;
+  TextEncoding encoding;
+  static TextEncoding lastEncoding = kTextEncodingMacRoman;
+  int len = 0;
+  KeyboardLayoutRef currentLayout = NULL;
+  static KeyboardLayoutRef lastLayout = NULL;
+  SInt32 currentLayoutId = 0;
+  static SInt32 lastLayoutId;
+  int hasLayoutChanged = false;
+  static Ptr uchr = NULL;
+  static Ptr KCHR = NULL;
+  // ScriptCode currentKeyScript;
+  
+  KLGetCurrentKeyboardLayout(&currentLayout);
+  if (currentLayout) {
+    KLGetKeyboardLayoutProperty(currentLayout, kKLIdentifier, (const void**)&currentLayoutId);
+    if ( (lastLayout != currentLayout) || (lastLayoutId != currentLayoutId) ) {
+      lastLayout = currentLayout;
+      lastLayoutId = currentLayoutId;
+      uchr = NULL;
+      KCHR = NULL;
+      if ((KLGetKeyboardLayoutProperty(currentLayout, kKLuchrData, (const void**)&uchr) == noErr) && (uchr != NULL)) {
+        // done
+      } else if ((KLGetKeyboardLayoutProperty(currentLayout, kKLKCHRData, (const void**)&KCHR) == noErr) && (KCHR != NULL)) {
+        // done
+      }
+      // FIXME No Layout property found. Now we have a problem. 
+    }
+  }
+  if (hasLayoutChanged) {
+    //deadKeyStateUp = deadKeyStateDown = 0;
+    if (KCHR != NULL) {
+      // FIXME this must not happen
+    } else if (uchr == NULL) {
+      KCHR = (Ptr) GetScriptManagerVariable(smKCHRCache);
+    }
+  }
+  if (uchr != NULL) {
+    // this is what I expect
+    resource = uchr;
+  } else {
+    resource = KCHR;
+    encoding = lastEncoding;
+    // this is actually not supported by the following code and will likely crash
+  }
+  
+  // now apply that keyboard mapping to our keycode
+  
+  int action;
+  //OptionBits options = 0;
+  // not used yet: OptionBits options = kUCKeyTranslateNoDeadKeysMask;
+  unsigned long keyboardType;
+  keycode &= 0xFF;
+  modifiers = (modifiers >> 8) & 0xFF;
+  keyboardType = LMGetKbdType();
+  OSStatus status;
+  UniCharCount actuallength;
+  UniChar utext[10];
+  
+  switch(eKind) {     
+    case kEventRawKeyDown:    action = kUCKeyActionDown; break;
+    case kEventRawKeyUp:      action = kUCKeyActionUp; break;
+    case kEventRawKeyRepeat:  action = kUCKeyActionAutoKey; break;
+    default: return 0;
+  }
+
+  UInt32 deadKeyState = *deadKeyStatePtr;
+  if ((action==kUCKeyActionUp)&&(*deadKeyStatePtr))
+    deadKeyStatePtr = &deadKeyState;
+
+  status = UCKeyTranslate(
+                          (const UCKeyboardLayout *) uchr,
+                          keycode, action, modifiers, keyboardType,
+                          0, deadKeyStatePtr,
+                          10, &actuallength, utext);
+
+  if (noErr != status) {
+    fprintf(stderr,"UCKeyTranslate failed: %d\n", (int) status);
+    actuallength = 0;
+  }
+
+  // convert the list of unicode chars into utf8
+  // FIXME no bounds check (see maxchars)
+  unsigned i;
+  for (i=0; i<actuallength; ++i) {
+    len += fltk3::utf8encode(utext[i], uniChars+len);
+  }
+  uniChars[len] = 0;
+  return len;
+}
+
+/*
+ * keycode_function for pre-10.5 systems, this is the "historic" fltk Mac key handling
+ */
+static int keycode_wrap_old(
+                char * buffer,
+                int, EventKind, UInt32, // not used in this function
+                UInt32, UInt32 *,       // not used in this function
+                unsigned char key,
+                unsigned short sym)
+{
+  if ( (sym >= fltk3::KPKey && sym <= fltk3::KPLastKey) || !(sym & 0xff00) ||
+        sym == fltk3::TabKey || sym == fltk3::EnterKey) {
+    buffer[0] = key;
+    return 1;
+  } else {
+    buffer[0] = 0;
+    return 0;
+  }
+} /* keycode_wrap_old */
+/* 
+ * Stub pointer to select appropriate keycode_function per operating system version. This function pointer
+ * is initialised in fl_open_display, based on the runtime identification of the host OS version. This is
+ * intended to allow us to utilise 10.5 services dynamically to improve Unicode handling, whilst still 
+ * allowing code to run satisfactorily on older systems.
+ */
+static int (*keycode_function)(char*, int, EventKind, UInt32, UInt32, UInt32*, unsigned char, unsigned short) = keycode_wrap_old;
+
+
+// EXPERIMENTAL!
+pascal OSStatus carbonTextHandler( 
+  EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  fltk3::Window *window = (fltk3::Window*)userData;
+  fltk3::first_window(window);
+  fl_lock_function();
+  //int kind = GetEventKind(event);
+  unsigned short buf[200];
+  ByteCount size;
+  GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, 
+                     NULL, 100, &size, &buf );
+//  printf("TextEvent: %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]);
+  // FIXME: oversimplified!
+  unsigned ucs = buf[0];
+  char utf8buf[20];
+  int len = fltk3::utf8encode(ucs, utf8buf);
+  fltk3::e_length = len;
+  fltk3::e_text = utf8buf;
+  while (window->parent()) window = window->window();
+  fltk3::handle(fltk3::KEYBOARD, window);
+  fl_unlock_function();
+  fl_lock_function();
+  fltk3::handle(fltk3::KEYUP, window);
+  fl_unlock_function();
+  // for some reason, the window does not redraw until the next mouse move or button push
+  // sending a 'redraw()' or 'awake()' does not solve the issue!
+  fltk3::flush();
+  return noErr;
+}  
+
+/**
+ * handle carbon keyboard events
+ */
+pascal OSStatus carbonKeyboardHandler( 
+  EventHandlerCallRef nextHandler, EventRef event, void *userData )
+{
+  static char buffer[32];
+  int sendEvent = 0;
+  fltk3::Window *window = (fltk3::Window*)userData;
+  fltk3::first_window(window);
+  UInt32 mods;
+  static UInt32 prevMods = mods_to_e_state( GetCurrentKeyModifiers() );
+
+  fl_lock_function();
+  
+  int kind = GetEventKind(event);
+  
+  // get the modifiers for any of the events
+  GetEventParameter( event, kEventParamKeyModifiers, typeUInt32, 
+                     NULL, sizeof(UInt32), NULL, &mods );
+  
+  // get the key code only for key events
+  UInt32 keyCode = 0, maskedKeyCode = 0;
+  unsigned char key = 0;
+  unsigned short sym = 0;
+  if (kind!=kEventRawKeyModifiersChanged) {
+    GetEventParameter( event, kEventParamKeyCode, typeUInt32, 
+                       NULL, sizeof(UInt32), NULL, &keyCode );
+    GetEventParameter( event, kEventParamKeyMacCharCodes, typeChar, 
+                       NULL, sizeof(char), NULL, &key );
+  }
+  // extended keyboards can also send sequences on key-up to generate Kanji etc. codes.
+  // Some observed prefixes are 0x81 to 0x83, followed by an 8 bit keycode.
+  // In this mode, there seem to be no key-down codes
+// printf("%08x %08x %08x\n", keyCode, mods, key);
+  maskedKeyCode = keyCode & 0x7f;
+  /* output a human readable event identifier for debugging 
+  const char *ev = "";
+  switch (kind) {
+    case kEventRawKeyDown: ev = "kEventRawKeyDown"; break;
+    case kEventRawKeyRepeat: ev = "kEventRawKeyRepeat"; break;
+    case kEventRawKeyUp: ev = "kEventRawKeyUp"; break;
+    case kEventRawKeyModifiersChanged: ev = "kEventRawKeyModifiersChanged"; break;
+    default: ev = "unknown";
+  }
+  printf("%08x %08x %08x '%c' %s \n", mods, keyCode, key, key, ev);
+  */
+  switch (kind)
+  {
+  case kEventRawKeyDown:
+  case kEventRawKeyRepeat:
+/*
+    // FIXME Matt: For 10.5, the keycode_function will handle all this. This is untested for ealier versions of OS X.
+    // When the user presses a "dead key", no information is send about
+    // which dead key symbol was created. So we need to trick Carbon into
+    // giving us the code by sending a "space" after the "dead key".
+    if (key==0) {
+      UInt32 ktState = 0;
+      KeyboardLayoutRef klr;
+      KLGetCurrentKeyboardLayout(&klr);
+      const void *kchar = 0; KLGetKeyboardLayoutProperty(klr, kKLKCHRData, &kchar);
+      KeyTranslate(kchar, (mods&0xff00) | keyCode, &ktState); // send the dead key
+      key = KeyTranslate(kchar, 0x31, &ktState); // fake a space key press
+      fltk3::e_state |= 0x40000000; // mark this as a dead key
+    } else {
+      fltk3::e_state &= 0xbfffffff; // clear the deadkey flag
+    }
+*/
+    sendEvent = fltk3::KEYBOARD;
+    // fall through
+  case kEventRawKeyUp:
+    if ( !sendEvent ) {
+      sendEvent = fltk3::KEYUP;
+      fltk3::e_state &= 0xbfffffff; // clear the deadkey flag
+    }
+    // if the user pressed alt/option, event_key should have the keycap, 
+    // but event_text should generate the international symbol
+    sym = macKeyLookUp[maskedKeyCode];
+    if ( isalpha(key) )
+      sym = tolower(key);
+    else if ( fltk3::e_state&fltk3::CTRL && key<32 && sym<0xff00)
+      sym = key+96;
+    else if ( fltk3::e_state&fltk3::ALT && sym<0xff00) // find the keycap of this key
+      sym = keycode_to_sym( maskedKeyCode, 0, macKeyLookUp[ maskedKeyCode ] );
+    fltk3::e_keysym = fltk3::e_original_keysym = sym;
+    // Handle fltk3::KPEnterKey on regular keyboards and on Powerbooks
+    if ( maskedKeyCode==0x4c || maskedKeyCode==0x34) key=0x0d;    
+    // Handle the Delete key on the keypad
+    // Matt: the Mac has no concept of a NumLock key, or at least not visible
+    // Matt: to Carbon. The kEventKeyModifierNumLockMask is only set when
+    // Matt: a numeric keypad key is pressed and does not correspond with
+    // Matt: the NumLock light in PowerBook keyboards.
+
+    // Matt: attempt to get the correct Unicode character(s) from our keycode
+    // imm:  keycode_function function pointer added to allow us to use different functions
+    // imm:  depending on which OS version we are running on (tested and set in fl_open_display)
+    static UInt32 deadKeyState = 0; // must be cleared when losing focus
+    fltk3::e_length = (*keycode_function)(buffer, 31, kind, keyCode, mods, &deadKeyState, key, sym);
+    fltk3::e_text = buffer;
+    buffer[fltk3::e_length] = 0; // just in case...
+    break;
+  case kEventRawKeyModifiersChanged: {
+    UInt32 tMods = prevMods ^ mods;
+    if ( tMods )
+    {
+      mods_to_e_keysym( tMods );
+      if ( fltk3::e_keysym ) 
+        sendEvent = ( prevMods<mods ) ? fltk3::KEYBOARD : fltk3::KEYUP;
+      fltk3::e_length = 0;
+      buffer[0] = 0;
+      prevMods = mods;
+    }
+    mods_to_e_state( mods );
+    break; }
+  }
+  while (window->parent()) window = window->window();
+  if (sendEvent && fltk3::handle(sendEvent,window)) {
+    fl_unlock_function();  
+    return noErr; // return noErr if FLTK handled the event
+  } else {
+    fl_unlock_function();
+    //return CallNextEventHandler( nextHandler, event );;
+    // Matt: I had better results (no duplicate events) always returning
+    // Matt: 'noErr'. System keyboard events still seem to work just fine.
+    return noErr;
+  }
+}
+
+
+
+/**
+ * Open callback function to call...
+ */
+
+static void	(*open_cb)(const char *) = 0;
+
+
+/**
+ * Event handler for Apple-O key combination and also for file opens
+ * via the finder...
+ */
+
+static OSErr OpenAppleEventHandler(const AppleEvent *appleEvt,
+                                   AppleEvent *reply,
+				   UInt32 refcon) {
+  OSErr err;
+  AEDescList documents;
+  long i, n;
+  FSSpec fileSpec;
+  AEKeyword keyWd;
+  DescType typeCd;
+  Size actSz;
+  char filename[1024];
+
+  if (!open_cb) return noErr;
+
+  // Initialize the document list...
+  AECreateDesc(typeNull, NULL, 0, &documents);
+ 
+  // Get the open parameter(s)...
+  err = AEGetParamDesc(appleEvt, keyDirectObject, typeAEList, &documents);
+  if (err != noErr) {
+    AEDisposeDesc(&documents);
+    return err;
+  }
+
+  // Lock access to FLTK in this thread...
+  fl_lock_function();
+
+  // Open the documents via the callback...
+  if (AECountItems(&documents, &n) == noErr) {
+    for (i = 1; i <= n; i ++) {
+      // Get the next FSSpec record...
+      AEGetNthPtr(&documents, i, typeFSS, &keyWd, &typeCd,
+                  (Ptr)&fileSpec, sizeof(fileSpec),
+		  (actSz = sizeof(fileSpec), &actSz));
+
+      // Convert to a UNIX path...
+      FSSpec2UnixPath(&fileSpec, filename);
+
+      // Call the callback with the filename...
+      (*open_cb)(filename);
+    }
+  }
+
+  // Unlock access to FLTK for all threads...
+  fl_unlock_function();
+
+  // Get rid of the document list...
+  AEDisposeDesc(&documents);
+
+  return noErr;
+}
+
+
+/**
+ * Install an open documents event handler...
+ */
+
+void fl_open_callback(void (*cb)(const char *)) {
+  open_cb = cb;
+  if (cb) {
+    AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
+                          NewAEEventHandlerUPP((AEEventHandlerProcPtr)
+			      OpenAppleEventHandler), 0, false);
+  } else {
+    AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments,
+                          NewAEEventHandlerUPP((AEEventHandlerProcPtr)
+			      OpenAppleEventHandler), false);
+  }
+}
+
+
+/**
+ * initialize the Mac toolboxes, dock status, and set the default menubar
+ */
+
+extern "C" {
+  extern OSErr CPSEnableForegroundOperation(ProcessSerialNumber *psn, UInt32 _arg2,
+    UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
+}
+
+void fl_open_display() {
+  static char beenHereDoneThat = 0;
+  if ( !beenHereDoneThat )  {
+    beenHereDoneThat = 1;
+    
+    FlushEvents(everyEvent,0);
+    
+    MoreMasters(); // \todo Carbon suggests MoreMasterPointers()
+    AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false );
+    
+    // create the Mac Handle for the default cursor (a pointer to a pointer)
+    GetQDGlobalsArrow(&default_cursor);
+    default_cursor_ptr = &default_cursor;
+    fl_default_cursor  = &default_cursor_ptr;
+    
+    ClearMenuBar();
+    AppendResMenu( GetMenuHandle( 1 ), 'DRVR' );
+    DrawMenuBar();
+    
+    // bring the application into foreground without a 'CARB' resource
+    Boolean same_psn;
+    ProcessSerialNumber cur_psn, front_psn;
+    if( !GetCurrentProcess( &cur_psn ) && !GetFrontProcess( &front_psn ) &&
+       !SameProcess( &front_psn, &cur_psn, &same_psn ) && !same_psn )
+    {
+      // only transform the application type for unbundled apps
+      CFBundleRef bundle = CFBundleGetMainBundle();
+      if( bundle )
+      {
+      	FSRef execFs;
+      	CFURLRef execUrl = CFBundleCopyExecutableURL( bundle );
+      	CFURLGetFSRef( execUrl, &execFs );
+        
+      	FSRef bundleFs;
+      	GetProcessBundleLocation( &cur_psn, &bundleFs );
+        
+      	if( !FSCompareFSRefs( &execFs, &bundleFs ) )
+          bundle = NULL;
+        
+        CFRelease(execUrl);
+      }
+      
+      if( !bundle )
+      {
+        // Earlier versions of this code tried to use weak linking, however it
+        // appears that this does not work on 10.2.  Since 10.3 and higher provide
+        // both TransformProcessType and CPSEnableForegroundOperation, the following
+        // conditional code compiled on 10.2 will still work on newer releases...
+        OSErr err;
+        
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+        if (TransformProcessType != NULL) {
+          err = TransformProcessType(&cur_psn, kProcessTransformToForegroundApplication);
+        } else
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+          err = CPSEnableForegroundOperation(&cur_psn, 0x03, 0x3C, 0x2C, 0x1103);
+        
+        if (err == noErr) {
+          SetFrontProcess( &cur_psn );
+        }
+      }
+    }
+    
+    // imm: keycode handler stub setting - use Gestalt to determine the running system version,
+    // then set the keycode_function pointer accordingly
+    keycode_function = keycode_wrap_old; // default to pre-10.5 mechanism
+    SInt32 MacVersion;
+    if (Gestalt(gestaltSystemVersion, &MacVersion) == noErr)
+    {
+      if(MacVersion >= 0x1050) { // 10.5.0 or later
+        keycode_function = keycodeToUnicode;
+      }
+    }
+  }
+}
+
+
+/**
+ * get rid of allocated resources
+ */
+void fl_close_display()  {
+}
+
+
+/**
+ * smallest x ccordinate in screen space
+ */
+int fltk3::x() {
+  BitMap r;
+  GetQDGlobalsScreenBits(&r);
+  return r.bounds.left;
+}
+
+
+/**
+ * smallest y ccordinate in screen space
+ */
+int fltk3::y() {
+  BitMap r;
+  GetQDGlobalsScreenBits(&r);
+  return r.bounds.top + 20; // \todo 20 pixel menu bar?
+}
+
+
+/**
+ * screen width (single monitor!?)
+ */
+int fltk3::w() {
+  BitMap r;
+  GetQDGlobalsScreenBits(&r);
+  return r.bounds.right - r.bounds.left;
+}
+
+
+/**
+ * screen height (single monitor!?)
+ */
+int fltk3::h() {
+  BitMap r;
+  GetQDGlobalsScreenBits(&r);
+  return r.bounds.bottom - r.bounds.top - 20;
+}
+
+
+/**
+ * get the current mouse pointer world coordinates
+ */
+void fltk3::get_mouse(int &x, int &y) 
+{
+  fl_open_display();
+  Point loc; 
+  GetMouse( &loc );
+  LocalToGlobal( &loc );
+  x = loc.h;
+  y = loc.v;
+}
+
+
+/**
+ * convert Mac keystrokes to FLTK
+ */
+unsigned short mac2fltk(ulong macKey) 
+{
+  unsigned short cc = macKeyLookUp[(macKey>>8)&0x7f];
+  if (cc) return cc;
+  return macKey&0xff;
+}
+
+
+/**
+ * Initialize the given port for redraw and call the windw's flush() to actually draw the content
+ */ 
+void Fl_X::flush()
+{
+  w->flush();
+  if (fl_gc) 
+    CGContextFlush(fl_gc);
+  SetOrigin( 0, 0 );
+}
+
+
+/**
+ * Handle all clipping and redraw for the given port
+ * There are two different callers for this event:
+ * 1: the OS can request a redraw and provides all clipping itself
+ * 2: fltk3::flush() wants all redraws now
+ */    
+void handleUpdateEvent( WindowPtr xid ) 
+{
+  fltk3::Window *window = fl_find( xid );
+  if ( !window ) return;
+  GrafPtr oldPort;
+  GetPort( &oldPort );
+  SetPort( GetWindowPort(xid) );
+  Fl_X *i = Fl_X::i( window );
+  i->wait_for_expose = 0;
+  if ( window->damage() ) {
+    if ( i->region ) {
+      InvalWindowRgn( xid, i->region );
+    }
+  }
+  if ( i->region ) { // no region, so the sytem will take the update region from the OS
+    DisposeRgn( i->region );
+    i->region = 0;
+  }
+  for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext )
+  {
+    cx->w->clear_damage(window->damage()|fltk3::DAMAGE_EXPOSE);
+    cx->flush();
+    cx->w->clear_damage();
+  }
+  window->clear_damage(window->damage()|fltk3::DAMAGE_EXPOSE);
+  i->flush();
+  window->clear_damage();
+  SetPort( oldPort );
+}     
+
+// Gets the border sizes and the titlebar size
+static void get_window_frame_sizes(int &bx, int &by, int &bt) {
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+	static HIRect contentRect = { {50,50}, {100,100} }; // a rect to stand in for the content rect of a real window
+	static HIThemeWindowDrawInfo metrics= {0, 
+		kThemeStateActive, kThemeDocumentWindow,
+		kThemeWindowHasFullZoom + kThemeWindowHasCloseBox + 
+		kThemeWindowHasCollapseBox + kThemeWindowHasTitleText, 
+		0, 0};
+	HIShapeRef shape1=0, shape2=0, shape3=0;
+	HIRect rect1, rect2, rect3;
+	OSStatus	status;
+	status  = HIThemeGetWindowShape(&contentRect, &metrics, kWindowStructureRgn, &shape1);
+	status |= HIThemeGetWindowShape(&contentRect, &metrics, kWindowContentRgn, &shape2);
+	status |= HIThemeGetWindowShape(&contentRect, &metrics, kWindowTitleBarRgn, &shape3);
+    
+	if (!status) 
+	{
+		HIShapeGetBounds(shape1, &rect1);
+		HIShapeGetBounds(shape2, &rect2);
+		HIShapeGetBounds(shape3, &rect3);
+		bt = rect3.size.height;
+		bx = rect2.origin.x  - rect1.origin.x;
+		by = rect2.origin.y  - rect1.origin.y - bt;
+		// fprintf(stderr, "HIThemeGetWindowShape succeeded bx=%d by=%d bt=%d\n", bx, by, bt);
+	}		
+	else 
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+	{
+		// sets default dimensions
+		bx = by = 6;
+		bt = 22;
+		// fprintf(stderr, "HIThemeGetWindowShape failed, bx=%d by=%d bt=%d\n", bx, by, bt);
+	}
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+	CFRelease(shape1); // we must free HIThemeGetWindowShape() (copied) handles 
+	CFRelease(shape2);
+	CFRelease(shape3);
+#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+}
+
+/**
+ * \todo this is a leftover from OS9 times. Please check how much applies to Carbon!
+ */
+int Fl_X::fake_X_wm(const fltk3::Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
+  int W, H, xoff, yoff, dx, dy;
+  int ret = bx = by = bt = 0;
+  if (w->border() && !w->parent()) {
+    if (w->maxw != w->minw || w->maxh != w->minh) {
+      ret = 2;
+      get_window_frame_sizes(bx, by, bt);
+      /*
+        bx = 6; // \todo Mac : GetSystemMetrics(SM_CXSIZEFRAME);
+        by = 6; // \todo Mac : get Mac window frame size GetSystemMetrics(SM_CYSIZEFRAME);
+      */
+    } else {
+      ret = 1;
+      get_window_frame_sizes(bx, by, bt);
+      /*
+        bx = 6; // \todo Mac : GetSystemMetrics(SM_CXFIXEDFRAME);
+        by = 6; // \todo Mac : GetSystemMetrics(SM_CYFIXEDFRAME);
+      */
+    }
+  }
+  //The coordinates of the whole window, including non-client area
+  xoff = bx;
+  yoff = by + bt;
+  dx = 2*bx;
+  dy = 2*by + bt;
+  X = w->x()-xoff;
+  Y = w->y()-yoff;
+  W = w->w()+dx;
+  H = w->h()+dy;
+
+  //Proceed to positioning the window fully inside the screen, if possible
+
+  // let's get a little elaborate here. Mac OS X puts a lot of stuff on the desk
+  // that we want to avoid when positioning our window, namely the Dock and the
+  // top menu bar (and even more stuff in 10.4 Tiger). So we will go through the
+  // list of all available screens and find the one that this window is most
+  // likely to go to, and then reposition it to fit withing the 'good' area.
+  Rect r;
+  // find the screen, that the center of this window will fall into
+  int R = X+W, B = Y+H; // right and bottom
+  int cx = (X+R)/2, cy = (Y+B)/2; // center of window;
+  GDHandle gd = 0L;
+  for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
+  GDPtr gp = *gd;
+  if (    cx >= gp->gdRect.left && cx <= gp->gdRect.right
+       && cy >= gp->gdRect.top  && cy <= gp->gdRect.bottom)
+    break;
+  }
+  // if the center doesn't fall on a screen, try the top left
+  if (!gd) {
+    for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
+      GDPtr gp = *gd;
+      if (    X >= gp->gdRect.left && X <= gp->gdRect.right
+           && Y >= gp->gdRect.top  && Y <= gp->gdRect.bottom)
+        break;
+    }
+  }
+  // if that doesn't fall on a screen, try the top right
+  if (!gd) {
+    for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
+      GDPtr gp = *gd;
+      if (    R >= gp->gdRect.left && R <= gp->gdRect.right
+           && Y >= gp->gdRect.top  && Y <= gp->gdRect.bottom)
+        break;
+    }
+  }
+  // if that doesn't fall on a screen, try the bottom left
+  if (!gd) {
+    for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
+      GDPtr gp = *gd;
+      if (    X >= gp->gdRect.left && X <= gp->gdRect.right
+           && B >= gp->gdRect.top  && B <= gp->gdRect.bottom)
+        break;
+    }
+  }
+  // last resort, try the bottom right
+  if (!gd) {
+    for (gd = GetDeviceList(); gd; gd = GetNextDevice(gd)) {
+      GDPtr gp = *gd;
+      if (    R >= gp->gdRect.left && R <= gp->gdRect.right
+           && B >= gp->gdRect.top  && B <= gp->gdRect.bottom)
+        break;
+    }
+  }
+  // if we still have not found a screen, we will use the main
+  // screen, the one that has the application menu bar.
+  if (!gd) gd = GetMainDevice();
+  if (gd) {
+    GetAvailableWindowPositioningBounds(gd, &r);
+    if ( R > r.right )  X -= R - r.right;
+    if ( B > r.bottom ) Y -= B - r.bottom;
+    if ( X < r.left )   X = r.left;
+    if ( Y < r.top )    Y = r.top;
+  }
+
+  //Return the client area's top left corner in (X,Y)
+  X+=xoff;
+  Y+=yoff;
+
+  return ret;
+}
+
+/**
+ * convert a Mac FSSpec structure into a Unix filename 
+ */
+static int FSSpec2UnixPath( FSSpec *fs, char *dst )
+{
+  FSRef fsRef;
+  FSpMakeFSRef( fs, &fsRef );
+  FSRefMakePath( &fsRef, (UInt8*)dst, 1024 );
+  return strlen(dst);
+}
+static void convert_crlf(char * s, size_t len)
+{
+  // turn all \r characters into \n:
+  for (size_t x = 0; x < len; x++) if (s[x] == '\r') s[x] = '\n';
+}
+
+
+static DragReference currDragRef = 0;
+static char *currDragData = 0L;
+static int currDragSize = 0; 
+static OSErr currDragErr = noErr;
+fltk3::Window *fl_dnd_target_window = 0;
+#include <fltk3/draw.h>
+
+/**
+ * Fill the currDrag* variables with the current DnD ASCII text.
+ */
+static OSErr fillCurrentDragData(DragReference dragRef)
+{
+  OSErr ret = noErr;
+  char *dst = 0L;
+  
+  // shortcut through this whole procedure if this is still the same drag event
+  if (dragRef==currDragRef)
+    return currDragErr;
+  
+  // clear currDrag* for a new drag event
+  currDragRef = dragRef;
+  if (currDragData) free(currDragData);
+  currDragData = 0;
+  currDragSize = 0;
+  
+  // fill currDRag* with ASCII data, if available
+  UInt16 i, nItem;
+  ItemReference itemRef;
+  FlavorFlags flags;
+  Size itemSize, size = 0;
+  CountDragItems( dragRef, &nItem );
+
+  for ( i = 1; i <= nItem; i++ )
+  {
+    GetDragItemReferenceNumber( dragRef, i, &itemRef );
+    ret = GetFlavorFlags( dragRef, itemRef, 'utf8', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'utf8', &itemSize );
+      size += itemSize;
+      continue;
+    }
+    ret = GetFlavorFlags( dragRef, itemRef, 'utxt', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'utxt', &itemSize );
+      size += itemSize;
+      continue;
+    }
+    ret = GetFlavorFlags( dragRef, itemRef, 'TEXT', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'TEXT', &itemSize );
+      size += itemSize;
+      continue;
+    }
+    ret = GetFlavorFlags( dragRef, itemRef, 'hfs ', &flags );
+    if ( ret == noErr )
+    {
+      size += 1024; //++ ouch! We should create the full pathname and figure out its length
+      continue;
+    }
+  }
+
+  if ( !size )
+  {
+    currDragErr = userCanceledErr;
+    return currDragErr;
+  }
+
+  currDragSize = size + nItem - 1;
+  currDragData = dst = (char*)malloc( size+nItem );;
+
+  for ( i = 1; i <= nItem; i++ )
+  {
+    GetDragItemReferenceNumber( dragRef, i, &itemRef );
+    ret = GetFlavorFlags( dragRef, itemRef, 'utf8', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'utf8', &itemSize );
+      GetFlavorData( dragRef, itemRef, 'utf8', dst, &itemSize, 0L );
+      dst += itemSize;
+      *dst++ = '\n'; // add our element separator
+      continue;
+    }
+    GetDragItemReferenceNumber( dragRef, i, &itemRef );
+    ret = GetFlavorFlags( dragRef, itemRef, 'utxt', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'utxt', &itemSize );
+      GetFlavorData( dragRef, itemRef, 'utxt', dst, &itemSize, 0L );
+      dst += itemSize;
+      *dst++ = '\n'; // add our element separator
+      continue;
+    }
+    ret = GetFlavorFlags( dragRef, itemRef, 'TEXT', &flags );
+    if ( ret == noErr )
+    {
+      GetFlavorDataSize( dragRef, itemRef, 'TEXT', &itemSize );
+      GetFlavorData( dragRef, itemRef, 'TEXT', dst, &itemSize, 0L );
+      dst += itemSize;
+      *dst++ = '\n'; // add our element separator
+      continue;
+    }
+    ret = GetFlavorFlags( dragRef, itemRef, 'hfs ', &flags );
+    if ( ret == noErr )
+    {
+      HFSFlavor hfs; itemSize = sizeof( hfs );
+      GetFlavorData( dragRef, itemRef, 'hfs ', &hfs, &itemSize, 0L );
+      itemSize = FSSpec2UnixPath( &hfs.fileSpec, dst ); // return the path name in UTF8
+      dst += itemSize;
+      if ( itemSize>1 && ( hfs.fileType=='fold' || hfs.fileType=='disk' ) ) 
+        *dst++ = '/';
+      *dst++ = '\n'; // add our element separator
+      continue;
+    }
+  }
+
+  dst[-1] = 0;
+  currDragSize = dst - currDragData - 1;
+  currDragErr = ret;
+  return ret;
+}
+
+/**
+ * Drag'n'drop tracking handler
+ */
+static pascal OSErr dndTrackingHandler( DragTrackingMessage msg, WindowPtr w, void *userData, DragReference dragRef )
+{
+  fltk3::Window *target = (fltk3::Window*)userData;
+  fltk3::first_window(target);
+  Point mp;
+  static int px, py;
+  
+  fillCurrentDragData(dragRef);
+  fltk3::e_length = currDragSize;
+  fltk3::e_text = currDragData;
+  
+  switch ( msg )
+  {
+  case kDragTrackingEnterWindow:
+    // check if 'TEXT' is available
+    GetDragMouse( dragRef, &mp, 0 );
+    fltk3::e_x_root = px = mp.h;
+    fltk3::e_y_root = py = mp.v;
+    fltk3::e_x = px - target->x();
+    fltk3::e_y = py - target->y();
+    fl_dnd_target_window = target;
+    if ( fltk3::handle( fltk3::DND_ENTER, target ) )
+      fltk3::cursor( fltk3::CURSOR_HAND ); //ShowDragHilite( ); // modify the mouse cursor?!
+    else
+      fltk3::cursor( fltk3::CURSOR_DEFAULT ); //HideDragHilite( dragRef );
+    breakMacEventLoop();
+    return noErr;
+  case kDragTrackingInWindow:
+    GetDragMouse( dragRef, &mp, 0 );
+    if ( mp.h==px && mp.v==py )
+      break;	//+ return previous condition for dnd hiliting
+    fltk3::e_x_root = px = mp.h;
+    fltk3::e_y_root = py = mp.v;
+    fltk3::e_x = px - target->x();
+    fltk3::e_y = py - target->y();
+    fl_dnd_target_window = target;
+    if ( fltk3::handle( fltk3::DND_DRAG, target ) )
+      fltk3::cursor( fltk3::CURSOR_HAND ); //ShowDragHilite( ); // modify the mouse cursor?!
+    else
+      fltk3::cursor( fltk3::CURSOR_DEFAULT ); //HideDragHilite( dragRef );
+    breakMacEventLoop();
+    return noErr;
+    break;
+  case kDragTrackingLeaveWindow:
+    // HideDragHilite()
+    fltk3::cursor( fltk3::CURSOR_DEFAULT ); //HideDragHilite( dragRef );
+    if ( fl_dnd_target_window )
+    {
+      fltk3::handle( fltk3::DND_LEAVE, fl_dnd_target_window );
+      fl_dnd_target_window = 0;
+    }
+    breakMacEventLoop();
+    return noErr;
+  }
+  return noErr;
+}
+
+
+/**
+ * Drag'n'drop receive handler
+ */
+static pascal OSErr dndReceiveHandler( WindowPtr w, void *userData, DragReference dragRef )
+{
+  Point mp;
+  OSErr ret;
+  
+  fltk3::Window *target = fl_dnd_target_window = (fltk3::Window*)userData;
+  fltk3::first_window(target);
+  GetDragMouse( dragRef, &mp, 0 );
+  fltk3::e_x_root = mp.h;
+  fltk3::e_y_root = mp.v;
+  fltk3::e_x = fltk3::e_x_root - target->x();
+  fltk3::e_y = fltk3::e_y_root - target->y();
+  if ( !fltk3::handle( fltk3::DND_RELEASE, target ) )
+    return userCanceledErr;
+
+  ret = fillCurrentDragData(dragRef);
+  if (ret==userCanceledErr)
+    return userCanceledErr;
+  
+  fltk3::e_length = currDragSize;
+  fltk3::e_text = currDragData;
+//  printf("Sending following text to widget %p:\n%s\n", fltk3::belowmouse(), fltk3::e_text);
+  int old_event = fltk3::e_number;
+  fltk3::belowmouse()->handle(fltk3::e_number = fltk3::PASTE);
+  fltk3::e_number = old_event;
+  
+  if (currDragData) {
+    free(currDragData);
+  }
+  currDragData = 0L;
+  currDragRef = 0;
+  fltk3::e_text = 0L;
+  fltk3::e_length = 0;
+  fl_dnd_target_window = 0L;
+  
+  breakMacEventLoop();
+  return noErr;
+}
+// fc:  
+static void  q_set_window_title(Window xid, const char * name ) {
+#if 1
+    CFStringRef utf8_title = CFStringCreateWithCString(NULL, (name ? name : ""), kCFStringEncodingUTF8);
+    SetWindowTitleWithCFString(xid, utf8_title);
+    CFRelease(utf8_title);
+#else // old non-utf8 code to remove after new utf8 code approval :
+    Str255 pTitle;
+    if (name) {
+      if (strlen(name) > 255) pTitle[0] = 255;
+      else pTitle[0] = strlen(name);
+      memcpy(pTitle+1, name, pTitle[0]);
+    } 
+    else 
+      pTitle[0] = 0;
+    SetWTitle(xid, pTitle);
+#endif
+}
+
+/**
+ * go ahead, create that (sub)window
+ * \todo we should make menu windows slightly transparent for the new Mac look
+ */
+void Fl_X::make(fltk3::Window* w)
+{
+  static int xyPos = 100;
+  if ( w->parent() ) // create a subwindow
+  {
+    fltk3::Group::current(0);
+    Rect wRect;
+    wRect.top    = w->y();
+    wRect.left   = w->x();
+    wRect.bottom = w->y() + w->h(); if (wRect.bottom<=wRect.top) wRect.bottom = wRect.top+1;
+    wRect.right  = w->x() + w->w(); if (wRect.right<=wRect.left) wRect.right = wRect.left+1;
+    // our subwindow needs this structure to know about its clipping. 
+    Fl_X* x = new Fl_X;
+    x->other_xid = 0;
+    x->region = 0;
+    x->subRegion = 0;
+    x->cursor = fl_default_cursor;
+    x->gc = 0; // stay 0 for Quickdraw; fill with CGContext for Quartz
+    fltk3::Window *win = w->window();
+    Fl_X *xo = Fl_X::i(win);
+    if (xo) {
+      x->xidNext = xo->xidChildren;
+      x->xidChildren = 0L;
+      xo->xidChildren = x;
+      x->xid = fl_xid(win);
+      x->w = w; w->i = x;
+      x->wait_for_expose = 0;
+      x->next = Fl_X::first; // must be in the list for ::flush()
+      Fl_X::first = x;
+      int old_event = fltk3::e_number;
+      w->handle(fltk3::e_number = fltk3::SHOW);
+      fltk3::e_number = old_event;
+      w->redraw(); // force draw to happen
+    }
+    fl_show_iconic = 0;
+  }
+  else // create a desktop window
+  {
+    fltk3::Group::current(0);
+    fl_open_display();
+    int winclass = kDocumentWindowClass;
+    int winattr = kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute;
+    int xp = w->x();
+    int yp = w->y();
+    int wp = w->w();
+    int hp = w->h();
+    if (w->size_range_set) {
+      if ( w->minh != w->maxh || w->minw != w->maxw)
+        winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute;
+    } else {
+      if (w->resizable()) {
+        fltk3::Widget *o = w->resizable();
+        int minw = o->w(); if (minw > 100) minw = 100;
+        int minh = o->h(); if (minh > 100) minh = 100;
+        w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+        winattr |= kWindowFullZoomAttribute | kWindowResizableAttribute | kWindowLiveResizeAttribute;
+      } else {
+        w->size_range(w->w(), w->h(), w->w(), w->h());
+      }
+    }
+    int xwm = xp, ywm = yp, bt, bx, by;
+
+    if (!fake_X_wm(w, xwm, ywm, bt, bx, by)) {
+      // menu windows and tooltips
+      if (w->modal()||w->override()) {
+        winclass = kHelpWindowClass;
+        winattr  = 0;
+      } else {
+        winattr = 512; // kWindowNoTitleBarAttribute;
+      }
+    } else if (w->modal()) {
+      winclass = kMovableModalWindowClass;
+    }
+
+    if (by+bt) {
+      wp += 2*bx;
+      hp += 2*by+bt;
+    }
+    if (!(w->flags() & fltk3::Widget::FORCE_POSITION)) {
+      // use the Carbon functions below for default window positioning
+      w->x(xyPos+fltk3::x());
+      w->y(xyPos+fltk3::y());
+      xyPos += 25;
+      if (xyPos>200) xyPos = 100;
+    } else {
+      if (!fltk3::grab()) {
+        xp = xwm; yp = ywm;
+        w->x(xp);w->y(yp);
+      }
+      xp -= bx;
+      yp -= by+bt;
+    }
+
+    if (w->non_modal() && Fl_X::first && !fl_disable_transient_for) {
+      // find some other window to be "transient for":
+      fltk3::Window* w = Fl_X::first->w;
+      while (w->parent()) w = w->window(); // todo: this code does not make any sense! (w!=w??)
+    }
+
+    Rect wRect;
+    wRect.top    = w->y();
+    wRect.left   = w->x();
+    wRect.bottom = w->y() + w->h(); if (wRect.bottom<=wRect.top) wRect.bottom = wRect.top+1;
+    wRect.right  = w->x() + w->w(); if (wRect.right<=wRect.left) wRect.right = wRect.left+1;
+
+    const char *name = w->label();
+
+    Fl_X* x = new Fl_X;
+    x->other_xid = 0; // room for doublebuffering image map. On OS X this is only used by overlay windows
+    x->region = 0;
+    x->subRegion = 0;
+    x->cursor = fl_default_cursor;
+    x->xidChildren = 0;
+    x->xidNext = 0;
+    x->gc = 0;
+
+    winattr &= GetAvailableWindowAttributes( winclass );	// make sure that the window will open
+    CreateNewWindow( winclass, winattr, &wRect, &(x->xid) );
+    q_set_window_title(x->xid, name);
+    MoveWindow(x->xid, wRect.left, wRect.top, 1);	// avoid Carbon Bug on old OS
+    if (w->non_modal() && !w->modal()) {
+      // Major kludge: this is to have the regular look, but stay above the document windows
+      SetWindowClass(x->xid, kFloatingWindowClass);
+      SetWindowActivationScope(x->xid, kWindowActivationScopeAll);
+    }
+    if (!(w->flags() & fltk3::Widget::FORCE_POSITION))
+    {
+      WindowRef pw = Fl_X::first ? Fl_X::first->xid : 0 ;
+      if (w->modal()) {
+        RepositionWindow(x->xid, pw, kWindowAlertPositionOnParentWindowScreen);
+      } else if (w->non_modal()) {
+        RepositionWindow(x->xid, pw, kWindowCenterOnParentWindowScreen);
+      } else {
+        RepositionWindow(x->xid, pw, kWindowCascadeOnParentWindowScreen);
+      }
+    }
+    x->w = w; w->i = x;
+    x->wait_for_expose = 1;
+    x->next = Fl_X::first;
+    Fl_X::first = x;
+    { // Install Carbon Event handlers 
+      OSStatus ret;
+      EventHandlerUPP mousewheelHandler = NewEventHandlerUPP( carbonMousewheelHandler ); // will not be disposed by Carbon...
+      static EventTypeSpec mousewheelEvents[] = {
+        { kEventClassMouse, kEventMouseWheelMoved } };
+      ret = InstallWindowEventHandler( x->xid, mousewheelHandler,
+	        (int)(sizeof(mousewheelEvents)/sizeof(mousewheelEvents[0])),
+		mousewheelEvents, w, 0L );
+      EventHandlerUPP mouseHandler = NewEventHandlerUPP( carbonMouseHandler ); // will not be disposed by Carbon...
+      static EventTypeSpec mouseEvents[] = {
+        { kEventClassMouse, kEventMouseDown },
+        { kEventClassMouse, kEventMouseUp },
+        { kEventClassMouse, kEventMouseMoved },
+        { kEventClassMouse, kEventMouseDragged } };
+      ret = InstallWindowEventHandler( x->xid, mouseHandler, 4, mouseEvents, w, 0L );
+
+      EventHandlerUPP keyboardHandler = NewEventHandlerUPP( carbonKeyboardHandler ); // will not be disposed by Carbon...
+      static EventTypeSpec keyboardEvents[] = {
+        { kEventClassKeyboard, kEventRawKeyDown },
+        { kEventClassKeyboard, kEventRawKeyRepeat },
+        { kEventClassKeyboard, kEventRawKeyUp },
+        { kEventClassKeyboard, kEventRawKeyModifiersChanged } };
+      ret = InstallWindowEventHandler( x->xid, keyboardHandler, 4, keyboardEvents, w, 0L );
+
+      EventHandlerUPP textHandler = NewEventHandlerUPP( carbonTextHandler ); // will not be disposed by Carbon...
+      static EventTypeSpec textEvents[] = {
+        { kEventClassTextInput, kEventTextInputUnicodeForKeyEvent } };
+      ret = InstallWindowEventHandler( x->xid, textHandler, 1, textEvents, w, 0L );
+
+      EventHandlerUPP windowHandler = NewEventHandlerUPP( carbonWindowHandler ); // will not be disposed by Carbon...
+      static EventTypeSpec windowEvents[] = {
+        { kEventClassWindow, kEventWindowDrawContent },
+        { kEventClassWindow, kEventWindowShown },
+        { kEventClassWindow, kEventWindowHidden },
+        { kEventClassWindow, kEventWindowActivated },
+        { kEventClassWindow, kEventWindowDeactivated },
+        { kEventClassWindow, kEventWindowClose },
+        { kEventClassWindow, kEventWindowCollapsed },
+        { kEventClassWindow, kEventWindowExpanded },
+        { kEventClassWindow, kEventWindowBoundsChanging },
+        { kEventClassWindow, kEventWindowBoundsChanged } };
+      ret = InstallWindowEventHandler( x->xid, windowHandler, 10, windowEvents, w, 0L );
+      ret = InstallTrackingHandler( dndTrackingHandler, x->xid, w );
+      ret = InstallReceiveHandler( dndReceiveHandler, x->xid, w );
+    }
+
+    if ( ! Fl_X::first->next ) // if this is the first window, we need to bring the application to the front
+    { 
+      ProcessSerialNumber psn;
+      OSErr err = GetCurrentProcess( &psn );
+      if ( err==noErr ) SetFrontProcess( &psn );
+    }
+    
+    if (w->size_range_set) w->size_range_();
+    
+    if (winclass != kHelpWindowClass) {
+      fltk3::Tooltip::enter(0);
+    }
+    if (w->size_range_set) w->size_range_();
+    ShowWindow(x->xid);
+    if (fl_show_iconic) { 
+      fl_show_iconic = 0;
+      CollapseWindow( x->xid, true ); // \todo Mac ; untested
+    } else {
+      w->set_visible();
+    }
+
+    Rect rect;
+    GetWindowBounds(x->xid, kWindowContentRgn, &rect);
+    w->x(rect.left); w->y(rect.top);
+    w->w(rect.right-rect.left); w->h(rect.bottom-rect.top);
+
+    int old_event = fltk3::e_number;
+    w->handle(fltk3::e_number = fltk3::SHOW);
+    fltk3::e_number = old_event;
+    w->redraw(); // force draw to happen
+    
+    if (w->modal()) { fltk3::modal_ = w; fl_fix_focus(); }
+  }
+}
+
+
+/**
+ * Tell the OS what window sizes we want to allow
+ */
+void fltk3::Window::size_range_() {
+  size_range_set = 1;
+  HISize minSize = { minw, minh };
+  HISize maxSize = { maxw?maxw:32000, maxh?maxh:32000 };
+  if (i && i->xid)
+    SetWindowResizeLimits(i->xid, &minSize, &maxSize);
+}
+
+
+/**
+ * returns pointer to the filename, or null if name ends with ':'
+ */
+const char *fltk3::filename_name( const char *name ) 
+{
+  const char *p, *q;
+  if (!name) return (0);
+  for ( p = q = name ; *p ; ) 
+  {
+    if ( ( p[0] == ':' ) && ( p[1] == ':' ) ) 
+    {
+      q = p+2;
+      p++;
+    }
+    else if (p[0] == '/')
+      q = p + 1;
+    p++;
+  }
+  return q;
+}
+
+
+/**
+ * set the window title bar
+ * \todo make the titlebar icon work!
+ */
+void fltk3::Window::label(const char *name,const char */*iname*/) {
+  fltk3::Widget::label(name);
+
+  if (shown() || i) {
+    q_set_window_title(fl_xid(this), name);
+  }
+}
+
+
+/**
+ * make a window visible
+ */
+void fltk3::Window::show() {
+  image(fltk3::scheme_bg_);
+  if (fltk3::scheme_bg_) {
+    labeltype(fltk3::NORMAL_LABEL);
+    align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+  } else {
+    labeltype(fltk3::NO_LABEL);
+  }
+  fltk3::Tooltip::exit(this);
+  if (!shown() || !i) {
+    Fl_X::make(this);
+  } else {
+      if ( !parent() )
+      {
+        if ( IsWindowCollapsed( i->xid ) ) CollapseWindow( i->xid, false );
+        if (!fl_capture) {
+          BringToFront(i->xid);
+          SelectWindow(i->xid);
+        }
+      }
+  }
+}
+
+
+/**
+ * resize a window
+ */
+void fltk3::Window::resize(int X,int Y,int W,int H) {
+  if (W<=0) W = 1; // OS X does not like zero width windows
+  if (H<=0) H = 1;
+  int is_a_resize = (W != w() || H != h());
+//  printf("Fl_Winodw::resize(X=%d, Y=%d, W=%d, H=%d), is_a_resize=%d, resize_from_system=%p, this=%p\n",
+//         X, Y, W, H, is_a_resize, resize_from_system, this);
+  if (X != x() || Y != y()) set_flag(FORCE_POSITION);
+  else if (!is_a_resize) return;
+  if ( (resize_from_system!=this) && (!parent()) && shown()) {
+    if (is_a_resize) {
+      if (resizable()) {
+        if (W<minw) minw = W; // user request for resize takes priority
+        if (W>maxw) maxw = W; // over a previously set size_range
+        if (H<minh) minh = H;
+        if (H>maxh) maxh = H;
+        size_range(minw, minh, maxw, maxh);
+      } else {
+        size_range(W, H, W, H);
+      }
+      Rect dim; dim.left=X; dim.top=Y; dim.right=X+W; dim.bottom=Y+H;
+      SetWindowBounds(i->xid, kWindowContentRgn, &dim);
+      Rect all; all.top=-32000; all.bottom=32000; all.left=-32000; all.right=32000;
+      InvalWindowRect( i->xid, &all );    
+    } else {
+      MoveWindow(i->xid, X, Y, 0);
+    }
+  }
+  resize_from_system = 0;
+  if (is_a_resize) {
+    fltk3::Group::resize(X,Y,W,H);
+    if (shown()) { 
+      redraw(); 
+    }
+  } else {
+    x(X); y(Y); 
+  }
+}
+
+
+/**
+ * make all drawing go into this window (called by subclass flush() impl.)
+ */
+void fltk3::Window::make_current() 
+{
+  OSStatus err;
+  Fl_X::q_release_context();
+  if ( !fl_window_region )
+    fl_window_region = NewRgn();
+  fl_window = i->xid;
+  current_ = this;
+
+  SetPort( GetWindowPort(i->xid) ); // \todo check for the handling of doublebuffered windows
+
+  int xp = 0, yp = 0;
+  fltk3::Window *win = this;
+  while ( win ) 
+  {
+    if ( !win->window() )
+      break;
+    xp += win->x();
+    yp += win->y();
+    win = (fltk3::Window*)win->window();
+  }
+  SetOrigin( -xp, -yp );
+  
+  SetRectRgn( fl_window_region, 0, 0, w(), h() );
+  
+  // \todo for performance reasons: we don't have to create this unless the child windows moved
+  for ( Fl_X *cx = i->xidChildren; cx; cx = cx->xidNext )
+  {
+    fltk3::Window *cw = cx->w;
+    if (!cw->visible_r()) continue;
+    fltk3::Region r = NewRgn();
+    SetRectRgn( r, cw->x() - xp, cw->y() - yp, 
+                   cw->x() + cw->w() - xp, cw->y() + cw->h() - yp );
+    DiffRgn( fl_window_region, r, fl_window_region );
+    DisposeRgn( r );
+  }
+ 
+  err = QDBeginCGContext(GetWindowPort(i->xid), &i->gc);
+  if (err!=noErr) 
+    fprintf(stderr, "Error %d in QDBeginCGContext\n", (int)err);
+  fl_gc = i->gc;
+  CGContextSaveGState(fl_gc);
+  Fl_X::q_fill_context();
+#if defined(USE_CAIRO)
+   if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
+#endif
+
+  fltk3::clip_region( 0 );
+  SetPortClipRegion( GetWindowPort(i->xid), fl_window_region );
+
+#if defined(USE_CAIRO)
+  // update the cairo_t context
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this);
+#endif
+}
+
+// helper function to manage the current CGContext fl_gc
+extern fltk3::Color fl_color_;
+extern class Fl_Font_Descriptor *fltk3::fontsize;
+extern void fltk3::font(class Fl_Font_Descriptor*);
+extern void fl_quartz_restore_line_style_();
+
+// FLTK has only one global graphics state. This function copies the FLTK state into the
+// current Quartz context
+void Fl_X::q_fill_context() {
+  if (!fl_gc) return;
+  int hgt = 0;
+  if (fl_window) {
+    Rect portRect; 
+    GetPortBounds(GetWindowPort( fl_window ), &portRect);
+    hgt = portRect.bottom-portRect.top;
+  } else {
+    hgt = CGBitmapContextGetHeight(fl_gc);
+  }
+  CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f);
+  CGContextScaleCTM(fl_gc, 1.0f, -1.0f);
+  fltk3::font(fltk3::fontsize);
+  fltk3::color(fl_color_);
+  fl_quartz_restore_line_style_();
+}
+
+// The only way to reset clipping to its original state is to pop the current graphics
+// state and restore the global state.
+void Fl_X::q_clear_clipping() {
+  if (!fl_gc) return;
+  CGContextRestoreGState(fl_gc);
+  CGContextSaveGState(fl_gc);
+}
+
+// Give the Quartz context back to the system
+void Fl_X::q_release_context(Fl_X *x) {
+  if (x && x->gc!=fl_gc) return;
+  if (!fl_gc) return;
+  CGContextRestoreGState(fl_gc);
+  if (fl_window) {
+    OSStatus err = QDEndCGContext(GetWindowPort(fl_window), &fl_gc);
+    if (err!=noErr)
+      fprintf(stderr, "Error %d in QDEndCGContext\n", (int)err);
+  }
+  fl_gc = 0;
+#if defined(USE_CAIRO)
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current((fltk3::Window*) 0); // capture gc changes automatically to update the cairo context adequately
+#endif
+}
+
+void Fl_X::q_begin_image(CGRect &rect, int cx, int cy, int w, int h) {
+  CGContextSaveGState(fl_gc);
+  CGAffineTransform mx = CGContextGetCTM(fl_gc);
+  CGRect r2 = rect;
+  r2.origin.x -= 0.5f;
+  r2.origin.y -= 0.5f;
+  CGContextClipToRect(fl_gc, r2);
+  mx.d = -1.0; mx.tx = -mx.tx;
+  CGContextConcatCTM(fl_gc, mx);
+  rect.origin.x = -(mx.tx+0.5f) + rect.origin.x     - cx;
+  rect.origin.y =  (mx.ty+0.5f) - rect.origin.y - h + cy;
+  rect.size.width = w;
+  rect.size.height = h;
+}
+
+void Fl_X::q_end_image() {
+  CGContextRestoreGState(fl_gc);
+}
+
+////////////////////////////////////////////////////////////////
+// Copy & Paste fltk implementation.
+////////////////////////////////////////////////////////////////
+
+// fltk 1.3 clipboard support constant definitions:
+const CFStringRef	flavorNames[] = {
+  CFSTR("public.utf16-plain-text"), 
+  CFSTR("public.utf8-plain-text"),
+  CFSTR("com.apple.traditional-mac-plain-text") };
+const CFStringEncoding encodings[] = { 
+  kCFStringEncodingUTF16, 
+  kCFStringEncodingUTF8, 
+  kCFStringEncodingMacRoman};
+const size_t handledFlavorsCount = sizeof(encodings)/sizeof(CFStringEncoding);
+
+// clipboard variables definitions :
+fltk3::Widget *fl_selection_requestor = 0;
+char *fl_selection_buffer[2];
+int fl_selection_length[2];
+static int fl_selection_buffer_length[2];
+
+#ifdef USE_PASTEBOARD
+static PasteboardRef myPasteboard = 0;
+static void allocatePasteboard() {
+  if (!myPasteboard)
+    PasteboardCreate(kPasteboardClipboard, &myPasteboard);
+}
+#else
+#endif
+
+#ifndef USE_PASTEBOARD
+static ScrapRef myScrap = 0;
+#endif
+
+/**
+ * create a selection
+ * owner: widget that created the selection
+ * stuff: pointer to selected data
+ * size of selected data
+ */
+void fltk3::copy(const char *stuff, int len, int clipboard) {
+  if (!stuff || len<0) return;
+  if (len+1 > fl_selection_buffer_length[clipboard]) {
+    delete[] fl_selection_buffer[clipboard];
+    fl_selection_buffer[clipboard] = new char[len+100];
+    fl_selection_buffer_length[clipboard] = len+100;
+  }
+  memcpy(fl_selection_buffer[clipboard], stuff, len);
+  fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
+  fl_selection_length[clipboard] = len;
+  if (clipboard) {
+#ifdef USE_PASTEBOARD
+    // FIXME no error checking done yet!
+    allocatePasteboard();
+    OSStatus err = PasteboardClear(myPasteboard);
+    if (err!=noErr) return; // clear did not work, maybe not owner of clipboard.
+    PasteboardSynchronize(myPasteboard);
+    CFDataRef text = CFDataCreate(kCFAllocatorDefault, (UInt8*)fl_selection_buffer[1], len);
+    if (text==NULL) return; // there was a pb creating the object, abort.
+    err=PasteboardPutItemFlavor(myPasteboard, (PasteboardItemID)1, CFSTR("public.utf8-plain-text"), text, 0);
+    CFRelease(text);
+#else
+    OSStatus err = ClearCurrentScrap(); // whatever happens we should clear the current scrap.
+    if(err!=noErr) {myScrap=0; return;} // don't get current scrap if a prev err occured. 
+    err = GetCurrentScrap( &myScrap );
+    if ( err != noErr ) {
+      myScrap = 0;
+      return;
+    }
+    // Previous version changed \n to \r before sending the text, but I would
+    // prefer to leave the local buffer alone, so a copied buffer may be
+    // needed. Check to see if this is necessary on OS/X.
+    PutScrapFlavor( myScrap, kScrapFlavorTypeText, 0,
+		    len, fl_selection_buffer[1] );
+#endif
+  }
+}
+
+// Call this when a "paste" operation happens:
+void fltk3::paste(fltk3::Widget &receiver, int clipboard) {
+    if (clipboard) {
+	// see if we own the selection, if not go get it:
+	fl_selection_length[1] = 0;
+#ifdef USE_PASTEBOARD
+	OSStatus err = noErr;
+	Boolean found = false;
+	CFDataRef flavorData = NULL;
+	CFStringEncoding encoding = 0;
+
+	allocatePasteboard();
+	PasteboardSynchronize(myPasteboard);
+	ItemCount nFlavor = 0, i, j;
+	err = PasteboardGetItemCount(myPasteboard, &nFlavor);
+	if (err==noErr) {
+	    for (i=1; i<=nFlavor; i++) {
+		PasteboardItemID itemID = 0;
+		CFArrayRef flavorTypeArray = NULL;
+		found = false;
+		err = PasteboardGetItemIdentifier(myPasteboard, i, &itemID);
+		if (err!=noErr) continue;
+		err = PasteboardCopyItemFlavors(myPasteboard, itemID, &flavorTypeArray);
+		if (err!=noErr) {
+		  if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;}
+		  continue;
+		}
+		CFIndex flavorCount = CFArrayGetCount(flavorTypeArray);
+		for (j = 0; j < handledFlavorsCount; j++) {
+		    for (CFIndex flavorIndex=0; flavorIndex<flavorCount; flavorIndex++) {
+			CFStringRef flavorType = (CFStringRef)CFArrayGetValueAtIndex(flavorTypeArray, flavorIndex);
+			if (UTTypeConformsTo(flavorType, flavorNames[j])) {
+			    err = PasteboardCopyItemFlavorData( myPasteboard, itemID, flavorNames[j], &flavorData );
+			    if(err != noErr) continue;
+			    encoding = encodings[j];
+			    found = true;
+			    break;
+			}
+		    }
+		    if(found) break;
+		}
+		if (flavorTypeArray) {CFRelease(flavorTypeArray); flavorTypeArray = NULL;}
+		if (found) break;
+	    }
+	    if(found) {
+		CFIndex len = CFDataGetLength(flavorData);
+		CFStringRef mycfs = CFStringCreateWithBytes(NULL, CFDataGetBytePtr(flavorData), len, encoding, false);
+		CFRelease(flavorData);
+		len = CFStringGetMaximumSizeForEncoding(CFStringGetLength(mycfs), kCFStringEncodingUTF8) + 1;
+		if ( len >= fl_selection_buffer_length[1] ) {
+		    fl_selection_buffer_length[1] = len;
+		    delete[] fl_selection_buffer[1];
+		    fl_selection_buffer[1] = new char[len];
+		}
+		CFStringGetCString(mycfs, fl_selection_buffer[1], len, kCFStringEncodingUTF8);
+		CFRelease(mycfs);
+		len = strlen(fl_selection_buffer[1]);
+		fl_selection_length[1] = len;
+		convert_crlf(fl_selection_buffer[1],len); // turn all \r characters into \n:
+	    }
+	}
+#else
+	ScrapRef scrap = 0;
+	if (GetCurrentScrap(&scrap) == noErr && scrap != myScrap &&
+	    GetScrapFlavorSize(scrap, kScrapFlavorTypeText, &len) == noErr) {
+	    if ( len >= fl_selection_buffer_length[1] ) {
+		fl_selection_buffer_length[1] = len + 32;
+		delete[] fl_selection_buffer[1];
+		fl_selection_buffer[1] = new char[len + 32];
+	    }
+	    fl_selection_length[1] = len; len++;
+	    GetScrapFlavorData( scrap, kScrapFlavorTypeText, &len,
+			       fl_selection_buffer[1] );
+	    fl_selection_buffer[1][fl_selection_length[1]] = 0;
+	    convert_crlf(fl_selection_buffer[1],len); 
+	}
+#endif
+    }
+    fltk3::e_text = fl_selection_buffer[clipboard];
+    fltk3::e_length = fl_selection_length[clipboard];
+    if (!fltk3::e_text) fltk3::e_text = (char *)"";
+    receiver.handle(fltk3::PASTE);
+}
+
+void fltk3::add_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+   // check, if this timer slot exists already
+   for (int i = 0;  i < mac_timer_used;  ++i) {
+        MacTimeout& t = mac_timers[i];
+        // if so, simply change the fire interval
+        if (t.callback == cb  &&  t.data == data) {
+            SetEventLoopTimerNextFireTime(t.timer, (EventTimerInterval)time);
+            t.pending = 1;
+            return;
+        }
+    }
+    // no existing timer to use. Create a new one:
+    int timer_id = -1;
+    // find an empty slot in the timer array
+    for (int i = 0;  i < mac_timer_used;  ++i) {
+        if ( !mac_timers[i].timer ) {
+            timer_id = i;
+            break;
+        }
+    }
+    // if there was no empty slot, append a new timer
+    if (timer_id == -1) {
+        // make space if needed
+        if (mac_timer_used == mac_timer_alloc) {
+            realloc_timers();
+        }
+        timer_id = mac_timer_used++;
+    }
+    // now install a brand new timer
+    MacTimeout& t = mac_timers[timer_id];
+    EventTimerInterval fireDelay = (EventTimerInterval)time;
+    EventLoopTimerUPP  timerUPP = NewEventLoopTimerUPP(do_timer);
+    EventLoopTimerRef  timerRef = 0;
+    OSStatus err = InstallEventLoopTimer(GetMainEventLoop(), fireDelay, 0, timerUPP, data, &timerRef);
+    if (err == noErr) {
+        t.callback = cb;
+        t.data     = data;
+        t.timer    = timerRef;
+        t.upp      = timerUPP;
+        t.pending  = 1;
+    } else {
+        if (timerRef) 
+            RemoveEventLoopTimer(timerRef);
+        if (timerUPP)
+            DisposeEventLoopTimerUPP(timerUPP);
+    }
+}
+
+void fltk3::repeat_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+    // currently, repeat_timeout does not subtract the trigger time of the previous timer event as it should.
+    add_timeout(time, cb, data);
+}
+
+int fltk3::has_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+   for (int i = 0;  i < mac_timer_used;  ++i) {
+        MacTimeout& t = mac_timers[i];
+        if (t.callback == cb  &&  t.data == data && t.pending) {
+            return 1;
+        }
+    }
+    return 0;
+}
+
+void fltk3::remove_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+   for (int i = 0;  i < mac_timer_used;  ++i) {
+        MacTimeout& t = mac_timers[i];
+        if (t.callback == cb  && ( t.data == data || data == NULL)) {
+            delete_timer(t);
+        }
+    }
+}
+
+int MacUnlinkWindow(Fl_X *ip, Fl_X *start) {
+  if (!ip) return 0;
+  if (start) {
+    Fl_X *pc = start;
+    while (pc) {
+      if (pc->xidNext == ip) {
+        pc->xidNext = ip->xidNext;
+        return 1;
+      }
+      if (pc->xidChildren) {
+        if (pc->xidChildren == ip) {
+          pc->xidChildren = ip->xidNext;
+          return 1;
+        }
+        if (MacUnlinkWindow(ip, pc->xidChildren))
+          return 1;
+      }
+      pc = pc->xidNext;
+    }
+  } else {
+    for ( Fl_X *pc = Fl_X::first; pc; pc = pc->next ) {
+      if (MacUnlinkWindow(ip, pc))
+        return 1;
+    }
+  }  
+  return 0;
+}
+
+static void MacRelinkWindow(Fl_X *x, Fl_X *p) {
+  if (!x || !p) return;
+  // first, check if 'x' is already registered as a child of 'p'
+  for (Fl_X *i = p->xidChildren; i; i=i->xidNext) {
+    if (i == x) return;
+  }
+  // now add 'x' as the first child of 'p'
+  x->xidNext = p->xidChildren;
+  p->xidChildren = x;
+}
+
+void MacDestroyWindow(fltk3::Window *w, WindowPtr p) {
+  MacUnmapWindow(w, p);
+  if (w && !w->parent() && p)
+    DisposeWindow(p);
+}
+
+void MacMapWindow(fltk3::Window *w, WindowPtr p) {
+  if (w && p)
+    ShowWindow(p);
+  //+ link to window list
+  if (w && w->parent()) {
+    MacRelinkWindow(Fl_X::i(w), Fl_X::i(w->window()));
+    w->redraw();
+  }
+}
+
+void MacUnmapWindow(fltk3::Window *w, WindowPtr p) {
+  if (w && !w->parent() && p) 
+    HideWindow(p);
+  if (w && Fl_X::i(w)) 
+    MacUnlinkWindow(Fl_X::i(w));
+}
+#endif // FLTK3_DOXYGEN
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_read_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_read_image_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_read_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_read_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,82 @@
+//
+// "$Id$"
+//
+// WIN32 image reading routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+
+//
+// 'fltk3::read_image()' - Read an image from the current window or off-screen buffer.
+//
+
+uchar *				// O - Pixel buffer or NULL if failed
+fltk3::read_image(uchar *p,		// I - Pixel buffer or NULL to allocate
+              int   x,		// I - Left position
+	      int   y,		// I - Top position
+	      int   w,		// I - Width of area to read
+	      int   h,		// I - Height of area to read
+	      int   alpha) {	// I - Alpha value for image (0 for none)
+  uchar *base;
+  int rowBytes, delta;
+  if(fl_window == NULL) { // reading from an offscreen buffer
+    CGContextRef src = (CGContextRef)fl_gc;   // get bitmap context
+    base = (uchar *)CGBitmapContextGetData(src);  // get data
+    if(!base) return NULL;
+    int sw = CGBitmapContextGetWidth(src);
+    int sh = CGBitmapContextGetHeight(src);
+    rowBytes = CGBitmapContextGetBytesPerRow(src);
+    delta = CGBitmapContextGetBitsPerPixel(src)/8;
+    if( (sw - x < w) || (sh - y < h) )  return NULL;
+    }
+  else { // reading from current window
+    fltk3::Window *window = fltk3::Window::current();
+    while(window->window()) window = window->window();
+    base = Fl_X::bitmap_from_window_rect(window,x,y,w,h,&delta);
+    rowBytes = delta*w;
+    x = y = 0;
+    }
+  // Allocate the image data array as needed...
+  int d = alpha ? 4 : 3;
+  if (!p) p = new uchar[w * h * d];
+  // Initialize the default colors/alpha in the whole image...
+  memset(p, alpha, w * h * d);
+  // Copy the image from the off-screen buffer to the memory buffer.
+  int           idx, idy;	// Current X & Y in image
+  uchar *pdst, *psrc;
+  for (idy = y, pdst = p; idy < h + y; idy ++) {
+    for (idx = 0, psrc = base + idy * rowBytes + x * delta; idx < w; idx ++, psrc += delta, pdst += d) {
+      pdst[0] = psrc[0];  // R
+      pdst[1] = psrc[1];  // G
+      pdst[2] = psrc[2];  // B
+    }
+  }
+  if(fl_window != NULL) delete[] base;
+  return p;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/cocoa_set_fonts.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_fonts_mac.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cocoa_set_fonts.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cocoa_set_fonts.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,164 @@
+//
+// "$Id$"
+//
+// MacOS font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+
+// #inclde <SFNTTypes.h>
+
+// This function fills in the fltk font table with all the fonts that
+// are found on the X server.  It tries to place the fonts into families
+// and to sort them so the first 4 in a family are normal, bold, italic,
+// and bold italic.
+
+// Bug: older versions calculated the value for *ap as a side effect of
+// making the name, and then forgot about it. To avoid having to change
+// the header files I decided to store this value in the last character
+// of the font name array.
+#define ENDOFBUFFER 127 // sizeof(fltk3::Font.fontname)-1
+
+// turn a stored font name into a pretty name:
+const char* fltk3::get_font_name(fltk3::Font fnum, int* ap) {
+  Fl_Fontdesc *f = fltk3::fonts + fnum;
+  if (!f->fontname[0]) {
+    const char* p = f->name;
+    if (!p || !*p) {if (ap) *ap = 0; return "";}
+    strlcpy(f->fontname, p, ENDOFBUFFER);
+    int type = 0;
+    if (strstr(f->name, "Bold")) type |= fltk3::BOLD;
+    if (strstr(f->name, "Italic")) type |= fltk3::ITALIC;
+    f->fontname[ENDOFBUFFER] = (char)type;
+  }
+  if (ap) *ap = f->fontname[ENDOFBUFFER];
+  return f->fontname;
+}
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+static int name_compare(const void *a, const void *b)
+{
+  return strcmp(*(char**)a, *(char**)b);
+}
+#endif
+
+static int fl_free_font = fltk3::FREE_FONT;
+
+fltk3::Font fltk3::set_fonts(const char* xstarname) {
+#pragma unused ( xstarname )
+if (fl_free_font > fltk3::FREE_FONT) return (fltk3::Font)fl_free_font; // if already called
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+if(fl_mac_os_version >= 100500) {
+//if(CTFontCreateWithFontDescriptor != NULL) {// CTFontCreateWithFontDescriptor != NULL on 10.4 also!
+  int value[1] = {1};
+  CFDictionaryRef dict = CFDictionaryCreate(NULL, 
+					    (const void **)kCTFontCollectionRemoveDuplicatesOption, 
+					    (const void **)&value, 1, NULL, NULL);
+  CTFontCollectionRef fcref = CTFontCollectionCreateFromAvailableFonts(dict);
+  CFRelease(dict);
+  CFArrayRef arrayref = CTFontCollectionCreateMatchingFontDescriptors(fcref);
+  CFRelease(fcref);
+  CFIndex count = CFArrayGetCount(arrayref);
+  CFIndex i;
+  char **tabfontnames = new char*[count];
+  for (i = 0; i < count; i++) {
+	CTFontDescriptorRef fdesc = (CTFontDescriptorRef)CFArrayGetValueAtIndex(arrayref, i);
+	CTFontRef font = CTFontCreateWithFontDescriptor(fdesc, 0., NULL);
+	CFStringRef cfname = CTFontCopyFullName(font);
+	CFRelease(font);
+	static char fname[100];
+	CFStringGetCString(cfname, fname, sizeof(fname), kCFStringEncodingUTF8);
+	tabfontnames[i] = strdup(fname); // never free'ed
+	CFRelease(cfname);
+	}
+  CFRelease(arrayref);
+  qsort(tabfontnames, count, sizeof(char*), name_compare);
+  for (i = 0; i < count; i++) {
+    fltk3::set_font((fltk3::Font)(fl_free_font++), tabfontnames[i]);
+    }
+  delete[] tabfontnames;
+  return (fltk3::Font)fl_free_font;
+}
+else {
+#endif
+#if ! __LP64__
+  ItemCount oFontCount, oCountAgain;
+  ATSUFontID *oFontIDs;
+  // How many fonts?
+  ATSUFontCount (&oFontCount);
+  // now allocate space for them...
+  oFontIDs = (ATSUFontID *)malloc((oFontCount+1) * sizeof(ATSUFontID));
+  ATSUGetFontIDs (oFontIDs, oFontCount, &oCountAgain);
+  // Now oFontIDs should contain a list of all the available Unicode fonts
+  // Iterate through the list to get each font name
+  for (ItemCount idx = 0; idx < oFontCount; idx++)
+  {
+//  ByteCount actualLength = 0;
+//	Ptr oName;
+    // How to get the name - Apples docs say call this twice, once to get the length, then again 
+	// to get the actual name...
+//    ATSUFindFontName (oFontIDs[idx], kFontFullName, kFontMacintoshPlatform, kFontRomanScript, kFontEnglishLanguage,
+//                      0, NULL, &actualLength, NULL);
+    // Now actualLength tells us the length of buffer we need
+//	oName = (Ptr)malloc(actualLength + 8);
+// But who's got time for that nonsense? Let's just hard code a fixed buffer (urgh!)
+    ByteCount actualLength = 511;
+	char oName[512];
+    ATSUFindFontName (oFontIDs[idx], kFontFullName, kFontMacintoshPlatform, kFontRomanScript, kFontEnglishLanguage,
+                      actualLength, oName, &actualLength, &oCountAgain);
+    // bounds check and terminate the returned name
+    if(actualLength > 511)
+      oName[511] = 0;
+    else
+      oName[actualLength] = 0;
+	fltk3::set_font((fltk3::Font)(fl_free_font++), strdup(oName));
+//	free(oName);
+  }
+  free(oFontIDs);
+  return (fltk3::Font)fl_free_font;
+#endif //__LP64__
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  }
+#endif
+  return 0;
+}
+
+static int array[128];
+int fltk3::get_font_sizes(fltk3::Font fnum, int*& sizep) {
+  Fl_Fontdesc *s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // empty slot in table, use entry 0
+  int cnt = 0;
+
+  // ATS supports all font size 
+  array[0] = 0;
+  sizep = array;
+  cnt = 1;
+
+  return cnt;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/color.cxx (from rev 9002, branches/branch-3.0/src/core/fl_color.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/color.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/color.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,471 @@
+//
+// "$Id$"
+//
+// Color functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_color.cxx
+  \brief Color handling
+*/
+
+// Implementation of fltk3::color(i), fltk3::color(r,g,b).
+
+#ifdef WIN32
+#  include "win32_color.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_color.cxx"
+#else
+
+// Also code to look at the X visual and figure out the best way to turn
+// a color into a pixel value.
+
+// SGI compiler seems to have problems with unsigned char arguments
+// being used to index arrays.  So I always copy them to an integer
+// before use.
+
+#  include "xcolor.h"
+#  include <fltk3/run.h>
+#  include <fltk3/x.h>
+#  include <fltk3/draw.h>
+
+////////////////////////////////////////////////////////////////
+// figure_out_visual() calculates masks & shifts for generating
+// pixels in true-color visuals:
+
+uchar fl_redmask;	/**< color mask used in current color map handling */
+uchar fl_greenmask;	/**< color mask used in current color map handling */
+uchar fl_bluemask;	/**< color mask used in current color map handling */
+
+int fl_redshift;	/**< color shift used in current color map handling */
+int fl_greenshift;	/**< color shift used in current color map handling */
+int fl_blueshift;	/**< color shift used in current color map handling */
+int fl_extrashift;	/**< color shift used in current color map handling */
+
+static uchar beenhere;
+
+static void figure_out_visual() {
+  beenhere = 1;
+  if (!fl_visual->red_mask || !fl_visual->green_mask || !fl_visual->blue_mask){
+#  if USE_COLORMAP
+    fl_redmask = 0;
+    return;
+#  else
+    fltk3::fatal("Requires true color visual");
+#  endif
+  }
+
+  // get the bit masks into a more useful form:
+  int i,j,m;
+
+  for (i = 0, m = 1; m; i++, m<<=1) if (fl_visual->red_mask & m) break;
+  for (j = i; m; j++, m<<=1) if (!(fl_visual->red_mask & m)) break;
+  fl_redshift = j-8;
+  fl_redmask = (j-i >= 8) ? 0xFF : 0xFF-(255>>(j-i));
+
+  for (i = 0, m = 1; m; i++, m<<=1) if (fl_visual->green_mask & m) break;
+  for (j = i; m; j++, m<<=1) if (!(fl_visual->green_mask & m)) break;
+  fl_greenshift = j-8;
+  fl_greenmask = (j-i >= 8) ? 0xFF : 0xFF-(255>>(j-i));
+
+  for (i = 0, m = 1; m; i++, m<<=1) if (fl_visual->blue_mask & m) break;
+  for (j = i; m; j++, m<<=1) if (!(fl_visual->blue_mask & m)) break;
+  fl_blueshift = j-8;
+  fl_bluemask = (j-i >= 8) ? 0xFF : 0xFF-(255>>(j-i));
+
+  i = fl_redshift;
+  if (fl_greenshift < i) i = fl_greenshift;
+  if (fl_blueshift < i) i = fl_blueshift;
+  if (i < 0) {
+    fl_extrashift = -i;
+    fl_redshift -= i; fl_greenshift -= i; fl_blueshift -= i;
+  } else
+    fl_extrashift = 0;
+
+}
+
+static unsigned fl_cmap[256] = {
+#include "fl_cmap.h" // this is a file produced by "cmap.cxx":
+};
+
+#  if HAVE_OVERLAY
+/** HAVE_OVERLAY determines whether fl_xmap is one or two planes */
+Fl_XColor fl_xmap[2][256];
+/** HAVE_OVERLAY determines whether fl_overlay is variable or defined as 0 */
+uchar fl_overlay;
+Colormap fl_overlay_colormap;
+XVisualInfo* fl_overlay_visual;
+ulong fl_transparent_pixel;
+#  else
+/** HAVE_OVERLAY determines whether fl_xmap is one or two planes */
+Fl_XColor fl_xmap[1][256];
+/** HAVE_OVERLAY determines whether fl_overlay is variable or defined as 0 */
+#    define fl_overlay 0
+#  endif
+
+void fltk3::XlibGraphicsDriver::color(fltk3::Color i) {
+  if (i & 0xffffff00) {
+    unsigned rgb = (unsigned)i;
+    fltk3::color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
+  } else {
+    fltk3::GraphicsDriver::color(i);
+    if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
+    XSetForeground(fl_display, fl_gc, fl_xpixel(i));
+  }
+}
+
+void fltk3::XlibGraphicsDriver::color(uchar r,uchar g,uchar b) {
+  fltk3::GraphicsDriver::color( fltk3::rgb_color(r, g, b) );
+  if(!fl_gc) return; // don't get a default gc if current window is not yet created/valid
+  XSetForeground(fl_display, fl_gc, fl_xpixel(r,g,b));
+}
+
+/** \addtogroup  fl_attributes
+    @{ */
+////////////////////////////////////////////////////////////////
+// Get an rgb color.  This is easy for a truecolor visual.  For
+// colormapped it picks the closest color out of the cube in the
+// fltk colormap.  However if this color cube entry has been
+// requested before, you will get the earlier requested color, and
+// even this may be approximated if the X colormap was full.
+
+/**
+  Returns the X pixel number used to draw the given rgb color.
+  This is the X pixel that fltk3::color() would use.
+  \param[in] r,g,b color components
+  \return X pixel number
+*/
+ulong fl_xpixel(uchar r,uchar g,uchar b) {
+  if (!beenhere) figure_out_visual();
+#  if USE_COLORMAP
+  if (!fl_redmask) {
+    // find closest entry in the colormap:
+    fltk3::Color i =
+      fltk3::color_cube(r*fltk3::NUM_RED/256,g*fltk3::NUM_GREEN/256,b*fltk3::NUM_BLUE/256);
+    Fl_XColor &xmap = fl_xmap[fl_overlay][i];
+    if (xmap.mapped) return xmap.pixel;
+    // if not black or white, change the entry to be an exact match:
+    if (i != fltk3::COLOR_CUBE && i != 0xFF)
+      fl_cmap[i] = (r<<24)|(g<<16)|(b<<8);
+    return fl_xpixel(i); // allocate an X color
+  }
+#  endif
+  return
+    (((r&fl_redmask) << fl_redshift)+
+     ((g&fl_greenmask)<<fl_greenshift)+
+     ((b&fl_bluemask)<< fl_blueshift)
+     ) >> fl_extrashift;
+}
+
+////////////////////////////////////////////////////////////////
+// Get a color out of the fltk colormap.  Again for truecolor
+// visuals this is easy.  For colormap this actually tries to allocate
+// an X color, and does a least-squares match to find the closest
+// color if X cannot allocate that color.
+
+// calculate what color is actually on the screen for a mask:
+static inline uchar realcolor(uchar color, uchar mask) {
+#  if 0
+  // accurate version if the display has linear gamma, but fltk3::draw_image
+  // works better with the simpler version on most screens...
+  uchar m = mask;
+  uchar result = color&m;
+  for (;;) {
+    while (m&mask) {m>>=1; color>>=1;}
+    if (!m) break;
+    mask = m;
+    result |= color&m;
+  }
+  return result;
+#  else
+  return (color&mask) | ( (~mask)&(mask>>1) );
+#  endif
+}
+
+/**
+  Returns the X pixel number used to draw the given FLTK color index.
+  This is the X pixel that fltk3::color() would use.
+  \param[in] i color index
+  \return X pixel number
+*/
+ulong fl_xpixel(fltk3::Color i) {
+  if (i & 0xffffff00) {
+    return fl_xpixel((i >> 24) & 255, (i >> 16) & 255, (i >> 8) & 255);
+  }
+
+  Fl_XColor &xmap = fl_xmap[fl_overlay][i];
+  if (xmap.mapped) return xmap.pixel;
+
+  if (!beenhere) figure_out_visual();
+
+  uchar r,g,b;
+  {unsigned c = fl_cmap[i]; r=uchar(c>>24); g=uchar(c>>16); b=uchar(c>>8);}
+
+#  if USE_COLORMAP
+  Colormap colormap = fl_colormap;
+#    if HAVE_OVERLAY
+  if (fl_overlay) colormap = fl_overlay_colormap; else
+#    endif
+  if (fl_redmask) {
+#  endif
+    // return color for a truecolor visual:
+    xmap.mapped = 2; // 2 prevents XFreeColor from being called
+    xmap.r = realcolor(r, fl_redmask);
+    xmap.g = realcolor(g, fl_greenmask);
+    xmap.b = realcolor(b, fl_bluemask);
+    return xmap.pixel = 
+      (((r&fl_redmask) << fl_redshift)+
+       ((g&fl_greenmask)<<fl_greenshift)+
+       ((b&fl_bluemask)<< fl_blueshift)
+       ) >> fl_extrashift;
+#  if USE_COLORMAP
+  }
+#    if HAVE_OVERLAY
+  static XColor* ac[2];
+  XColor*& allcolors = ac[fl_overlay];
+  static int nc[2];
+  int& numcolors = nc[fl_overlay];
+#    else
+  static XColor *allcolors;
+  static int numcolors;
+#    endif
+
+  // I don't try to allocate colors with XAllocColor once it fails
+  // with any color.  It is possible that it will work, since a color
+  // may have been freed, but some servers are extremely slow and this
+  // avoids one round trip:
+  if (!numcolors) { // don't try after a failure
+    XColor xcol;
+    xcol.red = r<<8; xcol.green = g<<8; xcol.blue = b<<8;
+    if (XAllocColor(fl_display, colormap, &xcol)) {
+      xmap.mapped = 1;
+      xmap.r = xcol.red>>8;
+      xmap.g = xcol.green>>8;
+      xmap.b = xcol.blue>>8;
+      return xmap.pixel = xcol.pixel;
+    }
+
+    // I only read the colormap once.  Again this is due to the slowness
+    // of round-trips to the X server, even though other programs may alter
+    // the colormap after this and make decisions here wrong.
+#    if HAVE_OVERLAY
+    if (fl_overlay) numcolors = fl_overlay_visual->colormap_size; else
+#    endif
+      numcolors = fl_visual->colormap_size;
+    if (!allcolors) allcolors = new XColor[numcolors];
+    for (int p = numcolors; p--;) allcolors[p].pixel = p;
+    XQueryColors(fl_display, colormap, allcolors, numcolors);
+  }
+
+  // find least-squares match:
+  int mindist = 0x7FFFFFFF;
+  unsigned int bestmatch = 0;
+  for (unsigned int n = numcolors; n--;) {
+#    if HAVE_OVERLAY
+    if (fl_overlay && n == fl_transparent_pixel) continue;
+#    endif
+    XColor &a = allcolors[n];
+    int d, t;
+    t = int(r)-int(a.red>>8); d = t*t;
+    t = int(g)-int(a.green>>8); d += t*t;
+    t = int(b)-int(a.blue>>8); d += t*t;
+    if (d <= mindist) {bestmatch = n; mindist = d;}
+  }
+  XColor &p = allcolors[bestmatch];
+
+  // It appears to "work" to not call this XAllocColor, which will
+  // avoid another round-trip to the server.  But then X does not
+  // know that this program "owns" this value, and can (and will)
+  // change it when the program that did allocate it exits:
+  if (XAllocColor(fl_display, colormap, &p)) {
+    xmap.mapped = 1;
+    xmap.pixel = p.pixel;
+  } else {
+    // However, if that XAllocColor fails, I have to give up and
+    // assume the pixel is ok for the duration of the program.  This
+    // is due to bugs (?) in the Solaris X and some X terminals
+    // where XAllocColor *always* fails when the colormap is full,
+    // even if we ask for a color already in it...
+    xmap.mapped = 2; // 2 prevents XFreeColor from being called
+    xmap.pixel = bestmatch;
+  }
+  xmap.r = p.red>>8;
+  xmap.g = p.green>>8;
+  xmap.b = p.blue>>8;
+  return xmap.pixel;
+#  endif
+}
+
+/**
+  Free color \p i if used, and clear mapping table entry.
+  \param[in] i color index
+  \param[in] overlay 0 for normal, 1 for overlay color
+*/
+void fltk3::free_color(fltk3::Color i, int overlay) {
+#  if HAVE_OVERLAY
+#  else
+  if (overlay) return;
+#  endif
+  if (fl_xmap[overlay][i].mapped) {
+#  if USE_COLORMAP
+#    if HAVE_OVERLAY
+    Colormap colormap = overlay ? fl_overlay_colormap : fl_colormap;
+#    else
+    Colormap colormap = fl_colormap;
+#    endif
+    if (fl_xmap[overlay][i].mapped == 1)
+      XFreeColors(fl_display, colormap, &(fl_xmap[overlay][i].pixel), 1, 0);
+#  endif
+    fl_xmap[overlay][i].mapped = 0;
+  }
+}
+
+/**
+  Set color mapping table entry \p i to color \p c
+  \param[in] i color index
+  \param[in] c color
+*/
+void fltk3::set_color(fltk3::Color i, unsigned c) {
+  if (fl_cmap[i] != c) {
+    free_color(i,0);
+#  if HAVE_OVERLAY
+    free_color(i,1);
+#  endif
+    fl_cmap[i] = c;
+  }
+}
+
+#endif // end of X-specific code
+/**
+    Returns the RGB value(s) for the given FLTK color index.
+    
+    This form returns the RGB values packed in a 32-bit unsigned
+    integer with the red value in the upper 8 bits, the green value
+    in the next 8 bits, and the blue value in bits 8-15.  The lower
+    8 bits will always be 0.
+*/
+unsigned fltk3::get_color(fltk3::Color i) {
+  if (i & 0xffffff00) return (i);
+  else return fl_cmap[i];
+}
+/**
+    Sets an entry in the fltk3::color index table.  You can set it to
+    any 8-bit RGB color.  The color is not allocated until fltk3::color(i)
+    is used.
+*/
+void fltk3::set_color(fltk3::Color i, uchar red, uchar green, uchar blue) {
+  fltk3::set_color((fltk3::Color)(i & 255),
+	((unsigned)red<<24)+((unsigned)green<<16)+((unsigned)blue<<8));
+}
+/**
+    Returns the RGB value(s) for the given FLTK color index. 
+    
+    This form returns the red, green, and blue values
+    separately in referenced variables.
+
+    See also unsigned get_color(fltk3::Color c)
+ */
+void fltk3::get_color(fltk3::Color i, uchar &red, uchar &green, uchar &blue) {
+  unsigned c;
+
+  if (i & 0xffffff00) c = (unsigned)i;
+  else c = fl_cmap[i];
+
+  red   = uchar(c>>24);
+  green = uchar(c>>16);
+  blue  = uchar(c>>8);
+}
+
+/**
+  Returns the weighted average color between the two given colors.
+  The red, green and blue values are averages using the following formula:
+  \code
+  color = color1 * weight  + color2 * (1 - weight)
+  \endcode
+  Thus, a \p weight value of 1.0 will return the first color, while a
+  value of 0.0 will return the second color.
+  \param[in] color1, color2 boundary colors
+  \param[in] weight weighting factor
+*/
+fltk3::Color fltk3::color_average(fltk3::Color color1, fltk3::Color color2, float weight) {
+  unsigned rgb1;
+  unsigned rgb2;
+  uchar r, g, b;
+
+  if (color1 & 0xffffff00) rgb1 = color1;
+  else rgb1 = fl_cmap[color1 & 255];
+
+  if (color2 & 0xffffff00) rgb2 = color2;
+  else rgb2 = fl_cmap[color2 & 255];
+
+  r = (uchar)(((uchar)(rgb1>>24))*weight + ((uchar)(rgb2>>24))*(1-weight));
+  g = (uchar)(((uchar)(rgb1>>16))*weight + ((uchar)(rgb2>>16))*(1-weight));
+  b = (uchar)(((uchar)(rgb1>>8))*weight + ((uchar)(rgb2>>8))*(1-weight));
+
+  return fltk3::rgb_color(r, g, b);
+}
+
+/**
+  Returns the inactive, dimmed version of the given color
+*/
+fltk3::Color fltk3::inactive(fltk3::Color c) {
+  return fltk3::color_average(c, fltk3::GRAY, .33f);
+}
+
+/**
+  Returns a color that contrasts with the background color.
+  This will be the foreground color if it contrasts sufficiently with the
+  background color. Otherwise, returns \p fltk3::WHITE or \p fltk3::BLACK depending
+  on which color provides the best contrast.
+  \param[in] fg,bg foreground and background colors
+  \return contrasting color
+*/
+fltk3::Color fltk3::contrast(fltk3::Color fg, fltk3::Color bg) {
+  unsigned c1, c2;	// RGB colors
+  int l1, l2;		// Luminosities
+
+
+  // Get the RGB values for each color...
+  if (fg & 0xffffff00) c1 = (unsigned)fg;
+  else c1 = fl_cmap[fg];
+
+  if (bg & 0xffffff00) c2 = (unsigned)bg;
+  else c2 = fl_cmap[bg];
+
+  // Compute the luminosity...
+  l1 = ((c1 >> 24) * 30 + ((c1 >> 16) & 255) * 59 + ((c1 >> 8) & 255) * 11) / 100;
+  l2 = ((c2 >> 24) * 30 + ((c2 >> 16) & 255) * 59 + ((c2 >> 8) & 255) * 11) / 100;
+
+  // Compare and return the contrasting color...
+  if ((l1 - l2) > 99) return fg;
+  else if ((l2 - l1) > 99) return fg;
+  else if (l2 > 127) return fltk3::BLACK;
+  else return fltk3::WHITE;
+}
+/**
+   @}
+*/
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/compose.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_compose.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/compose.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/compose.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,102 @@
+//
+// "$Id$"
+//
+// Character compose processing for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+#ifndef FLTK3_DOXYGEN
+int fltk3::compose_state = 0;
+#endif
+
+#if !defined(WIN32) && !defined(__APPLE__)
+extern XIC fl_xim_ic;
+#endif
+
+/** Any text editing widget should call this for each fltk3::KEYBOARD event.
+ Use of this function is very simple.
+ 
+ <p>If <i>true</i> is returned, then it has modified the
+ fltk3::event_text() and fltk3::event_length() to a set of <i>bytes</i> to
+ insert (it may be of zero length!).  In will also set the "del"
+ parameter to the number of <i>bytes</i> to the left of the cursor to
+ delete, this is used to delete the results of the previous call to
+ fltk3::compose().
+ 
+ <p>If <i>false</i> is returned, the keys should be treated as function
+ keys, and del is set to zero. You could insert the text anyways, if
+ you don't know what else to do.
+ 
+ <p>Though the current implementation returns immediately, future
+ versions may take quite awhile, as they may pop up a window or do
+ other user-interface things to allow characters to be selected.
+ */
+int fltk3::compose(int& del) {
+  // character composition is now handled by the OS
+  del = 0;
+#if defined(__APPLE__)
+  // this stuff is to be treated as a function key
+  if(fltk3::e_length == 0 || fltk3::e_keysym == fltk3::EnterKey || fltk3::e_keysym == fltk3::KPEnterKey || 
+     fltk3::e_keysym == fltk3::TabKey || fltk3::e_keysym == fltk3::EscapeKey || fltk3::e_state&(fltk3::META | fltk3::CTRL) ) {
+    return 0;
+  }
+#elif defined(WIN32)
+  unsigned char ascii = (unsigned)e_text[0];
+  if ((e_state & (fltk3::ALT | fltk3::META)) && !(ascii & 128)) return 0;
+#else
+  unsigned char ascii = (unsigned)e_text[0];
+  if ((e_state & (fltk3::ALT | fltk3::META | fltk3::CTRL)) && !(ascii & 128)) return 0;
+#endif
+  if(fltk3::compose_state) {
+    del = fltk3::compose_state;
+    fltk3::compose_state = 0;
+#ifndef __APPLE__
+  } else {
+    // Only insert non-control characters:
+    if (! (ascii & ~31 && ascii!=127)) { return 0; }
+#endif
+  }
+  return 1;
+}
+
+/**
+ If the user moves the cursor, be sure to call fltk3::compose_reset().
+ The next call to fltk3::compose() will start out in an initial state. In
+ particular it will not set "del" to non-zero. This call is very fast
+ so it is ok to call it many times and in many places.
+ */
+void fltk3::compose_reset()
+{
+  fltk3::compose_state = 0;
+#if !defined(WIN32) && !defined(__APPLE__)
+  if (fl_xim_ic) XmbResetIC(fl_xim_ic);
+#endif
+}
+
+//
+// End of "$Id$"
+//
+

Copied: branches/branch-3.0/src/fltk3/cursor.cxx (from rev 9002, branches/branch-3.0/src/core/fl_cursor.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/cursor.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/cursor.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,333 @@
+//
+// "$Id$"
+//
+// Mouse cursor support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Change the current cursor.
+// Under X the cursor is attached to the X window.  I tried to hide
+// this and pretend that changing the cursor is a drawing function.
+// This avoids a field in the fltk3::Window, and I suspect is more
+// portable to other systems.
+
+#include <fltk3/run.h>
+#include <fltk3/Window.h>
+#include <fltk3/x.h>
+#if !defined(WIN32) && !defined(__APPLE__)
+#  include <X11/cursorfont.h>
+#endif
+#include <fltk3/draw.h>
+
+/**
+  Sets the cursor for the current window to the specified shape and colors.
+  The cursors are defined in the <fltk3/enumerations.h> header file. 
+  */
+void fltk3::cursor(fltk3::Cursor c, fltk3::Color fg, fltk3::Color bg) {
+  if (fltk3::first_window()) fltk3::first_window()->cursor(c,fg,bg);
+}
+/** 
+    Sets the default window cursor as well as its color.
+
+    For back compatibility only.
+*/
+void fltk3::Window::default_cursor(fltk3::Cursor c, fltk3::Color fg, fltk3::Color bg) {
+//  if (c == fltk3::CURSOR_DEFAULT) c = fltk3::CURSOR_ARROW;
+
+  cursor_default = c;
+  cursor_fg      = fg;
+  cursor_bg      = bg;
+
+  cursor(c, fg, bg);
+}
+
+#ifdef WIN32
+
+#  ifndef IDC_HAND
+#    define IDC_HAND	MAKEINTRESOURCE(32649)
+#  endif // !IDC_HAND
+
+void fltk3::Window::cursor(fltk3::Cursor c, fltk3::Color c1, fltk3::Color c2) {
+  if (!shown()) return;
+  // the cursor must be set for the top level window, not for subwindows
+  fltk3::Window *w = window(), *toplevel = this;
+  while (w) { toplevel = w; w = w->window(); }
+  if (toplevel != this) { toplevel->cursor(c, c1, c2); return; }
+  // now set the actual cursor
+  if (c == fltk3::CURSOR_DEFAULT) {
+    c = cursor_default;
+  }
+  if (c > fltk3::CURSOR_NESW) {
+    i->cursor = 0;
+  } else if (c == fltk3::CURSOR_DEFAULT) {
+    i->cursor = fl_default_cursor;
+  } else {
+    LPSTR n;
+    switch (c) {
+    case fltk3::CURSOR_ARROW:	n = IDC_ARROW; break;
+    case fltk3::CURSOR_CROSS:	n = IDC_CROSS; break;
+    case fltk3::CURSOR_WAIT:	n = IDC_WAIT; break;
+    case fltk3::CURSOR_INSERT:	n = IDC_IBEAM; break;
+    case fltk3::CURSOR_HELP:	n = IDC_HELP; break;
+    case fltk3::CURSOR_HAND: {
+          OSVERSIONINFO osvi;
+
+          // Get the OS version: Windows 98 and 2000 have a standard
+	  // hand cursor.
+          memset(&osvi, 0, sizeof(OSVERSIONINFO));
+          osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+          GetVersionEx(&osvi);
+
+          if (osvi.dwMajorVersion > 4 ||
+  	      (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion > 0 &&
+  	       osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) n = IDC_HAND;
+          else n = IDC_UPARROW;
+	} break;
+    case fltk3::CURSOR_MOVE:	n = IDC_SIZEALL; break;
+    case fltk3::CURSOR_N:
+    case fltk3::CURSOR_S:
+    case fltk3::CURSOR_NS:		n = IDC_SIZENS; break;
+    case fltk3::CURSOR_NE:
+    case fltk3::CURSOR_SW:
+    case fltk3::CURSOR_NESW:	n = IDC_SIZENESW; break;
+    case fltk3::CURSOR_E:
+    case fltk3::CURSOR_W:
+    case fltk3::CURSOR_WE:		n = IDC_SIZEWE; break;
+    case fltk3::CURSOR_SE:
+    case fltk3::CURSOR_NW:
+    case fltk3::CURSOR_NWSE:	n = IDC_SIZENWSE; break;
+    default:			n = IDC_NO; break;
+    }
+    i->cursor = LoadCursor(NULL, n);
+  }
+  SetCursor(i->cursor);
+}
+
+#elif defined(__APPLE__)
+
+#ifdef __BIG_ENDIAN__
+# define E(x) x
+#elif defined __LITTLE_ENDIAN__
+// Don't worry. This will be resolved at compile time
+# define E(x) (x>>8)|((x<<8)&0xff00)
+#else
+# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined"
+#endif
+
+extern fltk3::Offscreen fl_create_offscreen_with_alpha(int w, int h);
+
+
+CGContextRef Fl_X::help_cursor_image(void)
+{
+  int w = 20, h = 20;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(w, h);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,w,h);
+  fltk3::color(fltk3::BLACK);
+  fltk3::font(fltk3::COURIER_BOLD, 20);
+  fltk3::draw("?", 1, h-1);
+  fl_end_offscreen();
+  return (CGContextRef)off;
+}
+
+CGContextRef Fl_X::none_cursor_image(void)
+{
+  int w = 20, h = 20;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(w, h);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,w,h);
+  fl_end_offscreen();
+  return (CGContextRef)off;
+}
+
+CGContextRef Fl_X::watch_cursor_image(void)
+{
+  int w, h, r = 5;
+  w = 2*r+6;
+  h = 4*r;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(w, h);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,w,h);
+  CGContextTranslateCTM( (CGContextRef)off, w/2, h/2);
+  fltk3::color(fltk3::WHITE);
+  fltk3::circle(0, 0, r+1);
+  fltk3::color(fltk3::BLACK);
+  fltk3::rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r));
+  fltk3::rectf(r-1, -1, 3, 3);
+  fltk3::color(fltk3::WHITE);
+  fltk3::pie(-r, -r, 2*r, 2*r, 0, 360);
+  fltk3::color(fltk3::BLACK);
+  fltk3::circle(0,0,r);
+  fltk3::xyline(0, 0, int(-r*.7));
+  fltk3::xyline(0, 0, 0, int(-r*.7));
+  fl_end_offscreen();
+  return (CGContextRef)off;
+}
+
+CGContextRef Fl_X::nesw_cursor_image(void)
+{
+  int c = 7, r = 2*c;
+  int w = r, h = r;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(w, h);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,w,h);
+  CGContextTranslateCTM( (CGContextRef)off, 0, h);
+  CGContextScaleCTM( (CGContextRef)off, 1, -1);
+  fltk3::color(fltk3::BLACK);
+  fltk3::polygon(0, 0, c, 0, 0, c);
+  fltk3::polygon(r, r, r, r-c, r-c, r);
+  fltk3::line_style(fltk3::SOLID, 2, 0);
+  fltk3::line(0,1, r,r+1);
+  fltk3::line_style(fltk3::SOLID, 0, 0);
+  fl_end_offscreen();
+  return (CGContextRef)off;
+}
+
+CGContextRef Fl_X::nwse_cursor_image(void)
+{
+  int c = 7, r = 2*c;
+  int w = r, h = r;
+  fltk3::Offscreen off = fl_create_offscreen_with_alpha(w, h);
+  fl_begin_offscreen(off);
+  CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0);
+  fltk3::rectf(0,0,w,h);
+  CGContextTranslateCTM( (CGContextRef)off, 0, h);
+  CGContextScaleCTM( (CGContextRef)off, 1, -1);
+  fltk3::color(fltk3::BLACK);
+  fltk3::polygon(r-1, 0, r-1, c, r-1-c, 0);
+  fltk3::polygon(-1, r, c-1, r, -1, r-c);
+  fltk3::line_style(fltk3::SOLID, 2, 0);
+  fltk3::line(r-1,1, -1,r+1);
+  fltk3::line_style(fltk3::SOLID, 0, 0);
+  fl_end_offscreen();
+  return (CGContextRef)off;
+}
+
+void fltk3::Window::cursor(fltk3::Cursor c, fltk3::Color, fltk3::Color) {
+  if (c == fltk3::CURSOR_DEFAULT) {
+    c = cursor_default;
+  }
+  if (i) i->set_cursor(c);
+}
+
+#else
+
+// I like the MSWindows resize cursors, so I duplicate them here:
+
+#define CURSORSIZE 16
+#define HOTXY 7
+static struct TableEntry {
+  uchar bits[CURSORSIZE*CURSORSIZE/8];
+  uchar mask[CURSORSIZE*CURSORSIZE/8];
+  ::Cursor cursor;
+} table[] = {
+  {{	// fltk3::CURSOR_NS
+   0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01,
+   0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
+   0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00},
+   {
+   0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03,
+   0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f,
+   0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01}},
+  {{	// fltk3::CURSOR_EW
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10,
+   0x0c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0x0c, 0x30, 0x08, 0x10, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+   {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1c, 0x38,
+   0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
+  {{	// fltk3::CURSOR_NWSE
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x38, 0x00, 0x78, 0x00,
+   0xe8, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x1c,
+   0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+   {
+   0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x7c, 0x00, 0xfc, 0x00,
+   0xfc, 0x01, 0xec, 0x03, 0xc0, 0x37, 0x80, 0x3f, 0x00, 0x3f, 0x00, 0x3e,
+   0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00}},
+  {{	// fltk3::CURSOR_NESW
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x1c, 0x00, 0x1e,
+   0x00, 0x17, 0x80, 0x03, 0xc0, 0x01, 0xe8, 0x00, 0x78, 0x00, 0x38, 0x00,
+   0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+   {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3e, 0x00, 0x3f,
+   0x80, 0x3f, 0xc0, 0x37, 0xec, 0x03, 0xfc, 0x01, 0xfc, 0x00, 0x7c, 0x00,
+   0xfc, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00}},
+  {{0}, {0}} // fltk3::CURSOR_NONE & unknown
+};
+
+void fltk3::Window::cursor(fltk3::Cursor c, fltk3::Color fg, fltk3::Color bg) {
+  if (!shown()) return;
+  ::Cursor xc;
+  int deleteit = 0;
+  if (c == fltk3::CURSOR_DEFAULT) {
+    c  = cursor_default;
+    fg = cursor_fg;
+    bg = cursor_bg;
+  }
+
+  if (!c) {
+    xc = None;
+  } else {
+    if (c >= fltk3::CURSOR_NS) {
+      TableEntry *q = (c > fltk3::CURSOR_NESW) ? table+4 : table+(c-fltk3::CURSOR_NS);
+      if (!(q->cursor)) {
+	XColor dummy = { 0 };
+	::Pixmap p = XCreateBitmapFromData(fl_display,
+	  RootWindow(fl_display, fl_screen), (const char*)(q->bits),
+	  CURSORSIZE, CURSORSIZE);
+	::Pixmap m = XCreateBitmapFromData(fl_display,
+	  RootWindow(fl_display, fl_screen), (const char*)(q->mask),
+	  CURSORSIZE, CURSORSIZE);
+	q->cursor = XCreatePixmapCursor(fl_display, p,m,&dummy, &dummy,
+					HOTXY, HOTXY);
+	XFreePixmap(fl_display, m);
+	XFreePixmap(fl_display, p);
+      }
+      xc = q->cursor;
+    } else {
+      xc = XCreateFontCursor(fl_display, (c-1)*2);
+      deleteit = 1;
+    }
+    XColor fgc;
+    uchar r,g,b;
+    fltk3::get_color(fg,r,g,b);
+    fgc.red = r<<8; fgc.green = g<<8; fgc.blue = b<<8;
+    XColor bgc;
+    fltk3::get_color(bg,r,g,b);
+    bgc.red = r<<8; bgc.green = g<<8; bgc.blue = b<<8;
+    XRecolorCursor(fl_display, xc, &fgc, &bgc);
+  }
+  XDefineCursor(fl_display, fl_xid(this), xc);
+  if (deleteit) XFreeCursor(fl_display, xc);
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/curve.cxx (from rev 9002, branches/branch-3.0/src/core/fl_curve.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/curve.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/curve.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,110 @@
+//
+// "$Id$"
+//
+// Bezier curve functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_curve.cxx
+  \brief Utility for drawing Bezier curves, adding the points to the
+         current fl_begin/fltk3::vertex/fl_end path.
+
+  Incremental math implementation:
+  I very much doubt this is optimal!  From Foley/vanDam page 511.
+  If anybody has a better algorithm, please send it!
+*/
+
+#include <fltk3/draw.h>
+#include <math.h>
+
+void fltk3::GraphicsDriver::curve(double X0, double Y0,
+	      double X1, double Y1,
+	      double X2, double Y2,
+	      double X3, double Y3) {
+
+  double x = fltk3::transform_x(X0,Y0);
+  double y = fltk3::transform_y(X0,Y0);
+
+  // draw point 0:
+  fltk3::transformed_vertex(x,y);
+
+  double x1 = fltk3::transform_x(X1,Y1);
+  double yy1 = fltk3::transform_y(X1,Y1);
+  double x2 = fltk3::transform_x(X2,Y2);
+  double y2 = fltk3::transform_y(X2,Y2);
+  double x3 = fltk3::transform_x(X3,Y3);
+  double y3 = fltk3::transform_y(X3,Y3);
+
+  // find the area:
+  double a = fabs((x-x2)*(y3-yy1)-(y-y2)*(x3-x1));
+  double b = fabs((x-x3)*(y2-yy1)-(y-y3)*(x2-x1));
+  if (b > a) a = b;
+
+  // use that to guess at the number of segments:
+  int n = int(sqrt(a)/4);
+  if (n > 1) {
+    if (n > 100) n = 100; // make huge curves not hang forever
+
+    double e = 1.0/n;
+
+    // calculate the coefficients of 3rd order equation:
+    double xa = (x3-3*x2+3*x1-x);
+    double xb = 3*(x2-2*x1+x);
+    double xc = 3*(x1-x);
+    // calculate the forward differences:
+    double dx1 = ((xa*e+xb)*e+xc)*e;
+    double dx3 = 6*xa*e*e*e;
+    double dx2 = dx3 + 2*xb*e*e;
+
+    // calculate the coefficients of 3rd order equation:
+    double ya = (y3-3*y2+3*yy1-y);
+    double yb = 3*(y2-2*yy1+y);
+    double yc = 3*(yy1-y);
+    // calculate the forward differences:
+    double dy1 = ((ya*e+yb)*e+yc)*e;
+    double dy3 = 6*ya*e*e*e;
+    double dy2 = dy3 + 2*yb*e*e;
+
+    // draw points 1 .. n-2:
+    for (int m=2; m<n; m++) {
+      x += dx1;
+      dx1 += dx2;
+      dx2 += dx3;
+      y += dy1;
+      dy1 += dy2;
+      dy2 += dy3;
+      fltk3::transformed_vertex(x,y);
+    }
+
+    // draw point n-1:
+    fltk3::transformed_vertex(x+dx1, y+dy1);
+  }
+
+  // draw point n:
+  fltk3::transformed_vertex(x3,y3);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/d1.xbm (from rev 9002, branches/branch-3.0/src/core/d1.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/d1.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/d1.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define d1_width 16
+#define d1_height 16
+static unsigned char d1_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x38, 0x00, 0x78, 0x00,
+   0xe8, 0x00, 0xc0, 0x01, 0x80, 0x03, 0x00, 0x17, 0x00, 0x1e, 0x00, 0x1c,
+   0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/d1_mask.xbm (from rev 9002, branches/branch-3.0/src/core/d1_mask.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/d1_mask.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/d1_mask.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define d1_mask_width 16
+#define d1_mask_height 16
+static unsigned char d1_mask_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0x7c, 0x00, 0xfc, 0x00,
+   0xfc, 0x01, 0xec, 0x03, 0xc0, 0x37, 0x80, 0x3f, 0x00, 0x3f, 0x00, 0x3e,
+   0x00, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/diamond_box.cxx (from rev 9002, branches/branch-3.0/src/core/fl_diamond_box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/diamond_box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/diamond_box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,76 @@
+//
+// "$Id$"
+//
+// Diamond box code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Box drawing code for an obscure box type.
+// These box types are in separate files so they are not linked
+// in if not used.
+
+// The diamond box draws best if the area is square!
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+namespace fltk3 {
+  extern uchar* gray_ramp();
+}
+
+void fl_diamond_up_box(int x,int y,int w,int h,fltk3::Color bgcolor, fltk3::Boxtype) {
+  w &= -2;
+  h &= -2;
+  int x1 = x+w/2;
+  int y1 = y+h/2;
+  fltk3::color(bgcolor); fltk3::polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
+  uchar *g = fltk3::gray_ramp();
+  fltk3::color(g['W']); fltk3::line(x+1, y1, x1, y+1, x+w-1, y1);
+  fltk3::color(g['U']); fltk3::line(x+2, y1, x1, y+2, x+w-2, y1);
+  fltk3::color(g['S']); fltk3::line(x+3, y1, x1, y+3, x+w-3, y1);
+  fltk3::color(g['P']); fltk3::line(x+3, y1, x1, y+h-3, x+w-3, y1);
+  fltk3::color(g['N']); fltk3::line(x+2, y1, x1, y+h-2, x+w-2, y1);
+  fltk3::color(g['H']); fltk3::line(x+1, y1, x1, y+h-1, x+w-1, y1);
+  fltk3::color(g['A']); fltk3::loop(x, y1, x1, y, x+w, y1, x1, y+h);
+}
+
+void fl_diamond_down_box(int x,int y,int w,int h,fltk3::Color bgcolor, fltk3::Boxtype) {
+  w &= -2;
+  h &= -2;
+  int x1 = x+w/2;
+  int y1 = y+h/2;
+  uchar *g = fltk3::gray_ramp();
+  fltk3::color(g['P']); fltk3::line(x+0, y1, x1, y+0, x+w-0, y1);
+  fltk3::color(g['N']); fltk3::line(x+1, y1, x1, y+1, x+w-1, y1);
+  fltk3::color(g['H']); fltk3::line(x+2, y1, x1, y+2, x+w-2, y1);
+  fltk3::color(g['W']); fltk3::line(x+2, y1, x1, y+h-2, x+w-2, y1);
+  fltk3::color(g['U']); fltk3::line(x+1, y1, x1, y+h-1, x+w-1, y1);
+  fltk3::color(g['S']); fltk3::line(x+0, y1, x1, y+h-0, x+w-0, y1);
+  fltk3::color(bgcolor); fltk3::polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
+  fltk3::color(g['A']); fltk3::loop(x+3, y1, x1, y+3, x+w-3, y1, x1, y+h-3);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/display.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_display.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/display.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/display.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,60 @@
+//
+// "$Id$"
+//
+// Display function for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Startup method to set what display to use.
+// Using setenv makes programs that are exec'd use the same display.
+
+#include <fltk3/run.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+/**
+    Sets the X display to use for all windows.  Actually this just sets
+    the environment variable $DISPLAY to the passed string, so this only
+    works before you show() the first window or otherwise open the display,
+    and does nothing useful under WIN32.
+*/
+void fltk3::display(const char *d) {
+#if defined(__APPLE__) || defined(WIN32)
+  (void)d;
+#else
+  static char e[1024];
+  strcpy(e,"DISPLAY=");
+  strlcat(e,d,sizeof(e));
+  for (char *c = e+8; *c!=':'; c++) {
+    if (!*c) {
+      strlcat(e,":0.0",sizeof(e));
+      break;
+    }
+  }
+  putenv(e);
+#endif // __APPLE__
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/dnd.cxx (from rev 9002, branches/branch-3.0/src/core/fl_dnd.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/dnd.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/dnd.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,38 @@
+//
+// "$Id$"
+//
+// Drag & Drop code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef WIN32
+#  include "fl_dnd_win32.cxx"
+#elif defined(__APPLE__)
+//#  include "fl_dnd_mac.cxx"
+#else
+#  include "fl_dnd_x.cxx"
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/draw.cxx (from rev 9002, branches/branch-3.0/src/core/fl_draw.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/draw.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/draw.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,486 @@
+//
+// "$Id$"
+//
+// Label drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Implementation of fltk3::draw(const char*,int,int,int,int,fltk3::Align)
+// Used to draw all the labels and text, this routine:
+// Word wraps the labels to fit into their bounding box.
+// Breaks them into lines at the newlines.
+// Expands all unprintable characters to ^X or \nnn notation
+// Aligns them against the inside of the box.
+
+#include <fltk3/utf8.h>
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/Image.h>
+
+#include "flstring.h"
+#include <ctype.h>
+#include <math.h>
+
+#define MAXBUF 1024
+
+char fltk3::draw_shortcut;	// set by fl_labeltypes.cxx
+
+static char* underline_at;
+
+/** 
+    utf8 multibyte char seq. detection an pass-thru routine.
+    \retval false if no utf8 seq detected, no change made. true if utf8 and d copied with s seq.
+    note that for n bytes copied dest incremented of n, but s of n-1 for compatible loop use see below.
+*/
+#define C_IN(c,a,b) ((c)>=(a) && (c)<=(b)) 
+#define C_UTF8(c)   C_IN(c,0x80,0xBF)
+
+static bool handle_utf8_seq(const char * &s,char * &d) {
+  register const unsigned char* p=(const unsigned char*)s;
+  if (p[0] < 0xc2 || p[0] > 0xf4)
+    return false; // not adressed in this function
+  else if ( C_IN(p[0], 0xc2, 0xdf) && C_UTF8(p[1]) ) {
+    d[0]=s[0]; d[1]=s[1];
+    d+=2; s++;
+    // non-overlong 2-byte
+  }
+  else if ( p[0]==0xe0 && C_IN(p[1], 0xa0, 0xbf) && C_UTF8(p[2]) ) {
+    d[0]=s[0]; d[1]=s[1];d[2]=s[2];
+    d+=3; s+=2;
+    //  excluding overlongs
+  }
+  else if (p[0]==0xed && C_IN(p[1], 0x80, 0x9f) && C_UTF8(p[2]) ) {
+    d[0]=s[0]; d[1]=s[1];d[2]=s[2];
+    d+=3; s+=2;
+    //  excluding surrogates
+  }
+  else if (p[0]!=0xed && C_IN(p[0], 0xe1, 0xef) && C_UTF8(p[1]) && C_UTF8(p[2]) ) {
+    d[0]=s[0]; d[1]=s[1];d[2]=s[2];
+    d+=3; s+=2;
+    // straight 3-byte
+  }
+  else if (p[0]==0xf0 && C_IN(p[1], 0x90, 0xbf)   && C_UTF8(p[2]) && C_UTF8(p[3]) ) {
+    d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3];
+    d+=4; s+=3;
+    // planes 1-3
+  }
+  else if (C_IN(p[0], 0xf1, 0xf3) && C_UTF8(p[1]) && C_UTF8(p[2]) && C_UTF8(p[3]) ) {
+    d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3];
+    d+=4; s+=3;
+    // planes 4-15
+  }
+  else if (p[0]==0xf4 && C_IN(p[1], 0x80, 0x8f)   && C_UTF8(p[2]) && C_UTF8(p[3]) ) {
+    d[0]=s[0]; d[1]=s[1]; d[2]=s[2]; d[3]=s[3];
+    d+=4; s+=3;
+    // planes 16
+  } else { // non utf8 compliant, maybe CP125x or broken utf8 string
+    // fprintf(stderr, "Not UTF8 char \n");
+    return false; 
+  }
+  return true; //  we did handled and copied the utf8 multibyte char seq.
+}
+
+/**
+ Copy \p from to \p buf, replacing unprintable characters with ^X and \\nnn.
+
+ Stop at a newline or if MAXBUF characters written to buffer.
+ Also word-wrap if width exceeds maxw.
+ Returns a pointer to the start of the next line of characters.
+ Sets n to the number of characters put into the buffer.
+ Sets width to the width of the string in the current font.
+*/
+const char*
+fltk3::expand_text(const char* from, char* buf, int maxbuf, double maxw, int& n, 
+	double &width, int wrap, int draw_symbols) {
+  char* o = buf;
+  char* e = buf+(maxbuf-4);
+  underline_at = 0;
+  char* word_end = o;
+  const char* word_start = from;
+  double w = 0;
+
+  const char* p = from;
+  for (;; p++) {
+
+    int c = *p & 255;
+
+    if (!c || c == ' ' || c == '\n') {
+      // test for word-wrap:
+      if (word_start < p && wrap) {
+	double newwidth = w + fltk3::width(word_end, o-word_end);
+	if (word_end > buf && newwidth > maxw) { // break before this word
+	  o = word_end;
+	  p = word_start;
+	  break;
+	}
+	word_end = o;
+	w = newwidth;
+      }
+      if (!c) break;
+      else if (c == '\n') {p++; break;}
+      word_start = p+1;
+    }
+
+    if (o > e) break; // don't overflow buffer
+
+    if (c == '\t') {
+      for (c = fltk3::utf_nb_char((uchar*)buf, o-buf)%8; c<8 && o<e; c++) 
+           *o++ = ' ';
+    } else if (c == '&' && fltk3::draw_shortcut && *(p+1)) {
+      if (*(p+1) == '&') {p++; *o++ = '&';}
+      else if (fltk3::draw_shortcut != 2) underline_at = o;
+    } else if (c < ' ' || c == 127) { // ^X
+      *o++ = '^';
+      *o++ = c ^ 0x40;
+    } else  if (handle_utf8_seq(p, o)) { // figure out if we have an utf8 valid sequence before we determine the nbsp test validity:
+#ifdef __APPLE__
+    } else if (c == 0xCA) { // non-breaking space in MacRoman
+#else
+    } else if (c == 0xA0) { // non-breaking space in ISO 8859
+#endif
+      *o++ = ' ';
+       
+    } else if (c == '@' && draw_symbols) { // Symbol???
+      if (p[1] && p[1] != '@')  break;
+      *o++ = c;
+      if (p[1]) p++;
+    } else {
+      *o++ = c;
+    }
+  }
+
+  width = w + fltk3::width(word_end, o-word_end);
+  *o = 0;
+  n = o-buf;
+  return p;
+}
+
+/**
+  The same as fltk3::draw(const char*,int,int,int,int,fltk3::Align,fltk3::Image*,int) with
+  the addition of the \p callthis parameter, which is a pointer to a text drawing
+  function such as fltk3::draw(const char*, int, int, int) to do the real work
+*/
+void fltk3::draw(
+    const char* str,	// the (multi-line) string
+    int x, int y, int w, int h,	// bounding box
+    fltk3::Align align,
+    void (*callthis)(const char*,int,int,int),
+    fltk3::Image* img, int draw_symbols) 
+{
+  const char* p;
+  const char* e;
+  char buf[MAXBUF];
+  int buflen;
+  char symbol[2][255], *symptr;
+  int symwidth[2], symoffset, symtotal, imgtotal;
+
+  // count how many lines and put the last one into the buffer:
+  int lines;
+  double width;
+
+  // if the image is set as a backdrop, ignore it here
+  if (img && (align & fltk3::ALIGN_IMAGE_BACKDROP)) img = 0;
+      
+  symbol[0][0] = '\0';
+  symwidth[0]  = 0;
+
+  symbol[1][0] = '\0';
+  symwidth[1]  = 0;
+
+  if (draw_symbols) {
+    if (str && str[0] == '@' && str[1] && str[1] != '@') {
+      // Start with a symbol...
+      for (symptr = symbol[0];
+           *str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) - 1);
+           *symptr++ = *str++);
+      *symptr = '\0';
+      if (isspace(*str)) str++;
+      symwidth[0] = (w < h ? w : h);
+    }
+
+    if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1] != '@') {
+      strlcpy(symbol[1], p, sizeof(symbol[1]));
+      symwidth[1] = (w < h ? w : h);
+    }
+  }
+
+  symtotal = symwidth[0] + symwidth[1];
+  imgtotal = (img && (align&fltk3::ALIGN_IMAGE_NEXT_TO_TEXT)) ? img->w() : 0;
+  
+  int strw = 0;
+  int strh;
+
+  if (str) {
+    for (p = str, lines=0; p;) {
+      e = fltk3::expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width, 
+                         align&fltk3::ALIGN_WRAP, draw_symbols);
+      if (strw<width) strw = (int)width;
+      lines++;
+      if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
+      p = e;
+    }
+  } else lines = 0;
+  
+  if ((symwidth[0] || symwidth[1]) && lines) {
+    if (symwidth[0]) symwidth[0] = lines * fltk3::height();
+    if (symwidth[1]) symwidth[1] = lines * fltk3::height();
+  }
+
+  symtotal = symwidth[0] + symwidth[1];
+  strh = lines * fltk3::height();
+  
+  // figure out vertical position of the first line:
+  int xpos;
+  int ypos;
+  int height = fltk3::height();
+  int imgvert = ((align&fltk3::ALIGN_IMAGE_NEXT_TO_TEXT)==0);
+  int imgh = img && imgvert ? img->h() : 0;
+  int imgw[2] = {0, 0};
+
+  symoffset = 0;
+
+  if (align & fltk3::ALIGN_BOTTOM) ypos = y+h-(lines-1)*height-imgh;
+  else if (align & fltk3::ALIGN_TOP) ypos = y+height;
+  else ypos = y+(h-lines*height-imgh)/2+height;
+
+  // draw the image unless the "text over image" alignment flag is set...
+  if (img && imgvert && !(align & fltk3::ALIGN_TEXT_OVER_IMAGE)) {
+    if (img->w() > symoffset) symoffset = img->w();
+
+    if (align & fltk3::ALIGN_LEFT) xpos = x + symwidth[0];
+    else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - img->w() - symwidth[1];
+    else xpos = x + (w - img->w() - symtotal) / 2 + symwidth[0];
+
+    img->draw(xpos, ypos - height);
+    ypos += img->h();
+  }
+
+  // draw the image to the side of the text
+  if (img && !imgvert /* && (align & !fltk3::ALIGN_TEXT_NEXT_TO_IMAGE)*/ ) {
+    if (align & fltk3::ALIGN_TEXT_OVER_IMAGE) { // image is right of text
+      imgw[1] = img->w();
+      if (align & fltk3::ALIGN_LEFT) xpos = x + symwidth[0] + strw + 1;
+      else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - symwidth[1] - imgw[1] + 1;
+      else xpos = x + (w - strw - symtotal - imgw[1]) / 2 + symwidth[0] + strw + 1;
+    } else { // image is to the left of the text
+      imgw[0] = img->w();
+      if (align & fltk3::ALIGN_LEFT) xpos = x + symwidth[0] - 1;
+      else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - symwidth[1] - strw - imgw[0] - 1;
+      else xpos = x + (w - strw - symtotal - imgw[0]) / 2 - 1;
+    }
+    int yimg = ypos - height;
+    if (align & fltk3::ALIGN_TOP) ;
+    else if (align & fltk3::ALIGN_BOTTOM) yimg += strh - img->h() - 1;
+    else yimg += (strh - img->h() - 1) / 2;
+    img->draw(xpos, yimg);
+  }
+  
+  // now draw all the lines:
+  if (str) {
+    int desc = fltk3::descent();
+    for (p=str; ; ypos += height) {
+      if (lines>1) e = fltk3::expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, 
+				width, align&fltk3::ALIGN_WRAP, draw_symbols);
+      else e = "";
+
+      if (width > symoffset) symoffset = (int)(width + 0.5);
+
+      if (align & fltk3::ALIGN_LEFT) xpos = x + symwidth[0] + imgw[0];
+      else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - (int)(width + .5) - symwidth[1] - imgw[1];
+      else xpos = x + (w - (int)(width + .5) - symtotal - imgw[0] - imgw[1]) / 2 + symwidth[0] + imgw[0];
+
+      callthis(buf,buflen,xpos,ypos-desc);
+
+      if (underline_at && underline_at >= buf && underline_at < (buf + buflen))
+	callthis("_",1,xpos+int(fltk3::width(buf,underline_at-buf)),ypos-desc);
+
+      if (!*e || (*e == '@' && e[1] != '@')) break;
+      p = e;
+    }
+  }
+
+  // draw the image if the "text over image" alignment flag is set...
+  if (img && imgvert && (align & fltk3::ALIGN_TEXT_OVER_IMAGE)) {
+    if (img->w() > symoffset) symoffset = img->w();
+
+    if (align & fltk3::ALIGN_LEFT) xpos = x + symwidth[0];
+    else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - img->w() - symwidth[1];
+    else xpos = x + (w - img->w() - symtotal) / 2 + symwidth[0];
+
+    img->draw(xpos, ypos);
+  }
+
+  // draw the symbols, if any...
+  if (symwidth[0]) {
+    // draw to the left
+    if (align & fltk3::ALIGN_LEFT) xpos = x;
+    else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - symtotal - symoffset;
+    else xpos = x + (w - symoffset - symtotal) / 2;
+
+    if (align & fltk3::ALIGN_BOTTOM) ypos = y + h - symwidth[0];
+    else if (align & fltk3::ALIGN_TOP) ypos = y;
+    else ypos = y + (h - symwidth[0]) / 2;
+
+    fltk3::draw_symbol(symbol[0], xpos, ypos, symwidth[0], symwidth[0], fltk3::color());
+  }
+
+  if (symwidth[1]) {
+    // draw to the right
+    if (align & fltk3::ALIGN_LEFT) xpos = x + symoffset + symwidth[0];
+    else if (align & fltk3::ALIGN_RIGHT) xpos = x + w - symwidth[1];
+    else xpos = x + (w - symoffset - symtotal) / 2 + symoffset + symwidth[0];
+
+    if (align & fltk3::ALIGN_BOTTOM) ypos = y + h - symwidth[1];
+    else if (align & fltk3::ALIGN_TOP) ypos = y;
+    else ypos = y + (h - symwidth[1]) / 2;
+
+    fltk3::draw_symbol(symbol[1], xpos, ypos, symwidth[1], symwidth[1], fltk3::color());
+  }
+}
+
+/**
+  Fancy string drawing function which is used to draw all the labels.
+
+  The string is formatted and aligned inside the passed box.
+  Handles '\\t' and '\\n', expands all other control characters to '^X',
+  and aligns inside or against the edges of the box.
+  See fltk3::Widget::align() for values of \p align. The value fltk3::ALIGN_INSIDE
+  is ignored, as this function always prints inside the box.
+  If \p img is provided and is not \p NULL, the image is drawn above or
+  below the text as specified by the \p align value.
+  The \p draw_symbols argument specifies whether or not to look for symbol
+  names starting with the '\@' character'
+  The text length is limited to 1024 characters per line.
+*/
+void fltk3::draw(
+  const char* str,
+  int x, int y, int w, int h,
+  fltk3::Align align,
+  fltk3::Image* img,
+  int draw_symbols)
+{
+  if ((!str || !*str) && !img) return;
+  if (w && h && !fltk3::not_clipped(x, y, w, h) && (align & fltk3::ALIGN_INSIDE)) return;
+  if (align & fltk3::ALIGN_CLIP) 
+    fltk3::push_clip(x, y, w, h);
+  fltk3::draw(str, x, y, w, h, align, fltk3::draw, img, draw_symbols);
+  if (align & fltk3::ALIGN_CLIP) 
+    fltk3::pop_clip();
+}
+
+/**
+  Measure how wide and tall the string will be when printed by the
+  fltk3::draw() function with \p align parameter. If the incoming \p w
+  is non-zero it will wrap to that width.
+  \param[in] str nul-terminated string
+  \param[out] w,h width and height of string in current font
+  \param[in] draw_symbols non-zero to enable @@symbol handling [default=1]
+*/
+void fltk3::measure(const char* str, int& w, int& h, int draw_symbols) {
+  if (!str || !*str) {w = 0; h = 0; return;}
+  h = fltk3::height();
+  const char* p;
+  const char* e;
+  char buf[MAXBUF];
+  int buflen;
+  int lines;
+  double width=0;
+  int W = 0;
+  char symbol[2][255], *symptr;
+  int symwidth[2], symtotal;
+
+  // count how many lines and put the last one into the buffer:
+  symbol[0][0] = '\0';
+  symwidth[0]  = 0;
+
+  symbol[1][0] = '\0';
+  symwidth[1]  = 0;
+
+  if (draw_symbols) {
+    if (str && str[0] == '@' && str[1] && str[1] != '@') {
+      // Start with a symbol...
+      for (symptr = symbol[0];
+           *str && !isspace(*str) && symptr < (symbol[0] + sizeof(symbol[0]) - 1);
+           *symptr++ = *str++);
+      *symptr = '\0';
+      if (isspace(*str)) str++;
+      symwidth[0] = h;
+    }
+
+    if (str && (p = strrchr(str, '@')) != NULL && p > (str + 1) && p[-1]!='@') {
+      strlcpy(symbol[1], p, sizeof(symbol[1]));
+      symwidth[1] = h;
+    }
+  }
+
+  symtotal = symwidth[0] + symwidth[1];
+  
+  for (p = str, lines=0; p;) {
+//    e = expand(p, buf, w - symtotal, buflen, width, w != 0, draw_symbols);
+    e = fltk3::expand_text(p, buf, MAXBUF, w - symtotal, buflen, width, 
+			w != 0, draw_symbols);
+    if ((int)ceil(width) > W) W = (int)ceil(width);
+    lines++;
+    if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
+    p = e;
+  }
+
+  if ((symwidth[0] || symwidth[1]) && lines) {
+    if (symwidth[0]) symwidth[0] = lines * fltk3::height();
+    if (symwidth[1]) symwidth[1] = lines * fltk3::height();
+  }
+
+  symtotal = symwidth[0] + symwidth[1];
+
+  w = W + symtotal;
+  h = lines*h;
+}
+
+/**
+  This function returns the actual height of the specified \p font
+  and \p size. Normally the font height should always be 'size',
+  but with the advent of XFT, there are (currently) complexities
+  that seem to only be solved by asking the font what its actual
+  font height is. (See STR#2115)
+  
+  This function was originally undocumented in 1.1.x, and was used
+  only by fltk3::TextDisplay. We're now documenting it in 1.3.x so that
+  apps that need precise height info can get it with this function.
+
+  \returns the height of the font in pixels.
+  
+  \todo  In the future, when the XFT issues are resolved, this function
+         should simply return the 'size' value.
+*/
+int fltk3::height(int font, int size) {
+    if ( font == fltk3::font() && size == fltk3::size() ) return(fltk3::height());
+    int tf = fltk3::font(), ts = fltk3::size();   // save
+    fltk3::font(font,size);
+    int height = fltk3::height();
+    fltk3::font(tf,ts);                       // restore
+    return(height);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/draw_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_draw_image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/draw_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/draw_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,578 @@
+//
+// "$Id$"
+//
+// Image drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// I hope a simple and portable method of drawing color and monochrome
+// images.  To keep this simple, only a single storage type is
+// supported: 8 bit unsigned data, byte order RGB, and pixels are
+// stored packed into rows with the origin at the top-left.  It is
+// possible to alter the size of pixels with the "delta" argument, to
+// add alpha or other information per pixel.  It is also possible to
+// change the origin and direction of the image data by messing with
+// the "delta" and "linedelta", making them negative, though this may
+// defeat some of the shortcuts in translating the image for X.
+
+#ifdef WIN32
+#  include "win32_draw_image.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_draw_image.cxx"
+#else
+
+// A list of assumptions made about the X display:
+
+// bits_per_pixel must be one of 8, 16, 24, 32.
+
+// scanline_pad must be a power of 2 and greater or equal to 8.
+
+// PsuedoColor visuals must have 8 bits_per_pixel (although the depth
+// may be less than 8).  This is the only limitation that affects any
+// modern X displays, you can't use 12 or 16 bit colormaps.
+
+// The mask bits in TrueColor visuals for each color are
+// contiguous and have at least one bit of each color.  This
+// is not checked for.
+
+// For 24 and 32 bit visuals there must be at least 8 bits of each color.
+
+////////////////////////////////////////////////////////////////
+
+#  include <fltk3/run.h>
+#  include <fltk3/draw.h>
+#  include <fltk3/x.h>
+#  include "Fl_XColor.H"
+#  include "flstring.h"
+
+static XImage xi;	// template used to pass info to X
+static int bytes_per_pixel;
+static int scanline_add;
+static int scanline_mask;
+
+static void (*converter)(const uchar *from, uchar *to, int w, int delta);
+static void (*mono_converter)(const uchar *from, uchar *to, int w, int delta);
+
+static int dir;		// direction-alternator
+static int ri,gi,bi;	// saved error-diffusion value
+
+#  if USE_COLORMAP
+////////////////////////////////////////////////////////////////
+// 8-bit converter with error diffusion
+
+static void color8_converter(const uchar *from, uchar *to, int w, int delta) {
+  int r=ri, g=gi, b=bi;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    to = to+(w-1);
+    d = -delta;
+    td = -1;
+  } else {
+    dir = 1;
+    d = delta;
+    td = 1;
+  }
+  for (; w--; from += d, to += td) {
+    r += from[0]; if (r < 0) r = 0; else if (r>255) r = 255;
+    g += from[1]; if (g < 0) g = 0; else if (g>255) g = 255;
+    b += from[2]; if (b < 0) b = 0; else if (b>255) b = 255;
+    fltk3::Color i = fltk3::color_cube(r*fltk3::NUM_RED/256,g*fltk3::NUM_GREEN/256,b*fltk3::NUM_BLUE/256);
+    Fl_XColor& xmap = fl_xmap[0][i];
+    if (!xmap.mapped) {if (!fl_redmask) fl_xpixel(r,g,b); else fl_xpixel(i);}
+    r -= xmap.r;
+    g -= xmap.g;
+    b -= xmap.b;
+    *to = uchar(xmap.pixel);
+  }
+  ri = r; gi = g; bi = b;
+}
+
+static void mono8_converter(const uchar *from, uchar *to, int w, int delta) {
+  int r=ri, g=gi, b=bi;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    to = to+(w-1);
+    d = -delta;
+    td = -1;
+  } else {
+    dir = 1;
+    d = delta;
+    td = 1;
+  }
+  for (; w--; from += d, to += td) {
+    r += from[0]; if (r < 0) r = 0; else if (r>255) r = 255;
+    g += from[0]; if (g < 0) g = 0; else if (g>255) g = 255;
+    b += from[0]; if (b < 0) b = 0; else if (b>255) b = 255;
+    fltk3::Color i = fltk3::color_cube(r*fltk3::NUM_RED/256,g*fltk3::NUM_GREEN/256,b*fltk3::NUM_BLUE/256);
+    Fl_XColor& xmap = fl_xmap[0][i];
+    if (!xmap.mapped) {if (!fl_redmask) fl_xpixel(r,g,b); else fl_xpixel(i);}
+    r -= xmap.r;
+    g -= xmap.g;
+    b -= xmap.b;
+    *to = uchar(xmap.pixel);
+  }
+  ri = r; gi = g; bi = b;
+}
+
+#  endif
+
+////////////////////////////////////////////////////////////////
+// 16 bit TrueColor converters with error diffusion
+// Cray computers have no 16-bit type, so we use character pointers
+// (which may be slow)
+
+#  ifdef U16
+#    define OUTTYPE U16
+#    define OUTSIZE 1
+#    define OUTASSIGN(v) *t = v
+#  else
+#    define OUTTYPE uchar
+#    define OUTSIZE 2
+#    define OUTASSIGN(v) int tt=v; t[0] = uchar(tt>>8); t[1] = uchar(tt)
+#  endif
+
+static void color16_converter(const uchar *from, uchar *to, int w, int delta) {
+  OUTTYPE *t = (OUTTYPE *)to;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    t = t+(w-1)*OUTSIZE;
+    d = -delta;
+    td = -OUTSIZE;
+  } else {
+    dir = 1;
+    d = delta;
+    td = OUTSIZE;
+  }
+  int r=ri, g=gi, b=bi;
+  for (; w--; from += d, t += td) {
+    r = (r&~fl_redmask)  +from[0]; if (r>255) r = 255;
+    g = (g&~fl_greenmask)+from[1]; if (g>255) g = 255;
+    b = (b&~fl_bluemask) +from[2]; if (b>255) b = 255;
+    OUTASSIGN((
+      ((r&fl_redmask)<<fl_redshift)+
+      ((g&fl_greenmask)<<fl_greenshift)+
+      ((b&fl_bluemask)<<fl_blueshift)
+      ) >> fl_extrashift);
+  }
+  ri = r; gi = g; bi = b;
+}
+
+static void mono16_converter(const uchar *from,uchar *to,int w, int delta) {
+  OUTTYPE *t = (OUTTYPE *)to;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    t = t+(w-1)*OUTSIZE;
+    d = -delta;
+    td = -OUTSIZE;
+  } else {
+    dir = 1;
+    d = delta;
+    td = OUTSIZE;
+  }
+  uchar mask = fl_redmask & fl_greenmask & fl_bluemask;
+  int r=ri;
+  for (; w--; from += d, t += td) {
+    r = (r&~mask) + *from; if (r > 255) r = 255;
+    uchar m = r&mask;
+    OUTASSIGN((
+      (m<<fl_redshift)+
+      (m<<fl_greenshift)+
+      (m<<fl_blueshift)
+      ) >> fl_extrashift);
+  }
+  ri = r;
+}
+
+// special-case the 5r6g5b layout used by XFree86:
+
+static void c565_converter(const uchar *from, uchar *to, int w, int delta) {
+  OUTTYPE *t = (OUTTYPE *)to;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    t = t+(w-1)*OUTSIZE;
+    d = -delta;
+    td = -OUTSIZE;
+  } else {
+    dir = 1;
+    d = delta;
+    td = OUTSIZE;
+  }
+  int r=ri, g=gi, b=bi;
+  for (; w--; from += d, t += td) {
+    r = (r&7)+from[0]; if (r>255) r = 255;
+    g = (g&3)+from[1]; if (g>255) g = 255;
+    b = (b&7)+from[2]; if (b>255) b = 255;
+    OUTASSIGN(((r&0xf8)<<8) + ((g&0xfc)<<3) + (b>>3));
+  }
+  ri = r; gi = g; bi = b;
+}
+
+static void m565_converter(const uchar *from,uchar *to,int w, int delta) {
+  OUTTYPE *t = (OUTTYPE *)to;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    t = t+(w-1)*OUTSIZE;
+    d = -delta;
+    td = -OUTSIZE;
+  } else {
+    dir = 1;
+    d = delta;
+    td = OUTSIZE;
+  }
+  int r=ri;
+  for (; w--; from += d, t += td) {
+    r = (r&7) + *from; if (r > 255) r = 255;
+    OUTASSIGN((r>>3) * 0x841);
+  }
+  ri = r;
+}
+
+////////////////////////////////////////////////////////////////
+// 24bit TrueColor converters:
+
+static void rgb_converter(const uchar *from, uchar *to, int w, int delta) {
+  int d = delta-3;
+  for (; w--; from += d) {
+    *to++ = *from++;
+    *to++ = *from++;
+    *to++ = *from++;
+  }
+}
+
+static void bgr_converter(const uchar *from, uchar *to, int w, int delta) {
+  for (; w--; from += delta) {
+    uchar r = from[0];
+    uchar g = from[1];
+    *to++ = from[2];
+    *to++ = g;
+    *to++ = r;
+  }
+}
+
+static void rrr_converter(const uchar *from, uchar *to, int w, int delta) {
+  for (; w--; from += delta) {
+    *to++ = *from;
+    *to++ = *from;
+    *to++ = *from;
+  }
+}
+
+////////////////////////////////////////////////////////////////
+// 32bit TrueColor converters on a 32 or 64-bit machine:
+
+#  ifdef U64
+#    define STORETYPE U64
+#    if WORDS_BIGENDIAN
+#      define INNARDS32(f) \
+  U64 *t = (U64*)to; \
+  int w1 = w/2; \
+  for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = (i<<32)|(f);} \
+  if (w&1) *t++ = (U64)(f)<<32;
+#    else
+#      define INNARDS32(f) \
+  U64 *t = (U64*)to; \
+  int w1 = w/2; \
+  for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = ((U64)(f)<<32)|i;} \
+  if (w&1) *t++ = (U64)(f);
+#    endif
+#  else
+#    define STORETYPE U32
+#    define INNARDS32(f) \
+  U32 *t = (U32*)to; for (; w--; from += delta) *t++ = f
+#  endif
+
+static void rgbx_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32((unsigned(from[0])<<24)+(from[1]<<16)+(from[2]<<8));
+}
+
+static void xbgr_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32((from[0])+(from[1]<<8)+(from[2]<<16));
+}
+
+static void xrgb_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32((from[0]<<16)+(from[1]<<8)+(from[2]));
+}
+
+static void bgrx_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32((from[0]<<8)+(from[1]<<16)+(unsigned(from[2])<<24));
+}
+
+static void rrrx_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32(unsigned(*from) * 0x1010100U);
+}
+
+static void xrrr_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32(*from * 0x10101U);
+}
+
+static void
+color32_converter(const uchar *from, uchar *to, int w, int delta) {
+  INNARDS32(
+    (from[0]<<fl_redshift)+(from[1]<<fl_greenshift)+(from[2]<<fl_blueshift));
+}
+
+static void
+mono32_converter(const uchar *from,uchar *to,int w, int delta) {
+  INNARDS32(
+    (*from << fl_redshift)+(*from << fl_greenshift)+(*from << fl_blueshift));
+}
+
+////////////////////////////////////////////////////////////////
+
+static void figure_out_visual() {
+
+  fl_xpixel(fltk3::BLACK); // setup fl_redmask, etc, in fltk3::color.cxx
+  fl_xpixel(fltk3::WHITE); // also make sure white is allocated
+
+  static XPixmapFormatValues *pfvlist;
+  static int NUM_pfv;
+  if (!pfvlist) pfvlist = XListPixmapFormats(fl_display,&NUM_pfv);
+  XPixmapFormatValues *pfv;
+  for (pfv = pfvlist; pfv < pfvlist+NUM_pfv; pfv++)
+    if (pfv->depth == fl_visual->depth) break;
+  xi.format = ZPixmap;
+  xi.byte_order = ImageByteOrder(fl_display);
+//i.bitmap_unit = 8;
+//i.bitmap_bit_order = MSBFirst;
+//i.bitmap_pad = 8;
+  xi.depth = fl_visual->depth;
+  xi.bits_per_pixel = pfv->bits_per_pixel;
+
+  if (xi.bits_per_pixel & 7) bytes_per_pixel = 0; // produce fatal error
+  else bytes_per_pixel = xi.bits_per_pixel/8;
+
+  unsigned int n = pfv->scanline_pad/8;
+  if (pfv->scanline_pad & 7 || (n&(n-1)))
+    fltk3::fatal("Can't do scanline_pad of %d",pfv->scanline_pad);
+  if (n < sizeof(STORETYPE)) n = sizeof(STORETYPE);
+  scanline_add = n-1;
+  scanline_mask = -n;
+
+#  if USE_COLORMAP
+  if (bytes_per_pixel == 1) {
+    converter = color8_converter;
+    mono_converter = mono8_converter;
+    return;
+  }
+  if (!fl_visual->red_mask)
+    fltk3::fatal("Can't do %d bits_per_pixel colormap",xi.bits_per_pixel);
+#  endif
+
+  // otherwise it is a TrueColor visual:
+
+  int rs = fl_redshift;
+  int gs = fl_greenshift;
+  int bs = fl_blueshift;
+
+  switch (bytes_per_pixel) {
+
+  case 2:
+    // All 16-bit TrueColor visuals are supported on any machine with
+    // 24 or more bits per integer.
+#  ifdef U16
+    xi.byte_order = WORDS_BIGENDIAN;
+#  else
+    xi.byte_order = 1;
+#  endif
+    if (rs == 11 && gs == 6 && bs == 0 && fl_extrashift == 3) {
+      converter = c565_converter;
+      mono_converter = m565_converter;
+    } else {
+      converter = color16_converter;
+      mono_converter = mono16_converter;
+    }
+    break;
+
+  case 3:
+    if (xi.byte_order) {rs = 16-rs; gs = 16-gs; bs = 16-bs;}
+    if (rs == 0 && gs == 8 && bs == 16) {
+      converter = rgb_converter;
+      mono_converter = rrr_converter;
+    } else if (rs == 16 && gs == 8 && bs == 0) {
+      converter = bgr_converter;
+      mono_converter = rrr_converter;
+    } else {
+      fltk3::fatal("Can't do arbitrary 24bit color");
+    }
+    break;
+
+  case 4:
+    if ((xi.byte_order!=0) != WORDS_BIGENDIAN)
+      {rs = 24-rs; gs = 24-gs; bs = 24-bs;}
+    if (rs == 0 && gs == 8 && bs == 16) {
+      converter = xbgr_converter;
+      mono_converter = xrrr_converter;
+    } else if (rs == 24 && gs == 16 && bs == 8) {
+      converter = rgbx_converter;
+      mono_converter = rrrx_converter;
+    } else if (rs == 8 && gs == 16 && bs == 24) {
+      converter = bgrx_converter;
+      mono_converter = rrrx_converter;
+    } else if (rs == 16 && gs == 8 && bs == 0) {
+      converter = xrgb_converter;
+      mono_converter = xrrr_converter;
+    } else {
+      xi.byte_order = WORDS_BIGENDIAN;
+      converter = color32_converter;
+      mono_converter = mono32_converter;
+    }
+    break;
+
+  default:
+    fltk3::fatal("Can't do %d bits_per_pixel",xi.bits_per_pixel);
+  }
+
+}
+
+#  define MAXBUFFER 0x40000 // 256k
+
+static void innards(const uchar *buf, int X, int Y, int W, int H,
+		    int delta, int linedelta, int mono,
+		    fltk3::DrawImageCb cb, void* userdata)
+{
+  if (!linedelta) linedelta = W*delta;
+
+  int dx, dy, w, h;
+  fltk3::clip_box(X,Y,W,H,dx,dy,w,h);
+  if (w<=0 || h<=0) return;
+  dx -= X;
+  dy -= Y;
+
+  if (!bytes_per_pixel) figure_out_visual();
+  xi.width = w;
+  xi.height = h;
+
+  void (*conv)(const uchar *from, uchar *to, int w, int delta) = converter;
+  if (mono) conv = mono_converter;
+
+  // See if the data is already in the right format.  Unfortunately
+  // some 32-bit x servers (XFree86) care about the unknown 8 bits
+  // and they must be zero.  I can't confirm this for user-supplied
+  // data, so the 32-bit shortcut is disabled...
+  // This can set bytes_per_line negative if image is bottom-to-top
+  // I tested it on Linux, but it may fail on other Xlib implementations:
+  if (buf && (
+#  if 0	// set this to 1 to allow 32-bit shortcut
+      delta == 4 &&
+#    if WORDS_BIGENDIAN
+      conv == rgbx_converter
+#    else
+      conv == xbgr_converter
+#    endif
+      ||
+#  endif
+      conv == rgb_converter && delta==3
+      ) && !(linedelta&scanline_add)) {
+    xi.data = (char *)(buf+delta*dx+linedelta*dy);
+    xi.bytes_per_line = linedelta;
+
+  } else {
+    int linesize = ((w*bytes_per_pixel+scanline_add)&scanline_mask)/sizeof(STORETYPE);
+    int blocking = h;
+    static STORETYPE *buffer;	// our storage, always word aligned
+    static long buffer_size;
+    {int size = linesize*h;
+    if (size > MAXBUFFER) {
+      size = MAXBUFFER;
+      blocking = MAXBUFFER/linesize;
+    }
+    if (size > buffer_size) {
+      delete[] buffer;
+      buffer_size = size;
+      buffer = new STORETYPE[size];
+    }}
+    xi.data = (char *)buffer;
+    xi.bytes_per_line = linesize*sizeof(STORETYPE);
+    if (buf) {
+      buf += delta*dx+linedelta*dy;
+      for (int j=0; j<h; ) {
+	STORETYPE *to = buffer;
+	int k;
+	for (k = 0; j<h && k<blocking; k++, j++) {
+	  conv(buf, (uchar*)to, w, delta);
+	  buf += linedelta;
+	  to += linesize;
+	}
+	XPutImage(fl_display,fl_window,fl_gc, &xi, 0, 0, X+dx, Y+dy+j-k, w, k);
+      }
+    } else {
+      STORETYPE* linebuf = new STORETYPE[(W*delta+(sizeof(STORETYPE)-1))/sizeof(STORETYPE)];
+      for (int j=0; j<h; ) {
+	STORETYPE *to = buffer;
+	int k;
+	for (k = 0; j<h && k<blocking; k++, j++) {
+	  cb(userdata, dx, dy+j, w, (uchar*)linebuf);
+	  conv((uchar*)linebuf, (uchar*)to, w, delta);
+	  to += linesize;
+	}
+	XPutImage(fl_display,fl_window,fl_gc, &xi, 0, 0, X+dx, Y+dy+j-k, w, k);
+      }
+
+      delete[] linebuf;
+    }
+  }
+}
+
+void fltk3::XlibGraphicsDriver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
+}
+void fltk3::XlibGraphicsDriver::draw_image(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+}
+void fltk3::XlibGraphicsDriver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  innards(buf,x,y,w,h,d,l,1,0,0);
+}
+void fltk3::XlibGraphicsDriver::draw_image_mono(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  innards(0,x,y,w,h,d,0,1,cb,data);
+}
+
+void fltk3::rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
+  if (fl_visual->depth > 16) {
+    fltk3::color(r,g,b);
+    fltk3::rectf(x,y,w,h);
+  } else {
+    uchar c[3];
+    c[0] = r; c[1] = g; c[2] = b;
+    innards(c,x,y,w,h,0,0,0,0,0);
+  }
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/draw_pixmap.cxx (from rev 9002, branches/branch-3.0/src/core/fl_draw_pixmap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/draw_pixmap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/draw_pixmap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,429 @@
+//
+// "$Id$"
+//
+// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Implemented without using the xpm library (which I can't use because
+// it interferes with the color cube used by fltk3::draw_image).
+// Current implementation is cheap and slow, and works best on a full-color
+// display.  Transparency is not handled, and colors are dithered to
+// the color cube.  Color index is achieved by adding the id
+// characters together!  Also mallocs a lot of temporary memory!
+// Notice that there is no pixmap file interface.  This is on purpose,
+// as I want to discourage programs that require support files to work.
+// All data needed by a program ui should be compiled in!!!
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <stdio.h>
+#include "flstring.h"
+
+static int ncolors, chars_per_pixel;
+
+/**
+  Get the dimensions of a pixmap.
+  An XPM image contains the dimensions in its data. This function
+  returns te width and height.
+  \param[in]  data pointer to XPM image data.
+  \param[out] w,h  width and height of image
+  \returns non-zero if the dimensions were parsed OK
+  \returns 0 if there were any problems
+  */
+int fltk3::measure_pixmap(/*const*/ char* const* data, int &w, int &h) {
+  return fltk3::measure_pixmap((const char*const*)data,w,h);
+}
+
+/**
+  Get the dimensions of a pixmap.
+  \see fltk3::measure_pixmap(char* const* data, int &w, int &h)
+  */
+int fltk3::measure_pixmap(const char * const *cdata, int &w, int &h) {
+  int i = sscanf(cdata[0],"%d%d%d%d",&w,&h,&ncolors,&chars_per_pixel);
+  if (i<4 || w<=0 || h<=0 ||
+      (chars_per_pixel!=1 && chars_per_pixel!=2) ) return w=0;
+  return 1;
+}
+
+#ifdef U64
+
+// The callback from fltk3::draw_image to get a row of data passes this:
+struct pixmap_data {
+  int w, h;
+  const uchar*const* data;
+  union {
+    U64 colors[256];
+    U64* byte1[256];
+  };
+};
+
+// callback for 1 byte per pixel:
+static void cb1(void*v, int x, int y, int w, uchar* buf) {
+  pixmap_data& d = *(pixmap_data*)v;
+  const uchar* p = d.data[y]+x;
+  U64* q = (U64*)buf;
+  for (int X=w; X>0; X-=2, p += 2) {
+    if (X>1) {
+#  if WORDS_BIGENDIAN
+      *q++ = (d.colors[p[0]]<<32) | d.colors[p[1]];
+#  else
+      *q++ = (d.colors[p[1]]<<32) | d.colors[p[0]];
+#  endif
+    } else {
+#  if WORDS_BIGENDIAN
+      *q++ = d.colors[p[0]]<<32;
+#  else
+      *q++ = d.colors[p[0]];
+#  endif
+    }
+  }
+}
+
+// callback for 2 bytes per pixel:
+static void cb2(void*v, int x, int y, int w, uchar* buf) {
+  pixmap_data& d = *(pixmap_data*)v;
+  const uchar* p = d.data[y]+2*x;
+  U64* q = (U64*)buf;
+  for (int X=w; X>0; X-=2) {
+    U64* colors = d.byte1[*p++];
+    int index = *p++;
+    if (X>1) {
+      U64* colors1 = d.byte1[*p++];
+      int index1 = *p++;
+#  if WORDS_BIGENDIAN
+      *q++ = (colors[index]<<32) | colors1[index1];
+#  else
+      *q++ = (colors1[index1]<<32) | colors[index];
+#  endif
+    } else {
+#  if WORDS_BIGENDIAN
+      *q++ = colors[index]<<32;
+#  else
+      *q++ = colors[index];
+#  endif
+    }
+  }
+}
+
+#else // U32
+
+// The callback from fltk3::draw_image to get a row of data passes this:
+struct pixmap_data {
+  int w, h;
+  const uchar*const* data;
+  union {
+    U32 colors[256];
+    U32* byte1[256];
+  };
+};
+
+// callback for 1 byte per pixel:
+static void cb1(void*v, int x, int y, int w, uchar* buf) {
+  pixmap_data& d = *(pixmap_data*)v;
+  const uchar* p = d.data[y]+x;
+  U32* q = (U32*)buf;
+  for (int X=w; X--;) *q++ = d.colors[*p++];
+}
+
+// callback for 2 bytes per pixel:
+static void cb2(void*v, int x, int y, int w, uchar* buf) {
+  pixmap_data& d = *(pixmap_data*)v;
+  const uchar* p = d.data[y]+2*x;
+  U32* q = (U32*)buf;
+  for (int X=w; X--;) {
+    U32* colors = d.byte1[*p++];
+    *q++ = colors[*p++];
+  }
+}
+
+#endif // U64 else U32
+
+uchar **fl_mask_bitmap; // if non-zero, create bitmap and store pointer here
+
+/**
+  Draw XPM image data, with the top-left corner at the given position.
+  The image is dithered on 8-bit displays so you won't lose color
+  space for programs displaying both images and pixmaps.
+  \param[in] data pointer to XPM image data
+  \param[in] x,y  position of top-left corner
+  \param[in] bg   background color
+  \returns 0 if there was any error decoding the XPM data.
+  */
+int fltk3::draw_pixmap(/*const*/ char* const* data, int x,int y,fltk3::Color bg) {
+  return fltk3::draw_pixmap((const char*const*)data,x,y,bg);
+}
+
+#ifdef WIN32
+// to compute an unused color to be used for the pixmap background
+FLTK3_EXPORT UINT win_pixmap_bg_color; // the RGB() of the pixmap background color
+static int color_count; // # of non-transparent colors used in pixmap
+static uchar *used_colors; // used_colors[3*i+j] j=0,1,2 are the RGB values of the ith used color
+
+static void make_unused_color(uchar &r, uchar &g, uchar &b)
+// makes an RGB triplet different from all the colors used in the pixmap
+// and compute win_pixmap_bg_color from this triplet
+{
+  int i;
+  r = 2; g = 3; b = 4;
+  while (1) {
+    for ( i = 0; i < color_count; i++) {
+      if(used_colors[3*i] == r && used_colors[3*i+1] == g && used_colors[3*i+2] == b) break;
+      }
+    if (i >= color_count) {
+      free(used_colors);
+      win_pixmap_bg_color = RGB(r, g, b);
+      return;
+      }
+    if (r < 255) r++;
+    else {
+      r = 0;
+      if (g < 255) g++;
+      else {
+	g = 0;
+	b++;
+	}
+      }
+    }
+}
+#endif
+
+/**
+  Draw XPM image data, with the top-left corner at the given position.
+  \see fltk3::draw_pixmap(char* const* data, int x, int y, fltk3::Color bg)
+  */
+int fltk3::draw_pixmap(const char*const* cdata, int x, int y, fltk3::Color bg) {
+  pixmap_data d;
+  if (!fltk3::measure_pixmap(cdata, d.w, d.h)) return 0;
+  const uchar*const* data = (const uchar*const*)(cdata+1);
+  int transparent_index = -1;
+  uchar *transparent_c = (uchar *)0; // such that transparent_c[0,1,2] are the RGB of the transparent color
+#ifdef WIN32
+  color_count = 0;
+  used_colors = (uchar *)malloc(abs(ncolors)*3*sizeof(uchar));
+#endif
+
+  if (ncolors < 0) {	// FLTK (non standard) compressed colormap
+    ncolors = -ncolors;
+    const uchar *p = *data++;
+    // if first color is ' ' it is transparent (put it later to make
+    // it not be transparent):
+    if (*p == ' ') {
+      uchar* c = (uchar*)&d.colors[(int)' '];
+#ifdef U64
+      *(U64*)c = 0;
+#  if WORDS_BIGENDIAN
+      c += 4;
+#  endif
+#endif
+      transparent_index = ' ';
+      fltk3::get_color(bg, c[0], c[1], c[2]); c[3] = 0;
+      transparent_c = c;
+      p += 4;
+      ncolors--;
+    }
+    // read all the rest of the colors:
+    for (int i=0; i < ncolors; i++) {
+      uchar* c = (uchar*)&d.colors[*p++];
+#ifdef U64
+      *(U64*)c = 0;
+#  if WORDS_BIGENDIAN
+      c += 4;
+#  endif
+#endif
+#ifdef WIN32
+      used_colors[3*color_count] = *p;
+      used_colors[3*color_count+1] = *(p+1);
+      used_colors[3*color_count+2] = *(p+2);
+      color_count++;
+#endif
+      *c++ = *p++;
+      *c++ = *p++;
+      *c++ = *p++;
+#ifdef __APPLE_QUARTZ__
+      *c = 255;
+#else
+      *c = 0;
+#endif
+    }
+  } else {	// normal XPM colormap with names
+    if (chars_per_pixel>1) memset(d.byte1, 0, sizeof(d.byte1));
+    for (int i=0; i<ncolors; i++) {
+      const uchar *p = *data++;
+      // the first 1 or 2 characters are the color index:
+      int ind = *p++;
+      uchar* c;
+      if (chars_per_pixel>1) {
+#ifdef U64
+	U64* colors = d.byte1[ind];
+	if (!colors) colors = d.byte1[ind] = new U64[256];
+#else
+	U32* colors = d.byte1[ind];
+	if (!colors) colors = d.byte1[ind] = new U32[256];
+#endif
+	c = (uchar*)&colors[*p];
+	ind = (ind<<8)|*p++;
+      } else {
+	c = (uchar *)&d.colors[ind];
+      }
+      // look for "c word", or last word if none:
+      const uchar *previous_word = p;
+      for (;;) {
+	while (*p && isspace(*p)) p++;
+	uchar what = *p++;
+	while (*p && !isspace(*p)) p++;
+	while (*p && isspace(*p)) p++;
+	if (!*p) {p = previous_word; break;}
+	if (what == 'c') break;
+	previous_word = p;
+	while (*p && !isspace(*p)) p++;
+      }
+#ifdef U64
+      *(U64*)c = 0;
+#  if WORDS_BIGENDIAN
+      c += 4;
+#  endif
+#endif
+#ifdef __APPLE_QUARTZ__
+      c[3] = 255;
+#endif
+      int parse = fl_parse_color((const char*)p, c[0], c[1], c[2]);
+      if (parse) {
+#ifdef WIN32
+	used_colors[3*color_count] = c[0];
+	used_colors[3*color_count+1] = c[1];
+	used_colors[3*color_count+2] = c[2];
+	color_count++;
+#endif
+	}
+      else {
+        // assume "None" or "#transparent" for any errors
+	// "bg" should be transparent...
+	fltk3::get_color(bg, c[0], c[1], c[2]);
+#ifdef __APPLE_QUARTZ__
+        c[3] = 0;
+#endif
+	transparent_index = ind;
+	transparent_c = c;
+      }
+    }
+  }
+  d.data = data;
+#ifdef WIN32
+  if (transparent_c) {
+    make_unused_color(transparent_c[0], transparent_c[1], transparent_c[2]);
+  }
+  else {
+    uchar r, g, b;
+    make_unused_color(r, g, b);
+  }
+#endif
+  
+#ifdef  __APPLE_QUARTZ__
+  if (fltk3::graphics_driver->class_name() == fltk3::QuartzGraphicsDriver::class_id ) {
+    bool transparent = (transparent_index>=0);
+    transparent = true;
+    U32 *array = new U32[d.w * d.h], *q = array;
+    for (int Y = 0; Y < d.h; Y++) {
+      const uchar* p = data[Y];
+      if (chars_per_pixel <= 1) {
+	for (int X = 0; X < d.w; X++) {
+	  *q++ = d.colors[*p++];
+	}
+      } else {
+	for (int X = 0; X < d.w; X++) {
+	  U32* colors = (U32*)d.byte1[*p++];
+	  *q++ = colors[*p++];
+	}
+      }
+    }
+    CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
+    CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, d.w * d.h * 4, 0L);
+    CGImageRef img = CGImageCreate(d.w, d.h, 8, 4*8, 4*d.w,
+				   lut, transparent?kCGImageAlphaLast:kCGImageAlphaNoneSkipLast,
+				   src, 0L, false, kCGRenderingIntentDefault);
+    CGColorSpaceRelease(lut);
+    CGDataProviderRelease(src);
+    CGRect rect = { { x, y} , { d.w, d.h } };
+    Fl_X::q_begin_image(rect, 0, 0, d.w, d.h);
+    CGContextDrawImage(fl_gc, rect, img);
+    Fl_X::q_end_image();
+    CGImageRelease(img);
+    delete[] array;
+    }
+  else {
+#endif // __APPLE_QUARTZ__
+
+  // build the mask bitmap used by fltk3::Pixmap:
+  if (fl_mask_bitmap && transparent_index >= 0) {
+    int W = (d.w+7)/8;
+    uchar* bitmap = new uchar[W * d.h];
+    *fl_mask_bitmap = bitmap;
+    for (int Y = 0; Y < d.h; Y++) {
+      const uchar* p = data[Y];
+      if (chars_per_pixel <= 1) {
+	int dw = d.w;
+	for (int X = 0; X < W; X++) {
+	  uchar b = (dw-->0 && *p++ != transparent_index);
+	  if (dw-->0 && *p++ != transparent_index) b |= 2;
+	  if (dw-->0 && *p++ != transparent_index) b |= 4;
+	  if (dw-->0 && *p++ != transparent_index) b |= 8;
+	  if (dw-->0 && *p++ != transparent_index) b |= 16;
+	  if (dw-->0 && *p++ != transparent_index) b |= 32;
+	  if (dw-->0 && *p++ != transparent_index) b |= 64;
+	  if (dw-->0 && *p++ != transparent_index) b |= 128;
+	  *bitmap++ = b;
+	}
+      } else {
+        uchar b = 0, bit = 1;
+	for (int X = 0; X < d.w; X++) {
+	  int ind = *p++;
+	  ind = (ind<<8) | (*p++);
+	  if (ind != transparent_index) b |= bit;
+
+          if (bit < 128) bit <<= 1;
+	  else {
+	    *bitmap++ = b;
+	    b = 0;
+	    bit = 1;
+	  }
+	}
+
+        if (bit > 1) *bitmap++ = b;
+      }
+    }
+  }
+
+  fltk3::draw_image(chars_per_pixel==1 ? cb1 : cb2, &d, x, y, d.w, d.h, 4);
+#ifdef __APPLE_QUARTZ__
+    }
+#endif
+
+  if (chars_per_pixel > 1) for (int i = 0; i < 256; i++) delete[] d.byte1[i];
+  return 1;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/dump_compose.c (from rev 9002, branches/branch-3.0/src/core/dump_compose.c)
===================================================================
--- branches/branch-3.0/src/fltk3/dump_compose.c	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/dump_compose.c	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,26 @@
+/* write out the documentation for the compose key */
+
+/* copy the string from fltk3::Input.C */
+static const char* const compose_pairs =
+"  ! @ # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "
+"A`A'A^A~A:A*AEC,E`E'E^E:I`I'I^I:D-N~O`O'O^O~O:x O/U`U'U^U:Y'DDss"
+"a`a'a^a~a:a*aec,e`e'e^e:i`i'i^i:d-n~o`o'o^o~o:-:o/u`u'u^u:y'ddy:";
+
+#include <stdio.h>
+
+int main() {
+  int x,y;
+  for (x = 0; x<16; x++) {
+    for (y = 0; y<6; y++) {
+      const char *p = compose_pairs + (16*y+x)*2;
+      if (p[1] == ' ')
+	printf("<td><code>%c&nbsp</code>&nbsp&nbsp&nbsp%c\n",
+	       p[0],(p-compose_pairs)/2+0xA0);
+      else
+	printf("<td><code>%c%c</code>&nbsp&nbsp&nbsp%c\n",
+	       p[0],p[1],(p-compose_pairs)/2+0xA0);
+    }
+    printf("<tr>");
+  }
+  return 0;
+}

Copied: branches/branch-3.0/src/fltk3/encoding_latin1.cxx (from rev 9002, branches/branch-3.0/src/core/fl_encoding_latin1.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/encoding_latin1.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/encoding_latin1.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,137 @@
+//
+// "$Id$"
+//
+// Convert MSWindows-1252 (Latin-1) encoded text to the local encoding.
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/draw.h>
+#include <fltk3/enumerations.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+#ifdef __APPLE__
+ 
+// These function assume a western code page. If you need to support 
+// scripts that are not part of this code page, you might want to
+// take a look at FLTK2, which uses utf8 for text encoding.
+//
+// By keeping these conversion tables in their own module, they will not
+// be statically linked (by a smart linker) unless actually used.
+//
+// On MS-Windows, nothing need to be converted. We simply return the 
+// original pointer.
+//
+// Most X11 implementations seem to default to Latin-1 as a code since it
+// is a superset of ISO 8859-1, the original wetsern codepage on X11.
+//
+// Apple's OS X however renders text in MacRoman for western settings. The
+// lookup tables below will convert all common character codes and replace
+// unknown characters with an upsidedown question mark.
+
+// This table converts MSWindows-1252/Latin 1 into MacRoman encoding
+static uchar latin2roman[128] = {
+0xdb, 0xc0, 0xe2, 0xc4, 0xe3, 0xc9, 0xa0, 0xe0, 0xf6, 0xe4, 0xc0, 0xdc, 0xce, 0xc0, 0xc0, 0xc0, 
+0xc0, 0xd4, 0xd5, 0xd2, 0xd3, 0xa5, 0xd0, 0xd1, 0xf7, 0xaa, 0xc0, 0xdd, 0xcf, 0xc0, 0xc0, 0xd9, 
+0xca, 0xc1, 0xa2, 0xa3, 0xc0, 0xb4, 0xc0, 0xa4, 0xac, 0xa9, 0xbb, 0xc7, 0xc2, 0xc0, 0xa8, 0xf8, 
+0xa1, 0xb1, 0xc0, 0xc0, 0xab, 0xb5, 0xa6, 0xe1, 0xfc, 0xc0, 0xbc, 0xc8, 0xc0, 0xc0, 0xc0, 0xc0, 
+0xcb, 0xe7, 0xe5, 0xcc, 0x80, 0x81, 0xae, 0x82, 0xe9, 0x83, 0xe6, 0xe8, 0xed, 0xea, 0xeb, 0xec, 
+0xc0, 0x84, 0xf1, 0xee, 0xef, 0xcd, 0x85, 0xc0, 0xaf, 0xf4, 0xf2, 0xf3, 0x86, 0xc0, 0xc0, 0xa7, 
+0x88, 0x87, 0x89, 0x8b, 0x8a, 0x8c, 0xbe, 0x8d, 0x8f, 0x8e, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, 
+0xc0, 0x96, 0x98, 0x97, 0x99, 0x9b, 0x9a, 0xd6, 0xbf, 0x9d, 0x9c, 0x9e, 0x9f, 0xc0, 0xc0, 0xd8
+};
+
+// This table converts MacRoman into MSWindows-1252/Latin 1
+static uchar roman2latin[128] = {
+0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1, 0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8, 
+0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3, 0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb, 0xfc, 
+0x86, 0xb0, 0xa2, 0xa3, 0xa7, 0x95, 0xb6, 0xdf, 0xae, 0xa9, 0x99, 0xb4, 0xa8, 0xbf, 0xc6, 0xd8, 
+0xbf, 0xb1, 0xbf, 0xbf, 0xa5, 0xb5, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xaa, 0xba, 0xbf, 0xe6, 0xf8, 
+0xbf, 0xa1, 0xac, 0xbf, 0x83, 0xbf, 0xbf, 0xab, 0xbb, 0x85, 0xa0, 0xc0, 0xc3, 0xd5, 0x8c, 0x9c, 
+0x96, 0x97, 0x93, 0x94, 0x91, 0x92, 0xf7, 0xbf, 0xff, 0x9f, 0xbf, 0x80, 0x8b, 0x9b, 0xbf, 0xbf, 
+0x87, 0xb7, 0x82, 0x84, 0x89, 0xc2, 0xca, 0xc1, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3, 0xd4, 
+0xbf, 0xd2, 0xda, 0xdb, 0xd9, 0xbf, 0x88, 0x98, 0xaf, 0xbf, 0xbf, 0xbf, 0xb8, 0xbf, 0xbf, 0xbf
+};
+
+static char *buf = 0;
+static int n_buf = 0;
+
+const char *fltk3::latin1_to_local(const char *t, int n)  
+{
+  if (n==-1) n = strlen(t);
+  if (n<=n_buf) {
+    n_buf = (n + 257) & 0x7fffff00;
+    if (buf) free(buf);
+    buf = (char*)malloc(n_buf);
+  }
+  const uchar *src = (const uchar*)t;
+  uchar *dst = (uchar*)buf;
+  for ( ; n>0; n--) {
+    uchar c = *src++;
+    if (c>127) 
+      *dst = latin2roman[c-128];
+    else
+      *dst = c;
+  }
+  //*dst = 0; // this would be wrong!
+  return buf;
+}
+
+const char *fltk3::local_to_latin1(const char *t, int n)
+{
+  if (n==-1) n = strlen(t);
+  if (n<=n_buf) {
+    n_buf = (n + 257) & 0x7fffff00;
+    if (buf) free(buf);
+    buf = (char*)malloc(n_buf);
+  }
+  const uchar *src = (const uchar*)t;
+  uchar *dst = (uchar*)buf;
+  for ( ; n>0; n--) {
+    uchar c = *src++;
+    if (c>127)
+      *dst++ = roman2latin[c-128];
+    else
+      *dst++ = c;
+  }
+  //*dst = 0; // this would be wrong
+  return buf;
+}
+
+#else 
+
+const char *fltk3::latin1_to_local(const char *t, int) 
+{
+  return t;
+}
+
+const char *fltk3::local_to_latin1(const char *t, int)
+{
+  return t;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/encoding_mac_roman.cxx (from rev 9002, branches/branch-3.0/src/core/fl_encoding_mac_roman.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/encoding_mac_roman.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/encoding_mac_roman.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,134 @@
+//
+// "$Id$"
+//
+// Convert Mac Roman encoded text to the local encoding.
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/draw.h>
+#include <fltk3/enumerations.h>
+#include <stdlib.h>
+#include "flstring.h"
+
+// These function assume a western code page. If you need to support 
+// scripts that are not part of this code page, you might want to
+// take a look at FLTK2, which uses utf8 for text encoding.
+//
+// By keeping these conversion tables in their own module, they will not
+// be statically linked (by a smart linker) unless actually used.
+//
+// On Mac OS X, nothing need to be converted. We simply return the 
+// original pointer.
+//
+// MSWindows and X11 render text in ISO or Latin-1 for western settings. The
+// lookup tables below will convert all common character codes and replace
+// unknown characters with an upsidedown question mark.
+
+#ifdef __APPLE__
+
+const char *fltk3::mac_roman_to_local(const char *t, int)
+{
+  return t;
+}
+
+const char *fltk3::local_to_mac_roman(const char *t, int)
+{
+  return t;
+}
+
+#else
+
+// This table converts MSWindows-1252/Latin 1 into MacRoman encoding
+static uchar latin2roman[128] = {
+0xdb, 0xc0, 0xe2, 0xc4, 0xe3, 0xc9, 0xa0, 0xe0, 0xf6, 0xe4, 0xc0, 0xdc, 0xce, 0xc0, 0xc0, 0xc0, 
+0xc0, 0xd4, 0xd5, 0xd2, 0xd3, 0xa5, 0xd0, 0xd1, 0xf7, 0xaa, 0xc0, 0xdd, 0xcf, 0xc0, 0xc0, 0xd9, 
+0xca, 0xc1, 0xa2, 0xa3, 0xc0, 0xb4, 0xc0, 0xa4, 0xac, 0xa9, 0xbb, 0xc7, 0xc2, 0xc0, 0xa8, 0xf8, 
+0xa1, 0xb1, 0xc0, 0xc0, 0xab, 0xb5, 0xa6, 0xe1, 0xfc, 0xc0, 0xbc, 0xc8, 0xc0, 0xc0, 0xc0, 0xc0, 
+0xcb, 0xe7, 0xe5, 0xcc, 0x80, 0x81, 0xae, 0x82, 0xe9, 0x83, 0xe6, 0xe8, 0xed, 0xea, 0xeb, 0xec, 
+0xc0, 0x84, 0xf1, 0xee, 0xef, 0xcd, 0x85, 0xc0, 0xaf, 0xf4, 0xf2, 0xf3, 0x86, 0xc0, 0xc0, 0xa7, 
+0x88, 0x87, 0x89, 0x8b, 0x8a, 0x8c, 0xbe, 0x8d, 0x8f, 0x8e, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95, 
+0xc0, 0x96, 0x98, 0x97, 0x99, 0x9b, 0x9a, 0xd6, 0xbf, 0x9d, 0x9c, 0x9e, 0x9f, 0xc0, 0xc0, 0xd8
+};
+
+// This table converts MacRoman into MSWindows-1252/Latin 1
+static uchar roman2latin[128] = {
+0xc4, 0xc5, 0xc7, 0xc9, 0xd1, 0xd6, 0xdc, 0xe1, 0xe0, 0xe2, 0xe4, 0xe3, 0xe5, 0xe7, 0xe9, 0xe8, 
+0xea, 0xeb, 0xed, 0xec, 0xee, 0xef, 0xf1, 0xf3, 0xf2, 0xf4, 0xf6, 0xf5, 0xfa, 0xf9, 0xfb, 0xfc, 
+0x86, 0xb0, 0xa2, 0xa3, 0xa7, 0x95, 0xb6, 0xdf, 0xae, 0xa9, 0x99, 0xb4, 0xa8, 0xbf, 0xc6, 0xd8, 
+0xbf, 0xb1, 0xbf, 0xbf, 0xa5, 0xb5, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xaa, 0xba, 0xbf, 0xe6, 0xf8, 
+0xbf, 0xa1, 0xac, 0xbf, 0x83, 0xbf, 0xbf, 0xab, 0xbb, 0x85, 0xa0, 0xc0, 0xc3, 0xd5, 0x8c, 0x9c, 
+0x96, 0x97, 0x93, 0x94, 0x91, 0x92, 0xf7, 0xbf, 0xff, 0x9f, 0xbf, 0x80, 0x8b, 0x9b, 0xbf, 0xbf, 
+0x87, 0xb7, 0x82, 0x84, 0x89, 0xc2, 0xca, 0xc1, 0xcb, 0xc8, 0xcd, 0xce, 0xcf, 0xcc, 0xd3, 0xd4, 
+0xbf, 0xd2, 0xda, 0xdb, 0xd9, 0xbf, 0x88, 0x98, 0xaf, 0xbf, 0xbf, 0xbf, 0xb8, 0xbf, 0xbf, 0xbf
+};
+
+static char *buf = 0;
+static int n_buf = 0;
+
+const char *fltk3::local_to_mac_roman(const char *t, int n)  
+{
+  if (n==-1) n = strlen(t);
+  if (n<=n_buf) {
+    n_buf = (n + 257) & 0x7fffff00;
+    if (buf) free(buf);
+    buf = (char*)malloc(n_buf);
+  }
+  const uchar *src = (const uchar*)t;
+  uchar *dst = (uchar*)buf;
+  for ( ; n>0; n--) {
+    uchar c = *src;
+    if (c>127) 
+      *dst = latin2roman[c-128];
+    else
+      *dst = c;
+  }
+  //*dst = 0; // this would be wrong!
+  return buf;
+}
+
+const char *fltk3::mac_roman_to_local(const char *t, int n)
+{
+  if (n==-1) n = strlen(t);
+  if (n<=n_buf) {
+    n_buf = (n + 257) & 0x7fffff00;
+    if (buf) free(buf);
+    buf = (char*)malloc(n_buf);
+  }
+  const uchar *src = (const uchar*)t;
+  uchar *dst = (uchar*)buf;
+  for ( ; n>0; n--) {
+    uchar c = *src++;
+    if (c>127)
+      *dst++ = roman2latin[c-128];
+    else
+      *dst++ = c;
+  }
+  //*dst = 0; // this would be wrong
+  return buf;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/engraved_label.cxx (from rev 9002, branches/branch-3.0/src/core/fl_engraved_label.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/engraved_label.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/engraved_label.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,77 @@
+//
+// "$Id$"
+//
+// Engraved label drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Drawing code for XForms style engraved & embossed labels
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/draw.h>
+
+// data[] is dx, dy, color triples
+
+static void innards(
+    const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align,
+    int data[][3], int n)
+{
+  fltk3::Align a1 = align;
+  if (a1 & fltk3::ALIGN_CLIP) {
+    fltk3::push_clip(X, Y, W, H); a1 = (fltk3::Align)(a1&~fltk3::ALIGN_CLIP);}
+  fltk3::font((fltk3::Font)o->font, o->size);
+  for (int i = 0; i < n; i++) {
+    fltk3::color((fltk3::Color)(i < n-1 ? data[i][2] : o->color));
+    fltk3::draw(o->value, X+data[i][0], Y+data[i][1], W, H, a1);
+  }
+  if (align & fltk3::ALIGN_CLIP) fltk3::pop_clip();
+}
+
+void fl_shadow_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
+{
+  static int data[2][3] = {{2,2,fltk3::DARK3},{0,0,0}};
+  innards(o, X, Y, W, H, align, data, 2);
+}
+
+void fl_engraved_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
+{
+  static int data[7][3] = {
+    {1,0,fltk3::LIGHT3},{1,1,fltk3::LIGHT3},{0,1,fltk3::LIGHT3},
+    {-1,0,fltk3::DARK3},{-1,-1,fltk3::DARK3},{0,-1,fltk3::DARK3},
+    {0,0,0}};
+  innards(o, X, Y, W, H, align, data, 7);
+}
+
+void fl_embossed_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
+{
+  static int data[7][3] = {
+    {-1,0,fltk3::LIGHT3},{-1,-1,fltk3::LIGHT3},{0,-1,fltk3::LIGHT3},
+    {1,0,fltk3::DARK3},{1,1,fltk3::DARK3},{0,1,fltk3::DARK3},
+    {0,0,0}};
+  innards(o, X, Y, W, H, align, data, 7);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ew.xbm (from rev 9002, branches/branch-3.0/src/core/ew.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/ew.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ew.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,8 @@
+#define ew_width 16
+#define ew_height 16
+#define ew_x_hot 8
+#define ew_y_hot 8
+static unsigned char ew_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10,
+   0x0c, 0x30, 0xfe, 0x7f, 0xfe, 0x7f, 0x0c, 0x30, 0x08, 0x10, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/ew_mask.xbm (from rev 9002, branches/branch-3.0/src/core/ew_mask.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/ew_mask.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ew_mask.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,8 @@
+#define ew_mask_width 16
+#define ew_mask_height 16
+#define ew_mask_x_hot 8
+#define ew_mask_y_hot 8
+static unsigned char ew_mask_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x1c, 0x38,
+   0xfe, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x7f, 0x1c, 0x38, 0x18, 0x18,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/fastarrow.h (from rev 9002, branches/branch-3.0/src/core/fastarrow.h)
===================================================================
--- branches/branch-3.0/src/fltk3/fastarrow.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/fastarrow.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define fastarrow_width 16
+#define fastarrow_height 16
+static unsigned char fastarrow_bits[] = {
+   0x00, 0x00, 0x00, 0x07, 0xe0, 0x07, 0xfc, 0x03, 0xff, 0xff, 0xfc, 0x03,
+   0xe0, 0x07, 0x00, 0x07, 0xe0, 0x00, 0xe0, 0x07, 0xc0, 0x3f, 0xff, 0xff,
+   0xc0, 0x3f, 0xe0, 0x07, 0xe0, 0x00, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/file_dir.cxx (from rev 9002, branches/branch-3.0/src/core/fl_file_dir.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/file_dir.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/file_dir.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,200 @@
+//
+// "$Id$"
+//
+// File chooser widget for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include "flstring.h"
+#include <fltk3/filename.h>
+#include <fltk3/FileChooser.h>
+#include <fltk3/ask.h>
+
+
+static fltk3::FileChooser	*fc = (fltk3::FileChooser *)0;
+static void		(*current_callback)(const char*) = 0;
+static const char	*current_label = fltk3::ok;
+
+
+// Do a file chooser callback...
+static void callback(fltk3::FileChooser *, void*) {
+  if (current_callback && fc->value())
+    (*current_callback)(fc->value());
+}
+
+/** \addtogroup  group_comdlg 
+    @{ */
+
+/** 
+    Set the file chooser callback
+    \note \#include <fltk3/FileChooser.h>
+    \relates fltk3::FileChooser
+*/
+void fltk3::file_chooser_callback(void (*cb)(const char*)) {
+  current_callback = cb;
+}
+
+
+/** 
+    Set the "OK" button label
+    \note \#include <fltk3/FileChooser.h>
+    \relates fltk3::FileChooser
+*/
+void fltk3::file_chooser_ok_label(const char *l) {
+  if (l) current_label = l;
+  else current_label = fltk3::ok;
+}
+
+/** 
+    Shows a file chooser dialog and gets a filename. 
+    \note \#include <fltk3/FileChooser.h>
+    \image html fltk3::FileChooser.jpg 
+    \image latex  fltk3::FileChooser.jpg "fltk3::FileChooser" width=12cm
+    \param[in] message text in title bar
+    \param[in] pat filename pattern filter
+    \param[in] fname initial/default filename selection
+    \param[in] relative 0 for absolute path name, relative path name otherwise
+    \return the user selected filename, in absolute or relative format 
+            or NULL if user cancels
+    \relates fltk3::FileChooser
+*/
+char *					// O - Filename or NULL
+fltk3::file_chooser(const char *message,	// I - Message in titlebar
+                const char *pat,	// I - Filename pattern
+		const char *fname,	// I - Initial filename selection
+		int        relative) {	// I - 0 for absolute path
+  static char	retname[FLTK3_PATH_MAX];		// Returned filename
+
+  if (!fc) {
+    if (!fname || !*fname) fname = ".";
+
+    fc = new fltk3::FileChooser(fname, pat, fltk3::FileChooser::CREATE, message);
+    fc->callback(callback, 0);
+  } else {
+    fc->type(fltk3::FileChooser::CREATE);
+    // see, if we use the same pattern between calls
+    char same_pattern = 0;
+    const char *fcf = fc->filter();
+    if ( fcf && pat && strcmp(fcf, pat)==0)
+      same_pattern = 1;
+    else if ( (fcf==0L || *fcf==0) && (pat==0L || *pat==0) )
+      same_pattern = 1;
+    // now set the pattern to the new pattern (even if they are the same)
+    fc->filter(pat);
+    fc->label(message);
+
+    if (!fname) { // null pointer reuses same filename if pattern didn't change
+      if (!same_pattern && fc->value()) {
+	// if pattern is different, remove name but leave old directory:
+	strlcpy(retname, fc->value(), sizeof(retname));
+
+	char *p = strrchr(retname, '/');
+
+        if (p) {
+	  // If the filename is "/foo", then the directory will be "/", not
+	  // ""...
+	  if (p == retname)
+	    retname[1] = '\0';
+	  else
+	    *p = '\0';
+	}
+	// Set the directory...
+	fc->value(retname);
+      } else {
+        // re-use the previously selected name
+      }
+    } else if (!*fname) { // empty filename reuses directory with empty name
+      const char *fcv = fc->value();
+      if (fcv) 
+        strlcpy(retname, fc->value(), sizeof(retname));
+      else 
+        *retname = 0;
+      const char *n = fltk3::filename_name(retname);
+      if (n) *((char*)n) = 0;
+      fc->value("");
+      fc->directory(retname);
+    } else {
+       fc->value(fname);
+    }
+  }
+
+  fc->ok_label(current_label);
+  fc->show();
+
+  while (fc->shown())
+    fltk3::wait();
+
+  if (fc->value() && relative) {
+    fltk3::filename_relative(retname, sizeof(retname), fc->value());
+
+    return retname;
+  } else if (fc->value()) return (char *)fc->value();
+  else return 0;
+}
+
+/** Shows a file chooser dialog and gets a directory.
+    \note \#include <fltk3/FileChooser.h>
+    \param[in] message title bar text
+    \param[in] fname initial/default directory name
+    \param[in] relative 0 for absolute path return, relative otherwise
+    \return the directory path string chosen by the user or NULL if user cancels
+    \relates fltk3::FileChooser
+*/
+char *					// O - Directory or NULL
+fltk3::dir_chooser(const char *message,	// I - Message for titlebar
+               const char *fname,	// I - Initial directory name
+	       int        relative)	// I - 0 for absolute
+{
+  static char	retname[FLTK3_PATH_MAX];		// Returned directory name
+
+  if (!fc) {
+    if (!fname || !*fname) fname = ".";
+
+    fc = new fltk3::FileChooser(fname, "*", fltk3::FileChooser::CREATE |
+                                         fltk3::FileChooser::DIRECTORY, message);
+    fc->callback(callback, 0);
+  } else {
+    fc->type(fltk3::FileChooser::CREATE | fltk3::FileChooser::DIRECTORY);
+    fc->filter("*");
+    if (fname && *fname) fc->value(fname);
+    fc->label(message);
+  }
+
+  fc->show();
+
+  while (fc->shown())
+    fltk3::wait();
+
+  if (fc->value() && relative) {
+    fltk3::filename_relative(retname, sizeof(retname), fc->value());
+
+    return retname;
+  } else if (fc->value()) return (char *)fc->value();
+  else return 0;
+}
+/** @} */
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_absolute.cxx (from rev 9002, branches/branch-3.0/src/core/filename_absolute.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_absolute.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_absolute.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,272 @@
+//
+// "$Id$"
+//
+// Filename expansion routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* expand a file name by prepending current directory, deleting . and
+   .. (not really correct for symbolic links) between the prepended
+   current directory.  Use $PWD if it exists.
+   Returns true if any changes were made.
+*/
+
+#include <fltk3/filename.h>
+#include <fltk3/utf8.h>
+#include <stdlib.h>
+#include "flstring.h"
+#include <ctype.h>
+#if defined(WIN32) && !defined(__CYGWIN__)
+# include <direct.h>
+#else
+#  include <unistd.h>
+#endif
+
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+inline int isdirsep(char c) {return c=='/' || c=='\\';}
+#else
+#define isdirsep(c) ((c)=='/')
+#endif
+
+/** Makes a filename absolute from a relative filename.
+    \code
+    #include <fltk3/filename.h>
+    [..]
+    chdir("/var/tmp");
+    fltk3::filename_absolute(out, sizeof(out), "foo.txt");         // out="/var/tmp/foo.txt"
+    fltk3::filename_absolute(out, sizeof(out), "./foo.txt");       // out="/var/tmp/foo.txt"
+    fltk3::filename_absolute(out, sizeof(out), "../log/messages"); // out="/var/log/messages"
+    \endcode
+    \param[out] to resulting absolute filename
+    \param[in]  tolen size of the absolute filename buffer 
+    \param[in]  from relative filename
+    \return 0 if no change, non zero otherwise
+ */
+int fltk3::filename_absolute(char *to, int tolen, const char *from) {
+  if (isdirsep(*from) || *from == '|'
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+      || from[1]==':'
+#endif
+      ) {
+    strlcpy(to, from, tolen);
+    return 0;
+  }
+
+  char *a;
+  char *temp = new char[tolen];
+  const char *start = from;
+
+  a = fltk3::getcwd(temp, tolen);
+  if (!a) {
+    strlcpy(to, from, tolen);
+    delete[] temp;
+    return 0;
+  }
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+  for (a = temp; *a; a++) if (*a=='\\') *a = '/'; // ha ha
+#else
+  a = temp+strlen(temp);
+#endif
+  if (isdirsep(*(a-1))) a--;
+  /* remove intermediate . and .. names: */
+  while (*start == '.') {
+    if (start[1]=='.' && isdirsep(start[2])) {
+      char *b;
+      for (b = a-1; b >= temp && !isdirsep(*b); b--);
+      if (b < temp) break;
+      a = b;
+      start += 3;
+    } else if (isdirsep(start[1])) {
+      start += 2;
+    } else if (!start[1]) {
+      start ++; // Skip lone "."
+      break;
+    } else
+      break;
+  }
+
+  *a++ = '/';
+  strlcpy(a,start,tolen - (a - temp));
+
+  strlcpy(to, temp, tolen);
+
+  delete[] temp;
+
+  return 1;
+}
+
+/** Makes a filename relative to the current working directory.
+    \code
+    #include <fltk3/filename.h>
+    [..]
+    chdir("/var/tmp/somedir");       // set cwd to /var/tmp/somedir
+    [..]
+    char out[FLTK3_PATH_MAX];
+    fltk3::filename_relative(out, sizeof(out), "/var/tmp/somedir/foo.txt");  // out="foo.txt",    return=1
+    fltk3::filename_relative(out, sizeof(out), "/var/tmp/foo.txt");          // out="../foo.txt", return=1
+    fltk3::filename_relative(out, sizeof(out), "foo.txt");                   // out="foo.txt",    return=0 (no change)
+    fltk3::filename_relative(out, sizeof(out), "./foo.txt");                 // out="./foo.txt",  return=0 (no change)
+    fltk3::filename_relative(out, sizeof(out), "../foo.txt");                // out="../foo.txt", return=0 (no change)
+    \endcode
+    \param[out] to resulting relative filename
+    \param[in]  tolen size of the relative filename buffer 
+    \param[in]  from absolute filename
+    \return 0 if no change, non zero otherwise
+ */
+int					// O - 0 if no change, 1 if changed
+fltk3::filename_relative(char       *to,	// O - Relative filename
+                     int        tolen,	// I - Size of "to" buffer
+                     const char *from)  // I - Absolute filename
+{
+  char cwd_buf[FLTK3_PATH_MAX];	// Current directory
+  // get the current directory and return if we can't
+  if (!fltk3::getcwd(cwd_buf, sizeof(cwd_buf))) {
+    strlcpy(to, from, tolen);
+    return 0;
+  }
+  return fltk3::filename_relative(to, tolen, from, cwd_buf);
+}
+
+
+/** Makes a filename relative to any other directory.
+ \param[out] to resulting relative filename
+ \param[in]  tolen size of the relative filename buffer 
+ \param[in]  from absolute filename
+ \param[in]  base relative to this absolute path
+ \return 0 if no change, non zero otherwise
+ */
+int					// O - 0 if no change, 1 if changed
+fltk3::filename_relative(char       *to,	// O - Relative filename
+                     int        tolen,	// I - Size of "to" buffer
+                     const char *from,  // I - Absolute filename
+                     const char *base) { // I - Find path relative to this path
+  
+  char          *newslash;		// Directory separator
+  const char	*slash;			// Directory separator
+  char          *cwd = 0L, *cwd_buf = 0L;
+  if (base) cwd = cwd_buf = strdup(base);
+  
+  // return if "from" is not an absolute path
+#if defined(WIN32) || defined(__EMX__)
+  if (from[0] == '\0' ||
+      (!isdirsep(*from) && !isalpha(*from) && from[1] != ':' &&
+       !isdirsep(from[2]))) {
+#else
+  if (from[0] == '\0' || !isdirsep(*from)) {
+#endif // WIN32 || __EMX__
+    strlcpy(to, from, tolen);
+    if (cwd_buf) free(cwd_buf);
+    return 0;
+  }
+        
+  // return if "cwd" is not an absolute path
+#if defined(WIN32) || defined(__EMX__)
+  if (!cwd || cwd[0] == '\0' ||
+      (!isdirsep(*cwd) && !isalpha(*cwd) && cwd[1] != ':' &&
+       !isdirsep(cwd[2]))) {
+#else
+  if (!cwd || cwd[0] == '\0' || !isdirsep(*cwd)) {
+#endif // WIN32 || __EMX__
+    strlcpy(to, from, tolen);
+    if (cwd_buf) free(cwd_buf);
+    return 0;
+  }
+              
+#if defined(WIN32) || defined(__EMX__)
+  // convert all backslashes into forward slashes
+  for (newslash = strchr(cwd, '\\'); newslash; newslash = strchr(newslash + 1, '\\'))
+    *newslash = '/';
+
+  // test for the exact same string and return "." if so
+  if (!strcasecmp(from, cwd)) {
+    strlcpy(to, ".", tolen);
+    free(cwd_buf);
+    return (1);
+  }
+
+  // test for the same drive. Return the absolute path if not
+  if (tolower(*from & 255) != tolower(*cwd & 255)) {
+    // Not the same drive...
+    strlcpy(to, from, tolen);
+    free(cwd_buf);
+    return 0;
+  }
+
+  // compare the path name without the drive prefix
+  from += 2; cwd += 2;
+#else
+  // test for the exact same string and return "." if so
+  if (!strcmp(from, cwd)) {
+    strlcpy(to, ".", tolen);
+    free(cwd_buf);
+    return (1);
+  }
+#endif // WIN32 || __EMX__
+
+  // compare both path names until we find a difference
+  for (slash = from, newslash = cwd;
+      *slash != '\0' && *newslash != '\0';
+       slash ++, newslash ++)
+    if (isdirsep(*slash) && isdirsep(*newslash)) continue;
+#if defined(WIN32) || defined(__EMX__) || defined(__APPLE__)
+    else if (tolower(*slash & 255) != tolower(*newslash & 255)) break;
+#else
+    else if (*slash != *newslash) break;
+#endif // WIN32 || __EMX__ || __APPLE__
+
+  // skip over trailing slashes
+  if ( *newslash == '\0' && *slash != '\0' && !isdirsep(*slash)
+     &&(newslash==cwd || !isdirsep(newslash[-1])) )
+    newslash--;
+
+  // now go back to the first character of the first differing paths segment
+  while (!isdirsep(*slash) && slash > from) slash --;
+  if (isdirsep(*slash)) slash ++;
+
+  // do the same for the current dir
+  if (isdirsep(*newslash)) newslash --;
+  if (*newslash != '\0')
+    while (!isdirsep(*newslash) && newslash > cwd) newslash --;
+
+  // prepare the destination buffer
+  to[0]         = '\0';
+  to[tolen - 1] = '\0';
+
+  // now add a "previous dir" sequence for every following slash in the cwd
+  while (*newslash != '\0') {
+    if (isdirsep(*newslash)) strlcat(to, "../", tolen);
+
+    newslash ++;
+  }
+
+  // finally add the differing path from "from"
+  strlcat(to, slash, tolen);
+
+  free(cwd_buf);
+  return 1;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_expand.cxx (from rev 9002, branches/branch-3.0/src/core/filename_expand.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_expand.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_expand.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,134 @@
+//
+// "$Id$"
+//
+// Filename expansion routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* expand a file name by substuting environment variables and
+   home directories.  Returns true if any changes were made.
+   to & from may be the same buffer.
+*/
+
+#include <fltk3/filename.h>
+#include <fltk3/utf8.h>
+#include <stdlib.h>
+#include "flstring.h"
+#if defined(WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#else
+# include <unistd.h>
+# include <pwd.h>
+#endif
+
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+static inline int isdirsep(char c) {return c=='/' || c=='\\';}
+#else
+#define isdirsep(c) ((c)=='/')
+#endif
+
+/** Expands a filename containing shell variables and tilde (~).
+    Currently handles these variants:
+    \code
+    "~username"               // if 'username' does not exist, result will be unchanged
+    "~/file"
+    "$VARNAME"                // does NOT handle ${VARNAME}
+    \endcode
+
+    \b Examples:
+    \code
+    #include <fltk3/filename.h>
+    [..]
+    putenv("TMPDIR=/var/tmp");
+    fltk3::filename_expand(out, sizeof(out), "~fred/.cshrc");     // out="/usr/fred/.cshrc"
+    fltk3::filename_expand(out, sizeof(out), "~/.cshrc");         // out="/usr/<yourname>/.cshrc"
+    fltk3::filename_expand(out, sizeof(out), "$TMPDIR/foo.txt");  // out="/var/tmp/foo.txt"
+    \endcode
+    \param[out] to resulting expanded filename
+    \param[in]  tolen size of the expanded filename buffer 
+    \param[in]  from filename containing shell variables
+    \return 0 if no change, non zero otherwise
+ */
+int fltk3::filename_expand(char *to,int tolen, const char *from) {
+
+  char *temp = new char[tolen];
+  strlcpy(temp,from, tolen);
+  char *start = temp;
+  char *end = temp+strlen(temp);
+
+  int ret = 0;
+
+  for (char *a=temp; a<end; ) {	// for each slash component
+    char *e; for (e=a; e<end && !isdirsep(*e); e++); // find next slash
+    const char *value = 0; // this will point at substitute value
+    switch (*a) {
+    case '~':	// a home directory name
+      if (e <= a+1) {	// current user's directory
+        value = fltk3::getenv("HOME");
+#ifndef WIN32
+      } else {	// another user's directory
+	struct passwd *pwd;
+	char t = *e; *(char *)e = 0; 
+        pwd = getpwnam(a+1); 
+        *(char *)e = t;
+	    if (pwd) value = pwd->pw_dir;
+#endif
+      }
+      break;
+    case '$':		/* an environment variable */
+      {char t = *e; *(char *)e = 0; value = fltk3::getenv(a+1); *(char *)e = t;}
+      break;
+    }
+    if (value) {
+      // substitutions that start with slash delete everything before them:
+      if (isdirsep(value[0])) start = a;
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+      // also if it starts with "A:"
+      if (value[0] && value[1]==':') start = a;
+#endif
+      int t = strlen(value); if (isdirsep(value[t-1])) t--;
+      if ((end+1-e+t) >= tolen) end += tolen - (end+1-e+t);
+      memmove(a+t, e, end+1-e);
+      end = a+t+(end-e);
+      *end = '\0';
+      memcpy(a, value, t);
+      ret++;
+    } else {
+      a = e+1;
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+      if (*e == '\\') {*e = '/'; ret++;} // ha ha!
+#endif
+    }
+  }
+
+  strlcpy(to, start, tolen);
+
+  delete[] temp;
+
+  return ret;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_ext.cxx (from rev 9002, branches/branch-3.0/src/core/filename_ext.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_ext.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_ext.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,58 @@
+//
+// "$Id$"
+//
+// Filename extension routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// returns pointer to the last '.' or to the null if none:
+
+#include <fltk3/filename.h>
+
+/** Gets the extensions of a filename.
+   \code
+   #include <fltk3/filename.h>
+   [..]
+   const char *out;
+   out = fltk3::filename_ext("/some/path/foo.txt");        // result: ".txt"
+   out = fltk3::filename_ext("/some/path/foo");            // result: NULL
+   \endcode
+   \param[in] buf the filename to be parsed
+   \return a pointer to the extension (including '.') if any or NULL otherwise
+ */
+const char *fltk3::filename_ext(const char *buf) {
+  const char *q = 0;
+  const char *p = buf;
+  for (p=buf; *p; p++) {
+    if (*p == '/') q = 0;
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+    else if (*p == '\\') q = 0;
+#endif
+    else if (*p == '.') q = p;
+  }
+  return q ? q : p;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_isdir.cxx (from rev 9002, branches/branch-3.0/src/core/filename_isdir.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_isdir.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_isdir.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,103 @@
+//
+// "$Id$"
+//
+// Directory detection routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Used by fltk3::file_chooser
+
+#include "flstring.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <ctype.h>
+#include <fltk3/filename.h>
+#include <fltk3/utf8.h>
+
+
+#if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__)
+static inline int isdirsep(char c) {return c=='/' || c=='\\';}
+#else
+#define isdirsep(c) ((c)=='/')
+#endif
+
+int fltk3::_filename_isdir_quick(const char* n) {
+  // Do a quick optimization for filenames with a trailing slash...
+  if (*n && isdirsep(n[strlen(n) - 1])) return 1;
+  return fltk3::filename_isdir(n);
+}
+
+/**
+   Determines if a file exists and is a directory from its filename.
+   \code
+   #include <fltk3/filename.h>
+   [..]
+   fltk3::filename_isdir("/etc");		// returns non-zero
+   fltk3::filename_isdir("/etc/hosts");	// returns 0
+   \endcode
+   \param[in] n the filename to parse
+   \return non zero if file exists and is a directory, zero otherwise
+*/
+int fltk3::filename_isdir(const char* n) {
+  struct stat	s;
+  char		fn[FLTK3_PATH_MAX];
+  int		length;
+
+  length = strlen(n);
+
+#ifdef WIN32
+  // This workaround brought to you by the fine folks at Microsoft!
+  // (read lots of sarcasm in that...)
+  if (length < (int)(sizeof(fn) - 1)) {
+    if (length < 4 && isalpha(n[0]) && n[1] == ':' &&
+        (isdirsep(n[2]) || !n[2])) {
+      // Always use D:/ for drive letters
+      fn[0] = n[0];
+      strcpy(fn + 1, ":/");
+      n = fn;
+    } else if (length > 0 && isdirsep(n[length - 1])) {
+      // Strip trailing slash from name...
+      length --;
+      memcpy(fn, n, length);
+      fn[length] = '\0';
+      n = fn;
+    }
+  }
+#else
+  // Matt: Just in case, we strip the slash for other operating
+  // systems as well, avoid bugs by sloppy implementations
+  // of "stat".
+  if (length > 1 && isdirsep(n[length - 1])) {
+    length --;
+    memcpy(fn, n, length);
+    fn[length] = '\0';
+    n = fn;
+  }
+#endif
+
+  return !fltk3::stat(n, &s) && (s.st_mode&0170000)==0040000;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_list.cxx (from rev 9002, branches/branch-3.0/src/core/filename_list.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_list.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_list.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,206 @@
+//
+// "$Id$"
+//
+// Filename list routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Wrapper for scandir with const-correct function prototypes.
+
+#include <fltk3/filename.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <stdlib.h>
+
+
+extern "C" {
+#ifndef HAVE_SCANDIR
+  int fl_scandir (const char *dir, dirent ***namelist,
+	          int (*select)(dirent *),
+	          int (*compar)(dirent **, dirent **));
+#endif
+}
+
+int fltk3::alphasort(struct dirent **a, struct dirent **b) {
+  return strcmp((*a)->d_name, (*b)->d_name);
+}
+
+int fltk3::casealphasort(struct dirent **a, struct dirent **b) {
+  return strcasecmp((*a)->d_name, (*b)->d_name);
+}
+
+
+/**
+   Portable and const-correct wrapper for the scandir() function. 
+   For each file in that directory a "dirent" structure is created. 
+   The only portable thing about a dirent is that dirent.d_name is the nul-terminated file name. 
+   An pointers array to these dirent's is created and a pointer to the array is returned in *list.
+   The number of entries is given as a return value. 
+   If there is an error reading the directory a number less than zero is returned, 
+   and errno has the reason; errno does not work under WIN32. 
+
+   \b Include:
+   \code
+   #include <fltk3/filename.h>
+   \endcode
+
+   \param[in] d the name of the directory to list.  It does not matter if it has a trailing slash.
+   \param[out] list table containing the resulting directory listing
+   \param[in] sort sorting functor:
+    - fltk3::alphasort: The files are sorted in ascending alphabetical order; 
+        upper and lowercase letters are compared according to their ASCII ordering  uppercase before lowercase.
+    - fltk3::casealphasort: The files are sorted in ascending alphabetical order; 
+        upper and lowercase letters are compared equally case is not significant.
+    - fltk3::casenumericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made 
+        to put unpadded numbers in consecutive order; upper and lowercase letters 
+        are compared equally case is not significant.
+    - fltk3::numericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made 
+        to put unpadded numbers in consecutive order; upper and lowercase letters are compared 
+        according to their ASCII ordering - uppercase before lowercase. 
+   \return the number of entries if no error, a negative value otherwise.
+*/
+int fltk3::filename_list(const char *d, dirent ***list,
+                     fltk3::FileSortF *sort) {
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(HAVE_SCANDIR)
+  // For Windows we have a special scandir implementation that uses
+  // the Win32 "wide" functions for lookup, avoiding the code page mess
+  // entirely. It also fixes up the trailing '/'.
+  return fl_scandir(d, list, 0, sort);
+
+#else // WIN32
+
+  int dirlen;
+  char *dirloc;
+
+  // Assume that locale encoding is no less dense than UTF-8
+  dirlen = strlen(d);
+#ifdef __APPLE__
+  dirloc = (char *)d;
+#else
+  dirloc = (char *)malloc(dirlen + 1);
+  fltk3::utf8to_mb(d, dirlen, dirloc, dirlen + 1);
+#endif
+
+#ifndef HAVE_SCANDIR
+  // This version is when we define our own scandir
+  int n = fl_scandir(dirloc, list, 0, sort);
+#elif defined(HAVE_SCANDIR_POSIX) && !defined(__APPLE__)
+  // POSIX (2008) defines the comparison function like this:
+  int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent **))sort);
+#elif defined(__osf__)
+  // OSF, DU 4.0x
+  int n = scandir(dirloc, list, 0, (int(*)(dirent **, dirent **))sort);
+#elif defined(_AIX)
+  // AIX is almost standard...
+  int n = scandir(dirloc, list, 0, (int(*)(void*, void*))sort);
+#elif defined(__sgi)
+  int n = scandir(dirloc, list, 0, sort);
+#else
+  // The vast majority of UNIX systems want the sort function to have this
+  // prototype, most likely so that it can be passed to qsort without any
+  // changes:
+  int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
+#endif
+
+#ifndef __APPLE__
+  free(dirloc);
+#endif
+
+  // convert every filename to utf-8, and append a '/' to all
+  // filenames that are directories
+  int i;
+  char *fullname = (char*)malloc(dirlen+FLTK3_PATH_MAX+3); // Add enough extra for two /'s and a nul
+  // Use memcpy for speed since we already know the length of the string...
+  memcpy(fullname, d, dirlen+1);
+
+  char *name = fullname + dirlen;
+  if (name!=fullname && name[-1]!='/')
+    *name++ = '/';
+
+  for (i=0; i<n; i++) {
+    int newlen;
+    dirent *de = (*list)[i];
+    unsigned int len = strlen(de->d_name);
+#ifdef __APPLE__
+    newlen = len;
+#else
+    newlen = fltk3::utf8from_mb(NULL, 0, de->d_name, len);
+#endif
+    dirent *newde = (dirent*)malloc(de->d_name - (char*)de + newlen + 2); // Add space for a / and a nul
+
+    // Conversion to UTF-8
+    memcpy(newde, de, de->d_name - (char*)de);
+#ifdef __APPLE__
+    strcpy(newde->d_name, de->d_name);
+#else
+    fltk3::utf8from_mb(newde->d_name, newlen + 1, de->d_name, len);
+#endif
+
+    // Check if dir (checks done on "old" name as we need to interact with
+    // the underlying OS)
+    if (de->d_name[len-1]!='/' && len<=FLTK3_PATH_MAX) {
+      // Use memcpy for speed since we already know the length of the string...
+      memcpy(name, de->d_name, len+1);
+      if (fltk3::filename_isdir(fullname)) {
+        char *dst = newde->d_name + newlen;
+        *dst++ = '/';
+        *dst = 0;
+      }
+    }
+
+    free(de);
+    (*list)[i] = newde;
+  }
+  free(fullname);
+
+  return n;
+
+#endif // WIN32
+}
+
+/**
+ \brief Free the list of filenames that is generated by fltk3::filename_list().
+ 
+ Free everything that was allocated by a previous call to fltk3::filename_list().
+ Use the return values as parameters for this function.
+ 
+ \param[in,out] list table containing the resulting directory listing
+ \param[in] n number of entries in the list
+ */
+void fltk3::filename_free_list(struct dirent ***list, int n)
+{
+  if (n<0) return;
+  
+  int i;
+  for (i = 0; i < n; i ++) {
+    if ((*list)[i])
+      free((*list)[i]);
+  }  
+  free(*list);
+  *list = 0;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_match.cxx (from rev 9002, branches/branch-3.0/src/core/filename_match.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_match.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_match.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,128 @@
+//
+// "$Id$"
+//
+// Pattern matching routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/* Adapted from Rich Salz. */
+#include <fltk3/filename.h>
+#include <ctype.h>
+
+/**
+    Checks if a string \p s matches a pattern \p p. 
+    The following syntax is used for the pattern:
+    - * matches any sequence of 0 or more characters.
+    - ? matches any single character.
+    - [set] matches any character in the set. Set can contain any single characters, or a-z to represent a range. 
+      To match ] or - they must be the first characters. To match ^ or ! they must not be the first characters.
+    - [^set] or [!set] matches any character not in the set.
+    - {X|Y|Z} or {X,Y,Z} matches any one of the subexpressions literally.
+    - \\x quotes the character x so it has no special meaning.
+    - x all other characters must be matched exactly.
+
+    \b Include:
+    \code
+    #include <fltk3/filename.h>
+    \endcode
+
+    \param[in] s the string to check for a match
+    \param[in] p the string pattern 
+    \return non zero if the string matches the pattern
+*/
+int fltk3::filename_match(const char *s, const char *p) {
+  int matched;
+
+  for (;;) {
+    switch(*p++) {
+
+    case '?' :	// match any single character
+      if (!*s++) return 0;
+      break;
+
+    case '*' :	// match 0-n of any characters
+      if (!*p) return 1; // do trailing * quickly
+      while (!fltk3::filename_match(s, p)) if (!*s++) return 0;
+      return 1;
+
+    case '[': {	// match one character in set of form [abc-d] or [^a-b]
+      if (!*s) return 0;
+      int reverse = (*p=='^' || *p=='!'); if (reverse) p++;
+      matched = 0;
+      char last = 0;
+      while (*p) {
+	if (*p=='-' && last) {
+	  if (*s <= *++p && *s >= last ) matched = 1;
+	  last = 0;
+	} else {
+	  if (*s == *p) matched = 1;
+	}
+	last = *p++;
+	if (*p==']') break;
+      }
+      if (matched == reverse) return 0;
+      s++; p++;}
+    break;
+
+    case '{' : // {pattern1|pattern2|pattern3}
+    NEXTCASE:
+    if (fltk3::filename_match(s,p)) return 1;
+    for (matched = 0;;) {
+      switch (*p++) {
+      case '\\': if (*p) p++; break;
+      case '{': matched++; break;
+      case '}': if (!matched--) return 0; break;
+      case '|': case ',': if (matched==0) goto NEXTCASE;
+      case 0: return 0;
+      }
+    }
+    case '|':	// skip rest of |pattern|pattern} when called recursively
+    case ',':
+      for (matched = 0; *p && matched >= 0;) {
+	switch (*p++) {
+	case '\\': if (*p) p++; break;
+	case '{': matched++; break;
+	case '}': matched--; break;
+	}
+      }
+      break;
+    case '}':
+      break;
+
+    case 0:	// end of pattern
+      return !*s;
+
+    case '\\':	// quote next character
+      if (*p) p++;
+      /* FALLTHROUGH */
+    default:
+      if (tolower(*s) != tolower(*(p-1))) return 0;
+      s++;
+      break;
+    }
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/filename_setext.cxx (from rev 9002, branches/branch-3.0/src/core/filename_setext.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/filename_setext.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/filename_setext.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,60 @@
+//
+// "$Id$"
+//
+// Filename extension routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Replace .ext with new extension
+
+#include <fltk3/filename.h>
+#include "flstring.h"
+
+/**
+   Replaces the extension in \p buf of max.<br>
+   size \p buflen with the extension in \p ext.<br>
+   If there's no '.' in \p buf, \p ext is appended.<br>
+   If \p ext is NULL, behaves as if it were an empty string ("").
+
+   \b Example
+   \code
+   #include <fltk3/filename.h>
+   [..]
+   char buf[FLTK3_PATH_MAX] = "/path/myfile.cxx";
+   fltk3::filename_setext(buf, sizeof(buf), ".txt");      // buf[] becomes "/path/myfile.txt"
+   \endcode
+
+   \return buf itself for calling convenience.
+*/
+char *fltk3::filename_setext(char *buf, int buflen, const char *ext) {
+  char *q = (char *)fltk3::filename_ext(buf);
+  if (ext) {
+    strlcpy(q,ext,buflen - (q - buf));
+  } else *q = 0;
+  return(buf);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/flstring.c (from rev 9007, branches/branch-3.0/src/core/flstring.c)
===================================================================
--- branches/branch-3.0/src/fltk3/flstring.c	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/flstring.c	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,105 @@
+/*
+ * "$Id$"
+ *
+ * BSD string functions for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+#include "flstring.h"
+
+
+/*
+ * 'fl_strlcat()' - Safely concatenate two strings.
+ */
+
+size_t				/* O - Length of string */
+fl_strlcat(char       *dst,	/* O - Destination string */
+           const char *src,	/* I - Source string */
+	   size_t     size) {	/* I - Size of destination string buffer */
+  size_t	srclen;		/* Length of source string */
+  size_t	dstlen;		/* Length of destination string */
+
+
+ /*
+  * Figure out how much room is left...
+  */
+
+  dstlen = strlen(dst);
+  size   -= dstlen + 1;
+
+  if (!size) return (dstlen);	/* No room, return immediately... */
+
+ /*
+  * Figure out how much room is needed...
+  */
+
+  srclen = strlen(src);
+
+ /*
+  * Copy the appropriate amount...
+  */
+
+  if (srclen > size) srclen = size;
+
+  memcpy(dst + dstlen, src, srclen);
+  dst[dstlen + srclen] = '\0';
+
+  return (dstlen + srclen);
+}
+
+
+/*
+ * 'fl_strlcpy()' - Safely copy two strings.
+ */
+
+size_t				/* O - Length of string */
+fl_strlcpy(char       *dst,	/* O - Destination string */
+           const char *src,	/* I - Source string */
+	   size_t      size) {	/* I - Size of destination string buffer */
+  size_t	srclen;		/* Length of source string */
+
+
+ /*
+  * Figure out how much room is needed...
+  */
+
+  size --;
+
+  srclen = strlen(src);
+
+ /*
+  * Copy the appropriate amount...
+  */
+
+  if (srclen > size) srclen = size;
+
+  memcpy(dst, src, srclen);
+  dst[srclen] = '\0';
+
+  return (srclen);
+}
+
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/flstring.h (from rev 9007, branches/branch-3.0/src/core/flstring.h)
===================================================================
--- branches/branch-3.0/src/fltk3/flstring.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/flstring.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,104 @@
+/*
+ * "$Id$"
+ *
+ * Common string header file for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+#ifndef flstring_h
+#  define flstring_h
+
+#  include <fltk3/Export.h>
+#  include <config.h>
+#  include <stdio.h>
+#  include <stdarg.h>
+#  include <string.h>
+#  ifdef HAVE_STRINGS_H
+#    include <strings.h>
+#  endif /* HAVE_STRINGS_H */
+#  include <ctype.h>
+
+/*
+ * Apparently Unixware defines "index" to strchr (!) rather than
+ * providing a proper entry point or not providing the (obsolete)
+ * BSD function.  Make sure index is not defined...
+ */
+
+#  ifdef index
+#    undef index
+#  endif /* index */
+
+#  if defined(WIN32) && !defined(__CYGWIN__)
+#    define strcasecmp(s,t)	_stricmp((s), (t))
+#    define strncasecmp(s,t,n)	_strnicmp((s), (t), (n))
+/* Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
+ * on Windows, which is supposed to be POSIX compliant...  Some of these
+ * functions are also defined in ISO C99...
+ */
+#    ifndef __WATCOMC__
+#      define strdup _strdup
+#      define unlink _unlink
+#    endif /* !__WATCOMC__ */
+#  elif defined(__EMX__)
+#    define strcasecmp(s,t)	stricmp((s), (t))
+#    define strncasecmp(s,t,n)	strnicmp((s), (t), (n))
+#  endif /* WIN32 */
+
+#  ifdef __cplusplus
+extern "C" {
+#  endif /* __cplusplus */
+
+FLTK3_EXPORT extern int fl_snprintf(char *, size_t, const char *, ...);
+#  if !HAVE_SNPRINTF
+#    define snprintf fl_snprintf
+#  endif /* !HAVE_SNPRINTF */
+
+FLTK3_EXPORT extern int fl_vsnprintf(char *, size_t, const char *, va_list ap);
+#  if !HAVE_VSNPRINTF
+#    define vsnprintf fl_vsnprintf
+#  endif /* !HAVE_VSNPRINTF */
+
+/*
+ * strlcpy() and strlcat() are some really useful BSD string functions
+ * that work the way strncpy() and strncat() *should* have worked.
+ */
+
+FLTK3_EXPORT extern size_t fl_strlcat(char *, const char *, size_t);
+#  if !HAVE_STRLCAT
+#    define strlcat fl_strlcat
+#  endif /* !HAVE_STRLCAT */
+
+FLTK3_EXPORT extern size_t fl_strlcpy(char *, const char *, size_t);
+#  if !HAVE_STRLCPY
+#    define strlcpy fl_strlcpy
+#  endif /* !HAVE_STRLCPY */
+
+#  ifdef __cplusplus
+}
+#  endif /* __cplusplus */
+#endif /* !flstring_h */
+
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_font.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,103 @@
+//
+// "$Id$"
+//
+// Font selection code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef WIN32
+# ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+# endif
+/* We require Windows 2000 features such as GetGlyphIndices */
+# if !defined(WINVER) || (WINVER < 0x0500)
+#  ifdef WINVER
+#   undef WINVER
+#  endif
+#  define WINVER 0x0500
+# endif
+# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
+#  ifdef _WIN32_WINNT
+#   undef _WIN32_WINNT
+#  endif
+#  define _WIN32_WINNT 0x0500
+# endif
+#endif
+
+// Select fonts from the FLTK font table.
+#include "flstring.h"
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include "font.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef WIN32
+#  include "win32_font.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_font.cxx"
+#elif USE_XFT
+#  include "xft_font.cxx"
+#else
+#  include "x11_font.cxx"
+#endif // WIN32
+
+namespace fltk3 {
+  
+  double width(const char* c) {
+    if (c) return width(c, strlen(c));
+    else return 0.0f;
+  }
+  
+  void draw(const char* str, int x, int y) {
+    draw(str, strlen(str), x, y);
+  }
+  
+  void draw(int angle, const char* str, int x, int y) {
+    draw(angle, str, strlen(str), x, y);//must be fixed!
+  }
+  
+  void text_extents(const char *c, int &dx, int &dy, int &w, int &h) {
+    if (c)  fltk3::text_extents(c, strlen(c), dx, dy, w, h);
+    else {
+      w = 0; h = 0;
+      dx = 0; dy = 0;
+    }
+  } // fltk3::text_extents
+  
+  
+  void draw(const char* str, int l, float x, float y) {
+#ifdef __APPLE__
+    fltk3::graphics_driver->draw(str, l, x, y);
+#else
+    fltk3::draw(str, l, (int)x, (int)y);
+#endif
+  }
+  
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/font.h (from rev 9002, branches/branch-3.0/src/core/Fl_Font.H)
===================================================================
--- branches/branch-3.0/src/fltk3/font.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/font.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,122 @@
+//
+// "$Id$"
+//
+// Font definitions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Two internal fltk data structures:
+//
+// Fl_Fontdesc: an entry into the fltk3::font() table.  There is one of these
+// for each fltk font number.
+//
+#ifndef FL_FONT_
+#define FL_FONT_
+
+#include <config.h>
+
+#  if USE_XFT
+typedef struct _XftFont XftFont;
+#  elif !defined(WIN32) && !defined(__APPLE__)
+#    include <fltk3/Xutf8.h>
+#  endif // USE_XFT
+
+/**
+   This a structure for an actual system font, with junk to
+   help choose it and info on character sizes.  Each Fl_Fontdesc has a
+   linked list of these.  These are created the first time each system
+   font/size combination is used.
+*/
+class Fl_Font_Descriptor {
+public:
+  /** linked list for this Fl_Fontdesc */
+  Fl_Font_Descriptor *next;	
+  fltk3::Fontsize size; /**< font size */
+#ifndef FLTK3_DOXYGEN // don't bother with platorm dependant details in the doc. 
+#  ifdef WIN32
+  HFONT fid;
+  int *width[64];
+  TEXTMETRIC metr;
+  int angle;
+  FLTK3_EXPORT Fl_Font_Descriptor(const char* fontname, fltk3::Fontsize size);
+#  elif defined(__APPLE_QUARTZ__)
+  FLTK3_EXPORT Fl_Font_Descriptor(const char* fontname, fltk3::Fontsize size);
+  ATSUTextLayout layout;
+#     if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+  CTFontRef fontref;
+  // the unicode span is divided in 512 blocks of 128 characters
+  float *width[512]; // array of arrays of character widths
+#     endif
+  ATSUStyle style;
+  short ascent, descent, q_width;
+  char *q_name;
+#  elif USE_XFT
+  XftFont* font;
+  //const char* encoding;
+  int angle;
+  FLTK3_EXPORT Fl_Font_Descriptor(const char* xfontname, fltk3::Fontsize size, int angle);
+#  else
+  XUtf8FontStruct* font;	// X UTF-8 font information
+  FLTK3_EXPORT Fl_Font_Descriptor(const char* xfontname);
+#  endif
+#  if HAVE_GL
+  unsigned int listbase;// base of display list, 0 = none
+#ifndef __APPLE_QUARTZ__
+  char glok[64];
+#endif // __APPLE_QUARTZ__
+#  endif // HAVE_GL
+
+  FLTK3_EXPORT ~Fl_Font_Descriptor();
+
+#endif // FLTK3_DOXYGEN
+};
+
+//extern FLTK3_EXPORT Fl_Font_Descriptor *fltk3::fontsize; // the currently selected one
+
+struct Fl_Fontdesc {
+  const char *name;
+  char fontname[128];	// "Pretty" font name
+  Fl_Font_Descriptor *first;	// linked list of sizes of this style
+#  ifndef WIN32
+  char **xlist;		// matched X font names
+  int n;		// size of xlist, negative = don't free xlist!
+#  endif
+};
+
+namespace fltk3 {
+  extern FLTK3_EXPORT Fl_Fontdesc *fonts; // the table
+}
+
+#  ifndef WIN32
+// functions for parsing X font names:
+namespace fltk3 {
+  FLTK3_EXPORT const char* font_word(const char *p, int n);
+}
+FLTK3_EXPORT char *fl_find_fontsize(char *name);
+#  endif
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/get_key.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_get_key.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/get_key.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/get_key.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,69 @@
+//
+// "$Id$"
+//
+// Keyboard state routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef WIN32
+#  include "win32_get_key.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_get_key.cxx"
+#else
+
+// Return the current state of a key.  This is the X version.  I identify
+// keys (mostly) by the X keysym.  So this turns the keysym into a keycode
+// and looks it up in the X key bit vector, which Fl_x.cxx keeps track of.
+
+#  include <fltk3/run.h>
+#  include <fltk3/x.h>
+
+extern char fl_key_vector[32]; // in Fl_x.cxx
+
+int fltk3::event_key(unsigned int k) {
+  if (k > fltk3::MouseButton && k <= fltk3::MouseButton+8)
+    return fltk3::event_state(8<<(k-fltk3::MouseButton));
+  int i;
+#  ifdef __sgi
+  // get some missing PC keyboard keys:
+  if (k == fltk3::MetaLKey) i = 147;
+  else if (k == fltk3::MetaRKey) i = 148;
+  else if (k == fltk3::MenuKey) i = 149;
+  else
+#  endif
+    i = XKeysymToKeycode(fl_display, k);
+  if (i==0) return 0;
+  return fl_key_vector[i/8] & (1 << (i%8));
+}
+
+int fltk3::get_key(unsigned int k) {
+  fl_open_display();
+  XQueryKeymap(fl_display, fl_key_vector);
+  return event_key(k);
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/get_system_colors.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_get_system_colors.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/get_system_colors.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/get_system_colors.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,427 @@
+//
+// "$Id$"
+//
+// System color support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <fltk3/math.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/Pixmap.h>
+#include <fltk3/TiledImage.h>
+#include "tile.xpm"
+
+#if defined(WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
+// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
+// on Windows, which is supposed to be POSIX compliant...
+#  define putenv _putenv
+#endif // WIN32 && !__CYGWIN__
+
+static char	fl_bg_set = 0;
+static char	fl_bg2_set = 0;
+static char	fl_fg_set = 0;
+
+/**
+    Changes fltk3::color(fltk3::BACKGROUND_COLOR) to the given color, 
+    and changes the gray ramp from 32 to 56 to black to white.  These are 
+    the colors used as backgrounds by almost all widgets and used to draw 
+    the edges of all the boxtypes.
+*/
+void fltk3::background(uchar r, uchar g, uchar b) {
+  fl_bg_set = 1;
+
+  // replace the gray ramp so that fltk3::GRAY is this color
+  if (!r) r = 1; else if (r==255) r = 254;
+  double powr = log(r/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  if (!g) g = 1; else if (g==255) g = 254;
+  double powg = log(g/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  if (!b) b = 1; else if (b==255) b = 254;
+  double powb = log(b/255.0)/log((fltk3::GRAY-fltk3::GRAY_RAMP)/(fltk3::NUM_GRAY-1.0));
+  for (unsigned int i = 0; i < fltk3::NUM_GRAY; i++) {
+    double gray = i/(fltk3::NUM_GRAY-1.0);
+    fltk3::set_color(fltk3::gray_ramp(i),
+		  uchar(pow(gray,powr)*255+.5),
+		  uchar(pow(gray,powg)*255+.5),
+		  uchar(pow(gray,powb)*255+.5));
+  }
+}
+/** Changes fltk3::color(fltk3::FOREGROUND_COLOR). */
+void fltk3::foreground(uchar r, uchar g, uchar b) {
+  fl_fg_set = 1;
+
+  fltk3::set_color(fltk3::FOREGROUND_COLOR,r,g,b);
+}
+
+/**
+    Changes the alternative background color. This color is used as a 
+    background by fltk3::Input and other text widgets.
+    <P>This call may change fltk3::color(fltk3::FOREGROUND_COLOR) if it 
+    does not provide sufficient contrast to fltk3::BACKGROUND2_COLOR.
+*/
+void fltk3::background2(uchar r, uchar g, uchar b) {
+  fl_bg2_set = 1;
+
+  fltk3::set_color(fltk3::BACKGROUND2_COLOR,r,g,b);
+  fltk3::set_color(fltk3::FOREGROUND_COLOR,
+                get_color(fltk3::contrast(fltk3::FOREGROUND_COLOR,fltk3::BACKGROUND2_COLOR)));
+}
+
+// these are set by fltk3::args() and override any system colors:
+const char *fl_fg = NULL;
+const char *fl_bg = NULL;
+const char *fl_bg2 = NULL;
+
+static void set_selection_color(uchar r, uchar g, uchar b) {
+  fltk3::set_color(fltk3::SELECTION_COLOR,r,g,b);
+}
+
+#if defined(WIN32) || defined(__APPLE__)
+
+#  include <stdio.h>
+// simulation of XParseColor:
+int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
+  if (*p == '#') p++;
+  int n = strlen(p);
+  int m = n/3;
+  const char *pattern = 0;
+  switch(m) {
+  case 1: pattern = "%1x%1x%1x"; break;
+  case 2: pattern = "%2x%2x%2x"; break;
+  case 3: pattern = "%3x%3x%3x"; break;
+  case 4: pattern = "%4x%4x%4x"; break;
+  default: return 0;
+  }
+  int R,G,B; if (sscanf(p,pattern,&R,&G,&B) != 3) return 0;
+  switch(m) {
+  case 1: R *= 0x11; G *= 0x11; B *= 0x11; break;
+  case 3: R >>= 4; G >>= 4; B >>= 4; break;
+  case 4: R >>= 8; G >>= 8; B >>= 8; break;
+  }
+  r = (uchar)R; g = (uchar)G; b = (uchar)B;
+  return 1;
+}
+#else
+// Wrapper around XParseColor...
+int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b) {
+  XColor x;
+  if (!fl_display) fl_open_display();
+  if (XParseColor(fl_display, fl_colormap, p, &x)) {
+    r = (uchar)(x.red>>8);
+    g = (uchar)(x.green>>8);
+    b = (uchar)(x.blue>>8);
+    return 1;
+  } else return 0;
+}
+#endif // WIN32 || __APPLE__
+/** \fn fltk3::get_system_colors()
+    Read the user preference colors from the system and use them to call
+    fltk3::foreground(), fltk3::background(), and 
+    fltk3::background2().  This is done by
+    fltk3::Window::show(argc,argv) before applying the -fg and -bg
+    switches.
+    
+    <P>On X this reads some common values from the Xdefaults database.
+    KDE users can set these values by running the "krdb" program, and
+    newer versions of KDE set this automatically if you check the "apply
+    style to other X programs" switch in their control panel.
+*/
+#if defined(WIN32)
+static void
+getsyscolor(int what, const char* arg, void (*func)(uchar,uchar,uchar))
+{
+  if (arg) {
+    uchar r,g,b;
+    if (!fl_parse_color(arg, r,g,b))
+      fltk3::error("Unknown color: %s", arg);
+    else
+      func(r,g,b);
+  } else {
+    DWORD x = GetSysColor(what);
+    func(uchar(x&255), uchar(x>>8), uchar(x>>16));
+  }
+}
+
+void fltk3::get_system_colors() {
+  if (!fl_bg2_set) getsyscolor(COLOR_WINDOW,	fl_bg2,fltk3::background2);
+  if (!fl_fg_set) getsyscolor(COLOR_WINDOWTEXT,	fl_fg, fltk3::foreground);
+  if (!fl_bg_set) getsyscolor(COLOR_BTNFACE,	fl_bg, fltk3::background);
+  getsyscolor(COLOR_HIGHLIGHT,	0,     set_selection_color);
+}
+
+#elif defined(__APPLE__)
+// MacOS X currently supports two color schemes - Blue and Graphite.
+// Since we aren't emulating the Aqua interface (even if Apple would
+// let us), we use some defaults that are similar to both.  The
+// fltk3::scheme("plastic") color/box scheme provides a usable Aqua-like
+// look-n-feel...
+void fltk3::get_system_colors()
+{
+  fl_open_display();
+
+  if (!fl_bg2_set) background2(0xff, 0xff, 0xff);
+  if (!fl_fg_set) foreground(0, 0, 0);
+  if (!fl_bg_set) background(0xd8, 0xd8, 0xd8);
+  
+#if 0 
+  // this would be the correct code, but it does not run on all versions
+  // of OS X. Also, setting a bright selection color would require 
+  // some updates in fltk3::Adjuster and Fl_Help_Browser
+  OSStatus err;
+  RGBColor c;
+  err = GetThemeBrushAsColor(kThemeBrushPrimaryHighlightColor, 24, true, &c);
+  if (err)
+    set_selection_color(0x00, 0x00, 0x80);
+  else
+    set_selection_color(c.red, c.green, c.blue);
+#else
+  set_selection_color(0x00, 0x00, 0x80);
+#endif
+}
+#else
+
+// Read colors that KDE writes to the xrdb database.
+
+// XGetDefault does not do the expected thing: it does not like
+// periods in either word. Therefore it cannot match class.Text.background.
+// However *.Text.background is matched by pretending the program is "Text".
+// But this will also match *.background if there is no *.Text.background
+// entry, requiring users to put in both (unless they want the text fields
+// the same color as the windows).
+
+static void
+getsyscolor(const char *key1, const char* key2, const char *arg, const char *defarg, void (*func)(uchar,uchar,uchar))
+{
+  if (!arg) {
+    arg = XGetDefault(fl_display, key1, key2);
+    if (!arg) arg = defarg;
+  }
+  XColor x;
+  if (!XParseColor(fl_display, fl_colormap, arg, &x))
+    fltk3::error("Unknown color: %s", arg);
+  else
+    func(x.red>>8, x.green>>8, x.blue>>8);
+}
+
+void fltk3::get_system_colors()
+{
+  fl_open_display();
+  const char* key1 = 0;
+  if (fltk3::first_window()) key1 = fltk3::first_window()->xclass();
+  if (!key1) key1 = "fltk";
+  if (!fl_bg2_set) getsyscolor("Text","background",	fl_bg2,	"#ffffff", fltk3::background2);
+  if (!fl_fg_set) getsyscolor(key1,  "foreground",	fl_fg,	"#000000", fltk3::foreground);
+  if (!fl_bg_set) getsyscolor(key1,  "background",	fl_bg,	"#c0c0c0", fltk3::background);
+  getsyscolor("Text", "selectBackground", 0, "#000080", set_selection_color);
+}
+
+#endif
+
+
+//// Simple implementation of 2.0 fltk3::scheme() interface...
+#define D1 BORDER_WIDTH
+#define D2 (BORDER_WIDTH+BORDER_WIDTH)
+
+extern void	fl_gtk_up_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_down_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_thin_up_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_thin_down_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_round_up_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_round_down_box(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+
+extern void	fl_gtk_up_frame(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_down_frame(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_thin_up_frame(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+extern void	fl_gtk_thin_down_frame(int, int, int, int, fltk3::Color, fltk3::Boxtype);
+
+#ifndef FLTK3_DOXYGEN
+const char	*fltk3::scheme_ = (const char *)0;	    // current scheme 
+fltk3::Image	*fltk3::scheme_bg_ = (fltk3::Image *)0;    // current background image for the scheme
+#endif
+
+static fltk3::Pixmap	tile(tile_xpm);
+
+/**
+    Gets or sets the current widget scheme. NULL will use
+    the scheme defined in the FLTK_SCHEME environment
+    variable or the scheme resource under X11. Otherwise,
+    any of the following schemes can be used:</P>
+    
+    <ul>
+    
+    	<li>"none" or "gtk+" - This is the default look-n-feel which
+    	is inspired by the Red Hat Bluecurve theme</li>
+    
+    	<li>"plastic" - This scheme is inspired by the Aqua user interface
+    	on Mac OS X</li>
+    
+        <li>"classic" - This is the FLTK1 look which resembles old
+        Windows (95/98/Me/NT/2000) and old GTK/KDE</li>
+
+    </ul>
+*/
+int fltk3::scheme(const char *s) {
+  if (!s) {
+    if ((s = getenv("FLTK_SCHEME")) == NULL) {
+#if !defined(WIN32) && !defined(__APPLE__)
+      const char* key = 0;
+      if (fltk3::first_window()) key = fltk3::first_window()->xclass();
+      if (!key) key = "fltk";
+      fl_open_display();
+      s = XGetDefault(fl_display, key, "scheme");
+#endif // !WIN32 && !__APPLE__
+    }
+  }
+
+  if (s) {
+    if (!strcasecmp(s, "none") || !strcasecmp(s, "base") || !strcasecmp(s, "gtk+") || !*s) s = 0;
+    else s = strdup(s);
+  }
+  if (scheme_) free((void*)scheme_);
+  scheme_ = s;
+
+  // Save the new scheme in the FLTK_SCHEME env var so that child processes
+  // inherit it...
+  static char e[1024];
+  strcpy(e,"FLTK_SCHEME=");
+  if (s) strlcat(e,s,sizeof(e));
+  putenv(e);
+
+  // Load the scheme...
+  return reload_scheme();
+}
+
+int fltk3::reload_scheme() {
+  fltk3::Window *win;
+
+  if (scheme_ && !strcasecmp(scheme_, "plastic")) {
+    // Update the tile image to match the background color...
+    uchar r, g, b;
+    int nr, ng, nb;
+    int i;
+//    static uchar levels[3] = { 0xff, 0xef, 0xe8 };
+    // OSX 10.3 and higher use a background with less contrast...
+    static uchar levels[3] = { 0xff, 0xf8, 0xf4 };
+
+    get_color(fltk3::GRAY, r, g, b);
+
+//    printf("fltk3::GRAY = 0x%02x 0x%02x 0x%02x\n", r, g, b);
+
+    for (i = 0; i < 3; i ++) {
+      nr = levels[i] * r / 0xe8;
+      if (nr > 255) nr = 255;
+
+      ng = levels[i] * g / 0xe8;
+      if (ng > 255) ng = 255;
+
+      nb = levels[i] * b / 0xe8;
+      if (nb > 255) nb = 255;
+
+      sprintf(tile_cmap[i], "%c c #%02x%02x%02x", "Oo."[i], nr, ng, nb);
+//      puts(tile_cmap[i]);
+    }
+
+    tile.uncache();
+
+    // FIXME: there is a misunderstanding: please fix the ROUNDED vs. ROUND box types!
+    if (!scheme_bg_) scheme_bg_ = new fltk3::TiledImage(&tile, w(), h());
+
+    // Load plastic buttons, etc...
+    set_boxtype(fltk3::UP_FRAME,        fltk3::PLASTIC_UP_FRAME);
+    set_boxtype(fltk3::DOWN_FRAME,      fltk3::PLASTIC_DOWN_FRAME);
+    set_boxtype(fltk3::THIN_UP_FRAME,   fltk3::PLASTIC_UP_FRAME);
+    set_boxtype(fltk3::THIN_DOWN_FRAME, fltk3::PLASTIC_DOWN_FRAME);
+
+    set_boxtype(fltk3::UP_BOX,          fltk3::PLASTIC_UP_BOX);
+    set_boxtype(fltk3::DOWN_BOX,        fltk3::PLASTIC_DOWN_BOX);
+    set_boxtype(fltk3::THIN_UP_BOX,     fltk3::PLASTIC_THIN_UP_BOX);
+    set_boxtype(fltk3::THIN_DOWN_BOX,   fltk3::PLASTIC_THIN_DOWN_BOX);
+    set_boxtype(fltk3::ROUND_UP_BOX,    fltk3::PLASTIC_ROUND_UP_BOX);
+    set_boxtype(fltk3::ROUND_DOWN_BOX,  fltk3::PLASTIC_ROUND_DOWN_BOX);
+
+    // Use standard size scrollbars...
+    fltk3::scrollbar_size(16);
+  } else if (scheme_ && !strcasecmp(scheme_, "classic")) {
+    // Use the standard FLTK look-n-feel...
+    if (scheme_bg_) {
+      delete scheme_bg_;
+      scheme_bg_ = (fltk3::Image *)0;
+    }
+    
+    set_boxtype(fltk3::UP_FRAME,        fltk3::CLASSIC_UP_FRAME);
+    set_boxtype(fltk3::DOWN_FRAME,      fltk3::CLASSIC_DOWN_FRAME);
+    set_boxtype(fltk3::THIN_UP_FRAME,   fltk3::CLASSIC_THIN_UP_FRAME);
+    set_boxtype(fltk3::THIN_DOWN_FRAME, fltk3::CLASSIC_THIN_DOWN_FRAME);
+    
+    set_boxtype(fltk3::UP_BOX,          fltk3::CLASSIC_UP_BOX);
+    set_boxtype(fltk3::DOWN_BOX,        fltk3::CLASSIC_DOWN_BOX);
+    set_boxtype(fltk3::THIN_UP_BOX,     fltk3::CLASSIC_THIN_UP_BOX);
+    set_boxtype(fltk3::THIN_DOWN_BOX,   fltk3::CLASSIC_THIN_DOWN_BOX);
+    set_boxtype(fltk3::ROUND_UP_BOX,    fltk3::CLASSIC_ROUND_UP_BOX);
+    set_boxtype(fltk3::ROUND_DOWN_BOX,  fltk3::CLASSIC_ROUND_DOWN_BOX);
+    
+    // Use standard size scrollbars...
+    fltk3::scrollbar_size(16);
+  } else {
+    // Use a GTK+ inspired look-n-feel...
+    if (scheme_bg_) {
+      delete scheme_bg_;
+      scheme_bg_ = (fltk3::Image *)0;
+    }
+    
+    set_boxtype(fltk3::UP_FRAME,        fl_gtk_up_frame,	2,2,4,4);
+    set_boxtype(fltk3::DOWN_FRAME,      fl_gtk_down_frame,      2,2,4,4);
+    set_boxtype(fltk3::THIN_UP_FRAME,   fl_gtk_thin_up_frame,	1,1,2,2);
+    set_boxtype(fltk3::THIN_DOWN_FRAME, fl_gtk_thin_down_frame,	1,1,2,2);
+    
+    set_boxtype(fltk3::UP_BOX,          fl_gtk_up_box,		2,2,4,4);
+    set_boxtype(fltk3::DOWN_BOX,        fl_gtk_down_box,	2,2,4,4);
+    set_boxtype(fltk3::THIN_UP_BOX,     fl_gtk_thin_up_box,	1,1,2,2);
+    set_boxtype(fltk3::THIN_DOWN_BOX,   fl_gtk_thin_down_box,	1,1,2,2);
+    set_boxtype(fltk3::ROUND_UP_BOX,    fl_gtk_round_up_box,	2,2,4,4);
+    set_boxtype(fltk3::ROUND_DOWN_BOX,  fl_gtk_round_down_box,	2,2,4,4);
+        
+    // Use slightly thinner scrollbars...
+    fltk3::scrollbar_size(15);
+  }
+
+  // Set (or clear) the background tile for all windows...
+  for (win = first_window(); win; win = next_window(win)) {
+    win->labeltype(scheme_bg_ ? fltk3::NORMAL_LABEL : fltk3::NO_LABEL);
+    win->align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+    win->image(scheme_bg_);
+    win->redraw();
+  }
+
+  return 1;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/grab.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_grab.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/grab.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/grab.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,104 @@
+//
+// "$Id$"
+//
+// Grab/release code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+////////////////////////////////////////////////////////////////
+// "Grab" is done while menu systems are up.  This has several effects:
+// Events are all sent to the "grab window", which does not even
+// have to be displayed (and in the case of Fl_Menu.cxx it isn't).
+// The system is also told to "grab" events and send them to this app.
+// This also modifies how fltk3::Window::show() works, on X it turns on
+// override_redirect, it does similar things on WIN32.
+
+extern void fl_fix_focus(); // in Fl.cxx
+
+#ifdef WIN32
+// We have to keep track of whether we have captured the mouse, since
+// MSWindows shows little respect for this... Grep for fl_capture to
+// see where and how this is used.
+extern HWND fl_capture;
+#endif
+
+#ifdef __APPLE__
+extern void *fl_capture;
+#endif
+
+void fltk3::grab(fltk3::Window* win) {
+  if (win) {
+    if (!grab_) {
+#ifdef WIN32
+      SetActiveWindow(fl_capture = fl_xid(first_window()));
+      SetCapture(fl_capture);
+#elif defined(__APPLE__)
+      fl_capture = Fl_X::i(first_window())->xid;
+      Fl_X::i(first_window())->set_key_window();
+#else
+      XGrabPointer(fl_display,
+		   fl_xid(first_window()),
+		   1,
+		   ButtonPressMask|ButtonReleaseMask|
+		   ButtonMotionMask|PointerMotionMask,
+		   GrabModeAsync,
+		   GrabModeAsync, 
+		   None,
+		   0,
+		   fl_event_time);
+      XGrabKeyboard(fl_display,
+		    fl_xid(first_window()),
+		    1,
+		    GrabModeAsync,
+		    GrabModeAsync, 
+		    fl_event_time);
+#endif
+    }
+    grab_ = win;
+  } else {
+    if (grab_) {
+#ifdef WIN32
+      fl_capture = 0;
+      ReleaseCapture();
+#elif defined(__APPLE__)
+      fl_capture = 0;
+#else
+      XUngrabKeyboard(fl_display, fl_event_time);
+      XUngrabPointer(fl_display, fl_event_time);
+      // this flush is done in case the picked menu item goes into
+      // an infinite loop, so we don't leave the X server locked up:
+      XFlush(fl_display);
+#endif
+      grab_ = 0;
+      fl_fix_focus();
+    }
+  }
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/gtk.cxx (from rev 9002, branches/branch-3.0/src/core/fl_gtk.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/gtk.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/gtk.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,472 @@
+//
+// "$Id$"
+//
+// "GTK" drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// These box types provide a GTK+ look, based on Red Hat's Bluecurve
+// theme...
+//
+// Copyright 2006-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Box drawing code for an obscure box type.
+// These box types are in separate files so they are not linked
+// in if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+extern void fl_internal_boxtype(fltk3::Boxtype, fltk3::BoxDrawF*);
+
+static const int tie_gap = 5;
+static const float tie_dk = 0.3f;
+static const float tie_lt = 0.45f;
+static const int use_tie_lt = 1;
+
+
+static fltk3::Color gtk_get_color(fltk3::Color c) {
+  if (fltk3::draw_box_active()) return c;
+  else return fltk3::inactive(c);
+}
+
+static void gtk_color(fltk3::Color c) {
+  fltk3::color(gtk_get_color(c));
+}
+
+/*
+fltk3::color(hi);
+fltk3::yxline(x+1, y+2, b-2);
+fltk3::xyline(x+2, y+1, r-2);
+fltk3::color(ol);
+*/
+
+
+static void draw_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Color lt, fltk3::Color dk, fltk3::Boxtype t) {
+  float f = (dk==fltk3::WHITE) ? 0.2 : 0.5;
+  fltk3::Color ol = gtk_get_color(fltk3::color_average(fltk3::BLACK, c, f));
+  fltk3::Color hi = gtk_get_color(fltk3::color_average(lt, c, 0.5));
+  if (t & 0xff000000) {
+    int r = x+w-1, b = y+h-1, xr = x+w/2, yb = y+h/2;
+    fltk3::color(ol);
+    switch (t & (fltk3::TIE_LEFT|fltk3::TIE_TOP)) {
+      case 0:
+        fltk3::color(hi);
+        fltk3::yxline(x+1, y+2, yb);
+        fltk3::xyline(x+2, y+1, xr);
+        fltk3::color(ol);
+        fltk3::begin_line();
+        fltk3::vertex(x, yb);
+        fltk3::vertex(x, y+2);
+        fltk3::vertex(x+2, y);
+        fltk3::vertex(xr, y);
+        fltk3::end_line();
+        break;
+      case fltk3::TIE_LEFT:
+        fltk3::color(hi);
+        fltk3::xyline(x, y+1, xr);
+        fltk3::color(ol);
+        fltk3::xyline(x, y, xr);
+        break;
+      case fltk3::TIE_TOP:
+        fltk3::color(hi);
+        fltk3::yxline(x+1, y, yb);
+        fltk3::color(ol);
+        fltk3::yxline(x, yb, y);
+    }
+    switch (t & (fltk3::TIE_RIGHT|fltk3::TIE_TOP)) {
+      case 0:
+        fltk3::color(hi);
+        fltk3::xyline(xr, y+1, r-2);
+        fltk3::color(ol);
+        fltk3::begin_line();
+        fltk3::vertex(xr, y);
+        fltk3::vertex(r-2, y);
+        fltk3::vertex(r, y+2);
+        fltk3::vertex(r, yb);
+        fltk3::end_line();
+        break;
+      case fltk3::TIE_RIGHT:
+        fltk3::color(hi);
+        fltk3::xyline(xr, y+1, r);
+        fltk3::color(ol);
+        fltk3::xyline(xr, y, r);
+        break;
+      case fltk3::TIE_TOP:
+        fltk3::yxline(r, y, yb);
+    }
+    switch (t & (fltk3::TIE_RIGHT|fltk3::TIE_BOTTOM)) {
+      case 0:
+        fltk3::begin_line();
+        fltk3::vertex(r, yb);
+        fltk3::vertex(r, b-2);
+        fltk3::vertex(r-2, b);
+        fltk3::vertex(xr, b);
+        fltk3::end_line();
+        break;
+      case fltk3::TIE_RIGHT:
+        fltk3::xyline(xr, b, r);
+        break;
+      case fltk3::TIE_BOTTOM:
+        fltk3::yxline(r, yb, b);
+    }
+    switch (t & (fltk3::TIE_LEFT|fltk3::TIE_BOTTOM)) {
+      case 0:
+        fltk3::color(hi);
+        fltk3::yxline(x+1, yb, b-2);
+        fltk3::color(ol);
+        fltk3::begin_line();
+        fltk3::vertex(xr, b);
+        fltk3::vertex(x+2, b);
+        fltk3::vertex(x, b-2);
+        fltk3::vertex(x, yb);
+        fltk3::end_line();
+        break;
+      case fltk3::TIE_LEFT:
+        fltk3::xyline(x, b, xr);
+        break;
+      case fltk3::TIE_BOTTOM:
+        fltk3::color(hi);
+        fltk3::yxline(x+1, yb, b);
+        fltk3::color(ol);
+        fltk3::yxline(x, yb, b);
+    }
+  } else {
+    fltk3::color(hi);
+    fltk3::xyline(x + 2, y + 1, x + w - 3);
+    fltk3::yxline(x + 1, y + 2, y + h - 3);
+    
+    fltk3::color(ol);
+    fltk3::begin_loop();
+    fltk3::vertex(x, y + 2);
+    fltk3::vertex(x + 2, y);
+    fltk3::vertex(x + w - 3, y);
+    fltk3::vertex(x + w - 1, y + 2);
+    fltk3::vertex(x + w - 1, y + h - 3);
+    fltk3::vertex(x + w - 3, y + h - 1);
+    fltk3::vertex(x + 2, y + h - 1);
+    fltk3::vertex(x, y + h - 3);
+    fltk3::end_loop();
+  }
+}
+
+static void draw_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Color lt, fltk3::Color dk, fltk3::Boxtype t) {
+  float f = (dk==fltk3::WHITE) ? 0.5 : 1.0;
+  draw_frame(x, y, w, h, c, lt, dk, t);
+  if (t & 0xff000000) {
+    int r = x+w-1, b = y+h-1;
+    int x2 = x+2, r2 = r-2;
+    int y2 = y+2, b2 = b-2;
+    if (t & fltk3::TIE_LEFT)  x2 = x;
+    if (t & fltk3::TIE_RIGHT) r2 = r;
+    if (t & fltk3::TIE_TOP) {
+      y2 = y;
+      if (use_tie_lt) {
+        gtk_color(fltk3::color_average(fltk3::WHITE, c, tie_lt));
+        fltk3::xyline(x+tie_gap, y, r-tie_gap);
+        fltk3::color(c);
+        fltk3::xyline(x2, y, x+tie_gap-1);
+        fltk3::xyline(r-tie_gap+1, y, r2+1);
+        fltk3::rectf(x2, y+1, r2-x2+1, 4);
+      } else {
+        fltk3::color(c);
+        fltk3::rectf(x2, y, r2-x2+2, 5);
+      }
+    } else {
+      gtk_color(fltk3::color_average(lt, c, 0.4f*f));
+      fltk3::xyline(x2, y+2, r2);
+      gtk_color(fltk3::color_average(lt, c, 0.2f*f));
+      fltk3::xyline(x2, y+3, r2);
+      gtk_color(fltk3::color_average(lt, c, 0.1f*f));
+      fltk3::xyline(x2, y+4, r2);
+    }
+    gtk_color(c);
+    fltk3::rectf(x2, y + 5, r2-x2+1, h - 7);
+    if (t & fltk3::TIE_BOTTOM) {
+      b2 = b;
+      gtk_color(fltk3::color_average(fltk3::BLACK, c, tie_dk));
+      fltk3::xyline(x+tie_gap, b, r-tie_gap);
+      fltk3::color(c);
+      fltk3::xyline(x2, b, x+tie_gap-1);
+      fltk3::xyline(r-tie_gap+1, b, r2);
+      fltk3::rectf(x2, y+h-4, r2-x2+1, 3);
+    } else {
+      gtk_color(fltk3::color_average(dk, c, 0.025f/f));
+      fltk3::xyline(x2, b-3, r2);
+      gtk_color(fltk3::color_average(dk, c, 0.05f/f));
+      fltk3::xyline(x2, b-2, r2);
+      gtk_color(fltk3::color_average(dk, c, 0.1f/f));
+      fltk3::xyline(x2, b-1, r2);
+    }
+    if (t & fltk3::TIE_LEFT) {
+      if (use_tie_lt) {
+        gtk_color(fltk3::color_average(fltk3::WHITE, c, tie_lt));
+        fltk3::yxline(x, y+tie_gap, b-tie_gap);
+        //gtk_color(c);
+        //fltk3::yxline(x, y2, y+tie_gap-1);
+        //fltk3::yxline(x, b-tie_gap+1, b2);
+      }
+    }
+    if (t & fltk3::TIE_RIGHT) {
+      gtk_color(fltk3::color_average(fltk3::BLACK, c, tie_dk));
+      fltk3::yxline(r, y+tie_gap, b-tie_gap);
+    } else {
+      gtk_color(fltk3::color_average(dk, c, 0.1f));
+      fltk3::yxline(r-1, y2, b2);
+    }
+  } else {
+    gtk_color(fltk3::color_average(lt, c, 0.4f));
+    fltk3::xyline(x + 2, y + 2, x + w - 3);
+    gtk_color(fltk3::color_average(lt, c, 0.2f));
+    fltk3::xyline(x + 2, y + 3, x + w - 3);
+    gtk_color(fltk3::color_average(lt, c, 0.1f));
+    fltk3::xyline(x + 2, y + 4, x + w - 3);
+    gtk_color(c);
+    fltk3::rectf(x + 2, y + 5, w - 4, h - 7);
+    gtk_color(fltk3::color_average(dk, c, 0.025f));
+    fltk3::xyline(x + 2, y + h - 4, x + w - 3);
+    gtk_color(fltk3::color_average(dk, c, 0.05f));
+    fltk3::xyline(x + 2, y + h - 3, x + w - 3);
+    gtk_color(fltk3::color_average(dk, c, 0.1f));
+    fltk3::xyline(x + 2, y + h - 2, x + w - 3);
+    fltk3::yxline(x + w - 2, y + 2, y + h - 3);
+  }
+}
+
+void fl_gtk_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  draw_frame(x, y, w, h, c, fltk3::WHITE, fltk3::BLACK, t);
+}
+
+void fl_gtk_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  draw_box(x, y, w, h, c, fltk3::WHITE, fltk3::BLACK, t);
+}
+
+void fl_gtk_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+#if 1
+  draw_frame(x, y, w, h, c, fltk3::BLACK, fltk3::WHITE, t);
+#else
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.5));
+  fltk3::begin_loop();
+    fltk3::vertex(x, y + 2);
+    fltk3::vertex(x + 2, y);
+    fltk3::vertex(x + w - 3, y);
+    fltk3::vertex(x + w - 1, y + 2);
+    fltk3::vertex(x + w - 1, y + h - 3);
+    fltk3::vertex(x + w - 3, y + h - 1);
+    fltk3::vertex(x + 2, y + h - 1);
+    fltk3::vertex(x, y + h - 3);
+  fltk3::end_loop();
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.1f));
+  fltk3::xyline(x + 2, y + 1, x + w - 3);
+  fltk3::yxline(x + 1, y + 2, y + h - 3);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.05f));
+  fltk3::yxline(x + 2, y + h - 2, y + 2, x + w - 2);
+#endif
+}
+
+
+void fl_gtk_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+#if 1
+  draw_box(x, y, w, h, c, fltk3::BLACK, fltk3::WHITE, t);
+#else
+  fl_gtk_down_frame(x, y, w, h, c, t);
+
+  gtk_color(c);
+  fltk3::rectf(x + 3, y + 3, w - 5, h - 4);
+  fltk3::yxline(x + w - 2, y + 3, y + h - 3);
+#endif
+}
+
+
+void fl_gtk_thin_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.6f));
+  fltk3::xyline(x + 1, y, x + w - 2);
+  fltk3::yxline(x, y + 1, y + h - 2);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.4f));
+  fltk3::xyline(x + 1, y + h - 1, x + w - 2);
+  fltk3::yxline(x + w - 1, y + 1, y + h - 2);
+}
+
+
+void fl_gtk_thin_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_gtk_thin_up_frame(x, y, w, h, c, t);
+
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.4f));
+  fltk3::xyline(x + 1, y + 1, x + w - 2);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.2f));
+  fltk3::xyline(x + 1, y + 2, x + w - 2);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.1f));
+  fltk3::xyline(x + 1, y + 3, x + w - 2);
+  gtk_color(c);
+  fltk3::rectf(x + 1, y + 4, w - 2, h - 8);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.025f));
+  fltk3::xyline(x + 1, y + h - 4, x + w - 2);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.05f));
+  fltk3::xyline(x + 1, y + h - 3, x + w - 2);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.1f));
+  fltk3::xyline(x + 1, y + h - 2, x + w - 2);
+}
+
+
+void fl_gtk_thin_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.4f));
+  fltk3::xyline(x + 1, y, x + w - 2);
+  fltk3::yxline(x, y + 1, y + h - 2);
+
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.6f));
+  fltk3::xyline(x + 1, y + h - 1, x + w - 2);
+  fltk3::yxline(x + w - 1, y + 1, y + h - 2);
+}
+
+
+void fl_gtk_thin_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_gtk_thin_down_frame(x, y, w, h, c, t);
+
+  gtk_color(c);
+  fltk3::rectf(x + 1, y + 1, w - 2, h - 2);
+}
+
+//------------------------
+// new GTK+ style for round buttons
+#if 1
+
+static void arc_i(int x,int y,int w,int h,double a1,double a2) {
+  fltk3::arc(x,y,w,h,a1,a2);
+}
+
+enum {UPPER_LEFT, LOWER_RIGHT, CLOSED, FILL};
+
+static void draw(int which, int x,int y,int w,int h, int inset)
+{
+  if (inset*2 >= w) inset = (w-1)/2;
+  if (inset*2 >= h) inset = (h-1)/2;
+  x += inset;
+  y += inset;
+  w -= 2*inset;
+  h -= 2*inset;
+  int d = w <= h ? w : h;
+  if (d <= 1) return;
+  void (*f)(int,int,int,int,double,double);
+  f = (which==FILL) ? fltk3::pie : arc_i;
+  if (which >= CLOSED) {
+    f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
+    f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
+  } else if (which == UPPER_LEFT) {
+    f(x+w-d, y, d, d, 45, w<=h ? 180 : 90);
+    f(x, y+h-d, d, d, w<=h ? 180 : 90, 225);
+  } else { // LOWER_RIGHT
+    f(x, y+h-d, d, d, 225, w<=h ? 360 : 270);
+    f(x+w-d, y, d, d, w<=h ? 360 : 270, 360+45);
+  }
+  if (which == FILL) {
+    if (w < h)
+      fltk3::rectf(x, y+d/2, w, h-(d&-2));
+    else if (w > h)
+      fltk3::rectf(x+d/2, y, w-(d&-2), h);
+  } else {
+    if (w < h) {
+      if (which != UPPER_LEFT) fltk3::yxline(x+w-1, y+d/2-1, y+h-d/2+1);
+      if (which != LOWER_RIGHT) fltk3::yxline(x, y+d/2-1, y+h-d/2+1);
+    } else if (w > h) {
+      if (which != UPPER_LEFT) fltk3::xyline(x+d/2-1, y+h-1, x+w-d/2+1);
+      if (which != LOWER_RIGHT) fltk3::xyline(x+d/2-1, y, x+w-d/2+1);
+    }
+  }
+}
+
+void fl_gtk_round_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c);
+  draw(FILL,	    x,   y, w,   h, 2);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.025f));
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 2);
+  draw(LOWER_RIGHT, x,   y, w,   h, 3);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.05f));
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 1);
+  draw(LOWER_RIGHT, x,   y, w,   h, 2);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.1f));
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 0);
+  draw(LOWER_RIGHT, x,   y, w,   h, 1);
+
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.1f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 4);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 3);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.2f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 3);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 2);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.4f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 2);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 1);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.5f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 1);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 0);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.5f));
+  draw(CLOSED,	    x,   y, w,   h, 0);
+}
+
+void fl_gtk_round_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c);
+  draw(FILL,	    x,   y, w,   h, 2);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.05f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 2);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 1);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.1f));
+  draw(UPPER_LEFT,  x,   y, w,   h, 1);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 0);
+
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.5f));
+  draw(CLOSED,	    x,   y, w,   h, 0);
+}
+
+#else
+
+void fl_gtk_round_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  gtk_color(c);
+  fltk3::pie(x, y, w, h, 0.0, 360.0);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.5f));
+  fltk3::arc(x, y, w, h, 45.0, 180.0);
+  gtk_color(fltk3::color_average(fltk3::WHITE, c, 0.25f));
+  fltk3::arc(x, y, w, h, 180.0, 405.0);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.5f));
+  fltk3::arc(x, y, w, h, 225.0, 360.0);
+}
+
+
+void fl_gtk_round_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  gtk_color(c);
+  fltk3::pie(x, y, w, h, 0.0, 360.0);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.2));
+  fltk3::arc(x + 1, y, w, h, 90.0, 210.0);
+  gtk_color(fltk3::color_average(fltk3::BLACK, c, 0.6));
+  fltk3::arc(x, y, w, h, 0.0, 360.0);
+}
+
+#endif
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/labeltype.cxx (from rev 9002, branches/branch-3.0/src/core/fl_labeltype.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/labeltype.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/labeltype.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,162 @@
+//
+// "$Id$"
+//
+// Label drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Drawing code for the (one) common label types.
+// Other label types (symbols) are in their own source files
+// to avoid linking if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/Group.h>
+#include <fltk3/draw.h>
+#include <fltk3/Image.h>
+
+void
+fl_no_label(const fltk3::Label*,int,int,int,int,fltk3::Align) {}
+
+void
+fl_normal_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align)
+{
+  fltk3::font(o->font, o->size);
+  fltk3::color((fltk3::Color)o->color);
+  fltk3::draw(o->value, X, Y, W, H, align, o->image);
+}
+
+void
+fl_normal_measure(const fltk3::Label* o, int& W, int& H) {
+  fltk3::font(o->font, o->size);
+  fltk3::measure(o->value, W, H);
+  if (o->image) {
+    if (o->image->w() > W) W = o->image->w();
+    H += o->image->h();
+  }
+}
+
+#define MAX_LABELTYPE 16
+
+void fl_shadow_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align);
+void fl_engraved_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align);
+void fl_embossed_label(const fltk3::Label* o, int X, int Y, int W, int H, fltk3::Align align);
+void fl_multi_labeltype(const fltk3::Label* o, int x, int y, int w, int h, fltk3::Align a);
+void fl_multi_measure(const fltk3::Label* o, int& w, int& h);
+void fl_icon_labeltype(const fltk3::Label* o, int x, int y, int w, int h, fltk3::Align a);
+
+static fltk3::LabelDrawF* table[MAX_LABELTYPE] = {
+  fl_normal_label,
+  fl_no_label,
+  fl_shadow_label,      // fltk3::SHADOW_LABEL,
+  fl_engraved_label,    // fltk3::ENGRAVED_LABEL,
+  fl_embossed_label,    // fltk3::EMBOSSED_LABEL,
+  fl_multi_labeltype,   // fltk3::MULTI_LABEL,
+  fl_icon_labeltype,    // fltk3::ICON_LABEL,
+  fltk3::Image::labeltype, // fltk3::IMAGE_LABEL
+  // fltk3::FREE_LABELTYPE+n:
+  fl_no_label, fl_no_label,
+  fl_no_label, fl_no_label, fl_no_label,
+  fl_no_label, fl_no_label, fl_no_label
+};
+
+static fltk3::LabelMeasureF* measure[MAX_LABELTYPE] = {
+  0L, // normal
+  0L, // no
+  0L, // shadow
+  0L, // engraved
+  0L, // embossed
+  fl_multi_measure, // multi
+  0L, //icon
+  fltk3::Image::measure // image
+};
+
+/** Sets the functions to call to draw and measure a specific labeltype. */
+void fltk3::set_labeltype(fltk3::Labeltype t,fltk3::LabelDrawF* f,fltk3::LabelMeasureF*m) 
+{
+  table[t] = f; ::measure[t] = m;
+}
+
+////////////////////////////////////////////////////////////////
+
+/** Draws a label with arbitrary alignment in an arbitrary box. */
+void fltk3::Label::draw(int X, int Y, int W, int H, fltk3::Align align) const {
+  if (!value && !image) return;
+  table[type](this, X, Y, W, H, align);
+}
+
+/** 
+    Measures the size of the label.
+    \param[in,out] W, H : this is the requested size for the label text plus image;
+         on return, this will contain the size needed to fit the label
+*/
+void fltk3::Label::measure(int& W, int& H) const {
+  if (!value && !image) {
+    W = H = 0;
+    return;
+  }
+
+  fltk3::LabelMeasureF* f = ::measure[type]; if (!f) f = fl_normal_measure;
+  f(this, W, H);
+}
+
+/** Draws the widget's label at the defined label position.
+    This is the normal call for a widget's draw() method.
+ */
+void fltk3::Widget::draw_label() const {
+  int X = x_+fltk3::box_dx(box());
+  int W = w_-fltk3::box_dw(box());
+  if (W > 11 && align()&(fltk3::ALIGN_LEFT|fltk3::ALIGN_RIGHT)) {X += 3; W -= 6;}
+  draw_label(X, y_+fltk3::box_dy(box()), W, h_-fltk3::box_dh(box()));
+}
+
+/** Draws the label in an arbitrary bounding box.
+    draw() can use this instead of draw_label(void) to change the bounding box
+ */
+void fltk3::Widget::draw_label(int X, int Y, int W, int H) const {
+  // quit if we are not drawing a label inside the widget:
+  if ((align()&15) && !(align() & fltk3::ALIGN_INSIDE)) return;
+  draw_label(X,Y,W,H,align());
+}
+
+/** Draws the label in an arbitrary bounding box with an arbitrary alignment.
+    Anybody can call this to force the label to draw anywhere.
+ */
+void fltk3::Widget::draw_label(int X, int Y, int W, int H, fltk3::Align a) const {
+  if (flags()&SHORTCUT_LABEL) fltk3::draw_shortcut = 1;
+  fltk3::Label l1 = label_;
+  if (!active_r()) {
+    l1.color = fltk3::inactive((fltk3::Color)l1.color);
+    if (l1.deimage) l1.image = l1.deimage;
+  }
+  l1.draw(X,Y,W,H,a);
+  fltk3::draw_shortcut = 0;
+}
+
+// include these vars here so they can be referenced without including
+// fltk3::Input_ code:
+#include <fltk3/Input_.h>
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/line_style.cxx (from rev 9002, branches/branch-3.0/src/core/fl_line_style.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/line_style.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/line_style.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,174 @@
+//
+// "$Id$"
+//
+// Line style code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_line_style.cxx
+  \brief Line style drawing utility hiding different platforms.
+*/
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <fltk3/Printer.h>
+#include "flstring.h"
+#include <stdio.h>
+
+// We save the current line width (absolute value) here.
+// This is currently used only for X11 clipping, see src/fltk3::rect.cxx.
+// FIXME: this would probably better be in class fltk3::
+int fl_line_width_ = 0;
+
+#ifdef __APPLE_QUARTZ__
+float fl_quartz_line_width_ = 1.0f;
+static enum CGLineCap fl_quartz_line_cap_ = kCGLineCapButt;
+static enum CGLineJoin fl_quartz_line_join_ = kCGLineJoinMiter;
+static CGFloat *fl_quartz_line_pattern = 0;
+static int fl_quartz_line_pattern_size = 0;
+void fl_quartz_restore_line_style_() {
+  CGContextSetLineWidth(fl_gc, fl_quartz_line_width_);
+  CGContextSetLineCap(fl_gc, fl_quartz_line_cap_);
+  CGContextSetLineJoin(fl_gc, fl_quartz_line_join_);
+  CGContextSetLineDash(fl_gc, 0, fl_quartz_line_pattern, fl_quartz_line_pattern_size);
+}
+#endif
+
+void fltk3::GraphicsDriver::line_style(int style, int width, char* dashes) {
+
+  // save line width in global variable for X11 clipping
+  if (width == 0) fl_line_width_ = 1;
+  else fl_line_width_ = width>0 ? width : -width;
+
+#if defined(USE_X11)
+  int ndashes = dashes ? strlen(dashes) : 0;
+  // emulate the WIN32 dash patterns on X
+  char buf[7];
+  if (!ndashes && (style&0xff)) {
+    int w = width ? width : 1;
+    char dash, dot, gap;
+    // adjust lengths to account for cap:
+    if (style & 0x200) {
+      dash = char(2*w);
+      dot = 1; // unfortunately 0 does not work
+      gap = char(2*w-1);
+    } else {
+      dash = char(3*w);
+      dot = gap = char(w);
+    }
+    char* p = dashes = buf;
+    switch (style & 0xff) {
+    case fltk3::DASH:	*p++ = dash; *p++ = gap; break;
+    case fltk3::DOT:	*p++ = dot; *p++ = gap; break;
+    case fltk3::DASHDOT:	*p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; break;
+    case fltk3::DASHDOTDOT: *p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; *p++ = dot; *p++ = gap; break;
+    }
+    ndashes = p-buf;
+  }
+  static int Cap[4] = {CapButt, CapButt, CapRound, CapProjecting};
+  static int Join[4] = {JoinMiter, JoinMiter, JoinRound, JoinBevel};
+  XSetLineAttributes(fl_display, fl_gc, width, 
+		     ndashes ? LineOnOffDash : LineSolid,
+		     Cap[(style>>8)&3], Join[(style>>12)&3]);
+  if (ndashes) XSetDashes(fl_display, fl_gc, 0, dashes, ndashes);
+#elif defined(WIN32)
+  // According to Bill, the "default" cap and join should be the
+  // "fastest" mode supported for the platform.  I don't know why
+  // they should be different (same graphics cards, etc., right?) MRS
+  static DWORD Cap[4]= {PS_ENDCAP_FLAT, PS_ENDCAP_FLAT, PS_ENDCAP_ROUND, PS_ENDCAP_SQUARE};
+  static DWORD Join[4]={PS_JOIN_ROUND, PS_JOIN_MITER, PS_JOIN_ROUND, PS_JOIN_BEVEL};
+  int s1 = PS_GEOMETRIC | Cap[(style>>8)&3] | Join[(style>>12)&3];
+  DWORD a[16]; int n = 0;
+  if (dashes && dashes[0]) {
+    s1 |= PS_USERSTYLE;
+    for (n = 0; n < 16 && *dashes; n++) a[n] = *dashes++;
+  } else {
+    s1 |= style & 0xff; // allow them to pass any low 8 bits for style
+  }
+  if ((style || n) && !width) width = 1; // fix cards that do nothing for 0?
+  LOGBRUSH penbrush = {BS_SOLID,fl_RGB(),0}; // can this be fl_brush()?
+  HPEN newpen = ExtCreatePen(s1, width, &penbrush, n, n ? a : 0);
+  if (!newpen) {
+    fltk3::error("fltk3::line_style(): Could not create GDI pen object.");
+    return;
+  }
+  HPEN oldpen = (HPEN)SelectObject(fl_gc, newpen);
+  DeleteObject(oldpen);
+  DeleteObject(fl_current_xmap->pen);
+  fl_current_xmap->pen = newpen;
+#elif defined(__APPLE_QUARTZ__)
+  static enum CGLineCap Cap[4] = { kCGLineCapButt, kCGLineCapButt, 
+                                   kCGLineCapRound, kCGLineCapSquare };
+  static enum CGLineJoin Join[4] = { kCGLineJoinMiter, kCGLineJoinMiter, 
+                                    kCGLineJoinRound, kCGLineJoinBevel };
+  if (width<1) width = 1;
+  fl_quartz_line_width_ = (float)width; 
+  fl_quartz_line_cap_ = Cap[(style>>8)&3];
+  // when printing kCGLineCapSquare seems better for solid lines
+  if ( fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id && style == fltk3::SOLID && dashes == NULL ) {
+    fl_quartz_line_cap_ = kCGLineCapSquare;
+    }
+  fl_quartz_line_join_ = Join[(style>>12)&3];
+  char *d = dashes; 
+  static CGFloat pattern[16];
+  if (d && *d) {
+	CGFloat *p = pattern;
+    while (*d) { *p++ = (float)*d++; }
+    fl_quartz_line_pattern = pattern;
+    fl_quartz_line_pattern_size = d-dashes;
+  } else if (style & 0xff) {
+    char dash, dot, gap;
+    // adjust lengths to account for cap:
+    if (style & 0x200) {
+      dash = char(2*width);
+      dot = 1; 
+      gap = char(2*width-1);
+    } else {
+      dash = char(3*width);
+      dot = gap = char(width);
+    }
+	CGFloat *p = pattern;
+    switch (style & 0xff) {
+    case fltk3::DASH:       *p++ = dash; *p++ = gap; break;
+    case fltk3::DOT:        *p++ = dot; *p++ = gap; break;
+    case fltk3::DASHDOT:    *p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; break;
+    case fltk3::DASHDOTDOT: *p++ = dash; *p++ = gap; *p++ = dot; *p++ = gap; *p++ = dot; *p++ = gap; break;
+    }
+    fl_quartz_line_pattern_size = p-pattern;
+    fl_quartz_line_pattern = pattern;
+  } else {
+    fl_quartz_line_pattern = 0; 
+		fl_quartz_line_pattern_size = 0;
+  }
+  fl_quartz_restore_line_style_();
+#else
+# error unsupported platform
+#endif
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/lock.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_lock.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/lock.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/lock.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,418 @@
+//
+// "$Id$"
+//
+// Multi-threading support code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+#include <fltk3/run.h>
+#include <config.h>
+
+#include <stdlib.h>
+
+/*
+   From Bill:
+
+   I would prefer that FLTK contain the minimal amount of extra
+   stuff for doing threads.  There are other portable thread
+   wrapper libraries out there and FLTK should not be providing
+   another.  This file is an attempt to make minimal additions
+   and make them self-contained in this source file.
+
+   From Mike:
+
+   Starting with 1.1.8, we now have a callback so that you can
+   process awake() messages as they come in.
+
+
+   The API:
+
+   fltk3::lock() - recursive lock.  You must call this before the
+   first call to fltk3::wait()/run() to initialize the thread
+   system. The lock is locked all the time except when
+   fltk3::wait() is waiting for events.
+
+   fltk3::unlock() - release the recursive lock.
+
+   fltk3::awake(void*) - Causes fltk3::wait() to return (with the lock
+   locked) even if there are no events ready.
+
+   fltk3::awake(void (*cb)(void *), void*) - Call a function
+   in the main thread from within another thread of execution.
+
+   fltk3::thread_message() - returns an argument sent to an
+   fltk3::awake() call, or returns NULL if none.  WARNING: the
+   current implementation only has a one-entry queue and only
+   returns the most recent value!
+*/
+
+#ifndef FLTK3_DOXYGEN
+fltk3::AwakeHandler *fltk3::awake_ring_;
+void **fltk3::awake_data_;
+int fltk3::awake_ring_size_;
+int fltk3::awake_ring_head_;
+int fltk3::awake_ring_tail_;
+#endif
+
+static const int AWAKE_RING_SIZE = 1024;
+static void lock_ring();
+static void unlock_ring();
+
+
+/** Adds an awake handler for use in awake(). */
+int fltk3::add_awake_handler_(fltk3::AwakeHandler func, void *data)
+{
+  int ret = 0;
+  lock_ring();
+  if (!awake_ring_) {
+    awake_ring_size_ = AWAKE_RING_SIZE;
+    awake_ring_ = (fltk3::AwakeHandler*)malloc(awake_ring_size_*sizeof(fltk3::AwakeHandler));
+    awake_data_ = (void**)malloc(awake_ring_size_*sizeof(void*));
+  }
+  if (awake_ring_head_==awake_ring_tail_-1 || awake_ring_head_+1==awake_ring_tail_) {
+    // ring is full. Return -1 as an error indicator.
+    ret = -1;
+  } else {
+    awake_ring_[awake_ring_head_] = func;
+    awake_data_[awake_ring_head_] = data;
+    ++awake_ring_head_;
+    if (awake_ring_head_ == awake_ring_size_)
+      awake_ring_head_ = 0;
+  }
+  unlock_ring();
+  return ret;
+}
+/** Gets the last stored awake handler for use in awake(). */
+int fltk3::get_awake_handler_(fltk3::AwakeHandler &func, void *&data)
+{
+  int ret = 0;
+  lock_ring();
+  if (!awake_ring_ || awake_ring_head_ == awake_ring_tail_) {
+    ret = -1;
+  } else {
+    func = awake_ring_[awake_ring_tail_];
+    data = awake_data_[awake_ring_tail_];
+    ++awake_ring_tail_;
+    if (awake_ring_tail_ == awake_ring_size_)
+      awake_ring_tail_ = 0;
+  }
+  unlock_ring();
+  return ret;
+}
+
+/**
+ Let the main thread know an update is pending and have it call a specific function.
+ Registers a function that will be 
+ called by the main thread during the next message handling cycle. 
+ Returns 0 if the callback function was registered, 
+ and -1 if registration failed. Over a thousand awake callbacks can be
+ registered simultaneously.
+ 
+ \see fltk3::awake(void* message=0)
+*/
+int fltk3::awake(fltk3::AwakeHandler func, void *data) {
+  int ret = add_awake_handler_(func, data);
+  fltk3::awake();
+  return ret;
+}
+
+////////////////////////////////////////////////////////////////
+// Windows threading...
+/** \fn int fltk3::lock()
+    The lock() method blocks the current thread until it
+    can safely access FLTK widgets and data. Child threads should
+    call this method prior to updating any widgets or accessing
+    data. The main thread must call lock() to initialize
+    the threading support in FLTK. lock() will return non-zero
+    if threading is not available on the platform.
+    
+    Child threads must call unlock() when they are done
+    accessing FLTK.
+    
+    When the wait() method is waiting
+    for input or timeouts, child threads are given access to FLTK.
+    Similarly, when the main thread needs to do processing, it will
+    wait until all child threads have called unlock() before processing
+    additional data.
+ 
+    \return 0 if threading is available on the platform; non-zero
+    otherwise.
+    
+    See also: \ref advanced_multithreading
+*/
+/** \fn void fltk3::unlock()
+    The unlock() method releases the lock that was set
+    using the lock() method. Child
+    threads should call this method as soon as they are finished
+    accessing FLTK.
+    
+    See also: \ref advanced_multithreading
+*/
+/** \fn void fltk3::awake(void* msg)
+    Sends a message pointer to the main thread, 
+    causing any pending fltk3::wait() call to 
+    terminate so that the main thread can retrieve the message and any pending 
+    redraws can be processed.
+    
+    Multiple calls to fltk3::awake() will queue multiple pointers 
+    for the main thread to process, up to a system-defined (typically several 
+    thousand) depth. The default message handler saves the last message which 
+    can be accessed using the 
+    fltk3::thread_message() function.
+
+    In the context of a threaded application, a call to fltk3::awake() with no
+    argument will trigger event loop handling in the main thread. Since
+    it is not possible to call fltk3::flush() from a subsidiary thread,
+    fltk3::awake() is the best (and only, really) substitute.
+    
+    See also: \ref advanced_multithreading
+*/
+#ifdef WIN32
+#  include <windows.h>
+#  include <process.h>
+#  include <fltk3/x.h>
+
+// These pointers are in Fl_win32.cxx:
+extern void (*fl_lock_function)();
+extern void (*fl_unlock_function)();
+
+// The main thread's ID
+static DWORD main_thread;
+
+// Microsoft's version of a MUTEX...
+CRITICAL_SECTION cs;
+CRITICAL_SECTION *cs_ring;
+
+void unlock_ring() {
+  LeaveCriticalSection(cs_ring);
+}
+
+void lock_ring() {
+  if (!cs_ring) {
+    cs_ring = (CRITICAL_SECTION*)malloc(sizeof(CRITICAL_SECTION));
+    InitializeCriticalSection(cs_ring);
+  }
+  EnterCriticalSection(cs_ring);
+}
+
+//
+// 'unlock_function()' - Release the lock.
+//
+
+static void unlock_function() {
+  LeaveCriticalSection(&cs);
+}
+
+//
+// 'lock_function()' - Get the lock.
+//
+
+static void lock_function() {
+  EnterCriticalSection(&cs);
+}
+
+int fltk3::lock() {
+  if (!main_thread) InitializeCriticalSection(&cs);
+
+  lock_function();
+
+  if (!main_thread) {
+    fl_lock_function   = lock_function;
+    fl_unlock_function = unlock_function;
+    main_thread        = GetCurrentThreadId();
+  }
+  return 0;
+}
+
+void fltk3::unlock() {
+  unlock_function();
+}
+
+void fltk3::awake(void* msg) {
+  PostThreadMessage( main_thread, fl_wake_msg, (WPARAM)msg, 0);
+}
+
+////////////////////////////////////////////////////////////////
+// POSIX threading...
+#elif HAVE_PTHREAD
+#  include <unistd.h>
+#  include <fcntl.h>
+#  include <pthread.h>
+
+// Pipe for thread messaging via fltk3::awake()...
+static int thread_filedes[2];
+
+// Mutex and state information for fltk3::lock() and fltk3::unlock()...
+static pthread_mutex_t fltk_mutex;
+static pthread_t owner;
+static int counter;
+
+static void lock_function_init_std() {
+  pthread_mutex_init(&fltk_mutex, NULL);
+}
+
+static void lock_function_std() {
+  if (!counter || owner != pthread_self()) {
+    pthread_mutex_lock(&fltk_mutex);
+    owner = pthread_self();
+  }
+  counter++;
+}
+
+static void unlock_function_std() {
+  if (!--counter) pthread_mutex_unlock(&fltk_mutex);
+}
+
+#  ifdef PTHREAD_MUTEX_RECURSIVE
+static bool lock_function_init_rec() {
+  pthread_mutexattr_t attrib;
+  pthread_mutexattr_init(&attrib);
+  if (pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE)) {
+    pthread_mutexattr_destroy(&attrib);
+    return true;
+  }
+
+  pthread_mutex_init(&fltk_mutex, &attrib);
+  return false;
+}
+
+static void lock_function_rec() {
+  pthread_mutex_lock(&fltk_mutex);
+}
+
+static void unlock_function_rec() {
+  pthread_mutex_unlock(&fltk_mutex);
+}
+#  endif // PTHREAD_MUTEX_RECURSIVE
+
+void fltk3::awake(void* msg) {
+  if (write(thread_filedes[1], &msg, sizeof(void*))==0) { /* ignore */ }
+}
+
+static void* thread_message_;
+void* fltk3::thread_message() {
+  void* r = thread_message_;
+  thread_message_ = 0;
+  return r;
+}
+
+static void thread_awake_cb(int fd, void*) {
+  if (read(fd, &thread_message_, sizeof(void*))==0) { 
+    /* This should never happen */
+  }
+  fltk3::AwakeHandler func;
+  void *data;
+  while (fltk3::get_awake_handler_(func, data)==0) {
+    (*func)(data);
+  }
+}
+
+// These pointers are in Fl_x.cxx:
+extern void (*fl_lock_function)();
+extern void (*fl_unlock_function)();
+
+int fltk3::lock() {
+  if (!thread_filedes[1]) {
+    // Initialize thread communication pipe to let threads awake FLTK
+    // from fltk3::wait()
+    if (pipe(thread_filedes)==-1) {
+      /* this should not happen */
+    }
+
+    // Make the write side of the pipe non-blocking to avoid deadlock
+    // conditions (STR #1537)
+    fcntl(thread_filedes[1], F_SETFL,
+          fcntl(thread_filedes[1], F_GETFL) | O_NONBLOCK);
+
+    // Monitor the read side of the pipe so that messages sent via
+    // fltk3::awake() from a thread will "wake up" the main thread in
+    // fltk3::wait().
+    fltk3::add_fd(thread_filedes[0], fltk3::READ, thread_awake_cb);
+
+    // Set lock/unlock functions for this system, using a system-supplied
+    // recursive mutex if supported...
+#  ifdef PTHREAD_MUTEX_RECURSIVE
+    if (!lock_function_init_rec()) {
+      fl_lock_function   = lock_function_rec;
+      fl_unlock_function = unlock_function_rec;
+    } else {
+#  endif // PTHREAD_MUTEX_RECURSIVE
+      lock_function_init_std();
+      fl_lock_function   = lock_function_std;
+      fl_unlock_function = unlock_function_std;
+#  ifdef PTHREAD_MUTEX_RECURSIVE
+    }
+#  endif // PTHREAD_MUTEX_RECURSIVE
+  }
+
+  fl_lock_function();
+  return 0;
+}
+
+void fltk3::unlock() {
+  fl_unlock_function();
+}
+
+// Mutex code for the awake ring buffer
+static pthread_mutex_t *ring_mutex;
+
+void unlock_ring() {
+  pthread_mutex_unlock(ring_mutex);
+}
+
+void lock_ring() {
+  if (!ring_mutex) {
+    ring_mutex = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t));
+    pthread_mutex_init(ring_mutex, NULL);
+  }
+  pthread_mutex_lock(ring_mutex);
+}
+
+#else
+
+void unlock_ring() {
+}
+
+void lock_ring() {
+}
+
+void fltk3::awake(void*) {
+}
+
+int fltk3::lock() {
+  return 1;
+}
+
+void fltk3::unlock() {
+}
+
+void* fltk3::thread_message() {
+  return NULL;
+}
+
+#endif // WIN32
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/mediumarrow.h (from rev 9002, branches/branch-3.0/src/core/mediumarrow.h)
===================================================================
--- branches/branch-3.0/src/fltk3/mediumarrow.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/mediumarrow.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define mediumarrow_width 16
+#define mediumarrow_height 16
+static unsigned char mediumarrow_bits[] = {
+   0x40, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, 0xfc, 0x3f, 0x78, 0x00,
+   0x70, 0x00, 0x60, 0x02, 0x40, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0xfc, 0x3f,
+   0x00, 0x1e, 0x00, 0x0e, 0x00, 0x06, 0x00, 0x02};

Copied: branches/branch-3.0/src/fltk3/new.xbm (from rev 9002, branches/branch-3.0/src/core/new.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/new.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/new.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define new_width 16
+#define new_height 16
+static unsigned char new_bits[] = {
+   0x00, 0x00, 0x78, 0x00, 0x84, 0x00, 0x02, 0x01, 0x01, 0xfe, 0x01, 0x80,
+   0x31, 0x80, 0x31, 0x80, 0xfd, 0x80, 0xfd, 0x80, 0x31, 0x80, 0x31, 0x80,
+   0x01, 0x80, 0x01, 0x80, 0xff, 0xff, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/ns.xbm (from rev 9002, branches/branch-3.0/src/core/ns.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/ns.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ns.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,8 @@
+#define ns_width 16
+#define ns_height 16
+#define ns_x_hot 8
+#define ns_y_hot 8
+static unsigned char ns_bits[] = {
+   0x00, 0x00, 0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01,
+   0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x80, 0x01,
+   0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/ns_mask.xbm (from rev 9002, branches/branch-3.0/src/core/ns_mask.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/ns_mask.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ns_mask.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,8 @@
+#define ns_mask_width 16
+#define ns_mask_height 16
+#define ns_mask_x_hot 8
+#define ns_mask_y_hot 8
+static unsigned char ns_mask_bits[] = {
+   0x80, 0x01, 0xc0, 0x03, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0xc0, 0x03,
+   0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xf0, 0x0f,
+   0xf0, 0x0f, 0xe0, 0x07, 0xc0, 0x03, 0x80, 0x01};

Copied: branches/branch-3.0/src/fltk3/numericsort.cxx (from rev 9002, branches/branch-3.0/src/core/numericsort.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/numericsort.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/numericsort.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,110 @@
+/*
+ * "$Id$"
+ *
+ * Numeric sorting routine for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+/* My own scandir sorting function, useful for the film industry where
+   we have many files with numbers in their names: */
+
+#include <config.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+#if !defined(WIN32) || defined(__CYGWIN__)
+#  ifdef HAVE_DIRENT_H
+#    include <dirent.h>
+#  else
+#    define dirent direct
+#    if HAVE_SYS_NDIR_H
+#      include <sys/ndir.h>
+#    endif /* HAVE_SYS_NDIR_H */
+#    if HAVE_SYS_DIR_H
+#      include <sys/dir.h>
+#    endif /* HAVE_SYS_DIR_H */
+#    if HAVE_NDIR_H
+#      include <ndir.h>
+#    endif /* HAVE_NDIR_H */
+#  endif /* HAVE_DIRENT_H */
+#endif /* !WIN32 || __CYGWIN__ */
+#include <fltk3/filename.h>
+
+/*
+ * 'numericsort()' - Compare two directory entries, possibly with
+ *                   a case-insensitive comparison...
+ */
+
+static int pNumericsort(struct dirent **A, struct dirent **B, int cs) {
+  const char* a = (*A)->d_name;
+  const char* b = (*B)->d_name;
+  int ret = 0;
+  for (;;) {
+    if (isdigit(*a & 255) && isdigit(*b & 255)) {
+      int diff,magdiff;
+      while (*a == '0') a++;
+      while (*b == '0') b++;
+      while (isdigit(*a & 255) && *a == *b) {a++; b++;}
+      diff = (isdigit(*a & 255) && isdigit(*b & 255)) ? *a - *b : 0;
+      magdiff = 0;
+      while (isdigit(*a & 255)) {magdiff++; a++;}
+      while (isdigit(*b & 255)) {magdiff--; b++;}
+      if (magdiff) {ret = magdiff; break;} /* compare # of significant digits*/
+      if (diff) {ret = diff; break;}	/* compare first non-zero digit */
+    } else {
+      if (cs) {
+      	/* compare case-sensitive */
+	if ((ret = *a-*b)) break;
+      } else {
+	/* compare case-insensitve */
+	if ((ret = tolower(*a & 255)-tolower(*b & 255))) break;
+      }
+
+      if (!*a) break;
+      a++; b++;
+    }
+  }
+  if (!ret) return 0;
+  else return (ret < 0) ? -1 : 1;
+}
+
+/*
+ * 'fltk3::casenumericsort()' - Compare directory entries with case-sensitivity.
+ */
+
+int fltk3::casenumericsort(struct dirent **A, struct dirent **B) {
+  return pNumericsort(A, B, 0);
+}
+
+/*
+ * 'fltk3::numericsort()' - Compare directory entries with case-sensitivity.
+ */
+
+int fltk3::numericsort(struct dirent **A, struct dirent **B) {
+  return pNumericsort(A, B, 1);
+}
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/open_uri.cxx (from rev 9002, branches/branch-3.0/src/core/fl_open_uri.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/open_uri.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/open_uri.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,383 @@
+//
+// "$Id$"
+//
+// fltk3::open_uri() code for FLTK.
+//
+// Test with:
+//
+//    gcc -I/fltk/dir -I/fltk/dir/src -DTEST -o fltk3::open_uri fltk3::open_uri.cxx -lfltk
+//
+// Copyright 2003-2010 by Michael R Sweet
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+
+//
+// Include necessary headers...
+//
+
+#include <fltk3/filename.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include "flstring.h"
+#ifdef WIN32
+#  include <windows.h>
+#  include <shellapi.h>
+#else
+#  include <sys/wait.h>
+#  include <signal.h>
+#  include <fcntl.h>
+#  include <unistd.h>
+#endif // WIN32
+
+
+//
+// Local functions...
+//
+
+#if !defined(WIN32) && !defined(__APPLE__)
+static char	*path_find(const char *program, char *filename, int filesize);
+#endif // !WIN32 && !__APPLE__
+#ifndef WIN32
+static int	run_program(const char *program, char **argv, char *msg, int msglen);
+#endif // !WIN32
+
+/** \addtogroup filenames
+ @{ */
+
+/**
+ * Opens the specified Uniform Resource Identifier (URI).
+ * Uses an operating-system dependent program or interface. For URIs
+ * using the "ftp", "http", or "https" schemes, the system default web
+ * browser is used to open the URI, while "mailto" and "news" URIs are
+ * typically opened using the system default mail reader and "file" URIs
+ * are opened using the file system navigator.
+ *
+ * On success, the (optional) msg buffer is filled with the command that
+ * was run to open the URI; on Windows, this will always be "open uri".
+ *
+ * On failure, the msg buffer is filled with an English error message.
+ *
+ * \b Example
+ * \code
+ * #include <fltk3/filename.h>
+ * [..]
+ * char errmsg[512];
+ * if ( !fltk3::open_uri("http://google.com/";, errmsg, sizeof(errmsg)) ) {
+ *     char warnmsg[768];
+ *     sprintf(warnmsg, "Error: %s", errmsg);
+ *     fltk3::alert(warnmsg);
+ * }
+ * \endcode
+ *
+ * @param uri The URI to open
+ * @param msg Optional buffer which contains the command or error message
+ * @param msglen Length of optional buffer
+ * @return 1 on success, 0 on failure
+ */
+
+int
+fltk3::open_uri(const char *uri, char *msg, int msglen) {
+  // Supported URI schemes...
+  static const char * const schemes[] = {
+    "file://",
+    "ftp://";,
+    "http://";,
+    "https://";,
+    "mailto:";,
+    "news://";,
+    NULL
+  };
+
+  // Validate the URI scheme...
+  int i;
+  for (i = 0; schemes[i]; i ++)
+    if (!strncmp(uri, schemes[i], strlen(schemes[i])))
+      break;
+
+  if (!schemes[i]) {
+    if (msg) {
+      char scheme[255];
+      if (sscanf(uri, "%254[^:]", scheme) == 1) {
+        snprintf(msg, msglen, "URI scheme \"%s\" not supported.", scheme);
+      } else {
+        snprintf(msg, msglen, "Bad URI \"%s\"", uri);
+      }
+    }
+
+    return 0;
+  }
+
+#ifdef WIN32
+  if (msg) snprintf(msg, msglen, "open %s", uri);
+
+  return (int)(ShellExecute(HWND_DESKTOP, "open", uri, NULL, NULL, SW_SHOW) > (void *)32);
+
+#elif defined(__APPLE__)
+  char	*argv[3];			// Command-line arguments
+
+  argv[0] = (char*)"open";
+  argv[1] = (char*)uri;
+  argv[2] = (char*)0;
+
+  if (msg) snprintf(msg, msglen, "open %s", uri);
+
+  return run_program("/usr/bin/open", argv, msg, msglen) != 0;
+
+#else // !WIN32 && !__APPLE__
+  // Run any of several well-known commands to open the URI.
+  //
+  // We give preference to the Portland group's xdg-utils
+  // programs which run the user's preferred web browser, etc.
+  // based on the current desktop environment in use.  We fall
+  // back on older standards and then finally test popular programs
+  // until we find one we can use.
+  //
+  // Note that we specifically do not support the MAILER and
+  // BROWSER environment variables because we have no idea whether
+  // we need to run the listed commands in a terminal program.
+
+  char	command[FLTK3_PATH_MAX],		// Command to run...
+	*argv[4],			// Command-line arguments
+	remote[1024];			// Remote-mode command...
+  const char * const *commands;		// Array of commands to check...
+  static const char * const browsers[] = {
+    "xdg-open", // Portland
+    "htmlview", // Freedesktop.org
+    "firefox",
+    "mozilla",
+    "netscape",
+    "konqueror", // KDE
+    "opera",
+    "hotjava", // Solaris
+    "mosaic",
+    NULL
+  };
+  static const char * const readers[] = {
+    "xdg-email", // Portland
+    "thunderbird",
+    "mozilla",
+    "netscape",
+    "evolution", // GNOME
+    "kmailservice", // KDE
+    NULL
+  };
+  static const char * const managers[] = {
+    "xdg-open", // Portland
+    "fm", // IRIX
+    "dtaction", // CDE
+    "nautilus", // GNOME
+    "konqueror", // KDE
+    NULL
+  };
+
+  // Figure out which commands to check for...
+  if (!strncmp(uri, "file://", 7)) commands = managers;
+  else if (!strncmp(uri, "mailto:";, 7) ||
+           !strncmp(uri, "news:";, 5)) commands = readers;
+  else commands = browsers;
+
+  // Find the command to run...
+  for (i = 0; commands[i]; i ++)
+    if (path_find(commands[i], command, sizeof(command))) break;
+
+  if (!commands[i]) {
+    if (msg) {
+      snprintf(msg, msglen, "No helper application found for \"%s\"", uri);
+    }
+
+    return 0;
+  }
+
+  // Handle command-specific arguments...
+  argv[0] = (char *)commands[i];
+
+  if (!strcmp(commands[i], "firefox") ||
+      !strcmp(commands[i], "mozilla") ||
+      !strcmp(commands[i], "netscape") ||
+      !strcmp(commands[i], "thunderbird")) {
+    // program -remote openURL(uri)
+    snprintf(remote, sizeof(remote), "openURL(%s)", uri);
+
+    argv[1] = (char *)"-remote";
+    argv[2] = remote;
+    argv[3] = 0;
+  } else if (!strcmp(commands[i], "dtaction")) {
+    // dtaction open uri
+    argv[1] = (char *)"open";
+    argv[2] = (char *)uri;
+    argv[3] = 0;
+  } else {
+    // program uri
+    argv[1] = (char *)uri;
+    argv[2] = 0;
+  }
+
+  if (msg) {
+    strlcpy(msg, argv[0], msglen);
+
+    for (i = 1; argv[i]; i ++) {
+      strlcat(msg, " ", msglen);
+      strlcat(msg, argv[i], msglen);
+    }
+  }
+
+  return run_program(command, argv, msg, msglen) != 0;
+#endif // WIN32
+}
+
+/**   @} */
+
+#if !defined(WIN32) && !defined(__APPLE__)
+// Find a program in the path...
+static char *path_find(const char *program, char *filename, int filesize) {
+  const char	*path;			// Search path
+  char		*ptr,			// Pointer into filename
+		*end;			// End of filename buffer
+
+
+  if ((path = getenv("PATH")) == NULL) path = "/bin:/usr/bin";
+
+  for (ptr = filename, end = filename + filesize - 1; *path; path ++) {
+    if (*path == ':') {
+      if (ptr > filename && ptr[-1] != '/' && ptr < end) *ptr++ = '/';
+
+      strlcpy(ptr, program, end - ptr + 1);
+
+      if (!access(filename, X_OK)) return filename;
+
+      ptr = filename;
+    } else if (ptr < end) *ptr++ = *path;
+  }
+
+  if (ptr > filename) {
+    if (ptr[-1] != '/' && ptr < end) *ptr++ = '/';
+
+    strlcpy(ptr, program, end - ptr + 1);
+
+    if (!access(filename, X_OK)) return filename;
+  }
+
+  return 0;
+}
+#endif // !WIN32 && !__APPLE__
+
+
+#ifndef WIN32
+// Run the specified program, returning 1 on success and 0 on failure
+static int
+run_program(const char *program, char **argv, char *msg, int msglen) {
+  pid_t	pid;				// Process ID of first child
+  int status;				// Exit status from first child
+  sigset_t set, oldset;			// Signal masks
+
+
+  // Block SIGCHLD while we run the program...
+  //
+  // Note that I only use the POSIX signal APIs, however older operating
+  // systems may either not support POSIX signals or have side effects.
+  // IRIX, for example, provides three separate and incompatible signal
+  // APIs, so it is possible that an application setting a signal handler
+  // via signal() or sigset() will not have its SIGCHLD signals blocked...
+
+  sigemptyset(&set);
+  sigaddset(&set, SIGCHLD);
+  sigprocmask(SIG_BLOCK, &set, &oldset);
+
+  // Create child processes that actually run the program for us...
+  if ((pid = fork()) == 0) {
+    // First child comes here, fork a second child and exit...
+    if (!fork()) {
+      // Second child comes here, redirect stdin/out/err to /dev/null...
+      close(0);
+      open("/dev/null", O_RDONLY);
+
+      close(1);
+      open("/dev/null", O_WRONLY);
+
+      close(2);
+      open("/dev/null", O_WRONLY);
+
+      // Detach from the current process group...
+      setsid();
+
+      // Run the program...
+      execv(program, argv);
+      _exit(0);
+    } else {
+      // First child gets here, exit immediately...
+      _exit(0);
+    }
+  } else if (pid < 0) {
+    // Restore signal handling...
+    sigprocmask(SIG_SETMASK, &oldset, NULL);
+
+    // Return indicating failure...
+    return 0;
+  }
+
+  // Wait for the first child to exit...
+  while (waitpid(pid, &status, 0) < 0) {
+    if (errno != EINTR) {
+      // Someone else grabbed the child status...
+      if (msg) snprintf(msg, msglen, "waitpid(%ld) failed: %s", (long)pid,
+                        strerror(errno));
+
+      // Restore signal handling...
+      sigprocmask(SIG_SETMASK, &oldset, NULL);
+
+      // Return indicating failure...
+      return 0;
+    }
+  }
+
+  // Restore signal handling...
+  sigprocmask(SIG_SETMASK, &oldset, NULL);
+
+  // Return indicating success...
+  return 1;
+}
+#endif // !WIN32
+
+
+#ifdef TEST
+//
+// Test code...
+//
+
+// Open the URI on the command-line...
+int main(int argc, char **argv) {
+  char msg[1024];
+
+
+  if (argc != 2) {
+    puts("Usage: fltk3::open_uri URI");
+    return 1;
+  }
+
+  if (!fltk3::open_uri(argv[1], msg, sizeof(msg))) {
+    puts(msg);
+    return 1;
+  } else return 0;
+}
+#endif // TEST
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/oval_box.cxx (from rev 9002, branches/branch-3.0/src/core/fl_oval_box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/oval_box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/oval_box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,57 @@
+//
+// "$Id$"
+//
+// Oval box drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+
+// Less-used box types are in separate files so they are not linked
+// in if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+void fl_oval_flat_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c);
+  fltk3::pie(x, y, w, h, 0, 360);
+}
+
+void fl_oval_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c);
+  fltk3::arc(x, y, w, h, 0, 360);
+}
+
+void fl_oval_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_oval_flat_box(x,y,w,h,c,t);
+  fl_oval_frame(x,y,w,h,fltk3::BLACK,t);
+}
+
+void fl_oval_shadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fl_oval_flat_box(x+3,y+3,w,h,fltk3::DARK3,t);
+  fl_oval_box(x,y,w,h,c,t);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/overlay.cxx (from rev 9002, branches/branch-3.0/src/core/fl_overlay.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/overlay.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/overlay.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,129 @@
+//
+// "$Id$"
+//
+// Overlay support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Extremely limited "overlay" support.  You can use this to drag out
+// a rectangle in response to mouse events.  It is your responsibility
+// to erase the overlay before drawing anything that might intersect
+// it.
+
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+#ifdef __APPLE__
+#include <config.h>
+#endif
+
+//#define USE_XOR
+
+static int px,py,pw,ph;
+
+#ifndef USE_XOR
+#include <stdlib.h>
+static uchar *bgN = 0L, *bgS = 0L, *bgE = 0L, *bgW = 0L;
+static int bgx, bgy, bgw, bgh;
+#endif
+
+static void draw_current_rect() {
+#ifdef USE_XOR
+# if defined(USE_X11)
+  XSetFunction(fl_display, fl_gc, GXxor);
+  XSetForeground(fl_display, fl_gc, 0xffffffff);
+  XDrawRectangle(fl_display, fl_window, fl_gc, px, py, pw, ph);
+  XSetFunction(fl_display, fl_gc, GXcopy);
+# elif defined(WIN32)
+  int old = SetROP2(fl_gc, R2_NOT);
+  fltk3::rect(px, py, pw, ph);
+  SetROP2(fl_gc, old);
+# elif defined(__APPLE_QUARTZ__)
+  // warning: Quartz does not support xor drawing
+  // Use the fltk3::OverlayWindow instead.
+  fltk3::color(fltk3::WHITE);
+  fltk3::rect(px, py, pw, ph);
+# else
+#  error unsupported platform
+# endif
+#else
+  if (bgN) { free(bgN); bgN = 0L; }
+  if (bgS) { free(bgS); bgS = 0L; }
+  if (bgE) { free(bgE); bgE = 0L; }
+  if (bgW) { free(bgW); bgW = 0L; }
+  if (pw>0 && ph>0) {
+    bgE = fltk3::read_image(0L, px+pw-1, py, 1, ph);
+    bgW = fltk3::read_image(0L, px, py, 1, ph);
+    bgS = fltk3::read_image(0L, px, py+ph-1, pw, 1);
+    bgN = fltk3::read_image(0L, px, py, pw, 1);
+    bgx = px; bgy = py;
+    bgw = pw; bgh = ph;
+  }
+  fltk3::color(fltk3::WHITE);
+  fltk3::line_style(fltk3::SOLID);
+  fltk3::rect(px, py, pw, ph);
+  fltk3::color(fltk3::BLACK);
+  fltk3::line_style(fltk3::DOT);
+  fltk3::rect(px, py, pw, ph);
+  fltk3::line_style(fltk3::SOLID);
+#endif
+}
+
+static void erase_current_rect() {
+#ifdef USE_XOR
+# ifdef __APPLE_QUARTZ__
+  fltk3::rect(px, py, pw, ph);
+# else
+  draw_current_rect();
+# endif
+#else
+  if (bgN) fltk3::draw_image(bgN, bgx, bgy, bgw, 1);
+  if (bgS) fltk3::draw_image(bgS, bgx, bgy+bgh-1, bgw, 1);
+  if (bgW) fltk3::draw_image(bgW, bgx, bgy, 1, bgh);
+  if (bgE) fltk3::draw_image(bgE, bgx+bgw-1, bgy, 1, bgh);
+#endif
+}
+
+/**
+  Erase a selection rectangle without drawing a new one
+  */
+void fltk3::overlay_clear() {
+  if (pw > 0) {erase_current_rect(); pw = 0;}
+}
+
+/**
+  Draws a selection rectangle, erasing a previous one by XOR'ing it first.
+  */
+void fltk3::overlay_rect(int x, int y, int w, int h) {
+  if (w < 0) {x += w; w = -w;} else if (!w) w = 1;
+  if (h < 0) {y += h; h = -h;} else if (!h) h = 1;
+  if (pw > 0) {
+    if (x==px && y==py && w==pw && h==ph) return;
+    erase_current_rect();
+  }
+  px = x; py = y; pw = w; ph = h;
+  draw_current_rect();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/overlay_visual.cxx (from rev 9002, branches/branch-3.0/src/core/fl_overlay_visual.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/overlay_visual.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/overlay_visual.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,105 @@
+//
+// "$Id$"
+//
+// X overlay support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Return an overlay visual, if any.  Also allocate a colormap and
+// record the depth for fltk3::color() to use.
+// Another disgusting X interface, based on code extracted and
+// purified with great difficulty from XLayerUtil.cxx:
+
+#include <config.h>
+#if HAVE_OVERLAY
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+// SERVER_OVERLAY_VISUALS property element:
+struct OverlayInfo {
+  long overlay_visual;
+  long transparent_type;
+  long value;
+  long layer;
+};
+
+extern Colormap fl_overlay_colormap;
+extern XVisualInfo* fl_overlay_visual;
+extern ulong fl_transparent_pixel;
+
+XVisualInfo *fl_find_overlay_visual() {
+  static char beenhere;
+  if (beenhere) return fl_overlay_visual;
+  beenhere = 1;
+
+  fl_open_display();
+  Atom overlayVisualsAtom =
+    XInternAtom(fl_display,"SERVER_OVERLAY_VISUALS",1);
+  if (!overlayVisualsAtom) return 0;
+  OverlayInfo *overlayInfo;
+  ulong sizeData, bytesLeft;
+  Atom actualType;
+  int actualFormat;
+  if (XGetWindowProperty(fl_display, RootWindow(fl_display, fl_screen),
+			 overlayVisualsAtom, 0L, 10000L, False,
+			 overlayVisualsAtom, &actualType, &actualFormat,
+			 &sizeData, &bytesLeft,
+			 (unsigned char **) &overlayInfo)) return 0;
+
+  if (actualType == overlayVisualsAtom && actualFormat == 32) {
+    int n = int(sizeData/4);
+    XVisualInfo* v = 0;
+    // find the greatest depth that has a transparent pixel:
+    for (int i = 0; i < n; i++) {
+      if (overlayInfo[i].transparent_type != 1) continue;
+      if (overlayInfo[i].layer <= 0) continue;
+      XVisualInfo templt;
+      templt.visualid = overlayInfo[i].overlay_visual;
+      int num;
+      XVisualInfo *v1=XGetVisualInfo(fl_display, VisualIDMask, &templt, &num);
+      if (v1->screen == fl_screen && v1->c_class == PseudoColor
+	  && (!v || v1->depth > v->depth && v1->depth <= 8)) {
+	if (v) XFree((char*)v);
+	v = v1;
+	fl_transparent_pixel = overlayInfo[i].value;
+      } else {
+	XFree((char*)v1);
+      }
+    }
+    if (v) {
+      fl_overlay_visual = v;
+      fl_overlay_colormap = 
+	XCreateColormap(fl_display, RootWindow(fl_display, fl_screen),
+			v->visual, AllocNone);
+    }
+  }
+  XFree((char*)overlayInfo);
+  //printf("overlay visual %ld selected\n", fl_overlay_visual->visualid);
+  return fl_overlay_visual;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/own_colormap.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_own_colormap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/own_colormap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/own_colormap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,90 @@
+//
+// "$Id$"
+//
+// Private colormap support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Using the default system colormap can be a bad idea on PseudoColor
+// visuals, since typically every application uses the default colormap and
+// you can run out of colormap entries easily.
+//
+// The solution is to always create a new colormap on PseudoColor displays
+// and copy the first 16 colors from the default colormap so that we won't
+// get huge color changes when switching windows.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+/** \fn fltk3::own_colormap()
+    Makes FLTK use its own colormap.  This may make FLTK display better
+    and will reduce conflicts with other programs that want lots of colors.
+    However the colors may flash as you move the cursor between windows.
+    
+    <P>This does nothing if the current visual is not colormapped.
+*/
+#ifdef WIN32
+// There is probably something relevant to do on MSWindows 8-bit displays
+// but I don't know what it is
+
+void fltk3::own_colormap() {}
+
+#elif defined(__APPLE__)
+// MacOS X always provides a TrueColor interface...
+
+void fltk3::own_colormap() {}
+#else
+// X version
+
+void fltk3::own_colormap() {
+  fl_open_display();
+#if USE_COLORMAP
+  switch (fl_visual->c_class) {
+  case GrayScale :
+  case PseudoColor :
+  case DirectColor :
+    break;
+  default:
+    return; // don't do anything for non-colormapped visuals
+  }
+  int i;
+  XColor colors[16];
+  // Get the first 16 colors from the default colormap...
+  for (i = 0; i < 16; i ++) colors[i].pixel = i;
+  XQueryColors(fl_display, fl_colormap, colors, 16);
+  // Create a new colormap...
+  fl_colormap = XCreateColormap(fl_display,
+				RootWindow(fl_display,fl_screen),
+				fl_visual->visual, AllocNone);
+  // Copy those first 16 colors to our own colormap:
+  for (i = 0; i < 16; i ++)
+    XAllocColor(fl_display, fl_colormap, colors + i);
+#endif
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/plastic.cxx (from rev 9002, branches/branch-3.0/src/core/fl_plastic.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/plastic.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/plastic.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,367 @@
+//
+// "$Id$"
+//
+// "Plastic" drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// These box types provide a cross between Aqua and KDE buttons; kindof
+// like translucent plastic buttons...
+//
+// Copyright 2001-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Box drawing code for an obscure box type.
+// These box types are in separate files so they are not linked
+// in if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+
+//
+// Uncomment the following line to restore the old plastic box type
+// appearance.
+//
+
+//#define USE_OLD_PLASTIC_BOX
+#define USE_OLD_PLASTIC_COLOR
+
+namespace fltk3 {
+  extern uchar* gray_ramp();
+}
+
+
+inline fltk3::Color shade_color(uchar gc, fltk3::Color bc) {
+#ifdef USE_OLD_PLASTIC_COLOR
+  return fltk3::color_average((fltk3::Color)gc, bc, 0.75f);
+#else
+  unsigned	grgb = fltk3::get_color((fltk3::Color)gc),
+		brgb = fltk3::get_color(bc);
+  int		red, green, blue, gray;
+
+
+  gray  = ((grgb >> 24) & 255);
+  red   = gray * ((brgb >> 24) & 255) / 255 + gray * gray / 510;
+  gray  = ((grgb >> 16) & 255);
+  green = gray * ((brgb >> 16) & 255) / 255 + gray * gray / 510;
+  gray  = ((grgb >> 8) & 255);
+  blue  = gray * ((brgb >> 8) & 255) / 255 + gray * gray / 510;
+
+  if (red > 255)
+    red = 255;
+
+  if (green > 255)
+    green = 255;
+
+  if (blue > 255)
+    blue = 255;
+
+  if (fltk3::draw_box_active())
+    return fltk3::rgb_color(red, green, blue);
+  else
+    return fltk3::color_average(fltk3::GRAY, fltk3::rgb_color(red, green, blue), 0.75f);
+#endif // USE_OLD_PLASTIC_COLOR
+}
+
+
+static void frame_rect(int x, int y, int w, int h, const char *c, fltk3::Color bc) {
+  uchar *g = fltk3::gray_ramp();
+  int b = strlen(c) / 4 + 1;
+
+  for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --)
+  {
+    // Draw lines around the perimeter of the button, 4 colors per
+    // circuit.
+    fltk3::color(shade_color(g[(int)*c++], bc));
+    fltk3::line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h);
+    fltk3::color(shade_color(g[(int)*c++], bc));
+    fltk3::line(x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b);
+    fltk3::color(shade_color(g[(int)*c++], bc));
+    fltk3::line(x + w - 1, y - b, x, y - b, x - b, y);
+    fltk3::color(shade_color(g[(int)*c++], bc));
+    fltk3::line(x - b, y, x - b, y + h, x, y + h + b);
+  }
+}
+
+
+static void frame_round(int x, int y, int w, int h, const char *c, fltk3::Color bc) {
+  uchar *g = fltk3::gray_ramp();
+  int b = strlen(c) / 4 + 1;
+
+  if (w==h) {
+    for (; b > 1; b --, x ++, y ++, w -= 2, h -= 2)
+    {
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, h, 45.0, 135.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, h, 315.0, 405.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, h, 225.0, 315.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, h, 135.0, 225.0);
+    }
+  } else if (w>h) {
+    int d = h/2;
+    for (; b > 1; d--, b --, x ++, y ++, w -= 2, h -= 2)
+    {
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, h, h, 90.0, 135.0);
+      fltk3::xyline(x+d, y, x+w-d);
+      fltk3::arc(x+w-h, y, h, h, 45.0, 90.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x+w-h, y, h, h, 315.0, 405.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x+w-h, y, h, h, 270.0, 315.0);
+      fltk3::xyline(x+d, y+h-1, x+w-d);
+      fltk3::arc(x, y, h, h, 225.0, 270.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, h, h, 135.0, 225.0);
+    }
+  } else if (w<h) {
+    int d = w/2;
+    for (; b > 1; d--, b --, x ++, y ++, w -= 2, h -= 2)
+    {
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, w, 45.0, 135.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y, w, w, 0.0, 45.0);
+      fltk3::yxline(x+w-1, y+d, y+h-d);
+      fltk3::arc(x, y+h-w, w, w, 315.0, 360.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y+h-w, w, w, 225.0, 315.0);
+      fltk3::color(shade_color(g[(int)*c++], bc));
+      fltk3::arc(x, y+h-w, w, w, 180.0, 225.0);
+      fltk3::yxline(x, y+d, y+h-d);
+      fltk3::arc(x, y, w, w, 135.0, 180.0);
+    }
+  }
+}
+
+
+static void shade_rect(int x, int y, int w, int h, const char *c, fltk3::Color bc) {
+  uchar		*g = fltk3::gray_ramp();
+  int		i, j;
+  int		clen = strlen(c) - 1;
+  int		chalf = clen / 2;
+  int		cstep = 1;
+
+  if (h < (w * 2)) {
+    // Horizontal shading...
+    if (clen >= h) cstep = 2;
+
+    for (i = 0, j = 0; j < chalf; i ++, j += cstep) {
+      // Draw the top line and points...
+      fltk3::color(shade_color(g[(int)c[i]], bc));
+      fltk3::xyline(x + 1, y + i, x + w - 2);
+
+      fltk3::color(shade_color(g[c[i] - 2], bc));
+      fltk3::point(x, y + i + 1);
+      fltk3::point(x + w - 1, y + i + 1);
+
+      // Draw the bottom line and points...
+      fltk3::color(shade_color(g[(int)c[clen - i]], bc));
+      fltk3::xyline(x + 1, y + h - i, x + w - 2);
+
+      fltk3::color(shade_color(g[c[clen - i] - 2], bc));
+      fltk3::point(x, y + h - i);
+      fltk3::point(x + w - 1, y + h - i);
+    }
+
+    // Draw the interior and sides...
+    i = chalf / cstep;
+
+    fltk3::color(shade_color(g[(int)c[chalf]], bc));
+    fltk3::rectf(x + 1, y + i, w - 2, h - 2 * i + 1);
+
+    fltk3::color(shade_color(g[c[chalf] - 2], bc));
+    fltk3::yxline(x, y + i, y + h - i);
+    fltk3::yxline(x + w - 1, y + i, y + h - i);
+  } else {
+    // Vertical shading...
+    if (clen >= w) cstep = 2;
+
+    for (i = 0, j = 0; j < chalf; i ++, j += cstep) {
+      // Draw the left line and points...
+      fltk3::color(shade_color(g[(int)c[i]], bc));
+      fltk3::yxline(x + i, y + 1, y + h - 1);
+
+      fltk3::color(shade_color(g[c[i] - 2], bc));
+      fltk3::point(x + i + 1, y);
+      fltk3::point(x + i + 1, y + h);
+
+      // Draw the right line and points...
+      fltk3::color(shade_color(g[(int)c[clen - i]], bc));
+      fltk3::yxline(x + w - 1 - i, y + 1, y + h - 1);
+
+      fltk3::color(shade_color(g[c[clen - i] - 2], bc));
+      fltk3::point(x + w - 2 - i, y);
+      fltk3::point(x + w - 2 - i, y + h);
+    }
+
+    // Draw the interior, top, and bottom...
+    i = chalf / cstep;
+
+    fltk3::color(shade_color(g[(int)c[chalf]], bc));
+    fltk3::rectf(x + i, y + 1, w - 2 * i, h - 1);
+
+    fltk3::color(shade_color(g[c[chalf] - 2], bc));
+    fltk3::xyline(x + i, y, x + w - i);
+    fltk3::xyline(x + i, y + h, x + w - i);
+  }
+}
+
+static void shade_round(int x, int y, int w, int h, const char *c, fltk3::Color bc) {
+  uchar		*g = fltk3::gray_ramp();
+  int		i;
+  int		clen = strlen(c) - 1;
+  int		chalf = clen / 2;
+
+  if (w>h) {
+    int d = h/2;
+    const int na = 8;
+    for (i=0; i<chalf; i++, d--, x++, y++, w-=2, h-=2)
+    {
+      fltk3::color(shade_color(g[(int)c[i]], bc));
+      fltk3::pie(x, y, h, h, 90.0, 135.0+i*na);
+      fltk3::xyline(x+d, y, x+w-d);
+      fltk3::pie(x+w-h, y, h, h, 45.0+i*na, 90.0);
+      fltk3::color(shade_color(g[(int)c[i] - 2], bc));
+      fltk3::pie(x+w-h, y, h, h, 315.0+i*na, 405.0+i*na);
+      fltk3::color(shade_color(g[(int)c[clen - i]], bc));
+      fltk3::pie(x+w-h, y, h, h, 270.0, 315.0+i*na);
+      fltk3::xyline(x+d, y+h-1, x+w-d);
+      fltk3::pie(x, y, h, h, 225.0+i*na, 270.0);
+      fltk3::color(shade_color(g[c[(int)clen - i] - 2], bc));
+      fltk3::pie(x, y, h, h, 135.0+i*na, 225.0+i*na);
+    }
+    fltk3::color(shade_color(g[(int)c[chalf]], bc));
+    fltk3::rectf(x+d, y, w-h+1, h+1);
+    fltk3::pie(x, y, h, h, 90.0, 270.0);
+    fltk3::pie(x+w-h, y, h, h, 270.0, 90.0);
+  } else {
+    int d = w/2;
+    const int na = 8;
+    for (i=0; i<chalf; i++, d--, x++, y++, w-=2, h-=2)
+    {
+      fltk3::color(shade_color(g[(int)c[i]], bc));
+      fltk3::pie(x, y, w, w, 45.0+i*na, 135.0+i*na);
+      fltk3::color(shade_color(g[c[i] - 2], bc));
+      fltk3::pie(x, y, w, w, 0.0, 45.0+i*na);
+      fltk3::yxline(x+w-1, y+d, y+h-d);
+      fltk3::pie(x, y+h-w, w, w, 315.0+i*na, 360.0);
+      fltk3::color(shade_color(g[(int)c[clen - i]], bc));
+      fltk3::pie(x, y+h-w, w, w, 225.0+i*na, 315.0+i*na);
+      fltk3::color(shade_color(g[c[clen - i] - 2], bc));
+      fltk3::pie(x, y+h-w, w, w, 180.0, 225.0+i*na);
+      fltk3::yxline(x, y+d, y+h-d);
+      fltk3::pie(x, y, w, w, 135.0+i*na, 180.0);
+    }
+    fltk3::color(shade_color(g[(int)c[chalf]], bc));
+    fltk3::rectf(x, y+d, w+1, h-w+1);
+    fltk3::pie(x, y, w, w, 0.0, 180.0);
+    fltk3::pie(x, y+h-w, w, w, 180.0, 360.0);
+  }
+}
+
+
+void fl_plastic_up_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  frame_rect(x, y, w, h - 1, "KLDIIJLM", c);
+}
+
+
+static void narrow_thin_box(int x, int y, int w, int h, fltk3::Color c) {
+  if (h<=0 || w<=0) return;
+  uchar *g = fltk3::gray_ramp();
+  fltk3::color(shade_color(g['R'], c));
+  fltk3::rectf(x+1, y+1, w-2, h-2);
+  fltk3::color(shade_color(g['I'], c));
+  if (w > 1) {
+    fltk3::xyline(x+1, y, x+w-2);
+    fltk3::xyline(x+1, y+h-1, x+w-2);
+  }
+  if (h > 1) {
+    fltk3::yxline(x, y+1, y+h-2);
+    fltk3::yxline(x+w-1, y+1, y+h-2);
+  }
+}
+
+
+void fl_plastic_thin_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+#ifdef USE_OLD_PLASTIC_BOX
+  shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c);
+  up_frame(x, y, w, h, c);
+#else
+  if (w > 4 && h > 4) {
+    shade_rect(x + 1, y + 1, w - 2, h - 3, "RQOQSUWQ", c);
+    frame_rect(x, y, w, h - 1, "IJLM", c);
+  } else {
+    narrow_thin_box(x, y, w, h, c);
+  }
+#endif // USE_OLD_PLASTIC_BOX
+}
+
+
+void fl_plastic_up_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+#ifdef USE_OLD_PLASTIC_BOX
+  shade_rect(x + 2, y + 2, w - 4, h - 5, "RVQNOPQRSTUVWVQ", c);
+  up_frame(x, y, w, h, c);
+#else
+  if (w > 8 && h > 8) {
+    shade_rect(x + 1, y + 1, w - 2, h - 3, "RVQNOPQRSTUVWVQ", c);
+    frame_rect(x, y, w, h - 1, "IJLM", c);
+  } else {
+    fl_plastic_thin_up_box(x, y, w, h, c, t);
+  }
+#endif // USE_OLD_PLASTIC_BOX
+}
+
+
+void fl_plastic_up_round(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  shade_round(x, y, w, h, "RVQNOPQRSTUVWVQ", c);
+  frame_round(x, y, w, h, "IJLM", c);
+}
+
+
+void fl_plastic_down_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  frame_rect(x, y, w, h - 1, "LLLLTTRR", c);
+}
+
+
+void fl_plastic_down_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  if (w > 6 && h > 6) {
+    shade_rect(x + 2, y + 2, w - 4, h - 5, "STUVWWWVT", c);
+    fl_plastic_down_frame(x, y, w, h, c, t);
+  }
+  else {
+    narrow_thin_box(x, y, w, h, c);
+  }
+}
+
+
+void fl_plastic_down_round(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  shade_round(x, y, w, h, "STUVWWWVT", c);
+  frame_round(x, y, w, h, "IJLM", c);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/print_panel.cxx (from rev 9002, branches/branch-3.0/src/core/print_panel.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/print_panel.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/print_panel.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,597 @@
+//
+// "$Id$"
+//
+// Print panel for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//
+// This file is "work in progress".  The main parts have been copied
+// from fluid's print_panel{.fl|.h|.cxx} and hand-edited to produce
+// a working version w/o global variables.  The intention is to move
+// all static variables into an own class, and to name this class
+// Fl_Printer_Chooser or similar...
+//
+// Todo:
+//
+//   -	Currently preferences can't be saved, and there are options that
+//	are not yet used for printing.
+//   -	This file can only be used as an include file in Fl_PS_Printer.cxx
+//   -	The use of static variables should be avoided.
+//   -	Probably much more ...
+//
+
+#include "print_panel.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "../src/core/flstring.h"
+#include <fltk3/Preferences.h>
+#include <fltk3/IntInput.h>
+
+static fltk3::Preferences print_prefs(fltk3::Preferences::USER, "fltk.org", "printers");
+static fltk3::DoubleWindow *print_panel=(fltk3::DoubleWindow *)0;
+static fltk3::Group *print_panel_controls=(fltk3::Group *)0;
+static fltk3::Choice *print_choice=(fltk3::Choice *)0;
+static fltk3::Button *print_properties=(fltk3::Button *)0;
+static fltk3::Box *print_status=(fltk3::Box *)0;
+static fltk3::RoundButton *print_all=(fltk3::RoundButton *)0;
+static fltk3::RoundButton *print_pages=(fltk3::RoundButton *)0;
+static fltk3::RoundButton *print_selection=(fltk3::RoundButton *)0;
+static fltk3::CheckButton *print_collate_button=(fltk3::CheckButton *)0;
+static fltk3::Group *print_collate_group[2]={(fltk3::Group *)0};
+static fltk3::Progress *print_progress=(fltk3::Progress *)0;
+static fltk3::DoubleWindow *print_properties_panel=(fltk3::DoubleWindow *)0;
+static fltk3::Choice *print_page_size=(fltk3::Choice *)0;
+static fltk3::IntInput *print_from=(fltk3::IntInput *)0;
+static fltk3::IntInput *print_to=(fltk3::IntInput *)0;
+static fltk3::Spinner *print_copies=(fltk3::Spinner *)0;
+
+static int print_start = 0;	// 1 if print_okay has been clicked
+
+static void cb_print_choice(fltk3::Choice*, void*) {
+  print_update_status();
+}
+
+static void cb_print_properties(fltk3::Button*, void*) {
+  print_properties_panel->show();
+}
+
+static void cb_print_all(fltk3::RoundButton*, void*) {
+  print_from->deactivate();
+  print_to->deactivate();
+}
+
+static void cb_print_pages(fltk3::RoundButton*, void*) {
+  print_from->activate();
+  print_to->activate();
+}
+
+static void cb_print_selection(fltk3::RoundButton*, void*) {
+  print_from->deactivate();
+  print_to->deactivate();
+}
+
+static void cb_print_copies(fltk3::Spinner*, void*) {
+  if (print_copies->value() == 1) {
+    print_collate_button->deactivate();
+    print_collate_group[0]->deactivate();
+    print_collate_group[1]->deactivate();
+  } else {
+/*    print_collate_button->activate(); // TODO: manage collate options
+    print_collate_group[0]->activate();
+    print_collate_group[1]->activate(); */
+  };
+}
+
+static void cb_print_collate_button(fltk3::CheckButton*, void*) {
+  int i = print_collate_button->value() != 0;
+  print_collate_group[i]->show();
+  print_collate_group[1 - i]->hide();
+}
+
+static void cb_Cancel(fltk3::Button*, void*) {
+  print_start = 0;
+  print_panel->hide();
+}
+
+static void cb_print_properties_panel(fltk3::DoubleWindow*, void*) {
+  print_properties_panel->hide();
+  print_update_status();
+}
+
+static fltk3::MenuItem menu_print_page_size[] = {
+ {"Letter", 0,  0, 0, 0, fltk3::NORMAL_LABEL, 0, 14, 0},
+ {"A4", 0,  0, 0, 0, fltk3::NORMAL_LABEL, 0, 14, 0},
+ {0,0,0,0,0,0,0,0,0}
+};
+
+#include <fltk3/Pixmap.h>
+static const char *idata_print_color[] = {
+"24 24 17 1",
+" \tc None",
+".\tc #FFFF00",
+"+\tc #C8FF00",
+"@\tc #00FF00",
+"#\tc #FFC800",
+"$\tc #FF0000",
+"%\tc #00FFFF",
+"&\tc #000000",
+"*\tc #FF00FF",
+"=\tc #00FFC8",
+"-\tc #FF00C8",
+";\tc #00C800",
+">\tc #C80000",
+",\tc #0000C8",
+"\'\tc #0000FF",
+")\tc #00C8FF",
+"!\tc #C800FF",
+"         ......         ",
+"       ..........       ",
+"      ............      ",
+"     ..............     ",
+"     ..............     ",
+"    ................    ",
+"    ................    ",
+"    ................    ",
+"    +@@@@@@+#$$$$$$#    ",
+"   %@@@@@@@&&$$$$$$$*   ",
+"  %%@@@@@@&&&&$$$$$$**  ",
+" %%%=@@@@&&&&&&$$$$-*** ",
+" %%%%@@@;&&&&&&>$$$**** ",
+"%%%%%%@@&&&&&&&&$$******",
+"%%%%%%%@&&&&&&&&$*******",
+"%%%%%%%%,&&&&&&,********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+" %%%%%%%)\'\'\'\'\'\'!******* ",
+" %%%%%%%%\'\'\'\'\'\'******** ",
+"  %%%%%%%%\'\'\'\'********  ",
+"   %%%%%%%%\'\'********   ",
+"     %%%%%%  ******     "
+};
+static fltk3::Pixmap image_print_color(idata_print_color);
+
+static const char *idata_print_gray[] = {
+"24 24 17 1",
+" \tc None",
+".\tc #E3E3E3",
+"+\tc #D2D2D2",
+"@\tc #969696",
+"#\tc #C2C2C2",
+"$\tc #4C4C4C",
+"%\tc #B2B2B2",
+"&\tc #000000",
+"*\tc #696969",
+"=\tc #ACACAC",
+"-\tc #626262",
+";\tc #767676",
+">\tc #3C3C3C",
+",\tc #161616",
+"\'\tc #1C1C1C",
+")\tc #929292",
+"!\tc #585858",
+"         ......         ",
+"       ..........       ",
+"      ............      ",
+"     ..............     ",
+"     ..............     ",
+"    ................    ",
+"    ................    ",
+"    ................    ",
+"    +@@@@@@+#$$$$$$#    ",
+"   %@@@@@@@&&$$$$$$$*   ",
+"  %%@@@@@@&&&&$$$$$$**  ",
+" %%%=@@@@&&&&&&$$$$-*** ",
+" %%%%@@@;&&&&&&>$$$**** ",
+"%%%%%%@@&&&&&&&&$$******",
+"%%%%%%%@&&&&&&&&$*******",
+"%%%%%%%%,&&&&&&,********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+"%%%%%%%%\'\'\'\'\'\'\'\'********",
+" %%%%%%%)\'\'\'\'\'\'!******* ",
+" %%%%%%%%\'\'\'\'\'\'******** ",
+"  %%%%%%%%\'\'\'\'********  ",
+"   %%%%%%%%\'\'********   ",
+"     %%%%%%  ******     "
+};
+static fltk3::Pixmap image_print_gray(idata_print_gray);
+
+static fltk3::Button *print_output_mode[4]={(fltk3::Button *)0};
+
+static void cb_Save(fltk3::ReturnButton*, void*) {
+  print_properties_panel->hide();
+
+  char name[1024];
+  int val;
+  const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+
+  snprintf(name, sizeof(name), "%s/page_size", printer);
+  print_prefs.set(name, print_page_size->value());
+
+  snprintf(name, sizeof(name), "%s/output_mode", printer);
+  for (val = 0; val < 4; val ++) {
+    if (print_output_mode[val]->value()) break;
+  }
+  print_prefs.set(name, val);
+}
+
+static void cb_Cancel1(fltk3::Button*, void*) {
+  print_properties_panel->hide();
+  print_update_status();
+}
+
+static void cb_Use(fltk3::Button*, void*) {
+  print_properties_panel->hide();
+}
+
+fltk3::DoubleWindow* make_print_panel() {
+  { print_panel = new fltk3::DoubleWindow(465, 235, fltk3::Printer::dialog_title);
+    { print_panel_controls = new fltk3::Group(10, 10, 447, 216);
+      { print_choice = new fltk3::Choice(133, 10, 181, 25, fltk3::Printer::dialog_printer);
+        print_choice->down_box(fltk3::BORDER_BOX);
+        print_choice->labelfont(1);
+        print_choice->callback((fltk3::Callback*)cb_print_choice);
+        print_choice->when(fltk3::WHEN_CHANGED);
+      } // fltk3::Choice* print_choice
+      { print_properties = new fltk3::Button(314, 10, 115, 25, fltk3::Printer::dialog_properties);
+        print_properties->callback((fltk3::Callback*)cb_print_properties);
+      } // fltk3::Button* print_properties
+      { print_status = new fltk3::Box(0, 41, print_panel_controls->w(), 17, "printer/job status");
+        print_status->align(fltk3::Align(fltk3::ALIGN_CLIP|fltk3::ALIGN_INSIDE|fltk3::ALIGN_LEFT));
+      } // fltk3::Box* print_status
+      { fltk3::Group* o = new fltk3::Group(10, 86, 227, 105, fltk3::Printer::dialog_range);
+        o->box(fltk3::THIN_DOWN_BOX);
+        o->labelfont(1);
+        o->align(fltk3::Align(fltk3::ALIGN_TOP_LEFT));
+        { print_all = new fltk3::RoundButton(20, 96, 38, 25, fltk3::Printer::dialog_all);
+          print_all->type(102);
+          print_all->down_box(fltk3::ROUND_DOWN_BOX);
+          print_all->value(1);
+          print_all->callback((fltk3::Callback*)cb_print_all);
+        } // fltk3::RoundButton* print_all
+        { print_pages = new fltk3::RoundButton(20, 126, 64, 25, fltk3::Printer::dialog_pages);
+          print_pages->type(102);
+          print_pages->down_box(fltk3::ROUND_DOWN_BOX);
+          print_pages->callback((fltk3::Callback*)cb_print_pages);
+        } // fltk3::RoundButton* print_pages
+        { print_selection = new fltk3::RoundButton(20, 156, 82, 25, "Selection");
+          print_selection->type(102);
+          print_selection->down_box(fltk3::ROUND_DOWN_BOX);
+          print_selection->callback((fltk3::Callback*)cb_print_selection);
+        } // fltk3::RoundButton* print_selection
+        { print_from = new fltk3::IntInput(136, 126, 28, 25, fltk3::Printer::dialog_from);
+          print_from->type(2);
+          print_from->textfont(4);
+          print_from->deactivate();
+        } // fltk3::IntInput* print_from
+        { print_to = new fltk3::IntInput(199, 126, 28, 25, fltk3::Printer::dialog_to);
+          print_to->type(2);
+          print_to->textfont(4);
+          print_to->deactivate();
+        } // fltk3::IntInput* print_to
+        o->end();
+      } // fltk3::Group* o
+      { fltk3::Group* o = new fltk3::Group(247, 86, 210, 105, fltk3::Printer::dialog_copies);
+        o->box(fltk3::THIN_DOWN_BOX);
+        o->labelfont(1);
+        o->align(fltk3::Align(fltk3::ALIGN_TOP_LEFT));
+        { print_copies = new fltk3::Spinner(321, 96, 45, 25, fltk3::Printer::dialog_copyNo);
+          print_copies->callback((fltk3::Callback*)cb_print_copies);
+          print_copies->when(fltk3::WHEN_CHANGED);
+        } // fltk3::Spinner* print_copies
+        { print_collate_button = new fltk3::CheckButton(376, 96, 64, 25, "Collate");
+          print_collate_button->down_box(fltk3::DOWN_BOX);
+          print_collate_button->callback((fltk3::Callback*)cb_print_collate_button);
+          print_collate_button->when(fltk3::WHEN_CHANGED);
+          print_collate_button->deactivate();
+        } // fltk3::CheckButton* print_collate_button
+        { print_collate_group[0] = new fltk3::Group(257, 131, 191, 50);
+          print_collate_group[0]->deactivate();
+          { fltk3::Box* o = new fltk3::Box(287, 141, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(272, 136, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(257, 131, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(352, 141, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(337, 136, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(322, 131, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(417, 141, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(402, 136, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(387, 131, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+            o->deactivate();
+          } // fltk3::Box* o
+          print_collate_group[0]->end();
+        } // fltk3::Group* print_collate_group[0]
+        { print_collate_group[1] = new fltk3::Group(257, 131, 191, 50);
+          print_collate_group[1]->hide();
+          print_collate_group[1]->deactivate();
+          { fltk3::Box* o = new fltk3::Box(287, 141, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(272, 136, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(257, 131, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(352, 141, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(337, 136, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(322, 131, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(417, 141, 30, 40, "3");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(402, 136, 30, 40, "2");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          { fltk3::Box* o = new fltk3::Box(387, 131, 30, 40, "1");
+            o->box(fltk3::BORDER_BOX);
+            o->color(fltk3::BACKGROUND2_COLOR);
+            o->labelsize(11);
+            o->align(fltk3::Align(fltk3::ALIGN_BOTTOM_RIGHT|fltk3::ALIGN_INSIDE));
+          } // fltk3::Box* o
+          print_collate_group[1]->end();
+        } // fltk3::Group* print_collate_group[1]
+        o->end();
+      } // fltk3::Group* o
+      { fltk3::ReturnButton* o = new fltk3::ReturnButton(279, 201, 100, 25, fltk3::Printer::dialog_print_button);
+        o->callback((fltk3::Callback*)print_cb);
+      } // fltk3::ReturnButton* o
+      { fltk3::Button* o = new fltk3::Button(389, 201, 68, 25, fltk3::Printer::dialog_cancel_button);
+        o->callback((fltk3::Callback*)cb_Cancel);
+      } // fltk3::Button* o
+      print_panel_controls->end();
+    } // fltk3::Group* print_panel_controls
+    { print_progress = new fltk3::Progress(10, 203, 289, 21);
+      print_progress->selection_color((fltk3::Color)4);
+      print_progress->hide();
+    } // fltk3::Progress* print_progress
+    print_panel->set_modal();
+    print_panel->end();
+  } // fltk3::DoubleWindow* print_panel
+  { print_properties_panel = new fltk3::DoubleWindow(290, 130, fltk3::Printer::property_title);
+    print_properties_panel->callback((fltk3::Callback*)cb_print_properties_panel);
+    { print_page_size = new fltk3::Choice(150, 10, 80, 25, fltk3::Printer::property_pagesize);
+      print_page_size->down_box(fltk3::BORDER_BOX);
+      print_page_size->labelfont(fltk3::HELVETICA);
+      print_page_size->menu(menu_print_page_size);
+    } // fltk3::Choice* print_page_size
+    { fltk3::Group* o = new fltk3::Group(110, 45, 170, 40, fltk3::Printer::property_mode);
+      o->labelfont(fltk3::HELVETICA);
+      o->align(fltk3::Align(fltk3::ALIGN_LEFT));
+      { print_output_mode[0] = new fltk3::Button(110, 45, 30, 40);
+        print_output_mode[0]->type(102);
+        print_output_mode[0]->box(fltk3::BORDER_BOX);
+        print_output_mode[0]->down_box(fltk3::BORDER_BOX);
+        print_output_mode[0]->value(1);
+        print_output_mode[0]->color(fltk3::BACKGROUND2_COLOR);
+        print_output_mode[0]->selection_color(fltk3::FOREGROUND_COLOR);
+        print_output_mode[0]->image(image_print_color);
+      } // fltk3::Button* print_output_mode[0]
+      { print_output_mode[1] = new fltk3::Button(150, 50, 40, 30);
+        print_output_mode[1]->type(102);
+        print_output_mode[1]->box(fltk3::BORDER_BOX);
+        print_output_mode[1]->down_box(fltk3::BORDER_BOX);
+        print_output_mode[1]->color(fltk3::BACKGROUND2_COLOR);
+        print_output_mode[1]->selection_color(fltk3::FOREGROUND_COLOR);
+        print_output_mode[1]->image(image_print_color);
+      } // fltk3::Button* print_output_mode[1]
+      { print_output_mode[2] = new fltk3::Button(200, 45, 30, 40);
+        print_output_mode[2]->type(102);
+        print_output_mode[2]->box(fltk3::BORDER_BOX);
+        print_output_mode[2]->down_box(fltk3::BORDER_BOX);
+        print_output_mode[2]->color(fltk3::BACKGROUND2_COLOR);
+        print_output_mode[2]->selection_color(fltk3::FOREGROUND_COLOR);
+        print_output_mode[2]->image(image_print_gray);
+      } // fltk3::Button* print_output_mode[2]
+      { print_output_mode[3] = new fltk3::Button(240, 50, 40, 30);
+        print_output_mode[3]->type(102);
+        print_output_mode[3]->box(fltk3::BORDER_BOX);
+        print_output_mode[3]->down_box(fltk3::BORDER_BOX);
+        print_output_mode[3]->color(fltk3::BACKGROUND2_COLOR);
+        print_output_mode[3]->selection_color(fltk3::FOREGROUND_COLOR);
+        print_output_mode[3]->image(image_print_gray);
+      } // fltk3::Button* print_output_mode[3]
+      o->end();
+    } // fltk3::Group* o
+    { fltk3::ReturnButton* o = new fltk3::ReturnButton(93, 95, 99, 25, fltk3::Printer::property_save);
+      o->callback((fltk3::Callback*)cb_Save);
+    } // fltk3::ReturnButton* o
+    { fltk3::Button* o = new fltk3::Button(202, 95, 78, 25, fltk3::Printer::property_cancel);
+      o->callback((fltk3::Callback*)cb_Cancel1);
+    } // fltk3::Button* o
+    { fltk3::Button* o = new fltk3::Button(10, 95, 73, 25, fltk3::Printer::property_use);
+      o->callback((fltk3::Callback*)cb_Use);
+    } // fltk3::Button* o
+    print_properties_panel->set_modal();
+    print_properties_panel->end();
+  } // fltk3::DoubleWindow* print_properties_panel
+  return print_properties_panel;
+}
+
+void print_cb(fltk3::ReturnButton *, void *) {
+  print_start = 1;
+  print_panel->hide();
+}
+
+void print_load() {
+  FILE *lpstat;
+  char line[1024], name[1024], *nptr, qname[2048], *qptr, defname[1024];
+  int i;
+
+  if (print_choice->size() > 1) {
+    for (i = 1; print_choice->text(i); i ++) {
+      free(print_choice->menu()[i].user_data());
+    }
+  }
+
+  print_choice->clear();
+  print_choice->add(fltk3::Printer::dialog_print_to_file, (unsigned)0, 0, 0, fltk3::MENU_DIVIDER);
+  print_choice->value(0);
+  
+  print_start = 0;
+
+  defname[0] = '\0';
+
+  if ((lpstat = popen("LC_MESSAGES=C LANG=C lpstat -p -d", "r")) != NULL) {
+    while (fgets(line, sizeof(line), lpstat)) {
+      if (!strncmp(line, "printer ", 8) &&
+          sscanf(line + 8, "%s", name) == 1) {
+        for (nptr = name, qptr = qname; *nptr; *qptr++ = *nptr++) {
+          if (*nptr == '/') *qptr++ = '\\';
+        }
+        *qptr = '\0';
+
+        print_choice->add(qname, (unsigned)0, 0, (void *)strdup(name), 0);
+      } else if (!strncmp(line, "system default destination: ", 28)) {
+        if (sscanf(line + 28, "%s", defname) != 1) defname[0] = '\0';
+      }
+    }
+    pclose(lpstat);
+  }
+
+  if (defname[0]) {
+    for (i = 1; print_choice->text(i); i ++) {
+      if (!strcmp((char *)print_choice->menu()[i].user_data(), defname)) {
+        print_choice->value(i);
+        break;
+      }
+    }
+  } else if (print_choice->size() > 2) print_choice->value(1);
+
+  print_update_status();
+
+} // print_load()
+
+void print_update_status() {
+  FILE *lpstat;
+  char command[1024];
+  static char status[1024];
+  const char *printer = (const char *)print_choice->menu()[print_choice->value()].user_data();
+
+  if (print_choice->value()) {
+    snprintf(command, sizeof(command), "lpstat -p '%s'", printer);
+    if ((lpstat = popen(command, "r")) != NULL) {
+      if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ }
+      pclose(lpstat);
+    } else strcpy(status, "printer status unavailable");
+  } else status[0] = '\0';
+
+  print_status->label(status);
+
+  char name[1024];
+  int val;
+
+  snprintf(name, sizeof(name), "%s/page_size", printer == NULL ? "" : printer);
+  print_prefs.get(name, val, 1);
+  print_page_size->value(val);
+
+  snprintf(name, sizeof(name), "%s/output_mode", printer == NULL ? "" : printer);
+  print_prefs.get(name, val, 0);
+  print_output_mode[val]->setonly();
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/print_panel.h (from rev 9002, branches/branch-3.0/src/core/print_panel.h)
===================================================================
--- branches/branch-3.0/src/fltk3/print_panel.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/print_panel.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,55 @@
+//
+// "$Id$"
+//
+// Print panel for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//
+// This is a temporary file.  It is only for development and will
+// probably be removed later.
+//
+
+#ifndef print_panel_h
+#define print_panel_h
+#include <fltk3/run.h>
+#include <fltk3/DoubleWindow.h>
+#include <fltk3/Group.h>
+#include <fltk3/Choice.h>
+#include <fltk3/Button.h>
+#include <fltk3/Box.h>
+#include <fltk3/RoundButton.h>
+#include <fltk3/Input.h>
+#include <fltk3/Spinner.h>
+#include <fltk3/CheckButton.h>
+#include <fltk3/ReturnButton.h>
+#include <fltk3/Progress.h>
+static fltk3::DoubleWindow* make_print_panel();
+static void print_cb(fltk3::ReturnButton *, void *); 
+static void print_load();
+static void print_update_status();
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/ps_image.cxx (from rev 9002, branches/branch-3.0/src/core/ps_image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/ps_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/ps_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,553 @@
+//
+// "$Id: image.cxx 4324 2005-05-09 21:47:22Z rokan $"
+//
+// Postscript image drawing implementation for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifndef FLTK3_DOXYGEN
+
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+
+#include <fltk3/PostScript.h>
+#include <fltk3/run.h>
+#include <fltk3/Pixmap.h>
+#include <fltk3/Bitmap.h>
+ 
+int fltk3::PostScriptGraphicsDriver::alpha_mask(const uchar * data, int w, int h, int D, int LD){
+
+  mask = 0;
+  if ((D/2)*2 != D){ //no mask info
+    return 0;
+  }
+  int xx;
+  int i,j, k, l;
+  LD += w*D;
+  int V255=0;
+  int V0 =0;
+  int V_=0;
+  for (j=0;j<h;j++){
+    for (i=0;i<w;i++)
+      switch(data[j*LD+D*i+D-1]){
+        case 255: V255 = 1; break;
+        case 0: V0 = 1; break;
+        default: V_= 1;
+      }
+    if (V_) break;
+  };
+  if (!V_){
+    if (V0)
+      if (V255){// not true alpha, only masking
+        xx = (w+7)/8;
+        mask = new uchar[h * xx];
+        for (i=0;i<h * xx;i++) mask[i]=0;
+        for (j=0;j<h;j++)
+          for (i=0;i<w;i++)
+            if (data[j*LD+D*i+D-1])
+              mask[j*xx+i/8] |= 1 << (i % 8);
+        mx = w;
+        my = h; //mask imensions
+        return 0;
+      } else {
+        mask=0;
+        return 1; //everything masked
+      }
+    else
+      return 0;
+  }
+
+
+
+  /////   Alpha dither, generating (4*w) * 4 mask area       /////
+  /////         with Floyd-Steinberg error diffusion         /////
+
+  mask = new uchar[((w+1)/2) * h * 4];
+
+  for (i = 0; i<((w+1)/2) * h * 4; i++) mask[i] = 0; //cleaning
+
+
+
+  mx= w*4;
+  my=h*4; // mask dimensions
+
+  xx = (w+1)/2;                //  mask line width in bytes
+
+  short * errors1 = new short [w*4+2]; //  two rows of dither errors
+  short * errors2 = new short [w*4+2]; //  two rows of dither errors
+
+  for (i=0; i<w*4+2; i++) errors2[i] = 0; // cleaning,after first swap will become current
+  for (i=0; i<w*4+2; i++) errors1[i] = 0; // cleaning,after first swap will become current
+
+  short * current = errors1;
+  short * next = errors2;
+  short * swap;
+
+  for (j=0; j<h; j++){
+    for (l=0; l<4; ){           // generating 4 rows of mask lines for 1 RGB line
+      int jj = j*4+l;
+
+      /// mask row index
+      swap = next;
+      next = current;
+      current = swap;
+      *(next+1) = 0;          // must clean the first cell, next are overriden by *1
+      for (i=0; i<w; i++){
+        for (k=0; k<4; k++){   // generating 4 x-pixels for 1 RGB
+          short error, o1, o2, o3;
+          int ii = i*4+k;   // mask cell index
+          short val = data[j*LD+D*i+D-1] + current[1+ii];
+          if (val>127){
+            mask[jj*xx+ii/8]  |= 1 << (ii % 8); //set mask bit
+            error =  val-255;
+          }else
+            error = val;
+
+          ////// error spreading /////
+          if (error >0){
+            next[ii] +=  o1 = (error * 3 + 8)/16;
+            current[ii+2] += o2 = (error * 7 + 8)/16;
+            next[ii+2] = o3 =(error + 8)/16;  // *1 - ok replacing (cleaning)
+          } else {
+            next[ii] += o1 = (error * 3 - 8)/16;
+            current[ii+2] += o2 = (error * 7 - 8)/16;
+            next[ii+2] = o3 = (error - 8)/16;
+          }
+          next[1+ii] += error - o1 - o2 - o3;
+        }
+      }
+      l++;
+
+      ////// backward
+
+      jj = j*4+l;
+      swap = next;
+      next = current;
+      current = swap;
+      *(next+1) = 0;          // must clean the first cell, next are overriden by *1
+
+      for (i = w-1; i >= 0; i--){
+
+        for (k=3; k>=0; k--){   // generating 4 x-pixels for 1 RGB
+          short error, o1, o2, o3;
+
+          int ii = i*4+k;   // mask cell index
+          short val = data[j*LD+D*i+D-1] + current[1+ii];
+          if (val>127){
+
+            mask[jj*xx+ii/8]  |= 1 << (ii % 8); //set mask bit
+            error =  val-255;
+          } else
+            error = val;
+
+          ////// error spreading /////
+          if (error >0){
+            next[ii+2] +=  o1 = (error * 3 + 8)/16;
+            current[ii] += o2 = (error * 7 + 8)/16;
+            next[ii] = o3 =(error + 8)/16;  // *1 - ok replacing (cleaning)
+          } else {
+            next[ii+2] += o1 = (error * 3 - 8)/16;
+
+            current[ii] += o2 = (error * 7 - 8)/16;
+            next[ii] = o3 = (error - 8)/16;
+          }
+          next[1+ii] += error - o1 - o2 - o3;
+        }
+      }
+      l++;
+    }
+  }
+  delete[] errors1;
+  delete[] errors2;
+  return 0;
+}
+
+// bitwise inversion of all 4-bit quantities
+static const unsigned char swapped[16] = {0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
+
+// bitwise inversion of a byte
+static inline uchar swap_byte(const uchar b) {
+  return (swapped[b & 0xF] << 4) | swapped[b >> 4];
+}
+
+
+extern uchar **fl_mask_bitmap;
+
+
+void fltk3::PostScriptGraphicsDriver::draw_image(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) {
+  double x = ix, y = iy, w = iw, h = ih;
+
+  if (D<3){ //mono
+    draw_image_mono(data, ix, iy, iw, ih, D, LD);
+    return;
+  }
+
+
+  int i,j, k;
+
+  fprintf(output,"save\n");
+
+  const char * interpol;
+  if (lang_level_>1){
+    if (interpolate_)
+      interpol="true";
+    else
+      interpol="false";
+    if (mask && lang_level_>2)
+      fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+    else
+      fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol);
+  } else
+    fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih);
+
+
+  if (!LD) LD = iw*D;
+  uchar *curmask=mask;
+
+  for (j=0; j<ih;j++){
+    if (mask){
+
+      for (k=0;k<my/ih;k++){
+        for (i=0; i<((mx+7)/8);i++){
+          if (!(i%80)) fprintf(output, "\n");
+          fprintf(output, "%.2x",swap_byte(*curmask));
+          curmask++;
+        }
+        fprintf(output,"\n");
+      }
+    }
+    const uchar *curdata=data+j*LD;
+    for (i=0 ; i<iw ; i++) {
+      uchar r = curdata[0];
+      uchar g =  curdata[1];
+      uchar b =  curdata[2];
+      if (lang_level_<3 && D>3) { //can do  mixing using bg_* colors)
+        unsigned int a2 = curdata[3]; //must be int
+        unsigned int a = 255-a2;
+        r = (a2 * r + bg_r * a)/255;
+        g = (a2 * g + bg_g * a)/255;
+        b = (a2 * b + bg_b * a)/255;
+      }
+      if (!(i%40)) fprintf(output, "\n");
+      fprintf(output, "%.2x%.2x%.2x", r, g, b);
+      curdata +=D;
+    }
+    fprintf(output,"\n");
+
+  }
+
+  fprintf(output," >\nrestore\n" );
+
+
+}
+
+void fltk3::PostScriptGraphicsDriver::draw_image(fltk3::DrawImageCb call, void *data, int ix, int iy, int iw, int ih, int D) {
+  double x = ix, y = iy, w = iw, h = ih;
+
+  int level2_mask = 0;
+  fprintf(output,"save\n");
+  int i,j,k;
+  const char * interpol;
+  if (lang_level_ > 1) {
+    if (interpolate_) interpol="true";
+    else interpol="false";
+    if (mask && lang_level_ > 2) {
+      fprintf(output, "%g %g %g %g %i %i %i %i %s CIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+      }
+    else if (mask && lang_level_ == 2) {
+      level2_mask = 1; // use method for drawing masked color image with PostScript level 2
+      fprintf(output, " %g %g %g %g %d %d pixmap_plot\n", x, y, w, h, iw, ih);
+    }
+    else {
+      fprintf(output, "%g %g %g %g %i %i %s CII\n", x , y+h , w , -h , iw , ih, interpol);
+      }
+  } else {
+    fprintf(output , "%g %g %g %g %i %i CI", x , y+h , w , -h , iw , ih);
+    }
+
+  int LD=iw*D;
+  uchar *rgbdata=new uchar[LD];
+  uchar *curmask=mask;
+
+  if (level2_mask) {
+    for (j = ih - 1; j >= 0; j--) { // output full image data
+      call(data, 0, j, iw, rgbdata);
+      uchar *curdata = rgbdata;
+      for (i=0 ; i<iw ; i++) {
+	if (!(i%20)) fputs("\n", output);
+	fprintf(output, "%.2x%.2x%.2x", curdata[0], curdata[1], curdata[2]);
+	curdata += D;
+	}
+      fputs("\n", output);
+      }
+    fputs(">\n", output);
+    for (j = ih - 1; j >= 0; j--) { // output mask data
+      curmask = mask + j * (my/ih) * ((mx+7)/8);
+      for (k=0; k < my/ih; k++) {
+	for (i=0; i < ((mx+7)/8); i++) {
+	  if (!(i%40)) fputs("\n", output);
+	  fprintf(output, "%.2x",swap_byte(*curmask));
+	  curmask++;
+	}
+	fputs("\n", output);
+      }
+    }
+    fputs(">\n", output);
+  }
+  else {
+    for (j=0; j<ih;j++) {
+      if (mask && lang_level_ > 2) {  // InterleaveType 2 mask data
+	for (k=0; k<my/ih;k++) { //for alpha pseudo-masking
+	  for (i=0; i<((mx+7)/8);i++) {
+	    if (!(i%40)) fputs("\n", output);
+	    fprintf(output, "%.2x",swap_byte(*curmask));
+	    curmask++;
+	  }
+	  fprintf(output,"\n");
+	}
+      }
+      call(data,0,j,iw,rgbdata);
+      uchar *curdata=rgbdata;
+      for (i=0 ; i<iw ; i++) {
+	uchar r = curdata[0];
+	uchar g =  curdata[1];
+	uchar b =  curdata[2];
+
+	if (!(i%40)) 	fputs("\n", output);
+	fprintf(output, "%.2x%.2x%.2x", r, g, b);
+
+	curdata +=D;
+      }
+      fputs("\n", output);
+
+    }
+    fputs(">\n", output);
+    }
+
+  fprintf(output,"restore\n");
+  delete[] rgbdata;
+}
+
+void fltk3::PostScriptGraphicsDriver::draw_image_mono(const uchar *data, int ix, int iy, int iw, int ih, int D, int LD) {
+  double x = ix, y = iy, w = iw, h = ih;
+
+  fprintf(output,"save\n");
+
+  int i,j, k;
+
+  const char * interpol;
+  if (lang_level_>1){
+    if (interpolate_)
+      interpol="true";
+    else
+      interpol="false";
+    if (mask && lang_level_>2)
+      fprintf(output, "%g %g %g %g %i %i %i %i %s GIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+    else
+      fprintf(output, "%g %g %g %g %i %i %s GII\n", x , y+h , w , -h , iw , ih, interpol);
+  }else
+    fprintf(output , "%g %g %g %g %i %i GI", x , y+h , w , -h , iw , ih);
+
+
+  if (!LD) LD = iw*D;
+
+
+  int bg = (bg_r + bg_g + bg_b)/3;
+
+  uchar *curmask=mask;
+  for (j=0; j<ih;j++){
+    if (mask){
+      for (k=0;k<my/ih;k++){
+        for (i=0; i<((mx+7)/8);i++){
+          if (!(i%80)) fprintf(output, "\n");
+          fprintf(output, "%.2x",swap_byte(*curmask));
+          curmask++;
+        }
+        fprintf(output,"\n");
+      }
+    }
+    const uchar *curdata=data+j*LD;
+    for (i=0 ; i<iw ; i++) {
+      if (!(i%80)) fprintf(output, "\n");
+      uchar r = curdata[0];
+      if (lang_level_<3 && D>1) { //can do  mixing
+
+        unsigned int a2 = curdata[1]; //must be int
+        unsigned int a = 255-a2;
+        r = (a2 * r + bg * a)/255;
+      }
+      if (!(i%120)) fprintf(output, "\n");
+      fprintf(output, "%.2x", r);
+      curdata +=D;
+    }
+    fprintf(output,"\n");
+
+  }
+
+  fprintf(output," >\nrestore\n" );
+
+}
+
+
+
+void fltk3::PostScriptGraphicsDriver::draw_image_mono(fltk3::DrawImageCb call, void *data, int ix, int iy, int iw, int ih, int D) {
+  double x = ix, y = iy, w = iw, h = ih;
+
+  fprintf(output,"save\n");
+  int i,j,k;
+  const char * interpol;
+  if (lang_level_>1){
+    if (interpolate_) interpol="true";
+    else interpol="false";
+    if (mask && lang_level_>2)
+      fprintf(output, "%g %g %g %g %i %i %i %i %s GIM\n", x , y+h , w , -h , iw , ih, mx, my, interpol);
+    else
+      fprintf(output, "%g %g %g %g %i %i %s GII\n", x , y+h , w , -h , iw , ih, interpol);
+  } else
+    fprintf(output , "%g %g %g %g %i %i GI", x , y+h , w , -h , iw , ih);
+
+  int LD=iw*D;
+  uchar *rgbdata=new uchar[LD];
+  uchar *curmask=mask;
+  for (j=0; j<ih;j++){
+
+    if (mask && lang_level_>2){  // InterleaveType 2 mask data
+      for (k=0; k<my/ih;k++){ //for alpha pseudo-masking
+        for (i=0; i<((mx+7)/8);i++){
+          if (!(i%40)) fprintf(output, "\n");
+          fprintf(output, "%.2x",swap_byte(*curmask));
+          curmask++;
+        }
+        fprintf(output,"\n");
+      }
+    }
+    call(data,0,j,iw,rgbdata);
+    uchar *curdata=rgbdata;
+    for (i=0 ; i<iw ; i++) {
+      uchar r = curdata[0];
+      if (!(i%120)) fprintf(output, "\n");
+      fprintf(output, "%.2x", r);
+      curdata +=D;
+    }
+    fprintf(output,"\n");
+  }
+  fprintf(output,">\n");
+  fprintf(output,"restore\n");
+  delete[] rgbdata;
+}
+
+
+////////////////////////////// Image classes //////////////////////
+
+
+void fltk3::PostScriptGraphicsDriver::draw(fltk3::Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy){
+  const char * const * di =pxm->data();
+  int w,h;
+  if (!fltk3::measure_pixmap(di, w, h)) return;
+  mask=0;
+  fl_mask_bitmap=&mask;
+  mx = WP;
+  my = HP;
+  push_clip(XP, YP, WP, HP);
+  fltk3::draw_pixmap(di,XP -cx, YP -cy, fltk3::BLACK );
+  pop_clip();
+  delete[] mask;
+  mask=0;
+  fl_mask_bitmap=0;
+}
+
+void fltk3::PostScriptGraphicsDriver::draw(fltk3::RGBImage * rgb,int XP, int YP, int WP, int HP, int cx, int cy){
+  const uchar  * di = rgb->array;
+  int w = rgb->w();
+  int h = rgb->h();
+  mask=0;
+  if (lang_level_>2) //when not true, not making alphamask, mixing colors instead...
+  if (alpha_mask(di, w, h, rgb->d(),rgb->ld())) return; //everthing masked, no need for painting!
+  push_clip(XP, YP, WP, HP);
+  draw_image(di, XP + cx, YP + cy, w, h, rgb->d(), rgb->ld());
+  pop_clip();
+  delete[]mask;
+  mask=0;
+}
+
+void fltk3::PostScriptGraphicsDriver::draw(fltk3::Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy){
+  const uchar  * di = bitmap->array;
+  int w,h;
+  int LD=(bitmap->w()+7)/8;
+  int xx;
+
+  if (WP> bitmap->w() - cx){// to assure that it does not go out of bounds;
+     w = bitmap->w() - cx;
+     xx = (bitmap->w()+7)/8 - cx/8; //length of mask in bytes
+  }else{
+    w =WP;
+    xx = (w+7)/8 - cx/8;
+  }
+  if ( HP > bitmap->h()-cy)
+    h = bitmap->h() - cy;
+  else
+    h = HP;
+
+  di += cy*LD + cx/8;
+  int si = cx % 8; // small shift to be clipped, it is simpler than shifting whole mask
+
+  int i,j;
+  push_clip(XP, YP, WP, HP);
+  fprintf(output , "%i %i %i %i %i %i MI", XP - si, YP + HP , WP , -HP , w , h);
+
+  for (j=0; j<HP; j++){
+    for (i=0; i<xx; i++){
+      if (!(i%80)) fprintf(output, "\n"); // not have lines longer than 255 chars
+      fprintf(output, "%.2x", swap_byte(*di) );
+      di++;
+    }
+    fprintf(output,"\n");
+  }
+  fprintf(output,">\n");
+  pop_clip();
+}
+
+#endif // FLTK3_DOXYGEN
+
+//
+// End of "$Id: image.cxx 4324 2005-05-09 21:47:22Z rokan $"
+//
+
+
+
+
+
+
+
+
+
+
+  
+
+
+
+
+
+
+

Copied: branches/branch-3.0/src/fltk3/read_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_read_image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/read_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/read_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,509 @@
+//
+// "$Id$"
+//
+// X11 image reading routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/x.h>
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+
+#ifdef DEBUG
+#  include <stdio.h>
+#endif // DEBUG
+
+#ifdef WIN32
+#  include "win32_read_image.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_read_image.cxx"
+#else
+#  include <X11/Xutil.h>
+#  ifdef __sgi
+#    include <X11/extensions/readdisplay.h>
+#  else
+#    include <stdlib.h>
+#  endif // __sgi
+
+// Defined in fltk3::color.cxx
+extern uchar fl_redmask, fl_greenmask, fl_bluemask;
+extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;
+
+//
+// 'fl_subimage_offsets()' - Calculate subimage offsets for an axis
+static inline int
+fl_subimage_offsets(int a, int aw, int b, int bw, int &obw)
+{
+  int off;
+  int ob;
+
+  if (b >= a) {
+    ob = b;
+    off = 0;
+  } else {
+    ob = a;
+    off = a - b;
+  }
+
+  bw -= off;
+
+  if (ob + bw <= a + aw) {
+    obw = bw;
+  } else {
+    obw = (a + aw) - ob;
+  }
+
+  return off;
+}
+
+// this handler will catch and ignore exceptions during XGetImage
+// to avoid an application crash
+static int xgetimageerrhandler(Display *display, XErrorEvent *error) {
+  return 0;
+}
+
+//
+// 'fltk3::read_image()' - Read an image from the current window.
+//
+
+uchar *				// O - Pixel buffer or NULL if failed
+fltk3::read_image(uchar *p,		// I - Pixel buffer or NULL to allocate
+              int   X,		// I - Left position
+	      int   Y,		// I - Top position
+	      int   w,		// I - Width of area to read
+	                        // negative allows capture of window title bar and frame
+	      int   h,		// I - Height of area to read
+	      int   alpha) {	// I - Alpha value for image (0 for none)
+  XImage	*image;		// Captured image
+  int		i, maxindex;	// Looping vars
+  int           x, y;		// Current X & Y in image
+  int		d;		// Depth of image
+  unsigned char *line,		// Array to hold image row
+		*line_ptr;	// Pointer to current line image
+  unsigned char	*pixel;		// Current color value
+  XColor	colors[4096];	// Colors from the colormap...
+  unsigned char	cvals[4096][3];	// Color values from the colormap...
+  unsigned	index_mask,
+		index_shift,
+		red_mask,
+		red_shift,
+		green_mask,
+		green_shift,
+		blue_mask,
+		blue_shift;
+
+
+  //
+  // Under X11 we have the option of the XGetImage() interface or SGI's
+  // ReadDisplay extension which does all of the really hard work for
+  // us...
+  //
+  int allow_outside = w < 0;    // negative w allows negative X or Y, that is, window frame
+  if (w < 0) w = - w;
+
+#  ifdef __sgi
+  if (XReadDisplayQueryExtension(fl_display, &i, &i)) {
+    image = XReadDisplay(fl_display, fl_window, X, Y, w, h, 0, NULL);
+  } else
+#  else
+  image = 0;
+#  endif // __sgi
+
+  if (!image) {
+    // fetch absolute coordinates
+    int dx, dy, sx, sy, sw, sh;
+    ::Window child_win;
+    
+    fltk3::Window *win;
+    if (allow_outside) win = (fltk3::Window*)1;
+    else win = fl_find(fl_window);
+    if (win) {
+      XTranslateCoordinates(fl_display, fl_window,
+          RootWindow(fl_display, fl_screen), X, Y, &dx, &dy, &child_win);
+      // screen dimensions
+      fltk3::screen_xywh(sx, sy, sw, sh, fl_screen);
+    }
+    if (!win || (dx >= sx && dy >= sy && dx + w <= sw && dy + h <= sh)) {
+      // the image is fully contained, we can use the traditional method
+      // however, if the window is obscured etc. the function will still fail. Make sure we
+      // catch the error and continue, otherwise an exception will be thrown.
+      XErrorHandler old_handler = XSetErrorHandler(xgetimageerrhandler);
+      image = XGetImage(fl_display, fl_window, X, Y, w, h, AllPlanes, ZPixmap);
+      XSetErrorHandler(old_handler);
+    } else {
+      // image is crossing borders, determine visible region
+      int nw, nh, noffx, noffy;
+      noffx = fl_subimage_offsets(sx, sw, dx, w, nw);
+      noffy = fl_subimage_offsets(sy, sh, dy, h, nh);
+      if (nw <= 0 || nh <= 0) return 0;
+
+      // allocate the image
+      int bpp = fl_visual->depth + ((fl_visual->depth / 8) % 2) * 8;
+      char* buf = (char*)malloc(bpp / 8 * w * h);
+      image = XCreateImage(fl_display, fl_visual->visual,
+	  fl_visual->depth, ZPixmap, 0, buf, w, h, bpp, 0);
+      if (!image) {
+	if (buf) free(buf);
+	return 0;
+      }
+
+      XErrorHandler old_handler = XSetErrorHandler(xgetimageerrhandler);
+      XImage *subimg = XGetSubImage(fl_display, fl_window, X + noffx, Y + noffy,
+                                    nw, nh, AllPlanes, ZPixmap, image, noffx, noffy);
+      XSetErrorHandler(old_handler);
+      if (!subimg) {
+        XDestroyImage(image);
+        return 0;
+      }
+    }
+  }
+
+  if (!image) return 0;
+
+#ifdef DEBUG
+  printf("width            = %d\n", image->width);
+  printf("height           = %d\n", image->height);
+  printf("xoffset          = %d\n", image->xoffset);
+  printf("format           = %d\n", image->format);
+  printf("data             = %p\n", image->data);
+  printf("byte_order       = %d\n", image->byte_order);
+  printf("bitmap_unit      = %d\n", image->bitmap_unit);
+  printf("bitmap_bit_order = %d\n", image->bitmap_bit_order);
+  printf("bitmap_pad       = %d\n", image->bitmap_pad);
+  printf("depth            = %d\n", image->depth);
+  printf("bytes_per_line   = %d\n", image->bytes_per_line);
+  printf("bits_per_pixel   = %d\n", image->bits_per_pixel);
+  printf("red_mask         = %08x\n", image->red_mask);
+  printf("green_mask       = %08x\n", image->green_mask);
+  printf("blue_mask        = %08x\n", image->blue_mask);
+  printf("map_entries      = %d\n", fl_visual->visual->map_entries);
+#endif // DEBUG
+
+  d = alpha ? 4 : 3;
+
+  // Allocate the image data array as needed...
+  if (!p) p = new uchar[w * h * d];
+
+  // Initialize the default colors/alpha in the whole image...
+  memset(p, alpha, w * h * d);
+
+  // Check that we have valid mask/shift values...
+  if (!image->red_mask && image->bits_per_pixel > 12) {
+    // Greater than 12 bits must be TrueColor...
+    image->red_mask   = fl_visual->visual->red_mask;
+    image->green_mask = fl_visual->visual->green_mask;
+    image->blue_mask  = fl_visual->visual->blue_mask;
+
+#ifdef DEBUG
+    puts("\n---- UPDATED ----");
+    printf("fl_redmask       = %08x\n", fl_redmask);
+    printf("fl_redshift      = %d\n", fl_redshift);
+    printf("fl_greenmask     = %08x\n", fl_greenmask);
+    printf("fl_greenshift    = %d\n", fl_greenshift);
+    printf("fl_bluemask      = %08x\n", fl_bluemask);
+    printf("fl_blueshift     = %d\n", fl_blueshift);
+    printf("red_mask         = %08x\n", image->red_mask);
+    printf("green_mask       = %08x\n", image->green_mask);
+    printf("blue_mask        = %08x\n", image->blue_mask);
+#endif // DEBUG
+  }
+
+  // Check if we have colormap image...
+  if (!image->red_mask) {
+    // Get the colormap entries for this window...
+    maxindex = fl_visual->visual->map_entries;
+
+    for (i = 0; i < maxindex; i ++) colors[i].pixel = i;
+
+    XQueryColors(fl_display, fl_colormap, colors, maxindex);
+
+    for (i = 0; i < maxindex; i ++) {
+      cvals[i][0] = colors[i].red >> 8;
+      cvals[i][1] = colors[i].green >> 8;
+      cvals[i][2] = colors[i].blue >> 8;
+    }
+
+    // Read the pixels and output an RGB image...
+    for (y = 0; y < image->height; y ++) {
+      pixel = (unsigned char *)(image->data + y * image->bytes_per_line);
+      line  = p + y * w * d;
+
+      switch (image->bits_per_pixel) {
+        case 1 :
+	  for (x = image->width, line_ptr = line, index_mask = 128;
+	       x > 0;
+	       x --, line_ptr += d) {
+	    if (*pixel & index_mask) {
+	      line_ptr[0] = cvals[1][0];
+	      line_ptr[1] = cvals[1][1];
+	      line_ptr[2] = cvals[1][2];
+            } else {
+	      line_ptr[0] = cvals[0][0];
+	      line_ptr[1] = cvals[0][1];
+	      line_ptr[2] = cvals[0][2];
+            }
+
+            if (index_mask > 1) {
+	      index_mask >>= 1;
+	    } else {
+              index_mask = 128;
+              pixel ++;
+            }
+	  }
+          break;
+
+        case 2 :
+	  for (x = image->width, line_ptr = line, index_shift = 6;
+	       x > 0;
+	       x --, line_ptr += d) {
+	    i = (*pixel >> index_shift) & 3;
+
+	    line_ptr[0] = cvals[i][0];
+	    line_ptr[1] = cvals[i][1];
+	    line_ptr[2] = cvals[i][2];
+
+            if (index_shift > 0) {
+              index_mask >>= 2;
+              index_shift -= 2;
+            } else {
+              index_mask  = 192;
+              index_shift = 6;
+              pixel ++;
+            }
+	  }
+          break;
+
+        case 4 :
+	  for (x = image->width, line_ptr = line, index_shift = 4;
+	       x > 0;
+	       x --, line_ptr += d) {
+	    if (index_shift == 4) i = (*pixel >> 4) & 15;
+	    else i = *pixel & 15;
+
+	    line_ptr[0] = cvals[i][0];
+	    line_ptr[1] = cvals[i][1];
+	    line_ptr[2] = cvals[i][2];
+
+            if (index_shift > 0) {
+              index_shift = 0;
+	    } else {
+              index_shift = 4;
+              pixel ++;
+            }
+	  }
+          break;
+
+        case 8 :
+	  for (x = image->width, line_ptr = line;
+	       x > 0;
+	       x --, line_ptr += d, pixel ++) {
+	    line_ptr[0] = cvals[*pixel][0];
+	    line_ptr[1] = cvals[*pixel][1];
+	    line_ptr[2] = cvals[*pixel][2];
+	  }
+          break;
+
+        case 12 :
+	  for (x = image->width, line_ptr = line, index_shift = 0;
+	       x > 0;
+	       x --, line_ptr += d) {
+	    if (index_shift == 0) {
+	      i = ((pixel[0] << 4) | (pixel[1] >> 4)) & 4095;
+	    } else {
+	      i = ((pixel[1] << 8) | pixel[2]) & 4095;
+	    }
+
+	    line_ptr[0] = cvals[i][0];
+	    line_ptr[1] = cvals[i][1];
+	    line_ptr[2] = cvals[i][2];
+
+            if (index_shift == 0) {
+              index_shift = 4;
+            } else {
+              index_shift = 0;
+              pixel += 3;
+            }
+	  }
+          break;
+      }
+    }
+  } else {
+    // RGB(A) image, so figure out the shifts & masks...
+    red_mask  = image->red_mask;
+    red_shift = 0;
+
+    while ((red_mask & 1) == 0) {
+      red_mask >>= 1;
+      red_shift ++;
+    }
+
+    green_mask  = image->green_mask;
+    green_shift = 0;
+
+    while ((green_mask & 1) == 0) {
+      green_mask >>= 1;
+      green_shift ++;
+    }
+
+    blue_mask  = image->blue_mask;
+    blue_shift = 0;
+
+    while ((blue_mask & 1) == 0) {
+      blue_mask >>= 1;
+      blue_shift ++;
+    }
+
+    // Read the pixels and output an RGB image...
+    for (y = 0; y < image->height; y ++) {
+      pixel = (unsigned char *)(image->data + y * image->bytes_per_line);
+      line  = p + y * w * d;
+
+      switch (image->bits_per_pixel) {
+        case 8 :
+	  for (x = image->width, line_ptr = line;
+	       x > 0;
+	       x --, line_ptr += d, pixel ++) {
+	    i = *pixel;
+
+	    line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	    line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	    line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	  }
+          break;
+
+        case 12 :
+	  for (x = image->width, line_ptr = line, index_shift = 0;
+	       x > 0;
+	       x --, line_ptr += d) {
+	    if (index_shift == 0) {
+	      i = ((pixel[0] << 4) | (pixel[1] >> 4)) & 4095;
+	    } else {
+	      i = ((pixel[1] << 8) | pixel[2]) & 4095;
+            }
+
+	    line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	    line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	    line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+
+            if (index_shift == 0) {
+              index_shift = 4;
+            } else {
+              index_shift = 0;
+              pixel += 3;
+            }
+	  }
+          break;
+
+        case 16 :
+          if (image->byte_order == LSBFirst) {
+            // Little-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 2) {
+	      i = (pixel[1] << 8) | pixel[0];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  } else {
+            // Big-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 2) {
+	      i = (pixel[0] << 8) | pixel[1];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  }
+          break;
+
+        case 24 :
+          if (image->byte_order == LSBFirst) {
+            // Little-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 3) {
+	      i = (((pixel[2] << 8) | pixel[1]) << 8) | pixel[0];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  } else {
+            // Big-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 3) {
+	      i = (((pixel[0] << 8) | pixel[1]) << 8) | pixel[2];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  }
+          break;
+
+        case 32 :
+          if (image->byte_order == LSBFirst) {
+            // Little-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 4) {
+	      i = (((((pixel[3] << 8) | pixel[2]) << 8) | pixel[1]) << 8) | pixel[0];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  } else {
+            // Big-endian...
+	    for (x = image->width, line_ptr = line;
+	         x > 0;
+	         x --, line_ptr += d, pixel += 4) {
+	      i = (((((pixel[0] << 8) | pixel[1]) << 8) | pixel[2]) << 8) | pixel[3];
+
+	      line_ptr[0] = 255 * ((i >> red_shift) & red_mask) / red_mask;
+	      line_ptr[1] = 255 * ((i >> green_shift) & green_mask) / green_mask;
+	      line_ptr[2] = 255 * ((i >> blue_shift) & blue_mask) / blue_mask;
+	    }
+	  }
+          break;
+      }
+    }
+  }
+
+  // Destroy the X image we've read and return the RGB(A) image...
+  XDestroyImage(image);
+
+  return p;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/rect.cxx (from rev 9002, branches/branch-3.0/src/core/fl_rect.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/rect.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/rect.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,727 @@
+//
+// "$Id$"
+//
+// Rectangle drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_rect.cxx
+  \brief Drawing and clipping routines for rectangles.
+*/
+
+// These routines from draw.h are used by the standard boxtypes
+// and thus are always linked into an fltk program.
+// Also all fl_clip routines, since they are always linked in so
+// that minimal update works.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/Printer.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+
+// fl_line_width_ must contain the absolute value of the current
+// line width to be used for X11 clipping (see below).
+// This is defined in src/fltk3::line_style.cxx
+extern int fl_line_width_;
+
+#ifdef __APPLE_QUARTZ__
+extern float fl_quartz_line_width_;
+#define USINGQUARTZPRINTER  (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id)
+#endif
+
+#ifdef USE_X11
+
+#ifndef SHRT_MAX
+#define SHRT_MAX (32767)
+#endif
+
+/*
+  We need to check some coordinates for areas for clipping before we
+  use X functions, because X can't handle coordinates outside the 16-bit
+  range. Since all windows use relative coordinates > 0, we do also
+  check for negative values. X11 only, see also STR #2304.
+  
+  Note that this is only necessary for large objects, where only a
+  part of the object is visible. The draw() functions (e.g. box
+  drawing) must be clipped correctly. This is usually only a matter
+  for large container widgets. The individual child widgets will be
+  clipped completely.
+
+  We define the usable X coordinate space as [ -LW : SHRT_MAX - LW ]
+  where LW = current line width for drawing. This is done so that
+  horizontal and vertical line drawing works correctly, even in real
+  border cases, e.g. drawing a rectangle slightly outside the top left
+  window corner, but with a line width so that a part of the line should
+  be visible (in this case 2 of 5 pixels):
+
+    fltk3::line_style (fltk3::SOLID,5);	// line width = 5
+    fltk3::rect (-1,-1,100,100);	// top/left: 2 pixels visible
+  
+  In this example case, no clipping would be done, because X can
+  handle it and clip unneeded pixels.
+  
+  Note that we must also take care of the case where fl_line_width_
+  is zero (maybe unitialized). If this is the case, we assume a line
+  width of 1.
+
+  Todo: Arbitrary line drawings (e.g. polygons) and clip regions
+  are not yet done.
+
+  Note:
+
+  We could use max. screen coordinates instead of SHRT_MAX, but that
+  would need more work and would probably be slower. We assume that
+  all window coordinates are >= 0 and that no window extends up to
+  32767 - LW (where LW = current line width). Thus it is safe to clip
+  all coordinates to this range before calling X functions. If this
+  is not true, then clip_to_short() and clip_x() must be redefined.
+
+  It would be somewhat easier if we had fl_clip_w and fl_clip_h, as
+  defined in FLTK 2.0 (for the upper clipping bounds)...
+*/
+
+/*
+  clip_to_short() returns 1, if the area is invisible (clipped),
+  because ...
+
+    (a) w or h are <= 0		i.e. nothing is visible
+    (b) x+w or y+h are < kmin	i.e. left of or above visible area
+    (c) x or y are > kmax	i.e. right of or below visible area
+
+  kmin and kmax are the minimal and maximal X coordinate values,
+  as defined above. In this case x, y, w, and h are not changed.
+
+  It returns 0, if the area is potentially visible and X can handle
+  clipping. x, y, w, and h may have been adjusted to fit into the
+  X coordinate space.
+
+  Use this for clipping rectangles, as used in fltk3::rect() and
+  fltk3::rectf().
+*/
+
+static int clip_to_short(int &x, int &y, int &w, int &h) {
+
+  int lw = (fl_line_width_ > 0) ? fl_line_width_ : 1;
+  int kmin = -lw;
+  int kmax = SHRT_MAX - lw;
+
+  if (w <= 0 || h <= 0) return 1;		// (a)
+  if (x+w < kmin || y+h < kmin) return 1;	// (b)
+  if (x > kmax || y > kmax) return 1;		// (c)
+
+  if (x < kmin) { w -= (kmin-x); x = kmin; }
+  if (y < kmin) { h -= (kmin-y); y = kmin; }
+  if (x+w > kmax) w = kmax - x;
+  if (y+h > kmax) h = kmax - y;
+
+  return 0;
+}
+
+/*
+  clip_x() returns a coordinate value clipped to the 16-bit coordinate
+  space (see above). This can be used to draw horizontal and vertical
+  lines that can be handled by X11. Each single coordinate value can
+  be clipped individually, and the result can be used directly, e.g.
+  in fltk3::xyline() and fltk3::yxline(). Note that this can't be used for
+  arbitrary lines (not horizontal or vertical).
+*/
+static int clip_x (int x) {
+
+  int lw = (fl_line_width_ > 0) ? fl_line_width_ : 1;
+  int kmin = -lw;
+  int kmax = SHRT_MAX - lw;
+
+  if (x < kmin)
+    x = kmin;
+  else if (x > kmax)
+    x = kmax;
+  return x;
+}
+
+#endif	// USE_X11
+
+
+void fltk3::GraphicsDriver::rect(int x, int y, int w, int h) {
+
+  if (w<=0 || h<=0) return;
+#if defined(USE_X11)
+  if (!clip_to_short(x, y, w, h))
+    XDrawRectangle(fl_display, fl_window, fl_gc, x, y, w-1, h-1);
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x+w-1, y);
+  LineTo(fl_gc, x+w-1, y+h-1);
+  LineTo(fl_gc, x, y+h-1);
+  LineTo(fl_gc, x, y);
+#elif defined(__APPLE_QUARTZ__)
+  if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGRect rect = CGRectMake(x, y, w-1, h-1);
+  CGContextStrokeRect(fl_gc, rect);
+  if ( (!USINGQUARTZPRINTER) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::rectf(int x, int y, int w, int h) {
+  if (w<=0 || h<=0) return;
+#if defined(USE_X11)
+  if (!clip_to_short(x, y, w, h))
+    XFillRectangle(fl_display, fl_window, fl_gc, x, y, w, h);
+#elif defined(WIN32)
+  RECT rect;
+  rect.left = x; rect.top = y;  
+  rect.right = x + w; rect.bottom = y + h;
+  FillRect(fl_gc, &rect, fl_brush());
+#elif defined(__APPLE_QUARTZ__)
+  CGFloat delta_size =  0.9;
+  CGFloat delta_ori = 0;
+  if (USINGQUARTZPRINTER) {
+    delta_size = 0;
+    delta_ori = 0.5;
+    }
+  CGRect  rect = CGRectMake(x - delta_ori, y - delta_ori, w - delta_size , h - delta_size);
+  CGContextFillRect(fl_gc, rect);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::xyline(int x, int y, int x1) {
+#if defined(USE_X11)
+  XDrawLine(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y), clip_x(x1), clip_x(y));
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x1+1, y);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::xyline(int x, int y, int x1, int y2) {
+#if defined (USE_X11)
+  XPoint p[3];
+  p[0].x = clip_x(x);  p[0].y = p[1].y = clip_x(y);
+  p[1].x = p[2].x = clip_x(x1); p[2].y = clip_x(y2);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0);
+#elif defined(WIN32)
+  if (y2 < y) y2--;
+  else y2++;
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y);
+  LineTo(fl_gc, x1, y2);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y);
+  CGContextAddLineToPoint(fl_gc, x1, y2);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+#error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::xyline(int x, int y, int x1, int y2, int x3) {
+#if defined(USE_X11)
+  XPoint p[4];
+  p[0].x = clip_x(x);  p[0].y = p[1].y = clip_x(y);
+  p[1].x = p[2].x = clip_x(x1); p[2].y = p[3].y = clip_x(y2);
+  p[3].x = clip_x(x3);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0);
+#elif defined(WIN32)
+  if(x3 < x1) x3--;
+  else x3++;
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y);
+  LineTo(fl_gc, x1, y2);
+  LineTo(fl_gc, x3, y2);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y);
+  CGContextAddLineToPoint(fl_gc, x1, y2);
+  CGContextAddLineToPoint(fl_gc, x3, y2);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::yxline(int x, int y, int y1) {
+#if defined(USE_X11)
+  XDrawLine(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y), clip_x(x), clip_x(y1));
+#elif defined(WIN32)
+  if (y1 < y) y1--;
+  else y1++;
+  MoveToEx(fl_gc, x, y, 0L); LineTo(fl_gc, x, y1);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x, y1);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::yxline(int x, int y, int y1, int x2) {
+#if defined(USE_X11)
+  XPoint p[3];
+  p[0].x = p[1].x = clip_x(x);  p[0].y = clip_x(y);
+  p[1].y = p[2].y = clip_x(y1); p[2].x = clip_x(x2);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0);
+#elif defined(WIN32)
+  if (x2 > x) x2++;
+  else x2--;
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x, y1);
+  LineTo(fl_gc, x2, y1);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y1);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::yxline(int x, int y, int y1, int x2, int y3) {
+#if defined(USE_X11)
+  XPoint p[4];
+  p[0].x = p[1].x = clip_x(x);  p[0].y = clip_x(y);
+  p[1].y = p[2].y = clip_x(y1); p[2].x = p[3].x = clip_x(x2);
+  p[3].y = clip_x(y3);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0);
+#elif defined(WIN32)
+  if(y3<y1) y3--;
+  else y3++;
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x, y1);
+  LineTo(fl_gc, x2, y1);
+  LineTo(fl_gc, x2, y3);
+#elif defined(__APPLE_QUARTZ__)
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y3);
+  CGContextStrokePath(fl_gc);
+  if (USINGQUARTZPRINTER || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::line(int x, int y, int x1, int y1) {
+#if defined(USE_X11)
+  XDrawLine(fl_display, fl_window, fl_gc, x, y, x1, y1);
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y1);
+  // Draw the last point *again* because the GDI line drawing
+  // functions will not draw the last point ("it's a feature!"...)
+  SetPixel(fl_gc, x1, y1, fl_RGB());
+#elif defined(__APPLE_QUARTZ__)
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextStrokePath(fl_gc);
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::line(int x, int y, int x1, int y1, int x2, int y2) {
+#if defined(USE_X11)
+  XPoint p[3];
+  p[0].x = x;  p[0].y = y;
+  p[1].x = x1; p[1].y = y1;
+  p[2].x = x2; p[2].y = y2;
+  XDrawLines(fl_display, fl_window, fl_gc, p, 3, 0);
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y1);
+  LineTo(fl_gc, x2, y2);
+  // Draw the last point *again* because the GDI line drawing
+  // functions will not draw the last point ("it's a feature!"...)
+  SetPixel(fl_gc, x2, y2, fl_RGB());
+#elif defined(__APPLE_QUARTZ__)
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y2);
+  CGContextStrokePath(fl_gc);
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::loop(int x, int y, int x1, int y1, int x2, int y2) {
+#if defined(USE_X11)
+  XPoint p[4];
+  p[0].x = x;  p[0].y = y;
+  p[1].x = x1; p[1].y = y1;
+  p[2].x = x2; p[2].y = y2;
+  p[3].x = x;  p[3].y = y;
+  XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0);
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y1);
+  LineTo(fl_gc, x2, y2);
+  LineTo(fl_gc, x, y);
+#elif defined(__APPLE_QUARTZ__)
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y2);
+  CGContextClosePath(fl_gc);
+  CGContextStrokePath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
+#if defined(USE_X11)
+  XPoint p[5];
+  p[0].x = x;  p[0].y = y;
+  p[1].x = x1; p[1].y = y1;
+  p[2].x = x2; p[2].y = y2;
+  p[3].x = x3; p[3].y = y3;
+  p[4].x = x;  p[4].y = y;
+  XDrawLines(fl_display, fl_window, fl_gc, p, 5, 0);
+#elif defined(WIN32)
+  MoveToEx(fl_gc, x, y, 0L); 
+  LineTo(fl_gc, x1, y1);
+  LineTo(fl_gc, x2, y2);
+  LineTo(fl_gc, x3, y3);
+  LineTo(fl_gc, x, y);
+#elif defined(__APPLE_QUARTZ__)
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y2);
+  CGContextAddLineToPoint(fl_gc, x3, y3);
+  CGContextClosePath(fl_gc);
+  CGContextStrokePath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::polygon(int x, int y, int x1, int y1, int x2, int y2) {
+  XPoint p[4];
+  p[0].x = x;  p[0].y = y;
+  p[1].x = x1; p[1].y = y1;
+  p[2].x = x2; p[2].y = y2;
+#if defined (USE_X11)
+  p[3].x = x;  p[3].y = y;
+  XFillPolygon(fl_display, fl_window, fl_gc, p, 3, Convex, 0);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 4, 0);
+#elif defined(WIN32)
+  SelectObject(fl_gc, fl_brush());
+  Polygon(fl_gc, p, 3);
+#elif defined(__APPLE_QUARTZ__)
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y2);
+  CGContextClosePath(fl_gc);
+  CGContextFillPath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
+  XPoint p[5];
+  p[0].x = x;  p[0].y = y;
+  p[1].x = x1; p[1].y = y1;
+  p[2].x = x2; p[2].y = y2;
+  p[3].x = x3; p[3].y = y3;
+#if defined(USE_X11)
+  p[4].x = x;  p[4].y = y;
+  XFillPolygon(fl_display, fl_window, fl_gc, p, 4, Convex, 0);
+  XDrawLines(fl_display, fl_window, fl_gc, p, 5, 0);
+#elif defined(WIN32)
+  SelectObject(fl_gc, fl_brush());
+  Polygon(fl_gc, p, 4);
+#elif defined(__APPLE_QUARTZ__)
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, x, y);
+  CGContextAddLineToPoint(fl_gc, x1, y1);
+  CGContextAddLineToPoint(fl_gc, x2, y2);
+  CGContextAddLineToPoint(fl_gc, x3, y3);
+  CGContextClosePath(fl_gc);
+  CGContextFillPath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::point(int x, int y) {
+#if defined(USE_X11)
+  XDrawPoint(fl_display, fl_window, fl_gc, clip_x(x), clip_x(y));
+#elif defined(WIN32)
+  SetPixel(fl_gc, x, y, fl_RGB());
+#elif defined(__APPLE_QUARTZ__)
+  CGContextFillRect(fl_gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) );
+#else
+# error unsupported platform
+#endif
+}
+
+////////////////////////////////////////////////////////////////
+
+#if !defined(WIN32) && !defined(__APPLE__)
+// Missing X call: (is this the fastest way to init a 1-rectangle region?)
+// MSWindows equivalent exists, implemented inline in win32.h
+fltk3::Region XRectangleRegion(int x, int y, int w, int h) {
+  XRectangle R;
+  clip_to_short(x, y, w, h);
+  R.x = x; R.y = y; R.width = w; R.height = h;
+  fltk3::Region r = XCreateRegion();
+  XUnionRectWithRegion(&R, r, r);
+  return r;
+}
+#endif
+
+void fltk3::GraphicsDriver::restore_clip() {
+  fl_clip_state_number++;
+  fltk3::Region r = rstack[rstackptr];
+#if defined(USE_X11)
+  if (r) XSetRegion(fl_display, fl_gc, r);
+  else XSetClipMask(fl_display, fl_gc, 0);
+#elif defined(WIN32)
+  SelectClipRgn(fl_gc, r); //if r is NULL, clip is automatically cleared
+#elif defined(__APPLE_QUARTZ__)
+  if ( fl_window ) { // clipping for a true window
+    Fl_X::q_clear_clipping();
+    Fl_X::q_fill_context();//flip coords if bitmap context
+    //apply program clip
+    if (r) {
+      CGContextClipToRects(fl_gc, r->rects, r->count);
+    }
+  } else if (fl_gc) { // clipping for an offscreen drawing world (CGBitmap)
+    Fl_X::q_clear_clipping();
+    Fl_X::q_fill_context();
+    if (r) {
+      CGContextClipToRects(fl_gc, r->rects, r->count);
+    }
+  }
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::clip_region(fltk3::Region r) {
+  fltk3::Region oldr = rstack[rstackptr];
+  if (oldr) XDestroyRegion(oldr);
+  rstack[rstackptr] = r;
+  fltk3::restore_clip();
+}
+
+fltk3::Region fltk3::GraphicsDriver::clip_region() {
+  return rstack[rstackptr];
+}
+
+void fltk3::GraphicsDriver::push_clip(int x, int y, int w, int h) {
+  fltk3::Region r;
+  if (w > 0 && h > 0) {
+    r = XRectangleRegion(x,y,w,h);
+    fltk3::Region current = rstack[rstackptr];
+    if (current) {
+#if defined(USE_X11)
+      fltk3::Region temp = XCreateRegion();
+      XIntersectRegion(current, r, temp);
+      XDestroyRegion(r);
+      r = temp;
+#elif defined(WIN32)
+      CombineRgn(r,r,current,RGN_AND);
+#elif defined(__APPLE_QUARTZ__)
+      XDestroyRegion(r);
+      r = Fl_X::intersect_region_and_rect(current, x,y,w,h);
+#else
+# error unsupported platform
+#endif
+    }
+  } else { // make empty clip region:
+#if defined(USE_X11)
+    r = XCreateRegion();
+#elif defined(WIN32)
+    r = CreateRectRgn(0,0,0,0);
+#elif defined(__APPLE_QUARTZ__)
+    r = XRectangleRegion(0,0,0,0);
+#else
+# error unsupported platform
+#endif
+  }
+  if (rstackptr < region_stack_max) rstack[++rstackptr] = r;
+  else fltk3::warning("fltk3::push_clip: clip stack overflow!\n");
+  fltk3::restore_clip();
+}
+
+// make there be no clip (used by fl_begin_offscreen() only!)
+void fltk3::GraphicsDriver::push_no_clip() {
+  if (rstackptr < region_stack_max) rstack[++rstackptr] = 0;
+  else fltk3::warning("fltk3::push_no_clip: clip stack overflow!\n");
+  fltk3::restore_clip();
+}
+
+// pop back to previous clip:
+void fltk3::GraphicsDriver::pop_clip() {
+  if (rstackptr > 0) {
+    fltk3::Region oldr = rstack[rstackptr--];
+    if (oldr) XDestroyRegion(oldr);
+  } else fltk3::warning("fltk3::pop_clip: clip stack underflow!\n");
+  fltk3::restore_clip();
+}
+
+int fltk3::GraphicsDriver::not_clipped(int x, int y, int w, int h) {
+  if (x+w <= 0 || y+h <= 0) return 0;
+  fltk3::Region r = rstack[rstackptr];
+  if (!r) return 1;
+#if defined (USE_X11)
+  // get rid of coordinates outside the 16-bit range the X calls take.
+  if (clip_to_short(x,y,w,h)) return 0;	// clipped
+  return XRectInRegion(r, x, y, w, h);
+#elif defined(WIN32)
+  RECT rect;
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) { // in case of print context, convert coords from logical to device
+    POINT pt[2] = { {x, y}, {x + w, y + h} };
+    LPtoDP(fl_gc, pt, 2);
+    rect.left = pt[0].x; rect.top = pt[0].y; rect.right = pt[1].x; rect.bottom = pt[1].y;
+  } else {
+    rect.left = x; rect.top = y; rect.right = x+w; rect.bottom = y+h;
+  }
+  return RectInRegion(r,&rect);
+#elif defined(__APPLE_QUARTZ__)
+  CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
+  for (int i = 0; i < r->count; i++) {
+    CGRect test = CGRectIntersection(r->rects[i], arg);
+    if (!CGRectIsEmpty(test)) return 1;
+  }
+  return 0;
+#else
+# error unsupported platform
+#endif
+}
+
+// return rectangle surrounding intersection of this rectangle and clip:
+int fltk3::GraphicsDriver::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H){
+  X = x; Y = y; W = w; H = h;
+  fltk3::Region r = rstack[rstackptr];
+  if (!r) return 0;
+#if defined(USE_X11)
+  switch (XRectInRegion(r, x, y, w, h)) {
+  case 0: // completely outside
+    W = H = 0;
+    return 2;
+  case 1: // completely inside:
+    return 0;
+  default: // partial:
+    break;
+  }
+  fltk3::Region rr = XRectangleRegion(x,y,w,h);
+  fltk3::Region temp = XCreateRegion();
+  XIntersectRegion(r, rr, temp);
+  XRectangle rect;
+  XClipBox(temp, &rect);
+  X = rect.x; Y = rect.y; W = rect.width; H = rect.height;
+  XDestroyRegion(temp);
+  XDestroyRegion(rr);
+  return 1;
+#elif defined(WIN32)
+// The win32 API makes no distinction between partial and complete
+// intersection, so we have to check for partial intersection ourselves.
+// However, given that the regions may be composite, we have to do
+// some voodoo stuff...
+  fltk3::Region rr = XRectangleRegion(x,y,w,h);
+  fltk3::Region temp = CreateRectRgn(0,0,0,0);
+  int ret;
+  if (CombineRgn(temp, rr, r, RGN_AND) == NULLREGION) { // disjoint
+    W = H = 0;
+    ret = 2;
+  } else if (EqualRgn(temp, rr)) { // complete
+    ret = 0;
+  } else {	// partial intersection
+    RECT rect;
+    GetRgnBox(temp, &rect);
+    if(fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) { // if print context, convert coords from device to logical
+      POINT pt[2] = { {rect.left, rect.top}, {rect.right, rect.bottom} };
+      DPtoLP(fl_gc, pt, 2);
+      X = pt[0].x; Y = pt[0].y; W = pt[1].x - X; H = pt[1].y - Y;
+    }
+    else {
+      X = rect.left; Y = rect.top; W = rect.right - X; H = rect.bottom - Y;
+      }
+    ret = 1;
+  }
+  DeleteObject(temp);
+  DeleteObject(rr);
+  return ret;
+#elif defined(__APPLE_QUARTZ__)
+  CGRect arg = fl_cgrectmake_cocoa(x, y, w, h);
+  CGRect u = CGRectMake(0,0,0,0);
+  CGRect test;
+  for(int i = 0; i < r->count; i++) {
+    test = CGRectIntersection(r->rects[i], arg);
+    if( ! CGRectIsEmpty(test) ) {
+      if(CGRectIsEmpty(u)) u = test;
+      else u = CGRectUnion(u, test);
+    }
+  }
+  X = int(u.origin.x);
+  Y = int(u.origin.y);
+  W = int(u.size.width + 1);
+  H = int(u.size.height + 1);
+  if(CGRectIsEmpty(u)) W = H = 0;
+  return ! CGRectEqualToRect(arg, u);
+#else
+# error unsupported platform
+#endif
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/round_box.cxx (from rev 9002, branches/branch-3.0/src/core/fl_round_box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/round_box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/round_box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,120 @@
+//
+// "$Id$"
+//
+// Round box drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Box drawing code for an obscure box type.
+// These box types are in separate files so they are not linked
+// in if not used.
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+namespace fltk3 {
+  extern uchar* gray_ramp();
+}
+
+
+// A compiler from a certain very large software company will not compile
+// the function pointer assignment due to the name conflict with fltk3::arc.
+// This function is to fix that:
+static void arc_i(int x,int y,int w,int h,double a1,double a2) {
+  fltk3::arc(x,y,w,h,a1,a2);
+}
+
+enum {UPPER_LEFT, LOWER_RIGHT, CLOSED, FILL};
+
+static void draw(int which, int x,int y,int w,int h, int inset, fltk3::Color color)
+{
+  if (inset*2 >= w) inset = (w-1)/2;
+  if (inset*2 >= h) inset = (h-1)/2;
+  x += inset;
+  y += inset;
+  w -= 2*inset;
+  h -= 2*inset;
+  int d = w <= h ? w : h;
+  if (d <= 1) return;
+  fltk3::color(color);
+  fltk3::line_style(0,1);
+  void (*f)(int,int,int,int,double,double);
+  f = (which==FILL) ? fltk3::pie : arc_i;
+  if (which >= CLOSED) {
+    f(x+w-d, y, d, d, w<=h ? 0 : -90, w<=h ? 180 : 90);
+    f(x, y+h-d, d, d, w<=h ? 180 : 90, w<=h ? 360 : 270);
+  } else if (which == UPPER_LEFT) {
+    f(x+w-d, y, d, d, 45, w<=h ? 180 : 90);
+    f(x, y+h-d, d, d, w<=h ? 180 : 90, 225);
+  } else { // LOWER_RIGHT
+    f(x, y+h-d, d, d, 225, w<=h ? 360 : 270);
+    f(x+w-d, y, d, d, w<=h ? 360 : 270, 360+45);
+  }
+  if (which == FILL) {
+    if (w < h)
+      fltk3::rectf(x, y+d/2, w, h-(d&-2));
+    else if (w > h)
+      fltk3::rectf(x+d/2, y, w-(d&-2), h);
+  } else {
+    if (w < h) {
+      if (which != UPPER_LEFT) fltk3::yxline(x+w-1, y+d/2-1, y+h-d/2+1);
+      if (which != LOWER_RIGHT) fltk3::yxline(x, y+d/2-1, y+h-d/2+1);
+    } else if (w > h) {
+      if (which != UPPER_LEFT) fltk3::xyline(x+d/2-1, y+h-1, x+w-d/2+1);
+      if (which != LOWER_RIGHT) fltk3::xyline(x+d/2-1, y, x+w-d/2+1);
+    }
+  }
+  fltk3::line_style(0);
+}
+
+void fl_classic_round_down_box(int x, int y, int w, int h, fltk3::Color bgcolor, fltk3::Boxtype) {
+  uchar *g = fltk3::gray_ramp();
+  draw(FILL,	    x,   y, w,   h, 2, bgcolor);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 0, (fltk3::Color)g['N']);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 1, (fltk3::Color)g['H']);
+  draw(UPPER_LEFT,  x,   y, w,   h, 0, (fltk3::Color)g['N']);
+  draw(UPPER_LEFT,  x,   y, w,   h, 1, (fltk3::Color)g['H']);
+  draw(LOWER_RIGHT, x,   y, w,   h, 0, (fltk3::Color)g['S']);
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 0, (fltk3::Color)g['U']);
+  draw(LOWER_RIGHT, x,   y, w,   h, 1, (fltk3::Color)g['U']);
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 1, (fltk3::Color)g['W']);
+  draw(CLOSED,	    x,   y, w,   h, 2, (fltk3::Color)g['A']);
+}
+
+void fl_classic_round_up_box(int x, int y, int w, int h, fltk3::Color bgcolor, fltk3::Boxtype) {
+  uchar *g = fltk3::gray_ramp();
+  draw(FILL,	    x,   y, w,   h, 2, bgcolor);
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 0, (fltk3::Color)g['H']);
+  draw(LOWER_RIGHT, x+1, y, w-2, h, 1, (fltk3::Color)g['N']);
+  draw(LOWER_RIGHT, x,   y, w,   h, 1, (fltk3::Color)g['H']);
+  draw(LOWER_RIGHT, x,   y, w,   h, 2, (fltk3::Color)g['N']);
+  draw(UPPER_LEFT,  x,   y, w,   h, 2, (fltk3::Color)g['U']);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 1, (fltk3::Color)g['S']);
+  draw(UPPER_LEFT,  x,   y, w,   h, 1, (fltk3::Color)g['W']);
+  draw(UPPER_LEFT,  x+1, y, w-2, h, 0, (fltk3::Color)g['U']);
+  draw(CLOSED,	    x,   y, w,   h, 0, (fltk3::Color)g['A']);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/rounded_box.cxx (from rev 9002, branches/branch-3.0/src/core/fl_rounded_box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/rounded_box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/rounded_box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,81 @@
+//
+// "$Id$"
+//
+// Rounded box drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+#define RN	5
+#define RS	15
+#define BW	3
+
+static double offset[RN] = { 0.0, 0.07612, 0.29289, 0.61732, 1.0};
+
+static void rbox(int fill, int x, int y, int w, int h) {
+  int i;
+  int rsx ,rsy, rs;
+  rsx = w*2/5; rsy = h*2/5;
+  if (rsx > rsy) rs = rsy; else  rs = rsx;
+  if (rs > RS) rs = RS;
+  rsx = rs; rsy = rs;
+
+  if (fill) fltk3::begin_polygon(); else fltk3::begin_loop();
+  for (i=0; i<RN; i++)
+    fltk3::vertex(x + offset[RN-i-1]*rsx, y + offset[i] * rsy);
+  for (i=0; i<RN; i++)
+    fltk3::vertex(x + offset[i]*rsx, y + h-1 - offset[RN-i-1] * rsy);
+  for (i=0; i<RN; i++)
+    fltk3::vertex(x + w-1 - offset[RN-i-1]*rsx, y + h-1 - offset[i] * rsy);
+  for (i=0; i<RN; i++)
+    fltk3::vertex(x + w-1 - offset[i]*rsx, y + offset[RN-i-1] * rsy);
+  if (fill) fltk3::end_polygon(); else fltk3::end_loop();
+}
+
+void fl_rflat_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c); rbox(1, x, y, w, h); rbox(0, x, y, w, h);
+}
+
+void fl_rounded_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c); rbox(0, x, y, w, h);
+}
+
+void fl_rounded_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(c); rbox(1, x, y, w, h);
+  fltk3::color(fltk3::BLACK); rbox(0, x, y, w, h);
+}
+
+void fl_rshadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  // draw shadow:
+  fltk3::color(fltk3::DARK3);
+  rbox(1, x+BW, y+BW, w, h);
+  rbox(0, x+BW, y+BW, w, h);
+  // draw the box:
+  fl_rounded_box(x, y, w, h, c, t);
+}
+
+//
+// End of "$Id$".
+//

Modified: branches/branch-3.0/src/fltk3/run.cxx
===================================================================
--- branches/branch-3.0/src/fltk3/run.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/src/fltk3/run.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -63,7 +63,7 @@
 #include <ctype.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "../core/flstring.h"
+#include "flstring.h"
 
 #if defined(DEBUG) || defined(DEBUG_WATCH)
 #  include <stdio.h>

Copied: branches/branch-3.0/src/fltk3/scandir.cxx (from rev 9002, branches/branch-3.0/src/core/scandir.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/scandir.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/scandir.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,124 @@
+/* Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA.  */
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+#  include "scandir_win32.cxx"
+#else
+
+#  include "flstring.h"
+
+#  if !HAVE_SCANDIR
+#    include <stdlib.h>
+#    include <sys/types.h>
+#    include <errno.h>
+
+#    if HAVE_DIRENT_H
+#      include <dirent.h>
+#      define NAMLEN(dirent) strlen((dirent)->d_name)
+#    else
+#      define dirent direct
+#      define NAMLEN(dirent) (dirent)->d_namlen
+#      if HAVE_SYS_NDIR_H
+#        include <sys/ndir.h>
+#      endif
+#      if HAVE_SYS_DIR_H
+#        include <sys/dir.h>
+#      endif
+#      if HAVE_NDIR_H
+#        include <ndir.h>
+#      endif
+#    endif
+
+int
+fl_scandir(const char *dir, struct dirent ***namelist,
+	   int (*select)(struct dirent *),
+	   int (*compar)(struct dirent **, struct dirent **))
+{
+  DIR *dp = opendir (dir);
+  struct dirent **v = NULL;
+  size_t vsize = 0, i;
+  struct dirent *d;
+  int save;
+
+  if (dp == NULL)
+    return -1;
+
+  save = errno;
+  errno = 0;
+
+  i = 0;
+  while ((d = readdir (dp)) != NULL)
+    if (select == NULL || (*select) (d))
+      {
+      size_t dsize;
+
+      if (i == vsize)
+        {
+          struct dirent **newv;
+          if (vsize == 0)
+            vsize = 10;
+          else
+            vsize *= 2;
+          newv = (struct dirent **) realloc (v, vsize * sizeof (*v));
+          if (newv == NULL)
+            {
+            lose:
+              errno = ENOMEM;
+              break;
+            }
+          v = newv;
+        }
+
+#    define _D_EXACT_NAMLEN(d) (strlen ((d)->d_name))
+#    define _D_ALLOC_NAMLEN(d) (sizeof (d)->d_name > 1 ? sizeof (d)->d_name : \
+                              _D_EXACT_NAMLEN (d) + 1)
+
+      dsize = &d->d_name[_D_ALLOC_NAMLEN (d)] - (char *) d;
+      v[i] = (struct dirent *) malloc (dsize);
+      if (v[i] == NULL)
+        goto lose;
+
+      memcpy (v[i++], d, dsize);
+      }
+
+  if (errno != 0)
+    {
+      save = errno;
+      (void) closedir (dp);
+      while (i > 0)
+      free (v[--i]);
+      free (v);
+      errno = save;
+      return -1;
+    }
+
+  (void) closedir (dp);
+  errno = save;
+
+  /* Sort the list if we have a comparison function to sort with.  */
+  if (compar) qsort (v, i, sizeof (*v), (int (*)(const void *, const void *))compar);
+  *namelist = v;
+  return i;
+}
+
+#  endif
+#endif
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/screen_xywh.cxx (from rev 9002, branches/branch-3.0/src/core/screen_xywh.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/screen_xywh.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/screen_xywh.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,342 @@
+//
+// "$Id$"
+//
+// Screen/monitor bounding box API for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 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 <fltk3/run.h>
+#include <fltk3/x.h>
+#include <config.h>
+
+
+// Number of screens returned by multi monitor aware API; -1 before init
+static int num_screens = -1;
+
+#ifdef WIN32
+#  if !defined(HMONITOR_DECLARED) && (_WIN32_WINNT < 0x0500)
+#    define COMPILE_MULTIMON_STUBS
+#    include <multimon.h>
+#  endif // !HMONITOR_DECLARED && _WIN32_WINNT < 0x0500
+
+// We go the much more difficult route of individually picking some multi-screen
+// functions from the USER32.DLL . If these functions are not available, we
+// will gracefully fall back to single monitor support.
+//
+// If we were to insist on the existence of "EnumDisplayMonitors" and 
+// "GetMonitorInfoA", it would be impossible to use FLTK on Windows 2000
+// before SP2 or earlier.
+
+// BOOL EnumDisplayMonitors(HDC, LPCRECT, MONITORENUMPROC, LPARAM)
+typedef BOOL (WINAPI* fl_edm_func)(HDC, LPCRECT, MONITORENUMPROC, LPARAM);
+// BOOL GetMonitorInfo(HMONITOR, LPMONITORINFO)
+typedef BOOL (WINAPI* fl_gmi_func)(HMONITOR, LPMONITORINFO);
+
+static fl_gmi_func fl_gmi = NULL; // used to get a proc pointer for GetMonitorInfoA
+
+static RECT screens[16];
+static float dpi[16][2];
+
+static BOOL CALLBACK screen_cb(HMONITOR mon, HDC, LPRECT r, LPARAM) {
+  if (num_screens >= 16) return TRUE;
+
+  MONITORINFOEX mi;
+  mi.cbSize = sizeof(mi);
+
+//  GetMonitorInfo(mon, &mi);
+//  (but we use our self-aquired function pointer instead)
+  if (fl_gmi(mon, &mi)) {
+    screens[num_screens] = mi.rcMonitor;
+// If we also want to record the work area, we would also store mi.rcWork at this point
+//  work_area[num_screens] = mi.rcWork;
+
+    // find the pixel size
+    if (mi.cbSize == sizeof(mi)) {
+      HDC screen = CreateDC(mi.szDevice, NULL, NULL, NULL);
+      if (screen) {
+        dpi[num_screens][0] = (float)GetDeviceCaps(screen, LOGPIXELSX);
+        dpi[num_screens][1] = (float)GetDeviceCaps(screen, LOGPIXELSY);
+      }
+      ReleaseDC(0L, screen);
+    }
+    
+    num_screens ++;
+  }
+  return TRUE;
+}
+
+static void screen_init() {
+  // Since not all versions of Windows include multiple monitor support,
+  // we do a run-time check for the required functions...
+  HMODULE hMod = GetModuleHandle("USER32.DLL");
+
+  if (hMod) {
+    // check that EnumDisplayMonitors is available
+    fl_edm_func fl_edm = (fl_edm_func)GetProcAddress(hMod, "EnumDisplayMonitors");
+
+    if (fl_edm) {
+      // we have EnumDisplayMonitors - do we also have GetMonitorInfoA ?
+      fl_gmi = (fl_gmi_func)GetProcAddress(hMod, "GetMonitorInfoA");
+      if (fl_gmi) {
+        // We have GetMonitorInfoA, enumerate all the screens...
+//      EnumDisplayMonitors(0,0,screen_cb,0);
+//      (but we use our self-aquired function pointer instead)
+//      NOTE: num_screens is incremented in screen_cb so we must first reset it here...
+        num_screens = 0;
+        fl_edm(0, 0, screen_cb, 0);
+        return;
+      }
+    }
+  }
+
+  // If we get here, assume we have 1 monitor...
+  num_screens = 1;
+  screens[0].top      = 0;
+  screens[0].left      = 0;
+  screens[0].right  = GetSystemMetrics(SM_CXSCREEN);
+  screens[0].bottom = GetSystemMetrics(SM_CYSCREEN);
+}
+#elif defined(__APPLE__)
+static XRectangle screens[16];
+static float dpi_h[16];
+static float dpi_v[16];
+
+static void screen_init() {
+  CGDirectDisplayID displays[16];
+  CGDisplayCount count, i;
+  CGRect r;
+  CGGetActiveDisplayList(16, displays, &count);
+  for( i = 0; i < count; i++) {
+    r = CGDisplayBounds(displays[i]);
+    screens[i].x      = int(r.origin.x);
+    screens[i].y      = int(r.origin.y);
+    screens[i].width  = int(r.size.width);
+    screens[i].height = int(r.size.height);
+    CGSize s = CGDisplayScreenSize(displays[i]);
+    dpi_h[i] = screens[i].width / (s.width/25.4);
+    dpi_v[i] = screens[i].height / (s.height/25.4);
+  }
+  num_screens = count;
+}
+#elif HAVE_XINERAMA
+#  include <X11/extensions/Xinerama.h>
+
+// Screen data...
+static XineramaScreenInfo *screens;
+static float dpi[16][2];
+
+static void screen_init() {
+  if (!fl_display) fl_open_display();
+
+  if (XineramaIsActive(fl_display)) {
+    screens = XineramaQueryScreens(fl_display, &num_screens);
+    int i;
+    // Xlib and Xinerama may disagree on the screen count. Sigh...
+    // Use the minimum of the reported counts.
+    // Use the previous screen's info for non-existent ones.
+    int sc = ScreenCount(fl_display); // Xlib screen count
+    for (i=0; i<num_screens; i++) {
+      int mm = (i < sc) ? DisplayWidthMM(fl_display, i) : 0;
+      dpi[i][0] = mm ? screens[i].width*25.4f/mm : (i > 0) ? dpi[i-1][0] : 0.0f;
+      mm = (i < sc) ? DisplayHeightMM(fl_display, i) : 0;
+      dpi[i][1] = mm ? screens[i].height*25.4f/mm : (i > 0) ? dpi[i-1][1] : 0.0f;
+    }
+  } else { // ! XineramaIsActive()
+    num_screens = 1;
+    int mm = DisplayWidthMM(fl_display, fl_screen);
+    dpi[0][0] = mm ? fltk3::w()*25.4f/mm : 0.0f;
+    mm = DisplayHeightMM(fl_display, fl_screen);
+    dpi[0][1] = mm ? fltk3::h()*25.4f/mm : dpi[0][0];
+  }
+}
+#else
+static float dpi[2];
+static void screen_init() {
+  num_screens = 1;
+  if (!fl_display) fl_open_display();
+  int mm = DisplayWidthMM(fl_display, fl_screen);
+  dpi[0] = mm ? fltk3::w()*25.4f/mm : 0.0f;
+  mm = DisplayHeightMM(fl_display, fl_screen);
+  dpi[1] = mm ? fltk3::h()*25.4f/mm : dpi[0];  
+}
+#endif // WIN32
+
+
+/**
+  Gets the number of available screens.
+*/
+int fltk3::screen_count() {
+  if (num_screens < 0) screen_init();
+  
+  return num_screens ? num_screens : 1;
+}
+
+/**
+ Gets the bounding box of a screen 
+ that contains the specified screen position \p mx, \p my
+ \param[out]  X,Y,W,H the corresponding screen bounding box
+ \param[in] mx, my the absolute screen position
+ */
+void fltk3::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my) {
+  int screen = 0;
+  int i;
+  
+  if (num_screens < 0) screen_init();
+  
+  for (i = 0; i < num_screens; i ++) {
+    int sx, sy, sw, sh;
+    fltk3::screen_xywh(sx, sy, sw, sh, i);
+    if ((mx >= sx) && (mx < (sx+sw)) && (my >= sy) && (my < (sy+sh))) {
+      screen = i;
+      break;
+    }
+  }
+  
+  screen_xywh(X, Y, W, H, screen);
+}
+
+
+/**
+ Gets the screen bounding rect for the given screen. 
+ \param[out]  X,Y,W,H the corresponding screen bounding box
+ \param[in] n the screen number (0 to Fl::screen_count() - 1)
+ \see void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my) 
+ */
+void fltk3::screen_xywh(int &X, int &Y, int &W, int &H, int n) {
+  if (num_screens < 0) screen_init();
+  
+  if ((n < 0) || (n >= num_screens))
+    n = 0;
+  
+#ifdef WIN32
+  if (num_screens > 0) {
+    X = screens[n].left;
+    Y = screens[n].top;
+    W = screens[n].right - screens[n].left;
+    H = screens[n].bottom - screens[n].top;
+  } else {
+    /* Fallback if something is broken... */
+    X = 0;
+    Y = 0;
+    W = GetSystemMetrics(SM_CXSCREEN);
+    H = GetSystemMetrics(SM_CYSCREEN);
+  }
+#elif defined(__APPLE__)
+  if (num_screens > 0) {
+    X = screens[n].x;
+    Y = screens[n].y;
+    W = screens[n].width;
+    H = screens[n].height;
+  } else {
+    /* Fallback if something is broken... */
+    X = fltk3::x();
+    Y = fltk3::y();
+    W = fltk3::w();
+    H = fltk3::h();
+  }
+#else
+#if HAVE_XINERAMA
+  if (num_screens > 0 && screens) {
+    X = screens[n].x_org;
+    Y = screens[n].y_org;
+    W = screens[n].width;
+    H = screens[n].height;
+  } else
+#endif // HAVE_XINERAMA
+  {
+    /* Fallback if something is broken (or no Xinerama)... */
+    X = 0;
+    Y = 0;
+    W = DisplayWidth(fl_display, fl_screen);
+    H = DisplayHeight(fl_display, fl_screen);
+  }
+#endif // WIN32
+}
+
+static inline float fl_intersection(int x1, int y1, int w1, int h1,
+                        int x2, int y2, int w2, int h2) {
+  if(x1+w1 < x2 || x2+w2 < x1 || y1+h1 < y2 || y2+h2 < y1)
+    return 0.;
+  int int_left = x1 > x2 ? x1 : x2;
+  int int_right = x1+w1 > x2+w2 ? x2+w2 : x1+w1;
+  int int_top = y1 > y2 ? y1 : y2;
+  int int_bottom = y1+h1 > y2+h2 ? y2+h2 : y1+h1;
+  return (float)(int_right - int_left) * (int_bottom - int_top);
+}
+
+/**
+  Gets the screen bounding rect for the screen
+  which intersects the most with the rectangle
+  defined by \p mx, \p my, \p mw, \p mh.
+  \param[out]  X,Y,W,H the corresponding screen bounding box
+  \param[in] mx, my, mw, mh the rectangle to search for intersection with
+  \see void screen_xywh(int &X, int &Y, int &W, int &H, int n)
+  */
+void fltk3::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh) {
+  int best_screen = 0;
+  float best_intersection = 0.;
+  for(int i = 0; i < fltk3::screen_count(); i++) {
+    int sx, sy, sw, sh;
+    fltk3::screen_xywh(sx, sy, sw, sh, i);
+    float sintersection = fl_intersection(mx, my, mw, mh, sx, sy, sw, sh);
+    if(sintersection > best_intersection) {
+      best_screen = i;
+      best_intersection = sintersection;
+    }
+  }
+  screen_xywh(X, Y, W, H, best_screen);
+}
+  
+
+
+/**
+ Gets the screen resolution in dots-per-inch for the given screen. 
+ \param[out]  h, v  horizontal and vertical resolution
+ \param[in]   n     the screen number (0 to fltk3::screen_count() - 1)
+ \see void screen_xywh(int &x, int &y, int &w, int &h, int mx, int my) 
+ */
+void fltk3::screen_dpi(float &h, float &v, int n)
+{
+  if (num_screens < 0) screen_init();
+  h = v = 0.0f;
+  
+#ifdef WIN32
+  if (n >= 0 && n < num_screens) {
+    h = float(dpi[n][0]);
+    v = float(dpi[n][1]);
+  }
+#elif defined(__APPLE__)
+  if (n >= 0 && n < num_screens) {
+    h = dpi_h[n];
+    v = dpi_v[n];
+  }
+#elif HAVE_XINERAMA
+  if (n >= 0 && n < num_screens) {
+    h = dpi[n][0];
+    v = dpi[n][1];
+  }
+#else
+  if (n >= 0 && n < num_screens) {
+    h = dpi[0];
+    v = dpi[1];
+  }
+#endif // WIN32
+}
+
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/scroll_area.cxx (from rev 9002, branches/branch-3.0/src/core/fl_scroll_area.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/scroll_area.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/scroll_area.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,169 @@
+//
+// "$Id$"
+//
+// Scrolling routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Drawing function to move the contents of a rectangle.  This is passed
+// a "callback" which is called to draw rectangular areas that are moved
+// into the drawing area.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+
+// scroll a rectangle and redraw the newly exposed portions:
+/**
+  Scroll a rectangle and draw the newly exposed portions.
+  \param[in] X,Y       position of top-left of rectangle
+  \param[in] W,H       size of rectangle
+  \param[in] dx,dy     pixel offsets for shifting rectangle
+  \param[in] draw_area callback function to draw rectangular areas
+  \param[in] data      pointer to user data for callback
+  The contents of the rectangular area is first shifted by \p dx
+  and \p dy pixels. The \p draw_area callback is then called for
+  every newly exposed rectangular area.
+  */
+void fltk3::scroll(int X, int Y, int W, int H, int dx, int dy,
+               void (*draw_area)(void*, int,int,int,int), void* data)
+{
+  if (!dx && !dy) return;
+  if (dx <= -W || dx >= W || dy <= -H || dy >= H) {
+    // no intersection of old an new scroll
+    draw_area(data,X,Y,W,H);
+    return;
+  }
+  int src_x, src_w, dest_x, clip_x, clip_w;
+  if (dx > 0) {
+    src_x = X;
+    dest_x = X+dx;
+    src_w = W-dx;
+    clip_x = X;
+    clip_w = dx;
+  } else {
+    src_x = X-dx;
+    dest_x = X;
+    src_w = W+dx;
+    clip_x = X+src_w;
+    clip_w = W-src_w;
+  }
+  int src_y, src_h, dest_y, clip_y, clip_h;
+  if (dy > 0) {
+    src_y = Y;
+    dest_y = Y+dy;
+    src_h = H-dy;
+    clip_y = Y;
+    clip_h = dy;
+  } else {
+    src_y = Y-dy;
+    dest_y = Y;
+    src_h = H+dy;
+    clip_y = Y+src_h;
+    clip_h = H-src_h;
+  }
+
+#if defined(USE_X11)
+  XCopyArea(fl_display, fl_window, fl_window, fl_gc,
+	    src_x, src_y, src_w, src_h, dest_x, dest_y);
+  // we have to sync the display and get the GraphicsExpose events! (sigh)
+  for (;;) {
+    XEvent e; XWindowEvent(fl_display, fl_window, ExposureMask, &e);
+    if (e.type == NoExpose) break;
+    // otherwise assume it is a GraphicsExpose event:
+    draw_area(data, e.xexpose.x, e.xexpose.y,
+	      e.xexpose.width, e.xexpose.height);
+    if (!e.xgraphicsexpose.count) break;
+  }
+#elif defined(WIN32)
+  typedef int (WINAPI* fl_GetRandomRgn_func)(HDC, HRGN, INT);
+  static fl_GetRandomRgn_func fl_GetRandomRgn = 0L;
+  static char first_time = 1;
+
+  // We will have to do some Region magic now, so let's see if the 
+  // required function is available (and it should be staring w/Win95)
+  if (first_time) {
+    HMODULE hMod = GetModuleHandle("GDI32.DLL");
+    if (hMod) {
+      fl_GetRandomRgn = (fl_GetRandomRgn_func)GetProcAddress(hMod, "GetRandomRgn");
+    }
+    first_time = 0;
+  }
+
+  // Now check if the source scrolling area is fully visible.
+  // If it is, we will do a quick scroll and just update the 
+  // newly exposed area. If it is not, we go the safe route and 
+  // re-render the full area instead.
+  // Note 1: we could go and find the areas that are actually
+  // obscured and recursively call fltk3::scroll for the newly found
+  // rectangles. However, this practice would rely on the 
+  // elements of the undocumented Rgn structure.
+  // Note 2: although this method should take care of most 
+  // multi-screen solutions, it will not solve issues scrolling
+  // from a different resolution screen onto another.
+  // Note 3: this has been tested with image maps, too.
+  if (fl_GetRandomRgn) {
+    // get the DC region minus all overlapping windows
+    HRGN sys_rgn = CreateRectRgn(0, 0, 0, 0);
+    fl_GetRandomRgn(fl_gc, sys_rgn, 4);
+    // now get the source scrolling rectangle 
+    HRGN src_rgn = CreateRectRgn(src_x, src_y, src_x+src_w, src_y+src_h);
+    POINT offset = { 0, 0 };
+    if (GetDCOrgEx(fl_gc, &offset)) {
+      OffsetRgn(src_rgn, offset.x, offset.y);
+    }
+    // see if all source pixels are available in the system region
+    // Note: we could be a bit more merciful and subtract the 
+    // scroll destination region as well.
+    HRGN dst_rgn = CreateRectRgn(0, 0, 0, 0);
+    int r = CombineRgn(dst_rgn, src_rgn, sys_rgn, RGN_DIFF);
+    DeleteObject(dst_rgn);
+    DeleteObject(src_rgn);
+    DeleteObject(sys_rgn);
+    if (r!=NULLREGION) {
+      draw_area(data,X,Y,W,H);
+      return;
+    }
+  }
+
+  // Great, we can do an accelerated scroll instead of re-rendering
+  BitBlt(fl_gc, dest_x, dest_y, src_w, src_h, fl_gc, src_x, src_y,SRCCOPY);
+
+#elif defined(__APPLE_QUARTZ__)
+  CGImageRef img = Fl_X::CGImage_from_window_rect(fltk3::Window::current(), src_x, src_y, src_w, src_h);
+  CGRect rect = { { dest_x, dest_y }, { src_w, src_h } };
+  Fl_X::q_begin_image(rect, 0, 0, src_w, src_h);
+  CGContextDrawImage(fl_gc, rect, img);
+  Fl_X::q_end_image();
+  CFRelease(img);
+#else
+# error unsupported platform
+#endif
+  if (dx) draw_area(data, clip_x, dest_y, clip_w, src_h);
+  if (dy) draw_area(data, X, clip_y, W, clip_h);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/set_font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_font.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/set_font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/set_font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,97 @@
+//
+// "$Id$"
+//
+// Font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Add a font to the internal table.
+// Also see fl_set_fonts.cxx which adds all possible fonts.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+#include "flstring.h"
+#include "font.h"
+#include <stdlib.h>
+
+static int table_size;
+/**
+  Changes a face.  The string pointer is simply stored,
+  the string is not copied, so the string must be in static memory.
+*/    
+void fltk3::set_font(fltk3::Font fnum, const char* name) {
+  while (fnum >= table_size) {
+    int i = table_size;
+    if (!i) {	// don't realloc the built-in table
+      table_size = 2*fltk3::FREE_FONT;
+      i = fltk3::FREE_FONT;
+      Fl_Fontdesc* t = (Fl_Fontdesc*)malloc(table_size*sizeof(Fl_Fontdesc));
+      memcpy(t, fltk3::fonts, fltk3::FREE_FONT*sizeof(Fl_Fontdesc));
+      fltk3::fonts = t;
+    } else {
+      table_size = 2*table_size;
+      fltk3::fonts=(Fl_Fontdesc*)realloc(fltk3::fonts, table_size*sizeof(Fl_Fontdesc));
+    }
+    for (; i < table_size; i++) {
+      fltk3::fonts[i].fontname[0] = 0;
+      fltk3::fonts[i].name = 0;
+#if !defined(WIN32) && !defined(__APPLE__)
+      fltk3::fonts[i].xlist = 0;
+      fltk3::fonts[i].n = 0;
+#endif // !WIN32 && !__APPLE__
+    }
+  }
+  Fl_Fontdesc* s = fltk3::fonts+fnum;
+  if (s->name) {
+    if (!strcmp(s->name, name)) {s->name = name; return;}
+#if !defined(WIN32) && !defined(__APPLE__)
+    if (s->xlist && s->n >= 0) XFreeFontNames(s->xlist);
+#endif
+    for (Fl_Font_Descriptor* f = s->first; f;) {
+      Fl_Font_Descriptor* n = f->next; delete f; f = n;
+    }
+    s->first = 0;
+  }
+  s->name = name;
+  s->fontname[0] = 0;
+#if !defined(WIN32) && !defined(__APPLE__)
+  s->xlist = 0;
+#endif
+  s->first = 0;
+  fltk3::font(-1, 0);
+}
+/** Copies one face to another. */
+void fltk3::set_font(fltk3::Font fnum, fltk3::Font from) {
+  fltk3::set_font(fnum, get_font(from));
+}
+/**
+    Gets the string for this face.  This string is different for each
+    face. Under X this value is passed to XListFonts to get all the sizes
+    of this face.
+*/
+const char* fltk3::get_font(fltk3::Font fnum) {return fltk3::fonts[fnum].name;}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/set_fonts.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_fonts.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/set_fonts.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/set_fonts.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,46 @@
+//
+// "$Id$"
+//
+// More font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include "font.h"
+#include "flstring.h"
+#include <stdlib.h>
+
+#ifdef WIN32
+#  include "win32_set_fonts.cxx"
+#elif defined(__APPLE__)
+#  include "cocoa_set_fonts.cxx"
+#elif USE_XFT
+#  include "xft_set_fonts.cxx"
+#else
+#  include "x11_set_fonts.cxx"
+#endif // WIN32
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/shadow_box.cxx (from rev 9002, branches/branch-3.0/src/core/fl_shadow_box.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/shadow_box.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/shadow_box.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,50 @@
+//
+// "$Id$"
+//
+// Shadow box drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+
+#define BW 3
+
+void fl_shadow_frame(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype) {
+  fltk3::color(fltk3::DARK3);
+  fltk3::rectf(x+BW, y+h-BW,  w - BW, BW);
+  fltk3::rectf(x+w-BW,  y+BW, BW,  h - BW);
+  fltk3::color(c);
+  fltk3::rect(x,y,w-BW,h-BW);
+}
+
+void fl_shadow_box(int x, int y, int w, int h, fltk3::Color c, fltk3::Boxtype t) {
+  fltk3::color(c);
+  fltk3::rectf(x+1,y+1,w-2-BW,h-2-BW);
+  fl_shadow_frame(x,y,w,h,fltk3::GRAY0,t);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/shortcut.cxx (from rev 9002, branches/branch-3.0/src/core/fl_shortcut.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/shortcut.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/shortcut.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,386 @@
+//
+// "$Id$"
+//
+// Shortcut support routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Code to test and parse fltk shortcut numbers.
+//
+// A shortcut is a keysym or'd with shift flags.  In the simplest
+// sense a shortcut is matched if the shift state is exactly as
+// given and the key returning that keysym is pressed.
+//
+// To make it easier to match some things it is more complex:
+//
+// Only fltk3::META, fltk3::ALT, fltk3::SHIFT, and fltk3::CTRL must be "off".  A
+// zero in the other shift flags indicates "don't care".
+//
+// It also checks against the first character of fltk3::event_text(),
+// and zero for fltk3::SHIFT means "don't care".
+// This allows punctuation shortcuts like "#" to work (rather than
+// calling it "shift+3" on a US keyboard)
+
+#include <fltk3/run.h>
+#include <fltk3/Widget.h>
+#include <fltk3/Button.h>
+#include <fltk3/draw.h>
+#include <ctype.h>
+#include "flstring.h"
+#if !defined(WIN32) && !defined(__APPLE__)
+#include <fltk3/x.h>
+#endif
+
+/**
+  Tests the current event, which must be an fltk3::KEYBOARD or
+  fltk3::SHORTCUT, against a shortcut value (described in fltk3::Button).
+
+  Not to be confused with fltk3::Widget::test_shortcut().
+
+  \return non-zero if there is a match.
+*/
+int fltk3::test_shortcut(unsigned int shortcut) {
+  if (!shortcut) return 0;
+
+  unsigned int v = shortcut & fltk3::KEY_MASK;
+  if (((unsigned)fltk3::tolower(v))!=v) {
+    shortcut |= fltk3::SHIFT;
+  }
+
+  int shift = fltk3::event_state();
+  // see if any required shift flags are off:
+  if ((shortcut&shift) != (shortcut&0x7fff0000)) return 0;
+  // record shift flags that are wrong:
+  int mismatch = (shortcut^shift)&0x7fff0000;
+  // these three must always be correct:
+  if (mismatch&(fltk3::META|fltk3::ALT|fltk3::CTRL)) return 0;
+
+  unsigned int key = shortcut & fltk3::KEY_MASK;
+
+  // if shift is also correct, check for exactly equal keysyms:
+  if (!(mismatch&(fltk3::SHIFT)) && key == (unsigned)fltk3::event_key()) return 1;
+
+  // try matching utf8, ignore shift:
+  unsigned int firstChar = fltk3::utf8decode(fltk3::event_text(), fltk3::event_text()+fltk3::event_length(), 0);
+  if ( ! (fltk3::CAPS_LOCK&shift) && key==firstChar) return 1;
+
+  // kludge so that Ctrl+'_' works (as opposed to Ctrl+'^_'):
+  if ((shift&fltk3::CTRL) && key >= 0x3f && key <= 0x5F
+      && firstChar==(key^0x40)) return 1; // firstChar should be within a-z
+  return 0;
+}
+
+// This table must be in numeric order by fltk (X) keysym number:
+struct Keyname {unsigned int key; const char* name;};
+#if defined(WIN32)
+static Keyname table[] = {
+  {' ', "Space"},
+  {fltk3::BackSpaceKey, "Backspace"},
+  {fltk3::TabKey,	"Tab"},
+  {0xff0b/*XK_Clear*/, "Clear"},
+  {fltk3::EnterKey,	"Enter"}, // X says "Enter"
+  {fltk3::PauseKey,	"Pause"},
+  {fltk3::ScrollLockKey, "Scroll_Lock"},
+  {fltk3::EscapeKey,	"Escape"},
+  {fltk3::HomeKey,	"Home"},
+  {fltk3::LeftKey,	"Left"},
+  {fltk3::UpKey,	"Up"},
+  {fltk3::RightKey,	"Right"},
+  {fltk3::DownKey,	"Down"},
+  {fltk3::PageUpKey,	"Page_Up"}, // X says "Prior"
+  {fltk3::PageDownKey,"Page_Down"}, // X says "Next"
+  {fltk3::EndKey,	"End"},
+  {fltk3::PrintKey,	"Print"},
+  {fltk3::InsertKey,	"Insert"},
+  {fltk3::MenuKey,	"Menu"},
+  {fltk3::NumLockKey,	"Num_Lock"},
+  {fltk3::KPEnterKey,	"KP_Enter"},
+  {fltk3::ShiftLKey,	"Shift_L"},
+  {fltk3::ShiftRKey,	"Shift_R"},
+  {fltk3::ControlLKey,"Control_L"},
+  {fltk3::ControlRKey,"Control_R"},
+  {fltk3::CapsLockKey,"Caps_Lock"},
+  {fltk3::MetaLKey,	"Meta_L"},
+  {fltk3::MetaRKey,	"Meta_R"},
+  {fltk3::AltLKey,	"Alt_L"},
+  {fltk3::AltRKey,	"Alt_R"},
+  {fltk3::DeleteKey,	"Delete"}
+};
+#elif defined(__APPLE__) 
+static Keyname table[] = {
+                                 // v - this column contains UTF-8 characters
+  {' ', "Space"},
+  {fltk3::BackSpaceKey,"\xe2\x8c\xab"}, // erase to the left
+  {fltk3::TabKey,	"\xe2\x87\xa5"}, // rightwards arrow to bar
+  {0xff0b,      "\xe2\x8c\xa6"}, // erase to the right
+  {fltk3::EnterKey,	"\xe2\x86\xa9"}, // leftwards arrow with hook
+  {fltk3::PauseKey,	"Pause"},
+  {fltk3::ScrollLockKey, "Scroll_Lock"},
+  {fltk3::EscapeKey,	"\xe2\x90\x9b"},
+  {fltk3::HomeKey,	"\xe2\x86\x96"}, // north west arrow
+  {fltk3::LeftKey,	"\xe2\x86\x90"}, // leftwards arrow
+  {fltk3::UpKey,	"\xe2\x86\x91"}, // upwards arrow
+  {fltk3::RightKey,	"\xe2\x86\x92"}, // rightwards arrow
+  {fltk3::DownKey,	"\xe2\x86\x93"}, // downwards arrow
+  {fltk3::PageUpKey,	"\xe2\x87\x9e"}, // upwards arrow with double stroke
+  {fltk3::PageDownKey,"\xe2\x87\x9f"}, // downwards arrow with double stroke
+  {fltk3::EndKey,	"\xe2\x86\x98"}, // south east arrow
+  {fltk3::PrintKey,	"Print"},
+  {fltk3::InsertKey,	"Insert"},
+  {fltk3::MenuKey,	"Menu"},
+  {fltk3::NumLockKey,	"Num_Lock"},
+  {fltk3::KPEnterKey,	"\xe2\x8c\xa4"}, // up arrow head between two horizontal bars
+  {fltk3::ShiftLKey,	"Shift_L"},
+  {fltk3::ShiftRKey,	"Shift_R"},
+  {fltk3::ControlLKey,"Control_L"},
+  {fltk3::ControlRKey,"Control_R"},
+  {fltk3::CapsLockKey,"\xe2\x87\xaa"}, // upwards white arrow from bar
+  {fltk3::MetaLKey,	"Meta_L"},
+  {fltk3::MetaRKey,	"Meta_R"},
+  {fltk3::AltLKey,	"Alt_L"},
+  {fltk3::AltRKey,	"Alt_R"},
+  {fltk3::DeleteKey,	"\xe2\x8c\xa7"}  // x in a rectangle box
+};
+#endif
+
+/**
+  Get a human-readable string from a shortcut value.
+
+  Unparse a shortcut value as used by fltk3::Button or fltk3::MenuItem into
+  a human-readable string like "Alt+N". This only works if the shortcut
+  is a character key or a numbered function key. If the shortcut is
+  zero then an empty string is returned. The return value points at
+  a static buffer that is overwritten with each call.
+
+  \param [in] shortcut the integer value containing the ascii character or extended keystroke plus modifiers
+  \return a pointer to a static buffer containing human readable text for the shortcut
+  */
+const char* fltk3::shortcut_label(unsigned int shortcut) {
+  return fltk3::shortcut_label(shortcut, 0L);
+}
+
+/** 
+  Get a human-readable string from a shortcut value.
+
+  \param [in] shortcut the integer value containing the ascii character or extended keystroke plus modifiers
+  \param [in] eom if this pointer is set, it will receive a pointer to the end of the modifier text
+  \return a pointer to a static buffer containing human readable text for the shortcut
+  \see fltk3::shortcut_label(unsigned int shortcut)
+  */
+const char* fltk3::shortcut_label(unsigned int shortcut, const char **eom) {
+  static char buf[20];
+  char *p = buf;
+  if (eom) *eom = p;
+  if (!shortcut) {*p = 0; return buf;}
+  // fix upper case shortcuts
+  unsigned int v = shortcut & fltk3::KEY_MASK;
+  if (((unsigned)fltk3::tolower(v))!=v) {
+    shortcut |= fltk3::SHIFT;
+  }
+#ifdef __APPLE__
+  //                        this column contains utf8 characters - v
+  if (shortcut & fltk3::SHIFT) {strcpy(p,"\xe2\x87\xa7"); p += 3;}  // upwards white arrow
+  if (shortcut & fltk3::CTRL)  {strcpy(p,"\xe2\x8c\x83"); p += 3;}  // up arrowhead
+  if (shortcut & fltk3::ALT)   {strcpy(p,"\xe2\x8c\xa5"); p += 3;}  // alternative key symbol
+  if (shortcut & fltk3::META)  {strcpy(p,"\xe2\x8c\x98"); p += 3;}  // place of interest sign
+#else
+  if (shortcut & fltk3::META) {strcpy(p,"Meta+"); p += 5;}
+  if (shortcut & fltk3::ALT) {strcpy(p,"Alt+"); p += 4;}
+  if (shortcut & fltk3::SHIFT) {strcpy(p,"Shift+"); p += 6;}
+  if (shortcut & fltk3::CTRL) {strcpy(p,"Ctrl+"); p += 5;}
+#endif // __APPLE__
+  if (eom) *eom = p;
+  unsigned int key = shortcut & fltk3::KEY_MASK;
+#if defined(WIN32) || defined(__APPLE__) // if not X
+  if (key >= fltk3::FKey && key <= fltk3::FLastKey) {
+    *p++ = 'F';
+    if (key > fltk3::FKey+9) *p++ = (key-fltk3::FKey)/10+'0';
+    *p++ = (key-fltk3::FKey)%10 + '0';
+  } else {
+    // binary search the table for a match:
+    int a = 0;
+    int b = sizeof(table)/sizeof(*table);
+    while (a < b) {
+      int c = (a+b)/2;
+      if (table[c].key == key) {
+        if (p > buf) {
+          strcpy(p,table[c].name); 
+          return buf;
+        } else {
+          const char *sp = table[c].name;
+          if (eom) *eom = sp;
+          return sp;
+        }
+      }
+      if (table[c].key < key) a = c+1;
+      else b = c;
+    }
+    if (key >= fltk3::KPKey && key <= fltk3::KPLastKey) {
+      // mark keypad keys with KP_ prefix
+      strcpy(p,"KP_"); p += 3;
+      *p++ = uchar(key & 127);
+    } else {
+      // if none found, use the keystroke as a match:
+      p += fltk3::utf8encode(fltk3::toupper(key), p); 
+    }
+  }
+  *p = 0;
+  return buf;
+#else
+  const char* q;
+  if (key == fltk3::EnterKey || key == '\r') q="Enter";  // don't use Xlib's "Return":
+  else if (key > 32 && key < 0x100) q = 0;
+  else q = XKeysymToString(key);
+  if (!q) {
+    p += fltk3::utf8encode(fltk3::toupper(key), p); 
+    *p = 0; 
+    return buf;
+  }
+  if (p > buf) {
+    strcpy(p,q); 
+    return buf;
+  } else {
+    if (eom) *eom = q;
+    return q;
+  }
+#endif
+}
+
+// Emulation of XForms named shortcuts
+#include <stdlib.h>
+/**
+  Emulation of XForms named shortcuts.
+
+  Converts ascii shortcut specifications (eg. "^c") 
+  into the FLTK integer equivalent (eg. fltk3::CTRL+'c')
+
+  These ascii characters are used to specify the various keyboard modifier keys:
+  \verbatim
+   # - Alt
+   + - Shift
+   ^ - Control
+  \endverbatim
+*/
+unsigned int fltk3::old_shortcut(const char* s) {
+  if (!s || !*s) return 0;
+  unsigned int n = 0;
+  if (*s == '#') {n |= fltk3::ALT; s++;}
+  if (*s == '+') {n |= fltk3::SHIFT; s++;}
+  if (*s == '^') {n |= fltk3::CTRL; s++;}
+  if (*s && s[1]) return n | (int)strtol(s,0,0); // allow 0xf00 to get any key
+  return n | *s;
+}
+
+// Tests for &x shortcuts in button labels:
+
+/** Returns the Unicode value of the '&x' shortcut in a given text.
+
+  The given text \p t (usually a widget's label or a menu text) is
+  searched for a '&x' shortcut label, and if found, the Unicode
+  value (code point) of the '&x' shortcut is returned.
+
+  \param t text or label to search for '&x' shortcut.
+
+  \return Unicode (UCS-4) value of shortcut in \p t or 0.
+
+  \note Internal use only.
+*/
+unsigned int fltk3::Widget::label_shortcut(const char *t) {
+  if (!t) return 0;
+  for (;;) {
+    if (*t==0) return 0;
+    if (*t=='&') {
+      unsigned int s = fltk3::utf8decode(t+1, 0, 0);
+      if (s==0) return 0;
+      else if (s==(unsigned int)'&') t++;
+      else return s;
+    }
+    t++;
+  }
+}
+
+/** Returns true if the given text \p t contains the entered '&x' shortcut.
+
+  This method must only be called in handle() methods or callbacks after
+  a keypress event (usually fltk3::KEYDOWN or fltk3::SHORTCUT). The given text
+  \p t (usually a widget's label or menu text) is searched for a '&x'
+  shortcut, and if found, this is compared with the entered key value.
+
+  fltk3::event_text() is used to get the entered key value.
+  fltk3::event_state() is used to get the Alt modifier, if \p require_alt
+  is true.
+
+  \param t text or label to search for '&x' shortcut.
+  \param require_alt if true: match only if Alt key is pressed.
+
+  \return true, if the entered text matches the '&x' shortcut in \p t
+	  false (0) otherwise.
+
+  \note Internal use only.
+*/
+int fltk3::Widget::test_shortcut(const char *t, const bool require_alt) {
+  if (!t) return 0;
+  // for menubars etc. shortcuts must work only if the Alt modifier is pressed
+  if (require_alt && fltk3::event_state(fltk3::ALT)==0) return 0;
+  unsigned int c = fltk3::utf8decode(fltk3::event_text(), fltk3::event_text()+fltk3::event_length(), 0);
+#ifdef __APPLE__
+  // this line makes underline shortcuts work the same way they do on MSWindow
+  // and Linux. 
+  if (c && fltk3::event_state(fltk3::ALT)) 
+    c = fltk3::event_key();
+#endif
+  if (!c) return 0;
+  unsigned int ls = label_shortcut(t);
+  if (c == ls)
+    return 1;
+#ifdef __APPLE__
+  // On OS X, we need to simulate the upper case keystroke as well
+  if (fltk3::event_state(fltk3::ALT) && c<128 && isalpha(c) && (unsigned)toupper(c)==ls)
+    return 1;
+#endif
+  return 0;
+}
+
+/** Returns true if the widget's label contains the entered '&x' shortcut.
+
+  This method must only be called in handle() methods or callbacks after
+  a keypress event (usually fltk3::KEYDOWN or fltk3::SHORTCUT).
+  The widget's label is searched for a '&x'
+  shortcut, and if found, this is compared with the entered key value.
+
+  fltk3::event_text() is used to get the entered key value.
+
+  \return true, if the entered text matches the widget's'&x' shortcut,
+	  false (0) otherwise.
+
+  \note Internal use only.
+*/
+
+int fltk3::Widget::test_shortcut() {
+  if (!(flags()&SHORTCUT_LABEL)) return 0;
+  return test_shortcut(label());
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/show_colormap.cxx (from rev 9002, branches/branch-3.0/src/core/fl_show_colormap.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/show_colormap.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/show_colormap.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,169 @@
+//
+// "$Id$"
+//
+// Colormap color selection dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/SingleWindow.h>
+#include <fltk3/draw.h>
+#include <fltk3/show_colormap.h>
+#include <fltk3/Wrapper.h>
+#include <config.h>
+
+#define BOXSIZE 14
+#define BORDER 4
+
+namespace fltk3 {
+  
+  /** 
+   This widget creates a modal window for selecting a color from the colormap.
+   Pretty much unchanged from Forms.
+   */
+  class ColorMenu : public fltk3::Window {
+    fltk3::Color initial;
+    fltk3::Color which, previous;
+    int done;
+    void drawbox(fltk3::Color);
+    void draw();
+    int handle(int);
+  public:
+    ColorMenu(fltk3::Color oldcol);
+    fltk3::Color run();
+  };
+  
+  ColorMenu::ColorMenu(fltk3::Color oldcol) :
+  fltk3::Window(BOXSIZE*8+1+2*BORDER, BOXSIZE*32+1+2*BORDER) {
+    clear_border();
+    set_modal();
+    initial = which = oldcol;
+  }
+  
+  void ColorMenu::drawbox(fltk3::Color c) {
+    if (c < 0 || c > 255) return;
+    int X = (c%8)*BOXSIZE+BORDER;
+    int Y = (c/8)*BOXSIZE+BORDER;
+#if BORDER_WIDTH < 3
+    if (c == which) fltk3::draw_box(fltk3::DOWN_BOX, X+1, Y+1, BOXSIZE-1, BOXSIZE-1, c);
+    else fltk3::draw_box(fltk3::BORDER_BOX, X, Y, BOXSIZE+1, BOXSIZE+1, c);
+#else
+    fltk3::draw_box(c == which ? fltk3::DOWN_BOX : fltk3::BORDER_BOX,
+                    X, Y, BOXSIZE+1, BOXSIZE+1, c);
+#endif
+  }
+  
+  void ColorMenu::draw() {
+    FLTK3_OBJECT_VCALLS_WRAPPER(draw(), Draw)
+    if (damage() != fltk3::DAMAGE_CHILD) {
+      fltk3::draw_box(fltk3::UP_BOX,0,0,w(),h(),color());
+      for (int c = 0; c < 256; c++) drawbox((fltk3::Color)c);
+    } else {
+      drawbox(previous);
+      drawbox(which);
+    }
+    previous = which;
+  }
+  
+  int ColorMenu::handle(int e) {
+    FLTK3_OBJECT_VCALLS_WRAPPER_RET(int, handle(e), Handle)
+    fltk3::Color c = which;
+    switch (e) {
+      case fltk3::PUSH:
+      case fltk3::DRAG: {
+        int X = (fltk3::event_x_root() - x() - BORDER);
+        if (X >= 0) X = X/BOXSIZE;
+        int Y = (fltk3::event_y_root() - y() - BORDER);
+        if (Y >= 0) Y = Y/BOXSIZE;
+        if (X >= 0 && X < 8 && Y >= 0 && Y < 32)
+          c = 8*Y + X;
+        else
+          c = initial;
+      } break;
+      case fltk3::RELEASE:
+        done = 1;
+        return 1;
+      case fltk3::KEYBOARD:
+        switch (fltk3::event_key()) {
+          case fltk3::UpKey: if (c > 7) c -= 8; break;
+          case fltk3::DownKey: if (c < 256-8) c += 8; break;
+          case fltk3::LeftKey: if (c > 0) c--; break;
+          case fltk3::RightKey: if (c < 255) c++; break;
+          case fltk3::EscapeKey: which = initial; done = 1; return 1;
+          case fltk3::KPEnterKey:
+          case fltk3::EnterKey: done = 1; return 1;
+          default: return 0;
+        }
+        break;
+      default:
+        return 0;
+    }
+    if (c != which) {
+      which = (fltk3::Color)c; damage(fltk3::DAMAGE_CHILD);
+      int bx = (c%8)*BOXSIZE+BORDER;
+      int by = (c/8)*BOXSIZE+BORDER;
+      int px = x();
+      int py = y();
+      int scr_x, scr_y, scr_w, scr_h;
+      fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h);
+      if (px < scr_x) px = scr_x;
+      if (px+bx+BOXSIZE+BORDER >= scr_x+scr_w) px = scr_x+scr_w-bx-BOXSIZE-BORDER;
+      if (py < scr_y) py = scr_y;
+      if (py+by+BOXSIZE+BORDER >= scr_y+scr_h) py = scr_y+scr_h-by-BOXSIZE-BORDER;
+      if (px+bx < BORDER) px = BORDER-bx;
+      if (py+by < BORDER) py = BORDER-by;
+      position(px,py);
+    }
+    return 1;
+  }
+  
+  extern char fl_override_redirect; // hack for menus
+  
+#ifdef _MSC_VER
+#pragma optimize("a",off) // needed to get the done check to work
+#endif
+  fltk3::Color ColorMenu::run() {
+    if (which < 0 || which > 255) {
+      position(fltk3::event_x_root()-w()/2, fltk3::event_y_root()-y()/2);
+    } else {
+      position(fltk3::event_x_root()-(initial%8)*BOXSIZE-BOXSIZE/2-BORDER,
+               fltk3::event_y_root()-(initial/8)*BOXSIZE-BOXSIZE/2-BORDER);
+    }
+    show();
+    fltk3::grab(*this);
+    done = 0;
+    while (!done) fltk3::wait();
+    fltk3::grab(0);
+    return which;
+  }
+  
+  fltk3::Color show_colormap(fltk3::Color oldcol) {
+    ColorMenu m(oldcol);
+    return m.run();
+  }
+  
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/slowarrow.h (from rev 9002, branches/branch-3.0/src/core/slowarrow.h)
===================================================================
--- branches/branch-3.0/src/fltk3/slowarrow.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/slowarrow.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define slowarrow_width 16
+#define slowarrow_height 16
+static unsigned char slowarrow_bits[] = {
+   0x40, 0x00, 0x40, 0x00, 0x60, 0x00, 0x60, 0x00, 0xf0, 0x0f, 0x60, 0x00,
+   0x60, 0x00, 0x40, 0x02, 0x40, 0x02, 0x00, 0x06, 0x00, 0x06, 0xf0, 0x0f,
+   0x00, 0x06, 0x00, 0x06, 0x00, 0x02, 0x00, 0x02};

Copied: branches/branch-3.0/src/fltk3/symbols.cxx (from rev 9002, branches/branch-3.0/src/core/fl_symbols.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/symbols.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/symbols.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,714 @@
+//
+// "$Id$"
+//
+// Symbol drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// These are small graphics drawn by the normal label-drawing
+// code when the string starts with an '@' sign.
+
+// Adapted from original code written by:
+
+// Written by Mark Overmars
+// Version 2.1 a
+// Date: Oct  2, 1992
+
+#include <fltk3/run.h>
+#include <fltk3/draw.h>
+#include <fltk3/math.h>
+#include "flstring.h"
+
+typedef struct {
+  const char *name;
+  void (*drawit)(fltk3::Color);
+  char scalable;
+  char notempty;
+} SYMBOL;
+
+#define MAXSYMBOL       211
+   /* Maximal number of symbols in table. Only half of them are
+      used. Should be prime. */
+
+static SYMBOL symbols[MAXSYMBOL];      /* The symbols */
+static int symbnumb = -1;              /* Their number */
+
+static int find(const char *name) {
+// returns hash entry if it exists, or first empty slot:
+  int pos = name[0] ? (
+    name[1] ? (
+      name[2] ? 71*name[0]+31*name[1]+name[2] : 31*name[0]+name[1]
+    ) :
+      name[0]
+  ) : 0;
+  pos %= MAXSYMBOL;
+  int hh2 = name[0] ? (
+    (name[1]) ? 51*name[0]+3*name[1] : 3*name[0]
+    ) : 1;
+  hh2 %= MAXSYMBOL; if (!hh2) hh2 = 1;
+  for (;;) {
+    if (!symbols[pos].notempty) return pos;
+    if (!strcmp(symbols[pos].name,name)) return pos;
+    pos = (pos + hh2) % MAXSYMBOL;
+  }
+}
+
+static void fl_init_symbols(void);
+
+/**************** The routines seen by the user *************************/
+
+/**
+  Adds a symbol to the system.
+  \param[in] name     name of symbol (without the "@")
+  \param[in] drawit   function to draw symbol
+  \param[in] scalable set to 1 if \p drawit uses scalable vector drawing
+  \returns 1 on success, 0 on failure
+  */
+int fltk3::add_symbol(const char *name, void (*drawit)(fltk3::Color), int scalable)
+{
+  fl_init_symbols();
+  int pos;
+  if (symbnumb > MAXSYMBOL / 2) return 0;	// table is full
+  pos = find(name);
+  symbols[pos].name = name;
+  symbols[pos].drawit = drawit;
+  symbols[pos].notempty = 1;
+  symbols[pos].scalable = scalable;
+  symbnumb++;
+  return 1;
+}
+
+int fl_return_arrow(int x,int y,int w,int h);
+
+/**
+  Draw the named symbol in the given rectangle using the given color
+  \param[in] label name of symbol
+  \param[in] x,y   position of symbol
+  \param[in] w,h   size of symbol
+  \param[in] col   color of symbox
+  \returns 1 on success, 0 on failure
+  */
+// provided for back compatibility:
+int fltk3::draw_symbol(const char *label,int x,int y,int w,int h,fltk3::Color col) {  
+  const char *p = label;
+  if (*p++ != '@') return 0;
+  fl_init_symbols();
+  int equalscale = 0;
+  if (*p == '#') {equalscale = 1; p++;}
+  if (*p == '-' && p[1]>='1' && p[1]<='9') {
+    int n = p[1]-'0';
+    x += n; y += n; w -= 2*n; h -= 2*n;
+    p += 2;
+  } else if (*p == '+' && p[1]>='1' && p[1]<='9') {
+    int n = p[1]-'0';
+    x -= n; y -= n; w += 2*n; h += 2*n;
+    p += 2;
+  }
+  if (w < 10) {x -= (10-w)/2; w = 10;}
+  if (h < 10) {y -= (10-h)/2; h = 10;}
+  w = (w-1)|1; h = (h-1)|1;
+  char flip_x = 0, flip_y = 0;
+  if (*p=='$') {
+    flip_x = 1;
+    p++;
+  }
+  if (*p=='%') {
+    flip_y = 1;
+    p++;
+  }
+  int rotangle;
+  switch (*p++) {
+  case '0':
+    rotangle = 1000*(p[1]-'0') + 100*(p[2]-'0') + 10*(p[3]-'0');
+    p += 4;
+    break;
+  case '1': rotangle = 2250; break;
+  case '2': rotangle = 2700; break;
+  case '3': rotangle = 3150; break;
+  case '4': rotangle = 1800; break;
+  case '5':
+  case '6': rotangle = 0; break;
+  case '7': rotangle = 1350; break;
+  case '8': rotangle =  900; break;
+  case '9': rotangle =  450; break;
+  default: rotangle = 0; p--; break;
+  }
+  int pos = find(p);
+  if (!symbols[pos].notempty) return 0;
+  if (symbols[pos].scalable == 3) { // kludge to detect return arrow
+    fl_return_arrow(x,y,w,h);
+    return 1;
+  }
+  fltk3::push_matrix();
+  fltk3::translate(x+w/2,y+h/2);
+  if (symbols[pos].scalable) {
+    if (equalscale) {if (w<h) h = w; else w = h;}
+    fltk3::scale(0.5*w, 0.5*h);
+    fltk3::rotate(rotangle/10.0);
+    if (flip_x) fltk3::scale(-1.0, 1.0);
+    if (flip_y) fltk3::scale(1.0, -1.0);
+  }
+  (symbols[pos].drawit)(col);
+  fltk3::pop_matrix();
+  return 1;
+}
+
+/******************** THE DEFAULT SYMBOLS ****************************/
+
+/* Some help stuff */
+
+#define BP fltk3::begin_polygon()
+#define EP fltk3::end_polygon()
+#define BCP fltk3::begin_complex_polygon()
+#define ECP fltk3::end_complex_polygon()
+#define BL fltk3::begin_line()
+#define EL fltk3::end_line()
+#define BC fltk3::begin_loop()
+#define EC fltk3::end_loop()
+#define vv(x,y) fltk3::vertex(x,y)
+
+//for the outline color
+static void set_outline_color(fltk3::Color c) {
+  fltk3::color(fltk3::darker(c));
+}
+
+static void rectangle(double x,double y,double x2,double y2,fltk3::Color col) {
+  fltk3::color(col);
+  BP; vv(x,y); vv(x2,y); vv(x2,y2); vv(x,y2); EP;
+  set_outline_color(col);
+  BC; vv(x,y); vv(x2,y); vv(x2,y2); vv(x,y2); EC;
+}
+
+/* The drawing routines */
+
+static void draw_fltk(fltk3::Color col) 
+{
+  fltk3::color(col);
+  // F fill
+  BCP; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3);
+  vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1);
+  vv(-1.8, 0.5); vv(-2.0, 0.5); ECP;
+  // L fill
+  BCP; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3);
+  vv(0.0, 0.5); vv(-1.0, 0.5); ECP;
+  // T outline
+  BCP; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3);
+  vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); ECP;
+  // K outline
+  BCP; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5);
+  vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5);
+  vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); ECP;
+  set_outline_color(col);
+  // F outline
+  BC; vv(-2.0, -0.5); vv(-1.0, -0.5); vv(-1.0, -0.3); vv(-1.8, -0.3);
+  vv(-1.8, -0.1); vv(-1.2, -0.1); vv(-1.2, 0.1); vv(-1.8, 0.1);
+  vv(-1.8, 0.5); vv(-2.0, 0.5); EC;
+  // L outline
+  BC; vv(-1.0, -0.5); vv(-0.8, -0.5); vv(-0.8, 0.3); vv(0.0, 0.3);
+  vv(0.0, 0.5); vv(-1.0, 0.5); EC;
+  // T outline
+  BC; vv(-0.1, -0.5); vv(1.1, -0.5); vv(1.1, -0.3); vv(0.6, -0.3);
+  vv(0.6, 0.5); vv(0.4, 0.5); vv(0.4, -0.3); vv(-0.1, -0.3); EC;
+  // K outline
+  BC; vv(1.1, -0.5); vv(1.3, -0.5); vv(1.3, -0.15); vv(1.70, -0.5);
+  vv(2.0, -0.5); vv(1.43, 0.0); vv(2.0, 0.5); vv(1.70, 0.5);
+  vv(1.3, 0.15); vv(1.3, 0.5); vv(1.1, 0.5); EC;
+}
+
+static void draw_search(fltk3::Color col) 
+{
+  fltk3::color(col);
+  BP; vv(-.4, .13); vv(-1.0, .73); vv(-.73, 1.0); vv(-.13, .4); EP;
+  set_outline_color(col);
+  fltk3::line_style(fltk3::SOLID, 3, 0);
+  BC; fltk3::circle(.2, -.2, .6); EC;
+  fltk3::line_style(fltk3::SOLID, 1, 0);
+  BC; vv(-.4, .13); vv(-1.0, .73); vv(-.73, 1.0); vv(-.13, .4); EC;
+}
+
+static void draw_arrow1(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(-0.8,-0.4); vv(-0.8,0.4); vv(0.0,0.4); vv(0.0,-0.4); EP;
+  BP; vv(0.0,0.8); vv(0.8,0.0); vv(0.0,-0.8); vv(0.0,-0.4); vv(0.0,0.4); EP;
+  set_outline_color(col);
+  BC; vv(-0.8,-0.4); vv(-0.8,0.4); vv(0.0,0.4); vv(0.0,0.8); vv(0.8,0.0);
+      vv(0.0,-0.8); vv(0.0,-0.4); EC;
+}
+
+static void draw_arrow1bar(fltk3::Color col)
+{
+  draw_arrow1(col);
+  rectangle(.6,-.8,.9,.8,col);
+}
+
+static void draw_arrow2(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(-0.3,0.8); vv(0.50,0.0); vv(-0.3,-0.8); EP;
+  set_outline_color(col);
+  BC; vv(-0.3,0.8); vv(0.50,0.0); vv(-0.3,-0.8); EC;
+}
+
+static void draw_arrow3(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EP;
+  BP; vv(-0.7,0.8); vv(0.1,0.0); vv(-0.7,-0.8); EP;
+  set_outline_color(col);
+  BC; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EC;
+  BC; vv(-0.7,0.8); vv(0.1,0.0); vv(-0.7,-0.8); EC;
+}
+
+static void draw_arrowbar(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EP;
+  BP; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EP;
+  set_outline_color(col);
+  BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC;
+  BC; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EC;
+}
+
+static void draw_arrowbox(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EP;
+  BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC;
+  set_outline_color(col);
+  BC; vv(0.2,0.8); vv(0.6,0.8); vv(0.6,-0.8); vv(0.2,-0.8); EC;
+  BC; vv(-0.6,0.8); vv(0.2,0.0); vv(-0.6,-0.8); EC;
+}
+
+static void draw_bararrow(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EP;
+  BP; vv(-0.5,0.8); vv(-0.1,0.8); vv(-0.1,-0.8); vv(-0.5,-0.8); EP;
+  set_outline_color(col);
+  BC; vv(0.1,0.8); vv(0.9,0.0); vv(0.1,-0.8); EC;
+  BC; vv(-0.5,0.8); vv(-0.1,0.8); vv(-0.1,-0.8); vv(-0.5,-0.8); EC;
+}
+
+static void draw_doublebar(fltk3::Color col) { 
+  rectangle(-0.6,-0.8,-.1,.8,col);
+  rectangle(.1,-0.8,.6,.8,col); 
+}
+
+static void draw_arrow01(fltk3::Color col)
+  { fltk3::rotate(180); draw_arrow1(col); }
+
+static void draw_arrow02(fltk3::Color col)
+  { fltk3::rotate(180); draw_arrow2(col); }
+
+static void draw_arrow03(fltk3::Color col)
+  { fltk3::rotate(180); draw_arrow3(col); }
+
+static void draw_0arrowbar(fltk3::Color col)
+  { fltk3::rotate(180); draw_arrowbar(col); }
+
+static void draw_0arrowbox(fltk3::Color col)
+  { fltk3::rotate(180); draw_arrowbox(col); }
+
+static void draw_0bararrow(fltk3::Color col)
+  { fltk3::rotate(180); draw_bararrow(col); }
+
+static void draw_doublearrow(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(-0.35,-0.4); vv(-0.35,0.4); vv(0.35,0.4); vv(0.35,-0.4); EP;
+  BP; vv(0.15,0.8); vv(0.95,0.0); vv(0.15,-0.8); EP;
+  BP; vv(-0.15,0.8); vv(-0.95,0.0); vv(-0.15,-0.8); EP;
+  set_outline_color(col);
+  BC; vv(-0.15,0.4); vv(0.15,0.4); vv(0.15,0.8); vv(0.95,0.0);
+      vv(0.15,-0.8); vv(0.15,-0.4); vv(-0.15,-0.4); vv(-0.15,-0.8);
+      vv(-0.95,0.0); vv(-0.15,0.8); EC;
+}
+
+static void draw_arrow(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(0.65,0.1); vv(1.0,0.0); vv(0.65,-0.1); EP;
+  BL; vv(-1.0,0.0); vv(0.65,0.0); EL;
+  set_outline_color(col);
+  BL; vv(-1.0,0.0); vv(0.65,0.0); EL;
+  BC; vv(0.65,0.1); vv(1.0,0.0); vv(0.65,-0.1); EC;
+}
+
+static void draw_square(fltk3::Color col)
+  { rectangle(-1,-1,1,1,col); }
+
+static void draw_circle(fltk3::Color col) {
+  fltk3::color(col); BP; fltk3::circle(0,0,1); EP;
+  set_outline_color(col);
+  BC; fltk3::circle(0,0,1); EC;
+}
+
+static void draw_line(fltk3::Color col)
+  { fltk3::color(col); BL; vv(-1.0,0.0); vv(1.0,0.0); EL; }
+
+static void draw_plus(fltk3::Color col)
+{
+  fltk3::color(col);
+  BP; vv(-0.9,-0.15); vv(-0.9,0.15); vv(0.9,0.15); vv(0.9,-0.15); EP;
+  BP; vv(-0.15,-0.9); vv(-0.15,0.9); vv(0.15,0.9); vv(0.15,-0.9); EP;
+  set_outline_color(col);
+  BC;
+  vv(-0.9,-0.15); vv(-0.9,0.15); vv(-0.15,0.15); vv(-0.15,0.9);
+  vv(0.15,0.9); vv(0.15,0.15); vv(0.9,0.15); vv(0.9,-0.15);
+  vv(0.15,-0.15); vv(0.15,-0.9); vv(-0.15,-0.9); vv(-0.15,-0.15);
+  EC;
+}
+
+static void draw_uparrow(fltk3::Color) {
+  fltk3::color(fltk3::LIGHT3);
+  BL; vv(-.8,.8); vv(-.8,-.8); vv(.8,0); EL;
+  fltk3::color(fltk3::DARK3);
+  BL; vv(-.8,.8); vv(.8, 0); EL;
+}
+
+static void draw_downarrow(fltk3::Color) {
+  fltk3::color(fltk3::DARK3);
+  BL; vv(-.8,.8); vv(-.8,-.8); vv(.8,0); EL;
+  fltk3::color(fltk3::LIGHT3);
+  BL; vv(-.8,.8); vv(.8, 0); EL;
+}
+
+static void draw_menu(fltk3::Color col)
+{
+  rectangle(-0.65, 0.85, 0.65, -0.25, col);
+  rectangle(-0.65, -0.6, 0.65, -1.0, col);
+}
+
+// Standard UI icons...
+static void draw_filenew(fltk3::Color c) {
+  fltk3::color(c);
+  BCP;
+    vv(-0.7, -1.0);
+    vv(0.1, -1.0);
+    vv(0.1, -0.4);
+    vv(0.7, -0.4);
+    vv(0.7, 1.0);
+    vv(-0.7, 1.0);
+  ECP;
+
+  fltk3::color(fltk3::lighter(c));
+  BP;
+    vv(0.1, -1.0);
+    vv(0.1, -0.4);
+    vv(0.7, -0.4);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(-0.7, -1.0);
+    vv(0.1, -1.0);
+    vv(0.1, -0.4);
+    vv(0.7, -0.4);
+    vv(0.7, 1.0);
+    vv(-0.7, 1.0);
+  EC;
+
+  BL;
+    vv(0.1, -1.0);
+    vv(0.7, -0.4);
+  EL;
+}
+
+static void draw_fileopen(fltk3::Color c) {
+  fltk3::color(c);
+  BP;
+    vv(-1.0, -0.7);
+    vv(-0.9, -0.8);
+    vv(-0.4, -0.8);
+    vv(-0.3, -0.7);
+    vv(0.6, -0.7);
+    vv(0.6, 0.7);
+    vv(-1.0, 0.7);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(-1.0, -0.7);
+    vv(-0.9, -0.8);
+    vv(-0.4, -0.8);
+    vv(-0.3, -0.7);
+    vv(0.6, -0.7);
+    vv(0.6, 0.7);
+    vv(-1.0, 0.7);
+  EC;
+
+  fltk3::color(fltk3::lighter(c));
+  BP;
+    vv(-1.0, 0.7);
+    vv(-0.6, -0.3);
+    vv(1.0, -0.3);
+    vv(0.6, 0.7);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(-1.0, 0.7);
+    vv(-0.6, -0.3);
+    vv(1.0, -0.3);
+    vv(0.6, 0.7);
+  EC;
+}
+
+static void draw_filesave(fltk3::Color c) {
+  fltk3::color(c);
+  BP;
+    vv(-0.9, -1.0);
+    vv(0.9, -1.0);
+    vv(1.0, -0.9);
+    vv(1.0, 0.9);
+    vv(0.9, 1.0);
+    vv(-0.9, 1.0);
+    vv(-1.0, 0.9);
+    vv(-1.0, -0.9);
+  EP;
+
+  fltk3::color(fltk3::lighter(c));
+  BP;
+    vv(-0.7, -1.0);
+    vv(0.7, -1.0);
+    vv(0.7, -0.4);
+    vv(-0.7, -0.4);
+  EP;
+
+  BP;
+    vv(-0.7, 0.0);
+    vv(0.7, 0.0);
+    vv(0.7, 1.0);
+    vv(-0.7, 1.0);
+  EP;
+
+  fltk3::color(c);
+  BP;
+    vv(-0.5, -0.9);
+    vv(-0.3, -0.9);
+    vv(-0.3, -0.5);
+    vv(-0.5, -0.5);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(-0.9, -1.0);
+    vv(0.9, -1.0);
+    vv(1.0, -0.9);
+    vv(1.0, 0.9);
+    vv(0.9, 1.0);
+    vv(-0.9, 1.0);
+    vv(-1.0, 0.9);
+    vv(-1.0, -0.9);
+  EC;
+}
+
+static void draw_filesaveas(fltk3::Color c) {
+  draw_filesave(c);
+
+  fltk3::color(fltk3::color_average(c, fltk3::WHITE, 0.25f));
+  BP;
+    vv(0.6, -0.8);
+    vv(1.0, -0.4);
+    vv(0.0, 0.6);
+    vv(-0.4, 0.6);
+    vv(-0.4, 0.2);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(0.6, -0.8);
+    vv(1.0, -0.4);
+    vv(0.0, 0.6);
+    vv(-0.4, 0.6);
+    vv(-0.4, 0.2);
+  EC;
+
+  BP;
+    vv(-0.1, 0.6);
+    vv(-0.4, 0.6);
+    vv(-0.4, 0.3);
+  EP;
+}
+
+static void draw_fileprint(fltk3::Color c) {
+  fltk3::color(c);
+  BP;
+    vv(-0.8, 0.0);
+    vv(0.8, 0.0);
+    vv(1.0, 0.2);
+    vv(1.0, 1.0);
+    vv(-1.0, 1.0);
+    vv(-1.0, 0.2);
+  EP;
+
+  fltk3::color(fltk3::color_average(c, fltk3::WHITE, 0.25f));
+  BP;
+    vv(-0.6, 0.0);
+    vv(-0.6, -1.0);
+    vv(0.6, -1.0);
+    vv(0.6, 0.0);
+  EP;
+
+  fltk3::color(fltk3::lighter(c));
+  BP;
+    vv(-0.6, 0.6);
+    vv(0.6, 0.6);
+    vv(0.6, 1.0);
+    vv(-0.6, 1.0);
+  EP;
+
+  fltk3::color(fltk3::darker(c));
+  BC;
+    vv(-0.8, 0.0);
+    vv(-0.6, 0.0);
+    vv(-0.6, -1.0);
+    vv(0.6, -1.0);
+    vv(0.6, 0.0);
+    vv(0.8, 0.0);
+    vv(1.0, 0.2);
+    vv(1.0, 1.0);
+    vv(-1.0, 1.0);
+    vv(-1.0, 0.2);
+  EC;
+
+  BC;
+    vv(-0.6, 0.6);
+    vv(0.6, 0.6);
+    vv(0.6, 1.0);
+    vv(-0.6, 1.0);
+  EC;
+}
+
+static void draw_round_arrow(fltk3::Color c, float da=5.0) {
+  double a, r, dr1=0.005, dr2=0.015;
+  int i, j;
+  for (j=0; j<2; j++) {
+    if (j&1) {
+      fltk3::color(c);
+      set_outline_color(c);
+      BC;
+    } else {
+      fltk3::color(c);
+      BCP;
+    }
+    vv(-0.1, 0.0);
+    vv(-1.0, 0.0);
+    vv(-1.0, 0.9);
+    for (i=27, a=140.0, r=1.0; i>0; i--, a-=da, r-=dr1) {
+      double ar = a/180.0 * M_PI;
+      vv(cos(ar)*r, sin(ar)*r);
+    }
+    for (i=27; i>=0; a+=da, i--, r-=dr2) {
+      double ar = a/180.0 * M_PI;
+      vv(cos(ar)*r, sin(ar)*r);
+    }
+    if (j&1) {
+      EC;
+    } else {
+      ECP;
+    }
+  }
+}
+
+static void draw_refresh(fltk3::Color c) {
+  draw_round_arrow(c);
+  fltk3::rotate(180.0);
+  draw_round_arrow(c);
+  fltk3::rotate(-180.0);
+}
+
+static void draw_reload(fltk3::Color c) {
+  fltk3::rotate(-135.0);
+  draw_round_arrow(c, 10);
+  fltk3::rotate(135.0);
+}
+
+static void draw_undo(fltk3::Color c) {
+  fltk3::translate(0.0, 0.2);
+  fltk3::scale(1.0, -1.0);
+  draw_round_arrow(c, 6);
+  fltk3::scale(1.0, -1.0);
+  fltk3::translate(0.0, -0.2);
+}
+
+static void draw_redo(fltk3::Color c) {
+  fltk3::scale(-1.0, 1.0);
+  draw_undo(c);
+  fltk3::scale(-1.0, 1.0);
+}
+
+static void fl_init_symbols(void) {
+  static char beenhere;
+  if (beenhere) return;
+  beenhere = 1;
+  symbnumb = 0;
+
+  fltk3::add_symbol("",		draw_arrow1,		1);
+  fltk3::add_symbol("->",		draw_arrow1,		1);
+  fltk3::add_symbol(">",		draw_arrow2,		1);
+  fltk3::add_symbol(">>",		draw_arrow3,		1);
+  fltk3::add_symbol(">|",		draw_arrowbar,		1);
+  fltk3::add_symbol(">[]",		draw_arrowbox,		1);
+  fltk3::add_symbol("|>",		draw_bararrow,		1);
+  fltk3::add_symbol("<-",		draw_arrow01,		1);
+  fltk3::add_symbol("<",		draw_arrow02,		1);
+  fltk3::add_symbol("<<",		draw_arrow03,		1);
+  fltk3::add_symbol("|<",		draw_0arrowbar,		1);
+  fltk3::add_symbol("[]<",		draw_0arrowbox,		1);
+  fltk3::add_symbol("<|",		draw_0bararrow,		1);
+  fltk3::add_symbol("<->",		draw_doublearrow,	1);
+  fltk3::add_symbol("-->",		draw_arrow,		1);
+  fltk3::add_symbol("+",		draw_plus,		1);
+  fltk3::add_symbol("->|",		draw_arrow1bar,		1);
+  fltk3::add_symbol("arrow",	draw_arrow,		1);
+  fltk3::add_symbol("returnarrow",	0,			3);
+  fltk3::add_symbol("square",	draw_square,		1);
+  fltk3::add_symbol("circle",	draw_circle,		1);
+  fltk3::add_symbol("line",		draw_line,		1);
+  fltk3::add_symbol("plus",		draw_plus,		1);
+  fltk3::add_symbol("menu",		draw_menu,		1);
+  fltk3::add_symbol("UpArrow",	draw_uparrow,		1);
+  fltk3::add_symbol("DnArrow",	draw_downarrow,		1);
+  fltk3::add_symbol("||",		draw_doublebar,		1);
+  fltk3::add_symbol("search",       draw_search,            1);
+  fltk3::add_symbol("FLTK",         draw_fltk,              1);
+
+  fltk3::add_symbol("filenew",      draw_filenew,           1);
+  fltk3::add_symbol("fileopen",     draw_fileopen,          1);
+  fltk3::add_symbol("filesave",     draw_filesave,          1);
+  fltk3::add_symbol("filesaveas",   draw_filesaveas,        1);
+  fltk3::add_symbol("fileprint",    draw_fileprint,         1);
+
+  fltk3::add_symbol("refresh",      draw_refresh,           1);
+  fltk3::add_symbol("reload",       draw_reload,            1);
+  fltk3::add_symbol("undo",         draw_undo,              1);
+  fltk3::add_symbol("redo",         draw_redo,              1);
+
+//  fltk3::add_symbol("file",      draw_file,           1);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/tile.xpm (from rev 9002, branches/branch-3.0/src/core/tile.xpm)
===================================================================
--- branches/branch-3.0/src/fltk3/tile.xpm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/tile.xpm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,91 @@
+/* XPM */
+static char	tile_cmap[3][32] = {
+"O c #FFFFFF",
+"o c #EFEFEF",
+". c #E8E8E8"
+};
+static const char * tile_xpm[] = {
+"64 64 3 1",
+tile_cmap[0],
+tile_cmap[1],
+tile_cmap[2],
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO",
+
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"................................................................",
+"oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo",
+"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO"};

Copied: branches/branch-3.0/src/fltk3/up.xbm (from rev 9002, branches/branch-3.0/src/core/up.xbm)
===================================================================
--- branches/branch-3.0/src/fltk3/up.xbm	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/up.xbm	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,6 @@
+#define up_width 16
+#define up_height 16
+static unsigned char up_bits[] = {
+   0x00, 0x00, 0x78, 0x00, 0x84, 0x00, 0x02, 0x01, 0x31, 0xfe, 0x79, 0x80,
+   0xfd, 0x80, 0x31, 0x80, 0x31, 0x80, 0x31, 0x80, 0x31, 0x80, 0x31, 0x80,
+   0x01, 0x80, 0x01, 0x80, 0xff, 0xff, 0x00, 0x00};

Copied: branches/branch-3.0/src/fltk3/utf.cxx (from rev 9002, branches/branch-3.0/src/core/fl_utf.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/utf.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/utf.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,995 @@
+/*
+ * "$Id$"
+ *
+ * This is the utf.c file from fltk2 adapted for use in my fltk1.1 port
+ */
+/* Copyright 2006-2011 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+/* Modified to obey rfc3629, which limits unicode to 0-0x10ffff */
+
+#include <fltk3/utf8.h>
+#include <string.h>
+#include <stdlib.h>
+
+/** \addtogroup fl_unicode
+    @{
+*/
+
+
+#if 0
+  /**
+   \defgroup fl_unichar Unicode Character Functions
+   Global Functions Handling Single Unicode Characters
+   @{ */
+
+  /**
+   Converts a Unicode character into a utf-8 sequence.
+   \param[in] uc Unicode character
+   \param[out] text utf-8 sequence will be written here; if this pointer is
+   \c NULL, only the length of the utf-8 sequence is calculated
+   \return length of the sequence in bytes
+   */
+  /* FLTK3_EXPORT int fl_unichar_to_utf8(unsigned int uc, char *text); */
+
+  /** @} */
+
+  /**
+   \defgroup fl_utf8 Unicode String Functions
+   Global Functions Handling Unicode Text
+   @{ */
+
+  /**
+   Calculate the size of a utf-8 sequence for a Unicode character.
+   \param[in] uc Unicode character
+   \return length of the sequence in bytes
+   */
+  /* FLTK3_EXPORT int fl_utf8_size(unsigned int uc); */
+
+  /** @} */
+#endif /* 0 */
+
+/*!Set to 1 to turn bad UTF8 bytes into ISO-8859-1. If this is to zero
+   they are instead turned into the Unicode REPLACEMENT CHARACTER, of
+   value 0xfffd.
+   If this is on fltk3::utf8decode() will correctly map most (perhaps all)
+   human-readable text that is in ISO-8859-1. This may allow you
+   to completely ignore character sets in your code because virtually
+   everything is either ISO-8859-1 or UTF-8.
+*/
+#define ERRORS_TO_ISO8859_1 1
+
+/*!Set to 1 to turn bad UTF8 bytes in the 0x80-0x9f range into the
+   Unicode index for Microsoft's CP1252 character set. You should
+   also set ERRORS_TO_ISO8859_1. With this a huge amount of more
+   available text (such as all web pages) are correctly converted
+   to Unicode.
+*/
+#define ERRORS_TO_CP1252 1
+
+/*!A number of Unicode code points are in fact illegal and should not
+   be produced by a UTF-8 converter. Turn this on will replace the
+   bytes in those encodings with errors. If you do this then converting
+   arbitrary 16-bit data to UTF-8 and then back is not an identity,
+   which will probably break a lot of software.
+*/
+#define STRICT_RFC3629 0
+
+#if ERRORS_TO_CP1252
+/* Codes 0x80..0x9f from the Microsoft CP1252 character set, translated
+ * to Unicode:
+ */
+static unsigned short cp1252[32] = {
+  0x20ac, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
+  0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x017d, 0x008f,
+  0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
+  0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x017e, 0x0178
+};
+#endif
+
+/*! Decode a single UTF-8 encoded character starting at \e p. The
+    resulting Unicode value (in the range 0-0x10ffff) is returned,
+    and \e len is set to the number of bytes in the UTF-8 encoding
+    (adding \e len to \e p will point at the next character).
+
+    If \p p points at an illegal UTF-8 encoding, including one that
+    would go past \e end, or where a code is uses more bytes than
+    necessary, then *(unsigned char*)p is translated as though it is
+    in the Microsoft CP1252 character set and \e len is set to 1.
+    Treating errors this way allows this to decode almost any
+    ISO-8859-1 or CP1252 text that has been mistakenly placed where
+    UTF-8 is expected, and has proven very useful.
+
+    If you want errors to be converted to error characters (as the
+    standards recommend), adding a test to see if the length is
+    unexpectedly 1 will work:
+
+    \code
+    if (*p & 0x80) {              // what should be a multibyte encoding
+      code = fltk3::utf8decode(p,end,&len);
+      if (len<2) code = 0xFFFD;   // Turn errors into REPLACEMENT CHARACTER
+    } else {                      // handle the 1-byte utf8 encoding:
+      code = *p;
+      len = 1;
+    }
+    \endcode
+
+    Direct testing for the 1-byte case (as shown above) will also
+    speed up the scanning of strings where the majority of characters
+    are ASCII.
+*/
+unsigned fltk3::utf8decode(const char* p, const char* end, int* len)
+{
+  unsigned char c = *(unsigned char*)p;
+  if (c < 0x80) {
+    if (len) *len = 1;
+    return c;
+#if ERRORS_TO_CP1252
+  } else if (c < 0xa0) {
+    if (len) *len = 1;
+    return cp1252[c-0x80];
+#endif
+  } else if (c < 0xc2) {
+    goto FAIL;
+  }
+  if ( (end && p+1 >= end) || (p[1]&0xc0) != 0x80) goto FAIL;
+  if (c < 0xe0) {
+    if (len) *len = 2;
+    return
+      ((p[0] & 0x1f) << 6) +
+      ((p[1] & 0x3f));
+  } else if (c == 0xe0) {
+    if (((unsigned char*)p)[1] < 0xa0) goto FAIL;
+    goto UTF8_3;
+#if STRICT_RFC3629
+  } else if (c == 0xed) {
+    /* RFC 3629 says surrogate chars are illegal. */
+    if (((unsigned char*)p)[1] >= 0xa0) goto FAIL;
+    goto UTF8_3;
+  } else if (c == 0xef) {
+    /* 0xfffe and 0xffff are also illegal characters */
+    if (((unsigned char*)p)[1]==0xbf &&
+	((unsigned char*)p)[2]>=0xbe) goto FAIL;
+    goto UTF8_3;
+#endif
+  } else if (c < 0xf0) {
+  UTF8_3:
+    if ( (end && p+2 >= end) || (p[2]&0xc0) != 0x80) goto FAIL;
+    if (len) *len = 3;
+    return
+      ((p[0] & 0x0f) << 12) +
+      ((p[1] & 0x3f) << 6) +
+      ((p[2] & 0x3f));
+  } else if (c == 0xf0) {
+    if (((unsigned char*)p)[1] < 0x90) goto FAIL;
+    goto UTF8_4;
+  } else if (c < 0xf4) {
+  UTF8_4:
+    if ( (end && p+3 >= end) || (p[2]&0xc0) != 0x80 || (p[3]&0xc0) != 0x80) goto FAIL;
+    if (len) *len = 4;
+#if STRICT_RFC3629
+    /* RFC 3629 says all codes ending in fffe or ffff are illegal: */
+    if ((p[1]&0xf)==0xf &&
+	((unsigned char*)p)[2] == 0xbf &&
+	((unsigned char*)p)[3] >= 0xbe) goto FAIL;
+#endif
+    return
+      ((p[0] & 0x07) << 18) +
+      ((p[1] & 0x3f) << 12) +
+      ((p[2] & 0x3f) << 6) +
+      ((p[3] & 0x3f));
+  } else if (c == 0xf4) {
+    if (((unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
+    goto UTF8_4;
+  } else {
+  FAIL:
+    if (len) *len = 1;
+#if ERRORS_TO_ISO8859_1
+    return c;
+#else
+    return 0xfffd; /* Unicode REPLACEMENT CHARACTER */
+#endif
+  }
+}
+
+/*! Move \p p forward until it points to the start of a UTF-8
+  character. If it already points at the start of one then it
+  is returned unchanged. Any UTF-8 errors are treated as though each
+  byte of the error is an individual character.
+
+  \e start is the start of the string and is used to limit the
+  backwards search for the start of a utf8 character.
+
+  \e end is the end of the string and is assumed to be a break
+  between characters. It is assumed to be greater than p.
+
+  This function is for moving a pointer that was jumped to the
+  middle of a string, such as when doing a binary search for
+  a position. You should use either this or fltk3::utf8back() depending
+  on which direction your algorithim can handle the pointer
+  moving. Do not use this to scan strings, use fltk3::utf8decode()
+  instead.
+*/
+const char* fltk3::utf8fwd(const char* p, const char* start, const char* end)
+{
+  const char* a;
+  int len;
+  /* if we are not pointing at a continuation character, we are done: */
+  if ((*p&0xc0) != 0x80) return p;
+  /* search backwards for a 0xc0 starting the character: */
+  for (a = p-1; ; --a) {
+    if (a < start) return p;
+    if (!(a[0]&0x80)) return p;
+    if ((a[0]&0x40)) break;
+  }
+  fltk3::utf8decode(a,end,&len);
+  a += len;
+  if (a > p) return a;
+  return p;
+}
+
+/*! Move \p p backward until it points to the start of a UTF-8
+  character. If it already points at the start of one then it
+  is returned unchanged. Any UTF-8 errors are treated as though each
+  byte of the error is an individual character.
+
+  \e start is the start of the string and is used to limit the
+  backwards search for the start of a UTF-8 character.
+
+  \e end is the end of the string and is assumed to be a break
+  between characters. It is assumed to be greater than p.
+
+  If you wish to decrement a UTF-8 pointer, pass p-1 to this.
+*/
+const char* fltk3::utf8back(const char* p, const char* start, const char* end)
+{
+  const char* a;
+  int len;
+  /* if we are not pointing at a continuation character, we are done: */
+  if ((*p&0xc0) != 0x80) return p;
+  /* search backwards for a 0xc0 starting the character: */
+  for (a = p-1; ; --a) {
+    if (a < start) return p;
+    if (!(a[0]&0x80)) return p;
+    if ((a[0]&0x40)) break;
+  }
+  fltk3::utf8decode(a,end,&len);
+  if (a+len > p) return a;
+  return p;
+}
+
+/*! Returns number of bytes that utf8encode() will use to encode the
+  character \p ucs. */
+int fltk3::utf8bytes(unsigned ucs) {
+  if (ucs < 0x000080U) {
+    return 1;
+  } else if (ucs < 0x000800U) {
+    return 2;
+  } else if (ucs < 0x010000U) {
+    return 3;
+  } else if (ucs <= 0x10ffffU) {
+    return 4;
+  } else {
+    return 3; /* length of the illegal character encoding */
+  }
+}
+
+/*! Write the UTF-8 encoding of \e ucs into \e buf and return the
+    number of bytes written. Up to 4 bytes may be written. If you know
+    that \p ucs is less than 0x10000 then at most 3 bytes will be written.
+    If you wish to speed this up, remember that anything less than 0x80
+    is written as a single byte.
+
+    If ucs is greater than 0x10ffff this is an illegal character
+    according to RFC 3629. These are converted as though they are
+    0xFFFD (REPLACEMENT CHARACTER).
+
+    RFC 3629 also says many other values for \p ucs are illegal (in
+    the range 0xd800 to 0xdfff, or ending with 0xfffe or
+    0xffff). However I encode these as though they are legal, so that
+    utf8encode/fltk3::utf8decode will be the identity for all codes between 0
+    and 0x10ffff.
+*/
+int fltk3::utf8encode(unsigned ucs, char* buf) {
+  if (ucs < 0x000080U) {
+    buf[0] = ucs;
+    return 1;
+  } else if (ucs < 0x000800U) {
+    buf[0] = 0xc0 | (ucs >> 6);
+    buf[1] = 0x80 | (ucs & 0x3F);
+    return 2;
+  } else if (ucs < 0x010000U) {
+    buf[0] = 0xe0 | (ucs >> 12);
+    buf[1] = 0x80 | ((ucs >> 6) & 0x3F);
+    buf[2] = 0x80 | (ucs & 0x3F);
+    return 3;
+  } else if (ucs <= 0x0010ffffU) {
+    buf[0] = 0xf0 | (ucs >> 18);
+    buf[1] = 0x80 | ((ucs >> 12) & 0x3F);
+    buf[2] = 0x80 | ((ucs >> 6) & 0x3F);
+    buf[3] = 0x80 | (ucs & 0x3F);
+    return 4;
+  } else {
+    /* encode 0xfffd: */
+    buf[0] = 0xefU;
+    buf[1] = 0xbfU;
+    buf[2] = 0xbdU;
+    return 3;
+  }
+}
+
+/*! Convert a single 32-bit Unicode codepoint into an array of 16-bit
+    characters. These are used by some system calls, especially on Windows.
+
+    \p ucs is the value to convert.
+
+    \p dst points at an array to write, and \p dstlen is the number of
+    locations in this array. At most \p dstlen words will be
+    written, and a 0 terminating word will be added if \p dstlen is
+    large enough. Thus this function will never overwrite the buffer
+    and will attempt return a zero-terminated string if space permits.
+    If \p dstlen is zero then \p dst can be set to NULL and no data
+    is written, but the length is returned.
+
+    The return value is the number of 16-bit words that \e would be written
+    to \p dst if it is large enough, not counting any terminating
+    zero.
+
+    If the return value is greater than \p dstlen it indicates truncation,
+    you should then allocate a new array of size return+1 and call this again.
+
+    Unicode characters in the range 0x10000 to 0x10ffff are converted to
+    "surrogate pairs" which take two words each (in UTF-16 encoding).
+    Typically, setting \p dstlen to 2 will ensure that any valid Unicode
+    value can be converted, and setting \p dstlen to 3 or more will allow
+    a NULL terminated sequence to be returned.
+*/
+unsigned fltk3::ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen)
+{
+  /* The rule for direct conversion from UCS to UTF16 is:
+   * - if UCS >  0x0010FFFF then UCS is invalid
+   * - if UCS >= 0xD800 && UCS <= 0xDFFF UCS is invalid
+   * - if UCS <= 0x0000FFFF then U16 = UCS, len = 1
+   * - else
+   * -- U16[0] = ((UCS - 0x00010000) >> 10) & 0x3FF + 0xD800
+   * -- U16[1] = (UCS & 0x3FF) + 0xDC00
+   * -- len = 2;
+   */
+  unsigned count;        /* Count of converted UTF16 cells */
+  unsigned short u16[4]; /* Alternate buffer if dst is not set */
+  unsigned short *out;   /* points to the active buffer */
+  /* Ensure we have a valid buffer to write to */
+  if((!dstlen) || (!dst)) {
+    out = u16;
+  } else {
+    out = dst;
+  }
+  /* Convert from UCS to UTF16 */
+  if((ucs > 0x0010FFFF) || /* UCS is too large */
+  ((ucs > 0xD7FF) && (ucs < 0xE000))) { /* UCS in invalid range */
+    out[0] = 0xFFFD; /* REPLACEMENT CHARACTER */
+    count = 1;
+  } else if(ucs < 0x00010000) {
+    out[0] = (unsigned short)ucs;
+    count = 1;
+  } else if(dstlen < 2) { /* dst is too small for the result */
+    out[0] = 0xFFFD; /* REPLACEMENT CHARACTER */
+    count = 2;
+  } else {
+    out[0] = (((ucs - 0x00010000) >> 10) & 0x3FF) + 0xD800;
+    out[1] = (ucs & 0x3FF) + 0xDC00;
+    count = 2;
+  }
+  /* NULL terminate the output, if there is space */
+  if(count < dstlen) { out[count] = 0; }
+  return count;
+} /* fltk3::ucs_to_Utf16 */
+
+/*! Convert a UTF-8 sequence into an array of 16-bit characters. These
+    are used by some system calls, especially on Windows.
+
+    \p src points at the UTF-8, and \p srclen is the number of bytes to
+    convert.
+
+    \p dst points at an array to write, and \p dstlen is the number of
+    locations in this array. At most \p dstlen-1 words will be
+    written there, plus a 0 terminating word. Thus this function
+    will never overwrite the buffer and will always return a
+    zero-terminated string. If \p dstlen is zero then \p dst can be
+    null and no data is written, but the length is returned.
+
+    The return value is the number of 16-bit words that \e would be written
+    to \p dst if it were long enough, not counting the terminating
+    zero. If the return value is greater or equal to \p dstlen it
+    indicates truncation, you can then allocate a new array of size
+    return+1 and call this again.
+
+    Errors in the UTF-8 are converted as though each byte in the
+    erroneous string is in the Microsoft CP1252 encoding. This allows
+    ISO-8859-1 text mistakenly identified as UTF-8 to be printed
+    correctly.
+
+    Unicode characters in the range 0x10000 to 0x10ffff are converted to
+    "surrogate pairs" which take two words each (this is called UTF-16
+    encoding).
+*/
+unsigned fltk3::utf8toUtf16(const char* src, unsigned srclen,
+		  unsigned short* dst, unsigned dstlen)
+{
+  const char* p = src;
+  const char* e = src+srclen;
+  unsigned count = 0;
+  if (dstlen) for (;;) {
+    if (p >= e) {dst[count] = 0; return count;}
+    if (!(*p & 0x80)) { /* ascii */
+      dst[count] = *p++;
+    } else {
+      int len; unsigned ucs = fltk3::utf8decode(p,e,&len);
+      p += len;
+      if (ucs < 0x10000) {
+	dst[count] = ucs;
+      } else {
+	/* make a surrogate pair: */
+	if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
+	dst[count] = (((ucs-0x10000u)>>10)&0x3ff) | 0xd800;
+	dst[++count] = (ucs&0x3ff) | 0xdc00;
+      }
+    }
+    if (++count == dstlen) {dst[count-1] = 0; break;}
+  }
+  /* we filled dst, measure the rest: */
+  while (p < e) {
+    if (!(*p & 0x80)) p++;
+    else {
+      int len; unsigned ucs = fltk3::utf8decode(p,e,&len);
+      p += len;
+      if (ucs >= 0x10000) ++count;
+    }
+    ++count;
+  }
+  return count;
+}
+
+
+/**
+  Converts a UTF-8 string into a wide character string.
+
+  This function generates 32-bit wchar_t (e.g. "ucs4" as it were) except
+  on Windows where it is equivalent to fltk3::utf8toUtf16 and returns
+  UTF-16.
+
+  \p src points at the UTF-8, and \p srclen is the number of bytes to
+  convert.
+
+  \p dst points at an array to write, and \p dstlen is the number of
+  locations in this array. At most \p dstlen-1 wchar_t will be
+  written there, plus a 0 terminating wchar_t.
+
+  The return value is the number of wchar_t that \e would be written
+  to \p dst if it were long enough, not counting the terminating
+  zero. If the return value is greater or equal to \p dstlen it
+  indicates truncation, you can then allocate a new array of size
+  return+1 and call this again.
+
+  Notice that sizeof(wchar_t) is 2 on Windows and is 4 on Linux
+  and most other systems. Where wchar_t is 16 bits, Unicode
+  characters in the range 0x10000 to 0x10ffff are converted to
+  "surrogate pairs" which take two words each (this is called UTF-16
+  encoding). If wchar_t is 32 bits this rather nasty problem is
+  avoided.
+
+  Note that Windows includes Cygwin, i.e. compiled with Cygwin's POSIX
+  layer (cygwin1.dll, --enable-cygwin), either native (GDI) or X11.
+  */
+unsigned fltk3::utf8towc(const char* src, unsigned srclen,
+		  wchar_t* dst, unsigned dstlen)
+{
+#if defined(WIN32) || defined(__CYGWIN__)
+  return fltk3::utf8toUtf16(src, srclen, (unsigned short*)dst, dstlen);
+#else
+  const char* p = src;
+  const char* e = src+srclen;
+  unsigned count = 0;
+  if (dstlen) for (;;) {
+    if (p >= e) {
+      dst[count] = 0;
+      return count;
+    }
+    if (!(*p & 0x80)) { /* ascii */
+      dst[count] = *p++;
+    } else {
+      int len; unsigned ucs = fltk3::utf8decode(p,e,&len);
+      p += len;
+      dst[count] = (wchar_t)ucs;
+    }
+    if (++count == dstlen) {dst[count-1] = 0; break;}
+  }
+  /* we filled dst, measure the rest: */
+  while (p < e) {
+    if (!(*p & 0x80)) p++;
+    else {
+      int len; fltk3::utf8decode(p,e,&len);
+      p += len;
+    }
+    ++count;
+  }
+  return count;
+#endif
+}
+
+/*! Convert a UTF-8 sequence into an array of 1-byte characters.
+
+    If the UTF-8 decodes to a character greater than 0xff then it is
+    replaced with '?'.
+
+    Errors in the UTF-8 are converted as individual bytes, same as
+    fltk3::utf8decode() does. This allows ISO-8859-1 text mistakenly identified
+    as UTF-8 to be printed correctly (and possibly CP1512 on Windows).
+
+    \p src points at the UTF-8, and \p srclen is the number of bytes to
+    convert.
+
+    Up to \p dstlen bytes are written to \p dst, including a null
+    terminator. The return value is the number of bytes that would be
+    written, not counting the null terminator. If greater or equal to
+    \p dstlen then if you malloc a new array of size n+1 you will have
+    the space needed for the entire string. If \p dstlen is zero then
+    nothing is written and this call just measures the storage space
+    needed.
+*/
+unsigned fltk3::utf8toa(const char* src, unsigned srclen,
+		 char* dst, unsigned dstlen)
+{
+  const char* p = src;
+  const char* e = src+srclen;
+  unsigned count = 0;
+  if (dstlen) for (;;) {
+    unsigned char c;
+    if (p >= e) {dst[count] = 0; return count;}
+    c = *(unsigned char*)p;
+    if (c < 0xC2) { /* ascii or bad code */
+      dst[count] = c;
+      p++;
+    } else {
+      int len; unsigned ucs = fltk3::utf8decode(p,e,&len);
+      p += len;
+      if (ucs < 0x100) dst[count] = ucs;
+      else dst[count] = '?';
+    }
+    if (++count >= dstlen) {dst[count-1] = 0; break;}
+  }
+  /* we filled dst, measure the rest: */
+  while (p < e) {
+    if (!(*p & 0x80)) p++;
+    else {
+      int len;
+      fltk3::utf8decode(p,e,&len);
+      p += len;
+    }
+    ++count;
+  }
+  return count;
+}
+
+/*! Turn "wide characters" as returned by some system calls
+    (especially on Windows) into UTF-8.
+
+    Up to \p dstlen bytes are written to \p dst, including a null
+    terminator. The return value is the number of bytes that would be
+    written, not counting the null terminator. If greater or equal to
+    \p dstlen then if you malloc a new array of size n+1 you will have
+    the space needed for the entire string. If \p dstlen is zero then
+    nothing is written and this call just measures the storage space
+    needed.
+
+    \p srclen is the number of words in \p src to convert. On Windows
+    this is not necessarily the number of characters, due to there
+    possibly being "surrogate pairs" in the UTF-16 encoding used.
+    On Unix wchar_t is 32 bits and each location is a character.
+
+    On Unix if a \p src word is greater than 0x10ffff then this is an
+    illegal character according to RFC 3629. These are converted as
+    though they are 0xFFFD (REPLACEMENT CHARACTER). Characters in the
+    range 0xd800 to 0xdfff, or ending with 0xfffe or 0xffff are also
+    illegal according to RFC 3629. However I encode these as though
+    they are legal, so that fltk3::utf8towc will return the original data.
+
+    On Windows "surrogate pairs" are converted to a single character
+    and UTF-8 encoded (as 4 bytes). Mismatched halves of surrogate
+    pairs are converted as though they are individual characters.
+*/
+unsigned fltk3::utf8fromwc(char* dst, unsigned dstlen,
+		    const wchar_t* src, unsigned srclen) {
+  unsigned i = 0;
+  unsigned count = 0;
+  if (dstlen) for (;;) {
+    unsigned ucs;
+    if (i >= srclen) {dst[count] = 0; return count;}
+    ucs = src[i++];
+    if (ucs < 0x80U) {
+      dst[count++] = ucs;
+      if (count >= dstlen) {dst[count-1] = 0; break;}
+    } else if (ucs < 0x800U) { /* 2 bytes */
+      if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
+      dst[count++] = 0xc0 | (ucs >> 6);
+      dst[count++] = 0x80 | (ucs & 0x3F);
+#if defined(WIN32) || defined(__CYGWIN__)
+    } else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen &&
+	       src[i] >= 0xdc00 && src[i] <= 0xdfff) {
+      /* surrogate pair */
+      unsigned ucs2 = src[i++];
+      ucs = 0x10000U + ((ucs&0x3ff)<<10) + (ucs2&0x3ff);
+      /* all surrogate pairs turn into 4-byte utf8 */
+#else
+    } else if (ucs >= 0x10000) {
+      if (ucs > 0x10ffff) {
+	ucs = 0xfffd;
+	goto J1;
+      }
+#endif
+      if (count+4 >= dstlen) {dst[count] = 0; count += 4; break;}
+      dst[count++] = 0xf0 | (ucs >> 18);
+      dst[count++] = 0x80 | ((ucs >> 12) & 0x3F);
+      dst[count++] = 0x80 | ((ucs >> 6) & 0x3F);
+      dst[count++] = 0x80 | (ucs & 0x3F);
+    } else {
+#if !(defined(WIN32) || defined(__CYGWIN__))
+    J1:
+#endif
+      /* all others are 3 bytes: */
+      if (count+3 >= dstlen) {dst[count] = 0; count += 3; break;}
+      dst[count++] = 0xe0 | (ucs >> 12);
+      dst[count++] = 0x80 | ((ucs >> 6) & 0x3F);
+      dst[count++] = 0x80 | (ucs & 0x3F);
+    }
+  }
+  /* we filled dst, measure the rest: */
+  while (i < srclen) {
+    unsigned ucs = src[i++];
+    if (ucs < 0x80U) {
+      count++;
+    } else if (ucs < 0x800U) { /* 2 bytes */
+      count += 2;
+#if defined(WIN32) || defined(__CYGWIN__)
+    } else if (ucs >= 0xd800 && ucs <= 0xdbff && i < srclen-1 &&
+	       src[i+1] >= 0xdc00 && src[i+1] <= 0xdfff) {
+      /* surrogate pair */
+      ++i;
+#else
+    } else if (ucs >= 0x10000 && ucs <= 0x10ffff) {
+#endif
+      count += 4;
+    } else {
+      count += 3;
+    }
+  }
+  return count;
+}
+
+/*! Convert an ISO-8859-1 (ie normal c-string) byte stream to UTF-8.
+
+    It is possible this should convert Microsoft's CP1252 to UTF-8
+    instead. This would translate the codes in the range 0x80-0x9f
+    to different characters. Currently it does not do this.
+
+    Up to \p dstlen bytes are written to \p dst, including a null
+    terminator. The return value is the number of bytes that would be
+    written, not counting the null terminator. If greater or equal to
+    \p dstlen then if you malloc a new array of size n+1 you will have
+    the space needed for the entire string. If \p dstlen is zero then
+    nothing is written and this call just measures the storage space
+    needed.
+
+    \p srclen is the number of bytes in \p src to convert.
+
+    If the return value equals \p srclen then this indicates that
+    no conversion is necessary, as only ASCII characters are in the
+    string.
+*/
+unsigned fltk3::utf8froma(char* dst, unsigned dstlen,
+		   const char* src, unsigned srclen) {
+  const char* p = src;
+  const char* e = src+srclen;
+  unsigned count = 0;
+  if (dstlen) for (;;) {
+    unsigned char ucs;
+    if (p >= e) {dst[count] = 0; return count;}
+    ucs = *(unsigned char*)p++;
+    if (ucs < 0x80U) {
+      dst[count++] = ucs;
+      if (count >= dstlen) {dst[count-1] = 0; break;}
+    } else { /* 2 bytes (note that CP1252 translate could make 3 bytes!) */
+      if (count+2 >= dstlen) {dst[count] = 0; count += 2; break;}
+      dst[count++] = 0xc0 | (ucs >> 6);
+      dst[count++] = 0x80 | (ucs & 0x3F);
+    }
+  }
+  /* we filled dst, measure the rest: */
+  while (p < e) {
+    unsigned char ucs = *(unsigned char*)p++;
+    if (ucs < 0x80U) {
+      count++;
+    } else {
+      count += 2;
+    }
+  }
+  return count;
+}
+
+#ifdef WIN32
+# include <windows.h>
+#endif
+
+/*! Return true if the "locale" seems to indicate that UTF-8 encoding
+    is used. If true the fltk3::utf8to_mb and fltk3::utf8from_mb don't do anything
+    useful.
+
+    <i>It is highly recommended that you change your system so this
+    does return true.</i> On Windows this is done by setting the
+    "codepage" to CP_UTF8.  On Unix this is done by setting $LC_CTYPE
+    to a string containing the letters "utf" or "UTF" in it, or by
+    deleting all $LC* and $LANG environment variables. In the future
+    it is likely that all non-Asian Unix systems will return true,
+    due to the compatibility of UTF-8 with ISO-8859-1.
+*/
+int fltk3::utf8locale(void) {
+  static int ret = 2;
+  if (ret == 2) {
+#ifdef WIN32
+    ret = GetACP() == CP_UTF8;
+#else
+    char* s;
+    ret = 1; /* assume UTF-8 if no locale */
+    if (((s = getenv("LC_CTYPE")) && *s) ||
+	((s = getenv("LC_ALL"))   && *s) ||
+	((s = getenv("LANG"))     && *s)) {
+      ret = (strstr(s,"utf") || strstr(s,"UTF"));
+    }
+#endif
+  }
+  return ret;
+}
+
+/*! Convert the UTF-8 used by FLTK to the locale-specific encoding
+    used for filenames (and sometimes used for data in files).
+    Unfortunately due to stupid design you will have to do this as
+    needed for filenames. This is a bug on both Unix and Windows.
+
+    Up to \p dstlen bytes are written to \p dst, including a null
+    terminator. The return value is the number of bytes that would be
+    written, not counting the null terminator. If greater or equal to
+    \p dstlen then if you malloc a new array of size n+1 you will have
+    the space needed for the entire string. If \p dstlen is zero then
+    nothing is written and this call just measures the storage space
+    needed.
+
+    If fltk3::utf8locale() returns true then this does not change the data.
+*/
+unsigned fltk3::utf8to_mb(const char* src, unsigned srclen,
+		  char* dst, unsigned dstlen)
+{
+  if (!fltk3::utf8locale()) {
+#ifdef WIN32
+    wchar_t lbuf[1024];
+    wchar_t* buf = lbuf;
+    unsigned length = fltk3::utf8towc(src, srclen, buf, 1024);
+    unsigned ret;
+    if (length >= 1024) {
+      buf = (wchar_t*)(malloc((length+1)*sizeof(wchar_t)));
+      fltk3::utf8towc(src, srclen, buf, length+1);
+    }
+    if (dstlen) {
+      /* apparently this does not null-terminate, even though msdn
+       * documentation claims it does:
+       */
+      ret =
+        WideCharToMultiByte(GetACP(), 0, buf, length, dst, dstlen, 0, 0);
+      dst[ret] = 0;
+    }
+    /* if it overflows or measuring length, get the actual length: */
+    if (dstlen==0 || ret >= dstlen-1)
+      ret =
+	WideCharToMultiByte(GetACP(), 0, buf, length, 0, 0, 0, 0);
+    if (buf != lbuf) free((void*)buf);
+    return ret;
+#else
+    wchar_t lbuf[1024];
+    wchar_t* buf = lbuf;
+    unsigned length = fltk3::utf8towc(src, srclen, buf, 1024);
+    unsigned ret;
+    if (length >= 1024) {
+      buf = (wchar_t*)(malloc((length+1)*sizeof(wchar_t)));
+      fltk3::utf8towc(src, srclen, buf, length+1);
+    }
+    if (dstlen) {
+      ret = wcstombs(dst, buf, dstlen);
+      if (ret >= dstlen-1) ret = wcstombs(0,buf,0);
+    } else {
+      ret = wcstombs(0,buf,0);
+    }
+    if (buf != lbuf) free((void*)buf);
+    if (ret >= 0) return (unsigned)ret;
+    /* on any errors we return the UTF-8 as raw text...*/
+#endif
+  }
+  /* identity transform: */
+  if (srclen < dstlen) {
+    memcpy(dst, src, srclen);
+    dst[srclen] = 0;
+  } else {
+    /* Buffer insufficent or buffer query */
+  }
+  return srclen;
+}
+
+/*! Convert a filename from the locale-specific multibyte encoding
+    used by Windows to UTF-8 as used by FLTK.
+
+    Up to \p dstlen bytes are written to \p dst, including a null
+    terminator. The return value is the number of bytes that would be
+    written, not counting the null terminator. If greater or equal to
+    \p dstlen then if you malloc a new array of size n+1 you will have
+    the space needed for the entire string. If \p dstlen is zero then
+    nothing is written and this call just measures the storage space
+    needed.
+
+    On Unix or on Windows when a UTF-8 locale is in effect, this
+    does not change the data.
+    You may also want to check if fltk3::utf8test() returns non-zero, so that
+    the filesystem can store filenames in UTF-8 encoding regardless of
+    the locale.
+*/
+unsigned fltk3::utf8from_mb(char* dst, unsigned dstlen,
+		    const char* src, unsigned srclen)
+{
+  if (!fltk3::utf8locale()) {
+#ifdef WIN32
+    wchar_t lbuf[1024];
+    wchar_t* buf = lbuf;
+    unsigned length;
+    unsigned ret;
+    length = MultiByteToWideChar(GetACP(), 0, src, srclen, buf, 1024);
+    if ((length == 0)&&(GetLastError()==ERROR_INSUFFICIENT_BUFFER)) {
+      length = MultiByteToWideChar(GetACP(), 0, src, srclen, 0, 0);
+      buf = (wchar_t*)(malloc(length*sizeof(wchar_t)));
+      MultiByteToWideChar(GetACP(), 0, src, srclen, buf, length);
+    }
+    ret = fltk3::utf8fromwc(dst, dstlen, buf, length);
+    if (buf != lbuf) free((void*)buf);
+    return ret;
+#else
+    wchar_t lbuf[1024];
+    wchar_t* buf = lbuf;
+    int length;
+    unsigned ret;
+    length = mbstowcs(buf, src, 1024);
+    if (length >= 1024) {
+      length = mbstowcs(0, src, 0)+1;
+      buf = (wchar_t*)(malloc(length*sizeof(wchar_t)));
+      mbstowcs(buf, src, length);
+    }
+    if (length >= 0) {
+      ret = fltk3::utf8fromwc(dst, dstlen, buf, length);
+      if (buf != lbuf) free((void*)buf);
+      return ret;
+    }
+    /* errors in conversion return the UTF-8 unchanged */
+#endif
+  }
+  /* identity transform: */
+  if (srclen < dstlen) {
+    memcpy(dst, src, srclen);
+    dst[srclen] = 0;
+  } else {
+    /* Buffer insufficent or buffer query */
+  }
+  return srclen;
+}
+
+/*! Examines the first \p srclen bytes in \p src and returns a verdict
+    on whether it is UTF-8 or not.
+    - Returns 0 if there is any illegal UTF-8 sequences, using the
+      same rules as fltk3::utf8decode(). Note that some UCS values considered
+      illegal by RFC 3629, such as 0xffff, are considered legal by this.
+    - Returns 1 if there are only single-byte characters (ie no bytes
+      have the high bit set). This is legal UTF-8, but also indicates
+      plain ASCII. It also returns 1 if \p srclen is zero.
+    - Returns 2 if there are only characters less than 0x800.
+    - Returns 3 if there are only characters less than 0x10000.
+    - Returns 4 if there are characters in the 0x10000 to 0x10ffff range.
+
+    Because there are many illegal sequences in UTF-8, it is almost
+    impossible for a string in another encoding to be confused with
+    UTF-8. This is very useful for transitioning Unix to UTF-8
+    filenames, you can simply test each filename with this to decide
+    if it is UTF-8 or in the locale encoding. My hope is that if
+    this is done we will be able to cleanly transition to a locale-less
+    encoding.
+*/
+int fltk3::utf8test(const char* src, unsigned srclen) {
+  int ret = 1;
+  const char* p = src;
+  const char* e = src+srclen;
+  while (p < e) {
+    if (*p & 0x80) {
+      int len; fltk3::utf8decode(p,e,&len);
+      if (len < 2) return 0;
+      if (len > ret) ret = len;
+      p += len;
+    } else {
+      p++;
+    }
+  }
+  return ret;
+}
+
+/* forward declare mk_wcwidth() as static so the name is not visible.
+ */
+ static int mk_wcwidth(unsigned int ucs);
+
+ /* include the c source directly so it's contents are only visible here
+  */
+#include "xutf8/mk_wcwidth.c"
+
+/** wrapper to adapt Markus Kuhn's implementation of wcwidth() for FLTK
+    \param [in] ucs Unicode character value
+    \returns width of character in columns
+
+    See http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c for Markus Kuhn's
+    original implementation of wcwidth() and wcswidth()
+    (defined in IEEE Std 1002.1-2001) for Unicode.
+
+    \b WARNING: this function returns widths for "raw" Unicode characters.
+    It does not even try to map C1 control characters (0x80 to 0x9F) to
+    CP1252, and C0/C1 control characters and DEL will return -1.
+    You are advised to use fltk3::width(const char* src) instead.
+ */
+int fltk3::wcwidth_(unsigned int ucs) {
+  return mk_wcwidth(ucs);
+}
+
+/** extended wrapper around  fltk3::wcwidth_(unsigned int ucs) function.
+    \param[in] src pointer to start of UTF-8 byte sequence
+    \returns width of character in columns
+
+    Depending on build options, this function may map C1 control
+    characters (0x80 to 0x9f) to CP1252, and return the width of
+    that character instead. This is not the same behaviour as
+    fltk3::wcwidth_(unsigned int ucs) .
+
+    Note that other control characters and DEL will still return -1,
+    so if you want different behaviour, you need to test for those
+    characters before calling fltk3::wcwidth(), and handle them separately.
+ */
+int fltk3::wcwidth(const char* src) {
+  int len = fltk3::utf8len(*src);
+  int ret = 0;
+  unsigned int ucs = fltk3::utf8decode(src, src+len, &ret);
+  int width = fltk3::wcwidth_(ucs);
+  return width;
+}
+
+/** @} */
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/utf8.cxx (from rev 9002, branches/branch-3.0/src/core/fl_utf8.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/utf8.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/utf8.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,854 @@
+//
+// "$Id$"
+//
+// Unicode to UTF-8 conversion functions.
+//
+// Author: Jean-Marc Lienher ( http://oksid.ch )
+// Copyright 2000-2010 by O'ksi'D.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+
+
+#include <config.h>
+#include <fltk3/filename.h>
+#include <stdarg.h>
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+# include <ctype.h>
+# include <io.h>
+# include <windows.h>
+# include <winbase.h>
+# include <process.h>
+#ifdef __CYGWIN__
+#include  <wchar.h>
+#else
+#include  <direct.h>
+#endif
+extern "C" {
+  int XUtf8Tolower(int ucs);
+  unsigned short XUtf8IsNonSpacing(unsigned int ucs);
+};
+
+#elif defined(__APPLE__)
+# include <stdio.h>
+# include <time.h>
+//# include <unix.h>
+# include <fcntl.h>
+# include <unistd.h>
+# include <wchar.h>
+# include <stdlib.h>
+#   include <sys/types.h>
+# include <sys/stat.h>
+
+extern "C" {
+  int XUtf8Tolower(int ucs);
+  unsigned short XUtf8IsNonSpacing(unsigned int ucs);
+}
+
+#else // X-windows platform
+
+# include <fltk3/Xutf8.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+# include <unistd.h>
+#endif // WIN32
+
+#include <fltk3/utf8.h>
+#include <string.h>
+#include <stdlib.h>
+
+
+/** \addtogroup fl_unicode
+ @{
+ */
+
+/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
+/***        but only 16 bits are really used under Linux and win32  ***/
+
+
+#define NBC 0xFFFF + 1
+
+static int
+Toupper(
+	int ucs)
+{
+  long i;
+  static unsigned short *table = NULL;
+  
+  if (!table) {
+    table = (unsigned short*) malloc(
+                                     sizeof(unsigned short) * (NBC));
+    for (i = 0; i < NBC; i++) {
+      table[i] = (unsigned short) i;
+    }
+    for (i = 0; i < NBC; i++) {
+      int l;
+      l = XUtf8Tolower(i);
+      if (l != i) table[l] = (unsigned short) i;
+    }
+    
+  }
+  if (ucs >= NBC || ucs < 0) return ucs;
+  return table[ucs];
+}
+
+/**
+ return the byte length of the UTF-8 sequence with first byte \p c,
+ or -1 if \p c is not valid.
+ This function is helpful for finding faulty UTF8 sequences.
+ \see fltk3::utf8len1
+ */
+int fltk3::utf8len(char c)
+{
+  if (!(c & 0x80)) return 1;
+  if (c & 0x40) {
+    if (c & 0x20) {
+      if (c & 0x10) {
+        if (c & 0x08) {
+          if (c & 0x04) {
+            return 6;
+          }
+          return 5;
+        }
+        return 4;
+      }
+      return 3;
+    }
+    return 2;
+  }
+  return -1;
+} // fltk3::utf8len
+
+
+/**
+ Return the byte length of the UTF-8 sequence with first byte \p c,
+ or 1 if \p c is not valid. 
+ This function can be used to scan faulty UTF8 sequence, albeit ignoring invalid
+ codes.
+ \see fltk3::utf8len
+ */
+int fltk3::utf8len1(char c)
+{
+  if (!(c & 0x80)) return 1;
+  if (c & 0x40) {
+    if (c & 0x20) {
+      if (c & 0x10) {
+        if (c & 0x08) {
+          if (c & 0x04) {
+            return 6;
+          }
+          return 5;
+        }
+        return 4;
+      }
+      return 3;
+    }
+    return 2;
+  }
+  return 1;
+} // fltk3::utf8len1
+
+
+/**
+ returns the number of Unicode chars in the UTF-8 string
+ */
+int
+fltk3::utf_nb_char(
+               const unsigned char 	*buf,
+               int 			len)
+{
+  int i = 0;
+  int nbc = 0;
+  while (i < len) {
+    int cl = fltk3::utf8len((buf+i)[0]);//fl_utflen(buf + i, len - i);
+    if (cl < 1) cl = 1;
+    nbc++;
+    i += cl;
+  }
+  return nbc;
+}
+
+/*
+ * compare only the first n bytes
+ * return 0 if the strings are equal;
+ * return 1 if s1 is greater than s2
+ * return -1 if s1 is less than s2
+ */
+/**
+ UTF-8 aware strncasecmp - converts to lower case Unicode and tests.
+ 
+ \todo Correct the incorrect logic where length of strings tested
+ \todo Clarify whether n means number of bytes, or characters.
+ */
+int fltk3::utf_strncasecmp(const char *s1, const char *s2, int n)
+{
+  int i;
+  int s1_l;
+  int s2_l;
+  char *e1, *e2; // string end pointers
+  
+  s1_l = 0;
+  while (s1_l < n && s1[s1_l]) s1_l++;
+  s2_l = 0;
+  while (s2_l < n && s2[s2_l]) s2_l++;
+  
+  if (s1_l < s2_l) {
+    return -1;
+  } else if (s1_l > s2_l) {
+    return 1;
+  }
+  e1 = (char *)&s1[s1_l]; // last char to test
+  e2 = (char *)&s2[s2_l];
+  for (i = 0; i < n;) {
+    int l1, l2;
+    unsigned int u1, u2;
+    int res;
+    
+    //              l1 = fl_utf2ucs((unsigned char*)s1 + i, n - i, &u1);
+    u1 = fltk3::utf8decode(s1 + i, e1, &l1);
+    //              l2 = fl_utf2ucs((unsigned char*)s2 + i, n - i, &u2);
+    u2 = fltk3::utf8decode(s2 + i, e2, &l2);
+    if (l1 - l2 != 0) return l1 - l2;
+    res = XUtf8Tolower(u1) - XUtf8Tolower(u2);
+    if (res != 0) return res;
+    if (l1 < 1) {
+      i += 1;
+    } else {
+      i += l1;
+    }
+  }
+  return 0;
+}
+
+/*
+ * return 0 if the strings are equal;
+ * return 1 if s1 is greater than s2
+ * return -1 if s1 is less than s2
+ */
+/**
+ UTF-8 aware strcasecmp - converts to Unicode and tests.
+ 
+ \todo Correct the incorrect logic where length of strings tested
+ */
+int fltk3::utf_strcasecmp(const char *s1, const char *s2)
+{
+  int s1_l = strlen(s1);
+  int s2_l = strlen(s2);
+  
+  if (s1_l < s2_l) {
+    return -1;
+  } else if (s1_l > s2_l) {
+    return 1;
+  }
+  return fltk3::utf_strncasecmp(s1, s2, s1_l);
+}
+
+/**
+ return the Unicode lower case value of \p ucs
+ */
+int fltk3::tolower(unsigned int ucs)
+{
+  return XUtf8Tolower(ucs);
+}
+
+/**
+ return the Unicode upper case value of \p ucs
+ */
+int fltk3::toupper(unsigned int ucs)
+{
+  return Toupper(ucs);
+}
+
+/**
+ converts the str string to the lower case equivalent into buf.
+ Warning: to be safe buf length must be at least 3 * len [for 16-bit Unicode]
+ */
+int fltk3::utf_tolower(const unsigned char *str, int len, char *buf)
+{
+  int i;
+  int l = 0;
+  char *end = (char *)&str[len];
+  for (i = 0; i < len;) {
+    int l1, l2;
+    unsigned int u1;
+    
+    //              l1 = fl_utf2ucs((unsigned char*)str + i, len - i, &u1);
+    u1 = fltk3::utf8decode((const char*)(str + i), end, &l1);
+    l2 = fltk3::utf8encode((unsigned int) XUtf8Tolower(u1), buf + l);
+    if (l1 < 1) {
+      i += 1;
+    } else {
+      i += l1;
+    }
+    if (l2 < 1) {
+      l += 1;
+    } else {
+      l += l2;
+    }
+    
+  }
+  return l;
+}
+
+/**
+ converts the str string to the upper case equivalent into buf.
+ Warning: to be safe buf length must be at least 3 * len [for 16-bit Unicode]
+ */
+int fltk3::utf_toupper(const unsigned char *str, int len, char *buf)
+{
+  int i;
+  int l = 0;
+  char *end = (char *)&str[len];
+  for (i = 0; i < len;) {
+    int l1, l2;
+    unsigned int u1;
+    
+    //              l1 = fl_utf2ucs((unsigned char*)str + i, len - i, &u1);
+    u1 = fltk3::utf8decode((const char*)(str + i), end, &l1);
+    l2 = fltk3::utf8encode((unsigned int) Toupper(u1), buf + l);
+    if (l1 < 1) {
+      i += 1;
+    } else {
+      i += l1;
+    }
+    if (l2 < 1) {
+      l += 1;
+    } else {
+      l += l2;
+    }
+  }
+  return l;
+}
+
+#if 0 // deprecated in favour of FLTK2's fltk3::utf8toa
+/*
+ * convert UTF-8 str to latin1
+ * Warning: buf must be at least len long
+ */
+int fl_utf2latin1(const unsigned char *str, int len, char *buf)
+{
+  int i;
+  int l = 0;
+  char *end = (char *)&str[len];
+  for (i = 0; i < len;) {
+    unsigned int u1;
+    int l1;
+    
+    //              l1 = fl_utf2ucs((unsigned char*)str + i, len - i, &u1);
+    u1 = fltk3::utf8decode((const char*)(str + i), end, &l1);
+    if (u1 > 0xFF) u1 = '?';
+    buf[l] = (char) u1;
+    if (l1 < 1) {
+      i += 1;
+    } else {
+      i += l1;
+    }
+    l++;
+    
+  }
+  return l;
+}
+#endif
+
+#if 0 // deprecated in favour of FLTK2's fltk3::utf8froma
+/*
+ * convert latin1 str to UTF-8
+ * Warning: buf must be at least 2 * len long
+ */
+int fl_latin12utf(const unsigned char *str, int len, char *buf)
+{
+  int i;
+  int l = 0;
+  int l1 = 0;
+  for (i = 0; i < len; i++) {
+    unsigned int n = (unsigned int) str[i];
+    l1 = fltk3::utf8encode(n, buf + l);
+    if (l1 < 1) {
+      l = l + 1;
+    } else {
+      l = l + l1;
+    }
+    
+  }
+  return l;
+}
+#endif
+
+/**
+ returns true if the character is non-spacing.
+ \todo explain what non-spacing means.
+ */
+unsigned int fltk3::nonspacing(unsigned int ucs)
+{
+#ifdef __APPLE__
+  return (ucs==0x20); // FIXME: what does this really do?
+#else
+  return (unsigned int) XUtf8IsNonSpacing(ucs);
+#endif
+}
+
+#if defined(WIN32) && !defined(__CYGWIN__)
+static xchar *mbwbuf = NULL;
+#endif
+
+#ifdef WIN32
+unsigned int fl_codepage = 0;
+#endif
+
+#if defined (WIN32) && !defined(__CYGWIN__)
+
+static char *buf = NULL;
+static int buf_len = 0;
+static unsigned short *wbufa = NULL;
+
+// FIXME: This should *maybe* return 'const char *' instead of 'char *'
+char *fltk3::utf8_to_locale(const char *s, int len, UINT codepage)
+{
+  if (!s) return (char *)"";
+  int l = 0;
+  //	if (buf_len < len * 2 + 1) {
+  //		buf_len = len * 2 + 1;
+  //		buf = (char*) realloc(buf, buf_len);
+  //		wbufa = (unsigned short*) realloc(wbufa, buf_len * sizeof(short));
+  //	}
+  unsigned wn = fltk3::utf8toUtf16(s, len, NULL, 0); // Query length
+  wn = wn * 2 + 1;
+  if (wn >= (unsigned)buf_len) {
+    buf_len = wn;
+    buf = (char*) realloc(buf, buf_len);
+    wbufa = (unsigned short*) realloc(wbufa, buf_len * sizeof(short));
+  }
+  if (codepage < 1) codepage = fl_codepage;
+  //	l = fl_utf2unicode((const unsigned char *)s, len, (xchar*) wbufa);
+  l = fltk3::utf8toUtf16(s, len, wbufa, wn); // Convert string
+  wbufa[l] = 0;
+  buf[l] = 0;
+  l = WideCharToMultiByte(codepage, 0, (WCHAR*)wbufa, l, buf, buf_len, NULL, NULL);
+  if (l < 0) l = 0;
+  buf[l] = 0;
+  return buf;
+}
+
+// FIXME: This should maybe return 'const char *' instead of 'char *'
+char *fltk3::locale_to_utf8(const char *s, int len, UINT codepage)
+{
+  if (!s) return (char *)"";
+  int l = 0;
+  if (buf_len < len * 5 + 1) {
+    buf_len = len * 5 + 1;
+    buf = (char*) realloc(buf, buf_len);
+    wbufa = (unsigned short*) realloc(wbufa, buf_len * sizeof(short));
+  }
+  if (codepage < 1) codepage = fl_codepage;
+  buf[l] = 0;
+  
+  l = MultiByteToWideChar(codepage, 0, s, len, (WCHAR*)wbufa, buf_len);
+  if (l < 0) l = 0;
+  wbufa[l] = 0;
+  //	l = fl_unicode2utf((xchar*)wbufa, l, buf);
+  l = fltk3::utf8fromwc(buf, buf_len, (xchar*)wbufa, l);
+  buf[l] = 0;
+  return buf;
+}
+#endif
+
+/**
+ converts UTF8 to a local multi-byte character string.
+ */
+char * fltk3::utf2mbcs(const char *s)
+{
+  if (!s) return NULL;
+#if defined(WIN32) && !defined(__CYGWIN__)
+  int l = strlen(s);
+  static char *buf = NULL;
+  
+  //	mbwbuf = (xchar*)realloc(mbwbuf, (l+6) * sizeof(xchar));
+  //	l = fl_utf2unicode((unsigned char*)s, l, mbwbuf);
+  //	mbwbuf[l] = 0;
+  unsigned wn = fltk3::utf8toUtf16(s, l, NULL, 0) + 7; // Query length
+  mbwbuf = (xchar*)realloc(mbwbuf, sizeof(xchar)*wn);
+  l = fltk3::utf8toUtf16(s, l, (unsigned short *)mbwbuf, wn); // Convert string
+  mbwbuf[l] = 0;
+  
+  buf = (char*)realloc(buf, l * 6 + 1);
+  l = wcstombs(buf, mbwbuf, l * 6);
+  buf[l] = 0;
+  return buf;
+#else
+  return (char*) s;
+#endif
+}
+
+
+#if 0 // deprecated in favour of FLTK2's fltk3::utf8from_mb
+char * fl_mbcs2utf(const char *s)
+{
+  if (!s) return NULL;
+#if defined(WIN32)
+  int l = strlen(s);
+  unsigned dstlen;
+  static char *buf = NULL;
+  
+  mbwbuf = (xchar*)realloc(mbwbuf,(l * 6 + 6) * sizeof(xchar));
+  l = mbstowcs(mbwbuf, s, l);
+  dstlen = l * 6 + 1;
+  buf = (char*)realloc(buf, dstlen);
+  //	l = fl_unicode2utf(mbwbuf, l, buf);
+  l = fltk3::utf8fromwc(buf, dstlen, mbwbuf, l);
+  buf[l] = 0;
+  return buf;
+#else
+  return (char*) s;
+#endif
+} // fl_mbcs2utf
+#endif
+
+#if defined(WIN32)  && !defined(__CYGWIN__)
+static xchar *wbuf = NULL;
+static xchar *wbuf1 = NULL;
+#endif
+
+
+char *fltk3::getenv(const char* v)
+{
+#if defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(v);
+  //	static xchar* wbuf = NULL;
+  //	wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //	wbuf[fl_utf2unicode((const unsigned char*)v, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(v, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(v, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  xchar *ret = ::_wgetenv(wbuf);
+  static char *buf = NULL;
+  if (ret) {
+    l = wcslen(ret);
+    wn = fltk3::utf8fromwc(NULL, 0, ret, l) + 1; // query length
+    buf = (char*) realloc(buf, wn);
+    //		buf[fl_unicode2utf(ret, l, buf)] = 0;
+    wn = fltk3::utf8fromwc(buf, wn, ret, l); // convert string
+    buf[wn] = 0;
+    return buf;
+  } else {
+    return NULL;
+  }
+#else
+  return ::getenv(v);
+#endif
+}
+
+int fltk3::open(const char* f, int oflags, ...)
+{
+  va_list ap;
+  va_start(ap, oflags);
+  int ret = fltk3::vopen(f, oflags, ap);
+  va_end(ap);
+  return ret;
+}
+
+int fltk3::vopen(const char* f, int oflags, va_list ap) {
+  int pmode;
+  pmode = va_arg(ap, int);
+#if defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  if (pmode == -1) return ::_wopen(wbuf, oflags);
+  else return ::_wopen(wbuf, oflags, pmode);
+#else
+  if (pmode == -1) return ::open(f, oflags);
+  else return ::open(f, oflags, pmode);
+#endif
+}
+
+FILE *fltk3::fopen(const char* f, const char *mode)
+{
+#if  defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  l = strlen(mode);
+  //		wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar) * (l+1));
+  //		wbuf1[fl_utf2unicode((const unsigned char*)mode, l, wbuf1)] = 0;
+  wn = fltk3::utf8toUtf16(mode, l, NULL, 0) + 1; // Query length
+  wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(mode, l, (unsigned short *)wbuf1, wn); // Convert string
+  wbuf1[wn] = 0;
+  return ::_wfopen(wbuf, wbuf1);
+#else
+  return ::fopen(f, mode);
+#endif
+}
+
+int fltk3::system(const char* f)
+{
+#if  defined (WIN32) && !defined(__CYGWIN__)
+#  ifdef __MINGW32__
+  return system(fltk3::utf2mbcs(f));
+#  else
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wsystem(wbuf);
+#  endif
+#else
+  return ::system(f);
+#endif
+}
+
+int fltk3::execvp(const char *file, char *const *argv)
+{
+#if  defined (WIN32) && !defined(__CYGWIN__)
+#ifdef __MINGW32__
+  return _execvp(fltk3::utf2mbcs(file), argv);
+#else
+  int l = strlen(file);
+  int i, n, ret;
+  xchar **ar;
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)file, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(file, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(file, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  
+  i = 0; n = 0;
+  while (argv[i]) {i++; n++;}
+  ar = (xchar**) malloc(sizeof(xchar*) * (n + 1));
+  i = 0;
+  while (i <= n) {
+    unsigned wn;
+    l = strlen(argv[i]);
+    //			ar[i] = (xchar *)malloc(sizeof(xchar) * (l+1));
+    //			ar[i][fl_utf2unicode((const unsigned char*)argv[i], l, ar[i])] = 0;
+    wn = fltk3::utf8toUtf16(argv[i], l, NULL, 0) + 1; // Query length
+    ar[i] = (xchar *)malloc(sizeof(xchar)*wn);
+    wn = fltk3::utf8toUtf16(argv[i], l, (unsigned short *)ar[i], wn); // Convert string
+    ar[i][wn] = 0;
+    i++;
+  }
+  ar[n] = NULL;
+  ret = ::_wexecvp(wbuf, ar);
+  i = 0;
+  while (i <= n) {
+    free(ar[i]);
+    i++;
+  }
+  free(ar);
+  return ret;
+#endif
+#else
+  return ::execvp(file, argv);
+#endif
+}
+
+
+
+int fltk3::chmod(const char* f, int mode)
+{
+#if  defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wchmod(wbuf, mode);
+#else
+  return ::chmod(f, mode);
+#endif
+}
+
+int fltk3::access(const char* f, int mode)
+{
+#if defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_waccess(wbuf, mode);
+#else
+  return ::access(f, mode);
+#endif
+}
+
+
+int fltk3::stat(const char* f, struct stat *b)
+{
+#if defined(WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wstat(wbuf, (struct _stat*)b);
+#else
+  return ::stat(f, b);
+#endif
+}
+
+char *fltk3::getcwd(char* b, int l)
+{
+  if (b == NULL) {
+    b = (char*) malloc(l+1);
+  }
+#if defined(WIN32) && !defined(__CYGWIN__)
+  static xchar *wbuf = NULL;
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		xchar *ret = _wgetcwd(wbuf, l / 5);
+  xchar *ret = ::_wgetcwd(wbuf, l);
+  if (ret) {
+    unsigned dstlen = l;
+    l = wcslen(wbuf);
+    //			b[fl_unicode2utf(wbuf, l, b)] = 0;
+    dstlen = fltk3::utf8fromwc(b, dstlen, wbuf, l);
+    b[dstlen] = 0;
+    return b;
+  } else {
+    return NULL;
+  }
+#else
+  return ::getcwd(b, l);
+#endif
+}
+
+
+int fltk3::unlink(const char* f)
+{
+#if defined(WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wunlink(wbuf);
+#else
+  return ::unlink(f);
+#endif
+}
+
+int fltk3::mkdir(const char* f, int mode)
+{
+#if defined(WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(short) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wmkdir(wbuf);
+#else
+  return ::mkdir(f, mode);
+#endif
+}
+
+
+int fltk3::rmdir(const char* f)
+{
+#if defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  //		wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1));
+  //		wbuf[fl_utf2unicode((const unsigned char*)f, l, wbuf)] = 0;
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  return ::_wrmdir(wbuf);
+#else
+  return ::rmdir(f);
+#endif
+}
+
+int fltk3::rename(const char* f, const char *n)
+{
+#if defined (WIN32) && !defined(__CYGWIN__)
+  int l = strlen(f);
+  unsigned wn = fltk3::utf8toUtf16(f, l, NULL, 0) + 1; // Query length
+  wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string
+  wbuf[wn] = 0;
+  l = strlen(n);
+  wn = fltk3::utf8toUtf16(n, l, NULL, 0) + 1; // Query length
+  wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn);
+  wn = fltk3::utf8toUtf16(n, l, (unsigned short *)wbuf1, wn); // Convert string
+  wbuf1[wn] = 0;
+  return ::_wrename(wbuf, wbuf1);
+#else
+  return ::rename(f, n);
+#endif
+}
+
+// recursively create a path in the file system
+char fltk3::make_path( const char *path ) {
+  if (fltk3::access(path, 0)) {
+    const char *s = strrchr( path, '/' );
+    if ( !s ) return 0;
+    int len = s-path;
+    char *p = (char*)malloc( len+1 );
+    memcpy( p, path, len );
+    p[len] = 0;
+    fltk3::make_path( p );
+    free( p );
+    fltk3::mkdir(path, 0700);
+  }
+  return 1;
+}
+
+// strip the filename and create a path
+void fltk3::make_path_for_file( const char *path )
+{
+  const char *s = strrchr( path, '/' );
+  if ( !s ) return;
+  int len = s-path;
+  char *p = (char*)malloc( len+1 );
+  memcpy( p, path, len );
+  p[len] = 0;
+  fltk3::make_path( p );
+  free( p );
+}
+
+/** @} */
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/vertex.cxx (from rev 9002, branches/branch-3.0/src/core/fl_vertex.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/vertex.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/vertex.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,286 @@
+//
+// "$Id$"
+//
+// Portable drawing routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+/**
+  \file fl_vertex.cxx
+  \brief  Portable drawing code for drawing arbitrary shapes with
+          simple 2D transformations.
+*/
+
+// Portable drawing code for drawing arbitrary shapes with
+// simple 2D transformations.  See also fltk3::arc.cxx
+
+// matt: the Quartz implementation purposely doesn't use the Quartz matrix
+//       operations for reasons of compatibility and maintainability
+
+#include <config.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+#include <fltk3/run.h>
+#include <fltk3/math.h>
+#include <stdlib.h>
+
+void fltk3::GraphicsDriver::push_matrix() {
+  if (sptr==matrix_stack_size)
+    fltk3::error("fltk3::push_matrix(): matrix stack overflow.");
+  else
+    stack[sptr++] = m;
+}
+
+void fltk3::GraphicsDriver::pop_matrix() {
+  if (sptr==0)
+    fltk3::error("fltk3::pop_matrix(): matrix stack underflow.");
+  else 
+    m = stack[--sptr];
+}
+
+void fltk3::GraphicsDriver::mult_matrix(double a, double b, double c, double d, double x, double y) {
+  matrix o;
+  o.a = a*m.a + b*m.c;
+  o.b = a*m.b + b*m.d;
+  o.c = c*m.a + d*m.c;
+  o.d = c*m.b + d*m.d;
+  o.x = x*m.a + y*m.c + m.x;
+  o.y = x*m.b + y*m.d + m.y;
+  m = o;
+}
+
+void fltk3::GraphicsDriver::rotate(double d) {
+  if (d) {
+    double s, c;
+    if (d == 0) {s = 0; c = 1;}
+    else if (d == 90) {s = 1; c = 0;}
+    else if (d == 180) {s = 0; c = -1;}
+    else if (d == 270 || d == -90) {s = -1; c = 0;}
+    else {s = sin(d*M_PI/180); c = cos(d*M_PI/180);}
+    mult_matrix(c,-s,s,c,0,0);
+  }
+}
+
+void fltk3::GraphicsDriver::begin_points() {n = 0; what = POINT_;}
+
+void fltk3::GraphicsDriver::begin_line() {n = 0; what = LINE;}
+
+void fltk3::GraphicsDriver::begin_loop() {n = 0; what = LOOP;}
+
+void fltk3::GraphicsDriver::begin_polygon() {n = 0; what = POLYGON;}
+
+double fltk3::GraphicsDriver::transform_x(double x, double y) {return x*m.a + y*m.c + m.x;}
+
+double fltk3::GraphicsDriver::transform_y(double x, double y) {return x*m.b + y*m.d + m.y;}
+
+double fltk3::GraphicsDriver::transform_dx(double x, double y) {return x*m.a + y*m.c;}
+
+double fltk3::GraphicsDriver::transform_dy(double x, double y) {return x*m.b + y*m.d;}
+
+void fltk3::GraphicsDriver::transformed_vertex0(COORD_T x, COORD_T y) {
+  if (!n || x != p[n-1].x || y != p[n-1].y) {
+    if (n >= p_size) {
+      p_size = p ? 2*p_size : 16;
+      p = (XPOINT*)realloc((void*)p, p_size*sizeof(*p));
+    }
+    p[n].x = x;
+    p[n].y = y;
+    n++;
+  }
+}
+
+void fltk3::GraphicsDriver::transformed_vertex(double xf, double yf) {
+#ifdef __APPLE_QUARTZ__
+  transformed_vertex0(COORD_T(xf), COORD_T(yf));
+#else
+  transformed_vertex0(COORD_T(rint(xf)), COORD_T(rint(yf)));
+#endif
+}
+
+void fltk3::GraphicsDriver::vertex(double x,double y) {
+  transformed_vertex0(COORD_T(x*m.a + y*m.c + m.x), COORD_T(x*m.b + y*m.d + m.y));
+}
+
+void fltk3::GraphicsDriver::end_points() {
+#if defined(USE_X11)
+  if (n>1) XDrawPoints(fl_display, fl_window, fl_gc, p, n, 0);
+#elif defined(WIN32)
+  for (int i=0; i<n; i++) SetPixel(fl_gc, p[i].x, p[i].y, fl_RGB());
+#elif defined(__APPLE_QUARTZ__)
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+  for (int i=0; i<n; i++) { 
+    CGContextMoveToPoint(fl_gc, p[i].x, p[i].y);
+    CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
+    CGContextStrokePath(fl_gc);
+  }
+  if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::end_line() {
+  if (n < 2) {
+    fltk3::end_points();
+    return;
+  }
+#if defined(USE_X11)
+  if (n>1) XDrawLines(fl_display, fl_window, fl_gc, p, n, 0);
+#elif defined(WIN32)
+  if (n>1) Polyline(fl_gc, p, n);
+#elif defined(__APPLE_QUARTZ__)
+  if (n<=1) return;
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+  for (int i=1; i<n; i++)
+    CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
+  CGContextStrokePath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::fixloop() {  // remove equal points from closed path
+  while (n>2 && p[n-1].x == p[0].x && p[n-1].y == p[0].y) n--;
+}
+
+void fltk3::GraphicsDriver::end_loop() {
+  fixloop();
+  if (n>2) fltk3::transformed_vertex((COORD_T)p[0].x, (COORD_T)p[0].y);
+  fltk3::end_line();
+}
+
+void fltk3::GraphicsDriver::end_polygon() {
+  fixloop();
+  if (n < 3) {
+    fltk3::end_line();
+    return;
+  }
+#if defined(USE_X11)
+  if (n>2) XFillPolygon(fl_display, fl_window, fl_gc, p, n, Convex, 0);
+#elif defined(WIN32)
+  if (n>2) {
+    SelectObject(fl_gc, fl_brush());
+    Polygon(fl_gc, p, n);
+  }
+#elif defined(__APPLE_QUARTZ__)
+  if (n<=1) return;
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+  for (int i=1; i<n; i++) 
+    CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
+  CGContextClosePath(fl_gc);
+  CGContextFillPath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+void fltk3::GraphicsDriver::begin_complex_polygon() {
+  fltk3::begin_polygon();
+  gap_ = 0;
+#if defined(WIN32)
+  numcount = 0;
+#endif
+}
+
+void fltk3::GraphicsDriver::gap() {
+  while (n>gap_+2 && p[n-1].x == p[gap_].x && p[n-1].y == p[gap_].y) n--;
+  if (n > gap_+2) {
+    fltk3::transformed_vertex((COORD_T)p[gap_].x, (COORD_T)p[gap_].y);
+#if defined(WIN32)
+    counts[numcount++] = n-gap_;
+#endif
+    gap_ = n;
+  } else {
+    n = gap_;
+  }
+}
+
+void fltk3::GraphicsDriver::end_complex_polygon() {
+  fltk3::gap();
+  if (n < 3) {
+    fltk3::end_line();
+    return;
+  }
+#if defined(USE_X11)
+  if (n>2) XFillPolygon(fl_display, fl_window, fl_gc, p, n, 0, 0);
+#elif defined(WIN32)
+  if (n>2) {
+    SelectObject(fl_gc, fl_brush());
+    PolyPolygon(fl_gc, p, counts, numcount);
+  }
+#elif defined(__APPLE_QUARTZ__)
+  if (n<=1) return;
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+  for (int i=1; i<n; i++)
+    CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
+  CGContextClosePath(fl_gc);
+  CGContextFillPath(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+// shortcut the closed circles so they use XDrawArc:
+// warning: these do not draw rotated ellipses correctly!
+// See fltk3::arc.c for portable version.
+
+void fltk3::GraphicsDriver::circle(double x, double y,double r) {
+  double xt = fltk3::transform_x(x,y);
+  double yt = fltk3::transform_y(x,y);
+  double rx = r * (m.c ? sqrt(m.a*m.a+m.c*m.c) : fabs(m.a));
+  double ry = r * (m.b ? sqrt(m.b*m.b+m.d*m.d) : fabs(m.d));
+  int llx = (int)rint(xt-rx);
+  int w = (int)rint(xt+rx)-llx;
+  int lly = (int)rint(yt-ry);
+  int h = (int)rint(yt+ry)-lly;
+
+#if defined(USE_X11)
+  (what == POLYGON ? XFillArc : XDrawArc)
+    (fl_display, fl_window, fl_gc, llx, lly, w, h, 0, 360*64);
+#elif defined(WIN32)
+  if (what==POLYGON) {
+    SelectObject(fl_gc, fl_brush());
+    Pie(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0); 
+  } else
+    Arc(fl_gc, llx, lly, llx+w, lly+h, 0,0, 0,0); 
+#elif defined(__APPLE_QUARTZ__)
+  // Quartz warning: circle won't scale to current matrix!
+  // Last argument must be 0 (counter-clockwise) or it draws nothing under __LP64__ !!!!
+  CGContextSetShouldAntialias(fl_gc, true);
+  CGContextAddArc(fl_gc, xt, yt, (w+h)*0.25f, 0, 2.0f*M_PI, 0);
+  (what == POLYGON ? CGContextFillPath : CGContextStrokePath)(fl_gc);
+  CGContextSetShouldAntialias(fl_gc, false);
+#else
+# error unsupported platform
+#endif
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/visual.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_visual.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/visual.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/visual.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,155 @@
+//
+// "$Id$"
+//
+// Visual support for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Set the default visual according to passed switches:
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+/** \fn  fltk3::visual(int flags)
+    Selects a visual so that your graphics are drawn correctly.  This is
+    only allowed before you call show() on any windows.  This does nothing
+    if the default visual satisfies the capabilities, or if no visual
+    satisfies the capabilities, or on systems that don't have such
+    brain-dead notions.
+    
+    <P>Only the following combinations do anything useful:
+    
+    <UL>
+    <LI>fltk3::visual(fltk3::RGB)
+    <BR>Full/true color (if there are several depths FLTK chooses  the
+    largest).  Do this if you use fltk3::draw_image
+    for much better (non-dithered)  output.
+    <BR>&nbsp; </LI>
+    <LI>fltk3::visual(fltk3::RGB8)
+    <BR>Full color with at least 24 bits of color. fltk3::RGB will
+    always  pick this if available, but if not it will happily return a
+    less-than-24 bit deep visual.  This call fails if 24 bits are not
+    available.
+    <BR>&nbsp; </LI>
+    <LI>fltk3::visual(fltk3::DOUBLE|fltk3::INDEX)
+    <BR>Hardware double buffering.  Call this if you are going to use 
+    fltk3::DoubleWindow.
+    <BR>&nbsp; </LI>
+    <LI>fltk3::visual(fltk3::DOUBLE|fltk3::RGB)</LI>
+    <LI>fltk3::visual(fltk3::DOUBLE|fltk3::RGB8)
+    <BR>Hardware double buffering and full color.
+    </UL>
+    
+    <P>This returns true if the system has the capabilities by default or
+    FLTK suceeded in turing them on.  Your program will still work even if
+    this returns false (it just won't look as good).
+*/
+#ifdef WIN32
+int fltk3::visual(int flags) {
+  fl_GetDC(0);
+  if (flags & fltk3::DOUBLE) return 0;
+  if (!(flags & fltk3::INDEX) &&
+    GetDeviceCaps(fl_gc,BITSPIXEL) <= 8) return 0;
+  if ((flags & fltk3::RGB8) && GetDeviceCaps(fl_gc,BITSPIXEL)<24) return 0;
+  return 1;
+}
+#elif defined(__APPLE__)
+
+// \todo Mac : need to implement Visual flags
+int fltk3::visual(int flags) {
+  (void)flags;
+  return 1;
+}
+
+#else
+
+#if USE_XDBE
+#include <X11/extensions/Xdbe.h>
+#endif
+
+static int test_visual(XVisualInfo& v, int flags) {
+  if (v.screen != fl_screen) return 0;
+#if USE_COLORMAP
+  if (!(flags & fltk3::INDEX)) {
+    if (v.c_class != StaticColor && v.c_class != TrueColor) return 0;
+    if (v.depth <= 8) return 0; // fltk will work better in colormap mode
+  }
+  if (flags & fltk3::RGB8) {
+    if (v.depth < 24) return 0;
+  }
+  // for now, fltk does not like colormaps of more than 8 bits:
+  if ((v.c_class&1) && v.depth > 8) return 0;
+#else
+  // simpler if we can't use colormapped visuals at all:
+  if (v.c_class != StaticColor && v.c_class != TrueColor) return 0;
+#endif
+#if USE_XDBE
+  if (flags & fltk3::DOUBLE) {
+    static XdbeScreenVisualInfo *xdbejunk;
+    if (!xdbejunk) {
+      int event_base, error_base;
+      if (!XdbeQueryExtension(fl_display, &event_base, &error_base)) return 0;
+      Drawable root = RootWindow(fl_display,fl_screen);
+      int numscreens = 1;
+      xdbejunk = XdbeGetVisualInfo(fl_display,&root,&numscreens);
+      if (!xdbejunk) return 0;
+    }
+    for (int j = 0; ; j++) {
+      if (j >= xdbejunk->count) return 0;
+      if (xdbejunk->visinfo[j].visual == v.visualid) break;
+    }
+  }
+#endif
+  return 1;
+}
+
+int fltk3::visual(int flags) {
+#if USE_XDBE == 0
+  if (flags & fltk3::DOUBLE) return 0;
+#endif
+  fl_open_display();
+  // always use default if possible:
+  if (test_visual(*fl_visual, flags)) return 1;
+  // get all the visuals:
+  XVisualInfo vTemplate;
+  int num;
+  XVisualInfo *visualList = XGetVisualInfo(fl_display, 0, &vTemplate, &num);
+  // find all matches, use the one with greatest depth:
+  XVisualInfo *found = 0;
+  for (int i=0; i<num; i++) if (test_visual(visualList[i], flags)) {
+    if (!found || found->depth < visualList[i].depth)
+      found = &visualList[i];
+  }
+  if (!found) {XFree((void*)visualList); return 0;}
+  fl_visual = found;
+  fl_colormap = XCreateColormap(fl_display, RootWindow(fl_display,fl_screen),
+				fl_visual->visual, AllocNone);
+  return 1;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/vsnprintf.c (from rev 9002, branches/branch-3.0/src/core/vsnprintf.c)
===================================================================
--- branches/branch-3.0/src/fltk3/vsnprintf.c	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/vsnprintf.c	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,281 @@
+/*
+ * "$Id$"
+ *
+ * snprintf() and vsnprintf() functions for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+#include <stdio.h>
+#include "flstring.h"
+
+#ifdef HAVE_SYS_STDTYPES_H
+#  include <sys/stdtypes.h>
+#endif /* HAVE_SYS_STDTYPES_H */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
+  char		*bufptr,		/* Pointer to position in buffer */
+		*bufend,		/* Pointer to end of buffer */
+		sign,			/* Sign of format width */
+		size,			/* Size character (h, l, L) */
+		type;			/* Format type character */
+  int		width,			/* Width of field */
+		prec;			/* Number of characters of precision */
+  char		tformat[100],		/* Temporary format string for sprintf() */
+		*tptr,			/* Pointer into temporary format */
+		temp[1024];		/* Buffer for formatted numbers */
+  char		*s;			/* Pointer to string */
+  int		slen;			/* Length of string */
+  int		bytes;			/* Total number of bytes needed */
+
+
+ /*
+  * Loop through the format string, formatting as needed...
+  */
+
+  bufptr = buffer;
+  bufend = buffer + bufsize - 1;
+  bytes  = 0;
+
+  while (*format) {
+    if (*format == '%') {
+      tptr = tformat;
+      *tptr++ = *format++;
+
+      if (*format == '%') {
+        if (bufptr && bufptr < bufend) *bufptr++ = *format;
+        bytes ++;
+        format ++;
+	continue;
+      } else if (strchr(" -+#\'", *format)) {
+        *tptr++ = *format;
+        sign = *format++;
+      } else sign = 0;
+
+      if (*format == '*') {
+        /* Get width from argument... */
+	format ++;
+	width = va_arg(ap, int);
+	snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", width);
+	tptr += strlen(tptr);
+      } else {
+	width = 0;
+	while (isdigit(*format & 255)) {
+	  if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format;
+	  width = width * 10 + *format++ - '0';
+	}
+      }
+
+      if (*format == '.') {
+	if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format;
+        format ++;
+
+        if (*format == '*') {
+          /* Get precision from argument... */
+	  format ++;
+	  prec = va_arg(ap, int);
+	  snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", prec);
+	  tptr += strlen(tptr);
+	} else {
+	  prec = 0;
+	  while (isdigit(*format & 255)) {
+	    if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format;
+	    prec = prec * 10 + *format++ - '0';
+	  }
+	}
+      } else prec = -1;
+
+      size = '\0';
+
+      if (*format == 'l' && format[1] == 'l') {
+        size = 'L';
+	if (tptr < (tformat + sizeof(tformat) - 2)) {
+	  *tptr++ = 'l';
+	  *tptr++ = 'l';
+	}
+	format += 2;
+      } else if (*format == 'h' || *format == 'l' || *format == 'L') {
+	if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format;
+        size = *format++;
+      }
+
+      if (!*format) break;
+
+      if (tptr < (tformat + sizeof(tformat) - 1)) *tptr++ = *format;
+      type  = *format++;
+      *tptr = '\0';
+
+      switch (type) {
+	case 'E' : /* Floating point formats */
+	case 'G' :
+	case 'e' :
+	case 'f' :
+	case 'g' :
+	  if ((width + 2) > sizeof(temp)) break;
+
+	  sprintf(temp, tformat, va_arg(ap, double));
+
+          bytes += strlen(temp);
+
+          if (bufptr) {
+	    if ((bufptr + strlen(temp)) > bufend) {
+	      strncpy(bufptr, temp, (size_t)(bufend - bufptr));
+	      bufptr = bufend;
+	    } else {
+	      strcpy(bufptr, temp);
+	      bufptr += strlen(temp);
+	    }
+	  }
+	  break;
+
+        case 'B' : /* Integer formats */
+	case 'X' :
+	case 'b' :
+        case 'd' :
+	case 'i' :
+	case 'o' :
+	case 'u' :
+	case 'x' :
+	  if ((width + 2) > sizeof(temp)) break;
+
+#ifdef HAVE_LONG_LONG
+	  if (size == 'L')
+	    sprintf(temp, tformat, va_arg(ap, long long));
+	  else
+#endif /* HAVE_LONG_LONG */
+	  if (size == 'l')
+	    sprintf(temp, tformat, va_arg(ap, long));
+	  else
+	    sprintf(temp, tformat, va_arg(ap, int));
+
+          bytes += strlen(temp);
+
+	  if (bufptr) {
+	    if ((bufptr + strlen(temp)) > bufend) {
+	      strncpy(bufptr, temp, (size_t)(bufend - bufptr));
+	      bufptr = bufend;
+	    } else {
+	      strcpy(bufptr, temp);
+	      bufptr += strlen(temp);
+	    }
+	  }
+	  break;
+	    
+	case 'p' : /* Pointer value */
+	  if ((width + 2) > sizeof(temp)) break;
+
+	  sprintf(temp, tformat, va_arg(ap, void *));
+
+          bytes += strlen(temp);
+
+	  if (bufptr) {
+	    if ((bufptr + strlen(temp)) > bufend) {
+	      strncpy(bufptr, temp, (size_t)(bufend - bufptr));
+	      bufptr = bufend;
+	    } else {
+	      strcpy(bufptr, temp);
+	      bufptr += strlen(temp);
+	    }
+	  }
+	  break;
+
+        case 'c' : /* Character or character array */
+	  bytes += width;
+
+	  if (bufptr) {
+	    if (width <= 1) *bufptr++ = va_arg(ap, int);
+	    else {
+	      if ((bufptr + width) > bufend) width = bufend - bufptr;
+
+	      memcpy(bufptr, va_arg(ap, char *), (size_t)width);
+	      bufptr += width;
+	    }
+	  }
+	  break;
+
+	case 's' : /* String */
+	  if ((s = va_arg(ap, char *)) == NULL) s = "(null)";
+
+	  slen = strlen(s);
+	  if (slen > width && prec != width) width = slen;
+
+          bytes += width;
+
+	  if (bufptr) {
+	    if ((bufptr + width) > bufend) width = bufend - bufptr;
+
+            if (slen > width) slen = width;
+
+	    if (sign == '-') {
+	      strncpy(bufptr, s, (size_t)slen);
+	      memset(bufptr + slen, ' ', (size_t)(width - slen));
+	    } else {
+	      memset(bufptr, ' ', (size_t)(width - slen));
+	      strncpy(bufptr + width - slen, s, (size_t)slen);
+	    }
+
+	    bufptr += width;
+	  }
+	  break;
+
+	case 'n' : /* Output number of chars so far */
+	  *(va_arg(ap, int *)) = bytes;
+	  break;
+      }
+    } else {
+      bytes ++;
+
+      if (bufptr && bufptr < bufend) *bufptr++ = *format;
+      format ++;
+    }
+  }
+
+ /*
+  * Nul-terminate the string and return the number of characters needed.
+  */
+
+  if (bufptr) *bufptr = '\0';
+
+  return (bytes);
+}
+
+int fl_snprintf(char* str, size_t size, const char* fmt, ...) {
+  int ret;
+  va_list ap;
+  va_start(ap, fmt);
+  ret = vsnprintf(str, size, fmt, ap);
+  va_end(ap);
+  return ret;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*
+ * End of "$Id$".
+ */
+

Copied: branches/branch-3.0/src/fltk3/win32.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,2084 @@
+//
+// "$Id$"
+//
+// WIN32-specific code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This file contains win32-specific code for fltk which is always linked
+// in.  Search other files for "WIN32" or filenames ending in _win32.cxx
+// for other system-specific code.
+
+// This file must be #include'd in Fl.cxx and not compiled separately.
+
+#ifndef FLTK3_DOXYGEN
+#include <fltk3/run.h>
+#include <fltk3/utf8.h>
+#include <fltk3/Window.h>
+#include <fltk3/draw.h>
+#include <fltk3/enumerations.h>
+#include <fltk3/Tooltip.h>
+#include <fltk3/PagedDevice.h>
+#include "flstring.h"
+#include "Fl_Font.H"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <time.h>
+#ifdef __CYGWIN__
+#  include <sys/time.h>
+#  include <unistd.h>
+#endif
+
+#if !defined(NO_TRACK_MOUSE)
+#  include <commctrl.h>	// TrackMouseEvent
+// fabien: Ms Visual Studio >= 2003 permit embedded lib reference
+// that makes fltk use easier as only fltk libs are now requested
+// This idea could be extended to fltk libs themselves, 
+// implementer should then care about DLL linkage flags ...
+#  if (_MSC_VER>=1310)
+#    pragma comment (lib, "comctl32.lib")
+#  endif
+#endif
+
+#if defined(__GNUC__)
+# include <wchar.h>
+#endif
+
+#include <ole2.h>
+#include <shellapi.h>
+
+#include "aimm.h"
+
+//
+// USE_ASYNC_SELECT - define it if you have WSAAsyncSelect()...
+// USE_ASYNC_SELECT is OBSOLETED in 1.3 for the following reasons:
+/*
+  This feature was supposed to provide an efficient alternative to the current
+  polling method, but as it has been discussed (Thanks Albrecht!) :
+  - the async mode would imply to change the socket to non blocking mode.
+    This can have unexpected side effects for 3rd party apps, especially
+    if it is set on-the-fly when socket service is really needed, as it is 
+    done today and on purpose, but still the 3rd party developer wouldn't easily
+    control the sequencing of socket operations.
+  - Finer granularity of events furthered by the async select is a plus only 
+    for socket 3rd party impl., it is simply not needed for the 'light' fltk
+    use we make of wsock, so here it would also be a bad point, because of all
+    the logic add-ons necessary for using this functionality, without a clear
+    benefit.
+
+  So async mode select would not add benefits to fltk, worse, it can slowdown
+  fltk because of this finer granularity and instrumentation code to be added
+  for async mode proper operation, not mentioning the side effects...
+*/
+
+static fltk3::GDIGraphicsDriver fl_gdi_driver;
+static fltk3::DisplayDevice fl_gdi_display(&fl_gdi_driver);
+FLTK3_EXPORT fltk3::GraphicsDriver *fltk3::graphics_driver = (fltk3::GraphicsDriver*)&fl_gdi_driver; // the current target driver of graphics operations
+fltk3::SurfaceDevice* fltk3::SurfaceDevice::_surface = (fltk3::SurfaceDevice*)&fl_gdi_display; // the current target surface of graphics operations
+fltk3::DisplayDevice *fltk3::DisplayDevice::_display = &fl_gdi_display; // the platform display
+
+// dynamic wsock dll handling api:
+#if defined(__CYGWIN__) && !defined(SOCKET)
+# define SOCKET int
+#endif
+
+// note: winsock2.h has been #include'd in Fl.cxx
+#define WSCK_DLL_NAME "WS2_32.DLL"
+
+typedef int (WINAPI* fl_wsk_select_f)(int, fd_set*, fd_set*, fd_set*, const struct timeval*);
+typedef int (WINAPI* fl_wsk_fd_is_set_f)(SOCKET, fd_set *);
+
+static HMODULE s_wsock_mod = 0;
+static fl_wsk_select_f s_wsock_select = 0;
+static fl_wsk_fd_is_set_f fl_wsk_fd_is_set = 0;
+
+static HMODULE get_wsock_mod() {
+  if (!s_wsock_mod) {
+    s_wsock_mod = LoadLibrary(WSCK_DLL_NAME);
+    if (s_wsock_mod==NULL)
+      fltk3::fatal("FLTK Lib Error: %s file not found! Please check your winsock dll accessibility.\n",WSCK_DLL_NAME);
+    s_wsock_select = (fl_wsk_select_f) GetProcAddress(s_wsock_mod, "select");
+    fl_wsk_fd_is_set = (fl_wsk_fd_is_set_f) GetProcAddress(s_wsock_mod, "__WSAFDIsSet");
+  }
+  return s_wsock_mod;
+}
+
+/*
+ * Dynamic linking of imm32.dll
+ * This library is only needed for a hand full (four ATM) functions relating to 
+ * international text rendering and locales. Dynamically loading reduces initial
+ * size and link dependencies.
+ */
+static HMODULE s_imm_module = 0;
+typedef HIMC (WINAPI* flTypeImmGetContext)(HWND);
+static flTypeImmGetContext flImmGetContext = 0;
+typedef BOOL (WINAPI* flTypeImmSetCompositionWindow)(HIMC, LPCOMPOSITIONFORM);
+static flTypeImmSetCompositionWindow flImmSetCompositionWindow = 0;
+typedef BOOL (WINAPI* flTypeImmReleaseContext)(HWND, HIMC);
+static flTypeImmReleaseContext flImmReleaseContext = 0;
+typedef BOOL (WINAPI* flTypeImmIsIME)(HKL);
+static flTypeImmIsIME flImmIsIME = 0;
+
+static HMODULE get_imm_module() {
+  if (!s_imm_module) {
+    s_imm_module = LoadLibrary("IMM32.DLL");
+    if (!s_imm_module)
+      fltk3::fatal("FLTK Lib Error: IMM32.DLL file not found!\n\n"
+        "Please check your input method manager library accessibility.");
+    flImmGetContext = (flTypeImmGetContext)GetProcAddress(s_imm_module, "ImmGetContext");
+    flImmSetCompositionWindow = (flTypeImmSetCompositionWindow)GetProcAddress(s_imm_module, "ImmSetCompositionWindow");
+    flImmReleaseContext = (flTypeImmReleaseContext)GetProcAddress(s_imm_module, "ImmReleaseContext");
+    flImmIsIME = (flTypeImmIsIME)GetProcAddress(s_imm_module, "ImmIsIME");
+  }
+  return s_imm_module;
+}
+
+// USE_TRACK_MOUSE - define NO_TRACK_MOUSE if you don't have
+// TrackMouseEvent()...
+//
+// Now (Dec. 2008) we can assume that current Cygwin/MinGW versions
+// support the TrackMouseEvent() function, but WinCE obviously doesn't
+// support it (STR 2095). Therefore, USE_TRACK_MOUSE is enabled by 
+// default, but you can disable it by defining NO_TRACK_MOUSE.
+//
+// TrackMouseEvent is only used to support window leave notifications
+// under Windows. It can be used to get fltk3::LEAVE events, when the
+// mouse leaves the _main_ application window (FLTK detects subwindow
+// leave events by using normal move events).
+//
+// Implementation note: If the mouse cursor leaves one subwindow and
+// enters another window, then Windows sends a WM_MOUSEMOVE message to
+// the new window before it sends a WM_MOUSELEAVE message to the old
+// (just left) window. We save the current mouse window in a static variable,
+// and if we get a WM_MOUSELEAVE event for the current mouse window, this
+// means that the top level window has been left (otherwise we would have
+// got another WM_MOUSEMOVE message before).
+
+// #define NO_TRACK_MOUSE
+
+#if !defined(NO_TRACK_MOUSE)
+# define USE_TRACK_MOUSE
+#endif // NO_TRACK_MOUSE
+
+static fltk3::Window *track_mouse_win=0;	// current TrackMouseEvent() window
+
+// USE_CAPTURE_MOUSE_WIN - this must be defined for TrackMouseEvent to work
+// correctly with subwindows - otherwise a single mouse click and release
+// (without a move) would generate phantom leave events.
+// This defines, if the current mouse window (maybe a subwindow) or the 
+// main window should get mouse events after pushing (and holding) a mouse
+// button, i.e. when dragging the mouse. This is done by calling SetCapture
+// (see below).
+
+#ifdef USE_TRACK_MOUSE
+#define USE_CAPTURE_MOUSE_WIN
+#endif // USE_TRACK_MOUSE
+
+//
+// WM_SYNCPAINT is an "undocumented" message, which is finally defined in
+// VC++ 6.0.
+//
+
+#ifndef WM_SYNCPAINT
+#  define WM_SYNCPAINT 0x0088
+#endif
+
+#ifndef WM_MOUSELEAVE
+#  define WM_MOUSELEAVE 0x02a3
+#endif
+
+#ifndef WM_MOUSEWHEEL
+#  define WM_MOUSEWHEEL 0x020a
+#endif
+
+#ifndef WHEEL_DELTA
+#  define WHEEL_DELTA 120	// according to MSDN.
+#endif
+
+
+//
+// WM_FLSELECT is the user-defined message that we get when one of
+// the sockets has pending data, etc.
+//
+
+#define WM_FLSELECT	(WM_APP+1)	// WM_APP is used for hide-window
+
+
+////////////////////////////////////////////////////////////////
+// interface to poll/select call:
+
+// fd's are only implemented for sockets.  Microsoft Windows does not
+// have a unified IO system, so it doesn't support select() on files,
+// devices, or pipes...
+//
+// Microsoft provides the Berkeley select() call and an asynchronous
+// select function that sends a WIN32 message when the select condition
+// exists. However, we don't try to use the asynchronous WSAAsyncSelect()
+// any more for good reasons (see above).
+//
+// A.S. Dec 2009: We got reports that current winsock2.h files define
+// POLLIN, POLLOUT, and POLLERR with conflicting values WRT what we
+// used before (STR #2301).  Therefore we must not use these values
+// for our internal purposes, but use fltk3::READ, fltk3::WRITE, and
+// fltk3::EXCEPT, as defined for use in fltk3::add_fd().
+//
+static int maxfd = 0;
+static fd_set fdsets[3];
+
+extern IDropTarget *flIDropTarget;
+
+static int nfds = 0;
+static int fd_array_size = 0;
+static struct FD {
+  int fd;
+  short events;
+  void (*cb)(int, void*);
+  void* arg;
+} *fd = 0;
+
+extern unsigned int fl_codepage;
+
+void fltk3::reset_spot()
+{
+}
+
+void fltk3::set_spot(int font, int size, int X, int Y, int W, int H, fltk3::Window *win)
+{
+  if (!win) return;
+  fltk3::Window* tw = win;
+  while (tw->parent()) tw = tw->window(); // find top level window
+
+  get_imm_module();
+  HIMC himc = flImmGetContext(fl_xid(tw));
+
+  if (himc) {
+    COMPOSITIONFORM cfs;
+    cfs.dwStyle = CFS_POINT;
+    cfs.ptCurrentPos.x = X;
+    cfs.ptCurrentPos.y = Y - tw->labelsize();
+    MapWindowPoints(fl_xid(win), fl_xid(tw), &cfs.ptCurrentPos, 1);
+    flImmSetCompositionWindow(himc, &cfs);
+    flImmReleaseContext(fl_xid(tw), himc);
+  }
+}
+
+void fltk3::set_status(int x, int y, int w, int h)
+{
+}
+
+void fltk3::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
+  remove_fd(n,events);
+  int i = nfds++;
+  if (i >= fd_array_size) {
+    fd_array_size = 2*fd_array_size+1;
+    fd = (FD*)realloc(fd, fd_array_size*sizeof(FD));
+  }
+  fd[i].fd = n;
+  fd[i].events = (short)events;
+  fd[i].cb = cb;
+  fd[i].arg = v;
+
+  if (events & fltk3::READ) FD_SET((unsigned)n, &fdsets[0]);
+  if (events & fltk3::WRITE) FD_SET((unsigned)n, &fdsets[1]);
+  if (events & fltk3::EXCEPT) FD_SET((unsigned)n, &fdsets[2]);
+  if (n > maxfd) maxfd = n;
+}
+
+void fltk3::add_fd(int fd, void (*cb)(int, void*), void* v) {
+  fltk3::add_fd(fd, fltk3::READ, cb, v);
+}
+
+void fltk3::remove_fd(int n, int events) {
+  int i,j;
+  for (i=j=0; i<nfds; i++) {
+    if (fd[i].fd == n) {
+      short e = fd[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      fd[i].events = e;
+    }
+    // move it down in the array if necessary:
+    if (j<i) {
+      fd[j]=fd[i];
+    }
+    j++;
+  }
+  nfds = j;
+
+  if (events & fltk3::READ) FD_CLR(unsigned(n), &fdsets[0]);
+  if (events & fltk3::WRITE) FD_CLR(unsigned(n), &fdsets[1]);
+  if (events & fltk3::EXCEPT) FD_CLR(unsigned(n), &fdsets[2]);
+}
+
+void fltk3::remove_fd(int n) {
+  remove_fd(n, -1);
+}
+
+// these pointers are set by the fltk3::lock() function:
+static void nothing() {}
+void (*fl_lock_function)() = nothing;
+void (*fl_unlock_function)() = nothing;
+
+static void* thread_message_;
+void* fltk3::thread_message() {
+  void* r = thread_message_;
+  thread_message_ = 0;
+  return r;
+}
+
+IActiveIMMApp *fl_aimm = NULL;
+MSG fl_msg;
+
+// This is never called with time_to_wait < 0.0.
+// It *should* return negative on error, 0 if nothing happens before
+// timeout, and >0 if any callbacks were done.  This version only
+// returns zero if nothing happens during a 0.0 timeout, otherwise
+// it returns 1.
+int fl_wait(double time_to_wait) {
+  int have_message = 0;
+
+  run_checks();
+
+  // idle processing
+  static char in_idle;
+  if (fltk3::idle && !in_idle) {
+    in_idle = 1;
+    fltk3::idle();
+    in_idle = 0;
+  }
+  
+  if (nfds) {
+    // For WIN32 we need to poll for socket input FIRST, since
+    // the event queue is not something we can select() on...
+    timeval t;
+    t.tv_sec = 0;
+    t.tv_usec = 0;
+
+    fd_set fdt[3];
+    memcpy(fdt, fdsets, sizeof fdt); // one shot faster fdt init
+    if (get_wsock_mod()&& s_wsock_select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t)) {
+      // We got something - do the callback!
+      for (int i = 0; i < nfds; i ++) {
+	SOCKET f = fd[i].fd;
+	short revents = 0;
+	if (fl_wsk_fd_is_set(f, &fdt[0])) revents |= fltk3::READ;
+	if (fl_wsk_fd_is_set(f, &fdt[1])) revents |= fltk3::WRITE;
+	if (fl_wsk_fd_is_set(f, &fdt[2])) revents |= fltk3::EXCEPT;
+	if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
+      }
+      time_to_wait = 0.0; // just peek for any messages
+    } else {
+      // we need to check them periodically, so set a short timeout:
+      if (time_to_wait > .001) time_to_wait = .001;
+    }
+  }
+
+  if (fltk3::idle || fltk3::damage()) 
+    time_to_wait = 0.0;
+
+  // if there are no more windows and this timer is set
+  // to FOREVER, continue through or look up indefinitely
+  if (!fltk3::first_window() && time_to_wait==1e20)
+    time_to_wait = 0.0;
+
+  fl_unlock_function();
+
+  time_to_wait = (time_to_wait > 10000 ? 10000 : time_to_wait);
+  int t_msec = (int) (time_to_wait * 1000.0 + 0.5);
+  MsgWaitForMultipleObjects(0, NULL, FALSE, t_msec, QS_ALLINPUT);
+
+  fl_lock_function();
+
+  // Execute the message we got, and all other pending messages:
+  // have_message = PeekMessage(&fl_msg, NULL, 0, 0, PM_REMOVE);
+  have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
+  if (have_message > 0) {
+    while (have_message != 0 && have_message != -1) {
+      if (fl_msg.message == fl_wake_msg) {
+        // Used for awaking wait() from another thread
+	thread_message_ = (void*)fl_msg.wParam;
+        fltk3::AwakeHandler func;
+        void *data;
+        while (fltk3::get_awake_handler_(func, data)==0) {
+          func(data);
+        }
+      }
+
+      TranslateMessage(&fl_msg);
+      DispatchMessageW(&fl_msg);
+      have_message = PeekMessageW(&fl_msg, NULL, 0, 0, PM_REMOVE);
+    }
+  }
+  fltk3::flush();
+
+  // This should return 0 if only timer events were handled:
+  return 1;
+}
+
+// fl_ready() is just like fl_wait(0.0) except no callbacks are done:
+int fl_ready() {
+  if (PeekMessage(&fl_msg, NULL, 0, 0, PM_NOREMOVE)) return 1;
+  if (!nfds) return 0;
+  timeval t;
+  t.tv_sec = 0;
+  t.tv_usec = 0;
+  fd_set fdt[3];
+  memcpy(fdt, fdsets, sizeof fdt);
+  return get_wsock_mod() ? s_wsock_select(0,&fdt[0],&fdt[1],&fdt[2],&t) : 0;
+}
+
+////////////////////////////////////////////////////////////////
+
+int fltk3::x()
+{
+  RECT r;
+
+  SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
+  return r.left;
+}
+
+int fltk3::y()
+{
+  RECT r;
+
+  SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
+  return r.top;
+}
+
+int fltk3::h()
+{
+  RECT r;
+
+  SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
+  return r.bottom - r.top;
+}
+
+int fltk3::w()
+{
+  RECT r;
+
+  SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
+  return r.right - r.left;
+}
+
+void fltk3::get_mouse(int &x, int &y) {
+  POINT p;
+  GetCursorPos(&p);
+  x = p.x;
+  y = p.y;
+}
+
+////////////////////////////////////////////////////////////////
+// code used for selections:
+
+char *fl_selection_buffer[2];
+int fl_selection_length[2];
+int fl_selection_buffer_length[2];
+char fl_i_own_selection[2];
+
+UINT fl_get_lcid_codepage(LCID id)
+{
+  char buf[8];
+  buf[GetLocaleInfo(id, LOCALE_IDEFAULTANSICODEPAGE, buf, 8)] = 0;
+  return atol(buf);
+}
+
+// Convert \n -> \r\n
+class Lf2CrlfConvert {
+  char *out;
+  int outlen;
+public:
+  Lf2CrlfConvert(const char *in, int inlen) {
+    outlen = 0;
+    const char *i;
+    char *o;
+    int lencount;
+    // Predict size of \r\n conversion buffer
+    for ( i=in, lencount = inlen; lencount--; ) {
+      if ( *i == '\r' && *(i+1) == '\n' )	// leave \r\n untranslated
+	{ i+=2; outlen+=2; }
+      else if ( *i == '\n' )			// \n by itself? leave room to insert \r
+	{ i++; outlen+=2; }
+      else
+	{ ++i; ++outlen; }
+    }
+    // Alloc conversion buffer + NULL
+    out = new char[outlen+1];
+    // Handle \n -> \r\n conversion
+    for ( i=in, o=out, lencount = inlen; lencount--; ) {
+      if ( *i == '\r' && *(i+1) == '\n' )	// leave \r\n untranslated
+        { *o++ = *i++; *o++ = *i++; }
+      else if ( *i == '\n' )			// \n by itself? insert \r
+        { *o++ = '\r'; *o++ = *i++; }
+      else
+        { *o++ = *i++; }
+    }
+    *o++ = 0;
+  }
+  ~Lf2CrlfConvert() {
+    delete[] out;
+  }
+  int GetLength() const { return(outlen); }
+  const char* GetValue() const { return(out); }
+};
+
+// call this when you create a selection:
+void fltk3::copy(const char *stuff, int len, int clipboard) {
+  if (!stuff || len<0) return;
+
+  // Convert \n -> \r\n (for old apps like Notepad, DOS)
+  Lf2CrlfConvert buf(stuff, len);
+  len = buf.GetLength();
+  stuff = buf.GetValue();
+
+  if (len+1 > fl_selection_buffer_length[clipboard]) {
+    delete[] fl_selection_buffer[clipboard];
+    fl_selection_buffer[clipboard] = new char[len+100];
+    fl_selection_buffer_length[clipboard] = len+100;
+  }
+  memcpy(fl_selection_buffer[clipboard], stuff, len);
+  fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
+  fl_selection_length[clipboard] = len;
+  if (clipboard) {
+    // set up for "delayed rendering":
+    if (OpenClipboard(NULL)) {
+      // if the system clipboard works, use it
+      int utf16_len = fltk3::utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], 0, 0);
+      EmptyClipboard();
+      HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc.
+      LPVOID memLock = GlobalLock(hMem);
+      fltk3::utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1);
+      GlobalUnlock(hMem);
+      SetClipboardData(CF_UNICODETEXT, hMem);
+      CloseClipboard();
+      GlobalFree(hMem);
+      fl_i_own_selection[clipboard] = 0;
+    } else {
+      // only if it fails, instruct paste() to use the internal buffers
+      fl_i_own_selection[clipboard] = 1;
+    }
+  }
+}
+
+// Call this when a "paste" operation happens:
+void fltk3::paste(fltk3::Widget &receiver, int clipboard) {
+  if (!clipboard || fl_i_own_selection[clipboard]) {
+    // We already have it, do it quickly without window server.
+    // Notice that the text is clobbered if set_selection is
+    // called in response to fltk3::PASTE!
+
+    // Convert \r\n -> \n
+    char *i = fl_selection_buffer[clipboard];
+    if (i==0L) {
+      fltk3::e_text = 0; 
+      return;
+    }
+    fltk3::e_text = new char[fl_selection_length[clipboard]+1];
+    char *o = fltk3::e_text;
+    while (*i) {
+      if ( *i == '\r' && *(i+1) == '\n') i++;
+      else *o++ = *i++;
+    }
+    *o = 0;
+    fltk3::e_length = o - fltk3::e_text;
+    receiver.handle(fltk3::PASTE);
+    delete [] fltk3::e_text;
+    fltk3::e_text = 0;
+  } else {
+    if (!OpenClipboard(NULL)) return;
+    HANDLE h = GetClipboardData(CF_UNICODETEXT);
+    if (h) {
+      wchar_t *memLock = (wchar_t*) GlobalLock(h);
+      int utf16_len = wcslen(memLock);
+      fltk3::e_text = (char*) malloc (utf16_len * 4 + 1);
+      int utf8_len = fltk3::utf8fromwc(fltk3::e_text, utf16_len * 4, memLock, utf16_len);
+      *(fltk3::e_text + utf8_len) = 0;
+      LPSTR a,b;
+      a = b = fltk3::e_text;
+      while (*a) { // strip the CRLF pairs ($%$#@^)
+        if (*a == '\r' && a[1] == '\n') a++;
+        else *b++ = *a++;
+      }
+      *b = 0;
+      fltk3::e_length = b - fltk3::e_text;
+      receiver.handle(fltk3::PASTE);
+      GlobalUnlock(h);
+      free(fltk3::e_text);
+      fltk3::e_text = 0;
+    }
+    CloseClipboard();
+  }
+}
+
+////////////////////////////////////////////////////////////////
+char fl_is_ime = 0;
+void fl_get_codepage()
+{
+  HKL hkl = GetKeyboardLayout(0);
+  TCHAR ld[8];
+
+  GetLocaleInfo (LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE, ld, 6);
+  DWORD ccp = atol(ld);
+  fl_is_ime = 0;
+
+  fl_codepage = ccp;
+  if (fl_aimm) {
+    fl_aimm->GetCodePageA(GetKeyboardLayout(0), &fl_codepage);
+  } else if (get_imm_module() && flImmIsIME(hkl)) {
+    fl_is_ime = 1;
+  }
+}
+
+HWND fl_capture;
+
+static int mouse_event(fltk3::Window *window, int what, int button,
+		       WPARAM wParam, LPARAM lParam)
+{
+  static int px, py, pmx, pmy;
+  POINT pt;
+  fltk3::e_x = pt.x = (signed short)LOWORD(lParam);
+  fltk3::e_y = pt.y = (signed short)HIWORD(lParam);
+  ClientToScreen(fl_xid(window), &pt);
+  fltk3::e_x_root = pt.x;
+  fltk3::e_y_root = pt.y;
+#ifdef USE_CAPTURE_MOUSE_WIN
+  fltk3::Window *mouse_window = window;	// save "mouse window"
+#endif
+  while (window->parent()) {
+    fltk3::e_x += window->x();
+    fltk3::e_y += window->y();
+    window = window->window();
+  }
+
+  ulong state = fltk3::e_state & 0xff0000; // keep shift key states
+#if 0
+  // mouse event reports some shift flags, perhaps save them?
+  if (wParam & MK_SHIFT) state |= fltk3::SHIFT;
+  if (wParam & MK_CONTROL) state |= fltk3::CTRL;
+#endif
+  if (wParam & MK_LBUTTON) state |= fltk3::BUTTON1;
+  if (wParam & MK_MBUTTON) state |= fltk3::BUTTON2;
+  if (wParam & MK_RBUTTON) state |= fltk3::BUTTON3;
+  fltk3::e_state = state;
+
+  switch (what) {
+  case 1: // double-click
+    if (fltk3::e_is_click) {fltk3::e_clicks++; goto J1;}
+  case 0: // single-click
+    fltk3::e_clicks = 0;
+  J1:
+#ifdef USE_CAPTURE_MOUSE_WIN
+    if (!fl_capture) SetCapture(fl_xid(mouse_window));  // use mouse window
+#else
+    if (!fl_capture) SetCapture(fl_xid(window));	// use main window
+#endif
+    fltk3::e_keysym = fltk3::MouseButton + button;
+    fltk3::e_is_click = 1;
+    px = pmx = fltk3::e_x_root; py = pmy = fltk3::e_y_root;
+    return fltk3::handle(fltk3::PUSH,window);
+
+  case 2: // release:
+    if (!fl_capture) ReleaseCapture();
+    fltk3::e_keysym = fltk3::MouseButton + button;
+    return fltk3::handle(fltk3::RELEASE,window);
+
+  case 3: // move:
+  default: // avoid compiler warning
+    // MSWindows produces extra events even if mouse does not move, ignore em:
+    if (fltk3::e_x_root == pmx && fltk3::e_y_root == pmy) return 1;
+    pmx = fltk3::e_x_root; pmy = fltk3::e_y_root;
+    if (abs(fltk3::e_x_root-px)>5 || abs(fltk3::e_y_root-py)>5) fltk3::e_is_click = 0;
+    return fltk3::handle(fltk3::MOVE,window);
+
+  }
+}
+
+// convert a MSWindows VK_x to an Fltk (X) Keysym:
+// See also the inverse converter in Fl_get_key_win32.cxx
+// This table is in numeric order by VK:
+static const struct {unsigned short vk, fltk, extended;} vktab[] = {
+  {VK_BACK,	fltk3::BackSpaceKey},
+  {VK_TAB,	fltk3::TabKey},
+  {VK_CLEAR,	fltk3::KPKey+'5',	0xff0b/*XK_Clear*/},
+  {VK_RETURN,	fltk3::EnterKey,	fltk3::KPEnterKey},
+  {VK_SHIFT,	fltk3::ShiftLKey,	fltk3::ShiftRKey},
+  {VK_CONTROL,	fltk3::ControlLKey,	fltk3::ControlRKey},
+  {VK_MENU,	fltk3::AltLKey,	fltk3::AltRKey},
+  {VK_PAUSE,	fltk3::PauseKey},
+  {VK_CAPITAL,	fltk3::CapsLockKey},
+  {VK_ESCAPE,	fltk3::EscapeKey},
+  {VK_SPACE,	' '},
+  {VK_PRIOR,	fltk3::KPKey+'9',	fltk3::PageUpKey},
+  {VK_NEXT,	fltk3::KPKey+'3',	fltk3::PageDownKey},
+  {VK_END,	fltk3::KPKey+'1',	fltk3::EndKey},
+  {VK_HOME,	fltk3::KPKey+'7',	fltk3::HomeKey},
+  {VK_LEFT,	fltk3::KPKey+'4',	fltk3::LeftKey},
+  {VK_UP,	fltk3::KPKey+'8',	fltk3::UpKey},
+  {VK_RIGHT,	fltk3::KPKey+'6',	fltk3::RightKey},
+  {VK_DOWN,	fltk3::KPKey+'2',	fltk3::DownKey},
+  {VK_SNAPSHOT,	fltk3::PrintKey},	// does not work on NT
+  {VK_INSERT,	fltk3::KPKey+'0',	fltk3::InsertKey},
+  {VK_DELETE,	fltk3::KPKey+'.',	fltk3::DeleteKey},
+  {VK_LWIN,	fltk3::MetaLKey},
+  {VK_RWIN,	fltk3::MetaRKey},
+  {VK_APPS,	fltk3::MenuKey},
+# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
+  {VK_SLEEP,    fltk3::SleepKey},
+#endif
+  {VK_MULTIPLY,	fltk3::KPKey+'*'},
+  {VK_ADD,	fltk3::KPKey+'+'},
+  {VK_SUBTRACT,	fltk3::KPKey+'-'},
+  {VK_DECIMAL,	fltk3::KPKey+'.'},
+  {VK_DIVIDE,	fltk3::KPKey+'/'},
+  {VK_NUMLOCK,	fltk3::NumLockKey},
+  {VK_SCROLL,	fltk3::ScrollLockKey},
+# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
+  {VK_BROWSER_BACK, fltk3::BackKey},
+  {VK_BROWSER_FORWARD, fltk3::ForwardKey},
+  {VK_BROWSER_REFRESH, fltk3::RefreshKey},
+  {VK_BROWSER_STOP, fltk3::StopKey},
+  {VK_BROWSER_SEARCH, fltk3::SearchKey},
+  {VK_BROWSER_FAVORITES, fltk3::FavoritesKey},
+  {VK_BROWSER_HOME, fltk3::HomePageKey},
+  {VK_VOLUME_MUTE, fltk3::VolumeMuteKey},
+  {VK_VOLUME_DOWN, fltk3::VolumeDownKey},
+  {VK_VOLUME_UP, fltk3::VolumeUpKey},
+  {VK_MEDIA_NEXT_TRACK, fltk3::MediaNextKey},
+  {VK_MEDIA_PREV_TRACK, fltk3::MediaPrevKey},
+  {VK_MEDIA_STOP, fltk3::MediaStopKey},
+  {VK_MEDIA_PLAY_PAUSE, fltk3::MediaPlayKey},
+  {VK_LAUNCH_MAIL, fltk3::MailKey},
+#endif
+  {0xba,	';'},
+  {0xbb,	'='},
+  {0xbc,	','},
+  {0xbd,	'-'},
+  {0xbe,	'.'},
+  {0xbf,	'/'},
+  {0xc0,	'`'},
+  {0xdb,	'['},
+  {0xdc,	'\\'},
+  {0xdd,	']'},
+  {0xde,	'\''}
+};
+static int ms2fltk(int vk, int extended) {
+  static unsigned short vklut[256];
+  static unsigned short extendedlut[256];
+  if (!vklut[1]) { // init the table
+    unsigned int i;
+    for (i = 0; i < 256; i++) vklut[i] = tolower(i);
+    for (i=VK_F1; i<=VK_F16; i++) vklut[i] = i+(fltk3::FKey-(VK_F1-1));
+    for (i=VK_NUMPAD0; i<=VK_NUMPAD9; i++) vklut[i] = i+(fltk3::KPKey+'0'-VK_NUMPAD0);
+    for (i = 0; i < sizeof(vktab)/sizeof(*vktab); i++) {
+      vklut[vktab[i].vk] = vktab[i].fltk;
+      extendedlut[vktab[i].vk] = vktab[i].extended;
+    }
+    for (i = 0; i < 256; i++) if (!extendedlut[i]) extendedlut[i] = vklut[i];
+  }
+  return extended ? extendedlut[vk] : vklut[vk];
+}
+
+#if USE_COLORMAP
+extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+/// Win32 timers
+///
+
+struct Win32Timer
+{
+  UINT_PTR handle;
+  fltk3::TimeoutHandler callback;
+  void *data;
+};
+static Win32Timer* win32_timers;
+static int win32_timer_alloc;
+static int win32_timer_used;
+static HWND s_TimerWnd;
+
+static void realloc_timers()
+{
+  if (win32_timer_alloc == 0) {
+    win32_timer_alloc = 8;
+  }
+  win32_timer_alloc *= 2;
+  Win32Timer* new_timers = new Win32Timer[win32_timer_alloc];
+  memset(new_timers, 0, sizeof(Win32Timer) * win32_timer_used);
+  memcpy(new_timers, win32_timers, sizeof(Win32Timer) * win32_timer_used);
+  Win32Timer* delete_me = win32_timers;
+  win32_timers = new_timers;
+  delete [] delete_me;
+}
+
+static void delete_timer(Win32Timer& t)
+{
+  KillTimer(s_TimerWnd, t.handle);
+  memset(&t, 0, sizeof(Win32Timer));
+}
+
+/// END TIMERS
+/////////////////////////////////////////////////////////////////////////////
+
+static fltk3::Window* resize_bug_fix;
+
+extern void fl_save_pen(void);
+extern void fl_restore_pen(void);
+
+static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+  // Copy the message to fl_msg so add_handler code can see it, it is
+  // already there if this is called by DispatchMessage, but not if
+  // Windows calls this directly.
+  fl_msg.hwnd = hWnd;
+  fl_msg.message = uMsg;
+  fl_msg.wParam = wParam;
+  fl_msg.lParam = lParam;
+  //fl_msg.time = ???
+  //fl_msg.pt = ???
+  //fl_msg.lPrivate = ???
+
+  fltk3::Window *window = fl_find(hWnd);
+
+  if (window) switch (uMsg) {
+
+  case WM_QUIT: // this should not happen?
+    fltk3::fatal("WM_QUIT message");
+
+  case WM_CLOSE: // user clicked close box
+    fltk3::handle(fltk3::CLOSE, window);
+    PostQuitMessage(0);
+    return 0;
+
+  case WM_SYNCPAINT :
+  case WM_NCPAINT :
+  case WM_ERASEBKGND :
+    // Andreas Weitl - WM_SYNCPAINT needs to be passed to DefWindowProc
+    // so that Windows can generate the proper paint messages...
+    // Similarly, WM_NCPAINT and WM_ERASEBKGND need this, too...
+    break;
+
+  case WM_PAINT: {
+    fltk3::Region R;
+    Fl_X *i = Fl_X::i(window);
+    i->wait_for_expose = 0;
+    char redraw_whole_window = false;
+    if (!i->region && window->damage()) {
+      // Redraw the whole window...
+      i->region = CreateRectRgn(0, 0, window->w(), window->h());
+      redraw_whole_window = true;
+    }
+
+    // We need to merge WIN32's damage into FLTK's damage.
+    R = CreateRectRgn(0,0,0,0);
+    int r = GetUpdateRgn(hWnd,R,0);
+    if (r==NULLREGION && !redraw_whole_window) {
+      break;
+    }
+
+    if (i->region) {
+      // Also tell WIN32 that we are drawing someplace else as well...
+      CombineRgn(i->region, i->region, R, RGN_OR);
+      XDestroyRegion(R);
+    } else {
+      i->region = R;
+    }
+    if (window->type() == fltk3::DOUBLE_WINDOW) ValidateRgn(hWnd,0);
+    else ValidateRgn(hWnd,i->region);
+
+    window->clear_damage((uchar)(window->damage()|fltk3::DAMAGE_EXPOSE));
+    // These next two statements should not be here, so that all update
+    // is deferred until fltk3::flush() is called during idle.  However WIN32
+    // apparently is very unhappy if we don't obey it and draw right now.
+    // Very annoying!
+    fl_GetDC(hWnd); // Make sure we have a DC for this window...
+    fl_save_pen();
+    i->flush();
+    fl_restore_pen();
+    window->clear_damage();
+    } return 0;
+
+  case WM_LBUTTONDOWN:  mouse_event(window, 0, 1, wParam, lParam); return 0;
+  case WM_LBUTTONDBLCLK:mouse_event(window, 1, 1, wParam, lParam); return 0;
+  case WM_LBUTTONUP:    mouse_event(window, 2, 1, wParam, lParam); return 0;
+  case WM_MBUTTONDOWN:  mouse_event(window, 0, 2, wParam, lParam); return 0;
+  case WM_MBUTTONDBLCLK:mouse_event(window, 1, 2, wParam, lParam); return 0;
+  case WM_MBUTTONUP:    mouse_event(window, 2, 2, wParam, lParam); return 0;
+  case WM_RBUTTONDOWN:  mouse_event(window, 0, 3, wParam, lParam); return 0;
+  case WM_RBUTTONDBLCLK:mouse_event(window, 1, 3, wParam, lParam); return 0;
+  case WM_RBUTTONUP:    mouse_event(window, 2, 3, wParam, lParam); return 0;
+
+  case WM_MOUSEMOVE:
+#ifdef USE_TRACK_MOUSE
+    if (track_mouse_win != window) {
+      TRACKMOUSEEVENT tme;
+      tme.cbSize    = sizeof(TRACKMOUSEEVENT);
+      tme.dwFlags   = TME_LEAVE;
+      tme.hwndTrack = hWnd;
+      _TrackMouseEvent(&tme);
+      track_mouse_win = window;
+    }
+#endif // USE_TRACK_MOUSE
+    mouse_event(window, 3, 0, wParam, lParam);
+    return 0;
+
+  case WM_MOUSELEAVE:
+    if (track_mouse_win == window) { // we left the top level window !
+      fltk3::Window *tw = window;
+      while (tw->parent()) tw = tw->window(); // find top level window
+      fltk3::belowmouse(0);
+      fltk3::handle(fltk3::LEAVE, tw);
+    }
+    track_mouse_win = 0; // force TrackMouseEvent() restart
+    break;
+
+  case WM_SETFOCUS:
+    fltk3::handle(fltk3::FOCUS, window);
+    break;
+
+  case WM_KILLFOCUS:
+    fltk3::handle(fltk3::UNFOCUS, window);
+    fltk3::flush(); // it never returns to main loop when deactivated...
+    break;
+
+  case WM_SHOWWINDOW:
+    if (!window->parent()) {
+      fltk3::handle(wParam ? fltk3::SHOW : fltk3::HIDE, window);
+    }
+    break;
+
+  case WM_ACTIVATEAPP:
+    // From eric@vfx.sel.sony.com, we should process WM_ACTIVATEAPP
+    // messages to restore the correct state of the shift/ctrl/alt/lock
+    // keys...  Added control, shift, alt, and meta keys, and changed
+    // to use GetAsyncKeyState and do it when wParam is 1
+    // (that means we have focus...)
+    if (wParam)
+    {
+      ulong state = 0;
+      if (GetAsyncKeyState(VK_CAPITAL)) state |= fltk3::CAPS_LOCK;
+      if (GetAsyncKeyState(VK_NUMLOCK)) state |= fltk3::NUM_LOCK;
+      if (GetAsyncKeyState(VK_SCROLL)) state |= fltk3::SCROLL_LOCK;
+      if (GetAsyncKeyState(VK_CONTROL)&~1) state |= fltk3::CTRL;
+      if (GetAsyncKeyState(VK_SHIFT)&~1) state |= fltk3::SHIFT;
+      if (GetAsyncKeyState(VK_MENU)) state |= fltk3::ALT;
+      if ((GetAsyncKeyState(VK_LWIN)|GetAsyncKeyState(VK_RWIN))&~1) state |= fltk3::META;
+      fltk3::e_state = state;
+      return 0;
+    }
+    break;
+
+  case WM_INPUTLANGCHANGE:
+    fl_get_codepage();
+    break;
+  case WM_IME_COMPOSITION:
+//	if (!fl_is_nt4() && lParam & GCS_RESULTCLAUSE) {
+//		HIMC himc = ImmGetContext(hWnd);
+//		wlen = ImmGetCompositionStringW(himc, GCS_RESULTSTR,
+//			wbuf, sizeof(wbuf)) / sizeof(short);
+//		if (wlen < 0) wlen = 0;
+//		wbuf[wlen] = 0;
+//		ImmReleaseContext(hWnd, himc);
+//	}
+	break;
+  case WM_KEYDOWN:
+  case WM_SYSKEYDOWN:
+  case WM_KEYUP:
+  case WM_SYSKEYUP:
+    // save the keysym until we figure out the characters:
+    fltk3::e_keysym = fltk3::e_original_keysym = ms2fltk(wParam,lParam&(1<<24));
+    // See if TranslateMessage turned it into a WM_*CHAR message:
+    if (PeekMessageW(&fl_msg, hWnd, WM_CHAR, WM_SYSDEADCHAR, PM_REMOVE))
+    {
+      uMsg = fl_msg.message;
+      wParam = fl_msg.wParam;
+      lParam = fl_msg.lParam;
+    }
+  case WM_DEADCHAR:
+  case WM_SYSDEADCHAR:
+  case WM_CHAR:
+  case WM_SYSCHAR: {
+    ulong state = fltk3::e_state & 0xff000000; // keep the mouse button state
+    // if GetKeyState is expensive we might want to comment some of these out:
+    if (GetKeyState(VK_SHIFT)&~1) state |= fltk3::SHIFT;
+    if (GetKeyState(VK_CAPITAL)) state |= fltk3::CAPS_LOCK;
+    if (GetKeyState(VK_CONTROL)&~1) state |= fltk3::CTRL;
+    // Alt gets reported for the Alt-GR switch on foreign keyboards.
+    // so we need to check the event as well to get it right:
+    if ((lParam&(1<<29)) //same as GetKeyState(VK_MENU)
+	&& uMsg != WM_CHAR) state |= fltk3::ALT;
+    if (GetKeyState(VK_NUMLOCK)) state |= fltk3::NUM_LOCK;
+    if ((GetKeyState(VK_LWIN)|GetKeyState(VK_RWIN))&~1) {
+      // WIN32 bug?  GetKeyState returns garbage if the user hit the
+      // meta key to pop up start menu.  Sigh.
+      if ((GetAsyncKeyState(VK_LWIN)|GetAsyncKeyState(VK_RWIN))&~1)
+	state |= fltk3::META;
+    }
+    if (GetKeyState(VK_SCROLL)) state |= fltk3::SCROLL_LOCK;
+    fltk3::e_state = state;
+    static char buffer[1024];
+    if (uMsg == WM_CHAR || uMsg == WM_SYSCHAR) {
+
+      xchar u = (xchar) wParam;
+//    fltk3::e_length = fl_unicode2utf(&u, 1, buffer);
+      fltk3::e_length = fltk3::utf8fromwc(buffer, 1024, &u, 1);
+      buffer[fltk3::e_length] = 0;
+
+
+    } else if (fltk3::e_keysym >= fltk3::KPKey && fltk3::e_keysym <= fltk3::KPLastKey) {
+      if (state & fltk3::NUM_LOCK) {
+        // Convert to regular keypress...
+	buffer[0] = fltk3::e_keysym-fltk3::KPKey;
+	fltk3::e_length = 1;
+      } else {
+        // Convert to special keypress...
+	buffer[0] = 0;
+	fltk3::e_length = 0;
+	switch (fltk3::e_keysym) {
+	  case fltk3::KPKey + '0' :
+	    fltk3::e_keysym = fltk3::InsertKey;
+	    break;
+	  case fltk3::KPKey + '1' :
+	    fltk3::e_keysym = fltk3::EndKey;
+	    break;
+	  case fltk3::KPKey + '2' :
+	    fltk3::e_keysym = fltk3::DownKey;
+	    break;
+	  case fltk3::KPKey + '3' :
+	    fltk3::e_keysym = fltk3::PageDownKey;
+	    break;
+	  case fltk3::KPKey + '4' :
+	    fltk3::e_keysym = fltk3::LeftKey;
+	    break;
+	  case fltk3::KPKey + '6' :
+	    fltk3::e_keysym = fltk3::RightKey;
+	    break;
+	  case fltk3::KPKey + '7' :
+	    fltk3::e_keysym = fltk3::HomeKey;
+	    break;
+	  case fltk3::KPKey + '8' :
+	    fltk3::e_keysym = fltk3::UpKey;
+	    break;
+	  case fltk3::KPKey + '9' :
+	    fltk3::e_keysym = fltk3::PageUpKey;
+	    break;
+	  case fltk3::KPKey + '.' :
+	    fltk3::e_keysym = fltk3::DeleteKey;
+	    break;
+	  case fltk3::KPKey + '/' :
+	  case fltk3::KPKey + '*' :
+	  case fltk3::KPKey + '-' :
+	  case fltk3::KPKey + '+' :
+	    buffer[0] = fltk3::e_keysym-fltk3::KPKey;
+	    fltk3::e_length = 1;
+	    break;
+	}
+      }
+    } else if ((lParam & (1<<31))==0) {
+#ifdef FLTK_PREVIEW_DEAD_KEYS
+      if ((lParam & (1<<24))==0) { // clear if dead key (always?)
+        xchar u = (xchar) wParam;
+        fltk3::e_length = fltk3::utf8fromwc(buffer, 1024, &u, 1);
+        buffer[fltk3::e_length] = 0;
+      } else { // set if "extended key" (never printable?)
+        buffer[0] = 0;
+        fltk3::e_length = 0;
+      }
+#else
+      buffer[0] = 0;
+      fltk3::e_length = 0;
+#endif
+    }
+    fltk3::e_text = buffer;
+    if (lParam & (1<<31)) { // key up events.
+      if (fltk3::handle(fltk3::KEYUP, window)) return 0;
+      break;
+    }
+    // for (int i = lParam&0xff; i--;)
+    while (window->parent()) window = window->window();
+    if (fltk3::handle(fltk3::KEYBOARD,window)) {
+	  if (uMsg==WM_DEADCHAR || uMsg==WM_SYSDEADCHAR)
+		fltk3::compose_state = 1;
+	  return 0;
+	}
+    break;}
+
+  case WM_MOUSEWHEEL: {
+    static int delta = 0; // running total of all motion
+    delta += (SHORT)(HIWORD(wParam));
+    fltk3::e_dy = -delta / WHEEL_DELTA;
+    delta += fltk3::e_dy * WHEEL_DELTA;
+    if (fltk3::e_dy) fltk3::handle(fltk3::MOUSEWHEEL, window);
+    return 0;
+  }
+
+  case WM_GETMINMAXINFO:
+    Fl_X::i(window)->set_minmax((LPMINMAXINFO)lParam);
+    break;
+
+  case WM_SIZE:
+    if (!window->parent()) {
+      if (wParam == SIZE_MINIMIZED || wParam == SIZE_MAXHIDE) {
+	fltk3::handle(fltk3::HIDE, window);
+      } else {
+	fltk3::handle(fltk3::SHOW, window);
+	resize_bug_fix = window;
+	window->size(LOWORD(lParam), HIWORD(lParam));
+      }
+    }
+    break;
+
+  case WM_MOVE: {
+    resize_bug_fix = window;
+    int nx = LOWORD(lParam);
+    int ny = HIWORD(lParam);
+    if (nx & 0x8000) nx -= 65536;
+    if (ny & 0x8000) ny -= 65536;
+    window->position(nx, ny); }
+    break;
+
+  case WM_SETCURSOR:
+    if (LOWORD(lParam) == HTCLIENT) {
+      while (window->parent()) window = window->window();
+      SetCursor(Fl_X::i(window)->cursor);
+      return 0;
+    }
+    break;
+
+#if USE_COLORMAP
+  case WM_QUERYNEWPALETTE :
+    fl_GetDC(hWnd);
+    if (fl_select_palette()) InvalidateRect(hWnd, NULL, FALSE);
+    break;
+
+  case WM_PALETTECHANGED:
+    fl_GetDC(hWnd);
+    if ((HWND)wParam != hWnd && fl_select_palette()) UpdateColors(fl_gc);
+    break;
+
+  case WM_CREATE :
+    fl_GetDC(hWnd);
+    fl_select_palette();
+    break;
+#endif
+
+  case WM_DESTROYCLIPBOARD:
+    fl_i_own_selection[1] = 0;
+    return 1;
+
+  case WM_RENDERALLFORMATS:
+    fl_i_own_selection[1] = 0;
+    // Windoze seems unhappy unless I do these two steps. Documentation
+    // seems to vary on whether opening the clipboard is necessary or
+    // is in fact wrong:
+    CloseClipboard();
+    OpenClipboard(NULL);
+    // fall through...
+  case WM_RENDERFORMAT: {
+    HANDLE h;
+
+//  int l = fltk3::utf_nb_char((unsigned char*)fl_selection_buffer[1], fl_selection_length[1]);
+    int l = fltk3::utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], NULL, 0); // Pass NULL buffer to query length required
+    h = GlobalAlloc(GHND, (l+1) * sizeof(unsigned short));
+    if (h) {
+      unsigned short *g = (unsigned short*) GlobalLock(h);
+//    fl_utf2unicode((unsigned char *)fl_selection_buffer[1], fl_selection_length[1], (xchar*)g);
+      l = fltk3::utf8toUtf16(fl_selection_buffer[1], fl_selection_length[1], g, (l+1));
+      g[l] = 0;
+      GlobalUnlock(h);
+      SetClipboardData(CF_UNICODETEXT, h);
+    }
+
+    // Windoze also seems unhappy if I don't do this. Documentation very
+    // unclear on what is correct:
+    if (fl_msg.message == WM_RENDERALLFORMATS) CloseClipboard();
+    return 1;}
+
+  default:
+    if (fltk3::handle(0,0)) return 0;
+    break;
+  }
+
+
+  return DefWindowProcW(hWnd, uMsg, wParam, lParam);
+}
+
+////////////////////////////////////////////////////////////////
+// This function gets the dimensions of the top/left borders and
+// the title bar, if there is one, based on the FL_BORDER, FL_MODAL
+// and FL_NONMODAL flags, and on the window's size range.
+// It returns the following values:
+//
+// value | border | title bar
+//   0   |  none  |   no
+//   1   |  fix   |   yes
+//   2   |  size  |   yes
+
+int Fl_X::fake_X_wm(const fltk3::Window* w,int &X,int &Y, int &bt,int &bx, int &by) {
+  int W, H, xoff, yoff, dx, dy;
+  int ret = bx = by = bt = 0;
+
+  int fallback = 1;
+  if (!w->parent()) {
+    HWND hwnd = fl_xid(w);
+    if (hwnd) {
+      // The block below calculates the window borders by requesting the
+      // required decorated window rectangle for a desired client rectangle.
+      // If any part of the function above fails, we will drop to a 
+      // fallback to get the best guess which is always available.
+      HWND hwnd = fl_xid(w);
+      // request the style flags of this window, as WIN32 sees them
+      LONG style = GetWindowLong(hwnd, GWL_STYLE);
+      LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+      RECT r;
+      r.left = w->x();
+      r.top = w->y();
+      r.right = w->x()+w->w();
+      r.bottom = w->y()+w->h();
+      // get the decoration rectangle for the desired client rectangle
+      BOOL ok = AdjustWindowRectEx(&r, style, FALSE, exstyle);
+      if (ok) {
+        X = r.left;
+        Y = r.top;
+        W = r.right - r.left;
+        H = r.bottom - r.top;
+        bx = w->x() - r.left;
+        by = r.bottom - w->y() - w->h(); // height of the bootm frame
+        bt = w->y() - r.top - by; // height of top caption bar
+        xoff = bx;
+        yoff = by + bt;
+        dx = W - w->w();
+        dy = H - w->h();
+        if (w->size_range_set && (w->maxw != w->minw || w->maxh != w->minh))
+          ret = 2;
+        else
+          ret = 1;
+        fallback = 0;
+      }
+    }
+  }
+  // This is the original (pre 1.1.7) routine to calculate window border sizes.
+  if (fallback) {
+    if (w->border() && !w->parent()) {
+      if (w->size_range_set && (w->maxw != w->minw || w->maxh != w->minh)) {
+        ret = 2;
+        bx = GetSystemMetrics(SM_CXSIZEFRAME);
+        by = GetSystemMetrics(SM_CYSIZEFRAME);
+      } else {
+        ret = 1;
+        bx = GetSystemMetrics(SM_CXFIXEDFRAME);
+        by = GetSystemMetrics(SM_CYFIXEDFRAME);
+      }
+      bt = GetSystemMetrics(SM_CYCAPTION);
+    }
+    //The coordinates of the whole window, including non-client area
+    xoff = bx;
+    yoff = by + bt;
+    dx = 2*bx;
+    dy = 2*by + bt;
+    X = w->x()-xoff;
+    Y = w->y()-yoff;
+    W = w->w()+dx;
+    H = w->h()+dy;
+  }
+
+  //Proceed to positioning the window fully inside the screen, if possible
+  //Find screen that contains most of the window
+  //FIXME: this ought to be the "work area" instead of the entire screen !
+  int scr_x, scr_y, scr_w, scr_h;
+  fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y, W, H);
+  //Make border's lower right corner visible
+  if (scr_x+scr_w < X+W) X = scr_x+scr_w - W;
+  if (scr_y+scr_h < Y+H) Y = scr_y+scr_h - H;
+  //Make border's upper left corner visible
+  if (X<scr_x) X = scr_x;
+  if (Y<scr_y) Y = scr_y;
+  //Make client area's lower right corner visible
+  if (scr_x+scr_w < X+dx+ w->w()) X = scr_x+scr_w - w->w() - dx;
+  if (scr_y+scr_h < Y+dy+ w->h()) Y = scr_y+scr_h - w->h() - dy;
+  //Make client area's upper left corner visible
+  if (X+xoff < scr_x) X = scr_x-xoff;
+  if (Y+yoff < scr_y) Y = scr_y-yoff;
+  //Return the client area's top left corner in (X,Y)
+  X+=xoff;
+  Y+=yoff;
+
+  return ret;
+}
+
+////////////////////////////////////////////////////////////////
+
+void fltk3::Window::resize(int X,int Y,int W,int H) {
+  UINT flags = SWP_NOSENDCHANGING | SWP_NOZORDER 
+             | SWP_NOACTIVATE | SWP_NOOWNERZORDER;
+  int is_a_resize = (W != w() || H != h());
+  int resize_from_program = (this != resize_bug_fix);
+  if (!resize_from_program) resize_bug_fix = 0;
+  if (X != x() || Y != y()) {
+    force_position(1);
+  } else {
+    if (!is_a_resize) return;
+    flags |= SWP_NOMOVE;
+  }
+  if (is_a_resize) {
+    Group::resize(X,Y,W,H);
+    if (visible_r()) {
+      redraw(); 
+      // only wait for exposure if this window has a size - a window 
+      // with no width or height will never get an exposure event
+      if (i && W>0 && H>0)
+        i->wait_for_expose = 1;
+    }
+  } else {
+    x(X); y(Y);
+    flags |= SWP_NOSIZE;
+  }
+  if (!border()) flags |= SWP_NOACTIVATE;
+  if (resize_from_program && shown()) {
+    if (!resizable()) size_range(w(),h(),w(),h());
+    int dummy_x, dummy_y, bt, bx, by;
+    //Ignore window managing when resizing, so that windows (and more
+    //specifically menus) can be moved offscreen.
+    if (Fl_X::fake_X_wm(this, dummy_x, dummy_y, bt, bx, by)) {
+      X -= bx;
+      Y -= by+bt;
+      W += 2*bx;
+      H += 2*by+bt;
+    }
+    // avoid zero size windows. A zero sized window on Win32
+    // will cause continouly  new redraw events.
+    if (W<=0) W = 1;
+    if (H<=0) H = 1;
+    SetWindowPos(i->xid, 0, X, Y, W, H, flags);
+  }
+}
+
+////////////////////////////////////////////////////////////////
+
+/*
+ * This silly little class remembers the name of all window classes 
+ * we register to avoid double registration. It has the added bonus 
+ * of freeing everything on application close as well.
+ */
+class NameList {
+public:
+  NameList() { name = (char**)malloc(sizeof(char**)); NName = 1; nName = 0; }
+  ~NameList() { 
+    int i;
+    for (i=0; i<nName; i++) free(name[i]);
+    if (name) free(name); 
+  }
+  void add_name(const char *n) {
+    if (NName==nName) {
+      NName += 5;
+      name = (char**)realloc(name, NName * sizeof(char*));
+    }
+    name[nName++] = strdup(n);
+  }
+  char has_name(const char *n) {
+    int i;
+    for (i=0; i<nName; i++) {
+      if (strcmp(name[i], n)==0) return 1;
+    }
+    return 0;
+  }
+private:
+  char **name;
+  int nName, NName;
+};
+
+void fl_fix_focus(); // in Fl.cxx
+
+char fl_show_iconic;	// hack for fltk3::Window::iconic()
+// int fl_background_pixel = -1; // color to use for background
+HCURSOR fl_default_cursor;
+UINT fl_wake_msg = 0;
+int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR
+
+Fl_X* Fl_X::make(fltk3::Window* w) {
+  fltk3::Group::current(0); // get rid of very common user bug: forgot end()
+
+  // if the window is a subwindow and our parent is not mapped yet, we
+  // mark this window visible, so that mapping the parent at a later
+  // point in time will call this function again to finally map the subwindow.
+  if (w->parent() && !Fl_X::i(w->window())) {
+    w->set_visible();
+    return 0L;
+  }
+
+  static NameList class_name_list;
+  static const char *first_class_name = 0L;
+  const char *class_name = w->xclass();
+  if (!class_name) class_name = first_class_name; // reuse first class name used
+  if (!class_name) class_name = "FLTK"; // default to create a "FLTK" WNDCLASS
+  if (!first_class_name) {
+    first_class_name = class_name;
+  }
+
+  wchar_t class_namew[100]; // (limited) buffer for Windows class name
+
+  // convert UTF-8 class_name to wchar_t for RegisterClassExW and CreateWindowExW
+
+  fltk3::utf8toUtf16(class_name,strlen(class_name),		// in
+		 (unsigned short*)class_namew,		// out
+		 sizeof(class_namew)/sizeof(wchar_t));	// max. size
+
+  if (!class_name_list.has_name(class_name)) {
+    WNDCLASSEXW wcw;
+    memset(&wcw, 0, sizeof(wcw));
+    wcw.cbSize = sizeof(WNDCLASSEXW);
+
+    // Documentation states a device context consumes about 800 bytes
+    // of memory... so who cares? If 800 bytes per window is what it
+    // takes to speed things up, I'm game.
+    //wc.style = CS_HREDRAW | CS_VREDRAW | CS_CLASSDC | CS_DBLCLKS;
+    wcw.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC | CS_DBLCLKS;
+    wcw.lpfnWndProc = (WNDPROC)WndProc;
+    wcw.cbClsExtra = wcw.cbWndExtra = 0;
+    wcw.hInstance = fl_display;
+    if (!w->icon())
+      w->icon((void *)LoadIcon(NULL, IDI_APPLICATION));
+    wcw.hIcon = wcw.hIconSm = (HICON)w->icon();
+    wcw.hCursor = fl_default_cursor = LoadCursor(NULL, IDC_ARROW);
+    //uchar r,g,b; fltk3::get_color(fltk3::GRAY,r,g,b);
+    //wc.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(r,g,b));
+    wcw.hbrBackground = NULL;
+    wcw.lpszMenuName = NULL;
+    wcw.lpszClassName = class_namew;
+    RegisterClassExW(&wcw);
+    class_name_list.add_name(class_name);
+  }
+
+  const wchar_t* message_namew = L"FLTK::ThreadWakeup";
+  if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessageW(message_namew);
+
+  HWND parent;
+  DWORD style = WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
+  DWORD styleEx = WS_EX_LEFT;
+
+  int xp = w->x();
+  int yp = w->y();
+  int wp = w->w();
+  int hp = w->h();
+
+  int showit = 1;
+
+  if (w->parent()) {
+    style |= WS_CHILD;
+    styleEx |= WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT;
+    parent = fl_xid(w->window());
+  } else {
+    if (!w->size_range_set) {
+      if (w->resizable()) {
+	fltk3::Widget *o = w->resizable();
+	int minw = o->w(); if (minw > 100) minw = 100;
+	int minh = o->h(); if (minh > 100) minh = 100;
+	w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+      } else {
+	w->size_range(w->w(), w->h(), w->w(), w->h());
+      }
+    }
+    styleEx |= WS_EX_WINDOWEDGE | WS_EX_CONTROLPARENT;
+    int xwm = xp , ywm = yp , bt, bx, by;
+    switch (fake_X_wm(w, xwm, ywm, bt, bx, by)) {
+      // No border (used for menus)
+      case 0: style |= WS_POPUP;
+              styleEx |= WS_EX_TOOLWINDOW;
+	      break;
+
+      // Thin border and title bar
+      case 1: style |= WS_DLGFRAME | WS_CAPTION; break;
+
+      // Thick, resizable border and title bar, with maximize button
+      case 2: style |= WS_THICKFRAME | WS_MAXIMIZEBOX | WS_CAPTION ; break;
+    }
+    if (by+bt) {
+      if (!w->modal()) style |= WS_SYSMENU | WS_MINIMIZEBOX;
+      wp += 2*bx;
+      hp += 2*by+bt;
+    }
+    if (!w->force_position()) {
+      xp = yp = CW_USEDEFAULT;
+    } else {
+      if (!fltk3::grab()) {
+	xp = xwm; yp = ywm;
+        w->x(xp);w->y(yp);
+      }
+      xp -= bx;
+      yp -= by+bt;
+    }
+
+    parent = 0;
+    if (w->non_modal() && Fl_X::first && !fl_disable_transient_for) {
+      // find some other window to be "transient for":
+      fltk3::Window* w = Fl_X::first->w;
+      while (w->parent()) w = w->window();
+      parent = fl_xid(w);
+      if (!w->visible()) showit = 0;
+    } else if (fltk3::grab()) parent = fl_xid(fltk3::grab());
+  }
+
+  Fl_X* x = new Fl_X;
+  x->other_xid = 0;
+  x->setwindow(w);
+  x->region = 0;
+  x->private_dc = 0;
+  x->cursor = fl_default_cursor;
+  if (!fl_codepage) fl_get_codepage();
+
+  WCHAR *lab = NULL;
+  if (w->label()) {
+    int l = strlen(w->label());
+//  lab = (WCHAR*) malloc((l + 1) * sizeof(short));
+//  l = fl_utf2unicode((unsigned char*)w->label(), l, (xchar*)lab);
+//  lab[l] = 0;
+    unsigned wlen = fltk3::utf8toUtf16(w->label(), l, NULL, 0); // Pass NULL to query length
+    wlen++;
+    lab = (WCHAR *) malloc(sizeof(WCHAR)*wlen);
+    wlen = fltk3::utf8toUtf16(w->label(), l, (unsigned short*)lab, wlen);
+    lab[wlen] = 0;
+  }
+  x->xid = CreateWindowExW(
+    styleEx,
+    class_namew, lab, style,
+    xp, yp, wp, hp,
+    parent,
+    NULL, // menu
+    fl_display,
+    NULL // creation parameters
+  );
+  if (lab) free(lab);
+
+  x->next = Fl_X::first;
+  Fl_X::first = x;
+
+  x->wait_for_expose = 1;
+  if (fl_show_iconic) {showit = 0; fl_show_iconic = 0;}
+  if (showit) {
+    w->set_visible();
+    int old_event = fltk3::e_number;
+    w->handle(fltk3::e_number = fltk3::SHOW); // get child windows to appear
+    fltk3::e_number = old_event;
+    w->redraw(); // force draw to happen
+  }
+  // If we've captured the mouse, we dont want to activate any
+  // other windows from the code, or we lose the capture.
+  ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE :
+	     (fltk3::grab() || (style & WS_POPUP)) ? SW_SHOWNOACTIVATE : SW_SHOWNORMAL);
+
+  // Register all windows for potential drag'n'drop operations
+  fl_OleInitialize();
+  RegisterDragDrop(x->xid, flIDropTarget);
+
+  if (!fl_aimm) {
+    CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER,
+		     IID_IActiveIMMApp, (void**) &fl_aimm);
+    if (fl_aimm) {
+      fl_aimm->Activate(TRUE);
+    }
+  }
+
+  if (w->modal()) {fltk3::modal_ = w; fl_fix_focus();}
+  return x;
+}
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+/// Win32 timers
+///
+
+
+static LRESULT CALLBACK s_TimerProc(HWND hwnd, UINT msg,
+                                    WPARAM wParam, LPARAM lParam)
+{
+  switch (msg) {
+  case WM_TIMER:
+    {
+      unsigned int id = wParam - 1;
+      if (id < (unsigned int)win32_timer_used && win32_timers[id].handle) {
+        fltk3::TimeoutHandler cb   = win32_timers[id].callback;
+        void*              data = win32_timers[id].data;
+        delete_timer(win32_timers[id]);
+        if (cb) {
+          (*cb)(data);
+        }
+      }
+    }
+    return 0;
+
+  default:
+    break;
+  }
+
+  return DefWindowProc(hwnd, msg, wParam, lParam);
+}
+
+void fltk3::add_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+  repeat_timeout(time, cb, data);
+}
+
+void fltk3::repeat_timeout(double time, fltk3::TimeoutHandler cb, void* data)
+{
+  int timer_id = -1;
+  for (int i = 0;  i < win32_timer_used;  ++i) {
+    if ( !win32_timers[i].handle ) {
+      timer_id = i;
+      break;
+    }
+  }
+  if (timer_id == -1) {
+    if (win32_timer_used == win32_timer_alloc) {
+      realloc_timers();
+    }
+    timer_id = win32_timer_used++;
+  }
+  unsigned int elapsed = (unsigned int)(time * 1000);
+
+  if ( !s_TimerWnd ) {
+    const char* timer_class = "FLTimer";
+    WNDCLASSEX wc;
+    memset(&wc, 0, sizeof(wc));
+    wc.cbSize = sizeof (wc);
+    wc.style = CS_CLASSDC;
+    wc.lpfnWndProc = (WNDPROC)s_TimerProc;
+    wc.hInstance = fl_display;
+    wc.lpszClassName = timer_class;
+    /*ATOM atom =*/ RegisterClassEx(&wc);
+    // create a zero size window to handle timer events
+    s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
+                                timer_class, "",
+                                WS_POPUP,
+                                0, 0, 0, 0,
+                                NULL, NULL, fl_display, NULL);
+    // just in case this OS won't let us create a 0x0 size window:
+    if (!s_TimerWnd)
+      s_TimerWnd = CreateWindowEx(WS_EX_LEFT | WS_EX_TOOLWINDOW,
+				  timer_class, "",
+				  WS_POPUP,
+				  0, 0, 1, 1,
+				  NULL, NULL, fl_display, NULL);
+    ShowWindow(s_TimerWnd, SW_SHOWNOACTIVATE);
+  }
+
+  win32_timers[timer_id].callback = cb;
+  win32_timers[timer_id].data     = data;
+
+  win32_timers[timer_id].handle =
+    SetTimer(s_TimerWnd, timer_id + 1, elapsed, NULL);
+}
+
+int fltk3::has_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+  for (int i = 0;  i < win32_timer_used;  ++i) {
+    Win32Timer& t = win32_timers[i];
+    if (t.handle  &&  t.callback == cb  &&  t.data == data) {
+      return 1;
+    }
+  }
+  return 0;
+}
+
+void fltk3::remove_timeout(fltk3::TimeoutHandler cb, void* data)
+{
+  int i;
+  for (i = 0;  i < win32_timer_used;  ++i) {
+    Win32Timer& t = win32_timers[i];
+    if (t.handle  &&  t.callback == cb  &&
+      (t.data == data  ||  data == NULL)) {
+      delete_timer(t);
+    }
+  }
+}
+
+/// END TIMERS
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+////////////////////////////////////////////////////////////////
+
+HINSTANCE fl_display = GetModuleHandle(NULL);
+
+void fltk3::Window::size_range_() {
+  size_range_set = 1;
+}
+
+void Fl_X::set_minmax(LPMINMAXINFO minmax)
+{
+  int td, wd, hd, dummy_x, dummy_y;
+
+  fake_X_wm(w, dummy_x, dummy_y, td, wd, hd);
+  wd *= 2;
+  hd *= 2;
+  hd += td;
+
+  minmax->ptMinTrackSize.x = w->minw + wd;
+  minmax->ptMinTrackSize.y = w->minh + hd;
+  if (w->maxw) {
+    minmax->ptMaxTrackSize.x = w->maxw + wd;
+    minmax->ptMaxSize.x = w->maxw + wd;
+  }
+  if (w->maxh) {
+    minmax->ptMaxTrackSize.y = w->maxh + hd;
+    minmax->ptMaxSize.y = w->maxh + hd;
+  }
+}
+
+////////////////////////////////////////////////////////////////
+
+#include <fltk3/filename.h> // need so FLTK3_EXPORT fltk3::filename_name works
+
+// returns pointer to the filename, or null if name ends with '/'
+const char *fltk3::filename_name(const char *name) {
+  const char *p,*q;
+  if (!name) return (0);
+  q = name;
+  if (q[0] && q[1]==':') q += 2; // skip leading drive letter
+  for (p = q; *p; p++) if (*p == '/' || *p == '\\') q = p+1;
+  return q;
+}
+
+void fltk3::Window::label(const char *name,const char *iname) {
+  Widget::label(name);
+  iconlabel_ = iname;
+  if (shown() && !parent()) {
+    if (!name) name = "";
+    int l = strlen(name);
+//  WCHAR *lab = (WCHAR*) malloc((l + 1) * sizeof(short));
+//  l = fl_utf2unicode((unsigned char*)name, l, (xchar*)lab);
+    unsigned wlen = fltk3::utf8toUtf16(name, l, NULL, 0); // Pass NULL to query length
+    wlen++;
+    unsigned short * lab = (unsigned short*)malloc(sizeof(unsigned short)*wlen);
+    wlen = fltk3::utf8toUtf16(name, l, lab, wlen);
+    lab[wlen] = 0;
+    SetWindowTextW(i->xid, (WCHAR *)lab);
+    free(lab);
+  }
+}
+
+////////////////////////////////////////////////////////////////
+// Implement the virtual functions for the base fltk3::Window class:
+
+// If the box is a filled rectangle, we can make the redisplay *look*
+// faster by using X's background pixel erasing.  We can make it
+// actually *be* faster by drawing the frame only, this is done by
+// setting fl_boxcheat, which is seen by code in fl_drawbox.cxx:
+// For WIN32 it looks like all windows share a background color, so
+// I use fltk3::GRAY for this and only do this cheat for windows that are
+// that color.
+// Actually it is totally disabled.
+// fltk3::Widget *fl_boxcheat;
+//static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
+
+void fltk3::Window::show() {
+  image(fltk3::scheme_bg_);
+  if (fltk3::scheme_bg_) {
+    labeltype(fltk3::NORMAL_LABEL);
+    align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+  } else {
+    labeltype(fltk3::NO_LABEL);
+  }
+  fltk3::Tooltip::exit(this);
+  if (!shown()) {
+    // if (can_boxcheat(box())) fl_background_pixel = fl_xpixel(color());
+    Fl_X::make(this);
+  } else {
+    // Once again, we would lose the capture if we activated the window.
+    if (IsIconic(i->xid)) OpenIcon(i->xid);
+    if (!fl_capture) BringWindowToTop(i->xid);
+    //ShowWindow(i->xid,fl_capture?SW_SHOWNOACTIVATE:SW_RESTORE);
+  }
+#ifdef USE_PRINT_BUTTON
+void preparePrintFront(void);
+preparePrintFront();
+#endif
+}
+
+fltk3::Window *fltk3::Window::current_;
+// the current context
+HDC fl_gc = 0;
+// the current window handle, initially set to -1 so we can correctly
+// allocate fl_GetDC(0)
+HWND fl_window = NULL;
+
+// Here we ensure only one GetDC is ever in place.
+HDC fl_GetDC(HWND w) {
+  if (fl_gc) {
+    if (w == fl_window  &&  fl_window != NULL) return fl_gc;
+    if (fl_window) fl_release_dc(fl_window, fl_gc); // ReleaseDC
+  }
+  fl_gc = GetDC(w);
+  fl_save_dc(w, fl_gc);
+  fl_window = w;
+  // calling GetDC seems to always reset these: (?)
+  SetTextAlign(fl_gc, TA_BASELINE|TA_LEFT);
+  SetBkMode(fl_gc, TRANSPARENT);
+
+  return fl_gc;
+}
+
+// make X drawing go into this window (called by subclass flush() impl.)
+void fltk3::Window::make_current() {
+  fl_GetDC(fl_xid(this));
+
+#if USE_COLORMAP
+  // Windows maintains a hardware and software color palette; the
+  // SelectPalette() call updates the current soft->hard mapping
+  // for all drawing calls, so we must select it here before any
+  // code does any drawing...
+
+  fl_select_palette();
+#endif // USE_COLORMAP
+
+  current_ = this;
+  fltk3::clip_region(0);
+
+
+}
+
+/* Make sure that all allocated fonts are released. This works only if 
+   fltk3::run() is allowed to exit by closing all windows. Calling 'exit(int)'
+   will not automatically free any fonts. */
+void fl_free_fonts(void)
+{
+// remove the Fl_Font_Descriptor chains
+  int i;
+  Fl_Fontdesc * s;
+  Fl_Font_Descriptor * f;
+  Fl_Font_Descriptor * ff;
+  for (i=0; i<fltk3::FREE_FONT; i++) {
+    s = fltk3::fonts + i;
+    for (f=s->first; f; f=ff) {
+      ff = f->next;
+      delete f;
+      s->first = ff;
+    }
+  }
+}
+
+
+///////////////////////////////////////////////////////////////////////
+//
+//  The following routines help fix a problem with the leaking of Windows
+//  Device Context (DC) objects. The 'proper' protocol is for a program to
+//  acquire a DC, save its state, do the modifications needed for drawing,
+//  perform the drawing, restore the initial state, and release the DC. In
+//  FLTK, the save and restore steps have previously been omitted and DCs are
+//  not properly released, leading to a great number of DC leaks. As some
+//  Windows "OSs" will hang when any process exceeds roughly 10,000 GDI objects,
+//  it is important to control GDI leaks, which are much more important than memory
+//  leaks. The following struct, global variable, and routines help implement
+//  the above protocol for those cases where the GetDC and RestoreDC are not in
+//  the same routine. For each GetDC, fl_save_dc is used to create an entry in 
+//  a linked list that saves the window handle, the DC handle, and the initial
+//  state. When the DC is to be released, 'fl_release_dc' is called. It restores
+//  the initial state and releases the DC. When the program exits, 'fl_cleanup_dc_list'
+//  frees any remaining nodes in the list.
+
+struct Win_DC_List {      // linked list 
+  HWND    window;         // window handle
+  HDC     dc;             // device context handle
+  int     saved_dc;       // initial state of DC
+  Win_DC_List * next;     // pointer to next item
+};
+
+static Win_DC_List * win_DC_list = 0;
+
+void fl_save_dc( HWND w, HDC dc) {
+  Win_DC_List * t;
+  t = new Win_DC_List;
+  t->window = w;
+  t->dc = dc;
+  t->saved_dc = SaveDC(dc);
+  if (win_DC_list)
+    t->next = win_DC_list;
+  else
+    t->next = NULL;
+  win_DC_list = t;
+}
+
+void fl_release_dc(HWND w, HDC dc) {
+  Win_DC_List * t= win_DC_list;
+  Win_DC_List * prev = 0;
+  if (!t)
+    return;
+  do {
+    if (t->dc == dc) {
+      RestoreDC(dc, t->saved_dc);
+      ReleaseDC(w, dc);
+      if (!prev) {
+        win_DC_list = t->next;   // delete first item
+      } else {
+        prev->next = t->next;       // one in the middle
+      }
+      delete (t);
+      return;
+    }
+    prev = t;
+    t = t->next;
+  } while (t);
+}
+
+void fl_cleanup_dc_list(void) {          // clean up the list
+  Win_DC_List * t = win_DC_list;
+  if (!t)return;
+  do {
+    RestoreDC(t->dc, t->saved_dc);
+    ReleaseDC(t->window, t->dc);
+    win_DC_list = t->next;
+    delete (t);
+    t = win_DC_list;
+  } while(t);
+}
+
+fltk3::Region XRectangleRegion(int x, int y, int w, int h) {
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::DisplayDevice::class_id) return CreateRectRgn(x,y,x+w,y+h);
+  // because rotation may apply, the rectangle becomes a polygon in device coords
+  POINT pt[4] = { {x, y}, {x + w, y}, {x + w, y + h}, {x, y + h} };
+  LPtoDP(fl_gc, pt, 4);
+  return CreatePolygonRgn(pt, 4, ALTERNATE);
+}
+
+Window fl_xid_(const fltk3::Window *w) {
+  Fl_X *temp = Fl_X::i(w); 
+  return temp ? temp->xid : 0;
+}
+
+int fltk3::Window::decorated_w()
+{
+  if (!shown() || parent() || !border() || !visible()) return w();
+  int X, Y, bt, bx, by;
+  Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
+  return w() + 2 * bx;
+}
+
+int fltk3::Window::decorated_h()
+{
+  if (!shown() || parent() || !border() || !visible()) return h();
+  int X, Y, bt, bx, by;
+  Fl_X::fake_X_wm(this, X, Y, bt, bx, by);
+  return h() + bt + 2 * by;
+}
+
+void fltk3::PagedDevice::print_window(fltk3::Window *win, int x_offset, int y_offset)
+{
+  if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
+    this->print_widget(win, x_offset, y_offset);
+    return;
+  }
+  int X, Y, bt, bx, by, ww, wh; // compute the window border sizes
+  Fl_X::fake_X_wm(win, X, Y, bt, bx, by);
+  ww = win->w() + 2 * bx;
+  wh = win->h() + bt + 2 * by;
+  fltk3::DisplayDevice::display_device()->set_current(); // make window current
+  win->show();
+  fltk3::check();
+  win->make_current();
+  HDC save_gc = fl_gc;
+  fl_gc = GetDC(NULL); // get the screen device context
+  // capture the 4 window sides from screen
+  RECT r; GetWindowRect(fl_window, &r);
+  uchar *top_image = fltk3::read_image(NULL, r.left, r.top, ww, bt + by);
+  uchar *left_image = fltk3::read_image(NULL, r.left, r.top, bx, wh);
+  uchar *right_image = fltk3::read_image(NULL, r.right - bx, r.top, bx, wh);
+  uchar *bottom_image = fltk3::read_image(NULL, r.left, r.bottom-by, ww, by);
+  ReleaseDC(NULL, fl_gc); fl_gc = save_gc;
+  this->set_current();
+  // print the 4 window sides
+  fltk3::draw_image(top_image, x_offset, y_offset, ww, bt + by, 3);
+  fltk3::draw_image(left_image, x_offset, y_offset, bx, wh, 3);
+  fltk3::draw_image(right_image, x_offset + win->w() + bx, y_offset, bx, wh, 3);
+  fltk3::draw_image(bottom_image, x_offset, y_offset + win->h() + bt + by, ww, by, 3);
+  delete[] top_image;
+  delete[] left_image;
+  delete[] right_image;
+  delete[] bottom_image;
+  // print the window inner part
+  this->print_widget(win, x_offset + bx, y_offset + bt + by);
+  fl_gc = GetDC(fl_xid(win));
+  ReleaseDC(fl_xid(win), fl_gc);
+}  
+
+#ifdef USE_PRINT_BUTTON
+// to test the fltk3::Printer class creating a "Print front window" button in a separate window
+// contains also preparePrintFront call above
+#include <fltk3/Printer.h>
+#include <fltk3/Button.h>
+void printFront(fltk3::Widget *o, void *data)
+{
+  fltk3::Printer printer;
+  o->window()->hide();
+  fltk3::Window *win = fltk3::first_window();
+  if(!win) return;
+  int w, h;
+  if( printer.start_job(1) ) { o->window()->show(); return; }
+  if( printer.start_page() ) { o->window()->show(); return; }
+  printer.printable_rect(&w,&h);
+  int  wh, ww;
+  wh = win->decorated_h();
+  ww = win->decorated_w();
+  // scale the printer device so that the window fits on the page
+  float scale = 1;
+  if (ww > w || wh > h) {
+    scale = (float)w/ww;
+    if ((float)h/wh < scale) scale = (float)h/wh;
+    printer.scale(scale, scale);
+  }
+// #define ROTATE 20.0
+#ifdef ROTATE
+  printer.scale(scale * 0.8, scale * 0.8);
+  printer.printable_rect(&w, &h);
+  printer.origin(w/2, h/2 );
+  printer.rotate(ROTATE);
+  printer.print_widget( win, - win->w()/2, - win->h()/2 );
+  //printer.print_window_part( win, 0,0, win->w(), win->h(), - win->w()/2, - win->h()/2 );
+#else  
+  printer.print_window(win);
+#endif
+  printer.end_page();
+  printer.end_job();
+  o->window()->show();
+}
+
+void preparePrintFront(void)
+{
+  static BOOL first=TRUE;
+  if(!first) return;
+  first=FALSE;
+  static fltk3::Window w(0,0,120,30);
+  static fltk3::Button b(0,0,w.w(),w.h(), "Print front window");
+  b.callback(printFront);
+  w.end();
+  w.show();
+}
+#endif // USE_PRINT_BUTTON
+
+#endif // FLTK3_DOXYGEN
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32NativeFileChooser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Native_File_Chooser_WIN32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32NativeFileChooser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32NativeFileChooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,860 @@
+// "$Id$"
+//
+// FLTK native OS file chooser widget
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 2004 Greg Ercolano.
+// API changes + filter improvements by Nathan Vander Wilt 2005
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Any application to multi-folder implementation:
+//     http://www.codeproject.com/dialog/selectfolder.asp
+//
+
+#ifndef FLTK3_DOXYGEN		// PREVENT DOXYGEN'S USE OF THIS FILE
+
+#include <stdio.h>		// debugging
+#include <wchar.h>		//MG
+#include "Fl_Native_File_Chooser_common.cxx"		// strnew/strfree/strapp/chrcat
+typedef const wchar_t *LPCWSTR; //MG
+LPCWSTR utf8towchar(const char *in); //MG
+char *wchartoutf8(LPCWSTR in);  //MG
+
+#include <fltk3/NativeFileChooser.h>
+
+#define LCURLY_CHR	'{'
+#define RCURLY_CHR	'}'
+#define LBRACKET_CHR	'['
+#define RBRACKET_CHR	']'
+#define MAXFILTERS	80
+
+void fl_OleInitialize();	// in Fl.cxx (Windows only)
+
+// STATIC: PRINT WINDOWS 'DOUBLE NULL' STRING (DEBUG)
+#ifdef DEBUG
+static void dnullprint(char *wp) {
+  if ( ! wp ) return;
+  for ( int t=0; true; t++ ) {
+    if ( wp[t] == '\0' && wp[t+1] == '\0' ) {
+      printf("\\0\\0");
+      fflush(stdout);
+      return;
+    } else if ( wp[t] == '\0' ) {
+      printf("\\0");
+    } else { 
+      printf("%c",wp[t]);
+    }
+  }
+}
+#endif
+
+// RETURN LENGTH OF DOUBLENULL STRING
+//    Includes single nulls in count, excludes trailing doublenull.
+//
+//         1234 567
+//         |||/\|||
+//    IN: "one\0two\0\0"
+//   OUT: 7
+//
+static int dnulllen(const char *wp) {
+  int len = 0;
+  while ( ! ( *(wp+0) == 0 && *(wp+1) == 0 ) ) {
+    ++wp;
+    ++len;
+  }
+  return(len);
+}
+
+// STATIC: Append a string to another, leaving terminated with DOUBLE NULL.
+//     Automatically handles extending length of string.
+//     wp can be NULL (a new wp will be allocated and initialized).
+//     string must be NULL terminated.
+//     The pointer wp may be modified on return.
+//
+static void dnullcat(char*&wp, const char *string, int n = -1 ) {
+  //DEBUG printf("DEBUG: dnullcat IN: <"); dnullprint(wp); printf(">\n");
+  int inlen = ( n < 0 ) ? strlen(string) : n;
+  if ( ! wp ) {
+    wp = new char[inlen + 4];
+    *(wp+0) = '\0';
+    *(wp+1) = '\0';
+  } else {
+    int wplen = dnulllen(wp);
+    // Make copy of wp into larger buffer
+    char *tmp = new char[wplen + inlen + 4];
+    memcpy(tmp, wp, wplen+2);	// copy of wp plus doublenull
+    delete [] wp;			// delete old wp
+    wp = tmp;			// use new copy
+    //DEBUG printf("DEBUG: dnullcat COPY: <"); dnullprint(wp); printf("> (wplen=%d)\n", wplen);
+  }
+
+  // Find end of double null string
+  //     *wp2 is left pointing at second null.
+  //
+  char *wp2 = wp;
+  if ( *(wp2+0) != '\0' && *(wp2+1) != '\0' ) {
+    for ( ; 1; wp2++ ) {
+      if ( *(wp2+0) == '\0' && *(wp2+1) == '\0' ) {
+        wp2++;
+        break;
+      }
+    }
+  }
+
+  if ( n == -1 ) n = strlen(string);
+  strncpy(wp2, string, n);
+
+  // Leave string double-null terminated
+  *(wp2+n+0) = '\0';
+  *(wp2+n+1) = '\0';
+  //DEBUG printf("DEBUG: dnullcat OUT: <"); dnullprint(wp); printf(">\n\n");
+}
+
+// CTOR
+fltk3::NativeFileChooser::NativeFileChooser(int val) {
+  _btype           = val;
+  _options         = NO_OPTIONS;
+  memset((void*)&_ofn, 0, sizeof(OPENFILENAMEW));
+  _ofn.lStructSize = sizeof(OPENFILENAMEW);
+  _ofn.hwndOwner   = NULL;
+  memset((void*)&_binf, 0, sizeof(BROWSEINFO));
+  _pathnames       = NULL;
+  _tpathnames      = 0;
+  _directory       = NULL;
+  _title           = NULL;
+  _filter          = NULL;
+  _parsedfilt      = NULL;
+  _nfilters        = 0;
+  _preset_file     = NULL;
+  _errmsg          = NULL;
+}
+
+// DTOR
+fltk3::NativeFileChooser::~NativeFileChooser() {
+  //_pathnames                // managed by clear_pathnames()
+  //_tpathnames               // managed by clear_pathnames()
+  _directory   = strfree(_directory);
+  _title       = strfree(_title);
+  _filter      = strfree(_filter);
+  //_parsedfilt               // managed by clear_filters()
+  //_nfilters                 // managed by clear_filters()
+  _preset_file = strfree(_preset_file);
+  _errmsg      = strfree(_errmsg);
+  clear_filters();
+  clear_pathnames();
+  ClearOFN();
+  ClearBINF();
+}
+
+// SET TYPE OF BROWSER
+void fltk3::NativeFileChooser::type(int val) {
+  _btype = val;
+}
+
+// GET TYPE OF BROWSER
+int fltk3::NativeFileChooser::type() const {
+  return( _btype );
+}
+
+// SET OPTIONS
+void fltk3::NativeFileChooser::options(int val) {
+  _options = val;
+}
+
+// GET OPTIONS
+int fltk3::NativeFileChooser::options() const {
+  return(_options);
+}
+
+// PRIVATE: SET ERROR MESSAGE
+void fltk3::NativeFileChooser::errmsg(const char *val) {
+  _errmsg = strfree(_errmsg);
+  _errmsg = strnew(val);
+}
+
+// FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS
+void fltk3::NativeFileChooser::clear_pathnames() {
+  if ( _pathnames ) {
+    while ( --_tpathnames >= 0 ) {
+      _pathnames[_tpathnames] = strfree(_pathnames[_tpathnames]);
+    }
+    delete [] _pathnames;
+    _pathnames = NULL;
+  }
+  _tpathnames = 0;
+}
+
+// SET A SINGLE PATHNAME
+void fltk3::NativeFileChooser::set_single_pathname(const char *s) {
+  clear_pathnames();
+  _pathnames = new char*[1];
+  _pathnames[0] = strnew(s);
+  _tpathnames = 1;
+}
+
+// ADD PATHNAME TO EXISTING ARRAY
+void fltk3::NativeFileChooser::add_pathname(const char *s) {
+  if ( ! _pathnames ) {
+    // Create first element in array
+    ++_tpathnames;
+    _pathnames = new char*[_tpathnames];
+  } else {
+    // Grow array by 1
+    char **tmp = new char*[_tpathnames+1];		// create new buffer
+    memcpy((void*)tmp, (void*)_pathnames, 
+		       sizeof(char*)*_tpathnames);	// copy old
+    delete [] _pathnames;				// delete old
+    _pathnames = tmp;					// use new
+    ++_tpathnames;
+  }
+  _pathnames[_tpathnames-1] = strnew(s);
+}
+
+// FREE A PIDL (Pointer to IDentity List)
+void fltk3::NativeFileChooser::FreePIDL(ITEMIDLIST *pidl) {
+  IMalloc *imalloc = NULL;
+  if ( SUCCEEDED(SHGetMalloc(&imalloc)) ) {
+    imalloc->Free(pidl);
+    imalloc->Release();
+    imalloc = NULL;
+  }
+}
+
+// CLEAR MICROSOFT OFN (OPEN FILE NAME) CLASS
+void fltk3::NativeFileChooser::ClearOFN() {
+  // Free any previously allocated lpstrFile before zeroing out _ofn
+  if ( _ofn.lpstrFile ) {
+    delete [] _ofn.lpstrFile;
+    _ofn.lpstrFile = NULL;
+  }
+  if ( _ofn.lpstrInitialDir ) {
+    delete [] (TCHAR*) _ofn.lpstrInitialDir; //msvc6 compilation fix
+    _ofn.lpstrInitialDir = NULL;
+  }
+  _ofn.lpstrFilter = NULL;		// (deleted elsewhere)
+  int temp = _ofn.nFilterIndex;		// keep the filter_value
+  memset((void*)&_ofn, 0, sizeof(_ofn));
+  _ofn.lStructSize  = sizeof(OPENFILENAMEW);
+  _ofn.nFilterIndex = temp;
+}
+
+// CLEAR MICROSOFT BINF (BROWSER INFO) CLASS
+void fltk3::NativeFileChooser::ClearBINF() {
+  if ( _binf.pidlRoot ) {
+    FreePIDL((ITEMIDLIST*)_binf.pidlRoot);
+    _binf.pidlRoot = NULL;
+  }
+  memset((void*)&_binf, 0, sizeof(_binf));
+}
+
+// CONVERT WINDOWS BACKSLASHES TO UNIX FRONTSLASHES
+void fltk3::NativeFileChooser::Win2Unix(char *s) {
+  for ( ; *s; s++ )
+    if ( *s == '\\' ) *s = '/';
+}
+
+// CONVERT UNIX FRONTSLASHES TO WINDOWS BACKSLASHES
+void fltk3::NativeFileChooser::Unix2Win(char *s) {
+  for ( ; *s; s++ )
+    if ( *s == '/' ) *s = '\\';
+}
+
+// SHOW FILE BROWSER
+int fltk3::NativeFileChooser::showfile() {
+  ClearOFN();
+  clear_pathnames();
+  size_t fsize = MAX_PATH;
+  _ofn.Flags |= OFN_NOVALIDATE;		// prevent disabling of front slashes
+  _ofn.Flags |= OFN_HIDEREADONLY;	// hide goofy readonly flag
+  // USE NEW BROWSER
+  _ofn.Flags |= OFN_EXPLORER;		// use newer explorer windows
+  _ofn.Flags |= OFN_ENABLESIZING;	// allow window to be resized (hey, why not?)
+
+  // XXX: The docs for OFN_NOCHANGEDIR says the flag is 'ineffective' on XP/2K/NT!
+  //      But let's set it anyway..
+  //
+  _ofn.Flags |= OFN_NOCHANGEDIR;	// prevent dialog for messing up the cwd
+
+  switch ( _btype ) {
+    case BROWSE_DIRECTORY:
+    case BROWSE_MULTI_DIRECTORY:
+    case BROWSE_SAVE_DIRECTORY:
+      abort();				// never happens: handled by showdir()
+    case BROWSE_FILE:
+      fsize = 65536;			// XXX: there must be a better way
+      break;
+    case BROWSE_MULTI_FILE:
+      _ofn.Flags |= OFN_ALLOWMULTISELECT;
+      fsize = 65536;			// XXX: there must be a better way
+      break;
+    case BROWSE_SAVE_FILE:
+      if ( options() & SAVEAS_CONFIRM && type() == BROWSE_SAVE_FILE ) {
+	  _ofn.Flags |= OFN_OVERWRITEPROMPT;
+      }
+      break;
+  }
+  // SPACE FOR RETURNED FILENAME
+  _ofn.lpstrFile    = new WCHAR[fsize];
+  _ofn.nMaxFile     = fsize-1;
+  _ofn.lpstrFile[0] = 0;
+  _ofn.lpstrFile[1] = 0;		// dnull
+  // PARENT WINDOW
+  _ofn.hwndOwner = GetForegroundWindow();
+  // DIALOG TITLE
+  if (_title) {
+    static WCHAR wtitle[200];
+    wcscpy(wtitle, utf8towchar(_title));
+    _ofn.lpstrTitle =  wtitle;
+  } else {
+    _ofn.lpstrTitle = NULL;
+  }
+  // FILTER
+  if (_parsedfilt != NULL) {	// to convert a null-containing char string into a widechar string
+    static WCHAR wpattern[MAX_PATH];
+    const char *p = _parsedfilt;
+    while(*(p + strlen(p) + 1) != 0) p += strlen(p) + 1;
+    p += strlen(p) + 2;
+    MultiByteToWideChar(CP_UTF8, 0, _parsedfilt, p - _parsedfilt, wpattern, MAX_PATH);
+    _ofn.lpstrFilter = wpattern;
+  } else {
+    _ofn.lpstrFilter = NULL;
+  }
+  // PRESET FILE
+  //     If set, supercedes _directory. See KB Q86920 for details
+  //
+  if ( _preset_file ) {
+    size_t len = strlen(_preset_file);
+    if ( len >= _ofn.nMaxFile ) {
+      char msg[80];
+      sprintf(msg, "preset_file() filename is too long: %ld is >=%ld", (long)len, (long)fsize);
+      return(-1);
+    }
+    wcscpy(_ofn.lpstrFile, utf8towchar(_preset_file));
+//  Unix2Win(_ofn.lpstrFile);
+    len = wcslen(_ofn.lpstrFile);
+    _ofn.lpstrFile[len+0] = 0;	// multiselect needs dnull
+    _ofn.lpstrFile[len+1] = 0;
+  }
+  if ( _directory ) {
+    // PRESET DIR
+    //     XXX: See KB Q86920 for doc bug:
+    //     http://support.microsoft.com/default.aspx?scid=kb;en-us;86920
+    //
+    _ofn.lpstrInitialDir    = new WCHAR[MAX_PATH];
+    wcscpy((WCHAR *)_ofn.lpstrInitialDir, utf8towchar(_directory));
+    // Unix2Win((char*)_ofn.lpstrInitialDir);
+  }
+  // SAVE THE CURRENT DIRECTORY
+  //     XXX: Save the cwd because GetOpenFileName() is probably going to
+  //     change it, in spite of the OFN_NOCHANGEDIR flag, due to its docs
+  //     saying the flag is 'ineffective'. %^(
+  //
+  char oldcwd[MAX_PATH];
+  GetCurrentDirectory(MAX_PATH, oldcwd);
+  oldcwd[MAX_PATH-1] = '\0';
+  // OPEN THE DIALOG WINDOW
+  int err;
+  if ( _btype == BROWSE_SAVE_FILE ) {
+    err = GetSaveFileNameW(&_ofn);
+  } else {
+    err = GetOpenFileNameW(&_ofn);
+  }
+  if ( err == 0 ) {
+    // EXTENDED ERROR CHECK
+    int err = CommDlgExtendedError();
+    // CANCEL?
+    if ( err == 0 ) return(1);	// user hit 'cancel'
+    // AN ERROR OCCURRED
+    char msg[80];
+    sprintf(msg, "CommDlgExtendedError() code=%d", err);
+    errmsg(msg);
+    // XXX: RESTORE CWD
+    if ( oldcwd[0] ) SetCurrentDirectory(oldcwd);
+    return(-1);
+  }
+  // XXX: RESTORE CWD
+  if ( oldcwd[0] ) {
+    SetCurrentDirectory(oldcwd);
+  }
+  // PREPARE PATHNAMES FOR RETURN
+  switch ( _btype ) {
+    case BROWSE_FILE: 
+    case BROWSE_SAVE_FILE:
+      set_single_pathname(wchartoutf8(_ofn.lpstrFile));
+      // Win2Unix(_pathnames[_tpathnames-1]);
+      break;
+    case BROWSE_MULTI_FILE: {
+      // EXTRACT MULTIPLE FILENAMES
+      const WCHAR *dirname = _ofn.lpstrFile;
+      int dirlen = wcslen(dirname);
+      if ( dirlen > 0 ) {
+	// WALK STRING SEARCHING FOR 'DOUBLE-NULL'
+	//     eg. "/dir/name\0foo1\0foo2\0foo3\0\0"
+	//
+	char pathname[MAX_PATH]; 
+	for ( const WCHAR *s = dirname + dirlen + 1; 
+		 *s; s+= (wcslen(s)+1)) {
+		strcpy(pathname, wchartoutf8(dirname));
+		strcat(pathname, "\\");
+		strcat(pathname, wchartoutf8(s));
+		add_pathname(pathname);
+	}
+      }
+      // XXX
+      //    Work around problem where pasted forward-slash pathname
+      //    into the file browser causes new "Explorer" interface
+      //    not to grok forward slashes, passing back as a 'filename'..!
+      //
+      if ( _tpathnames == 0 ) {
+	add_pathname(wchartoutf8(dirname)); 
+	// Win2Unix(_pathnames[_tpathnames-1]);
+      }
+      break;
+    }
+    case BROWSE_DIRECTORY:
+    case BROWSE_MULTI_DIRECTORY:
+    case BROWSE_SAVE_DIRECTORY:
+      abort();			// never happens: handled by showdir()
+  }
+  return(0);
+}
+
+// Used by SHBrowseForFolder(), sets initial selected dir.
+// Ref: Usenet: microsoft.public.vc.mfc, Dec 8 2000, 1:38p David Lowndes
+//              Subject: How to specify to select an initial folder .."
+//
+int CALLBACK fltk3::NativeFileChooser::Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data) {
+  switch (msg) {
+    case BFFM_INITIALIZED:
+      if (data) ::SendMessage(win, BFFM_SETSELECTION, TRUE, data);
+      break;
+    case BFFM_SELCHANGED:
+      TCHAR path[MAX_PATH];
+      if ( SHGetPathFromIDList((ITEMIDLIST*)param, path) ) {
+	::SendMessage(win, BFFM_ENABLEOK, 0, 1);
+      } else {
+	// disable ok button if not a path
+	::SendMessage(win, BFFM_ENABLEOK, 0, 0);
+      }
+      break;
+    case BFFM_VALIDATEFAILED:
+      // we could pop up an annoying message here. 
+      // also needs set ulFlags |= BIF_VALIDATE
+      break;
+    default:
+      break;
+  }
+  return(0);
+}
+
+// SHOW DIRECTORY BROWSER
+int fltk3::NativeFileChooser::showdir() {
+  // initialize OLE only once
+  fl_OleInitialize();		// init needed by BIF_USENEWUI
+  ClearBINF();
+  clear_pathnames();
+  // PARENT WINDOW
+  _binf.hwndOwner = GetForegroundWindow();
+  // DIALOG TITLE
+  _binf.lpszTitle = _title ? _title : NULL;
+  // FLAGS
+  _binf.ulFlags = 0; 		// initialize
+
+  // TBD: make sure matches to runtime system, if need be.
+  //(what if _WIN32_IE doesn't match system? does the program not run?)
+  //
+  // TBD: match all 3 types of directories
+  //
+  // NOTE: *Don't* use BIF_SHAREABLE. It /disables/ mapped network shares
+  //       from being visible in BROWSE_DIRECTORY mode. 
+  //       See Walter Garm's comments in ./TODO.
+
+#if defined(BIF_NONEWFOLDERBUTTON)				// Version 6.0
+  if ( _btype == BROWSE_DIRECTORY ) _binf.ulFlags |= BIF_NONEWFOLDERBUTTON;
+  _binf.ulFlags |= BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
+#elif defined(BIF_USENEWUI)					// Version 5.0
+  if ( _btype == BROWSE_DIRECTORY ) _binf.ulFlags |= BIF_EDITBOX;
+  else if ( _btype == BROWSE_SAVE_DIRECTORY ) _binf.ulFlags |= BIF_USENEWUI;
+  _binf.ulFlags |= BIF_RETURNONLYFSDIRS;
+#elif defined(BIF_EDITBOX)					// Version 4.71
+  _binf.ulFlags |= BIF_RETURNONLYFSDIRS | BIF_EDITBOX;
+#else								// Version Old
+  _binf.ulFlags |= BIF_RETURNONLYFSDIRS;
+#endif
+
+  // BUFFER
+  char displayname[MAX_PATH];
+  _binf.pszDisplayName = displayname;
+  // PRESET DIR
+  char presetname[MAX_PATH];
+  if ( _directory ) {
+    strcpy(presetname, _directory);
+    // Unix2Win(presetname);
+    _binf.lParam = (LPARAM)presetname;
+  }
+  else _binf.lParam = 0;
+  _binf.lpfn = Dir_CB;
+  // OPEN BROWSER
+  ITEMIDLIST *pidl = SHBrowseForFolder(&_binf);
+  // CANCEL?
+  if ( pidl == NULL ) return(1);
+
+  // GET THE PATHNAME(S) THE USER SELECTED
+  // 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
+
+  TCHAR path[MAX_PATH];
+  if ( SHGetPathFromIDList(pidl, path) ) {
+    // Win2Unix(path);
+    add_pathname(path);
+  }
+  FreePIDL(pidl);
+  if ( !strlen(path) ) return(1);             // don't return empty pathnames
+  return(0);
+}
+
+// RETURNS:
+//    0 - user picked a file
+//    1 - user cancelled
+//   -1 - failed; errmsg() has reason
+//
+int fltk3::NativeFileChooser::show() {
+  if ( _btype == BROWSE_DIRECTORY || 
+       _btype == BROWSE_MULTI_DIRECTORY || 
+       _btype == BROWSE_SAVE_DIRECTORY ) {
+    return(showdir());
+  } else {
+    return(showfile());
+  }
+}
+
+// RETURN ERROR MESSAGE
+const char *fltk3::NativeFileChooser::errmsg() const {
+  return(_errmsg ? _errmsg : "No error");
+}
+
+// GET FILENAME
+const char* fltk3::NativeFileChooser::filename() const {
+  if ( _pathnames && _tpathnames > 0 ) return(_pathnames[0]);
+  return("");
+}
+
+// GET FILENAME FROM LIST OF FILENAMES
+const char* fltk3::NativeFileChooser::filename(int i) const {
+  if ( _pathnames && i < _tpathnames ) return(_pathnames[i]);
+  return("");
+}
+
+// GET TOTAL FILENAMES CHOSEN
+int fltk3::NativeFileChooser::count() const {
+  return(_tpathnames);
+}
+
+// PRESET PATHNAME
+//     Can be NULL if no preset is desired.
+//
+void fltk3::NativeFileChooser::directory(const char *val) {
+  _directory = strfree(_directory);
+  _directory = strnew(val);
+}
+
+// GET PRESET PATHNAME
+//    Can return NULL if none set.
+//
+const char *fltk3::NativeFileChooser::directory() const {
+  return(_directory);
+}
+
+// SET TITLE
+//     Can be NULL if no title desired.
+//
+void fltk3::NativeFileChooser::title(const char *val) {
+  _title = strfree(_title);
+  _title = strnew(val);
+}
+
+// GET TITLE
+//    Can return NULL if none set.
+//
+const char *fltk3::NativeFileChooser::title() const {
+  return(_title);
+}
+
+// SET FILTER
+//     Can be NULL if no filter needed
+//
+void fltk3::NativeFileChooser::filter(const char *val) {
+  _filter = strfree(_filter);
+  clear_filters();
+  if ( val ) {
+    _filter = strnew(val);
+    parse_filter(_filter);
+  }
+  add_filter("All Files", "*.*");	// always include 'all files' option
+
+#ifdef DEBUG
+  nullprint(_parsedfilt);
+#endif /*DEBUG*/
+}
+
+// GET FILTER
+//    Can return NULL if none set.
+//
+const char *fltk3::NativeFileChooser::filter() const {
+  return(_filter);
+}
+
+// CLEAR FILTERS
+void fltk3::NativeFileChooser::clear_filters() {
+  _nfilters = 0;
+  _parsedfilt = strfree(_parsedfilt);
+}
+
+// ADD A FILTER
+void fltk3::NativeFileChooser::add_filter(const char *name_in,	// name of filter (optional: can be null)
+	                    const char *winfilter) {    	// windows style filter (eg. "*.cxx;*.h")
+  // No name? Make one..
+  char name[1024];
+  if ( !name_in || name_in[0] == '\0' ) {
+    sprintf(name, "%.*s Files", int(sizeof(name)-10), winfilter);
+  } else {
+    sprintf(name, "%.*s", int(sizeof(name)-10), name_in);
+  }
+  dnullcat(_parsedfilt, name);
+  dnullcat(_parsedfilt, winfilter);
+  _nfilters++;
+  //DEBUG printf("DEBUG: ADD FILTER name=<%s> winfilter=<%s>\n", name, winfilter);
+}
+
+// CONVERT FLTK STYLE PATTERN MATCHES TO WINDOWS 'DOUBLENULL' PATTERN
+//    Handles:
+//        IN              OUT
+//        -----------     -----------------------------
+//        *.{ma,mb}       "*.{ma,mb} Files\0*.ma;*.mb\0\0"
+//        *.[abc]         "*.[abc] Files\0*.a;*.b;*.c\0\0"
+//        *.txt           "*.txt Files\0*.txt\0\0"
+//        C Files\t*.[ch] "C Files\0*.c;*.h\0\0"
+//
+//    Example:
+//         IN: "*.{ma,mb}"
+//        OUT: "*.ma;*.mb Files\0*.ma;*.mb\0All Files\0*.*\0\0"
+//              ---------------  ---------  ---------  ---
+//                     |             |          |       |
+//                   Title       Wildcards    Title    Wildcards
+//
+// Parsing Mode:
+//         IN:"C Files\t*.{cxx,h}"
+//             |||||||  |||||||||
+//       mode: nnnnnnn  ww{{{{{{{
+//             \_____/  \_______/
+//              Name     Wildcard
+//
+void fltk3::NativeFileChooser::parse_filter(const char *in) {
+  clear_filters();
+  if ( ! in ) return;
+
+  int has_name = strchr(in, '\t') ? 1 : 0;
+
+  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] = "";
+
+  // Init
+  int t;
+  for ( t=0; t<MAXFILTERS; t++ ) {
+    wildcards[t][0] = '\0';
+  }
+
+  // Parse
+  for ( ; 1; in++ ) {
+
+    //// DEBUG
+    //// printf("WORKING ON '%c': mode=<%c> name=<%s> wildprefix=<%s> nwildcards=%d wildcards[n]=<%s>\n",
+    ////        *in, mode, name, wildprefix, nwildcards, wildcards[nwildcards]);
+
+    switch (*in) {
+      case ',':
+      case '|':
+	if ( mode == LCURLY_CHR ) {
+	  // create new wildcard, copy in prefix
+	  strcat(wildcards[nwildcards++], wildprefix);
+	  continue;
+	} else {
+	  goto regchar;
+	}
+	continue;
+
+      // FINISHED PARSING A NAME?
+      case '\t':
+	if ( mode != 'n' ) goto regchar;
+	// finish parsing name? switch to wildcard mode
+	mode = 'w';
+	break;
+
+      // ESCAPE NEXT CHAR
+      case '\\':
+	++in;
+	goto regchar;
+
+      // FINISHED PARSING ONE OF POSSIBLY SEVERAL FILTERS?
+      case '\r':
+      case '\n':
+      case '\0':
+      {
+	if ( mode == 'w' ) {		// finished parsing wildcard?
+	  if ( nwildcards == 0 ) {
+	    strcpy(wildcards[nwildcards++], wildprefix);
+	  }
+	  // Append wildcards in Microsoft's "*.one;*.two" format
+	  char comp[4096] = "";
+	  for ( t=0; t<nwildcards; t++ ) {
+	    if ( t != 0 ) strcat(comp, ";");
+	    strcat(comp, wildcards[t]);
+	  }
+	  // Add if not empty
+	  if ( comp[0] ) {
+	    add_filter(name, comp);
+	  }
+	}
+	// RESET
+	for ( t=0; t<MAXFILTERS; t++ ) {
+	  wildcards[t][0] = '\0';
+	}
+	nwildcards = 0;
+	wildprefix[0] = name[0] = '\0';
+	mode = strchr(in,'\t') ? 'n' : 'w';
+	// DONE?
+	if ( *in == '\0' ) return;	// done
+	continue;			// not done yet, more filters
+      }
+
+      // STARTING A WILDCARD?
+      case LBRACKET_CHR:
+      case LCURLY_CHR:
+	mode = *in;
+	if ( *in == LCURLY_CHR ) {
+	  // create new wildcard
+	  strcat(wildcards[nwildcards++], wildprefix);
+	}
+	continue;
+
+      // ENDING A WILDCARD?
+      case RBRACKET_CHR:
+      case RCURLY_CHR:
+	mode = 'w';	// back to wildcard mode
+	continue;
+
+      // ALL OTHER NON-SPECIAL CHARACTERS
+      default:
+      regchar:		// handle regular char
+	switch ( mode ) {
+	  case LBRACKET_CHR: 
+	    // create new wildcard
+	    ++nwildcards;
+	    // copy in prefix
+	    strcpy(wildcards[nwildcards-1], wildprefix);
+	    // append search char
+	    chrcat(wildcards[nwildcards-1], *in);
+	    continue;
+
+	  case LCURLY_CHR:
+	    if ( nwildcards > 0 ) {
+	      chrcat(wildcards[nwildcards-1], *in);
+	    }
+	    continue;
+
+	  case 'n':
+	    chrcat(name, *in);
+	    continue;
+
+	  case 'w':
+	    chrcat(wildprefix, *in);
+	    for ( t=0; t<nwildcards; t++ ) {
+	      chrcat(wildcards[t], *in);
+	    }
+	    continue;
+	}
+	break;
+    }
+  }
+}
+
+// SET 'CURRENTLY SELECTED FILTER'
+void fltk3::NativeFileChooser::filter_value(int i) {
+  _ofn.nFilterIndex = i + 1;
+}
+
+// RETURN VALUE OF 'CURRENTLY SELECTED FILTER'
+int fltk3::NativeFileChooser::filter_value() const {
+  return(_ofn.nFilterIndex ? _ofn.nFilterIndex-1 : _nfilters+1);
+}
+
+// PRESET FILENAME FOR 'SAVE AS' CHOOSER
+void fltk3::NativeFileChooser::preset_file(const char* val) {
+  _preset_file = strfree(_preset_file);
+  _preset_file = strnew(val);
+}
+
+// GET PRESET FILENAME FOR 'SAVE AS' CHOOSER
+const char* fltk3::NativeFileChooser::preset_file() const {
+  return(_preset_file);
+}
+
+int fltk3::NativeFileChooser::filters() const {
+  return(_nfilters);
+}
+
+char *wchartoutf8(LPCWSTR in)
+{
+  static char *out = NULL;
+  static int lchar = 0;
+  if (in == NULL)return NULL;
+  int utf8len  = WideCharToMultiByte(CP_UTF8, 0, in, -1, NULL, 0, NULL, NULL);
+  if (utf8len > lchar) {
+    lchar = utf8len;
+    out = (char *)realloc(out, lchar * sizeof(char));
+  }
+  WideCharToMultiByte(CP_UTF8, 0, in, -1, out, utf8len, NULL, NULL);
+  return out;
+}
+
+LPCWSTR utf8towchar(const char *in)
+{
+  static WCHAR *wout = NULL;
+  static int lwout = 0;
+  if (in == NULL)return NULL;
+  int wlen = MultiByteToWideChar(CP_UTF8, 0, in, -1, NULL, 0);
+  if (wlen > lwout) {
+    lwout = wlen;
+    wout = (WCHAR *)realloc(wout, lwout * sizeof(WCHAR));
+  }
+  MultiByteToWideChar(CP_UTF8, 0, in, -1, wout, wlen);
+  return wout;
+}
+
+#endif /*!FLTK3_DOXYGEN*/
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_color.cxx (from rev 9002, branches/branch-3.0/src/core/fl_color_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_color.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_color.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,252 @@
+//
+// "$Id$"
+//
+// WIN32 color functions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// The fltk "colormap".  This allows ui colors to be stored in 8-bit
+// locations, and provides a level of indirection so that global color
+// changes can be made.  Not to be confused with the X colormap, which
+// I try to hide completely.
+
+// SGI compiler seems to have problems with unsigned char arguments
+// being used to index arrays.  So I always copy them to an integer
+// before use.
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/draw.h>
+
+static unsigned fl_cmap[256] = {
+#include "fl_cmap.h" // this is a file produced by "cmap.cxx":
+};
+
+// Translations to win32 data structures:
+Fl_XMap fl_xmap[256];
+
+Fl_XMap* fl_current_xmap;
+
+HPALETTE fl_palette;
+static HGDIOBJ tmppen=0;
+static HPEN savepen=0;
+
+void fl_cleanup_pens(void) {
+  for (int i=0; i<256; i++) {
+    if (fl_xmap[i].pen) DeleteObject(fl_xmap[i].pen);
+  }
+}
+
+void fl_save_pen(void) {
+    if(!tmppen) tmppen = CreatePen(PS_SOLID, 1, 0);
+    savepen = (HPEN)SelectObject(fl_gc, tmppen);
+}
+
+void fl_restore_pen(void) {
+    if (savepen) SelectObject(fl_gc, savepen);
+    DeleteObject(tmppen);
+    tmppen = 0;
+    savepen = 0;
+}
+
+static void clear_xmap(Fl_XMap& xmap) {
+  if (xmap.pen) {
+    HGDIOBJ tmppen = GetStockObject(BLACK_PEN);
+    HGDIOBJ oldpen = SelectObject(fl_gc, tmppen);       // Push out the current pen of the gc
+    if(oldpen != xmap.pen) SelectObject(fl_gc, oldpen); // Put it back if it is not the one we are about to delete
+    DeleteObject((HGDIOBJ)(xmap.pen));
+    xmap.pen = 0;
+    xmap.brush = -1;
+  }
+}
+
+static void set_xmap(Fl_XMap& xmap, COLORREF c) {
+  xmap.rgb = c;
+  if (xmap.pen) {
+      HGDIOBJ oldpen = SelectObject(fl_gc,GetStockObject(BLACK_PEN)); // replace current pen with safe one
+      if (oldpen != xmap.pen)SelectObject(fl_gc,oldpen);              // if old one not xmap.pen, need to put it back
+      DeleteObject(xmap.pen);                                         // delete pen
+  }
+  xmap.pen = CreatePen(PS_SOLID, 1, xmap.rgb);                        // get a pen into xmap.pen
+  xmap.brush = -1;
+}
+
+void fltk3::GDIGraphicsDriver::color(fltk3::Color i) {
+  if (i & 0xffffff00) {
+    unsigned rgb = (unsigned)i;
+    fltk3::color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
+  } else {
+    GraphicsDriver::color(i);
+    Fl_XMap &xmap = fl_xmap[i];
+    if (!xmap.pen) {
+#if USE_COLORMAP
+      if (fl_palette) {
+	set_xmap(xmap, PALETTEINDEX(i));
+      } else {
+#endif
+	unsigned c = fl_cmap[i];
+	set_xmap(xmap, RGB(uchar(c>>24), uchar(c>>16), uchar(c>>8)));
+#if USE_COLORMAP
+      }
+#endif
+    }
+    fl_current_xmap = &xmap;
+    SelectObject(fl_gc, (HGDIOBJ)(xmap.pen));
+  }
+}
+
+void fltk3::GDIGraphicsDriver::color(uchar r, uchar g, uchar b) {
+  static Fl_XMap xmap;
+  COLORREF c = RGB(r,g,b);
+  GraphicsDriver::color( fltk3::rgb_color(r, g, b) );
+  if (!xmap.pen || c != xmap.rgb) {
+    clear_xmap(xmap);
+    set_xmap(xmap, c);
+  }
+  fl_current_xmap = &xmap;
+  SelectObject(fl_gc, (HGDIOBJ)(xmap.pen));
+}
+
+HBRUSH fl_brush() {
+  return fl_brush_action(0);
+}
+
+HBRUSH fl_brush_action(int action) {
+  Fl_XMap *xmap = fl_current_xmap;
+  // Wonko: we use some statistics to cache only a limited number
+  // of brushes:
+#define FL_N_BRUSH 16
+  static struct Fl_Brush {
+    HBRUSH brush;
+    unsigned short usage;
+    Fl_XMap* backref;
+  } brushes[FL_N_BRUSH];
+
+  if (action) {
+    SelectObject(fl_gc, GetStockObject(BLACK_BRUSH));  // Load stock object
+    for (int i=0; i<FL_N_BRUSH; i++) {
+      if (brushes[i].brush)
+        DeleteObject(brushes[i].brush); // delete all brushes in array
+    }
+    return NULL;
+  }
+
+  int i = xmap->brush; // find the associated brush
+  if (i != -1) { // if the brush was allready allocated
+    if (brushes[i].brush == NULL) goto CREATE_BRUSH;
+    if ( (++brushes[i].usage) > 32000 ) { // keep a usage statistic
+      for (int j=0; j<FL_N_BRUSH; j++) {
+	if (brushes[j].usage>16000)
+	  brushes[j].usage -= 16000;
+	else 
+	  brushes[j].usage = 0;
+      }
+    }
+    return brushes[i].brush;
+  } else {
+    int umin = 32000, imin = 0;
+    for (i=0; i<FL_N_BRUSH; i++) {
+      if (brushes[i].brush == NULL) goto CREATE_BRUSH;
+      if (brushes[i].usage<umin) {
+	umin = brushes[i].usage;
+	imin = i;
+      }
+    }
+    i = imin;
+    HGDIOBJ tmpbrush = GetStockObject(BLACK_BRUSH);  // get a stock brush
+    HGDIOBJ oldbrush = SelectObject(fl_gc,tmpbrush); // load in into current context
+    if (oldbrush != brushes[i].brush) SelectObject(fl_gc,oldbrush);  // reload old one
+    DeleteObject(brushes[i].brush);      // delete the one in list
+    brushes[i].brush = NULL;
+    brushes[i].backref->brush = -1;
+  }
+CREATE_BRUSH:
+  brushes[i].brush = CreateSolidBrush(xmap->rgb);
+  brushes[i].usage = 0;
+  brushes[i].backref = xmap;
+  xmap->brush = i;
+  return brushes[i].brush;
+}
+
+void fltk3::free_color(fltk3::Color i, int overlay) {
+  if (overlay) return; // do something about GL overlay?
+  clear_xmap(fl_xmap[i]);
+}
+
+void fltk3::set_color(fltk3::Color i, unsigned c) {
+  if (fl_cmap[i] != c) {
+    clear_xmap(fl_xmap[i]);
+    fl_cmap[i] = c;
+  }
+}
+
+#if USE_COLORMAP
+
+// 'fl_select_palette()' - Make a color palette for 8-bit displays if necessary
+// Thanks to Michael Sweet @ Easy Software Products for this
+
+HPALETTE
+fl_select_palette(void)
+{
+  static char beenhere;
+  if (!beenhere) {
+    beenhere = 1;
+
+    //if (GetDeviceCaps(fl_gc, BITSPIXEL) > 8) return NULL;
+    int nColors = GetDeviceCaps(fl_gc, SIZEPALETTE);
+    if (nColors <= 0 || nColors > 256) return NULL;
+    // this will try to work on < 256 color screens, but will probably
+    // come out quite badly.
+
+    // I lamely try to get this variable-sized object allocated on stack:
+    ulong foo[(sizeof(LOGPALETTE)+256*sizeof(PALETTEENTRY))/sizeof(ulong)+1];
+    LOGPALETTE *pPal = (LOGPALETTE*)foo;
+
+    pPal->palVersion    = 0x300;
+    pPal->palNumEntries = nColors;
+
+    // Build 256 colors from the standard FLTK colormap...
+
+    for (int i = 0; i < nColors; i ++) {
+      pPal->palPalEntry[i].peRed   = (fl_cmap[i] >> 24) & 255;
+      pPal->palPalEntry[i].peGreen = (fl_cmap[i] >> 16) & 255;
+      pPal->palPalEntry[i].peBlue  = (fl_cmap[i] >>  8) & 255;
+      pPal->palPalEntry[i].peFlags = 0;
+    };
+
+    // Create the palette:
+    fl_palette = CreatePalette(pPal);
+  }
+  if (fl_palette) {
+    SelectPalette(fl_gc, fl_palette, FALSE);
+    RealizePalette(fl_gc);
+  }
+  return fl_palette;
+}
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_dnd.cxx (from rev 9002, branches/branch-3.0/src/core/fl_dnd_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_dnd.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_dnd.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,555 @@
+//
+// "$Id$"
+//
+// Drag & Drop code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+
+// This file contains win32-specific code for fltk which is always linked
+// in.  Search other files for "WIN32" or filenames ending in _win32.cxx
+// for other system-specific code.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+#include <fltk3/Window.h>
+#include <fltk3/utf8.h>
+#include "flstring.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <objidl.h>
+#include <time.h>
+#if defined(__CYGWIN__)
+#include <sys/time.h>
+#include <unistd.h>
+#endif
+
+extern char *fl_selection_buffer[2];
+extern int fl_selection_length[2];
+extern int fl_selection_buffer_length[2];
+extern char fl_i_own_selection[2];
+extern char *fl_locale2utf8(const char *s, UINT codepage = 0);
+extern unsigned int fl_codepage;
+
+fltk3::Window *fl_dnd_target_window = 0;
+
+#include <ole2.h>
+#include <shellapi.h>
+#include <shlobj.h>
+
+
+/**
+ * subclass the IDropTarget to receive data from DnD operations
+ */
+class FLDropTarget : public IDropTarget
+{
+  DWORD m_cRefCount;
+  DWORD lastEffect;
+  int px, py;
+public:
+  FLDropTarget() : m_cRefCount(0) { } // initialize
+  HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, LPVOID *ppvObject ) {
+    if (IID_IUnknown==riid || IID_IDropTarget==riid)
+    {
+      *ppvObject=this;
+      ((LPUNKNOWN)*ppvObject)->AddRef();
+      return S_OK;
+    }
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
+  }
+  ULONG STDMETHODCALLTYPE AddRef() { return ++m_cRefCount; }
+  ULONG STDMETHODCALLTYPE Release() {
+    long nTemp;
+    nTemp = --m_cRefCount;
+    if(nTemp==0)
+      delete this;
+    return nTemp;
+  }
+  HRESULT STDMETHODCALLTYPE DragEnter( IDataObject *pDataObj, DWORD /*grfKeyState*/, POINTL pt, DWORD *pdwEffect) {
+    if( !pDataObj ) return E_INVALIDARG;
+    // set e_modifiers here from grfKeyState, set e_x and e_root_x
+    // check if FLTK handles this drag and return if it can't (i.e. BMP drag without filename)
+    POINT ppt;
+    fltk3::e_x_root = ppt.x = pt.x;
+    fltk3::e_y_root = ppt.y = pt.y;
+    HWND hWnd = WindowFromPoint( ppt );
+    fltk3::Window *target = fl_find( hWnd );
+    if (target) {
+      fltk3::e_x = fltk3::e_x_root-target->x();
+      fltk3::e_y = fltk3::e_y_root-target->y();
+    }
+    fl_dnd_target_window = target;
+    px = pt.x; py = pt.y;
+    if (fillCurrentDragData(pDataObj)) {
+      // FLTK has no mechanism yet for the different drop effects, so we allow move and copy
+      if ( target && fltk3::handle( fltk3::DND_ENTER, target ) )
+        *pdwEffect = DROPEFFECT_MOVE|DROPEFFECT_COPY; //|DROPEFFECT_LINK;
+      else
+        *pdwEffect = DROPEFFECT_NONE;
+    } else {
+      *pdwEffect = DROPEFFECT_NONE;
+    }
+    lastEffect = *pdwEffect;
+    return S_OK;
+  }
+  HRESULT STDMETHODCALLTYPE DragOver( DWORD /*grfKeyState*/, POINTL pt, DWORD *pdwEffect) {
+    if ( px==pt.x && py==pt.y )
+    {
+      *pdwEffect = lastEffect;
+      return S_OK;
+    }
+    if ( !fl_dnd_target_window )
+    {
+      *pdwEffect = lastEffect = DROPEFFECT_NONE;
+      return S_OK;
+    }
+    // set e_modifiers here from grfKeyState, set e_x and e_root_x
+    fltk3::e_x_root = pt.x;
+    fltk3::e_y_root = pt.y;
+    if (fl_dnd_target_window) {
+      fltk3::e_x = fltk3::e_x_root-fl_dnd_target_window->x();
+      fltk3::e_y = fltk3::e_y_root-fl_dnd_target_window->y();
+    }
+    if (fillCurrentDragData(0)) {
+      // fltk3::Group will change DND_DRAG into DND_ENTER and DND_LEAVE if needed
+      if ( fltk3::handle( fltk3::DND_DRAG, fl_dnd_target_window ) )
+        *pdwEffect = DROPEFFECT_MOVE|DROPEFFECT_COPY; //|DROPEFFECT_LINK;
+      else
+        *pdwEffect = DROPEFFECT_NONE;
+    } else {
+      *pdwEffect = DROPEFFECT_NONE;
+    }
+    px = pt.x; py = pt.y;
+    lastEffect = *pdwEffect;
+    return S_OK;
+  }
+  HRESULT STDMETHODCALLTYPE DragLeave() {
+    if ( fl_dnd_target_window && fillCurrentDragData(0))
+    {
+      fltk3::handle( fltk3::DND_LEAVE, fl_dnd_target_window );
+      fl_dnd_target_window = 0;
+      clearCurrentDragData();
+    }
+    return S_OK;
+  }
+  HRESULT STDMETHODCALLTYPE Drop( IDataObject *data, DWORD /*grfKeyState*/, POINTL pt, DWORD* /*pdwEffect*/) {
+    if ( !fl_dnd_target_window )
+      return S_OK;
+    fltk3::Window *target = fl_dnd_target_window;
+    fl_dnd_target_window = 0;
+    fltk3::e_x_root = pt.x;
+    fltk3::e_y_root = pt.y;
+    if (target) {
+      fltk3::e_x = fltk3::e_x_root-target->x();
+      fltk3::e_y = fltk3::e_y_root-target->y();
+    }
+    // tell FLTK that the user released an object on this widget
+    if ( !fltk3::handle( fltk3::DND_RELEASE, target ) )
+      return S_OK;
+
+    fltk3::Widget *w = target;
+    while (w->parent()) w = w->window();
+    HWND hwnd = fl_xid( (fltk3::Window*)w );
+    if (fillCurrentDragData(data)) {
+      int old_event = fltk3::e_number;
+      char *a, *b;
+      a = b = currDragData;
+      while (*a) { // strip the CRLF pairs
+	if (*a == '\r' && a[1] == '\n') a++;
+	else *b++ = *a++;
+      }
+      *b = 0;
+      fltk3::e_text = currDragData;
+      fltk3::e_length = b - currDragData;
+      fltk3::belowmouse()->handle(fltk3::e_number = fltk3::PASTE); // e_text will be invalid after this call
+      fltk3::e_number = old_event;
+      SetForegroundWindow( hwnd );
+      clearCurrentDragData();
+      return S_OK;
+    }
+    return S_OK;
+  }
+private:
+
+  static IDataObject *currDragRef;
+  static char *currDragData;
+  static int currDragSize;
+  static char currDragResult;
+
+  static void clearCurrentDragData() {
+    currDragRef = 0;
+    if (currDragData) free(currDragData);
+    currDragData = 0;
+    currDragSize = 0;
+    currDragResult = 0;
+  }
+  static char fillCurrentDragData(IDataObject *data) {
+    // shortcut through this whole procedure if there is no fresh data
+    if (!data) 
+      return currDragResult;
+    // shortcut through this whole procedure if this is still the same drag event
+    // (* this is safe, because 'currDragRef' is cleared on Leave and Drop events)
+    if (data==currDragRef)
+      return currDragResult;
+
+    // clear currDrag* for a new drag event
+    clearCurrentDragData();
+    
+    currDragRef = data;
+    // fill currDrag* with UTF-8 data, if available
+    FORMATETC fmt = { 0 };
+    STGMEDIUM medium = { 0 };
+    fmt.tymed = TYMED_HGLOBAL;
+    fmt.dwAspect = DVASPECT_CONTENT;
+    fmt.lindex = -1;
+    fmt.cfFormat = CF_UNICODETEXT;
+    // if it is UNICODE text, return a UTF-8-converted copy of it
+    if ( data->GetData( &fmt, &medium )==S_OK )
+    {
+      void *stuff = GlobalLock( medium.hGlobal );
+      unsigned srclen = 0;
+      const wchar_t *wstuff = (const wchar_t *)stuff;
+      while (*wstuff++) srclen++;
+      wstuff = (const wchar_t *)stuff;
+      unsigned utf8len = fltk3::utf8fromwc(NULL, 0, wstuff, srclen);
+      currDragSize = utf8len;
+      currDragData = (char*)malloc(utf8len + 1);
+      fltk3::utf8fromwc(currDragData, currDragSize+1, wstuff, srclen+1); // include null-byte
+      GlobalUnlock( medium.hGlobal );
+      ReleaseStgMedium( &medium );
+      currDragResult = 1;
+      return currDragResult;
+    }
+    fmt.cfFormat = CF_TEXT;
+    // if it is CP1252 text, return a UTF-8-converted copy of it
+    if ( data->GetData( &fmt, &medium )==S_OK )
+    {
+      int len;
+      char *p, *q, *last;
+      unsigned u;
+      void *stuff = GlobalLock( medium.hGlobal );
+      currDragData = (char*)malloc(3 * strlen((char*)stuff) + 10);
+      p = (char*)stuff; 
+      last = p + strlen(p);
+      q = currDragData;
+      while (p < last) {
+	u = fltk3::utf8decode(p, last, &len);
+	p += len;
+	len = fltk3::utf8encode(u, q);
+	q += len;
+	}
+      *q = 0;
+      currDragSize = q - currDragData;
+      currDragData = (char*)realloc(currDragData, currDragSize + 1);
+      GlobalUnlock( medium.hGlobal );
+      ReleaseStgMedium( &medium );
+      currDragResult = 1;
+      return currDragResult;
+    }
+    // else fill currDrag* with filenames, if possible
+    memset(&fmt, 0, sizeof(fmt));
+    fmt.tymed = TYMED_HGLOBAL;
+    fmt.dwAspect = DVASPECT_CONTENT;
+    fmt.lindex = -1;
+    fmt.cfFormat = CF_HDROP;
+    // if it is a pathname list, send an fltk3::PASTE with a \n separated list of filepaths
+    if ( data->GetData( &fmt, &medium )==S_OK )
+    {
+      HDROP hdrop = (HDROP)medium.hGlobal;
+      int i, n, nn = 0, nf = DragQueryFileW( hdrop, (UINT)-1, 0, 0 );
+        for ( i=0; i<nf; i++ ) nn += DragQueryFileW( hdrop, i, 0, 0 );
+      nn += nf;
+        xchar *dst = (xchar *)malloc(nn * sizeof(xchar));
+        xchar *bu = dst;
+      for ( i=0; i<nf; i++ ) {
+          n = DragQueryFileW( hdrop, i, (WCHAR*)dst, nn );
+          dst += n;
+          if ( i<nf-1 ) {
+            *dst++ = L'\n';
+          }
+        }
+         *dst=0;
+
+        currDragData = (char*) malloc(nn * 5 + 1);
+//      fltk3::e_length = fl_unicode2utf(bu, nn, fltk3::e_text);
+        currDragSize = fltk3::utf8fromwc(currDragData, (nn*5+1), bu, nn);
+        currDragData[currDragSize] = 0;
+        free(bu);
+
+//    fltk3::belowmouse()->handle(FL_DROP);
+//      free( fltk3::e_text );
+      ReleaseStgMedium( &medium );
+      currDragResult = 1;
+      return currDragResult;
+    }
+    currDragResult = 0;
+    return currDragResult;
+  }
+} flDropTarget;
+
+IDropTarget *flIDropTarget = &flDropTarget;
+
+IDataObject *FLDropTarget::currDragRef = 0;
+char *FLDropTarget::currDragData = 0;
+int FLDropTarget::currDragSize = 0;
+char FLDropTarget::currDragResult = 0;
+
+/**
+ * this class is needed to allow FLTK apps to be a DnD source
+ */
+class FLDropSource : public IDropSource
+{
+  DWORD m_cRefCount;
+public:
+  FLDropSource() { m_cRefCount = 0; }
+  HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, LPVOID *ppvObject ) {
+    if (IID_IUnknown==riid || IID_IDropSource==riid)
+    {
+      *ppvObject=this;
+      ((LPUNKNOWN)*ppvObject)->AddRef();
+      return S_OK;
+    }
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
+  }
+  ULONG STDMETHODCALLTYPE AddRef() { return ++m_cRefCount; }
+  ULONG STDMETHODCALLTYPE Release() {
+    long nTemp;
+    nTemp = --m_cRefCount;
+    if(nTemp==0)
+      delete this;
+    return nTemp;
+  }
+  STDMETHODIMP GiveFeedback( ulong ) { return DRAGDROP_S_USEDEFAULTCURSORS; }
+  STDMETHODIMP QueryContinueDrag( BOOL esc, DWORD keyState ) {
+    if ( esc )
+      return DRAGDROP_S_CANCEL;
+    if ( !(keyState & (MK_LBUTTON|MK_MBUTTON|MK_RBUTTON)) )
+      return DRAGDROP_S_DROP;
+    return S_OK;
+  }
+};
+class FLEnum : public IEnumFORMATETC
+{
+public:
+  int n;
+  LONG m_lRefCount;
+
+  ULONG __stdcall AddRef(void) {
+    return InterlockedIncrement(&m_lRefCount);
+  }
+
+  ULONG __stdcall Release(void) {
+    LONG count = InterlockedDecrement(&m_lRefCount);
+    if(count == 0) {
+      delete this;
+      return 0;
+    } else {
+      return count;
+    }
+  }
+
+
+  HRESULT __stdcall QueryInterface(REFIID iid, void **ppvObject) {
+    if(iid == IID_IEnumFORMATETC || iid == IID_IUnknown) {
+       AddRef();
+       *ppvObject = this;
+       return S_OK;
+    } else {
+        *ppvObject = 0;
+        return E_NOINTERFACE;
+    }
+  }
+
+  HRESULT __stdcall Next(ULONG celt, FORMATETC * rgelt, ULONG *pceltFetched) {
+    if (n > 0) return S_FALSE;
+    for (ULONG i = 0; i < celt; i++) {
+      n++;
+      rgelt->cfFormat = CF_HDROP;
+      rgelt->dwAspect = DVASPECT_CONTENT;
+      rgelt->lindex = -1;
+      rgelt->ptd = NULL;
+      rgelt->tymed = TYMED_HGLOBAL;
+    }
+    if (pceltFetched) *pceltFetched = celt;
+    return S_OK;
+  }
+
+  HRESULT __stdcall Skip(ULONG celt) {
+    n += celt;
+    return  (n == 0) ? S_OK : S_FALSE;
+  }
+
+  HRESULT __stdcall Reset(void) {
+	n = 0;
+	return S_OK;
+  }
+
+  HRESULT __stdcall Clone(IEnumFORMATETC  **ppenum){
+    *ppenum = new FLEnum();
+    return S_OK;
+  }
+
+  FLEnum(void) {
+    m_lRefCount   = 1;
+    n = 0;
+  }
+
+  virtual ~FLEnum(void) {
+    n = 0;
+  }
+};
+
+
+/**
+  This is the actual object that FLTK can drop somewhere.
+
+  The implementation is minimal, but it should work with all decent Win32 drop targets
+*/
+class FLDataObject : public IDataObject
+{
+  DWORD m_cRefCount;
+  FLEnum *m_EnumF;
+public:
+  FLDataObject() { m_cRefCount = 1; }// m_EnumF = new FLEnum();}
+  HRESULT STDMETHODCALLTYPE QueryInterface( REFIID riid, LPVOID *ppvObject ) {
+    if (IID_IUnknown==riid || IID_IDataObject==riid)
+    {
+      *ppvObject=this;
+      ((LPUNKNOWN)*ppvObject)->AddRef();
+      return S_OK;
+    }
+    *ppvObject = NULL;
+    return E_NOINTERFACE;
+  }
+  ULONG STDMETHODCALLTYPE AddRef() { return ++m_cRefCount; }
+  ULONG STDMETHODCALLTYPE Release() {
+    long nTemp;
+    nTemp = --m_cRefCount;
+    if(nTemp==0)
+      delete this;
+    return nTemp;
+  }
+  // GetData currently allows UNICODE text through Global Memory only
+  HRESULT STDMETHODCALLTYPE GetData( FORMATETC *pformatetcIn, STGMEDIUM *pmedium ) {
+    if ((pformatetcIn->dwAspect & DVASPECT_CONTENT) &&
+        (pformatetcIn->tymed & TYMED_HGLOBAL) &&
+        (pformatetcIn->cfFormat == CF_UNICODETEXT))
+    {
+      int utf16_len = fltk3::utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], 0, 0);
+      HGLOBAL gh = GlobalAlloc( GHND, utf16_len * 2 + 2 );
+      char *pMem = (char*)GlobalLock( gh );
+      fltk3::utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], (unsigned short*)pMem, utf16_len + 1);
+//      HGLOBAL gh = GlobalAlloc( GHND| GMEM_SHARE,
+//                            (fl_selection_length[0]+4) * sizeof(short)
+//                            + sizeof(DROPFILES));
+//      unsigned char *pMem = (unsigned char*)GlobalLock( gh );
+//      if (!pMem) {
+//        GlobalFree(gh);
+//        return DV_E_FORMATETC;
+//      }
+//      DROPFILES *df =(DROPFILES*) pMem;
+//      int l;
+//      df->pFiles = sizeof(DROPFILES);
+//      df->pt.x = 0;
+//      df->pt.y = 0;
+//      df->fNC = FALSE;
+//      for (int i = 0; i < fl_selection_length[0]; i++) {
+//        if (fl_selection_buffer[0][i] == '\n') {
+//          fl_selection_buffer[0][i] = '\0';
+//        }
+//      }
+//
+//        df->fWide = TRUE;
+//        l = fl_utf2unicode((unsigned char*)fl_selection_buffer[0],
+//                             fl_selection_length[0], (xchar*)(((char*)pMem)
+//                              + sizeof(DROPFILES)));
+//
+//      pMem[l * sizeof(WCHAR) + sizeof(DROPFILES)] = 0;
+//      pMem[l * sizeof(WCHAR) + 1 + sizeof(DROPFILES)] = 0;
+//      pMem[l * sizeof(WCHAR) + 2 + sizeof(DROPFILES)] = 0;
+//      pMem[l * sizeof(WCHAR) + 3 + sizeof(DROPFILES)] = 0;
+      pmedium->tymed	      = TYMED_HGLOBAL;
+      pmedium->hGlobal	      = gh;
+      pmedium->pUnkForRelease = NULL;
+      GlobalUnlock( gh );
+      return S_OK;
+    }
+    return DV_E_FORMATETC;
+  }
+  HRESULT STDMETHODCALLTYPE QueryGetData( FORMATETC *pformatetc )
+  {
+    if ((pformatetc->dwAspect & DVASPECT_CONTENT) &&
+        (pformatetc->tymed & TYMED_HGLOBAL) &&
+        (pformatetc->cfFormat == CF_UNICODETEXT))
+      return S_OK;
+    return DV_E_FORMATETC;
+  }
+//  HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD dir, IEnumFORMATETC** ppenumFormatEtc) {
+//	*ppenumFormatEtc = m_EnumF;
+//	return S_OK;
+//  }
+
+  // all the following methods are not really needed for a DnD object
+  HRESULT STDMETHODCALLTYPE GetDataHere( FORMATETC* /*pformatetcIn*/, STGMEDIUM* /*pmedium*/) { return E_NOTIMPL; }
+  HRESULT STDMETHODCALLTYPE GetCanonicalFormatEtc( FORMATETC* /*in*/, FORMATETC* /*out*/) { return E_NOTIMPL; }
+  HRESULT STDMETHODCALLTYPE SetData( FORMATETC* /*pformatetc*/, STGMEDIUM* /*pmedium*/, BOOL /*fRelease*/) { return E_NOTIMPL; }
+  HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD /*dir*/, IEnumFORMATETC** /*ppenumFormatEtc*/) { return E_NOTIMPL; }
+//  HRESULT STDMETHODCALLTYPE EnumFormatEtc( DWORD dir, IEnumFORMATETC** ppenumFormatEtc) {*ppenumFormatEtc = m_EnumF; return S_OK;}
+  HRESULT STDMETHODCALLTYPE DAdvise( FORMATETC* /*pformatetc*/, DWORD /*advf*/,
+      IAdviseSink* /*pAdvSink*/, DWORD* /*pdwConnection*/) { return E_NOTIMPL; }
+  HRESULT STDMETHODCALLTYPE DUnadvise( DWORD /*dwConnection*/) { return E_NOTIMPL; }
+  HRESULT STDMETHODCALLTYPE EnumDAdvise( IEnumSTATDATA** /*ppenumAdvise*/) { return E_NOTIMPL; }
+};
+
+
+int fltk3::dnd()
+{
+  DWORD dropEffect;
+  ReleaseCapture();
+
+  FLDataObject *fdo = new FLDataObject;
+  fdo->AddRef();
+  FLDropSource *fds = new FLDropSource;
+  fds->AddRef();
+
+  HRESULT ret = DoDragDrop( fdo, fds, DROPEFFECT_MOVE|DROPEFFECT_LINK|DROPEFFECT_COPY, &dropEffect );
+
+  fdo->Release();
+  fds->Release();
+
+  fltk3::Widget *w = fltk3::pushed();
+  if ( w )
+  {
+    int old_event = fltk3::e_number;
+    w->handle(fltk3::e_number = fltk3::RELEASE);
+    fltk3::e_number = old_event;
+    fltk3::pushed( 0 );
+  }
+  if ( ret==DRAGDROP_S_DROP ) return 1; // or DD_S_CANCEL
+  return 0;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_draw_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_draw_image_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_draw_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_draw_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,345 @@
+//
+// "$Id$"
+//
+// WIN32 image drawing code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// I hope a simple and portable method of drawing color and monochrome
+// images.  To keep this simple, only a single storage type is
+// supported: 8 bit unsigned data, byte order RGB, and pixels are
+// stored packed into rows with the origin at the top-left.  It is
+// possible to alter the size of pixels with the "delta" argument, to
+// add alpha or other information per pixel.  It is also possible to
+// change the origin and direction of the image data by messing with
+// the "delta" and "linedelta", making them negative, though this may
+// defeat some of the shortcuts in translating the image for X.
+
+// Unbelievably (since it conflicts with how most PC software works)
+// Micro$oft picked a bottom-up and BGR storage format for their
+// DIB images.  I'm pretty certain there is a way around this, but
+// I can't find any other than the brute-force method of drawing
+// each line as a separate image.  This may also need to be done
+// if the delta is any amount other than 1, 3, or 4.
+
+////////////////////////////////////////////////////////////////
+
+#include <config.h>
+#include <fltk3/run.h>
+#include <fltk3/Printer.h>
+#include <fltk3/draw.h>
+#include <fltk3/x.h>
+
+#define MAXBUFFER 0x40000 // 256k
+
+#if USE_COLORMAP
+
+// error-diffusion dither into the FLTK colormap
+static void dither(uchar* to, const uchar* from, int w, int delta) {
+  static int ri, gi, bi, dir;
+  int r=ri, g=gi, b=bi;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    to = to+(w-1);
+    d = -delta;
+    td = -1;
+  } else {
+    dir = 1;
+    d = delta;
+    td = 1;
+  }
+  for (; w--; from += d, to += td) {
+    r += from[0]; if (r < 0) r = 0; else if (r>255) r = 255;
+    int rr = r*fltk3::NUM_RED/256;
+    r -= rr*255/(fltk3::NUM_RED-1);
+    g += from[1]; if (g < 0) g = 0; else if (g>255) g = 255;
+    int gg = g*fltk3::NUM_GREEN/256;
+    g -= gg*255/(fltk3::NUM_GREEN-1);
+    b += from[2]; if (b < 0) b = 0; else if (b>255) b = 255;
+    int bb = b*fltk3::NUM_BLUE/256;
+    b -= bb*255/(fltk3::NUM_BLUE-1);
+    *to = uchar(fltk3::COLOR_CUBE+(bb*fltk3::NUM_RED+rr)*fltk3::NUM_GREEN+gg);
+  }
+  ri = r; gi = g; bi = b;
+}
+
+// error-diffusion dither into the FLTK colormap
+static void monodither(uchar* to, const uchar* from, int w, int delta) {
+  static int ri,dir;
+  int r=ri;
+  int d, td;
+  if (dir) {
+    dir = 0;
+    from = from+(w-1)*delta;
+    to = to+(w-1);
+    d = -delta;
+    td = -1;
+  } else {
+    dir = 1;
+    d = delta;
+    td = 1;
+  }
+  for (; w--; from += d, to += td) {
+    r += *from; if (r < 0) r = 0; else if (r>255) r = 255;
+    int rr = r*fltk3::NUM_GRAY/256;
+    r -= rr*255/(fltk3::NUM_GRAY-1);
+    *to = uchar(fltk3::GRAY_RAMP+rr);
+  }
+  ri = r;
+}
+
+#endif // USE_COLORMAP
+
+static void innards(const uchar *buf, int X, int Y, int W, int H,
+		    int delta, int linedelta, int depth,
+		    fltk3::DrawImageCb cb, void* userdata)
+{
+  char indexed = 0;
+
+#if USE_COLORMAP
+  indexed = (fl_palette != 0);
+#endif
+
+  if (depth==0) depth = 3;
+  if (indexed || !fltk3::can_do_alpha_blending()) 
+    depth = (depth-1)|1;
+
+  if (!linedelta) linedelta = W*delta;
+
+  int x, y, w, h;
+  fltk3::clip_box(X,Y,W,H,x,y,w,h);
+  if (w<=0 || h<=0) return;
+  if (buf) buf += (x-X)*delta + (y-Y)*linedelta;
+
+  static U32 bmibuffer[256+12];
+  BITMAPINFO &bmi = *((BITMAPINFO*)bmibuffer);
+  if (!bmi.bmiHeader.biSize) {
+    bmi.bmiHeader.biSize = sizeof(bmi)-4; // does it use this to determine type?
+    bmi.bmiHeader.biPlanes = 1;
+    bmi.bmiHeader.biCompression = BI_RGB;
+    bmi.bmiHeader.biXPelsPerMeter = 0;
+    bmi.bmiHeader.biYPelsPerMeter = 0;
+    bmi.bmiHeader.biClrUsed = 0;
+    bmi.bmiHeader.biClrImportant = 0;
+  }
+#if USE_COLORMAP
+  if (indexed) {
+    for (short i=0; i<256; i++) {
+      *((short*)(bmi.bmiColors)+i) = i;
+    }
+  } else
+#endif
+  if (depth<3) {
+    for (int i=0; i<256; i++) {
+      bmi.bmiColors[i].rgbBlue = (uchar)i;
+      bmi.bmiColors[i].rgbGreen = (uchar)i;
+      bmi.bmiColors[i].rgbRed = (uchar)i;
+      bmi.bmiColors[i].rgbReserved = (uchar)0; // must be zero
+    }
+  }
+  bmi.bmiHeader.biWidth = w;
+#if USE_COLORMAP
+  bmi.bmiHeader.biBitCount = indexed ? 8 : depth*8;
+  int pixelsize = indexed ? 1 : depth;
+#else
+  bmi.bmiHeader.biBitCount = depth*8;
+  int pixelsize = depth;
+#endif
+  if (depth==2) { // special case: gray with alpha
+    bmi.bmiHeader.biBitCount = 32;
+    pixelsize = 4;
+  }
+  int linesize = (pixelsize*w+3)&~3;
+  
+  static U32* buffer;
+  static long buffer_size;
+  int blocking = h;
+  {int size = linesize*h;
+  // when printing, don't limit buffer size not to get a crash in StretchDIBits
+  if (size > MAXBUFFER && fltk3::SurfaceDevice::surface()->class_name() != fltk3::Printer::class_id) {
+    size = MAXBUFFER;
+    blocking = MAXBUFFER/linesize;
+  }
+  if (size > buffer_size) {
+    delete[] buffer;
+    buffer_size = size;
+    buffer = new U32[(size+3)/4];
+  }}
+  bmi.bmiHeader.biHeight = blocking;
+  static U32* line_buffer;
+  if (!buf) {
+    int size = W*delta;
+    static int line_buf_size;
+    if (size > line_buf_size) {
+      delete[] line_buffer;
+      line_buf_size = size;
+      line_buffer = new U32[(size+3)/4];
+    }
+  }
+  for (int j=0; j<h; ) {
+    int k;
+    for (k = 0; j<h && k<blocking; k++, j++) {
+      const uchar* from;
+      if (!buf) { // run the converter:
+	cb(userdata, x-X, y-Y+j, w, (uchar*)line_buffer);
+	from = (uchar*)line_buffer;
+      } else {
+	from = buf;
+	buf += linedelta;
+      }
+      uchar *to = (uchar*)buffer+(blocking-k-1)*linesize;
+#if USE_COLORMAP
+      if (indexed) {
+	if (depth<3)
+	  monodither(to, from, w, delta);
+	else 
+	  dither(to, from, w, delta);
+	to += w;
+      } else
+#endif
+      {
+        int i;
+        switch (depth) {
+          case 1: 
+            for (i=w; i--; from += delta) *to++ = *from;
+            break;
+          case 2:
+	    for (i=w; i--; from += delta, to += 4) {
+	      uchar a = from[1];
+	      uchar gray = (from[0]*a)>>8;
+	      to[0] = gray;
+	      to[1] = gray;
+	      to[2] = gray;
+	      to[3] = a;
+            }
+            break;
+          case 3:
+	    for (i=w; i--; from += delta, to += 3) {
+	      uchar r = from[0];
+	      to[0] = from[2];
+	      to[1] = from[1];
+	      to[2] = r;
+            }
+            break;          
+          case 4:
+	    for (i=w; i--; from += delta, to += 4) {
+              uchar a = from[3];
+	      uchar r = from[0];
+	      to[0] = (from[2]*a)>>8;
+	      to[1] = (from[1]*a)>>8;
+	      to[2] = (r*a)>>8;
+	      to[3] = from[3];
+            }
+            break;          
+        }            
+      }
+    }
+    if(fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) {
+      // if print context, device and logical units are not equal, so SetDIBitsToDevice
+      // does not do the expected job, whereas StretchDIBits does it.
+      StretchDIBits(fl_gc, x, y+j-k, w, k, 0, 0, w, k,
+		    (LPSTR)((uchar*)buffer+(blocking-k)*linesize),
+		    &bmi,
+#if USE_COLORMAP
+		    indexed ? DIB_PAL_COLORS : DIB_RGB_COLORS
+#else
+		    DIB_RGB_COLORS
+#endif
+		    , SRCCOPY );
+      delete[] buffer;
+      buffer = NULL;
+      buffer_size = 0;
+    }
+    else {
+      SetDIBitsToDevice(fl_gc, x, y+j-k, w, k, 0, 0, 0, k,
+			(LPSTR)((uchar*)buffer+(blocking-k)*linesize),
+			&bmi,
+#if USE_COLORMAP
+			indexed ? DIB_PAL_COLORS : DIB_RGB_COLORS
+#else
+			DIB_RGB_COLORS
+#endif
+			);
+      }
+  }
+}
+
+static int fl_abs(int v) { return v<0 ? -v : v; }
+
+void fltk3::GDIGraphicsDriver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  if (fl_abs(d)&fltk3::IMAGE_WITH_ALPHA) {
+    d ^= fltk3::IMAGE_WITH_ALPHA;
+    innards(buf,x,y,w,h,d,l,fl_abs(d),0,0);
+  } else {
+    innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
+  }
+}
+
+void fltk3::GDIGraphicsDriver::draw_image(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  if (fl_abs(d)&fltk3::IMAGE_WITH_ALPHA) {
+    d ^= fltk3::IMAGE_WITH_ALPHA;
+    innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+  } else {
+    innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+  }
+}
+
+void fltk3::GDIGraphicsDriver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+  if (fl_abs(d)&fltk3::IMAGE_WITH_ALPHA) {
+    d ^= fltk3::IMAGE_WITH_ALPHA;
+    innards(buf,x,y,w,h,d,l,1,0,0);
+  } else {
+    innards(buf,x,y,w,h,d,l,1,0,0);
+  }
+}
+
+void fltk3::GDIGraphicsDriver::draw_image_mono(fltk3::DrawImageCb cb, void* data,
+		   int x, int y, int w, int h,int d) {
+  if (fl_abs(d)&fltk3::IMAGE_WITH_ALPHA) {
+    d ^= fltk3::IMAGE_WITH_ALPHA;
+    innards(0,x,y,w,h,d,0,1,cb,data);
+  } else {
+    innards(0,x,y,w,h,d,0,1,cb,data);
+  }
+}
+
+void fltk3::rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
+#if USE_COLORMAP
+  // use the error diffusion dithering code to produce a much nicer block:
+  if (fl_palette) {
+    uchar c[3];
+    c[0] = r; c[1] = g; c[2] = b;
+    innards(c,x,y,w,h,0,0,0,0,0);
+    return;
+  }
+#endif
+  fltk3::color(r,g,b);
+  fltk3::rectf(x,y,w,h);
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_font_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,452 @@
+//
+// "$Id$"
+//
+// WIN32 font selection routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/Printer.h>
+
+static int fl_angle_ = 0;
+
+#ifndef FLTK3_DOXYGEN
+Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, fltk3::Fontsize fsize) {
+  int weight = FW_NORMAL;
+  int italic = 0;
+  switch (*name++) {
+  case 'I': italic = 1; break;
+  case 'P': italic = 1;
+  case 'B': weight = FW_BOLD; break;
+  case ' ': break;
+  default: name--;
+  }
+  fid = CreateFont(
+    -fsize, // negative makes it use "char size"
+    0,	            // logical average character width
+    fl_angle_*10,	            // angle of escapement
+    fl_angle_*10,	            // base-line orientation angle
+    weight,
+    italic,
+    FALSE,	        // underline attribute flag
+    FALSE,	        // strikeout attribute flag
+    DEFAULT_CHARSET,    // character set identifier
+    OUT_DEFAULT_PRECIS,	// output precision
+    CLIP_DEFAULT_PRECIS,// clipping precision
+    DEFAULT_QUALITY,	// output quality
+    DEFAULT_PITCH,	// pitch and family
+    name	        // pointer to typeface name string
+    );
+  angle = fl_angle_;
+  if (!fl_gc) fl_GetDC(0);
+  SelectObject(fl_gc, fid);
+  GetTextMetrics(fl_gc, &metr);
+//  BOOL ret = GetCharWidthFloat(fl_gc, metr.tmFirstChar, metr.tmLastChar, font->width+metr.tmFirstChar);
+// ...would be the right call, but is not implemented into Window95! (WinNT?)
+  //GetCharWidth(fl_gc, 0, 255, width);
+  int i;
+  for (i = 0; i < 64; i++) width[i] = NULL;
+#if HAVE_GL
+  listbase = 0;
+  for (i = 0; i < 64; i++) glok[i] = 0;
+#endif
+  size = fsize;
+}
+
+Fl_Font_Descriptor::~Fl_Font_Descriptor() {
+#if HAVE_GL
+// Delete list created by gl_draw().  This is not done by this code
+// as it will link in GL unnecessarily.  There should be some kind
+// of "free" routine pointer, or a subclass?
+// if (listbase) {
+//  int base = font->min_char_or_byte2;
+//  int size = font->max_char_or_byte2-base+1;
+//  int base = 0; int size = 256;
+//  glDeleteLists(listbase+base,size);
+// }
+#endif
+  if (this == fltk3::graphics_driver->font_descriptor()) fltk3::graphics_driver->font_descriptor(NULL);
+  DeleteObject(fid);
+  int i;
+  for (i = 0; i < 64; i++) free(width[i]);
+}
+
+////////////////////////////////////////////////////////////////
+
+// WARNING: if you add to this table, you must redefine fltk3::FREE_FONT
+// in enumerations.h & recompile!!
+static Fl_Fontdesc built_in_table[] = {
+{" Arial"},
+{"BArial"},
+{"IArial"},
+{"PArial"},
+{" Courier New"},
+{"BCourier New"},
+{"ICourier New"},
+{"PCourier New"},
+{" Times New Roman"},
+{"BTimes New Roman"},
+{"ITimes New Roman"},
+{"PTimes New Roman"},
+{" Symbol"},
+{" Terminal"},
+{"BTerminal"},
+{" Wingdings"},
+};
+
+Fl_Fontdesc* fltk3::fonts = built_in_table;
+
+static Fl_Font_Descriptor* find(fltk3::Font fnum, fltk3::Fontsize size, int angle) {
+  Fl_Fontdesc* s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // use 0 if fnum undefined
+  Fl_Font_Descriptor* f;
+  for (f = s->first; f; f = f->next)
+    if (f->size == size && f->angle == angle) return f;
+  f = new Fl_Font_Descriptor(s->name, size);
+  f->next = s->first;
+  s->first = f;
+  return f;
+}
+
+////////////////////////////////////////////////////////////////
+// Public interface:
+
+static void set_font(fltk3::GraphicsDriver *driver, fltk3::Font fnum, fltk3::Fontsize size, int angle) {
+  if (fnum==-1) { // just make sure that we will load a new font next time
+    fl_angle_ = 0;
+    driver->GraphicsDriver::font(0, 0);
+    return;
+  }
+  if (fnum == driver->GraphicsDriver::font() && size == driver->size() && angle == fl_angle_) return;
+  fl_angle_ = angle;
+  driver->GraphicsDriver::font(fnum, size);
+  driver->font_descriptor( find(fnum, size, angle) );
+}
+
+void fltk3::GDIGraphicsDriver::font(fltk3::Font fnum, fltk3::Fontsize size) {
+  ::set_font(this, fnum, size, 0);
+}
+
+int fltk3::GDIGraphicsDriver::height() {
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  if (fontsize) return (fontsize->metr.tmAscent + fontsize->metr.tmDescent);
+  else return -1;
+}
+
+int fltk3::GDIGraphicsDriver::descent() {
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  if (fontsize) return fontsize->metr.tmDescent;
+  else return -1;
+}
+
+// Unicode string buffer
+static unsigned short *wstr = NULL;
+static int wstr_len    = 0;
+
+
+double fltk3::GDIGraphicsDriver::width(const char* c, int n) {
+  int i = 0;
+  if (!font_descriptor()) return -1.0;
+  double w = 0.0;
+  char *end = (char *)&c[n];
+  while (i < n) {
+    unsigned int ucs;
+    int l;
+    ucs = fltk3::utf8decode((const char*)(c + i), end, &l);
+//  if (l < 1) l = 1;
+    i += l;
+    if (!fltk3::nonspacing(ucs)) {
+      w += width(ucs);
+    }
+  }
+  return w;
+}
+
+double fltk3::GDIGraphicsDriver::width(unsigned int c) {
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  unsigned int r;
+  SIZE s;
+  // Special Case Handling of Unicode points over U+FFFF.
+  // The logic (below) computes a lookup table for char widths
+  // on-the-fly, but the table only covers codepoints up to
+  // U+FFFF, which covers the basic multilingual plane, but
+  // not any higher plane, or glyphs that require surrogate-pairs
+  // to encode them in WinXX, which is UTF16.
+  // This code assumes that these glyphs are rarely used and simply
+  // measures them explicitly if they occur - This will be slow...
+  if(c > 0x0000FFFF) { // UTF16 surrogate pair is needed
+    if (!fl_gc) { // We have no valid gc, so nothing to measure - bail out
+      return 0.0;
+    }
+    int cc; // cell count
+    unsigned short u16[4]; // Array for UTF16 representation of c
+    // Creates a UTF16 string from a UCS code point.
+    cc = fltk3::ucs_to_Utf16(c, u16, 4);
+    // Make sure the current font is selected before we make the measurement
+    SelectObject(fl_gc, fontsize->fid);
+    // measure the glyph width
+    GetTextExtentPoint32W(fl_gc, (WCHAR*)u16, cc, &s);
+    return (double)s.cx;
+  }
+  // else - this falls through to the lookup-table for glyph widths
+  // in the basic multilingual plane
+  r = (c & 0xFC00) >> 10;
+  if (!fontsize->width[r]) {
+    fontsize->width[r] = (int*) malloc(sizeof(int) * 0x0400);
+    unsigned short i = 0, ii = r * 0x400;
+    // The following code makes a best effort attempt to obtain a valid fl_gc.
+    // If no fl_gc is available at the time we call fltk3::width(), then we first
+    // try to obtain a gc from the first fltk window.
+    // If that is null then we attempt to obtain the gc from the current screen
+    // using (GetDC(NULL)).
+    // This should resolve STR #2086
+    HDC gc = fl_gc;
+    HWND hWnd = 0;
+    if (!gc) { // We have no valid gc, try and obtain one
+      // Use our first fltk window, or fallback to using the screen via GetDC(NULL)
+      hWnd = fltk3::first_window() ? fl_xid(fltk3::first_window()) : NULL;
+      gc = GetDC(hWnd);
+    }
+    if (!gc)
+	fltk3::fatal("Invalid graphic context: fltk3::width() failed because no valid HDC was found!");
+    SelectObject(gc, fontsize->fid);
+    for (; i < 0x400; i++) {
+      GetTextExtentPoint32W(gc, (WCHAR*)&ii, 1, &s);
+      fontsize->width[r][i] = s.cx;
+      ii++;
+    }
+    if (gc && gc!=fl_gc) ReleaseDC(hWnd, gc);
+  }
+  return (double) fontsize->width[r][c & 0x03FF];
+}
+
+/* Add function pointer to allow us to access GetGlyphIndicesW on systems that have it,
+ * without crashing on systems that do not. */
+/* DWORD WINAPI GetGlyphIndicesW(HDC,LPCWSTR,int,LPWORD,DWORD) */
+typedef DWORD (WINAPI* fl_GetGlyphIndices_func)(HDC,LPCWSTR,int,LPWORD,DWORD);
+
+static fl_GetGlyphIndices_func fl_GetGlyphIndices = NULL; // used to hold a proc pointer for GetGlyphIndicesW
+static int have_loaded_GetGlyphIndices = 0; // Set this non-zero once we have tried to load GetGlyphIndices
+
+// Function that tries to dynamically load GetGlyphIndicesW at runtime
+static void GetGlyphIndices_init() {
+  // Since not all versions of Windows include GetGlyphIndicesW support,
+  // we do a run-time check for the required function.
+  HMODULE hMod = GetModuleHandle("GDI32.DLL");
+  if (hMod) {
+    // check that GetGlyphIndicesW is available
+    fl_GetGlyphIndices = (fl_GetGlyphIndices_func)GetProcAddress(hMod, "GetGlyphIndicesW");
+  }
+  have_loaded_GetGlyphIndices = -1; // set this non-zero when we have attempted to load GetGlyphIndicesW
+} // GetGlyphIndices_init function
+
+static void on_printer_extents_update(int &dx, int &dy, int &w, int &h)
+// converts text extents from device coords to logical coords
+{
+  POINT pt[3] = { {0, 0}, {dx, dy}, {dx+w, dy+h} };
+  DPtoLP(fl_gc, pt, 3);
+  w = pt[2].x - pt[1].x;
+  h = pt[2].y - pt[1].y;
+  dx = pt[1].x - pt[0].x;
+  dy = pt[1].y - pt[0].y;
+}
+
+// if printer context, extents shd be converted to logical coords
+#define EXTENTS_UPDATE(x,y,w,h) \
+  if (fltk3::SurfaceDevice::surface()->class_name() == fltk3::Printer::class_id) { on_printer_extents_update(x,y,w,h); }
+
+// Function to determine the extent of the "inked" area of the glyphs in a string
+void fltk3::GDIGraphicsDriver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
+
+  Fl_Font_Descriptor *fontsize = font_descriptor();
+  if (!fontsize) { // no valid font, nothing to measure
+    w = 0; h = 0;
+    dx = dy = 0;
+    return;
+  }
+
+  static unsigned short *ext_buff = NULL; // UTF-16 converted version of input UTF-8 string
+  static WORD  *w_buff = NULL; // glyph indices array
+  static unsigned wc_len = 0;  // current string buffer dimensions
+  static const MAT2 matrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }; // identity mat for GetGlyphOutlineW
+  GLYPHMETRICS metrics;
+  int maxw = 0, maxh = 0, dh;
+  int minx = 0, miny = -999999;
+  unsigned len = 0, idx = 0, ll;
+  HWND hWnd = 0;
+  HDC gc = fl_gc; // local copy of current gc - make a copy in case we change it...
+  int has_surrogates; // will be set if the string contains surrogate pairs
+
+  // Have we loaded the GetGlyphIndicesW function yet?
+  if (have_loaded_GetGlyphIndices == 0) {
+    GetGlyphIndices_init();
+  }
+  // Do we have a usable GetGlyphIndices function?
+  if(!fl_GetGlyphIndices) goto exit_error; // No GetGlyphIndices function, use fallback mechanism instead
+
+  // The following code makes a best effort attempt to obtain a valid fl_gc.
+  // See description in fltk3::width() above for an explanation.
+  if (!gc) { // We have no valid gc, try and obtain one
+    // Use our first fltk window, or fallback to using the screen via GetDC(NULL)
+    hWnd = fltk3::first_window() ? fl_xid(fltk3::first_window()) : NULL;
+    gc = GetDC(hWnd);
+  }
+  if (!gc) goto exit_error; // no valid gc, attempt to use fallback measure
+
+  // now convert the string to WCHAR and measure it
+  len = fltk3::utf8toUtf16(c, n, ext_buff, wc_len);
+  if(len >= wc_len) {
+    if(ext_buff) {delete [] ext_buff;}
+    if(w_buff) {delete [] w_buff;}
+    wc_len = len + 64;
+    ext_buff = new unsigned short[wc_len];
+    w_buff = new WORD[wc_len];
+    len = fltk3::utf8toUtf16(c, n, ext_buff, wc_len);
+  }
+  SelectObject(gc, fontsize->fid);
+
+  // Are there surrogate-pairs in this string? If so GetGlyphIndicesW will fail
+  // since it can only handle the BMP range.
+  // We ideally want to use GetGlyphIndicesW, as it is the Right Thing, but it
+  // only works for the BMP, so we leverage GetCharacterPlacementW instead, which
+  // is not ideal, but works adequately well, and does handle surrogate pairs.
+  has_surrogates = 0;
+  for(ll = 0; ll < len; ll++) {
+    if((ext_buff[ll] >= 0xD800) && (ext_buff[ll] < 0xE000)) {
+      has_surrogates = -1;
+      break;
+    }
+  }
+  if (has_surrogates) {
+    // GetGlyphIndices will not work - use GetCharacterPlacementW() instead
+    GCP_RESULTSW gcp_res;
+    memset(w_buff, 0, (sizeof(WORD) * wc_len));
+    memset(&gcp_res, 0, sizeof(GCP_RESULTSW));
+    gcp_res.lpGlyphs = (LPWSTR)w_buff;
+    gcp_res.nGlyphs = wc_len;
+    gcp_res.lStructSize = sizeof(gcp_res);
+
+    DWORD dr = GetCharacterPlacementW(gc, (WCHAR*)ext_buff, len, 0, &gcp_res, GCP_GLYPHSHAPE);
+    if(dr) {
+      len = gcp_res.nGlyphs;
+    } else goto exit_error;
+  } else {
+    if (fl_GetGlyphIndices(gc, (WCHAR*)ext_buff, len, w_buff, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) {
+      // some error occured here - just return fltk3::measure values
+      goto exit_error;
+    }
+  }
+
+  // now we have the glyph array we measure each glyph in turn...
+  for(idx = 0; idx < len; idx++){
+    if (GetGlyphOutlineW (gc, w_buff[idx], GGO_METRICS | GGO_GLYPH_INDEX,
+                          &metrics, 0, NULL, &matrix) == GDI_ERROR) {
+      goto exit_error;
+    }
+    maxw += metrics.gmCellIncX;
+    if(idx == 0) minx = metrics.gmptGlyphOrigin.x;
+    dh = metrics.gmBlackBoxY - metrics.gmptGlyphOrigin.y;
+    if(dh > maxh) maxh = dh;
+    if(miny < metrics.gmptGlyphOrigin.y) miny = metrics.gmptGlyphOrigin.y;
+  }
+  // for the last cell, we only want the bounding X-extent, not the glyphs increment step
+  maxw = maxw - metrics.gmCellIncX + metrics.gmBlackBoxX + metrics.gmptGlyphOrigin.x;
+  w = maxw - minx;
+  h = maxh + miny;
+  dx = minx;
+  dy = -miny;
+  EXTENTS_UPDATE(dx, dy, w, h);
+  return; // normal exit
+
+exit_error:
+  // some error here - just return fltk3::measure values
+  w = (int)width(c, n);
+  h = height();
+  dx = 0;
+  dy = descent() - h;
+  EXTENTS_UPDATE(dx, dy, w, h);
+  return;
+} // fltk3::text_extents
+
+void fltk3::GDIGraphicsDriver::draw(const char* str, int n, int x, int y) {
+  COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
+  SelectObject(fl_gc, font_descriptor()->fid);
+  int wn = fltk3::utf8toUtf16(str, n, wstr, wstr_len);
+  if(wn >= wstr_len) {
+    wstr = (unsigned short*) realloc(wstr, sizeof(unsigned short) * (wn + 1));
+    wstr_len = wn + 1;
+    wn = fltk3::utf8toUtf16(str, n, wstr, wstr_len);
+  }
+  TextOutW(fl_gc, x, y, (WCHAR*)wstr, wn);
+  SetTextColor(fl_gc, oldColor); // restore initial state
+}
+
+void fltk3::GDIGraphicsDriver::draw(int angle, const char* str, int n, int x, int y) {
+  ::set_font(this, GraphicsDriver::font(), size(), angle);
+  int wn = 0; // count of UTF16 cells to render full string
+  COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
+  SelectObject(fl_gc, font_descriptor()->fid);
+  wn = fltk3::utf8toUtf16(str, n, wstr, wstr_len);
+  if(wn >= wstr_len) { // Array too small
+    wstr = (unsigned short*) realloc(wstr, sizeof(unsigned short) * (wn + 1));
+    wstr_len = wn + 1;
+    wn = fltk3::utf8toUtf16(str, n, wstr, wstr_len); // respin the translation
+  }
+  TextOutW(fl_gc, x, y, (WCHAR*)wstr, wn);
+  SetTextColor(fl_gc, oldColor);
+  ::set_font(this, GraphicsDriver::font(), size(), 0);
+}
+
+void fltk3::GDIGraphicsDriver::rtl_draw(const char* c, int n, int x, int y) {
+  int wn;
+  wn = fltk3::utf8toUtf16(c, n, wstr, wstr_len);
+  if(wn >= wstr_len) {
+    wstr = (unsigned short*) realloc(wstr, sizeof(unsigned short) * (wn + 1));
+    wstr_len = wn + 1;
+    wn = fltk3::utf8toUtf16(c, n, wstr, wstr_len);
+  }
+
+  COLORREF oldColor = SetTextColor(fl_gc, fl_RGB());
+  SelectObject(fl_gc, font_descriptor()->fid);
+#ifdef RTL_CHAR_BY_CHAR
+  int i = 0;
+  int lx = 0;
+  while (i < wn) { // output char by char is very bad for Arabic but coherent with fltk3::width()
+    lx = (int) width(wstr[i]);
+    x -= lx;
+    TextOutW(fl_gc, x, y, (WCHAR*)wstr + i, 1);
+    if (fltk3::nonspacing(wstr[i])) {
+      x += lx;
+    }
+    i++;
+  }
+#else
+  UINT old_align = SetTextAlign(fl_gc, TA_RIGHT | TA_RTLREADING);
+  TextOutW(fl_gc, x, y - height() + descent(), (WCHAR*)wstr, wn);
+  SetTextAlign(fl_gc, old_align);
+#endif
+  SetTextColor(fl_gc, oldColor);
+}
+#endif
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_get_key.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_get_key_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_get_key.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_get_key.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,138 @@
+//
+// "$Id$"
+//
+// WIN32 keyboard state routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// Return the current state of a key.  Keys are named by fltk symbols,
+// which are actually X keysyms.  So this has to translate to MSWindows
+// VK_x symbols.
+
+#include <fltk3/run.h>
+#include <fltk3/x.h>
+
+// convert an Fltk (X) keysym to a MSWindows VK symbol:
+// See also the inverse converter in Fl_win32.cxx
+// This table is in numeric order by Fltk symbol order for binary search:
+
+static const struct {unsigned short vk, fltk;} vktab[] = {
+  {VK_SPACE,	' '},
+  {'1',		'!'},
+  {0xde,	'\"'},
+  {'3',		'#'},
+  {'4',		'$'},
+  {'5',		'%'},
+  {'7',		'&'},
+  {0xde,	'\''},
+  {'9',		'('},
+  {'0',		')'},
+  {'8',		'*'},
+  {0xbb,	'+'},
+  {0xbc,	','},
+  {0xbd,	'-'},
+  {0xbe,	'.'},
+  {0xbf,	'/'},
+  {0xba,	':'},
+  {0xba,	';'},
+  {0xbc,	'<'},
+  {0xbb,	'='},
+  {0xbe,	'>'},
+  {0xbf,	'?'},
+  {'2',		'@'},
+  {0xdb,	'['},
+  {0xdc,	'\\'},
+  {0xdd,	']'},
+  {'6',		'^'},
+  {0xbd,	'_'},
+  {0xc0,	'`'},
+  {0xdb,	'{'},
+  {0xdc,	'|'},
+  {0xdd,	'}'},
+  {0xc0,	'~'},
+  {VK_BACK,	fltk3::BackSpaceKey},
+  {VK_TAB,	fltk3::TabKey},
+  {VK_CLEAR,	0xff0b/*XK_Clear*/},
+  {VK_RETURN,	fltk3::EnterKey},
+  {VK_PAUSE,	fltk3::PauseKey},
+  {VK_SCROLL,	fltk3::ScrollLockKey},
+  {VK_ESCAPE,	fltk3::EscapeKey},
+  {VK_HOME,	fltk3::HomeKey},
+  {VK_LEFT,	fltk3::LeftKey},
+  {VK_UP,	fltk3::UpKey},
+  {VK_RIGHT,	fltk3::RightKey},
+  {VK_DOWN,	fltk3::DownKey},
+  {VK_PRIOR,	fltk3::PageUpKey},
+  {VK_NEXT,	fltk3::PageDownKey},
+  {VK_END,	fltk3::EndKey},
+  {VK_SNAPSHOT,	fltk3::PrintKey},
+  {VK_INSERT,	fltk3::InsertKey},
+  {VK_APPS,	fltk3::MenuKey},
+  {VK_NUMLOCK,	fltk3::NumLockKey},
+//{VK_???,	fltk3::KPEnterKey},
+  {VK_MULTIPLY,	fltk3::KPKey+'*'},
+  {VK_ADD,	fltk3::KPKey+'+'},
+  {VK_SUBTRACT,	fltk3::KPKey+'-'},
+  {VK_DECIMAL,	fltk3::KPKey+'.'},
+  {VK_DIVIDE,	fltk3::KPKey+'/'},
+  {VK_LSHIFT,	fltk3::ShiftLKey},
+  {VK_RSHIFT,	fltk3::ShiftRKey},
+  {VK_LCONTROL,	fltk3::ControlLKey},
+  {VK_RCONTROL,	fltk3::ControlRKey},
+  {VK_CAPITAL,	fltk3::CapsLockKey},
+  {VK_LWIN,	fltk3::MetaLKey},
+  {VK_RWIN,	fltk3::MetaRKey},
+  {VK_LMENU,	fltk3::AltLKey},
+  {VK_RMENU,	fltk3::AltRKey},
+  {VK_DELETE,	fltk3::DeleteKey}
+};
+
+static int fltk2ms(unsigned int fltk) {
+  if (fltk >= '0' && fltk <= '9') return fltk;
+  if (fltk >= 'A' && fltk <= 'Z') return fltk;
+  if (fltk >= 'a' && fltk <= 'z') return fltk-('a'-'A');
+  if (fltk > fltk3::FKey && fltk <= fltk3::FKey+16) return fltk-(fltk3::FKey-(VK_F1-1));
+  if (fltk >= fltk3::KPKey+'0' && fltk<=fltk3::KPKey+'9') return fltk-(fltk3::KPKey+'0'-VK_NUMPAD0);
+  int a = 0;
+  int b = sizeof(vktab)/sizeof(*vktab);
+  while (a < b) {
+    int c = (a+b)/2;
+    if (vktab[c].fltk == fltk) return vktab[c].vk;
+    if (vktab[c].fltk < fltk) a = c+1; else b = c;
+  }
+  return 0;
+}
+
+int fltk3::event_key(unsigned int k) {
+  return GetKeyState(fltk2ms(k))&~1;
+}
+
+int fltk3::get_key(unsigned int k) {
+  uchar foo[256];
+  GetKeyboardState(foo);
+  return foo[fltk2ms(k)]&~1;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_read_image.cxx (from rev 9002, branches/branch-3.0/src/core/fl_read_image_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_read_image.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_read_image.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,133 @@
+//
+// "$Id$"
+//
+// WIN32 image reading routines for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//
+// 'fltk3::read_image()' - Read an image from the current window.
+//
+
+uchar *				// O - Pixel buffer or NULL if failed
+fltk3::read_image(uchar *p,		// I - Pixel buffer or NULL to allocate
+              int   X,		// I - Left position
+	      int   Y,		// I - Top position
+	      int   w,		// I - Width of area to read
+	      int   h,		// I - Height of area to read
+	      int   alpha) {	// I - Alpha value for image (0 for none)
+
+  int	d;			// Depth of image
+
+  // Allocate the image data array as needed...
+  d = alpha ? 4 : 3;
+
+  if (!p) p = new uchar[w * h * d];
+
+  // Initialize the default colors/alpha in the whole image...
+  memset(p, alpha, w * h * d);
+
+  // Grab all of the pixels in the image...
+
+  // Assure that we are not trying to read non-existing data. If it is so, the
+  // function should still work, but the out-of-bounds part of the image is
+  // untouched (initialized with the alpha value or 0 (black), resp.).
+
+  int ww = w; // We need the original width for output data line size
+
+  int shift_x = 0; // X target shift if X modified
+  int shift_y = 0; // Y target shift if X modified
+
+  if (X < 0) {
+    shift_x = -X;
+    w += X;
+    X = 0;
+  }
+  if (Y < 0) {
+    shift_y = -Y;
+    h += Y;
+    Y = 0;
+  }
+
+  if (h < 1 || w < 1) return p;		// nothing to copy
+
+  int line_size = ((3*w+3)/4) * 4;	// each line is aligned on a DWORD (4 bytes)
+  uchar *dib = new uchar[line_size*h];	// create temporary buffer to read DIB
+
+  // fill in bitmap info for GetDIBits
+
+  BITMAPINFO   bi;
+  bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+  bi.bmiHeader.biWidth = w;
+  bi.bmiHeader.biHeight = -h;		// negative => top-down DIB
+  bi.bmiHeader.biPlanes = 1;
+  bi.bmiHeader.biBitCount = 24;		// 24 bits RGB
+  bi.bmiHeader.biCompression = BI_RGB;
+  bi.bmiHeader.biSizeImage = 0;
+  bi.bmiHeader.biXPelsPerMeter = 0;
+  bi.bmiHeader.biYPelsPerMeter = 0;
+  bi.bmiHeader.biClrUsed = 0;
+  bi.bmiHeader.biClrImportant = 0;
+
+  // copy bitmap from original DC (Window, fltk3::Offscreen, ...)
+
+  HDC hdc = CreateCompatibleDC(fl_gc);
+  HBITMAP hbm = CreateCompatibleBitmap(fl_gc,w,h);
+
+  int save_dc = SaveDC(hdc);			// save context for cleanup
+  SelectObject(hdc,hbm);			// select bitmap
+  BitBlt(hdc,0,0,w,h,fl_gc,X,Y,SRCCOPY);	// copy image section to DDB
+
+  // copy RGB image data to the allocated DIB
+
+  GetDIBits(hdc, hbm, 0, h, dib, (BITMAPINFO *)&bi, DIB_RGB_COLORS);
+
+  // finally copy the image data to the user buffer
+
+  for (int j = 0; j<h; j++) {
+    const uchar *src = dib + j * line_size;			// source line
+    uchar *tg = p + (j + shift_y) * d * ww + shift_x * d;	// target line
+    for (int i = 0; i<w; i++) {
+      uchar b = *src++;
+      uchar g = *src++;
+      *tg++ = *src++;	// R
+      *tg++ = g;	// G
+      *tg++ = b;	// B
+      if (alpha)
+	*tg++ = alpha;	// alpha
+    }
+  }
+
+  // free used GDI and other structures
+
+  RestoreDC(hdc,save_dc);	// reset DC
+  DeleteDC(hdc);
+  DeleteObject(hbm);
+  delete[] dib;		// delete DIB temporary buffer
+
+  return p;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/win32_scandir.cxx (from rev 9002, branches/branch-3.0/src/core/scandir_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_scandir.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_scandir.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,141 @@
+/*
+ * "$Id$"
+ *
+ * WIN32 scandir function for the Fast Light Tool Kit (FLTK).
+ *
+ * Copyright 1998-2010 by Bill Spitzak and others.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ *
+ * Please report all bugs and problems on the following page:
+ *
+ *     http://www.fltk.org/str.php
+ */
+
+#ifndef __CYGWIN__
+/* Emulation of posix scandir() call */
+#include <fltk3/utf8.h>
+#include <fltk3/filename.h>
+#include "flstring.h"
+#include <windows.h>
+#include <stdlib.h>
+
+extern "C" {
+int fl_scandir(const char *dirname, struct dirent ***namelist,
+	       int (*select)(struct dirent *),
+	       int (*compar)(struct dirent **, struct dirent **));
+}
+
+int fl_scandir(const char *dirname, struct dirent ***namelist,
+	       int (*select)(struct dirent *),
+	       int (*compar)(struct dirent **, struct dirent **)) {
+  int len;
+  char *findIn, *d, is_dir = 0;
+  WIN32_FIND_DATAW findw;
+  HANDLE h;
+  int nDir = 0, NDir = 0;
+  struct dirent **dir = 0, *selectDir;
+  unsigned long ret;
+
+  len    = strlen(dirname);
+  findIn = (char *)malloc((size_t)(len+10));
+  if (!findIn) return -1;
+  strcpy(findIn, dirname);
+
+  /* #if defined(__GNUC__) */
+  /* #warning FIXME This probably needs to be MORE UTF8 aware now */
+  /* #endif */
+  for (d = findIn; *d; d++) if (*d=='/') *d='\\';
+  if ((len==0)) { strcpy(findIn, ".\\*"); }
+  if ((len==2)&&findIn[1]==':'&&isalpha(findIn[0])) { *d++ = '\\'; *d = 0; }
+  if ((len==1)&& (d[-1]=='.')) { strcpy(findIn, ".\\*"); is_dir = 1; }
+  if ((len>0) && (d[-1]=='\\')) { *d++ = '*'; *d = 0; is_dir = 1; }
+  if ((len>1) && (d[-1]=='.') && (d[-2]=='\\')) { d[-1] = '*'; is_dir = 1; }
+  if (!is_dir) { /* this file may still be a directory that we need to list */
+    DWORD attr = GetFileAttributes(findIn);
+    if (attr&FILE_ATTRIBUTE_DIRECTORY)
+      strcpy(d, "\\*");
+  }
+  { /* Create a block to limit the scope while we find the initial "wide" filename */
+     /* unsigned short * wbuf = (unsigned short*)malloc(sizeof(short) *(len + 10)); */
+     /* wbuf[fl_utf2unicode(findIn, strlen(findIn), wbuf)] = 0; */
+	unsigned short *wbuf = NULL;
+	unsigned wlen = fltk3::utf8toUtf16(findIn, strlen(findIn), NULL, 0); /* Pass NULL to query length */
+	wlen++; /* add a little extra for termination etc. */
+	wbuf = (unsigned short*)malloc(sizeof(unsigned short)*wlen);
+	wlen = fltk3::utf8toUtf16(findIn, strlen(findIn), wbuf, wlen); /* actually convert the filename */
+	wbuf[wlen] = 0; /* NULL terminate the resultant string */
+	h = FindFirstFileW((LPCWSTR)wbuf, &findw); /* get a handle to the first filename in the search */
+	free(wbuf); /* release the "wide" buffer before the pointer goes out of scope */
+  }
+  if (h==INVALID_HANDLE_VALUE) {
+    free(findIn);
+    ret = GetLastError();
+    if (ret != ERROR_NO_MORE_FILES) {
+      nDir = -1;
+    }
+    *namelist = dir;
+    return nDir;
+  }
+  do {
+	int l = wcslen(findw.cFileName);
+	int dstlen = l * 5 + 1;
+	selectDir=(struct dirent*)malloc(sizeof(struct dirent)+dstlen);
+
+     /* l = fl_unicode2utf(findw.cFileName, l, selectDir->d_name); */
+	l = fltk3::utf8fromwc(selectDir->d_name, dstlen, findw.cFileName, l);
+
+	selectDir->d_name[l] = 0;
+	if (findw.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
+		/* Append a trailing slash to directory names... */
+		strcat(selectDir->d_name, "/");
+	}
+	if (!select || (*select)(selectDir)) {
+		if (nDir==NDir) {
+	struct dirent **tempDir = (struct dirent **)calloc(sizeof(struct dirent*), (size_t)(NDir+33));
+	if (NDir) memcpy(tempDir, dir, sizeof(struct dirent*)*NDir);
+	if (dir) free(dir);
+	dir = tempDir;
+	NDir += 32;
+		}
+		dir[nDir] = selectDir;
+		nDir++;
+		dir[nDir] = 0;
+	} else {
+		free(selectDir);
+	}
+   } while (FindNextFileW(h, &findw));
+  ret = GetLastError();
+  if (ret != ERROR_NO_MORE_FILES) {
+    /* don't return an error code, because the dir list may still be valid
+       up to this point */
+  }
+  FindClose(h);
+
+  free (findIn);
+
+  if (compar) qsort(dir, (size_t)nDir, sizeof(*dir),
+		    (int(*)(const void*, const void*))compar);
+
+  *namelist = dir;
+  return nDir;
+}
+
+#endif
+
+/*
+ * End of "$Id$".
+ */

Copied: branches/branch-3.0/src/fltk3/win32_set_fonts.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_fonts_win32.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/win32_set_fonts.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/win32_set_fonts.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,173 @@
+//
+// "$Id$"
+//
+// WIN32 font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this7 library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This function fills in the FLTK font table with all the fonts that
+// are found on the X server.  It tries to place the fonts into families
+// and to sort them so the first 4 in a family are normal, bold, italic,
+// and bold italic.
+#include <fltk3/utf8.h>
+#ifdef __CYGWIN__
+# include <wchar.h>
+#endif
+
+// Bug: older versions calculated the value for *ap as a side effect of
+// making the name, and then forgot about it. To avoid having to change
+// the header files I decided to store this value in the last character
+// of the font name array.
+#define ENDOFBUFFER 127 // sizeof(fltk3::Font.fontname)-1
+
+// turn a stored font name into a pretty name:
+const char* fltk3::get_font_name(fltk3::Font fnum, int* ap) {
+  Fl_Fontdesc *f = fltk3::fonts + fnum;
+  if (!f->fontname[0]) {
+    const char* p = f->name;
+    if (!p || !*p) {if (ap) *ap = 0; return "";}
+    int type;
+    switch (*p) {
+    case 'B': type = fltk3::BOLD; break;
+    case 'I': type = fltk3::ITALIC; break;
+    case 'P': type = fltk3::BOLD | fltk3::ITALIC; break;
+    default:  type = 0; break;
+    }
+    strlcpy(f->fontname, p+1, ENDOFBUFFER);
+    if (type & fltk3::BOLD) strlcat(f->fontname, " bold", ENDOFBUFFER);
+    if (type & fltk3::ITALIC) strlcat(f->fontname, " italic", ENDOFBUFFER);
+    f->fontname[ENDOFBUFFER] = (char)type;
+  }
+  if (ap) *ap = f->fontname[ENDOFBUFFER];
+  return f->fontname;
+}
+
+static int fl_free_font = fltk3::FREE_FONT;
+
+static int CALLBACK
+enumcbw(CONST LOGFONTW    *lpelf,
+        CONST TEXTMETRICW * /*lpntm*/,
+       DWORD            /*FontType*/,
+       LPARAM           p) {
+  if (!p && lpelf->lfCharSet != ANSI_CHARSET) return 1;
+  char *n = NULL;
+  int l = wcslen(lpelf->lfFaceName);
+  unsigned dstlen = fltk3::utf8fromwc(n, 0, (xchar*)lpelf->lfFaceName, l) + 1; // measure the string
+  n = (char*) malloc(dstlen);
+//n[fl_unicode2utf((xchar*)lpelf->lfFaceName, l, n)] = 0;
+  dstlen = fltk3::utf8fromwc(n, dstlen, (xchar*)lpelf->lfFaceName, l); // convert the string
+  n[dstlen] = 0;
+  for (int i=0; i<fltk3::FREE_FONT; i++) // skip if one of our built-in fonts
+	  if (!strcmp(fltk3::get_font_name((fltk3::Font)i),n)) {free(n);return 1;}
+  char buffer[LF_FACESIZE + 1];
+  strcpy(buffer+1, n);
+  buffer[0] = ' '; fltk3::set_font((fltk3::Font)(fl_free_font++), strdup(buffer));
+  if (lpelf->lfWeight <= 400)
+    buffer[0] = 'B', fltk3::set_font((fltk3::Font)(fl_free_font++), strdup(buffer));
+  buffer[0] = 'I'; fltk3::set_font((fltk3::Font)(fl_free_font++), strdup(buffer));
+  if (lpelf->lfWeight <= 400)
+    buffer[0] = 'P', fltk3::set_font((fltk3::Font)(fl_free_font++), strdup(buffer));
+  free(n);
+  return 1;
+} /* enumcbw */
+
+fltk3::Font fltk3::set_fonts(const char* xstarname) {
+  if (fl_free_font == fltk3::FREE_FONT) {// if not already been called
+    if (!fl_gc) fl_GetDC(0);
+
+      EnumFontFamiliesW(fl_gc, NULL, (FONTENUMPROCW)enumcbw, xstarname != 0);
+
+  }
+  return (fltk3::Font)fl_free_font;
+}
+
+
+static int nbSize;
+static int cyPerInch;
+static int sizes[128];
+static int CALLBACK
+
+EnumSizeCbW(CONST LOGFONTW    * /*lpelf*/,
+           CONST TEXTMETRICW *lpntm,
+           DWORD            fontType,
+           LPARAM           /*p*/) {
+  if ((fontType & RASTER_FONTTYPE) == 0) {
+    sizes[0] = 0;
+    nbSize = 1;
+
+    // Scalable font
+    return 0;
+  }
+
+  int add = lpntm->tmHeight - lpntm->tmInternalLeading;
+  add = MulDiv(add, 72, cyPerInch);
+
+  int start = 0;
+  while ((start < nbSize) && (sizes[start] < add)) {
+    start++;
+  }
+
+  if ((start < nbSize) && (sizes[start] == add)) {
+    return 1;
+  }
+
+  for (int i=nbSize; i>start; i--) sizes[i] = sizes[i - 1];
+
+  sizes[start] = add;
+  nbSize++;
+
+  // Stop enum if buffer overflow
+  return nbSize < 128;
+}
+
+
+int
+fltk3::get_font_sizes(fltk3::Font fnum, int*& sizep) {
+  nbSize = 0;
+  Fl_Fontdesc *s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // empty slot in table, use entry 0
+
+  if (!fl_gc) fl_GetDC(0);
+  cyPerInch = GetDeviceCaps(fl_gc, LOGPIXELSY);
+  if (cyPerInch < 1) cyPerInch = 1;
+
+//  int l = fltk3::utf_nb_char((unsigned char*)s->name+1, strlen(s->name+1));
+//  unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
+//  fl_utf2unicode((unsigned char*)s->name+1, l, (xchar*)b);
+	const char *nm = (const char*)s->name+1;
+	int len = strlen(s->name+1);
+    int l = fltk3::utf8toUtf16(nm, len, NULL, 0); // Pass NULL to query length required
+    unsigned short *b = (unsigned short*) malloc((l + 1) * sizeof(short));
+    l = fltk3::utf8toUtf16(nm, len, b, (l+1)); // Now do the conversion
+    b[l] = 0;
+    EnumFontFamiliesW(fl_gc, (WCHAR*)b, (FONTENUMPROCW)EnumSizeCbW, 0);
+	free(b);
+
+  sizep = sizes;
+  return nbSize;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/x11.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_x.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/x11.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/x11.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,2119 @@
+//
+// "$Id$"
+//
+// X specific code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#ifdef WIN32
+//#  include "Fl_win32.cxx"
+#elif defined(__APPLE__)
+//#  include "Fl_mac.cxx"
+#elif !defined(FLTK3_DOXYGEN)
+
+#  define CONSOLIDATE_MOTION 1
+/**** Define this if your keyboard lacks a backspace key... ****/
+/* #define BACKSPACE_HACK 1 */
+
+#  include <config.h>
+#  include <fltk3/run.h>
+#  include <fltk3/x.h>
+#  include <fltk3/Window.h>
+#  include <fltk3/utf8.h>
+#  include <fltk3/Tooltip.h>
+#  include <fltk3/draw.h>
+#  include <fltk3/PagedDevice.h>
+#  include <fltk3/filename.h>
+#  include <stdio.h>
+#  include <stdlib.h>
+#  include "flstring.h"
+#  include <unistd.h>
+#  include <sys/time.h>
+#  include <X11/Xmd.h>
+#  include <X11/Xlocale.h>
+#  include <X11/Xlib.h>
+#  include <X11/keysym.h>
+
+static fltk3::XlibGraphicsDriver fl_xlib_driver;
+static fltk3::DisplayDevice fl_xlib_display(&fl_xlib_driver);
+FLTK3_EXPORT fltk3::GraphicsDriver *fltk3::graphics_driver = (fltk3::GraphicsDriver*)&fl_xlib_driver; // the current target device of graphics operations
+fltk3::SurfaceDevice* fltk3::SurfaceDevice::_surface = (fltk3::SurfaceDevice*)&fl_xlib_display; // the current target surface of graphics operations
+fltk3::DisplayDevice *fltk3::DisplayDevice::_display = &fl_xlib_display;// the platform display
+
+////////////////////////////////////////////////////////////////
+// interface to poll/select call:
+
+#  if USE_POLL
+
+#    include <poll.h>
+static pollfd *pollfds = 0;
+
+#  else
+#    if HAVE_SYS_SELECT_H
+#      include <sys/select.h>
+#    endif /* HAVE_SYS_SELECT_H */
+
+// The following #define is only needed for HP-UX 9.x and earlier:
+//#define select(a,b,c,d,e) select((a),(int *)(b),(int *)(c),(int *)(d),(e))
+
+static fd_set fdsets[3];
+static int maxfd;
+#    define POLLIN 1
+#    define POLLOUT 4
+#    define POLLERR 8
+
+#  endif /* USE_POLL */
+
+static int nfds = 0;
+static int fd_array_size = 0;
+struct FD {
+#  if !USE_POLL
+  int fd;
+  short events;
+#  endif
+  void (*cb)(int, void*);
+  void* arg;
+};
+
+static FD *fd = 0;
+
+void fltk3::add_fd(int n, int events, void (*cb)(int, void*), void *v) {
+  remove_fd(n,events);
+  int i = nfds++;
+  if (i >= fd_array_size) {
+    FD *temp;
+    fd_array_size = 2*fd_array_size+1;
+
+    if (!fd) temp = (FD*)malloc(fd_array_size*sizeof(FD));
+    else temp = (FD*)realloc(fd, fd_array_size*sizeof(FD));
+
+    if (!temp) return;
+    fd = temp;
+
+#  if USE_POLL
+    pollfd *tpoll;
+
+    if (!pollfds) tpoll = (pollfd*)malloc(fd_array_size*sizeof(pollfd));
+    else tpoll = (pollfd*)realloc(pollfds, fd_array_size*sizeof(pollfd));
+
+    if (!tpoll) return;
+    pollfds = tpoll;
+#  endif
+  }
+  fd[i].cb = cb;
+  fd[i].arg = v;
+#  if USE_POLL
+  pollfds[i].fd = n;
+  pollfds[i].events = events;
+#  else
+  fd[i].fd = n;
+  fd[i].events = events;
+  if (events & POLLIN) FD_SET(n, &fdsets[0]);
+  if (events & POLLOUT) FD_SET(n, &fdsets[1]);
+  if (events & POLLERR) FD_SET(n, &fdsets[2]);
+  if (n > maxfd) maxfd = n;
+#  endif
+}
+
+void fltk3::add_fd(int n, void (*cb)(int, void*), void* v) {
+  fltk3::add_fd(n, POLLIN, cb, v);
+}
+
+void fltk3::remove_fd(int n, int events) {
+  int i,j;
+# if !USE_POLL
+  maxfd = -1; // recalculate maxfd on the fly
+# endif
+  for (i=j=0; i<nfds; i++) {
+#  if USE_POLL
+    if (pollfds[i].fd == n) {
+      int e = pollfds[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      pollfds[j].events = e;
+    }
+#  else
+    if (fd[i].fd == n) {
+      int e = fd[i].events & ~events;
+      if (!e) continue; // if no events left, delete this fd
+      fd[i].events = e;
+    }
+    if (fd[i].fd > maxfd) maxfd = fd[i].fd;
+#  endif
+    // move it down in the array if necessary:
+    if (j<i) {
+      fd[j] = fd[i];
+#  if USE_POLL
+      pollfds[j] = pollfds[i];
+#  endif
+    }
+    j++;
+  }
+  nfds = j;
+#  if !USE_POLL
+  if (events & POLLIN) FD_CLR(n, &fdsets[0]);
+  if (events & POLLOUT) FD_CLR(n, &fdsets[1]);
+  if (events & POLLERR) FD_CLR(n, &fdsets[2]);
+#  endif
+}
+
+void fltk3::remove_fd(int n) {
+  remove_fd(n, -1);
+}
+
+#if CONSOLIDATE_MOTION
+static fltk3::Window* send_motion;
+extern fltk3::Window* fl_xmousewin;
+#endif
+static bool in_a_window; // true if in any of our windows, even destroyed ones
+static void do_queued_events() {
+  in_a_window = true;
+  while (XEventsQueued(fl_display,QueuedAfterReading)) {
+    XEvent xevent;
+    XNextEvent(fl_display, &xevent);
+    fl_handle(xevent);
+  }
+  // we send fltk3::LEAVE only if the mouse did not enter some other window:
+  if (!in_a_window) fltk3::handle(fltk3::LEAVE, 0);
+#if CONSOLIDATE_MOTION
+  else if (send_motion == fl_xmousewin) {
+    send_motion = 0;
+    fltk3::handle(fltk3::MOVE, fl_xmousewin);
+  }
+#endif
+}
+
+// these pointers are set by the fltk3::lock() function:
+static void nothing() {}
+void (*fl_lock_function)() = nothing;
+void (*fl_unlock_function)() = nothing;
+
+// This is never called with time_to_wait < 0.0:
+// It should return negative on error, 0 if nothing happens before
+// timeout, and >0 if any callbacks were done.
+int fl_wait(double time_to_wait) {
+
+  // OpenGL and other broken libraries call XEventsQueued
+  // unnecessarily and thus cause the file descriptor to not be ready,
+  // so we must check for already-read events:
+  if (fl_display && XQLength(fl_display)) {do_queued_events(); return 1;}
+
+#  if !USE_POLL
+  fd_set fdt[3];
+  fdt[0] = fdsets[0];
+  fdt[1] = fdsets[1];
+  fdt[2] = fdsets[2];
+#  endif
+  int n;
+
+  fl_unlock_function();
+
+  if (time_to_wait < 2147483.648) {
+#  if USE_POLL
+    n = ::poll(pollfds, nfds, int(time_to_wait*1000 + .5));
+#  else
+    timeval t;
+    t.tv_sec = int(time_to_wait);
+    t.tv_usec = int(1000000 * (time_to_wait-t.tv_sec));
+    n = ::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t);
+#  endif
+  } else {
+#  if USE_POLL
+    n = ::poll(pollfds, nfds, -1);
+#  else
+    n = ::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],0);
+#  endif
+  }
+
+  fl_lock_function();
+
+  if (n > 0) {
+    for (int i=0; i<nfds; i++) {
+#  if USE_POLL
+      if (pollfds[i].revents) fd[i].cb(pollfds[i].fd, fd[i].arg);
+#  else
+      int f = fd[i].fd;
+      short revents = 0;
+      if (FD_ISSET(f,&fdt[0])) revents |= POLLIN;
+      if (FD_ISSET(f,&fdt[1])) revents |= POLLOUT;
+      if (FD_ISSET(f,&fdt[2])) revents |= POLLERR;
+      if (fd[i].events & revents) fd[i].cb(f, fd[i].arg);
+#  endif
+    }
+  }
+  return n;
+}
+
+// fl_ready() is just like fl_wait(0.0) except no callbacks are done:
+int fl_ready() {
+  if (XQLength(fl_display)) return 1;
+  if (!nfds) return 0; // nothing to select or poll
+#  if USE_POLL
+  return ::poll(pollfds, nfds, 0);
+#  else
+  timeval t;
+  t.tv_sec = 0;
+  t.tv_usec = 0;
+  fd_set fdt[3];
+  fdt[0] = fdsets[0];
+  fdt[1] = fdsets[1];
+  fdt[2] = fdsets[2];
+  return ::select(maxfd+1,&fdt[0],&fdt[1],&fdt[2],&t);
+#  endif
+}
+
+// replace \r\n by \n
+static void convert_crlf(unsigned char *string, long& len) {
+  unsigned char *a, *b;
+  a = b = string;
+  while (*a) {
+    if (*a == '\r' && a[1] == '\n') { a++; len--; }
+    else *b++ = *a++;
+  }
+  *b = 0;
+}
+
+////////////////////////////////////////////////////////////////
+
+Display *fl_display;
+namespace fltk3 {
+ ::Window message_window = 0;
+}
+int fl_screen;
+XVisualInfo *fl_visual;
+Colormap fl_colormap;
+XIM fl_xim_im = 0;
+XIC fl_xim_ic = 0;
+char fl_is_over_the_spot = 0;
+static XRectangle status_area;
+
+static Atom WM_DELETE_WINDOW;
+static Atom WM_PROTOCOLS;
+static Atom fl_MOTIF_WM_HINTS;
+static Atom TARGETS;
+static Atom CLIPBOARD;
+Atom fl_XdndAware;
+Atom fl_XdndSelection;
+Atom fl_XdndEnter;
+Atom fl_XdndTypeList;
+Atom fl_XdndPosition;
+Atom fl_XdndLeave;
+Atom fl_XdndDrop;
+Atom fl_XdndStatus;
+Atom fl_XdndActionCopy;
+Atom fl_XdndFinished;
+//Atom fl_XdndProxy;
+Atom fl_XdndURIList;
+Atom fl_Xatextplainutf;
+Atom fl_Xatextplain;
+static Atom fl_XaText;
+Atom fl_XaCompoundText;
+Atom fl_XaUtf8String;
+Atom fl_XaTextUriList;
+Atom fl_NET_WM_NAME;			// utf8 aware window label
+Atom fl_NET_WM_ICON_NAME;		// utf8 aware window icon name
+
+/*
+  X defines 32-bit-entities to have a format value of max. 32,
+  although sizeof(atom) can be 8 (64 bits) on a 64-bit OS.
+  See also fl_open_display() for sizeof(atom) < 4.
+  Used for XChangeProperty (see STR #2419).
+*/
+static int atom_bits = 32;
+
+static void fd_callback(int,void *) {
+  do_queued_events();
+}
+
+extern "C" {
+  static int io_error_handler(Display*) {
+    fltk3::fatal("X I/O error");
+    return 0;
+  }
+
+  static int xerror_handler(Display* d, XErrorEvent* e) {
+    char buf1[128], buf2[128];
+    sprintf(buf1, "XRequest.%d", e->request_code);
+    XGetErrorDatabaseText(d,"",buf1,buf1,buf2,128);
+    XGetErrorText(d, e->error_code, buf1, 128);
+    fltk3::warning("%s: %s 0x%lx", buf2, buf1, e->resourceid);
+    return 0;
+  }
+}
+
+extern char *fl_get_font_xfld(int fnum, int size);
+
+void fl_new_ic()
+{
+  XVaNestedList preedit_attr = NULL;
+  XVaNestedList status_attr = NULL;
+  static XFontSet fs = NULL;
+  char *fnt;
+  char **missing_list;
+  int missing_count;
+  char *def_string;
+  static XRectangle spot;
+  int predit = 0;
+  int sarea = 0;
+  XIMStyles* xim_styles = NULL;
+
+#if USE_XFT
+
+#if defined(__GNUC__)
+// FIXME: warning XFT support here
+#endif /*__GNUC__*/
+
+  if (!fs) {
+    fnt = (char*)"-misc-fixed-*";
+    fs = XCreateFontSet(fl_display, fnt, &missing_list,
+                        &missing_count, &def_string);
+  }
+#else
+  if (!fs) {
+    bool must_free_fnt = true;
+    fnt = fl_get_font_xfld(0, 14);
+    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
+    fs = XCreateFontSet(fl_display, fnt, &missing_list,
+                        &missing_count, &def_string);
+    if (must_free_fnt) free(fnt);
+  }
+#endif
+  preedit_attr = XVaCreateNestedList(0,
+                                     XNSpotLocation, &spot,
+                                     XNFontSet, fs, NULL);
+  status_attr = XVaCreateNestedList(0,
+                                    XNAreaNeeded, &status_area,
+                                    XNFontSet, fs, NULL);
+
+  if (!XGetIMValues(fl_xim_im, XNQueryInputStyle,
+                    &xim_styles, NULL, NULL)) {
+    int i;
+    XIMStyle *style;
+    for (i = 0, style = xim_styles->supported_styles;
+         i < xim_styles->count_styles; i++, style++) {
+      if (*style == (XIMPreeditPosition | XIMStatusArea)) {
+        sarea = 1;
+        predit = 1;
+      } else if (*style == (XIMPreeditPosition | XIMStatusNothing)) {
+        predit = 1;
+      }
+    }
+  }
+  XFree(xim_styles);
+
+  if (sarea) {
+    fl_xim_ic = XCreateIC(fl_xim_im,
+                          XNInputStyle, (XIMPreeditPosition | XIMStatusArea),
+                          XNPreeditAttributes, preedit_attr,
+                          XNStatusAttributes, status_attr,
+                          NULL);
+  }
+
+  if (!fl_xim_ic && predit) {
+    fl_xim_ic = XCreateIC(fl_xim_im,
+                          XNInputStyle, (XIMPreeditPosition | XIMStatusNothing),
+                          XNPreeditAttributes, preedit_attr,
+                          NULL);
+  }
+  XFree(preedit_attr);
+  XFree(status_attr);
+  if (!fl_xim_ic) {
+    fl_is_over_the_spot = 0;
+    fl_xim_ic = XCreateIC(fl_xim_im,
+                          XNInputStyle, (XIMPreeditNothing | XIMStatusNothing),
+                          NULL);
+  } else {
+    fl_is_over_the_spot = 1;
+    XVaNestedList status_attr = NULL;
+    status_attr = XVaCreateNestedList(0, XNAreaNeeded, &status_area, NULL);
+
+    XGetICValues(fl_xim_ic, XNStatusAttributes, status_attr, NULL);
+    XFree(status_attr);
+  }
+}
+
+
+static XRectangle    spot;
+static int spotf = -1;
+static int spots = -1;
+
+void fltk3::reset_spot(void)
+{
+  spot.x = -1;
+  spot.y = -1;
+  //if (fl_xim_ic) XUnsetICFocus(fl_xim_ic);
+}
+
+void fltk3::set_spot(int font, int size, int X, int Y, int W, int H, fltk3::Window *win)
+{
+  int change = 0;
+  XVaNestedList preedit_attr;
+  static XFontSet fs = NULL;
+  char **missing_list;
+  int missing_count;
+  char *def_string;
+  char *fnt = NULL;
+  bool must_free_fnt =true;
+
+  static XIC ic = NULL;
+
+  if (!fl_xim_ic || !fl_is_over_the_spot) return;
+  //XSetICFocus(fl_xim_ic);
+  if (X != spot.x || Y != spot.y) {
+    spot.x = X;
+    spot.y = Y;
+    spot.height = H;
+    spot.width = W;
+    change = 1;
+  }
+  if (font != spotf || size != spots) {
+    spotf = font;
+    spots = size;
+    change = 1;
+    if (fs) {
+      XFreeFontSet(fl_display, fs);
+    }
+#if USE_XFT
+
+#if defined(__GNUC__)
+// FIXME: warning XFT support here
+#endif /*__GNUC__*/
+
+    fnt = NULL; // fl_get_font_xfld(font, size);
+    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
+    fs = XCreateFontSet(fl_display, fnt, &missing_list,
+                        &missing_count, &def_string);
+#else
+    fnt = fl_get_font_xfld(font, size);
+    if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
+    fs = XCreateFontSet(fl_display, fnt, &missing_list,
+                        &missing_count, &def_string);
+#endif
+  }
+  if (fl_xim_ic != ic) {
+    ic = fl_xim_ic;
+    change = 1;
+  }
+
+  if (fnt && must_free_fnt) free(fnt);
+  if (!change) return;
+
+
+  preedit_attr = XVaCreateNestedList(0,
+                                     XNSpotLocation, &spot,
+                                     XNFontSet, fs, NULL);
+  XSetICValues(fl_xim_ic, XNPreeditAttributes, preedit_attr, NULL);
+  XFree(preedit_attr);
+}
+
+void fltk3::set_status(int x, int y, int w, int h)
+{
+  XVaNestedList status_attr;
+  status_area.x = x;
+  status_area.y = y;
+  status_area.width = w;
+  status_area.height = h;
+  if (!fl_xim_ic) return;
+  status_attr = XVaCreateNestedList(0, XNArea, &status_area, NULL);
+
+  XSetICValues(fl_xim_ic, XNStatusAttributes, status_attr, NULL);
+  XFree(status_attr);
+}
+
+void fl_init_xim() {
+  static int xim_warning = 2;
+  if (xim_warning > 0) xim_warning--;
+
+  //XIMStyle *style;
+  XIMStyles *xim_styles;
+  if (!fl_display) return;
+  if (fl_xim_im) return;
+
+  fl_xim_im = XOpenIM(fl_display, NULL, NULL, NULL);
+  xim_styles = NULL;
+  fl_xim_ic = NULL;
+
+  if (fl_xim_im) {
+    XGetIMValues (fl_xim_im, XNQueryInputStyle,
+                  &xim_styles, NULL, NULL);
+  } else {
+    if (xim_warning)
+      fltk3::warning("XOpenIM() failed");
+    // if xim_styles is allocated, free it now
+    if (xim_styles) XFree(xim_styles);
+    return;
+  }
+
+  if (xim_styles && xim_styles->count_styles) {
+    fl_new_ic();
+   } else {
+     if (xim_warning)
+       fltk3::warning("No XIM style found");
+     XCloseIM(fl_xim_im);
+     fl_xim_im = NULL;
+     // if xim_styles is allocated, free it now
+     if (xim_styles) XFree(xim_styles);
+     return;
+  }
+  if (!fl_xim_ic) {
+    if (xim_warning)
+      fltk3::warning("XCreateIC() failed");
+    XCloseIM(fl_xim_im);
+    fl_xim_im = NULL;
+  }
+  // if xim_styles is still allocated, free it now
+  if(xim_styles) XFree(xim_styles);
+}
+
+void fl_open_display() {
+  if (fl_display) return;
+
+  setlocale(LC_CTYPE, "");
+  XSetLocaleModifiers("");
+
+  XSetIOErrorHandler(io_error_handler);
+  XSetErrorHandler(xerror_handler);
+
+  Display *d = XOpenDisplay(0);
+  if (!d) fltk3::fatal("Can't open display: %s",XDisplayName(0));
+
+  fl_open_display(d);
+}
+
+void fl_open_display(Display* d) {
+  fl_display = d;
+
+  WM_DELETE_WINDOW      = XInternAtom(d, "WM_DELETE_WINDOW",    0);
+  WM_PROTOCOLS          = XInternAtom(d, "WM_PROTOCOLS",        0);
+  fl_MOTIF_WM_HINTS     = XInternAtom(d, "_MOTIF_WM_HINTS",     0);
+  TARGETS               = XInternAtom(d, "TARGETS",             0);
+  CLIPBOARD             = XInternAtom(d, "CLIPBOARD",           0);
+  fl_XdndAware          = XInternAtom(d, "XdndAware",           0);
+  fl_XdndSelection      = XInternAtom(d, "XdndSelection",       0);
+  fl_XdndEnter          = XInternAtom(d, "XdndEnter",           0);
+  fl_XdndTypeList       = XInternAtom(d, "XdndTypeList",        0);
+  fl_XdndPosition       = XInternAtom(d, "XdndPosition",        0);
+  fl_XdndLeave          = XInternAtom(d, "XdndLeave",           0);
+  fl_XdndDrop           = XInternAtom(d, "XdndDrop",            0);
+  fl_XdndStatus         = XInternAtom(d, "XdndStatus",          0);
+  fl_XdndActionCopy     = XInternAtom(d, "XdndActionCopy",      0);
+  fl_XdndFinished       = XInternAtom(d, "XdndFinished",        0);
+  //fl_XdndProxy        = XInternAtom(d, "XdndProxy",           0);
+  fl_XdndEnter          = XInternAtom(d, "XdndEnter",           0);
+  fl_XdndURIList        = XInternAtom(d, "text/uri-list",       0);
+  fl_Xatextplainutf     = XInternAtom(d, "text/plain;charset=UTF-8",0);
+  fl_Xatextplain        = XInternAtom(d, "text/plain",          0);
+  fl_XaText             = XInternAtom(d, "TEXT",                0);
+  fl_XaCompoundText     = XInternAtom(d, "COMPOUND_TEXT",       0);
+  fl_XaUtf8String       = XInternAtom(d, "UTF8_STRING",         0);
+  fl_XaTextUriList      = XInternAtom(d, "text/uri-list",       0);
+  fl_NET_WM_NAME        = XInternAtom(d, "_NET_WM_NAME",        0);
+  fl_NET_WM_ICON_NAME   = XInternAtom(d, "_NET_WM_ICON_NAME",   0);
+
+  if (sizeof(Atom) < 4)
+    atom_bits = sizeof(Atom) * 8;
+
+  fltk3::add_fd(ConnectionNumber(d), POLLIN, fd_callback);
+
+  fl_screen = DefaultScreen(d);
+
+  fltk3::message_window =
+    XCreateSimpleWindow(d, RootWindow(d,fl_screen), 0,0,1,1,0, 0, 0);
+
+// construct an XVisualInfo that matches the default Visual:
+  XVisualInfo templt; int num;
+  templt.visualid = XVisualIDFromVisual(DefaultVisual(d, fl_screen));
+  fl_visual = XGetVisualInfo(d, VisualIDMask, &templt, &num);
+  fl_colormap = DefaultColormap(d, fl_screen);
+  fl_init_xim();
+
+#if !USE_COLORMAP
+  fltk3::visual(fltk3::RGB);
+#endif
+}
+
+void fl_close_display() {
+  fltk3::remove_fd(ConnectionNumber(fl_display));
+  XCloseDisplay(fl_display);
+}
+
+static int fl_workarea_xywh[4] = { -1, -1, -1, -1 };
+
+static void fl_init_workarea() {
+  fl_open_display();
+
+  Atom _NET_WORKAREA = XInternAtom(fl_display, "_NET_WORKAREA", 0);
+  Atom actual;
+  unsigned long count, remaining;
+  int format;
+  unsigned *xywh;
+
+  if (XGetWindowProperty(fl_display, RootWindow(fl_display, fl_screen),
+                         _NET_WORKAREA, 0, 4 * sizeof(unsigned), False,
+                         XA_CARDINAL, &actual, &format, &count, &remaining,
+                         (unsigned char **)&xywh) || !xywh || !xywh[2] ||
+                         !xywh[3])
+  {
+    fl_workarea_xywh[0] = 0;
+    fl_workarea_xywh[1] = 0;
+    fl_workarea_xywh[2] = DisplayWidth(fl_display, fl_screen);
+    fl_workarea_xywh[3] = DisplayHeight(fl_display, fl_screen);
+  }
+  else
+  {
+    fl_workarea_xywh[0] = (int)xywh[0];
+    fl_workarea_xywh[1] = (int)xywh[1];
+    fl_workarea_xywh[2] = (int)xywh[2];
+    fl_workarea_xywh[3] = (int)xywh[3];
+    XFree(xywh);
+  }
+}
+
+int fltk3::x() {
+  if (fl_workarea_xywh[0] < 0) fl_init_workarea();
+  return fl_workarea_xywh[0];
+}
+
+int fltk3::y() {
+  if (fl_workarea_xywh[0] < 0) fl_init_workarea();
+  return fl_workarea_xywh[1];
+}
+
+int fltk3::w() {
+  if (fl_workarea_xywh[0] < 0) fl_init_workarea();
+  return fl_workarea_xywh[2];
+}
+
+int fltk3::h() {
+  if (fl_workarea_xywh[0] < 0) fl_init_workarea();
+  return fl_workarea_xywh[3];
+}
+
+void fltk3::get_mouse(int &xx, int &yy) {
+  fl_open_display();
+  ::Window root = RootWindow(fl_display, fl_screen);
+  ::Window c; int mx,my,cx,cy; unsigned int mask;
+  XQueryPointer(fl_display,root,&root,&c,&mx,&my,&cx,&cy,&mask);
+  xx = mx;
+  yy = my;
+}
+
+////////////////////////////////////////////////////////////////
+// Code used for paste and DnD into the program:
+
+fltk3::Widget *fl_selection_requestor;
+char *fl_selection_buffer[2];
+int fl_selection_length[2];
+int fl_selection_buffer_length[2];
+char fl_i_own_selection[2] = {0,0};
+
+// Call this when a "paste" operation happens:
+void fltk3::paste(fltk3::Widget &receiver, int clipboard) {
+  if (fl_i_own_selection[clipboard]) {
+    // We already have it, do it quickly without window server.
+    // Notice that the text is clobbered if set_selection is
+    // called in response to fltk3::PASTE!
+    fltk3::e_text = fl_selection_buffer[clipboard];
+    fltk3::e_length = fl_selection_length[clipboard];
+    if (!fltk3::e_text) fltk3::e_text = (char *)"";
+    receiver.handle(fltk3::PASTE);
+    return;
+  }
+  // otherwise get the window server to return it:
+  fl_selection_requestor = &receiver;
+  Atom property = clipboard ? CLIPBOARD : XA_PRIMARY;
+  XConvertSelection(fl_display, property, TARGETS, property,
+                    fl_xid(fltk3::first_window()), fl_event_time);
+}
+
+::Window fl_dnd_source_window;
+Atom *fl_dnd_source_types; // null-terminated list of data types being supplied
+Atom fl_dnd_type;
+Atom fl_dnd_source_action;
+Atom fl_dnd_action;
+
+void fl_sendClientMessage(::Window window, Atom message,
+                                 unsigned long d0,
+                                 unsigned long d1=0,
+                                 unsigned long d2=0,
+                                 unsigned long d3=0,
+                                 unsigned long d4=0)
+{
+  XEvent e;
+  e.xany.type = ClientMessage;
+  e.xany.window = window;
+  e.xclient.message_type = message;
+  e.xclient.format = 32;
+  e.xclient.data.l[0] = (long)d0;
+  e.xclient.data.l[1] = (long)d1;
+  e.xclient.data.l[2] = (long)d2;
+  e.xclient.data.l[3] = (long)d3;
+  e.xclient.data.l[4] = (long)d4;
+  XSendEvent(fl_display, window, 0, 0, &e);
+}
+
+////////////////////////////////////////////////////////////////
+// Code for copying to clipboard and DnD out of the program:
+
+void fltk3::copy(const char *stuff, int len, int clipboard) {
+  if (!stuff || len<0) return;
+  if (len+1 > fl_selection_buffer_length[clipboard]) {
+    delete[] fl_selection_buffer[clipboard];
+    fl_selection_buffer[clipboard] = new char[len+100];
+    fl_selection_buffer_length[clipboard] = len+100;
+  }
+  memcpy(fl_selection_buffer[clipboard], stuff, len);
+  fl_selection_buffer[clipboard][len] = 0; // needed for direct paste
+  fl_selection_length[clipboard] = len;
+  fl_i_own_selection[clipboard] = 1;
+  Atom property = clipboard ? CLIPBOARD : XA_PRIMARY;
+  XSetSelectionOwner(fl_display, property, fltk3::message_window, fl_event_time);
+}
+
+////////////////////////////////////////////////////////////////
+
+const XEvent* fl_xevent; // the current x event
+ulong fl_event_time; // the last timestamp from an x event
+
+char fl_key_vector[32]; // used by fltk3::get_key()
+
+// Record event mouse position and state from an XEvent:
+
+static int px, py;
+static ulong ptime;
+
+static void set_event_xy() {
+#  if CONSOLIDATE_MOTION
+  send_motion = 0;
+#  endif
+  fltk3::e_x_root  = fl_xevent->xbutton.x_root;
+  fltk3::e_x       = fl_xevent->xbutton.x;
+  fltk3::e_y_root  = fl_xevent->xbutton.y_root;
+  fltk3::e_y       = fl_xevent->xbutton.y;
+  fltk3::e_state   = fl_xevent->xbutton.state << 16;
+  fl_event_time = fl_xevent->xbutton.time;
+#  ifdef __sgi
+  // get the meta key off PC keyboards:
+  if (fl_key_vector[18]&0x18) fltk3::e_state |= fltk3::META;
+#  endif
+  // turn off is_click if enough time or mouse movement has passed:
+  if (abs(fltk3::e_x_root-px)+abs(fltk3::e_y_root-py) > 3 ||
+      fl_event_time >= ptime+1000)
+    fltk3::e_is_click = 0;
+}
+
+// if this is same event as last && is_click, increment click count:
+static inline void checkdouble() {
+  if (((unsigned)fltk3::e_is_click) == fltk3::e_keysym)
+    fltk3::e_clicks++;
+  else {
+    fltk3::e_clicks = 0;
+    fltk3::e_is_click = fltk3::e_keysym;
+  }
+  px = fltk3::e_x_root;
+  py = fltk3::e_y_root;
+  ptime = fl_event_time;
+}
+
+static fltk3::Window* resize_bug_fix;
+
+////////////////////////////////////////////////////////////////
+
+static char unknown[] = "<unknown>";
+const int unknown_len = 10;
+
+extern "C" {
+
+static int xerror = 0;
+
+static int ignoreXEvents(Display *display, XErrorEvent *event) {
+  xerror = 1;
+  return 0;
+}
+
+static XErrorHandler catchXExceptions() {
+  xerror = 0;
+  return ignoreXEvents;
+}
+
+static int wasXExceptionRaised() {
+  return xerror;
+}
+
+}
+
+
+int fl_handle(const XEvent& thisevent)
+{
+  XEvent xevent = thisevent;
+  fl_xevent = &thisevent;
+  ::Window xid = xevent.xany.window;
+  static ::Window xim_win = 0;
+
+  if (fl_xim_ic && xevent.type == DestroyNotify &&
+        xid != xim_win && !fl_find(xid))
+  {
+    XIM xim_im;
+    xim_im = XOpenIM(fl_display, NULL, NULL, NULL);
+    if (!xim_im) {
+      /*  XIM server has crashed */
+      XSetLocaleModifiers("@im=");
+      fl_xim_im = NULL;
+      fl_init_xim();
+    } else {
+      XCloseIM(xim_im);	// see STR 2185 for comment
+    }
+    return 0;
+  }
+
+  if (fl_xim_ic && (xevent.type == FocusIn))
+  {
+#define POOR_XIM
+#ifdef POOR_XIM
+        if (xim_win != xid)
+        {
+                xim_win  = xid;
+                XDestroyIC(fl_xim_ic);
+                fl_xim_ic = NULL;
+                fl_new_ic();
+                XSetICValues(fl_xim_ic,
+                                XNFocusWindow, xevent.xclient.window,
+                                XNClientWindow, xid,
+                                NULL);
+        }
+        fltk3::set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+#else
+    if (fltk3::first_window() && fltk3::first_window()->modal()) {
+      ::Window x  = fl_xid(fltk3::first_window());
+      if (x != xim_win) {
+        xim_win  = x;
+        XSetICValues(fl_xim_ic,
+                        XNFocusWindow, xim_win,
+                        XNClientWindow, xim_win,
+                        NULL);
+        fltk3::set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+      }
+    } else if (xim_win != xid && xid) {
+      xim_win = xid;
+      XSetICValues(fl_xim_ic,
+                        XNFocusWindow, xevent.xclient.window,
+                        XNClientWindow, xid,
+                        //XNFocusWindow, xim_win,
+                        //XNClientWindow, xim_win,
+                        NULL);
+      fltk3::set_spot(spotf, spots, spot.x, spot.y, spot.width, spot.height);
+    }
+#endif
+  }
+
+  if ( XFilterEvent((XEvent *)&xevent, 0) )
+      return(1);
+
+  switch (xevent.type) {
+
+  case KeymapNotify:
+    memcpy(fl_key_vector, xevent.xkeymap.key_vector, 32);
+    return 0;
+
+  case MappingNotify:
+    XRefreshKeyboardMapping((XMappingEvent*)&xevent.xmapping);
+    return 0;
+
+  case SelectionNotify: {
+    if (!fl_selection_requestor) return 0;
+    static unsigned char* buffer = 0;
+    if (buffer) {XFree(buffer); buffer = 0;}
+    long bytesread = 0;
+    if (fl_xevent->xselection.property) for (;;) {
+      // The Xdnd code pastes 64K chunks together, possibly to avoid
+      // bugs in X servers, or maybe to avoid an extra round-trip to
+      // get the property length.  I copy this here:
+      Atom actual; int format; unsigned long count, remaining;
+      unsigned char* portion = NULL;
+      if (XGetWindowProperty(fl_display,
+                             fl_xevent->xselection.requestor,
+                             fl_xevent->xselection.property,
+                             bytesread/4, 65536, 1, 0,
+                             &actual, &format, &count, &remaining,
+                             &portion)) break; // quit on error
+      if (actual == TARGETS || actual == XA_ATOM) {
+	Atom type = XA_STRING;
+	for (unsigned i = 0; i<count; i++) {
+	  Atom t = ((Atom*)portion)[i];
+	    if (t == fl_Xatextplainutf ||
+		  t == fl_Xatextplain ||
+		  t == fl_XaUtf8String) {type = t; break;}
+	    // rest are only used if no utf-8 available:
+	    if (t == fl_XaText ||
+		  t == fl_XaTextUriList ||
+		  t == fl_XaCompoundText) type = t;
+	}
+	XFree(portion);
+	Atom property = xevent.xselection.property;
+	XConvertSelection(fl_display, property, type, property,
+	      fl_xid(fltk3::first_window()),
+	      fl_event_time);
+	return true;
+      }
+      // Make sure we got something sane...
+      if ((portion == NULL) || (format != 8) || (count == 0)) {
+        if (portion) XFree(portion);
+        return true;
+      }
+      buffer = (unsigned char*)realloc(buffer, bytesread+count+remaining+1);
+      memcpy(buffer+bytesread, portion, count);
+      XFree(portion);
+      bytesread += count;
+      // Cannot trust data to be null terminated
+      buffer[bytesread] = '\0';
+      if (!remaining) break;
+    }
+    if (buffer) {
+      buffer[bytesread] = 0;
+      convert_crlf(buffer, bytesread);
+    }
+    fltk3::e_text = buffer ? (char*)buffer : (char *)"";
+    fltk3::e_length = bytesread;
+    int old_event = fltk3::e_number;
+    fl_selection_requestor->handle(fltk3::e_number = fltk3::PASTE);
+    fltk3::e_number = old_event;
+    // Detect if this paste is due to Xdnd by the property name (I use
+    // XA_SECONDARY for that) and send an XdndFinished message. It is not
+    // clear if this has to be delayed until now or if it can be done
+    // immediatly after calling XConvertSelection.
+    if (fl_xevent->xselection.property == XA_SECONDARY &&
+        fl_dnd_source_window) {
+      fl_sendClientMessage(fl_dnd_source_window, fl_XdndFinished,
+                           fl_xevent->xselection.requestor);
+      fl_dnd_source_window = 0; // don't send a second time
+    }
+    return 1;}
+
+  case SelectionClear: {
+    int clipboard = fl_xevent->xselectionclear.selection == CLIPBOARD;
+    fl_i_own_selection[clipboard] = 0;
+    return 1;}
+
+  case SelectionRequest: {
+    XSelectionEvent e;
+    e.type = SelectionNotify;
+    e.requestor = fl_xevent->xselectionrequest.requestor;
+    e.selection = fl_xevent->xselectionrequest.selection;
+    int clipboard = e.selection == CLIPBOARD;
+    e.target = fl_xevent->xselectionrequest.target;
+    e.time = fl_xevent->xselectionrequest.time;
+    e.property = fl_xevent->xselectionrequest.property;
+    if (e.target == TARGETS) {
+      Atom a[3] = {fl_XaUtf8String, XA_STRING, fl_XaText};
+      XChangeProperty(fl_display, e.requestor, e.property,
+                      XA_ATOM, atom_bits, 0, (unsigned char*)a, 3);
+    } else if (/*e.target == XA_STRING &&*/ fl_selection_length[clipboard]) {
+    if (e.target == fl_XaUtf8String ||
+	     e.target == XA_STRING ||
+	     e.target == fl_XaCompoundText ||
+	     e.target == fl_XaText ||
+	     e.target == fl_Xatextplain ||
+	     e.target == fl_Xatextplainutf) {
+	// clobber the target type, this seems to make some applications
+	// behave that insist on asking for XA_TEXT instead of UTF8_STRING
+	// Does not change XA_STRING as that breaks xclipboard.
+	if (e.target != XA_STRING) e.target = fl_XaUtf8String;
+	XChangeProperty(fl_display, e.requestor, e.property,
+			 e.target, 8, 0,
+			 (unsigned char *)fl_selection_buffer[clipboard],
+			 fl_selection_length[clipboard]);
+      }
+    } else {
+//    char* x = XGetAtomName(fl_display,e.target);
+//    fprintf(stderr,"selection request of %s\n",x);
+//    XFree(x);
+      e.property = 0;
+    }
+    XSendEvent(fl_display, e.requestor, 0, 0, (XEvent *)&e);}
+    return 1;
+
+  // events where interesting window id is in a different place:
+  case CirculateNotify:
+  case CirculateRequest:
+  case ConfigureNotify:
+  case ConfigureRequest:
+  case CreateNotify:
+  case DestroyNotify:
+  case GravityNotify:
+  case MapNotify:
+  case MapRequest:
+  case ReparentNotify:
+  case UnmapNotify:
+    xid = xevent.xmaprequest.window;
+    break;
+  }
+
+  int event = 0;
+  fltk3::Window* window = fl_find(xid);
+
+  if (window) switch (xevent.type) {
+
+    case DestroyNotify: { // an X11 window was closed externally from the program
+      fltk3::handle(fltk3::CLOSE, window);
+      Fl_X* X = Fl_X::i(window);
+      if (X) { // indicates the FLTK window was not closed
+        X->xid = (::Window)0; // indicates the X11 window was already destroyed
+        window->hide();
+        int oldx = window->x(), oldy = window->y();
+        window->position(0, 0);
+        window->position(oldx, oldy);
+        window->show(); // recreate the X11 window in support of the FLTK window
+      }
+      return 1;
+    }
+    case ClientMessage: {
+    Atom message = fl_xevent->xclient.message_type;
+    const long* data = fl_xevent->xclient.data.l;
+    if ((Atom)(data[0]) == WM_DELETE_WINDOW) {
+      event = fltk3::CLOSE;
+    } else if (message == fl_XdndEnter) {
+      fl_xmousewin = window;
+      in_a_window = true;
+      fl_dnd_source_window = data[0];
+      // version number is data[1]>>24
+//      printf("XdndEnter, version %ld\n", data[1] >> 24);
+      if (data[1]&1) {
+        // get list of data types:
+        Atom actual; int format; unsigned long count, remaining;
+        unsigned char *buffer = 0;
+        XGetWindowProperty(fl_display, fl_dnd_source_window, fl_XdndTypeList,
+                           0, 0x8000000L, False, XA_ATOM, &actual, &format,
+                           &count, &remaining, &buffer);
+        if (actual != XA_ATOM || format != 32 || count<4 || !buffer)
+          goto FAILED;
+        delete [] fl_dnd_source_types;
+        fl_dnd_source_types = new Atom[count+1];
+        for (unsigned i = 0; i < count; i++) {
+          fl_dnd_source_types[i] = ((Atom*)buffer)[i];
+        }
+        fl_dnd_source_types[count] = 0;
+      } else {
+      FAILED:
+        // less than four data types, or if the above messes up:
+        if (!fl_dnd_source_types) fl_dnd_source_types = new Atom[4];
+        fl_dnd_source_types[0] = data[2];
+        fl_dnd_source_types[1] = data[3];
+        fl_dnd_source_types[2] = data[4];
+        fl_dnd_source_types[3] = 0;
+      }
+
+      // Loop through the source types and pick the first text type...
+      int i;
+
+      for (i = 0; fl_dnd_source_types[i]; i ++)
+      {
+//        printf("fl_dnd_source_types[%d] = %ld (%s)\n", i,
+//             fl_dnd_source_types[i],
+//             XGetAtomName(fl_display, fl_dnd_source_types[i]));
+
+        if (!strncmp(XGetAtomName(fl_display, fl_dnd_source_types[i]),
+                     "text/", 5))
+          break;
+      }
+
+      if (fl_dnd_source_types[i])
+        fl_dnd_type = fl_dnd_source_types[i];
+      else
+        fl_dnd_type = fl_dnd_source_types[0];
+
+      event = fltk3::DND_ENTER;
+      fltk3::e_text = unknown;
+      fltk3::e_length = unknown_len;
+      break;
+
+    } else if (message == fl_XdndPosition) {
+      fl_xmousewin = window;
+      in_a_window = true;
+      fl_dnd_source_window = data[0];
+      fltk3::e_x_root = data[2]>>16;
+      fltk3::e_y_root = data[2]&0xFFFF;
+      if (window) {
+        fltk3::e_x = fltk3::e_x_root-window->x();
+        fltk3::e_y = fltk3::e_y_root-window->y();
+      }
+      fl_event_time = data[3];
+      fl_dnd_source_action = data[4];
+      fl_dnd_action = fl_XdndActionCopy;
+      fltk3::e_text = unknown;
+      fltk3::e_length = unknown_len;
+      int accept = fltk3::handle(fltk3::DND_DRAG, window);
+      fl_sendClientMessage(data[0], fl_XdndStatus,
+                           fl_xevent->xclient.window,
+                           accept ? 1 : 0,
+                           0, // used for xy rectangle to not send position inside
+                           0, // used for width+height of rectangle
+                           accept ? fl_dnd_action : None);
+      return 1;
+
+    } else if (message == fl_XdndLeave) {
+      fl_dnd_source_window = 0; // don't send a finished message to it
+      event = fltk3::DND_LEAVE;
+      fltk3::e_text = unknown;
+      fltk3::e_length = unknown_len;
+      break;
+
+    } else if (message == fl_XdndDrop) {
+      fl_xmousewin = window;
+      in_a_window = true;
+      fl_dnd_source_window = data[0];
+      fl_event_time = data[2];
+      ::Window to_window = fl_xevent->xclient.window;
+      fltk3::e_text = unknown;
+      fltk3::e_length = unknown_len;
+      if (fltk3::handle(fltk3::DND_RELEASE, window)) {
+        fl_selection_requestor = fltk3::belowmouse();
+        XConvertSelection(fl_display, fl_XdndSelection,
+                          fl_dnd_type, XA_SECONDARY,
+                          to_window, fl_event_time);
+      } else {
+        // Send the finished message if I refuse the drop.
+        // It is not clear whether I can just send finished always,
+        // or if I have to wait for the SelectionNotify event as the
+        // code is currently doing.
+        fl_sendClientMessage(fl_dnd_source_window, fl_XdndFinished, to_window);
+        fl_dnd_source_window = 0;
+      }
+      return 1;
+
+    }
+    break;}
+
+  case UnmapNotify:
+    event = fltk3::HIDE;
+    break;
+
+  case Expose:
+    Fl_X::i(window)->wait_for_expose = 0;
+#  if 0
+    // try to keep windows on top even if WM_TRANSIENT_FOR does not work:
+    // opaque move/resize window managers do not like this, so I disabled it.
+    if (fltk3::first_window()->non_modal() && window != fltk3::first_window())
+      fltk3::first_window()->show();
+#  endif
+
+  case GraphicsExpose:
+    window->damage(fltk3::DAMAGE_EXPOSE, xevent.xexpose.x, xevent.xexpose.y,
+                   xevent.xexpose.width, xevent.xexpose.height);
+    return 1;
+
+  case FocusIn:
+    if (fl_xim_ic) XSetICFocus(fl_xim_ic);
+    event = fltk3::FOCUS;
+    break;
+
+  case FocusOut:
+    if (fl_xim_ic) XUnsetICFocus(fl_xim_ic);
+    event = fltk3::UNFOCUS;
+    break;
+
+  case KeyPress:
+  case KeyRelease: {
+  KEYPRESS:
+    int keycode = xevent.xkey.keycode;
+    fl_key_vector[keycode/8] |= (1 << (keycode%8));
+    static char *buffer = NULL;
+    static int buffer_len = 0;
+    int len;
+    KeySym keysym;
+    if (buffer_len == 0) {
+      buffer_len = 4096;
+      buffer = (char*) malloc(buffer_len);
+    }
+    if (xevent.type == KeyPress) {
+      event = fltk3::KEYDOWN;
+      int len = 0;
+
+      if (fl_xim_ic) {
+	Status status;
+	len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
+			     buffer, buffer_len, &keysym, &status);
+
+	while (status == XBufferOverflow && buffer_len < 50000) {
+	  buffer_len = buffer_len * 5 + 1;
+	  buffer = (char*)realloc(buffer, buffer_len);
+	  len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
+			     buffer, buffer_len, &keysym, &status);
+	}
+	keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+      } else {
+        //static XComposeStatus compose;
+        len = XLookupString((XKeyEvent*)&(xevent.xkey),
+                             buffer, buffer_len, &keysym, 0/*&compose*/);
+        if (keysym && keysym < 0x400) { // a character in latin-1,2,3,4 sets
+          // force it to type a character (not sure if this ever is needed):
+          // if (!len) {buffer[0] = char(keysym); len = 1;}
+          len = fltk3::utf8encode(XKeysymToUcs(keysym), buffer);
+          if (len < 1) len = 1;
+          // ignore all effects of shift on the keysyms, which makes it a lot
+          // easier to program shortcuts and is Windoze-compatible:
+          keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+        }
+      }
+      // MRS: Can't use fltk3::event_state(fltk3::CTRL) since the state is not
+      //      set until set_event_xy() is called later...
+      if ((xevent.xkey.state & ControlMask) && keysym == '-') buffer[0] = 0x1f; // ^_
+      buffer[len] = 0;
+      fltk3::e_text = buffer;
+      fltk3::e_length = len;
+    } else {
+      // Stupid X sends fake key-up events when a repeating key is held
+      // down, probably due to some back compatibility problem. Fortunately
+      // we can detect this because the repeating KeyPress event is in
+      // the queue, get it and execute it instead:
+
+      // Bool XkbSetDetectableAutorepeat ( display, detectable, supported_rtrn )
+      // Display * display ;
+      // Bool detectable ;
+      // Bool * supported_rtrn ;
+      // ...would be the easy way to corrct this isuue. Unfortunatly, this call is also
+      // broken on many Unix distros including Ubuntu and Solaris (as of Dec 2009)
+
+      // Bogus KeyUp events are generated by repeated KeyDown events. One
+      // neccessary condition is an identical key event pending right after
+      // the bogus KeyUp.
+      // The new code introduced Dec 2009 differs in that it only check the very
+      // next event in the queue, not the entire queue of events.
+      // This function wrongly detects a repeat key if a software keyboard
+      // sends a burst of events containing two consecutive equal keys. However,
+      // in every non-gaming situation, this is no problem because both KeyPress
+      // events will cause the expected behavior.
+      XEvent peekevent;
+      if (XPending(fl_display)) {
+        XPeekEvent(fl_display, &peekevent);
+        if (   (peekevent.type == KeyPress) // must be a KeyPress event
+            && (peekevent.xkey.keycode == xevent.xkey.keycode) // must be the same key
+            && (peekevent.xkey.time == xevent.xkey.time) // must be sent at the exact same time
+            ) {
+          XNextEvent(fl_display, &xevent);
+          goto KEYPRESS;
+        }
+      }
+
+      event = fltk3::KEYUP;
+      fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
+      // keyup events just get the unshifted keysym:
+      keysym = XKeycodeToKeysym(fl_display, keycode, 0);
+    }
+#  ifdef __sgi
+    // You can plug a microsoft keyboard into an sgi but the extra shift
+    // keys are not translated.  Make them translate like XFree86 does:
+    if (!keysym) switch(keycode) {
+    case 147: keysym = fltk3::MetaLKey; break;
+    case 148: keysym = fltk3::MetaRKey; break;
+    case 149: keysym = fltk3::MenuKey; break;
+    }
+#  endif
+#  if BACKSPACE_HACK
+    // Attempt to fix keyboards that send "delete" for the key in the
+    // upper-right corner of the main keyboard.  But it appears that
+    // very few of these remain?
+    static int got_backspace = 0;
+    if (!got_backspace) {
+      if (keysym == fltk3::DeleteKey) keysym = fltk3::BackSpaceKey;
+      else if (keysym == fltk3::BackSpaceKey) got_backspace = 1;
+    }
+#  endif
+    // For the first few years, there wasn't a good consensus on what the
+    // Windows keys should be mapped to for X11. So we need to help out a
+    // bit and map all variants to the same FLTK key...
+    switch (keysym) {
+	case XK_Meta_L:
+	case XK_Hyper_L:
+	case XK_Super_L:
+	  keysym = fltk3::MetaLKey;
+	  break;
+	case XK_Meta_R:
+	case XK_Hyper_R:
+	case XK_Super_R:
+	  keysym = fltk3::MetaRKey;
+	  break;
+    }
+    // Convert the multimedia keys to safer, portable values
+    switch (keysym) { // XF names come from X11/XF86keysym.h
+      case 0x1008FF11: // XF86XK_AudioLowerVolume:
+        keysym = fltk3::VolumeDownKey;
+        break;
+      case 0x1008FF12: // XF86XK_AudioMute:
+        keysym = fltk3::VolumeMuteKey;
+        break;
+      case 0x1008FF13: // XF86XK_AudioRaiseVolume:
+        keysym = fltk3::VolumeUpKey;
+        break;
+      case 0x1008FF14: // XF86XK_AudioPlay:
+        keysym = fltk3::MediaPlayKey;
+        break;
+      case 0x1008FF15: // XF86XK_AudioStop:
+        keysym = fltk3::MediaStopKey;
+        break;
+      case 0x1008FF16: // XF86XK_AudioPrev:
+        keysym = fltk3::MediaPrevKey;
+        break;
+      case 0x1008FF17: // XF86XK_AudioNext:
+        keysym = fltk3::MediaNextKey;
+        break;
+      case 0x1008FF18: // XF86XK_HomePage:
+        keysym = fltk3::HomePageKey;
+        break;
+      case 0x1008FF19: // XF86XK_Mail:
+        keysym = fltk3::MailKey;
+        break;
+      case 0x1008FF1B: // XF86XK_Search:
+        keysym = fltk3::SearchKey;
+        break;
+      case 0x1008FF26: // XF86XK_Back:
+        keysym = fltk3::BackKey;
+        break;
+      case 0x1008FF27: // XF86XK_Forward:
+      	keysym = fltk3::ForwardKey;
+        break;
+      case 0x1008FF28: // XF86XK_Stop:
+        keysym = fltk3::StopKey;
+        break;
+      case 0x1008FF29: // XF86XK_Refresh:
+        keysym = fltk3::RefreshKey;
+        break;
+      case 0x1008FF2F: // XF86XK_Sleep:
+        keysym = fltk3::SleepKey;
+        break;
+      case 0x1008FF30: // XF86XK_Favorites:
+        keysym = fltk3::FavoritesKey;
+        break;
+    }
+    // We have to get rid of the XK_KP_function keys, because they are
+    // not produced on Windoze and thus case statements tend not to check
+    // for them.  There are 15 of these in the range 0xff91 ... 0xff9f
+    if (keysym >= 0xff91 && keysym <= 0xff9f) {
+      // Map keypad keysym to character or keysym depending on
+      // numlock state...
+      unsigned long keysym1 = XKeycodeToKeysym(fl_display, keycode, 1);
+      if (keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= fltk3::KPLastKey))
+        fltk3::e_original_keysym = (int)(keysym1 | fltk3::KPKey);
+      if ((xevent.xkey.state & Mod2Mask) &&
+          (keysym1 <= 0x7f || (keysym1 > 0xff9f && keysym1 <= fltk3::KPLastKey))) {
+        // Store ASCII numeric keypad value...
+        keysym = keysym1 | fltk3::KPKey;
+        buffer[0] = char(keysym1) & 0x7F;
+        len = 1;
+      } else {
+        // Map keypad to special key...
+        static const unsigned short table[15] = {
+          fltk3::FKey+1, fltk3::FKey+2, fltk3::FKey+3, fltk3::FKey+4,
+          fltk3::HomeKey, fltk3::LeftKey, fltk3::UpKey, fltk3::RightKey,
+          fltk3::DownKey, fltk3::PageUpKey, fltk3::PageDownKey, fltk3::EndKey,
+          0xff0b/*XK_Clear*/, fltk3::InsertKey, fltk3::DeleteKey};
+        keysym = table[keysym-0xff91];
+      }
+    } else {
+      // Store this so we can later know if the KP was used
+      fltk3::e_original_keysym = (int)keysym;
+    }
+    fltk3::e_keysym = int(keysym);
+
+    // replace XK_ISO_Left_Tab (Shift-TAB) with fltk3::TabKey (modifier flags are set correctly by X11)
+    if (fltk3::e_keysym == 0xfe20) fltk3::e_keysym = fltk3::TabKey;
+
+    set_event_xy();
+    fltk3::e_is_click = 0;
+    break;}
+
+  case ButtonPress:
+    fltk3::e_keysym = fltk3::MouseButton + xevent.xbutton.button;
+    set_event_xy();
+    if (xevent.xbutton.button == Button4) {
+      fltk3::e_dy = -1; // Up
+      event = fltk3::MOUSEWHEEL;
+    } else if (xevent.xbutton.button == Button5) {
+      fltk3::e_dy = +1; // Down
+      event = fltk3::MOUSEWHEEL;
+    } else {
+      fltk3::e_state |= (fltk3::BUTTON1 << (xevent.xbutton.button-1));
+      event = fltk3::PUSH;
+      checkdouble();
+    }
+
+    fl_xmousewin = window;
+    in_a_window = true;
+    break;
+
+  case MotionNotify:
+    set_event_xy();
+#  if CONSOLIDATE_MOTION
+    send_motion = fl_xmousewin = window;
+    in_a_window = true;
+    return 0;
+#  else
+    event = fltk3::MOVE;
+    fl_xmousewin = window;
+    in_a_window = true;
+    break;
+#  endif
+
+  case ButtonRelease:
+    fltk3::e_keysym = fltk3::MouseButton + xevent.xbutton.button;
+    set_event_xy();
+    fltk3::e_state &= ~(fltk3::BUTTON1 << (xevent.xbutton.button-1));
+    if (xevent.xbutton.button == Button4 ||
+        xevent.xbutton.button == Button5) return 0;
+    event = fltk3::RELEASE;
+
+    fl_xmousewin = window;
+    in_a_window = true;
+    break;
+
+  case EnterNotify:
+    if (xevent.xcrossing.detail == NotifyInferior) break;
+    // XInstallColormap(fl_display, Fl_X::i(window)->colormap);
+    set_event_xy();
+    fltk3::e_state = xevent.xcrossing.state << 16;
+    event = fltk3::ENTER;
+
+    fl_xmousewin = window;
+    in_a_window = true;
+    { XIMStyles *xim_styles = NULL;
+      if(!fl_xim_im || XGetIMValues(fl_xim_im, XNQueryInputStyle, &xim_styles, NULL, NULL)) {
+	fl_init_xim();
+      }
+      if (xim_styles) XFree(xim_styles);
+    }
+    break;
+
+  case LeaveNotify:
+    if (xevent.xcrossing.detail == NotifyInferior) break;
+    set_event_xy();
+    fltk3::e_state = xevent.xcrossing.state << 16;
+    fl_xmousewin = 0;
+    in_a_window = false; // make do_queued_events produce fltk3::LEAVE event
+    return 0;
+
+  // We cannot rely on the x,y position in the configure notify event.
+  // I now think this is an unavoidable problem with X: it is impossible
+  // for a window manager to prevent the "real" notify event from being
+  // sent when it resizes the contents, even though it can send an
+  // artificial event with the correct position afterwards (and some
+  // window managers do not send this fake event anyway)
+  // So anyway, do a round trip to find the correct x,y:
+  case MapNotify:
+    event = fltk3::SHOW;
+
+  case ConfigureNotify: {
+    if (window->parent()) break; // ignore child windows
+
+    // figure out where OS really put window
+    XWindowAttributes actual;
+    XGetWindowAttributes(fl_display, fl_xid(window), &actual);
+    ::Window cr; int X, Y, W = actual.width, H = actual.height;
+    XTranslateCoordinates(fl_display, fl_xid(window), actual.root,
+                          0, 0, &X, &Y, &cr);
+
+    // tell fltk3::Window about it and set flag to prevent echoing:
+    resize_bug_fix = window;
+    window->resize(X, Y, W, H);
+    break; // allow add_handler to do something too
+    }
+
+  case ReparentNotify: {
+    int xpos, ypos;
+    ::Window junk;
+
+    // on some systems, the ReparentNotify event is not handled as we would expect.
+    XErrorHandler oldHandler = XSetErrorHandler(catchXExceptions());
+
+    //ReparentNotify gives the new position of the window relative to
+    //the new parent. FLTK cares about the position on the root window.
+    XTranslateCoordinates(fl_display, xevent.xreparent.parent,
+                          XRootWindow(fl_display, fl_screen),
+                          xevent.xreparent.x, xevent.xreparent.y,
+                          &xpos, &ypos, &junk);
+    XSetErrorHandler(oldHandler);
+
+    // tell fltk3::Window about it and set flag to prevent echoing:
+    if ( !wasXExceptionRaised() ) {
+      resize_bug_fix = window;
+      window->position(xpos, ypos);
+    }
+    break;
+    }
+  }
+
+  return fltk3::handle(event, window);
+}
+
+////////////////////////////////////////////////////////////////
+
+void fltk3::Window::resize(int X,int Y,int W,int H) {
+  int is_a_move = (X != x() || Y != y());
+  int is_a_resize = (W != w() || H != h());
+  int is_a_enlarge = (W > w() || H > h());
+  int resize_from_program = (this != resize_bug_fix);
+  if (!resize_from_program) resize_bug_fix = 0;
+  if (is_a_move && resize_from_program) set_flag(FORCE_POSITION);
+  else if (!is_a_resize && !is_a_move) return;
+  if (is_a_resize) {
+    fltk3::Group::resize(X,Y,W,H);
+    if (shown()) {redraw(); if(is_a_enlarge) i->wait_for_expose = 1;}
+  } else {
+    x(X); y(Y);
+  }
+
+  if (resize_from_program && is_a_resize && !resizable()) {
+    size_range(w(), h(), w(), h());
+  }
+
+  if (resize_from_program && shown()) {
+    if (is_a_resize) {
+      if (!resizable()) size_range(w(),h(),w(),h());
+      if (is_a_move) {
+        XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
+      } else {
+        XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1);
+      }
+    } else
+      XMoveWindow(fl_display, i->xid, X, Y);
+  }
+}
+
+////////////////////////////////////////////////////////////////
+
+// A subclass of fltk3::Window may call this to associate an X window it
+// creates with the fltk3::Window:
+
+void fl_fix_focus(); // in Fl.cxx
+
+Fl_X* Fl_X::set_xid(fltk3::Window* win, ::Window winxid) {
+  Fl_X* xp = new Fl_X;
+  xp->xid = winxid;
+  xp->other_xid = 0;
+  xp->setwindow(win);
+  xp->next = Fl_X::first;
+  xp->region = 0;
+  xp->wait_for_expose = 1;
+  xp->backbuffer_bad = 1;
+  Fl_X::first = xp;
+  if (win->modal()) {fltk3::modal_ = win; fl_fix_focus();}
+  return xp;
+}
+
+// More commonly a subclass calls this, because it hides the really
+// ugly parts of X and sets all the stuff for a window that is set
+// normally.  The global variables like fl_show_iconic are so that
+// subclasses of *that* class may change the behavior...
+
+char fl_show_iconic;    // hack for iconize()
+int fl_background_pixel = -1; // hack to speed up bg box drawing
+int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR
+
+static const int childEventMask = ExposureMask;
+
+static const int XEventMask =
+ExposureMask|StructureNotifyMask
+|KeyPressMask|KeyReleaseMask|KeymapStateMask|FocusChangeMask
+|ButtonPressMask|ButtonReleaseMask
+|EnterWindowMask|LeaveWindowMask
+|PointerMotionMask;
+
+void Fl_X::make_xid(fltk3::Window* win, XVisualInfo *visual, Colormap colormap)
+{
+  fltk3::Group::current(0); // get rid of very common user bug: forgot end()
+
+  int X = win->x();
+  int Y = win->y();
+  int W = win->w();
+  if (W <= 0) W = 1; // X don't like zero...
+  int H = win->h();
+  if (H <= 0) H = 1; // X don't like zero...
+  if (!win->parent() && !fltk3::grab()) {
+    // center windows in case window manager does not do anything:
+#ifdef FL_CENTER_WINDOWS
+    if (!(win->flags() & fltk3::Widget::FORCE_POSITION)) {
+      win->x(X = scr_x+(scr_w-W)/2);
+      win->y(Y = scr_y+(scr_h-H)/2);
+    }
+#endif // FL_CENTER_WINDOWS
+
+    // force the window to be on-screen.  Usually the X window manager
+    // does this, but a few don't, so we do it here for consistency:
+    int scr_x, scr_y, scr_w, scr_h;
+    fltk3::screen_xywh(scr_x, scr_y, scr_w, scr_h, X, Y);
+
+    if (win->border()) {
+      // ensure border is on screen:
+      // (assume extremely minimal dimensions for this border)
+      const int top = 20;
+      const int left = 1;
+      const int right = 1;
+      const int bottom = 1;
+      if (X+W+right > scr_x+scr_w) X = scr_x+scr_w-right-W;
+      if (X-left < scr_x) X = scr_x+left;
+      if (Y+H+bottom > scr_y+scr_h) Y = scr_y+scr_h-bottom-H;
+      if (Y-top < scr_y) Y = scr_y+top;
+    }
+    // now insure contents are on-screen (more important than border):
+    if (X+W > scr_x+scr_w) X = scr_x+scr_w-W;
+    if (X < scr_x) X = scr_x;
+    if (Y+H > scr_y+scr_h) Y = scr_y+scr_h-H;
+    if (Y < scr_y) Y = scr_y;
+  }
+
+  // if the window is a subwindow and our parent is not mapped yet, we
+  // mark this window visible, so that mapping the parent at a later
+  // point in time will call this function again to finally map the subwindow.
+  if (win->parent() && !Fl_X::i(win->window())) {
+    win->set_visible();
+    return;
+  }
+
+  ulong root = win->parent() ?
+    fl_xid(win->window()) : RootWindow(fl_display, fl_screen);
+
+  XSetWindowAttributes attr;
+  int mask = CWBorderPixel|CWColormap|CWEventMask|CWBitGravity;
+  attr.event_mask = win->parent() ? childEventMask : XEventMask;
+  attr.colormap = colormap;
+  attr.border_pixel = 0;
+  attr.bit_gravity = 0; // StaticGravity;
+  if (win->override()) {
+    attr.override_redirect = 1;
+    attr.save_under = 1;
+    mask |= CWOverrideRedirect | CWSaveUnder;
+  } else attr.override_redirect = 0;
+  if (fltk3::grab()) {
+    attr.save_under = 1; mask |= CWSaveUnder;
+    if (!win->border()) {attr.override_redirect = 1; mask |= CWOverrideRedirect;}
+  }
+  if (fl_background_pixel >= 0) {
+    attr.background_pixel = fl_background_pixel;
+    fl_background_pixel = -1;
+    mask |= CWBackPixel;
+  }
+
+  Fl_X* xp =
+    set_xid(win, XCreateWindow(fl_display,
+                               root,
+                               X, Y, W, H,
+                               0, // borderwidth
+                               visual->depth,
+                               InputOutput,
+                               visual->visual,
+                               mask, &attr));
+  int showit = 1;
+
+  if (!win->parent() && !attr.override_redirect) {
+    // Communicate all kinds 'o junk to the X Window Manager:
+
+    win->label(win->label(), win->iconlabel());
+
+    XChangeProperty(fl_display, xp->xid, WM_PROTOCOLS,
+                    XA_ATOM, 32, 0, (uchar*)&WM_DELETE_WINDOW, 1);
+
+    // send size limits and border:
+    xp->sendxjunk();
+
+    // set the class property, which controls the icon used:
+    if (win->xclass()) {
+      char buffer[1024];
+      char *p; const char *q;
+      // truncate on any punctuation, because they break XResource lookup:
+      for (p = buffer, q = win->xclass(); isalnum(*q)||(*q&128);) *p++ = *q++;
+      *p++ = 0;
+      // create the capitalized version:
+      q = buffer;
+      *p = toupper(*q++); if (*p++ == 'X') *p++ = toupper(*q++);
+      while ((*p++ = *q++));
+      XChangeProperty(fl_display, xp->xid, XA_WM_CLASS, XA_STRING, 8, 0,
+                      (unsigned char *)buffer, p-buffer-1);
+    }
+
+    if (win->non_modal() && xp->next && !fl_disable_transient_for) {
+      // find some other window to be "transient for":
+      fltk3::Window* wp = xp->next->w;
+      while (wp->parent()) wp = wp->window();
+      XSetTransientForHint(fl_display, xp->xid, fl_xid(wp));
+      if (!wp->visible()) showit = 0; // guess that wm will not show it
+    }
+
+    // Make sure that borderless windows do not show in the task bar
+    if (!win->border()) {
+      Atom net_wm_state = XInternAtom (fl_display, "_NET_WM_STATE", 0);
+      Atom net_wm_state_skip_taskbar = XInternAtom (fl_display, "_NET_WM_STATE_SKIP_TASKBAR", 0);
+      XChangeProperty (fl_display, xp->xid, net_wm_state, XA_ATOM, 32,
+          PropModeAppend, (unsigned char*) &net_wm_state_skip_taskbar, 1);
+    }
+
+    // Make it receptive to DnD:
+    long version = 4;
+    XChangeProperty(fl_display, xp->xid, fl_XdndAware,
+                    XA_ATOM, sizeof(int)*8, 0, (unsigned char*)&version, 1);
+
+    XWMHints *hints = XAllocWMHints();
+    hints->input = True;
+    hints->flags = InputHint;
+    if (fl_show_iconic) {
+      hints->flags |= StateHint;
+      hints->initial_state = IconicState;
+      fl_show_iconic = 0;
+      showit = 0;
+    }
+    if (win->icon()) {
+      hints->icon_pixmap = (Pixmap)win->icon();
+      hints->flags       |= IconPixmapHint;
+    }
+    XSetWMHints(fl_display, xp->xid, hints);
+    XFree(hints);
+  }
+
+  // set the window type for menu and tooltip windows to avoid animations (compiz)
+  if (win->menu_window() || win->tooltip_window()) {
+    Atom net_wm_type = XInternAtom(fl_display, "_NET_WM_WINDOW_TYPE", False);
+    Atom net_wm_type_kind = XInternAtom(fl_display, "_NET_WM_WINDOW_TYPE_MENU", False);
+    XChangeProperty(fl_display, xp->xid, net_wm_type, XA_ATOM, 32, PropModeReplace, (unsigned char*)&net_wm_type_kind, 1);
+  }
+
+  XMapWindow(fl_display, xp->xid);
+  if (showit) {
+    win->set_visible();
+    int old_event = fltk3::e_number;
+    win->handle(fltk3::e_number = fltk3::SHOW); // get child windows to appear
+    fltk3::e_number = old_event;
+    win->redraw();
+  }
+}
+
+////////////////////////////////////////////////////////////////
+// Send X window stuff that can be changed over time:
+
+void Fl_X::sendxjunk() {
+  if (w->parent() || w->override()) return; // it's not a window manager window!
+
+  if (!w->size_range_set) { // default size_range based on resizable():
+    if (w->resizable()) {
+      fltk3::Widget *o = w->resizable();
+      int minw = o->w(); if (minw > 100) minw = 100;
+      int minh = o->h(); if (minh > 100) minh = 100;
+      w->size_range(w->w() - o->w() + minw, w->h() - o->h() + minh, 0, 0);
+    } else {
+      w->size_range(w->w(), w->h(), w->w(), w->h());
+    }
+    return; // because this recursively called here
+  }
+
+  XSizeHints *hints = XAllocSizeHints();
+  // memset(&hints, 0, sizeof(hints)); jreiser suggestion to fix purify?
+  hints->min_width = w->minw;
+  hints->min_height = w->minh;
+  hints->max_width = w->maxw;
+  hints->max_height = w->maxh;
+  hints->width_inc = w->dw;
+  hints->height_inc = w->dh;
+  hints->win_gravity = StaticGravity;
+
+  // see the file /usr/include/X11/Xm/MwmUtil.h:
+  // fill all fields to avoid bugs in kwm and perhaps other window managers:
+  // 0, MWM_FUNC_ALL, MWM_DECOR_ALL
+  long prop[5] = {0, 1, 1, 0, 0};
+
+  if (hints->min_width != hints->max_width ||
+      hints->min_height != hints->max_height) { // resizable
+    hints->flags = PMinSize|PWinGravity;
+    if (hints->max_width >= hints->min_width ||
+        hints->max_height >= hints->min_height) {
+      hints->flags = PMinSize|PMaxSize|PWinGravity;
+      // unfortunately we can't set just one maximum size.  Guess a
+      // value for the other one.  Some window managers will make the
+      // window fit on screen when maximized, others will put it off screen:
+      if (hints->max_width < hints->min_width) hints->max_width = fltk3::w();
+      if (hints->max_height < hints->min_height) hints->max_height = fltk3::h();
+    }
+    if (hints->width_inc && hints->height_inc) hints->flags |= PResizeInc;
+    if (w->aspect) {
+      // stupid X!  It could insist that the corner go on the
+      // straight line between min and max...
+      hints->min_aspect.x = hints->max_aspect.x = hints->min_width;
+      hints->min_aspect.y = hints->max_aspect.y = hints->min_height;
+      hints->flags |= PAspect;
+    }
+  } else { // not resizable:
+    hints->flags = PMinSize|PMaxSize|PWinGravity;
+    prop[0] = 1; // MWM_HINTS_FUNCTIONS
+    prop[1] = 1|2|16; // MWM_FUNC_ALL | MWM_FUNC_RESIZE | MWM_FUNC_MAXIMIZE
+  }
+
+  if (w->flags() & fltk3::Widget::FORCE_POSITION) {
+    hints->flags |= USPosition;
+    hints->x = w->x();
+    hints->y = w->y();
+  }
+
+  if (!w->border()) {
+    prop[0] |= 2; // MWM_HINTS_DECORATIONS
+    prop[2] = 0; // no decorations
+  }
+
+  XSetWMNormalHints(fl_display, xid, hints);
+  XChangeProperty(fl_display, xid,
+                  fl_MOTIF_WM_HINTS, fl_MOTIF_WM_HINTS,
+                  32, 0, (unsigned char *)prop, 5);
+  XFree(hints);
+}
+
+void fltk3::Window::size_range_() {
+  size_range_set = 1;
+  if (shown()) i->sendxjunk();
+}
+
+////////////////////////////////////////////////////////////////
+
+// returns pointer to the filename, or null if name ends with '/'
+const char *fltk3::filename_name(const char *name) {
+  const char *p,*q;
+  if (!name) return (0);
+  for (p=q=name; *p;) if (*p++ == '/') q = p;
+  return q;
+}
+
+void fltk3::Window::label(const char *name,const char *iname) {
+  fltk3::Widget::label(name);
+  iconlabel_ = iname;
+  if (shown() && !parent()) {
+    if (!name) name = "";
+    int namelen = strlen(name);
+    if (!iname) iname = fltk3::filename_name(name);
+    int inamelen = strlen(iname);
+    XChangeProperty(fl_display, i->xid, fl_NET_WM_NAME,      fl_XaUtf8String, 8, 0, (uchar*)name,  namelen);	// utf8
+    XChangeProperty(fl_display, i->xid, XA_WM_NAME,          XA_STRING,       8, 0, (uchar*)name,  namelen);	// non-utf8
+    XChangeProperty(fl_display, i->xid, fl_NET_WM_ICON_NAME, fl_XaUtf8String, 8, 0, (uchar*)iname, inamelen);	// utf8
+    XChangeProperty(fl_display, i->xid, XA_WM_ICON_NAME,     XA_STRING,       8, 0, (uchar*)iname, inamelen);	// non-utf8
+  }
+}
+
+////////////////////////////////////////////////////////////////
+// Implement the virtual functions for the base fltk3::Window class:
+
+// If the box is a filled rectangle, we can make the redisplay *look*
+// faster by using X's background pixel erasing.  We can make it
+// actually *be* faster by drawing the frame only, this is done by
+// setting fl_boxcheat, which is seen by code in fl_drawbox.cxx:
+//
+// On XFree86 (and prehaps all X's) this has a problem if the window
+// is resized while a save-behind window is atop it.  The previous
+// contents are restored to the area, but this assumes the area
+// is cleared to background color.  So this is disabled in this version.
+// fltk3::Window *fl_boxcheat;
+static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));}
+
+void fltk3::Window::show() {
+  image(fltk3::scheme_bg_);
+  if (fltk3::scheme_bg_) {
+    labeltype(fltk3::NORMAL_LABEL);
+    align(fltk3::ALIGN_CENTER | fltk3::ALIGN_INSIDE | fltk3::ALIGN_CLIP);
+  } else {
+    labeltype(fltk3::NO_LABEL);
+  }
+  fltk3::Tooltip::exit(this);
+  if (!shown()) {
+    fl_open_display();
+    // Don't set background pixel for double-buffered windows...
+    if (type() == fltk3::WINDOW && can_boxcheat(box())) {
+      fl_background_pixel = int(fl_xpixel(color()));
+    }
+    Fl_X::make_xid(this);
+  } else {
+    XMapRaised(fl_display, i->xid);
+  }
+#ifdef USE_PRINT_BUTTON
+void preparePrintFront(void);
+preparePrintFront();
+#endif
+}
+
+::Window fl_window;
+fltk3::Window *fltk3::Window::current_;
+GC fl_gc;
+
+// make X drawing go into this window (called by subclass flush() impl.)
+void fltk3::Window::make_current() {
+  static GC gc; // the GC used by all X windows
+  if (!gc) gc = XCreateGC(fl_display, i->xid, 0, 0);
+  fl_window = i->xid;
+  fl_gc = gc;
+  current_ = this;
+  fltk3::clip_region(0);
+
+#ifdef FLTK_USE_CAIRO
+  // update the cairo_t context
+  if (fltk3::cairo_autolink_context()) fltk3::cairo_make_current(this);
+#endif
+}
+
+::Window fl_xid_(const fltk3::Window* w)
+{
+  Fl_X *temp = Fl_X::i(w);
+  return temp ? temp->xid : 0;
+}
+
+static void decorated_win_size(fltk3::Window *win, int &w, int &h)
+{
+  w = win->w();
+  h = win->h();
+  if (!win->shown() || win->parent() || !win->border() || !win->visible()) return;
+  ::Window root, parent, *children;
+  unsigned n = 0;
+  Status status = XQueryTree(fl_display, Fl_X::i(win)->xid, &root, &parent, &children, &n); 
+  if (status != 0 && n) XFree(children);
+  // when compiz is used, root and parent are the same window 
+  // and I don't know where to find the window decoration
+  if (status == 0 || root == parent) return; 
+  XWindowAttributes attributes;
+  XGetWindowAttributes(fl_display, parent, &attributes);
+  w = attributes.width;
+  h = attributes.height;
+}
+
+int fltk3::Window::decorated_h()
+{
+  int w, h;
+  decorated_win_size(this, w, h);
+  return h;
+}
+
+int fltk3::Window::decorated_w()
+{
+  int w, h;
+  decorated_win_size(this, w, h);
+  return w;
+}
+
+void fltk3::PagedDevice::print_window(fltk3::Window *win, int x_offset, int y_offset)
+{
+  if (!win->shown() || win->parent() || !win->border() || !win->visible()) {
+    this->print_widget(win, x_offset, y_offset);
+    return;
+  }
+  fltk3::DisplayDevice::display_device()->set_current();
+  win->show();
+  fltk3::check();
+  win->make_current();
+  ::Window root, parent, *children, child_win, from;
+  unsigned n = 0;
+  int bx, bt, do_it;
+  from = fl_window;
+  do_it = (XQueryTree(fl_display, fl_window, &root, &parent, &children, &n) != 0 && 
+           XTranslateCoordinates(fl_display, fl_window, parent, 0, 0, &bx, &bt, &child_win) == True);
+  if (n) XFree(children);
+  // hack to bypass STR #2648: when compiz is used, root and parent are the same window 
+  // and I don't know where to find the window decoration
+  if (do_it && root == parent) do_it = 0; 
+  if (!do_it) {
+    this->set_current();
+    this->print_widget(win, x_offset, y_offset);
+    return;
+  }
+  fl_window = parent;
+  uchar *top_image = 0, *left_image = 0, *right_image = 0, *bottom_image = 0;
+  top_image = fltk3::read_image(NULL, 0, 0, - (win->w() + 2 * bx), bt);
+  if (bx) {
+    left_image = fltk3::read_image(NULL, 0, bt, -bx, win->h() + bx);
+    right_image = fltk3::read_image(NULL, win->w() + bx, bt, -bx, win->h() + bx);
+    bottom_image = fltk3::read_image(NULL, 0, bt + win->h(), -(win->w() + 2*bx), bx);
+  }
+  fl_window = from;
+  this->set_current();
+  if (top_image) {
+    fltk3::draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
+    delete[] top_image;
+  }
+  if (bx) {
+    if (left_image) fltk3::draw_image(left_image, x_offset, y_offset + bt, bx, win->h() + bx, 3);
+    if (right_image) fltk3::draw_image(right_image, x_offset + win->w() + bx, y_offset + bt, bx, win->h() + bx, 3);
+    if (bottom_image) fltk3::draw_image(bottom_image, x_offset, y_offset + bt + win->h(), win->w() + 2*bx, bx, 3);
+    if (left_image) delete[] left_image;
+    if (right_image) delete[] right_image;
+    if (bottom_image) delete[] bottom_image;
+  }
+  this->print_widget( win, x_offset + bx, y_offset + bt );
+}
+
+
+#ifdef USE_PRINT_BUTTON
+// to test the fltk3::Printer class creating a "Print front window" button in a separate window
+// contains also preparePrintFront call above
+#include <fltk3/Printer.h>
+#include <fltk3/Button.h>
+void printFront(fltk3::Widget *o, void *data)
+{
+  fltk3::Printer printer;
+  o->window()->hide();
+  fltk3::Window *win = fltk3::first_window();
+  if(!win) return;
+  int w, h;
+  if( printer.start_job(1) ) { o->window()->show(); return; }
+  if( printer.start_page() ) { o->window()->show(); return; }
+  printer.printable_rect(&w,&h);
+  // scale the printer device so that the window fits on the page
+  float scale = 1;
+  int ww = win->decorated_w();
+  int wh = win->decorated_h();
+  if (ww > w || wh > h) {
+    scale = (float)w/ww;
+    if ((float)h/wh < scale) scale = (float)h/wh;
+    printer.scale(scale, scale);
+  }
+
+// #define ROTATE 20.0
+#ifdef ROTATE
+  printer.scale(scale * 0.8, scale * 0.8);
+  printer.printable_rect(&w, &h);
+  printer.origin(w/2, h/2 );
+  printer.rotate(ROTATE);
+  printer.print_widget( win, - win->w()/2, - win->h()/2 );
+  //printer.print_window_part( win, 0,0, win->w(), win->h(), - win->w()/2, - win->h()/2 );
+#else  
+  printer.print_window(win);
+#endif
+
+  printer.end_page();
+  printer.end_job();
+  o->window()->show();
+}
+
+void preparePrintFront(void)
+{
+  static int first=1;
+  if(!first) return;
+  first=0;
+  static fltk3::Window w(0,0,150,30);
+  static fltk3::Button b(0,0,w.w(),w.h(), "Print front window");
+  b.callback(printFront);
+  w.end();
+  w.show();
+}
+#endif // USE_PRINT_BUTTON
+
+#endif
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Native_File_Chooser_FLTK.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/x11NativeFileChooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,462 @@
+// "$Id$"
+//
+// FLTK native OS file chooser widget
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+// Copyright 2004 Greg Ercolano.
+// API changes + filter improvements by Nathan Vander Wilt 2005
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems to:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/NativeFileChooser.h>
+#include <fltk3/FileIcon.h>
+#define FLTK_CHOOSER_SINGLE    fltk3::FileChooser::SINGLE
+#define FLTK_CHOOSER_DIRECTORY fltk3::FileChooser::DIRECTORY
+#define FLTK_CHOOSER_MULTI     fltk3::FileChooser::MULTI
+#define FLTK_CHOOSER_CREATE    fltk3::FileChooser::CREATE
+
+#include "Fl_Native_File_Chooser_common.cxx"
+#include <sys/stat.h>
+#include <string.h>
+
+/**
+  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().
+*/
+fltk3::NativeFileChooser::NativeFileChooser(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
+  ////    fltk3::FileIcon::load_system_icons();
+  ////    init = 1;
+  ////  }
+  _btype       = val;
+  _options     = NO_OPTIONS;
+  _filter      = NULL;
+  _filtvalue   = 0;
+  _parsedfilt  = NULL;
+  _preset_file = NULL;
+  _prevvalue   = NULL;
+  _directory   = NULL;
+  _errmsg      = NULL;
+  _file_chooser = new fltk3::FileChooser(NULL, NULL, 0, NULL);
+  type(val);			// do this after _file_chooser created
+  _nfilters    = 0;
+} 
+
+/**
+  Destructor. 
+  Deallocates any resources allocated to this widget.
+*/
+fltk3::NativeFileChooser::~NativeFileChooser() {
+  delete _file_chooser;
+  _filter      = strfree(_filter);
+  _parsedfilt  = strfree(_parsedfilt);
+  _preset_file = strfree(_preset_file);
+  _prevvalue   = strfree(_prevvalue);
+  _directory   = strfree(_directory);
+  _errmsg      = strfree(_errmsg);
+}
+
+// PRIVATE: SET ERROR MESSAGE
+void fltk3::NativeFileChooser::errmsg(const char *msg) {
+  _errmsg = strfree(_errmsg);
+  _errmsg = strnew(msg);
+}
+
+// PRIVATE: translate Native types to fltk3::FileChooser types
+int fltk3::NativeFileChooser::type_fl_file(int 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);
+    default:
+      return(FLTK_CHOOSER_SINGLE);
+  }
+}
+
+/**
+  Sets the current fltk3::NativeFileChooser::Type of browser.
+ */
+void fltk3::NativeFileChooser::type(int val) {
+  _btype = val;
+  _file_chooser->type(type_fl_file(val));
+}
+
+/**
+  Gets the current fltk3::NativeFileChooser::Type of browser.
+ */
+int fltk3::NativeFileChooser::type() const {
+  return(_btype);
+}
+
+/**
+  Sets the platform specific chooser options to \p val.
+  \p val is expected to be one or more fltk3::NativeFileChooser::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.   Ignored   Used      Used
+  \endcode
+*/
+void fltk3::NativeFileChooser::options(int val) {
+  _options = val;
+}
+
+/**
+  Gets the platform specific fltk3::NativeFileChooser::Option flags.
+*/
+int fltk3::NativeFileChooser::options() const {
+  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 fltk3::NativeFileChooser::show() {
+  // 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() ) {
+    fltk3::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 ( fltk3::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);
+}
+
+/**
+  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 *fltk3::NativeFileChooser::errmsg() const {
+  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* fltk3::NativeFileChooser::filename() const {
+  if ( _file_chooser->count() > 0 ) return(_file_chooser->value());
+  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* fltk3::NativeFileChooser::filename(int i) const {
+  if ( i < _file_chooser->count() )
+    return(_file_chooser->value(i+1));	// convert fltk 1 based to our 0 based
+  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 fltk3::NativeFileChooser::title(const char *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 *fltk3::NativeFileChooser::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 fltk3::NativeFileChooser::filter(const char *val) {
+  _filter = strfree(_filter);
+  _filter = strnew(val);
+  parse_filter();
+}
+
+/**
+  Returns the filter string last set.
+  Can be NULL if no filter was set.
+ */
+const char *fltk3::NativeFileChooser::filter() const {
+  return(_filter);
+}
+
+/**
+Gets how many filters were available, not including "All Files" 
+*/
+int fltk3::NativeFileChooser::filters() const {
+  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 fltk3::NativeFileChooser::filter_value(int val) {
+  _filtvalue = val;
+}
+
+/**
+  Returns which filter value was last selected by the user.
+  This is only valid if the chooser returns success.
+ */
+int fltk3::NativeFileChooser::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 fltk3::NativeFileChooser::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 fltk3::NativeFileChooser::directory(const char *val) {
+  _directory = strfree(_directory);
+  _directory = strnew(val);
+}
+
+/**
+  Returns the current preset directory() value.
+*/
+const char *fltk3::NativeFileChooser::directory() const {
+  return(_directory);
+}
+
+// PRIVATE: Convert our filter format to fltk's chooser format
+//     FROM                                     TO (FLTK)
+//     -------------------------                --------------------------
+//     "*.cxx"                                  "*.cxx Files(*.cxx)"
+//     "C Files\t*.{cxx,h}"                     "C Files(*.{cxx,h})"
+//     "C Files\t*.{cxx,h}\nText Files\t*.txt"  "C Files(*.{cxx,h})\tText Files(*.txt)"
+//
+//     Returns a modified version of the filter that the caller is responsible
+//     for freeing with strfree().
+//
+void fltk3::NativeFileChooser::parse_filter() {
+  _parsedfilt = strfree(_parsedfilt);	// clear previous parsed filter (if any)
+  _nfilters = 0;
+  char *in = _filter;
+  if ( !in ) return;
+
+  int has_name = strchr(in, '\t') ? 1 : 0;
+
+  char mode = has_name ? 'n' : 'w';	// parse mode: n=title, w=wildcard
+  char wildcard[1024] = "";		// parsed wildcard
+  char name[1024] = "";
+
+  // Parse filter user specified
+  for ( ; 1; in++ ) {
+    /*** DEBUG
+    printf("WORKING ON '%c': mode=<%c> name=<%s> wildcard=<%s>\n",
+			*in, mode,     name,     wildcard);
+    ***/
+
+    switch (*in) {
+      // FINISHED PARSING NAME?
+      case '\t':
+        if ( mode != 'n' ) goto regchar;
+        mode = 'w';
+        break; 
+      // ESCAPE NEXT CHAR
+      case '\\':
+	++in;
+	goto regchar; 
+      // FINISHED PARSING ONE OF POSSIBLY SEVERAL FILTERS?
+      case '\r':
+      case '\n':
+      case '\0':
+	// APPEND NEW FILTER TO LIST
+	if ( wildcard[0] ) {
+	  // OUT: "name(wild)\tname(wild)"
+	  char comp[2048];
+	  sprintf(comp, "%s%.511s(%.511s)", ((_parsedfilt)?"\t":""),
+					    name, wildcard);
+	  _parsedfilt = strapp(_parsedfilt, comp);
+	  _nfilters++;
+	  //DEBUG printf("DEBUG: PARSED FILT NOW <%s>\n", _parsedfilt);
+	}
+	// RESET
+	wildcard[0] = name[0] = '\0';
+	mode = strchr(in, '\t') ? 'n' : 'w';
+	// DONE?
+	if ( *in == '\0' ) return;	// done
+	else continue;			// not done yet, more filters
+
+      // Parse all other chars
+      default:				// handle all non-special chars
+      regchar:				// handle regular char
+	switch ( mode ) {
+	  case 'n': chrcat(name, *in);     continue;
+	  case 'w': chrcat(wildcard, *in); continue;
+	}
+	break;
+    }
+  }
+  //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 fltk3::NativeFileChooser::preset_file(const char* val) {
+  _preset_file = strfree(_preset_file);
+  _preset_file = strnew(val);
+}
+
+/**
+  Get the preset filename.
+  */
+const char* fltk3::NativeFileChooser::preset_file() const {
+  return(_preset_file);
+}
+
+
+int fltk3::NativeFileChooser::exist_dialog() {
+  return(fltk3::choice("%s", fltk3::cancel, fltk3::ok, NULL, file_exists_message));
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/x11_dnd.cxx (from rev 9002, branches/branch-3.0/src/core/fl_dnd_x.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/x11_dnd.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/x11_dnd.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,202 @@
+//
+// "$Id$"
+//
+// Drag & Drop code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <fltk3/run.h>
+#include <fltk3/Window.h>
+#include <fltk3/x.h>
+#include "flstring.h"
+
+
+extern Atom fl_XdndAware;
+extern Atom fl_XdndSelection;
+extern Atom fl_XdndEnter;
+extern Atom fl_XdndTypeList;
+extern Atom fl_XdndPosition;
+extern Atom fl_XdndLeave;
+extern Atom fl_XdndDrop;
+extern Atom fl_XdndStatus;
+extern Atom fl_XdndActionCopy;
+extern Atom fl_XdndFinished;
+//extern Atom fl_XdndProxy;
+extern Atom fl_XdndURIList;
+extern Atom fl_XaUtf8String;
+
+extern char fl_i_own_selection[2];
+extern char *fl_selection_buffer[2];
+
+extern void fl_sendClientMessage(::Window window, Atom message,
+                                 unsigned long d0,
+                                 unsigned long d1=0,
+                                 unsigned long d2=0,
+                                 unsigned long d3=0,
+                                 unsigned long d4=0);
+
+// return version # of Xdnd this window supports.  Also change the
+// window to the proxy if it uses a proxy:
+static int dnd_aware(::Window& window) {
+  Atom actual; int format; unsigned long count, remaining;
+  unsigned char *data = 0;
+  XGetWindowProperty(fl_display, window, fl_XdndAware,
+		     0, 4, False, XA_ATOM,
+		     &actual, &format,
+		     &count, &remaining, &data);
+  if (actual == XA_ATOM && format==32 && count && data)
+    return int(*(Atom*)data);
+  return 0;
+}
+
+static int grabfunc(int event) {
+  if (event == fltk3::RELEASE) fltk3::pushed(0);
+  return 0;
+}
+
+extern int (*fl_local_grab)(int); // in Fl.cxx
+
+// send an event to an fltk window belonging to this program:
+static int local_handle(int event, fltk3::Window* window) {
+  fl_local_grab = 0;
+  fltk3::e_x = fltk3::e_x_root-window->x();
+  fltk3::e_y = fltk3::e_y_root-window->y();
+  int ret = fltk3::handle(event,window);
+  fl_local_grab = grabfunc;
+  return ret;
+}
+
+int fltk3::dnd() {
+  fltk3::Window *source_fl_win = fltk3::first_window();
+  fltk3::first_window()->cursor(fltk3::CURSOR_MOVE);
+  ::Window source_window = fl_xid(fltk3::first_window());
+  fl_local_grab = grabfunc;
+  ::Window target_window = 0;
+  fltk3::Window* local_window = 0;
+  int dndversion = 4; int dest_x, dest_y;
+  XSetSelectionOwner(fl_display, fl_XdndSelection, fltk3::message_window, fl_event_time);
+
+  while (fltk3::pushed()) {
+
+    // figure out what window we are pointing at:
+    ::Window new_window = 0; int new_version = 0;
+    fltk3::Window* new_local_window = 0;
+    for (::Window child = RootWindow(fl_display, fl_screen);;) {
+      ::Window root; unsigned int junk3;
+      XQueryPointer(fl_display, child, &root, &child,
+		    &e_x_root, &e_y_root, &dest_x, &dest_y, &junk3);
+      if (!child) {
+	if (!new_window && (new_version = dnd_aware(root))) new_window = root;
+	break;
+      }
+      new_window = child;
+      if ((new_local_window = fl_find(child))) break;
+      if ((new_version = dnd_aware(new_window))) break;
+    }
+
+    if (new_window != target_window) {
+      if (local_window) {
+	local_handle(fltk3::DND_LEAVE, local_window);
+      } else if (dndversion) {
+	fl_sendClientMessage(target_window, fl_XdndLeave, source_window);
+      }
+      dndversion = new_version;
+      target_window = new_window;
+      local_window = new_local_window;
+      if (local_window) {
+	local_handle(fltk3::DND_ENTER, local_window);
+      } else if (dndversion) {
+        // Send an X-DND message to the target window.  In order to
+	// support dragging of files/URLs as well as arbitrary text,
+	// we look at the selection buffer - if the buffer starts
+	// with a common URI scheme, does not contain spaces, and
+	// contains at least one CR LF, then we flag the data as
+	// both a URI list (MIME media type "text/uri-list") and
+	// plain text.  Otherwise, we just say it is plain text.
+        if ((!strncmp(fl_selection_buffer[0], "file:///", 8) ||
+	     !strncmp(fl_selection_buffer[0], "ftp://";, 6) ||
+	     !strncmp(fl_selection_buffer[0], "http://";, 7) ||
+	     !strncmp(fl_selection_buffer[0], "https://";, 8) ||
+	     !strncmp(fl_selection_buffer[0], "ipp://", 6) ||
+	     !strncmp(fl_selection_buffer[0], "ldap:", 5) ||
+	     !strncmp(fl_selection_buffer[0], "mailto:";, 7) ||
+	     !strncmp(fl_selection_buffer[0], "news:";, 5) ||
+	     !strncmp(fl_selection_buffer[0], "smb://", 6)) &&
+	    !strchr(fl_selection_buffer[0], ' ') &&
+	    strstr(fl_selection_buffer[0], "\r\n")) {
+	  // Send file/URI list...
+	  fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
+			       dndversion<<24, fl_XdndURIList, XA_STRING, 0);
+        } else {
+	  // Send plain text...
+	  fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
+			       dndversion<<24, fl_XaUtf8String, 0, 0);
+	}
+      }
+    }
+    if (local_window) {
+      local_handle(fltk3::DND_DRAG, local_window);
+    } else if (dndversion) {
+      fl_sendClientMessage(target_window, fl_XdndPosition, source_window,
+			   0, (e_x_root<<16)|e_y_root, fl_event_time,
+			   fl_XdndActionCopy);
+    }
+    fltk3::wait();
+  }
+
+  if (local_window) {
+    fl_i_own_selection[0] = 1;
+    if (local_handle(fltk3::DND_RELEASE, local_window)) paste(*belowmouse(), 0);
+  } else if (dndversion) {
+    fl_sendClientMessage(target_window, fl_XdndDrop, source_window,
+			 0, fl_event_time);
+  } else if (target_window) {
+    // fake a drop by clicking the middle mouse button:
+    XButtonEvent msg;
+    msg.type = ButtonPress;
+    msg.window = target_window;
+    msg.root = RootWindow(fl_display, fl_screen);
+    msg.subwindow = 0;
+    msg.time = fl_event_time+1;
+    msg.x = dest_x;
+    msg.y = dest_y;
+    msg.x_root = fltk3::e_x_root;
+    msg.y_root = fltk3::e_y_root;
+    msg.state = 0x0;
+    msg.button = Button2;
+    XSendEvent(fl_display, target_window, False, 0L, (XEvent*)&msg);
+    msg.time++;
+    msg.state = 0x200;
+    msg.type = ButtonRelease;
+    XSendEvent(fl_display, target_window, False, 0L, (XEvent*)&msg);
+  }
+
+  fl_local_grab = 0;
+  source_fl_win->cursor(fltk3::CURSOR_DEFAULT);
+  return 1;
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/x11_font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_font_x.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/x11_font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/x11_font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,344 @@
+//
+// "$Id$"
+//
+// Standard X11 font selection code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+#ifndef FLTK3_DOXYGEN
+
+Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name) {
+  font = XCreateUtf8FontStruct(fl_display, name);
+  if (!font) {
+    fltk3::warning("bad font: %s", name);
+    font = XCreateUtf8FontStruct(fl_display, "fixed");
+  }
+#  if HAVE_GL
+  listbase = 0;
+  for (int u = 0; u < 64; u++) glok[u] = 0;
+#  endif
+}
+
+Fl_XFont_On_Demand fl_xfont;
+
+Fl_Font_Descriptor::~Fl_Font_Descriptor() {
+#  if HAVE_GL
+// Delete list created by gl_draw().  This is not done by this code
+// as it will link in GL unnecessarily.  There should be some kind
+// of "free" routine pointer, or a subclass?
+// if (listbase) {
+//  int base = font->min_char_or_byte2;
+//  int size = font->max_char_or_byte2-base+1;
+//  int base = 0; int size = 256;
+//  glDeleteLists(listbase+base,size);
+// }
+#  endif
+  if (this == fltk3::graphics_driver->font_descriptor()) {
+    fltk3::graphics_driver->font_descriptor(NULL);
+    fl_xfont = 0;
+  }
+  XFreeUtf8FontStruct(fl_display, font);
+}
+
+////////////////////////////////////////////////////////////////
+
+// WARNING: if you add to this table, you must redefine fltk3::FREE_FONT
+// in enumerations.h & recompile!!
+static Fl_Fontdesc built_in_table[] = {
+{"-*-helvetica-medium-r-normal--*"},
+{"-*-helvetica-bold-r-normal--*"},
+{"-*-helvetica-medium-o-normal--*"},
+{"-*-helvetica-bold-o-normal--*"},
+{"-*-courier-medium-r-normal--*"},
+{"-*-courier-bold-r-normal--*"},
+{"-*-courier-medium-o-normal--*"},
+{"-*-courier-bold-o-normal--*"},
+{"-*-times-medium-r-normal--*"},
+{"-*-times-bold-r-normal--*"},
+{"-*-times-medium-i-normal--*"},
+{"-*-times-bold-i-normal--*"},
+{"-*-symbol-*"},
+{"-*-lucidatypewriter-medium-r-normal-sans-*"},
+{"-*-lucidatypewriter-bold-r-normal-sans-*"},
+{"-*-*zapf dingbats-*"}
+};
+
+Fl_Fontdesc* fltk3::fonts = built_in_table;
+
+#define MAXSIZE 32767
+
+// return dash number N, or pointer to ending null if none:
+const char* fltk3::font_word(const char* p, int n) {
+  while (*p) {if (*p=='-') {if (!--n) break;} p++;}
+  return p;
+}
+
+// return a pointer to a number we think is "point size":
+char* fl_find_fontsize(char* name) {
+  char* c = name;
+  // for standard x font names, try after 7th dash:
+  if (*c == '-') {
+    c = (char*)fltk3::font_word(c,7);
+    if (*c++ && isdigit(*c)) return c;
+    return 0; // malformed x font name?
+  }
+  char* r = 0;
+  // find last set of digits:
+  for (c++;* c; c++)
+    if (isdigit(*c) && !isdigit(*(c-1))) r = c;
+  return r;
+}
+
+//const char* fl_encoding = "iso8859-1";
+const char* fl_encoding = "iso10646-1";
+
+// return true if this matches fl_encoding:
+int fl_correct_encoding(const char* name) {
+  if (*name != '-') return 0;
+  const char* c = fltk3::font_word(name,13);
+  return (*c++ && !strcmp(c,fl_encoding));
+}
+
+static const char *find_best_font(const char *fname, int size) {
+  int cnt;
+  static char **list = NULL;
+// locate or create an Fl_Font_Descriptor for a given Fl_Fontdesc and size:
+  if (list) XFreeFontNames(list);
+  list = XListFonts(fl_display, fname, 100, &cnt);
+  if (!list) return "fixed";
+
+  // search for largest <= font size:
+  char* name = list[0]; int ptsize = 0;     // best one found so far
+  int matchedlength = 32767;
+  char namebuffer[1024];        // holds scalable font name
+  int found_encoding = 0;
+  int m = cnt; if (m<0) m = -m;
+  for (int n=0; n < m; n++) {
+    char* thisname = list[n];
+    if (fl_correct_encoding(thisname)) {
+      if (!found_encoding) ptsize = 0; // force it to choose this
+      found_encoding = 1;
+    } else {
+      if (found_encoding) continue;
+    }
+    char* c = (char*)fl_find_fontsize(thisname);
+    int thissize = c ? atoi(c) : MAXSIZE;
+    int thislength = strlen(thisname);
+    if (thissize == size && thislength < matchedlength) {
+      // exact match, use it:
+      name = thisname;
+      ptsize = size;
+      matchedlength = thislength;
+    } else if (!thissize && ptsize!=size) {
+      // whoa!  A scalable font!  Use unless exact match found:
+      int l = c-thisname;
+      memcpy(namebuffer,thisname,l);
+      l += sprintf(namebuffer+l,"%d",size);
+      while (*c == '0') c++;
+      strcpy(namebuffer+l,c);
+      name = namebuffer;
+      ptsize = size;
+    } else if (!ptsize ||	// no fonts yet
+	       (thissize < ptsize && ptsize > size) || // current font too big
+	       (thissize > ptsize && thissize <= size) // current too small
+      ) {
+      name = thisname;
+      ptsize = thissize;
+      matchedlength = thislength;
+    }
+  }
+
+//  if (ptsize != size) { // see if we already found this unscalable font:
+//    for (f = s->first; f; f = f->next) {
+//      if (f->minsize <= ptsize && f->maxsize >= ptsize) {
+//	if (f->minsize > size) f->minsize = size;
+//	if (f->maxsize < size) f->maxsize = size;
+//	return f;
+//      }
+//    }
+//  }
+//
+//  // okay, we definately have some name, make the font:
+//  f = new Fl_Font_Descriptor(name);
+//  if (ptsize < size) {f->minsize = ptsize; f->maxsize = size;}
+//  else {f->minsize = size; f->maxsize = ptsize;}
+//  f->next = s->first;
+//  s->first = f;
+//  return f;
+
+  return name;
+}
+
+static char *put_font_size(const char *n, int size)
+{
+        int i = 0;
+        char *buf;
+        const char *ptr;
+        const char *f;
+        char *name;
+        int nbf = 1;
+        name = strdup(n);
+        while (name[i]) {
+                if (name[i] == ',') {nbf++; name[i] = '\0';}
+                i++;
+        }
+
+        buf = (char*) malloc(nbf * 256);
+        buf[0] = '\0';
+        ptr = name;
+        i = 0;
+        while (ptr && nbf > 0) {
+                f = find_best_font(ptr, size);
+                while (*f) {
+                        buf[i] = *f;
+                        f++; i++;
+                }
+                nbf--;
+                while (*ptr) ptr++;
+                if (nbf) {
+                        ptr++;
+                        buf[i] = ',';
+                        i++;
+                }
+                while(isspace(*ptr)) ptr++;
+        }
+        buf[i] = '\0';
+        free(name);
+        return buf;
+}
+
+
+char *fl_get_font_xfld(int fnum, int size) {
+  Fl_Fontdesc* s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // use font 0 if still undefined
+  fl_open_display();
+  return put_font_size(s->name, size);
+}
+
+// locate or create an Fl_Font_Descriptor for a given Fl_Fontdesc and size:
+static Fl_Font_Descriptor* find(int fnum, int size) {
+  char *name;
+  Fl_Fontdesc* s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // use font 0 if still undefined
+  Fl_Font_Descriptor* f;
+  for (f = s->first; f; f = f->next)
+    if (f->size == size) return f;
+  fl_open_display();
+
+  name = put_font_size(s->name, size);
+  f = new Fl_Font_Descriptor(name);
+  f->size = size;
+  f->next = s->first;
+  s->first = f;
+  free(name);
+  return f;
+}
+
+
+////////////////////////////////////////////////////////////////
+// Public interface:
+
+void *fl_xftfont = 0;
+static GC font_gc;
+
+XFontStruct* Fl_XFont_On_Demand::value() {
+  return ptr;
+}
+
+void Fl_Xlib_Graphics_Driver::font(fltk3::Font fnum, fltk3::Fontsize size) {
+  if (fnum==-1) {
+    fltk3::GraphicsDriver::font(0, 0);
+    return;
+  }
+  if (fnum == fltk3::GraphicsDriver::font() && size == fltk3::GraphicsDriver::size()) return;
+  fltk3::GraphicsDriver::font(fnum, size);
+  Fl_Font_Descriptor* f = find(fnum, size);
+  if (f != this->font_descriptor()) {
+    this->font_descriptor(f);
+    fl_xfont = f->font->fonts[0];
+    font_gc = 0;
+  }
+}
+
+int Fl_Xlib_Graphics_Driver::height() {
+  if (font_descriptor()) return font_descriptor()->font->ascent + font_descriptor()->font->descent;
+  else return -1;
+}
+
+int Fl_Xlib_Graphics_Driver::descent() {
+  if (font_descriptor()) return font_descriptor()->font->descent;
+  else return -1;
+}
+
+double Fl_Xlib_Graphics_Driver::width(const char* c, int n) {
+  if (font_descriptor()) return (double) XUtf8TextWidth(font_descriptor()->font, c, n);
+  else return -1;
+}
+
+double Fl_Xlib_Graphics_Driver::width(unsigned int c) {
+  if (font_descriptor()) return (double) XUtf8UcsWidth(font_descriptor()->font, c);
+  else return -1;
+}
+
+void Fl_Xlib_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy, int &W, int &H) {
+  if (font_gc != fl_gc) {
+    if (!font_descriptor()) font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+    font_gc = fl_gc;
+    XSetFont(fl_display, fl_gc, font_descriptor()->font->fid);
+  }
+  int xx, yy, ww, hh;
+  xx = yy = ww = hh = 0;
+  if (fl_gc) XUtf8_measure_extents(fl_display, fl_window, font_descriptor()->font, fl_gc, &xx, &yy, &ww, &hh, c, n);
+
+  W = ww; H = hh; dx = xx; dy = yy;
+// This is the safe but mostly wrong thing we used to do...
+//  W = 0; H = 0;
+//  fltk3::measure(c, W, H, 0);
+//  dx = 0;
+//  dy = fltk3::descent() - H;
+}
+
+void Fl_Xlib_Graphics_Driver::draw(const char* c, int n, int x, int y) {
+  if (font_gc != fl_gc) {
+    if (!font_descriptor()) this->font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+    font_gc = fl_gc;
+    XSetFont(fl_display, fl_gc, font_descriptor()->font->fid);
+  }
+  if (fl_gc) XUtf8DrawString(fl_display, fl_window, font_descriptor()->font, fl_gc, x, y, c, n);
+}
+
+void Fl_Xlib_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) {
+  fprintf(stderr,"ROTATING TEXT NOT IMPLEMENTED\n");
+  this->draw(str, n, (int)x, (int)y);
+}
+
+void Fl_Xlib_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
+  if (font_gc != fl_gc) {
+    if (!font_descriptor()) this->font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+    font_gc = fl_gc;
+  }
+  if (fl_gc) XUtf8DrawRtlString(fl_display, fl_window, font_descriptor()->font, fl_gc, x, y, c, n);
+}
+#endif // FLTK3_DOXYGEN
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/x11_set_fonts.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_fonts_x.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/x11_set_fonts.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/x11_set_fonts.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,350 @@
+//
+// "$Id$"
+//
+// X11 font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// This function fills in the fltk font table with all the fonts that
+// are found on the X server.  It tries to place the fonts into families
+// and to sort them so the first 4 in a family are normal, bold, italic,
+// and bold italic.
+
+// Standard X fonts are matched by a pattern that is always of
+// this form, and this pattern is put in the table:
+// "-*-family-weight-slant-width1-style-*-registry-encoding"
+
+// Non-standard font names (those not starting with '-') are matched
+// by a pattern of the form "prefix*suffix", where the '*' is where
+// fltk thinks the point size is, or by the actual font name if no
+// point size is found.
+
+// Fltk knows how to pull an "attribute" out of a font name, such as
+// bold or italic, by matching known x font field values.  All words
+// that don't match a known attribute are combined into the "name"
+// of the font.  Names are compared before attributes for sorting, this
+// makes the bold and plain version of a font come out next to each
+// other despite the poor X font naming scheme.
+
+// By default fl_set_fonts() only does iso8859-1 encoded fonts.  You can
+// do all normal X fonts by passing "-*" or every possible font with "*".
+
+// fltk3::set_font will take strings other than the ones this stores
+// and can identify any font on X that way.  You may want to write your
+// own system of font management and not use this code.
+
+// turn word N of a X font name into either some attribute bits
+// (right now 0, fltk3::BOLD, or fltk3::ITALIC), or into -1 indicating that
+// the word should be put into the name:
+
+static int attribute(int n, const char *p) {
+  // don't put blank things into name:
+  if (!*p || *p=='-' || *p=='*') return 0;
+  if (n == 3) { // weight
+    if (!strncmp(p,"normal",6) ||
+	!strncmp(p,"light",5) ||
+	!strncmp(p,"medium",6) ||
+	!strncmp(p,"book",4)) return 0;
+    if (!strncmp(p,"bold",4) || !strncmp(p,"demi",4)) return fltk3::BOLD;
+  } else if (n == 4) { // slant
+    if (*p == 'r') return 0;
+    if (*p == 'i' || *p == 'o') return fltk3::ITALIC;
+  } else if (n == 5) { // sWidth
+    if (!strncmp(p,"normal",6)) return 0;
+  }
+  return -1;
+}
+
+// return non-zero if the registry-encoding should be used:
+extern const char* fl_encoding;
+static int use_registry(const char *p) {
+  return *p && *p!='*' && strcmp(p,fl_encoding);
+}
+
+// Bug: older versions calculated the value for *ap as a side effect of
+// making the name, and then forgot about it. To avoid having to change
+// the header files I decided to store this value in the last character
+// of the font name array.
+#define ENDOFBUFFER 127 // sizeof(fltk3::Font.fontname)-1
+
+// turn a stored (with *'s) X font name into a pretty name:
+const char* fltk3::get_font_name(fltk3::Font fnum, int* ap) {
+  Fl_Fontdesc *f = fltk3::fonts + fnum;
+  if (!f->fontname[0]) {
+    int type = 0;
+    const char* p = f->name;
+    if (!p) {
+      if (ap) *ap = 0;
+      return "";
+    }
+    char *o = f->fontname;
+
+    if (*p != '-') { // non-standard font, just replace * with spaces:
+      if (strstr(p,"bold")) type = fltk3::BOLD;
+      if (strstr(p,"ital")) type |= fltk3::ITALIC;
+      for (;*p; p++) {
+	if (*p == '*' || *p == ' ' || *p == '-') {
+	  do p++; while (*p == '*' || *p == ' ' || *p == '-');
+	  if (!*p) break;
+	  if (o < (f->fontname + ENDOFBUFFER - 1)) *o++ = ' ';
+	}
+	if (o < (f->fontname + ENDOFBUFFER - 1)) *o++ = *p;
+      }
+      *o = 0;
+
+    } else { // standard dash-separated font:
+
+      // get the family:
+      const char *x = fltk3::font_word(p,2); if (*x) x++; if (*x=='*') x++;
+      if (!*x) {
+	if (ap) *ap = 0;
+	return p;
+      }
+      const char *e = fltk3::font_word(x,1);
+      if ((e - x) < (int)(ENDOFBUFFER - 1)) {
+	// MRS: we want strncpy here, not strlcpy...
+	strncpy(o,x,e-x);
+	o += e-x;
+      } else {
+	strlcpy(f->fontname, x, ENDOFBUFFER);
+	o = f->fontname+ENDOFBUFFER-1;
+      }
+
+      // collect all the attribute words:
+      for (int n = 3; n <= 6; n++) {
+	// get the next word:
+	if (*e) e++; x = e; e = fltk3::font_word(x,1);
+	int t = attribute(n,x);
+	if (t < 0) {
+	  if (o < (f->fontname + ENDOFBUFFER - 1)) *o++ = ' ';
+	  if ((e - x) < (int)(ENDOFBUFFER - (o - f->fontname) - 1)) {
+	    // MRS: we want strncpy here, not strlcpy...
+	    strncpy(o,x,e-x);
+	    o += e-x;
+	  } else {
+	    strlcpy(o,x, ENDOFBUFFER - (o - f->fontname) - 1);
+	    o = f->fontname+ENDOFBUFFER-1;
+	  }
+	} else type |= t;
+      }
+
+      // skip over the '*' for the size and get the registry-encoding:
+      x = fltk3::font_word(e,2);
+      if (*x) {x++; *o++ = '('; while (*x) *o++ = *x++; *o++ = ')';}
+
+      *o = 0;
+      if (type & fltk3::BOLD) strlcat(f->fontname, " bold", ENDOFBUFFER);
+      if (type & fltk3::ITALIC) strlcat(f->fontname, " italic", ENDOFBUFFER);
+    }
+    f->fontname[ENDOFBUFFER] = (char)type;
+  }
+  if (ap) *ap = f->fontname[ENDOFBUFFER];
+  return f->fontname;
+}
+
+extern "C" {
+// sort raw (non-'*') X font names into perfect order:
+
+static int ultrasort(const void *aa, const void *bb) {
+  const char *a = *(char **)aa;
+  const char *b = *(char **)bb;
+
+  // sort all non x-fonts at the end:
+  if (*a != '-') {
+    if (*b == '-') return 1;
+    // 2 non-x fonts are matched by "numeric sort"
+    int ret = 0;
+    for (;;) {
+      if (isdigit(*a) && isdigit(*b)) {
+	int na = strtol(a, (char **)&a, 10);
+	int nb = strtol(b, (char **)&b, 10);
+	if (!ret) ret = na-nb;
+      } else if (*a != *b) {
+	return (*a-*b);
+      } else if (!*a) {
+	return ret;
+      } else {
+	a++; b++;
+      }
+    }
+  } else {
+    if (*b != '-') return -1;
+  }
+
+  // skip the foundry (assume equal):
+  for (a++; *a && *a++!='-';);
+  for (b++; *b && *b++!='-';);
+
+  // compare the family and all the attribute words:
+  int atype = 0;
+  int btype = 0;
+  for (int n = 2; n <= 6; n++) {
+    int at = attribute(n,a);
+    int bt = attribute(n,b);
+    if (at < 0) {
+      if (bt >= 0) return 1;
+      for (;;) {if (*a!=*b) return *a-*b; b++; if (!*a || *a++=='-') break;}
+    } else {
+      if (bt < 0) return -1;
+      a = fltk3::font_word(a,1); if (*a) a++;
+      b = fltk3::font_word(b,1); if (*b) b++;
+      atype |= at; btype |= bt;
+    }
+  }
+
+  // remember the pixel size:
+  int asize = atoi(a);
+  int bsize = atoi(b);
+
+  // compare the registry/encoding:
+  a = fltk3::font_word(a,6); if (*a) a++;
+  b = fltk3::font_word(b,6); if (*b) b++;
+  if (use_registry(a)) {
+    if (!use_registry(b)) return 1;
+    int r = strcmp(a,b); if (r) return r;
+  } else {
+    if (use_registry(b)) return -1;
+  }
+
+  if (atype != btype) return atype-btype;
+  if (asize != bsize) return asize-bsize;
+
+  // something wrong, just do a string compare...
+  return strcmp(*(char**)aa, *(char**)bb);
+}
+}
+
+// converts a X font name to a standard starname, returns point size:
+static int to_canonical(char *to, const char *from, size_t tolen) {
+  char* c = fl_find_fontsize((char*)from);
+  if (!c) return -1; // no point size found...
+  const char* endptr;
+  int size = strtol(c,(char**)&endptr,10);
+  if (from[0] == '-') {
+    // replace the "foundry" with -*-:
+    *to++ = '-'; *to++ = '*';
+    for (from++; *from && *from != '-'; from++);
+    // skip to the registry-encoding:
+    endptr = (char*)fltk3::font_word(endptr,6);
+    if (*endptr && !use_registry(endptr+1)) endptr = "";
+  }
+  int n = c-from;
+  // MRS: we want strncpy here, not strlcpy...
+  if (n > (int)(tolen - 1)) return -1;
+  strncpy(to,from,n);
+  to[n++] = '*';
+  strlcpy(to+n,endptr, tolen - n);
+  return size;
+}
+
+static unsigned int fl_free_font = fltk3::FREE_FONT;
+
+fltk3::Font fltk3::set_fonts(const char* xstarname) {
+  if (fl_free_font > (unsigned)fltk3::FREE_FONT) // already been here
+    return (fltk3::Font)fl_free_font;
+  fl_open_display();
+  int xlistsize;
+  char buf[20];
+  if (!xstarname) {
+    strcpy(buf,"-*-"); strcpy(buf+3,fl_encoding);
+    xstarname = buf;
+  }
+  char **xlist = XListFonts(fl_display, xstarname, 10000, &xlistsize);
+  if (!xlist) return (fltk3::Font)fl_free_font;
+  qsort(xlist, xlistsize, sizeof(*xlist), ultrasort);
+  int used_xlist = 0;
+  for (int i=0; i<xlistsize;) {
+    int first_xlist = i;
+    const char *p = xlist[i++];
+    char canon[1024];
+    int size = to_canonical(canon, p, sizeof(canon));
+    if (size >= 0) {
+      for (;;) { // find all matching fonts:
+	if (i >= xlistsize) break;
+	const char *q = xlist[i];
+	char this_canon[1024];
+	if (to_canonical(this_canon, q, sizeof(this_canon)) < 0) break;
+	if (strcmp(canon, this_canon)) break;
+	i++;
+      }
+      /*if (*p=='-' || i > first_xlist+1)*/ p = canon;
+    }
+    unsigned int j;
+    for (j = 0;; j++) {
+      /*if (j < fltk3::FREE_FONT) {
+	// see if it is one of our built-in fonts:
+	// if so, set the list of x fonts, since we have it anyway
+	if (fltk3::fonts[j].name && !strcmp(fltk3::fonts[j].name, p)) break;
+      } else */{
+	j = fl_free_font++;
+	if (p == canon) p = strdup(p); else used_xlist = 1;
+	fltk3::set_font((fltk3::Font)j, p);
+	break;
+      }
+    }
+    if (!fltk3::fonts[j].xlist) {
+      fltk3::fonts[j].xlist = xlist+first_xlist;
+      fltk3::fonts[j].n = -(i-first_xlist);
+      used_xlist = 1;
+    }
+  }
+  if (!used_xlist) XFreeFontNames(xlist);
+  return (fltk3::Font)fl_free_font;
+}
+
+int fltk3::get_font_sizes(fltk3::Font fnum, int*& sizep) {
+  Fl_Fontdesc *s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // empty slot in table, use entry 0
+  if (!s->xlist) {
+    fl_open_display();
+    s->xlist = XListFonts(fl_display, s->name, 100, &(s->n));
+    if (!s->xlist) return 0;
+  }
+  int listsize = s->n; if (listsize<0) listsize = -listsize;
+  static int sizes[128];
+  int numsizes = 0;
+  for (int i = 0; i < listsize; i++) {
+    char *q = s->xlist[i];
+    char *d = fl_find_fontsize(q);
+    if (!d) continue;
+    int s = strtol(d,0,10);
+    if (!numsizes || sizes[numsizes-1] < s) {
+      sizes[numsizes++] = s;
+    } else {
+      // insert-sort the new size into list:
+      int n;
+      for (n = numsizes-1; n > 0; n--) if (sizes[n-1] < s) break;
+      if (sizes[n] != s) {
+	for (int m = numsizes; m > n; m--) sizes[m] = sizes[m-1];
+	sizes[n] = s;
+	numsizes++;
+      }
+    }
+  }
+  sizep = sizes;
+  return numsizes;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/xcolor.h (from rev 9002, branches/branch-3.0/src/core/Fl_XColor.H)
===================================================================
--- branches/branch-3.0/src/fltk3/xcolor.h	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/xcolor.h	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,46 @@
+//
+// "$Id$"
+//
+// X-specific color definitions for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <config.h>
+#include <fltk3/enumerations.h>
+
+// one of these for each color in fltk's "colormap":
+// if overlays are enabled, another one for the overlay
+struct Fl_XColor {
+  unsigned char r,g,b;	// actual color used by X
+  unsigned char mapped;	// true when XAllocColor done
+  unsigned long pixel;	// the X pixel to use
+};
+extern Fl_XColor fl_xmap[/*overlay*/][256];
+
+// mask & shifts to produce xcolor for truecolor visuals:
+extern unsigned char fl_redmask, fl_greenmask, fl_bluemask;
+extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/xft_font.cxx (from rev 9002, branches/branch-3.0/src/core/fl_font_xft.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/xft_font.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/xft_font.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,706 @@
+//
+// "$Id$"
+//
+// Xft font code for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 2001-2011 Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+//
+// Draw fonts using Keith Packard's Xft library to provide anti-
+// aliased text. Yow!
+//
+// Many thanks to Carl for making the original version of this.
+//
+// This font code only requires libXft to work.  Contrary to popular
+// belief there is no need to have FreeType, or the Xrender extension
+// available to use this code.  You will just get normal Xlib fonts
+// (Xft calls them "core" fonts) The Xft algorithms for choosing
+// these is about as good as the FLTK ones (I hope to fix it so it is
+// exactly as good...), plus it can cache its results and share them
+// between programs, so using this should be a win in all cases. Also
+// it should be obvious by comparing this file and fltk3::font_x.cxx that
+// it is a lot easier to program with Xft than with Xlib.
+//
+// Also, Xft supports UTF-8 text rendering directly, which will allow
+// us to support UTF-8 on all platforms more easily.
+//
+// To actually get antialiasing you need the following:
+//
+//     1. You have XFree86 4
+//     2. You have the XRender extension
+//     3. Your X device driver supports the render extension
+//     4. You have libXft
+//     5. Your libXft has FreeType2 support compiled in
+//     6. You have the FreeType2 library
+//
+// Distributions that have XFree86 4.0.3 or later should have all of this...
+//
+// Unlike some other Xft packages, I tried to keep this simple and not
+// to work around the current problems in Xft by making the "patterns"
+// complicated. I believe doing this defeats our ability to improve Xft
+// itself. You should edit the ~/.xftconfig file to "fix" things, there
+// are several web pages of information on how to do this.
+//
+#ifndef FLTK3_DOXYGEN
+
+#include <X11/Xft/Xft.h>
+
+#include <math.h>
+
+// The predefined fonts that FLTK has:
+static Fl_Fontdesc built_in_table[] = {
+#if 1
+{" sans"},
+{"Bsans"},
+{"Isans"},
+{"Psans"},
+{" mono"},
+{"Bmono"},
+{"Imono"},
+{"Pmono"},
+{" serif"},
+{"Bserif"},
+{"Iserif"},
+{"Pserif"},
+{" symbol"},
+{" screen"},
+{"Bscreen"},
+{" zapf dingbats"},
+#else
+{" helvetica"},
+{"Bhelvetica"},
+{"Ihelvetica"},
+{"Phelvetica"},
+{" courier"},
+{"Bcourier"},
+{"Icourier"},
+{"Pcourier"},
+{" times"},
+{"Btimes"},
+{"Itimes"},
+{"Ptimes"},
+{" symbol"},
+{" lucidatypewriter"},
+{"Blucidatypewriter"},
+{" zapf dingbats"},
+#endif
+};
+
+Fl_Fontdesc* fltk3::fonts = built_in_table;
+
+Fl_XFont_On_Demand fl_xfont;
+void *fl_xftfont = 0;
+//const char* fl_encoding_ = "iso8859-1";
+const char* fl_encoding_ = "iso10646-1";
+
+static void fl_xft_font(fltk3::XlibGraphicsDriver *driver, fltk3::Font fnum, fltk3::Fontsize size, int angle) {
+  if (fnum==-1) { // special case to stop font caching
+    driver->fltk3::GraphicsDriver::font(0, 0);
+    return;
+  }
+  Fl_Font_Descriptor* f = driver->font_descriptor();
+  if (fnum == driver->fltk3::GraphicsDriver::font() && size == driver->size() && f && f->angle == angle)
+    return;
+  driver->fltk3::GraphicsDriver::font(fnum, size);
+  Fl_Fontdesc *font = fltk3::fonts + fnum;
+  // search the fontsizes we have generated already
+  for (f = font->first; f; f = f->next) {
+    if (f->size == size && f->angle == angle)// && !strcasecmp(f->encoding, fl_encoding_))
+      break;
+  }
+  if (!f) {
+    f = new Fl_Font_Descriptor(font->name, size, angle);
+    f->next = font->first;
+    font->first = f;
+  }
+  driver->font_descriptor(f);
+#if XFT_MAJOR < 2
+  fl_xfont    = f->font->u.core.font;
+#else
+  fl_xfont    = NULL; // invalidate
+#endif // XFT_MAJOR < 2
+  fl_xftfont = (void*)f->font;
+}
+
+void fltk3::XlibGraphicsDriver::font(fltk3::Font fnum, fltk3::Fontsize size) {
+  fl_xft_font(this,fnum,size,0);
+}
+
+static XftFont* fontopen(const char* name, fltk3::Fontsize size, bool core, int angle) {
+  // Check: does it look like we have been passed an old-school XLFD fontname?
+  bool is_xlfd = false;
+  int hyphen_count = 0;
+  int comma_count = 0;
+  unsigned len = strlen(name);
+  if (len > 512) len = 512; // ensure we are not passed an unbounded font name
+  for(unsigned idx = 0; idx < len; idx++) {
+    if(name[idx] == '-') hyphen_count++; // check for XLFD hyphens
+    if(name[idx] == ',') comma_count++;  // are there multiple names?
+  }
+  if(hyphen_count >= 14) is_xlfd = true; // Not a robust check, but good enough?
+
+  fl_open_display();
+
+  if(!is_xlfd) { // Not an XLFD - open as a XFT style name
+    XftFont *the_font; // the font we will return;
+    XftPattern *fnt_pat = XftPatternCreate(); // the pattern we will use for matching
+    int slant = XFT_SLANT_ROMAN;
+    int weight = XFT_WEIGHT_MEDIUM;
+
+    /* This "converts" FLTK-style font names back into "regular" names, extracting
+     * the BOLD and ITALIC codes as it does so - all FLTK font names are prefixed
+     * by 'I' (italic) 'B' (bold) 'P' (bold italic) or ' ' (regular) modifiers.
+     * This gives a fairly limited font selection ability, but is retained for
+     * compatibility reasons. If you really need a more complex choice, you are best
+     * calling fltk3::set_fonts(*) then selecting the font by font-index rather than by
+     * name anyway. Probably.
+     * If you want to load a font who's name does actually begin with I, B or P, you
+     * MUST use a leading space OR simply use lowercase for the name...
+     */
+    /* This may be efficient, but it is non-obvious. */
+    switch (*name++) {
+    case 'I': slant = XFT_SLANT_ITALIC; break; // italic
+    case 'P': slant = XFT_SLANT_ITALIC;        // bold-italic (falls-through)
+    case 'B': weight = XFT_WEIGHT_BOLD; break; // bold
+    case ' ': break;                           // regular
+    default: name--;                           // no prefix, restore name
+    }
+
+    if(comma_count) { // multiple comma-separated names were passed
+      char *local_name = strdup(name); // duplicate the full name so we can edit the copy
+      char *curr = local_name; // points to first name in string
+      char *nxt; // next name in string
+      do {
+        nxt = strchr(curr, ','); // find comma separator
+        if (nxt) {
+          *nxt = 0; // terminate first name
+          nxt++; // first char of next name
+        }
+
+	// Add the current name to the match pattern
+	XftPatternAddString(fnt_pat, XFT_FAMILY, curr);
+
+        if(nxt) curr = nxt; // move onto next name (if it exists)
+	// Now do a cut-down version of the FLTK name conversion.
+	// NOTE: we only use the slant and weight of the first name,
+	// subsequent names we ignore this for... But we still need to do the check.
+        switch (*curr++) {
+        case 'I': break; // italic
+        case 'P':        // bold-italic (falls-through)
+        case 'B': break; // bold
+        case ' ': break; // regular
+        default: curr--; // no prefix, restore name
+        }
+
+        comma_count--; // decrement name sections count
+      } while (comma_count >= 0);
+      free(local_name); // release our local copy of font names
+    }
+    else { // single name was passed - add it directly
+      XftPatternAddString(fnt_pat, XFT_FAMILY, name);
+    }
+
+    // Construct a match pattern for the font we want...
+    XftPatternAddInteger(fnt_pat, XFT_WEIGHT, weight);
+    XftPatternAddInteger(fnt_pat, XFT_SLANT, slant);
+    XftPatternAddDouble (fnt_pat, XFT_PIXEL_SIZE, (double)size);
+    XftPatternAddString (fnt_pat, XFT_ENCODING, fl_encoding_);
+
+    // rotate font if angle!=0
+    if (angle !=0) {
+      XftMatrix m;
+      XftMatrixInit(&m);
+      XftMatrixRotate(&m,cos(M_PI*angle/180.),sin(M_PI*angle/180.));
+      XftPatternAddMatrix (fnt_pat, XFT_MATRIX,&m);
+    }
+
+    if (core) {
+      XftPatternAddBool(fnt_pat, XFT_CORE, FcTrue);
+      XftPatternAddBool(fnt_pat, XFT_RENDER, FcFalse);
+    }
+
+    XftPattern *match_pat;  // the best available match on the system
+    XftResult match_result; // the result of our matching attempt
+
+    // query the system to find a match for this font
+    match_pat = XftFontMatch(fl_display, fl_screen, fnt_pat, &match_result);
+
+#if 0 // the XftResult never seems to get set to anything... abandon this code?
+    switch(match_result) { // how good a match is this font for our request?
+      case XftResultMatch:
+	puts("Object exists with the specified ID");
+	break;
+
+      case XftResultTypeMismatch:
+	puts("Object exists, but the type does not match");
+	break;
+
+      case XftResultNoId:
+	puts("Object exists, but has fewer values than specified");
+	break;
+
+      case FcResultOutOfMemory:
+	puts("FcResult: Malloc failed");
+	break;
+
+      case XftResultNoMatch:
+	puts("Object does not exist at all");
+	break;
+
+      default:
+	printf("Invalid XftResult status %d \n", match_result);
+	break;
+    }
+#endif
+
+#if 0 // diagnostic to print the "full name" of the font we matched. This works.
+    FcChar8 *picked_name =  FcNameUnparse(match_pat);
+    printf("Match: %s\n", picked_name);
+    free(picked_name);
+#endif
+
+    if (!match_pat) {
+      // last chance, just open any font in the right size
+      the_font = XftFontOpen (fl_display, fl_screen,
+                        XFT_FAMILY, XftTypeString, "sans",
+                        XFT_SIZE, XftTypeDouble, (double)size,
+                        NULL);
+      XftPatternDestroy(fnt_pat);
+      if (!the_font) {
+        fltk3::error("Unable to find fonts. Check your FontConfig configuration.\n");
+        exit(1);
+      }
+      return the_font;
+    }
+
+    // open the matched font
+    the_font = XftFontOpenPattern(fl_display, match_pat);
+
+#if 0 // diagnostic to print the "full name" of the font we actually opened. This works.
+    FcChar8 *picked_name2 =  FcNameUnparse(the_font->pattern);
+    printf("Open : %s\n", picked_name2);
+    free(picked_name2);
+#endif
+
+    XftPatternDestroy(fnt_pat);
+//  XftPatternDestroy(match_pat); // FontConfig will destroy this resource for us. We must not!
+
+    return the_font;
+  }
+  else { // We were passed a font name in XLFD format
+    /* OksiD's X font code could handle being passed a comma separated list
+     * of XLFD's. It then attempted to find which font was "best" from this list.
+     * But XftFontOpenXlfd can not do this, so if a list is passed, we just
+     * terminate it at the first comma.
+     * A "better" solution might be to use XftXlfdParse() on each of the passed
+     * XLFD's to construct a "super-pattern" that incorporates attributes from all
+     * XLFD's and use that to perform a XftFontMatch(). Maybe...
+     */
+    char *local_name = strdup(name);
+    if(comma_count) { // This means we were passed multiple XLFD's
+      char *pc = strchr(local_name, ',');
+      *pc = 0; // terminate the XLFD at the first comma
+    }
+    XftFont *the_font = XftFontOpenXlfd(fl_display, fl_screen, local_name);
+    free(local_name);
+#if 0 // diagnostic to print the "full name" of the font we actually opened. This works.
+puts("Font Opened"); fflush(stdout);
+    FcChar8 *picked_name2 =  FcNameUnparse(the_font->pattern);
+    printf("Open : %s\n", picked_name2); fflush(stdout);
+    free(picked_name2);
+#endif
+   return the_font;
+  }
+} // end of fontopen
+
+Fl_Font_Descriptor::Fl_Font_Descriptor(const char* name, fltk3::Fontsize fsize, int fangle) {
+//  encoding = fl_encoding_;
+  size = fsize;
+  angle = fangle;
+#if HAVE_GL
+  listbase = 0;
+#endif // HAVE_GL
+  font = fontopen(name, fsize, false, angle);
+}
+
+Fl_Font_Descriptor::~Fl_Font_Descriptor() {
+  if (this == fltk3::graphics_driver->font_descriptor()) fltk3::graphics_driver->font_descriptor(NULL);
+//  XftFontClose(fl_display, font);
+}
+
+/* decodes the input UTF-8 string into a series of wchar_t characters.
+ n is set upon return to the number of characters.
+ Don't deallocate the returned memory.
+ */
+static const wchar_t *utf8reformat(const char *str, int& n)
+{
+  static const wchar_t empty[] = {0};
+  static wchar_t *buffer;
+  static int lbuf = 0;
+  int newn;
+  if (n == 0) return empty;
+  newn = fltk3::utf8towc(str, n, (wchar_t*)buffer, lbuf);
+  if (newn >= lbuf) {
+    lbuf = newn + 100;
+    if (buffer) free(buffer);
+    buffer = (wchar_t*)malloc(lbuf * sizeof(wchar_t));
+    n = fltk3::utf8towc(str, n, (wchar_t*)buffer, lbuf);
+  } else {
+    n = newn;
+  }
+  return buffer;
+}
+
+static void utf8extents(Fl_Font_Descriptor *desc, const char *str, int n, XGlyphInfo *extents)
+{
+  memset(extents, 0, sizeof(XGlyphInfo));
+  const wchar_t *buffer = utf8reformat(str, n);
+#ifdef __CYGWIN__
+    XftTextExtents16(fl_display, desc->font, (XftChar16 *)buffer, n, extents);
+#else
+    XftTextExtents32(fl_display, desc->font, (XftChar32 *)buffer, n, extents);
+#endif
+}
+
+int fltk3::XlibGraphicsDriver::height() {
+  if (font_descriptor()) return font_descriptor()->font->ascent + font_descriptor()->font->descent;
+  else return -1;
+}
+
+int fltk3::XlibGraphicsDriver::descent() {
+  if (font_descriptor()) return font_descriptor()->font->descent;
+  else return -1;
+}
+
+double fltk3::XlibGraphicsDriver::width(const char* str, int n) {
+  if (!font_descriptor()) return -1.0;
+  XGlyphInfo i;
+  utf8extents(font_descriptor(), str, n, &i);
+  return i.xOff;
+}
+
+/*double fltk3::width(uchar c) {
+  return fltk3::graphics_driver->width((const char *)(&c), 1);
+}*/
+
+static double fl_xft_width(Fl_Font_Descriptor *desc, FcChar32 *str, int n) {
+  if (!desc) return -1.0;
+  XGlyphInfo i;
+  XftTextExtents32(fl_display, desc->font, str, n, &i);
+  return i.xOff;
+}
+
+double fltk3::XlibGraphicsDriver::width(unsigned int c) {
+  return fl_xft_width(font_descriptor(), (FcChar32 *)(&c), 1);
+}
+
+void fltk3::XlibGraphicsDriver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
+  if (!font_descriptor()) {
+    w = h = 0;
+    dx = dy = 0;
+    return;
+  }
+  XGlyphInfo gi;
+  utf8extents(font_descriptor(), c, n, &gi);
+
+  w = gi.width;
+  h = gi.height;
+  dx = -gi.x;
+  dy = -gi.y;
+} // fltk3::text_extents
+
+
+/* This code is used (mainly by opengl) to get a bitmapped font. The
+ * original XFT-1 code used XFT's "core" fonts methods to load an XFT
+ * font that was actually a X-bitmap font, that could then be readily
+ * used with GL.  But XFT-2 does not provide that ability, and there
+ * is no easy method to use an XFT font directly with GL. So...
+*/
+
+#  if XFT_MAJOR > 1
+// This function attempts, on XFT2 systems, to find a suitable "core" Xfont
+// for GL or other bitmap font needs (we dont have an XglUseXftFont(...) function.)
+// There's probably a better way to do this. I can't believe it is this hard...
+// Anyway... This code attempts to make an XLFD out of the fltk-style font
+// name it is passed, then tries to load that font. Surprisingly, this quite
+// often works - boxes that have XFT generally also have a fontserver that
+// can serve TTF and other fonts to X, and so the font name that fltk makes
+// from the XFT name often also "exists" as an "core" X font...
+// If this code fails to load the requested font, it falls back through a
+// series of tried 'n tested alternatives, ultimately resorting to what the
+// original fltk code did.
+// NOTE: On my test boxes (FC6, FC7, FC8, ubuntu8.04, 9.04, 9.10) this works 
+//       well for the fltk "built-in" font names.
+static XFontStruct* load_xfont_for_xft2(fltk3::GraphicsDriver *driver) {
+  XFontStruct* xgl_font = 0;
+  int size = driver->size();
+  int fnum = driver->font();
+  const char *wt_med = "medium";
+  const char *wt_bold = "bold";
+  const char *weight = wt_med; // no specifc weight requested - accept any
+  char slant = 'r';   // regular non-italic by default
+  char xlfd[128];     // we will put our synthetic XLFD in here
+  char *pc = strdup(fltk3::fonts[fnum].name); // what font were we asked for?
+  const char *name = pc;    // keep a handle to the original name for freeing later
+  // Parse the "fltk-name" of the font
+  switch (*name++) {
+  case 'I': slant = 'i'; break;       // italic
+  case 'P': slant = 'i';              // bold-italic (falls-through)
+  case 'B': weight = wt_bold; break;  // bold
+  case ' ': break;                    // regular
+  default: name--;                    // no prefix, restore name
+  }
+
+  // first, we do a query with no prefered size, to see if the font exists at all
+  snprintf(xlfd, 128, "-*-%s-%s-%c-*--*-*-*-*-*-*-*-*", name, weight, slant); // make up xlfd style name
+  xgl_font = XLoadQueryFont(fl_display, xlfd);
+  if(xgl_font) { // the face exists, but can we get it in a suitable size?
+    XFreeFont(fl_display, xgl_font); // release the non-sized version
+    snprintf(xlfd, 128, "-*-%s-%s-%c-*--*-%d-*-*-*-*-*-*", name, weight, slant, (size*10));
+    xgl_font = XLoadQueryFont(fl_display, xlfd); // attempt to load the font at the right size
+  }
+//puts(xlfd);
+
+  // try alternative names
+  if (!xgl_font) {
+    if (!strcmp(name, "sans")) {
+      name = "helvetica";
+    } else if (!strcmp(name, "mono")) {
+      name = "courier";
+    } else if (!strcmp(name, "serif")) {
+      name = "times";
+    } else if (!strcmp(name, "screen")) {
+      name = "lucidatypewriter";
+    } else if (!strcmp(name, "dingbats")) {
+      name = "zapf dingbats";
+    }
+    snprintf(xlfd, 128, "-*-*%s*-%s-%c-*--*-%d-*-*-*-*-*-*", name, weight, slant, (size*10));
+    xgl_font = XLoadQueryFont(fl_display, xlfd);
+  }  
+  free(pc); // release our copy of the font name
+  
+  // if we have nothing loaded, try a generic proportional font
+  if(!xgl_font) {
+    snprintf(xlfd, 128, "-*-helvetica-*-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
+    xgl_font = XLoadQueryFont(fl_display, xlfd);
+  }
+  // If that still didn't work, try this instead
+  if(!xgl_font) {
+    snprintf(xlfd, 128, "-*-courier-medium-%c-*--*-%d-*-*-*-*-*-*", slant, (size*10));
+    xgl_font = XLoadQueryFont(fl_display, xlfd);
+  }
+//printf("glf: %d\n%s\n%s\n", size, xlfd, fltk3::fonts[fltk3::font_].name);
+//if(xgl_font) puts("ok");
+
+  // Last chance fallback - this usually loads something...
+  if (!xgl_font) xgl_font = XLoadQueryFont(fl_display, "fixed");
+
+  return xgl_font;
+} // end of load_xfont_for_xft2
+#  endif
+
+static XFontStruct* fl_xxfont(fltk3::GraphicsDriver *driver) {
+#  if XFT_MAJOR > 1
+  // kludge! XFT 2 and later does not provide core fonts for us to use with GL
+  // try to load a bitmap X font instead
+  static XFontStruct* xgl_font = 0;
+  static int glsize = 0;
+  static int glfont = -1;
+  // Do we need to load a new font?
+  if ((!xgl_font) || (glsize != driver->size()) || (glfont != driver->font())) {
+    // create a dummy XLFD for some font of the appropriate size...
+    if (xgl_font) XFreeFont(fl_display, xgl_font); // font already loaded, free it - this *might* be a Bad Idea
+    glsize = driver->size(); // record current font size
+    glfont = driver->font(); // and face
+    xgl_font = load_xfont_for_xft2(driver);
+  }
+  return xgl_font;
+#  else // XFT-1 provides a means to load a "core" font directly
+  if (driver->font_descriptor()->font->core) {
+    return driver->font_descriptor()->font->u.core.font; // is the current font a "core" font? If so, use it.
+    }
+  static XftFont* xftfont;
+  if (xftfont) XftFontClose (fl_display, xftfont);
+  xftfont = fontopen(fltk3::fonts[driver->font()].name, driver->size(), true, 0); // else request XFT to load a suitable "core" font instead.
+  return xftfont->u.core.font;
+#  endif // XFT_MAJOR > 1
+}
+
+XFontStruct* Fl_XFont_On_Demand::value() {
+  if (!ptr) ptr = fl_xxfont(fltk3::graphics_driver);
+  return ptr;
+}
+
+#if USE_OVERLAY
+// Currently Xft does not work with colormapped visuals, so this probably
+// does not work unless you have a true-color overlay.
+extern bool fl_overlay;
+extern Colormap fl_overlay_colormap;
+extern XVisualInfo* fl_overlay_visual;
+#endif
+
+// For some reason Xft produces errors if you destroy a window whose id
+// still exists in an XftDraw structure. It would be nice if this is not
+// true, a lot of junk is needed to try to stop this:
+
+static XftDraw* draw_;
+static Window draw_window;
+#if USE_OVERLAY
+static XftDraw* draw_overlay;
+static Window draw_overlay_window;
+#endif
+
+void fl_destroy_xft_draw(Window id) {
+  if (id == draw_window)
+    XftDrawChange(draw_, draw_window = fltk3::message_window);
+#if USE_OVERLAY
+  if (id == draw_overlay_window)
+    XftDrawChange(draw_overlay, draw_overlay_window = fltk3::message_window);
+#endif
+}
+
+void fltk3::XlibGraphicsDriver::draw(const char *str, int n, int x, int y) {
+  if ( !this->font_descriptor() ) {
+    this->font(fltk3::HELVETICA, fltk3::NORMAL_SIZE);
+  }
+#if USE_OVERLAY
+  XftDraw*& draw_ = fl_overlay ? draw_overlay : ::draw_;
+  if (fl_overlay) {
+    if (!draw_)
+      draw_ = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
+			   fl_overlay_visual->visual, fl_overlay_colormap);
+    else //if (draw_overlay_window != fl_window)
+      XftDrawChange(draw_, draw_overlay_window = fl_window);
+  } else
+#endif
+  if (!draw_)
+    draw_ = XftDrawCreate(fl_display, draw_window = fl_window,
+			 fl_visual->visual, fl_colormap);
+  else //if (draw_window != fl_window)
+    XftDrawChange(draw_, draw_window = fl_window);
+
+  Region region = fltk3::clip_region();
+  if (region && XEmptyRegion(region)) return;
+  XftDrawSetClip(draw_, region);
+
+  // Use fltk's color allocator, copy the results to match what
+  // XftCollorAllocValue returns:
+  XftColor color;
+  color.pixel = fl_xpixel(fltk3::GraphicsDriver::color());
+  uchar r,g,b; fltk3::get_color(fltk3::GraphicsDriver::color(), r,g,b);
+  color.color.red   = ((int)r)*0x101;
+  color.color.green = ((int)g)*0x101;
+  color.color.blue  = ((int)b)*0x101;
+  color.color.alpha = 0xffff;
+  
+  const wchar_t *buffer = utf8reformat(str, n);
+#ifdef __CYGWIN__
+  XftDrawString16(draw_, &color, font_descriptor()->font, x, y, (XftChar16 *)buffer, n);
+#else
+  XftDrawString32(draw_, &color, font_descriptor()->font, x, y, (XftChar32 *)buffer, n);
+#endif
+}
+
+void fltk3::XlibGraphicsDriver::draw(int angle, const char *str, int n, int x, int y) {
+  fl_xft_font(this, this->fltk3::GraphicsDriver::font(), this->size(), angle);
+  this->draw(str, n, (int)x, (int)y);
+  fl_xft_font(this, this->fltk3::GraphicsDriver::font(), this->size(), 0);
+}
+
+static void fl_drawUCS4(fltk3::GraphicsDriver *driver, const FcChar32 *str, int n, int x, int y) {
+#if USE_OVERLAY
+  XftDraw*& draw_ = fl_overlay ? draw_overlay : ::draw_;
+  if (fl_overlay) {
+    if (!draw_)
+      draw_ = XftDrawCreate(fl_display, draw_overlay_window = fl_window,
+			   fl_overlay_visual->visual, fl_overlay_colormap);
+    else //if (draw_overlay_window != fl_window)
+      XftDrawChange(draw_, draw_overlay_window = fl_window);
+  } else
+#endif
+  if (!draw_)
+    draw_ = XftDrawCreate(fl_display, draw_window = fl_window,
+			 fl_visual->visual, fl_colormap);
+  else //if (draw_window != fl_window)
+    XftDrawChange(draw_, draw_window = fl_window);
+
+  Region region = fltk3::clip_region();
+  if (region && XEmptyRegion(region)) return;
+  XftDrawSetClip(draw_, region);
+
+  // Use fltk's color allocator, copy the results to match what
+  // XftCollorAllocValue returns:
+  XftColor color;
+  color.pixel = fl_xpixel(driver->color());
+  uchar r,g,b; fltk3::get_color(driver->color(), r,g,b);
+  color.color.red   = ((int)r)*0x101;
+  color.color.green = ((int)g)*0x101;
+  color.color.blue  = ((int)b)*0x101;
+  color.color.alpha = 0xffff;
+
+  XftDrawString32(draw_, &color, driver->font_descriptor()->font, x, y, (FcChar32 *)str, n);
+}
+
+
+void fltk3::XlibGraphicsDriver::rtl_draw(const char* c, int n, int x, int y) {
+
+#if defined(__GNUC__)
+// FIXME: warning Need to improve this XFT right to left draw function
+#endif /*__GNUC__*/
+
+// This actually draws LtoR, but aligned to R edge with the glyph order reversed...
+// but you can't just byte-rev a UTF-8 string, that isn't valid.
+// You can reverse a UCS4 string though...
+  int num_chars, wid, utf_len = strlen(c);
+  FcChar8 *u8 = (FcChar8 *)c;
+  FcBool valid = FcUtf8Len(u8, utf_len, &num_chars, &wid);
+  if (!valid)
+  {
+    // badly formed Utf-8 input string
+    return;
+  }
+  if (num_chars < n) n = num_chars; // limit drawing to usable characters in input array
+  FcChar32 *ucs_txt = new FcChar32[n+1];
+  FcChar32* pu;
+  int in, out, sz;
+  ucs_txt[n] = 0;
+  in = 0; out = n-1;
+  while ((out >= 0) && (utf_len > 0))
+  {
+    pu = &ucs_txt[out];
+    sz = FcUtf8ToUcs4(u8, pu, utf_len);
+    utf_len = utf_len - sz;
+    u8 = u8 + sz;
+    out = out - 1;
+  }
+  // Now we have a UCS4 version of the input text, reversed, in ucs_txt
+  int offs = (int)fl_xft_width(font_descriptor(), ucs_txt, n);
+  fl_drawUCS4(this, ucs_txt, n, (x-offs), y);
+
+  delete[] ucs_txt;
+}
+#endif
+
+//
+// End of "$Id$"
+//

Copied: branches/branch-3.0/src/fltk3/xft_set_fonts.cxx (from rev 9002, branches/branch-3.0/src/core/fl_set_fonts_xft.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3/xft_set_fonts.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3/xft_set_fonts.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,385 @@
+//
+// "$Id$"
+//
+// More font utilities for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2011 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+#include <X11/Xft/Xft.h>
+
+// This function fills in the fltk font table with all the fonts that
+// are found on the X server.  It tries to place the fonts into families
+// and to sort them so the first 4 in a family are normal, bold, italic,
+// and bold italic.
+
+// Bug: older versions calculated the value for *ap as a side effect of
+// making the name, and then forgot about it. To avoid having to change
+// the header files I decided to store this value in the last character
+// of the font name array.
+#define ENDOFBUFFER 127 // sizeof(fltk3::Font.fontname)-1
+
+// turn a stored font name into a pretty name:
+const char* fltk3::get_font_name(fltk3::Font fnum, int* ap) {
+  Fl_Fontdesc *f = fltk3::fonts + fnum;
+  if (!f->fontname[0]) {
+    const char* p = f->name;
+    int type;
+    switch (p[0]) {
+    case 'B': type = fltk3::BOLD; break;
+    case 'I': type = fltk3::ITALIC; break;
+    case 'P': type = fltk3::BOLD | fltk3::ITALIC; break;
+    default:  type = 0; break;
+    }
+
+  // NOTE: This can cause duplications in fonts that already have Bold or Italic in
+  // their "name". Maybe we need to find a cleverer way?
+    strlcpy(f->fontname, p+1, ENDOFBUFFER);
+    if (type & fltk3::BOLD) strlcat(f->fontname, " bold", ENDOFBUFFER);
+    if (type & fltk3::ITALIC) strlcat(f->fontname, " italic", ENDOFBUFFER);
+    f->fontname[ENDOFBUFFER] = (char)type;
+  }
+  if (ap) *ap = f->fontname[ENDOFBUFFER];
+  return f->fontname;
+}
+
+///////////////////////////////////////////////////////////
+#define LOCAL_RAW_NAME_MAX 256
+
+extern "C" {
+// sort returned fontconfig font names
+static int name_sort(const void *aa, const void *bb) {
+  // What should we do here? Just do a string compare for now...
+  // NOTE: This yeilds some oddities - in particular a Blah Bold font will be
+  // listed before Blah...
+  // Also - the fontconfig listing returns some faces that are effectively duplicates
+  // as far as fltk is concerned, e.g. where there are ko or ja variants that we
+  // can't distinguish (since we are not yet fully UTF-*) - should we strip them here?
+  return strcasecmp(*(char**)aa, *(char**)bb);
+} // end of name_sort
+} // end of extern C section
+
+
+// Read the "pretty" name we have derived from fontconfig then convert
+// it into the format fltk uses internally for Xft names...
+// This is just a mess - I should have tokenised the strings and gone from there,
+// but I really thought this would be easier!
+static void make_raw_name(char *raw, char *pretty)
+{
+  // Input name will be "Some Name:style = Bold Italic" or whatever
+  // The plan is this:
+  // - the first char in the "raw" name becomes either I, B, P or " " for
+  //   italic, bold, bold italic or normal - this seems to be the fltk way...
+
+  char *style = strchr(pretty, ':');
+  char *last = style + strlen(style) - 2;
+
+  if (style)
+  {
+    *style = 0; // Terminate "name" string
+    style ++;   // point to start of style section
+  }
+
+  // It is still possible that the "pretty" name has multiple comma separated entries
+  // I've seen this often in CJK fonts, for example... Keep only the first one... This
+  // is not ideal, the CJK fonts often have the name in utf8 in several languages. What
+  // we ought to do is use fontconfig to query the available languages and pick one... But which?
+#if 0 // loop to keep the LAST name entry...
+  char *nm1 = pretty;
+  char *nm2 = strchr(nm1, ',');
+  while(nm2) {
+    nm1 = nm2 + 1;
+    nm2 = strchr(nm1, ',');
+  }
+  raw[0] = ' '; raw[1] = 0; // Default start of "raw name" text
+  strncat(raw, nm1, LOCAL_RAW_NAME_MAX);
+#else // keep the first remaining name entry
+  char *nm2 = strchr(pretty, ',');
+  if(nm2) *nm2 = 0; // terminate name after first entry
+  raw[0] = ' '; raw[1] = 0; // Default start of "raw name" text
+  strncat(raw, pretty, LOCAL_RAW_NAME_MAX-1);
+#endif
+  // At this point, the name is "marked" as regular...
+  if (style)
+  {
+#define PLAIN   0
+#define BOLD    1
+#define ITALIC  2
+#define BITALIC (BOLD | ITALIC)
+    int mods = PLAIN;
+    // Now try and parse the style string - look for the "=" sign
+    style = strchr(style, '=');
+    while ((style) && (style < last))
+    {
+      int type;
+      while ((*style == '=') || (*style == ' ') || (*style == '\t'))
+      {
+        style++; // Start of Style string
+        if ((style >= last) || (*style == 0)) continue;
+      }
+      type = toupper(style[0]);
+      switch (type)
+      {
+      // Things we might see: Regular Normal Bold Italic Oblique (??what??) Medium
+      // Roman Light Demi Sans SemiCondensed SuperBold Book... etc...
+      // Things we actually care about: Bold Italic Oblique SuperBold - Others???
+      case 'I':
+        if (strncasecmp(style, "Italic", 6) == 0)
+        {
+          mods |= ITALIC;
+        }
+        goto NEXT_STYLE;
+
+      case 'B':
+        if (strncasecmp(style, "Bold", 4) == 0)
+        {
+          mods |= BOLD;
+        }
+        goto NEXT_STYLE;
+
+      case 'O':
+        if (strncasecmp(style, "Oblique", 7) == 0)
+        {
+          mods |= ITALIC;
+        }
+        goto NEXT_STYLE;
+          
+      case 's':
+        if (strncasecmp(style, "SuperBold", 9) == 0)
+        {
+          mods |= BOLD;
+        }
+        goto NEXT_STYLE;
+          
+      default: // find the next gap
+        goto NEXT_STYLE;
+      } // switch end
+NEXT_STYLE:
+      while ((*style != ' ') && (*style != '\t'))
+      {
+        style++;
+        if ((style >= last) || (*style == 0)) goto STYLE_DONE;
+      }
+    }
+STYLE_DONE:
+    // Set the "modifier" character in the raw string
+    switch(mods)
+    {
+    case BOLD: raw[0] = 'B';
+      break;
+    case ITALIC: raw[0] = 'I';
+      break;
+    case BITALIC: raw[0] = 'P';
+      break;
+    default: raw[0] = ' ';
+      break;
+    }
+  }
+} // make_raw_name
+
+///////////////////////////////////////////////////////////
+
+static int fl_free_font = fltk3::FREE_FONT;
+
+// Uses the fontconfig lib to construct a list of all installed fonts.
+// I tried using XftListFonts for this, but the API is tricky - and when
+// I looked at the XftList* code, it calls the Fc* functions anyway, so...
+//
+// Also, for now I'm ignoring the "pattern_name" and just getting everything...
+// AND I don't try and skip the fonts we've already loaded in the defaults.
+// Blimey! What a hack!
+fltk3::Font fltk3::set_fonts(const char* pattern_name)
+{
+  FcFontSet  *fnt_set;     // Will hold the list of fonts we find
+  FcPattern   *fnt_pattern; // Holds the generic "match all names" pattern
+  FcObjectSet *fnt_obj_set = 0; // Holds the generic "match all objects" 
+  
+  int j; // loop iterator variable
+  int font_count; // Total number of fonts found to process
+  char **full_list; // The list of font names we build
+
+  if (fl_free_font > fltk3::FREE_FONT) // already been here
+    return (fltk3::Font)fl_free_font;
+  
+  fl_open_display(); // Just in case...
+    
+  // Make sure fontconfig is ready... is this necessary? The docs say it is
+  // safe to call it multiple times, so just go for it anyway!
+  if (!FcInit())
+  {
+    // What to do? Just return defaults...
+    return fltk3::FREE_FONT;
+  }
+
+  // Create a search pattern that will match every font name - I think this
+  // does the Right Thing, but am not certain...
+  //
+  // This could possibly be "enhanced" to pay attention to the requested
+  // "pattern_name"?
+  fnt_pattern = FcPatternCreate();
+  fnt_obj_set = FcObjectSetBuild(FC_FAMILY, FC_STYLE, (void *)0);
+    
+  // Hopefully, this is a set of all the fonts...
+  fnt_set = FcFontList(0, fnt_pattern, fnt_obj_set);
+  
+  // We don't need the fnt_pattern and fnt_obj_set any more, release them
+  FcPatternDestroy(fnt_pattern);
+  FcObjectSetDestroy(fnt_obj_set);
+
+  // Now, if we got any fonts, iterate through them...
+  if (fnt_set)
+  {
+    char *stop;
+    char *start;
+    char *first;
+    
+    font_count = fnt_set->nfont; // How many fonts?
+    
+    // Allocate array of char*'s to hold the name strings
+    full_list = (char **)malloc(sizeof(char *) * font_count);
+    
+    // iterate through all the font patterns and get the names out...
+      for (j = 0; j < font_count; j++)
+      {
+      // NOTE: FcChar8 is a typedef of "unsigned char"...
+      FcChar8 *font; // String to hold the font's name
+            
+      // Convert from fontconfig internal pattern to human readable name
+      // NOTE: This WILL malloc storage, so we need to free it later...
+      font = FcNameUnparse(fnt_set->fonts[j]);
+            
+      // The returned strings look like this...
+      // Century Schoolbook:style=Bold Italic,fed kursiv,Fett Kursiv,...
+      // So the bit we want is up to the first comma - BUT some strings have
+      // more than one name, separated by, guess what?, a comma...
+      stop = start = first = 0;
+      stop = strchr((char *)font, ',');
+      start = strchr((char *)font, ':');
+      if ((stop) && (start) && (stop < start))
+      {
+        first = stop + 1; // discard first version of name
+        // find first comma *after* the end of the name
+        stop = strchr((char *)start, ',');
+      }
+      else
+      {
+        first = (char *)font; // name is just what was returned
+      }
+      // Truncate the name after the (english) modifiers description
+      if (stop)
+      {
+        *stop = 0; // Terminate the string at the first comma, if there is one
+      }
+
+      // Copy the font description into our list
+      if (first == (char *)font)
+      { // The listed name is still OK
+        full_list[j] = (char *)font;
+      }
+      else
+      { // The listed name has been modified
+        full_list[j] = strdup(first);
+        // Free the font name storage
+        free (font);
+      }
+      // replace "style=Regular" so strcmp sorts it first
+      if (start) {
+        char *reg = strstr(full_list[j], "=Regular");
+        if (reg) reg[1]='.';
+      }
+    }
+        
+    // Release the fnt_set - we don't need it any more
+    FcFontSetDestroy(fnt_set);
+        
+    // Sort the list into alphabetic order
+    qsort(full_list, font_count, sizeof(*full_list), name_sort);
+    
+    // Now let us add the names we got to fltk's font list...
+    for (j = 0; j < font_count; j++)
+    {
+      if (full_list[j])
+      {
+        char xft_name[LOCAL_RAW_NAME_MAX];
+        char *stored_name;
+        // Parse the strings into FLTK-XFT style..
+        make_raw_name(xft_name, full_list[j]);
+        // NOTE: This just adds on AFTER the default fonts - no attempt is made
+        // to identify already loaded fonts. Is this bad?
+        stored_name = strdup(xft_name);
+        fltk3::set_font((fltk3::Font)(j + fltk3::FREE_FONT), stored_name);
+        fl_free_font ++;
+        
+        free(full_list[j]); // release that name from our internal array
+      }
+    }
+    // Now we are done with the list, release it fully
+    free(full_list);
+  }
+  return (fltk3::Font)fl_free_font;
+} // ::set_fonts
+////////////////////////////////////////////////////////////////
+
+
+extern "C" {
+static int int_sort(const void *aa, const void *bb) {
+  return (*(int*)aa)-(*(int*)bb);
+}
+}
+
+////////////////////////////////////////////////////////////////
+
+// Return all the point sizes supported by this font:
+// Suprisingly enough Xft works exactly like fltk does and returns
+// the same list. Except there is no way to tell if the font is scalable.
+int fltk3::get_font_sizes(fltk3::Font fnum, int*& sizep) {
+  Fl_Fontdesc *s = fltk3::fonts+fnum;
+  if (!s->name) s = fltk3::fonts; // empty slot in table, use entry 0
+
+  fl_open_display();
+  XftFontSet* fs = XftListFonts(fl_display, fl_screen,
+                                XFT_FAMILY, XftTypeString, s->name+1,
+				(void *)0,
+                                XFT_PIXEL_SIZE,
+				(void *)0);
+  static int* array = 0;
+  static int array_size = 0;
+  if (fs->nfont >= array_size) {
+    delete[] array;
+    array = new int[array_size = fs->nfont+1];
+  }
+  array[0] = 0; int j = 1; // claim all fonts are scalable
+  for (int i = 0; i < fs->nfont; i++) {
+    double v;
+    if (XftPatternGetDouble(fs->fonts[i], XFT_PIXEL_SIZE, 0, &v) == XftResultMatch) {
+      array[j++] = int(v);
+    }
+  }
+  qsort(array+1, j-1, sizeof(int), int_sort);
+  XftFontSetDestroy(fs);
+  sizep = array;
+  return j;
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3/xutf8 (from rev 9002, branches/branch-3.0/src/core/xutf8)

Modified: branches/branch-3.0/src/fltk3gl/GLChoice.cxx
===================================================================
--- branches/branch-3.0/src/fltk3gl/GLChoice.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/src/fltk3gl/GLChoice.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -33,7 +33,7 @@
 #  include <stdlib.h>
 #  include "GLChoice.H"
 #  include <fltk3gl/glDraw.h>
-#  include "../core/flstring.h"
+#  include "../fltk3/flstring.h"
 #  include <fltk3/utf8.h>
 
 #  ifdef __APPLE__

Modified: branches/branch-3.0/src/fltk3gl/GLWindow.cxx
===================================================================
--- branches/branch-3.0/src/fltk3gl/GLWindow.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/src/fltk3gl/GLWindow.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -25,7 +25,7 @@
 //     http://www.fltk.org/str.php
 //
 
-#include "../core/flstring.h"
+#include "../fltk3/flstring.h"
 #if HAVE_GL
 
 extern int fl_gl_load_plugin;

Copied: branches/branch-3.0/src/fltk3images/BMPImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_BMP_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/BMPImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/BMPImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,495 @@
+//
+// "$Id$"
+//
+// fltk3::BMPImage routines.
+//
+// Copyright 1997-2010 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::BMPImage::fltk3::BMPImage() - Load a BMP image file.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3images/BMPImage.h>
+#include <fltk3/utf8.h>
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+//
+// BMP definitions...
+//
+
+#ifndef BI_RGB
+#  define BI_RGB       0             // No compression - straight BGR data
+#  define BI_RLE8      1             // 8-bit run-length compression
+#  define BI_RLE4      2             // 4-bit run-length compression
+#  define BI_BITFIELDS 3             // RGB bitmap with RGB masks
+#endif // !BI_RGB
+
+
+//
+// Local functions...
+//
+
+static int		read_long(FILE *fp);
+static unsigned short	read_word(FILE *fp);
+static unsigned int	read_dword(FILE *fp);
+/** 
+  The constructor loads the named BMP image from the given bmp filename.  
+  <P>The inherited destructor free all memory and server resources that are used by
+  the image.
+  <P>The destructor free all memory and server resources that are used by
+  the image
+*/
+fltk3::BMPImage::BMPImage(const char *bmp) // I - File to read
+  : fltk3::RGBImage(0,0,0) {
+  FILE		*fp;		// File pointer
+  int		info_size,	// Size of info header
+		depth,		// Depth of image (bits)
+		bDepth = 3,	// Depth of image (bytes)
+		compression,	// Type of compression
+		colors_used,	// Number of colors used
+		x, y,		// Looping vars
+		color,		// Color of RLE pixel
+		repcount,	// Number of times to repeat
+		temp,		// Temporary color
+		align,		// Alignment bytes
+		dataSize,	// number of bytes in image data set
+		row_order,	// 1 = normal;  -1 = flipped row order
+		start_y,	// Beginning Y
+		end_y;		// Ending Y
+  long		offbits;	// Offset to image data
+  uchar		bit,		// Bit in image
+		byte;		// Byte in image
+  uchar		*ptr;		// Pointer into pixels
+  uchar		colormap[256][3];// Colormap
+  uchar		havemask;	// Single bit mask follows image data
+  int		use_5_6_5;	// Use 5:6:5 for R:G:B channels in 16 bit images
+
+
+  // Open the file...
+  if ((fp = fltk3::fopen(bmp, "rb")) == NULL) return;
+
+  // Get the header...
+  byte = (uchar)getc(fp);	// Check "BM" sync chars
+  bit  = (uchar)getc(fp);
+  if (byte != 'B' || bit != 'M') {
+    fclose(fp);
+    return;
+  }
+
+  read_dword(fp);		// Skip size
+  read_word(fp);		// Skip reserved stuff
+  read_word(fp);
+  offbits = (long)read_dword(fp);// Read offset to image data
+
+  // Then the bitmap information...
+  info_size = read_dword(fp);
+
+//  printf("offbits = %ld, info_size = %d\n", offbits, info_size);
+
+  havemask  = 0;
+  row_order = -1;
+  use_5_6_5 = 0;
+
+  if (info_size < 40) {
+    // Old Windows/OS2 BMP header...
+    w(read_word(fp));
+    h(read_word(fp));
+    read_word(fp);
+    depth = read_word(fp);
+    compression = BI_RGB;
+    colors_used = 0;
+
+    repcount = info_size - 12;
+  } else {
+    // New BMP header...
+    w(read_long(fp));
+    // If the height is negative, the row order is flipped
+    temp = read_long(fp);
+    if (temp < 0) row_order = 1;
+    h(abs(temp));
+    read_word(fp);
+    depth = read_word(fp);
+    compression = read_dword(fp);
+    dataSize = read_dword(fp);
+    read_long(fp);
+    read_long(fp);
+    colors_used = read_dword(fp);
+    read_dword(fp);
+
+    repcount = info_size - 40;
+
+    if (!compression && depth>=8 && w()>32/depth) {
+      int Bpp = depth/8;
+      int maskSize = (((w()*Bpp+3)&~3)*h()) + (((((w()+7)/8)+3)&~3)*h());
+      if (maskSize==2*dataSize) {
+        havemask = 1;
+	h(h()/2);
+	bDepth = 4;
+      }
+    }
+  }
+
+//  printf("w() = %d, h() = %d, depth = %d, compression = %d, colors_used = %d, repcount = %d\n",
+//         w(), h(), depth, compression, colors_used, repcount);
+
+  // Skip remaining header bytes...
+  while (repcount > 0) {
+    getc(fp);
+    repcount --;
+  }
+
+  // Check header data...
+  if (!w() || !h() || !depth) {
+    fclose(fp);
+    return;
+  }
+
+  // Get colormap...
+  if (colors_used == 0 && depth <= 8)
+    colors_used = 1 << depth;
+
+  for (repcount = 0; repcount < colors_used; repcount ++) {
+    // Read BGR color...
+    if (fread(colormap[repcount], 1, 3, fp)==0) { /* ignore */ }
+
+    // Skip pad byte for new BMP files...
+    if (info_size > 12) getc(fp);
+  }
+
+  // Read first dword of colormap. It tells us if 5:5:5 or 5:6:5 for 16 bit
+  if (depth == 16)
+    use_5_6_5 = (read_dword(fp) == 0xf800);
+
+  // Set byte depth for RGBA images
+  if (depth == 32)
+    bDepth=4;
+
+  // Setup image and buffers...
+  d(bDepth);
+  if (offbits) fseek(fp, offbits, SEEK_SET);
+
+  array = new uchar[w() * h() * d()];
+  alloc_array = 1;
+
+  // Read the image data...
+  color = 0;
+  repcount = 0;
+  align = 0;
+  byte  = 0;
+  temp  = 0;
+
+  if (row_order < 0) {
+    start_y = h() - 1;
+    end_y   = -1;
+  } else {
+    start_y = 0;
+    end_y   = h();
+  }
+
+  for (y = start_y; y != end_y; y += row_order) {
+    ptr = (uchar *)array + y * w() * d();
+
+    switch (depth)
+    {
+      case 1 : // Bitmap
+          for (x = w(), bit = 128; x > 0; x --) {
+	    if (bit == 128) byte = (uchar)getc(fp);
+
+	    if (byte & bit) {
+	      *ptr++ = colormap[1][2];
+	      *ptr++ = colormap[1][1];
+	      *ptr++ = colormap[1][0];
+	    } else {
+	      *ptr++ = colormap[0][2];
+	      *ptr++ = colormap[0][1];
+	      *ptr++ = colormap[0][0];
+	    }
+
+	    if (bit > 1)
+	      bit >>= 1;
+	    else
+	      bit = 128;
+	  }
+
+          // Read remaining bytes to align to 32 bits...
+	  for (temp = (w() + 7) / 8; temp & 3; temp ++) {
+	    getc(fp);
+	  }
+          break;
+
+      case 4 : // 16-color
+          for (x = w(), bit = 0xf0; x > 0; x --) {
+	    // Get a new repcount as needed...
+	    if (repcount == 0) {
+              if (compression != BI_RLE4) {
+		repcount = 2;
+		color = -1;
+              } else {
+		while (align > 0) {
+	          align --;
+		  getc(fp);
+        	}
+
+		if ((repcount = getc(fp)) == 0) {
+		  if ((repcount = getc(fp)) == 0) {
+		    // End of line...
+                    x ++;
+		    continue;
+		  } else if (repcount == 1) {
+                    // End of image...
+		    break;
+		  } else if (repcount == 2) {
+		    // Delta...
+		    repcount = getc(fp) * getc(fp) * w();
+		    color = 0;
+		  } else {
+		    // Absolute...
+		    color = -1;
+		    align = ((4 - (repcount & 3)) / 2) & 1;
+		  }
+		} else {
+	          color = getc(fp);
+		}
+	      }
+	    }
+
+            // Get a new color as needed...
+	    repcount --;
+
+	    // Extract the next pixel...
+            if (bit == 0xf0) {
+	      // Get the next color byte as needed...
+              if (color < 0) temp = getc(fp);
+	      else temp = color;
+
+              // Copy the color value...
+	      *ptr++ = colormap[(temp >> 4) & 15][2];
+	      *ptr++ = colormap[(temp >> 4) & 15][1];
+	      *ptr++ = colormap[(temp >> 4) & 15][0];
+
+	      bit  = 0x0f;
+	    } else {
+	      bit  = 0xf0;
+
+              // Copy the color value...
+	      *ptr++ = colormap[temp & 15][2];
+	      *ptr++ = colormap[temp & 15][1];
+	      *ptr++ = colormap[temp & 15][0];
+	    }
+
+	  }
+
+	  if (!compression) {
+            // Read remaining bytes to align to 32 bits...
+	    for (temp = (w() + 1) / 2; temp & 3; temp ++) {
+	      getc(fp);
+	    }
+	  }
+          break;
+
+      case 8 : // 256-color
+          for (x = w(); x > 0; x --) {
+	    // Get a new repcount as needed...
+            if (compression != BI_RLE8) {
+	      repcount = 1;
+	      color = -1;
+            }
+
+	    if (repcount == 0) {
+	      while (align > 0) {
+	        align --;
+		getc(fp);
+              }
+
+	      if ((repcount = getc(fp)) == 0) {
+		if ((repcount = getc(fp)) == 0) {
+		  // End of line...
+                  x ++;
+		  continue;
+		} else if (repcount == 1) {
+		  // End of image...
+		  break;
+		} else if (repcount == 2) {
+		  // Delta...
+		  repcount = getc(fp) * getc(fp) * w();
+		  color = 0;
+		} else {
+		  // Absolute...
+		  color = -1;
+		  align = (2 - (repcount & 1)) & 1;
+		}
+	      } else {
+	        color = getc(fp);
+              }
+            }
+
+            // Get a new color as needed...
+            if (color < 0) temp = getc(fp);
+	    else temp = color;
+
+            repcount --;
+
+            // Copy the color value...
+	    *ptr++ = colormap[temp][2];
+	    *ptr++ = colormap[temp][1];
+	    *ptr++ = colormap[temp][0];
+	    if (havemask) ptr++;
+	  }
+
+	  if (!compression) {
+            // Read remaining bytes to align to 32 bits...
+	    for (temp = w(); temp & 3; temp ++) {
+	      getc(fp);
+	    }
+	  }
+          break;
+
+      case 16 : // 16-bit 5:5:5 or 5:6:5 RGB
+          for (x = w(); x > 0; x --, ptr += bDepth) {
+	    uchar b = getc(fp), a = getc(fp) ;
+	    if (use_5_6_5) {
+		ptr[2] = (uchar)(( b << 3 ) & 0xf8);
+		ptr[1] = (uchar)(((a << 5) & 0xe0) | ((b >> 3) & 0x1c));
+		ptr[0] = (uchar)(a & 0xf8);
+	    } else {
+		ptr[2] = (uchar)((b << 3) & 0xf8);
+		ptr[1] = (uchar)(((a << 6) & 0xc0) | ((b >> 2) & 0x38));
+		ptr[0] = (uchar)((a<<1) & 0xf8);
+	    }
+	  }
+
+          // Read remaining bytes to align to 32 bits...
+	  for (temp = w() * 2; temp & 3; temp ++) {
+	    getc(fp);
+	  }
+          break;
+
+      case 24 : // 24-bit RGB
+          for (x = w(); x > 0; x --, ptr += bDepth) {
+	    ptr[2] = (uchar)getc(fp);
+	    ptr[1] = (uchar)getc(fp);
+	    ptr[0] = (uchar)getc(fp);
+	  }
+
+          // Read remaining bytes to align to 32 bits...
+	  for (temp = w() * 3; temp & 3; temp ++) {
+	    getc(fp);
+	  }
+          break;
+		  
+      case 32 : // 32-bit RGBA
+         for (x = w(); x > 0; x --, ptr += bDepth) {
+            ptr[2] = (uchar)getc(fp);
+            ptr[1] = (uchar)getc(fp);
+            ptr[0] = (uchar)getc(fp);
+            ptr[3] = (uchar)getc(fp);
+          }
+          break;
+    }
+  }
+  
+  if (havemask) {
+    for (y = h() - 1; y >= 0; y --) {
+      ptr = (uchar *)array + y * w() * d() + 3;
+      for (x = w(), bit = 128; x > 0; x --, ptr+=bDepth) {
+	if (bit == 128) byte = (uchar)getc(fp);
+	if (byte & bit)
+	  *ptr = 0;
+	else
+	  *ptr = 255;
+	if (bit > 1)
+	  bit >>= 1;
+	else
+	  bit = 128;
+      }
+      // Read remaining bytes to align to 32 bits...
+      for (temp = (w() + 7) / 8; temp & 3; temp ++)
+	getc(fp);
+    }
+  }
+
+  // Close the file and return...
+  fclose(fp);
+}
+
+
+//
+// 'read_word()' - Read a 16-bit unsigned integer.
+//
+
+static unsigned short	// O - 16-bit unsigned integer
+read_word(FILE *fp) {	// I - File to read from
+  unsigned char b0, b1;	// Bytes from file
+
+  b0 = (uchar)getc(fp);
+  b1 = (uchar)getc(fp);
+
+  return ((b1 << 8) | b0);
+}
+
+
+//
+// 'read_dword()' - Read a 32-bit unsigned integer.
+//
+
+static unsigned int		// O - 32-bit unsigned integer
+read_dword(FILE *fp) {		// I - File to read from
+  unsigned char b0, b1, b2, b3;	// Bytes from file
+
+  b0 = (uchar)getc(fp);
+  b1 = (uchar)getc(fp);
+  b2 = (uchar)getc(fp);
+  b3 = (uchar)getc(fp);
+
+  return ((((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
+}
+
+
+//
+// 'read_long()' - Read a 32-bit signed integer.
+//
+
+static int			// O - 32-bit signed integer
+read_long(FILE *fp) {		// I - File to read from
+  unsigned char b0, b1, b2, b3;	// Bytes from file
+
+  b0 = (uchar)getc(fp);
+  b1 = (uchar)getc(fp);
+  b2 = (uchar)getc(fp);
+  b3 = (uchar)getc(fp);
+
+  return ((int)(((((b3 << 8) | b2) << 8) | b1) << 8) | b0);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/FileIcon2.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_File_Icon2.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/FileIcon2.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/FileIcon2.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,1022 @@
+//
+// "$Id$"
+//
+// fltk3::FileIcon system icon routines.
+//
+// KDE icon code donated by Maarten De Boer.
+//
+// Copyright 1999-2010 by Michael Sweet.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::FileIcon::load()              - Load an icon file...
+//   fltk3::FileIcon::load_fti()          - Load an SGI-format FTI file...
+//   fltk3::FileIcon::load_image()        - Load an image icon file...
+//   fltk3::FileIcon::load_system_icons() - Load the standard system icons/filetypes.
+//   load_kde_icons()                  - Load KDE icon files.
+//   load_kde_mimelnk()                - Load a KDE "mimelnk" file.
+//   kde_to_fltk_pattern()             - Convert a KDE pattern to a FLTK pattern.
+//   get_kde_val()                     - Get a KDE value.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "../fltk3/flstring.h"
+#include <ctype.h>
+#include <errno.h>
+#include <fltk3/math.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#if defined(WIN32) && !defined(__CYGWIN__)
+#  include <io.h>
+#  define F_OK	0
+// Visual C++ 2005 incorrectly displays a warning about the use of POSIX APIs
+// on Windows, which is supposed to be POSIX compliant...
+#  define access _access
+#else
+#  include <unistd.h>
+#endif // WIN32
+
+#include <fltk3/FileIcon.h>
+#include <fltk3/SharedImage.h>
+#include <fltk3/Widget.h>
+#include <fltk3/draw.h>
+#include <fltk3/filename.h>
+
+
+//
+// Define missing POSIX/XPG4 macros as needed...
+//
+
+#ifndef S_ISDIR
+#  define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
+#  define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
+#  define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#  define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
+#  define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif /* !S_ISDIR */
+
+
+//
+// Local functions...
+//
+
+static void	load_kde_icons(const char *directory, const char *icondir);
+static void	load_kde_mimelnk(const char *filename, const char *icondir);
+static char	*kde_to_fltk_pattern(const char *kdepattern);
+static char	*get_kde_val(char *str, const char *key);
+
+
+//
+// Local globals...
+//
+
+static const char *kdedir = NULL;
+
+
+/**
+  Loads the specified icon image. The format is deduced from the filename.
+  \param[in] f filename
+*/
+void
+fltk3::FileIcon::load(const char *f)	// I - File to read from
+{
+  int		i;			// Load status...
+  const char	*ext;			// File extension
+
+
+  ext = fltk3::filename_ext(f);
+
+  if (ext && strcmp(ext, ".fti") == 0)
+    i = load_fti(f);
+  else
+    i = load_image(f);
+
+  if (i)
+  {
+    fltk3::warning("fltk3::FileIcon::load(): Unable to load icon file \"%s\".", f);
+    return;
+  }
+}
+
+
+/**
+  Loads an SGI icon file.
+  \param[in] fti icon filename
+  \return 0 on success, non-zero on error
+*/
+int					// O - 0 on success, non-zero on error
+fltk3::FileIcon::load_fti(const char *fti)	// I - File to read from
+{
+  FILE	*fp;			// File pointer
+  int	ch;			// Current character
+  char	command[255],		// Command string ("vertex", etc.)
+	params[255],		// Parameter string ("10.0,20.0", etc.)
+	*ptr;			// Pointer into strings
+  int	outline;		// Outline polygon
+
+
+  // Try to open the file...
+  if ((fp = fltk3::fopen(fti, "rb")) == NULL)
+  {
+    fltk3::error("fltk3::FileIcon::load_fti(): Unable to open \"%s\" - %s",
+              fti, strerror(errno));
+    return -1;
+  }
+
+  // Read the entire file, adding data as needed...
+  outline = 0;
+
+  while ((ch = getc(fp)) != EOF)
+  {
+    // Skip whitespace
+    if (isspace(ch))
+      continue;
+
+    // Skip comments starting with "#"...
+    if (ch == '#')
+    {
+      while ((ch = getc(fp)) != EOF)
+        if (ch == '\n')
+	  break;
+
+      if (ch == EOF)
+        break;
+      else
+        continue;
+    }
+
+    // OK, this character better be a letter...
+    if (!isalpha(ch))
+    {
+      fltk3::error("fltk3::FileIcon::load_fti(): Expected a letter at file position %ld (saw '%c')",
+                ftell(fp) - 1, ch);
+      break;
+    }
+
+    // Scan the command name...
+    ptr    = command;
+    *ptr++ = ch;
+
+    while ((ch = getc(fp)) != EOF)
+    {
+      if (ch == '(')
+        break;
+      else if (ptr < (command + sizeof(command) - 1))
+        *ptr++ = ch;
+    }
+
+    *ptr++ = '\0';
+
+    // Make sure we stopped on a parenthesis...
+    if (ch != '(')
+    {
+      fltk3::error("fltk3::FileIcon::load_fti(): Expected a ( at file position %ld (saw '%c')",
+                ftell(fp) - 1, ch);
+      break;
+    }
+
+    // Scan the parameters...
+    ptr = params;
+
+    while ((ch = getc(fp)) != EOF)
+    {
+      if (ch == ')')
+        break;
+      else if (ptr < (params + sizeof(params) - 1))
+        *ptr++ = ch;
+    }
+
+    *ptr++ = '\0';
+
+    // Make sure we stopped on a parenthesis...
+    if (ch != ')')
+    {
+      fltk3::error("fltk3::FileIcon::load_fti(): Expected a ) at file position %ld (saw '%c')",
+                ftell(fp) - 1, ch);
+      break;
+    }
+
+    // Make sure the next character is a semicolon...
+    if ((ch = getc(fp)) != ';')
+    {
+      fltk3::error("fltk3::FileIcon::load_fti(): Expected a ; at file position %ld (saw '%c')",
+                ftell(fp) - 1, ch);
+      break;
+    }
+
+    // Now process the command...
+    if (strcmp(command, "color") == 0)
+    {
+      // Set the color; for negative colors blend the two primaries to
+      // produce a composite color.  Also, the following symbolic color
+      // names are understood:
+      //
+      //     name           FLTK color
+      //     -------------  ----------
+      //     iconcolor      fltk3::ICON_COLOR; mapped to the icon color in
+      //                    fltk3::FileIcon::draw()
+      //     shadowcolor    fltk3::DARK3
+      //     outlinecolor   fltk3::BLACK
+      if (strcmp(params, "iconcolor") == 0)
+        add_color(fltk3::ICON_COLOR);
+      else if (strcmp(params, "shadowcolor") == 0)
+        add_color(fltk3::DARK3);
+      else if (strcmp(params, "outlinecolor") == 0)
+        add_color(fltk3::BLACK);
+      else
+      {
+        int c = atoi(params);	// Color value
+
+
+        if (c < 0)
+	{
+	  // Composite color; compute average...
+	  c = -c;
+	  add_color(fltk3::color_average((fltk3::Color)(c >> 4),
+	                             (fltk3::Color)(c & 15), 0.5f));
+	}
+	else
+	  add_color((fltk3::Color)c);
+      }
+    }
+    else if (strcmp(command, "bgnline") == 0)
+      add(LINE);
+    else if (strcmp(command, "bgnclosedline") == 0)
+      add(CLOSEDLINE);
+    else if (strcmp(command, "bgnpolygon") == 0)
+      add(POLYGON);
+    else if (strcmp(command, "bgnoutlinepolygon") == 0)
+    {
+      add(OUTLINEPOLYGON);
+      outline = add(0) - data_;
+      add(0);
+    }
+    else if (strcmp(command, "endoutlinepolygon") == 0 && outline)
+    {
+      unsigned cval; // Color value
+
+      // Set the outline color; see above for valid values...
+      if (strcmp(params, "iconcolor") == 0)
+        cval = fltk3::ICON_COLOR;
+      else if (strcmp(params, "shadowcolor") == 0)
+        cval = fltk3::DARK3;
+      else if (strcmp(params, "outlinecolor") == 0)
+        cval = fltk3::BLACK;
+      else
+      {
+        int c = atoi(params);	// Color value
+
+
+        if (c < 0)
+	{
+	  // Composite color; compute average...
+	  c = -c;
+	  cval = fltk3::color_average((fltk3::Color)(c >> 4), (fltk3::Color)(c & 15), 0.5f);
+	}
+	else
+	  cval = c;
+      }
+
+      // Store outline color...
+      data_[outline]     = cval >> 16;
+      data_[outline + 1] = cval;
+
+      outline = 0;
+      add(END);
+    }
+    else if (strncmp(command, "end", 3) == 0)
+      add(END);
+    else if (strcmp(command, "vertex") == 0)
+    {
+      float x, y;		// Coordinates of vertex
+
+
+      if (sscanf(params, "%f,%f", &x, &y) != 2)
+        break;
+
+      add_vertex((short)(int)rint(x * 100.0), (short)(int)rint(y * 100.0));
+    }
+    else
+    {
+      fltk3::error("fltk3::FileIcon::load_fti(): Unknown command \"%s\" at file position %ld.",
+                command, ftell(fp) - 1);
+      break;
+    }
+  }
+
+  // Close the file and return...
+  fclose(fp);
+
+#ifdef DEBUG
+  printf("Icon File \"%s\":\n", fti);
+  for (int i = 0; i < num_data_; i ++)
+    printf("    %d,\n", data_[i]);
+#endif /* DEBUG */
+
+  return 0;
+}
+
+
+/**
+  Load an image icon file from an image filename.
+  \param[in] ifile image filename
+  \return 0 on success, non-zero on error
+*/
+int fltk3::FileIcon::load_image(const char *ifile)	// I - File to read from
+{
+  fltk3::SharedImage	*img;		// Image file
+
+
+  img = fltk3::SharedImage::get(ifile);
+  if (!img || !img->count() || !img->w() || !img->h()) return -1;
+
+  if (img->count() == 1) {
+    int		x, y;		// X & Y in image
+    int		startx;		// Starting X coord
+    fltk3::Color	c,		// Current color
+		temp;		// Temporary color
+    const uchar *row;		// Pointer into image
+
+
+    // Loop through grayscale or RGB image...
+    for (y = 0, row = (const uchar *)(*(img->data())); y < img->h(); y ++, row += img->ld())
+    {
+      for (x = 0, startx = 0, c = (fltk3::Color)-1;
+           x < img->w();
+	   x ++, row += img->d())
+      {
+	switch (img->d())
+	{
+          case 1 :
+              temp = fltk3::rgb_color(row[0], row[0], row[0]);
+	      break;
+          case 2 :
+	      if (row[1] > 127)
+        	temp = fltk3::rgb_color(row[0], row[0], row[0]);
+	      else
+		temp = (fltk3::Color)-1;
+	      break;
+	  case 3 :
+              temp = fltk3::rgb_color(row[0], row[1], row[2]);
+	      break;
+	  default :
+	      if (row[3] > 127)
+        	temp = fltk3::rgb_color(row[0], row[1], row[2]);
+	      else
+		temp = (fltk3::Color)-1;
+	      break;
+	}
+
+	if (temp != c)
+	{
+	  if (x > startx && c != (fltk3::Color)-1)
+	  {
+	    add_color(c);
+	    add(POLYGON);
+	    add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+	    add_vertex(x * 9000 / img->w() + 1000,      9500 - y * 9000 / img->h());
+	    add_vertex(x * 9000 / img->w() + 1000,      9500 - (y + 1) * 9000 / img->h());
+	    add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+	    add(END);
+	  }
+
+          c      = temp;
+	  startx = x;
+	}
+      }
+
+      if (x > startx && c != (fltk3::Color)-1)
+      {
+	add_color(c);
+	add(POLYGON);
+	add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+	add_vertex(x * 9000 / img->w() + 1000,      9500 - y * 9000 / img->h());
+	add_vertex(x * 9000 / img->w() + 1000,      9500 - (y + 1) * 9000 / img->h());
+	add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+	add(END);
+      }
+    }
+  } else {
+    int		i, j;			// Looping vars
+    int		ch;			// Current character
+    int		newch;			// New character
+    int		bg;			// Background color
+    char	val[16];		// Color value
+    const char	*lineptr,		// Pointer into line
+		*const*ptr;		// Pointer into data array
+    int		ncolors,		// Number of colors
+		chars_per_color;	// Characters per color
+    fltk3::Color	*colors;		// Colors
+    int		red, green, blue;	// Red, green, and blue values
+    int		x, y;			// X & Y in image
+    int		startx;			// Starting X coord
+
+
+    // Get the pixmap data...
+    ptr = img->data();
+    sscanf(*ptr, "%*d%*d%d%d", &ncolors, &chars_per_color);
+
+    colors = new fltk3::Color[1 << (chars_per_color * 8)];
+
+    // Read the colormap...
+    memset(colors, 0, sizeof(fltk3::Color) << (chars_per_color * 8));
+    bg = ' ';
+
+    ptr ++;
+
+    if (ncolors < 0) {
+      // Read compressed colormap...
+      const uchar *cmapptr;
+
+      ncolors = -ncolors;
+
+      for (i = 0, cmapptr = (const uchar *)*ptr; i < ncolors; i ++, cmapptr += 4)
+        colors[cmapptr[0]] = fltk3::rgb_color(cmapptr[1], cmapptr[2], cmapptr[3]);
+
+      ptr ++;
+    } else {
+      for (i = 0; i < ncolors; i ++, ptr ++) {
+	// Get the color's character
+	lineptr = *ptr;
+	ch      = *lineptr++;
+
+        if (chars_per_color > 1) ch = (ch << 8) | *lineptr++;
+
+	// Get the color value...
+	if ((lineptr = strstr(lineptr, "c ")) == NULL) {
+	  // No color; make this black...
+	  colors[ch] = fltk3::BLACK;
+	} else if (lineptr[2] == '#') {
+	  // Read the RGB triplet...
+	  lineptr += 3;
+	  for (j = 0; j < 12; j ++)
+            if (!isxdigit(lineptr[j]))
+	      break;
+
+	  switch (j) {
+            case 0 :
+		bg = ch;
+	    default :
+		red = green = blue = 0;
+		break;
+
+            case 3 :
+		val[0] = lineptr[0];
+		val[1] = '\0';
+		red = 255 * strtol(val, NULL, 16) / 15;
+
+		val[0] = lineptr[1];
+		val[1] = '\0';
+		green = 255 * strtol(val, NULL, 16) / 15;
+
+		val[0] = lineptr[2];
+		val[1] = '\0';
+		blue = 255 * strtol(val, NULL, 16) / 15;
+		break;
+
+            case 6 :
+            case 9 :
+            case 12 :
+		j /= 3;
+
+		val[0] = lineptr[0];
+		val[1] = lineptr[1];
+		val[2] = '\0';
+		red = strtol(val, NULL, 16);
+
+		val[0] = lineptr[j + 0];
+		val[1] = lineptr[j + 1];
+		val[2] = '\0';
+		green = strtol(val, NULL, 16);
+
+		val[0] = lineptr[2 * j + 0];
+		val[1] = lineptr[2 * j + 1];
+		val[2] = '\0';
+		blue = strtol(val, NULL, 16);
+		break;
+	  }
+
+	  colors[ch] = fltk3::rgb_color((uchar)red, (uchar)green, (uchar)blue);
+	} else {
+	  // Read a color name...
+	  if (strncasecmp(lineptr + 2, "white", 5) == 0) colors[ch] = fltk3::WHITE;
+	  else if (strncasecmp(lineptr + 2, "black", 5) == 0) colors[ch] = fltk3::BLACK;
+	  else if (strncasecmp(lineptr + 2, "none", 4) == 0) {
+            colors[ch] = fltk3::BLACK;
+	    bg = ch;
+	  } else colors[ch] = fltk3::GRAY;
+	}
+      }
+    }
+
+    // Read the image data...
+    for (y = 0; y < img->h(); y ++, ptr ++) {
+      lineptr = *ptr;
+      startx  = 0;
+      ch      = bg;
+
+      for (x = 0; x < img->w(); x ++) {
+	newch = *lineptr++;
+
+        if (chars_per_color > 1) newch = (newch << 8) | *lineptr++;
+
+	if (newch != ch) {
+	  if (ch != bg) {
+            add_color(colors[ch]);
+	    add(POLYGON);
+	    add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+	    add_vertex(x * 9000 / img->w() + 1000,      9500 - y * 9000 / img->h());
+	    add_vertex(x * 9000 / img->w() + 1000,      9500 - (y + 1) * 9000 / img->h());
+	    add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+	    add(END);
+          }
+
+	  ch     = newch;
+	  startx = x;
+	}
+      }
+
+      if (ch != bg) {
+	add_color(colors[ch]);
+	add(POLYGON);
+	add_vertex(startx * 9000 / img->w() + 1000, 9500 - y * 9000 / img->h());
+	add_vertex(x * 9000 / img->w() + 1000,      9500 - y * 9000 / img->h());
+	add_vertex(x * 9000 / img->w() + 1000,      9500 - (y + 1) * 9000 / img->h());
+	add_vertex(startx * 9000 / img->w() + 1000, 9500 - (y + 1) * 9000 / img->h());
+	add(END);
+      }
+    }
+
+    // Free the colormap...
+    delete[] colors;
+  }
+
+  img->release();
+
+#ifdef DEBUG
+  printf("Icon File \"%s\":\n", xpm);
+  for (i = 0; i < num_data_; i ++)
+    printf("    %d,\n", data_[i]);
+#endif // DEBUG
+
+  return 0;
+}
+
+
+/**
+  Loads all system-defined icons. This call is useful when using the
+  FileChooser widget and should be used when the application starts:
+  
+  \code
+  fltk3::FileIcon::load_system_icons();
+  \endcode
+*/
+void
+fltk3::FileIcon::load_system_icons(void) {
+  int		i;		// Looping var
+  fltk3::FileIcon	*icon;		// New icons
+  char		filename[FLTK3_PATH_MAX];	// Filename
+  char		icondir[FLTK3_PATH_MAX];	// Icon directory
+  static int	init = 0;	// Have the icons been initialized?
+  const char * const icondirs[] = {
+		  "Bluecurve",	// Icon directories to look for, in order
+		  "crystalsvg",
+		  "default.kde",
+		  "hicolor",
+		  NULL
+		};
+  static short	plain[] = {	// Plain file icon
+		  COLOR, -1, -1, OUTLINEPOLYGON, 0, fltk3::GRAY,
+		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
+		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
+		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, fltk3::GRAY,
+		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, END,
+		  COLOR, 0, fltk3::BLACK, LINE, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
+		  VERTEX, 2000, 1000, END, LINE, VERTEX, 3000, 7000,
+		  VERTEX, 5000, 7000, END, LINE, VERTEX, 3000, 6000,
+		  VERTEX, 5000, 6000, END, LINE, VERTEX, 3000, 5000,
+		  VERTEX, 7000, 5000, END, LINE, VERTEX, 3000, 4000,
+		  VERTEX, 7000, 4000, END, LINE, VERTEX, 3000, 3000,
+		  VERTEX, 7000, 3000, END, LINE, VERTEX, 3000, 2000,
+		  VERTEX, 7000, 2000, END, 
+		  END
+		};
+  static short	image[] = {	// Image file icon
+		  COLOR, -1, -1, OUTLINEPOLYGON, 0, fltk3::GRAY,
+		  VERTEX, 2000, 1000, VERTEX, 2000, 9000,
+		  VERTEX, 6000, 9000, VERTEX, 8000, 7000,
+		  VERTEX, 8000, 1000, END, OUTLINEPOLYGON, 0, fltk3::GRAY,
+		  VERTEX, 6000, 9000, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, END,
+		  COLOR, 0, fltk3::BLACK, LINE, VERTEX, 6000, 7000,
+		  VERTEX, 8000, 7000, VERTEX, 8000, 1000,
+		  VERTEX, 2000, 1000, END,
+		  COLOR, 0, fltk3::RED, POLYGON, VERTEX, 3500, 2500,
+		  VERTEX, 3000, 3000, VERTEX, 3000, 4000,
+		  VERTEX, 3500, 4500, VERTEX, 4500, 4500,
+		  VERTEX, 5000, 4000, VERTEX, 5000, 3000,
+		  VERTEX, 4500, 2500, END,
+		  COLOR, 0, fltk3::GREEN, POLYGON, VERTEX, 5500, 2500,
+		  VERTEX, 5000, 3000, VERTEX, 5000, 4000,
+		  VERTEX, 5500, 4500, VERTEX, 6500, 4500,
+		  VERTEX, 7000, 4000, VERTEX, 7000, 3000,
+		  VERTEX, 6500, 2500, END,
+		  COLOR, 0, fltk3::BLUE, POLYGON, VERTEX, 4500, 3500,
+		  VERTEX, 4000, 4000, VERTEX, 4000, 5000,
+		  VERTEX, 4500, 5500, VERTEX, 5500, 5500,
+		  VERTEX, 6000, 5000, VERTEX, 6000, 4000,
+		  VERTEX, 5500, 3500, END,
+		  END
+		};
+  static short	dir[] = {	// Directory icon
+		  COLOR, -1, -1, POLYGON, VERTEX, 1000, 1000,
+		  VERTEX, 1000, 7500,  VERTEX, 9000, 7500,
+		  VERTEX, 9000, 1000, END,
+		  POLYGON, VERTEX, 1000, 7500, VERTEX, 2500, 9000,
+		  VERTEX, 5000, 9000, VERTEX, 6500, 7500, END,
+		  COLOR, 0, fltk3::WHITE, LINE, VERTEX, 1500, 1500,
+		  VERTEX, 1500, 7000, VERTEX, 9000, 7000, END,
+		  COLOR, 0, fltk3::BLACK, LINE, VERTEX, 9000, 7500,
+		  VERTEX, 9000, 1000, VERTEX, 1000, 1000, END,
+		  COLOR, 0, fltk3::GRAY, LINE, VERTEX, 1000, 1000,
+		  VERTEX, 1000, 7500, VERTEX, 2500, 9000,
+		  VERTEX, 5000, 9000, VERTEX, 6500, 7500,
+		  VERTEX, 9000, 7500, END,
+		  END
+		};
+
+
+  // Add symbols if they haven't been added already...
+  if (!init) {
+    // This method requires the images library...
+    fltk3::register_images();
+
+    if (!kdedir) {
+      // Figure out where KDE is installed...
+      if ((kdedir = getenv("KDEDIR")) == NULL) {
+        if (!access("/opt/kde", F_OK)) kdedir = "/opt/kde";
+	else if (!access("/usr/local/share/mimelnk", F_OK)) kdedir = "/usr/local";
+        else kdedir = "/usr";
+      }
+    }
+
+    snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
+
+    if (!access(filename, F_OK)) {
+      // Load KDE icons...
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::PLAIN);
+
+      for (i = 0; icondirs[i]; i ++) {
+	snprintf(icondir, sizeof(icondir), "%s/share/icons/%s", kdedir,
+		 icondirs[i]);
+
+        if (!access(icondir, F_OK)) break;
+      }
+
+      if (icondirs[i]) {
+        snprintf(filename, sizeof(filename), "%s/16x16/mimetypes/unknown.png",
+	         icondir);
+      } else {
+	snprintf(filename, sizeof(filename), "%s/share/icons/unknown.xpm",
+	         kdedir);
+      }
+
+      if (!access(filename, F_OK)) icon->load_image(filename);
+
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::LINK);
+
+      snprintf(filename, sizeof(filename), "%s/16x16/filesystems/link.png",
+               icondir);
+
+      if (!access(filename, F_OK)) icon->load_image(filename);
+
+      snprintf(filename, sizeof(filename), "%s/share/mimelnk", kdedir);
+      load_kde_icons(filename, icondir);
+    } else if (!access("/usr/share/icons/folder.xpm", F_OK)) {
+      // Load GNOME icons...
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/share/icons/page.xpm");
+
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::DIRECTORY);
+      icon->load_image("/usr/share/icons/folder.xpm");
+    } else if (!access("/usr/dt/appconfig/icons", F_OK)) {
+      // Load CDE icons...
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/dt/appconfig/icons/C/Dtdata.m.pm");
+
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::DIRECTORY);
+      icon->load_image("/usr/dt/appconfig/icons/C/DtdirB.m.pm");
+
+      icon = new fltk3::FileIcon("core", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/dt/appconfig/icons/C/Dtcore.m.pm");
+
+      icon = new fltk3::FileIcon("*.{bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/dt/appconfig/icons/C/Dtimage.m.pm");
+
+      icon = new fltk3::FileIcon("*.{eps|pdf|ps}", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/dt/appconfig/icons/C/Dtps.m.pm");
+
+      icon = new fltk3::FileIcon("*.ppd", fltk3::FileIcon::PLAIN);
+      icon->load_image("/usr/dt/appconfig/icons/C/DtPrtpr.m.pm");
+    } else if (!access("/usr/lib/filetype", F_OK)) {
+      // Load SGI icons...
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::PLAIN);
+      icon->load_fti("/usr/lib/filetype/iconlib/generic.doc.fti");
+
+      icon = new fltk3::FileIcon("*", fltk3::FileIcon::DIRECTORY);
+      icon->load_fti("/usr/lib/filetype/iconlib/generic.folder.closed.fti");
+
+      icon = new fltk3::FileIcon("core", fltk3::FileIcon::PLAIN);
+      icon->load_fti("/usr/lib/filetype/default/iconlib/CoreFile.fti");
+
+      icon = new fltk3::FileIcon("*.{bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", fltk3::FileIcon::PLAIN);
+      icon->load_fti("/usr/lib/filetype/system/iconlib/ImageFile.fti");
+
+      if (!access("/usr/lib/filetype/install/iconlib/acroread.doc.fti", F_OK)) {
+	icon = new fltk3::FileIcon("*.{eps|ps}", fltk3::FileIcon::PLAIN);
+	icon->load_fti("/usr/lib/filetype/system/iconlib/PostScriptFile.closed.fti");
+
+	icon = new fltk3::FileIcon("*.pdf", fltk3::FileIcon::PLAIN);
+	icon->load_fti("/usr/lib/filetype/install/iconlib/acroread.doc.fti");
+      } else {
+	icon = new fltk3::FileIcon("*.{eps|pdf|ps}", fltk3::FileIcon::PLAIN);
+	icon->load_fti("/usr/lib/filetype/system/iconlib/PostScriptFile.closed.fti");
+      }
+
+      if (!access("/usr/lib/filetype/install/iconlib/html.fti", F_OK)) {
+	icon = new fltk3::FileIcon("*.{htm|html|shtml}", fltk3::FileIcon::PLAIN);
+        icon->load_fti("/usr/lib/filetype/iconlib/generic.doc.fti");
+	icon->load_fti("/usr/lib/filetype/install/iconlib/html.fti");
+      }
+
+      if (!access("/usr/lib/filetype/install/iconlib/color.ps.idle.fti", F_OK)) {
+	icon = new fltk3::FileIcon("*.ppd", fltk3::FileIcon::PLAIN);
+	icon->load_fti("/usr/lib/filetype/install/iconlib/color.ps.idle.fti");
+      }
+    } else {
+      // Create the default icons...
+      new fltk3::FileIcon("*", fltk3::FileIcon::PLAIN, sizeof(plain) / sizeof(plain[0]), plain);
+      new fltk3::FileIcon("*.{bm|bmp|bw|gif|jpg|pbm|pcd|pgm|ppm|png|ras|rgb|tif|xbm|xpm}", fltk3::FileIcon::PLAIN,
+                   sizeof(image) / sizeof(image[0]), image);
+      new fltk3::FileIcon("*", fltk3::FileIcon::DIRECTORY, sizeof(dir) / sizeof(dir[0]), dir);
+    }
+
+    // Mark things as initialized...
+    init = 1;
+
+#ifdef DEBUG
+    int count;
+    fltk3::FileIcon *temp;
+    for (count = 0, temp = first_; temp; temp = temp->next_, count ++);
+    printf("count of fltk3::FileIcon's is %d...\n", count);
+#endif // DEBUG
+  }
+}
+
+
+//
+// 'load_kde_icons()' - Load KDE icon files.
+//
+
+static void
+load_kde_icons(const char *directory,	// I - Directory to load
+               const char *icondir) {	// I - Location of icons
+  int		i;			// Looping var
+  int		n;			// Number of entries in directory
+  dirent	**entries;		// Entries in directory
+  char		full[FLTK3_PATH_MAX];	// Full name of file
+
+
+  entries = (dirent **)0;
+  n       = fltk3::filename_list(directory, &entries);
+
+  for (i = 0; i < n; i ++) {
+    if (entries[i]->d_name[0] != '.') {
+      snprintf(full, sizeof(full), "%s/%s", directory, entries[i]->d_name);
+
+      if (fltk3::filename_isdir(full)) load_kde_icons(full, icondir);
+      else load_kde_mimelnk(full, icondir);
+    }
+
+    free((void *)entries[i]);
+  }
+
+  free((void*)entries);
+}
+
+
+//
+// 'load_kde_mimelnk()' - Load a KDE "mimelnk" file.
+//
+
+static void
+load_kde_mimelnk(const char *filename,	// I - mimelnk filename
+                 const char *icondir) {	// I - Location of icons
+  FILE		*fp;
+  char		tmp[1024];
+  char		iconfilename[FLTK3_PATH_MAX];
+  char		pattern[1024];
+  char		mimetype[1024];
+  char		*val;
+  char		full_iconfilename[FLTK3_PATH_MAX];
+  fltk3::FileIcon	*icon;
+
+
+  mimetype[0]     = '\0';
+  pattern[0]      = '\0';
+  iconfilename[0] = '\0';
+
+  if ((fp = fltk3::fopen(filename, "rb")) != NULL) {
+    while (fgets(tmp, sizeof(tmp), fp)) {
+      if ((val = get_kde_val(tmp, "Icon")) != NULL)
+	strlcpy(iconfilename, val, sizeof(iconfilename));
+      else if ((val = get_kde_val(tmp, "MimeType")) != NULL)
+	strlcpy(mimetype, val, sizeof(mimetype));
+      else if ((val = get_kde_val(tmp, "Patterns")) != NULL)
+	strlcpy(pattern, val, sizeof(pattern));
+    }
+
+    fclose(fp);
+
+#ifdef DEBUG
+    printf("%s: Icon=\"%s\", MimeType=\"%s\", Patterns=\"%s\"\n", filename,
+           iconfilename, mimetype, pattern);
+#endif // DEBUG
+
+    if (!pattern[0] && strncmp(mimetype, "inode/", 6)) return;
+
+    if (iconfilename[0]) {
+      if (iconfilename[0] == '/') {
+        strlcpy(full_iconfilename, iconfilename, sizeof(full_iconfilename));
+      } else if (!access(icondir, F_OK)) {
+        // KDE 3.x and 2.x icons
+	int		i;		// Looping var
+	static const char *paths[] = {	// Subdirs to look in...
+	  "16x16/actions",
+	  "16x16/apps",
+	  "16x16/devices",
+	  "16x16/filesystems",
+	  "16x16/mimetypes",
+/*
+	  "20x20/actions",
+	  "20x20/apps",
+	  "20x20/devices",
+	  "20x20/filesystems",
+	  "20x20/mimetypes",
+
+	  "22x22/actions",
+	  "22x22/apps",
+	  "22x22/devices",
+	  "22x22/filesystems",
+	  "22x22/mimetypes",
+
+	  "24x24/actions",
+	  "24x24/apps",
+	  "24x24/devices",
+	  "24x24/filesystems",
+	  "24x24/mimetypes",
+*/
+	  "32x32/actions",
+	  "32x32/apps",
+	  "32x32/devices",
+	  "32x32/filesystems",
+	  "32x32/mimetypes",
+/*
+	  "36x36/actions",
+	  "36x36/apps",
+	  "36x36/devices",
+	  "36x36/filesystems",
+	  "36x36/mimetypes",
+
+	  "48x48/actions",
+	  "48x48/apps",
+	  "48x48/devices",
+	  "48x48/filesystems",
+	  "48x48/mimetypes",
+
+	  "64x64/actions",
+	  "64x64/apps",
+	  "64x64/devices",
+	  "64x64/filesystems",
+	  "64x64/mimetypes",
+
+	  "96x96/actions",
+	  "96x96/apps",
+	  "96x96/devices",
+	  "96x96/filesystems",
+	  "96x96/mimetypes"
+*/	};
+
+        for (i = 0; i < (int)(sizeof(paths) / sizeof(paths[0])); i ++) {
+          snprintf(full_iconfilename, sizeof(full_iconfilename),
+	           "%s/%s/%s.png", icondir, paths[i], iconfilename);
+
+          if (!access(full_iconfilename, F_OK)) break;
+	}
+
+        if (i >= (int)(sizeof(paths) / sizeof(paths[0]))) return;
+      } else {
+        // KDE 1.x icons
+        snprintf(full_iconfilename, sizeof(full_iconfilename),
+	         "%s/%s", tmp, iconfilename);
+
+        if (access(full_iconfilename, F_OK)) return;
+      }
+
+      if (strncmp(mimetype, "inode/", 6) == 0) {
+	if (!strcmp(mimetype + 6, "directory"))
+	  icon = new fltk3::FileIcon("*", fltk3::FileIcon::DIRECTORY);
+	else if (!strcmp(mimetype + 6, "blockdevice"))
+	  icon = new fltk3::FileIcon("*", fltk3::FileIcon::DEVICE);
+	else if (!strcmp(mimetype + 6, "fifo"))
+	  icon = new fltk3::FileIcon("*", fltk3::FileIcon::FIFO);
+	else return;
+      } else {
+        icon = new fltk3::FileIcon(kde_to_fltk_pattern(pattern),
+                                fltk3::FileIcon::PLAIN);
+      }
+
+      icon->load(full_iconfilename);
+    }
+  }
+}
+
+
+//
+// 'kde_to_fltk_pattern()' - Convert a KDE pattern to a FLTK pattern.
+//
+
+static char *
+kde_to_fltk_pattern(const char *kdepattern) {
+  char	*pattern,
+	*patptr;
+
+
+  pattern = (char *)malloc(strlen(kdepattern) + 3);
+  strcpy(pattern, "{");
+  strcpy(pattern + 1, kdepattern);
+
+  if (pattern[strlen(pattern) - 1] == ';') pattern[strlen(pattern) - 1] = '\0';
+
+  strcat(pattern, "}");
+
+  for (patptr = pattern; *patptr; patptr ++) {
+    if (*patptr == ';') *patptr = '|';
+  }
+
+  return (pattern);
+}
+
+
+//
+// 'get_kde_val()' - Get a KDE value.
+//
+
+static char *
+get_kde_val(char       *str,
+            const char *key) {
+  while (*str == *key) {
+    str ++;
+    key ++;
+  }
+
+  if (*key == '\0' && *str == '=') {
+    if (str[strlen(str) - 1] == '\n') str[strlen(str) - 1] = '\0';
+
+    return (str + 1);
+  }
+
+  return ((char *)0);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/GIFImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_GIF_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/GIFImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/GIFImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,390 @@
+//
+// "$Id$"
+//
+// fltk3::GIFImage routines.
+//
+// Copyright 1997-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3images/GIFImage.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "../fltk3/flstring.h"
+
+// Read a .gif file and convert it to a "xpm" format (actually my
+// modified one with compressed colormaps).
+
+// Extensively modified from original code for gif2ras by
+// Patrick J. Naughton of Sun Microsystems.  The original
+// copyright notice follows:
+
+/* gif2ras.c - Converts from a Compuserve GIF (tm) image to a Sun Raster image.
+ *
+ * Copyright (c) 1988 by Patrick J. Naughton
+ *
+ * Author: Patrick J. Naughton
+ * naughton@wind.sun.com
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation.
+ *
+ * This file is provided AS IS with no warranties of any kind.  The author
+ * shall have no liability with respect to the infringement of copyrights,
+ * trade secrets or any patents by this file or any part thereof.  In no
+ * event will the author be liable for any lost revenue or profits or
+ * other special, indirect and consequential damages.
+ *
+ * Comments and additions should be sent to the author:
+ *
+ *                     Patrick J. Naughton
+ *                     Sun Microsystems, Inc.
+ *                     2550 Garcia Ave, MS 14-40
+ *                     Mountain View, CA 94043
+ *                     (415) 336-1080
+ */
+
+typedef unsigned char uchar;
+
+#define NEXTBYTE (uchar)getc(GifFile)
+#define GETSHORT(var) var = NEXTBYTE; var += NEXTBYTE << 8
+
+/**  
+  The constructor loads the named GIF image.
+  <P>The inherited destructor free all memory and server resources that are used by
+  the image.
+*/
+fltk3::GIFImage::GIFImage(const char *infname) : fltk3::Pixmap((char *const*)0) {
+  FILE *GifFile;	// File to read
+  char **new_data;	// Data array
+
+  if ((GifFile = fltk3::fopen(infname, "rb")) == NULL) {
+    fltk3::error("fltk3::GIFImage: Unable to open %s!", infname);
+    return;
+  }
+
+  {char b[6];
+  if (fread(b,1,6,GifFile)<6) {
+    fclose(GifFile);
+    return; /* quit on eof */
+  }
+  if (b[0]!='G' || b[1]!='I' || b[2] != 'F') {
+    fclose(GifFile);
+    fltk3::error("fltk3::GIFImage: %s is not a GIF file.\n", infname);
+    return;
+  }
+  if (b[3]!='8' || b[4]>'9' || b[5]!= 'a')
+    fltk3::warning("%s is version %c%c%c.",infname,b[3],b[4],b[5]);
+  }
+
+  int Width; GETSHORT(Width);
+  int Height; GETSHORT(Height);
+
+  uchar ch = NEXTBYTE;
+  char HasColormap = ((ch & 0x80) != 0);
+  int BitsPerPixel = (ch & 7) + 1;
+  int ColorMapSize = 1 << BitsPerPixel;
+  // int OriginalResolution = ((ch>>4)&7)+1;
+  // int SortedTable = (ch&8)!=0;
+  ch = NEXTBYTE; // Background Color index
+  ch = NEXTBYTE; // Aspect ratio is N/64
+
+  // Read in global colormap:
+  uchar transparent_pixel = 0;
+  char has_transparent = 0;
+  uchar Red[256], Green[256], Blue[256]; /* color map */
+  if (HasColormap) {
+    for (int i=0; i < ColorMapSize; i++) {	
+      Red[i] = NEXTBYTE;
+      Green[i] = NEXTBYTE;
+      Blue[i] = NEXTBYTE;
+    }
+  } else {
+    fltk3::warning("%s does not have a colormap.", infname);
+    for (int i = 0; i < ColorMapSize; i++)
+      Red[i] = Green[i] = Blue[i] = (uchar)(255 * i / (ColorMapSize-1));
+  }
+
+  int CodeSize;		/* Code size, init from GIF header, increases... */
+  char Interlace;
+
+  for (;;) {
+
+    int i = NEXTBYTE;
+    if (i<0) {
+      fclose(GifFile);
+      fltk3::error("fltk3::GIFImage: %s - unexpected EOF",infname); 
+      return;
+    }
+    int blocklen;
+
+    //  if (i == 0x3B) return 0;  eof code
+
+    if (i == 0x21) {		// a "gif extension"
+
+      ch = NEXTBYTE;
+      blocklen = NEXTBYTE;
+
+      if (ch==0xF9 && blocklen==4) { // Netscape animation extension
+
+	char bits;
+	bits = NEXTBYTE;
+	getc(GifFile); getc(GifFile); // GETSHORT(delay);
+	transparent_pixel = NEXTBYTE;
+	if (bits & 1) has_transparent = 1;
+	blocklen = NEXTBYTE;
+
+      } else if (ch == 0xFF) { // Netscape repeat count
+	;
+
+      } else if (ch != 0xFE) { //Gif Comment
+	fltk3::warning("%s: unknown gif extension 0x%02x.", infname, ch);
+      }
+    } else if (i == 0x2c) {	// an image
+
+      ch = NEXTBYTE; ch = NEXTBYTE; // GETSHORT(x_position);
+      ch = NEXTBYTE; ch = NEXTBYTE; // GETSHORT(y_position);
+      GETSHORT(Width);
+      GETSHORT(Height);
+      ch = NEXTBYTE;
+      Interlace = ((ch & 0x40) != 0);
+      if (ch&0x80) { 
+	// read local color map
+	int n = 2<<(ch&7);
+	for (i=0; i < n; i++) {	
+	  Red[i] = NEXTBYTE;
+	  Green[i] = NEXTBYTE;
+	  Blue[i] = NEXTBYTE;
+	}
+      }
+      CodeSize = NEXTBYTE+1;
+      break; // okay, this is the image we want
+    } else {
+      fltk3::warning("%s: unknown gif code 0x%02x", infname, i);
+      blocklen = 0;
+    }
+
+    // skip the data:
+    while (blocklen>0) {while (blocklen--) {ch = NEXTBYTE;} blocklen=NEXTBYTE;}
+  }
+
+  if (BitsPerPixel >= CodeSize)
+  {
+    // Workaround for broken GIF files...
+    BitsPerPixel = CodeSize - 1;
+    ColorMapSize = 1 << BitsPerPixel;
+  }
+
+  uchar *Image = new uchar[Width*Height];
+
+  int YC = 0, Pass = 0; /* Used to de-interlace the picture */
+  uchar *p = Image;
+  uchar *eol = p+Width;
+
+  int InitCodeSize = CodeSize;
+  int ClearCode = (1 << (CodeSize-1));
+  int EOFCode = ClearCode + 1;
+  int FirstFree = ClearCode + 2;
+  int FinChar = 0;
+  int ReadMask = (1<<CodeSize) - 1;
+  int FreeCode = FirstFree;
+  int OldCode = ClearCode;
+
+  // tables used by LZW decompresser:
+  short int Prefix[4096];
+  uchar Suffix[4096];
+
+  int blocklen = NEXTBYTE;
+  uchar thisbyte = NEXTBYTE; blocklen--;
+  int frombit = 0;
+
+  for (;;) {
+
+/* Fetch the next code from the raster data stream.  The codes can be
+ * any length from 3 to 12 bits, packed into 8-bit bytes, so we have to
+ * maintain our location as a pointer and a bit offset.
+ * In addition, gif adds totally useless and annoying block counts
+ * that must be correctly skipped over. */
+    int CurCode = thisbyte;
+    if (frombit+CodeSize > 7) {
+      if (blocklen <= 0) {
+	blocklen = NEXTBYTE;
+	if (blocklen <= 0) break;
+      }
+      thisbyte = NEXTBYTE; blocklen--;
+      CurCode |= thisbyte<<8;
+    }
+    if (frombit+CodeSize > 15) {
+      if (blocklen <= 0) {
+	blocklen = NEXTBYTE;
+	if (blocklen <= 0) break;
+      }
+      thisbyte = NEXTBYTE; blocklen--;
+      CurCode |= thisbyte<<16;
+    }
+    CurCode = (CurCode>>frombit)&ReadMask;
+    frombit = (frombit+CodeSize)%8;
+
+    if (CurCode == ClearCode) {
+      CodeSize = InitCodeSize;
+      ReadMask = (1<<CodeSize) - 1;
+      FreeCode = FirstFree;
+      OldCode = ClearCode;
+      continue;
+    }
+
+    if (CurCode == EOFCode) break;
+
+    uchar OutCode[1025]; // temporary array for reversing codes
+    uchar *tp = OutCode;
+    int i;
+    if (CurCode < FreeCode) i = CurCode;
+    else if (CurCode == FreeCode) {*tp++ = (uchar)FinChar; i = OldCode;}
+    else {fltk3::error("fltk3::GIFImage: %s - LZW Barf!", infname); break;}
+
+    while (i >= ColorMapSize) {*tp++ = Suffix[i]; i = Prefix[i];}
+    *tp++ = FinChar = i;
+    do {
+      *p++ = *--tp;
+      if (p >= eol) {
+	if (!Interlace) YC++;
+	else switch (Pass) {
+	case 0: YC += 8; if (YC >= Height) {Pass++; YC = 4;} break;
+	case 1: YC += 8; if (YC >= Height) {Pass++; YC = 2;} break;
+	case 2: YC += 4; if (YC >= Height) {Pass++; YC = 1;} break;
+	case 3: YC += 2; break;
+	}
+	if (YC>=Height) YC=0; /* cheap bug fix when excess data */
+	p = Image + YC*Width;
+	eol = p+Width;
+      }
+    } while (tp > OutCode);
+
+    if (OldCode != ClearCode) {
+      Prefix[FreeCode] = (short)OldCode;
+      Suffix[FreeCode] = FinChar;
+      FreeCode++;
+      if (FreeCode > ReadMask) {
+	if (CodeSize < 12) {
+	  CodeSize++;
+	  ReadMask = (1 << CodeSize) - 1;
+	}
+	else FreeCode--;
+      }
+    }
+    OldCode = CurCode;
+  }
+
+  // We are done reading the file, now convert to xpm:
+
+  // allocate line pointer arrays:
+  w(Width);
+  h(Height);
+  d(1);
+  new_data = new char*[Height+2];
+
+  // transparent pixel must be zero, swap if it isn't:
+  if (has_transparent && transparent_pixel != 0) {
+    // swap transparent pixel with zero
+    p = Image+Width*Height;
+    while (p-- > Image) {
+      if (*p==transparent_pixel) *p = 0;
+      else if (!*p) *p = transparent_pixel;
+    }
+    uchar t;
+    t                        = Red[0];
+    Red[0]                   = Red[transparent_pixel];
+    Red[transparent_pixel]   = t;
+
+    t                        = Green[0];
+    Green[0]                 = Green[transparent_pixel];
+    Green[transparent_pixel] = t;
+
+    t                        = Blue[0];
+    Blue[0]                  = Blue[transparent_pixel];
+    Blue[transparent_pixel]  = t;
+  }
+
+  // find out what colors are actually used:
+  uchar used[256]; uchar remap[256];
+  int i;
+  for (i = 0; i < ColorMapSize; i++) used[i] = 0;
+  p = Image+Width*Height;
+  while (p-- > Image) used[*p] = 1;
+
+  // remap them to start with printing characters:
+  int base = has_transparent && used[0] ? ' ' : ' '+1;
+  int numcolors = 0;
+  for (i = 0; i < ColorMapSize; i++) if (used[i]) {
+    remap[i] = (uchar)(base++);
+    numcolors++;
+  }
+
+  // write the first line of xpm data (use suffix as temp array):
+  int length = sprintf((char*)(Suffix),
+		       "%d %d %d %d",Width,Height,-numcolors,1);
+  new_data[0] = new char[length+1];
+  strcpy(new_data[0], (char*)Suffix);
+
+  // write the colormap
+  new_data[1] = (char*)(p = new uchar[4*numcolors]);
+  for (i = 0; i < ColorMapSize; i++) if (used[i]) {
+    *p++ = remap[i];
+    *p++ = Red[i];
+    *p++ = Green[i];
+    *p++ = Blue[i];
+  }
+
+  // remap the image data:
+  p = Image+Width*Height;
+  while (p-- > Image) *p = remap[*p];
+
+  // split the image data into lines:
+  for (i=0; i<Height; i++) {
+    new_data[i+2] = new char[Width+1];
+    memcpy(new_data[i + 2], (char*)(Image + i*Width), Width);
+    new_data[i + 2][Width] = 0;
+  }
+
+  data((const char **)new_data, Height + 2);
+  alloc_data = 1;
+
+  delete[] Image;
+
+  fclose(GifFile);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/HelpDialog.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Help_Dialog.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/HelpDialog.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/HelpDialog.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,301 @@
+//
+// "$Id$"
+//
+// fltk3::HelpDialog dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// generated by Fast Light User Interface Designer (fluid) version 1.0108
+
+#include <fltk3images/HelpDialog.h>
+#include "../fltk3/flstring.h"
+#include <fltk3/ask.h>
+
+void fltk3::HelpDialog::cb_back__i(fltk3::Button*, void*) {
+  if (index_ > 0)
+  index_ --;
+
+if (index_ == 0)
+  back_->deactivate();
+
+forward_->activate();
+
+int l = line_[index_];
+
+if (strcmp(view_->filename(), file_[index_]) != 0)
+  view_->load(file_[index_]);
+
+view_->topline(l);
+}
+void fltk3::HelpDialog::cb_back_(fltk3::Button* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_back__i(o,v);
+}
+
+void fltk3::HelpDialog::cb_forward__i(fltk3::Button*, void*) {
+  if (index_ < max_)
+  index_ ++;
+
+if (index_ >= max_)
+  forward_->deactivate();
+
+back_->activate();
+
+int l = view_->topline();
+
+if (strcmp(view_->filename(), file_[index_]) != 0)
+  view_->load(file_[index_]);
+
+view_->topline(l);
+}
+void fltk3::HelpDialog::cb_forward_(fltk3::Button* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_forward__i(o,v);
+}
+
+void fltk3::HelpDialog::cb_smaller__i(fltk3::Button*, void*) {
+  if (view_->textsize() > 8)
+  view_->textsize(view_->textsize() - 2);
+
+if (view_->textsize() <= 8)
+  smaller_->deactivate();
+larger_->activate();
+}
+void fltk3::HelpDialog::cb_smaller_(fltk3::Button* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_smaller__i(o,v);
+}
+
+void fltk3::HelpDialog::cb_larger__i(fltk3::Button*, void*) {
+  if (view_->textsize() < 18)
+  view_->textsize(view_->textsize() + 2);
+
+if (view_->textsize() >= 18)
+  larger_->deactivate();
+smaller_->activate();
+}
+void fltk3::HelpDialog::cb_larger_(fltk3::Button* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->parent()->user_data()))->cb_larger__i(o,v);
+}
+
+void fltk3::HelpDialog::cb_find__i(fltk3::Input*, void*) {
+  find_pos_ = view_->find(find_->value(), find_pos_);
+}
+void fltk3::HelpDialog::cb_find_(fltk3::Input* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->parent()->parent()->user_data()))->cb_find__i(o,v);
+}
+
+void fltk3::HelpDialog::cb_view__i(fltk3::HelpView*, void*) {
+  if (view_->filename())
+{
+  if (view_->changed())
+  {
+    index_ ++;
+
+    if (index_ >= 100)
+    {
+      memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
+      memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
+      index_ -= 10;
+    }
+
+    max_ = index_;
+
+    strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
+    line_[index_] = view_->topline();
+
+    if (index_ > 0)
+      back_->activate();
+    else
+      back_->deactivate();
+
+    forward_->deactivate();
+    window_->label(view_->title());
+  }
+  else // if ! view_->changed()
+  {
+    strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
+    line_[index_] = view_->topline();
+  }
+} else { // if ! view_->filename()
+  index_ = 0; // hitting an internal page will disable the back/fwd buffer
+  file_[index_][0] = 0; // unnamed internal page
+  line_[index_] = view_->topline();
+  back_->deactivate();
+  forward_->deactivate();
+};
+}
+void fltk3::HelpDialog::cb_view_(fltk3::HelpView* o, void* v) {
+  ((fltk3::HelpDialog*)(o->parent()->user_data()))->cb_view__i(o,v);
+}
+
+fltk3::HelpDialog::HelpDialog() {
+  { window_ = new fltk3::DoubleWindow(530, 385, "Help Dialog");
+    window_->user_data((void*)(this));
+    { fltk3::Group* o = new fltk3::Group(10, 10, 511, 25);
+      { back_ = new fltk3::Button(10, 10, 25, 25, "@<-");
+        back_->tooltip("Show the previous help page.");
+        back_->shortcut(0xff51);
+        back_->labelcolor((fltk3::Color)2);
+        back_->callback((fltk3::Callback*)cb_back_);
+      } // fltk3::Button* back_
+      { forward_ = new fltk3::Button(45, 10, 25, 25, "@->");
+        forward_->tooltip("Show the next help page.");
+        forward_->shortcut(0xff53);
+        forward_->labelcolor((fltk3::Color)2);
+        forward_->callback((fltk3::Callback*)cb_forward_);
+      } // fltk3::Button* forward_
+      { smaller_ = new fltk3::Button(80, 10, 25, 25, "F");
+        smaller_->tooltip("Make the help text smaller.");
+        smaller_->labelfont(1);
+        smaller_->labelsize(10);
+        smaller_->callback((fltk3::Callback*)cb_smaller_);
+      } // fltk3::Button* smaller_
+      { larger_ = new fltk3::Button(115, 10, 25, 25, "F");
+        larger_->tooltip("Make the help text larger.");
+        larger_->labelfont(1);
+        larger_->labelsize(16);
+        larger_->callback((fltk3::Callback*)cb_larger_);
+      } // fltk3::Button* larger_
+      { fltk3::Group* o = new fltk3::Group(350, 10, 171, 25);
+        o->box(fltk3::DOWN_BOX);
+        o->color(fltk3::BACKGROUND2_COLOR);
+        { find_ = new fltk3::Input(375, 12, 143, 21, "@search");
+          find_->tooltip("find text in document");
+          find_->box(fltk3::FLAT_BOX);
+          find_->labelsize(13);
+          find_->textfont(4);
+          find_->callback((fltk3::Callback*)cb_find_);
+          find_->when(fltk3::WHEN_ENTER_KEY_ALWAYS);
+        } // fltk3::Input* find_
+        o->end();
+      } // fltk3::Group* o
+      { fltk3::Box* o = new fltk3::Box(150, 10, 190, 25);
+        fltk3::Group::current()->resizable(o);
+      } // fltk3::Box* o
+      o->end();
+    } // fltk3::Group* o
+    { view_ = new fltk3::HelpView(10, 45, 510, 330);
+      view_->box(fltk3::DOWN_BOX);
+      view_->callback((fltk3::Callback*)cb_view_);
+      fltk3::Group::current()->resizable(view_);
+    } // fltk3::HelpView* view_
+    window_->size_range(260, 150);
+    window_->end();
+  } // fltk3::DoubleWindow* window_
+  back_->deactivate();
+forward_->deactivate();
+
+index_    = -1;
+max_      = 0;
+find_pos_ = 0;
+
+fltk3::register_images();
+}
+
+fltk3::HelpDialog::~HelpDialog() {
+  delete window_;
+}
+
+int fltk3::HelpDialog::h() {
+  return (window_->h());
+}
+
+void fltk3::HelpDialog::hide() {
+  window_->hide();
+}
+
+void fltk3::HelpDialog::load(const char *f) {
+  view_->set_changed();
+view_->load(f);
+window_->label(view_->title());
+}
+
+void fltk3::HelpDialog::position(int xx, int yy) {
+  window_->position(xx, yy);
+}
+
+void fltk3::HelpDialog::resize(int xx, int yy, int ww, int hh) {
+  window_->resize(xx, yy, ww, hh);
+}
+
+void fltk3::HelpDialog::show() {
+  window_->show();
+}
+
+void fltk3::HelpDialog::show(int argc, char **argv) {
+  window_->show(argc, argv);
+}
+
+void fltk3::HelpDialog::textsize(fltk3::Fontsize s) {
+  view_->textsize(s);
+
+if (s <= 8)
+  smaller_->deactivate();
+else
+  smaller_->activate();
+
+if (s >= 18)
+  larger_->deactivate();
+else
+  larger_->activate();
+}
+
+fltk3::Fontsize fltk3::HelpDialog::textsize() {
+  return (view_->textsize());
+}
+
+void fltk3::HelpDialog::topline(const char *n) {
+  view_->topline(n);
+}
+
+void fltk3::HelpDialog::topline(int n) {
+  view_->topline(n);
+}
+
+void fltk3::HelpDialog::value(const char *f) {
+  view_->set_changed();
+view_->value(f);
+window_->label(view_->title());
+}
+
+const char * fltk3::HelpDialog::value() const {
+  return view_->value();
+}
+
+int fltk3::HelpDialog::visible() {
+  return (window_->visible());
+}
+
+int fltk3::HelpDialog::w() {
+  return (window_->w());
+}
+
+int fltk3::HelpDialog::x() {
+  return (window_->x());
+}
+
+int fltk3::HelpDialog::y() {
+  return (window_->y());
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/HelpDialog.fl (from rev 9002, branches/branch-3.0/src/core/Fl_Help_Dialog.fl)
===================================================================
--- branches/branch-3.0/src/fltk3images/HelpDialog.fl	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/HelpDialog.fl	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,265 @@
+# data file for the Fltk User Interface Designer (fluid)
+version 1.0108 
+header_name {../FL/Fl_Help_Dialog.H} 
+code_name {.cxx}
+comment {//
+// "$Id$"
+//
+// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+} {in_source in_header
+} 
+
+decl {\#include "flstring.h"} {} 
+
+decl {\#include <FL/fl_ask.H>} {} 
+
+class FL_EXPORT Fl_Help_Dialog {open
+} {
+  decl {int index_;} {}
+  decl {int max_;} {}
+  decl {int line_[100];} {}
+  decl {char file_[100][256];} {}
+  decl {int find_pos_;} {}
+  Function {Fl_Help_Dialog()} {open
+  } {
+    Fl_Window window_ {
+      label {Help Dialog} open
+      private xywh {398 64 530 385} type Double resizable size_range {260 150 0 0} visible
+    } {
+      Fl_Group {} {open selected
+        xywh {10 10 511 25}
+      } {
+        Fl_Button back_ {
+          label {@<-}
+          callback {if (index_ > 0)
+  index_ --;
+
+if (index_ == 0)
+  back_->deactivate();
+
+forward_->activate();
+
+int l = line_[index_];
+
+if (strcmp(view_->filename(), file_[index_]) != 0)
+  view_->load(file_[index_]);
+
+view_->topline(l);}
+          private tooltip {Show the previous help page.} xywh {10 10 25 25} shortcut 0xff51 labelcolor 2
+        }
+        Fl_Button forward_ {
+          label {@->}
+          callback {if (index_ < max_)
+  index_ ++;
+
+if (index_ >= max_)
+  forward_->deactivate();
+
+back_->activate();
+
+int l = view_->topline();
+
+if (strcmp(view_->filename(), file_[index_]) != 0)
+  view_->load(file_[index_]);
+
+view_->topline(l);}
+          private tooltip {Show the next help page.} xywh {45 10 25 25} shortcut 0xff53 labelcolor 2
+        }
+        Fl_Button smaller_ {
+          label F
+          callback {if (view_->textsize() > 8)
+  view_->textsize(view_->textsize() - 2);
+
+if (view_->textsize() <= 8)
+  smaller_->deactivate();
+larger_->activate();}
+          private tooltip {Make the help text smaller.} xywh {80 10 25 25} labelfont 1 labelsize 10
+        }
+        Fl_Button larger_ {
+          label F
+          callback {if (view_->textsize() < 18)
+  view_->textsize(view_->textsize() + 2);
+
+if (view_->textsize() >= 18)
+  larger_->deactivate();
+smaller_->activate();}
+          private tooltip {Make the help text larger.} xywh {115 10 25 25} labelfont 1 labelsize 16
+        }
+        Fl_Group {} {open
+          xywh {350 10 171 25} box DOWN_BOX color 7
+        } {
+          Fl_Input find_ {
+            label {@search}
+            callback {find_pos_ = view_->find(find_->value(), find_pos_);}
+            private tooltip {find text in document} xywh {375 12 143 21} box FLAT_BOX labelsize 13 when 10 textfont 4
+          }
+        }
+        Fl_Box {} {
+          xywh {150 10 190 25} resizable
+        }
+      }
+      Fl_Help_View view_ {
+        callback {if (view_->filename())
+{
+  if (view_->changed())
+  {
+    index_ ++;
+
+    if (index_ >= 100)
+    {
+      memmove(line_, line_ + 10, sizeof(line_[0]) * 90);
+      memmove(file_, file_ + 10, sizeof(file_[0]) * 90);
+      index_ -= 10;
+    }
+
+    max_ = index_;
+
+    strlcpy(file_[index_], view_->filename(),sizeof(file_[0]));
+    line_[index_] = view_->topline();
+
+    if (index_ > 0)
+      back_->activate();
+    else
+      back_->deactivate();
+
+    forward_->deactivate();
+    window_->label(view_->title());
+  }
+  else // if ! view_->changed()
+  {
+    strlcpy(file_[index_], view_->filename(), sizeof(file_[0]));
+    line_[index_] = view_->topline();
+  }
+} else { // if ! view_->filename()
+  index_ = 0; // hitting an internal page will disable the back/fwd buffer
+  file_[index_][0] = 0; // unnamed internal page
+  line_[index_] = view_->topline();
+  back_->deactivate();
+  forward_->deactivate();
+}}
+        private xywh {10 45 510 330} box DOWN_BOX resizable
+      }
+    }
+    code {back_->deactivate();
+forward_->deactivate();
+
+index_    = -1;
+max_      = 0;
+find_pos_ = 0;
+
+fl_register_images();} {}
+  }
+  Function {~Fl_Help_Dialog()} {} {
+    code {delete window_;} {}
+  }
+  Function {h()} {return_type int
+  } {
+    code {return (window_->h());} {}
+  }
+  Function {hide()} {return_type void
+  } {
+    code {window_->hide();} {}
+  }
+  Function {load(const char *f)} {return_type void
+  } {
+    code {view_->set_changed();
+view_->load(f);
+window_->label(view_->title());} {}
+  }
+  Function {position(int xx, int yy)} {return_type void
+  } {
+    code {window_->position(xx, yy);} {}
+  }
+  Function {resize(int xx, int yy, int ww, int hh)} {return_type void
+  } {
+    code {window_->resize(xx, yy, ww, hh);} {}
+  }
+  Function {show()} {return_type void
+  } {
+    code {window_->show();} {}
+  }
+  Function {show(int argc, char **argv)} {return_type void
+  } {
+    code {window_->show(argc, argv);} {}
+  }
+  Function {textsize(Fl_Fontsize s)} {return_type void
+  } {
+    code {view_->textsize(s);
+
+if (s <= 8)
+  smaller_->deactivate();
+else
+  smaller_->activate();
+
+if (s >= 18)
+  larger_->deactivate();
+else
+  larger_->activate();} {}
+  }
+  Function {textsize()} {return_type Fl_Fontsize
+  } {
+    code {return (view_->textsize());} {}
+  }
+  Function {topline(const char *n)} {return_type void
+  } {
+    code {view_->topline(n);} {}
+  }
+  Function {topline(int n)} {return_type void
+  } {
+    code {view_->topline(n);} {}
+  }
+  Function {value(const char *f)} {return_type void
+  } {
+    code {view_->set_changed();
+view_->value(f);
+window_->label(view_->title());} {}
+  }
+  Function {value() const} {return_type {const char *}
+  } {
+    code {return view_->value();} {}
+  }
+  Function {visible()} {return_type int
+  } {
+    code {return (window_->visible());} {}
+  }
+  Function {w()} {return_type int
+  } {
+    code {return (window_->w());} {}
+  }
+  Function {x()} {return_type int
+  } {
+    code {return (window_->x());} {}
+  }
+  Function {y()} {return_type int
+  } {
+    code {return (window_->y());} {}
+  }
+} 
+
+comment {
+//
+// End of "$Id$".
+//} {in_source in_header
+} 

Copied: branches/branch-3.0/src/fltk3images/HelpDialogDox.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_Help_Dialog_Dox.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/HelpDialogDox.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/HelpDialogDox.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,120 @@
+//
+// "$Id$"
+//
+// fltk3::HelpDialog dialog for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2010 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+
+// fltk3::HelpDialog (autogenerated class) doxygen documentation placeholder
+
+/** \class fltk3::HelpDialog
+  The fltk3::HelpDialog widget displays a standard help dialog window
+  using the fltk3::HelpView widget.
+  
+  <P ALIGN=CENTER> \image html fltk3::HelpDialog.png </P> 
+  \image latex  fltk3::HelpDialog.png "fltk3::HelpDialog" width=8cm
+*/
+
+/** \fn fltk3::HelpDialog::fltk3::HelpDialog()
+  The constructor creates the dialog pictured above.*/
+
+/** \fn fltk3::HelpDialog::~Fl_Help_Dialog()
+  The destructor destroys the widget and frees all memory that has been
+  allocated for the current file.
+*/
+
+/** \fn void fltk3::HelpDialog::hide()
+  Hides the fltk3::HelpDialog window.*/
+
+/** \fn void fltk3::HelpDialog::load(const char *f)
+  Loads the specified HTML file into the fltk3::HelpView widget.
+  The filename can also contain a target name ("filename.html#target").
+*/
+
+/** \fn void fltk3::HelpDialog::position(int x, int y)
+  Set the screen position of the dialog.*/
+
+/** \fn void fltk3::HelpDialog::resize(int xx, int yy, int ww, int hh)
+  Change the position and size of the dialog.*/
+
+/** \fn void fltk3::HelpDialog::show()
+  Shows the fltk3::HelpDialog window.*/
+
+/** \fn void fltk3::HelpDialog::textsize(fltk3::Fontsize s)
+  Sets or gets the default text size for the help view.*/
+
+/** \fn uchar fltk3::HelpDialog::textsize()
+  Sets or gets the default text size for the help view.*/
+
+/** \fn void fltk3::HelpDialog::topline(const char *n)
+  Sets the top line in the fltk3::HelpView widget to the named or
+  numbered line.
+*/
+
+/** \fn void fltk3::HelpDialog::topline(int n)
+  Sets the top line in the fltk3::HelpView widget to the named or
+  numbered line.
+*/
+
+/** \fn void fltk3::HelpDialog::value(const char *v)
+  The first form sets the current buffer to the string provided and
+  reformats the text. It also clears the history of the "back" and
+  "forward" buttons. The second form returns the current buffer contents.
+*/
+
+/** \fn const char *fltk3::HelpDialog::value() const
+  The first form sets the current buffer to the string provided and
+  reformats the text. It also clears the history of the "back" and
+  "forward" buttons. The second form returns the current buffer contents.
+*/
+
+/** \fn int fltk3::HelpDialog::visible()
+  Returns 1 if the fltk3::HelpDialog window is visible.*/
+
+/** \fn int fltk3::HelpDialog::x()
+  Returns the position and size of the help dialog.*/
+
+/** \fn int fltk3::HelpDialog::y()
+  Returns the position and size of the help dialog.*/
+
+/** \fn int fltk3::HelpDialog::w()
+  Returns the position and size of the help dialog.*/
+
+/** \fn int fltk3::HelpDialog::h()
+  Returns the position and size of the help dialog.*/
+
+/** \fn void fltk3::HelpDialog::show()
+  Shows the main Help Dialog Window
+  Delegates call to encapsulated window_ void fltk3::Window::show() method */
+
+/** \fn void fltk3::HelpDialog::show(int argc, char **argv)
+  Shows the main Help Dialog Window
+  Delegates call to encapsulated window_ void fltk3::Window::show(int argc, char **argv) instance method */
+
+/** \fn void fltk3::HelpDialog::textsize(fltk3::Fontsize s)
+  Sets the internal fltk3::HelpView instance text size.
+  Delegates call to encapsulated view_ void fltk3::HelpView::textsize(fltk3::Fontsize s) instance method */
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/JPEGImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_JPEG_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/JPEGImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/JPEGImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,381 @@
+//
+// "$Id$"
+//
+// fltk3::JPEGImage routines.
+//
+// Copyright 1997-2011 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::JPEGImage::fltk3::JPEGImage() - Load a JPEG image file.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3images/JPEGImage.h>
+#include <fltk3/SharedImage.h>
+#include <fltk3/utf8.h>
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+
+
+// Some releases of the Cygwin JPEG libraries don't have a correctly
+// updated header file for the INT32 data type; the following define
+// from Shane Hill seems to be a usable workaround...
+
+#if defined(WIN32) && defined(__CYGWIN__)
+#  define XMD_H
+#endif // WIN32 && __CYGWIN__
+
+
+extern "C"
+{
+#ifdef HAVE_LIBJPEG
+#  include <jpeglib.h>
+#endif // HAVE_LIBJPEG
+}
+
+
+//
+// Custom JPEG error handling structure...
+//
+
+#ifdef HAVE_LIBJPEG
+struct fl_jpeg_error_mgr {
+  jpeg_error_mgr	pub_;		// Destination manager...
+  jmp_buf		errhand_;	// Error handler
+};
+#endif // HAVE_LIBJPEG
+
+
+//
+// Error handler for JPEG files...
+//
+
+#ifdef HAVE_LIBJPEG
+extern "C" {
+  static void
+  fl_jpeg_error_handler(j_common_ptr dinfo) {	// I - Decompressor info
+    longjmp(((fl_jpeg_error_mgr *)(dinfo->err))->errhand_, 1);
+  }
+
+  static void
+  fl_jpeg_output_handler(j_common_ptr) {	// I - Decompressor info (not used)
+  }
+}
+#endif // HAVE_LIBJPEG
+
+
+/**
+ \brief The constructor loads the JPEG image from the given jpeg filename.
+ 
+ The inherited destructor frees all memory and server resources that are used 
+ by the image.
+ 
+ There is no error function in this class. If the image has loaded correctly, 
+ w(), h(), and d() should return values greater zero.
+ 
+ \param[in] filename a full path and name pointing to a valid jpeg file.
+ */
+fltk3::JPEGImage::JPEGImage(const char *filename)	// I - File to load
+: fltk3::RGBImage(0,0,0) {
+#ifdef HAVE_LIBJPEG
+  FILE				*fp;	// File pointer
+  jpeg_decompress_struct	dinfo;	// Decompressor info
+  fl_jpeg_error_mgr		jerr;	// Error handler info
+  JSAMPROW			row;	// Sample row pointer
+  
+  // the following variables are pointers allocating some private space that
+  // is not reset by 'setjmp()'
+  char* max_finish_decompress_err;      // count errors and give up afer a while
+  char* max_destroy_decompress_err;     // to avoid recusion and deadlock
+  
+  // Clear data...
+  alloc_array = 0;
+  array = (uchar *)0;
+  
+  // Open the image file...
+  if ((fp = fltk3::fopen(filename, "rb")) == NULL) return;
+  
+  // Setup the decompressor info and read the header...
+  dinfo.err                = jpeg_std_error((jpeg_error_mgr *)&jerr);
+  jerr.pub_.error_exit     = fl_jpeg_error_handler;
+  jerr.pub_.output_message = fl_jpeg_output_handler;
+  
+  // Setup error loop variables
+  max_finish_decompress_err = (char*)malloc(1);   // allocate space on the frame for error counters
+  max_destroy_decompress_err = (char*)malloc(1);  // otherwise, the variables are reset on the longjmp
+  *max_finish_decompress_err=10;
+  *max_destroy_decompress_err=10;
+  
+  if (setjmp(jerr.errhand_))
+  {
+    // JPEG error handling...
+    // if any of the cleanup routines hits another error, we would end up 
+    // in a loop. So instead, we decrement max_err for some upper cleanup limit.
+    if ( ((*max_finish_decompress_err)-- > 0) && array)
+      jpeg_finish_decompress(&dinfo);
+    if ( (*max_destroy_decompress_err)-- > 0)
+      jpeg_destroy_decompress(&dinfo);
+    
+    fclose(fp);
+    
+    w(0);
+    h(0);
+    d(0);
+    
+    if (array) {
+      delete[] (uchar *)array;
+      array = 0;
+      alloc_array = 0;
+    }
+    
+    free(max_destroy_decompress_err);
+    free(max_finish_decompress_err);
+    
+    return;
+  }
+  
+  jpeg_create_decompress(&dinfo);
+  jpeg_stdio_src(&dinfo, fp);
+  jpeg_read_header(&dinfo, 1);
+  
+  dinfo.quantize_colors      = (boolean)FALSE;
+  dinfo.out_color_space      = JCS_RGB;
+  dinfo.out_color_components = 3;
+  dinfo.output_components    = 3;
+  
+  jpeg_calc_output_dimensions(&dinfo);
+  
+  w(dinfo.output_width); 
+  h(dinfo.output_height);
+  d(dinfo.output_components);
+  
+  array = new uchar[w() * h() * d()];
+  alloc_array = 1;
+  
+  jpeg_start_decompress(&dinfo);
+  
+  while (dinfo.output_scanline < dinfo.output_height) {
+    row = (JSAMPROW)(array +
+                     dinfo.output_scanline * dinfo.output_width *
+                     dinfo.output_components);
+    jpeg_read_scanlines(&dinfo, &row, (JDIMENSION)1);
+  }
+  
+  jpeg_finish_decompress(&dinfo);
+  jpeg_destroy_decompress(&dinfo);
+  
+  free(max_destroy_decompress_err);
+  free(max_finish_decompress_err);
+  
+  fclose(fp);
+#endif // HAVE_LIBJPEG
+}
+
+
+// data source manager for reading jpegs from memory
+// init_source (j_decompress_ptr cinfo)
+// fill_input_buffer (j_decompress_ptr cinfo)
+// skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+// resync_to_restart (j_decompress_ptr cinfo, int desired)
+// term_source (j_decompress_ptr cinfo)
+//         JOCTET * next_output_byte;  /* => next byte to write in buffer */
+//         size_t free_in_buffer;      /* # of byte spaces remaining in buffer */
+
+#ifdef HAVE_LIBJPEG
+typedef struct {
+  struct jpeg_source_mgr pub;
+  const unsigned char *data, *s;
+  // JOCTET * buffer;              /* start of buffer */
+  // boolean start_of_file;        /* have we gotten any data yet? */
+} my_source_mgr;
+
+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);
+    }
+    src->pub.next_input_byte += (size_t) num_bytes;
+    src->pub.bytes_in_buffer -= (size_t) num_bytes;
+  }
+}
+
+static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *data)
+{
+  my_src_ptr src;
+  cinfo->src = (struct jpeg_source_mgr *)malloc(sizeof(my_source_mgr));
+  src = (my_src_ptr)cinfo->src;
+  src->pub.init_source = init_source;
+  src->pub.fill_input_buffer = fill_input_buffer;
+  src->pub.skip_input_data = skip_input_data;
+  src->pub.resync_to_restart = jpeg_resync_to_restart;
+  src->pub.term_source = term_source;
+  src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
+  src->pub.next_input_byte = NULL; /* until buffer loaded */
+  src->data = data;
+  src->s = data;
+}
+#endif // HAVE_LIBJPEG
+
+
+/**
+ \brief The constructor loads the JPEG image from memory.
+
+ Construct an image from a block of memory inside the application. Fluid offers
+ "binary Data" chunks as a great way to add image data into the C++ source code.
+ name_png can be NULL. If a name is given, the image is added to the list of 
+ shared images (see: fltk3::SharedImage) and will be available by that name.
+
+ The inherited destructor frees all memory and server resources that are used 
+ by the image.
+
+ There is no error function in this class. If the image has loaded correctly, 
+ w(), h(), and d() should return values greater zero.
+
+ \param name A unique name or NULL
+ \param data A pointer to the memory location of the JPEG image
+ */
+fltk3::JPEGImage::JPEGImage(const char *name, const unsigned char *data)
+: fltk3::RGBImage(0,0,0) {
+#ifdef HAVE_LIBJPEG
+  jpeg_decompress_struct	dinfo;	// Decompressor info
+  fl_jpeg_error_mgr		jerr;	// Error handler info
+  JSAMPROW			row;	// Sample row pointer
+  
+  // the following variables are pointers allocating some private space that
+  // is not reset by 'setjmp()'
+  char* max_finish_decompress_err;      // count errors and give up afer a while
+  char* max_destroy_decompress_err;     // to avoid recusion and deadlock
+  
+  // Clear data...
+  alloc_array = 0;
+  array = (uchar *)0;
+  
+  // Setup the decompressor info and read the header...
+  dinfo.err                = jpeg_std_error((jpeg_error_mgr *)&jerr);
+  jerr.pub_.error_exit     = fl_jpeg_error_handler;
+  jerr.pub_.output_message = fl_jpeg_output_handler;
+  
+  // Setup error loop variables
+  max_finish_decompress_err = (char*)malloc(1);   // allocate space on the frame for error counters
+  max_destroy_decompress_err = (char*)malloc(1);  // otherwise, the variables are reset on the longjmp
+  *max_finish_decompress_err=10;
+  *max_destroy_decompress_err=10;
+  
+  if (setjmp(jerr.errhand_))
+  {
+    // JPEG error handling...
+    // if any of the cleanup routines hits another error, we would end up 
+    // in a loop. So instead, we decrement max_err for some upper cleanup limit.
+    if ( ((*max_finish_decompress_err)-- > 0) && array)
+      jpeg_finish_decompress(&dinfo);
+    if ( (*max_destroy_decompress_err)-- > 0)
+      jpeg_destroy_decompress(&dinfo);
+    
+    w(0);
+    h(0);
+    d(0);
+    
+    if (array) {
+      delete[] (uchar *)array;
+      array = 0;
+      alloc_array = 0;
+    }
+    
+    free(max_destroy_decompress_err);
+    free(max_finish_decompress_err);
+    
+    return;
+  }
+  
+  jpeg_create_decompress(&dinfo);
+  jpeg_mem_src(&dinfo, data);
+  jpeg_read_header(&dinfo, 1);
+  
+  dinfo.quantize_colors      = (boolean)FALSE;
+  dinfo.out_color_space      = JCS_RGB;
+  dinfo.out_color_components = 3;
+  dinfo.output_components    = 3;
+  
+  jpeg_calc_output_dimensions(&dinfo);
+  
+  w(dinfo.output_width); 
+  h(dinfo.output_height);
+  d(dinfo.output_components);
+  
+  array = new uchar[w() * h() * d()];
+  alloc_array = 1;
+  
+  jpeg_start_decompress(&dinfo);
+  
+  while (dinfo.output_scanline < dinfo.output_height) {
+    row = (JSAMPROW)(array +
+                     dinfo.output_scanline * dinfo.output_width *
+                     dinfo.output_components);
+    jpeg_read_scanlines(&dinfo, &row, (JDIMENSION)1);
+  }
+  
+  jpeg_finish_decompress(&dinfo);
+  jpeg_destroy_decompress(&dinfo);
+  
+  free(max_destroy_decompress_err);
+  free(max_finish_decompress_err);
+
+  if (w() && h() && name) {
+    fltk3::SharedImage *si = new fltk3::SharedImage(name, this);
+    si->add();
+  }
+#endif // HAVE_LIBJPEG
+}
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/PNGImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_PNG_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/PNGImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/PNGImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,233 @@
+//
+// "$Id$"
+//
+// fltk3::PNGImage routines.
+//
+// Copyright 1997-2011 by Easy Software Products.
+// Image support by Matthias Melcher, Copyright 2000-2009.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+
+//
+//   fltk3::PNGImage::fltk3::PNGImage() - Load a PNG image file.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3images/PNGImage.h>
+#include <fltk3/SharedImage.h>
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+
+#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
+extern "C"
+{
+#  include <zlib.h>
+#  ifdef HAVE_PNG_H
+#    include <png.h>
+#  else
+#    include <libpng/png.h>
+#  endif // HAVE_PNG_H
+}
+
+typedef struct  {
+  png_structp pp;
+  const unsigned char *current;
+  const unsigned char *last;
+} 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;
+  }
+  /* copy data from image buffer */
+  memcpy (data, png_mem_data->current, length);
+  /* advance in the memory data */
+  png_mem_data->current += length;
+}
+#endif // HAVE_LIBPNG && HAVE_LIBZ
+
+
+/**
+  The constructor loads the named PNG image from the given png filename.
+
+  The destructor frees all memory and server resources that are used by
+  the image.
+
+  \param[in] filename	Name of PNG file to read
+*/
+fltk3::PNGImage::PNGImage (const char *filename): fltk3::RGBImage(0,0,0)
+{
+  load_png_(filename, NULL, 0);
+}
+
+/** 
+ \brief Constructor that reads a PNG image from memory.
+
+ Construct an image from a block of memory inside the application. Fluid offers
+ "binary Data" chunks as a great way to add image data into the C++ source code.
+ name_png can be NULL. If a name is given, the image is added to the list of 
+ shared images (see: fltk3::SharedImage) and will be available by that name.
+ 
+ \param name_png  A name given to this image or NULL
+ \param buffer	  Pointer to the start of the PNG image in memory
+ \param maxsize   Size in bytes of the memory buffer containing the PNG image
+ */
+fltk3::PNGImage::PNGImage (
+      const char *name_png, const unsigned char *buffer, int maxsize): fltk3::RGBImage(0,0,0)
+{
+  load_png_(name_png, buffer, maxsize);
+}
+
+void fltk3::PNGImage::load_png_(const char *name_png, const unsigned char *buffer_png, int maxsize)
+{
+#if defined(HAVE_LIBPNG) && defined(HAVE_LIBZ)
+  int i;	  // Looping var
+  FILE *fp = NULL;	  // File pointer
+  int channels;	  // Number of color channels
+  png_structp pp; // PNG read pointer
+  png_infop info; // PNG info pointers
+  png_bytep *rows;// PNG row pointers
+  fl_png_memory png_mem_data;
+  int from_memory = (buffer_png != NULL); // true if reading image from memory
+
+  if (!from_memory) {
+    if ((fp = fltk3::fopen(name_png, "rb")) == NULL) return;
+  }
+  else name_png = "In-memory PNG data";
+
+  // Setup the PNG data structures...
+  pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+  if (pp) info = png_create_info_struct(pp);
+  if (!pp || !info) {
+    if (pp) png_destroy_read_struct(&pp, NULL, NULL);
+    if (!from_memory) fclose(fp);
+    fltk3::warning("Cannot allocate memory to read PNG file or data \"%s\".\n", name_png);
+    return;
+  }
+  
+  if (setjmp(png_jmpbuf(pp)))
+  {
+    png_destroy_read_struct(&pp, &info, NULL);
+    if (!from_memory) fclose(fp);
+    fltk3::warning("PNG file or data \"%s\" contains errors!\n", name_png);
+    return;
+  }
+
+  if (from_memory) {
+    png_mem_data.current = buffer_png;
+    png_mem_data.last = buffer_png + maxsize;
+    png_mem_data.pp = pp;
+    // Initialize the function pointer to the PNG read "engine"...
+    png_set_read_fn (pp, (png_voidp) &png_mem_data, png_read_data_from_mem);
+  } else {
+    png_init_io(pp, fp); // Initialize the PNG file read "engine"...
+  }  
+
+  // Get the image dimensions and convert to grayscale or RGB...
+  png_read_info(pp, info);
+
+  if (png_get_color_type(pp, info) == PNG_COLOR_TYPE_PALETTE)
+    png_set_expand(pp);
+
+  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
+    channels = 3;
+  else
+    channels = 1;
+
+  int num_trans = 0;
+  png_get_tRNS(pp, info, 0, &num_trans, 0);
+  if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || (num_trans != 0))
+    channels ++;
+
+  w((int)(png_get_image_width(pp, info)));
+  h((int)(png_get_image_height(pp, info)));
+  d(channels);
+
+  if (png_get_bit_depth(pp, info) < 8)
+  {
+    png_set_packing(pp);
+    png_set_expand(pp);
+  }
+  else if (png_get_bit_depth(pp, info) == 16)
+    png_set_strip_16(pp);
+
+#  if defined(HAVE_PNG_GET_VALID) && defined(HAVE_PNG_SET_TRNS_TO_ALPHA)
+  // Handle transparency...
+  if (png_get_valid(pp, info, PNG_INFO_tRNS))
+    png_set_tRNS_to_alpha(pp);
+#  endif // HAVE_PNG_GET_VALID && HAVE_PNG_SET_TRNS_TO_ALPHA
+
+  array = new uchar[w() * h() * d()];
+  alloc_array = 1;
+
+  // Allocate pointers...
+  rows = new png_bytep[h()];
+
+  for (i = 0; i < h(); i ++)
+    rows[i] = (png_bytep)(array + i * w() * d());
+
+  // Read the image, handling interlacing as needed...
+  for (i = png_set_interlace_handling(pp); i > 0; i --)
+    png_read_rows(pp, rows, NULL, h());
+
+#ifdef WIN32
+  // Some Windows graphics drivers don't honor transparency when RGB == white
+  if (channels == 4) {
+    // Convert RGB to 0 when alpha == 0...
+    uchar *ptr = (uchar *)array;
+    for (i = w() * h(); i > 0; i --, ptr += 4)
+      if (!ptr[3]) ptr[0] = ptr[1] = ptr[2] = 0;
+  }
+#endif // WIN32
+
+  // Free memory and return...
+  delete[] rows;
+
+  png_read_end(pp, info);
+  png_destroy_read_struct(&pp, &info, NULL);
+
+  if (from_memory) {
+    if (w() && h() && name_png) {
+      fltk3::SharedImage *si = new fltk3::SharedImage(name_png, this);
+      si->add();
+    }
+  } else {
+    fclose(fp);
+  }
+#endif // HAVE_LIBPNG && HAVE_LIBZ
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/PNMImage.cxx (from rev 9002, branches/branch-3.0/src/core/Fl_PNM_Image.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/PNMImage.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/PNMImage.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,197 @@
+//
+// "$Id$"
+//
+// fltk3::PNMImage routines.
+//
+// Copyright 1997-2010 by Easy Software Products.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+
+//
+//   fltk3::PNMImage::fltk3::PNMImage() - Load a PNM image...
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/run.h>
+#include <fltk3images/PNMImage.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fltk3/utf8.h>
+#include "../fltk3/flstring.h"
+
+
+//
+// 'fltk3::PNMImage::fltk3::PNMImage()' - Load a PNM image...
+//
+
+/** 
+  The constructor loads the named PNM image. 
+  <P>The inherited destructor free all memory and server resources that are used by the image.
+*/
+
+fltk3::PNMImage::PNMImage(const char *name)	// I - File to read
+  : fltk3::RGBImage(0,0,0) {
+  FILE		*fp;		// File pointer
+  int		x, y;		// Looping vars
+  char		line[1024],	// Input line
+		*lineptr;	// Pointer in line
+  uchar		*ptr,		// Pointer to pixel values
+		byte,		// Byte from file
+		bit;		// Bit in pixel
+  int		format,		// Format of PNM file
+		val,		// Pixel value
+		maxval;		// Maximum pixel value
+
+
+  if ((fp = fltk3::fopen(name, "rb")) == NULL) return;
+
+  //
+  // Read the file header in the format:
+  //
+  //   Pformat
+  //   # comment1
+  //   # comment2
+  //   ...
+  //   # commentN
+  //   width
+  //   height
+  //   max sample
+  //
+
+  lineptr = fgets(line, sizeof(line), fp);
+  if (!lineptr) {
+    fclose(fp);
+    fltk3::error("Early end-of-file in PNM file \"%s\"!", name);
+    return;
+  }
+
+  lineptr ++;
+
+  format = atoi(lineptr);
+  while (isdigit(*lineptr)) lineptr ++;
+
+  if (format == 7) lineptr = (char *)"";
+
+  while (lineptr != NULL && w() == 0) {
+    if (*lineptr == '\0' || *lineptr == '#') {
+      lineptr = fgets(line, sizeof(line), fp);
+    } else if (isdigit(*lineptr)) {
+      w(strtol(lineptr, &lineptr, 10));
+    } else lineptr ++;
+  }
+
+  while (lineptr != NULL && h() == 0) {
+    if (*lineptr == '\0' || *lineptr == '#') {
+      lineptr = fgets(line, sizeof(line), fp);
+    } else if (isdigit(*lineptr)) {
+      h(strtol(lineptr, &lineptr, 10));
+    } else lineptr ++;
+  }
+
+  if (format != 1 && format != 4) {
+    maxval = 0;
+
+    while (lineptr != NULL && maxval == 0) {
+      if (*lineptr == '\0' || *lineptr == '#') {
+	lineptr = fgets(line, sizeof(line), fp);
+      } else if (isdigit(*lineptr)) {
+	maxval = strtol(lineptr, &lineptr, 10);
+      } else lineptr ++;
+    }
+  } else maxval = 1;
+
+  // Allocate memory...
+  if (format == 1 || format == 2 || format == 4 || format == 5) d(1);
+  else d(3);
+
+//  printf("%s = %dx%dx%d\n", name, w(), h(), d());
+
+  array       = new uchar[w() * h() * d()];
+  alloc_array = 1;
+
+  // Read the image file...
+  for (y = 0; y < h(); y ++) {
+    ptr = (uchar *)array + y * w() * d();
+
+    switch (format) {
+      case 1 :
+      case 2 :
+          for (x = w(); x > 0; x --)
+            if (fscanf(fp, "%d", &val) == 1) *ptr++ = (uchar)(255 * val / maxval);
+          break;
+
+      case 3 :
+          for (x = w(); x > 0; x --) {
+            if (fscanf(fp, "%d", &val) == 1) *ptr++ = (uchar)(255 * val / maxval);
+            if (fscanf(fp, "%d", &val) == 1) *ptr++ = (uchar)(255 * val / maxval);
+            if (fscanf(fp, "%d", &val) == 1) *ptr++ = (uchar)(255 * val / maxval);
+          }
+          break;
+
+      case 4 :
+          for (x = w(), byte = (uchar)getc(fp), bit = 128; x > 0; x --) {
+	    if (byte & bit) *ptr++ = 255;
+	    else *ptr++ = 0;
+
+            if (bit > 1) bit >>= 1;
+            else {
+              bit  = 128;
+              byte = (uchar)getc(fp);
+            }
+          }
+          break;
+          
+      case 5 :
+      case 6 :
+        if (maxval < 256) {
+          if (fread(ptr, w(), d(), fp)) { /* ignored */ }
+        } else {
+          for (x = d() * w(); x > 0; x --) {
+            val = (uchar)getc(fp);
+            val = (val<<8)|(uchar)getc(fp);
+            *ptr++ = (255*val)/maxval;
+          }
+        }
+        break;
+        
+      case 7 : /* XV 3:3:2 thumbnail format */
+        for (x = w(); x > 0; x --) {
+          byte = (uchar)getc(fp);
+          
+          *ptr++ = (uchar)(255 * ((byte >> 5) & 7) / 7);
+          *ptr++ = (uchar)(255 * ((byte >> 2) & 7) / 7);
+          *ptr++ = (uchar)(255 * (byte & 3) / 3);
+        }
+        break;
+    }
+  }
+
+  fclose(fp);
+}
+
+
+//
+// End of "$Id$".
+//

Copied: branches/branch-3.0/src/fltk3images/images_core.cxx (from rev 9002, branches/branch-3.0/src/core/fl_images_core.cxx)
===================================================================
--- branches/branch-3.0/src/fltk3images/images_core.cxx	                        (rev 0)
+++ branches/branch-3.0/src/fltk3images/images_core.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -0,0 +1,106 @@
+//
+// "$Id$"
+//
+// FLTK images library core.
+//
+// Copyright 1997-2010 by Easy Software Products.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+//     http://www.fltk.org/str.php
+//
+// Contents:
+//
+//   fltk3::register_images() - Register the image formats.
+//   fl_check_images()    - Check for a supported image format.
+//
+
+//
+// Include necessary header files...
+//
+
+#include <fltk3/SharedImage.h>
+#include <fltk3images/BMPImage.h>
+#include <fltk3images/GIFImage.h>
+#include <fltk3images/JPEGImage.h>
+#include <fltk3images/PNGImage.h>
+#include <fltk3images/PNMImage.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "../fltk3/flstring.h"
+
+
+//
+// Define a simple global image registration function that registers
+// the extra image formats that aren't part of the core FLTK library.
+//
+
+static fltk3::Image	*fl_check_images(const char *name, uchar *header, int headerlen);
+
+
+/**
+\brief Register the image formats.
+ *
+ This function is provided in the fltk_images library and 
+ registers all of the "extra" image file formats that are not part
+ of the core FLTK library.
+*/
+void fltk3::register_images() {
+  fltk3::SharedImage::add_handler(fl_check_images);
+}
+
+
+//
+// 'fl_check_images()' - Check for a supported image format.
+//
+
+fltk3::Image *					// O - Image, if found
+fl_check_images(const char *name,		// I - Filename
+                uchar      *header,		// I - Header data from file
+		int) {				// I - Amount of data (not used)
+  if (memcmp(header, "GIF87a", 6) == 0 ||
+      memcmp(header, "GIF89a", 6) == 0)	// GIF file
+    return new fltk3::GIFImage(name);
+
+  if (memcmp(header, "BM", 2) == 0)	// BMP file
+    return new fltk3::BMPImage(name);
+
+  if (header[0] == 'P' && header[1] >= '1' && header[1] <= '7')
+					// Portable anymap
+    return new fltk3::PNMImage(name);
+
+#ifdef HAVE_LIBPNG
+  if (memcmp(header, "\211PNG", 4) == 0)// PNG file
+    return new fltk3::PNGImage(name);
+#endif // HAVE_LIBPNG
+
+#ifdef HAVE_LIBJPEG
+  if (memcmp(header, "\377\330\377", 3) == 0 &&
+					// Start-of-Image
+      header[3] >= 0xc0 && header[3] <= 0xef)
+	   				// APPn for JPEG file
+    return new fltk3::JPEGImage(name);
+#endif // HAVE_LIBJPEG
+
+  return 0;
+}
+
+
+//
+// End of "$Id$".
+//

Modified: branches/branch-3.0/src/makedepend
===================================================================
--- branches/branch-3.0/src/makedepend	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/src/makedepend	2011-08-25 21:50:59 UTC (rev 9011)
@@ -8,1918 +8,1752 @@
 fltk3/run.o: ../include/fltk3/Xutf8.h ../include/fltk3/Window.h
 fltk3/run.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
 fltk3/run.o: ../include/fltk3/Tooltip.h ../include/fltk3/x.h
-fltk3/run.o: ../include/fltk3/Window.h core/flstring.h
+fltk3/run.o: ../include/fltk3/Window.h fltk3/flstring.h
 fltk3/run.o: ../include/fltk3/Export.h ../include/fltk3/draw.h
 fltk3/run.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
 fltk3/run.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
 fltk3/run.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
 fltk3/run.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
 fltk3/run.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Adjuster.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Adjuster.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Adjuster.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Adjuster.o: ../include/fltk3/Adjuster.h ../include/fltk3/Valuator.h
-core/Fl_Adjuster.o: ../include/fltk3/Widget.h ../include/fltk3/Bitmap.h
-core/Fl_Adjuster.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
-core/Fl_Adjuster.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Adjuster.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Adjuster.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
-core/Fl_Adjuster.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Adjuster.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Adjuster.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Adjuster.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Adjuster.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Adjuster.o: core/fastarrow.h core/mediumarrow.h core/slowarrow.h
-core/Fl_Bitmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Bitmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Bitmap.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Bitmap.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Bitmap.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/Fl_Bitmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Bitmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Bitmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Bitmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Bitmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Bitmap.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Bitmap.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Bitmap.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Bitmap.o: ../include/fltk3/MenuItem.h ../include/fltk3/Printer.h
-core/Fl_Bitmap.o: ../include/fltk3/PagedDevice.h
-core/Fl_Bitmap.o: ../include/fltk3/PostScript.h core/flstring.h
-core/Fl_Bitmap.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Box.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
-core/Fl_Box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Box.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Box.o: ../include/fltk3/Box.h ../include/fltk3/Widget.h
-core/Fl_Box.o: ../include/fltk3/Wrapper.h
-core/Fl_Browser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Browser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Browser.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Browser.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
-core/Fl_Browser.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Browser.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Browser.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Browser.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
-core/Fl_Browser.o: ../include/fltk3/Valuator.h ../include/fltk3/Image.h
-core/Fl_Browser.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Browser.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Browser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_Browser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Browser.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Browser.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
-core/Fl_Browser.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/Fl_Browser.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Browser_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Browser_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Browser_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Browser_.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Browser_.o: ../include/fltk3/Object.h ../include/fltk3/Browser_.h
-core/Fl_Browser_.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Browser_.o: ../include/fltk3/Wrapper.h ../include/fltk3/Scrollbar.h
-core/Fl_Browser_.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Browser_.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Browser_.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Browser_.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_Browser_.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Browser_.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Browser_.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Browser_.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Browser_load.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Browser_load.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Browser_load.o: ../include/fltk3/Xutf8.h
-core/Fl_Browser_load.o: ../include/fltk3/enumerations.h
-core/Fl_Browser_load.o: ../include/fltk3/Browser.h
-core/Fl_Browser_load.o: ../include/fltk3/Browser_.h ../include/fltk3/Group.h
-core/Fl_Browser_load.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Browser_load.o: ../include/fltk3/Widget.h
-core/Fl_Browser_load.o: ../include/fltk3/Rectangle.h
-core/Fl_Browser_load.o: ../include/fltk3/Object.h
-core/Fl_Browser_load.o: ../include/fltk3/Scrollbar.h
-core/Fl_Browser_load.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Browser_load.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
-core/Fl_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Button.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
-core/Fl_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Button.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Button.o: ../include/fltk3/Group.h ../include/fltk3/Window.h
-core/Fl_Button.o: ../include/fltk3/Group.h
-core/Fl_Chart.o: ../include/fltk3/math.h ../include/fltk3/run.h
-core/Fl_Chart.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Chart.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Chart.o: ../include/fltk3/enumerations.h ../include/fltk3/Chart.h
-core/Fl_Chart.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Chart.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Chart.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Chart.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Chart.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Chart.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Chart.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Chart.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Chart.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Chart.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Chart.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Chart.o: ../include/config.h
-core/Fl_Check_Browser.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Check_Browser.o: ../include/config.h ../include/fltk3/draw.h
-core/Fl_Check_Browser.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/Fl_Check_Browser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Check_Browser.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/Fl_Check_Browser.o: ../include/fltk3/enumerations.h
-core/Fl_Check_Browser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Check_Browser.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Check_Browser.o: ../include/fltk3/Widget.h
-core/Fl_Check_Browser.o: ../include/fltk3/Rectangle.h
-core/Fl_Check_Browser.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Check_Browser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Check_Browser.o: ../include/fltk3/Preferences.h
-core/Fl_Check_Browser.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Check_Browser.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Check_Browser.o: ../include/fltk3/RGBImage.h
-core/Fl_Check_Browser.o: ../include/fltk3/CheckBrowser.h
-core/Fl_Check_Browser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Check_Browser.o: ../include/fltk3/Browser_.h
-core/Fl_Check_Browser.o: ../include/fltk3/Scrollbar.h
-core/Fl_Check_Browser.o: ../include/fltk3/Slider.h
-core/Fl_Check_Browser.o: ../include/fltk3/Valuator.h ../include/fltk3/run.h
-core/Fl_Check_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Check_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Check_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Check_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Check_Button.o: ../include/fltk3/CheckButton.h
-core/Fl_Check_Button.o: ../include/fltk3/LightButton.h
-core/Fl_Check_Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
-core/Fl_Check_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Check_Button.o: ../include/fltk3/Rectangle.h
-core/Fl_Check_Button.o: ../include/fltk3/Object.h
-core/Fl_Choice.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Choice.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Choice.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Choice.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
-core/Fl_Choice.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
-core/Fl_Choice.o: ../include/fltk3/Image.h ../include/fltk3/Wrapper.h
-core/Fl_Choice.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Choice.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Choice.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Choice.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Choice.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Choice.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Choice.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Choice.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
-core/Fl_Choice.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/Fl_Choice.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Clock.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Clock.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Clock.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Clock.o: ../include/fltk3/Clock.h ../include/fltk3/Widget.h
-core/Fl_Clock.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Clock.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Clock.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Clock.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Clock.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Clock.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Clock.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Clock.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Clock.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Clock.o: ../include/fltk3/RGBImage.h
-core/Fl_Color_Chooser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Xutf8.h
-core/Fl_Color_Chooser.o: ../include/fltk3/enumerations.h
-core/Fl_Color_Chooser.o: ../include/fltk3/ColorChooser.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Rectangle.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Object.h ../include/fltk3/Box.h
-core/Fl_Color_Chooser.o: ../include/fltk3/ReturnButton.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Button.h ../include/fltk3/Choice.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Image.h
-core/Fl_Color_Chooser.o: ../include/fltk3/ValueInput.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Valuator.h ../include/fltk3/Input.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Input_.h ../include/fltk3/draw.h
-core/Fl_Color_Chooser.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Color_Chooser.o: ../include/fltk3/enumerations.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Plugin.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Preferences.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Color_Chooser.o: ../include/fltk3/Pixmap.h
-core/Fl_Color_Chooser.o: ../include/fltk3/RGBImage.h ../include/fltk3/math.h
-core/Fl_Counter.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Counter.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Counter.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Counter.o: ../include/fltk3/Counter.h ../include/fltk3/Valuator.h
-core/Fl_Counter.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Counter.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Counter.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Counter.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Counter.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Counter.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Counter.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Counter.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Counter.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Counter.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Device.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Device.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Device.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Device.o: ../include/fltk3/Device.h ../include/fltk3/x.h
-core/Fl_Device.o: ../include/fltk3/Window.h ../include/fltk3/Object.h
-core/Fl_Device.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Device.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
-core/Fl_Device.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Device.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Dial.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Dial.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Dial.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Dial.o: ../include/fltk3/Dial.h ../include/fltk3/Valuator.h
-core/Fl_Dial.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Dial.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Dial.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Dial.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Dial.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Dial.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Dial.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Dial.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Dial.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Dial.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Dial.o: ../include/fltk3/math.h
-core/Fl_Double_Window.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Double_Window.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Double_Window.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Double_Window.o: ../include/fltk3/enumerations.h
-core/Fl_Double_Window.o: ../include/fltk3/DoubleWindow.h
-core/Fl_Double_Window.o: ../include/fltk3/Window.h ../include/fltk3/Printer.h
-core/Fl_Double_Window.o: ../include/fltk3/x.h ../include/fltk3/PagedDevice.h
-core/Fl_Double_Window.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Double_Window.o: ../include/fltk3/Plugin.h
-core/Fl_Double_Window.o: ../include/fltk3/Preferences.h
-core/Fl_Double_Window.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
-core/Fl_Double_Window.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Double_Window.o: ../include/fltk3/Pixmap.h
-core/Fl_Double_Window.o: ../include/fltk3/RGBImage.h
-core/Fl_Double_Window.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Double_Window.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Double_Window.o: ../include/fltk3/Widget.h
-core/Fl_Double_Window.o: ../include/fltk3/Rectangle.h ../include/fltk3/draw.h
-core/Fl_Double_Window.o: ../include/fltk3/enumerations.h
-core/Fl_Double_Window.o: ../include/fltk3/PostScript.h
-core/Fl_File_Browser.o: ../include/fltk3/FileBrowser.h
-core/Fl_File_Browser.o: ../include/fltk3/Browser.h
-core/Fl_File_Browser.o: ../include/fltk3/Browser_.h ../include/fltk3/Group.h
-core/Fl_File_Browser.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_File_Browser.o: ../include/fltk3/Widget.h
-core/Fl_File_Browser.o: ../include/fltk3/enumerations.h
-core/Fl_File_Browser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_File_Browser.o: ../include/fltk3/Rectangle.h
-core/Fl_File_Browser.o: ../include/fltk3/Object.h
-core/Fl_File_Browser.o: ../include/fltk3/Scrollbar.h
-core/Fl_File_Browser.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_File_Browser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_File_Browser.o: ../include/fltk3/Xutf8.h ../include/fltk3/Image.h
-core/Fl_File_Browser.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/Fl_File_Browser.o: ../include/fltk3/filename.h ../include/fltk3/draw.h
-core/Fl_File_Browser.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_File_Browser.o: ../include/fltk3/enumerations.h
-core/Fl_File_Browser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_File_Browser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_File_Browser.o: ../include/fltk3/Preferences.h
-core/Fl_File_Browser.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_File_Browser.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_File_Browser.o: ../include/fltk3/filename.h core/flstring.h
-core/Fl_File_Browser.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_File_Chooser.o: ../include/fltk3/FileChooser.h ../include/fltk3/run.h
-core/Fl_File_Chooser.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_File_Chooser.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_File_Chooser.o: ../include/fltk3/enumerations.h
-core/Fl_File_Chooser.o: ../include/fltk3/DoubleWindow.h
-core/Fl_File_Chooser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_File_Chooser.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_File_Chooser.o: ../include/fltk3/Widget.h
-core/Fl_File_Chooser.o: ../include/fltk3/Rectangle.h
-core/Fl_File_Chooser.o: ../include/fltk3/Object.h ../include/fltk3/Choice.h
-core/Fl_File_Chooser.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
-core/Fl_File_Chooser.o: ../include/fltk3/Image.h
-core/Fl_File_Chooser.o: ../include/fltk3/MenuButton.h
-core/Fl_File_Chooser.o: ../include/fltk3/Button.h
-core/Fl_File_Chooser.o: ../include/fltk3/Preferences.h
-core/Fl_File_Chooser.o: ../include/fltk3/TiledGroup.h
-core/Fl_File_Chooser.o: ../include/fltk3/Group.h
-core/Fl_File_Chooser.o: ../include/fltk3/FileBrowser.h
-core/Fl_File_Chooser.o: ../include/fltk3/Browser.h
-core/Fl_File_Chooser.o: ../include/fltk3/Browser_.h
-core/Fl_File_Chooser.o: ../include/fltk3/Scrollbar.h
-core/Fl_File_Chooser.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_File_Chooser.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/Fl_File_Chooser.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
-core/Fl_File_Chooser.o: ../include/fltk3/CheckButton.h
-core/Fl_File_Chooser.o: ../include/fltk3/LightButton.h
-core/Fl_File_Chooser.o: ../include/fltk3/Button.h
-core/Fl_File_Chooser.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
-core/Fl_File_Chooser.o: ../include/fltk3/Input_.h
-core/Fl_File_Chooser.o: ../include/fltk3/ReturnButton.h
-core/Fl_File_Chooser.o: ../include/fltk3/ask.h ../include/fltk3/draw.h
-core/Fl_File_Chooser.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/Fl_File_Chooser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_File_Chooser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_File_Chooser.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_File_Chooser.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_File_Chooser2.o: ../include/fltk3/FileChooser.h
-core/Fl_File_Chooser2.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Xutf8.h
-core/Fl_File_Chooser2.o: ../include/fltk3/enumerations.h
-core/Fl_File_Chooser2.o: ../include/fltk3/DoubleWindow.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Widget.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Rectangle.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Object.h ../include/fltk3/Choice.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Image.h
-core/Fl_File_Chooser2.o: ../include/fltk3/MenuButton.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Button.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Preferences.h
-core/Fl_File_Chooser2.o: ../include/fltk3/TiledGroup.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Group.h
-core/Fl_File_Chooser2.o: ../include/fltk3/FileBrowser.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Browser.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Browser_.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Scrollbar.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Slider.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Valuator.h
-core/Fl_File_Chooser2.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/Fl_File_Chooser2.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
-core/Fl_File_Chooser2.o: ../include/fltk3/CheckButton.h
-core/Fl_File_Chooser2.o: ../include/fltk3/LightButton.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Button.h
-core/Fl_File_Chooser2.o: ../include/fltk3/FileInput.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
-core/Fl_File_Chooser2.o: ../include/fltk3/ReturnButton.h
-core/Fl_File_Chooser2.o: ../include/fltk3/ask.h ../include/fltk3/filename.h
-core/Fl_File_Chooser2.o: ../include/fltk3/x.h ../include/fltk3/SharedImage.h
-core/Fl_File_Chooser2.o: ../include/fltk3/draw.h
-core/Fl_File_Chooser2.o: ../include/fltk3/enumerations.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Pixmap.h
-core/Fl_File_Chooser2.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/Fl_File_Chooser2.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_File_Icon.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_File_Icon.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_File_Icon.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/Fl_File_Icon.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_File_Icon.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_File_Icon.o: ../include/fltk3/enumerations.h
-core/Fl_File_Icon.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_File_Icon.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_File_Icon.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_File_Icon.o: ../include/fltk3/enumerations.h
-core/Fl_File_Icon.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_File_Icon.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_File_Icon.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_File_Icon.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_File_Icon.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_File_Icon.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_File_Icon.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
-core/Fl_File_Input.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_File_Input.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_File_Input.o: ../include/fltk3/Xutf8.h
-core/Fl_File_Input.o: ../include/fltk3/enumerations.h
-core/Fl_File_Input.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
-core/Fl_File_Input.o: ../include/fltk3/Input_.h ../include/fltk3/Widget.h
-core/Fl_File_Input.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_File_Input.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_File_Input.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_File_Input.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_File_Input.o: ../include/fltk3/Window.h
-core/Fl_File_Input.o: ../include/fltk3/enumerations.h
-core/Fl_File_Input.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_File_Input.o: ../include/fltk3/Plugin.h
-core/Fl_File_Input.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_File_Input.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_File_Input.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_File_Input.o: ../include/fltk3/filename.h core/flstring.h
-core/Fl_File_Input.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Group.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Group.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Group.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Group.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Group.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Group.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Group.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Group.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Group.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Group.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Group.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Group.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Group.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Group.o: ../include/fltk3/RGBImage.h
-core/Fl_Help_View.o: ../include/fltk3/HelpView.h ../include/fltk3/run.h
-core/Fl_Help_View.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Help_View.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Help_View.o: ../include/fltk3/enumerations.h ../include/fltk3/Group.h
-core/Fl_Help_View.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Help_View.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Help_View.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
-core/Fl_Help_View.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Help_View.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Help_View.o: ../include/fltk3/Window.h
-core/Fl_Help_View.o: ../include/fltk3/enumerations.h
-core/Fl_Help_View.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_Help_View.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Help_View.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Help_View.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Help_View.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Help_View.o: ../include/fltk3/SharedImage.h
-core/Fl_Help_View.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
-core/Fl_Help_View.o: ../include/fltk3/filename.h core/flstring.h
-core/Fl_Help_View.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Image.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Image.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Image.o: ../include/fltk3/MenuItem.h core/flstring.h
-core/Fl_Image.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Input.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Input.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Input.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Input.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Input.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Input.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Input.o: ../include/fltk3/Object.h ../include/fltk3/Input.h
-core/Fl_Input.o: ../include/fltk3/Input_.h ../include/fltk3/draw.h
-core/Fl_Input.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Input.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
-core/Fl_Input.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Input.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Input.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Input.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Input.o: ../include/fltk3/ask.h core/flstring.h
-core/Fl_Input.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Input_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Input_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Input_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Input_.o: ../include/fltk3/Input_.h ../include/fltk3/Widget.h
-core/Fl_Input_.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Input_.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Input_.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Input_.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
-core/Fl_Input_.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Input_.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Input_.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Input_.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Input_.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Input_.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Input_.o: ../include/fltk3/ask.h ../include/fltk3/utf8.h
-core/Fl_Input_.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Input_.o: ../include/config.h
-core/Fl_Light_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Light_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Light_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Light_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Light_Button.o: ../include/fltk3/LightButton.h
-core/Fl_Light_Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
-core/Fl_Light_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Light_Button.o: ../include/fltk3/Rectangle.h
-core/Fl_Light_Button.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Light_Button.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Light_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Light_Button.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Light_Button.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Light_Button.o: ../include/fltk3/Plugin.h
-core/Fl_Light_Button.o: ../include/fltk3/Preferences.h
-core/Fl_Light_Button.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Light_Button.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Light_Button.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/Fl_Light_Button.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Menu.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Menu.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Menu.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Menu.o: ../include/fltk3/MenuWindow.h ../include/fltk3/SingleWindow.h
-core/Fl_Menu.o: ../include/fltk3/Window.h ../include/fltk3/Menu_.h
-core/Fl_Menu.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
-core/Fl_Menu.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
-core/Fl_Menu.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/Fl_Menu.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Menu.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Menu.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Menu.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Menu.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Menu.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Menu.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Menu.o: core/flstring.h ../include/fltk3/Export.h ../include/config.h
-core/Fl_Menu_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Menu_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Menu_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Menu_.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
-core/Fl_Menu_.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
-core/Fl_Menu_.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Menu_.o: ../include/config.h
-core/Fl_Menu_Bar.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Menu_Bar.o: ../include/fltk3/MenuBar.h ../include/fltk3/Menu_.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
-core/Fl_Menu_Bar.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Menu_Bar.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Menu_Bar.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
-core/Fl_Menu_Bar.o: ../include/fltk3/RGBImage.h
-core/Fl_Menu_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Menu_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Menu_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Menu_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Menu_Button.o: ../include/fltk3/MenuButton.h ../include/fltk3/Menu_.h
-core/Fl_Menu_Button.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
-core/Fl_Menu_Button.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
-core/Fl_Menu_Button.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Menu_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Menu_Button.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Menu_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Menu_Button.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Menu_Button.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Menu_Button.o: ../include/fltk3/Plugin.h
-core/Fl_Menu_Button.o: ../include/fltk3/Preferences.h
-core/Fl_Menu_Button.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Menu_Button.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Menu_Window.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Menu_Window.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Menu_Window.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Menu_Window.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_Menu_Window.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/Fl_Menu_Window.o: ../include/fltk3/enumerations.h
-core/Fl_Menu_Window.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Menu_Window.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Menu_Window.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Menu_Window.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Menu_Window.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Menu_Window.o: ../include/fltk3/Preferences.h
-core/Fl_Menu_Window.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Menu_Window.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Menu_Window.o: ../include/fltk3/RGBImage.h
-core/Fl_Menu_Window.o: ../include/fltk3/MenuWindow.h
-core/Fl_Menu_Window.o: ../include/fltk3/SingleWindow.h
-core/Fl_Menu_add.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
-core/Fl_Menu_add.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
-core/Fl_Menu_add.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Menu_add.o: ../include/config.h
-core/Fl_Menu_global.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Menu_global.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Menu_global.o: ../include/fltk3/Xutf8.h
-core/Fl_Menu_global.o: ../include/fltk3/enumerations.h
-core/Fl_Menu_global.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
-core/Fl_Menu_global.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
-core/Fl_Multi_Label.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Multi_Label.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Multi_Label.o: ../include/fltk3/Xutf8.h
-core/Fl_Multi_Label.o: ../include/fltk3/enumerations.h
-core/Fl_Multi_Label.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Multi_Label.o: ../include/fltk3/Object.h ../include/fltk3/MenuItem.h
-core/Fl_Multi_Label.o: ../include/fltk3/Widget.h ../include/fltk3/Image.h
-core/Fl_Multi_Label.o: ../include/fltk3/MultiLabel.h
-core/Fl_Native_File_Chooser.o: core/Fl_Native_File_Chooser_FLTK.cxx
-core/Fl_Native_File_Chooser.o: ../include/fltk3/NativeFileChooser.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/FileChooser.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Export.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/types.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Xutf8.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/enumerations.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/DoubleWindow.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Window.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Group.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Widget.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Wrapper.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Widget.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Rectangle.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Object.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Choice.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Menu_.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/MenuItem.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Image.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/MenuButton.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Button.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Preferences.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/TiledGroup.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Group.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/FileBrowser.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Browser.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Browser_.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Scrollbar.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Slider.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Valuator.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/FileIcon.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/run.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/filename.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Box.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/CheckButton.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/LightButton.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Button.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/FileInput.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Input.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/Input_.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/ReturnButton.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/ask.h
-core/Fl_Native_File_Chooser.o: ../include/fltk3/FileIcon.h
-core/Fl_Native_File_Chooser.o: core/Fl_Native_File_Chooser_common.cxx
-core/Fl_Native_File_Chooser.o: ../include/fltk3/enumerations.h
-core/Fl_Overlay_Window.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Overlay_Window.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Overlay_Window.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Overlay_Window.o: ../include/fltk3/enumerations.h
-core/Fl_Overlay_Window.o: ../include/fltk3/OverlayWindow.h
-core/Fl_Overlay_Window.o: ../include/fltk3/DoubleWindow.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/Fl_Overlay_Window.o: ../include/fltk3/x.h
-core/Fl_Overlay_Window.o: ../include/fltk3/enumerations.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Widget.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Wrapper.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Widget.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Rectangle.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Preferences.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Overlay_Window.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Overlay_Window.o: ../include/fltk3/RGBImage.h
-core/Fl_Pack.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Pack.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Pack.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Pack.o: ../include/fltk3/PackedGroup.h ../include/fltk3/Group.h
-core/Fl_Pack.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Pack.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Pack.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Pack.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Pack.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Pack.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Pack.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Pack.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Pack.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Pack.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Paged_Device.o: ../include/fltk3/PagedDevice.h
-core/Fl_Paged_Device.o: ../include/fltk3/Device.h ../include/fltk3/x.h
-core/Fl_Paged_Device.o: ../include/fltk3/enumerations.h
-core/Fl_Paged_Device.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Paged_Device.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/Fl_Paged_Device.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Paged_Device.o: ../include/fltk3/Preferences.h
-core/Fl_Paged_Device.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
-core/Fl_Paged_Device.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Paged_Device.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Paged_Device.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Paged_Device.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Paged_Device.o: ../include/fltk3/Widget.h
-core/Fl_Paged_Device.o: ../include/fltk3/Rectangle.h ../include/fltk3/run.h
-core/Fl_Paged_Device.o: ../include/fltk3/utf8.h ../include/fltk3/draw.h
-core/Fl_Paged_Device.o: ../include/fltk3/enumerations.h
-core/Fl_Pixmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Pixmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Pixmap.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Pixmap.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Pixmap.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Pixmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Pixmap.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Pixmap.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Pixmap.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Pixmap.o: ../include/fltk3/MenuItem.h ../include/fltk3/Printer.h
-core/Fl_Pixmap.o: ../include/fltk3/PagedDevice.h
-core/Fl_Pixmap.o: ../include/fltk3/PostScript.h core/flstring.h
-core/Fl_Pixmap.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Positioner.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Positioner.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Positioner.o: ../include/fltk3/Xutf8.h
-core/Fl_Positioner.o: ../include/fltk3/enumerations.h
-core/Fl_Positioner.o: ../include/fltk3/Positioner.h ../include/fltk3/Widget.h
-core/Fl_Positioner.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Positioner.o: ../include/fltk3/Window.h
-core/Fl_Positioner.o: ../include/fltk3/enumerations.h
-core/Fl_Positioner.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Positioner.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Positioner.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Positioner.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Positioner.o: ../include/fltk3/Plugin.h
-core/Fl_Positioner.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Positioner.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Positioner.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Printer.o: ../include/fltk3/Printer.h ../include/fltk3/x.h
-core/Fl_Printer.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/Fl_Printer.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/Fl_Printer.o: ../include/fltk3/Xutf8.h ../include/fltk3/PagedDevice.h
-core/Fl_Printer.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Printer.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Printer.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
-core/Fl_Printer.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Printer.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Printer.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Printer.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Printer.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Printer.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/Fl_Printer.o: ../include/fltk3/PostScript.h core/Fl_PostScript.cxx
-core/Fl_Printer.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Printer.o: ../include/fltk3/utf8.h ../include/fltk3/ask.h
-core/Fl_Printer.o: ../include/fltk3/NativeFileChooser.h
-core/Fl_Printer.o: ../include/fltk3/FileChooser.h
-core/Fl_Printer.o: ../include/fltk3/DoubleWindow.h ../include/fltk3/Group.h
-core/Fl_Printer.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
-core/Fl_Printer.o: ../include/fltk3/MenuItem.h ../include/fltk3/MenuButton.h
-core/Fl_Printer.o: ../include/fltk3/Button.h ../include/fltk3/TiledGroup.h
-core/Fl_Printer.o: ../include/fltk3/FileBrowser.h ../include/fltk3/Browser.h
-core/Fl_Printer.o: ../include/fltk3/Browser_.h ../include/fltk3/Scrollbar.h
-core/Fl_Printer.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Printer.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/Fl_Printer.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
-core/Fl_Printer.o: ../include/fltk3/CheckButton.h
-core/Fl_Printer.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
-core/Fl_Printer.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
-core/Fl_Printer.o: ../include/fltk3/Input_.h ../include/fltk3/ReturnButton.h
-core/Fl_Printer.o: core/print_panel.cxx core/print_panel.h
-core/Fl_Printer.o: ../include/fltk3/RoundButton.h ../include/fltk3/Spinner.h
-core/Fl_Printer.o: ../include/fltk3/RepeatButton.h
-core/Fl_Printer.o: ../include/fltk3/Progress.h ../src/core/flstring.h
-core/Fl_Printer.o: ../include/fltk3/Export.h ../include/fltk3/IntInput.h
-core/Fl_Printer.o: ../include/fltk3/Input.h
-core/Fl_Preferences.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Preferences.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Preferences.o: ../include/fltk3/Xutf8.h
-core/Fl_Preferences.o: ../include/fltk3/enumerations.h
-core/Fl_Preferences.o: ../include/fltk3/Preferences.h
-core/Fl_Preferences.o: ../include/fltk3/Plugin.h ../include/fltk3/filename.h
-core/Fl_Preferences.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_Preferences.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Progress.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Progress.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Progress.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Progress.o: ../include/fltk3/Progress.h ../include/fltk3/Widget.h
-core/Fl_Progress.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Progress.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Progress.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Progress.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Progress.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Progress.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Progress.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Progress.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Progress.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Progress.o: ../include/fltk3/RGBImage.h
-core/Fl_Repeat_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Repeat_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Repeat_Button.o: ../include/fltk3/RepeatButton.h
-core/Fl_Repeat_Button.o: ../include/fltk3/run.h ../include/fltk3/Button.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Widget.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Rectangle.h
-core/Fl_Repeat_Button.o: ../include/fltk3/Object.h
-core/Fl_Return_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Return_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Return_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Return_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Return_Button.o: ../include/fltk3/ReturnButton.h
-core/Fl_Return_Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
-core/Fl_Return_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Return_Button.o: ../include/fltk3/Rectangle.h
-core/Fl_Return_Button.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Return_Button.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Return_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Return_Button.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Return_Button.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Return_Button.o: ../include/fltk3/Plugin.h
-core/Fl_Return_Button.o: ../include/fltk3/Preferences.h
-core/Fl_Return_Button.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Return_Button.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Return_Button.o: ../include/fltk3/RGBImage.h
-core/Fl_Roller.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Roller.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Roller.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Roller.o: ../include/fltk3/Roller.h ../include/fltk3/Valuator.h
-core/Fl_Roller.o: ../include/fltk3/Widget.h ../include/fltk3/draw.h
-core/Fl_Roller.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Roller.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Roller.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
-core/Fl_Roller.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Roller.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Roller.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Roller.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Roller.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Roller.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Round_Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Round_Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Round_Button.o: ../include/fltk3/Xutf8.h
-core/Fl_Round_Button.o: ../include/fltk3/enumerations.h
-core/Fl_Round_Button.o: ../include/fltk3/RoundButton.h
-core/Fl_Round_Button.o: ../include/fltk3/LightButton.h
-core/Fl_Round_Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
-core/Fl_Round_Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Round_Button.o: ../include/fltk3/Rectangle.h
-core/Fl_Round_Button.o: ../include/fltk3/Object.h
-core/Fl_Scroll.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Scroll.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Scroll.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Scroll.o: ../include/fltk3/TiledImage.h ../include/fltk3/Image.h
-core/Fl_Scroll.o: ../include/fltk3/ScrollGroup.h ../include/fltk3/Group.h
-core/Fl_Scroll.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Scroll.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Scroll.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
-core/Fl_Scroll.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Scroll.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Scroll.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Scroll.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_Scroll.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Scroll.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Scroll.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
-core/Fl_Scroll.o: ../include/fltk3/RGBImage.h
-core/Fl_Scrollbar.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Scrollbar.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Scrollbar.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Scrollbar.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
-core/Fl_Scrollbar.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
-core/Fl_Scrollbar.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Scrollbar.o: ../include/fltk3/Window.h
-core/Fl_Scrollbar.o: ../include/fltk3/enumerations.h
-core/Fl_Scrollbar.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Scrollbar.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Scrollbar.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Scrollbar.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Scrollbar.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Scrollbar.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Scrollbar.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Scrollbar.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/Fl_Scrollbar.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Shared_Image.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_Shared_Image.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Shared_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Shared_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Shared_Image.o: ../include/fltk3/Xutf8.h
-core/Fl_Shared_Image.o: ../include/fltk3/enumerations.h
-core/Fl_Shared_Image.o: ../include/fltk3/SharedImage.h
-core/Fl_Shared_Image.o: ../include/fltk3/Image.h ../include/fltk3/XBMImage.h
-core/Fl_Shared_Image.o: ../include/fltk3/Bitmap.h ../include/fltk3/XPMImage.h
-core/Fl_Shared_Image.o: ../include/fltk3/Pixmap.h
-core/Fl_Single_Window.o: ../include/fltk3/SingleWindow.h
-core/Fl_Single_Window.o: ../include/fltk3/Window.h
-core/Fl_Slider.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Slider.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Slider.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Slider.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Slider.o: ../include/fltk3/Widget.h ../include/fltk3/draw.h
-core/Fl_Slider.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Slider.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Slider.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
-core/Fl_Slider.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Slider.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Slider.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Slider.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Slider.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Slider.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Slider.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Slider.o: ../include/config.h
-core/Style.o: ../include/fltk3/Style.h
-core/Fl_Table.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Table.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/Fl_Table.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/Fl_Table.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Table.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Table.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Table.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Table.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Table.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Table.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Table.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Table.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Table.o: ../include/fltk3/Table.h ../include/fltk3/run.h
-core/Fl_Table.o: ../include/fltk3/utf8.h ../include/fltk3/Group.h
-core/Fl_Table.o: ../include/fltk3/ScrollGroup.h ../include/fltk3/Scrollbar.h
-core/Fl_Table.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Table.o: ../include/fltk3/Box.h ../include/fltk3/Scrollbar.h
-core/Fl_Table_Row.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Table_Row.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Table_Row.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Table_Row.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Table_Row.o: ../include/fltk3/Window.h
-core/Fl_Table_Row.o: ../include/fltk3/enumerations.h
-core/Fl_Table_Row.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Table_Row.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Table_Row.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Table_Row.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Table_Row.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Table_Row.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Table_Row.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Table_Row.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Table_Row.o: ../include/fltk3/TableRow.h ../include/fltk3/Table.h
-core/Fl_Table_Row.o: ../include/fltk3/Group.h ../include/fltk3/ScrollGroup.h
-core/Fl_Table_Row.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
-core/Fl_Table_Row.o: ../include/fltk3/Valuator.h ../include/fltk3/Box.h
-core/Fl_Table_Row.o: ../include/fltk3/Scrollbar.h
-core/Fl_Tabs.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Tabs.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Tabs.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Tabs.o: ../include/fltk3/TabGroup.h ../include/fltk3/Group.h
-core/Fl_Tabs.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tabs.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Tabs.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_Tabs.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Tabs.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Tabs.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Tabs.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Tabs.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Tabs.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Tabs.o: ../include/fltk3/RGBImage.h ../include/fltk3/Tooltip.h
-core/Fl_Text_Buffer.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_Text_Buffer.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Text_Buffer.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Text_Buffer.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Text_Buffer.o: ../include/fltk3/Xutf8.h
-core/Fl_Text_Buffer.o: ../include/fltk3/enumerations.h
-core/Fl_Text_Buffer.o: ../include/fltk3/TextBuffer.h ../include/fltk3/ask.h
-core/Fl_Text_Display.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_Text_Display.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Text_Display.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Text_Display.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Text_Display.o: ../include/fltk3/Xutf8.h
-core/Fl_Text_Display.o: ../include/fltk3/enumerations.h
-core/Fl_Text_Display.o: ../include/fltk3/TextBuffer.h
-core/Fl_Text_Display.o: ../include/fltk3/TextDisplay.h
-core/Fl_Text_Display.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Text_Display.o: ../include/fltk3/Window.h
-core/Fl_Text_Display.o: ../include/fltk3/enumerations.h
-core/Fl_Text_Display.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Text_Display.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Text_Display.o: ../include/fltk3/Widget.h
-core/Fl_Text_Display.o: ../include/fltk3/Rectangle.h
-core/Fl_Text_Display.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Text_Display.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Text_Display.o: ../include/fltk3/Preferences.h
-core/Fl_Text_Display.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Text_Display.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Text_Display.o: ../include/fltk3/RGBImage.h
-core/Fl_Text_Display.o: ../include/fltk3/Scrollbar.h
-core/Fl_Text_Display.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Text_Display.o: ../include/fltk3/TextBuffer.h
-core/Fl_Text_Display.o: ../include/fltk3/MenuItem.h
-core/Fl_Text_Display.o: ../include/fltk3/Printer.h
-core/Fl_Text_Display.o: ../include/fltk3/PagedDevice.h
-core/Fl_Text_Display.o: ../include/fltk3/draw.h ../include/fltk3/PostScript.h
-core/Fl_Text_Editor.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Text_Editor.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Text_Editor.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Text_Editor.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Text_Editor.o: ../include/fltk3/enumerations.h
-core/Fl_Text_Editor.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Text_Editor.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Text_Editor.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Text_Editor.o: ../include/fltk3/Object.h
-core/Fl_Text_Editor.o: ../include/fltk3/TextEditor.h
-core/Fl_Text_Editor.o: ../include/fltk3/TextDisplay.h ../include/fltk3/draw.h
-core/Fl_Text_Editor.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Text_Editor.o: ../include/fltk3/enumerations.h
-core/Fl_Text_Editor.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Text_Editor.o: ../include/fltk3/Plugin.h
-core/Fl_Text_Editor.o: ../include/fltk3/Preferences.h
-core/Fl_Text_Editor.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Text_Editor.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Text_Editor.o: ../include/fltk3/RGBImage.h
-core/Fl_Text_Editor.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
-core/Fl_Text_Editor.o: ../include/fltk3/Valuator.h
-core/Fl_Text_Editor.o: ../include/fltk3/TextBuffer.h ../include/fltk3/ask.h
-core/Fl_Tile.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Tile.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Tile.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Tile.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
-core/Fl_Tile.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tile.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Tile.o: ../include/fltk3/Object.h ../include/fltk3/Window.h
-core/Fl_Tiled_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Xutf8.h
-core/Fl_Tiled_Image.o: ../include/fltk3/enumerations.h
-core/Fl_Tiled_Image.o: ../include/fltk3/TiledImage.h ../include/fltk3/Image.h
-core/Fl_Tiled_Image.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Window.h
-core/Fl_Tiled_Image.o: ../include/fltk3/enumerations.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Preferences.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Tiled_Image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Tooltip.o: ../include/fltk3/Tooltip.h ../include/fltk3/run.h
-core/Fl_Tooltip.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Tooltip.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Tooltip.o: ../include/fltk3/enumerations.h ../include/fltk3/Widget.h
-core/Fl_Tooltip.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Tooltip.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Tooltip.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Tooltip.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Tooltip.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tooltip.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Tooltip.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Tooltip.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Tooltip.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Tooltip.o: ../include/fltk3/RGBImage.h ../include/fltk3/MenuWindow.h
-core/Fl_Tooltip.o: ../include/fltk3/SingleWindow.h
-core/Fl_Tree.o: ../include/fltk3/Tree.h ../include/fltk3/run.h
-core/Fl_Tree.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Tree.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Tree.o: ../include/fltk3/enumerations.h ../include/fltk3/Group.h
-core/Fl_Tree.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tree.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Tree.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
-core/Fl_Tree.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Tree.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Tree.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/Fl_Tree.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Tree.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Tree.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Tree.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Tree.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Tree.o: ../include/fltk3/RGBImage.h ../include/fltk3/TreeItem.h
-core/Fl_Tree.o: ../include/fltk3/TreeItemArray.h ../include/fltk3/TreePrefs.h
-core/Fl_Tree_Item.o: ../include/fltk3/Widget.h
-core/Fl_Tree_Item.o: ../include/fltk3/enumerations.h
-core/Fl_Tree_Item.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Tree_Item.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Tree_Item.o: ../include/fltk3/TreeItem.h ../include/fltk3/run.h
-core/Fl_Tree_Item.o: ../include/fltk3/utf8.h ../include/fltk3/Xutf8.h
-core/Fl_Tree_Item.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
-core/Fl_Tree_Item.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Tree_Item.o: ../include/fltk3/enumerations.h
-core/Fl_Tree_Item.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Tree_Item.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Tree_Item.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Tree_Item.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Tree_Item.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Tree_Item.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Tree_Item.o: ../include/fltk3/TreeItemArray.h
-core/Fl_Tree_Item.o: ../include/fltk3/TreePrefs.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/TreeItemArray.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Export.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/TreeItem.h ../include/fltk3/run.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/utf8.h ../include/fltk3/types.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Xutf8.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/enumerations.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Widget.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Rectangle.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Object.h ../include/fltk3/Image.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Window.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/enumerations.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Widget.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Wrapper.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Device.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Object.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Plugin.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Preferences.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/Pixmap.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/RGBImage.h
-core/Fl_Tree_Item_Array.o: ../include/fltk3/TreePrefs.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/Xutf8.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/enumerations.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/Pixmap.h ../include/fltk3/Image.h
-core/Fl_Tree_Prefs.o: ../include/fltk3/TreePrefs.h
-core/Fl_Valuator.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Valuator.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Valuator.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Valuator.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
-core/Fl_Valuator.o: ../include/fltk3/math.h core/flstring.h
-core/Fl_Valuator.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Value_Input.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Value_Input.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Value_Input.o: ../include/fltk3/Xutf8.h
-core/Fl_Value_Input.o: ../include/fltk3/enumerations.h
-core/Fl_Value_Input.o: ../include/fltk3/ValueInput.h
-core/Fl_Value_Input.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
-core/Fl_Value_Input.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
-core/Fl_Value_Input.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
-core/Fl_Value_Input.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Value_Input.o: ../include/fltk3/Object.h ../include/fltk3/math.h
-core/Fl_Value_Output.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Value_Output.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Value_Output.o: ../include/fltk3/Xutf8.h
-core/Fl_Value_Output.o: ../include/fltk3/enumerations.h
-core/Fl_Value_Output.o: ../include/fltk3/ValueOutput.h
-core/Fl_Value_Output.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
-core/Fl_Value_Output.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Value_Output.o: ../include/fltk3/Window.h
-core/Fl_Value_Output.o: ../include/fltk3/enumerations.h
-core/Fl_Value_Output.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Value_Output.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Value_Output.o: ../include/fltk3/Rectangle.h
-core/Fl_Value_Output.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Value_Output.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Value_Output.o: ../include/fltk3/Preferences.h
-core/Fl_Value_Output.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Value_Output.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Value_Output.o: ../include/fltk3/RGBImage.h
-core/Fl_Value_Slider.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Value_Slider.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Value_Slider.o: ../include/fltk3/Xutf8.h
-core/Fl_Value_Slider.o: ../include/fltk3/enumerations.h
-core/Fl_Value_Slider.o: ../include/fltk3/ValueSlider.h
-core/Fl_Value_Slider.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/Fl_Value_Slider.o: ../include/fltk3/Widget.h ../include/fltk3/draw.h
-core/Fl_Value_Slider.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Value_Slider.o: ../include/fltk3/enumerations.h
-core/Fl_Value_Slider.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Value_Slider.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Value_Slider.o: ../include/fltk3/Rectangle.h
-core/Fl_Value_Slider.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/Fl_Value_Slider.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Value_Slider.o: ../include/fltk3/Preferences.h
-core/Fl_Value_Slider.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Value_Slider.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Value_Slider.o: ../include/fltk3/RGBImage.h
-core/Fl_Widget.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Widget.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Widget.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_Widget.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Widget.o: ../include/fltk3/Object.h ../include/fltk3/Wrapper.h
-core/Fl_Widget.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Widget.o: ../include/fltk3/Tooltip.h ../include/fltk3/draw.h
-core/Fl_Widget.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Widget.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/Fl_Widget.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
-core/Fl_Widget.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Widget.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Widget.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Widget.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_Widget.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Widget.o: ../include/config.h
-core/Fl_Window.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_Window.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Window.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Window.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_Window.o: ../include/fltk3/Window.h ../include/fltk3/Window.h
-core/Fl_Window.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_Window.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_Window.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Window.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_Window.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/Fl_Window.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_Window.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_Window.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Window.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Window.o: ../include/fltk3/RGBImage.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/Export.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/types.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/Xutf8.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/enumerations.h
-core/Fl_Window_fullscreen.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_Window_fullscreen.o: ../include/config.h
-core/Fl_Window_hotspot.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Xutf8.h
-core/Fl_Window_hotspot.o: ../include/fltk3/enumerations.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Widget.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Wrapper.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Widget.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Rectangle.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Object.h ../include/fltk3/x.h
-core/Fl_Window_hotspot.o: ../include/fltk3/Window.h
-core/Fl_Window_iconize.o: ../include/fltk3/x.h
-core/Fl_Window_iconize.o: ../include/fltk3/enumerations.h
-core/Fl_Window_iconize.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Window_iconize.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/Fl_Wizard.o: ../include/fltk3/WizardGroup.h ../include/fltk3/Group.h
-core/Fl_Wizard.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Wizard.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
-core/Fl_Wizard.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_Wizard.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_Wizard.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Wizard.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_Wizard.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/Fl_Wizard.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
-core/Fl_Wizard.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Wizard.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_Wizard.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_Wizard.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_XBM_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_XBM_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_XBM_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_XBM_Image.o: ../include/fltk3/XBMImage.h ../include/fltk3/Bitmap.h
-core/Fl_XBM_Image.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
-core/Fl_XBM_Image.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_XBM_Image.o: ../include/config.h
-core/Fl_XPM_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_XPM_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_XPM_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_XPM_Image.o: ../include/fltk3/XPMImage.h ../include/fltk3/Pixmap.h
-core/Fl_XPM_Image.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
-core/Fl_XPM_Image.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_XPM_Image.o: ../include/config.h
-core/Fl_abort.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_abort.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_abort.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_abort.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_abort.o: ../include/config.h
-core/Fl_add_idle.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_add_idle.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_add_idle.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_arg.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_arg.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_arg.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_arg.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_arg.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_arg.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_arg.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_arg.o: ../include/fltk3/Object.h ../include/fltk3/Tooltip.h
-core/Fl_arg.o: ../include/fltk3/filename.h ../include/fltk3/draw.h
-core/Fl_arg.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
-core/Fl_arg.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_arg.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_arg.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/Fl_arg.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/Fl_arg.o: core/flstring.h ../include/fltk3/Export.h ../include/config.h
-core/Fl_compose.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_compose.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_compose.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_compose.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_display.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_display.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_display.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_display.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_display.o: ../include/config.h
-core/Fl_get_key.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_get_key.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_get_key.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_get_key.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_get_system_colors.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_get_system_colors.o: ../include/fltk3/Export.h
-core/Fl_get_system_colors.o: ../include/fltk3/types.h
-core/Fl_get_system_colors.o: ../include/fltk3/Xutf8.h
-core/Fl_get_system_colors.o: ../include/fltk3/enumerations.h
-core/Fl_get_system_colors.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/Fl_get_system_colors.o: ../include/fltk3/Window.h
-core/Fl_get_system_colors.o: ../include/fltk3/enumerations.h
-core/Fl_get_system_colors.o: ../include/fltk3/Window.h
-core/Fl_get_system_colors.o: ../include/fltk3/Group.h
-core/Fl_get_system_colors.o: ../include/fltk3/Widget.h
-core/Fl_get_system_colors.o: ../include/fltk3/Wrapper.h
-core/Fl_get_system_colors.o: ../include/fltk3/Widget.h
-core/Fl_get_system_colors.o: ../include/fltk3/Rectangle.h
-core/Fl_get_system_colors.o: ../include/fltk3/Object.h
-core/Fl_get_system_colors.o: ../include/fltk3/Device.h
-core/Fl_get_system_colors.o: ../include/fltk3/Object.h
-core/Fl_get_system_colors.o: ../include/fltk3/Plugin.h
-core/Fl_get_system_colors.o: ../include/fltk3/Preferences.h
-core/Fl_get_system_colors.o: ../include/fltk3/Image.h
-core/Fl_get_system_colors.o: ../include/fltk3/Bitmap.h
-core/Fl_get_system_colors.o: ../include/fltk3/Image.h
-core/Fl_get_system_colors.o: ../include/fltk3/Pixmap.h
-core/Fl_get_system_colors.o: ../include/fltk3/RGBImage.h
-core/Fl_get_system_colors.o: ../include/fltk3/math.h ../include/fltk3/utf8.h
-core/Fl_get_system_colors.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_get_system_colors.o: ../include/config.h
-core/Fl_get_system_colors.o: ../include/fltk3/TiledImage.h core/tile.xpm
-core/Fl_grab.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_grab.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_grab.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_grab.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_grab.o: ../include/fltk3/Window.h
-core/Fl_lock.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_lock.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_lock.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_lock.o: ../include/config.h
-core/Fl_own_colormap.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_own_colormap.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_own_colormap.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_own_colormap.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_own_colormap.o: ../include/fltk3/Window.h
-core/Fl_visual.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_visual.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_visual.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_visual.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_visual.o: ../include/fltk3/Window.h
-core/Fl_x.o: ../include/config.h ../include/fltk3/run.h
-core/Fl_x.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_x.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_x.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/Fl_x.o: ../include/fltk3/Window.h ../include/fltk3/Window.h
-core/Fl_x.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/Fl_x.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/Fl_x.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_x.o: ../include/fltk3/utf8.h ../include/fltk3/Tooltip.h
-core/Fl_x.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/Fl_x.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_x.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/Fl_x.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_x.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_x.o: ../include/fltk3/RGBImage.h ../include/fltk3/PagedDevice.h
-core/Fl_x.o: ../include/fltk3/filename.h core/flstring.h
-core/Fl_x.o: ../include/fltk3/Export.h
-core/filename_absolute.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
-core/filename_absolute.o: core/flstring.h ../include/fltk3/Export.h
-core/filename_absolute.o: ../include/config.h
-core/filename_expand.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
-core/filename_expand.o: core/flstring.h ../include/fltk3/Export.h
-core/filename_expand.o: ../include/config.h
-core/filename_ext.o: ../include/fltk3/filename.h
-core/filename_isdir.o: core/flstring.h ../include/fltk3/Export.h
-core/filename_isdir.o: ../include/config.h ../include/fltk3/filename.h
-core/filename_isdir.o: ../include/fltk3/utf8.h
-core/filename_list.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
-core/filename_list.o: core/flstring.h ../include/fltk3/Export.h
-core/filename_list.o: ../include/config.h
-core/filename_match.o: ../include/fltk3/filename.h
-core/filename_setext.o: ../include/fltk3/filename.h core/flstring.h
-core/filename_setext.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_arc.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_arc.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/fl_arc.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/fl_arc.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_arc.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_arc.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_arc.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_arc.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_arc.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_arc.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_arc.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_arc.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_arc.o: ../include/fltk3/math.h
-core/fl_arci.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_arci.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/fl_arci.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/fl_arci.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_arci.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_arci.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_arci.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_arci.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_arci.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_arci.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_arci.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_arci.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_arci.o: ../include/config.h
-core/fl_ask.o: core/flstring.h ../include/fltk3/Export.h ../include/config.h
-core/fl_ask.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_ask.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_ask.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_ask.o: ../include/fltk3/ask.h ../include/fltk3/Box.h
-core/fl_ask.o: ../include/fltk3/Widget.h ../include/fltk3/Button.h
-core/fl_ask.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/fl_ask.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_ask.o: ../include/fltk3/ReturnButton.h ../include/fltk3/Button.h
-core/fl_ask.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_ask.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
-core/fl_ask.o: ../include/fltk3/SecretInput.h ../include/fltk3/Input.h
-core/fl_ask.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_ask.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/fl_ask.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_ask.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_ask.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_ask.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_ask.o: ../include/fltk3/RGBImage.h
-core/fl_boxtype.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_boxtype.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_boxtype.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_boxtype.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_boxtype.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/fl_boxtype.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_boxtype.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/fl_boxtype.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_boxtype.o: ../include/fltk3/Wrapper.h ../include/fltk3/Device.h
-core/fl_boxtype.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_boxtype.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_boxtype.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_boxtype.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_boxtype.o: ../include/config.h
-core/fl_color.o: core/Fl_XColor.H ../include/config.h
-core/fl_color.o: ../include/fltk3/enumerations.h ../include/fltk3/run.h
-core/fl_color.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_color.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_color.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/fl_color.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/fl_color.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_color.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_color.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_color.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_color.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_color.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_color.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_color.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_color.o: core/fl_cmap.h
-core/fl_cursor.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_cursor.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_cursor.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_cursor.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_cursor.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_cursor.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_cursor.o: ../include/fltk3/Object.h ../include/fltk3/x.h
-core/fl_cursor.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/fl_cursor.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
-core/fl_cursor.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_cursor.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_cursor.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_cursor.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_curve.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_curve.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/fl_curve.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/fl_curve.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_curve.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_curve.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_curve.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_curve.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_curve.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_curve.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_curve.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_curve.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_diamond_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_diamond_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_diamond_box.o: ../include/fltk3/Xutf8.h
-core/fl_diamond_box.o: ../include/fltk3/enumerations.h
-core/fl_diamond_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_diamond_box.o: ../include/fltk3/Window.h
-core/fl_diamond_box.o: ../include/fltk3/enumerations.h
-core/fl_diamond_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_diamond_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_diamond_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_diamond_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_diamond_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_diamond_box.o: ../include/fltk3/Preferences.h
-core/fl_diamond_box.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_diamond_box.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_diamond_box.o: ../include/fltk3/RGBImage.h
-core/fl_dnd.o: core/fl_dnd_x.cxx ../include/fltk3/run.h
-core/fl_dnd.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_dnd.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_dnd.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/fl_dnd.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_dnd.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/fl_dnd.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_dnd.o: ../include/fltk3/x.h ../include/fltk3/Window.h core/flstring.h
-core/fl_dnd.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_draw.o: ../include/fltk3/utf8.h ../include/fltk3/run.h
-core/fl_draw.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_draw.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_draw.o: ../include/fltk3/enumerations.h ../include/fltk3/draw.h
-core/fl_draw.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_draw.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/fl_draw.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_draw.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/fl_draw.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_draw.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_draw.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_draw.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_draw.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_draw.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/fl_draw.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_draw_image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_draw_image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_draw_image.o: ../include/fltk3/Xutf8.h
-core/fl_draw_image.o: ../include/fltk3/enumerations.h ../include/fltk3/draw.h
-core/fl_draw_image.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_draw_image.o: ../include/fltk3/enumerations.h
-core/fl_draw_image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_draw_image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_draw_image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_draw_image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_draw_image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_draw_image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_draw_image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_draw_image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_draw_image.o: core/Fl_XColor.H ../include/config.h core/flstring.h
-core/fl_draw_image.o: ../include/fltk3/Export.h
-core/fl_draw_pixmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_draw_pixmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_draw_pixmap.o: ../include/fltk3/Xutf8.h
-core/fl_draw_pixmap.o: ../include/fltk3/enumerations.h
-core/fl_draw_pixmap.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_draw_pixmap.o: ../include/fltk3/Window.h
-core/fl_draw_pixmap.o: ../include/fltk3/enumerations.h
-core/fl_draw_pixmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_draw_pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_draw_pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_draw_pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_draw_pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_draw_pixmap.o: ../include/fltk3/Preferences.h
-core/fl_draw_pixmap.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_draw_pixmap.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_draw_pixmap.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/fl_draw_pixmap.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_encoding_latin1.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_encoding_latin1.o: ../include/fltk3/enumerations.h
-core/fl_encoding_latin1.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_encoding_latin1.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/fl_encoding_latin1.o: ../include/fltk3/enumerations.h
-core/fl_encoding_latin1.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_encoding_latin1.o: ../include/fltk3/Widget.h
-core/fl_encoding_latin1.o: ../include/fltk3/Wrapper.h
-core/fl_encoding_latin1.o: ../include/fltk3/Widget.h
-core/fl_encoding_latin1.o: ../include/fltk3/Rectangle.h
-core/fl_encoding_latin1.o: ../include/fltk3/Object.h
-core/fl_encoding_latin1.o: ../include/fltk3/Device.h
-core/fl_encoding_latin1.o: ../include/fltk3/Object.h
-core/fl_encoding_latin1.o: ../include/fltk3/Plugin.h
-core/fl_encoding_latin1.o: ../include/fltk3/Preferences.h
-core/fl_encoding_latin1.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_encoding_latin1.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_encoding_latin1.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/fl_encoding_latin1.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/enumerations.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Export.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/types.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Window.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Xutf8.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/enumerations.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Window.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Group.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Widget.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Wrapper.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Widget.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Rectangle.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Object.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Device.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Object.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Plugin.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Preferences.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Image.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Bitmap.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Image.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Pixmap.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/fl_encoding_mac_roman.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_engraved_label.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_engraved_label.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_engraved_label.o: ../include/fltk3/Xutf8.h
-core/fl_engraved_label.o: ../include/fltk3/enumerations.h
-core/fl_engraved_label.o: ../include/fltk3/Widget.h
-core/fl_engraved_label.o: ../include/fltk3/Rectangle.h
-core/fl_engraved_label.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/fl_engraved_label.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_engraved_label.o: ../include/fltk3/enumerations.h
-core/fl_engraved_label.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_engraved_label.o: ../include/fltk3/Widget.h
-core/fl_engraved_label.o: ../include/fltk3/Wrapper.h
-core/fl_engraved_label.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_engraved_label.o: ../include/fltk3/Plugin.h
-core/fl_engraved_label.o: ../include/fltk3/Preferences.h
-core/fl_engraved_label.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_engraved_label.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_engraved_label.o: ../include/fltk3/RGBImage.h
-core/fl_file_dir.o: core/flstring.h ../include/fltk3/Export.h
-core/fl_file_dir.o: ../include/config.h ../include/fltk3/filename.h
-core/fl_file_dir.o: ../include/fltk3/FileChooser.h ../include/fltk3/run.h
-core/fl_file_dir.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_file_dir.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_file_dir.o: ../include/fltk3/enumerations.h
-core/fl_file_dir.o: ../include/fltk3/DoubleWindow.h ../include/fltk3/Window.h
-core/fl_file_dir.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_file_dir.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/fl_file_dir.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_file_dir.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
-core/fl_file_dir.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
-core/fl_file_dir.o: ../include/fltk3/MenuButton.h ../include/fltk3/Button.h
-core/fl_file_dir.o: ../include/fltk3/Preferences.h
-core/fl_file_dir.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
-core/fl_file_dir.o: ../include/fltk3/FileBrowser.h ../include/fltk3/Browser.h
-core/fl_file_dir.o: ../include/fltk3/Browser_.h ../include/fltk3/Scrollbar.h
-core/fl_file_dir.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
-core/fl_file_dir.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
-core/fl_file_dir.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
-core/fl_file_dir.o: ../include/fltk3/CheckButton.h
-core/fl_file_dir.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
-core/fl_file_dir.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
-core/fl_file_dir.o: ../include/fltk3/Input_.h ../include/fltk3/ReturnButton.h
-core/fl_file_dir.o: ../include/fltk3/ask.h
-core/fl_font.o: core/flstring.h ../include/fltk3/Export.h ../include/config.h
-core/fl_font.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_font.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_font.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_font.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_font.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_font.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_font.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_font.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_font.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_font.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_font.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_font.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_font.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_font.o: core/Fl_Font.H ../include/fltk3/Xutf8.h core/fl_font_x.cxx
-core/fl_gtk.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_gtk.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_gtk.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_gtk.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_gtk.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_gtk.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_gtk.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_gtk.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_gtk.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_gtk.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_gtk.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_gtk.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_gtk.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_labeltype.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_labeltype.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_labeltype.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_labeltype.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_labeltype.o: ../include/fltk3/Object.h ../include/fltk3/Group.h
-core/fl_labeltype.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_labeltype.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_labeltype.o: ../include/fltk3/Window.h
-core/fl_labeltype.o: ../include/fltk3/enumerations.h
-core/fl_labeltype.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_labeltype.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_labeltype.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_labeltype.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_labeltype.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_labeltype.o: ../include/fltk3/RGBImage.h ../include/fltk3/Input_.h
-core/fl_line_style.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_line_style.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_line_style.o: ../include/fltk3/Xutf8.h
-core/fl_line_style.o: ../include/fltk3/enumerations.h ../include/fltk3/draw.h
-core/fl_line_style.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_line_style.o: ../include/fltk3/enumerations.h
-core/fl_line_style.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_line_style.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_line_style.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_line_style.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_line_style.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_line_style.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_line_style.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_line_style.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_line_style.o: ../include/fltk3/Printer.h
-core/fl_line_style.o: ../include/fltk3/PagedDevice.h
-core/fl_line_style.o: ../include/fltk3/PostScript.h core/flstring.h
-core/fl_line_style.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_open_uri.o: ../include/fltk3/filename.h core/flstring.h
-core/fl_open_uri.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_oval_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_oval_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_oval_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_oval_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_oval_box.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_oval_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_oval_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_oval_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_oval_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_oval_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_oval_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_oval_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_oval_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_overlay.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/fl_overlay.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_overlay.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/fl_overlay.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/fl_overlay.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_overlay.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_overlay.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_overlay.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_overlay.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_overlay.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_overlay.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_overlay.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_overlay_visual.o: ../include/config.h
-core/fl_plastic.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_plastic.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_plastic.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_plastic.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_plastic.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_plastic.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_plastic.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_plastic.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_plastic.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_plastic.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_plastic.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_plastic.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_plastic.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_plastic.o: core/flstring.h ../include/fltk3/Export.h
-core/fl_plastic.o: ../include/config.h
-core/fl_read_image.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/fl_read_image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_read_image.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/fl_read_image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_read_image.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/fl_read_image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_read_image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_read_image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_read_image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_read_image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_read_image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_read_image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_read_image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_read_image.o: core/flstring.h ../include/fltk3/Export.h
-core/fl_read_image.o: ../include/config.h
-core/fl_rect.o: ../include/config.h ../include/fltk3/run.h
-core/fl_rect.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_rect.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_rect.o: ../include/fltk3/enumerations.h ../include/fltk3/Widget.h
-core/fl_rect.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_rect.o: ../include/fltk3/Printer.h ../include/fltk3/x.h
-core/fl_rect.o: ../include/fltk3/Window.h ../include/fltk3/PagedDevice.h
-core/fl_rect.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_rect.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_rect.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_rect.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_rect.o: ../include/fltk3/RGBImage.h ../include/fltk3/Window.h
-core/fl_rect.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_rect.o: ../include/fltk3/Wrapper.h ../include/fltk3/draw.h
-core/fl_rect.o: ../include/fltk3/enumerations.h ../include/fltk3/PostScript.h
-core/fl_round_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_round_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_round_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_round_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_round_box.o: ../include/fltk3/Window.h
-core/fl_round_box.o: ../include/fltk3/enumerations.h
-core/fl_round_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_round_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_round_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_round_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_round_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_round_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_round_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_round_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_rounded_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_rounded_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_rounded_box.o: ../include/fltk3/Xutf8.h
-core/fl_rounded_box.o: ../include/fltk3/enumerations.h
-core/fl_rounded_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_rounded_box.o: ../include/fltk3/Window.h
-core/fl_rounded_box.o: ../include/fltk3/enumerations.h
-core/fl_rounded_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_rounded_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_rounded_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_rounded_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_rounded_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_rounded_box.o: ../include/fltk3/Preferences.h
-core/fl_rounded_box.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_rounded_box.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_rounded_box.o: ../include/fltk3/RGBImage.h
-core/fl_scroll_area.o: ../include/config.h ../include/fltk3/run.h
-core/fl_scroll_area.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/fl_scroll_area.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/fl_scroll_area.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
-core/fl_scroll_area.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/fl_scroll_area.o: ../include/fltk3/enumerations.h
-core/fl_scroll_area.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_scroll_area.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_scroll_area.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_scroll_area.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_scroll_area.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_scroll_area.o: ../include/fltk3/Preferences.h
-core/fl_scroll_area.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_scroll_area.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_scroll_area.o: ../include/fltk3/RGBImage.h
-core/fl_set_font.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_set_font.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_set_font.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_set_font.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_set_font.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/fl_set_font.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_set_font.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_set_font.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_set_font.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_set_font.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_set_font.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_set_font.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_set_font.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_set_font.o: core/flstring.h ../include/fltk3/Export.h
-core/fl_set_font.o: ../include/config.h core/Fl_Font.H
-core/fl_set_font.o: ../include/fltk3/Xutf8.h
-core/fl_set_fonts.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_set_fonts.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_set_fonts.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_set_fonts.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_set_fonts.o: core/Fl_Font.H ../include/config.h
-core/fl_set_fonts.o: ../include/fltk3/Xutf8.h core/flstring.h
-core/fl_set_fonts.o: ../include/fltk3/Export.h core/fl_set_fonts_x.cxx
-core/fl_shadow_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_shadow_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_shadow_box.o: ../include/fltk3/Xutf8.h
-core/fl_shadow_box.o: ../include/fltk3/enumerations.h ../include/fltk3/draw.h
-core/fl_shadow_box.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/fl_shadow_box.o: ../include/fltk3/enumerations.h
-core/fl_shadow_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_shadow_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_shadow_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_shadow_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_shadow_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_shadow_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_shadow_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_shadow_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_shortcut.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_shortcut.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_shortcut.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_shortcut.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_shortcut.o: ../include/fltk3/Object.h ../include/fltk3/Button.h
-core/fl_shortcut.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_shortcut.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_shortcut.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_shortcut.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_shortcut.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_shortcut.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_shortcut.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_shortcut.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_shortcut.o: ../include/fltk3/RGBImage.h core/flstring.h
-core/fl_shortcut.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_show_colormap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_show_colormap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_show_colormap.o: ../include/fltk3/Xutf8.h
-core/fl_show_colormap.o: ../include/fltk3/enumerations.h
-core/fl_show_colormap.o: ../include/fltk3/SingleWindow.h
-core/fl_show_colormap.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
-core/fl_show_colormap.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/fl_show_colormap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_show_colormap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_show_colormap.o: ../include/fltk3/Widget.h
-core/fl_show_colormap.o: ../include/fltk3/Rectangle.h
-core/fl_show_colormap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_show_colormap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_show_colormap.o: ../include/fltk3/Preferences.h
-core/fl_show_colormap.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_show_colormap.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_show_colormap.o: ../include/fltk3/RGBImage.h
-core/fl_show_colormap.o: ../include/fltk3/show_colormap.h ../include/config.h
-core/fl_symbols.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/fl_symbols.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_symbols.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/fl_symbols.o: ../include/fltk3/draw.h ../include/fltk3/x.h
-core/fl_symbols.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
-core/fl_symbols.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/fl_symbols.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/fl_symbols.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/fl_symbols.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
-core/fl_symbols.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/fl_symbols.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/fl_symbols.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/fl_symbols.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/fl_symbols.o: ../include/fltk3/math.h core/flstring.h
-core/fl_symbols.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_utf8.o: ../include/config.h ../include/fltk3/filename.h
-core/fl_utf8.o: ../include/fltk3/Xutf8.h ../include/fltk3/utf8.h
-core/fl_utf.o: ../include/fltk3/utf8.h core/xutf8/mk_wcwidth.c
-core/fl_vertex.o: ../include/config.h ../include/fltk3/draw.h
-core/fl_vertex.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/fl_vertex.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/fl_vertex.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
-core/fl_vertex.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
-core/fl_vertex.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
-core/fl_vertex.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
-core/fl_vertex.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/fl_vertex.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/fl_vertex.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/fl_vertex.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/fl_vertex.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/fl_vertex.o: ../include/fltk3/RGBImage.h ../include/fltk3/run.h
-core/fl_vertex.o: ../include/fltk3/utf8.h ../include/fltk3/math.h
-core/numericsort.o: ../include/config.h ../include/fltk3/filename.h
-core/ps_image.o: ../include/fltk3/PostScript.h ../include/fltk3/PagedDevice.h
-core/ps_image.o: ../include/fltk3/Device.h ../include/fltk3/x.h
-core/ps_image.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
-core/ps_image.o: ../include/fltk3/types.h ../include/fltk3/Window.h
-core/ps_image.o: ../include/fltk3/Xutf8.h ../include/fltk3/Object.h
-core/ps_image.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
-core/ps_image.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
-core/ps_image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
-core/ps_image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-core/ps_image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/ps_image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/ps_image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/ps_image.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
-core/ps_image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/scandir.o: core/flstring.h ../include/fltk3/Export.h ../include/config.h
-core/screen_xywh.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/screen_xywh.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/screen_xywh.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/screen_xywh.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/screen_xywh.o: ../include/config.h
+fltk3/Adjuster.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Adjuster.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Adjuster.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Adjuster.o: ../include/fltk3/Adjuster.h ../include/fltk3/Valuator.h
+fltk3/Adjuster.o: ../include/fltk3/Widget.h ../include/fltk3/Bitmap.h
+fltk3/Adjuster.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
+fltk3/Adjuster.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Adjuster.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Adjuster.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
+fltk3/Adjuster.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Adjuster.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Adjuster.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Adjuster.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Adjuster.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Adjuster.o: fltk3/fastarrow.h fltk3/mediumarrow.h fltk3/slowarrow.h
+fltk3/Bitmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Bitmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Bitmap.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Bitmap.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Bitmap.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/Bitmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Bitmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Bitmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Bitmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Bitmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Bitmap.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Bitmap.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Bitmap.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Bitmap.o: ../include/fltk3/MenuItem.h ../include/fltk3/Printer.h
+fltk3/Bitmap.o: ../include/fltk3/PagedDevice.h ../include/fltk3/PostScript.h
+fltk3/Bitmap.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Bitmap.o: ../include/config.h
+fltk3/Box.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
+fltk3/Box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Box.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Box.o: ../include/fltk3/Box.h ../include/fltk3/Widget.h
+fltk3/Box.o: ../include/fltk3/Wrapper.h
+fltk3/Browser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Browser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Browser.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Browser.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
+fltk3/Browser.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Browser.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Browser.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Browser.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/Browser.o: ../include/fltk3/Valuator.h ../include/fltk3/Image.h
+fltk3/Browser.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Browser.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Browser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/Browser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Browser.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Browser.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/Browser.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/Browser.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/Browser_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Browser_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Browser_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Browser_.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Browser_.o: ../include/fltk3/Object.h ../include/fltk3/Browser_.h
+fltk3/Browser_.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Browser_.o: ../include/fltk3/Wrapper.h ../include/fltk3/Scrollbar.h
+fltk3/Browser_.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/Browser_.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Browser_.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Browser_.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/Browser_.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Browser_.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Browser_.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Browser_.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Browser_load.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Browser_load.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Browser_load.o: ../include/fltk3/Xutf8.h
+fltk3/Browser_load.o: ../include/fltk3/enumerations.h
+fltk3/Browser_load.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
+fltk3/Browser_load.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Browser_load.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Browser_load.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Browser_load.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/Browser_load.o: ../include/fltk3/Valuator.h ../include/fltk3/Image.h
+fltk3/Browser_load.o: ../include/fltk3/utf8.h
+fltk3/Button.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Button.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Button.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Button.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
+fltk3/Button.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Button.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Button.o: ../include/fltk3/Group.h ../include/fltk3/Window.h
+fltk3/Button.o: ../include/fltk3/Group.h
+fltk3/Chart.o: ../include/fltk3/math.h ../include/fltk3/run.h
+fltk3/Chart.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/Chart.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/Chart.o: ../include/fltk3/enumerations.h ../include/fltk3/Chart.h
+fltk3/Chart.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Chart.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Chart.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/Chart.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Chart.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Chart.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
+fltk3/Chart.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Chart.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Chart.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Chart.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Chart.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/CheckBrowser.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/CheckBrowser.o: ../include/config.h ../include/fltk3/draw.h
+fltk3/CheckBrowser.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/CheckBrowser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/CheckBrowser.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/CheckBrowser.o: ../include/fltk3/enumerations.h
+fltk3/CheckBrowser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/CheckBrowser.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/CheckBrowser.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/CheckBrowser.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/CheckBrowser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/CheckBrowser.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/CheckBrowser.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/CheckBrowser.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/CheckBrowser.o: ../include/fltk3/CheckBrowser.h ../include/fltk3/run.h
+fltk3/CheckBrowser.o: ../include/fltk3/utf8.h ../include/fltk3/Browser_.h
+fltk3/CheckBrowser.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/CheckBrowser.o: ../include/fltk3/Valuator.h ../include/fltk3/run.h
+fltk3/CheckButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/CheckButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/CheckButton.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/CheckButton.o: ../include/fltk3/CheckButton.h
+fltk3/CheckButton.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/CheckButton.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/CheckButton.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/CheckButton.o: ../include/fltk3/Object.h
+fltk3/Choice.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Choice.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Choice.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Choice.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
+fltk3/Choice.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
+fltk3/Choice.o: ../include/fltk3/Image.h ../include/fltk3/Wrapper.h
+fltk3/Choice.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Choice.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/Choice.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Choice.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Choice.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
+fltk3/Choice.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Choice.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Choice.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/Choice.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/Choice.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/Clock.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Clock.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Clock.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Clock.o: ../include/fltk3/Clock.h ../include/fltk3/Widget.h
+fltk3/Clock.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Clock.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Clock.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Clock.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Clock.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Clock.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Clock.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Clock.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Clock.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Clock.o: ../include/fltk3/RGBImage.h
+fltk3/ColorChooser.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ColorChooser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ColorChooser.o: ../include/fltk3/Xutf8.h
+fltk3/ColorChooser.o: ../include/fltk3/enumerations.h
+fltk3/ColorChooser.o: ../include/fltk3/ColorChooser.h
+fltk3/ColorChooser.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/ColorChooser.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ColorChooser.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ColorChooser.o: ../include/fltk3/Box.h ../include/fltk3/ReturnButton.h
+fltk3/ColorChooser.o: ../include/fltk3/Button.h ../include/fltk3/Choice.h
+fltk3/ColorChooser.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
+fltk3/ColorChooser.o: ../include/fltk3/Image.h ../include/fltk3/ValueInput.h
+fltk3/ColorChooser.o: ../include/fltk3/Valuator.h ../include/fltk3/Input.h
+fltk3/ColorChooser.o: ../include/fltk3/Input_.h ../include/fltk3/draw.h
+fltk3/ColorChooser.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/ColorChooser.o: ../include/fltk3/enumerations.h
+fltk3/ColorChooser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/ColorChooser.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/ColorChooser.o: ../include/fltk3/Plugin.h
+fltk3/ColorChooser.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/ColorChooser.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/ColorChooser.o: ../include/fltk3/RGBImage.h ../include/fltk3/math.h
+fltk3/Counter.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Counter.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Counter.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Counter.o: ../include/fltk3/Counter.h ../include/fltk3/Valuator.h
+fltk3/Counter.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Counter.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Counter.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/Counter.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Counter.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Counter.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
+fltk3/Counter.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Counter.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Counter.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Counter.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Device.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Device.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Device.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Device.o: ../include/fltk3/Device.h ../include/fltk3/x.h
+fltk3/Device.o: ../include/fltk3/Window.h ../include/fltk3/Object.h
+fltk3/Device.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Device.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
+fltk3/Device.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Device.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Dial.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Dial.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Dial.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Dial.o: ../include/fltk3/Dial.h ../include/fltk3/Valuator.h
+fltk3/Dial.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Dial.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Dial.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/Dial.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Dial.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Dial.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
+fltk3/Dial.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Dial.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Dial.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Dial.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Dial.o: ../include/fltk3/math.h
+fltk3/DoubleWindow.o: ../include/config.h ../include/fltk3/run.h
+fltk3/DoubleWindow.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/DoubleWindow.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/DoubleWindow.o: ../include/fltk3/enumerations.h
+fltk3/DoubleWindow.o: ../include/fltk3/DoubleWindow.h
+fltk3/DoubleWindow.o: ../include/fltk3/Window.h ../include/fltk3/Printer.h
+fltk3/DoubleWindow.o: ../include/fltk3/x.h ../include/fltk3/PagedDevice.h
+fltk3/DoubleWindow.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/DoubleWindow.o: ../include/fltk3/Plugin.h
+fltk3/DoubleWindow.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/DoubleWindow.o: ../include/fltk3/Object.h ../include/fltk3/Bitmap.h
+fltk3/DoubleWindow.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/DoubleWindow.o: ../include/fltk3/RGBImage.h ../include/fltk3/Window.h
+fltk3/DoubleWindow.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/DoubleWindow.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/DoubleWindow.o: ../include/fltk3/Rectangle.h ../include/fltk3/draw.h
+fltk3/DoubleWindow.o: ../include/fltk3/enumerations.h
+fltk3/DoubleWindow.o: ../include/fltk3/PostScript.h
+fltk3/FileBrowser.o: ../include/fltk3/FileBrowser.h
+fltk3/FileBrowser.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
+fltk3/FileBrowser.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/FileBrowser.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/FileBrowser.o: ../include/fltk3/enumerations.h
+fltk3/FileBrowser.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/FileBrowser.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/FileBrowser.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/FileBrowser.o: ../include/fltk3/Valuator.h ../include/fltk3/run.h
+fltk3/FileBrowser.o: ../include/fltk3/utf8.h ../include/fltk3/Xutf8.h
+fltk3/FileBrowser.o: ../include/fltk3/Image.h ../include/fltk3/FileIcon.h
+fltk3/FileBrowser.o: ../include/fltk3/run.h ../include/fltk3/filename.h
+fltk3/FileBrowser.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/FileBrowser.o: ../include/fltk3/Window.h
+fltk3/FileBrowser.o: ../include/fltk3/enumerations.h
+fltk3/FileBrowser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/FileBrowser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/FileBrowser.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/FileBrowser.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/FileBrowser.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
+fltk3/FileBrowser.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/FileBrowser.o: ../include/config.h
+fltk3/FileChooser.o: ../include/fltk3/FileChooser.h ../include/fltk3/run.h
+fltk3/FileChooser.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/FileChooser.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/FileChooser.o: ../include/fltk3/enumerations.h
+fltk3/FileChooser.o: ../include/fltk3/DoubleWindow.h
+fltk3/FileChooser.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/FileChooser.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/FileChooser.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/FileChooser.o: ../include/fltk3/Object.h ../include/fltk3/Choice.h
+fltk3/FileChooser.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
+fltk3/FileChooser.o: ../include/fltk3/Image.h ../include/fltk3/MenuButton.h
+fltk3/FileChooser.o: ../include/fltk3/Button.h ../include/fltk3/Preferences.h
+fltk3/FileChooser.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
+fltk3/FileChooser.o: ../include/fltk3/FileBrowser.h
+fltk3/FileChooser.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
+fltk3/FileChooser.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/FileChooser.o: ../include/fltk3/Valuator.h ../include/fltk3/FileIcon.h
+fltk3/FileChooser.o: ../include/fltk3/run.h ../include/fltk3/filename.h
+fltk3/FileChooser.o: ../include/fltk3/Box.h ../include/fltk3/CheckButton.h
+fltk3/FileChooser.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/FileChooser.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
+fltk3/FileChooser.o: ../include/fltk3/Input_.h
+fltk3/FileChooser.o: ../include/fltk3/ReturnButton.h ../include/fltk3/ask.h
+fltk3/FileChooser.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/FileChooser.o: ../include/fltk3/enumerations.h
+fltk3/FileChooser.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/FileChooser.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/FileChooser.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/FileChooser.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/FileChooser2.o: ../include/fltk3/FileChooser.h ../include/fltk3/run.h
+fltk3/FileChooser2.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/FileChooser2.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/FileChooser2.o: ../include/fltk3/enumerations.h
+fltk3/FileChooser2.o: ../include/fltk3/DoubleWindow.h
+fltk3/FileChooser2.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/FileChooser2.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/FileChooser2.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/FileChooser2.o: ../include/fltk3/Object.h ../include/fltk3/Choice.h
+fltk3/FileChooser2.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
+fltk3/FileChooser2.o: ../include/fltk3/Image.h ../include/fltk3/MenuButton.h
+fltk3/FileChooser2.o: ../include/fltk3/Button.h
+fltk3/FileChooser2.o: ../include/fltk3/Preferences.h
+fltk3/FileChooser2.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
+fltk3/FileChooser2.o: ../include/fltk3/FileBrowser.h
+fltk3/FileChooser2.o: ../include/fltk3/Browser.h ../include/fltk3/Browser_.h
+fltk3/FileChooser2.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/FileChooser2.o: ../include/fltk3/Valuator.h ../include/fltk3/FileIcon.h
+fltk3/FileChooser2.o: ../include/fltk3/run.h ../include/fltk3/filename.h
+fltk3/FileChooser2.o: ../include/fltk3/Box.h ../include/fltk3/CheckButton.h
+fltk3/FileChooser2.o: ../include/fltk3/LightButton.h
+fltk3/FileChooser2.o: ../include/fltk3/Button.h ../include/fltk3/FileInput.h
+fltk3/FileChooser2.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
+fltk3/FileChooser2.o: ../include/fltk3/ReturnButton.h ../include/fltk3/ask.h
+fltk3/FileChooser2.o: ../include/fltk3/filename.h ../include/fltk3/x.h
+fltk3/FileChooser2.o: ../include/fltk3/SharedImage.h ../include/fltk3/draw.h
+fltk3/FileChooser2.o: ../include/fltk3/enumerations.h
+fltk3/FileChooser2.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/FileChooser2.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/FileChooser2.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/FileChooser2.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/FileChooser2.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/FileChooser2.o: ../include/config.h
+fltk3/FileIcon.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3/FileIcon.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/FileIcon.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
+fltk3/FileIcon.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/FileIcon.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/FileIcon.o: ../include/fltk3/enumerations.h ../include/fltk3/Widget.h
+fltk3/FileIcon.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/FileIcon.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/FileIcon.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/FileIcon.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/FileIcon.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/FileIcon.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/FileIcon.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/FileIcon.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/FileIcon.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/FileIcon.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
+fltk3/FileInput.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/FileInput.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/FileInput.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/FileInput.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
+fltk3/FileInput.o: ../include/fltk3/Input_.h ../include/fltk3/Widget.h
+fltk3/FileInput.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/FileInput.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/FileInput.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/FileInput.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/FileInput.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/FileInput.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/FileInput.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/FileInput.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/FileInput.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/FileInput.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
+fltk3/FileInput.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/FileInput.o: ../include/config.h
+fltk3/Group.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Group.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Group.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Group.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Group.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Group.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Group.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Group.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Group.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Group.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Group.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Group.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Group.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Group.o: ../include/fltk3/RGBImage.h
+fltk3/HelpView.o: ../include/fltk3/HelpView.h ../include/fltk3/run.h
+fltk3/HelpView.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/HelpView.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/HelpView.o: ../include/fltk3/enumerations.h ../include/fltk3/Group.h
+fltk3/HelpView.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/HelpView.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/HelpView.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
+fltk3/HelpView.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/HelpView.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/HelpView.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/HelpView.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/HelpView.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/HelpView.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/HelpView.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/HelpView.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/HelpView.o: ../include/fltk3/SharedImage.h ../include/fltk3/filename.h
+fltk3/HelpView.o: ../include/fltk3/utf8.h ../include/fltk3/filename.h
+fltk3/HelpView.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/HelpView.o: ../include/config.h
+fltk3/Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Image.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Image.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Image.o: ../include/fltk3/MenuItem.h fltk3/flstring.h
+fltk3/Image.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/Input.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Input.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Input.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Input.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Input.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Input.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Input.o: ../include/fltk3/Object.h ../include/fltk3/Input.h
+fltk3/Input.o: ../include/fltk3/Input_.h ../include/fltk3/draw.h
+fltk3/Input.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Input.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
+fltk3/Input.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Input.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Input.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Input.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Input.o: ../include/fltk3/ask.h fltk3/flstring.h
+fltk3/Input.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/Input_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Input_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Input_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Input_.o: ../include/fltk3/Input_.h ../include/fltk3/Widget.h
+fltk3/Input_.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Input_.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Input_.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Input_.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
+fltk3/Input_.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Input_.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Input_.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Input_.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Input_.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Input_.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Input_.o: ../include/fltk3/ask.h ../include/fltk3/utf8.h
+fltk3/Input_.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Input_.o: ../include/config.h
+fltk3/LightButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/LightButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/LightButton.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/LightButton.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/LightButton.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/LightButton.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/LightButton.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/LightButton.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/LightButton.o: ../include/fltk3/enumerations.h
+fltk3/LightButton.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/LightButton.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/LightButton.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/LightButton.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/LightButton.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/LightButton.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/LightButton.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/Menu.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Menu.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Menu.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Menu.o: ../include/fltk3/MenuWindow.h ../include/fltk3/SingleWindow.h
+fltk3/Menu.o: ../include/fltk3/Window.h ../include/fltk3/Menu_.h
+fltk3/Menu.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
+fltk3/Menu.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
+fltk3/Menu.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/Menu.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Menu.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Menu.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Menu.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Menu.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Menu.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Menu.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Menu.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/Menu_.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Menu_.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Menu_.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Menu_.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
+fltk3/Menu_.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
+fltk3/Menu_.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/MenuBar.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/MenuBar.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/MenuBar.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/MenuBar.o: ../include/fltk3/MenuBar.h ../include/fltk3/Menu_.h
+fltk3/MenuBar.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
+fltk3/MenuBar.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
+fltk3/MenuBar.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/MenuBar.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/MenuBar.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
+fltk3/MenuBar.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/MenuBar.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/MenuBar.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/MenuBar.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/MenuBar.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/MenuBar.o: ../include/fltk3/RGBImage.h
+fltk3/MenuButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/MenuButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/MenuButton.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/MenuButton.o: ../include/fltk3/MenuButton.h ../include/fltk3/Menu_.h
+fltk3/MenuButton.o: ../include/fltk3/Widget.h ../include/fltk3/MenuItem.h
+fltk3/MenuButton.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
+fltk3/MenuButton.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/MenuButton.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/MenuButton.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
+fltk3/MenuButton.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/MenuButton.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/MenuButton.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/MenuButton.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/MenuButton.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/MenuButton.o: ../include/fltk3/RGBImage.h
+fltk3/MenuWindow.o: ../include/config.h ../include/fltk3/run.h
+fltk3/MenuWindow.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/MenuWindow.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/MenuWindow.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/MenuWindow.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/MenuWindow.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/MenuWindow.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/MenuWindow.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/MenuWindow.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/MenuWindow.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/MenuWindow.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/MenuWindow.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/MenuWindow.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/MenuWindow.o: ../include/fltk3/RGBImage.h ../include/fltk3/MenuWindow.h
+fltk3/MenuWindow.o: ../include/fltk3/SingleWindow.h
+fltk3/Menu_add.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
+fltk3/Menu_add.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
+fltk3/Menu_add.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Menu_add.o: ../include/config.h
+fltk3/Menu_global.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Menu_global.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Menu_global.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Menu_global.o: ../include/fltk3/Menu_.h ../include/fltk3/Widget.h
+fltk3/Menu_global.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
+fltk3/MultiLabel.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/MultiLabel.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/MultiLabel.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/MultiLabel.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/MultiLabel.o: ../include/fltk3/Object.h ../include/fltk3/MenuItem.h
+fltk3/MultiLabel.o: ../include/fltk3/Widget.h ../include/fltk3/Image.h
+fltk3/MultiLabel.o: ../include/fltk3/MultiLabel.h
+fltk3/OverlayWindow.o: ../include/config.h ../include/fltk3/run.h
+fltk3/OverlayWindow.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/OverlayWindow.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/OverlayWindow.o: ../include/fltk3/enumerations.h
+fltk3/OverlayWindow.o: ../include/fltk3/OverlayWindow.h
+fltk3/OverlayWindow.o: ../include/fltk3/DoubleWindow.h
+fltk3/OverlayWindow.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/OverlayWindow.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/OverlayWindow.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/OverlayWindow.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/OverlayWindow.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/OverlayWindow.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/OverlayWindow.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/OverlayWindow.o: ../include/fltk3/Preferences.h
+fltk3/OverlayWindow.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/OverlayWindow.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/OverlayWindow.o: ../include/fltk3/RGBImage.h
+fltk3/PackedGroup.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/PackedGroup.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/PackedGroup.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/PackedGroup.o: ../include/fltk3/PackedGroup.h ../include/fltk3/Group.h
+fltk3/PackedGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/PackedGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/PackedGroup.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/PackedGroup.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/PackedGroup.o: ../include/fltk3/enumerations.h
+fltk3/PackedGroup.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/PackedGroup.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/PackedGroup.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/PackedGroup.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/PackedGroup.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/PackedGroup.o: ../include/fltk3/RGBImage.h
+fltk3/PagedDevice.o: ../include/fltk3/PagedDevice.h ../include/fltk3/Device.h
+fltk3/PagedDevice.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/PagedDevice.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/PagedDevice.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/PagedDevice.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/PagedDevice.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/PagedDevice.o: ../include/fltk3/Object.h ../include/fltk3/Bitmap.h
+fltk3/PagedDevice.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/PagedDevice.o: ../include/fltk3/RGBImage.h ../include/fltk3/Window.h
+fltk3/PagedDevice.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/PagedDevice.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/PagedDevice.o: ../include/fltk3/Rectangle.h ../include/fltk3/run.h
+fltk3/PagedDevice.o: ../include/fltk3/utf8.h ../include/fltk3/draw.h
+fltk3/PagedDevice.o: ../include/fltk3/enumerations.h
+fltk3/Pixmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Pixmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Pixmap.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Pixmap.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Pixmap.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Pixmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Pixmap.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Pixmap.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Pixmap.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Pixmap.o: ../include/fltk3/MenuItem.h ../include/fltk3/Printer.h
+fltk3/Pixmap.o: ../include/fltk3/PagedDevice.h ../include/fltk3/PostScript.h
+fltk3/Pixmap.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Pixmap.o: ../include/config.h
+fltk3/Positioner.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Positioner.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Positioner.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Positioner.o: ../include/fltk3/Positioner.h ../include/fltk3/Widget.h
+fltk3/Positioner.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Positioner.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Positioner.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Positioner.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Positioner.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Positioner.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Positioner.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Positioner.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Positioner.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Positioner.o: ../include/fltk3/RGBImage.h
+fltk3/Printer.o: ../include/fltk3/Printer.h ../include/fltk3/x.h
+fltk3/Printer.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
+fltk3/Printer.o: ../include/fltk3/types.h ../include/fltk3/Window.h
+fltk3/Printer.o: ../include/fltk3/Xutf8.h ../include/fltk3/PagedDevice.h
+fltk3/Printer.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Printer.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Printer.o: ../include/fltk3/Image.h ../include/fltk3/Object.h
+fltk3/Printer.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Printer.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Printer.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Printer.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Printer.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Printer.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/Printer.o: ../include/fltk3/PostScript.h fltk3/PostScript.cxx
+fltk3/Printer.o: ../include/config.h ../include/fltk3/run.h
+fltk3/Printer.o: ../include/fltk3/utf8.h ../include/fltk3/ask.h
+fltk3/Printer.o: ../include/fltk3/NativeFileChooser.h
+fltk3/Printer.o: ../include/fltk3/FileChooser.h
+fltk3/Printer.o: ../include/fltk3/DoubleWindow.h ../include/fltk3/Group.h
+fltk3/Printer.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
+fltk3/Printer.o: ../include/fltk3/MenuItem.h ../include/fltk3/MenuButton.h
+fltk3/Printer.o: ../include/fltk3/Button.h ../include/fltk3/TiledGroup.h
+fltk3/Printer.o: ../include/fltk3/FileBrowser.h ../include/fltk3/Browser.h
+fltk3/Printer.o: ../include/fltk3/Browser_.h ../include/fltk3/Scrollbar.h
+fltk3/Printer.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/Printer.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
+fltk3/Printer.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
+fltk3/Printer.o: ../include/fltk3/CheckButton.h
+fltk3/Printer.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/Printer.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
+fltk3/Printer.o: ../include/fltk3/Input_.h ../include/fltk3/ReturnButton.h
+fltk3/Printer.o: fltk3/print_panel.cxx fltk3/print_panel.h
+fltk3/Printer.o: ../include/fltk3/RoundButton.h ../include/fltk3/Spinner.h
+fltk3/Printer.o: ../include/fltk3/RepeatButton.h ../include/fltk3/Progress.h
+fltk3/Printer.o: ../include/fltk3/IntInput.h ../include/fltk3/Input.h
+fltk3/Preferences.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Preferences.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Preferences.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Preferences.o: ../include/fltk3/Preferences.h ../include/fltk3/Plugin.h
+fltk3/Preferences.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
+fltk3/Preferences.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Preferences.o: ../include/config.h
+fltk3/Progress.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Progress.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Progress.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Progress.o: ../include/fltk3/Progress.h ../include/fltk3/Widget.h
+fltk3/Progress.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Progress.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Progress.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Progress.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Progress.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Progress.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Progress.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Progress.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Progress.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Progress.o: ../include/fltk3/RGBImage.h
+fltk3/RepeatButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/RepeatButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/RepeatButton.o: ../include/fltk3/Xutf8.h
+fltk3/RepeatButton.o: ../include/fltk3/enumerations.h
+fltk3/RepeatButton.o: ../include/fltk3/RepeatButton.h ../include/fltk3/run.h
+fltk3/RepeatButton.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
+fltk3/RepeatButton.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/RepeatButton.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ReturnButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ReturnButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ReturnButton.o: ../include/fltk3/Xutf8.h
+fltk3/ReturnButton.o: ../include/fltk3/enumerations.h
+fltk3/ReturnButton.o: ../include/fltk3/ReturnButton.h
+fltk3/ReturnButton.o: ../include/fltk3/Button.h ../include/fltk3/Widget.h
+fltk3/ReturnButton.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ReturnButton.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ReturnButton.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/ReturnButton.o: ../include/fltk3/Window.h
+fltk3/ReturnButton.o: ../include/fltk3/enumerations.h
+fltk3/ReturnButton.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/ReturnButton.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/ReturnButton.o: ../include/fltk3/Plugin.h
+fltk3/ReturnButton.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/ReturnButton.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/ReturnButton.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Roller.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Roller.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Roller.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Roller.o: ../include/fltk3/Roller.h ../include/fltk3/Valuator.h
+fltk3/Roller.o: ../include/fltk3/Widget.h ../include/fltk3/draw.h
+fltk3/Roller.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Roller.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Roller.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
+fltk3/Roller.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Roller.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Roller.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Roller.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Roller.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Roller.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/RoundButton.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/RoundButton.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/RoundButton.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/RoundButton.o: ../include/fltk3/RoundButton.h
+fltk3/RoundButton.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/RoundButton.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/RoundButton.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/RoundButton.o: ../include/fltk3/Object.h
+fltk3/ScrollGroup.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ScrollGroup.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ScrollGroup.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/ScrollGroup.o: ../include/fltk3/TiledImage.h ../include/fltk3/Image.h
+fltk3/ScrollGroup.o: ../include/fltk3/ScrollGroup.h ../include/fltk3/Group.h
+fltk3/ScrollGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/ScrollGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/ScrollGroup.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
+fltk3/ScrollGroup.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/ScrollGroup.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/ScrollGroup.o: ../include/fltk3/Window.h
+fltk3/ScrollGroup.o: ../include/fltk3/enumerations.h
+fltk3/ScrollGroup.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3/ScrollGroup.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/ScrollGroup.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/ScrollGroup.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/ScrollGroup.o: ../include/fltk3/RGBImage.h
+fltk3/Scrollbar.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Scrollbar.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Scrollbar.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Scrollbar.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/Scrollbar.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
+fltk3/Scrollbar.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Scrollbar.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Scrollbar.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Scrollbar.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Scrollbar.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Scrollbar.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Scrollbar.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Scrollbar.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Scrollbar.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Scrollbar.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/Scrollbar.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/SharedImage.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3/SharedImage.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/SharedImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/SharedImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/SharedImage.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/SharedImage.o: ../include/fltk3/SharedImage.h ../include/fltk3/Image.h
+fltk3/SharedImage.o: ../include/fltk3/XBMImage.h ../include/fltk3/Bitmap.h
+fltk3/SharedImage.o: ../include/fltk3/XPMImage.h ../include/fltk3/Pixmap.h
+fltk3/SingleWindow.o: ../include/fltk3/SingleWindow.h
+fltk3/SingleWindow.o: ../include/fltk3/Window.h
+fltk3/Slider.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Slider.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Slider.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Slider.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/Slider.o: ../include/fltk3/Widget.h ../include/fltk3/draw.h
+fltk3/Slider.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Slider.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Slider.o: ../include/fltk3/Group.h ../include/fltk3/Wrapper.h
+fltk3/Slider.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Slider.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Slider.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Slider.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Slider.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Slider.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Slider.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Slider.o: ../include/config.h
+fltk3/Style.o: ../include/fltk3/Style.h
+fltk3/Table.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Table.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
+fltk3/Table.o: ../include/fltk3/types.h ../include/fltk3/Window.h
+fltk3/Table.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Table.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Table.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Table.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Table.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/Table.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Table.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Table.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Table.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Table.o: ../include/fltk3/Table.h ../include/fltk3/run.h
+fltk3/Table.o: ../include/fltk3/utf8.h ../include/fltk3/Group.h
+fltk3/Table.o: ../include/fltk3/ScrollGroup.h ../include/fltk3/Scrollbar.h
+fltk3/Table.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/Table.o: ../include/fltk3/Box.h ../include/fltk3/Scrollbar.h
+fltk3/TableRow.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TableRow.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TableRow.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TableRow.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/TableRow.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/TableRow.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/TableRow.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TableRow.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TableRow.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/TableRow.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/TableRow.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/TableRow.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/TableRow.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/TableRow.o: ../include/fltk3/TableRow.h ../include/fltk3/Table.h
+fltk3/TableRow.o: ../include/fltk3/Group.h ../include/fltk3/ScrollGroup.h
+fltk3/TableRow.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/TableRow.o: ../include/fltk3/Valuator.h ../include/fltk3/Box.h
+fltk3/TableRow.o: ../include/fltk3/Scrollbar.h
+fltk3/TabGroup.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TabGroup.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TabGroup.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TabGroup.o: ../include/fltk3/TabGroup.h ../include/fltk3/Group.h
+fltk3/TabGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TabGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TabGroup.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/TabGroup.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/TabGroup.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/TabGroup.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/TabGroup.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/TabGroup.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/TabGroup.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/TabGroup.o: ../include/fltk3/RGBImage.h ../include/fltk3/Tooltip.h
+fltk3/TextBuffer.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3/TextBuffer.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/TextBuffer.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TextBuffer.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TextBuffer.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TextBuffer.o: ../include/fltk3/TextBuffer.h ../include/fltk3/ask.h
+fltk3/TextDisplay.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3/TextDisplay.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/TextDisplay.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TextDisplay.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TextDisplay.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TextDisplay.o: ../include/fltk3/TextBuffer.h
+fltk3/TextDisplay.o: ../include/fltk3/TextDisplay.h ../include/fltk3/draw.h
+fltk3/TextDisplay.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/TextDisplay.o: ../include/fltk3/enumerations.h
+fltk3/TextDisplay.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/TextDisplay.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TextDisplay.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TextDisplay.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/TextDisplay.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/TextDisplay.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/TextDisplay.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/TextDisplay.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/TextDisplay.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/TextDisplay.o: ../include/fltk3/Valuator.h
+fltk3/TextDisplay.o: ../include/fltk3/TextBuffer.h
+fltk3/TextDisplay.o: ../include/fltk3/MenuItem.h ../include/fltk3/Printer.h
+fltk3/TextDisplay.o: ../include/fltk3/PagedDevice.h ../include/fltk3/draw.h
+fltk3/TextDisplay.o: ../include/fltk3/PostScript.h
+fltk3/TextEditor.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/TextEditor.o: ../include/config.h ../include/fltk3/run.h
+fltk3/TextEditor.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/TextEditor.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/TextEditor.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/TextEditor.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/TextEditor.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/TextEditor.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/TextEditor.o: ../include/fltk3/TextEditor.h
+fltk3/TextEditor.o: ../include/fltk3/TextDisplay.h ../include/fltk3/draw.h
+fltk3/TextEditor.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/TextEditor.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
+fltk3/TextEditor.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/TextEditor.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/TextEditor.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/TextEditor.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/TextEditor.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
+fltk3/TextEditor.o: ../include/fltk3/Valuator.h ../include/fltk3/TextBuffer.h
+fltk3/TextEditor.o: ../include/fltk3/ask.h
+fltk3/TiledGroup.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TiledGroup.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TiledGroup.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TiledGroup.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
+fltk3/TiledGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TiledGroup.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TiledGroup.o: ../include/fltk3/Object.h ../include/fltk3/Window.h
+fltk3/TiledImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TiledImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TiledImage.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TiledImage.o: ../include/fltk3/TiledImage.h ../include/fltk3/Image.h
+fltk3/TiledImage.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/TiledImage.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/TiledImage.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/TiledImage.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TiledImage.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TiledImage.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/TiledImage.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/TiledImage.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/TiledImage.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
+fltk3/TiledImage.o: ../include/fltk3/RGBImage.h
+fltk3/Tooltip.o: ../include/fltk3/Tooltip.h ../include/fltk3/run.h
+fltk3/Tooltip.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/Tooltip.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/Tooltip.o: ../include/fltk3/enumerations.h ../include/fltk3/Widget.h
+fltk3/Tooltip.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Tooltip.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Tooltip.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Tooltip.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Tooltip.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Tooltip.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Tooltip.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Tooltip.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Tooltip.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Tooltip.o: ../include/fltk3/RGBImage.h ../include/fltk3/MenuWindow.h
+fltk3/Tooltip.o: ../include/fltk3/SingleWindow.h
+fltk3/Tree.o: ../include/fltk3/Tree.h ../include/fltk3/run.h
+fltk3/Tree.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/Tree.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/Tree.o: ../include/fltk3/enumerations.h ../include/fltk3/Group.h
+fltk3/Tree.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Tree.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Tree.o: ../include/fltk3/Object.h ../include/fltk3/Scrollbar.h
+fltk3/Tree.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/Tree.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Tree.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/Tree.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Tree.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Tree.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Tree.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Tree.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Tree.o: ../include/fltk3/RGBImage.h ../include/fltk3/TreeItem.h
+fltk3/Tree.o: ../include/fltk3/TreeItemArray.h ../include/fltk3/TreePrefs.h
+fltk3/TreeItem.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
+fltk3/TreeItem.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TreeItem.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/TreeItem.o: ../include/fltk3/TreeItem.h ../include/fltk3/run.h
+fltk3/TreeItem.o: ../include/fltk3/utf8.h ../include/fltk3/Xutf8.h
+fltk3/TreeItem.o: ../include/fltk3/Image.h ../include/fltk3/draw.h
+fltk3/TreeItem.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/TreeItem.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/TreeItem.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/TreeItem.o: ../include/fltk3/Wrapper.h ../include/fltk3/Device.h
+fltk3/TreeItem.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/TreeItem.o: ../include/fltk3/Preferences.h ../include/fltk3/Bitmap.h
+fltk3/TreeItem.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/TreeItem.o: ../include/fltk3/RGBImage.h
+fltk3/TreeItem.o: ../include/fltk3/TreeItemArray.h
+fltk3/TreeItem.o: ../include/fltk3/TreePrefs.h
+fltk3/TreeItemArray.o: ../include/fltk3/TreeItemArray.h
+fltk3/TreeItemArray.o: ../include/fltk3/Export.h ../include/fltk3/TreeItem.h
+fltk3/TreeItemArray.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TreeItemArray.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/TreeItemArray.o: ../include/fltk3/enumerations.h
+fltk3/TreeItemArray.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/TreeItemArray.o: ../include/fltk3/Object.h ../include/fltk3/Image.h
+fltk3/TreeItemArray.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/TreeItemArray.o: ../include/fltk3/Window.h
+fltk3/TreeItemArray.o: ../include/fltk3/enumerations.h
+fltk3/TreeItemArray.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/TreeItemArray.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/TreeItemArray.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/TreeItemArray.o: ../include/fltk3/Plugin.h
+fltk3/TreeItemArray.o: ../include/fltk3/Preferences.h
+fltk3/TreeItemArray.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/TreeItemArray.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/TreeItemArray.o: ../include/fltk3/TreePrefs.h
+fltk3/TreePrefs.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/TreePrefs.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/TreePrefs.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/TreePrefs.o: ../include/fltk3/Pixmap.h ../include/fltk3/Image.h
+fltk3/TreePrefs.o: ../include/fltk3/TreePrefs.h
+fltk3/Valuator.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Valuator.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Valuator.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Valuator.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
+fltk3/Valuator.o: ../include/fltk3/math.h fltk3/flstring.h
+fltk3/Valuator.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/ValueInput.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ValueInput.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ValueInput.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/ValueInput.o: ../include/fltk3/ValueInput.h ../include/fltk3/Valuator.h
+fltk3/ValueInput.o: ../include/fltk3/Widget.h ../include/fltk3/Input.h
+fltk3/ValueInput.o: ../include/fltk3/Input_.h ../include/fltk3/Group.h
+fltk3/ValueInput.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ValueInput.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ValueInput.o: ../include/fltk3/math.h
+fltk3/ValueOutput.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ValueOutput.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ValueOutput.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/ValueOutput.o: ../include/fltk3/ValueOutput.h
+fltk3/ValueOutput.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
+fltk3/ValueOutput.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/ValueOutput.o: ../include/fltk3/Window.h
+fltk3/ValueOutput.o: ../include/fltk3/enumerations.h
+fltk3/ValueOutput.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/ValueOutput.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ValueOutput.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ValueOutput.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/ValueOutput.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/ValueOutput.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/ValueOutput.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/ValueOutput.o: ../include/fltk3/RGBImage.h
+fltk3/ValueSlider.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ValueSlider.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ValueSlider.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/ValueSlider.o: ../include/fltk3/ValueSlider.h ../include/fltk3/Slider.h
+fltk3/ValueSlider.o: ../include/fltk3/Valuator.h ../include/fltk3/Widget.h
+fltk3/ValueSlider.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/ValueSlider.o: ../include/fltk3/Window.h
+fltk3/ValueSlider.o: ../include/fltk3/enumerations.h
+fltk3/ValueSlider.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/ValueSlider.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ValueSlider.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ValueSlider.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/ValueSlider.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/ValueSlider.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/ValueSlider.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/ValueSlider.o: ../include/fltk3/RGBImage.h
+fltk3/Widget.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Widget.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Widget.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/Widget.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/Widget.o: ../include/fltk3/Object.h ../include/fltk3/Wrapper.h
+fltk3/Widget.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Widget.o: ../include/fltk3/Tooltip.h ../include/fltk3/draw.h
+fltk3/Widget.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Widget.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/Widget.o: ../include/fltk3/Group.h ../include/fltk3/Device.h
+fltk3/Widget.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Widget.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Widget.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Widget.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/Widget.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Widget.o: ../include/config.h
+fltk3/Window.o: ../include/config.h ../include/fltk3/run.h
+fltk3/Window.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/Window.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/Window.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/Window.o: ../include/fltk3/Window.h ../include/fltk3/Window.h
+fltk3/Window.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/Window.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/Window.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Window.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/Window.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/Window.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/Window.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/Window.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/Window.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/Window.o: ../include/fltk3/RGBImage.h
+fltk3/Window_fullscreen.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Window_fullscreen.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Window_fullscreen.o: ../include/fltk3/Xutf8.h
+fltk3/Window_fullscreen.o: ../include/fltk3/enumerations.h
+fltk3/Window_fullscreen.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/Window_fullscreen.o: ../include/config.h
+fltk3/Window_hotspot.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/Window_hotspot.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Window_hotspot.o: ../include/fltk3/Xutf8.h
+fltk3/Window_hotspot.o: ../include/fltk3/enumerations.h
+fltk3/Window_hotspot.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Window_hotspot.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Window_hotspot.o: ../include/fltk3/Widget.h
+fltk3/Window_hotspot.o: ../include/fltk3/Rectangle.h
+fltk3/Window_hotspot.o: ../include/fltk3/Object.h ../include/fltk3/x.h
+fltk3/Window_hotspot.o: ../include/fltk3/Window.h
+fltk3/Window_iconize.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/Window_iconize.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Window_iconize.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/Wizard.o: ../include/fltk3/WizardGroup.h ../include/fltk3/Group.h
+fltk3/Wizard.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/Wizard.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
+fltk3/Wizard.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/Wizard.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/Wizard.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/Wizard.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/Wizard.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/Wizard.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
+fltk3/Wizard.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/Wizard.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/Wizard.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/Wizard.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/XBMImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/XBMImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/XBMImage.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/XBMImage.o: ../include/fltk3/XBMImage.h ../include/fltk3/Bitmap.h
+fltk3/XBMImage.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
+fltk3/XBMImage.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/XBMImage.o: ../include/config.h
+fltk3/XPMImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/XPMImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/XPMImage.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/XPMImage.o: ../include/fltk3/XPMImage.h ../include/fltk3/Pixmap.h
+fltk3/XPMImage.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
+fltk3/XPMImage.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/XPMImage.o: ../include/config.h
+fltk3/abort.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/abort.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/abort.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/abort.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/add_idle.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/add_idle.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/add_idle.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/arg.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/arg.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/arg.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/arg.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/arg.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/arg.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/arg.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/arg.o: ../include/fltk3/Object.h ../include/fltk3/Tooltip.h
+fltk3/arg.o: ../include/fltk3/filename.h ../include/fltk3/draw.h
+fltk3/arg.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
+fltk3/arg.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/arg.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/arg.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/arg.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/arg.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/compose.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/compose.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/compose.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/compose.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/display.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/display.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/display.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/display.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/display.o: ../include/config.h
+fltk3/get_key.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/get_key.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/get_key.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/get_key.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/get_system_colors.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/get_system_colors.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/get_system_colors.o: ../include/fltk3/Xutf8.h
+fltk3/get_system_colors.o: ../include/fltk3/enumerations.h
+fltk3/get_system_colors.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/get_system_colors.o: ../include/fltk3/Window.h
+fltk3/get_system_colors.o: ../include/fltk3/enumerations.h
+fltk3/get_system_colors.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/get_system_colors.o: ../include/fltk3/Widget.h
+fltk3/get_system_colors.o: ../include/fltk3/Wrapper.h
+fltk3/get_system_colors.o: ../include/fltk3/Widget.h
+fltk3/get_system_colors.o: ../include/fltk3/Rectangle.h
+fltk3/get_system_colors.o: ../include/fltk3/Object.h
+fltk3/get_system_colors.o: ../include/fltk3/Device.h
+fltk3/get_system_colors.o: ../include/fltk3/Object.h
+fltk3/get_system_colors.o: ../include/fltk3/Plugin.h
+fltk3/get_system_colors.o: ../include/fltk3/Preferences.h
+fltk3/get_system_colors.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/get_system_colors.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/get_system_colors.o: ../include/fltk3/RGBImage.h
+fltk3/get_system_colors.o: ../include/fltk3/math.h ../include/fltk3/utf8.h
+fltk3/get_system_colors.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/get_system_colors.o: ../include/config.h ../include/fltk3/TiledImage.h
+fltk3/get_system_colors.o: fltk3/tile.xpm
+fltk3/grab.o: ../include/config.h ../include/fltk3/run.h
+fltk3/grab.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/grab.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/grab.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/grab.o: ../include/fltk3/Window.h
+fltk3/lock.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/lock.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/lock.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/lock.o: ../include/config.h
+fltk3/own_colormap.o: ../include/config.h ../include/fltk3/run.h
+fltk3/own_colormap.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/own_colormap.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/own_colormap.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/own_colormap.o: ../include/fltk3/Window.h
+fltk3/visual.o: ../include/config.h ../include/fltk3/run.h
+fltk3/visual.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/visual.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/visual.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/visual.o: ../include/fltk3/Window.h
+fltk3/x11.o: ../include/config.h ../include/fltk3/run.h
+fltk3/x11.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/x11.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/x11.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/x11.o: ../include/fltk3/Window.h ../include/fltk3/Window.h
+fltk3/x11.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/x11.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/x11.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/x11.o: ../include/fltk3/utf8.h ../include/fltk3/Tooltip.h
+fltk3/x11.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/x11.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/x11.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/x11.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/x11.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/x11.o: ../include/fltk3/RGBImage.h ../include/fltk3/PagedDevice.h
+fltk3/x11.o: ../include/fltk3/filename.h fltk3/flstring.h
+fltk3/x11.o: ../include/fltk3/Export.h
+fltk3/filename_absolute.o: ../include/fltk3/filename.h
+fltk3/filename_absolute.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3/filename_absolute.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/filename_expand.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
+fltk3/filename_expand.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/filename_expand.o: ../include/config.h
+fltk3/filename_ext.o: ../include/fltk3/filename.h
+fltk3/filename_isdir.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/filename_isdir.o: ../include/config.h ../include/fltk3/filename.h
+fltk3/filename_isdir.o: ../include/fltk3/utf8.h
+fltk3/filename_list.o: ../include/fltk3/filename.h ../include/fltk3/utf8.h
+fltk3/filename_list.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/filename_list.o: ../include/config.h
+fltk3/filename_match.o: ../include/fltk3/filename.h
+fltk3/filename_setext.o: ../include/fltk3/filename.h fltk3/flstring.h
+fltk3/filename_setext.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/arc.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/arc.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
+fltk3/arc.o: ../include/fltk3/types.h ../include/fltk3/Window.h
+fltk3/arc.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/arc.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/arc.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/arc.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/arc.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/arc.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/arc.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/arc.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/arc.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/arc.o: ../include/fltk3/math.h
+fltk3/arci.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/arci.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
+fltk3/arci.o: ../include/fltk3/types.h ../include/fltk3/Window.h
+fltk3/arci.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/arci.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/arci.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/arci.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/arci.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/arci.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/arci.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/arci.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/arci.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/arci.o: ../include/config.h
+fltk3/ask.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/ask.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/ask.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ask.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/ask.o: ../include/fltk3/ask.h ../include/fltk3/Box.h
+fltk3/ask.o: ../include/fltk3/Widget.h ../include/fltk3/Button.h
+fltk3/ask.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ask.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/ask.o: ../include/fltk3/ReturnButton.h ../include/fltk3/Button.h
+fltk3/ask.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/ask.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
+fltk3/ask.o: ../include/fltk3/SecretInput.h ../include/fltk3/Input.h
+fltk3/ask.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/ask.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/ask.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/ask.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/ask.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/ask.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/ask.o: ../include/fltk3/RGBImage.h
+fltk3/boxtype.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/boxtype.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/boxtype.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/boxtype.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/boxtype.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/boxtype.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/boxtype.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/boxtype.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/boxtype.o: ../include/fltk3/Wrapper.h ../include/fltk3/Device.h
+fltk3/boxtype.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/boxtype.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/boxtype.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/boxtype.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/boxtype.o: ../include/config.h
+fltk3/color.o: fltk3/xcolor.h ../include/config.h
+fltk3/color.o: ../include/fltk3/enumerations.h ../include/fltk3/run.h
+fltk3/color.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/color.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/color.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/color.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/color.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/color.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/color.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/color.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/color.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/color.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/color.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/color.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/cursor.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/cursor.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/cursor.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/cursor.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/cursor.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/cursor.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/cursor.o: ../include/fltk3/Object.h ../include/fltk3/x.h
+fltk3/cursor.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/cursor.o: ../include/fltk3/enumerations.h ../include/fltk3/Device.h
+fltk3/cursor.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/cursor.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/cursor.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/cursor.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/curve.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/curve.o: ../include/fltk3/enumerations.h ../include/fltk3/Export.h
+fltk3/curve.o: ../include/fltk3/types.h ../include/fltk3/Window.h
+fltk3/curve.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/curve.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/curve.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/curve.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/curve.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/curve.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/curve.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/curve.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/curve.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/diamond_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/diamond_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/diamond_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/diamond_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/diamond_box.o: ../include/fltk3/Window.h
+fltk3/diamond_box.o: ../include/fltk3/enumerations.h
+fltk3/diamond_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/diamond_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/diamond_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/diamond_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/diamond_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/diamond_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/diamond_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/diamond_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/draw.o: ../include/fltk3/utf8.h ../include/fltk3/run.h
+fltk3/draw.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/draw.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/draw.o: ../include/fltk3/enumerations.h ../include/fltk3/draw.h
+fltk3/draw.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/draw.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/draw.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/draw.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/draw.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/draw.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/draw.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/draw.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/draw.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/draw.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/draw.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/draw_image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/draw_image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/draw_image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/draw_image.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/draw_image.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/draw_image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/draw_image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/draw_image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/draw_image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/draw_image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/draw_image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/draw_image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/draw_image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/draw_image.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/draw_image.o: ../include/config.h
+fltk3/draw_pixmap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/draw_pixmap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/draw_pixmap.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/draw_pixmap.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/draw_pixmap.o: ../include/fltk3/Window.h
+fltk3/draw_pixmap.o: ../include/fltk3/enumerations.h
+fltk3/draw_pixmap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/draw_pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/draw_pixmap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/draw_pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/draw_pixmap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/draw_pixmap.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/draw_pixmap.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/draw_pixmap.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/draw_pixmap.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/draw_pixmap.o: ../include/config.h
+fltk3/encoding_latin1.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/encoding_latin1.o: ../include/fltk3/enumerations.h
+fltk3/encoding_latin1.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/encoding_latin1.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/encoding_latin1.o: ../include/fltk3/enumerations.h
+fltk3/encoding_latin1.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/encoding_latin1.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/encoding_latin1.o: ../include/fltk3/Widget.h
+fltk3/encoding_latin1.o: ../include/fltk3/Rectangle.h
+fltk3/encoding_latin1.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/encoding_latin1.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/encoding_latin1.o: ../include/fltk3/Preferences.h
+fltk3/encoding_latin1.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/encoding_latin1.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/encoding_latin1.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/encoding_latin1.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/enumerations.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Export.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/types.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Window.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Xutf8.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/enumerations.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Window.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Group.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Widget.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Wrapper.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Widget.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Rectangle.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Object.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Device.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Object.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Plugin.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Preferences.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Image.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Bitmap.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Image.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Pixmap.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/encoding_mac_roman.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/engraved_label.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/engraved_label.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/engraved_label.o: ../include/fltk3/Xutf8.h
+fltk3/engraved_label.o: ../include/fltk3/enumerations.h
+fltk3/engraved_label.o: ../include/fltk3/Widget.h
+fltk3/engraved_label.o: ../include/fltk3/Rectangle.h
+fltk3/engraved_label.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3/engraved_label.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/engraved_label.o: ../include/fltk3/enumerations.h
+fltk3/engraved_label.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/engraved_label.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/engraved_label.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/engraved_label.o: ../include/fltk3/Plugin.h
+fltk3/engraved_label.o: ../include/fltk3/Preferences.h
+fltk3/engraved_label.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/engraved_label.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/engraved_label.o: ../include/fltk3/RGBImage.h
+fltk3/file_dir.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/file_dir.o: ../include/config.h ../include/fltk3/filename.h
+fltk3/file_dir.o: ../include/fltk3/FileChooser.h ../include/fltk3/run.h
+fltk3/file_dir.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/file_dir.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/file_dir.o: ../include/fltk3/enumerations.h
+fltk3/file_dir.o: ../include/fltk3/DoubleWindow.h ../include/fltk3/Window.h
+fltk3/file_dir.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/file_dir.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/file_dir.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/file_dir.o: ../include/fltk3/Choice.h ../include/fltk3/Menu_.h
+fltk3/file_dir.o: ../include/fltk3/MenuItem.h ../include/fltk3/Image.h
+fltk3/file_dir.o: ../include/fltk3/MenuButton.h ../include/fltk3/Button.h
+fltk3/file_dir.o: ../include/fltk3/Preferences.h
+fltk3/file_dir.o: ../include/fltk3/TiledGroup.h ../include/fltk3/Group.h
+fltk3/file_dir.o: ../include/fltk3/FileBrowser.h ../include/fltk3/Browser.h
+fltk3/file_dir.o: ../include/fltk3/Browser_.h ../include/fltk3/Scrollbar.h
+fltk3/file_dir.o: ../include/fltk3/Slider.h ../include/fltk3/Valuator.h
+fltk3/file_dir.o: ../include/fltk3/FileIcon.h ../include/fltk3/run.h
+fltk3/file_dir.o: ../include/fltk3/filename.h ../include/fltk3/Box.h
+fltk3/file_dir.o: ../include/fltk3/CheckButton.h
+fltk3/file_dir.o: ../include/fltk3/LightButton.h ../include/fltk3/Button.h
+fltk3/file_dir.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
+fltk3/file_dir.o: ../include/fltk3/Input_.h ../include/fltk3/ReturnButton.h
+fltk3/file_dir.o: ../include/fltk3/ask.h
+fltk3/font.o: fltk3/flstring.h ../include/fltk3/Export.h ../include/config.h
+fltk3/font.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/font.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/font.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/font.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/font.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/font.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/font.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/font.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/font.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/font.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/font.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/font.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/font.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/font.o: fltk3/font.h ../include/fltk3/Xutf8.h fltk3/x11_font.cxx
+fltk3/gtk.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/gtk.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/gtk.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/gtk.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/gtk.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/gtk.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/gtk.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/gtk.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/gtk.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/gtk.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/gtk.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/gtk.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/gtk.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/labeltype.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/labeltype.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/labeltype.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/labeltype.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/labeltype.o: ../include/fltk3/Object.h ../include/fltk3/Group.h
+fltk3/labeltype.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/labeltype.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/labeltype.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/labeltype.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/labeltype.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/labeltype.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/labeltype.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/labeltype.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/labeltype.o: ../include/fltk3/RGBImage.h ../include/fltk3/Input_.h
+fltk3/line_style.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/line_style.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/line_style.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/line_style.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/line_style.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/line_style.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/line_style.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/line_style.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/line_style.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/line_style.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/line_style.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/line_style.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/line_style.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/line_style.o: ../include/fltk3/Printer.h ../include/fltk3/PagedDevice.h
+fltk3/line_style.o: ../include/fltk3/PostScript.h fltk3/flstring.h
+fltk3/line_style.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/open_uri.o: ../include/fltk3/filename.h fltk3/flstring.h
+fltk3/open_uri.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/oval_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/oval_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/oval_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/oval_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/oval_box.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/oval_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/oval_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/oval_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/oval_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/oval_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/oval_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/oval_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/oval_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/overlay.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/overlay.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/overlay.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/overlay.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/overlay.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/overlay.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/overlay.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/overlay.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/overlay.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/overlay.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/overlay.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/overlay.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/overlay_visual.o: ../include/config.h
+fltk3/plastic.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/plastic.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/plastic.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/plastic.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/plastic.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/plastic.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/plastic.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/plastic.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/plastic.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/plastic.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/plastic.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/plastic.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/plastic.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/plastic.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/plastic.o: ../include/config.h
+fltk3/read_image.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/read_image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/read_image.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/read_image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/read_image.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/read_image.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/read_image.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/read_image.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/read_image.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/read_image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/read_image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/read_image.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/read_image.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/read_image.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/read_image.o: ../include/config.h
+fltk3/rect.o: ../include/config.h ../include/fltk3/run.h
+fltk3/rect.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/rect.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/rect.o: ../include/fltk3/enumerations.h ../include/fltk3/Widget.h
+fltk3/rect.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/rect.o: ../include/fltk3/Printer.h ../include/fltk3/x.h
+fltk3/rect.o: ../include/fltk3/Window.h ../include/fltk3/PagedDevice.h
+fltk3/rect.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/rect.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/rect.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/rect.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/rect.o: ../include/fltk3/RGBImage.h ../include/fltk3/Window.h
+fltk3/rect.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/rect.o: ../include/fltk3/Wrapper.h ../include/fltk3/draw.h
+fltk3/rect.o: ../include/fltk3/enumerations.h ../include/fltk3/PostScript.h
+fltk3/round_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/round_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/round_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/round_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/round_box.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/round_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/round_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/round_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/round_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/round_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/round_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/round_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/round_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/rounded_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/rounded_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/rounded_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/rounded_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/rounded_box.o: ../include/fltk3/Window.h
+fltk3/rounded_box.o: ../include/fltk3/enumerations.h
+fltk3/rounded_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/rounded_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/rounded_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/rounded_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/rounded_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/rounded_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/rounded_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/rounded_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/scroll_area.o: ../include/config.h ../include/fltk3/run.h
+fltk3/scroll_area.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
+fltk3/scroll_area.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
+fltk3/scroll_area.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
+fltk3/scroll_area.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/scroll_area.o: ../include/fltk3/enumerations.h
+fltk3/scroll_area.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/scroll_area.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/scroll_area.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/scroll_area.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/scroll_area.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/scroll_area.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/scroll_area.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/scroll_area.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/set_font.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/set_font.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/set_font.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/set_font.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/set_font.o: ../include/fltk3/draw.h ../include/fltk3/enumerations.h
+fltk3/set_font.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/set_font.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/set_font.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/set_font.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/set_font.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/set_font.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/set_font.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/set_font.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/set_font.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/set_font.o: ../include/config.h fltk3/font.h ../include/fltk3/Xutf8.h
+fltk3/set_fonts.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/set_fonts.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/set_fonts.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/set_fonts.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/set_fonts.o: fltk3/font.h ../include/config.h ../include/fltk3/Xutf8.h
+fltk3/set_fonts.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/set_fonts.o: fltk3/x11_set_fonts.cxx
+fltk3/shadow_box.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/shadow_box.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/shadow_box.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/shadow_box.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/shadow_box.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/shadow_box.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/shadow_box.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/shadow_box.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/shadow_box.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/shadow_box.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/shadow_box.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/shadow_box.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/shadow_box.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/shortcut.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/shortcut.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/shortcut.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/shortcut.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/shortcut.o: ../include/fltk3/Object.h ../include/fltk3/Button.h
+fltk3/shortcut.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/shortcut.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/shortcut.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/shortcut.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/shortcut.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/shortcut.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/shortcut.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/shortcut.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/shortcut.o: ../include/fltk3/RGBImage.h fltk3/flstring.h
+fltk3/shortcut.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/show_colormap.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/show_colormap.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/show_colormap.o: ../include/fltk3/Xutf8.h
+fltk3/show_colormap.o: ../include/fltk3/enumerations.h
+fltk3/show_colormap.o: ../include/fltk3/SingleWindow.h
+fltk3/show_colormap.o: ../include/fltk3/Window.h ../include/fltk3/draw.h
+fltk3/show_colormap.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/show_colormap.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/show_colormap.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/show_colormap.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/show_colormap.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/show_colormap.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/show_colormap.o: ../include/fltk3/Preferences.h
+fltk3/show_colormap.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/show_colormap.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/show_colormap.o: ../include/fltk3/RGBImage.h
+fltk3/show_colormap.o: ../include/fltk3/show_colormap.h ../include/config.h
+fltk3/symbols.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/symbols.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/symbols.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/symbols.o: ../include/fltk3/draw.h ../include/fltk3/x.h
+fltk3/symbols.o: ../include/fltk3/Window.h ../include/fltk3/enumerations.h
+fltk3/symbols.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3/symbols.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3/symbols.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
+fltk3/symbols.o: ../include/fltk3/Object.h ../include/fltk3/Device.h
+fltk3/symbols.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/symbols.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/symbols.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
+fltk3/symbols.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
+fltk3/symbols.o: ../include/fltk3/math.h fltk3/flstring.h
+fltk3/symbols.o: ../include/fltk3/Export.h ../include/config.h
+fltk3/utf8.o: ../include/config.h ../include/fltk3/filename.h
+fltk3/utf8.o: ../include/fltk3/Xutf8.h ../include/fltk3/utf8.h
+fltk3/utf.o: ../include/fltk3/utf8.h fltk3/xutf8/mk_wcwidth.c
+fltk3/vertex.o: ../include/config.h ../include/fltk3/draw.h
+fltk3/vertex.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/vertex.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/vertex.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/vertex.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
+fltk3/vertex.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/vertex.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/vertex.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
+fltk3/vertex.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3/vertex.o: ../include/fltk3/Plugin.h ../include/fltk3/Preferences.h
+fltk3/vertex.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3/vertex.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/vertex.o: ../include/fltk3/RGBImage.h ../include/fltk3/run.h
+fltk3/vertex.o: ../include/fltk3/utf8.h ../include/fltk3/math.h
+fltk3/numericsort.o: ../include/config.h ../include/fltk3/filename.h
+fltk3/ps_image.o: ../include/fltk3/PostScript.h
+fltk3/ps_image.o: ../include/fltk3/PagedDevice.h ../include/fltk3/Device.h
+fltk3/ps_image.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
+fltk3/ps_image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/ps_image.o: ../include/fltk3/Window.h ../include/fltk3/Xutf8.h
+fltk3/ps_image.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3/ps_image.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
+fltk3/ps_image.o: ../include/fltk3/Object.h ../include/fltk3/Bitmap.h
+fltk3/ps_image.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3/ps_image.o: ../include/fltk3/RGBImage.h ../include/fltk3/Window.h
+fltk3/ps_image.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
+fltk3/ps_image.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
+fltk3/ps_image.o: ../include/fltk3/Rectangle.h ../include/fltk3/draw.h
+fltk3/ps_image.o: ../include/fltk3/enumerations.h ../include/fltk3/run.h
+fltk3/ps_image.o: ../include/fltk3/utf8.h
+fltk3/scandir.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/scandir.o: ../include/config.h
+fltk3/screen_xywh.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3/screen_xywh.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3/screen_xywh.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
+fltk3/screen_xywh.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3/screen_xywh.o: ../include/config.h
 fltk3gl/GLChoice.o: ../include/config.h ../include/fltk3/run.h
 fltk3gl/GLChoice.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
 fltk3gl/GLChoice.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
 fltk3gl/GLChoice.o: ../include/fltk3/enumerations.h ../include/fltk3/x.h
 fltk3gl/GLChoice.o: ../include/fltk3/Window.h fltk3gl/GLChoice.H
 fltk3gl/GLChoice.o: ../include/fltk3gl/glDraw.h ../include/fltk3gl/gl.h
-fltk3gl/GLChoice.o: ../include/fltk3/enumerations.h core/flstring.h
+fltk3gl/GLChoice.o: ../include/fltk3/enumerations.h fltk3/flstring.h
 fltk3gl/GLChoice.o: ../include/fltk3/Export.h ../include/fltk3/utf8.h
 fltk3gl/GLDevicePlugin.o: ../include/config.h ../include/fltk3/Printer.h
 fltk3gl/GLDevicePlugin.o: ../include/fltk3/x.h
@@ -1953,7 +1787,7 @@
 fltk3gl/GLOverlay.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
 fltk3gl/GLOverlay.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
 fltk3gl/GLOverlay.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-fltk3gl/GLWindow.o: core/flstring.h ../include/fltk3/Export.h
+fltk3gl/GLWindow.o: fltk3/flstring.h ../include/fltk3/Export.h
 fltk3gl/GLWindow.o: ../include/config.h ../include/fltk3/Wrapper.h
 fltk3gl/GLWindow.o: ../include/fltk3/Widget.h ../include/fltk3/enumerations.h
 fltk3gl/GLWindow.o: ../include/fltk3/Export.h ../include/fltk3/types.h
@@ -2029,7 +1863,7 @@
 fltk3gl/freeglut_teapot.o: ../include/fltk3/Rectangle.h
 fltk3gl/freeglut_teapot.o: ../include/fltk3/Object.h
 fltk3gl/freeglut_teapot.o: fltk3gl/freeglut_teapot_data.h
-fltk3gl/gl_draw.o: core/flstring.h ../include/fltk3/Export.h
+fltk3gl/gl_draw.o: fltk3/flstring.h ../include/fltk3/Export.h
 fltk3gl/gl_draw.o: ../include/config.h ../include/fltk3/run.h
 fltk3gl/gl_draw.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
 fltk3gl/gl_draw.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
@@ -2044,7 +1878,7 @@
 fltk3gl/gl_draw.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
 fltk3gl/gl_draw.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
 fltk3gl/gl_draw.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-fltk3gl/gl_draw.o: fltk3gl/GLChoice.H core/Fl_Font.H ../include/fltk3/Xutf8.h
+fltk3gl/gl_draw.o: fltk3gl/GLChoice.H fltk3/font.h ../include/fltk3/Xutf8.h
 fltk3gl/gl_draw.o: ../include/fltk3/utf8.h
 fltk3gl/gl_start.o: ../include/config.h ../include/fltk3/run.h
 fltk3gl/gl_start.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
@@ -2060,7 +1894,7 @@
 fltk3gl/gl_start.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
 fltk3gl/gl_start.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
 fltk3gl/gl_start.o: ../include/fltk3/RGBImage.h fltk3gl/GLChoice.H
-fltk3gl/glut_compatability.o: core/flstring.h ../include/fltk3/Export.h
+fltk3gl/glut_compatability.o: fltk3/flstring.h ../include/fltk3/Export.h
 fltk3gl/glut_compatability.o: ../include/config.h ../include/fltk3gl/glut.h
 fltk3gl/glut_compatability.o: ../include/fltk3gl/gl.h
 fltk3gl/glut_compatability.o: ../include/fltk3/enumerations.h
@@ -2088,119 +1922,136 @@
 fltk3gl/glut_font.o: ../include/fltk3/Group.h ../include/fltk3/Widget.h
 fltk3gl/glut_font.o: ../include/fltk3/Wrapper.h ../include/fltk3/Widget.h
 fltk3gl/glut_font.o: ../include/fltk3/Rectangle.h ../include/fltk3/Object.h
-core/Fl_BMP_Image.o: ../include/fltk3/BMPImage.h ../include/fltk3/Image.h
-core/Fl_BMP_Image.o: ../include/fltk3/utf8.h ../include/config.h
-core/Fl_File_Icon2.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_File_Icon2.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_File_Icon2.o: ../include/fltk3/math.h ../include/fltk3/FileIcon.h
-core/Fl_File_Icon2.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_File_Icon2.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_File_Icon2.o: ../include/fltk3/Xutf8.h
-core/Fl_File_Icon2.o: ../include/fltk3/enumerations.h
-core/Fl_File_Icon2.o: ../include/fltk3/SharedImage.h ../include/fltk3/Image.h
-core/Fl_File_Icon2.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_File_Icon2.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
-core/Fl_File_Icon2.o: ../include/fltk3/x.h ../include/fltk3/Window.h
-core/Fl_File_Icon2.o: ../include/fltk3/enumerations.h
-core/Fl_File_Icon2.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_File_Icon2.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_File_Icon2.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
-core/Fl_File_Icon2.o: ../include/fltk3/Plugin.h
-core/Fl_File_Icon2.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
-core/Fl_File_Icon2.o: ../include/fltk3/Bitmap.h ../include/fltk3/Pixmap.h
-core/Fl_File_Icon2.o: ../include/fltk3/RGBImage.h ../include/fltk3/filename.h
-core/Fl_GIF_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_GIF_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_GIF_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_GIF_Image.o: ../include/fltk3/GIFImage.h ../include/fltk3/Pixmap.h
-core/Fl_GIF_Image.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
-core/Fl_GIF_Image.o: core/flstring.h ../include/fltk3/Export.h
-core/Fl_GIF_Image.o: ../include/config.h
-core/Fl_Help_Dialog.o: ../include/fltk3/HelpDialog.h ../include/fltk3/run.h
-core/Fl_Help_Dialog.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
-core/Fl_Help_Dialog.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
-core/Fl_Help_Dialog.o: ../include/fltk3/enumerations.h
-core/Fl_Help_Dialog.o: ../include/fltk3/DoubleWindow.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Object.h ../include/fltk3/Button.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Box.h ../include/fltk3/HelpView.h
-core/Fl_Help_Dialog.o: ../include/fltk3/run.h ../include/fltk3/Group.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Valuator.h ../include/fltk3/draw.h
-core/Fl_Help_Dialog.o: ../include/fltk3/x.h ../include/fltk3/enumerations.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Preferences.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
-core/Fl_Help_Dialog.o: ../include/fltk3/RGBImage.h
-core/Fl_Help_Dialog.o: ../include/fltk3/SharedImage.h
-core/Fl_Help_Dialog.o: ../include/fltk3/filename.h core/flstring.h
-core/Fl_Help_Dialog.o: ../include/fltk3/Export.h ../include/config.h
-core/Fl_Help_Dialog.o: ../include/fltk3/ask.h
-core/Fl_JPEG_Image.o: ../include/fltk3/JPEGImage.h ../include/fltk3/Image.h
-core/Fl_JPEG_Image.o: ../include/fltk3/SharedImage.h ../include/fltk3/utf8.h
-core/Fl_JPEG_Image.o: ../include/config.h
-core/Fl_PNG_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_PNG_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_PNG_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_PNG_Image.o: ../include/fltk3/PNGImage.h ../include/fltk3/Image.h
-core/Fl_PNG_Image.o: ../include/fltk3/SharedImage.h ../include/config.h
-core/Fl_PNG_Image.o: ../include/fltk3/utf8.h
-core/Fl_PNM_Image.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
-core/Fl_PNM_Image.o: ../include/fltk3/Export.h ../include/fltk3/types.h
-core/Fl_PNM_Image.o: ../include/fltk3/Xutf8.h ../include/fltk3/enumerations.h
-core/Fl_PNM_Image.o: ../include/fltk3/PNMImage.h ../include/fltk3/Image.h
-core/Fl_PNM_Image.o: ../include/fltk3/utf8.h core/flstring.h
-core/Fl_PNM_Image.o: ../include/fltk3/Export.h ../include/config.h
-core/fl_images_core.o: ../include/fltk3/SharedImage.h
-core/fl_images_core.o: ../include/fltk3/Image.h ../include/fltk3/BMPImage.h
-core/fl_images_core.o: ../include/fltk3/GIFImage.h ../include/fltk3/Pixmap.h
-core/fl_images_core.o: ../include/fltk3/JPEGImage.h
-core/fl_images_core.o: ../include/fltk3/PNGImage.h
-core/fl_images_core.o: ../include/fltk3/PNMImage.h core/flstring.h
-core/fl_images_core.o: ../include/fltk3/Export.h ../include/config.h
-core/flstring.o: core/flstring.h ../include/fltk3/Export.h
-core/flstring.o: ../include/config.h
-core/vsnprintf.o: core/flstring.h ../include/fltk3/Export.h
-core/vsnprintf.o: ../include/config.h
-core/xutf8/case.o: core/xutf8/headers/case.h
-core/xutf8/is_spacing.o: core/xutf8/headers/spacing.h
-core/xutf8/keysym2Ucs.o: core/xutf8/imKStoUCS.c core/xutf8/Xlibint.h
-core/xutf8/keysym2Ucs.o: core/xutf8/Ximint.h
-core/xutf8/utf8Input.o: ../include/config.h core/xutf8/lcUniConv/big5.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/gb2312.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/cp936ext.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/jisx0201.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/jisx0208.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/jisx0212.h
-core/xutf8/utf8Input.o: core/xutf8/lcUniConv/ksc5601.h
-core/xutf8/utf8Wrap.o: core/xutf8/ucs2fontmap.c
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/cp936ext.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/big5.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/gb2312.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_10.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_11.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_13.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_14.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_15.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_2.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_3.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_4.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_5.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_6.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_7.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_8.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/iso8859_9.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/jisx0201.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/jisx0208.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/jisx0212.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/koi8_r.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/koi8_u.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/ksc5601.h
-core/xutf8/utf8Wrap.o: core/xutf8/lcUniConv/cp1251.h
-core/xutf8/utf8Wrap.o: core/xutf8/headers/symbol_.h
-core/xutf8/utf8Wrap.o: core/xutf8/headers/dingbats_.h
+fltk3images/BMPImage.o: ../include/fltk3images/BMPImage.h
+fltk3images/BMPImage.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
+fltk3images/BMPImage.o: ../include/config.h
+fltk3images/FileIcon2.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3images/FileIcon2.o: ../include/fltk3/Export.h ../include/config.h
+fltk3images/FileIcon2.o: ../include/fltk3/math.h ../include/fltk3/FileIcon.h
+fltk3images/FileIcon2.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3images/FileIcon2.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3images/FileIcon2.o: ../include/fltk3/Xutf8.h
+fltk3images/FileIcon2.o: ../include/fltk3/enumerations.h
+fltk3images/FileIcon2.o: ../include/fltk3/SharedImage.h
+fltk3images/FileIcon2.o: ../include/fltk3/Image.h ../include/fltk3/Widget.h
+fltk3images/FileIcon2.o: ../include/fltk3/Rectangle.h
+fltk3images/FileIcon2.o: ../include/fltk3/Object.h ../include/fltk3/draw.h
+fltk3images/FileIcon2.o: ../include/fltk3/x.h ../include/fltk3/Window.h
+fltk3images/FileIcon2.o: ../include/fltk3/enumerations.h
+fltk3images/FileIcon2.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3images/FileIcon2.o: ../include/fltk3/Widget.h ../include/fltk3/Wrapper.h
+fltk3images/FileIcon2.o: ../include/fltk3/Device.h ../include/fltk3/Object.h
+fltk3images/FileIcon2.o: ../include/fltk3/Plugin.h
+fltk3images/FileIcon2.o: ../include/fltk3/Preferences.h
+fltk3images/FileIcon2.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3images/FileIcon2.o: ../include/fltk3/Pixmap.h
+fltk3images/FileIcon2.o: ../include/fltk3/RGBImage.h
+fltk3images/FileIcon2.o: ../include/fltk3/filename.h
+fltk3images/GIFImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3images/GIFImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3images/GIFImage.o: ../include/fltk3/Xutf8.h
+fltk3images/GIFImage.o: ../include/fltk3/enumerations.h
+fltk3images/GIFImage.o: ../include/fltk3images/GIFImage.h
+fltk3images/GIFImage.o: ../include/fltk3/Pixmap.h ../include/fltk3/Image.h
+fltk3images/GIFImage.o: ../include/fltk3/utf8.h fltk3/flstring.h
+fltk3images/GIFImage.o: ../include/fltk3/Export.h ../include/config.h
+fltk3images/HelpDialog.o: ../include/fltk3images/HelpDialog.h
+fltk3images/HelpDialog.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3images/HelpDialog.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3images/HelpDialog.o: ../include/fltk3/Xutf8.h
+fltk3images/HelpDialog.o: ../include/fltk3/enumerations.h
+fltk3images/HelpDialog.o: ../include/fltk3/DoubleWindow.h
+fltk3images/HelpDialog.o: ../include/fltk3/Window.h ../include/fltk3/Group.h
+fltk3images/HelpDialog.o: ../include/fltk3/Widget.h
+fltk3images/HelpDialog.o: ../include/fltk3/Wrapper.h
+fltk3images/HelpDialog.o: ../include/fltk3/Widget.h
+fltk3images/HelpDialog.o: ../include/fltk3/Rectangle.h
+fltk3images/HelpDialog.o: ../include/fltk3/Object.h ../include/fltk3/Button.h
+fltk3images/HelpDialog.o: ../include/fltk3/Input.h ../include/fltk3/Input_.h
+fltk3images/HelpDialog.o: ../include/fltk3/Box.h ../include/fltk3/HelpView.h
+fltk3images/HelpDialog.o: ../include/fltk3/run.h ../include/fltk3/Group.h
+fltk3images/HelpDialog.o: ../include/fltk3/Scrollbar.h
+fltk3images/HelpDialog.o: ../include/fltk3/Slider.h
+fltk3images/HelpDialog.o: ../include/fltk3/Valuator.h ../include/fltk3/draw.h
+fltk3images/HelpDialog.o: ../include/fltk3/x.h
+fltk3images/HelpDialog.o: ../include/fltk3/enumerations.h
+fltk3images/HelpDialog.o: ../include/fltk3/Window.h ../include/fltk3/Device.h
+fltk3images/HelpDialog.o: ../include/fltk3/Object.h ../include/fltk3/Plugin.h
+fltk3images/HelpDialog.o: ../include/fltk3/Preferences.h
+fltk3images/HelpDialog.o: ../include/fltk3/Image.h ../include/fltk3/Bitmap.h
+fltk3images/HelpDialog.o: ../include/fltk3/Image.h ../include/fltk3/Pixmap.h
+fltk3images/HelpDialog.o: ../include/fltk3/RGBImage.h
+fltk3images/HelpDialog.o: ../include/fltk3/SharedImage.h
+fltk3images/HelpDialog.o: ../include/fltk3/filename.h fltk3/flstring.h
+fltk3images/HelpDialog.o: ../include/fltk3/Export.h ../include/config.h
+fltk3images/HelpDialog.o: ../include/fltk3/ask.h
+fltk3images/images_core.o: ../include/fltk3/SharedImage.h
+fltk3images/images_core.o: ../include/fltk3/Image.h
+fltk3images/images_core.o: ../include/fltk3images/BMPImage.h
+fltk3images/images_core.o: ../include/fltk3images/GIFImage.h
+fltk3images/images_core.o: ../include/fltk3/Pixmap.h
+fltk3images/images_core.o: ../include/fltk3images/JPEGImage.h
+fltk3images/images_core.o: ../include/fltk3images/PNGImage.h
+fltk3images/images_core.o: ../include/fltk3images/PNMImage.h fltk3/flstring.h
+fltk3images/images_core.o: ../include/fltk3/Export.h ../include/config.h
+fltk3images/JPEGImage.o: ../include/fltk3images/JPEGImage.h
+fltk3images/JPEGImage.o: ../include/fltk3/Image.h
+fltk3images/JPEGImage.o: ../include/fltk3/SharedImage.h
+fltk3images/JPEGImage.o: ../include/fltk3/utf8.h ../include/config.h
+fltk3images/PNGImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3images/PNGImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3images/PNGImage.o: ../include/fltk3/Xutf8.h
+fltk3images/PNGImage.o: ../include/fltk3/enumerations.h
+fltk3images/PNGImage.o: ../include/fltk3images/PNGImage.h
+fltk3images/PNGImage.o: ../include/fltk3/Image.h
+fltk3images/PNGImage.o: ../include/fltk3/SharedImage.h ../include/config.h
+fltk3images/PNGImage.o: ../include/fltk3/utf8.h
+fltk3images/PNMImage.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
+fltk3images/PNMImage.o: ../include/fltk3/Export.h ../include/fltk3/types.h
+fltk3images/PNMImage.o: ../include/fltk3/Xutf8.h
+fltk3images/PNMImage.o: ../include/fltk3/enumerations.h
+fltk3images/PNMImage.o: ../include/fltk3images/PNMImage.h
+fltk3images/PNMImage.o: ../include/fltk3/Image.h ../include/fltk3/utf8.h
+fltk3images/PNMImage.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3images/PNMImage.o: ../include/config.h
+fltk3/flstring.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/flstring.o: ../include/config.h
+fltk3/vsnprintf.o: fltk3/flstring.h ../include/fltk3/Export.h
+fltk3/vsnprintf.o: ../include/config.h
+fltk3/xutf8/case.o: fltk3/xutf8/headers/case.h
+fltk3/xutf8/is_spacing.o: fltk3/xutf8/headers/spacing.h
+fltk3/xutf8/keysym2Ucs.o: fltk3/xutf8/imKStoUCS.c fltk3/xutf8/Xlibint.h
+fltk3/xutf8/keysym2Ucs.o: fltk3/xutf8/Ximint.h
+fltk3/xutf8/utf8Input.o: ../include/config.h fltk3/xutf8/lcUniConv/big5.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/gb2312.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/cp936ext.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/jisx0201.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/jisx0208.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/jisx0212.h
+fltk3/xutf8/utf8Input.o: fltk3/xutf8/lcUniConv/ksc5601.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/ucs2fontmap.c
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/cp936ext.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/big5.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/gb2312.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_10.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_11.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_13.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_14.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_15.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_2.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_3.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_4.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_5.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_6.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_7.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_8.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/iso8859_9.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/jisx0201.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/jisx0208.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/jisx0212.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/koi8_r.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/koi8_u.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/ksc5601.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/lcUniConv/cp1251.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/headers/symbol_.h
+fltk3/xutf8/utf8Wrap.o: fltk3/xutf8/headers/dingbats_.h

Modified: branches/branch-3.0/test/file_chooser.cxx
===================================================================
--- branches/branch-3.0/test/file_chooser.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/test/file_chooser.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -46,7 +46,7 @@
 #include <fltk3/FileChooser.h>
 #include <fltk3/FileIcon.h>
 #include <fltk3/SharedImage.h>
-#include <fltk3/PNMImage.h>
+#include <fltk3images/PNMImage.h>
 #include <fltk3/LightButton.h>
 #include <fltk3/DoubleWindow.h>
 #include <string.h>

Modified: branches/branch-3.0/test/help.cxx
===================================================================
--- branches/branch-3.0/test/help.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/test/help.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -33,7 +33,7 @@
 // Include necessary headers...
 //
 
-#include <fltk3/HelpDialog.h>
+#include <fltk3images/HelpDialog.h>
 
 
 #ifdef USING_XCODE

Modified: branches/branch-3.0/test/makedepend
===================================================================
--- branches/branch-3.0/test/makedepend	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/test/makedepend	2011-08-25 21:50:59 UTC (rev 9011)
@@ -362,7 +362,8 @@
 file_chooser.o: ../include/fltk3/FileInput.h ../include/fltk3/Input.h
 file_chooser.o: ../include/fltk3/Input_.h ../include/fltk3/ReturnButton.h
 file_chooser.o: ../include/fltk3/ask.h ../include/fltk3/FileIcon.h
-file_chooser.o: ../include/fltk3/SharedImage.h ../include/fltk3/PNMImage.h
+file_chooser.o: ../include/fltk3/SharedImage.h
+file_chooser.o: ../include/fltk3images/PNMImage.h
 file_chooser.o: ../include/fltk3/LightButton.h
 fonts.o: ../include/fltk3/run.h ../include/fltk3/utf8.h
 fonts.o: ../include/fltk3/Export.h ../include/fltk3/types.h
@@ -434,7 +435,7 @@
 hello.o: ../include/fltk3/Window.h ../include/fltk3/Box.h
 hello.o: ../include/fltk3/Widget.h ../include/fltk3/Rectangle.h
 hello.o: ../include/fltk3/Object.h
-help.o: ../include/fltk3/HelpDialog.h ../include/fltk3/run.h
+help.o: ../include/fltk3images/HelpDialog.h ../include/fltk3/run.h
 help.o: ../include/fltk3/utf8.h ../include/fltk3/Export.h
 help.o: ../include/fltk3/types.h ../include/fltk3/Xutf8.h
 help.o: ../include/fltk3/enumerations.h ../include/fltk3/DoubleWindow.h
@@ -586,7 +587,7 @@
 menubar.o: ../include/fltk3/Menu_.h ../include/fltk3/MenuItem.h
 menubar.o: ../include/fltk3/Image.h ../include/fltk3/ToggleButton.h
 menubar.o: ../include/fltk3/Button.h ../include/fltk3/MenuButton.h
-menubar.o: ../include/fltk3/Choice.h ../src/core/flstring.h
+menubar.o: ../include/fltk3/Choice.h ../src/fltk3/flstring.h
 menubar.o: ../include/fltk3/Export.h ../include/config.h
 menubar.o: ../include/fltk3/draw.h ../include/fltk3/x.h
 menubar.o: ../include/fltk3/enumerations.h ../include/fltk3/Window.h
@@ -813,7 +814,7 @@
 sudoku.o: ../include/fltk3/Preferences.h ../include/fltk3/Image.h
 sudoku.o: ../include/fltk3/Bitmap.h ../include/fltk3/Image.h
 sudoku.o: ../include/fltk3/Pixmap.h ../include/fltk3/RGBImage.h
-sudoku.o: ../include/fltk3/HelpDialog.h ../include/fltk3/Input.h
+sudoku.o: ../include/fltk3images/HelpDialog.h ../include/fltk3/Input.h
 sudoku.o: ../include/fltk3/Input_.h ../include/fltk3/Box.h
 sudoku.o: ../include/fltk3/HelpView.h ../include/fltk3/run.h
 sudoku.o: ../include/fltk3/Scrollbar.h ../include/fltk3/Slider.h

Modified: branches/branch-3.0/test/menubar.cxx
===================================================================
--- branches/branch-3.0/test/menubar.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/test/menubar.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -34,7 +34,7 @@
 #include <fltk3/Choice.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include "../src/core/flstring.h"
+#include "../src/fltk3/flstring.h"
 #include <fltk3/draw.h>
 
 void window_cb(fltk3::Widget* w, void*) {

Modified: branches/branch-3.0/test/sudoku.cxx
===================================================================
--- branches/branch-3.0/test/sudoku.cxx	2011-08-25 11:40:26 UTC (rev 9010)
+++ branches/branch-3.0/test/sudoku.cxx	2011-08-25 21:50:59 UTC (rev 9011)
@@ -32,7 +32,7 @@
 #include <fltk3/Group.h>
 #include <fltk3/ask.h>
 #include <fltk3/draw.h>
-#include <fltk3/HelpDialog.h>
+#include <fltk3images/HelpDialog.h>
 #include <fltk3/Preferences.h>
 #include <fltk3/SysMenuBar.h>
 #include <fltk3/x.h>

Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.