From c2c315e11feb622194be0a9c8de7e4852a831d55 Mon Sep 17 00:00:00 2001
From: Tobias Doerffel
Date: Thu, 16 Jun 2011 00:04:24 +0200
Subject: [PATCH] ZynAddSubFX/FLTK: updated to SVN revision 8805
Updated FLTK to SVN revision 8805 of branch-1.3.
---
plugins/zynaddsubfx/fltk/FL/Enumerations.H | 555 +-
plugins/zynaddsubfx/fltk/FL/Fl.H | 299 +-
plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Box.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Browser.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H | 12 +-
plugins/zynaddsubfx/fltk/FL/Fl_Button.H | 12 +-
plugins/zynaddsubfx/fltk/FL/Fl_Chart.H | 10 +-
.../zynaddsubfx/fltk/FL/Fl_Check_Browser.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Choice.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Clock.H | 22 +-
.../zynaddsubfx/fltk/FL/Fl_Color_Chooser.H | 26 +-
plugins/zynaddsubfx/fltk/FL/Fl_Counter.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Device.H | 326 +-
plugins/zynaddsubfx/fltk/FL/Fl_Dial.H | 10 +-
.../zynaddsubfx/fltk/FL/Fl_Double_Window.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Export.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H | 26 +-
plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H | 22 +-
plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H | 17 +-
plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Free.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Group.H | 22 +-
plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H | 30 +-
plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H | 16 +-
.../zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H | 8 +-
.../zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H | 26 +-
.../zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Image.H | 71 +-
plugins/zynaddsubfx/fltk/FL/Fl_Input.H | 433 +-
plugins/zynaddsubfx/fltk/FL/Fl_Input_.H | 88 +-
plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H | 20 +-
plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H | 12 +-
plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H | 21 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H | 32 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H | 132 +-
plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H | 6 +-
.../zynaddsubfx/fltk/FL/Fl_Multi_Browser.H | 12 +-
plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H | 6 +-
.../zynaddsubfx/fltk/FL/Fl_Multiline_Input.H | 25 +-
.../zynaddsubfx/fltk/FL/Fl_Multiline_Output.H | 24 +-
.../fltk/FL/Fl_Native_File_Chooser.H | 266 +-
.../fltk/FL/Fl_Native_File_Chooser_FLTK.H | 142 -
.../fltk/FL/Fl_Native_File_Chooser_MAC.H | 122 -
.../fltk/FL/Fl_Native_File_Chooser_WIN32.H | 120 -
plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Object.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Output.H | 41 +-
.../zynaddsubfx/fltk/FL/Fl_Overlay_Window.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Pack.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.H | 107 +-
plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Plugin.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_PostScript.H | 190 +-
plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H | 43 +-
plugins/zynaddsubfx/fltk/FL/Fl_Printer.H | 162 +-
plugins/zynaddsubfx/fltk/FL/Fl_Progress.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H | 8 +-
.../fltk/FL/Fl_Radio_Light_Button.H | 8 +-
.../fltk/FL/Fl_Radio_Round_Button.H | 8 +-
.../zynaddsubfx/fltk/FL/Fl_Repeat_Button.H | 6 +-
.../zynaddsubfx/fltk/FL/Fl_Return_Button.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Roller.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H | 8 +-
plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H | 24 +-
.../zynaddsubfx/fltk/FL/Fl_Select_Browser.H | 20 +-
plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H | 12 +-
.../zynaddsubfx/fltk/FL/Fl_Simple_Counter.H | 12 +-
.../zynaddsubfx/fltk/FL/Fl_Single_Window.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Slider.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H | 24 +-
plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Table.H | 250 +-
plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.H | 18 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H | 18 +-
plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H | 496 +-
plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H | 724 +-
plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tile.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Timer.H | 6 +-
.../zynaddsubfx/fltk/FL/Fl_Toggle_Button.H | 8 +-
.../fltk/FL/Fl_Toggle_Light_Button.H | 6 +-
.../fltk/FL/Fl_Toggle_Round_Button.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H | 21 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tree.H | 725 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.H | 46 +-
.../zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.H | 12 +-
plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.H | 74 +-
plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H | 44 +-
plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_Widget.H | 145 +-
plugins/zynaddsubfx/fltk/FL/Fl_Window.H | 99 +-
plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H | 10 +-
plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H | 6 +-
plugins/zynaddsubfx/fltk/FL/Xutf8.h | 65 +-
plugins/zynaddsubfx/fltk/FL/dirent.h | 8 +-
plugins/zynaddsubfx/fltk/FL/filename.H | 26 +-
plugins/zynaddsubfx/fltk/FL/fl_ask.H | 15 +-
plugins/zynaddsubfx/fltk/FL/fl_draw.H | 298 +-
plugins/zynaddsubfx/fltk/FL/fl_message.H | 6 +-
.../zynaddsubfx/fltk/FL/fl_show_colormap.H | 27 +-
plugins/zynaddsubfx/fltk/FL/fl_show_input.H | 6 +-
plugins/zynaddsubfx/fltk/FL/fl_types.h | 6 +-
plugins/zynaddsubfx/fltk/FL/fl_utf8.h | 14 +-
plugins/zynaddsubfx/fltk/FL/mac.H | 173 +-
plugins/zynaddsubfx/fltk/FL/math.h | 6 +-
plugins/zynaddsubfx/fltk/FL/names.h | 6 +-
plugins/zynaddsubfx/fltk/FL/win32.H | 51 +-
plugins/zynaddsubfx/fltk/FL/x.H | 100 +-
plugins/zynaddsubfx/fltk/src/CMakeLists.txt | 32 +-
plugins/zynaddsubfx/fltk/src/Fl.cxx | 636 +-
plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx | 10 +-
plugins/zynaddsubfx/fltk/src/Fl_Box.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx | 45 +-
plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Browser_load.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Button.cxx | 57 +-
plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Check_Browser.cxx | 17 +-
.../zynaddsubfx/fltk/src/Fl_Check_Button.cxx | 4 +-
plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx | 37 +-
plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Device.cxx | 56 +-
plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Double_Window.cxx | 88 +-
.../zynaddsubfx/fltk/src/Fl_File_Browser.cxx | 8 +-
.../zynaddsubfx/fltk/src/Fl_File_Chooser.cxx | 138 +-
.../zynaddsubfx/fltk/src/Fl_File_Chooser.fl | 33 +-
.../zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx | 178 +-
plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_File_Input.cxx | 9 +-
plugins/zynaddsubfx/fltk/src/Fl_Font.H | 25 +-
.../zynaddsubfx/fltk/src/Fl_GDI_Printer.cxx | 37 +-
plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Group.cxx | 151 +-
.../zynaddsubfx/fltk/src/Fl_Help_Dialog.fl | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx | 20 +-
plugins/zynaddsubfx/fltk/src/Fl_Image.cxx | 13 +-
plugins/zynaddsubfx/fltk/src/Fl_Input.cxx | 789 ++-
plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx | 28 +-
.../zynaddsubfx/fltk/src/Fl_Light_Button.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx | 138 +-
plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx | 8 +-
.../zynaddsubfx/fltk/src/Fl_Menu_Button.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Menu_Window.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx | 58 +-
.../zynaddsubfx/fltk/src/Fl_Menu_global.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Multi_Label.cxx | 6 +-
.../fltk/src/Fl_Native_File_Chooser.cxx | 10 +-
.../fltk/src/Fl_Native_File_Chooser_FLTK.cxx | 50 +-
..._MAC.cxx => Fl_Native_File_Chooser_MAC.mm} | 125 +-
.../fltk/src/Fl_Native_File_Chooser_WIN32.cxx | 21 +-
.../src/Fl_Native_File_Chooser_common.cxx | 8 +-
.../fltk/src/Fl_Overlay_Window.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Paged_Device.cxx | 144 +-
plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx | 10 +-
.../zynaddsubfx/fltk/src/Fl_Positioner.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_PostScript.cxx | 607 +-
.../zynaddsubfx/fltk/src/Fl_Preferences.cxx | 627 +-
plugins/zynaddsubfx/fltk/src/Fl_Printer.cxx | 122 +-
plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Return_Button.cxx | 7 +-
plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Round_Button.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx | 31 +-
plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Shared_Image.cxx | 31 +-
.../zynaddsubfx/fltk/src/Fl_Single_Window.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx | 29 +-
plugins/zynaddsubfx/fltk/src/Fl_Table.cxx | 69 +-
plugins/zynaddsubfx/fltk/src/Fl_Table_Row.cxx | 25 +-
plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx | 201 +-
.../zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx | 2077 ++----
.../zynaddsubfx/fltk/src/Fl_Text_Display.cxx | 4197 ++++++-----
.../zynaddsubfx/fltk/src/Fl_Text_Editor.cxx | 74 +-
plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx | 14 +-
.../zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx | 107 +-
plugins/zynaddsubfx/fltk/src/Fl_Tree.cxx | 876 ++-
plugins/zynaddsubfx/fltk/src/Fl_Tree_Item.cxx | 230 +-
.../fltk/src/Fl_Tree_Item_Array.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Tree_Prefs.cxx | 12 +-
plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Value_Input.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Value_Output.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_Value_Slider.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx | 7 +-
plugins/zynaddsubfx/fltk/src/Fl_Window.cxx | 119 +-
.../fltk/src/Fl_Window_fullscreen.cxx | 15 +-
.../fltk/src/Fl_Window_hotspot.cxx | 6 +-
.../fltk/src/Fl_Window_iconize.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_XColor.H | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/Fl_abort.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_arg.cxx | 225 +-
plugins/zynaddsubfx/fltk/src/Fl_compose.cxx | 264 +-
plugins/zynaddsubfx/fltk/src/Fl_display.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_get_key_mac.cxx | 40 +-
.../zynaddsubfx/fltk/src/Fl_get_key_win32.cxx | 6 +-
.../fltk/src/Fl_get_system_colors.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_grab.cxx | 9 +-
plugins/zynaddsubfx/fltk/src/Fl_lock.cxx | 62 +-
plugins/zynaddsubfx/fltk/src/Fl_mac.cxx | 6 +-
.../zynaddsubfx/fltk/src/Fl_own_colormap.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_visual.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/Fl_win32.cxx | 207 +-
plugins/zynaddsubfx/fltk/src/Fl_x.cxx | 453 +-
plugins/zynaddsubfx/fltk/src/aimm.h | 6 +-
.../fltk/src/filename_absolute.cxx | 64 +-
.../zynaddsubfx/fltk/src/filename_expand.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/filename_ext.cxx | 6 +-
.../zynaddsubfx/fltk/src/filename_isdir.cxx | 8 +-
.../zynaddsubfx/fltk/src/filename_list.cxx | 132 +-
.../zynaddsubfx/fltk/src/filename_match.cxx | 6 +-
.../zynaddsubfx/fltk/src/filename_setext.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/fl_arc.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_arci.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_ask.cxx | 183 +-
plugins/zynaddsubfx/fltk/src/fl_boxtype.cxx | 22 +-
plugins/zynaddsubfx/fltk/src/fl_call_main.c | 6 +-
plugins/zynaddsubfx/fltk/src/fl_color.cxx | 36 +-
plugins/zynaddsubfx/fltk/src/fl_color_mac.cxx | 16 +-
.../zynaddsubfx/fltk/src/fl_color_win32.cxx | 16 +-
plugins/zynaddsubfx/fltk/src/fl_cursor.cxx | 28 +-
plugins/zynaddsubfx/fltk/src/fl_curve.cxx | 6 +-
.../zynaddsubfx/fltk/src/fl_diamond_box.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_dnd.cxx | 8 +-
plugins/zynaddsubfx/fltk/src/fl_dnd_mac.cxx | 58 -
plugins/zynaddsubfx/fltk/src/fl_dnd_win32.cxx | 100 +-
plugins/zynaddsubfx/fltk/src/fl_dnd_x.cxx | 11 +-
plugins/zynaddsubfx/fltk/src/fl_draw.cxx | 20 +-
.../zynaddsubfx/fltk/src/fl_draw_image.cxx | 24 +-
.../fltk/src/fl_draw_image_mac.cxx | 47 +-
.../fltk/src/fl_draw_image_win32.cxx | 24 +-
.../zynaddsubfx/fltk/src/fl_draw_pixmap.cxx | 12 +-
.../fltk/src/fl_encoding_latin1.cxx | 6 +-
.../fltk/src/fl_encoding_mac_roman.cxx | 6 +-
.../fltk/src/fl_engraved_label.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_file_dir.cxx | 30 +-
plugins/zynaddsubfx/fltk/src/fl_font.cxx | 24 +-
plugins/zynaddsubfx/fltk/src/fl_font_mac.cxx | 340 +-
.../zynaddsubfx/fltk/src/fl_font_win32.cxx | 289 +-
plugins/zynaddsubfx/fltk/src/fl_font_x.cxx | 118 +-
plugins/zynaddsubfx/fltk/src/fl_font_xft.cxx | 281 +-
plugins/zynaddsubfx/fltk/src/fl_gtk.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_labeltype.cxx | 6 +-
.../zynaddsubfx/fltk/src/fl_line_style.cxx | 17 +-
plugins/zynaddsubfx/fltk/src/fl_open_uri.cxx | 14 +-
plugins/zynaddsubfx/fltk/src/fl_oval_box.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_overlay.cxx | 6 +-
.../fltk/src/fl_overlay_visual.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_plastic.cxx | 66 +-
.../zynaddsubfx/fltk/src/fl_read_image.cxx | 14 +-
.../fltk/src/fl_read_image_mac.cxx | 11 +-
.../fltk/src/fl_read_image_win32.cxx | 95 +-
plugins/zynaddsubfx/fltk/src/fl_rect.cxx | 226 +-
plugins/zynaddsubfx/fltk/src/fl_round_box.cxx | 10 +-
.../zynaddsubfx/fltk/src/fl_rounded_box.cxx | 6 +-
.../zynaddsubfx/fltk/src/fl_scroll_area.cxx | 9 +-
plugins/zynaddsubfx/fltk/src/fl_set_font.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_set_fonts.cxx | 6 +-
.../zynaddsubfx/fltk/src/fl_set_fonts_mac.cxx | 31 +-
.../fltk/src/fl_set_fonts_win32.cxx | 6 +-
.../zynaddsubfx/fltk/src/fl_set_fonts_x.cxx | 8 +-
.../zynaddsubfx/fltk/src/fl_set_fonts_xft.cxx | 8 +-
.../zynaddsubfx/fltk/src/fl_shadow_box.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_shortcut.cxx | 97 +-
.../zynaddsubfx/fltk/src/fl_show_colormap.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_symbols.cxx | 6 +-
plugins/zynaddsubfx/fltk/src/fl_utf.c | 170 +-
plugins/zynaddsubfx/fltk/src/fl_utf8.cxx | 57 +-
plugins/zynaddsubfx/fltk/src/fl_vertex.cxx | 126 +-
plugins/zynaddsubfx/fltk/src/flstring.c | 6 +-
plugins/zynaddsubfx/fltk/src/flstring.h | 6 +-
plugins/zynaddsubfx/fltk/src/numericsort.c | 10 +-
plugins/zynaddsubfx/fltk/src/print_panel.cxx | 9 +-
plugins/zynaddsubfx/fltk/src/print_panel.h | 6 +-
plugins/zynaddsubfx/fltk/src/ps_image.cxx | 196 +-
plugins/zynaddsubfx/fltk/src/scandir.c | 5 +-
plugins/zynaddsubfx/fltk/src/scandir_win32.c | 18 +-
plugins/zynaddsubfx/fltk/src/screen_xywh.cxx | 265 +-
plugins/zynaddsubfx/fltk/src/vsnprintf.c | 6 +-
plugins/zynaddsubfx/fltk/src/xutf8/README | 1 +
plugins/zynaddsubfx/fltk/src/xutf8/case.c | 5 +-
.../fltk/src/xutf8/is_right2left.c | 2 +-
.../zynaddsubfx/fltk/src/xutf8/is_spacing.c | 2 +-
.../fltk/src/xutf8/lcUniConv/README | 2 +-
.../fltk/src/xutf8/lcUniConv/big5.h | 5 +-
.../fltk/src/xutf8/lcUniConv/cp1251.h | 4 +
.../fltk/src/xutf8/lcUniConv/cp936ext.h | 6259 +++++++++++++++++
.../fltk/src/xutf8/lcUniConv/gb2312.h | 5 +-
.../fltk/src/xutf8/lcUniConv/gbk_tab_to_h.c | 1020 +++
.../fltk/src/xutf8/lcUniConv/iso8859_10.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_11.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_13.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_14.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_15.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_2.h | 6 +
.../fltk/src/xutf8/lcUniConv/iso8859_3.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_4.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_5.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_6.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_7.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_8.h | 4 +
.../fltk/src/xutf8/lcUniConv/iso8859_9.h | 4 +
.../fltk/src/xutf8/lcUniConv/jisx0201.h | 5 +
.../fltk/src/xutf8/lcUniConv/jisx0208.h | 4 +
.../fltk/src/xutf8/lcUniConv/jisx0212.h | 4 +
.../fltk/src/xutf8/lcUniConv/koi8_r.h | 4 +
.../fltk/src/xutf8/lcUniConv/koi8_u.h | 5 +-
.../fltk/src/xutf8/lcUniConv/ksc5601.h | 5 +-
.../zynaddsubfx/fltk/src/xutf8/ucs2fontmap.c | 14 +-
.../zynaddsubfx/fltk/src/xutf8/utf8Input.c | 55 +-
plugins/zynaddsubfx/fltk/src/xutf8/utf8Wrap.c | 340 +-
346 files changed, 22057 insertions(+), 10836 deletions(-)
delete mode 100644 plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_FLTK.H
delete mode 100644 plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_MAC.H
delete mode 100644 plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_WIN32.H
rename plugins/zynaddsubfx/fltk/src/{Fl_Native_File_Chooser_MAC.cxx => Fl_Native_File_Chooser_MAC.mm} (87%)
delete mode 100644 plugins/zynaddsubfx/fltk/src/fl_dnd_mac.cxx
create mode 100644 plugins/zynaddsubfx/fltk/src/xutf8/lcUniConv/cp936ext.h
create mode 100644 plugins/zynaddsubfx/fltk/src/xutf8/lcUniConv/gbk_tab_to_h.c
diff --git a/plugins/zynaddsubfx/fltk/FL/Enumerations.H b/plugins/zynaddsubfx/fltk/FL/Enumerations.H
index 53c32e0a2..093422bfd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Enumerations.H
+++ b/plugins/zynaddsubfx/fltk/FL/Enumerations.H
@@ -1,9 +1,9 @@
//
-// "$Id: Enumerations.H 7476 2010-04-09 22:18:05Z matt $"
+// "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $"
//
// Enumerations for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -26,7 +26,7 @@
//
/** \file
- * This file contains type definitions and general enumerations.
+ This file contains type definitions and general enumerations.
*/
#ifndef Fl_Enumerations_H
@@ -45,39 +45,35 @@
/*@{*/
/**
- * The major release version of this FLTK library.
+ The major release version of this FLTK library.
\sa FL_VERSION
*/
#define FL_MAJOR_VERSION 1
/**
- * The minor release version for this library.
- *
- * FLTK remains mostly source-code compatible between minor version changes.
+ The minor release version for this library.
+
+ FLTK remains mostly source-code compatible between minor version changes.
*/
#define FL_MINOR_VERSION 3
/**
- * The patch version for this library.
- *
- * FLTK remains binary compatible between patches.
+ The patch version for this library.
+
+ FLTK remains binary compatible between patches.
*/
#define FL_PATCH_VERSION 0
/**
- * The FLTK version number as a \em double.
- *
- * This is changed slightly from the beta versions
- * because the old "const double" definition would not allow for conditional
- * compilation...
- *
- * FL_VERSION is a double that describes the major and minor version numbers.
- * Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
- * releases.
- *
- * The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
- * give the integral values for the major, minor, and patch releases
- * respectively.
+ The FLTK version number as a \em double.
+
+ FL_VERSION is a double that describes the major and minor version numbers.
+ Version 1.1 is actually stored as 1.01 to allow for more than 9 minor
+ releases.
+
+ The FL_MAJOR_VERSION, FL_MINOR_VERSION, and FL_PATCH_VERSION constants
+ give the integral values for the major, minor, and patch releases
+ respectively.
*/
#define FL_VERSION ((double)FL_MAJOR_VERSION + \
(double)FL_MINOR_VERSION * 0.01 + \
@@ -86,203 +82,205 @@
/*@}*/ // group: Version Numbers
/**
- * Every time a user moves the mouse pointer, clicks a button,
- * or presses a key, an event is generated and sent to your
- * application. Events can also come from other programs like the
- * window manager.
- *
- * Events are identified by the integer argument passed to the
- * Fl_Widget::handle() virtual method. Other information about the
- * most recent event is stored in static locations and acquired by
- * calling the Fl::event_*() methods. This static information remains
- * valid until the next event is read from the window system, so it
- * is ok to look at it outside of the handle() method.
- *
- * \sa Fl::event_text(), Fl::event_key(), class Fl::
+ Every time a user moves the mouse pointer, clicks a button,
+ or presses a key, an event is generated and sent to your
+ application. Events can also come from other programs like the
+ window manager.
+
+ Events are identified by the integer argument passed to the
+ Fl_Widget::handle() virtual method. Other information about the
+ most recent event is stored in static locations and acquired by
+ calling the Fl::event_*() methods. This static information remains
+ valid until the next event is read from the window system, so it
+ is ok to look at it outside of the handle() method.
+
+ \sa Fl::event_text(), Fl::event_key(), class Fl::
*/
enum Fl_Event { // events
/** No event. */
FL_NO_EVENT = 0,
/** A mouse button has gone down with the mouse pointing at this
- * widget. You can find out what button by calling Fl::event_button().
- * You find out the mouse position by calling Fl::event_x() and
- * Fl::event_y().
- *
- * A widget indicates that it "wants" the mouse click by returning non-zero
- * from its Fl_Widget::handle() method. It will then become the
- * Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
- * If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
- * to another widget.
+ widget. You can find out what button by calling Fl::event_button().
+ You find out the mouse position by calling Fl::event_x() and
+ Fl::event_y().
+
+ A widget indicates that it "wants" the mouse click by returning non-zero
+ from its Fl_Widget::handle() method. It will then become the
+ Fl::pushed() widget and will get FL_DRAG and the matching FL_RELEASE events.
+ If Fl_Widget::handle() returns zero then FLTK will try sending the FL_PUSH
+ to another widget.
*/
FL_PUSH = 1,
/** A mouse button has been released. You can find out what button by
- * calling Fl::event_button().
- *
- * In order to receive the FL_RELEASE event, the widget must return
- * non-zero when handling FL_PUSH.
+ calling Fl::event_button().
+
+ In order to receive the FL_RELEASE event, the widget must return
+ non-zero when handling FL_PUSH.
*/
FL_RELEASE = 2,
/** The mouse has been moved to point at this widget. This can
- * be used for highlighting feedback. If a widget wants to
- * highlight or otherwise track the mouse, it indicates this by
- * returning non-zero from its handle() method. It then
- * becomes the Fl::belowmouse() widget and will receive
- * FL_MOVE and FL_LEAVE events.
+ be used for highlighting feedback. If a widget wants to
+ highlight or otherwise track the mouse, it indicates this by
+ returning non-zero from its handle() method. It then
+ becomes the Fl::belowmouse() widget and will receive
+ FL_MOVE and FL_LEAVE events.
*/
FL_ENTER = 3,
/** The mouse has moved out of the widget.
- * In order to receive the FL_LEAVE event, the widget must
- * return non-zero when handling FL_ENTER.
+ In order to receive the FL_LEAVE event, the widget must
+ return non-zero when handling FL_ENTER.
*/
FL_LEAVE = 4,
/** The mouse has moved with a button held down. The current button state
- * is in Fl::event_state(). The mouse position is in Fl::event_x() and
- * Fl::event_y().
- *
- * In order to receive FL_DRAG events, the widget must return non-zero
- * when handling FL_PUSH.
+ is in Fl::event_state(). The mouse position is in Fl::event_x() and
+ Fl::event_y().
+
+ In order to receive FL_DRAG events, the widget must return non-zero
+ when handling FL_PUSH.
*/
FL_DRAG = 5,
/** This indicates an attempt to give a widget the keyboard focus.
- *
- * If a widget wants the focus, it should change itself to display the
- * fact that it has the focus, and return non-zero from its handle() method.
- * It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
- * and FL_UNFOCUS events.
- *
- * The focus will change either because the window manager changed which
- * window gets the focus, or because the user tried to navigate using tab,
- * arrows, or other keys. You can check Fl::event_key() to figure out why
- * it moved. For navigation it will be the key pressed and interaction
- * with the window manager it will be zero.
+
+ If a widget wants the focus, it should change itself to display the
+ fact that it has the focus, and return non-zero from its handle() method.
+ It then becomes the Fl::focus() widget and gets FL_KEYDOWN, FL_KEYUP,
+ and FL_UNFOCUS events.
+
+ The focus will change either because the window manager changed which
+ window gets the focus, or because the user tried to navigate using tab,
+ arrows, or other keys. You can check Fl::event_key() to figure out why
+ it moved. For navigation it will be the key pressed and for interaction
+ with the window manager it will be zero.
*/
FL_FOCUS = 6,
/** This event is sent to the previous Fl::focus() widget when another
- * widget gets the focus or the window loses focus.
+ widget gets the focus or the window loses focus.
*/
FL_UNFOCUS = 7,
- /** A key was pressed or released. The key can be found in Fl::event_key().
- * The text that the key should insert can be found with Fl::event_text()
- * and its length is in Fl::event_length(). If you use the key handle()
- * should return 1. If you return zero then FLTK assumes you ignored the
- * key and will then attempt to send it to a parent widget. If none of
- * them want it, it will change the event into a FL_SHORTCUT event.
- *
- * To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
- * and FL_UNFOCUS events.
- *
- * If you are writing a text-editing widget you may also want to call
- * the Fl::compose() function to translate individual keystrokes into
- * foreign characters.
- *
- * FL_KEYUP events are sent to the widget that currently has focus. This
- * is not necessarily the same widget that received the corresponding
- * FL_KEYDOWN event because focus may have changed between events.
+ /** A key was pressed (FL_KEYDOWN) or released (FL_KEYUP).
+ Fl_KEYBOARD is a synonym for FL_KEYDOWN.
+ The key can be found in Fl::event_key().
+ The text that the key should insert can be found with Fl::event_text()
+ and its length is in Fl::event_length(). If you use the key handle()
+ should return 1. If you return zero then FLTK assumes you ignored the
+ key and will then attempt to send it to a parent widget. If none of
+ them want it, it will change the event into a FL_SHORTCUT event.
+
+ To receive FL_KEYBOARD events you must also respond to the FL_FOCUS
+ and FL_UNFOCUS events.
+
+ If you are writing a text-editing widget you may also want to call
+ the Fl::compose() function to translate individual keystrokes into
+ non-ASCII characters.
+
+ FL_KEYUP events are sent to the widget that currently has focus. This
+ is not necessarily the same widget that received the corresponding
+ FL_KEYDOWN event because focus may have changed between events.
*/
FL_KEYDOWN = 8,
- /** Equvalent to FL_KEYDOWN.
- * \see FL_KEYDOWN
+ /** Equivalent to FL_KEYDOWN.
+ \see FL_KEYDOWN
*/
FL_KEYBOARD = 8,
/** Key release event.
- * \see FL_KEYDOWN
+ \see FL_KEYDOWN
*/
FL_KEYUP = 9,
/** The user clicked the close button of a window.
- * This event is used internally only to trigger the callback of
- * Fl_Window derived classed. The default callback closes the
- * window calling Fl_Window::hide().
+ This event is used internally only to trigger the callback of
+ Fl_Window derived classed. The default callback closes the
+ window calling Fl_Window::hide().
*/
FL_CLOSE = 10,
/** The mouse has moved without any mouse buttons held down.
- * This event is sent to the Fl::belowmouse() widget.
- *
- * In order to receive FL_MOVE events, the widget must return
- * non-zero when handling FL_ENTER.
+ This event is sent to the Fl::belowmouse() widget.
+
+ In order to receive FL_MOVE events, the widget must return
+ non-zero when handling FL_ENTER.
*/
FL_MOVE = 11,
/** If the Fl::focus() widget is zero or ignores an FL_KEYBOARD
- * event then FLTK tries sending this event to every widget it
- * can, until one of them returns non-zero. FL_SHORTCUT is first
- * sent to the Fl::belowmouse() widget, then its parents and siblings,
- * and eventually to every widget in the window, trying to find an
- * object that returns non-zero. FLTK tries really hard to not to ignore
- * any keystrokes!
- *
- * You can also make "global" shortcuts by using Fl::add_handler(). A
- * global shortcut will work no matter what windows are displayed or
- * which one has the focus.
+ event then FLTK tries sending this event to every widget it
+ can, until one of them returns non-zero. FL_SHORTCUT is first
+ sent to the Fl::belowmouse() widget, then its parents and siblings,
+ and eventually to every widget in the window, trying to find an
+ object that returns non-zero. FLTK tries really hard to not to ignore
+ any keystrokes!
+
+ You can also make "global" shortcuts by using Fl::add_handler(). A
+ global shortcut will work no matter what windows are displayed or
+ which one has the focus.
*/
FL_SHORTCUT = 12,
/** This widget is no longer active, due to Fl_Widget::deactivate()
- * being called on it or one of its parents. Fl_Widget::active() may
- * still be true after this, the widget is only active if Fl_Widget::active()
- * is true on it and all its parents (use Fl_Widget::active_r() to check this).
+ being called on it or one of its parents. Fl_Widget::active() may
+ still be true after this, the widget is only active if Fl_Widget::active()
+ is true on it and all its parents (use Fl_Widget::active_r() to check this).
*/
FL_DEACTIVATE = 13,
/** This widget is now active, due to Fl_Widget::activate() being
- * called on it or one of its parents.
+ called on it or one of its parents.
*/
FL_ACTIVATE = 14,
/** This widget is no longer visible, due to Fl_Widget::hide() being
- * called on it or one of its parents, or due to a parent window being
- * minimized. Fl_Widget::visible() may still be true after this, but the
- * widget is visible only if visible() is true for it and all its
- * parents (use Fl_Widget::visible_r() to check this).
+ called on it or one of its parents, or due to a parent window being
+ minimized. Fl_Widget::visible() may still be true after this, but the
+ widget is visible only if visible() is true for it and all its
+ parents (use Fl_Widget::visible_r() to check this).
*/
FL_HIDE = 15,
/** This widget is visible again, due to Fl_Widget::show() being called on
- * it or one of its parents, or due to a parent window being restored.
- * Child Fl_Windows respond to this by actually creating the window if not
- * done already, so if you subclass a window, be sure to pass FL_SHOW
- * to the base class Fl_Widget::handle() method!
+ it or one of its parents, or due to a parent window being restored.
+ Child Fl_Windows respond to this by actually creating the window if not
+ done already, so if you subclass a window, be sure to pass FL_SHOW
+ to the base class Fl_Widget::handle() method!
*/
FL_SHOW = 16,
/** You should get this event some time after you call Fl::paste().
- * The contents of Fl::event_text() is the text to insert and the number
- * of characters is in Fl::event_length().
+ The contents of Fl::event_text() is the text to insert and the number
+ of characters is in Fl::event_length().
*/
FL_PASTE = 17,
/** The Fl::selection_owner() will get this event before the selection is
- * moved to another widget. This indicates that some other widget or program
- * has claimed the selection. Motif programs used this to clear the selection
- * indication. Most modern programs ignore this.
+ moved to another widget. This indicates that some other widget or program
+ has claimed the selection. Motif programs used this to clear the selection
+ indication. Most modern programs ignore this.
*/
FL_SELECTIONCLEAR = 18,
/** The user has moved the mouse wheel. The Fl::event_dx() and Fl::event_dy()
- * methods can be used to find the amount to scroll horizontally and vertically.
+ methods can be used to find the amount to scroll horizontally and vertically.
*/
FL_MOUSEWHEEL = 19,
/** The mouse has been moved to point at this widget. A widget that is
- * interested in receiving drag'n'drop data must return 1 to receive
- * FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
+ interested in receiving drag'n'drop data must return 1 to receive
+ FL_DND_DRAG, FL_DND_LEAVE and FL_DND_RELEASE events.
*/
FL_DND_ENTER = 20,
/** The mouse has been moved inside a widget while dragging data. A
- * widget that is interested in receiving drag'n'drop data should
- * indicate the possible drop position.
+ widget that is interested in receiving drag'n'drop data should
+ indicate the possible drop position.
*/
FL_DND_DRAG = 21,
@@ -291,8 +289,8 @@ enum Fl_Event { // events
FL_DND_LEAVE = 22,
/** The user has released the mouse button dropping data into the widget.
- * If the widget returns 1, it will receive the data in the immediately
- * following FL_PASTE event.
+ If the widget returns 1, it will receive the data in the immediately
+ following FL_PASTE event.
*/
FL_DND_RELEASE = 23
};
@@ -300,9 +298,9 @@ enum Fl_Event { // events
/** \name When Conditions */
/*@{*/
/** These constants determine when a callback is performed.
- *
- * \sa Fl_Widget::when();
- * \todo doxygen comments for values are incomplete and maybe wrong or unclear
+
+ \sa Fl_Widget::when();
+ \todo doxygen comments for values are incomplete and maybe wrong or unclear
*/
enum Fl_When { // Fl_Widget::when():
FL_WHEN_NEVER = 0, ///< Never call the callback
@@ -368,6 +366,27 @@ enum Fl_When { // Fl_Widget::when():
#define FL_Alt_R 0xffea ///< The right alt key.
#define FL_Delete 0xffff ///< The delete key.
+// These use the Private Use Area (PUA) of the Basic Multilingual Plane
+// of Unicode. Guaranteed not to conflict with a proper Unicode character.
+
+// These primarily map to the XFree86 keysym range
+#define FL_Volume_Down 0xEF11 /* Volume control down */
+#define FL_Volume_Mute 0xEF12 /* Mute sound from the system */
+#define FL_Volume_Up 0xEF13 /* Volume control up */
+#define FL_Media_Play 0xEF14 /* Start playing of audio */
+#define FL_Media_Stop 0xEF15 /* Stop playing audio */
+#define FL_Media_Prev 0xEF16 /* Previous track */
+#define FL_Media_Next 0xEF17 /* Next track */
+#define FL_Home_Page 0xEF18 /* Display user's home page */
+#define FL_Mail 0xEF19 /* Invoke user's mail program */
+#define FL_Search 0xEF1B /* Search */
+#define FL_Back 0xEF26 /* Like back on a browser */
+#define FL_Forward 0xEF27 /* Like forward on a browser */
+#define FL_Stop 0xEF28 /* Stop current operation */
+#define FL_Refresh 0xEF29 /* Refresh the page */
+#define FL_Sleep 0xEF2F /* Put system to sleep */
+#define FL_Favorites 0xEF30 /* Show favorite locations */
+
/*@}*/ // group: Mouse and Keyboard Events
/** \name Mouse Buttons
@@ -412,15 +431,15 @@ enum Fl_When { // Fl_Widget::when():
#define FL_BUTTONS 0x7f000000 ///< Any mouse button is pushed
#define FL_BUTTON(n) (0x00800000<<(n)) ///< Mouse button n (n > 0) is pushed
-#define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
- // FIXME: Unicode needs 24 bits!
+#define FL_KEY_MASK 0x0000ffff ///< All keys are 16 bit for now
+ // FIXME: Unicode needs 24 bits!
#ifdef __APPLE__
-# define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
-# define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_META on MacOS X
+# define FL_COMMAND FL_META ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
+# define FL_CONTROL FL_CTRL ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
#else
# define FL_COMMAND FL_CTRL ///< An alias for FL_CTRL on WIN32 and X11, or FL_META on MacOS X
-# define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_META on MacOS X
+# define FL_CONTROL FL_META ///< An alias for FL_META on WIN32 and X11, or FL_CTRL on MacOS X
#endif // __APPLE__
/*@}*/ // group: Event States
@@ -435,8 +454,8 @@ enum Fl_When { // Fl_Widget::when():
leaving the interior unchanged. The blue color in Figure 1
is the area that is not drawn by the frame types.
- \image html boxtypes.gif "Figure 1: FLTK standard box types"
- \image latex boxtypes.eps "FLTK standard box types" width=10cm
+ \image html boxtypes.png "Figure 1: FLTK standard box types"
+ \image latex boxtypes.png "FLTK standard box types" width=10cm
\todo Description of boxtypes is incomplete.
See below for the defined enum Fl_Boxtype.
\see src/Fl_get_system_colors.cxx
@@ -542,24 +561,24 @@ extern FL_EXPORT Fl_Boxtype fl_define_FL_GTK_UP_BOX();
/**
Get the filled version of a frame.
If no filled version of a given frame exists, the behavior of this function
- is undefined and some random box or frame is returned,
- */
+ is undefined and some random box or frame is returned.
+ */
inline Fl_Boxtype fl_box(Fl_Boxtype b) {
return (Fl_Boxtype)((b1)?b:(b-2));
}
/**
Get the "pressed" or "down" version of a box.
If no "down" version of a given box exists, the behavior of this function
- is undefined and some random box or frame is returned,
- */
+ is undefined and some random box or frame is returned.
+ */
inline Fl_Boxtype fl_down(Fl_Boxtype b) {
return (Fl_Boxtype)((b
Fl_Color => 0xrrggbbii
| | | |
@@ -745,12 +759,13 @@ extern FL_EXPORT Fl_Fontsize FL_NORMAL_SIZE; ///< normal font size
| +------- green component (8 bit)
+--------- red component (8 bit)
-
+
A color can have either an index or an rgb value. Colors with rgb set
and an index >0 are reserved for special use.
-
- */
+ */
+/*@{*/
+/** an FLTK color value */
typedef unsigned int Fl_Color;
// Standard colors. These are used as default colors in widgets and altered as necessary
@@ -762,14 +777,14 @@ const Fl_Color FL_SELECTION_COLOR = 15; ///< the default selection/highlight c
// boxtypes generally limit themselves to these colors so
// the whole ramp is not allocated:
-const Fl_Color FL_GRAY0 = 32; // 'A'
-const Fl_Color FL_DARK3 = 39; // 'H'
-const Fl_Color FL_DARK2 = 45; // 'N'
-const Fl_Color FL_DARK1 = 47; // 'P'
+const Fl_Color FL_GRAY0 = 32; // 'A'
+const Fl_Color FL_DARK3 = 39; // 'H'
+const Fl_Color FL_DARK2 = 45; // 'N'
+const Fl_Color FL_DARK1 = 47; // 'P'
const Fl_Color FL_BACKGROUND_COLOR = 49; // 'R' default background color
-const Fl_Color FL_LIGHT1 = 50; // 'S'
-const Fl_Color FL_LIGHT2 = 52; // 'U'
-const Fl_Color FL_LIGHT3 = 54; // 'W'
+const Fl_Color FL_LIGHT1 = 50; // 'S'
+const Fl_Color FL_LIGHT2 = 52; // 'U'
+const Fl_Color FL_LIGHT3 = 54; // 'W'
// FLTK provides a 5x8x5 color cube that is used with colormap visuals
@@ -807,74 +822,99 @@ FL_EXPORT Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg);
FL_EXPORT Fl_Color fl_color_average(Fl_Color c1, Fl_Color c2, float weight);
+/** Returns a lighter version of the specified color. */
inline Fl_Color fl_lighter(Fl_Color c) { return fl_color_average(c, FL_WHITE, .67f); }
+/** Returns a darker version of the specified color. */
inline Fl_Color fl_darker(Fl_Color c) { return fl_color_average(c, FL_BLACK, .67f); }
-/** return 24-bit color value closest to \p r, \p g, \p b. */
+/** Returns the 24-bit color value closest to \p r, \p g, \p b. */
inline Fl_Color fl_rgb_color(uchar r, uchar g, uchar b) {
if (!r && !g && !b) return FL_BLACK;
else return (Fl_Color)(((((r << 8) | g) << 8) | b) << 8);
}
-/** return 24-bit color value closest to \p grayscale */
+/** Returns the 24-bit color value closest to \p g (grayscale). */
inline Fl_Color fl_rgb_color(uchar g) {
if (!g) return FL_BLACK;
else return (Fl_Color)(((((g << 8) | g) << 8) | g) << 8);
}
+/** Returns a gray color value from black (i == 0) to white (i == FL_NUM_GRAY - 1).
+ FL_NUM_GRAY is defined to be 24 in the current FLTK release.
+ To get the closest FLTK gray value to an 8-bit grayscale color 'I' use:
+
+ \code
+ fl_gray_ramp(I * (FL_NUM_GRAY - 1) / 255)
+ \endcode
+*/
inline Fl_Color fl_gray_ramp(int i) {return (Fl_Color)(i+FL_GRAY_RAMP);}
+/** Returns a color out of the color cube.
+
+ \p r must be in the range 0 to FL_NUM_RED (5) minus 1,
+ \p g must be in the range 0 to FL_NUM_GREEN (8) minus 1,
+ \p b must be in the range 0 to FL_NUM_BLUE (5) minus 1.
+
+ To get the closest color to a 8-bit set of R,G,B values use:
+
+ \code
+ fl_color_cube(R * (FL_NUM_RED - 1) / 255,
+ G * (FL_NUM_GREEN - 1) / 255,
+ B * (FL_NUM_BLUE - 1) / 255);
+ \endcode
+ */
inline Fl_Color fl_color_cube(int r, int g, int b) {
return (Fl_Color)((b*FL_NUM_RED + r) * FL_NUM_GREEN + g + FL_COLOR_CUBE);}
-//*@}*/ // group: Colors
+/*@}*/ // group: Colors
-/** \name Cursors
+/** \name Cursors */
+/*@{*/
+
+/** The following constants define the mouse cursors that are available in FLTK.
- The following constants define the mouse cursors that are available in FLTK.
-
The double-headed arrows are bitmaps provided by FLTK on X, the others
are provided by system-defined cursors.
-
- \todo enum Fl_Cursor needs some more comments for values
- (and maybe an image), see Fl/Enumerations.H
+
+ \todo enum Fl_Cursor needs maybe an image.
*/
-enum Fl_Cursor { // standard cursors
- FL_CURSOR_DEFAULT = 0,
- FL_CURSOR_ARROW = 35,
- FL_CURSOR_CROSS = 66,
- FL_CURSOR_WAIT = 76,
- FL_CURSOR_INSERT = 77,
- FL_CURSOR_HAND = 31,
- FL_CURSOR_HELP = 47,
- FL_CURSOR_MOVE = 27,
+enum Fl_Cursor {
+ FL_CURSOR_DEFAULT = 0, /**< the default cursor, usually an arrow. */
+ FL_CURSOR_ARROW = 35, /**< an arrow pointer. */
+ FL_CURSOR_CROSS = 66, /**< crosshair. */
+ FL_CURSOR_WAIT = 76, /**< watch or hourglass. */
+ FL_CURSOR_INSERT = 77, /**< I-beam. */
+ FL_CURSOR_HAND = 31, /**< hand (uparrow on MSWindows). */
+ FL_CURSOR_HELP = 47, /**< question mark. */
+ FL_CURSOR_MOVE = 27, /**< 4-pointed arrow. */
// fltk provides bitmaps for these:
- FL_CURSOR_NS = 78,
- FL_CURSOR_WE = 79,
- FL_CURSOR_NWSE = 80,
- FL_CURSOR_NESW = 81,
- FL_CURSOR_NONE = 255,
- // for back compatability (non MSWindows ones):
- FL_CURSOR_N = 70,
- FL_CURSOR_NE = 69,
- FL_CURSOR_E = 49,
- FL_CURSOR_SE = 8,
- FL_CURSOR_S = 9,
- FL_CURSOR_SW = 7,
- FL_CURSOR_W = 36,
- FL_CURSOR_NW = 68
- //FL_CURSOR_NS = 22,
- //FL_CURSOR_WE = 55,
+ FL_CURSOR_NS = 78, /**< up/down arrow. */
+ FL_CURSOR_WE = 79, /**< left/right arrow. */
+ FL_CURSOR_NWSE = 80, /**< diagonal arrow. */
+ FL_CURSOR_NESW = 81, /**< diagonal arrow. */
+ FL_CURSOR_NONE =255, /**< invisible. */
+ // for back compatibility (non MSWindows ones):
+ FL_CURSOR_N = 70, /**< for back compatibility. */
+ FL_CURSOR_NE = 69, /**< for back compatibility. */
+ FL_CURSOR_E = 49, /**< for back compatibility. */
+ FL_CURSOR_SE = 8, /**< for back compatibility. */
+ FL_CURSOR_S = 9, /**< for back compatibility. */
+ FL_CURSOR_SW = 7, /**< for back compatibility. */
+ FL_CURSOR_W = 36, /**< for back compatibility. */
+ FL_CURSOR_NW = 68 /**< for back compatibility. */
};
+/*@}*/ // group: Cursors
+/** FD "when" conditions */
enum { // values for "when" passed to Fl::add_fd()
- FL_READ = 1,
- FL_WRITE = 4,
- FL_EXCEPT = 8
+ FL_READ = 1, /**< Call the callback when there is data to be read. */
+ FL_WRITE = 4, /**< Call the callback when data can be written without blocking. */
+ FL_EXCEPT = 8 /**< Call the callback if an exception occurs on the file. */
};
-enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
+/** visual types and Fl_Gl_Window::mode() (values match Glut) */
+enum Fl_Mode {
FL_RGB = 0,
FL_INDEX = 1,
FL_SINGLE = 0,
@@ -893,16 +933,15 @@ enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
#define FL_IMAGE_WITH_ALPHA 0x40000000
-// damage masks
-
+/** Damage masks */
enum Fl_Damage {
- FL_DAMAGE_CHILD = 0x01,
- FL_DAMAGE_EXPOSE = 0x02,
- FL_DAMAGE_SCROLL = 0x04,
- FL_DAMAGE_OVERLAY = 0x08,
- FL_DAMAGE_USER1 = 0x10,
- FL_DAMAGE_USER2 = 0x20,
- FL_DAMAGE_ALL = 0x80
+ FL_DAMAGE_CHILD = 0x01, /**< A child needs to be redrawn. */
+ FL_DAMAGE_EXPOSE = 0x02, /**< The window was exposed. */
+ FL_DAMAGE_SCROLL = 0x04, /**< The Fl_Scroll widget was scrolled. */
+ FL_DAMAGE_OVERLAY = 0x08, /**< The overlay planes need to be redrawn. */
+ FL_DAMAGE_USER1 = 0x10, /**< First user-defined damage bit. */
+ FL_DAMAGE_USER2 = 0x20, /**< Second user-defined damage bit. */
+ FL_DAMAGE_ALL = 0x80 /**< Everything needs to be redrawn. */
};
// FLTK 1.0.x compatibility definitions...
@@ -916,5 +955,5 @@ enum Fl_Damage {
#endif
//
-// End of "$Id: Enumerations.H 7476 2010-04-09 22:18:05Z matt $".
+// End of "$Id: Enumerations.H 8710 2011-05-21 21:55:59Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl.H b/plugins/zynaddsubfx/fltk/FL/Fl.H
index 6fd660a85..9aaa1edd4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl.H 7334 2010-03-25 14:37:46Z AlbrechtS $"
+// "$Id: Fl.H 8724 2011-05-23 18:01:29Z manolo $"
//
// Main header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -25,14 +25,14 @@
// http://www.fltk.org/str.php
//
-/* \file
+/** \file
Fl static class.
*/
#ifndef Fl_H
# define Fl_H
-#ifdef HAVE_CAIRO
+#ifdef FLTK_HAVE_CAIRO
# include
#endif
@@ -54,7 +54,7 @@ struct Fl_Label;
/** \defgroup callback_functions Callback function typedefs
- \brief Typedefs for callback or handler functions passed as function parameters.
+ \brief Typedefs defined in for callback or handler functions passed as function parameters.
FLTK uses callback functions as parameters for some function calls, e.g. to
set up global event handlers (Fl::add_handler()), to add a timeout handler
@@ -68,51 +68,56 @@ struct Fl_Label;
Fl::remove_timeout() and others
@{ */
-/** signature of some label drawing functions passed as parameters */
+/** Signature of some label drawing functions passed as parameters */
typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align);
-/** signature of some label measurement functions passed as parameters */
+/** Signature of some label measurement functions passed as parameters */
typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int &height);
-/** signature of some box drawing functions passed as parameters */
+/** Signature of some box drawing functions passed as parameters */
typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color);
-/** signature of some timeout callback functions passed as parameters */
+/** Signature of some timeout callback functions passed as parameters */
typedef void (*Fl_Timeout_Handler)(void *data);
-/** signature of some wakeup callback functions passed as parameters */
+/** Signature of some wakeup callback functions passed as parameters */
typedef void (*Fl_Awake_Handler)(void *data);
-/** signature of add_idle callback functions passed as parameters */
+/** Signature of add_idle callback functions passed as parameters */
typedef void (*Fl_Idle_Handler)(void *data);
-/** signature of set_idle callback functions passed as parameters */
+/** Signature of set_idle callback functions passed as parameters */
typedef void (*Fl_Old_Idle_Handler)();
-/** signature of add_fd functions passed as parameters */
+/** Signature of add_fd functions passed as parameters */
typedef void (*Fl_FD_Handler)(int fd, void *data);
-/** signature of add_handler functions passed as parameters */
+/** Signature of add_handler functions passed as parameters */
typedef int (*Fl_Event_Handler)(int event);
-/** signature of set_abort functions passed as parameters */
+/** Signature of set_abort functions passed as parameters */
typedef void (*Fl_Abort_Handler)(const char *format,...);
-/** signature of set_atclose functions passed as parameters */
+/** Signature of set_atclose functions passed as parameters */
typedef void (*Fl_Atclose_Handler)(Fl_Window *window, void *data);
-/** signature of args functions passed as parameters */
+/** Signature of args functions passed as parameters */
typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i);
+/** Signature of event_dispatch functions passed as parameters.
+ \see Fl::event_dispatch(Fl_Event_Dispatch) */
+typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
+
/** @} */ /* group callback_functions */
+
/**
- The Fl is the FLTK global (static) containing
+ The Fl is the FLTK global (static) class containing
state information and global methods for the current application.
*/
class FL_EXPORT Fl {
Fl() {}; // no constructor!
-
+
public: // should be private!
#ifndef FL_DOXYGEN
static int e_number;
@@ -128,6 +133,7 @@ public: // should be private!
static int e_keysym;
static char* e_text;
static int e_length;
+ static Fl_Event_Dispatch e_dispatch;
static Fl_Widget* belowmouse_;
static Fl_Widget* pushed_;
static Fl_Widget* focus_;
@@ -136,14 +142,69 @@ public: // should be private!
static Fl_Window* modal_;
static Fl_Window* grab_;
static int compose_state;
- static int visible_focus_;
- static int dnd_text_ops_;
#endif
/**
If true then flush() will do something.
*/
static void damage(int d) {damage_ = d;}
+
+public:
+ /** Enumerator for global FLTK options.
+ These options can be set system wide, per user, or for the running
+ application only.
+ \see Fl::option(Fl_Option, bool)
+ \see Fl::option(Fl_Option)
+ */
+ typedef enum {
+ /// When switched on, moving the text cursor beyond the start or end of
+ /// a text in a text widget will change focus to the next text widget.
+ /// When switched off, the cursor will stop at the end of the text.
+ /// Pressing Tab or Ctrl-Tab will advance the keyboard focus.
+ OPTION_ARROW_FOCUS = 0,
+ // When switched on, FLTK will use the file chooser dialog that comes
+ // with your operating system whenever possible. When switched off, FLTK
+ // will present its own file chooser.
+ // \todo implement me
+ // OPTION_NATIVE_FILECHOOSER,
+ // When Filechooser Preview is enabled, the FLTK or native file chooser
+ // will show a preview of a selected file (if possible) before the user
+ // decides to choose the file.
+ // \todo implement me
+ //OPTION_FILECHOOSER_PREVIEW,
+ /// If visible focus is switched on, FLTK will draw a dotted rectangle
+ /// inside the widget that will receive the next keystroke. If switched
+ /// off, no such indicator will be drawn and keyboard navigation
+ /// is disabled.
+ OPTION_VISIBLE_FOCUS,
+ /// If text drag-and-drop is enabled, the user can select and drag text
+ /// from any text widget. If disabled, no dragging is possible, however
+ /// dropping text from other applications still works.
+ OPTION_DND_TEXT,
+ /// If tooltips are enabled, hovering the mouse over a widget with a
+ /// tooltip text will open a little tooltip window until the mouse leaves
+ /// the widget. If disabled, no tooltip is shown.
+ OPTION_SHOW_TOOLTIPS,
+ // don't change this, leave it always as the last element
+ /// For internal use only.
+ OPTION_LAST
+ } Fl_Option;
+private:
+ static unsigned char options_[OPTION_LAST];
+ static unsigned char options_read_;
+
+public:
+ /*
+ Return a global setting for all FLTK applications, possibly overridden
+ by a setting specifically for this application.
+ */
+ static bool option(Fl_Option opt);
+
+ /*
+ Override an option while the application is running.
+ */
+ static void option(Fl_Option opt, bool val);
+
/**
The currently executing idle callback function: DO NOT USE THIS DIRECTLY!
@@ -176,9 +237,9 @@ public:
static double version();
// argument parsers:
- static int arg(int, char**, int&);
- static int args(int, char**, int&, Fl_Args_Handler ah = 0);
- static void args(int, char**);
+ static int arg(int argc, char **argv, int& i);
+ static int args(int argc, char **argv, int& i, Fl_Args_Handler cb = 0);
+ static void args(int argc, char **argv);
/**
Usage string displayed if Fl::args() detects an invalid argument.
This may be changed to point to customized text at run-time.
@@ -329,6 +390,7 @@ public:
be messed up, but the user can probably keep working - all X protocol
errors call this, for example. The default implementation returns after
displaying the message.
+ \note \#include
*/
static void (*warning)(const char*, ...);
/**
@@ -343,6 +405,7 @@ public:
Fl::error() means there is a recoverable error such as the inability to read
an image file. The default implementation returns after displaying the message.
+ \note \#include
*/
static void (*error)(const char*, ...);
/**
@@ -359,12 +422,13 @@ public:
version may be able to use longjmp or an exception to continue, as long as
it does not call FLTK again. The default implementation exits with status 1
after displaying the message.
+ \note \#include
*/
static void (*fatal)(const char*, ...);
/** @} */
/** \defgroup fl_windows Windows handling functions
- Windows and standard dialogs handling
+ \brief Windows and standard dialogs handling declared in
@{ */
static Fl_Window* first_window();
static void first_window(Fl_Window*);
@@ -380,37 +444,41 @@ public:
called (grab() overrides this).
*/
static Fl_Window* modal() {return modal_;}
- /**
- This is used when pop-up menu systems are active.
-
- Send all events to the passed window no matter where the pointer or
- focus is (including in other programs). The window does not have
- to be shown() , this lets the handle() method of a
- "dummy" window override all event handling and allows you to
- map and unmap a complex set of windows (under both X and WIN32
- some window must be mapped because the system interface needs a
- window id).
-
- If grab() is on it will also affect show() of windows by doing
- system-specific operations (on X it turns on override-redirect).
- These are designed to make menus popup reliably
- and faster on the system.
-
- To turn off grabbing do Fl::grab(0).
-
- Be careful that your program does not enter an infinite loop
- while grab() is on. On X this will lock up your screen!
- To avoid this potential lockup, all newer operating systems seem to
- limit mouse pointer grabbing to the time during which a mouse button
- is held down. Some OS's may not support grabbing at all.
+ /** Returns the window that currently receives all events.
+
+ \return The window that currently receives all events,
+ or NULL if event grabbing is currently OFF.
*/
static Fl_Window* grab() {return grab_;}
- /** Selects the window to grab. See Fl_Window* Fl::grab() */
+ /** Selects the window to grab.
+ This is used when pop-up menu systems are active.
+
+ Send all events to the passed window no matter where the pointer or
+ focus is (including in other programs). The window does not have
+ to be shown() , this lets the handle() method of a
+ "dummy" window override all event handling and allows you to
+ map and unmap a complex set of windows (under both X and WIN32
+ some window must be mapped because the system interface needs a
+ window id).
+
+ If grab() is on it will also affect show() of windows by doing
+ system-specific operations (on X it turns on override-redirect).
+ These are designed to make menus popup reliably
+ and faster on the system.
+
+ To turn off grabbing do Fl::grab(0).
+
+ Be careful that your program does not enter an infinite loop
+ while grab() is on. On X this will lock up your screen!
+ To avoid this potential lockup, all newer operating systems seem to
+ limit mouse pointer grabbing to the time during which a mouse button
+ is held down. Some OS's may not support grabbing at all.
+ */
static void grab(Fl_Window*); // platform dependent
/** @} */
/** \defgroup fl_events Events handling functions
- Fl class events handling API
+ Fl class events handling API declared in
@{
*/
// event information:
@@ -481,18 +549,18 @@ public:
*/
static void event_clicks(int i) {e_clicks = i;}
/**
- The first form returns non-zero if the mouse has not moved far enough
- and not enough time has passed since the last FL_PUSH or
- FL_KEYBOARD event for it to be considered a "drag" rather than a
- "click". You can test this on FL_DRAG, FL_RELEASE,
- and FL_MOVE events. The second form clears the value returned
- by Fl::event_is_click(). Useful to prevent the next
- click from being counted as a double-click or to make a popup menu
- pick an item with a single click. Don't pass non-zero to this.
+ Returns non-zero if the mouse has not moved far enough
+ and not enough time has passed since the last FL_PUSH or
+ FL_KEYBOARD event for it to be considered a "drag" rather than a
+ "click". You can test this on FL_DRAG, FL_RELEASE,
+ and FL_MOVE events.
*/
static int event_is_click() {return e_is_click;}
/**
- Only i=0 works! See int event_is_click().
+ Clears the value returned by Fl::event_is_click().
+ Useful to prevent the next
+ click from being counted as a double-click or to make a popup menu
+ pick an item with a single click. Don't pass non-zero to this.
*/
static void event_is_click(int i) {e_is_click = i;}
/**
@@ -618,19 +686,14 @@ public:
static int event_length() {return e_length;}
static int compose(int &del);
- /**
- If the user moves the cursor, be sure to call Fl::compose_reset().
- The next call to Fl::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.
- */
- static void compose_reset() {compose_state = 0;}
+ static void compose_reset();
static int event_inside(int,int,int,int);
static int event_inside(const Fl_Widget*);
static int test_shortcut(Fl_Shortcut);
// event destinations:
static int handle(int, Fl_Window*);
+ static int handle_(int, Fl_Window*);
/** Gets the widget that is below the mouse.
\see belowmouse(Fl_Widget*) */
static Fl_Widget* belowmouse() {return belowmouse_;}
@@ -644,31 +707,50 @@ public:
static void focus(Fl_Widget*);
static void add_handler(Fl_Event_Handler h);
static void remove_handler(Fl_Event_Handler h);
+ static void event_dispatch(Fl_Event_Dispatch d);
+ static Fl_Event_Dispatch event_dispatch();
/** @} */
/** \defgroup fl_clipboard Selection & Clipboard functions
- fl global copy/cut/paste functions
+ FLTK global copy/cut/paste functions declared in
@{ */
// cut/paste:
/**
- Copies the data pointed to by \p stuff to the selection (0) or
- primary (1) clipboard. The selection clipboard is used for
- middle-mouse pastes and for drag-and-drop selections. The primary
- clipboard is used for traditional copy/cut/paste operations.
+ Copies the data pointed to by \p stuff to the selection buffer
+ (\p destination is 0) or
+ the clipboard (\p destination is 1); \p len is the number of relevant
+ bytes in \p stuff.
+ The selection buffer is used for
+ middle-mouse pastes and for drag-and-drop selections. The
+ clipboard is used for traditional copy/cut/paste operations.
*/
- static void copy(const char* stuff, int len, int clipboard = 0); // platform dependent
+ static void copy(const char* stuff, int len, int destination = 0); // platform dependent
/**
- Pastes the data from the selection (0) or primary (1) clipboard into receiver.
- The selection clipboard is used for middle-mouse pastes and for
- drag-and-drop selections. The primary clipboard is used for
- traditional copy/cut/paste operations.
+ Pastes the data from the selection buffer (\p source is 0) or the clipboard
+ (\p source is 1) into \p receiver.
+ Set things up so the receiver widget will be called with an FL_PASTE event some
+ time in the future with the data from the specified \p source in Fl::event_text()
+ and the number of characters in Fl::event_length().
+ The receiver
+ should be prepared to be called \e directly by this, or for
+ it to happen \e later, or possibly not at all. This
+ allows the window system to take as long as necessary to retrieve
+ the paste buffer (or even to screw up completely) without complex
+ and error-prone synchronization code in FLTK.
+
+ The selection buffer is used for middle-mouse pastes and for
+ drag-and-drop selections. The clipboard is used for traditional
+ copy/cut/paste operations.
*/
- static void paste(Fl_Widget &receiver, int clipboard /*=0*/); // platform dependent
+ static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
/**
- Initiate a Drag And Drop operation. The clipboard should be
+ Initiate a Drag And Drop operation. The selection buffer should be
filled with relevant data before calling this method. FLTK will
then initiate the system wide drag and drop handling. Dropped data
will be marked as text.
+
+ Create a selection first using:
+ Fl::copy(const char *stuff, int len, 0)
*/
static int dnd(); // platform dependent
@@ -681,16 +763,16 @@ public:
static void paste(Fl_Widget &receiver);
/** @} */
/** \defgroup fl_screen Screen functions
- fl global screen functions
+ fl global screen functions declared in
@{ */
// screen size:
- /** Returns the origin of the current screen, where 0 indicates the left side of the screen. */
+ /** Returns the origin of the current screen work area, where 0 indicates the left side of the screen. */
static int x(); // platform dependent
- /** Returns the origin of the current screen, where 0 indicates the top edge of the screen. */
+ /** Returns the origin of the current screen work area, where 0 indicates the top edge of the screen. */
static int y(); // platform dependent
- /** Returns the width of the screen in pixels. */
+ /** Returns the width of the screen work area in pixels. */
static int w(); // platform dependent
- /** Returns the height of the screen in pixels. */
+ /** Returns the height of the screen work area in pixels. */
static int h(); // platform dependent
// multi-head support:
@@ -704,12 +786,15 @@ public:
screen_xywh(X, Y, W, H, e_x_root, e_y_root);
}
static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my);
- static void screen_xywh(int &X, int &Y, int &W, int &H, int n);
+ static void screen_xywh(int &X, int &Y, int &W, int &H, int n);
+ static void screen_xywh(int &X, int &Y, int &W, int &H, int mx, int my, int mw, int mh);
+ static void screen_dpi(float &h, float &v, int n=0);
/** @} */
/** \defgroup fl_attributes Color & Font functions
- fl global color, font functions
+ fl global color, font functions.
+ These functions are declared in or .
@{ */
// color map:
@@ -718,15 +803,15 @@ public:
Sets an entry in the fl_color index table. You can set it to any
8-bit RGB color. The color is not allocated until fl_color(i) is used.
*/
- static void set_color(Fl_Color, unsigned); // platform dependent
- static Fl_Color get_color(Fl_Color);
- static void get_color(Fl_Color, uchar&, uchar&, uchar&);
+ static void set_color(Fl_Color i, unsigned c); // platform dependent
+ static unsigned get_color(Fl_Color i);
+ static void get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue);
/**
Frees the specified color from the colormap, if applicable.
If overlay is non-zero then the color is freed from the
overlay colormap.
*/
- static void free_color(Fl_Color, int overlay = 0); // platform dependent
+ static void free_color(Fl_Color i, int overlay = 0); // platform dependent
// fonts:
static const char* get_font(Fl_Font);
@@ -779,7 +864,9 @@ public:
/** @} */
/** \defgroup fl_drawings Drawing functions
- fl global graphics and gui drawing functions
+ FLTK global graphics and GUI drawing functions.
+ These functions are declared in ,
+ and in for offscreen buffer-related ones.
@{ */
//
/** @} */
@@ -854,11 +941,11 @@ public:
\deprecated This method is obsolete - use the add_idle() method instead.
*/
static void set_idle(Fl_Old_Idle_Handler cb) {idle = cb;}
- /** See Fl_Window* grab() */
- static void grab(Fl_Window&win) {grab(&win);}
+ /** See grab(Fl_Window*) */
+ static void grab(Fl_Window& win) {grab(&win);}
/** Releases the current grabbed window, equals grab(0).
\deprecated Use Fl::grab(0) instead.
- \see Fl_Window* grab() */
+ \see grab(Fl_Window*) */
static void release() {grab(0);}
// Visible focus methods...
@@ -867,13 +954,13 @@ public:
non-text widgets. The default mode is to enable keyboard focus
for all widgets.
*/
- static void visible_focus(int v) { visible_focus_ = v; }
+ static void visible_focus(int v) { option(OPTION_VISIBLE_FOCUS, (v!=0)); }
/**
Gets or sets the visible keyboard focus on buttons and other
non-text widgets. The default mode is to enable keyboard focus
for all widgets.
*/
- static int visible_focus() { return visible_focus_; }
+ static int visible_focus() { return option(OPTION_VISIBLE_FOCUS); }
// Drag-n-drop text operation methods...
/**
@@ -882,20 +969,20 @@ public:
be dragged from text fields or dragged within a text field as a
cut/paste shortcut.
*/
- static void dnd_text_ops(int v) { dnd_text_ops_ = v; }
+ static void dnd_text_ops(int v) { option(OPTION_DND_TEXT, (v!=0)); }
/**
Gets or sets whether drag and drop text operations are
supported. This specifically affects whether selected text can
be dragged from text fields or dragged within a text field as a
cut/paste shortcut.
*/
- static int dnd_text_ops() { return dnd_text_ops_; }
+ static int dnd_text_ops() { return option(OPTION_DND_TEXT); }
/** \defgroup fl_multithread Multithreading support functions
- fl multithreading support functions
+ fl multithreading support functions declared in
@{ */
// Multithreading support:
- static void lock();
+ static int lock();
static void unlock();
static void awake(void* message = 0);
/** See void awake(void* message=0). */
@@ -904,14 +991,14 @@ public:
The thread_message() method returns the last message
that was sent from a child by the awake() method.
- See also: multithreading
+ See also: \ref advanced_multithreading
*/
static void* thread_message(); // platform dependent
/** @} */
/** \defgroup fl_del_widget Safe widget deletion support functions
- These functions support deletion of widgets inside callbacks.
+ These functions, declared in , support deletion of widgets inside callbacks.
Fl::delete_widget() should be called when deleting widgets
or complete widget trees (Fl_Group, Fl_Window, ...) inside
@@ -946,14 +1033,14 @@ public:
static void clear_widget_pointer(Fl_Widget const *w);
/** @} */
-#ifdef HAVE_CAIRO
+#ifdef FLTK_HAVE_CAIRO
/** \defgroup group_cairo Cairo support functions and classes
@{
*/
public:
// Cairo support API
static cairo_t * cairo_make_current(Fl_Window* w);
- /** when HAVE_CAIRO is defined and cairo_autolink_context() is true,
+ /** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true,
any current window dc is linked to a current context.
This is not the default, because it may not be necessary
to add cairo support to all fltk supported windows.
@@ -991,7 +1078,7 @@ private:
public:
/** @} */
-#endif // HAVE_CAIRO
+#endif // FLTK_HAVE_CAIRO
};
@@ -1076,12 +1163,12 @@ public:
};
/** \defgroup fl_unicode Unicode and UTF-8 functions
- fl global Unicode and UTF-8 handling functions
+ fl global Unicode and UTF-8 handling functions declared in
@{ */
/** @} */
#endif // !Fl_H
//
-// End of "$Id: Fl.H 7334 2010-03-25 14:37:46Z AlbrechtS $".
+// End of "$Id: Fl.H 8724 2011-05-23 18:01:29Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H b/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
index 8f3c68550..d0c661737 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Adjuster.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Adjuster.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,8 +40,8 @@
/**
The Fl_Adjuster widget was stolen from Prisms, and has proven
to be very useful for values that need a large dynamic range.
- \image html adjuster1.gif
- \image latex adjuster1.eps "Fl_Adjuster" width=4cm
+ \image html adjuster1.png
+ \image latex adjuster1.png "Fl_Adjuster" width=4cm
When you press a button and drag to the right the value increases.
When you drag to the left it decreases. The largest button adjusts by
100 * step(), the next by 10 * step() and that
@@ -78,5 +78,5 @@ public:
#endif
//
-// End of "$Id: Fl_Adjuster.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Adjuster.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
index aeaee42b7..35256c747 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Bitmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Bitmap.H 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $"
//
// Bitmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -81,5 +81,5 @@ public:
#endif
//
-// End of "$Id: Fl_Bitmap.H 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: Fl_Bitmap.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Box.H b/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
index f9e09effb..9de875dfc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Box.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $"
//
// Box header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -65,5 +65,5 @@ public:
#endif
//
-// End of "$Id: Fl_Box.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Box.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
index a2f8b00ce..b7cc06563 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser.H 6850 2009-09-07 02:25:51Z greg.ercolano $"
+// "$Id: Fl_Browser.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
//
// Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,7 +28,7 @@
/* \file
Fl_Browser widget . */
-// Forms-compatable browser. Probably useful for other
+// Forms-compatible browser. Probably useful for other
// lists of textual data. Notice that the line numbers
// start from 1, and 0 means "no line".
@@ -320,5 +320,5 @@ public:
#endif
//
-// End of "$Id: Fl_Browser.H 6850 2009-09-07 02:25:51Z greg.ercolano $".
+// End of "$Id: Fl_Browser.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
index 4068ae48b..5bcf7e164 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Browser_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Browser_.H 8275 2011-01-13 22:07:31Z manolo $"
//
// Common browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -138,20 +138,20 @@ protected:
\param[in] item The item whose label text is returned.
\returns The item's text label. (Can be NULL if blank)
*/
- virtual const char *item_text(void *item) const { return 0L; }
+ virtual const char *item_text(void *item) const { (void)item; return 0L; }
/**
This optional method should be provided by the subclass
to efficiently swap browser items \p a and \p b, such as for sorting.
\param[in] a,b The two items to be swapped.
*/
- virtual void item_swap(void *a,void *b) { }
+ virtual void item_swap(void *a,void *b) { (void)a; (void)b; }
/**
This method must be provided by the subclass
to return the item for the specified \p index.
\param[in] index The \p index of the item to be returned
\returns The item at the specified \p index.
*/
- virtual void *item_at(int index) const { return 0L; }
+ virtual void *item_at(int index) const { (void)index; return 0L; }
// you don't have to provide these but it may help speed it up:
virtual int full_width() const ; // current width of all items
virtual int full_height() const ; // current height of all items
@@ -374,5 +374,5 @@ public:
#endif
//
-// End of "$Id: Fl_Browser_.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Browser_.H 8275 2011-01-13 22:07:31Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
index 23547be05..39050dc44 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Button.H 7499 2010-04-14 08:07:53Z manolo $"
+// "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $"
//
// Button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -46,6 +46,8 @@
extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
+class Fl_Widget_Tracker;
+
/**
\class Fl_Button
\brief Buttons generate callbacks when they are clicked by the user.
@@ -88,6 +90,10 @@ class FL_EXPORT Fl_Button : public Fl_Widget {
protected:
+ static Fl_Widget_Tracker *key_release_tracker;
+ static void key_release_timeout(void*);
+ void simulate_key_action();
+
virtual void draw();
public:
@@ -170,5 +176,5 @@ public:
#endif
//
-// End of "$Id: Fl_Button.H 7499 2010-04-14 08:07:53Z manolo $".
+// End of "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H b/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
index e94c1a02a..97bd8eeba 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Chart.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Chart.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Forms chart header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -61,8 +61,8 @@ struct FL_CHART_ENTRY {
\brief Fl_Chart displays simple charts.
It is provided for Forms compatibility.
- \image html charts.gif
- \image latex charts.eps "Fl_Chart" width=10cm
+ \image html charts.png
+ \image latex charts.png "Fl_Chart" width=10cm
\todo Refactor Fl_Chart::type() information.
The type of an Fl_Chart object can be set using type(uchar t) to:
@@ -156,5 +156,5 @@ public:
#endif
//
-// End of "$Id: Fl_Chart.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
index c61c690ab..57cd96188 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -117,6 +117,6 @@ class FL_EXPORT Fl_Check_Browser : public Fl_Browser_ {
#endif // Fl_Check_Browser_H
//
-// End of "$Id: Fl_Check_Browser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Check_Browser.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
index 38eecb9a1..67fb01310 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Check_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Check button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,8 +37,8 @@
\class Fl_Check_Button
\brief A button with an "checkmark" to show its status.
- \image html Fl_Check_Button.gif
- \image latex Fl_Check_Button.eps "Fl_Check_Button" width=4cm
+ \image html Fl_Check_Button.png
+ \image latex Fl_Check_Button.png "Fl_Check_Button" width=4cm
Buttons generate callbacks when they are clicked by the user. You control
exactly when and how by changing the values for type() and when().
@@ -56,5 +56,5 @@ public:
#endif
//
-// End of "$Id: Fl_Check_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Check_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H b/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
index 50bb1e4e1..006364f3b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Choice.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Choice.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Choice header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -64,8 +64,8 @@
you pick the item with the mouse. The '\&' character in item names are
only looked at when the menu is popped up, however.
- \image html choice.gif
- \image latex choice.eps "Fl_Choice" width=4cm
+ \image html choice.png
+ \image latex choice.png "Fl_Choice" width=4cm
\todo Refactor the doxygen comments for Fl_Choice changed() documentation.
\li int Fl_Widget::changed() const
@@ -104,5 +104,5 @@ public:
#endif
//
-// End of "$Id: Fl_Choice.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Choice.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H b/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
index c4cf6c21b..0b631a8bf 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Clock.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Clock.H 6812 2009-07-01 07:27:25Z AlbrechtS $"
+// "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Clock header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -53,12 +53,12 @@
\htmlonly
type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK | \endhtmlonly
- \image html clock.gif
+ \image html clock.png
\htmlonly | \endhtmlonly
- \image html round_clock.gif
+ \image html round_clock.png
\htmlonly |
\endhtmlonly
- \image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
- \image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
+ \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
*/
class FL_EXPORT Fl_Clock_Output : public Fl_Widget {
int hour_, minute_, second_;
@@ -112,12 +112,12 @@ public:
You can choose the rounded or square type of the clock with type(), see below.
\htmlonly
type() FL_SQUARE_CLOCK and FL_ROUND_CLOCK | \endhtmlonly
- \image html clock.gif
+ \image html clock.png
\htmlonly | \endhtmlonly
- \image html round_clock.gif
+ \image html round_clock.png
\htmlonly |
\endhtmlonly
- \image latex clock.eps "FL_SQUARE_CLOCK type" width=4cm
- \image latex round_clock.eps "FL_ROUND_CLOCK type" width=4cm
+ \image latex clock.png "FL_SQUARE_CLOCK type" width=4cm
+ \image latex round_clock.png "FL_ROUND_CLOCK type" width=4cm
*/
class FL_EXPORT Fl_Clock : public Fl_Clock_Output {
public:
@@ -133,5 +133,5 @@ public:
#endif
//
-// End of "$Id: Fl_Clock.H 6812 2009-07-01 07:27:25Z AlbrechtS $".
+// End of "$Id: Fl_Clock.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
index 890c67cc2..180ee002a 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Color_Chooser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Color chooser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -84,7 +84,7 @@ public:
\brief The Fl_Color_Chooser widget provides a standard RGB color chooser.
\image html fl_color_chooser.jpg
- \image latex fl_color_chooser.eps "fl_color_chooser()" width=5cm
+ \image latex fl_color_chooser.jpg "fl_color_chooser()" width=5cm
You can place any number of the widgets into a panel of your own design.
The diagram shows the widget as part of a color chooser dialog created by
@@ -127,9 +127,19 @@ class FL_EXPORT Fl_Color_Chooser : public Fl_Group {
static void rgb_cb(Fl_Widget*, void*);
static void mode_cb(Fl_Widget*, void*);
public:
- /** Returns which Fl_Color_Chooser variant is currently active */
+
+ /**
+ Returns which Fl_Color_Chooser variant is currently active
+ \return color modes are rgb(0), byte(1), hex(2), or hsv(3)
+ */
int mode() {return choice.value();}
-
+
+ /**
+ Set which Fl_Color_Chooser variant is currently active
+ \param[in] newMode color modes are rgb(0), byte(1), hex(2), or hsv(3)
+ */
+ void mode(int newMode);
+
/**
Returns the current hue.
0 <= hue < 6. Zero is red, one is yellow, two is green, etc.
@@ -179,11 +189,11 @@ public:
Fl_Color_Chooser(int X, int Y, int W, int H, const char *L = 0);
};
-FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b);
-FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b);
+FL_EXPORT int fl_color_chooser(const char* name, double& r, double& g, double& b, int m=-1);
+FL_EXPORT int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b, int m=-1);
#endif
//
-// End of "$Id: Fl_Color_Chooser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Color_Chooser.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H b/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
index e6f1fad0d..419715bea 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Counter.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Counter.H 6939 2009-11-17 14:45:36Z matt $"
+// "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Counter header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -45,8 +45,8 @@
Controls a single floating point value with button (or keyboard) arrows.
Double arrows buttons achieve larger steps than simple arrows.
\see Fl_Spinner for value input with vertical step arrows.
- \image html counter.gif
- \image latex counter.eps "Fl_Counter" width=4cm
+ \image html counter.png
+ \image latex counter.png "Fl_Counter" width=4cm
\todo Refactor the doxygen comments for Fl_Counter type() documentation.
@@ -120,5 +120,5 @@ public:
#endif
//
-// End of "$Id: Fl_Counter.H 6939 2009-11-17 14:45:36Z matt $".
+// End of "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Device.H b/plugins/zynaddsubfx/fltk/FL/Fl_Device.H
index 2cb9e66d1..5b96dc8b1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Device.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Device.H
@@ -1,10 +1,10 @@
//
-// "$Id: Fl_Device.H 7666 2010-07-04 17:19:38Z AlbrechtS $"
+// "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $"
//
// Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device
// for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010 by Bill Spitzak and others.
+// 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
@@ -26,7 +26,8 @@
// http://www.fltk.org/str.php
//
/** \file Fl_Device.H
- \brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device.
+ \brief declaration of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device,
+ Fl_Display_Device, Fl_Device_Plugin.
*/
#ifndef Fl_Device_H
@@ -38,22 +39,11 @@
#include
#include
#include
-#ifdef WIN32
-#include
-#elif defined(__APPLE__)
-#else
-#include
-#endif
class Fl_Graphics_Driver;
-class Fl_Display_Device;
-class Fl_Surface_Device;
+class Fl_Font_Descriptor;
/** \brief Points to the driver that currently receives all graphics requests */
FL_EXPORT extern Fl_Graphics_Driver *fl_graphics_driver;
-/** \brief Points to the surface that currently receives all graphics requests */
-FL_EXPORT extern Fl_Surface_Device *fl_surface;
-/** \brief Points to the platform's display */
-FL_EXPORT extern Fl_Display_Device *fl_display_device;
/**
signature of image generation callback function.
@@ -65,47 +55,86 @@ FL_EXPORT extern Fl_Display_Device *fl_display_device;
*/
typedef void (*Fl_Draw_Image_Cb)(void* data,int x,int y,int w,uchar* buf);
+// typedef what the x,y fields in a point are:
+#ifdef WIN32
+typedef int COORD_T;
+# define XPOINT XPoint
+#elif defined(__APPLE__)
+typedef float COORD_T;
+typedef struct { float x; float y; } QPoint;
+# define XPOINT QPoint
+extern float fl_quartz_line_width_;
+#else
+typedef short COORD_T;
+# define XPOINT XPoint
+#endif
+
/**
\brief All graphical output devices and all graphics systems.
*/
-class Fl_Device {
-protected:
- /** \brief The device type */
- const char *type_;
- /** \brief A string that identifies each subclass of Fl_Device.
- *
- Function type() applied to a device of this class returns this string.
- */
- static const char *device_type;
+class FL_EXPORT Fl_Device {
public:
+ /** A string that identifies each subclass of Fl_Device.
+ Function class_name() applied to a device of this class returns this string.
+ */
+ static const char *class_id;
/**
- @brief An RTTI emulation of device classes.
- *
- The type of an instance of an Fl_Device subclass can be checked with code such as:
+ Returns the name of the class of this object.
+ The class of an instance of an Fl_Device subclass can be checked with code such as:
\code
- if ( instance->type() == Fl_Printer::device_type ) { ... }
+ if ( instance->class_name() == Fl_Printer::class_id ) { ... }
\endcode
*/
- inline const char *type() {return type_;};
+ virtual const char *class_name() {return class_id;};
+ /**
+ Virtual destructor.
+
+ The destructor of Fl_Device must be virtual to make the destructors of
+ derived classes being called correctly on destruction.
+ */
+ virtual ~Fl_Device() {};
};
+#define FL_REGION_STACK_SIZE 10
+#define FL_MATRIX_STACK_SIZE 32
/**
\brief A virtual class subclassed for each graphics driver FLTK uses.
*
- The protected virtual methods of this class are those that a graphics driver should implement to
+ The virtual methods of this class are those that a graphics driver should implement to
support all of FLTK drawing functions.
-
The preferred FLTK API for drawing operations is the function collection of the
- \ref fl_drawings and \ref fl_attributes modules.
-
Alternatively, methods of the Fl_Graphics_Driver class can be called
- using the global variable Fl_Graphics_Driver * \ref fl_graphics_driver that points at all time to
- the single driver (an instance of an Fl_Graphics_Driver subclass) that's currently receiving graphics
- requests. For example:
- \code fl_graphics_driver->rect(x, y, w, h); \endcode
-
Each protected method of the Fl_Graphics_Driver class has the same effect as the
- function of the \ref fl_drawings and \ref fl_attributes modules which bears the same name
- prefixed with fl_ and has the same parameter list.
+
The public API for drawing operations is functionally presented in \ref drawing and as function lists
+ in the \ref fl_drawings and \ref fl_attributes modules.
*/
-class Fl_Graphics_Driver : public Fl_Device {
+class FL_EXPORT Fl_Graphics_Driver : public Fl_Device {
+public:
+ /** A 2D coordinate transformation matrix
+ */
+ struct matrix {double a, b, c, d, x, y;};
+private:
+ static const matrix m0;
+ Fl_Font font_; // current font
+ Fl_Fontsize size_; // current font size
+ Fl_Color color_; // current color
+ enum {LINE, LOOP, POLYGON, POINT_};
+ int sptr;
+ static const int matrix_stack_size = FL_MATRIX_STACK_SIZE;
+ matrix stack[FL_MATRIX_STACK_SIZE];
+ matrix m;
+ int n, p_size, gap_;
+ XPOINT *p;
+ int what;
+ int fl_clip_state_number;
+ int rstackptr;
+ static const int region_stack_max = FL_REGION_STACK_SIZE - 1;
+ Fl_Region rstack[FL_REGION_STACK_SIZE];
+#ifdef WIN32
+ int numcount;
+ int counts[20];
+#endif
+ Fl_Font_Descriptor *font_descriptor_;
+ void transformed_vertex0(COORD_T x, COORD_T y);
+ void fixloop();
+
protected:
/* ** \brief red color for background and/or mixing if device does not support masking or alpha *
uchar bg_r_;
@@ -116,7 +145,6 @@ protected:
friend class Fl_Pixmap;
friend class Fl_Bitmap;
friend class Fl_RGB_Image;
- friend class Fl_PostScript_Graphics_Driver;
friend void fl_rect(int x, int y, int w, int h);
friend void fl_rectf(int x, int y, int w, int h);
friend void fl_line_style(int style, int width, char* dashes);
@@ -165,13 +193,31 @@ protected:
friend void fl_begin_complex_polygon();
friend void fl_gap();
friend void fl_end_complex_polygon();
+ friend void fl_push_matrix();
+ friend void fl_pop_matrix();
+ friend void fl_mult_matrix(double a, double b, double c, double d, double x, double y);
+ friend void fl_scale(double x, double y);
+ friend void fl_scale(double x);
+ friend void fl_translate(double x, double y);
+ friend void fl_rotate(double d);
+ friend double fl_transform_x(double x, double y);
+ friend double fl_transform_y(double x, double y);
+ friend double fl_transform_dx(double x, double y);
+ friend double fl_transform_dy(double x, double y);
+ friend Fl_Region fl_clip_region();
+ friend void fl_clip_region(Fl_Region r);
+ friend void fl_restore_clip();
+
friend void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L);
friend void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L);
friend void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
friend FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D);
-
+ friend FL_EXPORT void gl_start();
+
+ matrix *fl_matrix; /**< Points to the current coordinate transformation matrix */
+
/** \brief The constructor. */
- Fl_Graphics_Driver() {};
+ Fl_Graphics_Driver();
/** \brief see fl_rect(int x, int y, int w, int h). */
virtual void rect(int x, int y, int w, int h);
/** \brief see fl_rectf(int x, int y, int w, int h). */
@@ -195,17 +241,18 @@ protected:
/** \brief see fl_line(int x, int y, int x1, int y1, int x2, int y2). */
virtual void line(int x, int y, int x1, int y1, int x2, int y2);
/** \brief see fl_draw(const char *str, int n, int x, int y). */
- virtual void draw(const char *str, int n, int x, int y);
+ virtual void draw(const char *str, int n, int x, int y) = 0;
+#ifdef __APPLE__
+ virtual void draw(const char *str, int n, float x, float y) = 0;
+#endif
/** \brief see fl_draw(int angle, const char *str, int n, int x, int y). */
- virtual void draw(int angle, const char *str, int n, int x, int y);
+ virtual void draw(int angle, const char *str, int n, int x, int y) = 0;
/** \brief see fl_rtl_draw(const char *str, int n, int x, int y). */
- virtual void rtl_draw(const char *str, int n, int x, int y);
- /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
- virtual void font(Fl_Font face, Fl_Fontsize size);
+ virtual void rtl_draw(const char *str, int n, int x, int y) = 0;
/** \brief see fl_color(Fl_Color c). */
- virtual void color(Fl_Color c);
+ virtual void color(Fl_Color c) {color_ = c;}
/** \brief see fl_color(uchar r, uchar g, uchar b). */
- virtual void color(uchar r, uchar g, uchar b);
+ virtual void color(uchar r, uchar g, uchar b) = 0;
/** \brief see fl_point(int x, int y). */
virtual void point(int x, int y);
/** \brief see fl_loop(int x0, int y0, int x1, int y1, int x2, int y2). */
@@ -262,37 +309,90 @@ protected:
virtual void push_no_clip();
/** \brief see fl_pop_clip(). */
virtual void pop_clip();
+
+ /** \brief see fl_push_matrix(). */
+ void push_matrix();
+ /** \brief see fl_pop_matrix(). */
+ void pop_matrix();
+ /** \brief see fl_mult_matrix(double a, double b, double c, double d, double x, double y). */
+ void mult_matrix(double a, double b, double c, double d, double x, double y);
+ /** \brief see fl_scale(double x, double y). */
+ inline void scale(double x, double y) { mult_matrix(x,0,0,y,0,0); }
+ /** \brief see fl_scale(double x). */
+ inline void scale(double x) { mult_matrix(x,0,0,x,0,0); }
+ /** \brief see fl_translate(double x, double y). */
+ inline void translate(double x,double y) { mult_matrix(1,0,0,1,x,y); }
+ /** \brief see fl_rotate(double d). */
+ void rotate(double d);
+ /** \brief see fl_transform_x(double x, double y). */
+ double transform_x(double x, double y);
+ /** \brief see fl_transform_y(double x, double y). */
+ double transform_y(double x, double y);
+ /** \brief see fl_transform_dx(double x, double y). */
+ double transform_dx(double x, double y);
+ /** \brief see fl_transform_dy(double x, double y). */
+ double transform_dy(double x, double y);
+ /** \brief see fl_clip_region(). */
+ Fl_Region clip_region();
+ /** \brief see fl_clip_region(Fl_Region r). */
+ void clip_region(Fl_Region r);
+ /** \brief see fl_restore_clip(). */
+ void restore_clip();
+
// Images
/** \brief see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
- virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+ virtual void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0) = 0;
/** \brief see fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D, int L). */
- virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+ virtual void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0) = 0;
/** \brief see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
- virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+ virtual void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3) = 0;
/** \brief see fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D). */
- virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
+ virtual void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1) = 0;
// Image classes
/** \brief Draws an Fl_RGB_Image object to the device.
*
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
the image offset by the cx and cy arguments.
*/
- virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) {};
+ virtual void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
/** \brief Draws an Fl_Pixmap object to the device.
*
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
the image offset by the cx and cy arguments.
*/
- virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) {};
+ virtual void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy) = 0;
/** \brief Draws an Fl_Bitmap object to the device.
*
Specifies a bounding box for the image, with the origin (upper left-hand corner) of
the image offset by the cx and cy arguments.
*/
- virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) {};
+ virtual void draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy) = 0;
public:
- static const char *device_type;
+ static const char *class_id;
+ virtual const char *class_name() {return class_id;};
+ /** \brief see fl_font(Fl_Font face, Fl_Fontsize size). */
+ virtual void font(Fl_Font face, Fl_Fontsize size) {font_ = face; size_ = size;}
+ /** \brief see fl_font(void). */
+ Fl_Font font() {return font_; }
+ /** \brief see fl_size(). */
+ Fl_Fontsize size() {return size_; }
+ /** \brief see fl_width(const char *str, int n). */
+ virtual double width(const char *str, int n) = 0;
+ /** \brief see fl_width(unsigned int n). */
+ virtual inline double width(unsigned int c) { char ch = (char)c; return width(&ch, 1); }
+ /** \brief see fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h). */
+ virtual void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+ /** \brief see fl_height(). */
+ virtual int height() = 0;
+ /** \brief see fl_descent(). */
+ virtual int descent() = 0;
+ /** \brief see fl_color(void). */
+ Fl_Color color() {return color_;}
+ /** Returns a pointer to the current Fl_Font_Descriptor for the graphics driver */
+ inline Fl_Font_Descriptor *font_descriptor() { return font_descriptor_;}
+ /** Sets the current Fl_Font_Descriptor for the graphics driver */
+ inline void font_descriptor(Fl_Font_Descriptor *d) { font_descriptor_ = d;}
/** \brief The destructor */
virtual ~Fl_Graphics_Driver() {};
};
@@ -303,13 +403,31 @@ public:
*
This class is implemented only on the Mac OS X platform.
*/
-class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
+class FL_EXPORT Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
public:
- Fl_Quartz_Graphics_Driver() { type_ = device_type; };
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
+ void color(Fl_Color c);
+ void color(uchar r, uchar g, uchar b);
+ void draw(const char* str, int n, int x, int y);
+#ifdef __APPLE__
+ void draw(const char *str, int n, float x, float y);
+#endif
+ void draw(int angle, const char *str, int n, int x, int y);
+ void rtl_draw(const char* str, int n, int x, int y);
+ void font(Fl_Font face, Fl_Fontsize size);
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+ void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+ void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+ void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
+ double width(const char *str, int n);
+ double width(unsigned int c);
+ void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+ int height();
+ int descent();
};
#endif
#if defined(WIN32) || defined(FL_DOXYGEN)
@@ -318,13 +436,28 @@ public:
*
This class is implemented only on the MSWindows platform.
*/
-class Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver {
+class FL_EXPORT Fl_GDI_Graphics_Driver : public Fl_Graphics_Driver {
public:
- Fl_GDI_Graphics_Driver() { type_ = device_type; };
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
+ void color(Fl_Color c);
+ void color(uchar r, uchar g, uchar b);
+ void draw(const char* str, int n, int x, int y);
+ void draw(int angle, const char *str, int n, int x, int y);
+ void rtl_draw(const char* str, int n, int x, int y);
+ void font(Fl_Font face, Fl_Fontsize size);
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+ void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+ void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+ void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
+ double width(const char *str, int n);
+ double width(unsigned int c);
+ void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+ int height();
+ int descent();
};
#endif
#if !(defined(__APPLE__) || defined(WIN32))
@@ -335,32 +468,49 @@ public:
*/
class Fl_Xlib_Graphics_Driver : public Fl_Graphics_Driver {
public:
- Fl_Xlib_Graphics_Driver() { type_ = device_type; };
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
+ void color(Fl_Color c);
+ void color(uchar r, uchar g, uchar b);
+ void draw(const char* str, int n, int x, int y);
+ void draw(int angle, const char *str, int n, int x, int y);
+ void rtl_draw(const char* str, int n, int x, int y);
+ void font(Fl_Font face, Fl_Fontsize size);
void draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
void draw(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0);
+ void draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3);
+ void draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0);
+ void draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
+ double width(const char *str, int n);
+ double width(unsigned int c);
+ void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+ int height();
+ int descent();
};
#endif
/**
\brief A surface that's susceptible to receive graphical output.
*/
-class Fl_Surface_Device : public Fl_Device {
+class FL_EXPORT Fl_Surface_Device : public Fl_Device {
/** \brief The graphics driver in use by this surface. */
Fl_Graphics_Driver *_driver;
+ static Fl_Surface_Device *_surface; // the surface that currently receives graphics output
protected:
/** \brief Constructor that sets the graphics driver to use for the created surface. */
Fl_Surface_Device(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver; };
public:
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
virtual void set_current(void);
/** \brief Sets the graphics driver of this drawing surface. */
inline void driver(Fl_Graphics_Driver *graphics_driver) {_driver = graphics_driver;};
/** \brief Returns the graphics driver of this drawing surface. */
inline Fl_Graphics_Driver *driver() {return _driver; };
/** \brief the surface that currently receives graphics output */
- static Fl_Surface_Device *surface() {return fl_surface; };
+ static inline Fl_Surface_Device *surface() {return _surface; };
/** \brief The destructor. */
virtual ~Fl_Surface_Device() {}
};
@@ -368,19 +518,41 @@ public:
/**
\brief A display to which the computer can draw.
*/
-class Fl_Display_Device : public Fl_Surface_Device {
+class FL_EXPORT Fl_Display_Device : public Fl_Surface_Device {
+ static Fl_Display_Device *_display; // the platform display device
public:
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
/** \brief A constructor that sets the graphics driver used by the display */
- Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( graphics_driver) { type_ = device_type; };
- /**
- @brief Returns the platform's display device.
+ Fl_Display_Device(Fl_Graphics_Driver *graphics_driver);
+ /** Returns the platform display device. */
+ static inline Fl_Display_Device *display_device() {return _display;};
+};
+
+/**
+ This plugin socket allows the integration of new device drivers for special
+ window or screen types. It is currently used to provide an automated printing
+ service for OpenGL windows, if linked with fltk_gl.
+ */
+class FL_EXPORT Fl_Device_Plugin : public Fl_Plugin {
+public:
+ /** \brief The constructor */
+ Fl_Device_Plugin(const char *name)
+ : Fl_Plugin(klass(), name) { }
+ /** \brief Returns the class name */
+ virtual const char *klass() { return "fltk:device"; }
+ /** \brief Returns the plugin name */
+ virtual const char *name() = 0;
+ /** \brief Prints a widget
+ \param w the widget
+ \param x,y offsets where to print relatively to coordinates origin
+ \param height height of the current drawing area
*/
- static Fl_Display_Device *display_device() { return fl_display_device; };
+ virtual int print(Fl_Widget* w, int x, int y, int height) = 0;
};
#endif // Fl_Device_H
//
-// End of "$Id: Fl_Device.H 7666 2010-07-04 17:19:38Z AlbrechtS $".
+// End of "$Id: Fl_Device.H 8529 2011-03-23 12:49:30Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
index 5ca33ec0c..96de59fc4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,8 +43,8 @@
/**
The Fl_Dial widget provides a circular dial to control a
single floating point value.
- \image html dial.gif
- \image latex dial.eps "Fl_Dial" width=4cm
+
\image html dial.png
+ \image latex dial.png "Fl_Dial" width=4cm
Use type() to set the type of the dial to:
- FL_NORMAL_DIAL - Draws a normal dial with a knob.
@@ -93,5 +93,5 @@ public:
#endif
//
-// End of "$Id: Fl_Dial.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Dial.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
index f67e9f245..20ab25b30 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Double_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $"
//
// Double-buffered window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -77,5 +77,5 @@ public:
#endif
//
-// End of "$Id: Fl_Double_Window.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Double_Window.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Export.H b/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
index 73887dc46..875a2789e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Export.H
@@ -1,9 +1,9 @@
/*
- * "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $"
+ * "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $"
*
* WIN32 DLL export .
*
- * Copyright 1998-2009 by Bill Spitzak and others.
+ * 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
@@ -32,7 +32,7 @@
* The following is only used when building DLLs under WIN32...
*/
-# if defined(FL_DLL) && (defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) || __GNUC__ >= 3)
+# if defined(FL_DLL)
# ifdef FL_LIBRARY
# define FL_EXPORT __declspec(dllexport)
# else
@@ -45,5 +45,5 @@
#endif /* !Fl_Export_H */
/*
- * End of "$Id: Fl_Export.H 6614 2009-01-01 16:11:32Z matt $".
+ * End of "$Id: Fl_Export.H 7903 2010-11-28 21:06:39Z matt $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
index 9de6851d9..cc7fc96f5 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $"
//
// FileBrowser definitions.
//
-// Copyright 1999-2009 by Michael Sweet.
+// 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
@@ -45,8 +45,8 @@
//
/** The Fl_File_Browser widget displays a list of filenames, optionally with file-specific icons. */
-class FL_EXPORT Fl_File_Browser : public Fl_Browser
-{
+class FL_EXPORT Fl_File_Browser : public Fl_Browser {
+
int filetype_;
const char *directory_;
uchar iconsize_;
@@ -116,5 +116,5 @@ public:
#endif // !_Fl_File_Browser_H_
//
-// End of "$Id: Fl_File_Browser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_File_Browser.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
index 92471beec..3816621ca 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Chooser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser.H 7007 2010-01-14 23:08:06Z greg.ercolano $"
+// "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -54,8 +54,8 @@ private:
static Fl_Preferences prefs_;
void (*callback_)(Fl_File_Chooser*, void *);
void *data_;
- char directory_[1024];
- char pattern_[1024];
+ char directory_[FL_PATH_MAX];
+ char pattern_[FL_PATH_MAX];
char preview_text_[2048];
int type_;
void favoritesButtonCB();
@@ -95,6 +95,11 @@ public:
private:
void cb_previewButton_i(Fl_Check_Button*, void*);
static void cb_previewButton(Fl_Check_Button*, void*);
+public:
+ Fl_Check_Button *showHiddenButton;
+private:
+ void cb_showHiddenButton_i(Fl_Check_Button*, void*);
+ static void cb_showHiddenButton(Fl_Check_Button*, void*);
Fl_File_Input *fileName;
void cb_fileName_i(Fl_File_Input*, void*);
static void cb_fileName(Fl_File_Input*, void*);
@@ -144,9 +149,13 @@ public:
const char * ok_label();
void preview(int e);
int preview() const { return previewButton->value(); };
+private:
+ void showHidden(int e);
+ void remove_hidden_files();
+public:
void rescan();
void rescan_keep_filename();
- void show();
+ void show();
int shown();
void textcolor(Fl_Color c);
Fl_Color textcolor();
@@ -213,6 +222,10 @@ public:
[standard text may be customized at run-time]
*/
static const char *show_label;
+ /**
+ [standard text may be customized at run-time]
+ */
+ static const char *hidden_label;
/**
the sort function that is used when loading
the contents of a directory.
@@ -222,7 +235,6 @@ private:
Fl_Widget* ext_group;
public:
Fl_Widget* add_extra(Fl_Widget* gr);
- Fl_File_Browser *browser(void) {return fileList; };
};
FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname,int relative=0);
FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname,int relative=0);
@@ -231,5 +243,5 @@ FL_EXPORT void fl_file_chooser_ok_label(const char*l);
#endif
//
-// End of "$Id: Fl_File_Chooser.H 7007 2010-01-14 23:08:06Z greg.ercolano $".
+// End of "$Id: Fl_File_Chooser.H 8786 2011-06-07 11:41:36Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
index 174c7604e..7e67f0276 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Icon.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $"
//
// Fl_File_Icon definitions.
//
-// Copyright 1999-2009 by Michael Sweet.
+// 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
@@ -53,8 +53,8 @@
The Fl_File_Icon class manages icon images that can be used
as labels in other widgets and as icons in the FileBrowser widget.
*/
-class FL_EXPORT Fl_File_Icon //// Icon data
-{
+class FL_EXPORT Fl_File_Icon { //// Icon data
+
static Fl_File_Icon *first_; // Pointer to first icon/filetype
Fl_File_Icon *next_; // Pointer to next icon/filetype
const char *pattern_; // Pattern string
@@ -164,5 +164,5 @@ class FL_EXPORT Fl_File_Icon //// Icon data
#endif // !_Fl_Fl_File_Icon_H_
//
-// End of "$Id: Fl_File_Icon.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_File_Icon.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
index cb45acf06..e3d27fabc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_File_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $"
+// "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -42,17 +42,19 @@
navigate upward in the directory tree.
You may want to handle FL_WHEN_CHANGED events for tracking text changes
and also FL_WHEN_RELEASE for button release when changing to parent dir.
- FL_WHEN_RELEASE callback won't be called if the directory clicked
- is the same that the current one.
- \image html Fl_File_Input.gif
- \image latex Fl_File_Input.eps "Fl_File_Input" width=6cm
+ FL_WHEN_RELEASE callback won't be called if the directory clicked
+ is the same as the current one.
+
+ \image html Fl_File_Input.png
+ \image latex Fl_File_Input.png "Fl_File_Input" width=6cm
+
\note As all Fl_Input derived objects, Fl_File_Input may call its callback
- when loosing focus (see FL_UNFOCUS) to update its state like its cursor shape.
+ when losing focus (see FL_UNFOCUS) to update its state like its cursor shape.
One resulting side effect is that you should call clear_changed() early in your callback
to avoid reentrant calls if you plan to show another window or dialog box in the callback.
*/
-class FL_EXPORT Fl_File_Input : public Fl_Input
-{
+class FL_EXPORT Fl_File_Input : public Fl_Input {
+
Fl_Color errorcolor_;
char ok_entry_;
uchar down_box_;
@@ -100,5 +102,5 @@ public:
//
-// End of "$Id: Fl_File_Input.H 6716 2009-03-24 01:40:44Z fabien $".
+// End of "$Id: Fl_File_Input.H 8712 2011-05-22 09:45:40Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
index b2a27fbe6..e3b8444cd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Filled dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,7 +34,7 @@
#include "Fl_Dial.H"
/** Draws a dial with a filled arc */
-class Fl_Fill_Dial : public Fl_Dial {
+class FL_EXPORT Fl_Fill_Dial : public Fl_Dial {
public:
/** Creates a filled dial, also setting its type to FL_FILL_DIAL. */
Fl_Fill_Dial(int x,int y,int w,int h, const char *l = 0)
@@ -44,5 +44,5 @@ public:
#endif
//
-// End of "$Id: Fl_Fill_Dial.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Fill_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
index 92a49fed8..05e22b191 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Fill_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Filled slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Slider.H"
/** Widget that draws a filled horizontal slider, useful as a progress or value meter*/
-class Fl_Fill_Slider : public Fl_Slider {
+class FL_EXPORT Fl_Fill_Slider : public Fl_Slider {
public:
/** Creates the slider from its position,size and optional title. */
Fl_Fill_Slider(int x,int y,int w,int h,const char *l=0)
@@ -43,5 +43,5 @@ public:
#endif
//
-// End of "$Id: Fl_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
index 2a312308a..f774dd379 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Float_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Floating point input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -39,19 +39,24 @@
that only allows the user to type floating point numbers (sign,
digits, decimal point, more digits, 'E' or 'e', sign, digits).
*/
-class Fl_Float_Input : public Fl_Input {
+class FL_EXPORT Fl_Float_Input : public Fl_Input {
public:
/**
- Creates a new Fl_Float_Input widget using the given position,
+ Creates a new Fl_Float_Input widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
- Inherited destructor destroys the widget and any value associated with it
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0);
+#else
Fl_Float_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_FLOAT_INPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Float_Input.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Float_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
index fe3347526..55582629d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_FormsBitmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_FormsBitmap.H 7903 2010-11-28 21:06:39Z matt $"
//
// Forms bitmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -52,5 +52,5 @@ public:
#endif
//
-// End of "$Id: Fl_FormsBitmap.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_FormsBitmap.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
index 23b8a8ce7..1eb01dee3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_FormsPixmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_FormsPixmap.H 7903 2010-11-28 21:06:39Z matt $"
//
// Forms pixmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -59,5 +59,5 @@ public:
#endif
//
-// End of "$Id: Fl_FormsPixmap.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_FormsPixmap.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Free.H b/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
index 4bab575e0..367443ca0 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Free.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Free.H 7903 2010-11-28 21:06:39Z matt $"
//
// Forms free header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -85,5 +85,5 @@ public:
#endif
//
-// End of "$Id: Fl_Free.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Free.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Group.H b/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
index 2c6e6f946..0056e1035 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Group.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Group.H 7280 2010-03-16 22:51:31Z matt $"
+// "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $"
//
// Group header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -106,6 +106,7 @@ public:
widget if \p before is not in the group.
*/
void insert(Fl_Widget& o, Fl_Widget* before) {insert(o,find(before));}
+ void remove(int index);
void remove(Fl_Widget&);
/**
Removes the widget \p o from the group.
@@ -127,13 +128,13 @@ public:
In these examples the gray area is the resizable:
- \image html resizebox1.gif
+ \image html resizebox1.png
- \image html resizebox2.gif
+ \image html resizebox2.png
- \image latex resizebox1.eps "before resize" width=4cm
+ \image latex resizebox1.png "before resize" width=4cm
- \image latex resizebox2.eps "after resize" width=4cm
+ \image latex resizebox2.png "after resize" width=4cm
The resizable may be set to the group itself, in which case all the
contents are resized. This is the default value for Fl_Group,
@@ -176,12 +177,7 @@ public:
*/
unsigned int clip_children() { return (flags() & CLIP_CHILDREN) != 0; }
- /** Returns an Fl_Group pointer if this widget is an Fl_Group.
-
- \retval NULL if this widget is not derived from Fl_Group.
- \note This method is provided to avoid dynamic_cast.
- \todo More documentation ...
- */
+ // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
virtual Fl_Group* as_group() { return this; }
// back compatibility functions:
@@ -230,5 +226,5 @@ public:
#endif
//
-// End of "$Id: Fl_Group.H 7280 2010-03-16 22:51:31Z matt $".
+// End of "$Id: Fl_Group.H 8157 2011-01-01 14:01:53Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H b/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
index 3b8fe4c31..7cb2aef5f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Help_Dialog.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $"
//
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,8 +43,8 @@
class FL_EXPORT Fl_Help_Dialog {
int index_;
int max_;
- int line_[100];
- char file_[100][256];
+ int line_[100]; // FIXME: we must remove those static numbers
+ char file_[100][FL_PATH_MAX]; // FIXME: we must remove those static numbers
int find_pos_;
public:
Fl_Help_Dialog();
@@ -91,5 +91,5 @@ public:
#endif
//
-// End of "$Id: Fl_Help_Dialog.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Help_Dialog.H 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H b/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
index f30dc6b44..c0ee66db3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Help_View.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Help_View.H 7139 2010-02-23 15:55:22Z greg.ercolano $"
+// "$Id: Fl_Help_View.H 8306 2011-01-24 17:04:22Z matt $"
//
// Help Viewer widget definitions.
//
-// Copyright 1997-2009 by Easy Software Products.
+// 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
@@ -42,6 +42,7 @@
# include "Fl_Scrollbar.H"
# include "fl_draw.H"
# include "Fl_Shared_Image.H"
+# include "filename.H"
//
@@ -56,8 +57,7 @@ typedef const char *(Fl_Help_Func)(Fl_Widget *, const char *);
// Fl_Help_Block structure...
//
-struct Fl_Help_Block
-{
+struct Fl_Help_Block {
const char *start, // Start of text
*end; // End of text
uchar border; // Draw border?
@@ -73,8 +73,7 @@ struct Fl_Help_Block
// Fl_Help_Link structure...
//
/** Definition of a link for the html viewer. */
-struct Fl_Help_Link
-{
+struct Fl_Help_Link {
char filename[192], ///< Reference filename
name[32]; ///< Link target (blank if none)
int x, ///< X offset of link text
@@ -88,7 +87,7 @@ struct Fl_Help_Link
*/
/** Fl_Help_View font stack element definition. */
-struct Fl_Help_Font_Style {
+struct FL_EXPORT Fl_Help_Font_Style {
Fl_Font f; ///< Font
Fl_Fontsize s; ///< Font Size
Fl_Color c; ///< Font Color
@@ -101,7 +100,7 @@ struct Fl_Help_Font_Style {
/** Fl_Help_View font stack definition. */
const size_t MAX_FL_HELP_FS_ELTS = 100;
-struct Fl_Help_Font_Stack {
+struct FL_EXPORT Fl_Help_Font_Stack {
/** font stack construction, initialize attributes. */
Fl_Help_Font_Stack() {
nfonts_ = 0;
@@ -137,8 +136,7 @@ protected:
/** Fl_Help_Target structure */
-struct Fl_Help_Target
-{
+struct Fl_Help_Target {
char name[32]; ///< Target name
int y; ///< Y offset of target
};
@@ -208,8 +206,8 @@ struct Fl_Help_Target
- yen Yuml yuml
*/
-class FL_EXPORT Fl_Help_View : public Fl_Group // Help viewer widget
-{
+class FL_EXPORT Fl_Help_View : public Fl_Group { // Help viewer widget
+
enum { RIGHT = -1, CENTER, LEFT }; ///< Alignments
char title_[1024]; ///< Title string
@@ -220,7 +218,7 @@ class FL_EXPORT Fl_Help_View : public Fl_Group // Help viewer widget
Fl_Font textfont_; ///< Default font for text
Fl_Fontsize textsize_; ///< Default font size
const char *value_; ///< HTML text value
- Fl_Help_Font_Stack fstack_; ///< font stack management
+ Fl_Help_Font_Stack fstack_; ///< font stack management
int nblocks_, ///< Number of blocks/paragraphs
ablocks_; ///< Allocated blocks
Fl_Help_Block *blocks_; ///< Blocks
@@ -235,8 +233,8 @@ class FL_EXPORT Fl_Help_View : public Fl_Group // Help viewer widget
atargets_; ///< Allocated targets
Fl_Help_Target *targets_; ///< Targets
- char directory_[1024]; ///< Directory for current file
- char filename_[1024]; ///< Current filename
+ char directory_[FL_PATH_MAX];///< Directory for current file
+ char filename_[FL_PATH_MAX]; ///< Current filename
int topline_, ///< Top line in document
leftline_, ///< Lefthand position
size_, ///< Total document length
@@ -394,5 +392,5 @@ public:
#endif // !Fl_Help_View_H
//
-// End of "$Id: Fl_Help_View.H 7139 2010-02-23 15:55:22Z greg.ercolano $".
+// End of "$Id: Fl_Help_View.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
index f4cb3979d..37d05b5ae 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hold_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
//
// Hold browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -42,7 +42,7 @@
user releases the mouse, but you can change this with when().
See Fl_Browser for methods to add and remove lines from the browser.
*/
-class Fl_Hold_Browser : public Fl_Browser {
+class FL_EXPORT Fl_Hold_Browser : public Fl_Browser {
public:
/**
Creates a new Fl_Hold_Browser widget using the given
@@ -50,12 +50,16 @@ public:
The constructor specializes Fl_Browser() by setting the type to FL_HOLD_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
- Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0)
- : Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);}
+#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
+ Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
+ Fl_Hold_Browser(int X,int Y,int W,int H,const char *L=0)
+ : Fl_Browser(X,Y,W,H,L) {type(FL_HOLD_BROWSER);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Hold_Browser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Hold_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
index e7ebc6d4b..3c5a06312 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Fill_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Horizontal fill slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Slider.H"
-class Fl_Hor_Fill_Slider : public Fl_Slider {
+class FL_EXPORT Fl_Hor_Fill_Slider : public Fl_Slider {
public:
Fl_Hor_Fill_Slider(int x,int y,int w,int h,const char *l=0)
: Fl_Slider(x,y,w,h,l) {type(FL_HOR_FILL_SLIDER);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Fill_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Hor_Fill_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
index 6e6fce9db..1305a54e8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Nice_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Horizontal "nice" slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Slider.H"
-class Fl_Hor_Nice_Slider : public Fl_Slider {
+class FL_EXPORT Fl_Hor_Nice_Slider : public Fl_Slider {
public:
Fl_Hor_Nice_Slider(int x,int y,int w,int h,const char *l=0)
: Fl_Slider(x,y,w,h,l) {type(FL_HOR_NICE_SLIDER); box(FL_FLAT_BOX);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Hor_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
index 9bbee8f2c..82a88cbc8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Horizontal slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,14 +33,28 @@
#include "Fl_Slider.H"
-class Fl_Hor_Slider : public Fl_Slider {
+/** Horizontal Slider class.
+
+ \see class Fl_Slider.
+*/
+class FL_EXPORT Fl_Hor_Slider : public Fl_Slider {
public:
- Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0)
- : Fl_Slider(X,Y,W,H,l) {type(FL_HOR_SLIDER);}
+
+ /**
+ Creates a new Fl_Hor_Slider widget using the given position,
+ size, and label string.
+ */
+
+#if defined(FL_DLL) // implementation in src/Fl_Slider.cxx
+ Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0);
+#else
+ Fl_Hor_Slider(int X,int Y,int W,int H,const char *l=0)
+ : Fl_Slider(X,Y,W,H,l) { type(FL_HOR_SLIDER); }
+#endif
};
#endif
//
-// End of "$Id: Fl_Hor_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Hor_Slider.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
index a02a50c31..299944848 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Hor_Value_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Horizontal value slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Value_Slider.H"
-class Fl_Hor_Value_Slider : public Fl_Value_Slider {
+class FL_EXPORT Fl_Hor_Value_Slider : public Fl_Value_Slider {
public:
Fl_Hor_Value_Slider(int X,int Y,int W,int H,const char *l=0)
: Fl_Value_Slider(X,Y,W,H,l) {type(FL_HOR_SLIDER);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Hor_Value_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Hor_Value_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
index 278d70d7d..eb1e7e3fc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Image.H 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $"
//
// Image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -59,33 +59,24 @@ class FL_EXPORT Fl_Image {
protected:
/**
- The first form of the w() method returns the current
- image width in pixels.
-
- The second form is a protected method that sets the current
- image width.
+ Sets the current image width in pixels.
*/
void w(int W) {w_ = W;}
/**
- The first form of the h() method returns the current
- image height in pixels.
-
- The second form is a protected method that sets the current
- image height.
+ Sets the current image height in pixels.
*/
void h(int H) {h_ = H;}
/**
- The first form of the d() method returns the current
- image depth. The return value will be 0 for bitmaps, 1 for
- pixmaps, and 1 to 4 for color images.
-
- The second form is a protected method that sets the current
- image depth.
+ Sets the current image depth.
*/
void d(int D) {d_ = D;}
- /** See int ld() */
+ /**
+ Sets the current line data size in bytes.
+ */
void ld(int LD) {ld_ = LD;}
- /** See const char * const *data() */
+ /**
+ Sets the current array pointer and count of pointers in the array.
+ */
void data(const char * const *p, int c) {data_ = p; count_ = c;}
void draw_empty(int X, int Y);
@@ -94,26 +85,23 @@ class FL_EXPORT Fl_Image {
public:
- /** See void Fl_Image::w(int) */
+ /**
+ Returns the current image width in pixels.
+ */
int w() const {return w_;}
- /** See void Fl_Image::h(int) */
+ /** Returns the current image height in pixels.
+ */
int h() const {return h_;}
/**
- The first form of the d() method returns the current
- image depth. The return value will be 0 for bitmaps, 1 for
+ Returns the current image depth.
+ The return value will be 0 for bitmaps, 1 for
pixmaps, and 1 to 4 for color images.
-
- The second form is a protected method that sets the current
- image depth.
*/
int d() const {return d_;}
/**
- The first form of the ld() method returns the current
- line data size in bytes. Line data is extra data that is included
- after each line of color image data and is normally not present.
-
- The second form is a protected method that sets the current
- line data size in bytes.
+ Returns the current line data size in bytes.
+ Line data is extra data that is included
+ after each line of color image data and is normally not present.
*/
int ld() const {return ld_;}
/**
@@ -124,12 +112,8 @@ class FL_EXPORT Fl_Image {
*/
int count() const {return count_;}
/**
- The first form of the data() method returns a
- pointer to the current image data array. Use the
- count() method to find the size of the data array.
-
- The second form is a protected method that sets the current
- array pointer and count of pointers in the array.
+ Returns a pointer to the current image data array.
+ Use the count() method to find the size of the data array.
*/
const char * const *data() const {return data_;}
@@ -162,15 +146,16 @@ class FL_EXPORT Fl_Image {
virtual void label(Fl_Widget*w);
virtual void label(Fl_Menu_Item*m);
/**
- The draw() methods draw the image. This form specifies
+ Draws the image with a bounding box.
+ This form specifies
a bounding box for the image, with the origin
(upper-lefthand corner) of the image offset by the cx
and cy arguments.
*/
virtual void draw(int X, int Y, int W, int H, int cx=0, int cy=0); // platform dependent
/**
- The draw() methods draw the image. This form
- specifies the upper-lefthand corner of the image
+ Draws the image.
+ This form specifies the upper-lefthand corner of the image.
*/
void draw(int X, int Y) {draw(X, Y, w(), h(), 0, 0);} // platform dependent
virtual void uncache();
@@ -226,5 +211,5 @@ public:
#endif // !Fl_Image_H
//
-// End of "$Id: Fl_Image.H 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: Fl_Image.H 8338 2011-01-30 09:24:40Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
index 01ae60d48..3f6c49e9d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $"
+// "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $"
//
// Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,217 +37,232 @@
This is the FLTK text input widget. It displays a single line
of text and lets the user edit it. Normally it is drawn with an
inset box and a white background. The text may contain any
- characters (even 0), and will correctly display anything, using
- ^X notation for unprintable control characters and \\nnn notation
- for unprintable characters with the high bit set. It assumes the
- font can draw any characters in the ISO-8859-1 character set.
-
-
-
- | Mouse button 1 | Moves the cursor to
- this point. Drag selects characters. Double click selects words.
- Triple click selects all text. Shift+click extends the selection.
- When you select text it is automatically copied to the clipboard.
- |
-
- | Mouse button 2 | Insert the clipboard at
- the point clicked. You can also select a region and replace it with the
- clipboard by selecting the region with mouse button 2.
- |
-
- | Mouse button 3 | Currently acts like button 1. |
-
- | Backspace | Deletes one character to the left, or
- deletes the selected region. |
- | Enter | May cause the callback, see when(). |
- | ^A or Home | Go to start of line. |
- | ^B or Left | Move left |
- | ^C | Copy the selection to the clipboard |
- | ^D or Delete | Deletes one character to the right
- or deletes the selected region. |
- | ^E or End | Go to the end of line. |
- | ^F or Right | Move right |
- | ^K | Delete to the end of line (next \\n character)
- or deletes a single \\n character. These deletions are all concatenated
- into the clipboard. |
- | ^N or Down | Move down (for Fl_Multiline_Input
- only, otherwise it moves to the next input field). |
- | ^P or Up | Move up (for Fl_Multiline_Input only,
- otherwise it moves to the previous input field). |
- | ^U | Delete everything. |
- | ^V or ^Y | Paste the clipboard |
- | ^X or ^W | Copy the region to the clipboard and
- delete it. |
- | ^Z or ^_ | Undo. This is a single-level undo
- mechanism, but all adjacent deletions and insertions are concatenated
- into a single "undo". Often this will undo a lot more than you
- expected. |
- | Shift+move | Move the cursor but also extend the
- selection. |
-
- RightCtrl or
- Compose |
- \anchor Fl_Input_Compose_Character
- Start a compose-character
- sequence. The next one or two keys typed define the character to
- insert (see table that follows.)
-
- For instance, to type "á" type [compose][a]['] or [compose]['][a].
-
- The character "nbsp" (non-breaking space) is typed by using
- [compose][space].
-
- The single-character sequences may be followed by a space if
- necessary to remove ambiguity. For instance, if you really want to
- type "ª~" rather than "ã" you must type [compose][a][space][~].
-
- The same key may be used to "quote" control characters into the
- text. If you need a ^Q character you can get one by typing
- [compose][Control+Q].
-
- X may have a key on the keyboard
- defined as XK_Multi_key. If so this key may be used as well
- as the right-hand control key. You can set this up with the program
- xmodmap.
-
- If your keyboard is set to support a foreign language you should
- also be able to type "dead key" prefix characters. On X you will
- actually be able to see what dead key you typed, and if you then move
- the cursor without completing the sequence the accent will remain
- inserted. |
-
-
-
-
- Character Composition Table
-
- | Keys | Char |
- Keys | Char |
- Keys | Char |
- Keys | Char |
- Keys | Char |
- Keys | Char |
-
-
- | sp | nbsp |
- * | ° |
- ` A | À |
- D - | Ð |
- ` a | à |
- d - | ð |
-
- | ! | ¡ |
- + - | ± |
- ' A | Á |
- ~ N | Ñ |
- ' a | á |
- ~ n | ñ |
-
- | % | ¢ |
- 2 | ² |
- A ^ | Â |
- ` O | Ò |
- ^ a | â |
- ` o | ò |
-
- | # | £ |
- 3 | ³ |
- ~ A | Ã |
- ' O | Ó |
- ~ a | ã |
- ' o | ó |
-
- | $ | ¤ |
- ' | ´ |
- : A | Ä |
- ^ O | Ô |
- : a | ä |
- ^ o | ô |
-
- | y = | ¥ |
- u | µ |
- * A | Å |
- ~ O | Õ |
- * a | å |
- ~ o | õ |
-
- | | | ¦ |
- p | ¶ |
- A E | Æ |
- : O | Ö |
- a e | æ |
- : o | ö |
-
- | & | § |
- . | · |
- , C | Ç |
- x | × |
- , c | ç |
- - : | ÷ |
-
- | : | ¨ |
- , | ¸ |
- E ` | È |
- O / | Ø |
- ` e | è |
- o / | ø |
-
- | c | © |
- 1 | ¹ |
- ' E | É |
- ` U | Ù |
- ' e | é |
- ` u | ù |
-
- | a | ª |
- o | º |
- ^ E | Ê |
- ' U | Ú |
- ^ e | ê |
- ' u | ú |
-
- | < < | « |
- > > | » |
- : E | Ë |
- ^ U | Û |
- : e | ë |
- ^ u | û |
-
- | ~ | ¬ |
- 1 4 | ¼ |
- ` I | Ì |
- : U | Ü |
- ` i | ì |
- : u | ü |
-
- | - | |
- 1 2 | ½ |
- ' I | Í |
- ' Y | Ý |
- ' i | í |
- ' y | ý |
-
- | r | ® |
- 3 4 | ¾ |
- ^ I | Î |
- T H | Þ |
- ^ i | î |
- t h | þ |
-
- | _ | ¯ |
- ? | ¿ |
- : I | Ï |
- s s | ß |
- : i | ï |
- : y | ÿ |
-
-
-*/
+ characters, and will correctly display any UTF text, using
+ ^X notation for unprintable control characters. It assumes the
+ font can draw any characters of the used scripts, which is true
+ for standard fonts under MSWindows and Mac OS X.
+ Characters can be input using the keyboard or the character palette/map.
+ Character composition is done using dead keys and/or a compose
+ key as defined by the operating system.
+
+
+ Fl_Input keyboard and mouse bindings.
+ |
+ Mouse button 1
+ |
+ Moves the cursor to this point.
+ Drag selects characters.
+ Double click selects words.
+ Triple click selects all line.
+ Shift+click extends the selection.
+ When you select text it is automatically copied to the selection buffer.
+ |
|
+ Mouse button 2
+ |
+ Insert the selection buffer at the point clicked.
+ You can also select a region and replace it with the selection buffer
+ by selecting the region with mouse button 2.
+ |
|
+ Mouse button 3
+ |
+ Currently acts like button 1.
+ |
|
+ Backspace
+ |
+ Deletes one character to the left, or deletes the selected region.
+ |
|
+ Delete
+ |
+ Deletes one character to the right, or deletes the selected region.
+ Combine with Shift for equivalent of ^X (copy+cut).
+ |
|
+ Enter
+ |
+ May cause the callback, see when().
+ |
+
+
+
+
+ Fl_Input platform specific keyboard bindings.
+
+ | Windows/Linux |
+ Mac |
+ Function |
+
+
+ | ^A |
+ Command-A |
+
+ Selects all text in the widget.
+
+ |
+ | ^C |
+ Command-C |
+
+ Copy the current selection to the clipboard.
+
+ |
+ | ^I |
+ ^I |
+
+ Insert a tab.
+
+ |
+ | ^J |
+ ^J |
+
+ Insert a Line Feed.
+ (Similar to literal 'Enter' character)
+
+ |
+ | ^L |
+ ^L |
+
+ Insert a Form Feed.
+
+ |
+ | ^M |
+ ^M |
+
+ Insert a Carriage Return.
+
+ |
+ ^V, Shift-Insert |
+ Command-V |
+
+ Paste the clipboard.
+ (Macs keyboards don't have "Insert" keys,
+ but if they did, Shift-Insert would work)
+
+ |
+ ^X, Shift-Delete |
+ Command-X, Shift-Delete |
+
+ Cut.
+ Copy the selection to the clipboard and delete it.
+ (If there's no selection, Shift-Delete acts like Delete)
+
+ |
+ | ^Z |
+ Command-Z |
+
+ Undo.
+ This is a single-level undo mechanism, but all adjacent
+ deletions and insertions are concatenated into a single "undo".
+ Often this will undo a lot more than you expected.
+
+ |
+ | Shift-^Z |
+ Shift-Command-Z |
+
+ Redo.
+ Currently same behavior as ^Z.
+ Reserved for future multilevel undo/redo.
+
+ |
+ | Arrow Keys |
+ Arrow Keys |
+
+ Standard cursor movement.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Home |
+ Command-Up, Command-Left |
+
+ Move to start of line.
+ Can be combined with Shift to extend selection.
+
+ |
+ | End |
+ Command-Down, Command-Right |
+
+ Move to end of line.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Ctrl-Home |
+ Command-Up, Command-PgUp, Ctrl-Left |
+
+ Move to top of document/field.
+ In single line input, moves to start of line.
+ In multiline input, moves to start of top line.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Ctrl-End |
+ Command-End, Command-PgDn, Ctrl-Right |
+
+ Move to bottom of document/field.
+ In single line input, moves to end of line.
+ In multiline input, moves to end of last line.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Ctrl-Left |
+ Alt-Left |
+
+ Word left.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Ctrl-Right |
+ Alt-Right |
+
+ Word right.
+ Can be combined with Shift to extend selection.
+
+ |
+ | Ctrl-Backspace |
+ Alt-Backspace |
+
+ Delete word left.
+
+ |
+ | Ctrl-Delete |
+ Alt-Delete |
+
+ Delete word right.
+
+ |
+ */
class FL_EXPORT Fl_Input : public Fl_Input_ {
int handle_key();
int shift_position(int p);
int shift_up_down_position(int p);
void handle_mouse(int keepmark=0);
+
+ // Private keyboard functions
+ int kf_lines_up(int repeat_num);
+ int kf_lines_down(int repeat_num);
+ int kf_page_up();
+ int kf_page_down();
+ int kf_insert_toggle();
+ int kf_delete_word_right();
+ int kf_delete_word_left();
+ int kf_delete_sol();
+ int kf_delete_eol();
+ int kf_delete_char_right();
+ int kf_delete_char_left();
+ int kf_move_sol();
+ int kf_move_eol();
+ int kf_clear_eol();
+ int kf_move_char_left();
+ int kf_move_char_right();
+ int kf_move_word_left();
+ int kf_move_word_right();
+ int kf_move_up_and_sol();
+ int kf_move_down_and_eol();
+ int kf_top();
+ int kf_bottom();
+ int kf_select_all();
+ int kf_undo();
+ int kf_redo();
+ int kf_copy();
+ int kf_paste();
+ int kf_copy_cut();
+
protected:
void draw();
public:
@@ -258,5 +273,5 @@ public:
#endif
//
-// End of "$Id: Fl_Input.H 6699 2009-03-18 22:58:12Z engelsman $".
+// End of "$Id: Fl_Input.H 8111 2010-12-23 08:13:18Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
index dc14ab17f..1638436a4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input_.H 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $"
//
// Input base class header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -58,10 +58,10 @@
one of those people who likes to change how the editing keys
work. It may also be useful for adding scrollbars
to the input field.
-
+
This can act like any of the subclasses of Fl_Input, by
setting type() to one of the following values:
-
+
\code
#define FL_NORMAL_INPUT 0
#define FL_FLOAT_INPUT 1
@@ -78,26 +78,26 @@
\endcode
All variables that represent an index into a text buffer are byte-oriented,
- not character oriented. Since utf8 characters can be up to six bytes long,
+ not character oriented. Since UTF-8 characters can be up to six bytes long,
simply incrementing such an index will not reliably advance to the next character
- in the text buffer.
+ in the text buffer.
- Indices and pointers into the text buffer should always point at a 7 bit ASCII
- character or the beginning of a utf8 character sequence. Behavior for false
- utf8 sequences and pointers into the middle of a seqeunce are undefined.
+ Indices and pointers into the text buffer should always point at a 7 bit ASCII
+ character or the beginning of a UTF-8 character sequence. Behavior for false
+ UTF-8 sequences and pointers into the middle of a sequence are undefined.
\see Fl_Text_Display, Fl_Text_Editor for more powerful text handling widgets
\internal
- When porting this widget from ASCII to UTF8, previously legal pointers into
+ When porting this widget from ASCII to UTF-8, previously legal pointers into
the text of this widget can become illegal by pointing into the middle of
- a UTF8 seuence. This is not a big problem for Fl_Input_ because all code
+ a UTF-8 sequence. This is not a big problem for Fl_Input_ because all code
in this module is quite tolerant. It could be problematic though when deriving
- from this class because no feedback for illegal pointers is given. Additionaly,
- a careless "copy" call can put partial UTF8 sequnces into the clipboard.
+ from this class because no feedback for illegal pointers is given. Additionally,
+ a careless "copy" call can put partial UTF-8 sequences into the clipboard.
- None of these issues should be desasterous. Nevertheless, we should
- discuss how FLTK should handle false UTF8 suequences and pointers.
+ None of these issues should be disastrous. Nevertheless, we should
+ discuss how FLTK should handle false UTF-8 sequences and pointers.
*/
class FL_EXPORT Fl_Input_ : public Fl_Widget {
@@ -113,17 +113,22 @@ class FL_EXPORT Fl_Input_ : public Fl_Widget {
/** \internal \todo Please document me! */
int bufsize;
- /** \internal Positin of the cursor in the document */
+ /** \internal Position of the cursor in the document. */
int position_;
/** \internal Position of the other end of the selected text. If \p position_ equals
\p mark_, no text is selected */
int mark_;
+ /** \internal Behavior of Tab key in multiline input widget.
+ If enabled (default) Tab causes focus nav, otherwise Tab is inserted
+ as a character. */
+ int tab_nav_;
+
/** \internal Offset to text origin within widget bounds */
int xscroll_, yscroll_;
- /** \internal Minimal update pointer. Display requirs redraw from here to the end
+ /** \internal Minimal update pointer. Display requires redraw from here to the end
of the buffer. */
int mu_p;
@@ -148,7 +153,7 @@ class FL_EXPORT Fl_Input_ : public Fl_Widget {
/** \internal color of the text cursor */
Fl_Color cursor_color_;
- /** \internal Horizontal cursor position in pixels while movin up or down. */
+ /** \internal Horizontal cursor position in pixels while moving up or down. */
static double up_down_pos;
/** \internal Flag to remember last cursor move. */
@@ -192,7 +197,7 @@ protected:
/* Move the cursor to the column given by up_down_pos. */
int up_down_position(int, int keepmark=0);
- /* Handle mouse clicks and mose moves. */
+ /* Handle mouse clicks and mouse moves. */
void handle_mouse(int, int, int, int, int keepmark=0);
/* Handle all kinds of text field related events. */
@@ -294,7 +299,7 @@ public:
int position(int p) {return position(p, p);}
/** Sets the current selection mark.
- mark(n) is the same as position(position(),n).
+ mark(n) is the same as position(position(),n).
\param m new index of the mark
\return 0 if the mark did not change
\see position(), position(int, int) */
@@ -364,13 +369,13 @@ public:
/* Copy the yank buffer to the clipboard. */
int copy_cuts();
- /** Return the shortcut key associtaed with this widget.
+ /** Return the shortcut key associated with this widget.
\return shortcut keystroke
\see Fl_Button::shortcut() */
int shortcut() const {return shortcut_;}
/**
- Sets the shortcut key associtaed with this widget.
+ Sets the shortcut key associated with this widget.
Pressing the shortcut key gives text editing focus to this widget.
\param [in] s new shortcut keystroke
\see Fl_Button::shortcut()
@@ -446,10 +451,47 @@ public:
void wrap(int b) { if (b) type((uchar)(type() | FL_INPUT_WRAP));
else type((uchar)(type() & ~FL_INPUT_WRAP)); }
+ /**
+ Sets whether the Tab key does focus navigation,
+ or inserts tab characters into Fl_Multiline_Input.
+
+ By default this flag is enabled to provide the 'normal' behavior
+ most users expect; Tab navigates focus to the next widget.
+ To inserting an actual Tab character, users can use Ctrl-I
+ or copy/paste.
+
+ Disabling this flag gives the old FLTK behavior where Tab
+ inserts a tab character into the text field, in which case
+ only the mouse can be used to navigate to the next field.
+
+ History: This flag was provided for backwards support of FLTK's old 1.1.x
+ behavior where Tab inserts a tab character instead of navigating
+ focus to the next widget. This behavior was unique to Fl_Multiline_Input.
+ With the advent of Fl_Text_Editor, this old behavior has been deprecated.
+
+ \param [in] val If \p val is 1, Tab advances focus (default).
+ If \p val is 0, Tab inserts a tab character (old FLTK behavior).
+ */
+ void tab_nav(int val) {
+ tab_nav_ = val;
+ }
+
+ /**
+ Gets whether the Tab key causes focus navigation in multiline input fields or not.
+
+ If enabled (default), hitting Tab causes focus navigation to the next widget.
+
+ If disabled, hitting Tab inserts a tab character into the text field.
+ \returns 1 if Tab advances focus (default), 0 if Tab inserts tab characters.
+ \see tab_nav(int)
+ */
+ int tab_nav() const {
+ return tab_nav_;
+ }
};
#endif
//
-// End of "$Id: Fl_Input_.H 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Input_.H 8068 2010-12-20 07:48:59Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H b/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
index b0fbe1f27..843e74954 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Input_Choice.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Input_Choice.H 7115 2010-02-20 17:40:07Z AlbrechtS $"
+// "$Id: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// An input/chooser widget.
// ______________ ____
@@ -7,7 +7,7 @@
// | input area || \/ |
// |______________||____|
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 by Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -56,7 +56,7 @@
widgets directly, using the menubutton()
and input() accessor methods.
*/
-class Fl_Input_Choice : public Fl_Group {
+class FL_EXPORT Fl_Input_Choice : public Fl_Group {
// Private class to handle slightly 'special' behavior of menu button
class InputMenuButton : public Fl_Menu_Button {
void draw() {
@@ -218,5 +218,5 @@ public:
#endif // !Fl_Input_Choice_H
//
-// End of "$Id: Fl_Input_Choice.H 7115 2010-02-20 17:40:07Z AlbrechtS $".
+// End of "$Id: Fl_Input_Choice.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
index 85db694b6..9bc947782 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Int_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Integer input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,22 +34,28 @@
#include "Fl_Input.H"
/**
- The Fl_Int_Input class is a subclass of Fl_Input
- that only allows the user to type decimal digits (or hex numbers of the form 0xaef).
+ The Fl_Int_Input class is a subclass of Fl_Input that only allows
+ the user to type decimal digits (or hex numbers of the form 0xaef).
*/
-class Fl_Int_Input : public Fl_Input {
+class FL_EXPORT Fl_Int_Input : public Fl_Input {
public:
/**
Creates a new Fl_Int_Input widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
- Inherited destructor Destroys the widget and any value associated with it.
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0);
+#else
Fl_Int_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_INT_INPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Int_Input.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Int_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
index 23085a3da..a5786c27b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $"
//
// Lighted button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,15 +34,15 @@
#include "Fl_Button.H"
/**
-
This subclass displays the "on" state by turning on a light,
+ This subclass displays the "on" state by turning on a light,
rather than drawing pushed in. The shape of the "light"
is initially set to FL_DOWN_BOX. The color of the light when
on is controlled with selection_color(), which defaults to FL_YELLOW.
Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type() and when().
-
\image html Fl_Light_Button.gif
- \image latex Fl_Light_Button.eps "Fl_Light_Button" width=4cm
+ \image html Fl_Light_Button.png
+ \image latex Fl_Light_Button.png "Fl_Light_Button" width=4cm
*/
class FL_EXPORT Fl_Light_Button : public Fl_Button {
protected:
@@ -55,5 +55,5 @@ public:
#endif
//
-// End of "$Id: Fl_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Light_Button.H 8178 2011-01-04 14:09:37Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H b/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
index 64763c0b8..ade856c17 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Line_Dial.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Line dial header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Dial.H"
-class Fl_Line_Dial : public Fl_Dial {
+class FL_EXPORT Fl_Line_Dial : public Fl_Dial {
public:
Fl_Line_Dial(int x,int y,int w,int h, const char *l = 0)
: Fl_Dial(x,y,w,h,l) {type(FL_LINE_DIAL);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Line_Dial.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Line_Dial.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
index 8cc42e32f..a35dd4a89 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $"
//
// Old menu header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -29,5 +29,5 @@
#include "Fl_Menu_Item.H"
//
-// End of "$Id: Fl_Menu.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Menu.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
index 9f4319ef2..278ad8ca9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_.H 7517 2010-04-16 17:55:45Z greg.ercolano $"
+// "$Id: Fl_Menu_.H 7903 2010-11-28 21:06:39Z matt $"
//
// Menu base class header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -70,6 +70,17 @@ public:
int find_index(const Fl_Menu_Item *item) const;
int find_index(Fl_Callback *cb) const;
+ /**
+ Returns the menu item with the entered shortcut (key value).
+
+ This searches the complete menu() for a shortcut that matches the
+ entered key value. It must be called for a FL_KEYBOARD or FL_SHORTCUT
+ event.
+
+ If a match is found, the menu's callback will be called.
+
+ \return matched Fl_Menu_Item or NULL.
+ */
const Fl_Menu_Item* test_shortcut() {return picked(menu()->test_shortcut());}
void global();
@@ -116,9 +127,9 @@ public:
the new value is different than the old one.
*/
int value(int i) {return value(menu_+i);}
- /** Returns the title of the last item chosen, or of item i. */
+ /** Returns the title of the last item chosen. */
const char *text() const {return value_ ? value_->text : 0;}
- /** Returns the title of the last item chosen, or of item i. */
+ /** Returns the title of item i. */
const char *text(int i) const {return menu_[i].text;}
/** Gets the current font of menu item labels. */
@@ -153,5 +164,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_.H 7517 2010-04-16 17:55:45Z greg.ercolano $".
+// End of "$Id: Fl_Menu_.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
index e48adbcdc..5e522f6ad 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Bar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Menu bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -44,8 +44,8 @@
top level menu defines the items in the menubar, while the submenus
define the pull-down menus. Sub-sub menus and lower pop up to the right
of the submenus.
- \image html menubar.gif
- \image latex menubar.eps " menubar" width=12cm
+ \image html menubar.png
+ \image latex menubar.png " menubar" width=12cm
If there is an item in the top menu that is not a title of a
submenu, then it acts like a "button" in the menubar. Clicking on it
will pick it.
@@ -85,5 +85,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Bar.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Menu_Bar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
index 430b66087..a5ff5d89b 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $"
//
// Menu button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,12 +37,14 @@
This is a button that when pushed pops up a menu (or hierarchy of
menus) defined by an array of
Fl_Menu_Item objects.
- \image html menu_button.gif
- \image latex menu_button.eps " menu_button" width=5cm
+ \image html menu_button.png
+ \image latex menu_button.png " menu_button" width=5cm
Normally any mouse button will pop up a menu and it is lined up
below the button as shown in the picture. However an Fl_Menu_Button
- may also control a pop-up menu. This is done by setting the type()
- , see below.
+ may also control a pop-up menu. This is done by setting the type().
+ If type() is zero a normal menu button is produced.
+ If it is nonzero then this is a pop-up menu. The bits in type() indicate
+ what mouse buttons pop up the menu (see Fl_Menu_Button::popup_buttons).
The menu will also pop up in response to shortcuts indicated by
putting a '&' character in the label().
Typing the shortcut() of any of the menu items will cause
@@ -58,8 +60,20 @@ class FL_EXPORT Fl_Menu_Button : public Fl_Menu_ {
protected:
void draw();
public:
- // values for type:
- enum {POPUP1 = 1, POPUP2, POPUP12, POPUP3, POPUP13, POPUP23, POPUP123};
+ /**
+ \brief indicate what mouse buttons pop up the menu.
+
+ Values for type() used to indicate what mouse buttons pop up the menu.
+ Fl_Menu_Button::POPUP3 is usually what you want.
+ */
+ enum popup_buttons {POPUP1 = 1, /**< pops up with the mouse 1st button. */
+ POPUP2, /**< pops up with the mouse 2nd button. */
+ POPUP12, /**< pops up with the mouse 1st or 2nd buttons. */
+ POPUP3, /**< pops up with the mouse 3rd button. */
+ POPUP13, /**< pops up with the mouse 1st or 3rd buttons. */
+ POPUP23, /**< pops up with the mouse 2nd or 3rd buttons. */
+ POPUP123 /**< pops up with any mouse button. */
+ };
int handle(int);
const Fl_Menu_Item* popup();
Fl_Menu_Button(int,int,int,int,const char * =0);
@@ -68,5 +82,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Menu_Button.H 8016 2010-12-12 11:19:12Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
index 25b46732e..4d5869933 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Item.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Item.H 7517 2010-04-16 17:55:45Z greg.ercolano $"
+// "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $"
//
// Menu item header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -56,11 +56,11 @@ class Fl_Menu_;
is used by the Fl_Menu_ class.
\code
struct Fl_Menu_Item {
- const char* text; // label()
+ const char* text; // label()
ulong shortcut_;
- Fl_Callback* callback_;
+ Fl_Callback* callback_;
void* user_data_;
- int flags;
+ int flags;
uchar labeltype_;
uchar labelfont_;
uchar labelsize_;
@@ -102,8 +102,8 @@ class Fl_Menu_;
\endcode
produces:
- \image html menu.gif
- \image latex menu.eps "menu" width=10cm
+ \image html menu.png
+ \image latex menu.png "menu" width=10cm
A submenu title is identified by the bit FL_SUBMENU in the
flags field, and ends with a label() that is NULL.
@@ -119,12 +119,12 @@ struct FL_EXPORT Fl_Menu_Item {
const char *text; ///< menu item text, returned by label()
int shortcut_; ///< menu item shortcut
Fl_Callback *callback_; ///< menu item callback
- void *user_data_; ///< menu item user_data for 3rd party apps
+ void *user_data_; ///< menu item user_data for the menu's callback
int flags; ///< menu item flags like FL_MENU_TOGGLE, FL_MENU_RADIO
uchar labeltype_; ///< how the menu item text looks like
Fl_Font labelfont_; ///< which font for this menu item text
Fl_Fontsize labelsize_; ///< size of menu item text
- Fl_Color labelcolor_; ///< menu item text color
+ Fl_Color labelcolor_; ///< menu item text color
// advance N items, skipping submenus:
const Fl_Menu_Item *next(int=1) const;
@@ -148,7 +148,7 @@ struct FL_EXPORT Fl_Menu_Item {
Returns the title of the item.
A NULL here indicates the end of the menu (or of a submenu).
A '&' in the item will print an underscore under the next letter,
- and if the menu is popped up that letter will be a "shortcut" to pick
+ and if the menu is popped up that letter will be a "shortcut" to pick
that item. To get a real '&' put two in a row.
*/
const char* label() const {return text;}
@@ -160,6 +160,7 @@ struct FL_EXPORT Fl_Menu_Item {
void label(Fl_Labeltype a,const char* b) {labeltype_ = a; text = b;}
/**
+ Returns the menu item's labeltype.
A labeltype identifies a routine that draws the label of the
widget. This can be used for special effects such as emboss, or to use
the label() pointer as another form of data such as a bitmap.
@@ -168,6 +169,7 @@ struct FL_EXPORT Fl_Menu_Item {
Fl_Labeltype labeltype() const {return (Fl_Labeltype)labeltype_;}
/**
+ Sets the menu item's labeltype.
A labeltype identifies a routine that draws the label of the
widget. This can be used for special effects such as emboss, or to use
the label() pointer as another form of data such as a bitmap.
@@ -176,77 +178,100 @@ struct FL_EXPORT Fl_Menu_Item {
void labeltype(Fl_Labeltype a) {labeltype_ = a;}
/**
+ Gets the menu item's label color.
This color is passed to the labeltype routine, and is typically the
color of the label text. This defaults to FL_BLACK. If this
- color is not black fltk will not use overlay bitplanes to draw
+ color is not black fltk will \b not use overlay bitplanes to draw
the menu - this is so that images put in the menu draw correctly.
*/
Fl_Color labelcolor() const {return labelcolor_;}
- /** See Fl_Color Fl_Menu_Item::labelcolor() const */
+ /**
+ Sets the menu item's label color.
+ \see Fl_Color Fl_Menu_Item::labelcolor() const
+ */
void labelcolor(Fl_Color a) {labelcolor_ = a;}
/**
- Fonts are identified by small 8-bit indexes into a table. See the
+ Gets the menu item's label font.
+ Fonts are identified by small 8-bit indexes into a table. See the
enumeration list for predefined fonts. The default value is a
Helvetica font. The function Fl::set_font() can define new fonts.
*/
Fl_Font labelfont() const {return labelfont_;}
/**
- Fonts are identified by small 8-bit indexes into a table. See the
+ Sets the menu item's label font.
+ Fonts are identified by small 8-bit indexes into a table. See the
enumeration list for predefined fonts. The default value is a
Helvetica font. The function Fl::set_font() can define new fonts.
*/
void labelfont(Fl_Font a) {labelfont_ = a;}
- /** Gets the label font pixel size/height.*/
+ /** Gets the label font pixel size/height. */
Fl_Fontsize labelsize() const {return labelsize_;}
/** Sets the label font pixel size/height.*/
void labelsize(Fl_Fontsize a) {labelsize_ = a;}
/**
- Each item has space for a callback function and an argument for that
- function. Due to back compatibility, the Fl_Menu_Item itself
- is not passed to the callback, instead you have to get it by calling
- ((Fl_Menu_*)w)->mvalue() where w is the widget argument.
+ Returns the callback function that is set for the menu item.
+ Each item has space for a callback function and an argument for that
+ function. Due to back compatibility, the Fl_Menu_Item itself
+ is not passed to the callback, instead you have to get it by calling
+ ((Fl_Menu_*)w)->mvalue() where w is the widget argument.
*/
Fl_Callback_p callback() const {return callback_;}
- /** See Fl_Callback_p Fl_MenuItem::callback() const */
+ /**
+ Sets the menu item's callback function and userdata() argument.
+ \see Fl_Callback_p Fl_MenuItem::callback() const
+ */
void callback(Fl_Callback* c, void* p) {callback_=c; user_data_=p;}
- /** See Fl_Callback_p Fl_MenuItem::callback() const */
+ /**
+ Sets the menu item's callback function.
+ This method does not set the userdata() argument.
+ \see Fl_Callback_p Fl_MenuItem::callback() const
+ */
void callback(Fl_Callback* c) {callback_=c;}
- /** See Fl_Callback_p Fl_MenuItem::callback() const */
+ /**
+ Sets the menu item's callback function.
+ This method does not set the userdata() argument.
+ \see Fl_Callback_p Fl_MenuItem::callback() const
+ */
void callback(Fl_Callback0*c) {callback_=(Fl_Callback*)c;}
- /** See Fl_Callback_p Fl_MenuItem::callback() const */
+ /**
+ Sets the menu item's callback function and userdata() argument.
+ This method does not set the userdata() argument.
+ The argument \p is cast to void* and stored as the userdata()
+ for the menu item's callback function.
+ \see Fl_Callback_p Fl_MenuItem::callback() const
+ */
void callback(Fl_Callback1*c, long p=0) {callback_=(Fl_Callback*)c; user_data_=(void*)p;}
/**
- Get or set the user_data argument that is sent to the
- callback function.
+ Gets the user_data() argument that is sent to the callback function.
*/
void* user_data() const {return user_data_;}
/**
- Get or set the user_data argument that is sent to the
- callback function.
+ Sets the user_data() argument that is sent to the callback function.
*/
void user_data(void* v) {user_data_ = v;}
/**
+ Gets the user_data() argument that is sent to the callback function.
For convenience you can also define the callback as taking a long
- argument. This is implemented by casting this to a Fl_Callback
- and casting the long to a void* and may not be
- portable to some machines.
+ argument. This method casts the stored userdata() argument to long
+ and returns it as a \e long value.
*/
- intptr_t argument() const {return (intptr_t)user_data_;}
+ long argument() const {return (long)(fl_intptr_t)user_data_;}
/**
+ Sets the user_data() argument that is sent to the callback function.
For convenience you can also define the callback as taking a long
- argument. This is implemented by casting this to a Fl_Callback
- and casting the long to a void* and may not be
- portable to some machines.
+ argument. This method casts the given argument \p v to void*
+ and stores it in the menu item's userdata() member.
+ This may not be portable to some machines.
*/
void argument(long v) {user_data_ = (void*)v;}
@@ -278,15 +303,15 @@ struct FL_EXPORT Fl_Menu_Item {
*/
int submenu() const {return flags&(FL_SUBMENU|FL_SUBMENU_POINTER);}
/**
- Returns true if a checkbox will be drawn next to this item. This is
- true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags.
+ Returns true if a checkbox will be drawn next to this item.
+ This is true if FL_MENU_TOGGLE or FL_MENU_RADIO is set in the flags.
*/
int checkbox() const {return flags&FL_MENU_TOGGLE;}
/**
- Returns true if this item is a radio item. When a radio button is
- selected all "adjacent" radio buttons are turned off. A set of radio
- items is delimited by an item that has radio() false, or by an
- item with FL_MENU_DIVIDER turned on.
+ Returns true if this item is a radio item.
+ When a radio button is selected all "adjacent" radio buttons are
+ turned off. A set of radio items is delimited by an item that has
+ radio() false, or by an item with FL_MENU_DIVIDER turned on.
*/
int radio() const {return flags&FL_MENU_RADIO;}
/** Returns the current value of the check or radio item. */
@@ -349,29 +374,28 @@ struct FL_EXPORT Fl_Menu_Item {
const Fl_Menu_Item* title = 0,
int menubar=0) const;
const Fl_Menu_Item* test_shortcut() const;
- const Fl_Menu_Item* find_shortcut(int *ip=0) const;
+ const Fl_Menu_Item* find_shortcut(int *ip=0, const bool require_alt = false) const;
/**
- Calls the Fl_Menu_Item item's callback, and provides the
- Fl_Widget argument (and optionally overrides the user_data()
- argument). You must first check that callback() is non-zero
- before calling this.
+ Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
+ The callback is called with the stored user_data() as its second argument.
+ You must first check that callback() is non-zero before calling this.
*/
void do_callback(Fl_Widget* o) const {callback_(o, user_data_);}
/**
- Calls the Fl_Menu_Item item's callback, and provides the
- Fl_Widget argument (and optionally overrides the user_data()
- argument). You must first check that callback() is non-zero
- before calling this.
+ Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
+ This call overrides the callback's second argument with the given value \p arg.
+ You must first check that callback() is non-zero before calling this.
*/
void do_callback(Fl_Widget* o,void* arg) const {callback_(o, arg);}
/**
- Calls the Fl_Menu_Item item's callback, and provides the
- Fl_Widget argument (and optionally overrides the user_data()
- argument). You must first check that callback() is non-zero
- before calling this.
+ Calls the Fl_Menu_Item item's callback, and provides the Fl_Widget argument.
+ This call overrides the callback's second argument with the
+ given value \p arg. long \p arg is cast to void* when calling
+ the callback.
+ You must first check that callback() is non-zero before calling this.
*/
void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)arg);}
@@ -415,5 +439,5 @@ enum { // back-compatibility enum:
#endif
//
-// End of "$Id: Fl_Menu_Item.H 7517 2010-04-16 17:55:45Z greg.ercolano $".
+// End of "$Id: Fl_Menu_Item.H 7983 2010-12-09 00:04:06Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
index 217e224af..cca5a97d6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Menu_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Window.H 6909 2009-09-28 14:41:43Z matt $"
+// "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $"
//
// Menu window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -64,5 +64,5 @@ public:
#endif
//
-// End of "$Id: Fl_Menu_Window.H 6909 2009-09-28 14:41:43Z matt $".
+// End of "$Id: Fl_Menu_Window.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
index 18303b18c..6a8661112 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
//
// Multi browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,7 +43,7 @@
mouse, but you can change this with when().
See Fl_Browser for methods to add and remove lines from the browser.
*/
-class Fl_Multi_Browser : public Fl_Browser {
+class FL_EXPORT Fl_Multi_Browser : public Fl_Browser {
public:
/**
Creates a new Fl_Multi_Browser widget using the given
@@ -51,12 +51,16 @@ public:
The constructor specializes Fl_Browser() by setting the type to FL_MULTI_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
+#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
+ Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
Fl_Multi_Browser(int X,int Y,int W,int H,const char *L=0)
: Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Multi_Browser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Multi_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
index c53a3f8c4..0b160d13d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multi_Label.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $"
//
// Multi-label header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,5 +43,5 @@ struct FL_EXPORT Fl_Multi_Label {
#endif
//
-// End of "$Id: Fl_Multi_Label.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Multi_Label.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
index 5f46624be..a22bfaa3c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multiline_Input.H 6889 2009-09-19 22:09:00Z greg.ercolano $"
+// "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Multiline input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -38,29 +38,38 @@
This input field displays '\n' characters as new lines rather than ^J,
and accepts the Return, Tab, and up and down arrow keys. This is for
editing multiline text.
-
+
This is far from the nirvana of text editors, and is probably only
good for small bits of text, 10 lines at most. Note that this widget
does not support scrollbars or per-character color control.
-
+
If you are presenting large amounts of text and need scrollbars
or full color control of characters, you probably want Fl_Text_Editor
instead.
-
+
+ In FLTK 1.3.x, the default behavior of the 'Tab' key was changed
+ to support consistent focus navigation. To get the older FLTK 1.1.x
+ behavior, set Fl_Input_::tab_nav() to 0. Newer programs should consider using
+ Fl_Text_Editor.
*/
-class Fl_Multiline_Input : public Fl_Input {
+class FL_EXPORT Fl_Multiline_Input : public Fl_Input {
public:
/**
Creates a new Fl_Multiline_Input widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
-
Inherited destructor destroys the widget and any value associated with it.
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0);
+#else
Fl_Multiline_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_MULTILINE_INPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Multiline_Input.H 6889 2009-09-19 22:09:00Z greg.ercolano $".
+// End of "$Id: Fl_Multiline_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
index f0edf63d0..087d6ed6d 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Multiline_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multiline_Output.H 6889 2009-09-19 22:09:00Z greg.ercolano $"
+// "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Multi line output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,28 +37,34 @@
This widget is a subclass of Fl_Output that displays multiple
lines of text. It also displays tab characters as whitespace to the
next column.
-
+
Note that this widget does not support scrollbars, or per-character
color control.
-
+
If you are presenting large amounts of read-only text
and need scrollbars, or full color control of characters,
then use Fl_Text_Display. If you want to display HTML text,
use Fl_Help_View.
*/
-class Fl_Multiline_Output : public Fl_Output {
+class FL_EXPORT Fl_Multiline_Output : public Fl_Output {
public:
+
/**
- Creates a new Fl_Multiline_Output widget using the given
- position, size, and label string. The default boxtype is FL_DOWN_BOX
-
Inherited destructor destroys the widget and any value associated with it.
+ Creates a new Fl_Multiline_Output widget using the given position,
+ size, and label string. The default boxtype is FL_DOWN_BOX.
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0);
+#else
Fl_Multiline_Output(int X,int Y,int W,int H,const char *l = 0)
: Fl_Output(X,Y,W,H,l) {type(FL_MULTILINE_OUTPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Multiline_Output.H 6889 2009-09-19 22:09:00Z greg.ercolano $".
+// End of "$Id: Fl_Multiline_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.H
index dac6807a7..ad76c68d2 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Native_File_Chooser.H 7003 2010-01-14 20:47:59Z greg.ercolano $"
+// "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -26,26 +26,280 @@
// http://www.fltk.org/str.php
//
+/** \file
+ Fl_Native_File_Chooser widget. */
+
+/**
+ \class Fl_Native_File_Chooser
+
+ This class lets an FLTK application easily and consistently access
+ the operating system's native file chooser. Some operating systems
+ have very complex and specific file choosers that many users want
+ access to specifically, instead of FLTK's default file chooser(s).
+
+ In cases where there is no native file browser, FLTK's own file browser
+ is used instead.
+
+ To use this widget correctly, use the following include in your code:
+ \code
+ #include
+ \endcode
+ Do not include the other Fl_Native_File_Choser_XXX.H files in your code;
+ those are platform specific files that will be included automatically
+ depending on your build platform.
+
+ The following example shows how to pick a single file:
+ \code
+ // Create and post the local native file chooser
+ #include
+ [..]
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Pick a file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
+ fnfc.filter("Text\t*.txt\n"
+ "C Files\t*.{cxx,h,c}");
+ fnfc.directory("/var/tmp"); // default directory to use
+ // Show native chooser
+ switch ( fnfc.show() ) {
+ case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
+ case 1: printf("CANCEL\n"); break; // CANCEL
+ default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
+ }
+ \endcode
+
+ Platform Specific Caveats
+
+ - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
+ at the start of main(), to enable the nicer looking file browser widgets.
+ Use the static public attributes of class Fl_File_Chooser to localize
+ the browser.
+ - Some operating systems support certain OS specific options; see
+ Fl_Native_File_Chooser::options() for a list.
+
+ \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
+ \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
+
+*/
#ifndef FL_NATIVE_FILE_CHOOSER_H
#define FL_NATIVE_FILE_CHOOSER_H
+/* \file
+ Fl_Native_File_Chooser widget. */
+
// Use Windows' chooser
#ifdef WIN32
-#include
+// #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx'
+#include
+#include // malloc
+#include
+#include // OPENFILENAME, GetOpenFileName()
+#include // BROWSEINFO, SHBrowseForFolder()
#endif
// Use Apple's chooser
#ifdef __APPLE__
-#include
+#include
+#define MAXFILTERS 80
#endif
// All else falls back to FLTK's own chooser
#if ! defined(__APPLE__) && !defined(WIN32)
-#include
+#include
+#include // _POSIX_NAME_MAX
#endif
+
+/**
+ This class lets an FLTK application easily and consistently access
+ the operating system's native file chooser. Some operating systems
+ have very complex and specific file choosers that many users want
+ access to specifically, instead of FLTK's default file chooser(s).
+
+ In cases where there is no native file browser, FLTK's own file browser
+ is used instead.
+
+ To use this widget, use the following include in your code:
+ \code
+ #include
+ \endcode
+
+ The following example shows how to pick a single file:
+ \code
+ // Create and post the local native file chooser
+ #include
+ [..]
+ Fl_Native_File_Chooser fnfc;
+ fnfc.title("Pick a file");
+ fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
+ fnfc.filter("Text\t*.txt\n"
+ "C Files\t*.{cxx,h,c}");
+ fnfc.directory("/var/tmp"); // default directory to use
+ // Show native chooser
+ switch ( fnfc.show() ) {
+ case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
+ case 1: printf("CANCEL\n"); break; // CANCEL
+ default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
+ }
+ \endcode
+
+ Platform Specific Caveats
+
+ - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
+ at the start of main(), to enable the nicer looking file browser widgets.
+ Use the static public attributes of class Fl_File_Chooser to localize
+ the browser.
+ - Some operating systems support certain OS specific options; see
+ Fl_Native_File_Chooser::options() for a list.
+
+ \image html Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms."
+ \image latex Fl_Native_File_Chooser.png "The Fl_Native_File_Chooser on different platforms" width=14cm
+
+ */
+class FL_EXPORT Fl_Native_File_Chooser {
+public:
+ enum Type {
+ BROWSE_FILE = 0, ///< browse files (lets user choose one file)
+ BROWSE_DIRECTORY, ///< browse directories (lets user choose one directory)
+ BROWSE_MULTI_FILE, ///< browse files (lets user choose multiple files)
+ BROWSE_MULTI_DIRECTORY, ///< browse directories (lets user choose multiple directories)
+ BROWSE_SAVE_FILE, ///< browse to save a file
+ BROWSE_SAVE_DIRECTORY ///< browse to save a directory
+ };
+ enum Option {
+ NO_OPTIONS = 0x0000, ///< no options enabled
+ SAVEAS_CONFIRM = 0x0001, ///< Show native 'Save As' overwrite confirm dialog (if supported)
+ NEW_FOLDER = 0x0002, ///< Show 'New Folder' icon (if supported)
+ PREVIEW = 0x0004 ///< enable preview mode
+ };
+ /** Localizable message */
+ static const char *file_exists_message;
+
+public:
+ Fl_Native_File_Chooser(int val=BROWSE_FILE);
+ ~Fl_Native_File_Chooser();
+
+ // Public methods
+ void type(int);
+ int type() const;
+ void options(int);
+ int options() const;
+ int count() const;
+ const char *filename() const;
+ const char *filename(int i) const;
+ void directory(const char *val);
+ const char *directory() const;
+ void title(const char *);
+ const char* title() const;
+ const char *filter() const;
+ void filter(const char *);
+ int filters() const;
+ void filter_value(int i);
+ int filter_value() const;
+ void preset_file(const char*);
+ const char* preset_file() const;
+ const char *errmsg() const;
+ int show();
+
+#ifdef WIN32
+private:
+ int _btype; // kind-of browser to show()
+ int _options; // general options
+ OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
+ BROWSEINFO _binf; // SHBrowseForFolder() struct
+ char **_pathnames; // array of pathnames
+ int _tpathnames; // total pathnames
+ char *_directory; // default pathname to use
+ char *_title; // title for window
+ char *_filter; // user-side search filter
+ char *_parsedfilt; // filter parsed for Windows dialog
+ int _nfilters; // number of filters parse_filter counted
+ char *_preset_file; // the file to preselect
+ char *_errmsg; // error message
+
+ // Private methods
+ void errmsg(const char *msg);
+
+ void clear_pathnames();
+ void set_single_pathname(const char *s);
+ void add_pathname(const char *s);
+
+ void FreePIDL(ITEMIDLIST *pidl);
+ void ClearOFN();
+ void ClearBINF();
+ void Win2Unix(char *s);
+ void Unix2Win(char *s);
+ int showfile();
+ static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
+ int showdir();
+
+ void parse_filter(const char *);
+ void clear_filters();
+ void add_filter(const char *, const char *);
+#endif
+
+#ifdef __APPLE__
+private:
+ int _btype; // kind-of browser to show()
+ int _options; // general options
+ void *_panel;
+ char **_pathnames; // array of pathnames
+ int _tpathnames; // total pathnames
+ char *_directory; // default pathname to use
+ char *_title; // title for window
+ char *_preset_file; // the 'save as' filename
+
+ char *_filter; // user-side search filter, eg:
+ // C Files\t*.[ch]\nText Files\t*.txt"
+
+ char *_filt_names; // filter names (tab delimited)
+ // eg. "C Files\tText Files"
+
+ char *_filt_patt[MAXFILTERS];
+ // array of filter patterns, eg:
+ // _filt_patt[0]="*.{cxx,h}"
+ // _filt_patt[1]="*.txt"
+
+ int _filt_total; // parse_filter() # of filters loaded
+ int _filt_value; // index of the selected filter
+ char *_errmsg; // error message
+
+ // Private methods
+ void errmsg(const char *msg);
+ void clear_pathnames();
+ void set_single_pathname(const char *s);
+ int get_saveas_basename(void);
+ void clear_filters();
+ void add_filter(const char *, const char *);
+ void parse_filter(const char *from);
+ int post();
+#endif
+
+#if ! defined(__APPLE__) && !defined(WIN32)
+private:
+ int _btype; // kind-of browser to show()
+ int _options; // general options
+ int _nfilters;
+ char *_filter; // user supplied filter
+ char *_parsedfilt; // parsed filter
+ int _filtvalue; // selected filter
+ char *_preset_file;
+ char *_prevvalue; // Returned filename
+ char *_directory;
+ char *_errmsg; // error message
+ Fl_File_Chooser *_file_chooser;
+
+ // Private methods
+ void errmsg(const char *msg);
+ int type_fl_file(int);
+ void parse_filter();
+ void keeplocation();
+ int exist_dialog();
+#endif
+};
+
+
#endif /*FL_NATIVE_FILE_CHOOSER_H*/
//
-// End of "$Id: Fl_Native_File_Chooser.H 7003 2010-01-14 20:47:59Z greg.ercolano $".
+// End of "$Id: Fl_Native_File_Chooser.H 8380 2011-02-06 10:07:28Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_FLTK.H b/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_FLTK.H
deleted file mode 100644
index 8f1ae263e..000000000
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_FLTK.H
+++ /dev/null
@@ -1,142 +0,0 @@
-//
-// "$Id: Fl_Native_File_Chooser_FLTK.H 7007 2010-01-14 23:08:06Z greg.ercolano $"
-//
-// FLTK native OS file chooser widget
-//
-// Copyright 1998-2009 by Bill Spitzak and others.
-// Copyright 2005 by Nathan Vander Wilt.
-//
-// 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_Native_File_Chooser widget. */
-
-#include
-#include // _POSIX_NAME_MAX
-
-/**
- This class lets an FLTK application easily and consistently access
- the operating system's native file chooser. Some operating systems
- have very complex and specific file choosers that many users want
- access to specifically, instead of FLTK's default file chooser(s).
-
- In cases where there is no native file browser, FLTK's own file browser
- is used instead.
-
- \code
- // Create and post the local native file chooser
- #include
- [..]
- Fl_Native_File_Chooser fnfc;
- fnfc.title("Pick a file");
- fnfc.type(Fl_Native_File_Chooser::BROWSE_FILE);
- fnfc.filter("Text\t*.txt\n"
- "C Files\t*.{cxx,h,c}");
- fnfc.directory("/var/tmp");
- // Show native chooser
- switch ( fnfc.show() ) {
- case -1: printf("ERROR: %s\n", fnfc.errmsg()); break; // ERROR
- case 1: printf("CANCEL\n"); break; // CANCEL
- default: printf("PICKED: %s\n", fnfc.filename()); break; // FILE CHOSEN
- }
- \endcode
-
- Platform Specific Caveats
-
- - Under X windows, it's best if you call Fl_File_Icon::load_system_icons()
- at the start of main(), to enable the nicer looking file browser widgets.
- - Some operating systems support certain OS specific options; see
- Fl_Native_File_Chooser::options() for a list.
-*/
-class Fl_Native_File_Chooser {
-public:
- enum Type {
- BROWSE_FILE = 0, ///< browse files (lets user choose one file)
- BROWSE_DIRECTORY, ///< browse directories (lets user choose one directory)
- BROWSE_MULTI_FILE, ///< browse files (lets user choose multiple files)
- BROWSE_MULTI_DIRECTORY, ///< browse directories (lets user choose multiple directories)
- BROWSE_SAVE_FILE, ///< browse to save a file
- BROWSE_SAVE_DIRECTORY ///< browse to save a directory
- };
- enum Option {
- NO_OPTIONS = 0x0000, ///< no options enabled
- SAVEAS_CONFIRM = 0x0001, ///< Show native 'Save As' overwrite confirm dialog (if supported)
- NEW_FOLDER = 0x0002, ///< Show 'New Folder' icon (if supported)
- PREVIEW = 0x0004, ///< enable preview mode
- };
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- int _nfilters;
- char *_filter; // user supplied filter
- char *_parsedfilt; // parsed filter
- int _filtvalue; // selected filter
- char *_preset_file;
- char *_prevvalue; // Returned filename
- char *_directory;
- char *_errmsg; // error message
- char *_old_dir;
- Fl_File_Chooser *_file_chooser;
-
- // added by MG
- Fl_File_Browser *my_fileList;
- Fl_Check_Button *show_hidden;
- int prev_filtervalue;
- static void show_hidden_cb(Fl_Check_Button *o, void *data);
- static void remove_hidden_files(Fl_File_Browser *my_fileList);
-
- // Private methods
- void errmsg(const char *msg);
- int type_fl_file(int);
- void parse_filter();
- void keeplocation();
- int exist_dialog();
-
-public:
- Fl_Native_File_Chooser(int val=BROWSE_FILE);
- ~Fl_Native_File_Chooser();
-
- // Public methods
- void type(int);
- int type() const;
- void options(int);
- int options() const;
- int count() const;
- const char *filename() const;
- const char *filename(int i) const;
- void directory(const char *val);
- const char *directory() const;
- void title(const char *);
- const char* title() const;
- const char *filter() const;
- void filter(const char *);
- int filters() const;
- void filter_value(int i);
- int filter_value() const;
- void preset_file(const char*);
- const char* preset_file() const;
- const char *errmsg() const;
- int show();
-};
-
-//
-// End of "$Id: Fl_Native_File_Chooser_FLTK.H 7007 2010-01-14 23:08:06Z greg.ercolano $".
-//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_MAC.H b/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_MAC.H
deleted file mode 100644
index d9668cfc6..000000000
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_MAC.H
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// "$Id: Fl_Native_File_Chooser_MAC.H 7354 2010-03-29 11:07:29Z matt $"
-//
-// FLTK native OS file chooser widget
-//
-// Copyright 1998-2009 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 on the following page:
-//
-// http://www.fltk.org/str.php
-//
-
-#ifndef FL_DOXYGEN // PREVENT DOXYGEN'S USE OF THIS FILE
-
-// OSX-SPECIFIC NATIVE BROWSER
-#include
-#include
-
-#undef check // necessary for use of Fl::check()
-
-#include
-#define MAXFILTERS 80
-
-class Fl_Native_File_Chooser {
-public:
- enum Type {
- BROWSE_FILE = 0,
- BROWSE_DIRECTORY,
- BROWSE_MULTI_FILE,
- BROWSE_MULTI_DIRECTORY,
- BROWSE_SAVE_FILE,
- BROWSE_SAVE_DIRECTORY
- };
- enum Option {
- NO_OPTIONS = 0x0000, // no options enabled
- SAVEAS_CONFIRM = 0x0001, // Show native 'Save As' overwrite confirm dialog (if supported)
- NEW_FOLDER = 0x0002, // Show 'New Folder' icon (if supported)
- PREVIEW = 0x0004, // enable preview mode
- };
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- void *_panel;
- char **_pathnames; // array of pathnames
- int _tpathnames; // total pathnames
- char *_directory; // default pathname to use
- char *_title; // title for window
- char *_preset_file; // the 'save as' filename
-
- char *_filter; // user-side search filter, eg:
- // C Files\t*.[ch]\nText Files\t*.txt"
-
- char *_filt_names; // filter names (tab delimited)
- // eg. "C Files\tText Files"
-
- char *_filt_patt[MAXFILTERS];
- // array of filter patterns, eg:
- // _filt_patt[0]="*.{cxx,h}"
- // _filt_patt[1]="*.txt"
-
- int _filt_total; // parse_filter() # of filters loaded
- int _filt_value; // index of the selected filter
- char *_errmsg; // error message
-
- // Private methods
- void errmsg(const char *msg);
- void clear_pathnames();
- void set_single_pathname(const char *s);
- int get_saveas_basename(void);
- void clear_filters();
- void add_filter(const char *, const char *);
- void parse_filter(const char *from);
- int post();
-
-public:
- Fl_Native_File_Chooser(int val = BROWSE_FILE);
- ~Fl_Native_File_Chooser();
-
- // Public methods
- void type(int);
- int type() const;
- void options(int);
- int options() const;
- int count() const;
- const char *filename() const;
- const char *filename(int i) const;
- void directory(const char *);
- const char *directory() const;
- void title(const char *);
- const char *title() const;
- const char *filter() const;
- void filter(const char *);
- void filter_value(int i) { _filt_value = i; }
- int filter_value() { return(_filt_value); }
- int filters() { return(_filt_total); }
- void preset_file(const char *);
- const char *preset_file();
- const char *errmsg() const;
- int show();
-};
-
-#endif /*!FL_DOXYGEN*/
-
-//
-// End of "$Id: Fl_Native_File_Chooser_MAC.H 7354 2010-03-29 11:07:29Z matt $".
-//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_WIN32.H b/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_WIN32.H
deleted file mode 100644
index d6aa53a69..000000000
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Native_File_Chooser_WIN32.H
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// "$Id: Fl_Native_File_Chooser_WIN32.H 7003 2010-01-14 20:47:59Z greg.ercolano $"
-//
-// FLTK native OS file chooser widget
-//
-// Copyright 1998-2005 by Bill Spitzak and others.
-// Copyright 2004 by Greg Ercolano.
-// April 2005 - API changes, improved filter processing by Nathan Vander Wilt
-//
-// 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
-//
-
-#ifndef FL_DOXYGEN // PREVENT DOXYGEN'S USE OF THIS FILE
-
-// #define _WIN32_WINNT 0x0501 // needed for OPENFILENAME's 'FlagsEx'
-#include
-#include // malloc
-#include
-#include // OPENFILENAME, GetOpenFileName()
-#include // BROWSEINFO, SHBrowseForFolder()
-
-class Fl_Native_File_Chooser {
-public:
- enum Type {
- BROWSE_FILE = 0,
- BROWSE_DIRECTORY,
- BROWSE_MULTI_FILE,
- BROWSE_MULTI_DIRECTORY,
- BROWSE_SAVE_FILE,
- BROWSE_SAVE_DIRECTORY
- };
- enum Option {
- NO_OPTIONS = 0x0000, // no options enabled
- SAVEAS_CONFIRM = 0x0001, // Show native 'Save As' overwrite confirm dialog (if supported)
- NEW_FOLDER = 0x0002, // Show 'New Folder' icon (if supported)
- PREVIEW = 0x0004, // enable preview mode
- };
-private:
- int _btype; // kind-of browser to show()
- int _options; // general options
- OPENFILENAMEW _ofn; // GetOpenFileName() & GetSaveFileName() struct
- BROWSEINFO _binf; // SHBrowseForFolder() struct
- char **_pathnames; // array of pathnames
- int _tpathnames; // total pathnames
- char *_directory; // default pathname to use
- char *_title; // title for window
- char *_filter; // user-side search filter
- char *_parsedfilt; // filter parsed for Windows dialog
- int _nfilters; // number of filters parse_filter counted
- char *_preset_file; // the file to preselect
- char *_errmsg; // error message
-
- // Private methods
- void errmsg(const char *msg);
-
- void clear_pathnames();
- void set_single_pathname(const char *s);
- void add_pathname(const char *s);
-
- void FreePIDL(ITEMIDLIST *pidl);
- void ClearOFN();
- void ClearBINF();
- void Win2Unix(char *s);
- void Unix2Win(char *s);
- int showfile();
- static int CALLBACK Dir_CB(HWND win, UINT msg, LPARAM param, LPARAM data);
- int showdir();
-
- void parse_filter(const char *);
- void clear_filters();
- void add_filter(const char *, const char *);
-
-public:
- Fl_Native_File_Chooser(int val = BROWSE_FILE);
- ~Fl_Native_File_Chooser();
-
- // Public methods
- void type(int val);
- int type() const;
- void options(int);
- int options() const;
- int count() const;
- const char *filename() const;
- const char *filename(int i) const;
- void directory(const char *val);
- const char *directory() const;
- void title(const char *val);
- const char *title() const;
- const char *filter() const;
- void filter(const char *val);
- int filters() const { return _nfilters; }
- void filter_value(int i);
- int filter_value() const;
- void preset_file(const char *);
- const char *preset_file() const;
- const char *errmsg() const;
- int show();
-};
-#endif /*!FL_DOXYGEN*/
-
-//
-// End of "$Id: Fl_Native_File_Chooser_WIN32.H 7003 2010-01-14 20:47:59Z greg.ercolano $".
-//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
index 1d78a4985..591a8333f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Nice_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// "Nice" slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Slider.H"
-class Fl_Nice_Slider : public Fl_Slider {
+class FL_EXPORT Fl_Nice_Slider : public Fl_Slider {
public:
Fl_Nice_Slider(int x,int y,int w,int h,const char *l=0)
: Fl_Slider(x,y,w,h,l) {type(FL_VERT_NICE_SLIDER); box(FL_FLAT_BOX);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Nice_Slider.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Nice_Slider.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Object.H b/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
index 464f492ec..c743999f1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Object.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Object.H 7903 2010-11-28 21:06:39Z matt $"
//
// Old Fl_Object header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -32,5 +32,5 @@
#include "Fl_Widget.H"
//
-// End of "$Id: Fl_Object.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Object.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
index 58b33378f..51cc0348e 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Output.H 6898 2009-09-23 20:43:27Z matt $"
+// "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,36 +33,45 @@
#include "Fl_Input.H"
/**
- This widget displays a piece of text. When you set the value()
- , Fl_Output does a strcpy() to it's own storage,
+ This widget displays a piece of text.
+
+ When you set the value() , Fl_Output does a strcpy() to its own storage,
which is useful for program-generated values. The user may select
portions of the text using the mouse and paste the contents into other
fields or programs.
- \image html text.gif
- \image latex text.eps "Fl_Output" width=8cm
- There is a single subclass,
- Fl_Multiline_Output, which allows you to display multiple lines of
- text. Fl_Multiline_Output does not provide scroll bars. If a more
- complete text editing widget is needed, use Fl_Text_Display instead.
- The text may contain any characters except \\0, and will correctly
+
+
\image html text.png
+ \image latex text.png "Fl_Output" width=8cm
+
+ There is a single subclass, Fl_Multiline_Output, which allows you to
+ display multiple lines of text. Fl_Multiline_Output does not provide
+ scroll bars. If a more complete text editing widget is needed, use
+ Fl_Text_Display instead.
+
+ The text may contain any characters except \\0, and will correctly
display anything, using ^X notation for unprintable control characters
and \\nnn notation for unprintable characters with the high bit set. It
- assumes the font can draw any characters in the ISO-Latin1 character
- set.
+ assumes the font can draw any characters in the ISO-Latin1 character set.
*/
-class Fl_Output : public Fl_Input {
+class FL_EXPORT Fl_Output : public Fl_Input {
public:
/**
Creates a new Fl_Output widget using the given position,
size, and label string. The default boxtype is FL_DOWN_BOX.
- Inherited destrucor destroys the widget and any value associated with it.
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Output(int X,int Y,int W,int H, const char *l = 0);
+#else
Fl_Output(int X,int Y,int W,int H, const char *l = 0)
: Fl_Input(X, Y, W, H, l) {type(FL_NORMAL_OUTPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Output.H 6898 2009-09-23 20:43:27Z matt $".
+// End of "$Id: Fl_Output.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
index 923d64258..918b67101 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Overlay_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $"
//
// Overlay window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -75,5 +75,5 @@ public:
#endif
//
-// End of "$Id: Fl_Overlay_Window.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Overlay_Window.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H b/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
index dc3847dc2..4ff3ae442 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Pack.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $"
+// "$Id: Fl_Pack.H 7903 2010-11-28 21:06:39Z matt $"
//
// Pack header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -80,5 +80,5 @@ public:
#endif
//
-// End of "$Id: Fl_Pack.H 6664 2009-02-18 09:27:54Z AlbrechtS $".
+// End of "$Id: Fl_Pack.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.H b/plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.H
index 345a4bab9..f65da3a95 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Paged_Device.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Paged_Device.H 7622 2010-05-27 17:50:51Z manolo $"
+// "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $"
//
// Printing support for the Fast Light Tool Kit (FLTK).
//
@@ -33,6 +33,10 @@
#define Fl_Paged_Device_H
#include
+#include
+
+/** \brief Number of elements in enum Page_Format */
+#define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
/**
\brief Represents page-structured drawing surfaces.
@@ -40,46 +44,103 @@
This class has no public constructor: don't instantiate it; use Fl_Printer
or Fl_PostScript_File_Device instead.
*/
-class Fl_Paged_Device : public Fl_Surface_Device {
-private:
-#ifdef __APPLE__
- struct chain_elt {
- Fl_Image *image;
- const uchar *data;
- struct chain_elt *next;
+class FL_EXPORT Fl_Paged_Device : public Fl_Surface_Device {
+public:
+ /**
+ \brief Possible page formats.
+
+ All paper formats with pre-defined width and height.
+ */
+ enum Page_Format {
+ A0 = 0, /**< A0 format */
+ A1,
+ A2,
+ A3,
+ A4, /**< A4 format */
+ A5,
+ A6,
+ A7,
+ A8,
+ A9,
+ B0,
+ B1,
+ B2,
+ B3,
+ B4,
+ B5,
+ B6,
+ B7,
+ B8,
+ B9,
+ B10,
+ C5E,
+ DLE,
+ EXECUTIVE,
+ FOLIO,
+ LEDGER,
+ LEGAL,
+ LETTER, /**< Letter format */
+ TABLOID,
+ ENVELOPE,
+ MEDIA = 0x1000
};
- void add_image(Fl_Image *image, const uchar *data); // adds an image to the page image list
-#endif
+ /**
+ \brief Possible page layouts.
+ */
+ enum Page_Layout {
+ PORTRAIT = 0, /**< Portrait orientation */
+ LANDSCAPE = 0x100, /**< Landscape orientation */
+ REVERSED = 0x200, /**< Reversed orientation */
+ ORIENTATION = 0x300 /**< orientation */
+ };
+
+ /** \brief width, height and name of a page format
+ */
+ typedef struct {
+ /** \brief width in points */
+ int width;
+ /** \brief height in points */
+ int height;
+ /** \brief format name */
+ const char *name;
+ } page_format;
+ /** \brief width, height and name of all elements of the enum \ref Page_Format.
+ */
+ static const page_format page_formats[NO_PAGE_FORMATS];
+private:
void traverse(Fl_Widget *widget); // finds subwindows of widget and prints them
protected:
/** \brief horizontal offset to the origin of graphics coordinates */
int x_offset;
/** \brief vertical offset to the origin of graphics coordinates */
int y_offset;
- /** \brief chained list of Fl_Image's used in this page */
- struct chain_elt *image_list_;
-#ifdef __APPLE__
- /** \brief deletes the page image list */
- void delete_image_list();
-#endif
/** \brief The constructor */
- Fl_Paged_Device() : Fl_Surface_Device(NULL) {type_ = device_type;};
+ Fl_Paged_Device() : Fl_Surface_Device(NULL) {};
/** \brief The destructor */
virtual ~Fl_Paged_Device() {};
public:
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
virtual int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
virtual int start_page(void);
virtual int printable_rect(int *w, int *h);
virtual void margins(int *left, int *top, int *right, int *bottom);
virtual void origin(int x, int y);
- void origin(int *x, int *y);
- virtual void scale(float scale_x, float scale_y);
+ virtual void origin(int *x, int *y);
+ virtual void scale(float scale_x, float scale_y = 0.);
virtual void rotate(float angle);
virtual void translate(int x, int y);
virtual void untranslate(void);
- void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
- void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
+ virtual void print_widget(Fl_Widget* widget, int delta_x = 0, int delta_y = 0);
+ /** Prints a window with its title bar and frame if any.
+
+ \p x_offset and \p y_offset are optional coordinates of where to position the window top left.
+ Equivalent to print_widget() if \p win is a subwindow or has no border.
+ Use Fl_Window::decorated_w() and Fl_Window::decorated_h() to get the size of the
+ printed window.
+ */
+ void print_window(Fl_Window *win, int x_offset = 0, int y_offset = 0);
+ virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x = 0, int delta_y = 0);
virtual int end_page (void);
virtual void end_job (void);
};
@@ -87,6 +148,6 @@ public:
#endif // Fl_Paged_Device_H
//
-// End of "$Id: Fl_Paged_Device.H 7622 2010-05-27 17:50:51Z manolo $"
+// End of "$Id: Fl_Paged_Device.H 8699 2011-05-20 16:39:06Z manolo $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H b/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
index 273ed20d8..bc6438b76 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Pixmap.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pixmap.H 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $"
//
// Pixmap header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -95,5 +95,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
#endif
//
-// End of "$Id: Fl_Pixmap.H 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: Fl_Pixmap.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Plugin.H b/plugins/zynaddsubfx/fltk/FL/Fl_Plugin.H
index 231a802cc..62da3a238 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Plugin.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Plugin.H
@@ -55,7 +55,7 @@
My_Plugin blur_plugin();
\endcode
- Plugins can be put into modules and either linked befor distribution, or loaded
+ Plugins can be put into modules and either linked before distribution, or loaded
from dynamically linkable files. An Fl_Plugin_Manager is used to list and
access all currently loaded plugins.
\code
@@ -67,8 +67,7 @@
}
\endcode
*/
-class FL_EXPORT Fl_Plugin
-{
+class FL_EXPORT Fl_Plugin {
Fl_Preferences::ID id;
public:
Fl_Plugin(const char *klass, const char *name);
@@ -80,8 +79,7 @@ public:
\brief Fl_Plugin_Manager manages link-time and run-time plugin binaries.
\see Fl_Plugin
*/
-class FL_EXPORT Fl_Plugin_Manager : public Fl_Preferences
-{
+class FL_EXPORT Fl_Plugin_Manager : public Fl_Preferences {
public:
Fl_Plugin_Manager(const char *klass);
~Fl_Plugin_Manager();
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H b/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
index 04f181aa6..c8b31a624 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Positioner.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Positioner.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Positioner header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,8 +40,8 @@
It would be useful if this could be put atop another widget so that the
crosshairs are on top, but this is not implemented. The color of the
crosshairs is selection_color().
- \image html positioner.gif
- \image latex positioner.eps " Fl_Positioner" width=4cm
+ \image html positioner.png
+ \image latex positioner.png " Fl_Positioner" width=4cm
*/
class FL_EXPORT Fl_Positioner : public Fl_Widget {
@@ -99,5 +99,5 @@ public:
#endif
//
-// End of "$Id: Fl_Positioner.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Positioner.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_PostScript.H b/plugins/zynaddsubfx/fltk/FL/Fl_PostScript.H
index 9a998a6d6..fe1ee01b6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_PostScript.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_PostScript.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_PostScript.H 7622 2010-05-27 17:50:51Z manolo $"
+// "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $"
//
// Support for graphics output to PostScript file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010 by Bill Spitzak and others.
+// 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
@@ -35,70 +35,40 @@
#include
#include
-#define NO_PAGE_FORMATS 30 /* MSVC6 compilation fix */
-
/**
\brief PostScript graphical backend.
*
- PostScript text output is presently implemented only for the latin character set.
- FLTK's standard fonts are output using PostScript's standard fonts: Helvetica, Courier,
- Times (and their bold, oblique, italic variants), Symbol, ZapfDingbats.
+ PostScript text uses vectorial fonts for the latin alphabet (exactly: all unicode
+ characters between U+0020 and U+017F, that is, ASCII, Latin-1 Supplement and Latin Extended-A charts)
+ plus a few other characters:
+
+ | Char | Codepoint | Name | Char | Codepoint | Name | Char | Codepoint | Name |
+ | ƒ | U+0192 | florin | ‚ | U+201A | quotesinglbase | ™ | U+2122 | trademark |
+ | ˆ | U+02C6 | circumflex | “ | U+201C | quotedblleft | ∂ | U+2202 | partialdiff |
+ | ˇ | U+02C7 | caron | †| U+201D | quotedblright | Δ | U+2206 | Delta |
+ | ˘ | U+02D8 | breve | „ | U+201E | quotedblbase | ∑ | U+2211 | summation |
+ | ˙ | U+02D9 | dotaccent | †| U+2020 | dagger | √ | U+221A | radical |
+ | ˚ | U+02DA | ring | ‡ | U+2021 | daggerdbl | ∞ | U+221E | infinity |
+ | ˛ | U+02DB | ogonek | • | U+2022 | bullet | ≠| U+2260 | notequal |
+ | ˜ | U+02DC | tilde | … | U+2026 | ellipsis | ≤ | U+2264 | lessequal |
+ | Ë | U+02DD | hungarumlaut | ‰ | U+2030 | perthousand | ≥ | U+2265 | greaterequal |
+ | – | U+2013 | endash | ‹ | U+2039 | guilsinglleft | ◊ | U+25CA | lozenge |
+ | — | U+2014 | emdash | › | U+203A | guilsinglright | ï¬ | U+FB01 | fi |
+ | ‘ | U+2018 | quoteleft | / | U+2044 | fraction | fl | U+FB02 | fl |
+ | ’ | U+2019 | quoteright | € | U+20AC | Euro |  | U+F8FF | apple (Mac OS only) |
+
+
All other unicode characters are output as a bitmap.
+
FLTK standard fonts are output using PostScript standard fonts: Helvetica, Courier,
+ Times (and their bold, oblique, italic variants).
*/
-class Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
+class FL_EXPORT Fl_PostScript_Graphics_Driver : public Fl_Graphics_Driver {
public:
- static const char *device_type;
- /**
- \brief Possible page formats.
- */
- enum Page_Format {
- A0 = 0,
- A1,
- A2,
- A3,
- A4,
- A5,
- A6,
- A7,
- A8,
- A9,
- B0,
- B1,
- B2,
- B3,
- B4,
- B5,
- B6,
- B7,
- B8,
- B9,
- B10,
- C5E,
- DLE,
- EXECUTIVE,
- FOLIO,
- LEDGER,
- LEGAL,
- LETTER,
- TABLOID,
- ENVELOPE,
- MEDIA = 0x1000
- };
-
- /**
- \brief Possible page layouts.
- */
- enum Page_Layout {PORTRAIT = 0, LANDSCAPE = 0x100, REVERSED = 0x200, ORIENTATION = 0x300};
-
+ static const char *class_id;
+ const char *class_name() {return class_id;};
+ Fl_PostScript_Graphics_Driver();
#ifndef FL_DOXYGEN
-public:
enum SHAPE{NONE=0, LINE, LOOP, POLYGON, POINTS};
-typedef struct page_format {
- int width;
- int height;
- const char *name;
-} page_format;
-
class Clip {
public:
int x, y, w, h;
@@ -107,9 +77,6 @@ class Clip {
Clip * clip_;
int lang_level_;
- int font_;
- int size_;
- Fl_Color color_;
int gap_;
int pages_;
@@ -144,29 +111,35 @@ class Clip {
FILE *output;
double pw_, ph_;
- static const page_format page_formats[NO_PAGE_FORMATS];
uchar bg_r, bg_g, bg_b;
- int start_postscript (int pagecount, enum Page_Format format, enum Page_Layout layout);
+ int start_postscript (int pagecount, enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout);
/* int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
*/
- void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
- void draw(int angle, const char *str, int n, int x, int y);
void transformed_draw(const char* s, int n, double x, double y); //precise text placing
void transformed_draw(const char* s, double x, double y);
int alpha_mask(const uchar * data, int w, int h, int D, int LD=0);
- void draw_scaled_image(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0);
- void draw_scaled_image_mono(const uchar *data, double x, double y, double w, double h, int iw, int ih, int D=3, int LD=0);
- void draw_scaled_image(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
- void draw_scaled_image_mono(Fl_Draw_Image_Cb call, void *data, double x, double y, double w, double h, int iw, int ih, int D);
- enum Page_Format page_format_;
+ enum Fl_Paged_Device::Page_Format page_format_;
char *ps_filename_;
+
+ void page_policy(int p);
+ int page_policy(){return page_policy_;};
+ void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
+ FILE * file() {return output;};
+ //void orientation (int o);
+ //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
+ //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor
+ void interpolate(int i){interpolate_=i;};
+ int interpolate(){return interpolate_;}
+
+ void page(double pw, double ph, int media = 0);
+ void page(int format);
+#endif // FL_DOXYGEN
+
// implementation of drawing methods
void color(Fl_Color c);
- //void bg_color(Fl_Color bg);
void color(uchar r, uchar g, uchar b);
- Fl_Color color(){return color_;};
void push_clip(int x, int y, int w, int h);
int clip_box(int x, int y, int w, int h, int &X, int &Y, int &W, int &H);
@@ -214,66 +187,53 @@ class Clip {
void gap(){gap_=1;};
void end_complex_polygon(){end_polygon();};
void transformed_vertex(double x, double y);
-
- void font(int face, int size);
- int font(){return font_;};
- int size(){return size_;};
- double width(unsigned c);
- double width(const char* s, int n);
- int descent();
- int height();
-
- void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0){draw_scaled_image(d,x,y,w,h,w,h,delta,ldelta);};
- void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0){draw_scaled_image_mono(d,x,y,w,h,w,h,delta,ld);};
- void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3){draw_scaled_image(call,data, x, y, w, h, w, h, delta);};
- void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1){draw_scaled_image_mono(call, data, x, y, w, h, w, h, delta);};
-
- void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
- void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
-public:
- void page_policy(int p);
- int page_policy(){return page_policy_;};
- void close_command( int (*cmd)(FILE *)){close_cmd_=cmd;};
- FILE * file() {return output;};
- //void orientation (int o);
- //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int pages = 0); // ps (also multi-page) constructor
- //Fl_PostScript_Graphics_Driver(FILE *o, int lang_level, int x, int y, int w, int h); //eps constructor
- void interpolate(int i){interpolate_=i;};
- int interpolate(){return interpolate_;}
-
- void page(double pw, double ph, int media = 0);
- void page(int format);
-
- void place(double x, double y, double tx, double ty, double scale = 1);
-#endif // FL_DOXYGEN
- Fl_PostScript_Graphics_Driver();
+ void draw_image(const uchar* d, int x,int y,int w,int h, int delta=3, int ldelta=0);
+ void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0);
+ void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
+ void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
+
+ void draw(const char* s, int n, int x, int y) {transformed_draw(s,n,x,y); };
+#ifdef __APPLE__
+ void draw(const char* s, int n, float x, float y) {transformed_draw(s,n,x,y); };
+#endif
+ void draw(int angle, const char *str, int n, int x, int y);
+ void rtl_draw(const char* s, int n, int x, int y);
+ void font(int face, int size);
+ double width(const char *, int);
+ void text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h);
+ int height();
+ int descent();
+ void draw(Fl_Pixmap * pxm,int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
+ void draw(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
~Fl_PostScript_Graphics_Driver();
};
/**
\brief To send graphical output to a PostScript file.
*/
-class Fl_PostScript_File_Device : public Fl_Paged_Device {
+class FL_EXPORT Fl_PostScript_File_Device : public Fl_Paged_Device {
#ifdef __APPLE__
- CGContextRef gc;
+ Fl_CGContextRef gc;
#endif
protected:
Fl_PostScript_Graphics_Driver *driver();
public:
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
Fl_PostScript_File_Device();
~Fl_PostScript_File_Device();
- int start_job(int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format = Fl_PostScript_Graphics_Driver::A4,
- enum Fl_PostScript_Graphics_Driver::Page_Layout layout = Fl_PostScript_Graphics_Driver::PORTRAIT);
- int start_job(FILE *ps_output, int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format = Fl_PostScript_Graphics_Driver::A4,
- enum Fl_PostScript_Graphics_Driver::Page_Layout layout = Fl_PostScript_Graphics_Driver::PORTRAIT);
+ int start_job(int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
+ enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
+ int start_job(FILE *ps_output, int pagecount, enum Fl_Paged_Device::Page_Format format = Fl_Paged_Device::A4,
+ enum Fl_Paged_Device::Page_Layout layout = Fl_Paged_Device::PORTRAIT);
int start_page (void);
int printable_rect(int *w, int *h);
void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int *x, int *y);
void origin(int x, int y);
- void scale (float scale_x, float scale_y);
+ void scale (float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);
@@ -289,5 +249,5 @@ public:
#endif // Fl_PostScript_H
//
-// End of "$Id: Fl_PostScript.H 7622 2010-05-27 17:50:51Z manolo $"
+// End of "$Id: Fl_PostScript.H 8699 2011-05-20 16:39:06Z manolo $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H b/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
index 1c201814b..8fa3f04c6 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Preferences.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Preferences.H 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $"
//
// Preferences .
//
-// Copyright 2002-2009 by Matthias Melcher.
+// 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
@@ -32,8 +32,7 @@
# define Fl_Preferences_H
# include
-# include "Fl_Export.H"
-
+# include "Fl_Export.H"
/**
\brief Fl_Preferences provides methods to store user
@@ -67,11 +66,9 @@
current chracter set or code page which renders them incompatible
for text entries using international characters.
*/
-class FL_EXPORT Fl_Preferences
-{
-
-public:
+class FL_EXPORT Fl_Preferences {
+public:
/**
Define the scope of the preferences.
*/
@@ -99,7 +96,7 @@ public:
Fl_Preferences( Fl_Preferences *parent, int groupIndex );
Fl_Preferences(const Fl_Preferences&);
Fl_Preferences( ID id );
- ~Fl_Preferences();
+ virtual ~Fl_Preferences();
/** Return an ID that can later be reused to open more references to this dataset.
*/
@@ -156,8 +153,6 @@ public:
// char export( const char *filename, Type fileFormat );
// char import( const char *filename );
- // char copyTo(class Fl_Tree*); // deprecated, use Fl_Tree::load(Fl_Preferences&)
-
/**
'Name' provides a simple method to create numerical or more complex
procedural names for entries and groups on the fly.
@@ -173,8 +168,7 @@ public:
char *data_;
- public:
-
+ public:
Name( unsigned int n );
Name( const char *format, ... );
@@ -187,13 +181,11 @@ public:
};
/** \internal An entry associates a preference name to its corresponding value */
- struct Entry
- {
+ struct Entry {
char *name, *value;
};
-private:
-
+private:
Fl_Preferences() : node(0), rootNode(0) { }
Fl_Preferences &operator=(const Fl_Preferences&);
@@ -203,12 +195,12 @@ private:
class RootNode;
- class FL_EXPORT Node // a node contains a list to all its entries
- { // and all means to manage the tree structure
+ class FL_EXPORT Node { // a node contains a list to all its entries
+ // and all means to manage the tree structure
Node *child_, *next_;
- union { // these two are mutually exclusive
- Node *parent_; // top_ bit clear
- RootNode *root_; // top_ bit set
+ union { // these two are mutually exclusive
+ Node *parent_; // top_ bit clear
+ RootNode *root_; // top_ bit set
};
char *path_;
Entry *entry_;
@@ -257,8 +249,7 @@ private:
};
friend class Node;
- class FL_EXPORT RootNode // the root node manages file paths and basic reading and writing
- {
+ class FL_EXPORT RootNode { // the root node manages file paths and basic reading and writing
Fl_Preferences *prefs_;
char *filename_;
char *vendor_, *application_;
@@ -274,14 +265,12 @@ private:
friend class RootNode;
protected:
-
Node *node;
RootNode *rootNode;
};
-
#endif // !Fl_Preferences_H
//
-// End of "$Id: Fl_Preferences.H 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Preferences.H 7949 2010-12-05 00:38:16Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Printer.H b/plugins/zynaddsubfx/fltk/FL/Fl_Printer.H
index 91450837a..6e8d0efcd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Printer.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Printer.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Printer.H 7662 2010-07-01 15:35:28Z manolo $"
+// "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $"
//
// Printing support for the Fast Light Tool Kit (FLTK).
//
@@ -25,12 +25,13 @@
// http://www.fltk.org/str.php
//
/** \file Fl_Printer.H
- \brief declaration of classes Fl_System_Printer, Fl_PostScript_Printer, Fl_Printer, Fl_Device_Plugin.
+ \brief declaration of classes Fl_Printer, Fl_System_Printer and Fl_PostScript_Printer.
*/
#ifndef Fl_Printer_H
#define Fl_Printer_H
+#include
#include
#include
#include
@@ -39,27 +40,31 @@
#include
#if !(defined(__APPLE__) || defined(WIN32))
#include
+#elif defined(WIN32)
+#include
#endif
#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
/**
- \brief Print support under MSWindows and Mac OS X.
-*
+ Print support under MSWindows and Mac OS.
+
+ Class Fl_System_Printer is implemented only on the MSWindows and Mac OS platforms.
+ It has no public constructor.
Use Fl_Printer instead that is cross-platform and has the same API.
- Fl_Printer is typedef'ed to Fl_System_Printer under MSWindows and Mac OS X.
*/
class Fl_System_Printer : public Fl_Paged_Device {
+ friend class Fl_Printer;
private:
/** \brief the printer's graphics context, if there's one, NULL otherwise */
void *gc;
- void set_current();
+ void set_current(void);
#ifdef __APPLE__
float scale_x;
float scale_y;
float angle; // rotation angle in radians
- PMPrintSession printSession;
- PMPageFormat pageFormat;
- PMPrintSettings printSettings;
+ Fl_PMPrintSession printSession;
+ Fl_PMPageFormat pageFormat;
+ Fl_PMPrintSettings printSettings;
#elif defined(WIN32)
int abortPrint;
PRINTDLG pd;
@@ -69,117 +74,69 @@ private:
int top_margin;
void absolute_printable_rect(int *x, int *y, int *w, int *h);
#endif
-public:
- static const char *device_type;
- /**
- @brief The constructor.
- */
+protected:
+ /** \brief The constructor */
Fl_System_Printer(void);
+public:
+ static const char *class_id;
+ const char *class_name() {return class_id;};
int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
int start_page (void);
int printable_rect(int *w, int *h);
void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int *x, int *y);
void origin(int x, int y);
- void scale (float scale_x, float scale_y);
+ void scale (float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);
int end_page (void);
void end_job (void);
-
- /**
- @brief The destructor.
- */
+ /** \brief The destructor */
~Fl_System_Printer(void);
-#ifndef FL_DOXYGEN
-public:
- static const char *dialog_title;
- static const char *dialog_printer;
- static const char *dialog_range;
- static const char *dialog_copies;
- static const char *dialog_all;
- static const char *dialog_pages;
- static const char *dialog_from;
- static const char *dialog_to;
- static const char *dialog_properties;
- static const char *dialog_copyNo;
- static const char *dialog_print_button;
- static const char *dialog_cancel_button;
- static const char *dialog_print_to_file;
- static const char *property_title;
- static const char *property_pagesize;
- static const char *property_mode;
- static const char *property_use;
- static const char *property_save;
- static const char *property_cancel;
-#endif // FL_DOXYGEN
}; // class Fl_System_Printer
-/** \brief OS-independant class name */
-typedef Fl_System_Printer Fl_Printer;
#endif
-#if !(defined(__APPLE__) || defined(WIN32))
+#if !(defined(__APPLE__) || defined(WIN32) )
/**
- \brief Print support under Unix/Linux.
- *
+ Print support under Unix/Linux.
+
+ Class Fl_PostScript_Printer is implemented only on the Unix/Linux platform.
+ It has no public constructor.
Use Fl_Printer instead that is cross-platform and has the same API.
- Fl_Printer is typedef'ed to Fl_PostScript_Printer under Unix/Linux.
*/
class Fl_PostScript_Printer : public Fl_PostScript_File_Device {
-private:
- void set_current();
+ friend class Fl_Printer;
+protected:
+ /** The constructor */
+ Fl_PostScript_Printer(void) {};
public:
- static const char *device_type;
+ static const char *class_id;
+ const char *class_name() {return class_id;};
int start_job(int pages, int *firstpage = NULL, int *lastpage = NULL);
-
-#ifndef FL_DOXYGEN
- static const char *dialog_title;
- static const char *dialog_printer;
- static const char *dialog_range;
- static const char *dialog_copies;
- static const char *dialog_all;
- static const char *dialog_pages;
- static const char *dialog_from;
- static const char *dialog_to;
- static const char *dialog_properties;
- static const char *dialog_copyNo;
- static const char *dialog_print_button;
- static const char *dialog_cancel_button;
- static const char *dialog_print_to_file;
- static const char *property_title;
- static const char *property_pagesize;
- static const char *property_mode;
- static const char *property_use;
- static const char *property_save;
- static const char *property_cancel;
-#endif // FL_DOXYGEN
};
-/** \brief OS-independant class name */
-typedef Fl_PostScript_Printer Fl_Printer;
#endif
/**
- * @brief OS-independent print support.
+ * \brief OS-independent print support.
*
Fl_Printer allows to use all FLTK drawing, color, text, and clip functions, and to have them operate
on printed page(s). There are two main, non exclusive, ways to use it.
- Print any widget (standard, custom, Fl_Window, Fl_Gl_Window) as it appears
on screen, with optional translation, scaling and rotation. This is done by calling print_widget()
or print_window_part().
-
- Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip) to
+
- Use a series of FLTK graphics commands (e.g., font, text, lines, colors, clip, image) to
compose a page appropriately shaped for printing.
In both cases, begin by start_job(), start_page(), printable_rect() and origin() calls
and finish by end_page() and end_job() calls.
Platform specifics
-
Fl_Printer is typedef'ed to Fl_PostScript_Printer under Unix/Linux
- and to Fl_System_Printer otherwise. Both classes have the same API.
- Unix/Linux platforms:
Class Fl_RGB_Image prints but loses its transparency if it has one.
- PostScript text output is presently restricted to the Latin alphabet.
+ See class Fl_PostScript_Graphics_Driver for a description of how UTF-8 strings appear in print.
Use the static public attributes of this class to set the print dialog to other languages
than English. For example, the "Printer:" dialog item Fl_Printer::dialog_printer can be set to French with:
\code
@@ -194,25 +151,29 @@ typedef Fl_PostScript_Printer Fl_Printer;
- Mac OS X platform: all graphics requests print as on display.
*/
-#ifdef FL_DOXYGEN
-// this class is NOT compiled. It's here for Doxygen documentation purpose only
-class Fl_Printer : public Fl_System_Printer, Fl_PostScript_Printer {
+class FL_EXPORT Fl_Printer : public Fl_Paged_Device {
public:
- static const char *device_type;
- /** @brief The constructor */
+ static const char *class_id;
+ const char *class_name() {return class_id;};
+ /** \brief The constructor */
Fl_Printer(void);
int start_job(int pagecount, int *frompage = NULL, int *topage = NULL);
int start_page(void);
int printable_rect(int *w, int *h);
void margins(int *left, int *top, int *right, int *bottom);
+ void origin(int *x, int *y);
void origin(int x, int y);
- void scale(float scale_x, float scale_y);
+ void scale(float scale_x, float scale_y = 0.);
void rotate(float angle);
void translate(int x, int y);
void untranslate(void);
int end_page (void);
void end_job (void);
- /** @brief The destructor */
+ void print_widget(Fl_Widget* widget, int delta_x=0, int delta_y=0);
+ void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
+ void set_current(void);
+ Fl_Graphics_Driver* driver(void);
+ /** \brief The destructor */
~Fl_Printer(void);
/** \name These attributes are effective under the Xlib platform only.
@@ -238,33 +199,16 @@ public:
static const char *property_save;
static const char *property_cancel;
/** \} */
-};
+private:
+#if defined(WIN32) || defined(__APPLE__)
+ Fl_System_Printer *printer;
+#else
+ Fl_PostScript_Printer *printer;
#endif
-
-/**
- This plugin socket allows the integration of new device drivers for special
- window or screen types. It is currently used to provide an automated printing
- service for OpenGL windows, if linked with fltk_gl.
- */
-class Fl_Device_Plugin : public Fl_Plugin {
-public:
- /** \brief The constructor */
- Fl_Device_Plugin(const char *name)
- : Fl_Plugin(klass(), name) { }
- /** \brief Returns the class name */
- virtual const char *klass() { return "fltk:device"; }
- /** \brief Returns the plugin name */
- virtual const char *name() = 0;
- /** \brief Prints a widget
- \param w the widget
- \param x,y offsets where to print relatively to coordinates origin
- \param height height of the current drawing area
- */
- virtual int print(Fl_Widget* w, int x, int y, int height) { return 0; }
};
#endif // Fl_Printer_H
//
-// End of "$Id: Fl_Printer.H 7662 2010-07-01 15:35:28Z manolo $"
+// End of "$Id: Fl_Printer.H 8699 2011-05-20 16:39:06Z manolo $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H b/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
index 5d2e8c434..ce506d5ae 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Progress.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Progress.H 8306 2011-01-24 17:04:22Z matt $"
//
// Progress bar widget definitions.
//
-// Copyright 2000-2009 by Michael Sweet.
+// 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
@@ -44,8 +44,8 @@
/**
Displays a progress bar for the user.
*/
-class FL_EXPORT Fl_Progress : public Fl_Widget
-{
+class FL_EXPORT Fl_Progress : public Fl_Widget {
+
float value_,
minimum_,
maximum_;
@@ -77,5 +77,5 @@ class FL_EXPORT Fl_Progress : public Fl_Widget
#endif // !_Fl_Progress_H_
//
-// End of "$Id: Fl_Progress.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Progress.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.H
index fd4a44fc7..bf1285eb4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_RGB_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_RGB_Image.H 6942 2009-11-18 12:22:51Z AlbrechtS $"
+// "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $"
//
// RGB Image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -31,5 +31,5 @@
#endif // !Fl_RGB_Image_H
//
-// End of "$Id: Fl_RGB_Image.H 6942 2009-11-18 12:22:51Z AlbrechtS $".
+// End of "$Id: Fl_RGB_Image.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
index 892730705..979e33010 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Radio button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Button.H"
-class Fl_Radio_Button : public Fl_Button {
+class FL_EXPORT Fl_Radio_Button : public Fl_Button {
public:
Fl_Radio_Button(int x,int y,int w,int h,const char *l=0)
: Fl_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Radio_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
index 136915d5d..6286dbd7a 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Radio light button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Light_Button.H"
-class Fl_Radio_Light_Button : public Fl_Light_Button {
+class FL_EXPORT Fl_Radio_Light_Button : public Fl_Light_Button {
public:
Fl_Radio_Light_Button(int X,int Y,int W,int H,const char *l=0)
: Fl_Light_Button(X,Y,W,H,l) {type(FL_RADIO_BUTTON);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Radio_Light_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
index 588d02360..b1505afda 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Radio_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Radio round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,7 +33,7 @@
#include "Fl_Round_Button.H"
-class Fl_Radio_Round_Button : public Fl_Round_Button {
+class FL_EXPORT Fl_Radio_Round_Button : public Fl_Round_Button {
public:
Fl_Radio_Round_Button(int x,int y,int w,int h,const char *l=0)
: Fl_Round_Button(x,y,w,h,l) {type(FL_RADIO_BUTTON);}
@@ -42,5 +42,5 @@ public:
#endif
//
-// End of "$Id: Fl_Radio_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Radio_Round_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
index 0ed4a8f6b..dc6d42eb3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Repeat_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $"
//
// Repeat button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -59,5 +59,5 @@ public:
#endif
//
-// End of "$Id: Fl_Repeat_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Repeat_Button.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
index afa13a64e..eb8d6c4e9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Return_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Return button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -36,8 +36,8 @@
The Fl_Return_Button is a subclass of Fl_Button that
generates a callback when it is pressed or when the user presses the
Enter key. A carriage-return symbol is drawn next to the button label.
- \image html Fl_Return_Button.gif
- \image latex Fl_Return_Button.eps "Fl_Return_Button" width=4cm
+
\image html Fl_Return_Button.png
+ \image latex Fl_Return_Button.png "Fl_Return_Button" width=4cm
*/
class FL_EXPORT Fl_Return_Button : public Fl_Button {
protected:
@@ -56,5 +56,5 @@ public:
#endif
//
-// End of "$Id: Fl_Return_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Return_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H b/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
index 60659812f..a22d6433c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Roller.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Roller header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -38,8 +38,8 @@
/**
The Fl_Roller widget is a "dolly" control commonly used to
move 3D objects.
-
\image html Fl_Roller.gif
- \image latex Fl_Roller.eps "Fl_Roller" width=4cm
+
\image html Fl_Roller.png
+ \image latex Fl_Roller.png "Fl_Roller" width=4cm
*/
class FL_EXPORT Fl_Roller : public Fl_Valuator {
protected:
@@ -52,5 +52,5 @@ public:
#endif
//
-// End of "$Id: Fl_Roller.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Roller.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
index de4179119..f11123ec0 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,8 +37,8 @@
Buttons generate callbacks when they are clicked by the user. You
control exactly when and how by changing the values for type()
and when().
-
\image html Fl_Round_Button.gif
- \image latex Fl_Round_Button.eps " Fl_Round_Button" width=4cm
+ \image html Fl_Round_Button.png
+ \image latex Fl_Round_Button.png " Fl_Round_Button" width=4cm
The Fl_Round_Button subclass display the "on" state by
turning on a light, rather than drawing pushed in. The shape of the
"light" is initially set to FL_ROUND_DOWN_BOX. The color of the light
@@ -53,5 +53,5 @@ public:
#endif
//
-// End of "$Id: Fl_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Round_Button.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
index 919bfbda5..2d420baee 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Round_Clock.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Round clock header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,7 +34,7 @@
#include "Fl_Clock.H"
/** A clock widget of type FL_ROUND_CLOCK. Has no box. */
-class Fl_Round_Clock : public Fl_Clock {
+class FL_EXPORT Fl_Round_Clock : public Fl_Clock {
public:
/** Creates the clock widget, setting his type and box. */
Fl_Round_Clock(int x,int y,int w,int h, const char *l = 0)
@@ -44,5 +44,5 @@ public:
#endif
//
-// End of "$Id: Fl_Round_Clock.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Round_Clock.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H b/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
index f93b222c3..c649497ef 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Scroll.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scroll.H 6951 2009-12-06 22:21:55Z matt $"
+// "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Scroll header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -39,8 +39,8 @@
larger than your window. If the child widgets are larger than the size
of this object then scrollbars will appear so that you can scroll over
to them:
- \image html Fl_Scroll.gif
- \image latex Fl_Scroll.eps "Fl_Scroll" width=4cm
+ \image html Fl_Scroll.png
+ \image latex Fl_Scroll.png "Fl_Scroll" width=4cm
If all of the child widgets are packed together into a solid
rectangle then you want to set box() to FL_NO_BOX or
@@ -195,5 +195,5 @@ public:
#endif
//
-// End of "$Id: Fl_Scroll.H 6951 2009-12-06 22:21:55Z matt $".
+// End of "$Id: Fl_Scroll.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
index 0b7ab1d5c..96aa4330c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Scrollbar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $"
+// "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Scroll bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -46,8 +46,8 @@
have to use casts to get at the floating-point versions of value()
from Fl_Slider.
- \image html scrollbar.gif
- \image latex scrollbar.eps "Fl_Scrollbar" width=4cm
+ \image html scrollbar.png
+ \image latex scrollbar.png "Fl_Scrollbar" width=4cm
*/
class FL_EXPORT Fl_Scrollbar : public Fl_Slider {
@@ -116,5 +116,5 @@ public:
#endif
//
-// End of "$Id: Fl_Scrollbar.H 6683 2009-03-14 11:46:43Z engelsman $".
+// End of "$Id: Fl_Scrollbar.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
index 90a65cf87..2c100362c 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Secret_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Secret input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,23 +34,31 @@
#include "Fl_Input.H"
/**
- The Fl_Secret_Input class is a subclass of Fl_Input
- that displays its input as a string of asterisks. This subclass is
- usually used to receive passwords and other "secret" information.
+ The Fl_Secret_Input class is a subclass of Fl_Input that displays its
+ input as a string of placeholders. Depending on the platform this
+ placeholder is either the asterisk ('*') or the Unicode bullet
+ character (U+2022).
+
+ This subclass is usually used to receive passwords and other "secret" information.
*/
-class Fl_Secret_Input : public Fl_Input {
+class FL_EXPORT Fl_Secret_Input : public Fl_Input {
public:
/**
Creates a new Fl_Secret_Input widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
-
Inherited destructor destroys the widget and any value associated with it.
+
+ Inherited destructor destroys the widget and any value associated with it.
*/
+#if defined(FL_DLL) // implementation in src/Fl_Input.cxx
+ Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0);
+#else
Fl_Secret_Input(int X,int Y,int W,int H,const char *l = 0)
: Fl_Input(X,Y,W,H,l) {type(FL_SECRET_INPUT);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Secret_Input.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Secret_Input.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H b/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
index 2ae7406c5..82e68da2f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Select_Browser.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $"
//
// Select browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -36,25 +36,29 @@
/**
The class is a subclass of Fl_Browser
which lets the user select a single item, or no items by clicking on
- the empty space. As long as the mouse button is held down on an
+ the empty space. As long as the mouse button is held down on an
unselected item it is highlighted. Normally the callback is done when the
user presses the mouse, but you can change this with when().
See Fl_Browser for methods to add and remove lines from the browser.
*/
-class Fl_Select_Browser : public Fl_Browser {
+class FL_EXPORT Fl_Select_Browser : public Fl_Browser {
public:
- /**
+ /**
Creates a new Fl_Select_Browser widget using the given
position, size, and label string. The default boxtype is FL_DOWN_BOX.
The constructor specializes Fl_Browser() by setting the type to FL_SELECT_BROWSER.
The destructor destroys the widget and frees all memory that has been allocated.
*/
- Fl_Select_Browser(int X,int Y,int W,int H,const char *l=0)
- : Fl_Browser(X,Y,W,H,l) {type(FL_SELECT_BROWSER);}
+#if defined(FL_DLL) // implementation in src/Fl_Browser.cxx
+ Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0);
+#else
+ Fl_Select_Browser(int X,int Y,int W,int H,const char *L=0)
+ : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
+#endif
};
#endif
//
-// End of "$Id: Fl_Select_Browser.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Select_Browser.H 8736 2011-05-24 20:00:56Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
index 0e1b39b20..a6beb0dda 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Shared_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Shared_Image.H 7505 2010-04-14 20:47:34Z manolo $"
+// "$Id: Fl_Shared_Image.H 8306 2011-01-24 17:04:22Z matt $"
//
// Shared image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -47,7 +47,11 @@ typedef Fl_Image *(*Fl_Shared_Handler)(const char *name, uchar *header,
function to support standard image formats such as BMP, GIF, JPEG, and PNG.
*/
class FL_EXPORT Fl_Shared_Image : public Fl_Image {
- protected:
+
+ friend class Fl_JPEG_Image;
+ friend class Fl_PNG_Image;
+
+protected:
static Fl_Shared_Image **images_; // Shared images
static int num_images_; // Number of shared images
@@ -106,5 +110,5 @@ FL_EXPORT extern void fl_register_images();
#endif // !Fl_Shared_Image_H
//
-// End of "$Id: Fl_Shared_Image.H 7505 2010-04-14 20:47:34Z manolo $"
+// End of "$Id: Fl_Shared_Image.H 8306 2011-01-24 17:04:22Z matt $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H b/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
index 3b1a92784..dbcebdba2 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Simple_Counter.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Simple_Counter.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Simple counter header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,10 +34,10 @@
#include "Fl_Counter.H"
/**
This widget creates a counter with only 2 arrow buttons
-
\image html counter.gif
- \image latex counter.eps "Fl_Simple_Counter" width=4cm
+ \image html counter.png
+ \image latex counter.png "Fl_Simple_Counter" width=4cm
*/
-class Fl_Simple_Counter : public Fl_Counter {
+class FL_EXPORT Fl_Simple_Counter : public Fl_Counter {
public:
Fl_Simple_Counter(int x,int y,int w,int h, const char *l = 0)
: Fl_Counter(x,y,w,h,l) {type(FL_SIMPLE_COUNTER);}
@@ -46,5 +46,5 @@ public:
#endif
//
-// End of "$Id: Fl_Simple_Counter.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Simple_Counter.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
index a536c4951..9bebc4ea8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Single_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Single_Window.H 7903 2010-11-28 21:06:39Z matt $"
//
// Single-buffered window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -63,5 +63,5 @@ public:
#endif
//
-// End of "$Id: Fl_Single_Window.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Single_Window.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
index 20c60c4e6..e16e2d6d1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $"
+// "$Id: Fl_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -64,8 +64,8 @@
\li FL_HOR_NICE_SLIDER - Draws a horizontal slider with a
nice looking control knob.
- \image html slider.gif
- \image latex slider.eps "Fl_Slider" width=4cm
+ \image html slider.png
+ \image latex slider.png "Fl_Slider" width=4cm
*/
class FL_EXPORT Fl_Slider : public Fl_Valuator {
@@ -116,5 +116,5 @@ public:
#endif
//
-// End of "$Id: Fl_Slider.H 6683 2009-03-14 11:46:43Z engelsman $".
+// End of "$Id: Fl_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H b/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
index b718d9281..5d141bd31 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Spinner.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Spinner.H 8339 2011-01-30 12:50:19Z ianmacarthur $"
//
// Spinner widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -48,8 +48,8 @@
widget and repeat buttons. The user can either type into the
input area or use the buttons to change the value.
*/
-class Fl_Spinner : public Fl_Group
-{
+class FL_EXPORT Fl_Spinner : public Fl_Group {
+
double value_; // Current value
double minimum_; // Minimum value
double maximum_; // Maximum value
@@ -233,14 +233,16 @@ class Fl_Spinner : public Fl_Group
void textsize(Fl_Fontsize s) {
input_.textsize(s);
}
- /** Sets or Gets the numeric representation in the input field.
- Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
- The first form also changes the format() template.
- Setting a new spinner type via a superclass pointer will not work.
- \note type is not a virtual function.
+ /** Gets the numeric representation in the input field.
+ \see Fl_Spinner::type(uchar)
*/
uchar type() const { return (input_.type()); }
- /** See uchar Fl_Spinner::type() const */
+ /** Sets the numeric representation in the input field.
+ Valid values are FL_INT_INPUT and FL_FLOAT_INPUT.
+ Also changes the format() template.
+ Setting a new spinner type via a superclass pointer will not work.
+ \note type is not a virtual function.
+ */
void type(uchar v) {
if (v==FL_FLOAT_INPUT) {
format("%.*f");
@@ -262,5 +264,5 @@ class Fl_Spinner : public Fl_Group
#endif // !Fl_Spinner_H
//
-// End of "$Id: Fl_Spinner.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Spinner.H 8339 2011-01-30 12:50:19Z ianmacarthur $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H b/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
index 68a26d16a..da70c92c4 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Sys_Menu_Bar.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Sys_Menu_Bar.H 7518 2010-04-16 19:27:28Z manolo $"
+// "$Id: Fl_Sys_Menu_Bar.H 7903 2010-11-28 21:06:39Z matt $"
//
// MacOS system menu bar header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -76,5 +76,5 @@ typedef Fl_Menu_Bar Fl_Sys_Menu_Bar;
#endif // Fl_Sys_Menu_Bar_H
//
-// End of "$Id: Fl_Sys_Menu_Bar.H 7518 2010-04-16 19:27:28Z manolo $".
+// End of "$Id: Fl_Sys_Menu_Bar.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Table.H b/plugins/zynaddsubfx/fltk/FL/Fl_Table.H
index 3be069dc4..55c06fddd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Table.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Table.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Table.H 7612 2010-05-19 07:22:37Z greg.ercolano $"
+// "$Id: Fl_Table.H 8301 2011-01-22 22:40:11Z AlbrechtS $"
//
// Fl_Table -- A table widget
//
@@ -61,12 +61,19 @@
This widget can be used in several ways:
- - As a custom widget; see test/testtablerow.cxx. Very optimal for even
- extremely large tables.
- - As a table made up of a single FLTK widget instanced all over the table;
- see test/singleinput.cxx. Very optimal for even extremely large tables;
+ - As a custom widget; see examples/table-simple.cxx and test/table.cxx.
+ Very optimal for even extremely large tables.
+ - As a table made up of a single FLTK widget instanced all over the table,
+ simulating a numeric spreadsheet. See examples/table-spreadsheet.cxx and
+ examples/table-spreadsheet-with-keyboard-nav.cxx. Optimal for large tables.
- As a regular container of FLTK widgets, one widget per cell.
- See test/widgettable.cxx. \em Not recommended for large tables.
+ See examples/table-as-container.cxx. \em Not recommended for large tables.
+
+ \image html table-simple.png
+ \image latex table-simple.png "table-simple example" width=6cm
+
+ \image html table-as-container.png
+ \image latex table-as-container.png "table-as-container example" width=6cm
When acting as part of a custom widget, events on the cells and/or headings
generate callbacks when they are clicked by the user. You control when events
@@ -74,11 +81,12 @@
When acting as a container for FLTK widgets, the FLTK widgets maintain
themselves. Although the draw_cell() method must be overridden, its contents
- can be very simple. See the draw_cell() code in test/widgettable.cxx.
+ can be very simple. See the draw_cell() code in examples/table-simple.cxx.
The following variables are available to classes deriving from Fl_Table:
- \image html table-dimensions.gif
+ \image html table-dimensions.png
+ \image latex table-dimensions.png "Fl_Table Dimensions" width=6cm
| x()/y()/w()/h() |
@@ -117,11 +125,12 @@
LICENSE
Greg added the following license to the original distribution of Fl_Table. He
- kindly gave his permission to integrate Fl_Table and Fl_Table_row into FLTK,
+ kindly gave his permission to integrate Fl_Table and Fl_Table_Row into FLTK,
allowing FLTK license to apply while his widgets are part of the library.
If used on its own, this is the license that applies:
-
+
+ \verbatim
Fl_Table License
December 16, 2002
@@ -165,20 +174,24 @@
[program/widget] is based in part on the work of
the Fl_Table project http://seriss.com/people/erco/fltk/Fl_Table/
+ \endverbatim
*/
-class Fl_Table : public Fl_Group {
+class FL_EXPORT Fl_Table : public Fl_Group {
public:
+ /**
+ The context bit flags for Fl_Table related callbacks (eg. draw_cell(), callback(), etc)
+ */
enum TableContext {
- CONTEXT_NONE = 0,
- CONTEXT_STARTPAGE = 0x01, // before a page is redrawn
- CONTEXT_ENDPAGE = 0x02, // after a page is redrawn
- CONTEXT_ROW_HEADER = 0x04, // in the row header
- CONTEXT_COL_HEADER = 0x08, // in the col header
- CONTEXT_CELL = 0x10, // in one of the cells
- CONTEXT_TABLE = 0x20, // in the table
- CONTEXT_RC_RESIZE = 0x40 // column or row being resized
+ CONTEXT_NONE = 0, ///< no known context
+ CONTEXT_STARTPAGE = 0x01, ///< before a page is redrawn
+ CONTEXT_ENDPAGE = 0x02, ///< after a page is redrawn
+ CONTEXT_ROW_HEADER = 0x04, ///< in the row header
+ CONTEXT_COL_HEADER = 0x08, ///< in the col header
+ CONTEXT_CELL = 0x10, ///< in one of the cells
+ CONTEXT_TABLE = 0x20, ///< in a dead zone of table
+ CONTEXT_RC_RESIZE = 0x40 ///< column or row being resized
};
private:
@@ -207,7 +220,7 @@ private:
int _selecting;
// An STL-ish vector without templates
- class IntVector {
+ class FL_EXPORT IntVector {
int *arr;
unsigned int _size;
void init() {
@@ -326,38 +339,47 @@ protected:
| \p Fl_Table::CONTEXT_STARTPAGE |
- When table, or parts of the table, are about to be redrawn.
- Use to initialize static data, such as font selections.
- r/c will be zero, x/y/w/h will be the dimensions of the
- table's entire data area.
- (Useful for locking a database before accessing; see
- also visible_cells()) |
+ When table, or parts of the table, are about to be redrawn.
+ Use to initialize static data, such as font selections.
+ R/C will be zero,
+ X/Y/W/H will be the dimensions of the table's entire data area.
+ (Useful for locking a database before accessing; see
+ also visible_cells()) |
| \p Fl_Table::CONTEXT_ENDPAGE |
- When table has completed being redrawn.
- r/c will be zero, x/y/w/h dimensions of table's data area.
- (Useful for unlocking a database after accessing) |
+ When table has completed being redrawn.
+ R/C will be zero, X/Y/W/H dimensions of table's data area.
+ (Useful for unlocking a database after accessing) |
| \p Fl_Table::CONTEXT_ROW_HEADER |
- Whenever a row header cell needs to be drawn. |
+ Whenever a row header cell needs to be drawn.
+ R will be the row number of the header being redrawn,
+ C will be zero,
+ X/Y/W/H will be the fltk drawing area of the row header in the window |
| \p Fl_Table::CONTEXT_COL_HEADER |
- Whenever a column header cell needs to be drawn. |
+ Whenever a column header cell needs to be drawn.
+ R will be zero,
+ C will be the column number of the header being redrawn,
+ X/Y/W/H will be the fltk drawing area of the column header in the window |
| \p Fl_Table::CONTEXT_CELL |
- Whenever a data cell in the table needs to be drawn. |
+ Whenever a data cell in the table needs to be drawn.
+ R/C will be the row/column of the cell to be drawn,
+ X/Y/W/H will be the fltk drawing area of the cell in the window |
| \p Fl_Table::CONTEXT_RC_RESIZE |
Whenever table or row/column is resized or scrolled,
- either interactively or via col_width() or row_height().
-
- Useful for fltk containers that need to resize or move
- the child fltk widgets. |
+ either interactively or via col_width() or row_height().
+ R/C/X/Y/W/H will all be zero.
+
+ Useful for fltk containers that need to resize or move
+ the child fltk widgets.
\p row and \p col will be set to the row and column number
- the user clicked on. In the case of row headers, \p col will be \a 0.
+ of the cell being drawn. In the case of row headers, \p col will be \a 0.
In the case of column headers, \p row will be \a 0.
x/y/w/h will be the position and dimensions of where the cell
@@ -371,55 +393,53 @@ protected:
\code
// This is called whenever Fl_Table wants you to draw a cell
- void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0)
- {
- static char s[40];
- sprintf(s, "%d/%d", R, C); // text for each cell
- switch ( context )
- {
- case CONTEXT_STARTPAGE: // Fl_Table telling us its starting to draw page
- fl_font(FL_HELVETICA, 16);
- return;
-
- case CONTEXT_ROW_HEADER: // Fl_Table telling us it's draw row/col headers
- case CONTEXT_COL_HEADER:
- fl_push_clip(X, Y, W, H);
- {
- fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color());
- fl_color(FL_BLACK);
- fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
- }
- fl_pop_clip();
- return;
-
- case CONTEXT_CELL: // Fl_Table telling us to draw cells
- fl_push_clip(X, Y, W, H);
- {
- // BG COLOR
- fl_color( row_selected(R) ? selection_color() : FL_WHITE);
- fl_rectf(X, Y, W, H);
-
- // TEXT
- fl_color(FL_BLACK);
- fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
-
- // BORDER
- fl_color(FL_LIGHT2);
- fl_rect(X, Y, W, H);
- }
- fl_pop_clip();
- return;
-
- default:
- return;
- }
- //NOTREACHED
+ void MyTable::draw_cell(TableContext context, int R=0, int C=0, int X=0, int Y=0, int W=0, int H=0) {
+ static char s[40];
+ sprintf(s, "%d/%d", R, C); // text for each cell
+ switch ( context ) {
+ case CONTEXT_STARTPAGE: // Fl_Table telling us its starting to draw page
+ fl_font(FL_HELVETICA, 16);
+ return;
+
+ case CONTEXT_ROW_HEADER: // Fl_Table telling us it's draw row/col headers
+ case CONTEXT_COL_HEADER:
+ fl_push_clip(X, Y, W, H);
+ {
+ fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, color());
+ fl_color(FL_BLACK);
+ fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
+ }
+ fl_pop_clip();
+ return;
+
+ case CONTEXT_CELL: // Fl_Table telling us to draw cells
+ fl_push_clip(X, Y, W, H);
+ {
+ // BG COLOR
+ fl_color( row_selected(R) ? selection_color() : FL_WHITE);
+ fl_rectf(X, Y, W, H);
+
+ // TEXT
+ fl_color(FL_BLACK);
+ fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER);
+
+ // BORDER
+ fl_color(FL_LIGHT2);
+ fl_rect(X, Y, W, H);
+ }
+ fl_pop_clip();
+ return;
+
+ default:
+ return;
+ }
+ //NOTREACHED
}
\endcode
*/
virtual void draw_cell(TableContext context, int R=0, int C=0,
int X=0, int Y=0, int W=0, int H=0)
- { } // overridden by deriving class
+ { } // overridden by deriving class
long row_scroll_position(int row); // find scroll position of row (in pixels)
long col_scroll_position(int col); // find scroll position of col (in pixels)
@@ -472,9 +492,7 @@ public:
*/
virtual void clear() { rows(0); cols(0); }
- // topline()
- // middleline()
- // bottomline()
+ // \todo: add topline(), middleline(), bottomline()
/**
Sets the kind of box drawn around the data table,
@@ -811,8 +829,8 @@ public:
return(row_position());
}
int is_selected(int r, int c); // selected cell
- void get_selection(int& s_top, int& s_left, int& s_bottom, int& s_right);
- void set_selection(int s_top, int s_left, int s_bottom, int s_right);
+ void get_selection(int &row_top, int &col_left, int &row_bot, int &col_right);
+ void set_selection(int row_top, int col_left, int row_bot, int col_right);
int move_cursor(int R, int C);
/**
@@ -879,10 +897,9 @@ public:
Typically used in loops, eg:
\code
- for ( int i=0; i
\code
- class MyTable
- {
- [..]
+ class MyTable : public Fl_Table {
+ [..]
private:
- // Handle events that happen on the table
- void event_callback2()
- {
- int R = callback_row(), // row where event occurred
- C = callback_col(); // column where event occurred
- TableContext context = callback_context(); // which part of table
- fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
- R, C, (int)context, (int)Fl::event());
- }
-
- // Actual static callback
- static void event_callback(Fl_Widget*, void* data)
- {
- MyTable *o = (MyTable*)data;
- o->event_callback2();
- }
+ // Handle events that happen on the table
+ void event_callback2() {
+ int R = callback_row(), // row where event occurred
+ C = callback_col(); // column where event occurred
+ TableContext context = callback_context(); // which part of table
+ fprintf(stderr, "callback: Row=%d Col=%d Context=%d Event=%d\n",
+ R, C, (int)context, (int)Fl::event());
+ }
+ // Actual static callback
+ static void event_callback(Fl_Widget*, void* data) {
+ MyTable *o = (MyTable*)data;
+ o->event_callback2();
+ }
+
public:
- MyTable() // Constructor
- {
- [..]
- table.callback(&event_callback, (void*)this); // setup callback
- table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
- }
+ // Constructor
+ MyTable() {
+ [..]
+ table.callback(&event_callback, (void*)this); // setup callback
+ table.when(FL_WHEN_CHANGED|FL_WHEN_RELEASE); // when to call it
+ }
};
\endcode
*/
@@ -1063,5 +1077,5 @@ public:
#endif /*_FL_TABLE_H*/
//
-// End of "$Id: Fl_Table.H 7612 2010-05-19 07:22:37Z greg.ercolano $".
+// End of "$Id: Fl_Table.H 8301 2011-01-22 22:40:11Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.H b/plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.H
index 936eb47af..f2c3f25c0 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Table_Row.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Table_Row.H 6942 2009-11-18 12:22:51Z AlbrechtS $"
+// "$Id: Fl_Table_Row.H 8301 2011-01-22 22:40:11Z AlbrechtS $"
//
#ifndef _FL_TABLE_ROW_H
@@ -37,12 +37,10 @@
/**
A table with row selection capabilities.
- This class implements a simple table of rows and columns that specializes in
- the selection of rows. This widget is similar in behavior to a "mail subject
- browser", similar to that found in mozilla, netscape and outlook mail browsers.
-
- Most methods of importance will be found in the Fl_Table widget, such as
- Fl_Table::rows() and Fl_Table::cols().
+ This class implements a simple table with the ability to select
+ rows. This widget is similar to an Fl_Browser with columns. Most
+ methods of importance will be found in the Fl_Table widget, such
+ as Fl_Table::rows() and Fl_Table::cols().
To be useful it must be subclassed and at minimum the draw_cell()
method must be overridden to provide the content of the cells. This widget
@@ -53,7 +51,7 @@
clicked by the user. You control when events are generated based on
the values you supply for Fl_Table::when().
*/
-class Fl_Table_Row : public Fl_Table {
+class FL_EXPORT Fl_Table_Row : public Fl_Table {
public:
enum TableRowSelectMode {
SELECT_NONE, // no selection allowed
@@ -62,7 +60,7 @@ public:
};
private:
// An STL-ish vector without templates
- class CharVector {
+ class FL_EXPORT CharVector {
char *arr;
int _size;
void init() {
@@ -209,5 +207,5 @@ public:
#endif /*_FL_TABLE_ROW_H*/
//
-// End of "$Id: Fl_Table_Row.H 6942 2009-11-18 12:22:51Z AlbrechtS $".
+// End of "$Id: Fl_Table_Row.H 8301 2011-01-22 22:40:11Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
index aff3096a4..66b4d3be9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tabs.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $"
//
// Tab header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -38,8 +38,8 @@
interface that allows you to put lots and lots of buttons and
switches in a panel, as popularized by many toolkits.
- \image html tabs.gif
- \image latex tabs.eps "Fl_Tabs" width=8cm
+ \image html tabs.png
+ \image latex tabs.png "Fl_Tabs" width=8cm
Clicking the tab makes a child visible() by calling
show() on it, and all other children are made invisible
@@ -62,7 +62,11 @@
class FL_EXPORT Fl_Tabs : public Fl_Group {
Fl_Widget *value_;
Fl_Widget *push_;
- int tab_positions(int*, int*);
+ int *tab_pos; // array of x-offsets of tabs per child + 1
+ int *tab_width; // array of widths of tabs per child + 1
+ int tab_count; // array size
+ int tab_positions(); // allocate and calculate tab positions
+ void clear_tab_positions();
int tab_height();
void draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int sel=0);
protected:
@@ -77,10 +81,12 @@ public:
int push(Fl_Widget *);
Fl_Tabs(int,int,int,int,const char * = 0);
Fl_Widget *which(int event_x, int event_y);
+ ~Fl_Tabs();
+ void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
};
#endif
//
-// End of "$Id: Fl_Tabs.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Tabs.H 8101 2010-12-22 13:06:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
index 84fae40a5..630fccbb3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Buffer.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Buffer.H 7527 2010-04-18 14:33:33Z engelsman $"
+// "$Id: Fl_Text_Buffer.H 8148 2010-12-31 22:38:03Z matt $"
//
// Header file for Fl_Text_Buffer class.
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -33,24 +33,34 @@
#ifndef FL_TEXT_BUFFER_H
#define FL_TEXT_BUFFER_H
+
+#undef ASSERT_UTF8
+
+#ifdef ASSERT_UTF8
+# include
+# define IS_UTF8_ALIGNED(a) if (a && *a) assert(fl_utf8len(*(a))>0);
+# define IS_UTF8_ALIGNED2(a, b) if (b>=0 && blength()) assert(fl_utf8len(a->byte_at(b))>0);
+#else
+# define IS_UTF8_ALIGNED(a)
+# define IS_UTF8_ALIGNED2(a, b)
+#endif
+
+
/*
- Suggested UTF-8 terminology for this file:
-
- ?? "length" is the number of characters in a string
- ?? "size" is the number of bytes
- ?? "index" is the position in a string in number of characters
- ?? "offset" is the position in a strin in bytes (and must be kept on a charater boundary)
- (there seems to be no standard in Uncode documents, howevere "length" is commonly
- referencing the number of bytes. Maybe "bytes" and "glyphs" would be the most
- obvious way to describe sizes?)
-
"character size" is the size of a UTF-8 character in bytes
- "character width" is the width of a Unicode character in pixels
-
- "column" was orginally defined as a character offset from the left margin. It was
- identical to the byte offset. In UTF-8, we have neither a byte offset nor
- truly fixed width fonts. Column could be a pixel value multiplied with
+ "character width" is the width of a Unicode character in pixels
+ "column" was orginally defined as a character offset from the left margin.
+ It was identical to the byte offset. In UTF-8, we have neither a byte offset
+ nor truly fixed width fonts (*). Column could be a pixel value multiplied with
an average character width (which is a bearable approximation).
+
+ * in Unicode, there are no fixed width fonts! Even if the ASCII characters may
+ happen to be all the same width in pixels, chinese charcaters surely are not.
+ There are plenty of exceptions, like ligatures, that make special handling of
+ "fixed" character widths a nightmare. I decided to remove all references to
+ fixed fonts and see "columns" as a multiple of the average width of a
+ character in the main font.
+ - Matthias
*/
@@ -79,15 +89,6 @@ public:
*/
void set(int start, int end);
- /**
- \brief Set a regtangular selection range.
- \param start byte offset to first selected character
- \param end byte offset pointing after last selected character
- \param rectStart first selected column
- \param rectEnd last selected column +1
- */
- void set_rectangular(int start, int end, int rectStart, int rectEnd);
-
/**
\brief Updates a selection afer text was modified.
Updates an individual selection for changes in the corresponding text
@@ -97,12 +98,6 @@ public:
*/
void update(int pos, int nDeleted, int nInserted);
- /**
- \brief Returns true if the selection is rectangular.
- \return flag
- */
- char rectangular() const { return mRectangular; }
-
/**
\brief Return the byte offset to the first selected character.
\return byte offset
@@ -115,36 +110,24 @@ public:
*/
int end() const { return mEnd; }
- /**
- \brief Return the first column of the rectangular selection.
- \return first column of rectangular selection
- */
- int rect_start() const { return mRectStart; }
-
- /**
- \brief Return the last column of the rectangular selection + 1.
- \return last column of rectangular selection +1
- */
- int rect_end() const { return mRectEnd; }
-
/**
\brief Returns true if any text is selected.
\return a non-zero number if any text has been selected, or 0
if no text is selected.
*/
- char selected() const { return mSelected; }
+ bool selected() const { return mSelected; }
/**
\brief Modify the 'selected' flag.
\param b new flag
*/
- void selected(char b) { mSelected = b; }
+ void selected(bool b) { mSelected = b; }
/**
Return true if position \p pos with indentation \p dispIndex is in
the Fl_Text_Selection.
*/
- int includes(int pos, int lineStartPos, int dispIndex) const;
+ int includes(int pos) const;
/**
\brief Return the positions of this selection.
@@ -154,41 +137,33 @@ public:
*/
int position(int* start, int* end) const;
- /**
- \brief Return the positions of this rectangular selection.
- \param start return byte offset to first selected character
- \param end return byte offset pointing after last selected character
- \param isRect return if the selection is rectangular
- \param rectStart return first selected column
- \param rectEnd return last selected column +1
- \return true if selected
- */
- int position(int* start, int* end, int* isRect, int* rectStart, int* rectEnd) const;
-
protected:
- char mSelected; ///< this flag is set if any text is selected
- char mRectangular; ///< this flag is set if the selection is rectangular
int mStart; ///< byte offset to the first selected character
int mEnd; ///< byte offset to the character after the last selected character
- int mRectStart; ///< first selected column (see "column")
- int mRectEnd; ///< last selected column +1 (see "column")
+ bool mSelected; ///< this flag is set if any text is selected
};
+
typedef void (*Fl_Text_Modify_Cb)(int pos, int nInserted, int nDeleted,
int nRestyled, const char* deletedText,
void* cbArg);
+
typedef void (*Fl_Text_Predelete_Cb)(int pos, int nDeleted, void* cbArg);
/**
\brief This class manages unicode displayed in one or more Fl_Text_Display widgets.
+ All text in Fl_Text_Buffermust be encoded in UTF-8. All indices used in the
+ function calls must be aligned to the start of a UTF-8 sequence. All indices
+ and pointers returned will be aligned. All functions that return a single
+ character will return that in an unsiged int in UCS-4 encoding.
+
The Fl_Text_Buffer class is used by the Fl_Text_Display
and Fl_Text_Editor to manage complex text data and is based upon the
excellent NEdit text editor engine - see http://www.nedit.org/.
- \todo unicode check
*/
class FL_EXPORT Fl_Text_Buffer {
public:
@@ -218,13 +193,13 @@ public:
\brief Get a copy of the entire contents of the text buffer.
Memory is allocated to contain the returned string, which the caller
must free.
- \return newly allocated text buffer - must be free'd
+ \return newly allocated text buffer - must be free'd, text is utf8
*/
char* text() const;
/**
- Replaces the entire contents of the text buffer
- \todo unicode check
+ Replaces the entire contents of the text buffer.
+ \param text Text must be valid utf8.
*/
void text(const char* text);
@@ -236,37 +211,42 @@ public:
When you are done with the text, free it using the free() function.
\param start byte offset to first character
\param end byte offset after last character in range
- \return newly allocated text buffer - must be free'd
+ \return newly allocated text buffer - must be free'd, text is utf8
*/
char* text_range(int start, int end) const;
/**
Returns the character at the specified position pos in the buffer.
Positions start at 0
- \param pos byte offset into buffer
+ \param pos byte offset into buffer, pos must be at acharacter boundary
\return Unicode UCS-4 encoded character
*/
- unsigned int character(int pos) const;
+ unsigned int char_at(int pos) const;
+
+ /**
+ Returns the raw byte at the specified position pos in the buffer.
+ Positions start at 0
+ \param pos byte offset into buffer
+ \return unencoded raw byte
+ */
+ char byte_at(int pos) const;
/**
Convert a byte offset in buffer into a memory address.
+ \param pos byte offset into buffer
+ \return byte offset converted to a memory address
*/
const char *address(int pos) const
{ return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
/**
Convert a byte offset in buffer into a memory address.
+ \param pos byte offset into buffer
+ \return byte offset converted to a memory address
*/
char *address(int pos)
{ return (pos < mGapStart) ? mBuf+pos : mBuf+pos+mGapEnd-mGapStart; }
- /**
- Returns the text from the given rectangle. When you are done
- with the text, free it using the free() function.
- \todo unicode check
- */
- char* text_in_rectangle(int start, int end, int rectStart, int rectEnd) const;
-
/**
Inserts null-terminated string \p text at position \p pos.
\param pos insertion position as byte offset (must be utf-8 character aligned)
@@ -276,7 +256,7 @@ public:
/**
Appends the text string to the end of the buffer.
- \todo unicode check
+ \param t utf-8 encoded and nul terminated text
*/
void append(const char* t) { insert(length(), t); }
@@ -296,16 +276,17 @@ public:
void replace(int start, int end, const char *text);
/**
- Copies text from one buffer to this one; fromBuf may
- be the same as this.
- \todo unicode check
+ Copies text from one buffer to this one.
+ \param fromBuf source text buffer may be the same as this
+ \param fromStart byte offset into buffer
+ \param fromEnd byte offset into buffer
+ \param toPos destination byte offset into buffer
*/
void copy(Fl_Text_Buffer* fromBuf, int fromStart, int fromEnd, int toPos);
/**
Undo text modification according to the undo variables or insert text
from the undo buffer
- \todo unicode check
*/
int undo(int *cp=0);
@@ -319,23 +300,22 @@ public:
non-zero on error (strerror() contains reason). 1 indicates open
for read failed (no data loaded). 2 indicates error occurred
while reading data (data was partially loaded).
- \todo unicode check
+ File can be UTF-8 or CP1252-encoded.
+ If the input file is not UTF-8-encoded, the Fl_Text_Buffer widget will contain
+ UTF-8-transcoded data. By default, the message Fl_Text_Buffer::file_encoding_warning_message
+ will warn the user about this.
+ \see input_file_was_transcoded and transcoding_warning_action.
*/
int insertfile(const char *file, int pos, int buflen = 128*1024);
/**
- Appends the named file to the end of the buffer. Returns 0 on
- success, non-zero on error (strerror() contains reason). 1 indicates
- open for read failed (no data loaded). 2 indicates error occurred
- while reading data (data was partially loaded).
- \todo unicode check
+ Appends the named file to the end of the buffer. See also insertfile().
*/
int appendfile(const char *file, int buflen = 128*1024)
{ return insertfile(file, length(), buflen); }
/**
- Loads a text file into the buffer
- \todo unicode check
+ Loads a text file into the buffer. See also insertfile().
*/
int loadfile(const char *file, int buflen = 128*1024)
{ select(0, length()); remove_selection(); return appendfile(file, buflen); }
@@ -345,81 +325,28 @@ public:
on error (strerror() contains reason). 1 indicates open for write failed
(no data saved). 2 indicates error occurred while writing data
(data was partially saved).
- \todo unicode check
*/
int outputfile(const char *file, int start, int end, int buflen = 128*1024);
/**
Saves a text file from the current buffer
- \todo unicode check
*/
int savefile(const char *file, int buflen = 128*1024)
{ return outputfile(file, 0, length(), buflen); }
/**
- Insert \p s columnwise into buffer starting at displayed character
- position \p column on the line beginning at \p startPos. Opens a rectangular
- space the width and height of \p s, by moving all text to the right of
- \p column right. If \p charsInserted and \p charsDeleted are not NULL, the
- number of characters inserted and deleted in the operation (beginning
- at \p startPos) are returned in these arguments.
- \todo unicode check
- */
- void insert_column(int column, int startPos, const char* text,
- int* charsInserted, int* charsDeleted);
-
- /**
- Replaces a rectangular area in the buffer, given by \p start, \p end,
- \p rectStart, and \p rectEnd, with \p text. If \p text is vertically
- longer than the rectangle, add extra lines to make room for it.
- \todo unicode check
- */
- void replace_rectangular(int start, int end, int rectStart, int rectEnd,
- const char* text);
-
- /**
- Overlay \p text between displayed character positions \p rectStart and
- \p rectEnd on the line beginning at \p startPos. If \p charsInserted and
- \p charsDeleted are not NULL, the number of characters inserted and deleted
- in the operation (beginning at \p startPos) are returned in these arguments.
- \todo unicode check
- */
- void overlay_rectangular(int startPos, int rectStart, int rectEnd,
- const char* text, int* charsInserted,
- int* charsDeleted);
-
- /**
- Removes a rectangular swath of characters between character positions start
- and end and horizontal displayed-character offsets rectStart and rectEnd.
- \todo unicode check
- */
- void remove_rectangular(int start, int end, int rectStart, int rectEnd);
-
- /**
- Clears text in the specified area.
- It clears a rectangular "hole" out of the buffer between character positions
- start and end and horizontal displayed-character offsets rectStart and
- rectEnd.
- \todo unicode check
- */
- void clear_rectangular(int start, int end, int rectStart, int rectEnd);
-
- /**
Gets the tab width.
- \todo unicode check
*/
int tab_distance() const { return mTabDist; }
/**
Set the hardware tab distance (width) used by all displays for this buffer,
and used in computing offsets for rectangular selection operations.
- \todo unicode check
*/
void tab_distance(int tabDist);
/**
Selects a range of characters in the buffer.
- \todo unicode check
*/
void select(int start, int end);
@@ -430,51 +357,32 @@ public:
/**
Cancels any previous selection on the primary text selection object
- \todo unicode check
*/
void unselect();
- /**
- Achieves a rectangular selection on the primary text selection object
- \todo unicode check
- */
- void select_rectangular(int start, int end, int rectStart, int rectEnd);
-
/**
Gets the selection position
- \todo unicode check
*/
int selection_position(int* start, int* end);
/**
- Gets the selection position, and rectangular selection info
- \todo unicode check
- */
- int selection_position(int* start, int* end, int* isRect, int* rectStart,
- int* rectEnd);
-
- /**
Returns the currently selected text. When you are done with
the text, free it using the free() function.
- \todo unicode check
*/
char* selection_text();
/**
Removes the text in the primary selection.
- \todo unicode check
*/
void remove_selection();
/**
Replaces the text in the primary selection.
- \todo unicode check
*/
void replace_selection(const char* text);
/**
Selects a range of characters in the secondary selection.
- \todo unicode check
*/
void secondary_select(int start, int end);
@@ -486,53 +394,33 @@ public:
/**
Clears any selection in the secondary text selection object.
- \todo unicode check
*/
void secondary_unselect();
/**
- Achieves a rectangular selection on the secondary text selection object
- \todo unicode check
- */
- void secondary_select_rectangular(int start, int end, int rectStart,
- int rectEnd);
-
- /**
Returns the current selection in the secondary text selection object.
- \todo unicode check
*/
int secondary_selection_position(int* start, int* end);
/**
- Returns the current selection in the secondary text selection object.
- \todo unicode check
- */
- int secondary_selection_position(int* start, int* end, int* isRect,
- int* rectStart, int* rectEnd);
-
- /**
Returns the text in the secondary selection. When you are
done with the text, free it using the free() function.
- \todo unicode check
*/
char* secondary_selection_text();
/**
Removes the text from the buffer corresponding to the secondary text selection object.
- \todo unicode check
*/
void remove_secondary_selection();
/**
Replaces the text from the buffer corresponding to the secondary
text selection object with the new string \p text.
- \todo unicode check
*/
void replace_secondary_selection(const char* text);
/**
Highlights the specified text within the buffer.
- \todo unicode check
*/
void highlight(int start, int end);
@@ -544,33 +432,17 @@ public:
/**
Unhighlights text in the buffer.
- \todo unicode check
*/
void unhighlight();
- /**
- Highlights a rectangular selection in the buffer
- \todo unicode check
- */
- void highlight_rectangular(int start, int end, int rectStart, int rectEnd);
-
/**
Highlights the specified text between \p start and \p end within the buffer.
- \todo unicode check
*/
int highlight_position(int* start, int* end);
/**
- Highlights the specified rectangle of text within the buffer.
- \todo unicode check
- */
- int highlight_position(int* start, int* end, int* isRect, int* rectStart,
- int* rectEnd);
-
- /**
Returns the highlighted text. When you are done with the
text, free it using the free() function.
- \todo unicode check
*/
char* highlight_text();
@@ -583,13 +455,11 @@ public:
int nRestyled, const char* deletedText,
void* cbArg);
\endcode
- \todo unicode check
*/
void add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
/**
Removes a modify callback.
- \todo unicode check
*/
void remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void* cbArg);
@@ -597,27 +467,23 @@ public:
Calls all modify callbacks that have been registered using
the add_modify_callback()
method.
- \todo unicode check
*/
void call_modify_callbacks() { call_modify_callbacks(0, 0, 0, 0, 0); }
/**
Adds a callback routine to be called before text is deleted from the buffer.
- \todo unicode check
*/
void add_predelete_callback(Fl_Text_Predelete_Cb bufPredelCB, void* cbArg);
/**
Removes a callback routine \p bufPreDeleteCB associated with argument \p cbArg
to be called before text is deleted from the buffer.
- \todo unicode check
*/
void remove_predelete_callback(Fl_Text_Predelete_Cb predelCB, void* cbArg);
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
- \todo unicode check
*/
void call_predelete_callbacks() { call_predelete_callbacks(0, 0); }
@@ -625,13 +491,15 @@ public:
Returns the text from the entire line containing the specified
character position. When you are done with the text, free it
using the free() function.
- \todo unicode check
+ \param pos byte index into buffer
+ \return copy of utf8 text, must be free'd
*/
char* line_text(int pos) const;
/**
Returns the position of the start of the line containing position \p pos.
- \todo unicode check
+ \param pos byte index into buffer
+ \return byte offset to line start
*/
int line_start(int pos) const;
@@ -639,68 +507,30 @@ public:
Finds and returns the position of the end of the line containing position \p pos
(which is either a pointer to the newline character ending the line,
or a pointer to one character beyond the end of the buffer)
- \todo unicode check
+ \param pos byte index into buffer
+ \return byte offset to line end
*/
int line_end(int pos) const;
/**
Returns the position corresponding to the start of the word
- \todo unicode check
+ \param pos byte index into buffer
+ \return byte offset to word start
*/
int word_start(int pos) const;
/**
Returns the position corresponding to the end of the word.
- \todo unicode check
+ \param pos byte index into buffer
+ \return byte offset to word end
*/
int word_end(int pos) const;
- /**
- Expands the given character to a displayable format. Tabs and
- other control characters are given special treatment.
- Get a character from the text buffer expanded into its screen
- representation (which may be several characters for a tab or a
- control code). Returns the number of characters written to \p outStr.
- \p indent is the number of characters from the start of the line
- for figuring tabs. Output string is guranteed to be shorter or
- equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
- \todo unicode check
- */
- int expand_character(int pos, int indent, char *outStr) const;
-
- /**
- Expand a single character \p c from the text buffer into it's displayable
- screen representation (which may be several characters for a tab or a
- control code). Returns the number of characters added to \p outStr.
- \p indent is the number of characters from the start of the line
- for figuring tabs of length \p tabDist. Output string is guaranteed
- to be shorter or equal in length to FL_TEXT_MAX_EXP_CHAR_LEN
- Tabs and other control characters are given special treatment.
- \param src address of utf-8 text
- \param indent
- \param[out] outStr write substitution here
- \param tabDist
- \return number of byte in substitution
- */
- static int expand_character(const char *src, int indent, char* outStr, int tabDist);
-
- /**
- Return the length in displayed characters of character \p c expanded
- for display (as discussed above in expand_character() ).
- \param src address of utf-8 text
- \param indent
- \param tabDist
- \return number of byte in substitution
- */
- static int character_width(const char *src, int indent, int tabDist);
- static int character_width(const char c, int indent, int tabDist);
-
/**
Count the number of displayed characters between buffer position
\p lineStartPos and \p targetPos. (displayed characters are the characters
shown on the screen to represent characters in the buffer, where tabs and
control characters are expanded)
- \todo unicode check
*/
int count_displayed_characters(int lineStartPos, int targetPos) const;
@@ -711,21 +541,18 @@ public:
\param lineStartPos byte offset into buffer
\param nChars number of bytes that are sent to the display
\return byte offset in input after all output bytes are sent
- \todo unicode check
*/
int skip_displayed_characters(int lineStartPos, int nChars);
/**
Counts the number of newlines between \p startPos and \p endPos in buffer.
The character at position \p endPos is not counted.
- \todo unicode check
*/
int count_lines(int startPos, int endPos) const;
/**
Finds the first character of the line \p nLines forward from \p startPos
in the buffer and returns its position
- \todo unicode check
*/
int skip_lines(int startPos, int nLines);
@@ -733,7 +560,6 @@ public:
Finds and returns the position of the first character of the line \p nLines backwards
from \p startPos (not counting the character pointed to by \p startpos if
that is a newline) in the buffer. \p nLines == 0 means find the beginning of the line
- \todo unicode check
*/
int rewind_lines(int startPos, int nLines);
@@ -745,9 +571,12 @@ public:
BufSearchForward is that it's optimized for single characters. The
overall performance of the text widget is dependent on its ability to
count lines quickly, hence searching for a single character: newline)
- \todo unicode check
+ \param startPos byte offset to start position
+ \param searchChar UCS-4 character that we want to find
+ \param foundPos byte offset where the character was found
+ \return 1 if found, 0 if not
*/
- int findchar_forward(int startPos, char searchChar, int* foundPos) const;
+ int findchar_forward(int startPos, unsigned searchChar, int* foundPos) const;
/**
Search backwards in buffer \p buf for character \p searchChar, starting
@@ -756,33 +585,22 @@ public:
BufSearchBackward is that it's optimized for single characters. The
overall performance of the text widget is dependent on its ability to
count lines quickly, hence searching for a single character: newline)
- \todo unicode check
+ \param startPos byte offset to start position
+ \param searchChar UCS-4 character that we want to find
+ \param foundPos byte offset where the character was found
+ \return 1 if found, 0 if not
*/
- int findchar_backward(int startPos, char searchChar, int* foundPos) const;
-
- /**
- Finds the next occurrence of the specified characters.
- Search forwards in buffer for characters in \p searchChars, starting
- with the character \p startPos, and returning the result in \p foundPos
- returns 1 if found, 0 if not.
- \todo unicode check
- */
- int findchars_forward(int startPos, const char* searchChars, int* foundPos) const;
-
- /**
- Finds the previous occurrence of the specified characters.
- Search backwards in buffer for characters in \p searchChars, starting
- with the character BEFORE \p startPos, returning the result in \p foundPos
- returns 1 if found, 0 if not.
- \todo unicode check
- */
- int findchars_backward(int startPos, const char* searchChars, int* foundPos) const;
+ int findchar_backward(int startPos, unsigned int searchChar, int* foundPos) const;
/**
Search forwards in buffer for string \p searchString, starting with the
character \p startPos, and returning the result in \p foundPos
returns 1 if found, 0 if not.
- \todo unicode check
+ \param startPos byte offset to start position
+ \param searchString utf8 string that we want to find
+ \param foundPos byte offset where the string was found
+ \param matchCase if set, match character case
+ \return 1 if found, 0 if not
*/
int search_forward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0) const;
@@ -791,7 +609,11 @@ public:
Search backwards in buffer for string searchCharssearchString, starting with the
character BEFORE \p startPos, returning the result in \p foundPos
returns 1 if found, 0 if not.
- \todo unicode check
+ \param startPos byte offset to start position
+ \param searchString utf8 string that we want to find
+ \param foundPos byte offset where the string was found
+ \param matchCase if set, match character case
+ \return 1 if found, 0 if not
*/
int search_backward(int startPos, const char* searchString, int* foundPos,
int matchCase = 0) const;
@@ -816,12 +638,51 @@ public:
*/
const Fl_Text_Selection* highlight_selection() const { return &mHighlight; }
+ /**
+ Returns the index of the previous character.
+ \param ix index to the current char
+ */
+ int prev_char(int ix) const;
+ int prev_char_clipped(int ix) const;
+
+ /**
+ Returns the index of the next character.
+ \param ix index to the current char
+ */
+ int next_char(int ix) const;
+ int next_char_clipped(int ix) const;
+
+ /**
+ Align an index into the buffer to the current or previous utf8 boundary.
+ */
+ int utf8_align(int) const;
+
+ /**
+ \brief true iff the loaded file has been transcoded to UTF-8
+ */
+ int input_file_was_transcoded;
+
+ /** This message may be displayed using the fl_alert() function when a file
+ which was not UTF-8 encoded is input.
+ */
+ static const char* file_encoding_warning_message;
+
+ /**
+ \brief Pointer to a function called after reading a non UTF-8 encoded file.
+
+ This function is called after reading a file if the file content
+ was transcoded to UTF-8. Its default implementation calls fl_alert()
+ with the text of \ref file_encoding_warning_message. No warning message is
+ displayed if this pointer is set to NULL. Use \ref input_file_was_transcoded
+ to be informed if file input required transcoding to UTF-8.
+ */
+ void (*transcoding_warning_action)(Fl_Text_Buffer*);
+
protected:
/**
Calls the stored modify callback procedure(s) for this buffer to update the
changed area(s) on the screen and any other listeners.
- \todo unicode check
*/
void call_modify_callbacks(int pos, int nDeleted, int nInserted,
int nRestyled, const char* deletedText) const;
@@ -829,7 +690,6 @@ protected:
/**
Calls the stored pre-delete callback procedure(s) for this buffer to update
the changed area(s) on the screen and any other listeners.
- \todo unicode check
*/
void call_predelete_callbacks(int pos, int nDeleted) const;
@@ -839,7 +699,7 @@ protected:
expensive and the length will be required by any caller who will continue
on to call redisplay). \p pos must be contiguous with the existing text in
the buffer (i.e. not past the end).
- \todo unicode check
+ \return the number of bytes inserted
*/
int insert_(int pos, const char* text);
@@ -847,64 +707,24 @@ protected:
Internal (non-redisplaying) version of BufRemove. Removes the contents
of the buffer between start and end (and moves the gap to the site of
the delete).
- \todo unicode check
*/
void remove_(int start, int end);
- /**
- Deletes a rectangle of text without calling the modify callbacks. Returns
- the number of characters replacing those between \p start and \p end. Note that
- in some pathological cases, deleting can actually increase the size of
- the buffer because of tab expansions. \p endPos returns the buffer position
- of the point in the last line where the text was removed (as a hint for
- routines which need to position the cursor after a delete operation)
- \todo unicode check
- */
- void remove_rectangular_(int start, int end, int rectStart, int rectEnd,
- int* replaceLen, int* endPos);
-
- /**
- Inserts a column of text without calling the modify callbacks. Note that
- in some pathological cases, inserting can actually decrease the size of
- the buffer because of spaces being coalesced into tabs. \p nDeleted and
- \p nInserted return the number of characters deleted and inserted beginning
- at the start of the line containing \p startPos. \p endPos returns buffer
- position of the lower left edge of the inserted column (as a hint for
- routines which need to set a cursor position).
- \todo unicode check
- */
- void insert_column_(int column, int startPos, const char* insText,
- int* nDeleted, int* nInserted, int* endPos);
-
- /**
- Overlay a rectangular area of text without calling the modify callbacks.
- \p nDeleted and \p nInserted return the number of characters deleted and
- inserted beginning at the start of the line containing \p startPos.
- \p endPos returns buffer position of the lower left edge of the inserted
- column (as a hint for routines which need to set a cursor position).
- \todo unicode check
- */
- void overlay_rectangular_(int startPos, int rectStart, int rectEnd,
- const char* insText, int* nDeleted,
- int* nInserted, int* endPos);
-
/**
Calls the stored redisplay procedure(s) for this buffer to update the
screen for a change in a selection.
- \todo unicode check
*/
void redisplay_selection(Fl_Text_Selection* oldSelection,
Fl_Text_Selection* newSelection) const;
/**
- \todo unicode check
+ Move the gap to start at a new position.
*/
void move_gap(int pos);
/**
Reallocates the text storage in the buffer to have a gap starting at \p newGapStart
and a gap size of \p newGapLen, preserving the buffer's current contents.
- \todo unicode check
*/
void reallocate_with_gap(int newGapStart, int newGapLen);
@@ -912,38 +732,16 @@ protected:
/**
Removes the text from the buffer corresponding to \p sel.
- \todo unicode check
*/
void remove_selection_(Fl_Text_Selection* sel);
/**
Replaces the \p text in selection \p sel.
- \todo unicode check
*/
void replace_selection_(Fl_Text_Selection* sel, const char* text);
- /**
- Finds the first and last character position in a line within a rectangular
- selection (for copying). Includes tabs which cross rectStart, but not
- control characters which do so. Leaves off tabs which cross rectEnd.
-
- Technically, the calling routine should convert tab characters which
- cross the right boundary of the selection to spaces which line up with
- the edge of the selection. Unfortunately, the additional memory
- management required in the parent routine to allow for the changes
- in string size is not worth all the extra work just for a couple of
- shifted characters, so if a tab protrudes, just lop it off and hope
- that there are other characters in the selection to establish the right
- margin for subsequent columnar pastes of this data.
- \todo unicode check
- */
- void rectangular_selection_boundaries(int lineStartPos, int rectStart,
- int rectEnd, int* selStart,
- int* selEnd) const;
-
/**
Updates all of the selections in the buffer for changes in the buffer's text
- \todo unicode check
*/
void update_selections(int pos, int nDeleted, int nInserted);
@@ -959,15 +757,13 @@ protected:
// The hardware tab distance used by all displays for this buffer,
// and used in computing offsets for rectangular selection operations.
int mTabDist; /**< equiv. number of characters in a tab */
- int mUseTabs; /**< True if buffer routines are allowed to use
- tabs for padding in rectangular operations */
int mNModifyProcs; /**< number of modify-redisplay procs attached */
- Fl_Text_Modify_Cb* /**< procedures to call when buffer is */
- mModifyProcs; /**< modified to redisplay contents */
+ Fl_Text_Modify_Cb *mModifyProcs;/**< procedures to call when buffer is
+ modified to redisplay contents */
void** mCbArgs; /**< caller arguments for modifyProcs above */
int mNPredeleteProcs; /**< number of pre-delete procs attached */
- Fl_Text_Predelete_Cb* /**< procedure to call before text is deleted */
- mPredeleteProcs; /**< from the buffer; at most one is supported. */
+ Fl_Text_Predelete_Cb *mPredeleteProcs; /**< procedure to call before text is deleted
+ from the buffer; at most one is supported. */
void **mPredeleteCbArgs; /**< caller argument for pre-delete proc above */
int mCursorPosHint; /**< hint for reasonable cursor position after
a buffer modification operation */
@@ -981,5 +777,5 @@ protected:
#endif
//
-// End of "$Id: Fl_Text_Buffer.H 7527 2010-04-18 14:33:33Z engelsman $".
+// End of "$Id: Fl_Text_Buffer.H 8148 2010-12-31 22:38:03Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
index 71bbd229d..c9b91f1f1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Display.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Display.H 7527 2010-04-18 14:33:33Z engelsman $"
+// "$Id: Fl_Text_Display.H 8306 2011-01-24 17:04:22Z matt $"
//
// Header file for Fl_Text_Display class.
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -28,7 +28,7 @@
//
/* \file
- Fl_Text_Display widget . */
+ Fl_Text_Display widget . */
#ifndef FL_TEXT_DISPLAY_H
#define FL_TEXT_DISPLAY_H
@@ -40,305 +40,441 @@
#include "Fl_Text_Buffer.H"
/**
- This is the FLTK text display widget. It allows the user to
- view multiple lines of text and supports highlighting and
- scrolling. The buffer that is displayed in the widget is managed
- by the Fl_Text_Buffer
- class.
-*/
+ \brief Rich text display widget.
+
+ This is the FLTK text display widget. It allows the user to view multiple lines
+ of text and supports highlighting and scrolling. The buffer that is displayed
+ in the widget is managed by the Fl_Text_Buffer class. A single Text Buffer
+ can be displayed by multiple Text Displays.
+ */
class FL_EXPORT Fl_Text_Display: public Fl_Group {
- public:
- /** text display cursor shapes enumeration */
- enum {
- NORMAL_CURSOR, CARET_CURSOR, DIM_CURSOR,
- BLOCK_CURSOR, HEAVY_CURSOR
- };
- enum {
- CURSOR_POS, CHARACTER_POS
- };
-
- /** drag types- they match Fl::event_clicks() so that single clicking to
- start a collection selects by character, double clicking selects by
- word and triple clicking selects by line.
- */
- enum {
- DRAG_CHAR = 0, DRAG_WORD = 1, DRAG_LINE = 2
- };
- friend void fl_text_drag_me(int pos, Fl_Text_Display* d);
-
- typedef void (*Unfinished_Style_Cb)(int, void *);
-
- /** style attributes - currently not implemented! */
- enum {
- ATTR_NONE = 0,
- ATTR_UNDERLINE = 1,
- ATTR_HIDDEN = 2
- };
- /** This structure associates the color,font,size of a string to draw
- with an attribute mask matching attr */
- struct Style_Table_Entry {
- Fl_Color color;
- Fl_Font font;
- int size;
- unsigned attr;
- };
-
- Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0);
- ~Fl_Text_Display();
-
- virtual int handle(int e);
- void buffer(Fl_Text_Buffer* buf);
+public:
+
+ /**
+ text display cursor shapes enumeration
+ */
+ enum {
+ NORMAL_CURSOR, /**< I-beam */
+ CARET_CURSOR, /**< caret under the text */
+ DIM_CURSOR, /**< dim I-beam */
+ BLOCK_CURSOR, /**< unfille box under the current character */
+ HEAVY_CURSOR /**< thick I-beam */
+ };
+
/**
- Sets or gets the current text buffer associated with the text widget.
- Multiple text widgets can be associated with the same text buffer.
- */
- void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
- /**
- Gets the current text buffer associated with the text widget.
- Multiple text widgets can be associated with the same text buffer.
- */
- Fl_Text_Buffer* buffer() const { return mBuffer; }
- void redisplay_range(int start, int end);
- void scroll(int topLineNum, int horizOffset);
- void insert(const char* text);
- void overstrike(const char* text);
- void insert_position(int newPos);
- /** Gets the position of the text insertion cursor for text display */
- int insert_position() const { return mCursorPos; }
- int in_selection(int x, int y) const;
- void show_insert_position();
- int move_right();
- int move_left();
- int move_up();
- int move_down();
- int count_lines(int start, int end, bool start_pos_is_line_start) const;
- int line_start(int pos) const;
- int line_end(int pos, bool start_pos_is_line_start) const;
- int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
- int rewind_lines(int startPos, int nLines);
- void next_word(void);
- void previous_word(void);
- void show_cursor(int b = 1);
- /** Hides the text cursor */
- void hide_cursor() { show_cursor(0); }
- void cursor_style(int style);
- /** Sets or gets the text cursor color. */
- Fl_Color cursor_color() const {return mCursor_color;}
- /** Sets or gets the text cursor color. */
- void cursor_color(Fl_Color n) {mCursor_color = n;}
- /** Sets or gets the width/height of the scrollbars. */
- int scrollbar_width() const { return scrollbar_width_; }
- /** Sets or gets the width/height of the scrollbars. */
- void scrollbar_width(int W) { scrollbar_width_ = W; }
- /** Gets the scrollbar alignment type */
- Fl_Align scrollbar_align() const { return scrollbar_align_; }
- /** Sets the scrollbar alignment type */
- void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
- /** Moves the insert position to the beginning of the current word. */
- int word_start(int pos) const { return buffer()->word_start(pos); }
- /** Moves the insert position to the end of the current word. */
- int word_end(int pos) const { return buffer()->word_end(pos); }
+ the character position is the left edge of a character, whereas
+ the cursor is thought to be between the centers of two consecutive
+ characters.
+ */
+ enum {
+ CURSOR_POS,
+ CHARACTER_POS
+ };
+
+ /**
+ drag types - they match Fl::event_clicks() so that single clicking to
+ start a collection selects by character, double clicking selects by
+ word and triple clicking selects by line.
+ */
+ enum {
+ DRAG_NONE = -2,
+ DRAG_START_DND = -1,
+ DRAG_CHAR = 0,
+ DRAG_WORD = 1,
+ DRAG_LINE = 2
+ };
+
+ /**
+ wrap types - used in wrap_mode()
+ */
+ enum {
+ 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 */
+ WRAP_AT_BOUNDS /**< wrap text so that it fits into the widget width */
+ };
+
+ friend void fl_text_drag_me(int pos, Fl_Text_Display* d);
+
+ typedef void (*Unfinished_Style_Cb)(int, void *);
+
+ /**
+ This structure associates the color, font, andsize of a string to draw
+ with an attribute mask matching attr
+ */
+ struct Style_Table_Entry {
+ Fl_Color color;
+ Fl_Font font;
+ Fl_Fontsize size;
+ unsigned attr;
+ };
+
+ Fl_Text_Display(int X, int Y, int W, int H, const char *l = 0);
+ ~Fl_Text_Display();
+
+ virtual int handle(int e);
+
+ void buffer(Fl_Text_Buffer* buf);
+
+ /**
+ Sets the current text buffer associated with the text widget.
+ Multiple text widgets can be associated with the same text buffer.
+ \param buf new text buffer
+ */
+ void buffer(Fl_Text_Buffer& buf) { buffer(&buf); }
+
+ /**
+ Gets the current text buffer associated with the text widget.
+ Multiple text widgets can be associated with the same text buffer.
+ \return current text buffer
+ */
+ Fl_Text_Buffer* buffer() const { return mBuffer; }
+
+ void redisplay_range(int start, int end);
+ void scroll(int topLineNum, int horizOffset);
+ void insert(const char* text);
+ void overstrike(const char* text);
+ void insert_position(int newPos);
+
+ /**
+ Gets the position of the text insertion cursor for text display.
+ \return insert position index into text buffer
+ */
+ int insert_position() const { return mCursorPos; }
+ int position_to_xy(int pos, int* x, int* y) const;
-
- void highlight_data(Fl_Text_Buffer *styleBuffer,
- const Style_Table_Entry *styleTable,
- int nStyles, char unfinishedStyle,
- Unfinished_Style_Cb unfinishedHighlightCB,
- void *cbArg);
+ int in_selection(int x, int y) const;
+ void show_insert_position();
+
+ int move_right();
+ int move_left();
+ int move_up();
+ int move_down();
+ int count_lines(int start, int end, bool start_pos_is_line_start) const;
+ int line_start(int pos) const;
+ int line_end(int startPos, bool startPosIsLineStart) const;
+ int skip_lines(int startPos, int nLines, bool startPosIsLineStart);
+ int rewind_lines(int startPos, int nLines);
+ void next_word(void);
+ void previous_word(void);
+
+ void show_cursor(int b = 1);
+
+ /**
+ Hides the text cursor.
+ */
+ void hide_cursor() { show_cursor(0); }
+
+ void cursor_style(int style);
+
+ /**
+ Gets the text cursor color.
+ \return cursor color
+ */
+ Fl_Color cursor_color() const {return mCursor_color;}
+
+ /**
+ Sets the text cursor color.
+ \param n new cursor color
+ */
+ void cursor_color(Fl_Color n) {mCursor_color = n;}
+
+ /**
+ Gets the width/height of the scrollbars.
+ /return width of scrollbars
+ */
+ int scrollbar_width() const { return scrollbar_width_; }
+
+ /**
+ Sets the width/height of the scrollbars.
+ \param W width of scrollbars
+ */
+ void scrollbar_width(int W) { scrollbar_width_ = W; }
+
+ /**
+ Gets the scrollbar alignment type.
+ \return scrollbar alignment
+ */
+ Fl_Align scrollbar_align() const { return scrollbar_align_; }
+
+ /**
+ Sets the scrollbar alignment type.
+ \param a new scrollbar alignment
+ */
+ void scrollbar_align(Fl_Align a) { scrollbar_align_ = a; }
+
+ /**
+ Moves the insert position to the beginning of the current word.
+ \param pos start calculation at this index
+ \return beginning of the words
+ */
+ int word_start(int pos) const { return buffer()->word_start(pos); }
+
+ /**
+ Moves the insert position to the end of the current word.
+ \param pos start calculation at this index
+ \return index of first character after the end of the word
+ */
+ int word_end(int pos) const { return buffer()->word_end(pos); }
+
+
+ void highlight_data(Fl_Text_Buffer *styleBuffer,
+ const Style_Table_Entry *styleTable,
+ int nStyles, char unfinishedStyle,
+ Unfinished_Style_Cb unfinishedHighlightCB,
+ void *cbArg);
+
+ int position_style(int lineStartPos, int lineLen, int lineIndex) const;
+
+ /**
+ \todo FIXME : get set methods pointing on shortcut_
+ have no effects as shortcut_ is unused in this class and derived!
+ \return the current shortcut key
+ */
+ int shortcut() const {return shortcut_;}
+
+ /**
+ \todo FIXME : get set methods pointing on shortcut_
+ have no effects as shortcut_ is unused in this class and derived!
+ \param s the new shortcut key
+ */
+ void shortcut(int s) {shortcut_ = s;}
+
+ /**
+ Gets the default font used when drawing text in the widget.
+ \return current text font face unless overridden by a style
+ */
+ Fl_Font textfont() const {return textfont_;}
+
+ /**
+ Sets the default font used when drawing text in the widget.
+ \param s default text font face
+ */
+ void textfont(Fl_Font s) {textfont_ = s; mColumnScale = 0;}
+
+ /**
+ Gets the default size of text in the widget.
+ \return current text height unless overridden by a style
+ */
+ Fl_Fontsize textsize() const {return textsize_;}
+
+ /**
+ Sets the default size of text in the widget.
+ \param s new text size
+ */
+ void textsize(Fl_Fontsize s) {textsize_ = s; mColumnScale = 0;}
+
+ /**
+ Gets the default color of text in the widget.
+ \return text color unless overridden by a style
+ */
+ Fl_Color textcolor() const {return textcolor_;}
+
+ /**
+ Sets the default color of text in the widget.
+ \param n new text color
+ */
+ void textcolor(Fl_Color n) {textcolor_ = n;}
+
+ int wrapped_column(int row, int column) const;
+ int wrapped_row(int row) const;
+ void wrap_mode(int wrap, int wrap_margin);
+
+ virtual void resize(int X, int Y, int W, int H);
- int position_style(int lineStartPos, int lineLen, int lineIndex,
- int dispIndex) const;
- /** \todo FIXME : get set methods pointing on shortcut_
- have no effects as shortcut_ is unused in this class and derived! */
- int shortcut() const {return shortcut_;}
- /** \todo FIXME : get set methods pointing on shortcut_
- have no effects as shortcut_ is unused in this class and derived! */
- void shortcut(int s) {shortcut_ = s;}
-
- /** Gets the default font used when drawing text in the widget. */
- Fl_Font textfont() const {return textfont_;}
- /** Sets the default font used when drawing text in the widget. */
- void textfont(Fl_Font s) {textfont_ = s;}
- /** Gets the default size of text in the widget. */
- Fl_Fontsize textsize() const {return textsize_;}
- /** Sets the default size of text in the widget. */
- void textsize(Fl_Fontsize s) {textsize_ = s;}
- /** Gets the default color of text in the widget. */
- Fl_Color textcolor() const {return textcolor_;}
- /** Sets the default color of text in the widget. */
- void textcolor(Fl_Color n) {textcolor_ = n;}
-
- int wrapped_column(int row, int column) const;
- int wrapped_row(int row) const;
- void wrap_mode(int wrap, int wrap_margin);
-
- virtual void resize(int X, int Y, int W, int H);
-
- protected:
- // Most (all?) of this stuff should only be called from resize() or
- // draw().
- // Anything with "vline" indicates thats it deals with currently
- // visible lines.
-
- virtual void draw();
- void draw_text(int X, int Y, int W, int H);
- void draw_range(int start, int end);
- void draw_cursor(int, int);
-
- void draw_string(int style, int x, int y, int toX, const char *string,
- int nChars);
-
- void draw_vline(int visLineNum, int leftClip, int rightClip,
- int leftCharIndex, int rightCharIndex);
-
- void draw_line_numbers(bool clearAll);
-
- void clear_rect(int style, int x, int y, int width, int height);
- void display_insert();
-
- void offset_line_starts(int newTopLineNum);
-
- void calc_line_starts(int startLine, int endLine);
-
- void update_line_starts(int pos, int charsInserted, int charsDeleted,
- int linesInserted, int linesDeleted, int *scrolled);
-
- void calc_last_char();
-
- int position_to_line( int pos, int* lineNum ) const;
- int string_width(const char* string, int length, int style) const;
-
- static void scroll_timer_cb(void*);
-
- static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
- static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
- int nRestyled, const char* deletedText,
- void* cbArg);
-
- static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display* d);
- static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display* d);
- void update_v_scrollbar();
- void update_h_scrollbar();
- int measure_vline(int visLineNum) const;
- int longest_vline() const;
- int empty_vlines() const;
- int vline_length(int visLineNum) const;
- int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const;
-
- void xy_to_rowcol(int x, int y, int* row, int* column,
- int PosType = CHARACTER_POS) const;
-
- int position_to_xy(int pos, int* x, int* y) const;
- void maintain_absolute_top_line_number(int state);
- int get_absolute_top_line_number() const;
- void absolute_top_line_number(int oldFirstChar);
- int maintaining_absolute_top_line_number() const;
- void reset_absolute_top_line_number();
- int position_to_linecol(int pos, int* lineNum, int* column) const;
- void scroll_(int topLineNum, int horizOffset);
-
- void extend_range_for_styles(int* start, int* end);
-
- void find_wrap_range(const char *deletedText, int pos, int nInserted,
- int nDeleted, int *modRangeStart, int *modRangeEnd,
- int *linesInserted, int *linesDeleted);
- void measure_deleted_lines(int pos, int nDeleted);
- void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos,
- int maxLines, bool startPosIsLineStart,
- int styleBufOffset, int *retPos, int *retLines,
- int *retLineStart, int *retLineEnd,
- bool countLastLineMissingNewLine = true) const;
- void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
- int *nextLineStart) const;
- int measure_proportional_character(const char *s, int colNum, int pos) const;
- int wrap_uses_character(int lineEndPos) const;
- int range_touches_selection(const Fl_Text_Selection *sel, int rangeStart,
- int rangeEnd) const;
-#ifndef FL_DOXYGEN
- int damage_range1_start, damage_range1_end;
- int damage_range2_start, damage_range2_end;
- int mCursorPos;
- int mCursorOn;
- int mCursorOldY; /* Y pos. of cursor for blanking */
- int mCursorToHint; /* Tells the buffer modified callback
- where to move the cursor, to reduce
- the number of redraw calls */
- int mCursorStyle; /* One of enum cursorStyles above */
- int mCursorPreferredCol; /* Column for vert. cursor movement */
- int mNVisibleLines; /* # of visible (displayed) lines */
- int mNBufferLines; /* # of newlines in the buffer */
- Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
- Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
- color and font information */
- int mFirstChar, mLastChar; /* Buffer positions of first and last
- displayed character (lastChar points
- either to a newline or one character
- beyond the end of the buffer) */
- int mContinuousWrap; /* Wrap long lines when displaying */
- int mWrapMargin; /* Margin in # of char positions for
- wrapping in continuousWrap mode */
- int* mLineStarts;
- int mTopLineNum; /* Line number of top displayed line
- of file (first line of file is 1) */
- int mAbsTopLineNum; /* In continuous wrap mode, the line
- number of the top line if the text
- were not wrapped (note that this is
- only maintained as needed). */
- int mNeedAbsTopLineNum; /* Externally settable flag to continue
- maintaining absTopLineNum even if
- it isn't needed for line # display */
- int mHorizOffset; /* Horizontal scroll pos. in pixels */
- int mTopLineNumHint; /* Line number of top displayed line
- of file (first line of file is 1) */
- int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
- int mNStyles; /* Number of entries in styleTable */
- const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
- coloring/syntax-highlighting */
- char mUnfinishedStyle; /* Style buffer entry which triggers
- on-the-fly reparsing of region */
- Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
- /* regions */
- void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
-
- int mMaxsize;
-
- int mFixedFontWidth; /* Font width if all current fonts are
- fixed and match in width, else -1 */
- int mSuppressResync; /* Suppress resynchronization of line
- starts during buffer updates */
- int mNLinesDeleted; /* Number of lines deleted during
- buffer modification (only used
- when resynchronization is suppressed) */
- int mModifyingTabDistance; /* Whether tab distance is being
- modified */
-
- Fl_Color mCursor_color;
-
- Fl_Scrollbar* mHScrollBar;
- Fl_Scrollbar* mVScrollBar;
- int scrollbar_width_;
- Fl_Align scrollbar_align_;
- int dragPos, dragType, dragging;
- int display_insert_position_hint;
- struct { int x, y, w, h; } text_area;
-
- int shortcut_;
-
- Fl_Font textfont_;
- Fl_Fontsize textsize_;
- Fl_Color textcolor_;
-
- // The following are not presently used from the original NEdit code,
- // but are being put here so that future versions of Fl_Text_Display
- // can implement line numbers without breaking binary compatibility.
- int mLineNumLeft, mLineNumWidth;
- /* Line number margin and width */
-#endif
+ /**
+ Convert an x pixel position into a column number.
+ \param x number of pixels from the left margin
+ \return an approximate column number based on the main font
+ */
+ double x_to_col(double x) const;
+
+ /**
+ Convert a column number into an x pixel position.
+ \param col an approximate column number based on the main font
+ \return number of pixels from the left margin to the left of an
+ average sized character
+ */
+ double col_to_x(double col) const;
+
+protected:
+ // Most (all?) of this stuff should only be called from resize() or
+ // draw().
+ // Anything with "vline" indicates thats it deals with currently
+ // visible lines.
+
+ virtual void draw();
+ void draw_text(int X, int Y, int W, int H);
+ void draw_range(int start, int end);
+ void draw_cursor(int, int);
+
+ void draw_string(int style, int x, int y, int toX, const char *string,
+ int nChars) const;
+
+ void draw_vline(int visLineNum, int leftClip, int rightClip,
+ int leftCharIndex, int rightCharIndex);
+
+ int find_x(const char *s, int len, int style, int x) const;
+
+ enum {
+ DRAW_LINE,
+ FIND_INDEX,
+ FIND_INDEX_FROM_ZERO,
+ GET_WIDTH
+ };
+
+ int handle_vline(int mode,
+ int lineStart, int lineLen, int leftChar, int rightChar,
+ int topClip, int bottomClip,
+ int leftClip, int rightClip) const;
+
+ void draw_line_numbers(bool clearAll);
+
+ void clear_rect(int style, int x, int y, int width, int height) const;
+ void display_insert();
+
+ void offset_line_starts(int newTopLineNum);
+
+ void calc_line_starts(int startLine, int endLine);
+
+ void update_line_starts(int pos, int charsInserted, int charsDeleted,
+ int linesInserted, int linesDeleted, int *scrolled);
+
+ void calc_last_char();
+
+ int position_to_line( int pos, int* lineNum ) const;
+ double string_width(const char* string, int length, int style) const;
+
+ static void scroll_timer_cb(void*);
+
+ static void buffer_predelete_cb(int pos, int nDeleted, void* cbArg);
+ static void buffer_modified_cb(int pos, int nInserted, int nDeleted,
+ int nRestyled, const char* deletedText,
+ void* cbArg);
+
+ static void h_scrollbar_cb(Fl_Scrollbar* w, Fl_Text_Display* d);
+ static void v_scrollbar_cb( Fl_Scrollbar* w, Fl_Text_Display* d);
+ void update_v_scrollbar();
+ void update_h_scrollbar();
+ int measure_vline(int visLineNum) const;
+ int longest_vline() const;
+ int empty_vlines() const;
+ int vline_length(int visLineNum) const;
+ int xy_to_position(int x, int y, int PosType = CHARACTER_POS) const;
+
+ void xy_to_rowcol(int x, int y, int* row, int* column,
+ int PosType = CHARACTER_POS) const;
+ void maintain_absolute_top_line_number(int state);
+ int get_absolute_top_line_number() const;
+ void absolute_top_line_number(int oldFirstChar);
+ int maintaining_absolute_top_line_number() const;
+ void reset_absolute_top_line_number();
+ int position_to_linecol(int pos, int* lineNum, int* column) const;
+ int scroll_(int topLineNum, int horizOffset);
+
+ void extend_range_for_styles(int* start, int* end);
+
+ void find_wrap_range(const char *deletedText, int pos, int nInserted,
+ int nDeleted, int *modRangeStart, int *modRangeEnd,
+ int *linesInserted, int *linesDeleted);
+ void measure_deleted_lines(int pos, int nDeleted);
+ void wrapped_line_counter(Fl_Text_Buffer *buf, int startPos, int maxPos,
+ int maxLines, bool startPosIsLineStart,
+ int styleBufOffset, int *retPos, int *retLines,
+ int *retLineStart, int *retLineEnd,
+ bool countLastLineMissingNewLine = true) const;
+ void find_line_end(int pos, bool start_pos_is_line_start, int *lineEnd,
+ int *nextLineStart) const;
+ double measure_proportional_character(const char *s, int colNum, int pos) const;
+ int wrap_uses_character(int lineEndPos) const;
+
+ int damage_range1_start, damage_range1_end;
+ int damage_range2_start, damage_range2_end;
+ int mCursorPos;
+ int mCursorOn;
+ int mCursorOldY; /* Y pos. of cursor for blanking */
+ int mCursorToHint; /* Tells the buffer modified callback
+ where to move the cursor, to reduce
+ the number of redraw calls */
+ int mCursorStyle; /* One of enum cursorStyles above */
+ int mCursorPreferredXPos; /* Pixel position for vert. cursor movement */
+ int mNVisibleLines; /* # of visible (displayed) lines */
+ int mNBufferLines; /* # of newlines in the buffer */
+ Fl_Text_Buffer* mBuffer; /* Contains text to be displayed */
+ Fl_Text_Buffer* mStyleBuffer; /* Optional parallel buffer containing
+ color and font information */
+ int mFirstChar, mLastChar; /* Buffer positions of first and last
+ displayed character (lastChar points
+ either to a newline or one character
+ beyond the end of the buffer) */
+ int mContinuousWrap; /* Wrap long lines when displaying */
+ int mWrapMarginPix; /* Margin in # of pixels for
+ wrapping in continuousWrap mode */
+ int* mLineStarts;
+ int mTopLineNum; /* Line number of top displayed line
+ of file (first line of file is 1) */
+ int mAbsTopLineNum; /* In continuous wrap mode, the line
+ number of the top line if the text
+ were not wrapped (note that this is
+ only maintained as needed). */
+ int mNeedAbsTopLineNum; /* Externally settable flag to continue
+ maintaining absTopLineNum even if
+ it isn't needed for line # display */
+ int mHorizOffset; /* Horizontal scroll pos. in pixels */
+ int mTopLineNumHint; /* Line number of top displayed line
+ of file (first line of file is 1) */
+ int mHorizOffsetHint; /* Horizontal scroll pos. in pixels */
+ int mNStyles; /* Number of entries in styleTable */
+ const Style_Table_Entry *mStyleTable; /* Table of fonts and colors for
+ coloring/syntax-highlighting */
+ char mUnfinishedStyle; /* Style buffer entry which triggers
+ on-the-fly reparsing of region */
+ Unfinished_Style_Cb mUnfinishedHighlightCB; /* Callback to parse "unfinished" */
+ /* regions */
+ void* mHighlightCBArg; /* Arg to unfinishedHighlightCB */
+
+ int mMaxsize;
+
+ int mSuppressResync; /* Suppress resynchronization of line
+ starts during buffer updates */
+ int mNLinesDeleted; /* Number of lines deleted during
+ buffer modification (only used
+ when resynchronization is suppressed) */
+ int mModifyingTabDistance; /* Whether tab distance is being
+ modified */
+
+ mutable double mColumnScale; /* Width in pixels of an average character. This
+ value is calculated as needed (lazy eval); it
+ needs to be mutable so that it can be calculated
+ within a method marked as "const" */
+
+ Fl_Color mCursor_color;
+
+ Fl_Scrollbar* mHScrollBar;
+ Fl_Scrollbar* mVScrollBar;
+ int scrollbar_width_;
+ Fl_Align scrollbar_align_;
+ int dragPos, dragType, dragging;
+ int display_insert_position_hint;
+ struct { int x, y, w, h; } text_area;
+
+ int shortcut_;
+
+ Fl_Font textfont_;
+ Fl_Fontsize textsize_;
+ Fl_Color textcolor_;
+
+ // The following are not presently used from the original NEdit code,
+ // but are being put here so that future versions of Fl_Text_Display
+ // can implement line numbers without breaking binary compatibility.
+
+ /* Line number margin and width */
+ int mLineNumLeft, mLineNumWidth;
};
#endif
//
-// End of "$Id: Fl_Text_Display.H 7527 2010-04-18 14:33:33Z engelsman $".
+// End of "$Id: Fl_Text_Display.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
index be3b718a3..40f9e6be2 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Text_Editor.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Text_Editor.H 6893 2009-09-20 19:24:24Z greg.ercolano $"
+// "$Id: Fl_Text_Editor.H 7903 2010-11-28 21:06:39Z matt $"
//
// Header file for Fl_Text_Editor class.
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -136,6 +136,6 @@ class FL_EXPORT Fl_Text_Editor : public Fl_Text_Display {
#endif
//
-// End of "$Id: Fl_Text_Editor.H 6893 2009-09-20 19:24:24Z greg.ercolano $".
+// End of "$Id: Fl_Text_Editor.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
index 1d9c9174c..c83d2ec1f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tile.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Tile header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,8 +37,8 @@
The Fl_Tile class lets you resize the children by dragging
the border between them:
- \image html Fl_Tile.gif
- \image latex Fl_Tile.eps "Fl_Tile" width=4cm
+ \image html Fl_Tile.png
+ \image latex Fl_Tile.png "Fl_Tile" width=4cm
For the tiling to work correctly, the children of an
Fl_Tile must cover the entire area of the widget, but not
@@ -98,5 +98,5 @@ public:
#endif
//
-// End of "$Id: Fl_Tile.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Tile.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
index bff39e251..d16937989 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tiled_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Tiled_Image.H 7903 2010-11-28 21:06:39Z matt $"
//
// Tiled image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -66,5 +66,5 @@ class FL_EXPORT Fl_Tiled_Image : public Fl_Image {
#endif // !Fl_Tiled_Image_H
//
-// End of "$Id: Fl_Tiled_Image.H 6614 2009-01-01 16:11:32Z matt $"
+// End of "$Id: Fl_Tiled_Image.H 7903 2010-11-28 21:06:39Z matt $"
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H b/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
index 5af7bc612..952273ffb 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Timer.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Timer.H 7903 2010-11-28 21:06:39Z matt $"
//
// Timer header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -82,6 +82,6 @@ public:
#endif
//
-// End of "$Id: Fl_Timer.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Timer.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
index c7f48a7cc..eaf821b42 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Toggle_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $"
//
// Toggle button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -42,7 +42,7 @@
control exactly when and how by changing the values for type()
and when().
*/
-class Fl_Toggle_Button : public Fl_Button {
+class FL_EXPORT Fl_Toggle_Button : public Fl_Button {
public:
/**
Creates a new Fl_Toggle_Button widget using the given
@@ -56,5 +56,5 @@ public:
#endif
//
-// End of "$Id: Fl_Toggle_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Toggle_Button.H 8022 2010-12-12 23:21:03Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
index caecb99d0..8d446d8e7 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Light_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Toggle_Light_Button.H 7903 2010-11-28 21:06:39Z matt $"
//
// Toggle light button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,5 +33,5 @@
#endif
//
-// End of "$Id: Fl_Toggle_Light_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Toggle_Light_Button.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
index fef2ae4b6..3fd892bc3 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Toggle_Round_Button.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Toggle_Round_Button.H 7903 2010-11-28 21:06:39Z matt $"
//
// Toggle round button header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,5 +33,5 @@
#endif
//
-// End of "$Id: Fl_Toggle_Round_Button.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Toggle_Round_Button.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
index c5ec20641..71153791f 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tooltip.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tooltip.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $"
//
// Tooltip header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -55,11 +55,11 @@ public:
*/
static void hoverdelay(float f) { hoverdelay_ = f; }
/** Returns non-zero if tooltips are enabled. */
- static int enabled() { return enabled_; }
+ static int enabled() { return Fl::option(Fl::OPTION_SHOW_TOOLTIPS); }
/** Enables tooltips on all widgets (or disables if b is false). */
- static void enable(int b = 1) { enabled_ = b;}
+ static void enable(int b = 1) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, (b!=0));}
/** Same as enable(0), disables tooltips on all widgets. */
- static void disable() { enabled_ = 0; }
+ static void disable() { enable(0); }
static void (*enter)(Fl_Widget* w);
static void enter_area(Fl_Widget* w, int X, int Y, int W, int H, const char* tip);
static void (*exit)(Fl_Widget *w);
@@ -72,7 +72,7 @@ public:
/** Sets the typeface for the tooltip text. */
static void font(Fl_Font i) { font_ = i; }
/** Gets the size of the tooltip text. */
- static Fl_Fontsize size() { return size_; }
+ static Fl_Fontsize size() { return (size_ == -1 ? FL_NORMAL_SIZE : size_); }
/** Sets the size of the tooltip text. */
static void size(Fl_Fontsize s) { size_ = s; }
/** Gets the background color for tooltips. The default background color is a pale yellow. */
@@ -83,18 +83,23 @@ public:
static Fl_Color textcolor() { return textcolor_; }
/** Sets the color of the text in the tooltip. The default is black. */
static void textcolor(Fl_Color c) { textcolor_ = c; }
+#ifdef __APPLE__
+ // the unique tooltip window
+ static Fl_Window* current_window(void);
+#endif
// These should not be public, but Fl_Widget::tooltip() needs them...
// fabien: made it private with only a friend function access
private:
friend void Fl_Widget::tooltip(const char *);
+ friend void Fl_Widget::copy_tooltip(const char *);
static void enter_(Fl_Widget* w);
static void exit_(Fl_Widget *w);
+ static void set_enter_exit_once_();
private:
static float delay_; //!< delay before a tooltip is shown
static float hoverdelay_; //!< delay between tooltips
- static int enabled_;
static Fl_Color color_;
static Fl_Color textcolor_;
static Fl_Font font_;
@@ -105,5 +110,5 @@ private:
#endif
//
-// End of "$Id: Fl_Tooltip.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Tooltip.H 8405 2011-02-08 20:59:46Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tree.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tree.H
index 94e43f6fe..cce11e729 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tree.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tree.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree.H 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Tree.H 8632 2011-05-04 02:59:50Z greg.ercolano $"
//
#ifndef FL_TREE_H
@@ -18,7 +18,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -45,6 +45,9 @@
///
/// \brief Tree widget.
///
+/// \image html tree-simple.png "Fl_Tree example program"
+/// \image latex tree-simple.png "Fl_Tree example program" width=4cm
+///
/// \code
/// Fl_Tree // Top level widget
/// |--- Fl_Tree_Item // Items in the tree
@@ -54,10 +57,8 @@
/// |--- Fl_Tree_Sort (enum) // Sort behavior
/// \endcode
///
-/// An expandable tree widget.
-///
-/// Similar to Fl_Browser, Fl_Tree is browser of Fl_Tree_Item's, which can be
-/// in a parented hierarchy. Subtrees can be expanded or closed. Items can be
+/// Similar to Fl_Browser, Fl_Tree is a browser of Fl_Tree_Item's, which is arranged
+/// in a parented hierarchy, or 'tree'. Subtrees can be expanded or closed. Items can be
/// added, deleted, inserted, sorted and re-ordered.
///
/// The tree items may also contain other FLTK widgets, like buttons, input fields,
@@ -84,68 +85,139 @@
/// tree.end();
/// \endcode
///
-/// Items can be added with Fl_Tree::add(),
-/// removed with Fl_Tree::remove(),
-/// inserted with Fl_Tree::insert_above(),
-/// selected/deselected with Fl_Tree::select() and Fl_Tree::deselect().
-/// Items can be swapped with Fl_Tree_Item::swap_children(), sorting control via
-/// Fl_Tree::sortorder().
+/// Items can be added with add(),
+/// removed with remove(),
+/// completely cleared with clear(),
+/// inserted with insert() and insert_above(),
+/// selected/deselected with select() and deselect(),
+/// open/closed with open() and closed().
+/// Children of an item can be swapped around with Fl_Tree_Item::swap_children(),
+/// sorting can be controlled when items are add()ed via sortorder().
+/// You can walk the entire tree with first() and next().
+/// You can walk selected items with first_selected_item() and
+/// next_selected_item().
+/// Items can be found by their pathname using find_item(const char*),
+/// and an item's pathname can be found with item_pathname().
+/// The selected items' colors are controlled by selection_color() (inherited from Fl_Widget).
///
-/// The tree can have different selection behaviors controlled by Fl_Tree::selectmode().
+/// The tree can have different selection behaviors controlled by selectmode().
///
-/// FLTK and custom FLTK widgets can be assigned to tree items via Fl_Tree_Item::widget().
+/// FLTK widgets (including custom widgets) can be assigned to tree items via
+/// Fl_Tree_Item::widget().
///
-/// Parent nodes can be open/closed with open() and close(), icons can be assigned
-/// or redefined with some or all items via
+/// Icons for individual items can be changed with
/// Fl_Tree_Item::openicon(),
/// Fl_Tree_Item::closeicon(),
/// Fl_Tree_Item::usericon().
///
-/// Various default preferences can be manipulated via Fl_Tree_Prefs, including
-/// colors, margins, connection lines.
+/// Various default preferences can be globally manipulated via Fl_Tree_Prefs,
+/// including colors, margins, icons, connection lines.
///
+/// The tree's callback() will be invoked when items change state or are open/closed.
+/// when() controls when mouse/keyboard events invoke the callback.
+/// callback_item() and callback_reason() can be used to determine the cause of the callback. eg:
+///
+/// \code
+/// void MyTreeCallback(Fl_Widget *w, void *data) {
+/// Fl_Tree *tree = (Fl_Tree*)w;
+/// Fl_Tree_Item *item = (Fl_Tree_Item*)tree->callback_item(); // get selected item
+/// switch ( tree->callback_reason() ) {
+/// case FL_TREE_REASON_SELECTED: [..]
+/// case FL_TREE_REASON_DESELECTED: [..]
+/// case FL_TREE_REASON_OPENED: [..]
+/// case FL_TREE_REASON_CLOSED: [..]
+/// }
+/// \endcode
+///
+/// To get the item's full menu pathname, you can use Fl_Tree_Item::item_pathname(), eg:
+///
+/// \code
+/// char pathname[256] = "???";
+/// tree->item_pathname(pathname, sizeof(pathname), item); // eg. "Parent/Child/Item"
+/// \endcode
+///
+/// To walk all the items of the tree from top to bottom:
+/// \code
+/// // Walk all the items in the tree, and print their labels
+/// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
+/// printf("Item: %s\n", item->label());
+/// }
+/// \endcode
+///
+/// To recursively walk all the children of a particular item,
+/// define a function that uses recursion:
+/// \code
+/// // Find all of the item's children and print an indented report of their labels
+/// void my_print_all_children(Fl_Tree_Item *item, int indent=0) {
+/// for ( int t=0; tchildren(); t++ ) {
+/// printf("%*s Item: %s\n", indent, "", item->child(t)->label());
+/// my_print_all_children(item->child(t), indent+4); // recurse
+/// }
+/// }
+/// \endcode
+///
+/// To change the default label font and color for creating new items:
+/// \code
+/// tree = new Fl_Tree(..);
+/// tree->item_labelfont(FL_COURIER); // Use Courier font for all new items
+/// tree->item_labelfgcolor(FL_RED); // Use red color for labels of all new items
+/// [..]
+/// // Now create the items in the tree using the above defaults.
+/// tree->add("Aaa");
+/// tree->add("Bbb");
+/// [..]
+/// \endcode
+///
+/// To change the font and color of all items in the tree:
+/// \code
+/// // Change the font and color of all items currently in the tree
+/// for ( Fl_Tree_Item *item = tree->first(); item; item = tree->next(item) ) {
+/// item->labelfont(FL_COURIER);
+/// item->labelcolor(FL_RED);
+/// }
+/// \endcode
+///
+/// The following image shows the tree's various visual elements
+/// and the methods that control them:
+///
/// \image html tree-elements.png
-///
-/// \todo Needs handling of callbacks when items are procedurally select()ed
+/// \image latex tree-elements.png "Fl_Tree dimensions" width=6cm
///
-class Fl_Tree : public Fl_Group {
- Fl_Tree_Item *_root; // can be null!
- Fl_Tree_Item *_item_clicked;
- Fl_Tree_Prefs _prefs; // all the tree's settings
- Fl_Scrollbar *_vscroll;
-
-public:
- /// Find the item that was clicked.
- /// You probably want to use item_clicked() instead, which is fast.
- ///
- /// This method walks the entire tree looking for the first item that is
- /// under the mouse (ie. at Fl::event_x()/Fl:event_y().
- ///
- /// Use this method /only/ if you've subclassed Fl_Tree, and are receiving
- /// events before Fl_Tree has been able to process and update item_clicked().
- ///
- /// \returns the item clicked, or 0 if no item was under the current event.
- ///
- const Fl_Tree_Item *find_clicked() const {
- if ( ! _root ) return(0);
- return(_root->find_clicked(_prefs));
- }
+/// \enum Fl_Tree_Reason
+/// The reason the callback was invoked.
+///
+enum Fl_Tree_Reason {
+ FL_TREE_REASON_NONE=0, ///< unknown reason
+ FL_TREE_REASON_SELECTED, ///< an item was selected
+ FL_TREE_REASON_DESELECTED, ///< an item was de-selected
+ FL_TREE_REASON_OPENED, ///< an item was opened
+ FL_TREE_REASON_CLOSED ///< an item was closed
+};
+
+
+class FL_EXPORT Fl_Tree : public Fl_Group {
+ Fl_Tree_Item *_root; // can be null!
+ Fl_Tree_Item *_item_focus; // item that has focus box
+ Fl_Tree_Item *_callback_item; // item invoked during callback (can be NULL)
+ Fl_Tree_Reason _callback_reason; // reason for the callback
+ Fl_Tree_Prefs _prefs; // all the tree's settings
+ int _scrollbar_size; // size of scrollbar trough
+
protected:
- /// Set the item that was last clicked.
- /// Should only be used by subclasses needing to change this value.
- /// Normally Fl_Tree manages this value.
- ///
- void item_clicked(Fl_Tree_Item* val) {
- _item_clicked = val;
- }
- void do_callback_for_item(Fl_Tree_Item* item) {
- Fl_Tree_Item *save = _item_clicked; // save previous 'item_clicked'
- _item_clicked = item; // set item_clicked to this item while we do callback
- do_callback((Fl_Widget*)this, user_data());
- _item_clicked = save; // restore item_clicked
- }
+ /// Vertical scrollbar
+ Fl_Scrollbar *_vscroll;
+protected:
+ void item_clicked(Fl_Tree_Item* val);
+ /// Do the callback for the item, setting the item and reason
+ void do_callback_for_item(Fl_Tree_Item* item, Fl_Tree_Reason reason) {
+ callback_reason(reason);
+ callback_item(item);
+ do_callback((Fl_Widget*)this, user_data());
+ }
+ Fl_Tree_Item *next_visible_item(Fl_Tree_Item *start, int dir);
+
public:
Fl_Tree(int X, int Y, int W, int H, const char *L=0);
~Fl_Tree();
@@ -178,11 +250,11 @@ public:
Fl_Tree_Item* insert(Fl_Tree_Item *item, const char *name, int pos);
/// Remove the specified \p item from the tree.
+ /// \p item may not be NULL.
/// If it has children, all those are removed too.
/// \returns 0 if done, -1 if 'item' not found.
///
int remove(Fl_Tree_Item *item) {
- if ( !item ) return(0);
if ( item == _root ) {
clear();
} else {
@@ -201,10 +273,12 @@ public:
delete _root; _root = 0;
}
/// Clear all the children of a particular node in the tree specified by \p item.
+ /// Item may not be NULL.
+ ///
void clear_children(Fl_Tree_Item *item) {
if ( item->has_children() ) {
item->clear_children();
- redraw(); // redraw only if there were children to clear
+ redraw(); // redraw only if there were children to clear
}
}
@@ -213,52 +287,29 @@ public:
////////////////////////
Fl_Tree_Item *find_item(const char *path);
const Fl_Tree_Item *find_item(const char *path) const;
+ int item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *item) const;
+
+ const Fl_Tree_Item *find_clicked() const;
/// Return the item that was last clicked.
///
- /// Valid only from within an Fl_Tree::callback().
+ /// Valid only from within the callback().
+ ///
+ /// Deprecated: use callback_item() instead.
///
/// \returns the item clicked, or 0 if none.
/// 0 may also be used to indicate several items were clicked/changed.
///
Fl_Tree_Item *item_clicked() {
- return(_item_clicked);
+ return(_callback_item);
}
- /// Returns the first item in the tree.
- ///
- /// Use this to walk the tree in the forward direction, eg:
- /// \code
- /// for ( Fl_Tree_Item *item = tree->first(); item; item = item->next() ) {
- /// printf("Item: %s\n", item->label());
- /// }
- /// \endcode
- ///
- /// \returns first item in tree, or 0 if none (tree empty).
- ///
- Fl_Tree_Item *first() {
- return(_root); // first item always root
- }
- /// Returns the last item in the tree.
- ///
- /// Use this to walk the tree in reverse, eg:
- ///
- /// \code
- /// for ( Fl_Tree_Item *item = tree->last(); item; item = item->prev() ) {
- /// printf("Item: %s\n", item->label());
- /// }
- /// \endcode
- ///
- /// \returns last item in the tree, or 0 if none (tree empty).
- ///
- Fl_Tree_Item *last() {
- if ( ! _root ) return(0);
- Fl_Tree_Item *item = _root;
- while ( item->has_children() ) {
- item = item->child(item->children()-1);
- }
- return(item);
- }
-
+ Fl_Tree_Item *first();
+ Fl_Tree_Item *next(Fl_Tree_Item *item=0);
+ Fl_Tree_Item *prev(Fl_Tree_Item *item=0);
+ Fl_Tree_Item *last();
+ Fl_Tree_Item *first_selected_item();
+ Fl_Tree_Item *next_selected_item(Fl_Tree_Item *item=0);
+
//////////////////////////
// Item open/close methods
//////////////////////////
@@ -266,59 +317,141 @@ public:
/// Open the specified 'item'.
/// This causes the item's children (if any) to be shown.
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- void open(Fl_Tree_Item *item) {
- if ( ! item->is_open() ) {
- item->open();
- redraw();
+ /// 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 to be opened. Must not be NULL.
+ /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+ /// - 0 - callback() is not invoked
+ /// - 1 - callback() is invoked if item changed,
+ /// callback_reason() will be FL_TREE_REASON_OPENED
+ /// \returns
+ /// - 1 -- item was opened
+ /// - 0 -- item was already open, no change
+ ///
+ /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
+ ///
+ int open(Fl_Tree_Item *item, int docallback=1) {
+ if ( item->is_open() ) return(0);
+ item->open();
+ redraw();
+ if ( docallback ) {
+ do_callback_for_item(item, FL_TREE_REASON_OPENED);
}
+ return(1);
}
/// Opens the item specified by \p path (eg: "Parent/child/item").
/// This causes the item's children (if any) to be shown.
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. open("Holidays/12\\/25\//2010").
+ ///
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
+ /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+ /// - 0 - callback() is not invoked
+ /// - 1 - callback() is invoked if item changed,
+ /// callback_reason() will be FL_TREE_REASON_OPENED
/// \returns
- /// - 0 : OK
- /// - -1 : item was not found
+ /// - 1 -- OK: item opened
+ /// - 0 -- OK: item was already open, no change
+ /// - -1 -- ERROR: item was not found
+ ///
+ /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
///
- int open(const char *path) {
+ int open(const char *path, int docallback=1) {
Fl_Tree_Item *item = find_item(path);
- if ( item ) {
- open(item);
- return(0);
+ if ( ! item ) return(-1);
+ return(open(item, docallback));
+ }
+ /// Toggle the open state of \p item.
+ /// Handles redrawing if anything was actually 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 whose open state is to be toggled. Must not be NULL.
+ /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+ /// - 0 - callback() is not invoked
+ /// - 1 - callback() is invoked, callback_reason() will be either
+ /// FL_TREE_REASON_OPENED or FL_TREE_REASON_CLOSED
+ ///
+ /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
+ ///
+ void open_toggle(Fl_Tree_Item *item, int docallback=1) {
+ if ( item->is_open() ) {
+ close(item, docallback);
+ } else {
+ open(item, docallback);
}
- return(-1);
}
/// Closes the specified \p item.
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- void close(Fl_Tree_Item *item) {
- if ( ! item->is_close() ) {
- item->close();
- redraw();
+ /// 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 to be closed. Must not be NULL.
+ /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+ /// - 0 - callback() is not invoked
+ /// - 1 - callback() is invoked if item changed,
+ /// callback_reason() will be FL_TREE_REASON_CLOSED
+ /// \returns
+ /// - 1 -- item was closed
+ /// - 0 -- item was already closed, no change
+ ///
+ /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
+ ///
+ int close(Fl_Tree_Item *item, int docallback=1) {
+ if ( item->is_close() ) return(0);
+ item->close();
+ redraw();
+ if ( docallback ) {
+ do_callback_for_item(item, FL_TREE_REASON_CLOSED);
}
+ return(1);
}
/// Closes the item specified by \p path, eg: "Parent/child/item".
- ///
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. close("Holidays/12\\/25\//2010").
+ ///
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
+ /// \param[in] docallback -- A flag that determines if the callback() is invoked or not:
+ /// - 0 - callback() is not invoked
+ /// - 1 - callback() is invoked if item changed,
+ /// callback_reason() will be FL_TREE_REASON_CLOSED
/// \returns
- /// - 0 -- OK
- /// - -1 -- item was not found
+ /// - 1 -- OK: item closed
+ /// - 0 -- OK: item was already closed, no change
+ /// - -1 -- ERROR: item was not found
+ ///
+ /// \see open(), close(), is_open(), is_close(), callback_item(), callback_reason()
///
- int close(const char *path) {
+ int close(const char *path, int docallback=1) {
Fl_Tree_Item *item = find_item(path);
- if ( item ) {
- close(item);
- return(0);
- }
- return(-1);
+ if ( ! item ) return(-1);
+ return(close(item, docallback));
}
/// See if \p item is open.
///
/// Items that are 'open' are themselves not necessarily visible;
/// one of the item's parents might be closed.
///
+ /// \param[in] item -- the item to be tested. Must not be NULL.
/// \returns
/// - 1 : item is open
/// - 0 : item is closed
@@ -328,20 +461,26 @@ public:
}
/// See if item specified by \p path (eg: "Parent/child/item") is open.
///
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. is_open("Holidays/12\\/25\//2010").
+ ///
/// Items that are 'open' are themselves not necessarily visible;
/// one of the item's parents might be closed.
///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
/// \returns
- /// - 1 : item is open
- /// - 0 : item is closed
- /// - -1 : item was not found
+ /// - 1 - OK: item is open
+ /// - 0 - OK: item is closed
+ /// - -1 - ERROR: item was not found
///
int is_open(const char *path) const {
const Fl_Tree_Item *item = find_item(path);
- if ( item ) return(item->is_open()?1:0);
- return(-1);
+ if ( ! item ) return(-1);
+ return(item->is_open()?1:0);
}
/// See if the specified \p item is closed.
+ ///
+ /// \param[in] item -- the item to be tested. Must not be NULL.
/// \returns
/// - 1 : item is open
/// - 0 : item is closed
@@ -351,111 +490,159 @@ public:
}
/// See if item specified by \p path (eg: "Parent/child/item") is closed.
///
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. is_close("Holidays/12\\/25\//2010").
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
/// \returns
- /// - 1 : item is closed
- /// - 0 : item is open
- /// - -1 : item was not found
+ /// - 1 - OK: item is closed
+ /// - 0 - OK: item is open
+ /// - -1 - ERROR: item was not found
///
int is_close(const char *path) const {
const Fl_Tree_Item *item = find_item(path);
- if ( item ) return(item->is_close()?1:0);
- return(-1);
+ if ( ! item ) return(-1);
+ return(item->is_close()?1:0);
}
- /////////////////////////
- // Item selection methods
- /////////////////////////
-
/// Select the specified \p item. Use 'deselect()' to de-select it.
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- /// \p docallback is an optional paramemter that can either be 0 or 1.
- /// - 0 - the callback() is not invoked (default)
- /// - 1 - the callback() is invoked if the item changed state,
- /// and the callback can use item_clicked() to determine the selected item.
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
///
- void select(Fl_Tree_Item *item, int docallback=0) {
+ /// \param[in] item -- the item to be selected. Must not be NULL.
+ /// \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 if item changed state,
+ /// callback_reason() will be FL_TREE_REASON_SELECTED
+ /// \returns
+ /// - 1 - item's state was changed
+ /// - 0 - item was already selected, no change was made
+ ///
+ int select(Fl_Tree_Item *item, int docallback=1) {
if ( ! item->is_selected() ) {
item->select();
- if ( docallback == 1 ) do_callback_for_item(item);
+ set_changed();
+ if ( docallback ) {
+ do_callback_for_item(item, FL_TREE_REASON_SELECTED);
+ }
redraw();
+ return(1);
}
+ return(0);
}
/// Select the item specified by \p path (eg: "Parent/child/item").
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- /// \p docallback is an optional paramemter that can either be 0 or 1.
- /// - 0 - the callback() is not invoked (default)
- /// - 1 - the callback() is invoked if the item changed state,
- /// and the callback can use item_clicked() to determine the selected item.
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. select("Holidays/12\\/25\//2010").
///
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
+ /// \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 if item changed state,
+ /// callback_reason() will be FL_TREE_REASON_SELECTED
/// \returns
- /// - 0 : OK
- /// - -1 : item was not found
+ /// - 1 : OK: item's state was changed
+ /// - 0 : OK: item was already selected, no change was made
+ /// - -1 : ERROR: item was not found
///
- int select(const char *path, int docallback=0) {
+ int select(const char *path, int docallback=1) {
Fl_Tree_Item *item = find_item(path);
- if ( item ) {
- select(item);
- if ( docallback == 1 ) do_callback_for_item(item);
- return(0);
- }
- return(-1);
+ if ( ! item ) return(-1);
+ return(select(item, docallback));
}
/// Toggle the select state of the specified \p item.
- /// Handles redrawing.
+ /// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- /// \p docallback is an optional paramemter that can either be 0 or 1.
- /// - 0 - the callback() is not invoked (default)
- /// - 1 - the callback() is invoked,
- /// and the callback can use item_clicked() to determine the selected item.
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
///
- void select_toggle(Fl_Tree_Item *item, int docallback=0) {
+ /// \param[in] item -- the item to be selected. Must not be NULL.
+ /// \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, callback_reason() will be
+ /// either FL_TREE_REASON_SELECTED or FL_TREE_REASON_DESELECTED
+ ///
+ void select_toggle(Fl_Tree_Item *item, int docallback=1) {
item->select_toggle();
- if ( docallback == 1 ) do_callback_for_item(item);
+ set_changed();
+ if ( docallback ) {
+ do_callback_for_item(item, item->is_selected() ? FL_TREE_REASON_SELECTED
+ : FL_TREE_REASON_DESELECTED);
+ }
redraw();
}
/// De-select the specified \p item.
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- /// \p docallback is an optional paramemter that can either be 0 or 1.
- /// - 0 - the callback() is not invoked (default)
- /// - 1 - the callback() is invoked if the item changed state,
- /// and the callback can use item_clicked() to determine the selected item.
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
///
- void deselect(Fl_Tree_Item *item, int docallback=0) {
+ /// \param[in] item -- the item to be selected. Must not be NULL.
+ /// \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 if item changed state,
+ /// callback_reason() will be FL_TREE_REASON_DESELECTED
+ /// \returns
+ /// - 0 - item was already deselected, no change was made
+ /// - 1 - item's state was changed
+ ///
+ int deselect(Fl_Tree_Item *item, int docallback=1) {
if ( item->is_selected() ) {
item->deselect();
- if ( docallback == 1 ) do_callback_for_item(item);
+ set_changed();
+ if ( docallback ) {
+ do_callback_for_item(item, FL_TREE_REASON_DESELECTED);
+ }
redraw();
+ return(1);
}
+ return(0);
}
- /// De-select an item specified by \p path (eg: "Parent/child/item").
+ /// Deselect an item specified by \p path (eg: "Parent/child/item").
/// Handles redrawing if anything was actually changed.
+ /// Invokes the callback depending on the value of optional parameter \p docallback.
///
- /// \p docallback is an optional paramemter that can either be 0 or 1.
- /// - 0 - the callback() is not invoked (default)
- /// - 1 - the callback() is invoked if the item changed state,
- /// and the callback can use item_clicked() to determine the selected item.
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. deselect("Holidays/12\\/25\//2010").
///
+ /// The callback can use callback_item() and callback_reason() respectively to determine
+ /// the item changed and the reason the callback was called.
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
+ /// \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 if item changed state,
+ /// callback_reason() will be FL_TREE_REASON_DESELECTED
/// \returns
- /// - 0 : OK
- /// - -1 : item was not found
+ /// - 1 - OK: item's state was changed
+ /// - 0 - OK: item was already deselected, no change was made
+ /// - -1 - ERROR: item was not found
///
- int deselect(const char *path, int docallback=0) {
+ int deselect(const char *path, int docallback=1) {
Fl_Tree_Item *item = find_item(path);
- if ( item ) {
- deselect(item, docallback);
- return(0);
- }
- return(-1);
+ if ( ! item ) return(-1);
+ return(deselect(item, docallback));
}
- int deselect_all(Fl_Tree_Item *item=0, int docallback=0);
- int select_only(Fl_Tree_Item *selitem, int docallback=0);
- int select_all(Fl_Tree_Item *item=0, int docallback=0);
+ int deselect_all(Fl_Tree_Item *item=0, int docallback=1);
+ int select_only(Fl_Tree_Item *selitem, int docallback=1);
+ int select_all(Fl_Tree_Item *item=0, int docallback=1);
+ void set_item_focus(Fl_Tree_Item *o);
/// See if the specified \p item is selected.
+ ///
+ /// \param[in] item -- the item to be tested. Must not be NULL.
+ ///
/// \return
/// - 1 : item selected
/// - 0 : item deselected
@@ -465,6 +652,10 @@ public:
}
/// See if item specified by \p path (eg: "Parent/child/item") is selected.
///
+ /// Items or submenus that themselves contain slashes ('/' or '\')
+ /// should be escaped, e.g. is_selected("Holidays/12\\/25\//2010").
+ ///
+ /// \param[in] path -- the tree item's pathname (e.g. "Flintstones/Fred")
/// \returns
/// - 1 : item selected
/// - 0 : item deselected
@@ -472,8 +663,8 @@ public:
///
int is_selected(const char *path) {
Fl_Tree_Item *item = find_item(path);
- if ( item ) return(is_selected(item));
- return(-1);
+ if ( ! item ) return(-1);
+ return(is_selected(item));
}
/// Print the tree as 'ascii art' to stdout.
/// Used mainly for debugging.
@@ -488,36 +679,57 @@ public:
/////////////////////////////////
/// Get the default label fontsize used for creating new items.
- int labelsize() const {
+ Fl_Fontsize item_labelsize() const {
return(_prefs.labelsize());
}
/// Set the default label font size used for creating new items.
- /// To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(int)
+ /// To change the font size on a per-item basis, use Fl_Tree_Item::labelsize(Fl_Fontsize)
///
- void labelsize(int val) {
+ void item_labelsize(Fl_Fontsize val) {
_prefs.labelsize(val);
}
-
- /// Get the default font face used for item's labels when new items are created.
- ///
- /// Don't use this if you want to change an existing label() size; use
- /// item->labelfont() instead.
- ///
- int labelfont() const {
+ /// Get the default font face used for creating new items.
+ Fl_Font item_labelfont() const {
return(_prefs.labelfont());
}
- /// Set the default font face used for item's labels when new items are created.
+ /// Set the default font face used for creating new items.
+ /// To change the font face on a per-item basis, use Fl_Tree_Item::labelfont(Fl_Font)
///
- /// Don't use this if you want to change an existing label() size; use
- /// item->labelfont(int) instead.
- ///
- void labelfont(int val) {
+ void item_labelfont(Fl_Font val) {
_prefs.labelfont(val);
}
+ /// Get the default label foreground color used for creating new items.
+ Fl_Color item_labelfgcolor(void) const {
+ return(_prefs.labelfgcolor());
+ }
+ /// Set the default label foreground color used for creating new items.
+ /// To change the foreground color on a per-item basis, use Fl_Tree_Item::labelfgcolor(Fl_Color)
+ ///
+ void item_labelfgcolor(Fl_Color val) {
+ _prefs.labelfgcolor(val);
+ }
+ /// Get the default label background color used for creating new items.
+ Fl_Color item_labelbgcolor(void) const {
+ return(_prefs.labelbgcolor());
+ }
+ /// Set the default label background color used for creating new items.
+ /// To change the background color on a per-item basis, use Fl_Tree_Item::labelbgcolor(Fl_Color)
+ ///
+ void item_labelbgcolor(Fl_Color val) {
+ _prefs.labelbgcolor(val);
+ }
+ /// Get the connector color used for tree connection lines.
+ Fl_Color connectorcolor() const {
+ return(_prefs.connectorcolor());
+ }
+ /// Set the connector color used for tree connection lines.
+ void connectorcolor(Fl_Color val) {
+ _prefs.connectorcolor(val);
+ }
/// Get the amount of white space (in pixels) that should appear
/// between the widget's left border and the tree's contents.
///
- int marginleft() const {
+ int marginleft() const {
return(_prefs.marginleft());
}
/// Set the amount of white space (in pixels) that should appear
@@ -530,7 +742,7 @@ public:
/// Get the amount of white space (in pixels) that should appear
/// between the widget's top border and the top of the tree's contents.
///
- int margintop() const {
+ int margintop() const {
return(_prefs.margintop());
}
/// Sets the amount of white space (in pixels) that should appear
@@ -543,7 +755,7 @@ public:
/// Get the amount of white space (in pixels) that should appear
/// below an open child tree's contents.
///
- int openchild_marginbottom() const {
+ int openchild_marginbottom() const {
return(_prefs.openchild_marginbottom());
}
/// Set the amount of white space (in pixels) that should appear
@@ -556,7 +768,7 @@ public:
/// Gets the width of the horizontal connection lines (in pixels)
/// that appear to the left of each tree item's label.
///
- int connectorwidth() const {
+ int connectorwidth() const {
return(_prefs.connectorwidth());
}
/// Sets the width of the horizontal connection lines (in pixels)
@@ -566,7 +778,8 @@ public:
_prefs.connectorwidth(val);
redraw();
}
- /// Returns the Fl_Image being used as the default user icon for newly created items.
+ /// Returns the Fl_Image being used as the default user icon for all
+ /// newly created items.
/// Returns zero if no icon has been set, which is the default.
///
Fl_Image *usericon() const {
@@ -688,12 +901,116 @@ public:
void selectmode(Fl_Tree_Select val) {
_prefs.selectmode(val);
}
-
+ int displayed(Fl_Tree_Item *item);
+ void show_item(Fl_Tree_Item *item, int yoff);
+ void show_item(Fl_Tree_Item *item);
+ void show_item_bottom(Fl_Tree_Item *item);
+ void show_item_middle(Fl_Tree_Item *item);
+ void show_item_top(Fl_Tree_Item *item);
+ void display(Fl_Tree_Item *item);
+ int vposition() const;
+ void vposition(int ypos);
+
+ /// See if widget \p w is one of the Fl_Tree widget's scrollbars.
+ /// Use this to skip over the scrollbars when walking the child() array. Example:
+ /// \code
+ /// for ( int i=0; ichildren(); i++ ) { // walk children
+ /// Fl_Widget *w= tree->child(i);
+ /// if ( brow->is_scrollbar(w) ) continue; // skip scrollbars
+ /// ..do work here..
+ /// }
+ /// \endcode
+ /// \param[in] w Widget to test
+ /// \returns 1 if \p w is a scrollbar, 0 if not.
+ ///
+ int is_scrollbar(Fl_Widget *w) {
+ return( ( w == _vscroll ) ? 1 : 0 );
+ }
+ /// Gets the current size of the scrollbars' troughs, in pixels.
+ ///
+ /// If this value is zero (default), this widget will use the global
+ /// Fl::scrollbar_size() value as the scrollbar's width.
+ ///
+ /// \returns Scrollbar size in pixels, or 0 if the global Fl::scrollsize() is being used.
+ /// \see Fl::scrollbar_size(int)
+ ///
+ int scrollbar_size() const {
+ return(_scrollbar_size);
+ }
+ /// Sets the pixel size of the scrollbars' troughs to the \p size, in pixels.
+ ///
+ /// Normally you should not need this method, and should use the global
+ /// Fl::scrollbar_size(int) instead to manage the size of ALL
+ /// your widgets' scrollbars. This ensures your application
+ /// has a consistent UI, is the default behavior, and is normally
+ /// what you want.
+ ///
+ /// Only use THIS method if you really need to override the global
+ /// scrollbar size. The need for this should be rare.
+ ///
+ /// Setting \p size to the special value of 0 causes the widget to
+ /// track the global Fl::scrollbar_size(), which is the default.
+ ///
+ /// \param[in] size Sets the scrollbar size in pixels.\n
+ /// If 0 (default), scrollbar size tracks the global Fl::scrollbar_size()
+ /// \see Fl::scrollbar_size()
+ ///
+ void scrollbar_size(int size) {
+ _scrollbar_size = size;
+ int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size();
+ if ( _vscroll->w() != scrollsize ) {
+ _vscroll->resize(x()+w()-scrollsize, h(), scrollsize, _vscroll->h());
+ }
+ }
+
+ ///////////////////////
+ // callback related
+ ///////////////////////
+
+ /// Sets the item that was changed for this callback.
+ /// Used internally to pass the item that invoked the callback.
+ ///
+ void callback_item(Fl_Tree_Item* item) {
+ _callback_item = item;
+ }
+ /// Gets the item that caused the callback.
+ /// The callback() can use this value to see which item changed.
+ ///
+ Fl_Tree_Item* callback_item() {
+ return(_callback_item);
+ }
+ /// Sets the reason for this callback.
+ /// Used internally to pass the reason the callback was invoked.
+ ///
+ void callback_reason(Fl_Tree_Reason reason) {
+ _callback_reason = reason;
+ }
+ /// Gets the reason for this callback.
+ ///
+ /// The callback() can use this value to see why it was called. Example:
+ /// \code
+ /// void MyTreeCallback(Fl_Widget *w, void *userdata) {
+ /// Fl_Tree *tree = (Fl_Tree*)w;
+ /// Fl_Tree_Item *item = tree->callback_item(); // the item changed (can be NULL if more than one item was changed!)
+ /// switch ( tree->callback_reason() ) { // reason callback was invoked
+ /// case FL_TREE_REASON_OPENED: ..item was opened..
+ /// case FL_TREE_REASON_CLOSED: ..item was closed..
+ /// case FL_TREE_REASON_SELECTED: ..item was selected..
+ /// case FL_TREE_REASON_DESELECTED: ..item was deselected..
+ /// }
+ /// }
+ /// \endcode
+ ///
+ Fl_Tree_Reason callback_reason() const {
+ return(_callback_reason);
+ }
+
+ /// Load FLTK preferences
void load(class Fl_Preferences&);
};
#endif /*FL_TREE_H*/
//
-// End of "$Id: Fl_Tree.H 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Tree.H 8632 2011-05-04 02:59:50Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.H
index 6c46c5caa..3c579faf1 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree_Item.H 6957 2009-12-08 08:39:31Z greg.ercolano $"
+// "$Id: Fl_Tree_Item.H 8340 2011-01-30 20:22:06Z greg.ercolano $"
//
#ifndef FL_TREE_ITEM_H
@@ -18,7 +18,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -56,10 +56,10 @@
/// When you make changes to items, you'll need to tell the tree to redraw()
/// for the changes to show up.
///
-class Fl_Tree_Item {
+class FL_EXPORT Fl_Tree_Item {
const char *_label; // label (memory managed)
- int _labelfont; // label's font face
- int _labelsize; // label's font size
+ Fl_Font _labelfont; // label's font face
+ Fl_Fontsize _labelsize; // label's font size
Fl_Color _labelfgcolor; // label's fg color
Fl_Color _labelbgcolor; // label's bg color
char _open; // item is open?
@@ -83,7 +83,11 @@ public:
Fl_Tree_Item(const Fl_Tree_Prefs &prefs); // CTOR
~Fl_Tree_Item(); // DTOR
Fl_Tree_Item(const Fl_Tree_Item *o); // COPY CTOR
- void draw(int X, int &Y, int W, Fl_Widget *tree, const Fl_Tree_Prefs &prefs, int lastchild=1);
+ int x() const { return(_xywh[0]); }
+ int y() const { return(_xywh[1]); }
+ int w() const { return(_xywh[2]); }
+ int h() const { return(_xywh[3]); }
+ void draw(int X, int &Y, int W, Fl_Widget *tree, Fl_Tree_Item *itemfocus, const Fl_Tree_Prefs &prefs, int lastchild=1);
void show_self(const char *indent = "") const;
void label(const char *val);
const char *label() const;
@@ -95,19 +99,19 @@ public:
inline void* user_data() const { return _userdata; }
/// Set item's label font face.
- void labelfont(int val) {
+ void labelfont(Fl_Font val) {
_labelfont = val;
}
/// Get item's label font face.
- int labelfont() const {
+ Fl_Font labelfont() const {
return(_labelfont);
}
/// Set item's label font size.
- void labelsize(int val) {
+ void labelsize(Fl_Fontsize val) {
_labelsize = val;
}
/// Get item's label font size.
- int labelsize() const {
+ Fl_Fontsize labelsize() const {
return(_labelsize);
}
/// Set item's label foreground text color.
@@ -163,8 +167,10 @@ public:
void clear_children();
void swap_children(int ax, int bx);
int swap_children(Fl_Tree_Item *a, Fl_Tree_Item *b);
- const Fl_Tree_Item *find_item(char **arr) const;
- Fl_Tree_Item *find_item(char **arr);
+ const Fl_Tree_Item *find_child_item(char **arr) const; // const
+ Fl_Tree_Item *find_child_item(char **arr); // non-const
+ const Fl_Tree_Item *find_item(char **arr) const; // const
+ Fl_Tree_Item *find_item(char **arr); // non-const
//////////////////
// Adding items
//////////////////
@@ -175,12 +181,16 @@ public:
int depth() const;
Fl_Tree_Item *prev();
Fl_Tree_Item *next();
+ Fl_Tree_Item *next_sibling();
+ Fl_Tree_Item *prev_sibling();
+ Fl_Tree_Item *next_displayed(Fl_Tree_Prefs &prefs);
+ Fl_Tree_Item *prev_displayed(Fl_Tree_Prefs &prefs);
- /// Return the parent for this item.
+ /// Return the parent for this item. Returns NULL if we are the root.
Fl_Tree_Item *parent() {
return(_parent);
}
- /// Return the const parent for this item.
+ /// Return the const parent for this item. Returns NULL if we are the root.
const Fl_Tree_Item *parent() const {
return(_parent);
}
@@ -293,6 +303,12 @@ public:
char is_active() const {
return(_active);
}
+ /// See if the item is visible.
+ int visible() const {
+ return(_visible ? 1 : 0);
+ }
+ int visible_r() const;
+
/// Set the user icon's image. '0' will disable.
void usericon(Fl_Image *val) {
_usericon = val;
@@ -317,5 +333,5 @@ public:
#endif /*FL_TREE_ITEM_H*/
//
-// End of "$Id: Fl_Tree_Item.H 6957 2009-12-08 08:39:31Z greg.ercolano $".
+// End of "$Id: Fl_Tree_Item.H 8340 2011-01-30 20:22:06Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.H
index f1d2834ba..5a91dee18 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Item_Array.H
@@ -1,11 +1,13 @@
//
-// "$Id: Fl_Tree_Item_Array.H 6956 2009-12-08 08:06:44Z greg.ercolano $"
+// "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $"
//
#ifndef _FL_TREE_ITEM_ARRAY_H
#define _FL_TREE_ITEM_ARRAY_H
-class Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
+#include "Fl_Export.H"
+
+class FL_EXPORT Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
// or doxygen will not document our class..
//////////////////////////
@@ -13,7 +15,7 @@ class Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
//////////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -46,7 +48,7 @@ class Fl_Tree_Item; // forward decl must *precede* first doxygen comment block
/// (unless otherwise noted).
///
-class Fl_Tree_Item_Array {
+class FL_EXPORT Fl_Tree_Item_Array {
Fl_Tree_Item **_items; // items array
int _total; // #items in array
int _size; // #items *allocated* for array
@@ -84,5 +86,5 @@ public:
#endif /*_FL_TREE_ITEM_ARRAY_H*/
//
-// End of "$Id: Fl_Tree_Item_Array.H 6956 2009-12-08 08:06:44Z greg.ercolano $".
+// End of "$Id: Fl_Tree_Item_Array.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.H b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.H
index 5387a4236..57d72e382 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Tree_Prefs.H
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree_Prefs.H 6956 2009-12-08 08:06:44Z greg.ercolano $"
+// "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $"
//
#ifndef FL_TREE_PREFS_H
@@ -10,7 +10,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -69,8 +69,8 @@ enum Fl_Tree_Connector {
///
enum Fl_Tree_Select {
FL_TREE_SELECT_NONE=0, ///< Nothing selected when items are clicked
- FL_TREE_SELECT_SINGLE, ///< Single item selected when item is clicked (default)
- FL_TREE_SELECT_MULTI ///< Multiple items can be selected by clicking with
+ FL_TREE_SELECT_SINGLE=1, ///< Single item selected when item is clicked (default)
+ FL_TREE_SELECT_MULTI=2 ///< Multiple items can be selected by clicking with
///< SHIFT or CTRL or mouse drags.
};
@@ -82,9 +82,9 @@ enum Fl_Tree_Select {
/// You should probably be using the methods in Fl_Tree
/// instead of trying to accessing tree's preferences settings directly.
///
-class Fl_Tree_Prefs {
- int _labelfont; // label's font face
- int _labelsize; // label's font size
+class FL_EXPORT Fl_Tree_Prefs {
+ Fl_Font _labelfont; // label's font face
+ Fl_Fontsize _labelsize; // label's font size
int _margintop; // --
int _marginleft; // |- tree's margins
//int _marginright; // |
@@ -95,10 +95,8 @@ class Fl_Tree_Prefs {
int _connectorwidth; // connector width (right of open/close icon)
int _linespacing; // vertical space between lines
// Colors
- Fl_Color _fgcolor; // label's foreground color
- Fl_Color _bgcolor; // background color
- Fl_Color _selectcolor; // selection color
- Fl_Color _inactivecolor; // inactive color
+ Fl_Color _labelfgcolor; // label's foreground color
+ Fl_Color _labelbgcolor; // background color
Fl_Color _connectorcolor; // connector dotted line color
Fl_Tree_Connector _connectorstyle; // connector line style
Fl_Image *_openimage; // the 'open' icon [+]
@@ -116,19 +114,19 @@ public:
// Labels
////////////////////////////
/// Return the label's font.
- inline int labelfont() const {
+ inline Fl_Font labelfont() const {
return(_labelfont);
}
/// Set the label's font to \p val.
- inline void labelfont(int val) {
+ inline void labelfont(Fl_Font val) {
_labelfont = val;
}
/// Return the label's size in pixels.
- inline int labelsize() const {
+ inline Fl_Fontsize labelsize() const {
return(_labelsize);
}
/// Set the label's size in pixels to \p val.
- inline void labelsize(int val) {
+ inline void labelsize(Fl_Fontsize val) {
_labelsize = val;
}
@@ -204,50 +202,34 @@ public:
// Colors and Styles
////////////////////////////
/// Get the default label foreground color
- inline Fl_Color fgcolor() const {
- return(_fgcolor);
+ inline Fl_Color labelfgcolor() const {
+ return(_labelfgcolor);
}
/// Set the default label foreground color
- inline void fgcolor(Fl_Color val) {
- _fgcolor = val;
+ inline void labelfgcolor(Fl_Color val) {
+ _labelfgcolor = val;
}
/// Get the default label background color
- inline Fl_Color bgcolor() const {
- return(_bgcolor);
+ inline Fl_Color labelbgcolor() const {
+ return(_labelbgcolor);
}
/// Set the default label background color
- inline void bgcolor(Fl_Color val) {
- _bgcolor = val;
+ inline void labelbgcolor(Fl_Color val) {
+ _labelbgcolor = val;
}
- /// Get the default selection color
- inline Fl_Color selectcolor() const {
- return(_selectcolor);
- }
- /// Set the default selection color
- inline void selectcolor(Fl_Color val) {
- _selectcolor = val;
- }
- /// Get the default inactive color
- inline Fl_Color inactivecolor() const {
- return(_inactivecolor);
- }
- /// Set the default inactive color
- inline void inactivecolor(Fl_Color val) {
- _inactivecolor = val;
- }
- /// Get the connector color; the color used for tree connection lines
+ /// Get the connector color used for tree connection lines.
inline Fl_Color connectorcolor() const {
return(_connectorcolor);
}
- /// Set the connector color; the color used for tree connection lines
+ /// Set the connector color used for tree connection lines.
inline void connectorcolor(Fl_Color val) {
_connectorcolor = val;
}
- /// Get the connector style
+ /// Get the connector style.
inline Fl_Tree_Connector connectorstyle() const {
return(_connectorstyle);
}
- /// Set the connector style
+ /// Set the connector style.
inline void connectorstyle(Fl_Tree_Connector val) {
_connectorstyle = val;
}
@@ -255,11 +237,11 @@ public:
inline void connectorstyle(int val) {
_connectorstyle = Fl_Tree_Connector(val);
}
- /// Get the tree connection line's width
+ /// Get the tree connection line's width.
inline int connectorwidth() const {
return(_connectorwidth);
}
- /// Set the tree connection line's width
+ /// Set the tree connection line's width.
inline void connectorwidth(int val) {
_connectorwidth = val;
}
@@ -357,5 +339,5 @@ public:
#endif /*FL_TREE_PREFS_H*/
//
-// End of "$Id: Fl_Tree_Prefs.H 6956 2009-12-08 08:06:44Z greg.ercolano $".
+// End of "$Id: Fl_Tree_Prefs.H 8340 2011-01-30 20:22:06Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H b/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
index af217477e..73af078b9 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Valuator.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Valuator.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Valuator header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -44,8 +44,8 @@
and provides a consistent interface to set the value, range, and step,
and insures that callbacks are done the same for every object.
There are probably more of these classes in FLTK than any others:
-
\image html valuators.gif
- \image latex valuators.eps "Valuators derived from Fl_Valuators" width=10cm
+ \image html valuators.png
+ \image latex valuators.png "Valuators derived from Fl_Valuators" width=10cm
In the above diagram each box surrounds an actual subclass. These
are further differentiated by setting the type() of the widget t
o the symbolic value labeling the widget.
@@ -140,5 +140,5 @@ public:
#endif
//
-// End of "$Id: Fl_Valuator.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Valuator.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
index 4ed1b1011..47ffcf331 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Input.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Input.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Value_Input.H 8337 2011-01-30 09:04:59Z manolo $"
//
// Value input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -59,8 +59,8 @@
of numbers are limited to integers instead of floating point
values.
-
\image html Fl_Value_Input.gif
- \image latex Fl_Value_Input.eps "Fl_Value_Input" width=8cm
+
\image html Fl_Value_Input.png
+ \image latex Fl_Value_Input.png "Fl_Value_Input" width=4cm
*/
class FL_EXPORT Fl_Value_Input : public Fl_Valuator {
public:
@@ -90,23 +90,27 @@ public:
*/
char soft() const {return soft_;}
/**
- The first form returns the current shortcut key for the Input.
-
The second form sets the shortcut key to key. Setting this
- overrides the use of '&' in the label(). The value is a bitwise
- OR of a key and a set of shift flags, for example FL_ALT | 'a'
- , FL_ALT | (FL_F + 10), or just 'a'. A value
- of 0 disables the shortcut.
- The key can be any value returned by
- Fl::event_key(), but will usually be an ASCII letter. Use
- a lower-case letter unless you require the shift key to be held down.
- The shift flags can be any set of values accepted by
- Fl::event_state(). If the bit is on that shift key must
- be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
- the shift flags (zero for the other bits indicates a "don't care"
- setting).
+ Returns the current shortcut key for the Input.
+ \see Fl_Value_Input::shortcut(int)
*/
int shortcut() const {return input.shortcut();}
- /** See int Fl_Value_Input::shortcut() const */
+ /**
+ Sets the shortcut key to \p s. Setting this
+ overrides the use of '&' in the label(). The value is a bitwise
+ OR of a key and a set of shift flags, for example FL_ALT | 'a'
+ , FL_ALT | (FL_F + 10), or just 'a'. A value
+ of 0 disables the shortcut.
+
+ The key can be any value returned by
+ Fl::event_key(), but will usually be an ASCII letter. Use
+ a lower-case letter unless you require the shift key to be held down.
+
+ The shift flags can be any set of values accepted by
+ Fl::event_state(). If the bit is on that shift key must
+ be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in
+ the shift flags (zero for the other bits indicates a "don't care"
+ setting).
+ */
void shortcut(int s) {input.shortcut(s);}
/** Gets the typeface of the text in the value box. */
@@ -131,5 +135,5 @@ public:
#endif
//
-// End of "$Id: Fl_Value_Input.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Value_Input.H 8337 2011-01-30 09:04:59Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
index 5dda0ca89..afae308a8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Output.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Output.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Value_Output.H 7989 2010-12-09 12:19:03Z greg.ercolano $"
//
// Value output header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -44,8 +44,8 @@
This is much lighter-weight than
Fl_Value_Input because it contains no text editing code or
character buffer.
- \image html Fl_Value_Output.gif
- \image latex Fl_Value_Output.eps "Fl_Value_Output" width=8cm
+
\image html Fl_Value_Output.png
+ \image latex Fl_Value_Output.png "Fl_Value_Output" width=4cm
*/
class FL_EXPORT Fl_Value_Output : public Fl_Valuator {
Fl_Font textfont_;
@@ -91,5 +91,5 @@ public:
#endif
//
-// End of "$Id: Fl_Value_Output.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Value_Output.H 7989 2010-12-09 12:19:03Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
index ec886428a..21a42ff79 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Value_Slider.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Slider.H 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Value_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Value slider header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -36,8 +36,8 @@
/**
The Fl_Value_Slider widget is a Fl_Slider widget
with a box displaying the current value.
-
\image html value_slider.gif
- \image latex value_slider.eps "Fl_Value_Slider" width=4cm
+
\image html value_slider.png
+ \image latex value_slider.png "Fl_Value_Slider" width=4cm
*/
class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
Fl_Font textfont_;
@@ -65,5 +65,5 @@ public:
#endif
//
-// End of "$Id: Fl_Value_Slider.H 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Value_Slider.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H b/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
index 6ddd04522..780c6cba8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Widget.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Widget.H 7661 2010-07-01 15:01:49Z manolo $"
+// "$Id: Fl_Widget.H 8623 2011-04-24 17:09:41Z AlbrechtS $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -31,10 +31,24 @@
#ifndef Fl_Widget_H
#define Fl_Widget_H
-#include
-
#include "Enumerations.H"
+/**
+ \todo typedef's fl_intptr_t and fl_uintptr_t should be documented.
+*/
+#ifdef _WIN64
+#ifdef __GNUC__
+#include
+#else
+#include // M$VC
+#endif
+typedef intptr_t fl_intptr_t;
+typedef uintptr_t fl_uintptr_t;
+#else
+typedef long fl_intptr_t;
+typedef unsigned long fl_uintptr_t;
+#endif
+
class Fl_Widget;
class Fl_Window;
class Fl_Group;
@@ -148,11 +162,11 @@ protected:
*/
enum {
INACTIVE = 1<<0, ///< the widget can't receive focus, and is disabled but potentially visible
- INVISIBLE = 1<<1, ///< the widget is not drawn but can receive events
+ INVISIBLE = 1<<1, ///< the widget is not drawn, but can receive a few special events
OUTPUT = 1<<2, ///< for output only
NOBORDER = 1<<3, ///< don't draw a decoration (Fl_Window)
FORCE_POSITION = 1<<4, ///< don't let the window manager position the window (Fl_Window)
- NON_MODAL = 1<<5, ///< thisis a hovering toolbar window (Fl_Window)
+ NON_MODAL = 1<<5, ///< this is a hovering toolbar window (Fl_Window)
SHORTCUT_LABEL = 1<<6, ///< the label contains a shortcut we need to draw
CHANGED = 1<<7, ///< the widget value changed
OVERRIDE = 1<<8, ///< position window on top (Fl_Window)
@@ -163,7 +177,8 @@ protected:
TOOLTIP_WINDOW = 1<<13, ///< a temporary popup, transparent to events, and dismissed easily (Fl_Window)
MODAL = 1<<14, ///< a window blocking input to all other winows (Fl_Window)
NO_OVERLAY = 1<<15, ///< window not using a hardware overlay plane (Fl_Menu_Window)
- GROUP_RELATIVE = 1<<16, ///< position this idget relative to the parent group, not to the window
+ GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window
+ COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget
// (space for more flags)
USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions
USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions
@@ -325,13 +340,6 @@ public:
\return label alignment
\see label(), align(Fl_Align), Fl_Align
- \todo This function should not take uchar as an argument.
- Apart from the fact that uchar is too short with only 8 bits,
- it does not provide type safety (in which case we don't need
- to declare Fl_Align an enum to begin with).
- *NOTE* The current (FLTK 1.3) implementation (Dec 2008) is such that
- Fl_Align is (typedef'd to be) "unsigned" (int), but Fl_Widget's
- "align_" member variable is a bit field of 8 bits only !
*/
Fl_Align align() const {return label_.align_;}
@@ -535,22 +543,12 @@ public:
/** Gets the current tooltip text.
\return a pointer to the tooltip text or NULL
+ \see tooltip(const char*), copy_tooltip(const char*)
*/
const char *tooltip() const {return tooltip_;}
- /** 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 not copied, so
- make sure any formatted string is stored in a static, global,
- or allocated buffer.
-
- 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] t new tooltip
- */
- void tooltip(const char *t);
+ void tooltip(const char *text); // see Fl_Tooltip
+ void copy_tooltip(const char *text); // see Fl_Tooltip
/** Gets the current callback function for the widget.
Each widget has a single callback.
@@ -598,11 +596,11 @@ public:
/** Gets the current user data (long) argument that is passed to the callback function.
*/
- intptr_t argument() const {return (intptr_t)user_data_;}
+ long argument() const {return (long)(fl_intptr_t)user_data_;}
/** Sets the current user data (long) argument that is passed to the callback function.
- \todo The user data value must be implemented using a \em union to avoid
- 64 bit machine incompatibilities.
+ \todo The user data value must be implemented using \em intptr_t or similar
+ to avoid 64-bit machine incompatibilities.
*/
void argument(long v) {user_data_ = (void*)v;}
@@ -662,14 +660,17 @@ public:
int visible_r() const;
/** Makes a widget visible.
- An invisible widget never gets redrawn and does not get events.
- The visible() method returns true if the widget is set to be
- visible. The visible_r() method returns true if the widget and
- all of its parents are visible. A widget is only visible if
- visible() is true on it and all of its parents.
- Changing it will send FL_SHOW or FL_HIDE events to
- the widget. Do not change it if the parent is not visible, as this
+ An invisible widget never gets redrawn and does not get keyboard
+ or mouse events, but can receive a few other events like FL_SHOW.
+
+ The visible() method returns true if the widget is set to be
+ visible. The visible_r() method returns true if the widget and
+ all of its parents are visible. A widget is only visible if
+ visible() is true on it and all of its parents.
+
+ Changing it will send FL_SHOW or FL_HIDE events to the widget.
+ Do not change it if the parent is not visible, as this
will send false FL_SHOW or FL_HIDE events to the widget.
redraw() is called if necessary on this or the parent.
@@ -722,7 +723,7 @@ public:
Changing this value will send FL_DEACTIVATE to the widget if
active_r() is true.
-
+
Currently you cannot deactivate Fl_Window widgets.
\see activate(), active(), active_r()
@@ -750,10 +751,10 @@ public:
void clear_output() {flags_ &= ~OUTPUT;}
/** Returns if the widget is able to take events.
- This is the same as (active() && !output()
- && visible()) but is faster.
+ This is the same as (active() && !output() && visible())
+ but is faster.
\retval 0 if the widget takes no events
- */
+ */
unsigned int takesevents() const {return !(flags_&(INACTIVE|INVISIBLE|OUTPUT));}
/**
@@ -845,12 +846,12 @@ public:
// Documentation and implementation in Fl_Widget.cxx
void do_callback(Fl_Widget* o,void* arg=0);
- /** Internal use only. */
+ /* Internal use only. */
int test_shortcut();
- /** Internal use only. */
+ /* Internal use only. */
static unsigned int label_shortcut(const char *t);
- /** Internal use only. */
- static int test_shortcut(const char*);
+ /* Internal use only. */
+ static int test_shortcut(const char*, const bool require_alt = false);
/** Checks if w is a child of this widget.
\param[in] w potential child widget
@@ -920,7 +921,7 @@ public:
/** Sets width ww and height hh accordingly with the label size.
Labels with images will return w() and h() of the image.
*/
- void measure_label(int& ww, int& hh) {label_.measure(ww, hh);}
+ void measure_label(int& ww, int& hh) const {label_.measure(ww, hh);}
/** Returns a pointer to the primary Fl_Window widget.
\retval NULL if no window is associated with this widget.
@@ -930,25 +931,53 @@ public:
Fl_Window* window() const ;
/** Returns an Fl_Group pointer if this widget is an Fl_Group.
-
+
+ Use this method if you have a widget (pointer) and need to
+ know whether this widget is derived from Fl_Group. If it returns
+ non-NULL, then the widget in question is derived from Fl_Group,
+ and you can use the returned pointer to access its children
+ or other Fl_Group-specific methods.
+
+ Example:
+ \code
+ void my_callback (Fl_Widget *w, void *) {
+ Fl_Group *g = w->as_group();
+ if (g)
+ printf ("This group has %d children\n",g->children());
+ else
+ printf ("This widget is not a group!\n");
+ }
+ \endcode
+
\retval NULL if this widget is not derived from Fl_Group.
\note This method is provided to avoid dynamic_cast.
- \todo More documentation ...
+ \see Fl_Widget::as_window(), Fl_Widget::as_gl_window()
*/
virtual Fl_Group* as_group() {return 0;}
/** Returns an Fl_Window pointer if this widget is an Fl_Window.
-
- \retval NULL if this widget is not derived from Fl_Window.
- \note This method is provided to avoid dynamic_cast.
- \todo More documentation ...
+
+ Use this method if you have a widget (pointer) and need to
+ know whether this widget is derived from Fl_Window. If it returns
+ non-NULL, then the widget in question is derived from Fl_Window,
+ and you can use the returned pointer to access its children
+ or other Fl_Window-specific methods.
+
+ \retval NULL if this widget is not derived from Fl_Window.
+ \note This method is provided to avoid dynamic_cast.
+ \see Fl_Widget::as_group(), Fl_Widget::as_gl_window()
*/
virtual Fl_Window* as_window() {return 0;}
-
- /** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
- \retval NULL if this widget is not derived from Fl_Gl_Window.
- \note This method is provided to avoid dynamic_cast.
- \todo More documentation ...
+
+ /** Returns an Fl_Gl_Window pointer if this widget is an Fl_Gl_Window.
+
+ Use this method if you have a widget (pointer) and need to
+ know whether this widget is derived from Fl_Gl_Window. If it returns
+ non-NULL, then the widget in question is derived from Fl_Gl_Window.
+
+ \retval NULL if this widget is not derived from Fl_Gl_Window.
+ \note This method is provided to avoid dynamic_cast.
+ \see Fl_Widget::as_group(), Fl_Widget::as_window()
*/
virtual class Fl_Gl_Window* as_gl_window() {return 0;}
@@ -973,5 +1002,5 @@ public:
#endif
//
-// End of "$Id: Fl_Widget.H 7661 2010-07-01 15:01:49Z manolo $".
+// End of "$Id: Fl_Widget.H 8623 2011-04-24 17:09:41Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Window.H b/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
index cad924ace..8317fb4a8 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Window.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window.H 7280 2010-03-16 22:51:31Z matt $"
+// "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $"
//
// Window header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -57,11 +57,13 @@ class Fl_X;
*/
class FL_EXPORT Fl_Window : public Fl_Group {
+ static char *default_xclass_;
+
friend class Fl_X;
Fl_X *i; // points at the system-specific stuff
const char* iconlabel_;
- const char* xclass_;
+ char* xclass_;
const void* icon_;
// size_range stuff:
int minw, minh, maxw, maxh;
@@ -114,8 +116,8 @@ public:
If Fl_Group::current() is not NULL, the window is created as a
subwindow of the parent window.
- The first form of the constructor creates a top-level window
- and asks the window manager to position the window. The second
+ The (w,h) form of the constructor creates a top-level window
+ and asks the window manager to position the window. The (x,y,w,h)
form of the constructor either creates a subwindow or a
top-level window at the specified location (x,y) , subject to window
manager configuration. If you do not specify the position of the
@@ -135,12 +137,12 @@ public:
change this to FL_NO_BOX. If you turn the window border off
you may want to change this to FL_UP_BOX.
- \see Fl_Window(int x, int y, int w, int h, const char* title = 0)
+ \see Fl_Window(int x, int y, int w, int h, const char* title)
*/
Fl_Window(int w, int h, const char* title= 0);
/** Creates a window from the given position, size and title.
- \see Fl_Window::Fl_Window(int w, int h, const char *title = 0)
+ \see Fl_Window(int w, int h, const char *title)
*/
Fl_Window(int x, int y, int w, int h, const char* title = 0);
/**
@@ -321,29 +323,15 @@ public:
/** Sets the icon label. */
void iconlabel(const char*);
/** Sets the icon label. */
- void label(const char* label, const char* iconlabel); // platform dependent
+ void label(const char* label, const char* iconlabel); // platform dependent
void copy_label(const char* a);
- /** See void Fl_Window::xclass(const char*) */
- const char* xclass() const {return xclass_;}
- /**
- A string used to tell the system what type of window this is. Mostly
- this identifies the picture to draw in the icon. Under X, 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". This only works if called
- before calling show().
- Under Microsoft Windows this string is used as the name of the
- WNDCLASS structure, though it is not clear if this can have any
- visible effect. The passed pointer is stored unchanged. The string
- is not copied.
- */
- void xclass(const char* c) {xclass_ = c;}
- /** Gets the current icon window target dependent data. */
- const void* icon() const {return icon_;}
- /** Sets the current icon window target dependent data. */
- void icon(const void * ic) {icon_ = ic;}
+ static void default_xclass(const char*);
+ static const char *default_xclass();
+ const char* xclass() const;
+ void xclass(const char* c);
+ const void* icon() const;
+ void icon(const void * ic);
/**
Returns non-zero if show() has been called (but not hide()
@@ -353,14 +341,18 @@ public:
int shown() {return i != 0;}
/**
Puts the window on the screen. Usually (on X) this has the side
- effect of opening the display. The second form is used for top-level
- windows and allows standard arguments to be parsed from the
- command-line.
+ effect of opening the display.
If the window is already shown then it is restored and raised to the
top. This is really convenient because your program can call show()
- at any time, even if the window is already up. It also means that
+ at any time, even if the window is already up. It also means that
show() serves the purpose of raise() in other toolkits.
+
+ Fl_Window::show(int argc, char **argv) is used for top-level
+ windows and allows standard arguments to be parsed from the
+ command-line.
+
+ \see Fl_Window::show(int argc, char **argv)
*/
virtual void show();
/**
@@ -369,9 +361,26 @@ public:
*/
virtual void hide();
/**
- See virtual void Fl_Window::show()
+ Puts the window on the screen and parses command-line arguments.
+
+ Usually (on X) this has the side effect of opening the display.
+
+ This form should be used for top-level windows, at least for the
+ first (main) window. It allows standard arguments to be parsed
+ from the command-line. You can use \p argc and \p argv from
+ main(int argc, char **argv) for this call.
+
+ The first call also sets up some system-specific internal
+ variables like the system colors.
+
+ \todo explain which system parameters are set up.
+
+ \param argc command-line argument count, usually from main()
+ \param argv command-line argument vector, usually from main()
+
+ \see virtual void Fl_Window::show()
*/
- void show(int, char**);
+ void show(int argc, char **argv);
/**
Makes the window completely fill the screen, without any window
manager border visible. You must use fullscreen_off() to undo
@@ -415,15 +424,9 @@ public:
*/
void make_current();
- /** Returns an Fl_Window pointer if this widget is an Fl_Window.
-
- \retval NULL if this widget is not derived from Fl_Window.
- \note This method is provided to avoid dynamic_cast.
- \todo More documentation ...
- */
+ // Note: Doxygen docs in Fl_Widget.H to avoid redundancy.
virtual Fl_Window* as_window() { return this; }
- // for back-compatibility only:
/**
Changes the cursor for this window. This always calls the system, if
you are changing the cursor a lot you may want to keep track of how
@@ -440,11 +443,23 @@ public:
void cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE); // platform dependent
void default_cursor(Fl_Cursor, Fl_Color=FL_BLACK, Fl_Color=FL_WHITE);
static void default_callback(Fl_Window*, void* v);
+
+ /** Returns the window width including any frame added by the window manager.
+
+ Same as w() if applied to a subwindow.
+ */
+ int decorated_w();
+ /** Returns the window height including any window title bar and any frame
+ added by the window manager.
+
+ Same as h() if applied to a subwindow.
+ */
+ int decorated_h();
};
#endif
//
-// End of "$Id: Fl_Window.H 7280 2010-03-16 22:51:31Z matt $".
+// End of "$Id: Fl_Window.H 8593 2011-04-15 21:38:05Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H b/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
index 80d8af52c..2dcf31513 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_Wizard.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Wizard.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_Wizard.H 8306 2011-01-24 17:04:22Z matt $"
//
// Fl_Wizard widget definitions.
//
-// Copyright 1999-2009 by Easy Software Products.
+// Copyright 1999-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
@@ -47,8 +47,8 @@
As with Fl_Tabs, wizard panes are composed of child (usually
Fl_Group) widgets. Navigation buttons must be added separately.
*/
-class FL_EXPORT Fl_Wizard : public Fl_Group
-{
+class FL_EXPORT Fl_Wizard : public Fl_Group {
+
Fl_Widget *value_;
void draw();
@@ -66,5 +66,5 @@ class FL_EXPORT Fl_Wizard : public Fl_Group
#endif // !_Fl_Wizard_H_
//
-// End of "$Id: Fl_Wizard.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_Wizard.H 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
index 315cee80c..53081ebdd 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_XBM_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XBM_Image.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_XBM_Image.H 7903 2010-11-28 21:06:39Z matt $"
//
// XBM image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -46,5 +46,5 @@ class FL_EXPORT Fl_XBM_Image : public Fl_Bitmap {
#endif // !Fl_XBM_Image_H
//
-// End of "$Id: Fl_XBM_Image.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_XBM_Image.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H b/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
index e5e7ec61d..2f1a18acc 100644
--- a/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
+++ b/plugins/zynaddsubfx/fltk/FL/Fl_XPM_Image.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XPM_Image.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: Fl_XPM_Image.H 7903 2010-11-28 21:06:39Z matt $"
//
// XPM image header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -47,5 +47,5 @@ class FL_EXPORT Fl_XPM_Image : public Fl_Pixmap {
#endif // !Fl_XPM_Image
//
-// End of "$Id: Fl_XPM_Image.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: Fl_XPM_Image.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/Xutf8.h b/plugins/zynaddsubfx/fltk/FL/Xutf8.h
index b4009bd6e..b122d2e04 100644
--- a/plugins/zynaddsubfx/fltk/FL/Xutf8.h
+++ b/plugins/zynaddsubfx/fltk/FL/Xutf8.h
@@ -1,7 +1,7 @@
-/* "$Id: Xutf8.h 6942 2009-11-18 12:22:51Z AlbrechtS $"
+/* "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
- * Copyright 2000-2003 by O'ksi'D.
+ * 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
@@ -48,8 +48,8 @@ typedef struct {
XUtf8FontStruct *
XCreateUtf8FontStruct (
- Display *dpy,
- const char *base_font_name_list);
+ Display *dpy,
+ const char *base_font_name_list);
void
XUtf8DrawString(
@@ -62,6 +62,19 @@ XUtf8DrawString(
const char *string,
int num_bytes);
+void
+XUtf8_measure_extents(
+ Display *display,
+ Drawable d,
+ XUtf8FontStruct *font_set,
+ GC gc,
+ int *xx,
+ int *yy,
+ int *ww,
+ int *hh,
+ const char *string,
+ int num_bytes);
+
void
XUtf8DrawRtlString(
Display *display,
@@ -89,7 +102,7 @@ XUtf8TextWidth(
XUtf8FontStruct *font_set,
const char *string,
int num_bytes);
-int
+int
XUtf8UcsWidth(
XUtf8FontStruct *font_set,
unsigned int ucs);
@@ -100,41 +113,41 @@ XGetUtf8FontAndGlyph(
unsigned int ucs,
XFontStruct **fnt,
unsigned short *id);
-
+
void
XFreeUtf8FontStruct(
Display *dpy,
XUtf8FontStruct *font_set);
-int
-XConvertUtf8ToUcs(
- const unsigned char *buf,
- int len,
+int
+XConvertUtf8ToUcs(
+ const unsigned char *buf,
+ int len,
unsigned int *ucs);
-int
+int
XConvertUcsToUtf8(
- unsigned int ucs,
+ unsigned int ucs,
char *buf);
-int
+int
XUtf8CharByteLen(
- const unsigned char *buf,
+ const unsigned char *buf,
int len);
-int
+int
XCountUtf8Char(
- const unsigned char *buf,
+ const unsigned char *buf,
int len);
-int
-XFastConvertUtf8ToUcs(
- const unsigned char *buf,
- int len,
+int
+XFastConvertUtf8ToUcs(
+ const unsigned char *buf,
+ int len,
unsigned int *ucs);
-long
+long
XKeysymToUcs(
KeySym keysym);
@@ -147,7 +160,7 @@ XUtf8LookupString(
KeySym* keysym,
Status* status_return);
-unsigned short
+unsigned short
XUtf8IsNonSpacing(
unsigned int ucs);
@@ -156,11 +169,11 @@ XUtf8IsRightToLeft(
unsigned int ucs);
-int
+int
XUtf8Tolower(
int ucs);
-int
+int
XUtf8Toupper(
int ucs);
@@ -172,5 +185,5 @@ XUtf8Toupper(
#endif
/*
- * End of "$Id: Xutf8.h 6942 2009-11-18 12:22:51Z AlbrechtS $".
- */
+ * End of "$Id: Xutf8.h 8399 2011-02-07 22:22:16Z ianmacarthur $".
+ */
diff --git a/plugins/zynaddsubfx/fltk/FL/dirent.h b/plugins/zynaddsubfx/fltk/FL/dirent.h
index 764a4cba4..7b68cd169 100644
--- a/plugins/zynaddsubfx/fltk/FL/dirent.h
+++ b/plugins/zynaddsubfx/fltk/FL/dirent.h
@@ -1,9 +1,9 @@
//
-// "$Id: dirent.h 7504 2010-04-14 20:17:44Z matt $"
+// "$Id: dirent.h 8623 2011-04-24 17:09:41Z AlbrechtS $"
//
// Directory header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -26,9 +26,9 @@
//
-// this file is for back-compatability only
+// this file is for back-compatibility only
#include "filename.H"
//
-// End of "$Id: dirent.h 7504 2010-04-14 20:17:44Z matt $".
+// End of "$Id: dirent.h 8623 2011-04-24 17:09:41Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/filename.H b/plugins/zynaddsubfx/fltk/FL/filename.H
index 7c0187926..3acae5788 100644
--- a/plugins/zynaddsubfx/fltk/FL/filename.H
+++ b/plugins/zynaddsubfx/fltk/FL/filename.H
@@ -1,9 +1,9 @@
/*
- * "$Id: filename.H 7504 2010-04-14 20:17:44Z matt $"
+ * "$Id: filename.H 8073 2010-12-20 13:35:43Z ianmacarthur $"
*
* Filename header file for the Fast Light Tool Kit (FLTK).
*
- * Copyright 1998-2009 by Bill Spitzak and others.
+ * 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
@@ -25,9 +25,10 @@
* http://www.fltk.org/str.php
*/
-// Xcode on OS X includes files by recursing down into directories.
-// This code catches the cycle and directly includes the required file.
-#ifdef fl_dirent_h_cyclic_include
+/* Xcode on OS X includes files by recursing down into directories.
+ * This code catches the cycle and directly includes the required file.
+ */
+#ifdef fl_dirent_h_cyclic_include
# include "/usr/include/dirent.h"
#endif
@@ -36,11 +37,12 @@
# include "Fl_Export.H"
-/** \addtogroup filenames File names and URI utility functions
+/** \addtogroup filenames File names and URI utility functions
+ File names and URI functions defined in
@{ */
-# define FL_PATH_MAX 256 /**< all path buffers should use this length */
-/** Gets the file name from a path.
+# define FL_PATH_MAX 2048 /**< all path buffers should use this length */
+/** Gets the file name from a path.
Similar to basename(3), exceptions shown below.
\code
#include
@@ -72,6 +74,7 @@ FL_EXPORT int fl_filename_isdir(const char *name);
inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
+FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd);
inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
# endif /* __cplusplus */
@@ -100,9 +103,9 @@ struct dirent {char d_name[1];};
* It would be best to create a file that does this...
*/
# include
-# define fl_dirent_h_cyclic_include
+# define fl_dirent_h_cyclic_include
# include
-# undef fl_dirent_h_cyclic_include
+# undef fl_dirent_h_cyclic_include
# endif
# if defined (__cplusplus)
@@ -127,6 +130,7 @@ FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
Fl_File_Sort_F *s = fl_numericsort);
+FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
/*
* Generic function to open a Uniform Resource Identifier (URI) using a
@@ -172,5 +176,5 @@ int _fl_filename_isdir_quick(const char *name);
/** @} */
/*
- * End of "$Id: filename.H 7504 2010-04-14 20:17:44Z matt $".
+ * End of "$Id: filename.H 8073 2010-12-20 13:35:43Z ianmacarthur $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_ask.H b/plugins/zynaddsubfx/fltk/FL/fl_ask.H
index f9a245748..98e7f3964 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_ask.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_ask.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_ask.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: fl_ask.H 8441 2011-02-18 08:52:48Z AlbrechtS $"
//
// Standard dialog header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,9 +43,6 @@ enum {
# ifdef __GNUC__
# define __fl_attr(x) __attribute__ (x)
-# if __GNUC__ < 3
-# define __deprecated__
-# endif // __GNUC__ < 3
# else
# define __fl_attr(x)
# endif // __GNUC__
@@ -67,6 +64,12 @@ extern FL_EXPORT Fl_Fontsize fl_message_size_;
inline void fl_message_font(Fl_Font f, Fl_Fontsize s) {
fl_message_font_ = f; fl_message_size_ = s;}
+FL_EXPORT void fl_message_hotspot(int enable);
+FL_EXPORT int fl_message_hotspot(void);
+
+FL_EXPORT void fl_message_title(const char *title);
+FL_EXPORT void fl_message_title_default(const char *title);
+
// pointers you can use to change FLTK to a foreign language:
extern FL_EXPORT const char* fl_no;
extern FL_EXPORT const char* fl_yes;
@@ -76,5 +79,5 @@ extern FL_EXPORT const char* fl_close;
#endif // !fl_ask_H
//
-// End of "$Id: fl_ask.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: fl_ask.H 8441 2011-02-18 08:52:48Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_draw.H b/plugins/zynaddsubfx/fltk/FL/fl_draw.H
index e515b1c35..93c0ce1a6 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_draw.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_draw.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_draw.H 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: fl_draw.H 8772 2011-06-02 08:06:09Z manolo $"
//
// Portable drawing function header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,9 +33,10 @@
#ifndef fl_draw_H
#define fl_draw_H
-#include "Enumerations.H" // for the color names
-#include "Fl_Window.H" // for fl_set_spot()
-#include "Fl_Device.H"
+#include // for Fl_Region
+#include // for the color names
+#include // for fl_set_spot()
+#include // for fl_graphics_driver
// Image class...
class Fl_Image;
@@ -57,11 +58,11 @@ FL_EXPORT extern char fl_draw_shortcut;
the foreground is not set for the current window.
\param[in] c color
*/
-inline void fl_color(Fl_Color c) {fl_graphics_driver->color(c); }; // select indexed color
+inline void fl_color(Fl_Color c) {fl_graphics_driver->color(c); } // select indexed color
/** for back compatibility - use fl_color(Fl_Color c) instead */
inline void fl_color(int c) {fl_color((Fl_Color)c);}
/**
- Set the color for all subsequent drawing operations.
+ Sets the color for all subsequent drawing operations.
The closest possible match to the RGB color is used.
The RGB color is used directly on TrueColor displays.
For colormap visuals the nearest index in the gray
@@ -70,14 +71,12 @@ inline void fl_color(int c) {fl_color((Fl_Color)c);}
the foreground is not set for the current window.
\param[in] r,g,b color components
*/
-inline void fl_color(uchar r, uchar g, uchar b) {fl_graphics_driver->color(r,g,b); }; // select actual color
-/** \brief The current color */
-extern FL_EXPORT Fl_Color fl_color_;
+inline void fl_color(uchar r, uchar g, uchar b) {fl_graphics_driver->color(r,g,b); } // select actual color
/**
Returns the last fl_color() that was set.
This can be used for state save/restore.
*/
-inline Fl_Color fl_color() {return fl_color_;}
+inline Fl_Color fl_color() {return fl_graphics_driver->color();}
/** @} */
/** \addtogroup fl_drawings
@@ -89,13 +88,20 @@ inline Fl_Color fl_color() {return fl_color_;}
new region onto the stack.
\param[in] x,y,w,h position and size
*/
-inline void fl_push_clip(int x, int y, int w, int h) {fl_graphics_driver->push_clip(x,y,w,h); };
-/** The fl_clip() name is deprecated and will be removed from future releases */
+inline void fl_push_clip(int x, int y, int w, int h) {fl_graphics_driver->push_clip(x,y,w,h); }
+/**
+ Intersects the current clip region with a rectangle and pushes this
+ new region onto the stack (deprecated).
+ \param[in] x,y,w,h position and size
+ \deprecated
+ fl_clip(int, int, int, int) is deprecated and will be removed from future releases.
+ Please use fl_push_clip(int x, int y, int w, int h) instead.
+ */
#define fl_clip fl_push_clip
/**
Pushes an empty clip region onto the stack so nothing will be clipped.
*/
-inline void fl_push_no_clip() {fl_graphics_driver->push_no_clip(); };
+inline void fl_push_no_clip() {fl_graphics_driver->push_no_clip(); }
/**
Restores the previous clip region.
@@ -103,7 +109,7 @@ inline void fl_push_no_clip() {fl_graphics_driver->push_no_clip(); };
Unpredictable results may occur if the clip stack is not empty when
you return to FLTK.
*/
-inline void fl_pop_clip() {fl_graphics_driver->pop_clip(); };
+inline void fl_pop_clip() {fl_graphics_driver->pop_clip(); }
/**
Does the rectangle intersect the current clip region?
\param[in] x,y,w,h position and size of rectangle
@@ -114,43 +120,40 @@ inline void fl_pop_clip() {fl_graphics_driver->pop_clip(); };
Under X this returns 2 if the rectangle is partially clipped,
and 1 if it is entirely inside the clip region.
*/
-inline int fl_not_clipped(int x, int y, int w, int h) {return fl_graphics_driver->not_clipped(x,y,w,h); };
+inline int fl_not_clipped(int x, int y, int w, int h) {return fl_graphics_driver->not_clipped(x,y,w,h); }
/**
Intersects the rectangle with the current clip region and returns the
bounding box of the result.
Returns non-zero if the resulting rectangle is different to the original.
This can be used to limit the necessary drawing to a rectangle.
- \p W and \p H are set to zero if the rectangle is completely outside
- the region.
+ \p W and \p H are set to zero if the rectangle is completely outside the region.
\param[in] x,y,w,h position and size of rectangle
\param[out] X,Y,W,H position and size of resulting bounding box.
- \p W and \p H are set to zero if the rectangle is
- completely outside the region.
\returns Non-zero if the resulting rectangle is different to the original.
*/
inline int fl_clip_box(int x , int y, int w, int h, int& X, int& Y, int& W, int& H)
- {return fl_graphics_driver->clip_box(x,y,w,h,X,Y,W,H); };
+ {return fl_graphics_driver->clip_box(x,y,w,h,X,Y,W,H); }
/** Undoes any clobbering of clip done by your program */
-extern void fl_restore_clip();
+inline void fl_restore_clip() { fl_graphics_driver->restore_clip(); }
/**
Replaces the top of the clipping stack with a clipping region of any shape.
Fl_Region is an operating system specific type.
\param[in] r clipping region
*/
-FL_EXPORT void fl_clip_region(Fl_Region r);
+inline void fl_clip_region(Fl_Region r) { fl_graphics_driver->clip_region(r); }
/**
- returns the current clipping region.
+ Returns the current clipping region.
*/
-extern Fl_Region fl_clip_region();
-
+inline Fl_Region fl_clip_region() { return fl_graphics_driver->clip_region(); }
+
// points:
/**
Draws a single pixel at the given coordinates
*/
-inline void fl_point(int x, int y) { fl_graphics_driver->point(x,y); };
+inline void fl_point(int x, int y) { fl_graphics_driver->point(x,y); }
// line type:
/**
@@ -180,7 +183,7 @@ inline void fl_point(int x, int y) { fl_graphics_driver->point(x,y); };
\note The \p dashes array does not work under Windows 95, 98 or Me,
since those operating systems do not support complex line styles.
*/
-inline void fl_line_style(int style, int width=0, char* dashes=0) {fl_graphics_driver->line_style(style,width,dashes); };
+inline void fl_line_style(int style, int width=0, char* dashes=0) {fl_graphics_driver->line_style(style,width,dashes); }
enum {
FL_SOLID = 0, ///< line style: ___________
FL_DASH = 1, ///< line style: _ _ _ _ _ _
@@ -204,17 +207,17 @@ enum {
This function is meant for quick drawing of simple boxes. The behavior is
undefined for line widths that are not 1.
*/
-inline void fl_rect(int x, int y, int w, int h) { fl_graphics_driver->rect(x,y,w,h); };
+inline void fl_rect(int x, int y, int w, int h) { fl_graphics_driver->rect(x,y,w,h); }
/** Draws with passed color a 1-pixel border \e inside the given bounding box */
inline void fl_rect(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rect(x,y,w,h);}
/** Colors with current color a rectangle that exactly fills the given bounding box */
-inline void fl_rectf(int x, int y, int w, int h) { fl_graphics_driver->rectf(x,y,w,h); };
-/** Colors with passsed color a rectangle that exactly fills the given bounding box */
+inline void fl_rectf(int x, int y, int w, int h) { fl_graphics_driver->rectf(x,y,w,h); }
+/** Colors with passed color a rectangle that exactly fills the given bounding box */
inline void fl_rectf(int x, int y, int w, int h, Fl_Color c) {fl_color(c); fl_rectf(x,y,w,h);}
/**
- Color a rectangle with "exactly" the passed r,g,b color.
+ Colors a rectangle with "exactly" the passed r,g,b color.
On screens with less than 24 bits of color this is done by drawing a
solid-colored block using fl_draw_image() so that the correct color
shade is produced.
@@ -226,63 +229,63 @@ FL_EXPORT void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b);
/**
Draws a line from (x,y) to (x1,y1)
*/
-inline void fl_line(int x, int y, int x1, int y1) {fl_graphics_driver->line(x,y,x1,y1); };
+inline void fl_line(int x, int y, int x1, int y1) {fl_graphics_driver->line(x,y,x1,y1); }
/**
Draws a line from (x,y) to (x1,y1) and another from (x1,y1) to (x2,y2)
*/
-inline void fl_line(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->line(x,y,x1,y1,x2,y2); };
+inline void fl_line(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->line(x,y,x1,y1,x2,y2); }
// closed line segments:
/**
Outlines a 3-sided polygon with lines
*/
-inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->loop(x,y,x1,y1,x2,y2); };
+inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->loop(x,y,x1,y1,x2,y2); }
/**
Outlines a 4-sided polygon with lines
*/
inline void fl_loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
- {fl_graphics_driver->loop(x,y,x1,y1,x2,y2,x3,y3); };
+ {fl_graphics_driver->loop(x,y,x1,y1,x2,y2,x3,y3); }
// filled polygons
/**
Fills a 3-sided polygon. The polygon must be convex.
*/
-inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->polygon(x,y,x1,y1,x2,y2); };
+inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2) {fl_graphics_driver->polygon(x,y,x1,y1,x2,y2); }
/**
Fills a 4-sided polygon. The polygon must be convex.
*/
inline void fl_polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3)
- { fl_graphics_driver->polygon(x,y,x1,y1,x2,y2,x3,y3); };
+ { fl_graphics_driver->polygon(x,y,x1,y1,x2,y2,x3,y3); }
// draw rectilinear lines, horizontal segment first:
/**
Draws a horizontal line from (x,y) to (x1,y)
*/
-inline void fl_xyline(int x, int y, int x1) {fl_graphics_driver->xyline(x,y,x1);};
+inline void fl_xyline(int x, int y, int x1) {fl_graphics_driver->xyline(x,y,x1);}
/**
Draws a horizontal line from (x,y) to (x1,y), then vertical from (x1,y) to (x1,y2)
*/
-inline void fl_xyline(int x, int y, int x1, int y2) {fl_graphics_driver->xyline(x,y,x1,y2);};
+inline void fl_xyline(int x, int y, int x1, int y2) {fl_graphics_driver->xyline(x,y,x1,y2);}
/**
Draws a horizontal line from (x,y) to (x1,y), then a vertical from (x1,y) to (x1,y2)
and then another horizontal from (x1,y2) to (x3,y2)
*/
-inline void fl_xyline(int x, int y, int x1, int y2, int x3) {fl_graphics_driver->xyline(x,y,x1,y2,x3);};
+inline void fl_xyline(int x, int y, int x1, int y2, int x3) {fl_graphics_driver->xyline(x,y,x1,y2,x3);}
// draw rectilinear lines, vertical segment first:
/**
Draws a vertical line from (x,y) to (x,y1)
*/
-inline void fl_yxline(int x, int y, int y1) {fl_graphics_driver->yxline(x,y,y1);};
+inline void fl_yxline(int x, int y, int y1) {fl_graphics_driver->yxline(x,y,y1);}
/**
Draws a vertical line from (x,y) to (x,y1), then a horizontal from (x,y1) to (x2,y1)
*/
-inline void fl_yxline(int x, int y, int y1, int x2) {fl_graphics_driver->yxline(x,y,y1,x2);};
+inline void fl_yxline(int x, int y, int y1, int x2) {fl_graphics_driver->yxline(x,y,y1,x2);}
/**
Draws a vertical line from (x,y) to (x,y1) then a horizontal from (x,y1)
to (x2,y1), then another vertical from (x2,y1) to (x2,y3)
*/
-inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_graphics_driver->yxline(x,y,y1,x2,y3);};
+inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_graphics_driver->yxline(x,y,y1,x2,y3);}
// circular lines and pie slices (code in fl_arci.C):
/**
@@ -294,7 +297,7 @@ inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_graphics_driver-
much nicer small circles, since the small sizes are often hard-coded bitmaps.
If a complete circle is drawn it will fit inside the passed bounding box.
- The two angles are measured in degrees counterclockwise from 3 o'clock and
+ The two angles are measured in degrees counter-clockwise from 3 o'clock and
are the starting and ending angle of the arc, \p a2 must be greater or equal
to \p a1.
@@ -307,7 +310,7 @@ inline void fl_yxline(int x, int y, int y1, int x2, int y3) {fl_graphics_driver-
counter-clockwise from 3 o'clock. \p a2 must be greater
than or equal to \p a1.
*/
-inline void fl_arc(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->arc(x,y,w,h,a1,a2); };
+inline void fl_arc(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->arc(x,y,w,h,a1,a2); }
/**
Draw filled ellipse sections using integer coordinates.
@@ -320,41 +323,71 @@ inline void fl_arc(int x, int y, int w, int h, double a1, double a2) {fl_graphic
counter-clockwise from 3 o'clock. \p a2 must be greater
than or equal to \p a1.
*/
-inline void fl_pie(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->pie(x,y,w,h,a1,a2); };
+inline void fl_pie(int x, int y, int w, int h, double a1, double a2) {fl_graphics_driver->pie(x,y,w,h,a1,a2); }
/** fl_chord declaration is a place holder - the function does not yet exist */
FL_EXPORT void fl_chord(int x, int y, int w, int h, double a1, double a2); // nyi
// scalable drawing code (code in fl_vertex.C and fl_arc.C):
-FL_EXPORT void fl_push_matrix();
-FL_EXPORT void fl_pop_matrix();
-FL_EXPORT void fl_scale(double x, double y);
-FL_EXPORT void fl_scale(double x);
-FL_EXPORT void fl_translate(double x, double y);
-FL_EXPORT void fl_rotate(double d);
-FL_EXPORT void fl_mult_matrix(double a, double b, double c, double d, double x,double y);
+/**
+ Saves the current transformation matrix on the stack.
+ The maximum depth of the stack is 32.
+ */
+inline void fl_push_matrix() { fl_graphics_driver->push_matrix(); }
+/**
+ Restores the current transformation matrix from the stack.
+ */
+inline void fl_pop_matrix() { fl_graphics_driver->pop_matrix(); }
+/**
+ Concatenates scaling transformation onto the current one.
+ \param[in] x,y scale factors in x-direction and y-direction
+ */
+inline void fl_scale(double x, double y) { fl_graphics_driver->scale(x, y); }
+/**
+ Concatenates scaling transformation onto the current one.
+ \param[in] x scale factor in both x-direction and y-direction
+ */
+inline void fl_scale(double x) { fl_graphics_driver->scale(x, x); }
+/**
+ Concatenates translation transformation onto the current one.
+ \param[in] x,y translation factor in x-direction and y-direction
+ */
+inline void fl_translate(double x, double y) { fl_graphics_driver->translate(x, y); }
+/**
+ Concatenates rotation transformation onto the current one.
+ \param[in] d - rotation angle, counter-clockwise in degrees (not radians)
+ */
+inline void fl_rotate(double d) { fl_graphics_driver->rotate(d); }
+/**
+ Concatenates another transformation onto the current one.
+
+ \param[in] a,b,c,d,x,y transformation matrix elements such that
+ X' = aX + cY + x and Y' = bX +dY + y
+ */
+inline void fl_mult_matrix(double a, double b, double c, double d, double x,double y)
+ { fl_graphics_driver->mult_matrix(a, b, c, d, x, y); }
/**
Starts drawing a list of points. Points are added to the list with fl_vertex()
*/
-inline void fl_begin_points() {fl_graphics_driver->begin_points(); };
+inline void fl_begin_points() {fl_graphics_driver->begin_points(); }
/**
Starts drawing a list of lines.
*/
-inline void fl_begin_line() {fl_graphics_driver->begin_line(); };
+inline void fl_begin_line() {fl_graphics_driver->begin_line(); }
/**
Starts drawing a closed sequence of lines.
*/
-inline void fl_begin_loop() {fl_graphics_driver->begin_loop(); };
+inline void fl_begin_loop() {fl_graphics_driver->begin_loop(); }
/**
Starts drawing a convex filled polygon.
*/
-inline void fl_begin_polygon() {fl_graphics_driver->begin_polygon(); };
+inline void fl_begin_polygon() {fl_graphics_driver->begin_polygon(); }
/**
Adds a single vertex to the current path.
\param[in] x,y coordinate
*/
-inline void fl_vertex(double x, double y) {fl_graphics_driver->vertex(x,y); };
+inline void fl_vertex(double x, double y) {fl_graphics_driver->vertex(x,y); }
/**
- Add a series of points on a Bezier curve to the path.
+ Adds a series of points on a Bezier curve to the path.
The curve ends (and two of the points) are at X0,Y0 and X3,Y3.
\param[in] X0,Y0 curve start point
\param[in] X1,Y1 curve control point
@@ -362,16 +395,16 @@ inline void fl_vertex(double x, double y) {fl_graphics_driver->vertex(x,y); };
\param[in] X3,Y3 curve end point
*/
inline void fl_curve(double X0, double Y0, double X1, double Y1, double X2, double Y2, double X3, double Y3)
- {fl_graphics_driver->curve(X0,Y0,X1,Y1,X2,Y2,X3,Y3); };
+ {fl_graphics_driver->curve(X0,Y0,X1,Y1,X2,Y2,X3,Y3); }
/**
- Add a series of points to the current path on the arc of a circle; you
- can get elliptical paths by using scale and rotate before calling fl_arc().
+ Adds a series of points to the current path on the arc of a circle.
+ You can get elliptical paths by using scale and rotate before calling fl_arc().
\param[in] x,y,r center and radius of circular arc
\param[in] start,end angles of start and end of arc measured in degrees
counter-clockwise from 3 o'clock. If \p end is less than \p start
then it draws the arc in a clockwise direction.
*/
-inline void fl_arc(double x, double y, double r, double start, double end) {fl_graphics_driver->arc(x,y,r,start,end); };
+inline void fl_arc(double x, double y, double r, double start, double end) {fl_graphics_driver->arc(x,y,r,start,end); }
/**
fl_circle() is equivalent to fl_arc(x,y,r,0,360), but may be faster.
@@ -379,23 +412,23 @@ inline void fl_arc(double x, double y, double r, double start, double end) {fl_g
a complex polygon you must use fl_arc()
\param[in] x,y,r center and radius of circle
*/
-inline void fl_circle(double x, double y, double r) {fl_graphics_driver->circle(x,y,r); };
+inline void fl_circle(double x, double y, double r) {fl_graphics_driver->circle(x,y,r); }
/**
Ends list of points, and draws.
*/
-inline void fl_end_points() {fl_graphics_driver->end_points(); };
+inline void fl_end_points() {fl_graphics_driver->end_points(); }
/**
Ends list of lines, and draws.
*/
-inline void fl_end_line() {fl_graphics_driver->end_line(); };
+inline void fl_end_line() {fl_graphics_driver->end_line(); }
/**
Ends closed sequence of lines, and draws.
*/
-inline void fl_end_loop() {fl_graphics_driver->end_loop(); };
+inline void fl_end_loop() {fl_graphics_driver->end_loop(); }
/**
Ends convex filled polygon, and draws.
*/
-inline void fl_end_polygon() {fl_graphics_driver->end_polygon(); };
+inline void fl_end_polygon() {fl_graphics_driver->end_polygon(); }
/**
Starts drawing a complex filled polygon.
@@ -410,28 +443,44 @@ inline void fl_end_polygon() {fl_graphics_driver->end_polygon(); };
whether "even/odd" or "non-zero" winding rules are used to fill them.
Holes should be drawn in the opposite direction to the outside loop.
*/
-inline void fl_begin_complex_polygon() {fl_graphics_driver->begin_complex_polygon(); };
+inline void fl_begin_complex_polygon() {fl_graphics_driver->begin_complex_polygon(); }
/**
Call fl_gap() to separate loops of the path.
It is unnecessary but harmless to call fl_gap() before the first vertex,
after the last vertex, or several times in a row.
*/
-inline void fl_gap() {fl_graphics_driver->gap(); };
+inline void fl_gap() {fl_graphics_driver->gap(); }
/**
Ends complex filled polygon, and draws.
*/
-inline void fl_end_complex_polygon() {fl_graphics_driver->end_complex_polygon(); };
+inline void fl_end_complex_polygon() {fl_graphics_driver->end_complex_polygon(); }
// get and use transformed positions:
-FL_EXPORT double fl_transform_x(double x, double y);
-FL_EXPORT double fl_transform_y(double x, double y);
-FL_EXPORT double fl_transform_dx(double x, double y);
-FL_EXPORT double fl_transform_dy(double x, double y);
+/**
+ Transforms coordinate using the current transformation matrix.
+ \param[in] x,y coordinate
+ */
+inline double fl_transform_x(double x, double y) {return fl_graphics_driver->transform_x(x, y); }
+/**
+ Transforms coordinate using the current transformation matrix.
+ \param[in] x,y coordinate
+ */
+inline double fl_transform_y(double x, double y) {return fl_graphics_driver->transform_y(x, y); }
+/**
+ Transforms distance using current transformation matrix.
+ \param[in] x,y coordinate
+ */
+inline double fl_transform_dx(double x, double y) {return fl_graphics_driver->transform_dx(x, y); }
+/**
+ Transforms distance using current transformation matrix.
+ \param[in] x,y coordinate
+ */
+inline double fl_transform_dy(double x, double y) {return fl_graphics_driver->transform_dy(x, y); }
/**
Adds coordinate pair to the vertex list without further transformations.
\param[in] xf,yf transformed coordinate
*/
-inline void fl_transformed_vertex(double xf, double yf) {fl_graphics_driver->transformed_vertex(xf,yf); };
+inline void fl_transformed_vertex(double xf, double yf) {fl_graphics_driver->transformed_vertex(xf,yf); }
/** @} */
/** \addtogroup fl_attributes
@@ -448,81 +497,79 @@ inline void fl_transformed_vertex(double xf, double yf) {fl_graphics_driver->tra
The size of the font is measured in pixels and not "points".
Lines should be spaced \p size pixels apart or more.
*/
-inline void fl_font(Fl_Font face, Fl_Fontsize size) { fl_graphics_driver->font(face,size); };
-extern FL_EXPORT Fl_Font fl_font_; ///< current font index
+inline void fl_font(Fl_Font face, Fl_Fontsize size) { fl_graphics_driver->font(face,size); }
/**
Returns the \p face set by the most recent call to fl_font().
This can be used to save/restore the font.
*/
-inline Fl_Font fl_font() {return fl_font_;}
-/** \brief current font size */
-extern FL_EXPORT Fl_Fontsize fl_size_;
+inline Fl_Font fl_font() {return fl_graphics_driver->font();}
/**
Returns the \p size set by the most recent call to fl_font().
This can be used to save/restore the font.
*/
-inline Fl_Fontsize fl_size() {return fl_size_;}
+inline Fl_Fontsize fl_size() {return fl_graphics_driver->size();}
// information you can get about the current font:
/**
Returns the recommended minimum line spacing for the current font.
You can also use the value of \p size passed to fl_font()
*/
-FL_EXPORT int fl_height(); // using "size" should work ok
+inline int fl_height() {return fl_graphics_driver->height();}
FL_EXPORT int fl_height(int font, int size);
/**
Returns the recommended distance above the bottom of a fl_height() tall box to
draw the text at so it looks centered vertically in that box.
*/
-FL_EXPORT int fl_descent();
-/** Return the typographical width of a nul-terminated string */
+inline int fl_descent() {return fl_graphics_driver->descent();}
+/** Returns the typographical width of a nul-terminated string */
FL_EXPORT double fl_width(const char* txt);
-/** Return the typographical width of a sequence of \p n characters */
-FL_EXPORT double fl_width(const char* txt, int n);
-/** Return the typographical width of a single character :
+/** Returns the typographical width of a sequence of \p n characters */
+inline double fl_width(const char* txt, int n) {return fl_graphics_driver->width(txt, n);}
+/** Returns the typographical width of a single character.
\note if a valid fl_gc is NOT found then it uses the first window gc,
or the screen gc if no fltk window is available when called. */
-FL_EXPORT double fl_width(unsigned int);
-/** Determine the minimum pixel dimensions of a nul-terminated string.
+inline double fl_width(unsigned int c) {return fl_graphics_driver->width(c);}
+/** Determines the minimum pixel dimensions of a nul-terminated string.
-Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine
-its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho)
-such that a bounding box that exactly fits around the text could be drawn with
-fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first
-"colored in" pixel of the string, from the draw origin.
+ Usage: given a string "txt" drawn using fl_draw(txt, x, y) you would determine
+ its pixel extents on the display using fl_text_extents(txt, dx, dy, wo, ho)
+ such that a bounding box that exactly fits around the text could be drawn with
+ fl_rect(x+dx, y+dy, wo, ho). Note the dx, dy values hold the offset of the first
+ "colored in" pixel of the string, from the draw origin.
*/
FL_EXPORT void fl_text_extents(const char*, int& dx, int& dy, int& w, int& h); // NO fltk symbol expansion will be performed
-/** Determine the minimum pixel dimensions of a sequence of \p n characters.
+/** Determines the minimum pixel dimensions of a sequence of \p n characters.
\see fl_text_extents(const char*, int& dx, int& dy, int& w, int& h)
*/
-FL_EXPORT void fl_text_extents(const char*, int n, int& dx, int& dy, int& w, int& h);
+inline void fl_text_extents(const char *t, int n, int& dx, int& dy, int& w, int& h)
+ {fl_graphics_driver->text_extents(t, n, dx, dy, w, h);}
// font encoding:
// Note: doxygen comments here to avoid duplication for os-sepecific cases
/**
- convert text from Windows/X11 latin1 charcter set to local encoding.
+ Converts text from Windows/X11 latin1 character set to local encoding.
\param[in] t character string (latin1 encoding)
\param[in] n optional number of characters to convert (default is all)
\returns pointer to internal buffer containing converted characters
*/
FL_EXPORT const char *fl_latin1_to_local(const char *t, int n=-1);
/**
- convert text from local encoding to Windowx/X11 latin1 character set.
+ Converts text from local encoding to Windowx/X11 latin1 character set.
\param[in] t character string (local encoding)
\param[in] n optional number of characters to convert (default is all)
\returns pointer to internal buffer containing converted characters
*/
FL_EXPORT const char *fl_local_to_latin1(const char *t, int n=-1);
/**
- convert text from Mac Roman charcter set to local encoding.
+ Converts text from Mac Roman character set to local encoding.
\param[in] t character string (Mac Roman encoding)
\param[in] n optional number of characters to convert (default is all)
\returns pointer to internal buffer containing converted characters
*/
FL_EXPORT const char *fl_mac_roman_to_local(const char *t, int n=-1);
/**
- convert text from local encoding to Mac Roman character set.
+ Converts text from local encoding to Mac Roman character set.
\param[in] t character string (local encoding)
\param[in] n optional number of characters to convert (default is all)
\returns pointer to internal buffer containing converted characters
@@ -545,7 +592,7 @@ FL_EXPORT const char *fl_local_to_mac_roman(const char *t, int n=-1);
FL_EXPORT void fl_draw(const char* str, int x, int y);
/**
Draws a nul-terminated string starting at the given location and
- rotating \p angle degrees counterclockwise.
+ rotating \p angle degrees counter-clockwise.
This version of fl_draw provides direct access to the text drawing
function of the underlying OS and is supported by Xft, Win32 and MacOS
fltk subsets.
@@ -554,16 +601,16 @@ FL_EXPORT void fl_draw(int angle, const char* str, int x, int y);
/**
Draws an array of \p n characters starting at the given location.
*/
-inline void fl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->draw(str,n,x,y); };
+inline void fl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->draw(str,n,x,y); }
/**
Draws an array of \p n characters starting at the given location,
- rotating \p angle degrees counterclockwise.
+ rotating \p angle degrees counter-clockwise.
*/
-inline void fl_draw(int angle,const char* str, int n, int x, int y) {fl_graphics_driver->draw(angle,str,n,x,y); };
+inline void fl_draw(int angle,const char* str, int n, int x, int y) {fl_graphics_driver->draw(angle,str,n,x,y); }
/**
Draws an array of \p n characters right to left starting at given location.
*/
-inline void fl_rtl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->rtl_draw(str,n,x,y); };
+inline void fl_rtl_draw(const char* str, int n, int x, int y) {fl_graphics_driver->rtl_draw(str,n,x,y); }
FL_EXPORT void fl_measure(const char* str, int& x, int& y,
int draw_symbols = 1);
FL_EXPORT void fl_draw(const char* str, int x, int y, int w, int h,
@@ -582,13 +629,14 @@ FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
// images:
/**
- Draw an 8-bit per color RGB or luminance image.
+ Draws an 8-bit per color RGB or luminance image.
\param[in] buf points at the "r" data of the top-left pixel.
Color data must be in r,g,b order.
+ Luminance data is only one gray byte.
\param[in] X,Y position where to put top-left corner of image
\param[in] W,H size of the image
- \param[in] D delta to add to the pointer between pixels. it may be
- any value greater than or equal to 3, or it can be
+ \param[in] D delta to add to the pointer between pixels. It may be
+ any value greater than or equal to 1, or it can be
negative to flip the image horizontally
\param[in] L delta to add to the pointer between lines (if 0 is
passed it uses \p W * \p D), and may be larger than
@@ -601,6 +649,7 @@ FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
\code
Fl::visual(FL_RGB);
\endcode
+
Gray scale (1-channel) images may be drawn. This is done if
abs(D) is less than 3, or by calling fl_draw_image_mono().
Only one 8-bit sample is used for each pixel, and on screens with
@@ -615,31 +664,32 @@ FL_EXPORT void fl_draw_box(Fl_Boxtype, int x, int y, int w, int h, Fl_Color);
to 32 bits.
*/
inline void fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D=3, int L=0)
- { fl_graphics_driver->draw_image(buf, X, Y, W, H, D, L); };
+ { fl_graphics_driver->draw_image(buf, X, Y, W, H, D, L); }
/**
- Draw a gray-scale (1 channel) image.
+ Draws a gray-scale (1 channel) image.
\see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
*/
inline void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=1, int L=0)
- { fl_graphics_driver->draw_image_mono(buf, X, Y, W, H, D, L); };
+ { fl_graphics_driver->draw_image_mono(buf, X, Y, W, H, D, L); }
/**
- Draw image using callback function to generate image data.
+ Draws an image using a callback function to generate image data.
+
You can generate the image as it is being drawn, or do arbitrary
decompression of stored data, provided it can be decompressed to
individual scan lines easily.
\param[in] cb callback function to generate scan line data
\param[in] data user data passed to callback function
- \param[in] X,Y
- \param[in] W,H
- \param[in] D
+ \param[in] X,Y screen position of top left pixel
+ \param[in] W,H image width and height
+ \param[in] D data size in bytes (must be greater than 0)
\see fl_draw_image(const uchar* buf, int X,int Y,int W,int H, int D, int L)
The callback function \p cb is called with the void* \p data
user data pointer to allow access to a structure of information about
the image, and the \p x, \p y, and \p w of the scan line desired from
- the image. 0,0 is the upper-left corner of the image, not \p X, \p Y.
+ the image. 0,0 is the upper-left corner of the image, not \p x, \p y.
A pointer to a buffer to put the data into is passed. You must copy
\p w pixels from scanline \p y, starting at pixel \p x, to this buffer.
@@ -657,10 +707,10 @@ inline void fl_draw_image_mono(const uchar* buf, int X,int Y,int W,int H, int D=
If \p D is 4 or more, you must fill in the unused bytes with zero.
*/
inline void fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=3)
- { fl_graphics_driver->draw_image(cb, data, X, Y, W, H, D); };
+ { fl_graphics_driver->draw_image(cb, data, X, Y, W, H, D); }
/**
- Draw gray-scale image using callback function to generate image data.
+ Draws a gray-scale image using a callback function to generate image data.
\see fl_draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D)
*/
FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D=1);
@@ -674,17 +724,17 @@ FL_EXPORT void fl_draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,i
FL_EXPORT char fl_can_do_alpha_blending();
/**
- Read an RGB(A) image from the current window or off-screen buffer.
+ Reads an RGB(A) image from the current window or off-screen buffer.
\param[in] p pixel buffer, or NULL to allocate one
\param[in] X,Y position of top-left of image to read
\param[in] W,H width and height of image to read
- \param[in] alpha alpha value for image (0 fr none)
+ \param[in] alpha alpha value for image (0 for none)
\returns pointer to pixel buffer, or NULL if allocation failed.
The \p p argument points to a buffer that can hold the image and must
be at least \p W*H*3 bytes when reading RGB images, or \p W*H*4 bytes
when reading RGBA images. If NULL, fl_read_image() will create an
- array of the proper suze which can be freed using delete[].
+ array of the proper size which can be freed using delete[].
The \p alpha parameter controls whether an alpha channel is created
and the value that is placed in the alpha channel. If 0, no alpha
@@ -730,5 +780,5 @@ FL_EXPORT int fl_add_symbol(const char* name, void (*drawit)(Fl_Color), int scal
#endif
//
-// End of "$Id: fl_draw.H 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: fl_draw.H 8772 2011-06-02 08:06:09Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_message.H b/plugins/zynaddsubfx/fltk/FL/fl_message.H
index bb64474e1..d07949e90 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_message.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_message.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_message.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: fl_message.H 7903 2010-11-28 21:06:39Z matt $"
//
// Standard message header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,5 +28,5 @@
#include "fl_ask.H"
//
-// End of "$Id: fl_message.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: fl_message.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H b/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
index f72fc5176..762a3b4c3 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_show_colormap.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_show_colormap.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: fl_show_colormap.H 8621 2011-04-23 15:46:30Z AlbrechtS $"
//
// Colormap picker header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -25,13 +25,34 @@
// http://www.fltk.org/str.php
//
+/** \file
+ The fl_show_colormap() function hides the implementation classes used
+ to provide the popup window and color selection mechanism.
+*/
+
#ifndef fl_show_colormap_H
#define fl_show_colormap_H
+/* doxygen comment here to avoid exposing ColorMenu in fl_show_colormap.cxx
+*/
+
+/** \addtogroup fl_attributes
+ @{ */
+
+/**
+ \brief Pops up a window to let the user pick a colormap entry.
+ \image html fl_show_colormap.png
+ \image latex fl_show_colormap.png "fl_show_colormap" height=10cm
+ \param[in] oldcol color to be highlighted when grid is shown.
+ \retval Fl_Color value of the chosen colormap entry.
+ \see Fl_Color_Chooser
+*/
FL_EXPORT Fl_Color fl_show_colormap(Fl_Color oldcol);
+/** @} */
+
#endif
//
-// End of "$Id: fl_show_colormap.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: fl_show_colormap.H 8621 2011-04-23 15:46:30Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_show_input.H b/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
index 268c3d168..2d931a417 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
+++ b/plugins/zynaddsubfx/fltk/FL/fl_show_input.H
@@ -1,9 +1,9 @@
//
-// "$Id: fl_show_input.H 6614 2009-01-01 16:11:32Z matt $"
+// "$Id: fl_show_input.H 7903 2010-11-28 21:06:39Z matt $"
//
// Standard input dialog header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,5 +28,5 @@
#include "fl_ask.H"
//
-// End of "$Id: fl_show_input.H 6614 2009-01-01 16:11:32Z matt $".
+// End of "$Id: fl_show_input.H 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_types.h b/plugins/zynaddsubfx/fltk/FL/fl_types.h
index 6175ded02..c019821a2 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_types.h
+++ b/plugins/zynaddsubfx/fltk/FL/fl_types.h
@@ -1,9 +1,9 @@
/*
- * "$Id: fl_types.h 6942 2009-11-18 12:22:51Z AlbrechtS $"
+ * "$Id: fl_types.h 7903 2010-11-28 21:06:39Z matt $"
*
* Simple "C"-style types for the Fast Light Tool Kit (FLTK).
*
- * Copyright 1998-2009 by Bill Spitzak and others.
+ * 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
@@ -62,5 +62,5 @@ typedef unsigned int Fl_Char;
#endif
/*
- * End of "$Id: fl_types.h 6942 2009-11-18 12:22:51Z AlbrechtS $".
+ * End of "$Id: fl_types.h 7903 2010-11-28 21:06:39Z matt $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/fl_utf8.h b/plugins/zynaddsubfx/fltk/FL/fl_utf8.h
index 767a2a3a3..311683ebb 100644
--- a/plugins/zynaddsubfx/fltk/FL/fl_utf8.h
+++ b/plugins/zynaddsubfx/fltk/FL/fl_utf8.h
@@ -1,7 +1,7 @@
-/* "$Id: fl_utf8.h 7551 2010-04-20 21:43:31Z engelsman $"
+/* "$Id: fl_utf8.h 8585 2011-04-13 15:43:22Z ianmacarthur $"
*
* Author: Jean-Marc Lienher ( http://oksid.ch )
- * Copyright 2000-2009 by O'ksi'D.
+ * 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
@@ -28,8 +28,6 @@
* with the functions provided in OksiD's fltk-1.1.6-utf8 port
*/
-/*** NOTE : all functions are LIMITED to 24 bits Unicode values !!! ***/
-
/**
\file fl_utf8.h
\brief header for Unicode and UTF8 chracter handling
@@ -100,6 +98,9 @@ FL_EXPORT int fl_utf8bytes(unsigned ucs);
/* OD: returns the byte length of the first UTF-8 char sequence (returns -1 if not valid) */
FL_EXPORT int fl_utf8len(char c);
+/* OD: returns the byte length of the first UTF-8 char sequence (returns +1 if not valid) */
+FL_EXPORT int fl_utf8len1(char c);
+
/* OD: returns the number of Unicode chars in the UTF-8 string */
FL_EXPORT int fl_utf_nb_char(const unsigned char *buf, int len);
@@ -115,6 +116,9 @@ FL_EXPORT const char* fl_utf8fwd(const char* p, const char* start, const char* e
/* F2: Move backward to the previous valid UTF8 sequence start */
FL_EXPORT const char* fl_utf8back(const char* p, const char* start, const char* end);
+/* XX: Convert a single 32-bit Unicode value into UTF16 */
+FL_EXPORT unsigned fl_ucs_to_Utf16(const unsigned ucs, unsigned short *dst, const unsigned dstlen);
+
/* F2: Convert a UTF8 string into UTF16 */
FL_EXPORT unsigned fl_utf8toUtf16(const char* src, unsigned srclen, unsigned short* dst, unsigned dstlen);
@@ -255,5 +259,5 @@ FL_EXPORT char fl_make_path( const char *path );
#endif /* _HAVE_FL_UTF8_HDR_ */
/*
- * End of "$Id: fl_utf8.h 7551 2010-04-20 21:43:31Z engelsman $".
+ * End of "$Id: fl_utf8.h 8585 2011-04-13 15:43:22Z ianmacarthur $".
*/
diff --git a/plugins/zynaddsubfx/fltk/FL/mac.H b/plugins/zynaddsubfx/fltk/FL/mac.H
index aa8e6fb31..704f521d8 100644
--- a/plugins/zynaddsubfx/fltk/FL/mac.H
+++ b/plugins/zynaddsubfx/fltk/FL/mac.H
@@ -1,9 +1,9 @@
//
-// "$Id: mac.H 7663 2010-07-01 16:51:28Z manolo $"
+// "$Id: mac.H 8657 2011-05-12 11:50:43Z manolo $"
//
// Mac header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -33,11 +33,13 @@
#if !defined(Fl_X_H)
# error "Never use directly; include instead."
#endif // !Fl_X_H
+#include
-// Standard MacOS Carbon API includes...
-#include
-#include
+typedef void* Window; // this is really a pointer to the subclass FLWindow of NSWindow
+typedef void* Fl_Offscreen; // this is really a CGContextRef
+typedef void* Fl_Bitmask; // this is really a CGImageRef
+#include
#ifndef MAC_OS_X_VERSION_10_3
#define MAC_OS_X_VERSION_10_3 1030
#endif
@@ -50,10 +52,36 @@
#ifndef MAC_OS_X_VERSION_10_6
#define MAC_OS_X_VERSION_10_6 1060
#endif
-#ifndef MAC_OS_X_VERSION_MAX_ALLOWED
-#define MAC_OS_X_VERSION_MAX_ALLOWED MAC_OS_X_VERSION_10_3
-#endif
+#if !(defined(FL_LIBRARY) || defined(FL_INTERNALS)) // this part is used when compiling an application program
+
+typedef void* Fl_Region;
+typedef void* Fl_CGContextRef;
+typedef void* Fl_PMPrintSettings;
+typedef void* Fl_PMPageFormat;
+typedef void* Fl_PMPrintSession;
+
+#else // this part must be compiled when building the FLTK libraries
+
+// Standard MacOS C/C++ includes...
+#include
+#undef check // because of Fl::check()
+
+typedef CGContextRef Fl_CGContextRef;
+typedef PMPrintSettings Fl_PMPrintSettings;
+typedef PMPageFormat Fl_PMPageFormat;
+typedef PMPrintSession Fl_PMPrintSession;
+
+typedef struct flCocoaRegion {
+ int count;
+ CGRect *rects;
+} *Fl_Region; // a region is the union of a series of rectangles
+
+# include "Fl_Window.H"
+
+// Some random X equivalents
+struct XPoint { int x, y; };
+struct XRectangle {int x, y, width, height;};
#ifndef CGFLOAT_DEFINED //appears with 10.5 in CGBase.h
#if defined(__LP64__) && __LP64__
typedef double CGFloat;
@@ -62,21 +90,7 @@ typedef float CGFloat;
#endif
#endif // CGFLOAT_DEFINED
-
-// Now make some fixes to the headers...
-#undef check // Dunno where this comes from...
-
-// Some random X equivalents
-struct XPoint { int x, y; };
-struct XRectangle {int x, y, width, height;};
-
-typedef void *Window; // this is really a pter to the subclass FLWindow of NSWindow
-typedef struct flCocoaRegion {
- int count;
- CGRect *rects;
-} *Fl_Region; // a region is the union of a series of rectangles
extern CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h);
-
inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
Fl_Region R = (Fl_Region)malloc(sizeof(*R));
R->count = 1;
@@ -86,33 +100,27 @@ inline Fl_Region XRectangleRegion(int x, int y, int w, int h) {
}
inline void XDestroyRegion(Fl_Region r) {
if(r) {
- free(r->rects);
- free(r);
- }
+ free(r->rects);
+ free(r);
+ }
}
-extern void *fl_default_cursor;
extern void *fl_system_menu;
-typedef CGContextRef Fl_Offscreen;
-typedef CGImageRef Fl_Bitmask;
-
-void fl_clip_region(Fl_Region);
-
-# include "Fl_Window.H"
+extern void *fl_default_cursor;
// This object contains all mac-specific stuff about a window:
// WARNING: this object is highly subject to change!
-class Fl_X
-{
+class Fl_X {
+
public:
- Window xid; // Cocoa: FLWindow* ; Carbon: WindowRef
- Fl_Offscreen other_xid; // pointer for offscreen bitmaps (doublebuffer)
+ Window xid; // pointer to the Cocoa window object (FLWindow*)
+ Fl_Offscreen other_xid; // pointer for offscreen bitmaps (overlay window)
Fl_Window *w; // FLTK window for
Fl_Region region;
Fl_Region subRegion; // region for this specific subwindow
Fl_X *next; // linked tree to support subwindows
Fl_X *xidChildren, *xidNext; // more subwindow tree
int wait_for_expose;
- void *cursor; // is really NSCursor*
+ void *cursor; // is really NSCursor*
static Fl_X* first;
static Fl_X* i(const Fl_Window* w) {return w->i;}
static int fake_X_wm(const Fl_Window*,int&,int&,int&,int&,int&);
@@ -125,60 +133,69 @@ public:
static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
static void q_begin_image(CGRect&, int x, int y, int w, int h);
static void q_end_image();
+ // Cocoa additions
+ void destroy(void);
+ void map(void);
+ void unmap(void);
+ int unlink(Fl_X* start = NULL);
+ void collapse(void);
+ WindowRef window_ref(void);
+ void set_key_window(void);
+ void set_cursor(Fl_Cursor);
+ static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h);
+ static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel);
+ static Fl_Region intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h);
+ static CGContextRef watch_cursor_image(void);
+ static CGContextRef help_cursor_image(void);
+ static CGContextRef nesw_cursor_image(void);
+ static CGContextRef nwse_cursor_image(void);
+ static CGContextRef none_cursor_image(void);
+ static void *get_carbon_function(const char *name);
+private:
+ static void relink(Fl_Window*, Fl_Window*);
+ bool subwindow;
};
-extern void MacDestroyWindow(Fl_Window*,void *);
-extern void MacMapWindow(Fl_Window*,void *);
-extern void MacUnmapWindow(Fl_Window*,void *);
-extern WindowRef MACwindowRef(Fl_Window *w);
-extern Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, int h);
-extern void MacCollapseWindow(Window w);
-
-extern int MacUnlinkWindow(Fl_X*,Fl_X*start=0L);
-
-inline Window fl_xid(const Fl_Window*w)
-{
- return Fl_X::i(w)->xid;
-}
-
extern struct Fl_XMap {
RGBColor rgb;
ulong pen;
} *fl_current_xmap;
-
-extern FL_EXPORT void *fl_display;
extern FL_EXPORT Window fl_window;
-extern FL_EXPORT CGContextRef fl_gc;
+
+#endif // FL_LIBRARY || FL_INTERNALS
+
+extern FL_EXPORT Fl_CGContextRef fl_gc;
extern FL_EXPORT class Fl_Sys_Menu_Bar *fl_sys_menu_bar;
+extern Window fl_xid(const Fl_Window*);
+void fl_clip_region(Fl_Region);
+extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
+extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
+extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
extern Fl_Offscreen fl_create_offscreen(int w, int h);
extern void fl_copy_offscreen(int x,int y,int w,int h, Fl_Offscreen gWorld, int srcx,int srcy);
extern void fl_delete_offscreen(Fl_Offscreen gWorld);
extern void fl_begin_offscreen(Fl_Offscreen gWorld);
extern void fl_end_offscreen();
-
-extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
-extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
-extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
-
+extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
extern void fl_open_display();
-extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
#endif // FL_DOXYGEN
-/** \defgroup group_macosx Mac OS X-specific functions
+/** \defgroup group_macosx Mac OS X-specific symbols
+ Mac OS X-specific symbols declared in or
@{ */
-/** @brief Register a function called for each file dropped onto an application icon
- * \note \#include
+/** @brief Register a function called for each file dropped onto an application icon.
+ \e cb will be called with a single Unix-style file name and path.
+ If multiple files were dropped, \e cb will be called multiple times.
*/
extern void fl_open_callback(void (*cb)(const char *));
/**
* \brief Attaches a callback to the "About myprog" item of the system application menu.
- * \note \#include
*
* \param cb a callback that will be called by "About myprog" menu item
* with NULL 1st argument.
@@ -186,9 +203,35 @@ extern void fl_open_callback(void (*cb)(const char *));
* \param shortcut optional shortcut to attach to the "About myprog" menu item (e.g., FL_META+'a')
*/
extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
+
+/** \brief The version number of the running Mac OS X (e.g., 100604 for 10.6.4)
+ */
+extern int fl_mac_os_version;
+
+class Fl_Mac_App_Menu {
+public:
+ /** Localizable text for the "About xxx" application menu item */
+ static const char *about;
+ /** Localizable text for the "Print Front Window" application menu item.
+ This menu item won't be displayed if Fl_Mac_App_Menu::print
+ is set to an empty string.
+ */
+ static const char *print;
+ /** Localizable text for the "Services" application menu item */
+ static const char *services;
+ /** Localizable text for the "Hide xxx" application menu item */
+ static const char *hide;
+ /** Localizable text for the "Hide Others" application menu item */
+ static const char *hide_others;
+ /** Localizable text for the "Show All" application menu item */
+ static const char *show;
+ /** Localizable text for the "Quit xxx" application menu item */
+ static const char *quit;
+};
+
/** @} */
//
-// End of "$Id: mac.H 7663 2010-07-01 16:51:28Z manolo $".
+// End of "$Id: mac.H 8657 2011-05-12 11:50:43Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/math.h b/plugins/zynaddsubfx/fltk/FL/math.h
index bb7fad393..e0f1d4058 100644
--- a/plugins/zynaddsubfx/fltk/FL/math.h
+++ b/plugins/zynaddsubfx/fltk/FL/math.h
@@ -1,9 +1,9 @@
//
-// "$Id: math.h 7504 2010-04-14 20:17:44Z matt $"
+// "$Id: math.h 7903 2010-11-28 21:06:39Z matt $"
//
// Math header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -67,5 +67,5 @@ inline double copysign(double a, double b) {return b<0 ? -a : a;}
//
-// End of "$Id: math.h 7504 2010-04-14 20:17:44Z matt $".
+// End of "$Id: math.h 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/names.h b/plugins/zynaddsubfx/fltk/FL/names.h
index 85f1bc02a..952acc028 100644
--- a/plugins/zynaddsubfx/fltk/FL/names.h
+++ b/plugins/zynaddsubfx/fltk/FL/names.h
@@ -1,9 +1,9 @@
//
-// "$Id: names.h 7159 2010-02-26 18:10:54Z greg.ercolano $"
+// "$Id: names.h 7903 2010-11-28 21:06:39Z matt $"
//
// Event names header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -119,5 +119,5 @@ const char * const fl_fontnames[] =
#endif /* FL_NAMES_H */
//
-// End of "$Id: names.h 7159 2010-02-26 18:10:54Z greg.ercolano $".
+// End of "$Id: names.h 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/win32.H b/plugins/zynaddsubfx/fltk/FL/win32.H
index 46a9ceb57..2150505a1 100644
--- a/plugins/zynaddsubfx/fltk/FL/win32.H
+++ b/plugins/zynaddsubfx/fltk/FL/win32.H
@@ -1,9 +1,9 @@
//
-// "$Id: win32.H 7671 2010-07-09 17:31:33Z manolo $"
+// "$Id: win32.H 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// WIN32 header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -35,6 +35,15 @@
#endif // !Fl_X_H
#include
+typedef HRGN Fl_Region;
+typedef HWND Window;
+typedef POINT XPoint;
+
+#include
+
+// this part is included only when compiling the FLTK library or if requested explicitly
+#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
+
// In some of the distributions, the gcc header files are missing some stuff:
#ifndef LPMINMAXINFO
#define LPMINMAXINFO MINMAXINFO*
@@ -45,14 +54,8 @@
#define VK_APPS 0x5D
#endif
-#include
-
// some random X equivalents
-typedef HWND Window;
-typedef POINT XPoint;
struct XRectangle {int x, y, width, height;};
-typedef HRGN Fl_Region;
-FL_EXPORT void fl_clip_region(Fl_Region);
extern Fl_Region XRectangleRegion(int x, int y, int w, int h);
inline void XDestroyRegion(Fl_Region r) {DeleteObject(r);}
inline void XClipBox(Fl_Region r,XRectangle* rect) {
@@ -66,7 +69,6 @@ inline void XClipBox(Fl_Region r,XRectangle* rect) {
#define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
#define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
-#include "Fl_Window.H"
// this object contains all win32-specific stuff about a window:
// Warning: this object is highly subject to change!
class FL_EXPORT Fl_X {
@@ -94,10 +96,21 @@ public:
};
extern FL_EXPORT HCURSOR fl_default_cursor;
extern FL_EXPORT UINT fl_wake_msg;
-inline Window fl_xid(const Fl_Window*w) {Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0;}
-FL_EXPORT Fl_Window* fl_find(Window xid);
extern FL_EXPORT char fl_override_redirect; // hack into Fl_Window::make_xid()
extern FL_EXPORT int fl_background_pixel; // hack into Fl_Window::make_xid()
+extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
+extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
+extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
+
+inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
+
+#else
+FL_EXPORT Window fl_xid_(const Fl_Window* w);
+#define fl_xid(w) fl_xid_(w)
+#endif // FL_LIBRARY || FL_INTERNALS
+
+FL_EXPORT Fl_Window* fl_find(Window xid);
+void fl_clip_region(Fl_Region);
// most recent fl_color() or fl_rgbcolor() points at one of these:
extern FL_EXPORT struct Fl_XMap {
@@ -113,31 +126,27 @@ FL_EXPORT HBRUSH fl_brush_action(int); // now does the real work
extern FL_EXPORT HINSTANCE fl_display;
extern FL_EXPORT Window fl_window;
extern FL_EXPORT HDC fl_gc;
-extern FL_EXPORT HPALETTE fl_palette; // non-zero only on 8-bit displays!
-extern FL_EXPORT HDC fl_GetDC(Window);
extern FL_EXPORT MSG fl_msg;
-extern FL_EXPORT void fl_release_dc(HWND w, HDC dc);
-extern FL_EXPORT void fl_save_dc( HWND w, HDC dc);
+extern FL_EXPORT HDC fl_GetDC(Window);
+extern FL_EXPORT HDC fl_makeDC(HBITMAP);
// off-screen pixmaps: create, destroy, draw into, copy to window
typedef HBITMAP Fl_Offscreen;
#define fl_create_offscreen(w, h) \
CreateCompatibleBitmap( (fl_gc ? fl_gc : fl_GetDC(0) ) , w, h)
-extern FL_EXPORT HDC fl_makeDC(HBITMAP);
-
# define fl_begin_offscreen(b) \
HDC _sgc=fl_gc; Window _sw=fl_window; \
- Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
+ Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
fl_gc=fl_makeDC(b); int _savedc = SaveDC(fl_gc); fl_window=(HWND)b; fl_push_no_clip()
# define fl_end_offscreen() \
fl_pop_clip(); RestoreDC(fl_gc, _savedc); DeleteDC(fl_gc); _ss->set_current(); fl_window=_sw; fl_gc = _sgc
-
+
FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy);
-#define fl_delete_offscreen(bitmap) DeleteObject(bitmap);
+#define fl_delete_offscreen(bitmap) DeleteObject(bitmap)
// Bitmap masks
typedef HBITMAP Fl_Bitmask;
@@ -152,5 +161,5 @@ inline void fl_open_callback(void (*)(const char *)) {}
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
#endif // FL_DOXYGEN
//
-// End of "$Id: win32.H 7671 2010-07-09 17:31:33Z manolo $".
+// End of "$Id: win32.H 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/FL/x.H b/plugins/zynaddsubfx/fltk/FL/x.H
index 754fe5e4a..002e429f9 100644
--- a/plugins/zynaddsubfx/fltk/FL/x.H
+++ b/plugins/zynaddsubfx/fltk/FL/x.H
@@ -1,9 +1,9 @@
//
-// "$Id: x.H 7671 2010-07-09 17:31:33Z manolo $"
+// "$Id: x.H 8706 2011-05-21 10:05:19Z AlbrechtS $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -30,6 +30,17 @@
// need to call Xlib directly. These symbols may not exist on non-X
// systems.
+/** \class Fl_Mac_App_Menu
+ Mac OS-specific class allowing to localize the application menu.
+
+ These character strings are used to build the application menu. They can be localized
+ at run time to any UTF-8 text by placing instructions such as this \e very
+ early in the program:
+ \verbatim
+ Fl_Mac_App_Menu::print = "Imprimer la fenêtre";
+ \endverbatim
+*/
+
#if !defined(Fl_X_H) && !defined(FL_DOXYGEN)
# define Fl_X_H
@@ -60,46 +71,18 @@ FL_EXPORT void fl_close_display();
// constant info about the X server connection:
extern FL_EXPORT Display *fl_display;
-extern FL_EXPORT Window fl_message_window;
extern FL_EXPORT int fl_screen;
extern FL_EXPORT XVisualInfo *fl_visual;
extern FL_EXPORT Colormap fl_colormap;
-// access to core fonts:
-// This class provides a "smart pointer" that returns a pointer to an XFontStruct.
-// The global variable fl_xfont can be called wherever a bitmap "core" font is
-// needed, e.g. when rendering to a GL context under X11.
-// With Xlib / X11 fonts, fl_xfont will return the current selected font.
-// With XFT / X11 fonts, fl_xfont will attempt to return the bitmap "core" font most
-// similar to (usually the same as) the current XFT font.
-class Fl_XFont_On_Demand
-{
-public:
- Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
- Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
- { ptr = x.ptr; return *this; }
- Fl_XFont_On_Demand& operator=(XFontStruct* p)
- { ptr = p; return *this; }
- XFontStruct* value();
- operator XFontStruct*() { return value(); }
- XFontStruct& operator*() { return *value(); }
- XFontStruct* operator->() { return value(); }
- bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
- bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
-private:
- XFontStruct *ptr;
-};
-extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
// drawing functions:
extern FL_EXPORT GC fl_gc;
extern FL_EXPORT Window fl_window;
-extern FL_EXPORT void *fl_xftfont;
FL_EXPORT ulong fl_xpixel(Fl_Color i);
FL_EXPORT ulong fl_xpixel(uchar r, uchar g, uchar b);
FL_EXPORT void fl_clip_region(Fl_Region);
FL_EXPORT Fl_Region fl_clip_region();
-FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
// feed events into fltk:
FL_EXPORT int fl_handle(const XEvent&);
@@ -112,13 +95,13 @@ extern FL_EXPORT ulong fl_event_time;
typedef ulong Fl_Offscreen;
# define fl_create_offscreen(w,h) \
XCreatePixmap(fl_display, \
- (fl_surface->type() == Fl_Display_Device::device_type ? \
+ (Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::class_id ? \
fl_window : fl_xid(Fl::first_window()) ) , \
w, h, fl_visual->depth)
// begin/end are macros that save the old state in local variables:
# define fl_begin_offscreen(pixmap) \
Window _sw=fl_window; fl_window=pixmap; \
- Fl_Surface_Device *_ss = fl_surface; fl_display_device->set_current(); \
+ Fl_Surface_Device *_ss = Fl_Surface_Device::surface(); Fl_Display_Device::display_device()->set_current(); \
fl_push_no_clip()
# define fl_end_offscreen() \
fl_pop_clip(); fl_window = _sw; _ss->set_current()
@@ -133,9 +116,40 @@ extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
+#if defined(FL_LIBRARY) || defined(FL_INTERNALS)
+extern FL_EXPORT Window fl_message_window;
+extern FL_EXPORT void *fl_xftfont;
+FL_EXPORT Fl_Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.cxx
+
+// access to core fonts:
+// This class provides a "smart pointer" that returns a pointer to an XFontStruct.
+// The global variable fl_xfont can be called wherever a bitmap "core" font is
+// needed, e.g. when rendering to a GL context under X11.
+// With Xlib / X11 fonts, fl_xfont will return the current selected font.
+// With XFT / X11 fonts, fl_xfont will attempt to return the bitmap "core" font most
+// similar to (usually the same as) the current XFT font.
+class Fl_XFont_On_Demand
+{
+public:
+ Fl_XFont_On_Demand(XFontStruct* p = NULL) : ptr(p) { }
+ Fl_XFont_On_Demand& operator=(const Fl_XFont_On_Demand& x)
+ { ptr = x.ptr; return *this; }
+ Fl_XFont_On_Demand& operator=(XFontStruct* p)
+ { ptr = p; return *this; }
+ XFontStruct* value();
+ operator XFontStruct*() { return value(); }
+ XFontStruct& operator*() { return *value(); }
+ XFontStruct* operator->() { return value(); }
+ bool operator==(const Fl_XFont_On_Demand& x) { return ptr == x.ptr; }
+ bool operator!=(const Fl_XFont_On_Demand& x) { return ptr != x.ptr; }
+private:
+ XFontStruct *ptr;
+};
+extern FL_EXPORT Fl_XFont_On_Demand fl_xfont;
+
// this object contains all X-specific stuff about a window:
-// Warning: this object is highly subject to change! It's definition
-// is only here so that fl_xid can be declared inline:
+// Warning: this object is highly subject to change!
+// FL_LIBRARY or FL_INTERNALS must be defined to access this class.
class FL_EXPORT Fl_X {
public:
Window xid;
@@ -157,13 +171,21 @@ public:
static void y(Fl_Window* wi, int Y) {wi->y(Y);}
};
-// convert xid <-> Fl_Window:
-inline Window fl_xid(const Fl_Window*w) {return Fl_X::i(w)->xid;}
-FL_EXPORT Fl_Window* fl_find(Window xid);
-
extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
extern FL_EXPORT int fl_background_pixel; // hack into Fl_X::make_xid()
+inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return temp ? temp->xid : 0; }
+
+#else
+
+extern Window fl_xid_(const Fl_Window* w);
+#define fl_xid(w) fl_xid_(w)
+
+#endif // FL_LIBRARY || FL_INTERNALS
+
+FL_EXPORT Fl_Window* fl_find(Window xid);
+
+
// Dummy function to register a function for opening files via the window manager...
inline void fl_open_callback(void (*)(const char *)) {}
@@ -173,5 +195,5 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
#endif
//
-// End of "$Id: x.H 7671 2010-07-09 17:31:33Z manolo $".
+// End of "$Id: x.H 8706 2011-05-21 10:05:19Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/CMakeLists.txt b/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
index 2f05dd4d7..f5feedc02 100644
--- a/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
+++ b/plugins/zynaddsubfx/fltk/src/CMakeLists.txt
@@ -193,14 +193,20 @@ set(CFILES
fl_utf.c
)
+add_definitions(-DFL_LIBRARY)
if(APPLE)
- set_source_files_properties(
- Fl.cxx Fl_Native_File_Chooser.cxx Fl_Printer.cxx
- PROPERTIES COMPILE_FLAGS "-x objective-c++")
+ set(MMFILES
+ Fl_cocoa.mm
+ Fl_Quartz_Printer.mm
+ Fl_Native_File_Chooser_MAC.mm
+ )
+else()
+ set(MMFILES
+ )
endif(APPLE)
#######################################################################
-add_library(fltk STATIC ${CPPFILES} ${CFILES} fl_call_main.c)
+add_library(fltk STATIC ${CPPFILES} ${MMFILES} ${CFILES} fl_call_main.c)
set_target_properties(fltk PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
@@ -225,13 +231,13 @@ if(WIN32)
target_link_libraries(fltk comctl32)
endif(WIN32)
-if(HAVE_CAIRO)
+if(FLTK_HAVE_CAIRO)
target_link_libraries(fltk fltk_cairo ${PKG_CAIRO_LIBRARIES})
-ENDif(HAVE_CAIRO)
+ENDif(FLTK_HAVE_CAIRO)
-if(USE_XINERAMA)
+if(HAVE_XINERAMA)
target_link_libraries(fltk ${X11_Xinerama_LIB})
-endif(USE_XINERAMA)
+endif(HAVE_XINERAMA)
if(USE_XFT)
target_link_libraries(fltk ${X11_Xft_LIB})
@@ -254,7 +260,7 @@ install(TARGETS fltk
if(OPTION_BUILD_SHARED_LIBS)
#######################################################################
-add_library(fltk_SHARED SHARED ${CPPFILES} ${CFILES})
+add_library(fltk_SHARED SHARED ${CPPFILES} ${MMFILES} ${CFILES})
set_target_properties(fltk_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
@@ -286,13 +292,13 @@ if(WIN32)
target_link_libraries(fltk_SHARED comctl32)
endif(WIN32)
-if(HAVE_CAIRO)
+if(FLTK_HAVE_CAIRO)
target_link_libraries(fltk_SHARED fltk_cairo ${PKG_CAIRO_LIBRARIES})
-ENDif(HAVE_CAIRO)
+ENDif(FLTK_HAVE_CAIRO)
-if(USE_XINERAMA)
+if(HAVE_XINERAMA)
target_link_libraries(fltk_SHARED ${X11_Xinerama_LIB})
-endif(USE_XINERAMA)
+endif(HAVE_XINERAMA)
if(USE_XFT)
target_link_libraries(fltk_SHARED ${X11_Xft_LIB})
diff --git a/plugins/zynaddsubfx/fltk/src/Fl.cxx b/plugins/zynaddsubfx/fltk/src/Fl.cxx
index 116e25705..900ff8f65 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl.cxx 7354 2010-03-29 11:07:29Z matt $"
+// "$Id: Fl.cxx 8723 2011-05-23 16:49:02Z manolo $"
//
// Main event handling code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -27,23 +27,43 @@
// warning: the Apple Quartz version still uses some Quickdraw calls,
-// mostly to get around the single active context in QD and
+// 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.
-#include "config.h"
+#include
+
+/* We require Windows 2000 features (e.g. VK definitions) */
+#if defined(WIN32)
+# 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
+
+// recent versions of MinGW warn: "Please include winsock2.h before windows.h",
+// hence we must include winsock2.h before FL/Fl.H (A.S. Dec. 2010, IMM May 2011)
+#if defined(WIN32) && !defined(__CYGWIN__)
+# include
+#endif
+
#include
#include
-#include
#include
+#include
+
#include
#include
#include
#include "flstring.h"
-#if defined(__APPLE__)
-#import
-#endif
-
#if defined(DEBUG) || defined(DEBUG_WATCH)
# include
#endif // DEBUG || DEBUG_WATCH
@@ -55,11 +75,22 @@ HBRUSH fl_brush_action(int action);
void fl_cleanup_pens(void);
void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
+#elif defined(__APPLE__)
+extern double fl_mac_flush_and_wait(double time_to_wait, char in_idle);
#endif // WIN32
//
// Globals...
//
+#if defined(__APPLE__) || defined(FL_DOXYGEN)
+const char *Fl_Mac_App_Menu::about = "About ";
+const char *Fl_Mac_App_Menu::print = "Print Front Window";
+const char *Fl_Mac_App_Menu::services = "Services";
+const char *Fl_Mac_App_Menu::hide = "Hide ";
+const char *Fl_Mac_App_Menu::hide_others = "Hide Others";
+const char *Fl_Mac_App_Menu::show = "Show All";
+const char *Fl_Mac_App_Menu::quit = "Quit ";
+#endif // __APPLE__
#ifndef FL_DOXYGEN
Fl_Widget *Fl::belowmouse_,
*Fl::pushed_,
@@ -82,8 +113,12 @@ int Fl::damage_,
char *Fl::e_text = (char *)"";
int Fl::e_length;
-int Fl::visible_focus_ = 1,
- Fl::dnd_text_ops_ = 1;
+
+Fl_Event_Dispatch Fl::e_dispatch = 0;
+
+unsigned char Fl::options_[] = { 0, 0 };
+unsigned char Fl::options_read_ = 0;
+
Fl_Window *fl_xfocus; // which window X thinks has focus
Fl_Window *fl_xmousewin;// which window X thinks has FL_ENTER
@@ -106,7 +141,7 @@ Fl::version() {
}
/**
- Gets the default scrollbar size used by
+ Gets the default scrollbar size used by
Fl_Browser_,
Fl_Help_View,
Fl_Scroll, and
@@ -130,12 +165,19 @@ void Fl::scrollbar_size(int W) {
}
-/**
- Returns whether or not the mouse event is inside the given rectangle.
- Returns non-zero if the current event_x and event_y
- put it inside the widget or inside an arbitrary bounding box. You
- should always call this rather than doing your own comparison so you
- are consistent about edge effects.
+/** Returns whether or not the mouse event is inside the given rectangle.
+
+ Returns non-zero if the current Fl::event_x() and Fl::event_y()
+ put it inside the given arbitrary bounding box.
+
+ You should always call this rather than doing your own comparison
+ so you are consistent about edge effects.
+
+ To find out, whether the event is inside a child widget of the
+ current window, you can use Fl::event_inside(const Fl_Widget *).
+
+ \param[in] xx,yy,ww,hh bounding box
+ \return non-zero, if mouse event is inside
*/
int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
int mx = e_x - xx;
@@ -143,11 +185,32 @@ int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
return (mx >= 0 && mx < ww && my >= 0 && my < hh);
}
-/** Returns whether or not the mouse event is inside the given widget.
- Returns non-zero if the current event_x and event_y
- put it inside the widget or inside an arbitrary bounding box. You
- should always call this rather than doing your own comparison so you
- are consistent about edge effects.
+/** Returns whether or not the mouse event is inside a given child widget.
+
+ Returns non-zero if the current Fl::event_x() and Fl::event_y()
+ put it inside the given child widget's bounding box.
+
+ This method can only be used to check whether the mouse event is
+ inside a \b child widget of the window that handles the event, and
+ there must not be an intermediate subwindow (i.e. the widget must
+ not be inside a subwindow of the current window). However, it is
+ valid if the widget is inside a nested Fl_Group.
+
+ You must not use it with the window itself as the \p o argument
+ in a window's handle() method.
+
+ \note The mentioned restrictions are necessary, because this method
+ does not transform coordinates of child widgets, and thus the given
+ widget \p o must be within the \e same window that is handling the
+ current event. Otherwise the results are undefined.
+
+ You should always call this rather than doing your own comparison
+ so you are consistent about edge effects.
+
+ \see Fl::event_inside(int, int, int, int)
+
+ \param[in] o child widget to be tested
+ \return non-zero, if mouse event is inside the widget
*/
int Fl::event_inside(const Fl_Widget *o) /*const*/ {
int mx = e_x - o->x();
@@ -162,11 +225,11 @@ int Fl::event_inside(const Fl_Widget *o) /*const*/ {
#ifdef WIN32
-/// implementation in Fl_win32.cxx
+// implementation in Fl_win32.cxx
#elif defined(__APPLE__)
-/// implementation in Fl_mac.cxx
+// implementation in Fl_mac.cxx
#else
@@ -175,10 +238,12 @@ int Fl::event_inside(const Fl_Widget *o) /*const*/ {
//
-////////////////////////////////////////////////////////////////
-// Timeouts are stored in a sorted list, so only the first one needs
-// to be checked to see if any should be called.
-
+////////////////////////////////////////////////////////////////////////
+// Timeouts are stored in a sorted list (*first_timeout), so only the
+// first one needs to be checked to see if any should be called.
+// Allocated, but unused (free) Timeout structs are stored in another
+// linked list (*free_timeout).
+
struct Timeout {
double time;
void (*cb)(void*);
@@ -186,14 +251,13 @@ struct Timeout {
Timeout* next;
};
static Timeout* first_timeout, *free_timeout;
-static int first_timeout_count, free_timeout_count;
#include
// I avoid the overhead of getting the current time when we have no
// timeouts by setting this flag instead of getting the time.
// In this case calling elapse_timeouts() does nothing, but records
-// the current time, and the next call will actualy elapse time.
+// the current time, and the next call will actually elapse time.
static char reset_clock = 1;
static void elapse_timeouts() {
@@ -227,7 +291,6 @@ void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
Timeout* t = free_timeout;
if (t) {
free_timeout = t->next;
- --free_timeout_count;
} else {
t = new Timeout;
}
@@ -235,7 +298,7 @@ void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
t->cb = cb;
t->arg = argp;
// insert-sort the new timeout:
- Timeout** p = &first_timeout;
+ Timeout** p = &first_timeout;
while (*p && (*p)->time <= time) p = &((*p)->next);
t->next = *p;
*p = t;
@@ -253,10 +316,11 @@ int Fl::has_timeout(Fl_Timeout_Handler cb, void *argp) {
/**
Removes a timeout callback. It is harmless to remove a timeout
callback that no longer exists.
+
+ \note This version removes all matching timeouts, not just the first one.
+ This may change in the future.
*/
void Fl::remove_timeout(Fl_Timeout_Handler cb, void *argp) {
- // This version removes all matching timeouts, not just the first one.
- // This may change in the future.
for (Timeout** p = &first_timeout; *p;) {
Timeout* t = *p;
if (t->cb == cb && (t->arg == argp || !argp)) {
@@ -275,7 +339,7 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void *argp) {
// Checks are just stored in a list. They are called in the reverse
// order that they were added (this may change in the future).
// This is a bit messy because I want to allow checks to be added,
-// removed, and have wait() called from inside them, to do this
+// removed, and have wait() called from inside them. To do this
// next_check points at the next unprocessed one for the outermost
// call to Fl::wait().
@@ -291,26 +355,26 @@ static Check *first_check, *next_check, *free_check;
waits for events. This is different than an idle callback because it
is only called once, then FLTK calls the system and tells it not to
return until an event happens.
-
+
This can be used by code that wants to monitor the
application's state, such as to keep a display up to date. The
advantage of using a check callback is that it is called only when no
events are pending. If events are coming in quickly, whole blocks of
them will be processed before this is called once. This can save
significant time and avoid the application falling behind the events.
-
+
Sample code:
-
+
\code
bool state_changed; // anything that changes the display turns this on
-
+
void callback(void*) {
if (!state_changed) return;
state_changed = false;
do_expensive_calculation();
widget->redraw();
}
-
+
main() {
Fl::add_check(callback);
return Fl::run();
@@ -382,13 +446,13 @@ static char in_idle;
////////////////////////////////////////////////////////////////
// wait/run/check/ready:
-void (*Fl::idle)(); // see Fl_add_idle.cxx for the add/remove functions
+void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions
extern int fl_ready(); // in Fl_.cxx
extern int fl_wait(double time); // in Fl_.cxx
/**
- See int wait()
+ See int Fl::wait()
*/
double Fl::wait(double time_to_wait) {
// delete all widgets that were listed during callbacks
@@ -410,13 +474,7 @@ double Fl::wait(double time_to_wait) {
// the idle function may turn off idle, we can then wait:
if (idle) time_to_wait = 0.0;
}
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- flush();
- if (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;
+ return fl_mac_flush_and_wait(time_to_wait, in_idle);
#else
@@ -433,8 +491,6 @@ double Fl::wait(double time_to_wait) {
first_timeout = t->next;
t->next = free_timeout;
free_timeout = t;
- ++free_timeout_count;
- --first_timeout_count;
// Now it is safe for the callback to do add_timeout:
cb(argp);
}
@@ -484,13 +540,35 @@ int Fl::run() {
}
#ifdef WIN32
+
+// Function to initialize COM/OLE for usage. This must be done only once.
+// We define a flag to register whether we called it:
+static char oleInitialized = 0;
+
+// This calls the Windows function OleInitialize() exactly once.
+void fl_OleInitialize() {
+ if (!oleInitialized) {
+ OleInitialize(0L);
+ oleInitialized = 1;
+ }
+}
+
+// This calls the Windows function OleUninitialize() only, if
+// OleInitialize has been called before.
+void fl_OleUninitialize() {
+ if (oleInitialized) {
+ OleUninitialize();
+ oleInitialized = 0;
+ }
+}
+
class Fl_Win32_At_Exit {
public:
Fl_Win32_At_Exit() { }
~Fl_Win32_At_Exit() {
fl_free_fonts(); // do some WIN32 cleanup
fl_cleanup_pens();
- OleUninitialize();
+ fl_OleUninitialize();
fl_brush_action(1);
fl_cleanup_dc_list();
}
@@ -505,24 +583,23 @@ static Fl_Win32_At_Exit win32_at_exit;
repeatedly to "run" your program. You can also check what happened
each time after this returns, which is quite useful for managing
program state.
-
+
What this really does is call all idle callbacks, all elapsed
timeouts, call Fl::flush() to get the screen to update, and
then wait some time (zero if there are idle callbacks, the shortest of
all pending timeouts, or infinity), for any events from the user or
any Fl::add_fd() callbacks. It then handles the events and
calls the callbacks and then returns.
-
- The return value of the first form is non-zero if there are
- any visible windows - this may change in future versions of
- FLTK.
-
- The second form waits a maximum of time
- seconds. It can return much sooner if something happens.
-
+
+ The return value of Fl::wait() is non-zero if there are any
+ visible windows - this may change in future versions of FLTK.
+
+ Fl::wait(time) waits a maximum of \e time seconds.
+ It can return much sooner if something happens.
+
The return value is positive if an event or fd happens before the
time elapsed. It is zero if nothing happens (on Win32 this will only
- return zero if time is zero). It is negative if an error
+ return zero if \e time is zero). It is negative if an error
occurs (this will happen on UNIX if a signal happens).
*/
int Fl::wait() {
@@ -534,7 +611,7 @@ int Fl::wait() {
/**
Same as Fl::wait(0). Calling this during a big calculation
will keep the screen up to date and the interface responsive:
-
+
\code
while (!calculation_done()) {
calculate();
@@ -542,8 +619,8 @@ int Fl::wait() {
if (user_hit_abort_button()) break;
}
\endcode
-
- The returns non-zero if any windows are displayed, and 0 if no
+
+ This returns non-zero if any windows are displayed, and 0 if no
windows are displayed (this is likely to change in future versions of
FLTK).
*/
@@ -558,15 +635,15 @@ int Fl::check() {
program is in a state where such callbacks are illegal. This returns
true if Fl::check() would do anything (it will continue to
return true until you call Fl::check() or Fl::wait()).
-
+
\code
while (!calculation_done()) {
- calculate();
- if (Fl::ready()) {
- do_expensive_cleanup();
- Fl::check();
- if (user_hit_abort_button()) break;
- }
+ calculate();
+ if (Fl::ready()) {
+ do_expensive_cleanup();
+ Fl::check();
+ if (user_hit_abort_button()) break;
+ }
}
\endcode
*/
@@ -593,9 +670,9 @@ Fl_Window* fl_find(Window xid) {
Fl_X *window;
for (Fl_X **pp = &Fl_X::first; (window = *pp); pp = &window->next)
#if defined(WIN32) || defined(USE_X11)
- if (window->xid == xid)
+ if (window->xid == xid)
#elif defined(__APPLE_QUARTZ__)
- if (window->xid == xid && !window->w->window())
+ if (window->xid == xid && !window->w->window())
#else
# error unsupported platform
#endif // __APPLE__
@@ -616,13 +693,6 @@ Fl_Window* fl_find(Window xid) {
Returns the first top-level window in the list of shown() windows. If
a modal() window is shown this is the top-most modal window, otherwise
it is the most recent window to get an event.
-
- The second form sets the window that is returned by
- first_window. The window is removed from wherever it is in the
- list and inserted at the top. This is not done if Fl::modal()
- is on or if the window is not shown(). Because the first window
- is used to set the "parent" of modal windows, this is often
- useful.
*/
Fl_Window* Fl::first_window() {
Fl_X* i = Fl_X::first;
@@ -630,8 +700,9 @@ Fl_Window* Fl::first_window() {
}
/**
- Returns the next top-level window in the list of shown() windows. You can
- use this call to iterate through all the windows that are shown().
+ Returns the next top-level window in the list of shown() windows.
+ You can use this call to iterate through all the windows that are shown().
+ \param[in] window must be shown and not NULL
*/
Fl_Window* Fl::next_window(const Fl_Window* window) {
Fl_X* i = Fl_X::i(window)->next;
@@ -639,11 +710,16 @@ Fl_Window* Fl::next_window(const Fl_Window* window) {
}
/**
- See Fl_Window* first_window()
-*/
+ Sets the window that is returned by first_window().
+ The window is removed from wherever it is in the
+ list and inserted at the top. This is not done if Fl::modal()
+ is on or if the window is not shown(). Because the first window
+ is used to set the "parent" of modal windows, this is often
+ useful.
+ */
void Fl::first_window(Fl_Window* window) {
if (!window || !window->shown()) return;
- fl_find(fl_xid(window));
+ fl_find( Fl_X::i(window)->xid );
}
/**
@@ -656,7 +732,7 @@ void Fl::redraw() {
/**
Causes all the windows that need it to be redrawn and graphics forced
out through the pipes.
-
+
This is what wait() does before looking for events.
Note: in multi-threaded applications you should only call Fl::flush()
@@ -688,29 +764,37 @@ void Fl::flush() {
#endif
}
+
////////////////////////////////////////////////////////////////
// Event handlers:
+
struct handler_link {
int (*handle)(int);
handler_link *next;
};
+
static handler_link *handlers = 0;
+
/**
Install a function to parse unrecognized events. If FLTK cannot
figure out what to do with an event, it calls each of these functions
(most recent first) until one of them returns non-zero. If none of
- them returns non zero then the event is ignored. Events that cause
+ them returns non-zero then the event is ignored. Events that cause
this to be called are:
-
- - FL_SHORTCUT events that are not recognized by any widget.
+
+ - FL_SHORTCUT events that are not recognized by any widget.
This lets you provide global shortcut keys.
- System events that FLTK does not recognize. See fl_xevent.
- - \e Some other events when the widget FLTK selected returns
- zero from its handle() method. Exactly which ones may change
+ - \e Some other events when the widget FLTK selected returns
+ zero from its handle() method. Exactly which ones may change
in future versions, however.
+
+ \see Fl::remove_handler(Fl_Event_Handler)
+ \see Fl::event_dispatch(Fl_Event_Dispatch d)
+ \see Fl::handle(int, Fl_Window*)
*/
void Fl::add_handler(Fl_Event_Handler ha) {
handler_link *l = new handler_link;
@@ -719,8 +803,10 @@ void Fl::add_handler(Fl_Event_Handler ha) {
handlers = l;
}
+
/**
- Removes a previously added event handler.
+ Removes a previously added event handler.
+ \see Fl::handle(int, Fl_Window*)
*/
void Fl::remove_handler(Fl_Event_Handler ha) {
handler_link *l, *p;
@@ -752,15 +838,15 @@ Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
/**
Sets the widget that will receive FL_KEYBOARD events.
-
+
If you change Fl::focus(), the previous widget and all
parents (that don't contain the new widget) are sent FL_UNFOCUS
events. Changing the focus does \e not send FL_FOCUS to
this or any widget, because sending FL_FOCUS is supposed to
\e test if the widget wants the focus (by it returning non-zero from
handle()).
-
- \sa Fl_Widget::take_focus()
+
+ \see Fl_Widget::take_focus()
*/
void Fl::focus(Fl_Widget *o) {
if (o && !o->visible_focus()) return;
@@ -772,9 +858,18 @@ void Fl::focus(Fl_Widget *o) {
// make sure that fl_xfocus is set to the top level window
// of this widget, or fl_fix_focus will clear our focus again
if (o) {
- Fl_Window *win = 0, *w1 = o->window();
+ Fl_Window *win = 0, *w1 = o->as_window();
+ if (!w1) w1 = o->window();
while (w1) { win=w1; w1=win->window(); }
- if (win) fl_xfocus = win;
+ if (win) {
+#ifdef __APPLE__
+ if (fl_xfocus != win) {
+ Fl_X *x = Fl_X::i(win);
+ if (x) x->set_key_window();
+ }
+#endif
+ fl_xfocus = win;
+ }
}
// take focus from the old focused window
fl_oldfocus = 0;
@@ -792,16 +887,16 @@ static char dnd_flag = 0; // make 'belowmouse' send DND_LEAVE instead of LEAVE
/**
Sets the widget that is below the mouse. This is for
- highlighting buttons. It is not used to send FL_PUSH or
+ highlighting buttons. It is not used to send FL_PUSH or
FL_MOVE directly, for several obscure reasons, but those events
- typically go to this widget. This is also the first widget tried for
+ typically go to this widget. This is also the first widget tried for
FL_SHORTCUT events.
-
+
If you change the belowmouse widget, the previous one and all
parents (that don't contain the new widget) are sent FL_LEAVE
events. Changing this does \e not send FL_ENTER to this
or any widget, because sending FL_ENTER is supposed to \e test
- if the widget wants the mouse (by it returning non-zero from
+ if the widget wants the mouse (by it returning non-zero from
handle()).
*/
void Fl::belowmouse(Fl_Widget *o) {
@@ -819,15 +914,15 @@ void Fl::belowmouse(Fl_Widget *o) {
}
/**
- Sets the widget that is being pushed. FL_DRAG or
+ Sets the widget that is being pushed. FL_DRAG or
FL_RELEASE (and any more FL_PUSH) events will be sent to
this widget.
-
+
If you change the pushed widget, the previous one and all parents
(that don't contain the new widget) are sent FL_RELEASE
events. Changing this does \e not send FL_PUSH to this
or any widget, because sending FL_PUSH is supposed to \e test
- if the widget wants the mouse (by it returning non-zero from
+ if the widget wants the mouse (by it returning non-zero from
handle()).
*/
void Fl::pushed(Fl_Widget *o) {
@@ -895,11 +990,11 @@ void fl_fix_focus() {
}
}
-#ifndef WIN32
+#if !(defined(WIN32) || defined(__APPLE__))
extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx
#endif
-// This function is called by ~Fl_Widget() and by Fl_Widget::deactivate
+// This function is called by ~Fl_Widget() and by Fl_Widget::deactivate()
// and by Fl_Widget::hide(). It indicates that the widget does not want
// to receive any more events, and also removes all global variables that
// point at the widget.
@@ -913,7 +1008,7 @@ void fl_throw_focus(Fl_Widget *o) {
#endif // DEBUG
if (o->contains(Fl::pushed())) Fl::pushed_ = 0;
-#ifndef WIN32
+#if !(defined(WIN32) || defined(__APPLE__))
if (o->contains(fl_selection_requestor)) fl_selection_requestor = 0;
#endif
if (o->contains(Fl::belowmouse())) Fl::belowmouse_ = 0;
@@ -927,9 +1022,9 @@ void fl_throw_focus(Fl_Widget *o) {
////////////////////////////////////////////////////////////////
-// Call to->handle but first replace the mouse x/y with the correct
-// values to account for nested X windows. 'window' is the outermost
-// window the event was posted to by X:
+// Call to->handle(), but first replace the mouse x/y with the correct
+// values to account for nested windows. 'window' is the outermost
+// window the event was posted to by the system:
static int send(int event, Fl_Widget* to, Fl_Window* window) {
int dx, dy;
int old_event = Fl::e_number;
@@ -950,11 +1045,98 @@ static int send(int event, Fl_Widget* to, Fl_Window* window) {
return ret;
}
-int Fl::handle(int e, Fl_Window* window)
+
/**
- Sends the event to a window for processing. Returns non-zero if any
- widget uses the event.
-*/
+ \brief Set a new event dispatch function.
+
+ The event dispatch function is called after native events are converted to
+ FLTK events, but before they are handled by FLTK. If the dispatch function
+ Fl_Event_Dispatch \p d is set, it is up to the dispatch function to call
+ Fl::handle_(int, Fl_Window*) or to ignore the event.
+
+ The dispatch function itself must return 0 if it ignored the event,
+ or non-zero if it used the event. If you call Fl::handle_(), then
+ this will return the correct value.
+
+ The event dispatch can be used to handle exceptions in FLTK events and
+ callbacks before they reach the native event handler:
+
+ \code
+ int myHandler(int e, Fl_Window *w) {
+ try {
+ return Fl::handle_(e, w);
+ } catch () {
+ ...
+ }
+ }
+
+ main() {
+ Fl::event_dispatch(myHandler);
+ ...
+ Fl::run();
+ }
+ \endcode
+
+ \param d new dispatch function, or NULL
+ \see Fl::add_handler(Fl_Event_Handler)
+ \see Fl::handle(int, Fl_Window*)
+ \see Fl::handle_(int, Fl_Window*)
+ */
+void Fl::event_dispatch(Fl_Event_Dispatch d)
+{
+ e_dispatch = d;
+}
+
+
+/**
+ \brief Return the current event dispatch function.
+ */
+Fl_Event_Dispatch Fl::event_dispatch()
+{
+ return e_dispatch;
+}
+
+
+/**
+ \brief Handle events from the window system.
+
+ This is called from the native event dispatch after native events have been
+ converted to FLTK notation. This function calls Fl::handle_(int, Fl_Window*)
+ unless the user sets a dispatch function. If a user dispatch function is set,
+ the user must make sure that Fl::handle_() is called, or the event will be
+ ignored.
+
+ \param e the event type (Fl::event_number() is not yet set)
+ \param window the window that caused this event
+ \return 0 if the event was not handled
+
+ \see Fl::add_handler(Fl_Event_Handler)
+ \see Fl::event_dispatch(Fl_Event_Dispatch)
+ */
+int Fl::handle(int e, Fl_Window* window)
+{
+ if (e_dispatch) {
+ return e_dispatch(e, window);
+ } else {
+ return handle_(e, window);
+ }
+}
+
+
+/**
+ \brief Handle events from the window system.
+
+ This function is called from the native event dispatch, unless the user sets
+ another dispatch function. In that case, the user dispatch function must
+ decide when to call Fl::handle_(int, Fl_Window*)
+
+ \param e the event type (Fl::event_number() is not yet set)
+ \param window the window that caused this event
+ \return 0 if the event was not handled
+
+ \see Fl::event_dispatch(Fl_Event_Dispatch)
+ */
+int Fl::handle_(int e, Fl_Window* window)
{
e_number = e;
if (fl_local_grab) return fl_local_grab(e);
@@ -964,7 +1146,7 @@ int Fl::handle(int e, Fl_Window* window)
switch (e) {
case FL_CLOSE:
- if (grab() || modal() && window != modal()) return 0;
+ if ( grab() || (modal() && window != modal()) ) return 0;
wi->do_callback();
return 1;
@@ -1016,9 +1198,25 @@ int Fl::handle(int e, Fl_Window* window)
}
if (modal() && wi != modal()) wi = 0;
if (grab()) wi = grab();
- {Fl_Widget* pbm = belowmouse();
- int ret = (wi && send(e, wi, window));
- if (pbm != belowmouse()) {
+ { int ret;
+ Fl_Widget* pbm = belowmouse();
+#ifdef __APPLE__
+ if (fl_mac_os_version < 100500) {
+ // before 10.5, mouse moved events aren't sent to borderless windows such as tooltips
+ Fl_Window *tooltip = Fl_Tooltip::current_window();
+ int inside = 0;
+ if (tooltip && tooltip->shown() ) { // check if a tooltip window is currently opened
+ // check if mouse is inside the tooltip
+ inside = (Fl::event_x_root() >= tooltip->x() && Fl::event_x_root() < tooltip->x() + tooltip->w() &&
+ Fl::event_y_root() >= tooltip->y() && Fl::event_y_root() < tooltip->y() + tooltip->h() );
+ }
+ // if inside, send event to tooltip window instead of background window
+ if (inside) ret = send(e, tooltip, window);
+ else ret = (wi && send(e, wi, window));
+ } else
+#endif
+ ret = (wi && send(e, wi, window));
+ if (pbm != belowmouse()) {
#ifdef DEBUG
printf("Fl::handle(e=%d, window=%p);\n", e, window);
#endif // DEBUG
@@ -1049,12 +1247,12 @@ int Fl::handle(int e, Fl_Window* window)
return 1;
case FL_KEYUP:
- // Send the key-up to the current focus. This is not
+ // Send the key-up to the current focus widget. This is not
// always the same widget that received the corresponding
// FL_KEYBOARD event because focus may have changed.
// Sending the KEYUP to the right KEYDOWN is possible, but
- // would require that we track the KEYDOWN for every possible
- // key stroke (users may hold down multiple keys!) and then
+ // would require that we track the KEYDOWN for every possible
+ // key stroke (users may hold down multiple keys!) and then
// make sure that the widget still exists before sending
// a KEYUP there. I believe that the current solution is
// "close enough".
@@ -1178,7 +1376,7 @@ void Fl_Window::hide() {
for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
*pp = ip->next;
#ifdef __APPLE__
- MacUnlinkWindow(ip);
+ ip->unlink();
// MacOS X manages a single pointer per application. Make sure that hiding
// a toplevel window will not leave us with some random pointer shape, or
// worst case, an invisible pointer
@@ -1225,7 +1423,7 @@ void Fl_Window::hide() {
fl_release_dc(fl_window, fl_gc);
fl_window = (HWND)-1;
fl_gc = 0;
-# ifdef USE_CAIRO
+# ifdef FLTK_USE_CAIRO
if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
# endif
}
@@ -1241,7 +1439,8 @@ void Fl_Window::hide() {
# if USE_XFT
fl_destroy_xft_draw(ip->xid);
# endif
- XDestroyWindow(fl_display, ip->xid);
+ // this test makes sure ip->xid has not been destroyed already
+ if (ip->xid) XDestroyWindow(fl_display, ip->xid);
#elif defined(WIN32)
// this little trickery seems to avoid the popup window stacking problem
HWND p = GetForegroundWindow();
@@ -1251,11 +1450,11 @@ void Fl_Window::hide() {
}
XDestroyWindow(fl_display, ip->xid);
#elif defined(__APPLE_QUARTZ__)
- MacDestroyWindow(this, ip->xid);
+ ip->destroy();
#else
# error unsupported platform
#endif
-
+
#ifdef WIN32
// Try to stop the annoying "raise another program" behavior
if (non_modal() && Fl::first_window() && Fl::first_window()->shown())
@@ -1266,6 +1465,9 @@ void Fl_Window::hide() {
Fl_Window::~Fl_Window() {
hide();
+ if (xclass_) {
+ free(xclass_);
+ }
}
// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
@@ -1286,7 +1488,7 @@ int Fl_Window::handle(int ev)
#if defined(USE_X11) || defined(WIN32)
XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
#elif defined(__APPLE_QUARTZ__)
- MacMapWindow(this, i->xid);
+ i->map();
#else
# error unsupported platform
#endif // __APPLE__
@@ -1294,7 +1496,7 @@ int Fl_Window::handle(int ev)
break;
case FL_HIDE:
if (shown()) {
- // Find what really turned invisible, if is was a parent window
+ // Find what really turned invisible, if it was a parent window
// we do nothing. We need to avoid unnecessary unmap calls
// because they cause the display to blink when the parent is
// remapped. However if this or any intermediate non-window
@@ -1308,7 +1510,7 @@ int Fl_Window::handle(int ev)
#if defined(USE_X11) || defined(WIN32)
XUnmapWindow(fl_display, fl_xid(this));
#elif defined(__APPLE_QUARTZ__)
- MacUnmapWindow(this, i->xid);
+ i->unmap();
#else
# error platform unsupported
#endif
@@ -1330,7 +1532,7 @@ int Fl_Window::handle(int ev)
NULL, without changing the actual text of the
selection. FL_SELECTIONCLEAR is sent to the previous
selection owner, if any.
-
+
Copying the buffer every time the selection is changed is
obviously wasteful, especially for large selections. An interface will
probably be added in a future version to allow the selection to be made
@@ -1351,14 +1553,8 @@ void Fl::selection(Fl_Widget &owner, const char* text, int len) {
Fl::copy(text, len, 0);
}
-/** Backward compatibility only:
- Set things up so the receiver widget will be called with an FL_PASTE event some
- time in the future for the specified clipboard. The reciever
- should be prepared to be called \e directly by this, or for
- it to happen \e later, or possibly not at all. This
- allows the window system to take as long as necessary to retrieve
- the paste buffer (or even to screw up completely) without complex
- and error-prone synchronization code in FLTK.
+/** Backward compatibility only.
+ This calls Fl::paste(receiver, 0);
\see Fl::paste(Fl_Widget &receiver, int clipboard)
*/
void Fl::paste(Fl_Widget &receiver) {
@@ -1392,16 +1588,36 @@ void Fl_Widget::redraw_label() {
W += 5; // Add a little to the size of the label to cover overflow
H += 5;
- if (align() & FL_ALIGN_BOTTOM) {
- window()->damage(FL_DAMAGE_EXPOSE, x(), y() + h(), w(), H);
- } else if (align() & FL_ALIGN_TOP) {
- window()->damage(FL_DAMAGE_EXPOSE, x(), y() - H, w(), H);
- } else if (align() & FL_ALIGN_LEFT) {
- window()->damage(FL_DAMAGE_EXPOSE, x() - W, y(), W, h());
- } else if (align() & FL_ALIGN_RIGHT) {
- window()->damage(FL_DAMAGE_EXPOSE, x() + w(), y(), W, h());
- } else {
- window()->damage(FL_DAMAGE_ALL);
+ // FIXME:
+ // This assumes that measure() returns the correct outline, which it does
+ // not in all possible cases of alignment combinedwith image and symbols.
+ switch (align() & 0x0f) {
+ case FL_ALIGN_TOP_LEFT:
+ window()->damage(FL_DAMAGE_EXPOSE, x(), y()-H, W, H); break;
+ case FL_ALIGN_TOP:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()-H, W, H); break;
+ case FL_ALIGN_TOP_RIGHT:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()-H, W, H); break;
+ case FL_ALIGN_LEFT_TOP:
+ window()->damage(FL_DAMAGE_EXPOSE, x()-W, y(), W, H); break;
+ case FL_ALIGN_RIGHT_TOP:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y(), W, H); break;
+ case FL_ALIGN_LEFT:
+ window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+(h()-H)/2, W, H); break;
+ case FL_ALIGN_RIGHT:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+(h()-H)/2, W, H); break;
+ case FL_ALIGN_LEFT_BOTTOM:
+ window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+h()-H, W, H); break;
+ case FL_ALIGN_RIGHT_BOTTOM:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+h()-H, W, H); break;
+ case FL_ALIGN_BOTTOM_LEFT:
+ window()->damage(FL_DAMAGE_EXPOSE, x(), y()+h(), W, H); break;
+ case FL_ALIGN_BOTTOM:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()+h(), W, H); break;
+ case FL_ALIGN_BOTTOM_RIGHT:
+ window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()+h(), W, H); break;
+ default:
+ window()->damage(FL_DAMAGE_ALL); break;
}
} else {
// The label is inside the widget, so just redraw the widget itself...
@@ -1492,8 +1708,7 @@ void Fl_Window::flush() {
#ifdef WIN32
# include "Fl_win32.cxx"
-#elif defined(__APPLE__)
-# include "Fl_cocoa.mm"
+//#elif defined(__APPLE__)
#endif
//
@@ -1504,7 +1719,7 @@ void Fl_Window::flush() {
static int num_dwidgets = 0, alloc_dwidgets = 0;
static Fl_Widget **dwidgets = 0;
-/**
+/**
Schedules a widget for deletion at the next call to the event loop.
Use this method to delete a widget inside a callback function.
@@ -1544,9 +1759,9 @@ void Fl::delete_widget(Fl_Widget *wi) {
num_dwidgets ++;
}
-/**
+/**
Deletes widgets previously scheduled for deletion.
-
+
This is for internal use only. You should never call this directly.
Fl::do_widget_deletion() is called from the FLTK event loop or whenever
@@ -1570,7 +1785,7 @@ static int max_widget_watch = 0;
/**
Adds a widget pointer to the widget watch list.
-
+
\note Internal use only, please use class Fl_Widget_Tracker instead.
This can be used, if it is possible that a widget might be deleted during
@@ -1613,7 +1828,7 @@ static int max_widget_watch = 0;
\see class Fl_Widget_Tracker
*/
-void Fl::watch_widget_pointer(Fl_Widget *&w)
+void Fl::watch_widget_pointer(Fl_Widget *&w)
{
Fl_Widget **wp = &w;
int i;
@@ -1637,7 +1852,7 @@ void Fl::watch_widget_pointer(Fl_Widget *&w)
This is used to remove a widget pointer that has been added to the watch list
with Fl::watch_widget_pointer(), when it is not needed anymore.
-
+
\note Internal use only, please use class Fl_Widget_Tracker instead.
\see Fl::watch_widget_pointer()
@@ -1681,7 +1896,7 @@ void Fl::release_widget_pointer(Fl_Widget *&w)
\see Fl::watch_widget_pointer()
\see class Fl_Widget_Tracker
*/
-void Fl::clear_widget_pointer(Fl_Widget const *w)
+void Fl::clear_widget_pointer(Fl_Widget const *w)
{
if (w==0L) return;
int i;
@@ -1692,13 +1907,105 @@ void Fl::clear_widget_pointer(Fl_Widget const *w)
}
}
+
+/**
+ \brief FLTK library options management.
+
+ This function needs to be documented in more detail. It can be used for more
+ optional settings, such as using a native file chooser instead of the FLTK one
+ wherever possible, disabling tooltips, disabling visible focus, disabling
+ FLTK file chooser preview, etc. .
+
+ There should be a command line option interface.
+
+ There should be an application that manages options system wide, per user, and
+ per application.
+
+ \note As of FLTK 1.3.0, options can be managed within fluid, using the menu
+ Edit/Global FLTK Settings.
+
+ \param opt which option
+ \return true or false
+ \see enum Fl::Fl_Option
+ \see Fl::option(Fl_Option, bool)
+
+ \since FLTK 1.3.0
+ */
+bool Fl::option(Fl_Option opt)
+{
+ if (!options_read_) {
+ int tmp;
+ { // first, read the system wide preferences
+ Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
+ Fl_Preferences opt_prefs(prefs, "options");
+ opt_prefs.get("ArrowFocus", tmp, 0); // default: off
+ options_[OPTION_ARROW_FOCUS] = tmp;
+ //opt_prefs.get("NativeFilechooser", tmp, 1); // default: on
+ //options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ //opt_prefs.get("FilechooserPreview", tmp, 1); // default: on
+ //options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
+ opt_prefs.get("VisibleFocus", tmp, 1); // default: on
+ options_[OPTION_VISIBLE_FOCUS] = tmp;
+ opt_prefs.get("DNDText", tmp, 1); // default: on
+ options_[OPTION_DND_TEXT] = tmp;
+ opt_prefs.get("ShowTooltips", tmp, 1); // default: on
+ options_[OPTION_SHOW_TOOLTIPS] = tmp;
+ }
+ { // next, check the user preferences
+ // override system options only, if the option is set ( >= 0 )
+ Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
+ Fl_Preferences opt_prefs(prefs, "options");
+ opt_prefs.get("ArrowFocus", tmp, -1);
+ if (tmp >= 0) options_[OPTION_ARROW_FOCUS] = tmp;
+ //opt_prefs.get("NativeFilechooser", tmp, -1);
+ //if (tmp >= 0) options_[OPTION_NATIVE_FILECHOOSER] = tmp;
+ //opt_prefs.get("FilechooserPreview", tmp, -1);
+ //if (tmp >= 0) options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
+ opt_prefs.get("VisibleFocus", tmp, -1);
+ if (tmp >= 0) options_[OPTION_VISIBLE_FOCUS] = tmp;
+ opt_prefs.get("DNDText", tmp, -1);
+ if (tmp >= 0) options_[OPTION_DND_TEXT] = tmp;
+ opt_prefs.get("ShowTooltips", tmp, -1);
+ if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp;
+ }
+ { // now, if the developer has registered this app, we could as for per-application preferences
+ }
+ options_read_ = 1;
+ }
+ if (opt<0 || opt>=OPTION_LAST)
+ return false;
+ return (bool)(options_[opt]!=0);
+}
+
+/**
+ \brief Override an option while the application is running.
+
+ This function does not change any system or user settings.
+
+ \param opt which option
+ \param val set to true or false
+ \see enum Fl::Fl_Option
+ \see bool Fl::option(Fl_Option)
+ */
+void Fl::option(Fl_Option opt, bool val)
+{
+ if (opt<0 || opt>=OPTION_LAST)
+ return;
+ if (!options_read_) {
+ // first read this option, so we don't override our setting later
+ option(opt);
+ }
+ options_[opt] = val;
+}
+
+
// Helper class Fl_Widget_Tracker
/**
The constructor adds a widget to the watch list.
*/
-Fl_Widget_Tracker::Fl_Widget_Tracker(Fl_Widget *wi) {
-
+Fl_Widget_Tracker::Fl_Widget_Tracker(Fl_Widget *wi)
+{
wp_ = wi;
Fl::watch_widget_pointer(wp_); // add pointer to watch list
}
@@ -1706,11 +2013,12 @@ Fl_Widget_Tracker::Fl_Widget_Tracker(Fl_Widget *wi) {
/**
The destructor removes a widget from the watch list.
*/
-Fl_Widget_Tracker::~Fl_Widget_Tracker() {
-
+Fl_Widget_Tracker::~Fl_Widget_Tracker()
+{
Fl::release_widget_pointer(wp_); // remove pointer from watch list
}
+
//
-// End of "$Id: Fl.cxx 7354 2010-03-29 11:07:29Z matt $".
+// End of "$Id: Fl.cxx 8723 2011-05-23 16:49:02Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
index 189d0412f..150504f15 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Adjuster.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Adjuster.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $"
+// "$Id: Fl_Adjuster.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Adjuster widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -178,5 +178,5 @@ Fl_Adjuster::Fl_Adjuster(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Adjuster.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $".
+// End of "$Id: Fl_Adjuster.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
index 7f472c68b..daef86a58 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Bitmap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Bitmap.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_Bitmap.cxx 8360 2011-02-02 12:42:47Z manolo $"
//
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -304,13 +304,13 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int HP,
HDC tempdc;
int save;
BOOL use_print_algo = false;
- if (fl_surface->type() == Fl_Printer::device_type) {
+ if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
static HMODULE hMod = NULL;
if (!hMod) {
hMod = LoadLibrary("MSIMG32.DLL");
if (hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
}
- if (hMod) use_print_algo = true;
+ if (fl_TransparentBlt) use_print_algo = true;
}
if (use_print_algo) { // algorithm for bitmap output to Fl_GDI_Printer
Fl_Offscreen tmp_id = fl_create_offscreen(W, H);
@@ -478,5 +478,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
//
-// End of "$Id: Fl_Bitmap.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_Bitmap.cxx 8360 2011-02-02 12:42:47Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
index 2e9245229..9450cf6a2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Box.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Box.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Box.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Box widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,5 +40,5 @@ int Fl_Box::handle(int event) {
//
-// End of "$Id: Fl_Box.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Box.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
index 0db009245..d62b4f4db 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser.cxx 6895 2009-09-21 06:35:08Z greg.ercolano $"
+// "$Id: Fl_Browser.cxx 8736 2011-05-24 20:00:56Z AlbrechtS $"
//
// Browser widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -32,6 +32,12 @@
#include
#include
+#if defined(FL_DLL) // really needed for c'tors for MS VC++ only
+#include
+#include
+#include
+#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
@@ -375,6 +381,7 @@ int Fl_Browser::item_height(void *item) const {
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++) {
Fl_Font font = textfont(); // default font
@@ -389,7 +396,7 @@ int Fl_Browser::item_height(void *item) const {
case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
case 'f': case 't': font = FL_COURIER; break;
case 'B':
- case 'C': strtol(str, &str, 10); break;// skip a color number
+ case 'C': dummy = strtol(str, &str, 10); break;// skip a color number
case 'F': font = (Fl_Font)strtol(str,&str,10); break;
case 'S': tsize = strtol(str,&str,10); break;
case 0: case '@': str--;
@@ -442,6 +449,7 @@ int Fl_Browser::item_width(void *item) const {
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;
@@ -451,7 +459,7 @@ int Fl_Browser::item_width(void *item) const {
case 'i': font = (Fl_Font)(font|FL_ITALIC); break;
case 'f': case 't': font = FL_COURIER; break;
case 'B':
- case 'C': strtol(str, &str, 10); break;// skip a color number
+ case 'C': dummy = strtol(str, &str, 10); break;// skip a color number
case 'F': font = (Fl_Font)strtol(str, &str, 10); break;
case 'S': tsize = strtol(str, &str, 10); break;
case '.':
@@ -536,6 +544,7 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
//#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;
@@ -549,7 +558,7 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const {
if (!(l->flags & SELECTED)) {
fl_color((Fl_Color)strtol(str, &str, 10));
fl_rectf(X, Y, w1, H);
- } else strtol(str, &str, 10);
+ } else dummy = strtol(str, &str, 10);
break;
case 'C':
lcol = (Fl_Color)strtol(str, &str, 10);
@@ -911,6 +920,30 @@ void Fl_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)
+
+ Fl_Hold_Browser::Fl_Hold_Browser(int X,int Y,int W,int H,const char *L)
+ : Fl_Browser(X,Y,W,H,L) {type(FL_HOLD_BROWSER);}
+
+ Fl_Multi_Browser::Fl_Multi_Browser(int X,int Y,int W,int H,const char *L)
+ : Fl_Browser(X,Y,W,H,L) {type(FL_MULTI_BROWSER);}
+
+ Fl_Select_Browser::Fl_Select_Browser(int X,int Y,int W,int H,const char *L)
+ : Fl_Browser(X,Y,W,H,L) {type(FL_SELECT_BROWSER);}
+
+#endif // FL_DLL
+
//
-// End of "$Id: Fl_Browser.cxx 6895 2009-09-21 06:35:08Z greg.ercolano $".
+// End of "$Id: Fl_Browser.cxx 8736 2011-05-24 20:00:56Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
index c1c97ba51..1f738b1d1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $"
+// "$Id: Fl_Browser_.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -1103,5 +1103,5 @@ void Fl_Browser_::item_select(void *item, int val) {}
int Fl_Browser_::item_selected(void* item) const { return item==selection_ ? 1 : 0; }
//
-// End of "$Id: Fl_Browser_.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $".
+// End of "$Id: Fl_Browser_.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
index c72d31fd2..d529d2a7b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Browser_load.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Browser_load.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $"
+// "$Id: Fl_Browser_load.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// File loading routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -66,5 +66,5 @@ int Fl_Browser::load(const char *filename) {
}
//
-// End of "$Id: Fl_Browser_load.cxx 6726 2009-03-27 16:52:31Z greg.ercolano $".
+// End of "$Id: Fl_Browser_load.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
index 391f9311a..7104b4446 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Button.cxx 7476 2010-04-09 22:18:05Z matt $"
+// "$Id: Fl_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -30,6 +30,10 @@
#include
#include
+
+Fl_Widget_Tracker *Fl_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 Fl_Radio_Button and Fl_Toggle_Button
@@ -128,22 +132,9 @@ int Fl_Button::handle(int event) {
return 1;
case FL_SHORTCUT:
if (!(shortcut() ?
- Fl::test_shortcut(shortcut()) : test_shortcut())) return 0;
-
+ Fl::test_shortcut(shortcut()) : test_shortcut())) return 0;
if (Fl::visible_focus() && handle(FL_FOCUS)) Fl::focus(this);
-
- if (type() == FL_RADIO_BUTTON && !value_) {
- setonly();
- set_changed();
- if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE) )
- do_callback();
- } else if (type() == FL_TOGGLE_BUTTON) {
- value(!value());
- set_changed();
- if (when() & (FL_WHEN_CHANGED|FL_WHEN_RELEASE))
- do_callback();
- } else if (when() & FL_WHEN_RELEASE) do_callback();
- return 1;
+ goto triggered_by_keyboard;
case FL_FOCUS : /* FALLTHROUGH */
case FL_UNFOCUS :
if (Fl::visible_focus()) {
@@ -161,6 +152,7 @@ int Fl_Button::handle(int event) {
if (Fl::focus() == this && Fl::event_key() == ' ' &&
!(Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT | FL_META))) {
set_changed();
+ triggered_by_keyboard:
Fl_Widget_Tracker wp(this);
if (type() == FL_RADIO_BUTTON && !value_) {
setonly();
@@ -168,6 +160,8 @@ int Fl_Button::handle(int event) {
} else if (type() == FL_TOGGLE_BUTTON) {
value(!value());
if (when() & FL_WHEN_CHANGED) do_callback();
+ } else {
+ simulate_key_action();
}
if (wp.deleted()) return 1;
if (when() & FL_WHEN_RELEASE) do_callback();
@@ -178,6 +172,33 @@ int Fl_Button::handle(int event) {
}
}
+void Fl_Button::simulate_key_action()
+{
+ if (key_release_tracker) {
+ Fl::remove_timeout(key_release_timeout, key_release_tracker);
+ key_release_timeout(key_release_tracker);
+ }
+ value(1);
+ redraw();
+ key_release_tracker = new Fl_Widget_Tracker(this);
+ Fl::add_timeout(0.15, key_release_timeout, key_release_tracker);
+}
+
+void Fl_Button::key_release_timeout(void *d)
+{
+ Fl_Widget_Tracker *wt = (Fl_Widget_Tracker*)d;
+ if (!wt)
+ return;
+ if (wt==key_release_tracker)
+ key_release_tracker = 0L;
+ Fl_Button *btn = (Fl_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
@@ -193,5 +214,5 @@ Fl_Button::Fl_Button(int X, int Y, int W, int H, const char *L)
}
//
-// End of "$Id: Fl_Button.cxx 7476 2010-04-09 22:18:05Z matt $".
+// End of "$Id: Fl_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
index 28004c901..5af4ed218 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Chart.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Chart.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Chart.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -432,5 +432,5 @@ void Fl_Chart::maxsize(int m) {
}
//
-// End of "$Id: Fl_Chart.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Chart.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
index 77284c8cc..4355119a7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Check_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Browser.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Check_Browser.cxx 8354 2011-02-01 15:41:04Z manolo $"
//
// Fl_Check_Browser header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -166,15 +166,18 @@ int Fl_Check_Browser::item_selected(void *v) const {
return i->selected;
}
/**
- Add a new unchecked 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. The second form can set the item checked.
+ Add a new unchecked line to the end of the browser.
+ \see add(char *s, int b)
*/
int Fl_Check_Browser::add(char *s) {
return (add(s, 0));
}
-/** See int Fl_Check_Browser::add(char *s) */
+/**
+ 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 Fl_Check_Browser::add(char *s, int b) {
cb_item *p = (cb_item *)malloc(sizeof(cb_item));
p->next = 0;
@@ -322,5 +325,5 @@ int Fl_Check_Browser::handle(int event) {
}
//
-// End of "$Id: Fl_Check_Browser.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Check_Browser.cxx 8354 2011-02-01 15:41:04Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
index d6f24b90c..0baeafcd5 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Check_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Check_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Check_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Check button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
index a31bdc873..6f3b06ffe 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Choice.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Choice.cxx 6873 2009-09-16 07:06:41Z AlbrechtS $"
+// "$Id: Fl_Choice.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Choice widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -209,5 +209,5 @@ int Fl_Choice::handle(int e) {
}
//
-// End of "$Id: Fl_Choice.cxx 6873 2009-09-16 07:06:41Z AlbrechtS $".
+// End of "$Id: Fl_Choice.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
index f00ba255f..75a757c2f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Clock.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Clock.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Clock.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Clock widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -214,5 +214,5 @@ Fl_Clock::~Fl_Clock() {
}
//
-// End of "$Id: Fl_Clock.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Clock.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
index eb88f8d22..d5bd6e6a1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Color_Chooser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Color_Chooser.cxx 7347 2010-03-27 16:35:14Z AlbrechtS $"
+// "$Id: Fl_Color_Chooser.cxx 7981 2010-12-08 23:53:04Z greg.ercolano $"
//
// Color chooser for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -455,6 +455,13 @@ void Fl_Color_Chooser::mode_cb(Fl_Widget* o, void*) {
c->set_valuators();
}
+void Fl_Color_Chooser::mode(int newMode)
+{
+ choice.value(newMode);
+ choice.do_callback();
+}
+
+
////////////////////////////////////////////////////////////////
/**
@@ -553,15 +560,17 @@ static void cc_cancel_cb (Fl_Widget *o, void *p) {
@{ */
/**
\brief Pops up a window to let the user pick an arbitrary RGB color.
+ \note \#include
\image html fl_color_chooser.jpg
- \image latex fl_color_chooser.eps "fl_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.
+ \image latex fl_color_chooser.jpg "fl_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 Fl_Color_Chooser
*/
-int fl_color_chooser(const char* name, double& r, double& g, double& b) {
+int fl_color_chooser(const char* name, double& r, double& g, double& b, int cmode) {
int ret = 0;
Fl_Window window(215,200,name);
window.callback(cc_cancel_cb,&ret);
@@ -578,6 +587,7 @@ int fl_color_chooser(const char* name, double& r, double& g, double& b) {
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);
@@ -593,19 +603,21 @@ int fl_color_chooser(const char* name, double& r, double& g, double& b) {
/**
\brief Pops up a window to let the user pick an arbitrary RGB color.
+ \note \#include
\image html fl_color_chooser.jpg
- \image latex fl_color_chooser.eps "fl_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.
+ \image latex fl_color_chooser.jpg "fl_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 Fl_Color_Chooser
*/
-int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
+int fl_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 (fl_color_chooser(name,dr,dg,db)) {
+ if (fl_color_chooser(name,dr,dg,db,cmode)) {
r = uchar(255*dr+.5);
g = uchar(255*dg+.5);
b = uchar(255*db+.5);
@@ -613,7 +625,8 @@ int fl_color_chooser(const char* name, uchar& r, uchar& g, uchar& b) {
}
return 0;
}
+
/** @} */
//
-// End of "$Id: Fl_Color_Chooser.cxx 7347 2010-03-27 16:35:14Z AlbrechtS $".
+// End of "$Id: Fl_Color_Chooser.cxx 7981 2010-12-08 23:53:04Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
index dd0a43674..7f895a751 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Counter.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Counter.cxx 7162 2010-02-26 21:10:46Z matt $"
+// "$Id: Fl_Counter.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -207,5 +207,5 @@ Fl_Counter::Fl_Counter(int X, int Y, int W, int H, const char* L)
}
//
-// End of "$Id: Fl_Counter.cxx 7162 2010-02-26 21:10:46Z matt $".
+// End of "$Id: Fl_Counter.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Device.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Device.cxx
index b37ad5db6..e2808ea7c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Device.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Device.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Device.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_Device.cxx 8504 2011-03-04 16:48:10Z manolo $"
//
// implementation of Fl_Device class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010 by Bill Spitzak and others.
+// 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
@@ -29,18 +29,18 @@
#include
#include
-const char *Fl_Device::device_type = "Fl_Device";
-const char *Fl_Surface_Device::device_type = "Fl_Surface_Device";
-const char *Fl_Display_Device::device_type = "Fl_Display_Device";
-const char *Fl_Graphics_Driver::device_type = "Fl_Graphics_Driver";
+const char *Fl_Device::class_id = "Fl_Device";
+const char *Fl_Surface_Device::class_id = "Fl_Surface_Device";
+const char *Fl_Display_Device::class_id = "Fl_Display_Device";
+const char *Fl_Graphics_Driver::class_id = "Fl_Graphics_Driver";
#if defined(__APPLE__) || defined(FL_DOXYGEN)
-const char *Fl_Quartz_Graphics_Driver::device_type = "Fl_Quartz_Graphics_Driver";
+const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
#endif
#if defined(WIN32) || defined(FL_DOXYGEN)
-const char *Fl_GDI_Graphics_Driver::device_type = "Fl_GDI_Graphics_Driver";
+const char *Fl_GDI_Graphics_Driver::class_id = "Fl_GDI_Graphics_Driver";
#endif
#if !(defined(__APPLE__) || defined(WIN32))
-const char *Fl_Xlib_Graphics_Driver::device_type = "Fl_Xlib_Graphics_Driver";
+const char *Fl_Xlib_Graphics_Driver::class_id = "Fl_Xlib_Graphics_Driver";
#endif
@@ -48,9 +48,43 @@ const char *Fl_Xlib_Graphics_Driver::device_type = "Fl_Xlib_Graphics_Driver";
void Fl_Surface_Device::set_current(void)
{
fl_graphics_driver = _driver;
- fl_surface = this;
+ _surface = this;
}
+const Fl_Graphics_Driver::matrix Fl_Graphics_Driver::m0 = {1, 0, 0, 1, 0, 0};
+
+Fl_Graphics_Driver::Fl_Graphics_Driver() {
+ 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 Fl_Graphics_Driver::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();
+}
+
+Fl_Display_Device::Fl_Display_Device(Fl_Graphics_Driver *graphics_driver) : Fl_Surface_Device( 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: Fl_Device.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_Device.cxx 8504 2011-03-04 16:48:10Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
index def4c7103..2adaabbea 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Dial.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Dial.cxx 7162 2010-02-26 21:10:46Z matt $"
+// "$Id: Fl_Dial.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Circular dial widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -162,5 +162,5 @@ Fl_Dial::Fl_Dial(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Dial.cxx 7162 2010-02-26 21:10:46Z matt $".
+// End of "$Id: Fl_Dial.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
index 13725b5d1..927eccbe1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Double_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Double_Window.cxx 7671 2010-07-09 17:31:33Z manolo $"
+// "$Id: Fl_Double_Window.cxx 8383 2011-02-06 12:20:16Z AlbrechtS $"
//
// Double-buffered window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -52,9 +52,12 @@ static int can_xdbe() {
int numscreens = 1;
XdbeScreenVisualInfo *a = XdbeGetVisualInfo(fl_display,&root,&numscreens);
if (!a) return 0;
- for (int j = 0; j < a->count; j++)
+ 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;}
+ /*&& a->visinfo[j].perflevel > 0*/) {
+ use_xdbe = 1; break;
+ }
+ }
XdbeFreeVisualInfo(a);
}
return use_xdbe;
@@ -67,8 +70,17 @@ void Fl_Double_Window::show() {
static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_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, Fl_Offscreen pixmap, int srcx, int srcy) {
- if( fl_graphics_driver == fl_display_device->driver()) {
+ if (fl_graphics_driver == Fl_Display_Device::display_device()->driver()) {
fl_copy_offscreen_to_display(x, y, w, h, pixmap, srcx, srcy);
}
else { // when copy is not to the display
@@ -76,14 +88,15 @@ void fl_copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx
uchar *img = fl_read_image(NULL, srcx, srcy, w, h, 0);
fl_end_offscreen();
fl_draw_image(img, x, y, w, h, 3, 0);
- delete img;
+ delete[] img;
}
}
+/** @} */
#if defined(USE_X11)
static void fl_copy_offscreen_to_display(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy) {
- XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
+ XCopyArea(fl_display, pixmap, fl_window, fl_gc, srcx, srcy, w, h, x, y);
}
@@ -170,35 +183,26 @@ void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int src
BOOL alpha_ok = 0;
// first try to alpha blend
// if to printer, always try alpha_blend
- int to_display = Fl_Surface_Device::surface()->type() == Fl_Display_Device::device_type; // true iff display output
- if ( (to_display && fl_can_do_alpha_blending()) || Fl_Surface_Device::surface()->type() == Fl_Printer::device_type) {
+ int to_display = Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::class_id; // true iff display output
+ if ( (to_display && fl_can_do_alpha_blending()) || Fl_Surface_Device::surface()->class_name() == Fl_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 fl_restore_clip();
-#elif defined(__APPLE_QUARTZ__)
+#elif defined(__APPLE_QUARTZ__) || defined(FL_DOXYGEN)
char fl_can_do_alpha_blending() {
return 1;
}
-Fl_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 (Fl_Offscreen)ctx;
-}
-
Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h) {
void *data = calloc(w*h,4);
CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB();
@@ -208,8 +212,25 @@ Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h) {
return (Fl_Offscreen)ctx;
}
-static void bmProviderRelease (void *src, const void *data, size_t size)
-{
+/** \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.
+ */
+Fl_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 (Fl_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);
@@ -238,6 +259,9 @@ static void fl_copy_offscreen_to_display(int x,int y,int w,int h,Fl_Offscreen os
CGDataProviderRelease(src_bytes);
}
+/** Deletion of an offscreen graphics buffer.
+ \param ctx the buffer to be deleted.
+ */
void fl_delete_offscreen(Fl_Offscreen ctx) {
if (!ctx) return;
void *data = CGBitmapContextGetData((CGContextRef)ctx);
@@ -252,9 +276,12 @@ static CGContextRef stack_gc[stack_max];
static Window stack_window[stack_max];
static Fl_Surface_Device *_ss;
+/** Send all subsequent drawing commands to this offscreen buffer.
+ \param ctx the offscreen buffer.
+ */
void fl_begin_offscreen(Fl_Offscreen ctx) {
- _ss = fl_surface;
- fl_display_device->set_current();
+ _ss = Fl_Surface_Device::surface();
+ Fl_Display_Device::display_device()->set_current();
if (stack_ixset_current();
}
+/** @} */
+
extern void fl_restore_clip();
#else
@@ -307,8 +338,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
if (!myi->other_xid) {
#if USE_XDBE
if (can_xdbe()) {
- myi->other_xid =
- XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeCopied);
+ myi->other_xid = XdbeAllocateBackBufferName(fl_display, fl_xid(this), XdbeCopied);
myi->backbuffer_bad = 1;
} else
#endif
@@ -360,7 +390,7 @@ void Fl_Double_Window::flush(int eraseoverlay) {
RestoreDC(fl_gc, save);
DeleteDC(fl_gc);
fl_gc = _sgc;
- //# if defined(USE_CAIRO)
+ //# if defined(FLTK_USE_CAIRO)
//if Fl::cairo_autolink_context() Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
//# endif
#elif defined(__APPLE__)
@@ -428,5 +458,5 @@ Fl_Double_Window::~Fl_Double_Window() {
}
//
-// End of "$Id: Fl_Double_Window.cxx 7671 2010-07-09 17:31:33Z manolo $".
+// End of "$Id: Fl_Double_Window.cxx 8383 2011-02-06 12:20:16Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
index 78e21aa33..98c5ff1dd 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Browser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Browser.cxx 7352 2010-03-29 10:47:11Z matt $"
+// "$Id: Fl_File_Browser.cxx 8063 2010-12-19 21:20:10Z matt $"
//
// Fl_File_Browser routines.
//
-// Copyright 1999-2009 by Michael Sweet.
+// 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
@@ -536,7 +536,7 @@ Fl_File_Browser::load(const char *directory,// I - Directory to load
// UNIX code uses /etc/fstab or similar...
//
FILE *mtab; // /etc/mtab or /etc/mnttab file
- char line[1024]; // Input line
+ char line[FL_PATH_MAX]; // Input line
//
// Open the file that contains a list of mounted filesystems...
@@ -639,5 +639,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string
//
-// End of "$Id: Fl_File_Browser.cxx 7352 2010-03-29 10:47:11Z matt $".
+// End of "$Id: Fl_File_Browser.cxx 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
index 6a4ba00d3..4d879d2af 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_File_Chooser.cxx 8786 2011-06-07 11:41:36Z manolo $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -88,6 +88,13 @@ void Fl_File_Chooser::cb_previewButton(Fl_Check_Button* o, void* v) {
((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_previewButton_i(o,v);
}
+void Fl_File_Chooser::cb_showHiddenButton_i(Fl_Check_Button*, void*) {
+ showHidden(showHiddenButton->value());
+}
+void Fl_File_Chooser::cb_showHiddenButton(Fl_Check_Button* o, void* v) {
+ ((Fl_File_Chooser*)(o->parent()->parent()->parent()->user_data()))->cb_showHiddenButton_i(o,v);
+}
+
void Fl_File_Chooser::cb_fileName_i(Fl_File_Input*, void*) {
fileNameCB();
}
@@ -208,6 +215,11 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
previewButton->callback((Fl_Callback*)cb_previewButton);
previewButton->label(preview_label);
} // Fl_Check_Button* previewButton
+ { showHiddenButton = new Fl_Check_Button(115, 275, 165, 20, "Show hidden files");
+ showHiddenButton->down_box(FL_DOWN_BOX);
+ showHiddenButton->callback((Fl_Callback*)cb_showHiddenButton);
+ showHiddenButton->label(hidden_label);
+ } // Fl_Check_Button* showHiddenButton
{ Fl_Box* o = new Fl_Box(115, 275, 365, 20);
Fl_Group::current()->resizable(o);
} // Fl_Box* o
@@ -286,31 +298,31 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char
favWindow->end();
} // Fl_Double_Window* favWindow
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);
+ 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);
ext_group=(Fl_Widget*)0;
}
Fl_File_Chooser::~Fl_File_Chooser() {
Fl::remove_timeout((Fl_Timeout_Handler)previewCB, this);
-if(ext_group)window->remove(ext_group);
-delete window;
-delete favWindow;
+ if(ext_group)window->remove(ext_group);
+ delete window;
+ delete favWindow;
}
void Fl_File_Chooser::callback(void (*cb)(Fl_File_Chooser *, void *), void *d ) {
callback_ = cb;
-data_ = d;
+ data_ = d;
}
void Fl_File_Chooser::color(Fl_Color c) {
@@ -335,7 +347,7 @@ int Fl_File_Chooser::filter_value() {
void Fl_File_Chooser::filter_value(int f) {
showChoice->value(f);
-showChoiceCB();
+ showChoiceCB();
}
void Fl_File_Chooser::hide() {
@@ -360,27 +372,17 @@ const char * Fl_File_Chooser::label() {
void Fl_File_Chooser::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();
+ 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 * Fl_File_Chooser::ok_label() {
return (okButton->label());
}
-void Fl_File_Chooser::show() {
- window->hotspot(fileList);
-window->show();
-Fl::flush();
-fl_cursor(FL_CURSOR_WAIT);
-rescan_keep_filename();
-fl_cursor(FL_CURSOR_DEFAULT);
-fileName->take_focus();
-}
-
int Fl_File_Chooser::shown() {
return window->shown();
}
@@ -411,18 +413,18 @@ Fl_Fontsize Fl_File_Chooser::textsize() {
void Fl_File_Chooser::type(int t) {
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);
+ 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);
}
int Fl_File_Chooser::type() {
@@ -445,29 +447,29 @@ Fl_Widget* Fl_File_Chooser::add_extra(Fl_Widget* gr) {
Fl_Widget* ret=ext_group;
if (gr==ext_group) {
return ret;
- }
- if (ext_group) {
- 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);
- }
- if (gr) {
- 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);
- }
- return ret;
+ }
+ if (ext_group) {
+ 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);
+ }
+ if (gr) {
+ 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);
+ }
+ return ret;
}
//
-// End of "$Id: Fl_File_Chooser.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_File_Chooser.cxx 8786 2011-06-07 11:41:36Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
index 84716418b..dc22a7269 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser.fl
@@ -3,11 +3,11 @@ version 1.0300
header_name {../FL/Fl_File_Chooser.H}
code_name {.cxx}
comment {//
-// "$Id: Fl_File_Chooser.fl 6678 2009-03-13 23:36:09Z AlbrechtS $"
+// "$Id: Fl_File_Chooser.fl 8786 2011-06-07 11:41:36Z manolo $"
//
// Fl_File_Chooser dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,8 +40,8 @@ class FL_EXPORT Fl_File_Chooser {open
decl {static Fl_Preferences prefs_;} {}
decl {void (*callback_)(Fl_File_Chooser*, void *);} {}
decl {void *data_;} {}
- decl {char directory_[1024];} {}
- decl {char pattern_[1024];} {}
+ decl {char directory_[FL_PATH_MAX];} {}
+ decl {char pattern_[FL_PATH_MAX];} {}
decl {char preview_text_[2048];} {}
decl {int type_;} {}
decl {void favoritesButtonCB();} {}
@@ -115,6 +115,12 @@ window->hide();} open
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
}
@@ -301,19 +307,15 @@ okButton->parent()->init_sizes();} {}
}
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
}
- Function {show()} {open return_type void
- } {
- code {window->hotspot(fileList);
-window->show();
-Fl::flush();
-fl_cursor(FL_CURSOR_WAIT);
-rescan_keep_filename();
-fl_cursor(FL_CURSOR_DEFAULT);
-fileName->take_focus();} {}
+ decl {void show();} {public
}
Function {shown()} {return_type int
} {
@@ -418,6 +420,9 @@ else
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
@@ -469,6 +474,6 @@ decl {FL_EXPORT void fl_file_chooser_ok_label(const char*l);} {public
comment {
//
-// End of "$Id: Fl_File_Chooser.fl 6678 2009-03-13 23:36:09Z AlbrechtS $".
+// End of "$Id: Fl_File_Chooser.fl 8786 2011-06-07 11:41:36Z manolo $".
//} {in_source in_header
}
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
index fda39ef6a..861f73997 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Chooser2.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Chooser2.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_File_Chooser2.cxx 8785 2011-06-06 16:11:22Z manolo $"
//
// More Fl_File_Chooser routines.
//
-// Copyright 1999-2009 by Michael Sweet.
+// 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
@@ -34,7 +34,7 @@
dialog that supports various selection modes.
\image html Fl_File_Chooser.jpg
- \image latex Fl_File_Chooser.eps "Fl_File_Chooser" width=12cm
+ \image latex Fl_File_Chooser.jpg "Fl_File_Chooser" width=12cm
The Fl_File_Chooser class also exports several static values
that may be used to localize or customize the appearance of all file chooser
@@ -74,7 +74,11 @@
"My Computer" (WIN32)
"File Systems" (all others) |
-
+
+ | hidden_label |
+ "Show hidden files:" |
+
+
| manage_favorites_label |
"Manage Favorites" |
@@ -98,7 +102,7 @@
show_label |
"Show:" |
-
+
| sort |
fl_numericsort |
@@ -165,19 +169,19 @@
Destroys the widget and frees all memory used by it.*/
/** \fn void Fl_File_Chooser::color(Fl_Color c)
- Sets or gets the background color of the Fl_File_Browser list.*/
+ Sets the background color of the Fl_File_Browser list.*/
/** \fn Fl_Color Fl_File_Chooser::color()
- Sets or gets the background color of the Fl_File_Browser list.*/
+ Gets the background color of the Fl_File_Browser list.*/
/** \fn int Fl_File_Chooser::count()
Returns the number of selected files.*/
/** \fn void Fl_File_Chooser::directory(const char *pathname)
- Sets or gets the current directory.*/
+ Sets the current directory.*/
/** \fn const char *Fl_File_Chooser::directory()
- Sets or gets the current directory.*/
+ Gets the current directory.*/
/** \fn void Fl_File_Chooser::filter(const char *pattern)
Sets or gets the current filename filter patterns. The filter
@@ -195,36 +199,36 @@
See void filter(const char *pattern)*/
/** \fn void Fl_File_Chooser::filter_value(int f)
- Sets or gets the current filename filter selection.*/
+ Sets the current filename filter selection.*/
/** \fn int Fl_File_Chooser::filter_value()
- Sets or gets the current filename filter selection.*/
+ Gets the current filename filter selection.*/
/** \fn void Fl_File_Chooser::hide()
Hides the Fl_File_Chooser window.*/
/** \fn void Fl_File_Chooser::iconsize(uchar s)
- Sets or gets the size of the icons in the Fl_File_Browser. By
+ Sets the size of the icons in the Fl_File_Browser. By
default the icon size is set to 1.5 times the textsize().
*/
/** \fn uchar Fl_File_Chooser::iconsize()
- Sets or gets the size of the icons in the Fl_File_Browser. By
+ Gets the size of the icons in the Fl_File_Browser. By
default the icon size is set to 1.5 times the textsize().
*/
/** \fn void Fl_File_Chooser::label(const char *l)
- Sets or gets the title bar text for the Fl_File_Chooser.*/
+ Sets the title bar text for the Fl_File_Chooser.*/
/** \fn const char *Fl_File_Chooser::label()
- Sets or gets the title bar text for the Fl_File_Chooser.*/
+ Gets the title bar text for the Fl_File_Chooser.*/
/** \fn void Fl_File_Chooser::ok_label(const char *l)
- Sets or gets the label for the "ok" button in the Fl_File_Chooser.
+ Sets the label for the "ok" button in the Fl_File_Chooser.
*/
/** \fn const char *Fl_File_Chooser::ok_label()
- Sets or gets the label for the "ok" button in the Fl_File_Chooser.
+ Gets the label for the "ok" button in the Fl_File_Chooser.
*/
/** \fn int Fl_File_Chooser::preview() const
@@ -237,48 +241,48 @@
Shows the Fl_File_Chooser window.*/
/** \fn void Fl_File_Chooser::textcolor(Fl_Color c)
- Sets or gets the current Fl_File_Browser text color.*/
+ Sets the current Fl_File_Browser text color.*/
/** \fn Fl_Color Fl_File_Chooser::textcolor()
- Sets or gets the current Fl_File_Browser text color.*/
+ Gets the current Fl_File_Browser text color.*/
/** \fn void Fl_File_Chooser::textfont(Fl_Font f)
- Sets or gets the current Fl_File_Browser text font.*/
+ Sets the current Fl_File_Browser text font.*/
/** \fn Fl_Font Fl_File_Chooser::textfont()
- Sets or gets the current Fl_File_Browser text font.*/
+ Gets the current Fl_File_Browser text font.*/
/** \fn void Fl_File_Chooser::textsize(Fl_Fontsize s)
- Sets or gets the current Fl_File_Browser text size.*/
+ Sets the current Fl_File_Browser text size.*/
/** \fn Fl_Fontsize Fl_File_Chooser::textsize()
- Sets or gets the current Fl_File_Browser text size.*/
+ Gets the current Fl_File_Browser text size.*/
/** \fn void Fl_File_Chooser::type(int t)
- Sets or gets the current type of Fl_File_Chooser.*/
+ Sets the current type of Fl_File_Chooser.*/
/** \fn int Fl_File_Chooser::type()
- Sets or gets the current type of Fl_File_Chooser.*/
+ Gets the current type of Fl_File_Chooser.*/
-/** \fn const char *Fl_File_Chooser::value(const char *pathname)
- Sets or gets the current value of the selected file.
-
- In the second form, \p file is a \c 1-based index into a list of
- file names. The number of selected files is returned by
- Fl_File_Chooser::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 void Fl_File_Chooser::value(const char *pathname)
+ Sets the current value of the selected file.
*/
-/** \fn const char *Fl_File_Chooser::value(int file)
- See const char *value(const char *pathname)*/
+/** \fn const char *Fl_File_Chooser::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
+ Fl_File_Chooser::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 Fl_File_Chooser::visible()
Returns 1 if the Fl_File_Chooser window is visible.*/
@@ -343,6 +347,7 @@
#include
#include
#include
+#include
#include
#include
@@ -392,6 +397,7 @@ const char *Fl_File_Chooser::new_directory_tooltip = "Create a new directory.";
const char *Fl_File_Chooser::preview_label = "Preview";
const char *Fl_File_Chooser::save_label = "Save";
const char *Fl_File_Chooser::show_label = "Show:";
+const char *Fl_File_Chooser::hidden_label = "Show hidden files";
Fl_File_Sort_F *Fl_File_Chooser::sort = fl_numericsort;
@@ -460,7 +466,7 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to
#ifdef WIN32
// See if the filename contains backslashes...
char *slash; // Pointer to slashes
- char fixpath[1024]; // Path with slashes converted
+ char fixpath[FL_PATH_MAX]; // Path with slashes converted
if (strchr(d, '\\')) {
// Convert backslashes to slashes...
strlcpy(fixpath, d, sizeof(fixpath));
@@ -524,8 +530,8 @@ void
Fl_File_Chooser::favoritesButtonCB()
{
int v; // Current selection
- char pathname[1024], // Pathname
- menuname[2048]; // Menu name
+ char pathname[FL_PATH_MAX], // Pathname
+ menuname[FL_PATH_MAX]; // Menu name
v = favoritesButton->value();
@@ -691,7 +697,7 @@ void
Fl_File_Chooser::fileListCB()
{
char *filename, // New filename
- pathname[1024]; // Full pathname to file
+ pathname[FL_PATH_MAX]; // Full pathname to file
filename = (char *)fileList->text(fileList->value());
@@ -727,6 +733,7 @@ Fl_File_Chooser::fileListCB()
{
// Hide the window - picked the file...
window->hide();
+ if (callback_) (*callback_)(this, data_);
}
}
else
@@ -791,8 +798,8 @@ Fl_File_Chooser::fileNameCB()
{
char *filename, // New filename
*slash, // Pointer to trailing slash
- pathname[1024], // Full pathname to file
- matchname[256]; // Matching filename
+ pathname[FL_PATH_MAX], // Full pathname to file
+ matchname[FL_PATH_MAX]; // Matching filename
int i, // Looping var
min_match, // Minimum number of matching chars
max_match, // Maximum number of matching chars
@@ -841,8 +848,8 @@ Fl_File_Chooser::fileNameCB()
// Enter pressed - select or change directory...
#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__)
if ((isalpha(pathname[0] & 255) && pathname[1] == ':' && !pathname[2]) ||
- _fl_filename_isdir_quick(pathname) &&
- compare_dirnames(pathname, directory_)) {
+ (_fl_filename_isdir_quick(pathname) &&
+ compare_dirnames(pathname, directory_))) {
#else
if (_fl_filename_isdir_quick(pathname) &&
compare_dirnames(pathname, directory_)) {
@@ -889,7 +896,7 @@ Fl_File_Chooser::fileNameCB()
directory(pathname);
if (filename[0]) {
- char tempname[1024];
+ char tempname[FL_PATH_MAX];
snprintf(tempname, sizeof(tempname), "%s/%s", directory_, filename);
fileName->value(tempname);
@@ -1000,7 +1007,7 @@ Fl_File_Chooser::filter(const char *p) // I - Pattern(s)
*start, // Start of pattern
*end; // End of pattern
int allfiles; // Do we have a "*" pattern?
- char temp[1024]; // Temporary pattern string
+ char temp[FL_PATH_MAX]; // Temporary pattern string
// Make sure we have a pattern...
@@ -1032,8 +1039,6 @@ Fl_File_Chooser::filter(const char *p) // I - Pattern(s)
showChoice->add(custom_filter_label);
- // TODO: add a menu item to switch hidden files on and off
-
showChoice->value(0);
showChoiceCB();
}
@@ -1047,7 +1052,7 @@ void
Fl_File_Chooser::newdir()
{
const char *dir; // New directory name
- char pathname[1024]; // Full path of directory
+ char pathname[FL_PATH_MAX]; // Full path of directory
// Get a directory name from the user
@@ -1128,7 +1133,7 @@ Fl_File_Chooser::previewCB(Fl_File_Chooser *fc) { // I - File chooser
void
Fl_File_Chooser::rescan()
{
- char pathname[1024]; // New pathname for filename field
+ char pathname[FL_PATH_MAX]; // New pathname for filename field
// Clear the current filename
@@ -1146,7 +1151,9 @@ Fl_File_Chooser::rescan()
// Build the file list...
fileList->load(directory_, sort);
-
+#ifndef WIN32
+ if (!showHiddenButton->value()) remove_hidden_files();
+#endif
// Update the preview box...
update_preview();
}
@@ -1166,12 +1173,14 @@ void Fl_File_Chooser::rescan_keep_filename()
}
int i;
- char pathname[1024]; // New pathname for filename field
+ char pathname[FL_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();
@@ -1212,7 +1221,7 @@ Fl_File_Chooser::showChoiceCB()
const char *item, // Selected item
*patstart; // Start of pattern
char *patend; // End of pattern
- char temp[1024]; // Temporary string for pattern
+ char temp[FL_PATH_MAX]; // Temporary string for pattern
item = showChoice->text(showChoice->value());
@@ -1249,7 +1258,7 @@ void
Fl_File_Chooser::update_favorites()
{
int i; // Looping var
- char pathname[1024], // Pathname
+ char pathname[FL_PATH_MAX], // Pathname
menuname[2048]; // Menu name
const char *home; // Home directory
@@ -1296,7 +1305,6 @@ Fl_File_Chooser::update_preview()
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();
@@ -1345,7 +1353,7 @@ Fl_File_Chooser::update_preview()
int bytes;
char *ptr;
- if (filename) fp = fopen(filename, "rb");
+ if (filename) fp = fl_fopen(filename, "rb");
else fp = NULL;
if (fp != NULL) {
@@ -1403,7 +1411,7 @@ Fl_File_Chooser::update_preview()
// Show the first 1k of text...
int size = previewBox->h() / 20;
if (size < 6) size = 6;
- else if (size > 14) size = 14;
+ else if (size > FL_NORMAL_SIZE) size = FL_NORMAL_SIZE;
previewBox->label(preview_text_);
previewBox->align((Fl_Align)(FL_ALIGN_CLIP | FL_ALIGN_INSIDE |
@@ -1455,7 +1463,7 @@ Fl_File_Chooser::value(int f) // I - File number
int i; // Looping var
int fcount; // Number of selected files
const char *name; // Current filename
- static char pathname[1024]; // Filename + directory
+ static char pathname[FL_PATH_MAX]; // Filename + directory
name = fileName->value();
@@ -1502,7 +1510,7 @@ Fl_File_Chooser::value(const char *filename)
int i, // Looping var
fcount; // Number of items in list
char *slash; // Directory separator
- char pathname[1024]; // Local copy of filename
+ char pathname[FL_PATH_MAX]; // Local copy of filename
// printf("Fl_File_Chooser::value(\"%s\")\n", filename == NULL ? "(null)" : filename);
@@ -1518,7 +1526,7 @@ Fl_File_Chooser::value(const char *filename)
#ifdef WIN32
// See if the filename contains backslashes...
- char fixpath[1024]; // Path with slashes converted
+ char fixpath[FL_PATH_MAX]; // Path with slashes converted
if (strchr(filename, '\\')) {
// Convert backslashes to slashes...
strlcpy(fixpath, filename, sizeof(fixpath));
@@ -1569,8 +1577,42 @@ Fl_File_Chooser::value(const char *filename)
break;
}
}
+
+void Fl_File_Chooser::show()
+{
+ window->hotspot(fileList);
+ window->show();
+ Fl::flush();
+ fl_cursor(FL_CURSOR_WAIT);
+ rescan_keep_filename();
+ fl_cursor(FL_CURSOR_DEFAULT);
+ fileName->take_focus();
+#ifdef WIN32
+ showHiddenButton->hide();
+#endif
+}
+void Fl_File_Chooser::showHidden(int value)
+{
+ if (value) {
+ fileList->load(directory());
+ } else {
+ remove_hidden_files();
+ fileList->redraw();
+ }
+}
+
+void Fl_File_Chooser::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.
//
@@ -1650,5 +1692,5 @@ unquote_pathname(char *dst, // O - Destination string
//
-// End of "$Id: Fl_File_Chooser2.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_File_Chooser2.cxx 8785 2011-06-06 16:11:22Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
index 7de58c8b7..98069dda9 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Icon.cxx
@@ -1,11 +1,11 @@
//
-// "$Id: Fl_File_Icon.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_File_Icon.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Fl_File_Icon routines.
//
// KDE icon code donated by Maarten De Boer.
//
-// Copyright 1999-2009 by Michael Sweet.
+// 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
@@ -488,5 +488,5 @@ Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
//
-// End of "$Id: Fl_File_Icon.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_File_Icon.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
index dfed97bdd..1bce8f41f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_File_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_File_Input.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $"
+// "$Id: Fl_File_Input.cxx 8063 2010-12-19 21:20:10Z matt $"
//
// File_Input header file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -30,6 +30,7 @@
#include
#include
#include
+#include
#include
#include "flstring.h"
@@ -240,7 +241,7 @@ Fl_File_Input::handle_button(int event) // I - Event
X; // Current X position
char *start, // Start of path component
*end; // End of path component
- char newvalue[1024]; // New value
+ char newvalue[FL_PATH_MAX]; // New value
// Figure out which button is being pressed...
@@ -293,5 +294,5 @@ Fl_File_Input::handle_button(int event) // I - Event
//
-// End of "$Id: Fl_File_Input.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $".
+// End of "$Id: Fl_File_Input.cxx 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Font.H b/plugins/zynaddsubfx/fltk/src/Fl_Font.H
index 4e79b3f93..f534e6f83 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Font.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Font.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Font.H 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $"
//
// Font definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -51,6 +51,7 @@ class Fl_Font_Descriptor {
public:
/** linked list for this Fl_Fontdesc */
Fl_Font_Descriptor *next;
+ Fl_Fontsize size; /**< font size */
#ifndef FL_DOXYGEN // don't bother with platorm dependant details in the doc.
# ifdef WIN32
HFONT fid;
@@ -63,36 +64,34 @@ public:
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;
-// short width[256];
-// bool knowWidths;
char *q_name;
- int size;
# elif USE_XFT
XftFont* font;
- const char* encoding;
- Fl_Fontsize size;
+ //const char* encoding;
int angle;
- FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
+ FL_EXPORT Fl_Font_Descriptor(const char* xfontname, Fl_Fontsize size, int angle);
# else
XUtf8FontStruct* font; // X UTF-8 font information
FL_EXPORT Fl_Font_Descriptor(const char* xfontname);
# endif
- Fl_Fontsize minsize; // smallest point size that should use this
- Fl_Fontsize maxsize; // largest point size that should use this
# if HAVE_GL
unsigned int listbase;// base of display list, 0 = none
+#ifndef __APPLE_QUARTZ__
char glok[64];
-# endif
+#endif // __APPLE_QUARTZ__
+# endif // HAVE_GL
FL_EXPORT ~Fl_Font_Descriptor();
#endif // FL_DOXYGEN
};
-extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
+//extern FL_EXPORT Fl_Font_Descriptor *fl_fontsize; // the currently selected one
struct Fl_Fontdesc {
const char *name;
@@ -115,5 +114,5 @@ FL_EXPORT char *fl_find_fontsize(char *name);
#endif
//
-// End of "$Id: Fl_Font.H 7351 2010-03-29 10:35:00Z matt $".
+// End of "$Id: Fl_Font.H 8428 2011-02-15 15:47:22Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_GDI_Printer.cxx b/plugins/zynaddsubfx/fltk/src/Fl_GDI_Printer.cxx
index 79c158732..49d25a785 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_GDI_Printer.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_GDI_Printer.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_GDI_Printer.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_GDI_Printer.cxx 8467 2011-02-23 14:36:18Z manolo $"
//
// Support for WIN32 printing for the Fast Light Tool Kit (FLTK).
//
@@ -34,13 +34,12 @@
extern HWND fl_window;
-Fl_Printer::Fl_System_Printer(void) : Fl_Paged_Device() {
+Fl_System_Printer::Fl_System_Printer(void) : Fl_Paged_Device() {
hPr = NULL;
- type_ = device_type;
- driver(fl_graphics_driver);
+ driver(Fl_Display_Device::display_device()->driver());
}
-Fl_Printer::~Fl_System_Printer(void) {
+Fl_System_Printer::~Fl_System_Printer(void) {
if (hPr) end_job();
}
@@ -61,7 +60,7 @@ static void WIN_SetupPrinterDeviceContext(HDC prHDC)
}
-int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
+int Fl_System_Printer::start_job (int pagecount, int *frompage, int *topage)
// returns 0 iff OK
{
DWORD commdlgerr;
@@ -116,7 +115,7 @@ int Fl_Printer::start_job (int pagecount, int *frompage, int *topage)
return err;
}
-void Fl_Printer::end_job (void)
+void Fl_System_Printer::end_job (void)
{
Fl_Display_Device::display_device()->set_current();
if (hPr != NULL) {
@@ -137,7 +136,7 @@ void Fl_Printer::end_job (void)
hPr = NULL;
}
-void Fl_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
+void Fl_System_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
{
POINT physPageSize;
POINT pixelsPerInch;
@@ -163,7 +162,7 @@ void Fl_Printer::absolute_printable_rect(int *x, int *y, int *w, int *h)
origin(x_offset, y_offset);
}
-void Fl_Printer::margins(int *left, int *top, int *right, int *bottom)
+void Fl_System_Printer::margins(int *left, int *top, int *right, int *bottom)
{
int x, y, w, h;
absolute_printable_rect(&x, &y, &w, &h);
@@ -173,14 +172,14 @@ void Fl_Printer::margins(int *left, int *top, int *right, int *bottom)
if (bottom) *bottom = y;
}
-int Fl_Printer::printable_rect(int *w, int *h)
+int Fl_System_Printer::printable_rect(int *w, int *h)
{
int x, y;
absolute_printable_rect(&x, &y, w, h);
return 0;
}
-int Fl_Printer::start_page (void)
+int Fl_System_Printer::start_page (void)
{
int rsult, w, h;
@@ -194,29 +193,29 @@ int Fl_Printer::start_page (void)
}
printable_rect(&w, &h);
origin(0, 0);
- image_list_ = NULL;
fl_clip_region(0);
gc = (void *)fl_gc;
}
return rsult;
}
-void Fl_Printer::origin (int deltax, int deltay)
+void Fl_System_Printer::origin (int deltax, int deltay)
{
SetWindowOrgEx(fl_gc, - left_margin - deltax, - top_margin - deltay, NULL);
x_offset = deltax;
y_offset = deltay;
}
-void Fl_Printer::scale (float scalex, float scaley)
+void Fl_System_Printer::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 Fl_Printer::rotate (float rot_angle)
+void Fl_System_Printer::rotate (float rot_angle)
{
XFORM mat;
float angle;
@@ -229,7 +228,7 @@ void Fl_Printer::rotate (float rot_angle)
SetWorldTransform(fl_gc, &mat);
}
-int Fl_Printer::end_page (void)
+int Fl_System_Printer::end_page (void)
{
int rsult;
@@ -261,7 +260,7 @@ static void do_translate(int x, int y)
ModifyWorldTransform(fl_gc, &tr, MWT_LEFTMULTIPLY);
}
-void Fl_Printer::translate (int x, int y)
+void Fl_System_Printer::translate (int x, int y)
{
do_translate(x, y);
if (translate_stack_depth < translate_stack_max) {
@@ -271,7 +270,7 @@ void Fl_Printer::translate (int x, int y)
}
}
-void Fl_Printer::untranslate (void)
+void Fl_System_Printer::untranslate (void)
{
if (translate_stack_depth > 0) {
translate_stack_depth--;
@@ -282,5 +281,5 @@ void Fl_Printer::untranslate (void)
#endif // WIN32
//
-// End of "$Id: Fl_GDI_Printer.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_GDI_Printer.cxx 8467 2011-02-23 14:36:18Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H b/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
index 3c5bef1a0..2b9aedb0e 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Gl_Choice.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Gl_Choice.H 7564 2010-04-28 07:21:41Z greg.ercolano $"
+// "$Id: Fl_Gl_Choice.H 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// OpenGL definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -120,5 +120,5 @@ void fl_delete_gl_context(GLContext);
#endif
//
-// End of "$Id: Fl_Gl_Choice.H 7564 2010-04-28 07:21:41Z greg.ercolano $".
+// End of "$Id: Fl_Gl_Choice.H 7913 2010-11-29 18:18:27Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
index d77a75cfe..de7d4887b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Group.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Group.cxx 7469 2010-04-07 23:17:33Z matt $"
+// "$Id: Fl_Group.cxx 8184 2011-01-04 18:28:01Z matt $"
//
// Group widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -89,7 +89,8 @@ void Fl_Group::end() {current_ = parent();}
Fl_Group *Fl_Group::current() {return current_;}
/**
- See static Fl_Group *Fl_Group::current()
+ Sets the current group.
+ \see Fl_Group::current()
*/
void Fl_Group::current(Fl_Group *g) {current_ = g;}
@@ -133,7 +134,6 @@ static int navkey() {
break;
case FL_Tab:
if (!Fl::event_state(FL_SHIFT)) return FL_Right;
- case 0xfe20: // XK_ISO_Left_Tab
return FL_Left;
case FL_Right:
return FL_Right;
@@ -387,20 +387,51 @@ void Fl_Group::clear() {
savedfocus_ = 0;
resizable_ = this;
init_sizes();
+
+ // we must change the Fl::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.
+
+ Fl_Widget *pushed = Fl::pushed(); // save pushed() widget
+ if (contains(pushed)) pushed = this; // set it to be the group, if it's a child
+ Fl::pushed(this); // for fl_fix_focus etc.
+
// okay, now it is safe to destroy the children:
- while (children_) {
- Fl_Widget* o = child(0); // *first* child widget
- if (o->parent() == this) { // should always be true
- remove(o); // remove child widget first
- delete o; // then delete it
- } else { // this should never happen !
-#ifdef DEBUG_CLEAR
- printf ("Fl_Group::clear() widget:%p, parent: %p != this (%p)\n",
- o, o->parent(), this); fflush(stdout);
-#endif // DEBUG_CLEAR
- remove(o); // remove it
+
+#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) {
+ Fl_Widget *temp;
+ Fl_Widget **a = (Fl_Widget**)array();
+ for (int i=0,j=children_-1; iparent()==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) Fl::pushed(pushed); // reset pushed() widget
+
}
/**
@@ -435,7 +466,7 @@ void Fl_Group::insert(Fl_Widget &o, int index) {
if (index > n) index--;
if (index == n) return;
}
- g->remove(o);
+ g->remove(n);
}
o.parent_ = this;
if (children_ == 0) { // use array pointer to point at single child
@@ -462,6 +493,37 @@ void Fl_Group::insert(Fl_Widget &o, int index) {
*/
void Fl_Group::add(Fl_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 Fl_Group::remove(int index) {
+ if (index < 0 || index >= children_) return;
+ Fl_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
+ Fl_Widget *t = array_[!index];
+ free((void*)array_);
+ array_ = (Fl_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.
@@ -469,33 +531,16 @@ void Fl_Group::add(Fl_Widget &o) {insert(o, children_);}
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 Fl_Group::remove(Fl_Widget &o) {
if (!children_) return;
int i = find(o);
- if (i >= children_) return;
- if (&o == savedfocus_) savedfocus_ = 0;
- if (o.parent_ == this) { // this should always be true
- o.parent_ = 0;
- }
-#ifdef DEBUG_REMOVE
- else { // this should never happen !
- printf ("Fl_Group::remove(): widget %p, parent_ (%p) != this (%p)\n",
- &o, o.parent_, this);
- }
-#endif // DEBUG_REMOVE
-
- // remove the widget from the group
-
- children_--;
- if (children_ == 1) { // go from 2 to 1 child
- Fl_Widget *t = array_[!i];
- free((void*)array_);
- array_ = (Fl_Widget**)t;
- } else if (children_ > 1) { // delete from array
- for (; i < children_; i++) array_[i] = array_[i+1];
- }
- init_sizes();
+ if (i < children_) remove(i);
}
////////////////////////////////////////////////////////////////
@@ -600,7 +645,7 @@ void Fl_Group::resize(int X, int Y, int W, int H) {
Fl_Widget::resize(X,Y,W,H); // make new xywh values visible for children
- if (!resizable() || dw==0 && dh==0 ) {
+ if (!resizable() || (dw==0 && dh==0) ) {
if (type() < FL_WINDOW) {
Fl_Widget*const* a = array();
@@ -740,47 +785,53 @@ void Fl_Group::draw_outside_label(const Fl_Widget& widget) const {
// skip any labels that are inside the widget:
if (!(widget.align()&15) || (widget.align() & FL_ALIGN_INSIDE)) return;
// invent a box that is outside the widget:
- int a = widget.align();
+ Fl_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(this)->as_window()) {
+ wx = wy = 0;
+ } else {
+ wx = x(); wy = y();
+ }
if ( (a & 0x0f) == FL_ALIGN_LEFT_TOP ) {
a = (a &~0x0f ) | FL_ALIGN_TOP_RIGHT;
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if ( (a & 0x0f) == FL_ALIGN_LEFT_BOTTOM ) {
a = (a &~0x0f ) | FL_ALIGN_BOTTOM_RIGHT;
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if ( (a & 0x0f) == FL_ALIGN_RIGHT_TOP ) {
a = (a &~0x0f ) | FL_ALIGN_TOP_LEFT;
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
} else if ( (a & 0x0f) == FL_ALIGN_RIGHT_BOTTOM ) {
a = (a &~0x0f ) | FL_ALIGN_BOTTOM_LEFT;
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
} else if (a & FL_ALIGN_TOP) {
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
- Y = y();
+ Y = wy;
H = widget.y()-Y;
} else if (a & FL_ALIGN_BOTTOM) {
a ^= (FL_ALIGN_BOTTOM|FL_ALIGN_TOP);
Y = Y+H;
- H = y()+h()-Y;
+ H = wy+h()-Y;
} else if (a & FL_ALIGN_LEFT) {
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
- X = x();
+ X = wx;
W = widget.x()-X-3;
} else if (a & FL_ALIGN_RIGHT) {
a ^= (FL_ALIGN_LEFT|FL_ALIGN_RIGHT);
X = X+W+3;
- W = x()+this->w()-X;
+ W = wx+this->w()-X;
}
widget.draw_label(X,Y,W,H,(Fl_Align)a);
}
//
-// End of "$Id: Fl_Group.cxx 7469 2010-04-07 23:17:33Z matt $".
+// End of "$Id: Fl_Group.cxx 8184 2011-01-04 18:28:01Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl b/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
index e1faef039..d61a35317 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Help_Dialog.fl
@@ -3,11 +3,11 @@ version 1.0108
header_name {../FL/Fl_Help_Dialog.H}
code_name {.cxx}
comment {//
-// "$Id: Fl_Help_Dialog.fl 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Help_Dialog.fl 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// Fl_Help_Dialog dialog for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -260,6 +260,6 @@ window_->label(view_->title());} {}
comment {
//
-// End of "$Id: Fl_Help_Dialog.fl 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Help_Dialog.fl 7913 2010-11-29 18:18:27Z greg.ercolano $".
//} {in_source in_header
}
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
index 04d4cae88..1b31a8982 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Help_View.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Help_View.cxx 6776 2009-04-22 09:02:13Z greg.ercolano $"
+// "$Id: Fl_Help_View.cxx 8063 2010-12-19 21:20:10Z matt $"
//
// Fl_Help_View widget routines.
//
-// Copyright 1997-2009 by Easy Software Products.
+// 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
@@ -2606,8 +2606,8 @@ Fl_Help_View::get_color(const char *n, // I - Color name
Fl_Shared_Image *
Fl_Help_View::get_image(const char *name, int W, int H) {
const char *localname; // Local filename
- char dir[1024]; // Current directory
- char temp[1024], // Temporary filename
+ char dir[FL_PATH_MAX]; // Current directory
+ char temp[FL_PATH_MAX], // Temporary filename
*tempptr; // Pointer into temporary name
Fl_Shared_Image *ip; // Image pointer...
@@ -2703,8 +2703,8 @@ void Fl_Help_View::follow_link(Fl_Help_Link *linkp)
if (strcmp(linkp->filename, filename_) != 0 && linkp->filename[0])
{
- char dir[1024]; // Current directory
- char temp[1024], // Temporary filename
+ char dir[FL_PATH_MAX]; // Current directory
+ char temp[FL_PATH_MAX], // Temporary filename
*tempptr; // Pointer into temporary filename
@@ -3115,7 +3115,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
char *slash; // Directory separator
const char *localname; // Local filename
char error[1024]; // Error buffer
- char newname[1024]; // New filename buffer
+ char newname[FL_PATH_MAX]; // New filename buffer
// printf("load(%s)\n",f); fflush(stdout);
@@ -3125,7 +3125,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
strncmp(f, "ipp:", 4) == 0 ||
strncmp(f, "mailto:", 7) == 0 ||
strncmp(f, "news:", 5) == 0) {
- char urimsg[256];
+ char urimsg[FL_PATH_MAX];
if ( fl_open_uri(f, urimsg, sizeof(urimsg)) == 0 ) {
clear_selection();
@@ -3201,7 +3201,7 @@ Fl_Help_View::load(const char *f)// I - Filename to load (may also have target)
rewind(fp);
value_ = (const char *)calloc(len + 1, 1);
- fread((void *)value_, 1, len, fp);
+ if (fread((void *)value_, 1, len, fp)==0) { /* use default 0 */ }
fclose(fp);
}
else
@@ -3515,5 +3515,5 @@ hscrollbar_callback(Fl_Widget *s, void *)
//
-// End of "$Id: Fl_Help_View.cxx 6776 2009-04-22 09:02:13Z greg.ercolano $".
+// End of "$Id: Fl_Help_View.cxx 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
index c7cebebb0..4117ba77b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Image.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_Image.cxx 8611 2011-04-20 14:01:04Z AlbrechtS $"
//
// Image drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -379,8 +379,10 @@ void Fl_RGB_Image::desaturate() {
// Composite an image with alpha on systems that don't have accelerated
// alpha compositing...
static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) {
- uchar *srcptr = (uchar*)img->array + img->d() * (img->w() * cy + cx);
- int srcskip = img->d() * (img->w() - W);
+ 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;
@@ -392,7 +394,6 @@ static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, i
if (img->d() == 2) {
// Composite grayscale + alpha over RGB...
- // Composite RGBA over RGB...
for (int y = H; y > 0; y--, srcptr+=srcskip)
for (int x = W; x > 0; x--) {
srcg = *srcptr++;
@@ -586,5 +587,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
//
-// End of "$Id: Fl_Image.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_Image.cxx 8611 2011-04-20 14:01:04Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
index aeb096923..d38d5cfef 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input.cxx 6968 2009-12-13 14:44:30Z matt $"
+// "$Id: Fl_Input.cxx 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Input widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,6 +40,15 @@
#include
#include "flstring.h"
+#if defined(FL_DLL) // really needed for c'tors for MS VC++ only
+#include
+#include
+#include
+#include
+#include
+#include
+#endif
+
#ifdef HAVE_LOCALE_H
# include
#endif
@@ -62,11 +71,19 @@ int Fl_Input::shift_up_down_position(int p) {
return up_down_position(p, Fl::event_state(FL_SHIFT));
}
-// If you define this symbol as zero you will get the peculiar fltk
+// 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:
-#define NORMAL_INPUT_MOVE 0
+//
+// Note: this has been replaced by Fl::option(Fl::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 (Fl::option(Fl::OPTION_ARROW_FOCUS) ? 0 : 1)
#define ctrl(x) ((x)^0x40)
@@ -82,12 +99,223 @@ static const char *legal_fp_chars = 0L;
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 Fl_Input::kf_lines_up(int repeat_num) {
+ int i = position();
+ if (!line_start(i)) {
+ //UNNEEDED if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::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 Fl_Input::kf_lines_down(int repeat_num) {
+ int i = position();
+ if (line_end(i) >= size()) {
+ //UNNEEDED if (input_type()==FL_MULTILINE_INPUT && !Fl::option(Fl::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 Fl_Input::kf_page_up() {
+ return kf_lines_up(linesPerPage());
+}
+
+// Move down a page
+int Fl_Input::kf_page_down() {
+ return kf_lines_down(linesPerPage());
+}
+
+// Toggle insert mode
+int Fl_Input::kf_insert_toggle() {
+ if (readonly()) { fl_beep(); return 1; }
+ return 1; // \todo: needs insert mode
+}
+
+// Delete word right
+int Fl_Input::kf_delete_word_right() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) return cut();
+ cut(position(), word_end(position()));
+ return 1;
+}
+
+// Delete word left
+int Fl_Input::kf_delete_word_left() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) return cut();
+ cut(word_start(position()), position());
+ return 1;
+}
+
+// Delete to start of line
+int Fl_Input::kf_delete_sol() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) return cut();
+ cut(line_start(position()), position());
+ return 1;
+}
+
+// Delete to end of line
+int Fl_Input::kf_delete_eol() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) return cut();
+ cut(position(), line_end(position()));
+ return 1;
+}
+
+int Fl_Input::kf_delete_char_right() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) return cut();
+ else return cut(1);
+}
+
+int Fl_Input::kf_delete_char_left() {
+ if (readonly()) { fl_beep(); return 1; }
+ if (mark() != position()) cut();
+ else cut(-1);
+ return 1;
+}
+
+// Move cursor to start of line
+int Fl_Input::kf_move_sol() {
+ return shift_position(line_start(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Move cursor to end of line
+int Fl_Input::kf_move_eol() {
+ return shift_position(line_end(position())) + NORMAL_INPUT_MOVE;
+}
+
+// Clear to end of line
+int Fl_Input::kf_clear_eol() {
+ if (readonly()) { fl_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 Fl_Input::kf_move_char_left() {
+ int i = shift_position(position()-1) + NORMAL_INPUT_MOVE;
+ return Fl::option(Fl::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 Fl_Input::kf_move_char_right() {
+ int i = shift_position(position()+1) + NORMAL_INPUT_MOVE;
+ return Fl::option(Fl::OPTION_ARROW_FOCUS) ? i : 1;
+}
+
+// Move cursor word-left
+int Fl_Input::kf_move_word_left() {
+ shift_position(word_start(position()));
+ return 1;
+}
+
+// Move cursor word-right
+int Fl_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 Fl_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 Fl_Input::kf_move_down_and_eol() {
+ if (line_end(position())==position() && position()= '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()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii))
+ || (ip>1 && index(0)=='0' && (index(1)=='x'||index(1)=='X')
+ && ((ascii>='A'&& ascii<='F') || (ascii>='a'&& ascii<='f')))
+ || (input_type()==FL_FLOAT_INPUT && ascii && strchr(legal_fp_chars, ascii)))
{
if (readonly()) fl_beep();
else replace(position(), mark(), &ascii, 1);
@@ -145,339 +373,223 @@ int Fl_Input::handle_key() {
}
unsigned int mods = Fl::event_state() & (FL_META|FL_CTRL|FL_ALT);
+ unsigned int shift = Fl::event_state() & FL_SHIFT;
+ unsigned int multiline = (input_type() == FL_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 (Fl::event_key()) {
+
case FL_Insert:
- if (Fl::event_state() & FL_CTRL) ascii = ctrl('C');
- else if (Fl::event_state() & FL_SHIFT) ascii = ctrl('V');
- break;
- case FL_Delete:
+ // 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==FL_CTRL) return kf_copy(); // Ctrl-Insert (WP,NP,WOW,GE,KE,OF)
+ return 0; // ignore other combos, pass to parent
+
+ case FL_Delete: {
#ifdef __APPLE__
- if (mods==0 || mods==FL_CTRL) { // delete next char
- ascii = ctrl('D');
- } else if (mods==FL_ALT) { // delete next word
- if (mark() != position()) return cut();
- cut(position(), word_end(position()));
- return 1;
- } else if (mods==FL_META) { // delete to the end of the line
- if (mark() != position()) return cut();
- cut(position(), line_end(position()));
- return 1;
- } else return 1;
+ if (mods==0) return kf_delete_char_right(); // Delete (OSX-HIG,TE,SA,WOX)
+ if (mods==FL_CTRL) return kf_delete_char_right(); // Ctrl-Delete (??? TE,!SA,!WOX)
+ if (mods==FL_ALT) return kf_delete_word_right(); // Alt-Delete (OSX-HIG,TE,SA)
+ return 0; // ignore other combos, pass to parent
#else
- if (mods==0) {
- ascii = ctrl('D');
- } else if (mods==FL_SHIFT) {
- ascii = ctrl('X');
- } else return 1;
+ 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==FL_CTRL) return kf_delete_word_right(); // Ctrl-Delete (WP,!NP,WOW,GE,KE,!OF)
+ return 0; // ignore other combos, pass to parent
#endif
- break;
+ }
+
case FL_Left:
#ifdef __APPLE__
- if (mods==0) { // char left
- ascii = ctrl('B');
- } else if (mods==FL_ALT) { // word left
- shift_position(word_start(position()));
- return 1;
- } else if (mods==FL_CTRL || mods==FL_META) { // start of line
- shift_position(line_start(position()));
- return 1;
- } else return 1;
+ if (mods==0) return kf_move_char_left(); // Left (OSX-HIG)
+ if (mods==FL_ALT) return kf_move_word_left(); // Alt-Left (OSX-HIG)
+ if (mods==FL_META) return kf_move_sol(); // Meta-Left (OSX-HIG)
+ if (mods==FL_CTRL) return kf_move_sol(); // Ctrl-Left (TE/SA)
+ return 0; // ignore other combos, pass to parent
#else
- if (mods==0) { // char left
- ascii = ctrl('B');
- } else if (mods==FL_CTRL) { // word left
- shift_position(word_start(position()));
- return 1;
- } else return 1;
+ if (mods==0) return kf_move_char_left(); // Left (WP,NP,WOW,GE,KE,OF)
+ if (mods==FL_CTRL) return kf_move_word_left(); // Ctrl-Left (WP,NP,WOW,GE,KE,!OF)
+ if (mods==FL_META) return kf_move_char_left(); // Meta-Left (WP,NP,?WOW,GE,KE)
+ return 0; // ignore other combos, pass to parent
#endif
- break;
+
case FL_Right:
#ifdef __APPLE__
- if (mods==0) { // char right
- ascii = ctrl('F');
- } else if (mods==FL_ALT) { // word right
- shift_position(word_end(position()));
- return 1;
- } else if (mods==FL_CTRL || mods==FL_META) { // end of line
- shift_position(line_end(position()));
- return 1;
- } else return 1;
+ if (mods==0) return kf_move_char_right(); // Right (OSX-HIG)
+ if (mods==FL_ALT) return kf_move_word_right(); // Alt-Right (OSX-HIG)
+ if (mods==FL_META) return kf_move_eol(); // Meta-Right (OSX-HIG)
+ if (mods==FL_CTRL) return kf_move_eol(); // Ctrl-Right (TE/SA)
+ return 0; // ignore other combos, pass to parent
#else
- if (mods==0) { // char right
- ascii = ctrl('F');
- } else if (mods==FL_CTRL) { // word right
- shift_position(word_end(position()));
- return 1;
- } else return 1;
-#endif // __APPLE__
- break;
- case FL_Page_Up:
-#ifdef __APPLE__
- if (mods==0) { // scroll text one page
- // OS X scrolls the view, but does not move the cursor
- // Fl_Input has no scroll control, so instead we move the cursor by one page
- repeat_num = linesPerPage();
- ascii = ctrl('P');
- } else if (mods==FL_ALT) { // move cursor one page
- repeat_num = linesPerPage();
- ascii = ctrl('P');
- } else return 1;
- break;
-#else
- repeat_num = linesPerPage();
- // fall through
+ if (mods==0) return kf_move_char_right(); // Right (WP,NP,WOW,GE,KE,OF)
+ if (mods==FL_CTRL) return kf_move_word_right(); // Ctrl-Right (WP,NP,WOW,GE,KE,!OF)
+ if (mods==FL_META) return kf_move_char_right(); // Meta-Right (WP,NP,?WOW,GE,KE,!OF)
+ return 0; // ignore other combos, pass to parent
#endif
+
case FL_Up:
#ifdef __APPLE__
- if (mods==0) { // line up
- ascii = ctrl('P');
- } else if (mods==FL_CTRL) { // scroll text down one page
- // OS X scrolls the view, but does not move the cursor
- // Fl_Input has no scroll control, so instead we move the cursor by one page
- repeat_num = linesPerPage();
- ascii = ctrl('P');
- } else if (mods==FL_ALT) { // line start and up
- 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;
- } else if (mods==FL_META) { // start of document
- shift_position(0);
- return 1;
- } else return 1;
+ if (mods==0) return kf_lines_up(1); // Up (OSX-HIG)
+ if (mods==FL_CTRL) return kf_page_up(); // Ctrl-Up (TE !HIG)
+ if (mods==FL_ALT) return kf_move_up_and_sol(); // Alt-Up (OSX-HIG)
+ if (mods==FL_META) return kf_top(); // Meta-Up (OSX-HIG)
+ return 0; // ignore other combos, pass to parent
#else
- if (mods==0) { // line up
- ascii = ctrl('P');
- } else if (mods==FL_CTRL) { // scroll text down one line
- // Fl_Input has no scroll control, so instead we move the cursor by one page
- ascii = ctrl('P');
- } else return 1;
-#endif
- break;
- case FL_Page_Down:
-#ifdef __APPLE__
- if (mods==0) { // scroll text one page
- // OS X scrolls the view, but does not move the cursor
- // Fl_Input has no scroll control, so instead we move the cursor by one page
- repeat_num = linesPerPage();
- ascii = ctrl('N');
- } else if (mods==FL_ALT) { // move cursor one page
- repeat_num = linesPerPage();
- ascii = ctrl('N');
- } else return 1;
- break;
-#else
- repeat_num = linesPerPage();
- // fall through
+ if (mods==0) return kf_lines_up(1); // Up (WP,NP,WOW,GE,KE,OF)
+ if (mods==FL_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 FL_Down:
#ifdef __APPLE__
- if (mods==0) { // line down
- ascii = ctrl('N');
- } else if (mods==FL_CTRL) {
- // OS X scrolls the view, but does not move the cursor
- // Fl_Input has no scroll control, so instead we move the cursor by one page
- repeat_num = linesPerPage();
- ascii = ctrl('N');
- } else if (mods==FL_ALT) { // line end and down
- if (line_end(position())==position() && position()=size()) return 0;
- i = line_end(position());
- if (i == position() && i < size()) i++;
- cut(position(), i);
- return copy_cuts();
- case ctrl('N'): // go down one line
- i = position();
- if (line_end(i) >= size()) return NORMAL_INPUT_MOVE;
- while (repeat_num--) {
- i = line_end(i);
- if (i >= size()) break;
- i++;
- }
- shift_up_down_position(i);
- return 1;
- case ctrl('P'): // go up one line
- i = position();
- if (!line_start(i)) return NORMAL_INPUT_MOVE;
- while(repeat_num--) {
- i = line_start(i);
- if (!i) break;
- i--;
- }
- shift_up_down_position(line_start(i));
- return 1;
- case ctrl('U'): // clear the whole document?
- if (readonly()) {
- fl_beep();
- return 1;
- }
- return cut(0, size());
- case ctrl('V'): // paste text
- case ctrl('Y'):
- if (readonly()) {
- fl_beep();
- return 1;
- }
- Fl::paste(*this, 1);
- return 1;
- case ctrl('X'): // cut the selected text
- case ctrl('W'):
- if (readonly()) {
- fl_beep();
- return 1;
- }
- copy(1);
- return cut();
- case ctrl('Z'): // undo
- case ctrl('_'):
- if (readonly()) {
- fl_beep();
- return 1;
- }
- return undo();
- case ctrl('I'): // insert literal
- case ctrl('J'):
- case ctrl('L'):
- case ctrl('M'):
- if (readonly()) {
- fl_beep();
- return 1;
- }
+ 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()) { fl_beep(); return 1; }
// insert a few selected control characters literally:
if (input_type() != FL_FLOAT_INPUT && input_type() != FL_INT_INPUT)
return replace(position(), mark(), &ascii, 1);
+ break;
}
- return 0;
+ return 0; // ignored
}
int Fl_Input::handle(int event) {
@@ -499,7 +611,6 @@ int Fl_Input::handle(int event) {
up_down_position(line_start(size()));
break;
case FL_Tab:
- case 0xfe20: // XK_ISO_Left_Tab
position(size(),0);
break;
default:
@@ -509,8 +620,16 @@ int Fl_Input::handle(int event) {
break;
case FL_KEYBOARD:
- if (Fl::event_key() == FL_Tab && mark() != position()) {
- // Set the current cursor position to the end of the selection...
+ // 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 (Fl::event_key() == FL_Tab // Tab key?
+ && !Fl::event_state(FL_SHIFT) // no shift?
+ && !tab_nav() // with tab navigation disabled?
+ && input_type() == FL_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
@@ -521,23 +640,23 @@ int Fl_Input::handle(int event) {
window()->cursor(FL_CURSOR_NONE);
return handle_key();
}
+ //NOTREACHED
case FL_PUSH:
if (Fl::dnd_text_ops()) {
int oldpos = position(), oldmark = mark();
Fl_Boxtype b = box();
- Fl_Input_::handle_mouse(
- x()+Fl::box_dx(b), y()+Fl::box_dy(b),
+ Fl_Input_::handle_mouse(x()+Fl::box_dx(b), y()+Fl::box_dy(b),
w()-Fl::box_dw(b), h()-Fl::box_dh(b), 0);
newpos = position();
position( oldpos, oldmark );
if (Fl::focus()==this && !Fl::event_state(FL_SHIFT) && input_type()!=FL_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;
- }
+ ( (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;
}
@@ -602,12 +721,11 @@ int Fl_Input::handle(int event) {
return 0;
}
#endif
- {
- Fl_Boxtype b = box();
- Fl_Input_::handle_mouse(
- x()+Fl::box_dx(b), y()+Fl::box_dy(b),
- w()-Fl::box_dw(b), h()-Fl::box_dh(b), 0);
- }
+ {
+ Fl_Boxtype b = box();
+ Fl_Input_::handle_mouse(x()+Fl::box_dx(b), y()+Fl::box_dy(b),
+ w()-Fl::box_dw(b), h()-Fl::box_dh(b), 0);
+ }
return 1;
case FL_DND_LEAVE:
@@ -619,6 +737,9 @@ int Fl_Input::handle(int event) {
Fl::focus(dnd_save_focus);
handle(FL_UNFOCUS);
}
+#if !(defined(__APPLE__) || defined(WIN32))
+ Fl::first_window()->cursor(FL_CURSOR_MOVE);
+#endif
return 1;
case FL_DND_RELEASE:
@@ -636,7 +757,6 @@ int Fl_Input::handle(int event) {
}
return 1;
*/
-
}
Fl_Boxtype b = box();
return Fl_Input_::handletext(event,
@@ -652,6 +772,51 @@ Fl_Input::Fl_Input(int X, int Y, int W, int H, const char *l)
: Fl_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)
+
+Fl_Float_Input::Fl_Float_Input(int X,int Y,int W,int H,const char *l)
+ : Fl_Input(X,Y,W,H,l) {
+ type(FL_FLOAT_INPUT);
+}
+
+Fl_Int_Input::Fl_Int_Input(int X,int Y,int W,int H,const char *l)
+ : Fl_Input(X,Y,W,H,l) {
+ type(FL_INT_INPUT);
+}
+
+Fl_Multiline_Input::Fl_Multiline_Input(int X,int Y,int W,int H,const char *l)
+ : Fl_Input(X,Y,W,H,l) {
+ type(FL_MULTILINE_INPUT);
+}
+
+Fl_Output::Fl_Output(int X,int Y,int W,int H, const char *l)
+ : Fl_Input(X, Y, W, H, l) {
+ type(FL_NORMAL_OUTPUT);
+}
+
+Fl_Multiline_Output::Fl_Multiline_Output(int X,int Y,int W,int H,const char *l)
+ : Fl_Output(X,Y,W,H,l) {
+ type(FL_MULTILINE_OUTPUT);
+}
+
+Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l)
+ : Fl_Input(X,Y,W,H,l) {
+ type(FL_SECRET_INPUT);
+}
+
+#endif // FL_DLL
+
//
-// End of "$Id: Fl_Input.cxx 6968 2009-12-13 14:44:30Z matt $".
+// End of "$Id: Fl_Input.cxx 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
index 6a94ad19a..276c38754 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Input_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Input_.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Input_.cxx 8413 2011-02-11 16:37:06Z manolo $"
//
// Common input widget routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,6 +37,12 @@
#include
#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;
extern void fl_draw(const char*, int, float, float);
@@ -67,7 +73,10 @@ const char* Fl_Input_::expand(const char* p, char* buf) const {
if (input_type()==FL_SECRET_INPUT) {
while (o= 1) *o++ = '*';
+ if (fl_utf8len((char)p[0]) >= 1) {
+ l_secret = fl_utf8encode(secret_char, o);
+ o += l_secret;
+ }
p++;
}
@@ -124,10 +133,12 @@ double Fl_Input_::expandpos(
) const {
int n = 0;
int chr = 0;
+ int l;
if (input_type()==FL_SECRET_INPUT) {
while (p= 1) n++;
- p++;
+ l = fl_utf8len((char)p[0]);
+ if (l >= 1) n += l_secret;
+ p += l;
}
} else while (p= p-value() && position() <= e-value()) {
fl_color(cursor_color());
+ // cursor position may need to be recomputed (see STR #2486)
+ curx = int(expandpos(p, value()+position(), buf, 0)+.5);
if (readonly()) {
fl_line((int)(xpos+curx-2.5f), Y+ypos+height-1,
(int)(xpos+curx+0.5f), Y+ypos+height-4,
@@ -844,7 +857,7 @@ int Fl_Input_::replace(int b, int e, const char* text, int ilen) {
*/
int Fl_Input_::undo() {
was_up_down = 0;
- if (undowidget != this || !undocut && !undoinsert) return 0;
+ if ( undowidget != this || (!undocut && !undoinsert) ) return 0;
int ilen = undocut;
int xlen = undoinsert;
@@ -1057,6 +1070,7 @@ Fl_Input_::Fl_Input_(int X, int Y, int W, int H, const char* l)
maximum_size_ = 32767;
shortcut_ = 0;
set_flag(SHORTCUT_LABEL);
+ tab_nav(1);
}
/**
@@ -1254,5 +1268,5 @@ unsigned int Fl_Input_::index(int i) const
}
//
-// End of "$Id: Fl_Input_.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Input_.cxx 8413 2011-02-11 16:37:06Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
index 8041f4354..9025fcf2d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Light_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Light_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Light_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Lighted button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -170,5 +170,5 @@ Fl_Light_Button::Fl_Light_Button(int X, int Y, int W, int H, const char* l)
}
//
-// End of "$Id: Fl_Light_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Light_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
index d8a7c1273..81568d0e6 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu.cxx 7151 2010-02-26 13:28:36Z matt $"
+// "$Id: Fl_Menu.cxx 8775 2011-06-03 14:07:52Z manolo $"
//
// Menu code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -38,9 +38,6 @@
#include
#include "flstring.h"
-#ifdef __APPLE__
-# include
-#endif
/** Size of the menu starting from this menu item */
int Fl_Menu_Item::size() const {
const Fl_Menu_Item* m = this;
@@ -56,6 +53,23 @@ int Fl_Menu_Item::size() const {
}
}
+// Advance a pointer to next visible or invisible item of a menu array,
+// skipping the contents of submenus.
+static const Fl_Menu_Item* next_visible_or_not(const Fl_Menu_Item* m) {
+ int nest = 0;
+ do {
+ if (!m->text) {
+ if (!nest) return m;
+ nest--;
+ } else if (m->flags&FL_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
@@ -64,17 +78,10 @@ int Fl_Menu_Item::size() const {
const Fl_Menu_Item* Fl_Menu_Item::next(int n) const {
if (n < 0) return 0; // this is so selected==-1 returns NULL
const Fl_Menu_Item* m = this;
- int nest = 0;
if (!m->visible()) n++;
- while (n>0) {
- if (!m->text) {
- if (!nest) return m;
- nest--;
- } else if (m->flags&FL_SUBMENU) {
- nest++;
- }
- m++;
- if (!nest && m->visible()) n--;
+ while (n) {
+ m = next_visible_or_not(m);
+ if (m->visible()) n--;
}
return m;
}
@@ -99,7 +106,7 @@ class menuwindow : public Fl_Menu_Window {
public:
menutitle* title;
int handle(int);
-#ifdef __APPLE__
+#if defined (__APPLE__) || defined (USE_X11)
int early_hide_handle(int);
#endif
int itemheight; // zero == menubar
@@ -538,6 +545,10 @@ int menuwindow::is_inside(int mx, int my) {
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;
}
@@ -601,7 +612,7 @@ static void setitem(int m, int n) {
static int forward(int menu) { // go to next item in menu menu if possible
menustate &pp = *p;
- // Fl_Menu_Button can geberate menu=-1. This line fixes it and selectes the first item.
+ // Fl_Menu_Button can generate menu=-1. This line fixes it and selectes the first item.
if (menu==-1)
menu = 0;
menuwindow &m = *(pp.p[menu]);
@@ -626,7 +637,7 @@ static int backward(int menu) { // previous item in menu menu if possible
}
int menuwindow::handle(int e) {
-#ifdef __APPLE__
+#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
@@ -660,7 +671,6 @@ int menuwindow::early_hide_handle(int e) {
case FL_KEYBOARD:
switch (Fl::event_key()) {
case FL_BackSpace:
- case 0xFE20: // backtab
BACKTAB:
if (!backward(pp.menu_number)) {pp.item_number = -1;backward(pp.menu_number);}
return 1;
@@ -686,7 +696,7 @@ int menuwindow::early_hide_handle(int e) {
}
return 1;
case FL_Right:
- if (pp.menubar && (pp.menu_number<=0 || pp.menu_number==1 && pp.nummenus==2))
+ 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;
@@ -719,16 +729,17 @@ int menuwindow::early_hide_handle(int e) {
}
}
break;
+ case FL_MOVE:
+#if ! (defined(WIN32) || defined(__APPLE__))
+ if (pp.state == DONE_STATE) {
+ return 1; // Fix for STR #2619
+ }
+ /* FALLTHROUGH */
+#endif
case FL_ENTER:
- case FL_MOVE:
case FL_PUSH:
case FL_DRAG:
{
-#ifdef __QNX__
- // STR 704: workaround QNX X11 bug - in QNX a FL_MOVE event is sent
- // right after FL_RELEASE...
- if (pp.state == DONE_STATE) return 1;
-#endif // __QNX__
int mx = Fl::event_x_root();
int my = Fl::event_y_root();
int item=0; int mymenu = pp.nummenus-1;
@@ -774,8 +785,9 @@ int menuwindow::early_hide_handle(int e) {
case FL_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 (!Fl::event_is_click() || pp.state == PUSH_STATE ||
- pp.menubar && pp.current_item && !pp.current_item->submenu() // button
+ if ( !Fl::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 Fl_Menu_Item* m = pp.current_item;
@@ -812,7 +824,7 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
Fl_Group::current(0); // fix possible user error...
button = pbutton;
- if (pbutton) {
+ if (pbutton && pbutton->window()) {
for (Fl_Window* w = pbutton->window(); w; w = w->window()) {
X += w->x();
Y += w->y();
@@ -948,52 +960,64 @@ const Fl_Menu_Item* Fl_Menu_Item::pulldown(
}
}
const Fl_Menu_Item* m = pp.current_item;
- Fl::grab(0);
delete pp.fakemenu;
while (pp.nummenus>1) delete pp.p[--pp.nummenus];
mw.hide();
+ Fl::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. This does not do the
- callbacks or change the state of check or radio items.
- X,Y is the position of the mouse cursor, relative to the
+ 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. This does not
+ do the callbacks or change the state of check or radio items.
+
+ X,Y is the position of the mouse cursor, relative to the
window that got the most recent event (usually you can pass
- Fl::event_x() and Fl::event_y() unchanged here).
- 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 picked is in a submenu.
- If picked is zero or not in the menu item table the menu is
- positioned with the cursor in the top-left corner.
- button is a pointer to an
- Fl_Menu_ from which the color and boxtypes for the menu are
- pulled. If NULL then defaults are used.
+ Fl::event_x() and Fl::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 Fl_Menu_ from which the color and
+ boxtypes for the menu are pulled. If NULL then defaults are used.
*/
const Fl_Menu_Item* Fl_Menu_Item::popup(
int X, int Y,
const char* title,
const Fl_Menu_Item* picked,
- const Fl_Menu_* but
+ const Fl_Menu_* button
) const {
static Fl_Menu_Item dummy; // static so it is all zeros
dummy.text = title;
- return pulldown(X, Y, 0, 0, picked, but, title ? &dummy : 0);
+ 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.
+ Either &x in the label or the shortcut fields are used.
+
+ This tests the current event, which must be an FL_KEYBOARD or
+ FL_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 Fl_Menu_Item or NULL
*/
-const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
- const Fl_Menu_Item* m = first();
- if (m) for (int ii = 0; m->text; m = m->next(), ii++) {
- if (m->activevisible()) {
+const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip, const bool require_alt) const {
+ const Fl_Menu_Item* m = this;
+ if (m) for (int ii = 0; m->text; m = next_visible_or_not(m), ii++) {
+ if (m->active()) {
if (Fl::test_shortcut(m->shortcut_)
- || Fl_Widget::test_shortcut(m->text)) {
+ || Fl_Widget::test_shortcut(m->text, require_alt)) {
if (ip) *ip=ii;
return m;
}
@@ -1013,10 +1037,10 @@ const Fl_Menu_Item* Fl_Menu_Item::find_shortcut(int* ip) const {
preceeded by '
*/
const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
- const Fl_Menu_Item* m = first();
+ const Fl_Menu_Item* m = this;
const Fl_Menu_Item* ret = 0;
- if (m) for (; m->text; m = m->next()) {
- if (m->activevisible()) {
+ 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 (Fl::test_shortcut(m->shortcut_)) return m;
// if (Fl_Widget::test_shortcut(m->text)) return m;
@@ -1032,5 +1056,5 @@ const Fl_Menu_Item* Fl_Menu_Item::test_shortcut() const {
}
//
-// End of "$Id: Fl_Menu.cxx 7151 2010-02-26 13:28:36Z matt $".
+// End of "$Id: Fl_Menu.cxx 8775 2011-06-03 14:07:52Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
index af855f957..934430d05 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_.cxx 7517 2010-04-16 17:55:45Z greg.ercolano $"
+// "$Id: Fl_Menu_.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Common menu code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -431,5 +431,5 @@ int Fl_Menu_::clear_submenu(int index) {
}
//
-// End of "$Id: Fl_Menu_.cxx 7517 2010-04-16 17:55:45Z greg.ercolano $".
+// End of "$Id: Fl_Menu_.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
index 8328836e3..8e114e39b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Bar.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Menu_Bar.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Menu bar widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -65,7 +65,7 @@ int Fl_Menu_Bar::handle(int event) {
return 1;
case FL_SHORTCUT:
if (visible_r()) {
- v = menu()->find_shortcut();
+ v = menu()->find_shortcut(0, true);
if (v && v->submenu()) goto J1;
}
return test_shortcut() != 0;
@@ -74,5 +74,5 @@ int Fl_Menu_Bar::handle(int event) {
}
//
-// End of "$Id: Fl_Menu_Bar.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Menu_Bar.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
index a808d3194..bfd220779 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Button.cxx 7162 2010-02-26 21:10:46Z matt $"
+// "$Id: Fl_Menu_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Menu button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -118,5 +118,5 @@ Fl_Menu_Button::Fl_Menu_Button(int X,int Y,int W,int H,const char *l)
}
//
-// End of "$Id: Fl_Menu_Button.cxx 7162 2010-02-26 21:10:46Z matt $".
+// End of "$Id: Fl_Menu_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
index 8f230c379..956f88bdc 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Menu_Window.cxx 8198 2011-01-06 10:24:58Z manolo $"
//
// Menu window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -69,7 +69,7 @@ void Fl_Menu_Window::flush() {
fl_window = myi->xid;
if (!gc) {
gc = XCreateGC(fl_display, myi->xid, 0, 0);
-# if defined(USE_CAIRO)
+# if defined(FLTK_USE_CAIRO)
if(Fl::autolink_context()) Fl::cairo_make_current(gc); // capture gc changes automatically to update the cairo context adequately
# endif
}
@@ -106,5 +106,5 @@ Fl_Menu_Window::~Fl_Menu_Window() {
}
//
-// End of "$Id: Fl_Menu_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Menu_Window.cxx 8198 2011-01-06 10:24:58Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
index c36eb2939..2ce280450 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_add.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_add.cxx 7519 2010-04-16 19:50:40Z greg.ercolano $"
+// "$Id: Fl_Menu_add.cxx 8110 2010-12-23 08:02:52Z manolo $"
//
// Menu utilities for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -51,6 +51,8 @@ extern Fl_Menu_* fl_menu_array_owner; // in Fl_Menu_.cxx
// above pointers to detect if the array belongs to an Fl_Menu_
// widget, and if so it reallocates as necessary.
+
+
// Insert a single Fl_Menu_Item into an array of size at offset n,
// if this is local_array it will be reallocated if needed.
static Fl_Menu_Item* array_insert(
@@ -81,6 +83,8 @@ static Fl_Menu_Item* array_insert(
return array;
}
+
+
// Comparison that does not care about deleted '&' signs:
static int compare(const char* a, const char* b) {
for (;;) {
@@ -97,6 +101,8 @@ static int compare(const char* a, const char* b) {
}
}
+
+
/** 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):
@@ -111,15 +117,26 @@ int Fl_Menu_Item::add(
return(insert(-1,mytext,sc,cb,data,myflags)); // -1: append
}
-/** Inserts an item at position \p index.
+
+
+/**
+ Inserts an item at position \p index.
- If \p index is -1, the item is added the same way as Fl_Menu_Item::add().
+ If \p index is -1, the item is added the same way as Fl_Menu_Item::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.
+ 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().
+ 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 FL_Menu_Item
+ \returns the index into the menu() array, where the entry was added
*/
int Fl_Menu_Item::insert(
int index,
@@ -199,6 +216,8 @@ int Fl_Menu_Item::insert(
return m-array;
}
+
+
/**
Adds a new menu item.
@@ -251,6 +270,8 @@ int Fl_Menu_Item::insert(
\par
Raw integer shortcuts can be a combination of keyboard chars (eg. 'A')
and optional keyboard modifiers (see Fl::event_state(), e.g. FL_SHIFT, etc).
+ In addition, FL_COMMAND can be used to denote FL_META under Mac OS X and
+ FL_CTRL under other platforms.
\par
String shortcuts can be specified in one of two ways:
\par
@@ -262,7 +283,7 @@ int Fl_Menu_Item::insert(
..where \ 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 above order.
+ appear in the order below.
\par
\verbatim
# - Alt
@@ -307,6 +328,8 @@ int Fl_Menu_::add(const char *label,int shortcut,Fl_Callback *callback,void *use
return(insert(-1,label,shortcut,callback,userdata,flags)); // -1: append
}
+
+
/**
Inserts a new menu item at the specified \p index position.
@@ -387,6 +410,8 @@ int Fl_Menu_::insert(
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
@@ -399,6 +424,9 @@ int Fl_Menu_::insert(
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 Fl_Menu_::add(const char *str) {
char buf[1024];
@@ -417,10 +445,15 @@ int Fl_Menu_::add(const char *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 Fl_Menu_::replace(int i, const char *str) {
if (i<0 || i>=size()) return;
@@ -431,11 +464,16 @@ void Fl_Menu_::replace(int i, const char *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 Fl_Menu_::remove(int i) {
int n = size();
@@ -454,5 +492,5 @@ void Fl_Menu_::remove(int i) {
}
//
-// End of "$Id: Fl_Menu_add.cxx 7519 2010-04-16 19:50:40Z greg.ercolano $".
+// End of "$Id: Fl_Menu_add.cxx 8110 2010-12-23 08:02:52Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
index 31349a8f7..c5d5a76c7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Menu_global.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Menu_global.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Menu_global.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Global menu shortcut code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -56,5 +56,5 @@ void Fl_Menu_::global() {
}
//
-// End of "$Id: Fl_Menu_global.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Menu_global.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
index d8e5cff8a..df117db30 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Multi_Label.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Multi_Label.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Multi_Label.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Multi-label widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -76,5 +76,5 @@ void Fl_Multi_Label::label(Fl_Menu_Item* o) {
}
//
-// End of "$Id: Fl_Multi_Label.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Multi_Label.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser.cxx
index ffef8b362..1b3024f3c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser.cxx
@@ -1,8 +1,8 @@
-// "$Id: Fl_Native_File_Chooser.cxx 7003 2010-01-14 20:47:59Z greg.ercolano $"
+// "$Id: Fl_Native_File_Chooser.cxx 8378 2011-02-05 22:35:51Z matt $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -32,7 +32,7 @@
// Use Apple's chooser
#ifdef __APPLE__
-#include "Fl_Native_File_Chooser_MAC.cxx"
+#include
#endif
// All else falls back to FLTK's own chooser
@@ -40,6 +40,8 @@
#include "Fl_Native_File_Chooser_FLTK.cxx"
#endif
+const char *Fl_Native_File_Chooser::file_exists_message = "File exists. Are you sure you want to overwrite?";
+
//
-// End of "$Id: Fl_Native_File_Chooser.cxx 7003 2010-01-14 20:47:59Z greg.ercolano $".
+// End of "$Id: Fl_Native_File_Chooser.cxx 8378 2011-02-05 22:35:51Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_FLTK.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_FLTK.cxx
index 7f910a18a..a11c1f94a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_FLTK.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_FLTK.cxx
@@ -1,8 +1,8 @@
-// "$Id: Fl_Native_File_Chooser_FLTK.cxx 7015 2010-01-17 17:09:00Z greg.ercolano $"
+// "$Id: Fl_Native_File_Chooser_FLTK.cxx 8282 2011-01-16 18:26:51Z manolo $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
// API changes + filter improvements by Nathan Vander Wilt 2005
//
@@ -64,16 +64,6 @@ Fl_Native_File_Chooser::Fl_Native_File_Chooser(int val) {
_file_chooser = new Fl_File_Chooser(NULL, NULL, 0, NULL);
type(val); // do this after _file_chooser created
_nfilters = 0;
-
- // Added by MG
- Fl_Button *b = _file_chooser->previewButton;
- Fl_Window *w = b->window();
- Fl_Group::current(w); // adds a "Show hidden files" check button in _file_chooser's window
- show_hidden = new Fl_Check_Button(b->x() + b->w() + 10, b->y(), 145, b->h(), "Show hidden files");
- show_hidden->callback((Fl_Callback*)show_hidden_cb, this);
- my_fileList = _file_chooser->browser();
- _old_dir = 0; // to detect directory changes
- prev_filtervalue = _file_chooser->filter_value(); // to detect filter changes
}
/**
@@ -88,7 +78,6 @@ Fl_Native_File_Chooser::~Fl_Native_File_Chooser() {
_prevvalue = strfree(_prevvalue);
_directory = strfree(_directory);
_errmsg = strfree(_errmsg);
- _old_dir = strfree(_old_dir);
}
// PRIVATE: SET ERROR MESSAGE
@@ -198,14 +187,6 @@ int Fl_Native_File_Chooser::show() {
// BLOCK WHILE BROWSER SHOWN
while ( _file_chooser->shown() ) {
- if (_old_dir==0 || strcmp(_old_dir, _file_chooser->directory()) != 0) {
- _old_dir = strfree(_old_dir);
- _old_dir = strnew(_file_chooser->directory());
- if (!show_hidden->value()) remove_hidden_files(my_fileList);
- } else if (prev_filtervalue != _file_chooser->filter_value() ) {
- prev_filtervalue = _file_chooser->filter_value();
- if (!show_hidden->value() ) remove_hidden_files(my_fileList);
- }
Fl::wait();
}
@@ -471,34 +452,11 @@ const char* Fl_Native_File_Chooser::preset_file() const {
return(_preset_file);
}
-void Fl_Native_File_Chooser::show_hidden_cb(Fl_Check_Button *o, void *data)
-{
- Fl_Native_File_Chooser *mychooser = (Fl_Native_File_Chooser *)data;
- if (o->value()) {
- mychooser->my_fileList->load(mychooser->_file_chooser->directory());
- } else {
- remove_hidden_files(mychooser->my_fileList);
- mychooser->my_fileList->redraw();
- }
-}
-// PRIVATE: Don't show hidden files
-void Fl_Native_File_Chooser::remove_hidden_files(Fl_File_Browser *my_fileList)
-{
- int count = my_fileList->size();
- for(int num = count; num >= 1; num--) {
- const char *p = my_fileList->text(num);
- if (*p == '.' && strcmp(p, "../") != 0) my_fileList->remove(num);
- }
- my_fileList->topline(1);
-}
-
-// PRIVATE: Don't show hidden files
int Fl_Native_File_Chooser::exist_dialog() {
- return(fl_choice("File exists. Are you sure you want to overwrite?",
- "Cancel", " OK ", NULL));
+ return(fl_choice("%s", fl_cancel, fl_ok, NULL, file_exists_message));
}
//
-// End of "$Id: Fl_Native_File_Chooser_FLTK.cxx 7015 2010-01-17 17:09:00Z greg.ercolano $".
+// End of "$Id: Fl_Native_File_Chooser_FLTK.cxx 8282 2011-01-16 18:26:51Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.mm
similarity index 87%
rename from plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.cxx
rename to plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.mm
index 485376e69..c17b4a076 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_MAC.mm
@@ -1,8 +1,8 @@
-// "$Id: Fl_Native_File_Chooser_MAC.cxx 7354 2010-03-29 11:07:29Z matt $"
+// "$Id: Fl_Native_File_Chooser_MAC.mm 8784 2011-06-06 12:11:04Z manolo $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -30,7 +30,7 @@
// Possibly 'preset_file' could be used to select the filename.
//
-#ifndef FL_DOXYGEN // PREVENT DOXYGEN'S USE OF THIS FILE
+#ifdef __APPLE__
#include "Fl_Native_File_Chooser_common.cxx" // strnew/strfree/strapp/chrcat
#include // dirname(3)
@@ -40,6 +40,7 @@
#include
#include
+#include
#include
// FREE PATHNAMES ARRAY, IF IT HAS ANY CONTENTS
@@ -332,10 +333,22 @@ void Fl_Native_File_Chooser::preset_file(const char* val) {
// PRESET FILE
// Returned value can be NULL if none set.
//
-const char* Fl_Native_File_Chooser::preset_file() {
+const char* Fl_Native_File_Chooser::preset_file() const {
return(_preset_file);
}
+void Fl_Native_File_Chooser::filter_value(int val) {
+ _filt_value = val;
+}
+
+int Fl_Native_File_Chooser::filter_value() const {
+ return(_filt_value);
+}
+
+int Fl_Native_File_Chooser::filters() const {
+ return(_filt_total);
+}
+
#import
#define UNLIKELYPREFIX "___fl_very_unlikely_prefix_"
#ifndef MAC_OS_X_VERSION_10_6
@@ -360,18 +373,45 @@ int Fl_Native_File_Chooser::get_saveas_basename(void) {
// SET THE TYPE OF BROWSER
void Fl_Native_File_Chooser::type(int val) {
_btype = val;
- 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;
- }
+}
+
+/* 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
@@ -425,9 +465,9 @@ static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filte
NSPopUpButton *popup;
NSRect rectview = NSMakeRect(5, 5, 350, 30 );
NSView *view = [[[NSView alloc] initWithFrame:rectview] autorelease];
- NSRect rectbox = NSMakeRect(0, 3, 50, 1 );
+ NSRect rectbox = NSMakeRect(0, 3, 140, 20 );
NSBox *box = [[[NSBox alloc] initWithFrame:rectbox] autorelease];
- NSRect rectpop = NSMakeRect(60, 0, 250, 30 );
+ NSRect rectpop = NSMakeRect(105, 0, 246, 30 );
popup = [[[NSPopUpButton alloc ] initWithFrame:rectpop pullsDown:NO] autorelease];
[view addSubview:box];
[view addSubview:popup];
@@ -438,9 +478,14 @@ static NSPopUpButton *createPopupAccessory(NSSavePanel *panel, const char *filte
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, kCFStringEncodingASCII);
+ tmp_cfs = CFStringCreateWithCString(NULL, filter, kCFStringEncodingUTF8);
CFArrayRef array = CFStringCreateArrayBySeparatingStrings(NULL, tmp_cfs, tab);
CFRelease(tmp_cfs);
CFRelease(tab);
@@ -469,6 +514,18 @@ int Fl_Native_File_Chooser::post() {
}
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];
@@ -478,6 +535,7 @@ int Fl_Native_File_Chooser::post() {
break;
case BROWSE_MULTI_DIRECTORY:
[(NSOpenPanel*)_panel setAllowsMultipleSelection:YES];
+ /* FALLTHROUGH */
case BROWSE_DIRECTORY:
[(NSOpenPanel*)_panel setCanChooseDirectories:YES];
break;
@@ -490,23 +548,11 @@ int Fl_Native_File_Chooser::post() {
if ( [(NSSavePanel*)_panel isKindOfClass:[NSOpenPanel class]] ) {
NSPopUpButton *popup = nil;
if (_filt_total) {
- char *p; p = _filter;
- char *q; q = new char[strlen(p) + 1];
- char *r, *s, *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) - 1;
- s = strchr(p, '\t');
- if (s && s < r) { memcpy(q, p, s - p); q += s - p; *(q++) = '\n'; }
- else { memcpy(q, p, r - p + 1); q += r - p + 1; }
- *q = 0;
- p = r + 1;
- } while(*p);
- popup = createPopupAccessory((NSSavePanel*)_panel, t, "Enable:", 0);
- delete t;
+ char *t = prepareMacFilter(_filt_total, _filter, _filt_patt);
+ popup = createPopupAccessory((NSSavePanel*)_panel, t, Fl_File_Chooser::show_label, 0);
+ delete[] t;
[[popup menu] addItem:[NSMenuItem separatorItem]];
- [popup addItemWithTitle:@"All Documents"];
+ [popup addItemWithTitle:[[NSString alloc] initWithUTF8String:Fl_File_Chooser::all_files_label]];
[popup setAction:@selector(validateVisibleColumns)];
[popup setTarget:(NSObject*)_panel];
static FLopenDelegate *openDelegate = nil;
@@ -548,6 +594,7 @@ int Fl_Native_File_Chooser::post() {
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
@@ -562,7 +609,9 @@ int Fl_Native_File_Chooser::post() {
}
if (_directory && !dir) dir = [[NSString alloc] initWithUTF8String:_directory];
if (_filt_total) {
- popup = createPopupAccessory((NSSavePanel*)_panel, _filter, "Format:", _filt_value);
+ 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) {
@@ -576,8 +625,8 @@ int Fl_Native_File_Chooser::post() {
return (retval == NSOKButton ? 0 : 1);
}
-#endif /*!FL_DOXYGEN*/
+#endif // __APPLE__
//
-// End of "$Id: Fl_Native_File_Chooser_MAC.cxx 7354 2010-03-29 11:07:29Z matt $".
+// End of "$Id: Fl_Native_File_Chooser_MAC.mm 8784 2011-06-06 12:11:04Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_WIN32.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_WIN32.cxx
index 542f0c07b..71b5a9252 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_WIN32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_WIN32.cxx
@@ -1,8 +1,8 @@
-// "$Id: Fl_Native_File_Chooser_WIN32.cxx 7312 2010-03-21 22:55:18Z fabien $"
+// "$Id: Fl_Native_File_Chooser_WIN32.cxx 8454 2011-02-20 21:46:11Z manolo $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
// API changes + filter improvements by Nathan Vander Wilt 2005
//
@@ -47,7 +47,10 @@ char *wchartoutf8(LPCWSTR in); //MG
#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++ ) {
@@ -62,6 +65,7 @@ static void dnullprint(char *wp) {
}
}
}
+#endif
// RETURN LENGTH OF DOUBLENULL STRING
// Includes single nulls in count, excludes trailing doublenull.
@@ -464,7 +468,8 @@ int CALLBACK Fl_Native_File_Chooser::Dir_CB(HWND win, UINT msg, LPARAM param, LP
// SHOW DIRECTORY BROWSER
int Fl_Native_File_Chooser::showdir() {
- OleInitialize(NULL); // init needed by BIF_USENEWUI
+ // initialize OLE only once
+ fl_OleInitialize(); // init needed by BIF_USENEWUI
ClearBINF();
clear_pathnames();
// PARENT WINDOW
@@ -630,9 +635,9 @@ void Fl_Native_File_Chooser::add_filter(const char *name_in, // name of filter (
// No name? Make one..
char name[1024];
if ( !name_in || name_in[0] == '\0' ) {
- sprintf(name, "%.*s Files", sizeof(name)-10, winfilter);
+ sprintf(name, "%.*s Files", int(sizeof(name)-10), winfilter);
} else {
- sprintf(name, "%.*s", sizeof(name)-10, name_in);
+ sprintf(name, "%.*s", int(sizeof(name)-10), name_in);
}
dnullcat(_parsedfilt, name);
dnullcat(_parsedfilt, winfilter);
@@ -816,6 +821,10 @@ const char* Fl_Native_File_Chooser::preset_file() const {
return(_preset_file);
}
+int Fl_Native_File_Chooser::filters() const {
+ return(_nfilters);
+}
+
char *wchartoutf8(LPCWSTR in)
{
static char *out = NULL;
@@ -847,5 +856,5 @@ LPCWSTR utf8towchar(const char *in)
#endif /*!FL_DOXYGEN*/
//
-// End of "$Id: Fl_Native_File_Chooser_WIN32.cxx 7312 2010-03-21 22:55:18Z fabien $".
+// End of "$Id: Fl_Native_File_Chooser_WIN32.cxx 8454 2011-02-20 21:46:11Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_common.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_common.cxx
index 209c9c725..f5d45f194 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_common.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Native_File_Chooser_common.cxx
@@ -1,8 +1,8 @@
-// "$Id: Fl_Native_File_Chooser_common.cxx 7001 2010-01-14 19:38:23Z ianmacarthur $"
+// "$Id: Fl_Native_File_Chooser_common.cxx 7977 2010-12-08 13:16:27Z AlbrechtS $"
//
// FLTK native OS file chooser widget
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2010 by Bill Spitzak and others.
// Copyright 2004 Greg Ercolano.
//
// This library is free software; you can redistribute it and/or
@@ -56,6 +56,7 @@ static char *strfree(char *val) {
// 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
@@ -69,6 +70,7 @@ static char *strapp(char *s, const char *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.
@@ -79,5 +81,5 @@ static void chrcat(char *s, char c) {
}
//
-// End of "$Id: Fl_Native_File_Chooser_common.cxx 7001 2010-01-14 19:38:23Z ianmacarthur $".
+// End of "$Id: Fl_Native_File_Chooser_common.cxx 7977 2010-12-08 13:16:27Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
index 8eec995eb..f75a3d941 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Overlay_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Overlay_Window.cxx 7636 2010-06-09 08:36:25Z AlbrechtS $"
+// "$Id: Fl_Overlay_Window.cxx 8198 2011-01-06 10:24:58Z manolo $"
//
// Overlay window code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -135,7 +135,7 @@ void _Fl_Overlay::flush() {
gc = XCreateGC(fl_display, fl_xid(this), 0, 0);
}
fl_gc = gc;
-#if defined(USE_CAIRO)
+#if defined(FLTK_USE_CAIRO)
if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately
#endif
fl_overlay = 1;
@@ -172,5 +172,5 @@ void Fl_Overlay_Window::redraw_overlay() {
#endif
//
-// End of "$Id: Fl_Overlay_Window.cxx 7636 2010-06-09 08:36:25Z AlbrechtS $".
+// End of "$Id: Fl_Overlay_Window.cxx 8198 2011-01-06 10:24:58Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
index 86935910c..5889b9fc3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Pack.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pack.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Pack.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Packing widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -153,5 +153,5 @@ void Fl_Pack::draw() {
}
//
-// End of "$Id: Fl_Pack.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Pack.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Paged_Device.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Paged_Device.cxx
index faa436983..d3ea07b66 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Paged_Device.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Paged_Device.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Paged_Device.cxx 7623 2010-05-27 17:52:27Z manolo $"
+// "$Id: Fl_Paged_Device.cxx 8621 2011-04-23 15:46:30Z AlbrechtS $"
//
// implementation of Fl_Paged_Device class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010 by Bill Spitzak and others.
+// 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
@@ -28,10 +28,11 @@
\brief implementation of class Fl_Paged_Device.
*/
+#include
#include
-#include
+#include
-const char *Fl_Paged_Device::device_type = "Fl_Paged_Device";
+const char *Fl_Paged_Device::class_id = "Fl_Paged_Device";
/**
@@ -73,7 +74,7 @@ void Fl_Paged_Device::print_widget(Fl_Widget* widget, int delta_x, int delta_y)
int width, height;
this->printable_rect(&width, &height);
drawn_by_plugin = pi->print(widget, 0, 0, height);
- }
+ }
}
if (!drawn_by_plugin) {
widget->draw();
@@ -117,7 +118,7 @@ void Fl_Paged_Device::origin(int *x, int *y)
/**
@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
@@ -128,7 +129,6 @@ void Fl_Paged_Device::origin(int *x, int *y)
*/
void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x, int delta_y)
{
- int slice, width, offset, count = 0;
Fl_Surface_Device *current = Fl_Surface_Device::surface();
Fl_Display_Device::display_device()->set_current();
Fl_Window *save_front = Fl::first_window();
@@ -136,87 +136,51 @@ void Fl_Paged_Device::print_window_part(Fl_Window *win, int x, int y, int w, int
fl_gc = NULL;
Fl::check();
win->make_current();
- uchar *image_data[20];
-#ifdef WIN32 // because of bug in StretchDIBits, vertically cut image in pieces of width slice
- slice = 500;
-#else
- slice = w;
-#endif
- for ( offset = 0; offset < w; offset += slice) {
- width = slice;
- if (offset + width > w) width = w - offset;
- image_data[count++] = fl_read_image(NULL, x + offset, y, width, h);
- }
- save_front->show();
+ uchar *image_data;
+ image_data = fl_read_image(NULL, x, y, w, h);
+ if (save_front != win) save_front->show();
current->set_current();
- for ( int i = 0, offset = 0; i < count; i++, offset += slice) {
- width = slice;
- if (offset + width > w) width = w - offset;
- fl_draw_image(image_data[i], delta_x + offset, delta_y, width, h, 3);
-#ifdef __APPLE__
- add_image(NULL, image_data[i]);
-#else
- delete image_data[i];
+ fl_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
- }
}
-#ifdef __APPLE__
-void Fl_Paged_Device::add_image(Fl_Image *image, const uchar *data)
-{
- struct chain_elt *elt = (struct chain_elt *)calloc(sizeof(struct chain_elt), 1);
- elt->image = image;
- elt->data = data;
- if (image_list_) { elt->next = image_list_; }
- image_list_ = elt;
-}
-
-void Fl_Paged_Device::delete_image_list()
-{
- while(image_list_) {
- struct chain_elt *next = image_list_->next;
- if(image_list_->image) delete image_list_->image;
- if (image_list_->data) delete (uchar*) image_list_->data; // msvc6 compilation fix
- free(image_list_);
- image_list_ = next;
- }
-}
-#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 iff OK
+ @return 0 if OK, non-zero if any error
*/
int Fl_Paged_Device::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 iff OK
+ @return 0 if OK, non-zero if any error
*/
int Fl_Paged_Device::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 iff OK.
+ @return 0 if OK, non-zero if any error
*/
int Fl_Paged_Device::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.
@@ -228,7 +192,7 @@ void Fl_Paged_Device::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, printable_rect(&w, &h); origin(w/2, 0); sets the graphics origin at the
top center of the page printable area.
@@ -241,28 +205,30 @@ void Fl_Paged_Device::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.
+ @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 Fl_Paged_Device::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 counterclockwise degrees.
+ @param angle Rotation angle in counter-clockwise degrees.
*/
void Fl_Paged_Device::rotate(float angle) {}
/**
@brief To be called at the end of each page.
- *
- @return 0 iff OK.
+
+ @return 0 if OK, non-zero if any error.
*/
int Fl_Paged_Device::end_page (void) {return 1;}
@@ -273,7 +239,7 @@ void Fl_Paged_Device::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.
@@ -285,7 +251,47 @@ void Fl_Paged_Device::translate(int x, int y) {}
*/
void Fl_Paged_Device::untranslate(void) {}
-//
-// End of "$Id: Fl_Paged_Device.cxx 7623 2010-05-27 17:52:27Z manolo $".
-//
+const Fl_Paged_Device::page_format Fl_Paged_Device::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: Fl_Paged_Device.cxx 8621 2011-04-23 15:46:30Z AlbrechtS $".
+//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
index 3130e1786..461d970e1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Pixmap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Pixmap.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_Pixmap.cxx 8360 2011-02-02 12:42:47Z manolo $"
//
// Pixmap drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -145,7 +145,7 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP
}
fl_end_offscreen();
}
- if (fl_surface->type() == Fl_Printer::device_type) {
+ if (Fl_Surface_Device::surface()->class_name() == Fl_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;
@@ -153,7 +153,7 @@ void Fl_GDI_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP
hMod = LoadLibrary("MSIMG32.DLL");
if(hMod) fl_TransparentBlt = (fl_transp_func)GetProcAddress(hMod, "TransparentBlt");
}
- if (hMod) {
+ if (fl_TransparentBlt) {
Fl_Offscreen tmp_id = fl_create_offscreen(pxm->w(), pxm->h());
fl_begin_offscreen(tmp_id);
uchar *bitmap = 0;
@@ -559,5 +559,5 @@ void Fl_Pixmap::desaturate() {
}
//
-// End of "$Id: Fl_Pixmap.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_Pixmap.cxx 8360 2011-02-02 12:42:47Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
index 11f954dd9..1a50630b3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Positioner.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Positioner.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Positioner.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Positioner widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -157,5 +157,5 @@ void Fl_Positioner::ybounds(double a, double b) {
}
//
-// End of "$Id: Fl_Positioner.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Positioner.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_PostScript.cxx b/plugins/zynaddsubfx/fltk/src/Fl_PostScript.cxx
index 1f55badff..e7de956b3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_PostScript.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_PostScript.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_PostScript.cxx 7653 2010-06-24 08:55:04Z manolo $"
+// "$Id: Fl_PostScript.cxx 8623 2011-04-24 17:09:41Z AlbrechtS $"
//
// PostScript device support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2010 by Bill Spitzak and others.
+// 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
@@ -25,15 +25,22 @@
// http://www.fltk.org/str.php
//
+#include
#include
#include
#include
#include
#include
#include
+#if defined(USE_X11)
+#include "Fl_Font.H"
+#if USE_XFT
+#include
+#endif
+#endif
-const char *Fl_PostScript_Graphics_Driver::device_type = "Fl_PostScript_Graphics_Driver";
-const char *Fl_PostScript_File_Device::device_type = "Fl_PostScript_File_Device";
+const char *Fl_PostScript_Graphics_Driver::class_id = "Fl_PostScript_Graphics_Driver";
+const char *Fl_PostScript_File_Device::class_id = "Fl_PostScript_File_Device";
/** \brief Label of the PostScript file chooser window */
const char *Fl_PostScript_File_Device::file_chooser_title = "Select a .ps file";
@@ -47,7 +54,6 @@ Fl_PostScript_Graphics_Driver::Fl_PostScript_Graphics_Driver(void)
lang_level_ = 2;
mask = 0;
ps_filename_ = NULL;
- type_ = device_type;
scale_x = scale_y = 1.;
bg_r = bg_g = bg_b = 255;
}
@@ -62,7 +68,6 @@ Fl_PostScript_Graphics_Driver::~Fl_PostScript_Graphics_Driver() {
*/
Fl_PostScript_File_Device::Fl_PostScript_File_Device(void)
{
- type_ = device_type;
#ifdef __APPLE__
gc = fl_gc; // the display context is used by fl_text_extents()
#endif
@@ -85,9 +90,10 @@ Fl_PostScript_Graphics_Driver *Fl_PostScript_File_Device::driver()
@param pagecount The total number of pages to be created.
@param format Desired page format.
@param layout Desired page layout.
- @return 0 iff OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
+ @return 0 if OK, 1 if user cancelled the file dialog, 2 if fopen failed on user-selected output file.
*/
-int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
+int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_Paged_Device::Page_Format format,
+ enum Fl_Paged_Device::Page_Layout layout)
{
Fl_Native_File_Chooser fnfc;
fnfc.title(Fl_PostScript_File_Device::file_chooser_title);
@@ -105,22 +111,29 @@ int Fl_PostScript_File_Device::start_job (int pagecount, enum Fl_PostScript_Grap
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 will be closed
- when end_job() will be called.
+ @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 Fl_PostScript_File_Device::start_job (FILE *ps_output, int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
+int Fl_PostScript_File_Device::start_job (FILE *ps_output, int pagecount,
+ enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout)
{
Fl_PostScript_Graphics_Driver *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;
}
@@ -139,46 +152,6 @@ Fl_PostScript_File_Device::~Fl_PostScript_File_Device() {
#include "print_panel.cxx"
#endif
-const Fl_PostScript_Graphics_Driver::page_format Fl_PostScript_Graphics_Driver::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
-};
-
// Prolog string
static const char * prolog =
@@ -270,7 +243,7 @@ static const char * prolog =
"/MI { GS /py exch def /px exch def /sy exch def /sx exch def \n"
"translate \n"
-"sx sy scale px py false \n"
+"sx sy scale px py true \n"
"[ px 0 0 py neg 0 py ]\n"
"currentfile /ASCIIHexDecode filter\n"
"imagemask GR\n"
@@ -300,7 +273,8 @@ static const char * prolog =
// 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 exch 3 index exch sub exch "
+"/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
@@ -330,8 +304,6 @@ static const char * prolog_2 = // prolog relevant only if lang_level >1
"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"
@@ -351,28 +323,90 @@ static const char * prolog_2 = // prolog relevant only if lang_level >1
"end\n"
"IDD image GR} bind def\n"
-// procedure to modify a font to use ISOLatin1 encoding (iso-8859-1)
-// and to keep its name unchanged
-"/ToLatin1 { dup findfont dup length dict "
-"begin {def} forall /Encoding ISOLatin1Encoding def currentdict end definefont pop } def\n"
-// modify all fonts to use ISOLatin1 encoding
-"/Helvetica ToLatin1 "
-"/Helvetica-Bold ToLatin1 "
-"/Helvetica-Oblique ToLatin1 "
-"/Helvetica-BoldOblique ToLatin1 \n"
-"/Courier ToLatin1 "
-"/Courier-Bold ToLatin1 "
-"/Courier-Oblique ToLatin1 "
-"/Courier-BoldOblique ToLatin1 \n"
-"/Times ToLatin1 "
-"/Times-Bold ToLatin1 "
-"/Times-Italic ToLatin1 "
-"/Times-BoldItalic ToLatin1 \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
-"/pixmap_size { /pixmap_sy exch def /pixmap_sx exch def } bind def\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 {"
@@ -384,10 +418,10 @@ static const char * prolog_2_pixmap = // prolog relevant only if lang_level ==
"/YStep pixmap_sy\n"
"/PaintProc "
"{ begin "
-"pixmap_sx pixmap_sy scale "
+"pixmap_w pixmap_h scale "
"pixmap_sx pixmap_sy 8 "
"pixmap_mat "
-"pixmap_data "
+"currentfile /ASCIIHexDecode filter "
"false 3 "
"colorimage "
"end "
@@ -397,28 +431,20 @@ static const char * prolog_2_pixmap = // prolog relevant only if lang_level ==
"/pixmap_plot {"
"GS "
-"/pixmap_y exch def /pixmap_x exch def\n"
-"pixmap_x pixmap_y translate\n"
+"/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_sx pixmap_sy scale\n"
+"pixmap_w pixmap_h scale\n"
"pixmap_sx pixmap_sy\n"
"true\n"
"pixmap_mat\n"
-"pixmap_mask\n"
+"currentfile /ASCIIHexDecode filter\n"
"imagemask\n"
"GR\n"
"} bind def\n"
-
-"/pixmap_loaddata { /pixmap_data currentfile pixmap_sx pixmap_sy 3 mul mul string readhexstring "
-"} bind def\n"
-
-"/pixmap_loadmask { "
-"/pixmap_mask currentfile pixmap_sx 8 div ceiling cvi pixmap_sy mul string readhexstring "
-"} bind def\n"
;
-
-
static const char * prolog_3 = // prolog relevant only if lang_level >2
// masked color images
@@ -508,11 +534,12 @@ static const char * prolog_3 = // prolog relevant only if lang_level >2
// end prolog
-int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_PostScript_Graphics_Driver::Page_Format format, enum Fl_PostScript_Graphics_Driver::Page_Layout layout)
+int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount,
+ enum Fl_Paged_Device::Page_Format format, enum Fl_Paged_Device::Page_Layout layout)
//returns 0 iff OK
{
int w, h, x;
- if (format == A4) {
+ if (format == Fl_Paged_Device::A4) {
left_margin = 18;
top_margin = 18;
}
@@ -520,7 +547,7 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_Post
left_margin = 12;
top_margin = 12;
}
- page_format_ = (enum Page_Format)(format | layout);
+ page_format_ = (enum Fl_Paged_Device::Page_Format)(format | layout);
fputs("%!PS-Adobe-3.0\n", output);
fputs("%%Creator: FLTK\n", output);
@@ -530,10 +557,10 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_Post
fprintf(output, "%%%%Pages: %i\n", pagecount);
else
fputs("%%Pages: (atend)\n", output);
- fprintf(output, "%%%%BeginFeature: *PageSize %s\n", page_formats[format].name );
- w = page_formats[format].width;
- h = page_formats[format].height;
- if (lang_level_ == 3 && (layout & LANDSCAPE) ) { x = w; w = h; h = x; }
+ fprintf(output, "%%%%BeginFeature: *PageSize %s\n", Fl_Paged_Device::page_formats[format].name );
+ w = Fl_Paged_Device::page_formats[format].width;
+ h = Fl_Paged_Device::page_formats[format].height;
+ if (lang_level_ == 3 && (layout & Fl_Paged_Device::LANDSCAPE) ) { x = w; w = h; h = x; }
fprintf(output, "<>setpagedevice\n", w, h );
fputs("%%EndFeature\n", output);
fputs("%%EndComments\n", output);
@@ -568,15 +595,14 @@ int Fl_PostScript_Graphics_Driver::start_postscript (int pagecount, enum Fl_Post
void Fl_PostScript_Graphics_Driver::recover(){
color(cr_,cg_,cb_);
line_style(linestyle_,linewidth_,linedash_);
- font(font_,size_);
+ font(Fl_Graphics_Driver::font(), Fl_Graphics_Driver::size());
}
void Fl_PostScript_Graphics_Driver::reset(){
gap_=1;
clip_=0;
cr_=cg_=cb_=0;
- font_=FL_HELVETICA;
- size_=12;
+ Fl_Graphics_Driver::font(FL_HELVETICA, 12);
linewidth_=0;
linestyle_=FL_SOLID;
strcpy(linedash_,"");
@@ -614,8 +640,8 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
}
fprintf(output, "%%%%BeginPageSetup\n");
- if((media & MEDIA) &&(lang_level_>1)){
- int r = media & REVERSED;
+ if((media & Fl_Paged_Device::MEDIA) &&(lang_level_>1)){
+ int r = media & Fl_Paged_Device::REVERSED;
if(r) r = 2;
fprintf(output, "<< /PageSize [%i %i] /Orientation %i>> setpagedevice\n", (int)(pw+.5), (int)(ph+.5), r);
}
@@ -632,9 +658,9 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
line_style(0);
fprintf(output, "GS\n");
- if (!((media & MEDIA) &&(lang_level_>1))){
+ if (!((media & Fl_Paged_Device::MEDIA) &&(lang_level_>1))){
if (pw > ph) {
- if(media & REVERSED) {
+ if(media & Fl_Paged_Device::REVERSED) {
fprintf(output, "-90 rotate %i 0 translate\n", int(-pw));
}
else {
@@ -642,25 +668,25 @@ void Fl_PostScript_Graphics_Driver::page(double pw, double ph, int media) {
}
}
else {
- if(media & REVERSED)
+ if(media & Fl_Paged_Device::REVERSED)
fprintf(output, "180 rotate %i %i translate\n", int(-pw), int(-ph));
}
}
fprintf(output, "GS\nCS\n");
-};
+}
void Fl_PostScript_Graphics_Driver::page(int format){
- if(format & LANDSCAPE){
- ph_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].width;
- pw_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].height;
+ if(format & Fl_Paged_Device::LANDSCAPE){
+ ph_=Fl_Paged_Device::page_formats[format & 0xFF].width;
+ pw_=Fl_Paged_Device::page_formats[format & 0xFF].height;
}else{
- pw_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].width;
- ph_=Fl_PostScript_Graphics_Driver::page_formats[format & 0xFF].height;
+ pw_=Fl_Paged_Device::page_formats[format & 0xFF].width;
+ ph_=Fl_Paged_Device::page_formats[format & 0xFF].height;
}
page(pw_,ph_,format & 0xFF00);//,orientation only;
-};
+}
void Fl_PostScript_Graphics_Driver::rect(int x, int y, int w, int h) {
// Commented code does not work, i can't find the bug ;-(
@@ -706,7 +732,7 @@ void Fl_PostScript_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3)
fprintf(output,"%i %i LT\n", x3 , y2);
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::xyline(int x, int y, int x1, int y2){
@@ -718,7 +744,7 @@ void Fl_PostScript_Graphics_Driver::xyline(int x, int y, int x1, int y2){
fprintf(output, "%i %i LT\n", x1 , y2 );
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::xyline(int x, int y, int x1){
fprintf(output, "GS\n");
@@ -728,7 +754,7 @@ void Fl_PostScript_Graphics_Driver::xyline(int x, int y, int x1){
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3){
fprintf(output, "GS\n");
@@ -740,7 +766,7 @@ void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3)
fprintf(output , "%i %i LT\n", x2 , y3);
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1, int x2){
fprintf(output, "GS\n");
@@ -750,7 +776,7 @@ void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1, int x2){
fprintf(output, "%i %i LT\n", x2 , y1);
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1){
fprintf(output, "GS\n");
@@ -759,7 +785,7 @@ void Fl_PostScript_Graphics_Driver::yxline(int x, int y, int y1){
fprintf(output, "%i %i LT\n", x , y1);
fprintf(output, "ELP\n");
fprintf(output, "GR\n");
-};
+}
void Fl_PostScript_Graphics_Driver::loop(int x0, int y0, int x1, int y1, int x2, int y2) {
fprintf(output, "GS\n");
@@ -841,7 +867,7 @@ void Fl_PostScript_Graphics_Driver::line_style(int style, int width, char* dashe
linedash_[0]=0;
char width0 = 0;
if(!width){
- width=1; //for screen drawing compatability
+ width=1; //for screen drawing compatibility
width0=1;
}
@@ -884,57 +910,83 @@ void Fl_PostScript_Graphics_Driver::line_style(int style, int width, char* dashe
}
}
fprintf(output, "] 0 setdash\n");
-};
+}
static const char *_fontNames[] = {
-"Helvetica",
-"Helvetica-Bold",
-"Helvetica-Oblique",
-"Helvetica-BoldOblique",
-"Courier",
-"Courier-Bold",
-"Courier-Oblique",
-"Courier-BoldOblique",
-"Times",
-"Times-Bold",
-"Times-Italic",
-"Times-BoldItalic",
+"Helvetica2B",
+"Helvetica-Bold2B",
+"Helvetica-Oblique2B",
+"Helvetica-BoldOblique2B",
+"Courier2B",
+"Courier-Bold2B",
+"Courier-Oblique2B",
+"Courier-BoldOblique2B",
+"Times-Roman2B",
+"Times-Bold2B",
+"Times-Italic2B",
+"Times-BoldItalic2B",
"Symbol",
-"Courier",
-"Courier-Bold",
+"Courier2B",
+"Courier-Bold2B",
"ZapfDingbats"
};
void Fl_PostScript_Graphics_Driver::font(int f, int s) {
- if (f >= FL_FREE_FONT)
- f = FL_COURIER;
- fprintf(output, "/%s SF\n" , _fontNames[f]);
- fprintf(output,"%i FS\n", s);
- Fl_Display_Device::display_device()->driver()->font(f,s); // Use display fonts for font measurement
- font_ = f; size_ = s;
-};
-
-void Fl_PostScript_Graphics_Driver::color(Fl_Color c) {
- //colored_=1;
- color_=c;
- Fl::get_color(c, cr_, cg_, cb_);
- if (cr_==cg_ && cg_==cb_) {
- double gray = cr_/255.0;
- fprintf(output, "%g GL\n", gray);
-
- } else {
- double fr, fg, fb;
- fr = cr_/255.0;
- fg = cg_/255.0;
- fb = cb_/255.0;
- fprintf(output,"%g %g %g SRGB\n", fr , fg , fb);
+ Fl_Graphics_Driver *driver = Fl_Display_Device::display_device()->driver();
+ driver->font(f,s); // Use display fonts for font measurement
+ Fl_Graphics_Driver::font(f, s);
+ Fl_Font_Descriptor *desc = driver->font_descriptor();
+ this->font_descriptor(desc);
+ if (f < FL_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 Fl_PostScript_Graphics_Driver::width(const char *s, int n) {
+ return Fl_Display_Device::display_device()->driver()->width(s, n);
+}
+
+int Fl_PostScript_Graphics_Driver::height() {
+ return Fl_Display_Device::display_device()->driver()->height();
+}
+
+int Fl_PostScript_Graphics_Driver::descent() {
+ return Fl_Display_Device::display_device()->driver()->descent();
+}
+
+void Fl_PostScript_Graphics_Driver::text_extents(const char *c, int n, int &dx, int &dy, int &w, int &h) {
+ Fl_Display_Device::display_device()->driver()->text_extents(c, n, dx, dy, w, h);
+}
+
+
+void Fl_PostScript_Graphics_Driver::color(Fl_Color c) {
+ Fl::get_color(c, cr_, cg_, cb_);
+ color(cr_, cg_, cb_);
+}
+
void Fl_PostScript_Graphics_Driver::color(unsigned char r, unsigned char g, unsigned char b) {
- //colored_=1;
- cr_=r;cg_=g;cb_=b;
- if (r==g && g==b) {
+ Fl_Graphics_Driver::color( fl_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 {
@@ -953,32 +1005,162 @@ void Fl_PostScript_Graphics_Driver::draw(int angle, const char *str, int n, int
fprintf(output, "GR\n");
}
-// outputs in PostScript a UTF8 string replacing non-Latin1 characters by ?
-// and using the same width in points as on display
-void Fl_PostScript_Graphics_Driver::transformed_draw(const char* str, int n, double x, double y) {
- int len;
- if (!n || !str || !*str) return;
- const char *last = str + n;
- // compute display width of string
- fprintf(output,"%g (", fl_width(str, n));
- while (str < last) {
- // Extract each unicode character of string.
- // Until 0xFF, UTF codes coincide with iso-Latin1 (iso-8859-1)
- unsigned utf = fl_utf8decode(str, last, &len);
- str += len;
- if (utf > 0xFF) {
- utf = '?'; // replace non Latin-1 unicodes by ?
+
+// computes the mask for the RGB image img of all pixels with color != bg
+static uchar *calc_mask(uchar *img, int w, int h, Fl_Color bg)
+{
+ uchar red, green, blue, r, g, b;
+ uchar bit, byte, *q;
+ Fl::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
+ }
}
- else if (utf == '(' || utf == ')' || utf == '\\') {
- putc('\\' , output); // these chars need be escaped
- }
- putc(utf, output); // output the latin character
- }
- fprintf(output, ") %g %g show_pos_width\n", x, y);
+ if (bit != 0x80) *q++ = byte; // enter last columns' byte in mask
+ }
+ return mask;
}
-struct matrix {double a, b, c, d, x, y;};
-extern matrix * fl_matrix;
+// 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, Fl_Graphics_Driver *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
+ Fl_Fontsize old_size = driver->size();
+ Fl_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
+ Fl_Color text_color = driver->color();
+ Fl_Color bg_color = fl_contrast(FL_WHITE, text_color);
+ Fl_Offscreen off = fl_create_offscreen(w_scaled, (int)(h+3*scale) );
+ fl_begin_offscreen(off);
+ fl_color(bg_color);
+ // color offscreen background with a shade contrasting with the text color
+ fl_rectf(0, 0, w_scaled, (int)(h+3*scale) );
+ fl_color(text_color);
+#if defined(USE_X11) && !USE_XFT
+ // force seeing this font as new so it's applied to the offscreen graphics context
+ fl_graphics_driver->font_descriptor(NULL);
+ fl_font(fontnum, 0);
+#endif
+ fl_font(fontnum, (Fl_Fontsize)(scale * old_size) );
+ int w2 = (int)fl_width(str, n);
+ // draw string in offscreen
+ if (rtl) fl_rtl_draw(str, n, w2, (int)(h * 0.8) );
+ else fl_draw(str, n, 1, (int)(h * 0.8) );
+ // read (most of) the offscreen image
+ uchar *img = fl_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 Fl_PostScript_Graphics_Driver::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 (Fl_Graphics_Driver::font() >= FL_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 = fl_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 Fl_PostScript_Graphics_Driver::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 Fl_PostScript_Graphics_Driver::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);
@@ -998,7 +1180,7 @@ void Fl_PostScript_Graphics_Driver::begin_points(){
fprintf(output, "BP\n");
gap_=1;
shape_=POINTS;
-};
+}
void Fl_PostScript_Graphics_Driver::begin_line(){
fprintf(output, "GS\n");
@@ -1006,7 +1188,7 @@ void Fl_PostScript_Graphics_Driver::begin_line(){
fprintf(output, "BP\n");
gap_=1;
shape_=LINE;
-};
+}
void Fl_PostScript_Graphics_Driver::begin_loop(){
fprintf(output, "GS\n");
@@ -1014,7 +1196,7 @@ void Fl_PostScript_Graphics_Driver::begin_loop(){
fprintf(output, "BP\n");
gap_=1;
shape_=LOOP;
-};
+}
void Fl_PostScript_Graphics_Driver::begin_polygon(){
fprintf(output, "GS\n");
@@ -1022,7 +1204,7 @@ void Fl_PostScript_Graphics_Driver::begin_polygon(){
fprintf(output, "BP\n");
gap_=1;
shape_=POLYGON;
-};
+}
void Fl_PostScript_Graphics_Driver::vertex(double x, double y){
if(shape_==POINTS){
@@ -1035,7 +1217,7 @@ void Fl_PostScript_Graphics_Driver::vertex(double x, double y){
gap_=0;
}else
fprintf(output, "%g %g LT\n", x , y);
-};
+}
void Fl_PostScript_Graphics_Driver::curve(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3){
if(shape_==NONE) return;
@@ -1046,7 +1228,7 @@ void Fl_PostScript_Graphics_Driver::curve(double x, double y, double x1, double
gap_=0;
fprintf(output, "%g %g %g %g %g %g curveto \n", x1 , y1 , x2 , y2 , x3 , y3);
-};
+}
void Fl_PostScript_Graphics_Driver::circle(double x, double y, double r){
@@ -1062,7 +1244,7 @@ void Fl_PostScript_Graphics_Driver::circle(double x, double y, double r){
fprintf(output, "%g %g %g 0 360 arc\n", x , y , r);
-};
+}
void Fl_PostScript_Graphics_Driver::arc(double x, double y, double r, double start, double a){
if(shape_==NONE) return;
@@ -1072,7 +1254,7 @@ void Fl_PostScript_Graphics_Driver::arc(double x, double y, double r, double sta
else
fprintf(output, "%g %g %g %g %g arcn\n", x , y , r , -start, -a);
-};
+}
void Fl_PostScript_Graphics_Driver::arc(int x, int y, int w, int h, double a1, double a2) {
fprintf(output, "GS\n");
@@ -1145,7 +1327,7 @@ void Fl_PostScript_Graphics_Driver::transformed_vertex(double x, double y){
}else
fprintf(output, "%g %g LT\n", x , y);
concat();
-};
+}
///////////////////////////// Clipping /////////////////////////////////////////////
@@ -1218,7 +1400,7 @@ int Fl_PostScript_Graphics_Driver::clip_box(int x, int y, int w, int h, int &X,
return 1;
}
return ret;
-};
+}
int Fl_PostScript_Graphics_Driver::not_clipped(int x, int y, int w, int h){
if(!clip_) return 1;
@@ -1227,7 +1409,7 @@ int Fl_PostScript_Graphics_Driver::not_clipped(int x, int y, int w, int h){
clip_box(x, y, w, h, X, Y, W, H);
if(W) return 1;
return 0;
-};
+}
void Fl_PostScript_File_Device::margins(int *left, int *top, int *right, int *bottom) // to implement
@@ -1248,6 +1430,11 @@ int Fl_PostScript_File_Device::printable_rect(int *w, int *h)
return 0;
}
+void Fl_PostScript_File_Device::origin(int *x, int *y)
+{
+ Fl_Paged_Device::origin(x, y);
+}
+
void Fl_PostScript_File_Device::origin(int x, int y)
{
x_offset = x;
@@ -1259,6 +1446,7 @@ void Fl_PostScript_File_Device::origin(int x, int y)
void Fl_PostScript_File_Device::scale (float s_x, float s_y)
{
+ if (s_y == 0.) s_y = s_x;
Fl_PostScript_Graphics_Driver *ps = driver();
ps->scale_x = s_x;
ps->scale_y = s_y;
@@ -1319,27 +1507,23 @@ void Fl_PostScript_File_Device::end_job (void)
if(ferror(ps->output)) {
fl_alert ("Error during PostScript data output.");
}
-#if ! (defined(__APPLE__) || defined(WIN32) )
- if (print_pipe)
- pclose(ps->output);
- else
+ if (ps->close_cmd_) {
+ (*ps->close_cmd_)(ps->output);
+ } else {
fclose(ps->output);
-#else
- fclose(ps->output);
-#endif
+ }
while (ps->clip_){
Fl_PostScript_Graphics_Driver::Clip * c= ps->clip_;
ps->clip_= ps->clip_->prev;
delete c;
}
- if (ps->close_cmd_) (*ps->close_cmd_)(ps->output);
Fl_Display_Device::display_device()->set_current();
}
#if ! (defined(__APPLE__) || defined(WIN32) )
-int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
- enum Fl_PostScript_Graphics_Driver::Page_Format format;
- enum Fl_PostScript_Graphics_Driver::Page_Layout layout;
+int Fl_PostScript_Printer::start_job(int pages, int *firstpage, int *lastpage) {
+ enum Fl_Paged_Device::Page_Format format;
+ enum Fl_Paged_Device::Page_Layout layout;
// first test version for print dialog
if (!print_panel) make_print_panel();
@@ -1357,7 +1541,7 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
// get options
- format = print_page_size->value() ? Fl_PostScript_Graphics_Driver::A4 : Fl_PostScript_Graphics_Driver::LETTER;
+ format = print_page_size->value() ? Fl_Paged_Device::A4 : Fl_Paged_Device::LETTER;
{ // page range choice
int from = 1, to = pages;
if (print_pages->value()) {
@@ -1372,12 +1556,12 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
pages = to - from + 1;
}
- if (print_output_mode[0]->value()) layout = Fl_PostScript_Graphics_Driver::PORTRAIT;
- else if (print_output_mode[1]->value()) layout = Fl_PostScript_Graphics_Driver::LANDSCAPE;
- else if (print_output_mode[2]->value()) layout = Fl_PostScript_Graphics_Driver::PORTRAIT;
- else layout = Fl_PostScript_Graphics_Driver::LANDSCAPE;
+ if (print_output_mode[0]->value()) layout = Fl_Paged_Device::PORTRAIT;
+ else if (print_output_mode[1]->value()) layout = Fl_Paged_Device::LANDSCAPE;
+ else if (print_output_mode[2]->value()) layout = Fl_Paged_Device::PORTRAIT;
+ else layout = Fl_Paged_Device::LANDSCAPE;
- print_pipe = print_choice->value(); // 0 = print to file, >0 = printer (pipe)
+ 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();
@@ -1399,6 +1583,7 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
fl_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
}
@@ -1408,5 +1593,5 @@ int Fl_Printer::start_job(int pages, int *firstpage, int *lastpage) {
#endif // FL_DOXYGEN
//
-// End of "$Id: Fl_PostScript.cxx 7653 2010-06-24 08:55:04Z manolo $".
+// End of "$Id: Fl_PostScript.cxx 8623 2011-04-24 17:09:41Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
index ce5ab57fe..e343821ba 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Preferences.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Preferences.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Preferences.cxx 8291 2011-01-19 06:33:48Z manolo $"
//
// Preferences methods for the Fast Light Tool Kit (FLTK).
//
-// Copyright 2002-2009 by Matthias Melcher.
+// 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
@@ -28,7 +28,6 @@
#include
#include
#include
-#include
#include
#include
@@ -48,7 +47,7 @@
# define access _access
# define mkdir _mkdir
#elif defined (__APPLE__)
-# include
+# include
# include
# include
#else
@@ -85,8 +84,7 @@ Fl_Preferences *Fl_Preferences::runtimePrefs = 0;
* \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 *Fl_Preferences::newUUID()
-{
+const char *Fl_Preferences::newUUID() {
#ifdef __APPLE__
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFUUIDBytes b = CFUUIDGetUUIDBytes(theUUID);
@@ -104,18 +102,18 @@ const char *Fl_Preferences::newUUID()
UUID *pu = &ud;
int got_uuid = 0;
- if(!hMod){ // first time in?
+ if (!hMod) { // first time in?
hMod = LoadLibrary("Rpcrt4.dll");
}
- if(hMod){ // do we have a usable handle to 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) {
+ 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
+ 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
+ (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",
@@ -125,30 +123,36 @@ const char *Fl_Preferences::newUUID()
}
}
}
- if(got_uuid == 0) { // did not make a UUID - use fallback logic
+ if (got_uuid == 0) { // did not make a UUID - use fallback logic
unsigned char b[16];
- time_t t = time(0); // first 4 byte
+ 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
+ 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 int a = (unsigned int)(intptr_t)&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: 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++){
+ 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",
@@ -156,26 +160,44 @@ const char *Fl_Preferences::newUUID()
b[8], b[9], b[10], b[11], b[12], b[13], b[14], b[15]);
}
#else
-#warning Unix implementation incomplete!
+ // warning Unix implementation of Fl_Preferences::newUUID() incomplete!
// #include
// void uuid_generate(uuid_t out);
unsigned char b[16];
- time_t t = time(0); // first 4 byte
+ 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
+ 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
+ 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);
- char name[80]; // last four bytes
+ // 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",
@@ -186,7 +208,6 @@ const char *Fl_Preferences::newUUID()
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.
@@ -213,14 +234,12 @@ const char *Fl_Preferences::newUUID()
\param[in] vendor unique text describing the company or author of this file
\param[in] application unique text describing the application
*/
-Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *application )
-{
+Fl_Preferences::Fl_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.
@@ -233,14 +252,12 @@ Fl_Preferences::Fl_Preferences( Root root, const char *vendor, const char *appli
\param[in] vendor unique text describing the company or author of this file
\param[in] application unique text describing the application
*/
-Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application )
-{
+Fl_Preferences::Fl_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.
@@ -251,13 +268,11 @@ Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char
\param[in] parent reference object for the new group
\param[in] group name of the group to access (may contain '/'s)
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *group )
-{
+Fl_Preferences::Fl_Preferences( Fl_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.
@@ -268,8 +283,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, const char *group )
\param[in] group a group name that is used as a key into the database
\see Fl_Preferences( Fl_Preferences&, const char *group )
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group )
-{
+Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group ) {
if (parent==0) {
if (!runtimePrefs) {
runtimePrefs = new Fl_Preferences();
@@ -283,7 +297,6 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group )
node = parent->node->addChild( group );
}
-
/**
\brief Open a child group using a given index.
@@ -297,8 +310,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, const char *group )
\param[in] parent reference object for the new group
\param[in] groupIndex zero based index into child groups
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, int groupIndex )
-{
+Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, int groupIndex ) {
rootNode = parent.rootNode;
if (groupIndex<0 || groupIndex>=parent.groups()) {
node = parent.node->addChild( newUUID() );
@@ -307,12 +319,10 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences &parent, int groupIndex )
}
}
-
/**
\see Fl_Preferences( Fl_Preferences&, int groupIndex )
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, int groupIndex )
-{
+Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, int groupIndex ) {
rootNode = parent->rootNode;
if (groupIndex<0 || groupIndex>=parent->groups()) {
node = parent->node->addChild( newUUID() );
@@ -321,7 +331,6 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, int groupIndex )
}
}
-
/**
Create a new dataset access point using a dataset ID.
@@ -333,8 +342,7 @@ Fl_Preferences::Fl_Preferences( Fl_Preferences *parent, int groupIndex )
ID's can be put very helpful when put into the user_data() field of
widget callbacks.
*/
-Fl_Preferences::Fl_Preferences( Fl_Preferences::ID id )
-{
+Fl_Preferences::Fl_Preferences( Fl_Preferences::ID id ) {
node = (Node*)id;
rootNode = node->findRoot();
}
@@ -358,7 +366,6 @@ Fl_Preferences &Fl_Preferences::operator=(const Fl_Preferences &rhs) {
return *this;
}
-
/**
The destructor removes allocated resources. When used on the
\em base preferences group, the destructor flushes all
@@ -368,8 +375,7 @@ Fl_Preferences &Fl_Preferences::operator=(const Fl_Preferences &rhs) {
The destructor does not remove any data from the database. It merely
deletes your reference to the database.
*/
-Fl_Preferences::~Fl_Preferences()
-{
+Fl_Preferences::~Fl_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
@@ -378,18 +384,15 @@ Fl_Preferences::~Fl_Preferences()
rootNode = 0L;
}
-
/**
Returns the number of groups that are contained within a group.
\return 0 for no groups at all
*/
-int Fl_Preferences::groups()
-{
+int Fl_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
@@ -398,12 +401,10 @@ int Fl_Preferences::groups()
\param[in] num_group number indexing the requested group
\return 'C' string pointer to the group name
*/
-const char *Fl_Preferences::group( int num_group )
-{
+const char *Fl_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.
@@ -413,12 +414,10 @@ const char *Fl_Preferences::group( int num_group )
\param[in] key name of group that is searched for
\return 0 if no group by that name was found
*/
-char Fl_Preferences::groupExists( const char *key )
-{
+char Fl_Preferences::groupExists( const char *key ) {
return node->search( key ) ? 1 : 0 ;
}
-
/**
Deletes a group.
@@ -428,8 +427,7 @@ char Fl_Preferences::groupExists( const char *key )
\param[in] group name of the group to delete
\return 0 if call failed
*/
-char Fl_Preferences::deleteGroup( const char *group )
-{
+char Fl_Preferences::deleteGroup( const char *group ) {
Node *nd = node->search( group );
if ( nd ) return nd->remove();
return 0;
@@ -438,8 +436,7 @@ char Fl_Preferences::deleteGroup( const char *group )
/**
Delete all groups.
*/
-char Fl_Preferences::deleteAllGroups()
-{
+char Fl_Preferences::deleteAllGroups() {
node->deleteAllChildren();
return 1;
}
@@ -449,12 +446,10 @@ char Fl_Preferences::deleteAllGroups()
\return number of entries
*/
-int Fl_Preferences::entries()
-{
+int Fl_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
@@ -463,24 +458,20 @@ int Fl_Preferences::entries()
\param[in] index number indexing the requested entry
\return pointer to value cstring
*/
-const char *Fl_Preferences::entry( int index )
-{
+const char *Fl_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 Fl_Preferences::entryExists( const char *key )
-{
+char Fl_Preferences::entryExists( const char *key ) {
return node->getEntry( key )>=0 ? 1 : 0 ;
}
-
/**
Deletes a single name/value pair.
@@ -489,16 +480,14 @@ char Fl_Preferences::entryExists( const char *key )
\param[in] key name of entry to delete
\return 0 if deleting the entry failed
*/
-char Fl_Preferences::deleteEntry( const char *key )
-{
+char Fl_Preferences::deleteEntry( const char *key ) {
return node->deleteEntry( key );
}
/**
Delete all entries.
*/
-char Fl_Preferences::deleteAllEntries()
-{
+char Fl_Preferences::deleteAllEntries() {
node->deleteAllEntries();
return 1;
}
@@ -506,8 +495,7 @@ char Fl_Preferences::deleteAllEntries()
/**
Delete all groups and all entries.
*/
-char Fl_Preferences::clear()
-{
+char Fl_Preferences::clear() {
char ret1 = deleteAllGroups();
char ret2 = deleteAllEntries();
return ret1 & ret2;
@@ -523,14 +511,12 @@ char Fl_Preferences::clear()
\param[in] defaultValue default value to be used if no preference was set
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, int &value, int defaultValue )
-{
+char Fl_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
@@ -541,14 +527,12 @@ char Fl_Preferences::get( const char *key, int &value, int defaultValue )
\param[in] value set this entry to \p value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, int value )
-{
+char Fl_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
@@ -559,14 +543,12 @@ char Fl_Preferences::set( const char *key, int value )
\param[in] defaultValue default value to be used if no preference was set
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, float &value, float defaultValue )
-{
+char Fl_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
@@ -577,14 +559,12 @@ char Fl_Preferences::get( const char *key, float &value, float defaultValue )
\param[in] value set this entry to \p value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, float value )
-{
+char Fl_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
@@ -596,14 +576,12 @@ char Fl_Preferences::set( const char *key, float value )
\param[in] precision number of decimal digits to represent value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, float value, int precision )
-{
+char Fl_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
@@ -614,14 +592,12 @@ char Fl_Preferences::set( const char *key, float value, int precision )
\param[in] defaultValue default value to be used if no preference was set
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, double &value, double defaultValue )
-{
+char Fl_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
@@ -632,14 +608,12 @@ char Fl_Preferences::get( const char *key, double &value, double defaultValue )
\param[in] value set this entry to \p value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, double value )
-{
+char Fl_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
@@ -651,30 +625,29 @@ char Fl_Preferences::set( const char *key, double value )
\param[in] precision number of decimal digits to represent value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, double value, int precision )
-{
+char Fl_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 )
-{
+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;
+ 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++ )
- {
+ for ( s = src; *s; s++ ) {
char c = *s;
- if ( c == '\\' )
- {
+ if ( c == '\\' ) {
if ( s[1] == '\\' ) { *d++ = c; s++; }
else if ( s[1] == 'n' ) { *d++ = '\n'; s++; }
else if ( s[1] == 'r' ) { *d++ = '\r'; s++; }
@@ -688,7 +661,6 @@ static char *decodeText( const char *src )
return dst;
}
-
/**
Reads an entry from the group. A default value must be
supplied. The return value indicates if the value was available
@@ -702,8 +674,7 @@ static char *decodeText( const char *src )
\param[in] maxSize maximum length of value plus one byte for a trailing zero
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, char *text, const char *defaultValue, int maxSize )
-{
+char Fl_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 );
@@ -717,7 +688,6 @@ char Fl_Preferences::get( const char *key, char *text, const char *defaultValue,
return ( v != defaultValue );
}
-
/**
Reads an entry from the group. A default value must be
supplied. The return value indicates if the value was available
@@ -730,11 +700,9 @@ char Fl_Preferences::get( const char *key, char *text, const char *defaultValue,
\param[in] defaultValue default value to be used if no preference was set
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue )
-{
+char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue ) {
const char *v = node->get( key );
- if ( v && strchr( v, '\\' ) )
- {
+ if ( v && strchr( v, '\\' ) ) {
text = decodeText( v );
return 1;
}
@@ -746,8 +714,6 @@ char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue
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
@@ -758,16 +724,13 @@ char Fl_Preferences::get( const char *key, char *&text, const char *defaultValue
\param[in] text set this entry to \p value
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, const char *text )
-{
+char Fl_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 )
- {
+ if ( ns ) {
char *buffer = (char*)malloc( n+ns+1 ), *d = buffer;
- for ( s=text; *s; )
- {
+ for ( s=text; *s; ) {
char c = *s;
if ( c=='\\' ) { *d++ = '\\'; *d++ = '\\'; s++; }
else if ( c=='\n' ) { *d++ = '\\'; *d++ = 'n'; s++; }
@@ -785,17 +748,12 @@ char Fl_Preferences::set( const char *key, const char *text )
return 1;
}
-
// convert a hex string to binary data
-static void *decodeHex( const char *src, int &size )
-{
+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;
- int i;
-
- for ( i=size; i>0; i-- )
- {
+ for ( int i=size; i>0; i-- ) {
int v;
char x = tolower(*s++);
if ( x >= 'a' ) v = x-'a'+10; else v = x-'0';
@@ -804,11 +762,9 @@ static void *decodeHex( const char *src, int &size )
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
@@ -824,11 +780,9 @@ static void *decodeHex( const char *src, int &size )
\todo maxSize should receive the number of bytes that were read.
*/
-char Fl_Preferences::get( const char *key, void *data, const void *defaultValue, int defaultSize, int maxSize )
-{
+char Fl_Preferences::get( const char *key, void *data, const void *defaultValue, int defaultSize, int maxSize ) {
const char *v = node->get( key );
- if ( v )
- {
+ if ( v ) {
int dsize;
void *w = decodeHex( v, dsize );
memmove( data, w, dsize>maxSize?maxSize:dsize );
@@ -840,7 +794,6 @@ char Fl_Preferences::get( const char *key, void *data, const void *defaultValue,
return 0;
}
-
/**
Reads an entry from the group. A default value must be
supplied. The return value indicates if the value was available
@@ -854,17 +807,14 @@ char Fl_Preferences::get( const char *key, void *data, const void *defaultValue,
\param[in] defaultSize size of default value array
\return 0 if the default value was used
*/
-char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue, int defaultSize )
-{
+char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue, int defaultSize ) {
const char *v = node->get( key );
- if ( v )
- {
+ if ( v ) {
int dsize;
data = decodeHex( v, dsize );
return 1;
}
- if ( defaultValue )
- {
+ if ( defaultValue ) {
data = (void*)malloc( defaultSize );
memmove( data, defaultValue, defaultSize );
}
@@ -873,7 +823,6 @@ char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue
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
@@ -885,12 +834,10 @@ char Fl_Preferences::get( const char *key, void *&data, const void *defaultValue
\param[in] dsize size of data array
\return 0 if setting the value failed
*/
-char Fl_Preferences::set( const char *key, const void *data, int dsize )
-{
+char Fl_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-- )
- {
+ for ( ; dsize>0; dsize-- ) {
static char lu[] = "0123456789abcdef";
unsigned char v = *s++;
*d++ = lu[v>>4];
@@ -902,20 +849,17 @@ char Fl_Preferences::set( const char *key, const void *data, int dsize )
return 1;
}
-
/**
Returns the size of the value part of an entry.
\param[in] key name of entry
\return size of value
*/
-int Fl_Preferences::size( const char *key )
-{
+int Fl_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.
@@ -943,8 +887,7 @@ int Fl_Preferences::size( const char *key )
\param[in] pathlen size of path buffer (should be at least \c FL_PATH_MAX)
\return 0 if path was not created or pathname can't fit into buffer
*/
-char Fl_Preferences::getUserdataPath( char *path, int pathlen )
-{
+char Fl_Preferences::getUserdataPath( char *path, int pathlen ) {
if ( rootNode )
return rootNode->getPath( path, pathlen );
return 0;
@@ -955,8 +898,7 @@ char Fl_Preferences::getUserdataPath( char *path, int pathlen )
the base preferences group. This function is rarely used as
deleting the base preferences flushes automatically.
*/
-void Fl_Preferences::flush()
-{
+void Fl_Preferences::flush() {
if ( rootNode && node->dirty() )
rootNode->write();
}
@@ -978,8 +920,7 @@ void Fl_Preferences::flush()
prev.get( Fl_Preferences::Name(i), prevFile[i], "" );
\endcode
*/
-Fl_Preferences::Name::Name( unsigned int n )
-{
+Fl_Preferences::Name::Name( unsigned int n ) {
data_ = (char*)malloc(20);
sprintf(data_, "%u", n);
}
@@ -997,8 +938,7 @@ Fl_Preferences::Name::Name( unsigned int n )
prev.get( Fl_Preferences::Name( "File%d", i ), prevFile[i], "" );
\endcode
*/
-Fl_Preferences::Name::Name( const char *format, ... )
-{
+Fl_Preferences::Name::Name( const char *format, ... ) {
data_ = (char*)malloc(1024);
va_list args;
va_start(args, format);
@@ -1007,8 +947,7 @@ Fl_Preferences::Name::Name( const char *format, ... )
}
// delete the name
-Fl_Preferences::Name::~Name()
-{
+Fl_Preferences::Name::~Name() {
if (data_) {
free(data_);
data_ = 0L;
@@ -1043,8 +982,7 @@ static char makePath( const char *path ) {
#if 0
// strip the filename and create a path
-static void makePathForFile( const char *path )
-{
+static void makePathForFile( const char *path ) {
const char *s = strrchr( path, '/' );
if ( !s ) return;
int len = s-path;
@@ -1062,8 +1000,8 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
: prefs_(prefs),
filename_(0L),
vendor_(0L),
- application_(0L)
-{
+ application_(0L) {
+
char filename[ FL_PATH_MAX ]; filename[0] = 0;
#ifdef WIN32
# define FLPREFS_RESOURCE "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
@@ -1075,41 +1013,32 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
switch (root) {
case SYSTEM:
-
- err = RegOpenKeyW( HKEY_LOCAL_MACHINE, FLPREFS_RESOURCEW, &key );
-
+ err = RegOpenKeyW( HKEY_LOCAL_MACHINE, FLPREFS_RESOURCEW, &key );
if (err == ERROR_SUCCESS) {
- nn = FL_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);
+ nn = FL_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 );
-
-
+ err = RegOpenKeyW( HKEY_CURRENT_USER, FLPREFS_RESOURCEW, &key );
if (err == ERROR_SUCCESS) {
- nn = FL_PATH_MAX - appDataLen;
- err = RegQueryValueExW( key, L"AppData", 0L, &type,
- (BYTE*)filename, &nn );
-
+ nn = FL_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;
+ filename[0] = 0;
+ filename[1] = 0;
}
RegCloseKey(key);
}
break;
- }
-
-
+ }
if (!filename[1] && !filename[0]) {
strcpy(filename, "C:\\FLTK");
} else {
@@ -1139,7 +1068,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
strcpy(filename, "/Library/Preferences");
break;
case USER:
- sprintf(filename, "%s/Library/Preferences", fl_getenv("HOME"));
+ sprintf(filename, "%s/Library/Preferences", fl_getenv("HOME"));
break;
}
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
@@ -1157,21 +1086,17 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
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
-
+#endif
filename_ = strdup(filename);
vendor_ = strdup(vendor);
- application_ = strdup(application);
-
+ application_ = strdup(application);
read();
}
@@ -1181,8 +1106,8 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, con
: prefs_(prefs),
filename_(0L),
vendor_(0L),
- application_(0L)
-{
+ application_(0L) {
+
if (!vendor)
vendor = "unknown";
if (!application) {
@@ -1194,8 +1119,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, const char *path, con
filename_ = strdup(filename);
}
vendor_ = strdup(vendor);
- application_ = strdup(application);
-
+ application_ = strdup(application);
read();
}
@@ -1205,13 +1129,11 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs )
: prefs_(prefs),
filename_(0L),
vendor_(0L),
- application_(0L)
-{
+ application_(0L) {
}
// destroy the root node and all depending nodes
-Fl_Preferences::RootNode::~RootNode()
-{
+Fl_Preferences::RootNode::~RootNode() {
if ( prefs_->node->dirty() )
write();
if ( filename_ ) {
@@ -1231,43 +1153,32 @@ Fl_Preferences::RootNode::~RootNode()
}
// read a preferences file and construct the group tree and with all entry leafs
-int Fl_Preferences::RootNode::read()
-{
+int Fl_Preferences::RootNode::read() {
if (!filename_) // RUNTIME preferences
- return -1;
-
+ return -1;
char buf[1024];
FILE *f = fl_fopen( filename_, "rb" );
if ( !f )
- return -1;
-
- fgets( buf, 1024, f );
- fgets( buf, 1024, f );
- fgets( buf, 1024, 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 (;;)
- {
+ for (;;) {
if ( !fgets( buf, 1024, f ) ) break; // EOF or Error
- if ( buf[0]=='[' ) // read a new group
- {
+ 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
+ } 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
- {
+ if ( end != 0 ) { // if entry is not empty
buf[ end+1 ] = 0;
nd->add( buf+1 );
}
- }
- else // read a name/value pair
- {
+ } else { // read a name/value pair
int end = strcspn( buf, "\n\r" );
- if ( end != 0 ) // if entry is not empty
- {
+ if ( end != 0 ) { // if entry is not empty
buf[ end ] = 0;
nd->set( buf );
}
@@ -1278,31 +1189,40 @@ int Fl_Preferences::RootNode::read()
}
// write the group tree and all entry leafs
-int Fl_Preferences::RootNode::write()
-{
+int Fl_Preferences::RootNode::write() {
if (!filename_) // RUNTIME preferences
- return -1;
-
+ return -1;
fl_make_path_for_file(filename_);
FILE *f = fl_fopen( filename_, "wb" );
if ( !f )
- return -1;
-
+ 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;
+ fl_chmod(filename_, 0755); // rwxr-xr-x
+ *p = '/';
+ p = strchr(p+1, '/');
+ } while (p);
+ fl_chmod(filename_, 0644); // rw-r--r--
+ }
+#endif
return 0;
}
// get the path to the preferences directory
-char Fl_Preferences::RootNode::getPath( char *path, int pathlen )
-{
+char Fl_Preferences::RootNode::getPath( char *path, int pathlen ) {
if (!filename_) // RUNTIME preferences
- return -1;
-
- strlcpy( path, filename_, pathlen);
+ return -1;
+ strlcpy( path, filename_, pathlen);
char *s;
for ( s = path; *s; s++ ) if ( *s == '\\' ) *s = '/';
@@ -1310,14 +1230,19 @@ char Fl_Preferences::RootNode::getPath( char *path, int pathlen )
if ( !s ) return 0;
*s = 0;
char ret = fl_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) {
+ fl_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.
-Fl_Preferences::Node::Node( const char *path )
-{
+Fl_Preferences::Node::Node( const char *path ) {
if ( path ) path_ = strdup( path ); else path_ = 0;
child_ = 0; next_ = 0; parent_ = 0;
entry_ = 0;
@@ -1329,11 +1254,9 @@ Fl_Preferences::Node::Node( const char *path )
nIndex_ = NIndex_ = 0;
}
-void Fl_Preferences::Node::deleteAllChildren()
-{
+void Fl_Preferences::Node::deleteAllChildren() {
Node *nx;
- for ( Node *nd = child_; nd; nd = nx )
- {
+ for ( Node *nd = child_; nd; nd = nx ) {
nx = nd->next_;
delete nd;
}
@@ -1342,12 +1265,9 @@ void Fl_Preferences::Node::deleteAllChildren()
updateIndex();
}
-void Fl_Preferences::Node::deleteAllEntries()
-{
- if ( entry_ )
- {
- for ( int i = 0; i < nEntry_; i++ )
- {
+void Fl_Preferences::Node::deleteAllEntries() {
+ if ( entry_ ) {
+ for ( int i = 0; i < nEntry_; i++ ) {
if ( entry_[i].name ) {
free( entry_[i].name );
entry_[i].name = 0L;
@@ -1366,8 +1286,7 @@ void Fl_Preferences::Node::deleteAllEntries()
}
// delete this and all depending nodes
-Fl_Preferences::Node::~Node()
-{
+Fl_Preferences::Node::~Node() {
deleteAllChildren();
deleteAllEntries();
deleteIndex();
@@ -1380,8 +1299,7 @@ Fl_Preferences::Node::~Node()
}
// recursively check if any entry is dirty (was changed after loading a fresh prefs file)
-char Fl_Preferences::Node::dirty()
-{
+char Fl_Preferences::Node::dirty() {
if ( dirty_ ) return 1;
if ( next_ && next_->dirty() ) return 1;
if ( child_ && child_->dirty() ) return 1;
@@ -1391,28 +1309,24 @@ char Fl_Preferences::Node::dirty()
// write this node (recursively from the last neighbor back to this)
// write all entries
// write all children
-int Fl_Preferences::Node::write( FILE *f )
-{
+int Fl_Preferences::Node::write( FILE *f ) {
if ( next_ ) next_->write( f );
fprintf( f, "\n[%s]\n\n", path_ );
- for ( int i = 0; i < nEntry_; i++ )
- {
+ for ( int i = 0; i < nEntry_; i++ ) {
char *src = entry_[i].value;
- if ( src )
- { // hack it into smaller pieces if needed
+ if ( src ) { // hack it into smaller pieces if needed
fprintf( f, "%s:", entry_[i].name );
- int cnt;
+ int cnt, written;
for ( cnt = 0; cnt < 60; cnt++ )
if ( src[cnt]==0 ) break;
- fwrite( src, cnt, 1, f );
+ written = fwrite( src, cnt, 1, f );
fprintf( f, "\n" );
src += cnt;
- for (;*src;)
- {
+ for (;*src;) {
for ( cnt = 0; cnt < 80; cnt++ )
if ( src[cnt]==0 ) break;
fputc( '+', f );
- fwrite( src, cnt, 1, f );
+ written = fwrite( src, cnt, 1, f );
fputc( '\n', f );
src += cnt;
}
@@ -1426,8 +1340,7 @@ int Fl_Preferences::Node::write( FILE *f )
}
// set the parent node and create the full path
-void Fl_Preferences::Node::setParent( Node *pn )
-{
+void Fl_Preferences::Node::setParent( Node *pn ) {
parent_ = pn;
next_ = pn->child_;
pn->child_ = this;
@@ -1437,21 +1350,18 @@ void Fl_Preferences::Node::setParent( Node *pn )
}
// find the corresponding root node
-Fl_Preferences::RootNode *Fl_Preferences::Node::findRoot()
-{
+Fl_Preferences::RootNode *Fl_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...)
-Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path )
-{
+Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path ) {
sprintf( nameBuffer, "%s/%s", path_, path );
char *name = strdup( nameBuffer );
Node *nd = find( name );
@@ -1464,13 +1374,10 @@ Fl_Preferences::Node *Fl_Preferences::Node::addChild( const char *path )
// create and set, or change an entry within this node
void Fl_Preferences::Node::set( const char *name, const char *value )
{
- for ( int i=0; i= sizeof( nameBuffer ) )
len = sizeof( nameBuffer );
strlcpy( nameBuffer, line, len );
set( nameBuffer, c+1 );
- }
- else
+ } else {
set( line, "" );
+ }
}
dirty_ = dirt;
}
// add more data to an existing entry
-void Fl_Preferences::Node::add( const char *line )
-{
+void Fl_Preferences::Node::add( const char *line ) {
if ( lastEntrySet<0 || lastEntrySet>=nEntry_ ) return;
char *&dst = entry_[ lastEntrySet ].value;
int a = strlen( dst );
@@ -1532,19 +1432,15 @@ void Fl_Preferences::Node::add( const char *line )
}
// get the value for a name, returns 0 if no such name
-const char *Fl_Preferences::Node::get( const char *name )
-{
+const char *Fl_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 Fl_Preferences::Node::getEntry( const char *name )
-{
- for ( int i=0; inext_ )
- {
+ for ( nd = child_; nd; nd = nd->next_ ) {
Node *nn = nd->find( path );
if ( nn ) return nn;
}
@@ -1598,23 +1489,15 @@ Fl_Preferences::Node *Fl_Preferences::Node::find( const char *path )
// - 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
-Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset )
-{
-
- if ( offset == 0 )
- {
- if ( path[0] == '.' )
- {
- if ( path[1] == 0 )
- {
+Fl_Preferences::Node *Fl_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] == '/' )
- {
+ } else if ( path[1] == '/' ) {
Node *nn = this;
while ( nn->parent() ) nn = nn->parent();
- if ( path[2]==0 )
- { // user is searching for root ( "./" )
+ 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
@@ -1622,18 +1505,14 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset
}
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 ) || ( 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_ )
- {
+ if ( len <= 0 || path[ len ] == '/' ) {
+ for ( Node *nd = child_; nd; nd = nd->next_ ) {
Node *nn = nd->search( path, offset );
if ( nn ) return nn;
}
@@ -1644,8 +1523,7 @@ Fl_Preferences::Node *Fl_Preferences::Node::search( const char *path, int offset
}
// return the number of child nodes (groups)
-int Fl_Preferences::Node::nChildren()
-{
+int Fl_Preferences::Node::nChildren() {
if (indexed_) {
return nIndex_;
} else {
@@ -1657,10 +1535,8 @@ int Fl_Preferences::Node::nChildren()
}
// return the node name
-const char *Fl_Preferences::Node::name()
-{
- if ( path_ )
- {
+const char *Fl_Preferences::Node::name() {
+ if ( path_ ) {
char *r = strrchr( path_, '/' );
return r ? r+1 : path_ ;
} else {
@@ -1669,8 +1545,7 @@ const char *Fl_Preferences::Node::name()
}
// return the n'th child node's name
-const char *Fl_Preferences::Node::child( int ix )
-{
+const char *Fl_Preferences::Node::child( int ix ) {
Node *nd = childNode( ix );
if ( nd )
return nd->name();
@@ -1679,8 +1554,7 @@ const char *Fl_Preferences::Node::child( int ix )
}
// return the n'th child node
-Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix )
-{
+Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix ) {
createIndex();
if (indexed_) {
// usually faster access in correct order, but needing more memory
@@ -1690,8 +1564,7 @@ Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix )
int n = nChildren();
ix = n - ix -1;
Node *nd;
- for ( nd = child_; nd; nd = nd->next_ )
- {
+ for ( nd = child_; nd; nd = nd->next_ ) {
if ( !ix-- ) break;
if ( !nd ) break;
}
@@ -1700,16 +1573,12 @@ Fl_Preferences::Node *Fl_Preferences::Node::childNode( int ix )
}
// remove myself from the list and delete me (and all children)
-char Fl_Preferences::Node::remove()
-{
+char Fl_Preferences::Node::remove() {
Node *nd = 0, *np;
- if ( parent() )
- {
+ if ( parent() ) {
nd = parent()->child_; np = 0L;
- for ( ; nd; np = nd, nd = nd->next_ )
- {
- if ( nd == this )
- {
+ for ( ; nd; np = nd, nd = nd->next_ ) {
+ if ( nd == this ) {
if ( np )
np->next_ = nd->next_;
else
@@ -1758,8 +1627,7 @@ void Fl_Preferences::Node::deleteIndex() {
* \param[in] name every plugin should have a unique name
*/
Fl_Plugin::Fl_Plugin(const char *klass, const char *name)
-: id(0)
-{
+: id(0) {
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: creating a plugin, class \"%s\", name \"%s\"\n",
klass, name);
@@ -1771,8 +1639,7 @@ Fl_Plugin::Fl_Plugin(const char *klass, const char *name)
/**
* \brief Clear the plugin and remove it from the database.
*/
-Fl_Plugin::~Fl_Plugin()
-{
+Fl_Plugin::~Fl_Plugin() {
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: deleting a plugin\n");
#endif
@@ -1780,13 +1647,11 @@ Fl_Plugin::~Fl_Plugin()
Fl_Plugin_Manager::remove(id);
}
-
/**
* \brief Manage all plugins belonging to one class.
*/
Fl_Plugin_Manager::Fl_Plugin_Manager(const char *klass)
-: Fl_Preferences(0, Fl_Preferences::Name("%s/%s", "plugins", klass))
-{
+: Fl_Preferences(0, Fl_Preferences::Name("%s/%s", "plugins", klass)) {
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: creating a plugin manager for class \"%s\"\n", klass);
#endif
@@ -1798,8 +1663,7 @@ Fl_Plugin_Manager::Fl_Plugin_Manager(const char *klass)
* Calling this does not remove the database itself or any plugins. It just
* removes the reference to the database.
*/
-Fl_Plugin_Manager::~Fl_Plugin_Manager()
-{
+Fl_Plugin_Manager::~Fl_Plugin_Manager() {
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: deleting a plugin manager\n");
#endif
@@ -1836,8 +1700,7 @@ static void p2a(void *vp, char *d) {
/**
* \brief Return the address of a plugin by index.
*/
-Fl_Plugin *Fl_Plugin_Manager::plugin(int index)
-{
+Fl_Plugin *Fl_Plugin_Manager::plugin(int index) {
char buf[34];
Fl_Plugin *ret = 0;
Fl_Preferences pin(this, index);
@@ -1852,8 +1715,7 @@ Fl_Plugin *Fl_Plugin_Manager::plugin(int index)
/**
* \brief Return the address of a plugin by name.
*/
-Fl_Plugin *Fl_Plugin_Manager::plugin(const char *name)
-{
+Fl_Plugin *Fl_Plugin_Manager::plugin(const char *name) {
char buf[34];
Fl_Plugin *ret = 0;
if (groupExists(name)) {
@@ -1878,8 +1740,7 @@ Fl_Plugin *Fl_Plugin_Manager::plugin(const char *name)
* There is no need to call this function explicitly. Every Fl_Plugin constructor
* will call this function at initialization time.
*/
-Fl_Preferences::ID Fl_Plugin_Manager::addPlugin(const char *name, Fl_Plugin *plugin)
-{
+Fl_Preferences::ID Fl_Plugin_Manager::addPlugin(const char *name, Fl_Plugin *plugin) {
char buf[34];
#ifdef FL_PLUGIN_VERBOSE
printf("Fl_Plugin: adding plugin named \"%s\" at 0x%p\n", name, plugin);
@@ -1896,8 +1757,7 @@ Fl_Preferences::ID Fl_Plugin_Manager::addPlugin(const char *name, Fl_Plugin *plu
* There is no need to call this function explicitly. Every Fl_Plugin destructor
* will call this function at destruction time.
*/
-void Fl_Plugin_Manager::removePlugin(Fl_Preferences::ID id)
-{
+void Fl_Plugin_Manager::removePlugin(Fl_Preferences::ID id) {
Fl_Preferences::remove(id);
}
@@ -1909,8 +1769,7 @@ void Fl_Plugin_Manager::removePlugin(Fl_Preferences::ID id)
* the constructor of all statically initialized Fl_Plugin classes and adds
* them to the database.
*/
-int Fl_Plugin_Manager::load(const char *filename)
-{
+int Fl_Plugin_Manager::load(const char *filename) {
// the functions below will autmaticaly load plugins that are defined:
// Fl_My_Plugin plugin();
#if defined(WIN32) && !defined(__CYGWIN__)
@@ -1925,8 +1784,7 @@ int Fl_Plugin_Manager::load(const char *filename)
/**
* \brief Use this function to load a whole directory full of modules.
*/
-int Fl_Plugin_Manager::loadAll(const char *filepath, const char *pattern)
-{
+int Fl_Plugin_Manager::loadAll(const char *filepath, const char *pattern) {
struct dirent **dir;
int i, n = fl_filename_list(filepath, &dir);
for (i=0; i
#ifdef __APPLE__
-#include
+//#include "Fl_Quartz_Printer.mm"
#elif defined(WIN32)
-#include
+#include "Fl_GDI_Printer.cxx"
#endif
-#include
+#include "Fl_PostScript.cxx"
// print dialog customization strings
/** [this text may be customized at run-time] */
@@ -76,9 +76,16 @@ const char *Fl_Printer::property_save = "Save";
/** [this text may be customized at run-time] */
const char *Fl_Printer::property_cancel = "Cancel";
-const char *Fl_Printer::device_type = "Fl_Printer";
+const char *Fl_Printer::class_id = "Fl_Printer";
+#if defined(__APPLE__) || defined(WIN32) || defined(FL_DOXYGEN)
+const char *Fl_System_Printer::class_id = Fl_Printer::class_id;
+#endif
+#if !( defined(__APPLE__) || defined(WIN32) )
+const char *Fl_PostScript_Printer::class_id = Fl_Printer::class_id;
+#endif
-void Fl_Printer::set_current()
+#if defined(__APPLE__) || defined(WIN32)
+void Fl_System_Printer::set_current(void)
{
#ifdef __APPLE__
fl_gc = (CGContextRef)gc;
@@ -88,6 +95,107 @@ void Fl_Printer::set_current()
this->Fl_Surface_Device::set_current();
}
+void Fl_System_Printer::origin(int *x, int *y)
+{
+ Fl_Paged_Device::origin(x, y);
+}
+
+#endif
+
+Fl_Printer::Fl_Printer(void) {
+#if defined(WIN32) || defined(__APPLE__)
+ printer = new Fl_System_Printer();
+#else
+ printer = new Fl_PostScript_Printer();
+#endif
+}
+
+int Fl_Printer::start_job(int pagecount, int *frompage, int *topage)
+{
+ return printer->start_job(pagecount, frompage, topage);
+}
+
+int Fl_Printer::start_page(void)
+{
+ return printer->start_page();
+}
+
+int Fl_Printer::printable_rect(int *w, int *h)
+{
+ return printer->printable_rect(w, h);
+}
+
+void Fl_Printer::margins(int *left, int *top, int *right, int *bottom)
+{
+ printer->margins(left, top, right, bottom);
+}
+
+void Fl_Printer::origin(int *x, int *y)
+{
+ printer->origin(x, y);
+}
+
+void Fl_Printer::origin(int x, int y)
+{
+ printer->origin(x, y);
+}
+
+void Fl_Printer::scale(float scale_x, float scale_y)
+{
+ printer->scale(scale_x, scale_y);
+}
+
+void Fl_Printer::rotate(float angle)
+{
+ printer->rotate(angle);
+}
+
+void Fl_Printer::translate(int x, int y)
+{
+ printer->translate(x, y);
+}
+
+void Fl_Printer::untranslate(void)
+{
+ printer->untranslate();
+}
+
+int Fl_Printer::end_page (void)
+{
+ return printer->end_page();
+}
+
+void Fl_Printer::end_job (void)
+{
+ printer->end_job();
+}
+
+void Fl_Printer::print_widget(Fl_Widget* widget, int delta_x, int delta_y)
+{
+ printer->print_widget(widget, delta_x, delta_y);
+}
+
+void Fl_Printer::print_window_part(Fl_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 Fl_Printer::set_current(void)
+{
+ printer->set_current();
+}
+
+Fl_Graphics_Driver* Fl_Printer::driver(void)
+{
+ return printer->driver();
+}
+
+Fl_Printer::~Fl_Printer(void)
+{
+ delete printer;
+}
+
+
//
-// End of "$Id: Fl_Printer.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: Fl_Printer.cxx 8565 2011-04-06 13:43:09Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
index d7dee6885..192b38da7 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Progress.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Progress.cxx 6794 2009-06-27 09:29:36Z AlbrechtS $"
+// "$Id: Fl_Progress.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Progress bar widget routines.
//
-// Copyright 2000-2009 by Michael Sweet.
+// 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
@@ -119,5 +119,5 @@ Fl_Progress::Fl_Progress(int X, int Y, int W, int H, const char* L)
//
-// End of "$Id: Fl_Progress.cxx 6794 2009-06-27 09:29:36Z AlbrechtS $".
+// End of "$Id: Fl_Progress.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
index cff903a8f..65ed3eff1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Repeat_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Repeat_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Repeat_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Repeat button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -66,5 +66,5 @@ int Fl_Repeat_Button::handle(int event) {
}
//
-// End of "$Id: Fl_Repeat_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Repeat_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
index 3ab21cbe7..42db04788 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Return_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Return_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Return_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Return button widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -61,6 +61,7 @@ void Fl_Return_Button::draw() {
int Fl_Return_Button::handle(int event) {
if (event == FL_SHORTCUT &&
(Fl::event_key() == FL_Enter || Fl::event_key() == FL_KP_Enter)) {
+ simulate_key_action();
do_callback();
return 1;
} else
@@ -68,5 +69,5 @@ int Fl_Return_Button::handle(int event) {
}
//
-// End of "$Id: Fl_Return_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Return_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
index 7efc3472d..8cfbf17e3 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Roller.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Roller.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Roller.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Roller widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -181,5 +181,5 @@ Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
}
//
-// End of "$Id: Fl_Roller.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Roller.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
index 7ca8e40d4..f97207690 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Round_Button.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Round_Button.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Round_Button.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Round button for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -44,5 +44,5 @@ Fl_Round_Button::Fl_Round_Button(int X,int Y,int W,int H, const char *l)
}
//
-// End of "$Id: Fl_Round_Button.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Round_Button.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
index 4ac025ca6..d93b43b6c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Scroll.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scroll.cxx 7039 2010-02-07 21:14:35Z AlbrechtS $"
+// "$Id: Fl_Scroll.cxx 8591 2011-04-14 13:21:12Z manolo $"
//
// Scroll widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -32,13 +32,16 @@
/** Clear all but the scrollbars... */
void Fl_Scroll::clear() {
- for (int i=children() - 1; i >= 0; i --) {
- Fl_Widget* o = child(i);
- if (o != &hscrollbar && o != &scrollbar) {
- remove(o);
- delete o;
- }
- }
+ // Note: the scrollbars are removed from the group before calling
+ // Fl_Group::clear() to take advantage of the optimized widget removal
+ // and deletion. Finally they are added to Fl_Scroll's group again. This
+ // is MUCH faster than removing the widgets one by one (STR #2409).
+
+ remove(scrollbar);
+ remove(hscrollbar);
+ Fl_Group::clear();
+ add(hscrollbar);
+ add(scrollbar);
}
/** Insure the scrollbars are the last children */
@@ -345,9 +348,9 @@ void Fl_Scroll::resize(int X, int Y, int W, int H) {
o->position(o->x()+dx, o->y()+dy);
}
if (dw==0 && dh==0) {
- char pad = (scrollbar.visible() && hscrollbar.visible());
- char al = (scrollbar.align()&FL_ALIGN_LEFT!=0);
- char at = (scrollbar.align()&FL_ALIGN_TOP!=0);
+ char pad = ( scrollbar.visible() && hscrollbar.visible() );
+ char al = ( (scrollbar.align() & FL_ALIGN_LEFT) != 0 );
+ char at = ( (scrollbar.align() & FL_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 {
@@ -388,7 +391,7 @@ void Fl_Scroll::scrollbar_cb(Fl_Widget* o, void*) {
The destructor also deletes all the children. 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
- Fl_Scroll and all of it's children can be automatic (local)
+ Fl_Scroll and all of its children can be automatic (local)
variables, but you must declare the Fl_Scrollfirst, so
that it is destroyed last.
*/
@@ -413,5 +416,5 @@ int Fl_Scroll::handle(int event) {
}
//
-// End of "$Id: Fl_Scroll.cxx 7039 2010-02-07 21:14:35Z AlbrechtS $".
+// End of "$Id: Fl_Scroll.cxx 8591 2011-04-14 13:21:12Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
index 40c298c9b..263e6642e 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Scrollbar.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Scrollbar.cxx 7161 2010-02-26 20:44:35Z matt $"
+// "$Id: Fl_Scrollbar.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -288,5 +288,5 @@ Fl_Scrollbar::~Fl_Scrollbar() {
//
-// End of "$Id: Fl_Scrollbar.cxx 7161 2010-02-26 20:44:35Z matt $".
+// End of "$Id: Fl_Scrollbar.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
index b32c572f1..13598a9e2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Shared_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Shared_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Shared_Image.cxx 8306 2011-01-24 17:04:22Z matt $"
//
// Shared image code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -228,7 +228,7 @@ void Fl_Shared_Image::reload() {
if (!name_) return;
if ((fp = fl_fopen(name_, "rb")) != NULL) {
- fread(header, 1, sizeof(header), fp);
+ if (fread(header, 1, sizeof(header), fp)==0) { /* ignore */ }
fclose(fp);
} else {
return;
@@ -374,11 +374,24 @@ Fl_Shared_Image* Fl_Shared_Image::find(const char *n, int W, int H) {
/**
- 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.
+ \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 Fl_Shared_Image::find(const char *n, int W, int H)
+ \see Fl_Shared_Image::release()
+ \see Fl_JPEG_Image::Fl_JPEG_Image(const char *name, const unsigned char *data)
+ \see Fl_PNG_Image::Fl_PNG_Image (const char *name_png, const unsigned char *buffer, int maxsize)
*/
Fl_Shared_Image* Fl_Shared_Image::get(const char *n, int W, int H) {
Fl_Shared_Image *temp; // Image
@@ -459,5 +472,5 @@ void Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) {
//
-// End of "$Id: Fl_Shared_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Shared_Image.cxx 8306 2011-01-24 17:04:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
index e83a94709..054b76dd2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Single_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Single_Window.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Single_Window.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Single-buffered window for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,5 +37,5 @@ void Fl_Single_Window::show() {Fl_Window::show();}
void Fl_Single_Window::flush() {Fl_Window::flush();}
//
-// End of "$Id: Fl_Single_Window.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Single_Window.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
index 59474df07..341589b79 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Slider.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Slider.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $"
+// "$Id: Fl_Slider.cxx 8726 2011-05-23 18:32:47Z AlbrechtS $"
//
// Slider widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -31,6 +31,10 @@
#include
#include "flstring.h"
+#if defined(FL_DLL) // really needed for c'tors for MS VC++ only
+#include
+#endif
+
void Fl_Slider::_Fl_Slider() {
slider_size_ = 0;
slider_ = 0; // FL_UP_BOX;
@@ -364,6 +368,25 @@ int Fl_Slider::handle(int event) {
h()-Fl::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)
+
+Fl_Hor_Slider::Fl_Hor_Slider(int X,int Y,int W,int H,const char *l)
+ : Fl_Slider(X,Y,W,H,l) {type(FL_HOR_SLIDER);}
+
+#endif // FL_DLL
+
//
-// End of "$Id: Fl_Slider.cxx 7115 2010-02-20 17:40:07Z AlbrechtS $".
+// End of "$Id: Fl_Slider.cxx 8726 2011-05-23 18:32:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Table.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Table.cxx
index 8f743d178..dc6f26338 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Table.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Table.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Table.cxx 7117 2010-02-20 21:14:47Z matt $"
+// "$Id: Fl_Table.cxx 7950 2010-12-05 01:22:53Z greg.ercolano $"
//
// Fl_Table -- A table widget
//
@@ -424,14 +424,13 @@ void Fl_Table::_auto_drag_cb() {
if (lx > x() + w() - 20) {
Fl::e_x = x() + w() - 20;
if (hscrollbar->visible())
- ((Fl_Slider*)hscrollbar)->value(
- hscrollbar->clamp(hscrollbar->value() + 30));
+ ((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() + 30));
hscrollbar->do_callback();
_dragging_x = Fl::e_x - 30;
}
else if (lx < (x() + row_header_width())) {
Fl::e_x = x() + row_header_width() + 1;
- if (hscrollbar->visible()) {
+ if (hscrollbar->visible()) {
((Fl_Slider*)hscrollbar)->value(hscrollbar->clamp(hscrollbar->value() - 30));
}
hscrollbar->do_callback();
@@ -514,7 +513,7 @@ void Fl_Table::table_scrolled() {
if ( y > voff ) { y -= row_height(row); break; }
}
_row_position = toprow = ( row >= _rows ) ? (row - 1) : row;
- toprow_scrollpos = y; // OPTIMIZATION: save for later use
+ toprow_scrollpos = y; // OPTIMIZATION: save for later use
// Find bottom row
voff = vscrollbar->value() + tih;
for ( ; row < _rows; row++ ) {
@@ -990,6 +989,13 @@ int Fl_Table::handle(int event) {
case FL_Down:
ret = move_cursor(1, 0);
break;
+ case FL_Tab:
+ if ( Fl::event_state() & FL_SHIFT ) {
+ ret = move_cursor(0, -1); // shift-tab -> left
+ } else {
+ ret = move_cursor(0, 1); // tab -> right
+ }
+ break;
}
if (ret && Fl::focus() != this) {
do_callback(CONTEXT_TABLE, -1, -1);
@@ -1034,6 +1040,10 @@ void Fl_Table::_redraw_cell(TableContext context, int r, int c) {
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 Fl_Table::is_selected(int r, int c) {
int s_left, s_right, s_top, s_bottom;
@@ -1057,29 +1067,48 @@ int Fl_Table::is_selected(int r, int c) {
return 0;
}
-void Fl_Table::get_selection(int& s_top, int& s_left, int& s_bottom, int& s_right) {
+/**
+ 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 Fl_Table::get_selection(int& row_top, int& col_left, int& row_bot, int& col_right) {
if (select_col > current_col) {
- s_left = current_col;
- s_right = select_col;
+ col_left = current_col;
+ col_right = select_col;
} else {
- s_right = current_col;
- s_left = select_col;
+ col_right = current_col;
+ col_left = select_col;
}
if (select_row > current_row) {
- s_top = current_row;
- s_bottom = select_row;
+ row_top = current_row;
+ row_bot = select_row;
} else {
- s_bottom = current_row;
- s_top = select_row;
+ row_bot = current_row;
+ row_top = select_row;
}
}
-void Fl_Table::set_selection(int s_top, int s_left, int s_bottom, int s_right) {
+/**
+ 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 Fl_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 = s_left;
- current_row = s_top;
- select_col = s_right;
- select_row = s_bottom;
+ 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);
}
@@ -1220,5 +1249,5 @@ void Fl_Table::draw() {
}
//
-// End of "$Id: Fl_Table.cxx 7117 2010-02-20 21:14:47Z matt $".
+// End of "$Id: Fl_Table.cxx 7950 2010-12-05 01:22:53Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Table_Row.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Table_Row.cxx
index 82b1ef64e..6e24bba0a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Table_Row.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Table_Row.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Table_Row.cxx 6943 2009-11-18 12:43:21Z AlbrechtS $"
+// "$Id: Fl_Table_Row.cxx 7950 2010-12-05 01:22:53Z greg.ercolano $"
//
// Fl_Table_Row -- A row oriented table widget
//
@@ -45,16 +45,14 @@ int Fl_Table_Row::row_selected(int row) {
void Fl_Table_Row::type(TableRowSelectMode val) {
_selectmode = val;
switch ( _selectmode ) {
- case SELECT_NONE:
- {
+ case SELECT_NONE: {
for ( int row=0; row -1 ) {
int srow = R, erow = _last_row;
@@ -234,8 +228,7 @@ int Fl_Table_Row::handle(int event) {
}
break;
- case FL_DRAG:
- {
+ case FL_DRAG: {
if ( _dragging_select ) {
// Dragged off table edges? Handle scrolling
int offtop = toy - _last_y; // >0 if off top of table
@@ -319,5 +312,5 @@ int Fl_Table_Row::handle(int event) {
}
//
-// End of "$Id: Fl_Table_Row.cxx 6943 2009-11-18 12:43:21Z AlbrechtS $".
+// End of "$Id: Fl_Table_Row.cxx 7950 2010-12-05 01:22:53Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
index bb5e54b20..14f309b6b 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tabs.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tabs.cxx 7162 2010-02-26 21:10:46Z matt $"
+// "$Id: Fl_Tabs.cxx 8658 2011-05-12 15:53:59Z manolo $"
//
// Tab widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,61 +40,76 @@
#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 position are actually of the left
+// 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 Fl_Tabs::tab_positions(int* p, int* wp) {
+int Fl_Tabs::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;
Fl_Widget*const* a = array();
int i;
char prev_draw_shortcut = fl_draw_shortcut;
fl_draw_shortcut = 1;
- p[0] = Fl::box_dx(box());
- for (i=0; ivisible()) selected = i;
int wt = 0; int ht = 0;
o->measure_label(wt,ht);
- wp[i] = wt+EXTRASPACE;
- p[i+1] = p[i]+wp[i]+BORDER;
+ tab_width[i] = wt + EXTRASPACE;
+ tab_pos[i+1] = tab_pos[i] + tab_width[i] + BORDER;
}
fl_draw_shortcut = prev_draw_shortcut;
int r = w();
- if (p[i] <= r) return selected;
+ if (tab_pos[i] <= r) return selected;
// uh oh, they are too big:
// pack them against right edge:
- p[i] = r;
- for (i = children(); i--;) {
- int l = r-wp[i];
- if (p[i+1] < l) l = p[i+1];
- if (p[i] <= l) break;
- p[i] = l;
+ 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= i*EXTRASPACE) break;
- p[i] = i*EXTRASPACE;
- int W = w()-1-EXTRASPACE*(children()-i) - p[i];
- if (wp[i] > W) wp[i] = W;
+ for (i = 0; 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 = children(); i > selected; i--) {
- p[i] = p[i-1]+wp[i-1];
+ for (i = nc; i > selected; i--) {
+ tab_pos[i] = tab_pos[i-1] + tab_width[i-1];
}
return selected;
}
-// return space needed for tabs. Negative to put them on the bottom:
+// Returns space (height) in pixels needed for tabs. Negative to put them on the bottom.
+// Returns full height, if children() = 0.
int Fl_Tabs::tab_height() {
+ if (children() == 0) return h();
int H = h();
int H2 = y();
Fl_Widget*const* a = array();
@@ -108,8 +123,10 @@ int Fl_Tabs::tab_height() {
else return (H <= 0) ? 0 : H;
}
-// this is used by fluid to pick tabs:
+// 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.
Fl_Widget *Fl_Tabs::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;
@@ -117,12 +134,16 @@ Fl_Widget *Fl_Tabs::which(int event_x, int event_y) {
if (event_y > y()+H || event_y < y()) return 0;
}
if (event_x < x()) return 0;
- int p[128], wp[128];
- tab_positions(p, wp);
- for (int i=0; ivisible() || o && !o->visible())
+ if ( (push_ && !push_->visible()) || (o && !o->visible()) )
redraw_tabs();
push_ = o;
return 1;
@@ -303,14 +325,11 @@ void Fl_Tabs::draw() {
draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H), c);
if (selection_color() != c) {
- // Draw the top 5 lines of the tab pane in the selection color so
- // that the user knows which tab is selected...
- if (H >= 0) fl_push_clip(x(), y() + H, w(), 5);
- else fl_push_clip(x(), y() + h() - H - 4, w(), 5);
-
- draw_box(box(), x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H),
- selection_color());
-
+ // 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;
+ fl_push_clip(x(), clip_y, w(), SELECTION_BORDER);
+ draw_box(box(), x(), clip_y, w(), SELECTION_BORDER, selection_color());
fl_pop_clip();
}
if (v) draw_child(*v);
@@ -318,17 +337,20 @@ void Fl_Tabs::draw() {
if (v) update_child(*v);
}
if (damage() & (FL_DAMAGE_SCROLL|FL_DAMAGE_ALL)) {
- int p[128]; int wp[128];
- int selected = tab_positions(p,wp);
+ int nc = children();
+ int selected = tab_positions();
int i;
Fl_Widget*const* a = array();
for (i=0; i selected; i--)
- draw_tab(x()+p[i], x()+p[i+1], wp[i], H, a[i], RIGHT);
+ 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()+p[i], x()+p[i+1], wp[i], H, a[i], SELECTED);
+ draw_tab(x()+tab_pos[i], x()+tab_pos[i+1],
+ tab_width[i], H, a[i], SELECTED);
}
}
}
@@ -405,13 +427,17 @@ void Fl_Tabs::draw_tab(int x1, int x2, int W, int H, Fl_Widget* o, int what) {
Creates a new Fl_Tabs widget using the given position, size,
and label string. The default boxtype is FL_THIN_UP_BOX.
- Use add(Fl_Widget
- *) to add each child, which are usually
+ Use add(Fl_Widget*) to add each child, which are usually
Fl_Group widgets. The children should be sized to stay
away from the top or bottom edge of the Fl_Tabs widget,
which is where the tabs will be drawn.
-
The destructor also deletes all the children. This
+ All children of Fl_Tabs 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 Fl_Tabs is set to
+ "resizable()", the riders will not resize when the tabs are resized.
+
+ The destructor also deletes all the children. 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 Fl_Tabs and all of its children
@@ -423,8 +449,83 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
{
box(FL_THIN_UP_BOX);
push_ = 0;
+ tab_pos = 0;
+ tab_width = 0;
+ tab_count = 0;
+}
+
+Fl_Tabs::~Fl_Tabs() {
+ 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 Fl_Tabs' 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 Fl_Tabs::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 = fl_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 Fl_Tabs::clear_tab_positions() {
+ if (tab_pos) {
+ free(tab_pos);
+ tab_pos = 0;
+ }
+ if (tab_width){
+ free(tab_width);
+ tab_width = 0;
+ }
}
//
-// End of "$Id: Fl_Tabs.cxx 7162 2010-02-26 21:10:46Z matt $".
+// End of "$Id: Fl_Tabs.cxx 8658 2011-05-12 15:53:59Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
index 6e244a006..9714f51e5 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Buffer.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Buffer.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Text_Buffer.cxx 8040 2010-12-15 17:38:39Z manolo $"
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -32,91 +32,36 @@
#include
#include
#include
+#include
+
/*
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 nice widget
- for FLTK.
+ 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 monspaced fonts only, many
- features make les sense in the multibyte and multiwdth world of UTF-8.
-
- Columns are a good example. There is simply no such thing.
-
- Rectangular selections pose a real problem.
-
- Using multiple spaces to emulate tab stops will no longer work.
-
- And constantly recalculating character widths is just much too expensive.
-
- But nevertheless, we will get ths widget rolling again ;-)
-
+ 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.
*/
-/*
- \todo unicode check
- */
-static void insertColInLine(const char *line, char *insLine, int column,
- int insWidth, int tabDist, int useTabs,
- char *outStr, int *outLen,
- int *endOffset);
-
-/*
- \todo unicode check
- */
-static void deleteRectFromLine(const char *line, int rectStart,
- int rectEnd, int tabDist, int useTabs,
- char *outStr,
- int *outLen, int *endOffset);
-
-/*
- \todo unicode check
- */
-static void overlayRectInLine(const char *line, char *insLine,
- int rectStart, int rectEnd, int tabDist,
- int useTabs, char *outStr,
- int *outLen, int *endOffset);
-
-/*
- \todo unicode check
- */
-static void addPadding(char *string, int startIndent, int toIndent,
- int tabDist, int useTabs, int *charsAdded);
-
-/*
- \todo unicode check
- */
-static char *copyLine(const char *text, int *lineLen);
-
-/*
- unicode tested
- */
-static int countLines(const char *string);
-
-/*
- \todo unicode check
- */
-static int textWidth(const char *text, int tabDist);
-
-/*
- \todo unicode check
- */
-static char *realignTabs(const char *text, int origIndent, int newIndent,
- int tabDist, int useTabs, int *newLength);
-
-/*
- \todo unicode check
- */
-static char *expandTabs(const char *text, int startIndent, int tabDist, int *newLen);
-
-/*
- \todo unicode check
- */
-static char *unexpandTabs(char *text, int startIndent, int tabDist, int *newLen);
-
#ifndef min
static int max(int i1, int i2)
@@ -131,12 +76,6 @@ static int min(int i1, int i2)
#endif
-static const char *ControlCodeTable[32] = {
- "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
- "bs", "ht", "nl", "vt", "np", "cr", "so", "si",
- "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb",
- "can", "em", "sub", "esc", "fs", "gs", "rs", "us"
-};
static char *undobuffer;
static int undobufferlength;
@@ -146,6 +85,9 @@ 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) {
@@ -161,8 +103,14 @@ static void undobuffersize(int n)
}
}
+static void def_transcoding_warning_action(Fl_Text_Buffer *text)
+{
+ fl_alert("%s", text->file_encoding_warning_message);
+}
-// unicode ok
+/*
+ Initialize all variables.
+ */
Fl_Text_Buffer::Fl_Text_Buffer(int requestedSize, int preferredGapSize)
{
mLength = 0;
@@ -171,16 +119,12 @@ Fl_Text_Buffer::Fl_Text_Buffer(int requestedSize, int preferredGapSize)
mGapStart = 0;
mGapEnd = mPreferredGapSize;
mTabDist = 8;
- mUseTabs = 1;
mPrimary.mSelected = 0;
- mPrimary.mRectangular = 0;
mPrimary.mStart = mPrimary.mEnd = 0;
mSecondary.mSelected = 0;
mSecondary.mStart = mSecondary.mEnd = 0;
- mSecondary.mRectangular = 0;
mHighlight.mSelected = 0;
mHighlight.mStart = mHighlight.mEnd = 0;
- mHighlight.mRectangular = 0;
mModifyProcs = NULL;
mCbArgs = NULL;
mNModifyProcs = 0;
@@ -189,17 +133,14 @@ Fl_Text_Buffer::Fl_Text_Buffer(int requestedSize, int preferredGapSize)
mPredeleteCbArgs = NULL;
mCursorPosHint = 0;
mCanUndo = 1;
-#ifdef PURIFY
- {
- int i;
- for (i = mGapStart; i < mGapEnd; i++)
- mBuf[i] = '.';
- }
-#endif
+ input_file_was_transcoded = 0;
+ transcoding_warning_action = def_transcoding_warning_action;
}
-// unicode ok
+/*
+ Free all resources.
+ */
Fl_Text_Buffer::~Fl_Text_Buffer()
{
free(mBuf);
@@ -214,21 +155,26 @@ Fl_Text_Buffer::~Fl_Text_Buffer()
}
-// This function copies verbose whatever is in front and after the gap into a
-// single buffer.
-// - unicode ok
+/*
+ This function copies verbose whatever is in front and after the gap into a
+ single buffer.
+ */
char *Fl_Text_Buffer::text() const {
char *t = (char *) malloc(mLength + 1);
memcpy(t, mBuf, mGapStart);
- memcpy(&t[mGapStart], &mBuf[mGapEnd], mLength - mGapStart);
+ memcpy(t+mGapStart, mBuf+mGapEnd, mLength - mGapStart);
t[mLength] = '\0';
return t;
}
-// unicode ok, functions called have not been verified yet
+/*
+ Set the text buffer to a new string.
+ */
void Fl_Text_Buffer::text(const char *t)
{
+ IS_UTF8_ALIGNED(t)
+
call_predelete_callbacks(0, length());
/* Save information for redisplay, and get rid of the old buffer */
@@ -243,13 +189,6 @@ void Fl_Text_Buffer::text(const char *t)
mGapStart = insertedLength;
mGapEnd = mGapStart + mPreferredGapSize;
memcpy(mBuf, t, insertedLength);
-#ifdef PURIFY
- {
- int i;
- for (i = mGapStart; i < mGapEnd; i++)
- mBuf[i] = '.';
- }
-#endif
/* Zero all of the existing selections */
update_selections(0, deletedLength, 0);
@@ -260,9 +199,13 @@ void Fl_Text_Buffer::text(const char *t)
}
-// Creates a new buffer and copies verbose from around the gap.
-// - unicode ok
+/*
+ Creates a range of text to a new buffer and copies verbose from around the gap.
+ */
char *Fl_Text_Buffer::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.
@@ -285,32 +228,58 @@ char *Fl_Text_Buffer::text_range(int start, int end) const {
/* Copy the text from the buffer to the returned string */
if (end <= mGapStart) {
- memcpy(s, &mBuf[start], copiedLength);
+ memcpy(s, mBuf + start, copiedLength);
} else if (start >= mGapStart) {
- memcpy(s, &mBuf[start + (mGapEnd - mGapStart)], copiedLength);
+ memcpy(s, mBuf + start + (mGapEnd - mGapStart), copiedLength);
} else {
int part1Length = mGapStart - start;
- memcpy(s, &mBuf[start], part1Length);
- memcpy(&s[part1Length], &mBuf[mGapEnd], copiedLength - part1Length);
+ memcpy(s, mBuf + start, part1Length);
+ memcpy(s + part1Length, mBuf + mGapEnd, copiedLength - part1Length);
}
s[copiedLength] = '\0';
return s;
}
-
-// TODO: we will need the same signature function to get bytes (style buffer)
-// unicode ok
-unsigned int Fl_Text_Buffer::character(int pos) const {
+/*
+ Return a UCS-4 character at the given index.
+ Pos must be at a character boundary.
+ */
+unsigned int Fl_Text_Buffer::char_at(int pos) const {
if (pos < 0 || pos >= mLength)
return '\0';
+
+ IS_UTF8_ALIGNED2(this, (pos))
+
const char *src = address(pos);
return fl_utf8decode(src, 0, 0);
}
-// unicode ok, dependents not tested
+/*
+ Return the raw byte at the given index.
+ This function ignores all unicode encoding.
+ */
+char Fl_Text_Buffer::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 Fl_Text_Buffer::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;
@@ -323,11 +292,15 @@ void Fl_Text_Buffer::insert(int pos, const char *text)
/* insert and redisplay */
int nInserted = insert_(pos, text);
mCursorPosHint = pos + nInserted;
+ IS_UTF8_ALIGNED2(this, (mCursorPosHint))
call_modify_callbacks(pos, 0, nInserted, 0, NULL);
}
-// unicode ok, dependents not tested
+/*
+ Replace a range of text with new text.
+ Start and end must be at a character boundary.
+*/
void Fl_Text_Buffer::replace(int start, int end, const char *text)
{
// Range check...
@@ -337,6 +310,10 @@ void Fl_Text_Buffer::replace(int start, int end, const char *text)
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);
@@ -348,7 +325,10 @@ void Fl_Text_Buffer::replace(int start, int end, const char *text)
}
-// unicode ok, dependents not tested
+/*
+ Remove a range of text.
+ Start and End must be at a character boundary.
+*/
void Fl_Text_Buffer::remove(int start, int end)
{
/* Make sure the arguments make sense */
@@ -365,6 +345,9 @@ void Fl_Text_Buffer::remove(int start, int end)
end = mLength;
if (end < 0)
end = 0;
+
+ IS_UTF8_ALIGNED2(this, (start))
+ IS_UTF8_ALIGNED2(this, (end))
if (start == end)
return;
@@ -378,9 +361,18 @@ void Fl_Text_Buffer::remove(int start, int end)
free((void *) deletedText);
}
+
+/*
+ Copy a range of text from another text buffer.
+ fromStart, fromEnd, and toPos must be at a character boundary.
+ */
void Fl_Text_Buffer::copy(Fl_Text_Buffer * 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
@@ -398,8 +390,7 @@ void Fl_Text_Buffer::copy(Fl_Text_Buffer * fromBuf, int fromStart,
memcpy(&mBuf[toPos], &fromBuf->mBuf[fromStart], copiedLength);
} else if (fromStart >= fromBuf->mGapStart) {
memcpy(&mBuf[toPos],
- &fromBuf->mBuf[fromStart +
- (fromBuf->mGapEnd - fromBuf->mGapStart)],
+ &fromBuf->mBuf[fromStart + (fromBuf->mGapEnd - fromBuf->mGapStart)],
copiedLength);
} else {
int part1Length = fromBuf->mGapStart - fromStart;
@@ -412,9 +403,15 @@ void Fl_Text_Buffer::copy(Fl_Text_Buffer * fromBuf, int fromStart,
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 Fl_Text_Buffer::undo(int *cursorPos)
{
- if (undowidget != this || !undocut && !undoinsert && !mCanUndo)
+ if (undowidget != this || (!undocut && !undoinsert && !mCanUndo))
return 0;
int ilen = undocut;
@@ -450,181 +447,25 @@ int Fl_Text_Buffer::undo(int *cursorPos)
}
-// unicode ok
+/*
+ Set a flag if undo function will work.
+ */
void Fl_Text_Buffer::canUndo(char flag)
{
mCanUndo = flag;
+ // disabling undo also clears the last undo operation!
+ if (!mCanUndo && undowidget==this)
+ undowidget = 0;
}
-void Fl_Text_Buffer::insert_column(int column, int startPos,
- const char *text, int *charsInserted,
- int *charsDeleted)
-{
- int nLines = countLines(text);
- int lineStartPos = line_start(startPos);
- int nDeleted = line_end(skip_lines(startPos, nLines)) - lineStartPos;
- call_predelete_callbacks(lineStartPos, nDeleted);
- const char *deletedText =
- text_range(lineStartPos, lineStartPos + nDeleted);
- int insertDeleted, nInserted;
- insert_column_(column, lineStartPos, text, &insertDeleted, &nInserted,
- &mCursorPosHint);
- if (nDeleted != insertDeleted)
- Fl::error
- ("Fl_Text_Buffer::insert_column(): internal consistency check ins1 failed");
- call_modify_callbacks(lineStartPos, nDeleted, nInserted, 0, deletedText);
- free((void *) deletedText);
- if (charsInserted != NULL)
- *charsInserted = nInserted;
- if (charsDeleted != NULL)
- *charsDeleted = nDeleted;
-}
-
-void Fl_Text_Buffer::overlay_rectangular(int startPos, int rectStart,
- int rectEnd, const char *text,
- int *charsInserted,
- int *charsDeleted)
-{
-
- int nLines = countLines(text);
- int lineStartPos = line_start(startPos);
- int nDeleted = line_end(skip_lines(startPos, nLines)) - lineStartPos;
- call_predelete_callbacks(lineStartPos, nDeleted);
- const char *deletedText =
- text_range(lineStartPos, lineStartPos + nDeleted);
- int insertDeleted, nInserted;
- overlay_rectangular_(lineStartPos, rectStart, rectEnd, text,
- &insertDeleted, &nInserted, &mCursorPosHint);
- if (nDeleted != insertDeleted)
- Fl::error
- ("Fl_Text_Buffer::overlay_rectangle(): internal consistency check ovly1 failed");
- call_modify_callbacks(lineStartPos, nDeleted, nInserted, 0, deletedText);
- free((void *) deletedText);
- if (charsInserted != NULL)
- *charsInserted = nInserted;
- if (charsDeleted != NULL)
- *charsDeleted = nDeleted;
-}
-
-void Fl_Text_Buffer::replace_rectangular(int start, int end, int rectStart,
- int rectEnd, const char *text)
-{
- char *insText = (char *) "";
- int linesPadded = 0;
-
- /* Make sure start and end refer to complete lines, since the
- columnar delete and insert operations will replace whole lines */
- start = line_start(start);
- end = line_end(end);
-
- call_predelete_callbacks(start, end - start);
-
- /* If more lines will be deleted than inserted, pad the inserted text
- with newlines to make it as long as the number of deleted lines. This
- will indent all of the text to the right of the rectangle to the same
- column. If more lines will be inserted than deleted, insert extra
- lines in the buffer at the end of the rectangle to make room for the
- additional lines in "text" */
- int nInsertedLines = countLines(text);
- int nDeletedLines = count_lines(start, end);
- if (nInsertedLines < nDeletedLines) {
- int insLen = strlen(text);
- insText = (char *) malloc(insLen + nDeletedLines - nInsertedLines + 1);
- strcpy(insText, text);
- char *insPtr = insText + insLen;
- for (int i = 0; i < nDeletedLines - nInsertedLines; i++)
- *insPtr++ = '\n';
- *insPtr = '\0';
- } else if (nDeletedLines < nInsertedLines) {
- linesPadded = nInsertedLines - nDeletedLines;
- for (int i = 0; i < linesPadded; i++)
- insert_(end, "\n");
- }
-
- /* else nDeletedLines == nInsertedLines; */
- /* Save a copy of the text which will be modified for the modify CBs */
- const char *deletedText = text_range(start, end);
-
- /* Delete then insert */
- int insertDeleted, insertInserted, deleteInserted, hint;
- remove_rectangular_(start, end, rectStart, rectEnd, &deleteInserted,
- &hint);
- insert_column_(rectStart, start, insText, &insertDeleted,
- &insertInserted, &mCursorPosHint);
-
- /* Figure out how many chars were inserted and call modify callbacks */
- if (insertDeleted != deleteInserted + linesPadded)
- Fl::error
- ("Fl_Text_Buffer::replace_rectangular(): internal consistency check repl1 failed");
- call_modify_callbacks(start, end - start, insertInserted, 0,
- deletedText);
- free((void *) deletedText);
- if (nInsertedLines < nDeletedLines)
- free((void *) insText);
-}
-
-void Fl_Text_Buffer::remove_rectangular(int start, int end, int rectStart,
- int rectEnd)
-{
-
- start = line_start(start);
- end = line_end(end);
- call_predelete_callbacks(start, end - start);
- const char *deletedText = text_range(start, end);
- int nInserted;
- remove_rectangular_(start, end, rectStart, rectEnd, &nInserted,
- &mCursorPosHint);
- call_modify_callbacks(start, end - start, nInserted, 0, deletedText);
- free((void *) deletedText);
-}
-
-void Fl_Text_Buffer::clear_rectangular(int start, int end, int rectStart,
- int rectEnd)
-{
- int nLines = count_lines(start, end);
- char *newlineString = (char *) malloc(nLines + 1);
- int i;
- for (i = 0; i < nLines; i++)
- newlineString[i] = '\n';
- newlineString[i] = '\0';
- overlay_rectangular(start, rectStart, rectEnd, newlineString,
- NULL, NULL);
- free((void *) newlineString);
-}
-
-char *Fl_Text_Buffer::text_in_rectangle(int start, int end,
- int rectStart,
- int rectEnd) const {
- start = line_start(start);
- end = line_end(end);
- char *textOut = (char *) malloc((end - start) + 1);
- int lineStart = start;
- char *outPtr = textOut;
- int selLeft, selRight;
- while (lineStart <= end)
- {
- rectangular_selection_boundaries(lineStart, rectStart, rectEnd,
- &selLeft, &selRight);
- const char *textIn = text_range(selLeft, selRight);
- int len = selRight - selLeft;
- memcpy(outPtr, textIn, len);
- free((void *) textIn);
- outPtr += len;
- lineStart = line_end(selRight) + 1;
- *outPtr++ = '\n';
- } if (outPtr != textOut)
- outPtr--; /* don't leave trailing newline */
- *outPtr = '\0';
-
- /* If necessary, realign the tabs in the selection as if the text were
- positioned at the left margin */
- int len;
- char *retabbedStr = realignTabs(textOut, rectStart, 0, mTabDist,
- mUseTabs, &len);
- free((void *) textOut);
- return retabbedStr;
-}
+/*
+ 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 Fl_Text_Buffer::tab_distance(int tabDist)
{
/* First call the pre-delete callbacks with the previous tab setting
@@ -641,14 +482,26 @@ void Fl_Text_Buffer::tab_distance(int tabDist)
free((void *) deletedText);
}
+
+/*
+ Select a range of text.
+ Start and End must be at a character boundary.
+ */
void Fl_Text_Buffer::select(int start, int end)
{
+ IS_UTF8_ALIGNED2(this, (start))
+ IS_UTF8_ALIGNED2(this, (end))
+
Fl_Text_Selection oldSelection = mPrimary;
mPrimary.set(start, end);
redisplay_selection(&oldSelection, &mPrimary);
}
+
+/*
+ Clear the primary selection.
+ */
void Fl_Text_Buffer::unselect()
{
Fl_Text_Selection oldSelection = mPrimary;
@@ -657,42 +510,47 @@ void Fl_Text_Buffer::unselect()
redisplay_selection(&oldSelection, &mPrimary);
}
-void Fl_Text_Buffer::select_rectangular(int start, int end, int rectStart,
- int rectEnd)
-{
- Fl_Text_Selection oldSelection = mPrimary;
- mPrimary.set_rectangular(start, end, rectStart, rectEnd);
- redisplay_selection(&oldSelection, &mPrimary);
-}
-
+/*
+ Return the primary selection range.
+ */
int Fl_Text_Buffer::selection_position(int *start, int *end)
{
return mPrimary.position(start, end);
}
-int Fl_Text_Buffer::selection_position(int *start, int *end,
- int *isRect, int *rectStart,
- int *rectEnd)
-{
- return mPrimary.position(start, end, isRect, rectStart, rectEnd);
-}
+/*
+ Return a copy of the selected text.
+ */
char *Fl_Text_Buffer::selection_text()
{
return selection_text_(&mPrimary);
}
+
+/*
+ Remove the selected text.
+ */
void Fl_Text_Buffer::remove_selection()
{
remove_selection_(&mPrimary);
}
+
+/*
+ Replace the selected text.
+ */
void Fl_Text_Buffer::replace_selection(const char *text)
{
replace_selection_(&mPrimary, text);
}
+
+/*
+ Select text.
+ Start and End must be at a character boundary.
+ */
void Fl_Text_Buffer::secondary_select(int start, int end)
{
Fl_Text_Selection oldSelection = mSecondary;
@@ -701,6 +559,10 @@ void Fl_Text_Buffer::secondary_select(int start, int end)
redisplay_selection(&oldSelection, &mSecondary);
}
+
+/*
+ Deselect text.
+ */
void Fl_Text_Buffer::secondary_unselect()
{
Fl_Text_Selection oldSelection = mSecondary;
@@ -709,44 +571,47 @@ void Fl_Text_Buffer::secondary_unselect()
redisplay_selection(&oldSelection, &mSecondary);
}
-void Fl_Text_Buffer::secondary_select_rectangular(int start, int end,
- int rectStart,
- int rectEnd)
-{
- Fl_Text_Selection oldSelection = mSecondary;
- mSecondary.set_rectangular(start, end, rectStart, rectEnd);
- redisplay_selection(&oldSelection, &mSecondary);
-}
-
+/*
+ Return the selected range.
+ */
int Fl_Text_Buffer::secondary_selection_position(int *start, int *end)
{
return mSecondary.position(start, end);
}
-int Fl_Text_Buffer::secondary_selection_position(int *start, int *end,
- int *isRect,
- int *rectStart,
- int *rectEnd)
-{
- return mSecondary.position(start, end, isRect, rectStart, rectEnd);
-}
+/*
+ Return a copy of the text in this selection.
+ */
char *Fl_Text_Buffer::secondary_selection_text()
{
return selection_text_(&mSecondary);
}
+
+/*
+ Remove the selected text.
+ */
void Fl_Text_Buffer::remove_secondary_selection()
{
remove_selection_(&mSecondary);
}
+
+/*
+ Replace selected text.
+ */
void Fl_Text_Buffer::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 Fl_Text_Buffer::highlight(int start, int end)
{
Fl_Text_Selection oldSelection = mHighlight;
@@ -755,6 +620,10 @@ void Fl_Text_Buffer::highlight(int start, int end)
redisplay_selection(&oldSelection, &mHighlight);
}
+
+/*
+ Remove text highlighting.
+ */
void Fl_Text_Buffer::unhighlight()
{
Fl_Text_Selection oldSelection = mHighlight;
@@ -763,32 +632,28 @@ void Fl_Text_Buffer::unhighlight()
redisplay_selection(&oldSelection, &mHighlight);
}
-void Fl_Text_Buffer::highlight_rectangular(int start, int end,
- int rectStart, int rectEnd)
-{
- Fl_Text_Selection oldSelection = mHighlight;
- mHighlight.set_rectangular(start, end, rectStart, rectEnd);
- redisplay_selection(&oldSelection, &mHighlight);
-}
-
+/*
+ Return position of highlight.
+ */
int Fl_Text_Buffer::highlight_position(int *start, int *end)
{
return mHighlight.position(start, end);
}
-int Fl_Text_Buffer::highlight_position(int *start, int *end,
- int *isRect, int *rectStart,
- int *rectEnd)
-{
- return mHighlight.position(start, end, isRect, rectStart, rectEnd);
-}
+/*
+ Return a copy of highlighted text.
+ */
char *Fl_Text_Buffer::highlight_text()
{
return selection_text_(&mHighlight);
}
+
+/*
+ Add a callback that is called whenever text is modified.
+ */
void Fl_Text_Buffer::add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB,
void *cbArg)
{
@@ -810,8 +675,12 @@ void Fl_Text_Buffer::add_modify_callback(Fl_Text_Modify_Cb bufModifiedCB,
mCbArgs = newCBArgs;
}
-void Fl_Text_Buffer::
-remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void *cbArg)
+
+/*
+ Remove a callback.
+ */
+void Fl_Text_Buffer::remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB,
+ void *cbArg)
{
int i, toRemove = -1;
@@ -857,8 +726,12 @@ remove_modify_callback(Fl_Text_Modify_Cb bufModifiedCB, void *cbArg)
mCbArgs = newCBArgs;
}
-void Fl_Text_Buffer::
-add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg)
+
+/*
+ Add a callback that is called before deleting text.
+ */
+void Fl_Text_Buffer::add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB,
+ void *cbArg)
{
Fl_Text_Predelete_Cb *newPreDeleteProcs =
new Fl_Text_Predelete_Cb[mNPredeleteProcs + 1];
@@ -878,8 +751,11 @@ add_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg)
mPredeleteCbArgs = newCBArgs;
}
-void Fl_Text_Buffer::
-remove_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg)
+
+/*
+ Remove a callback.
+ */
+void Fl_Text_Buffer::remove_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg)
{
int i, toRemove = -1;
/* find the matching callback to remove */
@@ -926,170 +802,116 @@ remove_predelete_callback(Fl_Text_Predelete_Cb bufPreDeleteCB, void *cbArg)
mPredeleteCbArgs = newCBArgs;
}
+
+/*
+ Return a copy of the line that contains a given index.
+ Pos must be at a character boundary.
+ */
char *Fl_Text_Buffer::line_text(int pos) const {
return text_range(line_start(pos), line_end(pos));
}
-int Fl_Text_Buffer::line_start(int pos) const {
+
+/*
+ Find the beginning of the line.
+ */
+int Fl_Text_Buffer::line_start(int pos) const
+{
if (!findchar_backward(pos, '\n', &pos))
return 0;
return pos + 1;
}
+
+/*
+ Find the end of the line.
+ */
int Fl_Text_Buffer::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 Fl_Text_Buffer::word_start(int pos) const {
// FIXME: character is ucs-4
- while (pos && (isalnum(character(pos)) || character(pos) == '_')) {
- pos--;
+ while (pos>0 && (isalnum(char_at(pos)) || char_at(pos) == '_')) {
+ pos = prev_char(pos);
}
// FIXME: character is ucs-4
- if (!(isalnum(character(pos)) || character(pos) == '_'))
- pos++;
+ if (!(isalnum(char_at(pos)) || char_at(pos) == '_'))
+ pos = next_char(pos);
return pos;
}
+
+/*
+ Find the end of a word.
+ NOT UNICODE SAFE.
+ */
int Fl_Text_Buffer::word_end(int pos) const {
// FIXME: character is ucs-4
- while (pos < length() && (isalnum(character(pos)) || character(pos) == '_'))
+ while (pos < length() && (isalnum(char_at(pos)) || char_at(pos) == '_'))
{
- pos++;
- } return pos;
+ pos = next_char(pos);
+ }
+ return pos;
}
-// Expand from the byte representation into some readable text.
-// Under unicode, this is not really needed because all characters should
-// be prinatble one way or the other. But since we use this to (badly) simulate
-// tabs, we can leave this here anyway.
-// - unicode ok
-int Fl_Text_Buffer::expand_character(int pos, int indent, char *outStr) const {
- const char *src = address(pos);
- return expand_character(src, indent, outStr, mTabDist);
-}
-
-
-// static function and counterpart to "character_width"
-// - unicode ok
-// FIXME: harmonise with new character_width(char*...) version
-//
-int Fl_Text_Buffer::expand_character(const char *src, int indent, char *outStr, int tabDist)
-{
- char c = *src;
- /* Convert tabs to spaces */
- if (c == '\t') {
- int nSpaces = tabDist - (indent % tabDist);
- for (int i = 0; i < nSpaces; i++)
- outStr[i] = ' ';
- return nSpaces;
- }
-
- /* Convert control codes to readable character sequences */
- if (((unsigned char) c) <= 31) {
- sprintf(outStr, "<%s>", ControlCodeTable[(unsigned char) c]);
- return strlen(outStr);
- } else if (c == 127) {
- sprintf(outStr, "");
- return 5;
- } else if ((c & 0x80) && !(c & 0x40)) {
-#ifdef DEBUG
- fprintf(stderr, "%s:%d - Error in UTF-8 encoding!\n", __FILE__, __LINE__);
-#endif
- *outStr = c;
- return 1;
- } else if (c & 0x80) {
- int i, n = fl_utf8len(c);
- for (i=0; i %d (%d, %d, %s)\n", ucs, width, len, ret, src);
- return width;
- }
- if ((c & 0x80) && !(c & 0x40)) { // other byte of UTF-8 sequence
- return 0;
- }
- return character_width(c, indent, tabDist);
-}
-
-// FIXME: merge the following with the char* version above.
-// but the question then is: how to reorganise expand_character()?
-//
-int Fl_Text_Buffer::character_width(const char c, int indent, int tabDist)
-{
- /* Note, this code must parallel that in Fl_Text_Buffer::ExpandCharacter */
- if (c == '\t') {
- return tabDist - (indent % tabDist);
- } else if (((unsigned char) c) <= 31) {
- return strlen(ControlCodeTable[(unsigned char) c]) + 2;
- } else if (c == 127) {
- return 5;
- } else if ((c & 0x80) && !(c & 0x40)) {
-#ifdef DEBUG
- fprintf(stderr, "%s:%d - Error in UTF-8 encoding!\n", __FILE__, __LINE__);
-#endif
- return 1;
- } else if (c & 0x80) {
- // return fl_utf8len(c);
- return 1;
- }
- return 1;
-}
-
+/*
+ Count the number of characters between two positions.
+ */
int Fl_Text_Buffer::count_displayed_characters(int lineStartPos,
int targetPos) const
{
+ IS_UTF8_ALIGNED2(this, (lineStartPos))
+ IS_UTF8_ALIGNED2(this, (targetPos))
+
int charCount = 0;
- char expandedChar[FL_TEXT_MAX_EXP_CHAR_LEN];
int pos = lineStartPos;
- while (pos < targetPos)
- charCount += expand_character(pos++, charCount, expandedChar);
+ while (pos < targetPos) {
+ pos = next_char(pos);
+ charCount++;
+ }
return charCount;
}
-// All values are number of bytes.
-// - unicode ok
+/*
+ Skip ahead a number of characters from a given index.
+ This function breaks early if it encounters a newline character.
+ */
int Fl_Text_Buffer::skip_displayed_characters(int lineStartPos, int nChars)
{
+ IS_UTF8_ALIGNED2(this, (lineStartPos))
+
int pos = lineStartPos;
- for (int charCount = 0; charCount < nChars && pos < mLength;) {
- const char *src = address(pos);
- char c = *src;
+ for (int charCount = 0; charCount < nChars && pos < mLength; charCount++) {
+ unsigned int c = char_at(pos);
if (c == '\n')
return pos;
- charCount += character_width(src, charCount, mTabDist);
- pos += fl_utf8len(c);
+ 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 Fl_Text_Buffer::count_lines(int startPos, int endPos) const {
+ IS_UTF8_ALIGNED2(this, (startPos))
+ IS_UTF8_ALIGNED2(this, (endPos))
+
int gapLen = mGapEnd - mGapStart;
int lineCount = 0;
@@ -1100,7 +922,8 @@ int Fl_Text_Buffer::count_lines(int startPos, int endPos) const {
return lineCount;
if (mBuf[pos++] == '\n')
lineCount++;
- } while (pos < mLength) {
+ }
+ while (pos < mLength) {
if (pos == endPos)
return lineCount;
if (mBuf[pos++ + gapLen] == '\n')
@@ -1109,8 +932,16 @@ int Fl_Text_Buffer::count_lines(int startPos, int endPos) const {
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 Fl_Text_Buffer::skip_lines(int startPos, int nLines)
{
+ IS_UTF8_ALIGNED2(this, (startPos))
+
if (nLines == 0)
return startPos;
@@ -1120,22 +951,35 @@ int Fl_Text_Buffer::skip_lines(int startPos, int nLines)
while (pos < mGapStart) {
if (mBuf[pos++] == '\n') {
lineCount++;
- if (lineCount == nLines)
+ if (lineCount == nLines) {
+ IS_UTF8_ALIGNED2(this, (pos))
return pos;
+ }
}
}
while (pos < mLength) {
if (mBuf[pos++ + gapLen] == '\n') {
lineCount++;
- if (lineCount >= nLines)
+ 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 Fl_Text_Buffer::rewind_lines(int startPos, int nLines)
{
+ IS_UTF8_ALIGNED2(this, (startPos))
+
int pos = startPos - 1;
if (pos <= 0)
return 0;
@@ -1144,136 +988,144 @@ int Fl_Text_Buffer::rewind_lines(int startPos, int nLines)
int lineCount = -1;
while (pos >= mGapStart) {
if (mBuf[pos + gapLen] == '\n') {
- if (++lineCount >= nLines)
+ if (++lineCount >= nLines) {
+ IS_UTF8_ALIGNED2(this, (pos+1))
return pos + 1;
+ }
}
pos--;
}
while (pos >= 0) {
if (mBuf[pos] == '\n') {
- if (++lineCount >= nLines)
+ if (++lineCount >= nLines) {
+ IS_UTF8_ALIGNED2(this, (pos+1))
return pos + 1;
+ }
}
pos--;
}
return 0;
}
+
+/*
+ Find a matching string in the buffer.
+ */
int Fl_Text_Buffer::search_forward(int startPos, const char *searchString,
- int *foundPos,
- int matchCase) const
+ int *foundPos, int matchCase) const
{
+ IS_UTF8_ALIGNED2(this, (startPos))
+ IS_UTF8_ALIGNED(searchString)
+
if (!searchString)
return 0;
int bp;
const char *sp;
- while (startPos < length()) {
- bp = startPos;
- sp = searchString;
- do {
- if (!*sp) {
- *foundPos = startPos;
- return 1;
+ 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 = fl_utf8len1(c);
+ if (memcmp(sp, address(bp), l))
+ break;
+ sp += l; bp += l;
}
- // FIXME: character is ucs-4
- } while ((matchCase ? character(bp++) == *sp++ :
- toupper(character(bp++)) == toupper(*sp++))
- && bp < length());
- startPos++;
- }
+ 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 = fl_utf8decode(sp, 0, &l);
+ if (fl_tolower(b)!=fl_tolower(s))
+ break;
+ sp += l;
+ bp = next_char(bp);
+ }
+ startPos = next_char(startPos);
+ }
+ }
return 0;
}
int Fl_Text_Buffer::search_backward(int startPos, const char *searchString,
- int *foundPos,
- int matchCase) const {
+ int *foundPos, int matchCase) const
+{
+ IS_UTF8_ALIGNED2(this, (startPos))
+ IS_UTF8_ALIGNED(searchString)
+
if (!searchString)
return 0;
int bp;
const char *sp;
- while (startPos > 0)
- {
- bp = startPos - 1;
- sp = searchString + strlen(searchString) - 1;
- do {
- if (sp < searchString) {
- *foundPos = bp + 1;
- return 1;
+ 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 = fl_utf8len1(c);
+ if (memcmp(sp, address(bp), l))
+ break;
+ sp += l; bp += l;
}
- // FIXME: character is ucs-4
- } while ((matchCase ? character(bp--) == *sp-- :
- toupper(character(bp--)) == toupper(*sp--))
- && bp >= 0);
- startPos--;
- }
+ 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 = fl_utf8decode(sp, 0, &l);
+ if (fl_tolower(b)!=fl_tolower(s))
+ break;
+ sp += l;
+ bp = next_char(bp);
+ }
+ startPos = prev_char(startPos);
+ }
+ }
return 0;
}
-int Fl_Text_Buffer::findchars_forward(int startPos,
- const char *searchChars,
- int *foundPos) const {
- int gapLen = mGapEnd - mGapStart;
- const char *c;
-
- int pos = startPos;
- while (pos < mGapStart)
- {
- for (c = searchChars; *c != '\0'; c++) {
- if (mBuf[pos] == *c) {
- *foundPos = pos;
- return 1;
- }
- } pos++;
- }
- while (pos < mLength) {
- for (c = searchChars; *c != '\0'; c++) {
- if (mBuf[pos + gapLen] == *c) {
- *foundPos = pos;
- return 1;
- }
- }
- pos++;
- }
- *foundPos = mLength;
- return 0;
-}
-int Fl_Text_Buffer::findchars_backward(int startPos,
- const char *searchChars,
- int *foundPos) const {
- int gapLen = mGapEnd - mGapStart;
- const char *c;
-
- if (startPos == 0)
- {
- *foundPos = 0;
- return 0;
- }
- int pos = startPos == 0 ? 0 : startPos - 1;
- while (pos >= mGapStart) {
- for (c = searchChars; *c != '\0'; c++) {
- if (mBuf[pos + gapLen] == *c) {
- *foundPos = pos;
- return 1;
- }
- }
- pos--;
- }
- while (pos >= 0) {
- for (c = searchChars; *c != '\0'; c++) {
- if (mBuf[pos] == *c) {
- *foundPos = pos;
- return 1;
- }
- }
- pos--;
- }
- *foundPos = 0;
- return 0;
-}
+/*
+ Insert a string into the buffer.
+ Pos must be at a character boundary. Text must be a correct UTF-8 string.
+ */
int Fl_Text_Buffer::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
@@ -1307,6 +1159,11 @@ int Fl_Text_Buffer::insert_(int pos, const char *text)
return insertedLength;
}
+
+/*
+ Remove a string from the buffer.
+ Unicode safe. Start and end must be at a character boundary.
+ */
void Fl_Text_Buffer::remove_(int start, int end)
{
/* if the gap is not contiguous to the area to remove, move it there */
@@ -1354,458 +1211,23 @@ void Fl_Text_Buffer::remove_(int start, int end)
update_selections(start, end - start, 0);
}
-void Fl_Text_Buffer::insert_column_(int column, int startPos,
- const char *insText, int *nDeleted,
- int *nInserted, int *endPos)
-{
- if (column < 0)
- column = 0;
- /* Allocate a buffer for the replacement string large enough to hold
- possibly expanded tabs in both the inserted text and the replaced
- area, as well as per line: 1) an additional 2*FL_TEXT_MAX_EXP_CHAR_LEN
- characters for padding where tabs and control characters cross the
- column of the selection, 2) up to "column" additional spaces per
- line for padding out to the position of "column", 3) padding up
- to the width of the inserted text if that must be padded to align
- the text beyond the inserted column. (Space for additional
- newlines if the inserted text extends beyond the end of the buffer
- is counted with the length of insText) */
- int start = line_start(startPos);
- int nLines = countLines(insText) + 1;
- int insWidth = textWidth(insText, mTabDist); // this function probably returns a useless value
- int end = line_end(skip_lines(start, nLines - 1));
- int expReplLen, expInsLen, len, endOffset;
- const char *replText = text_range(start, end);
- char *expText = expandTabs(replText, 0, mTabDist, &expReplLen);
- free((void *) replText);
- free((void *) expText);
- expText = expandTabs(insText, 0, mTabDist, &expInsLen);
- free((void *) expText);
- char *outStr = (char *) malloc(expReplLen + expInsLen +
- nLines * (column + insWidth +
- FL_TEXT_MAX_EXP_CHAR_LEN) + 1);
-
- /* Loop over all lines in the buffer between start and end removing the
- text between rectStart and rectEnd and padding appropriately. Trim
- trailing space from line (whitespace at the ends of lines otherwise
- tends to multiply, since additional padding is added to maintain it */
- char *outPtr = outStr, *insLine;
- const char *insPtr = insText, *line;
- for (int lineStart = start, lineEnd;;) {
- lineEnd = line_end(lineStart);
- line = text_range(lineStart, lineEnd);
- insLine = copyLine(insPtr, &len);
- insPtr += len;
- insertColInLine(line, insLine, column, insWidth, mTabDist,
- mUseTabs, outPtr, &len, &endOffset);
- free((void *) line);
- free((void *) insLine);
- for (const char *c = outPtr + len - 1; c > outPtr && isspace(*c); c--)
- len--;
- outPtr += len;
- *outPtr++ = '\n';
- lineStart = lineEnd < mLength ? lineEnd + 1 : mLength;
- if (*insPtr == '\0')
- break;
- insPtr++;
- }
- if (outPtr != outStr)
- outPtr--; /* trim back off extra newline */
- *outPtr = '\0';
-
- /* replace the text between start and end with the new stuff */
- remove_(start, end);
- insert_(start, outStr);
- *nInserted = outPtr - outStr;
- *nDeleted = end - start;
- *endPos = start + (outPtr - outStr) - len + endOffset;
- free((void *) outStr);
-}
-
-void Fl_Text_Buffer::remove_rectangular_(int start, int end, int rectStart,
- int rectEnd, int *replaceLen,
- int *endPos)
-{
- /* allocate a buffer for the replacement string large enough to hold
- possibly expanded tabs as well as an additional FL_TEXT_MAX_EXP_CHAR_LEN * 2
- characters per line for padding where tabs and control characters cross
- the edges of the selection */
- start = line_start(start);
- end = line_end(end);
- int nLines = count_lines(start, end) + 1;
- const char *s = text_range(start, end);
- int len;
- char *expText = expandTabs(s, 0, mTabDist, &len);
- free((void *) s);
- free((void *) expText);
- char *outStr =
- (char *) malloc(len + nLines * FL_TEXT_MAX_EXP_CHAR_LEN * 2 + 1);
-
- /* loop over all lines in the buffer between start and end removing
- the text between rectStart and rectEnd and padding appropriately */
- int endOffset = 0;
- char *outPtr = outStr;
- const char *line;
- for (int lineStart = start, lineEnd;
- lineStart <= mLength && lineStart <= end;) {
- lineEnd = line_end(lineStart);
- line = text_range(lineStart, lineEnd);
- deleteRectFromLine(line, rectStart, rectEnd, mTabDist,
- mUseTabs, outPtr, &len, &endOffset);
- free((void *) line);
- outPtr += len;
- *outPtr++ = '\n';
- lineStart = lineEnd + 1;
- }
- if (outPtr != outStr)
- outPtr--; /* trim back off extra newline */
- *outPtr = '\0';
-
- /* replace the text between start and end with the newly created string */
- remove_(start, end);
- insert_(start, outStr);
- *replaceLen = outPtr - outStr;
- *endPos = start + (outPtr - outStr) - len + endOffset;
- free((void *) outStr);
-}
-
-void Fl_Text_Buffer::overlay_rectangular_(int startPos, int rectStart,
- int rectEnd, const char *insText,
- int *nDeleted, int *nInserted,
- int *endPos)
-{
-
- /* Allocate a buffer for the replacement string large enough to hold
- possibly expanded tabs in the inserted text, as well as per line: 1)
- an additional 2*FL_TEXT_MAX_EXP_CHAR_LEN characters for padding where tabs
- and control characters cross the column of the selection, 2) up to
- "column" additional spaces per line for padding out to the position
- of "column", 3) padding up to the width of the inserted text if that
- must be padded to align the text beyond the inserted column. (Space
- for additional newlines if the inserted text extends beyond the end
- of the buffer is counted with the length of insText) */
- int start = line_start(startPos);
- int nLines = countLines(insText) + 1;
- int end = line_end(skip_lines(start, nLines - 1)), expInsLen;
- char *expText = expandTabs(insText, 0, mTabDist, &expInsLen);
- free((void *) expText);
- char *outStr = (char *) malloc(end - start + expInsLen +
- nLines * (rectEnd +
- FL_TEXT_MAX_EXP_CHAR_LEN) + 1);
-
- /* Loop over all lines in the buffer between start and end overlaying the
- text between rectStart and rectEnd and padding appropriately. Trim
- trailing space from line (whitespace at the ends of lines otherwise
- tends to multiply, since additional padding is added to maintain it */
- int len, endOffset;
- char *outPtr = outStr, *insLine;
- const char *insPtr = insText, *line;
- for (int lineStart = start, lineEnd;;) {
- lineEnd = line_end(lineStart);
- line = text_range(lineStart, lineEnd);
- insLine = copyLine(insPtr, &len);
- insPtr += len;
- overlayRectInLine(line, insLine, rectStart, rectEnd, mTabDist,
- mUseTabs, outPtr, &len, &endOffset);
- free((void *) line);
- free((void *) insLine);
- for (const char *c = outPtr + len - 1; c > outPtr && isspace(*c); c--)
- len--;
- outPtr += len;
- *outPtr++ = '\n';
- lineStart = lineEnd < mLength ? lineEnd + 1 : mLength;
- if (*insPtr == '\0')
- break;
- insPtr++;
- }
- if (outPtr != outStr)
- outPtr--; /* trim back off extra newline */
- *outPtr = '\0';
-
- /* replace the text between start and end with the new stuff */
- remove_(start, end);
- insert_(start, outStr);
- *nInserted = outPtr - outStr;
- *nDeleted = end - start;
- *endPos = start + (outPtr - outStr) - len + endOffset;
- free((void *) outStr);
-}
-
/*
- Inserts characters from single-line string \p insLine in single-line string
- \p line at \p column, leaving \p insWidth space before continuing line.
- \p outLen returns the number of characters written to \p outStr, \p endOffset
- returns the number of characters from the beginning of the string to
- the right edge of the inserted text (as a hint for routines which need
- to position the cursor).
+ simple setter.
+ Unicode safe. Start and end must be at a character boundary.
*/
-static void insertColInLine(const char *line, char *insLine, int column,
- int insWidth, int tabDist, int useTabs,
- char *outStr, int *outLen,
- int *endOffset)
-{
- /* copy the line up to "column" */
- char *outPtr = outStr;
- int indent = 0, len;
- const char *linePtr;
-
- for (linePtr = line; *linePtr != '\0'; linePtr++) {
- len = Fl_Text_Buffer::character_width(linePtr, indent, tabDist);
- if (indent + len > column)
- break;
- indent += len;
- *outPtr++ = *linePtr;
- }
-
- /* If "column" falls in the middle of a character, and the character is a
- tab, leave it off and leave the indent short and it will get padded
- later. If it's a control character, insert it and adjust indent
- accordingly. */
- int postColIndent;
- if (indent < column && *linePtr != '\0') {
- postColIndent = indent + len;
- if (*linePtr == '\t')
- linePtr++;
- else {
- *outPtr++ = *linePtr++;
- indent += len;
- }
- } else
- postColIndent = indent;
-
- /* If there's no text after the column and no text to insert, that's all */
- if (*insLine == '\0' && *linePtr == '\0') {
- *outLen = *endOffset = outPtr - outStr;
- return;
- }
-
- /* pad out to column if text is too short */
- if (indent < column) {
- addPadding(outPtr, indent, column, tabDist, useTabs, &len);
- outPtr += len;
- indent = column;
- }
-
- /* Copy the text from "insLine" (if any), recalculating the tabs as if
- the inserted string began at column 0 to its new column destination */
- if (*insLine != '\0') {
- char *retabbedStr = realignTabs(insLine, 0, indent, tabDist, useTabs,
- &len);
- for (const char *c = retabbedStr; *c != '\0'; c++) {
- *outPtr++ = *c;
- len = Fl_Text_Buffer::character_width(c, indent, tabDist);
- indent += len;
- }
- free((void *) retabbedStr);
- }
-
- /* If the original line did not extend past "column", that's all */
- if (*linePtr == '\0') {
- *outLen = *endOffset = outPtr - outStr;
- return;
- }
-
- /* Pad out to column + width of inserted text + (additional original
- offset due to non-breaking character at column) */
- int toIndent = column + insWidth + postColIndent - column;
- addPadding(outPtr, indent, toIndent, tabDist, useTabs, &len);
- outPtr += len;
- indent = toIndent;
-
- /* realign tabs for text beyond "column" and write it out */
- char *retabbedStr = realignTabs(linePtr, postColIndent, indent, tabDist,
- useTabs, &len);
- strcpy(outPtr, retabbedStr);
- free((void *) retabbedStr);
- *endOffset = outPtr - outStr;
- *outLen = (outPtr - outStr) + len;
-}
-
-/**
- Removes characters in single-line string \p line between displayed positions
- \p rectStart and \p rectEnd, and write the result to \p outStr, which is
- assumed to be large enough to hold the returned string. Note that in
- certain cases, it is possible for the string to get longer due to
- expansion of tabs. \p endOffset returns the number of characters from
- the beginning of the string to the point where the characters were
- deleted (as a hint for routines which need to position the cursor).
- */
-static void deleteRectFromLine(const char *line, int rectStart,
- int rectEnd, int tabDist, int useTabs,
- char *outStr,
- int *outLen, int *endOffset)
-{
-
- /* copy the line up to rectStart */
- char *outPtr = outStr;
- int indent = 0, len;
- const char *c;
- for (c = line; *c != '\0'; c++) {
- if (indent > rectStart)
- break;
- len = Fl_Text_Buffer::character_width(c, indent, tabDist);
- if (indent + len > rectStart && (indent == rectStart || *c == '\t'))
- break;
- indent += len;
- *outPtr++ = *c;
- }
- int preRectIndent = indent;
-
- /* skip the characters between rectStart and rectEnd */
- for (; *c != '\0' && indent < rectEnd; c++)
- indent += Fl_Text_Buffer::character_width(c, indent, tabDist);
- int postRectIndent = indent;
-
- /* If the line ended before rectEnd, there's nothing more to do */
- if (*c == '\0') {
- *outPtr = '\0';
- *outLen = *endOffset = outPtr - outStr;
- return;
- }
-
- /* fill in any space left by removed tabs or control characters
- which straddled the boundaries */
- indent = max(rectStart + postRectIndent - rectEnd, preRectIndent);
- addPadding(outPtr, preRectIndent, indent, tabDist, useTabs, &len);
- outPtr += len;
-
- /* Copy the rest of the line. If the indentation has changed, preserve
- the position of non-whitespace characters by converting tabs to
- spaces, then back to tabs with the correct offset */
- char *retabbedStr =
- realignTabs(c, postRectIndent, indent, tabDist, useTabs, &len);
- strcpy(outPtr, retabbedStr);
- free((void *) retabbedStr);
- *endOffset = outPtr - outStr;
- *outLen = (outPtr - outStr) + len;
-}
-
-/**
- Overlay characters from single-line string \p insLine on single-line string
- \p line between displayed character offsets \p rectStart and \p rectEnd.
- \p outLen returns the number of characters written to \p outStr, \p endOffset
- returns the number of characters from the beginning of the string to
- the right edge of the inserted text (as a hint for routines which need
- to position the cursor).
- */
-static void overlayRectInLine(const char *line, char *insLine,
- int rectStart, int rectEnd, int tabDist,
- int useTabs, char *outStr,
- int *outLen, int *endOffset)
-{
- /* copy the line up to "rectStart" */
- char *outPtr = outStr;
- int inIndent = 0, outIndent = 0, len;
- const char *linePtr = line;
-
- for (; *linePtr != '\0'; linePtr++) {
- len = Fl_Text_Buffer::character_width(linePtr, inIndent, tabDist);
- if (inIndent + len > rectStart)
- break;
- inIndent += len;
- outIndent += len;
- *outPtr++ = *linePtr;
- }
-
- /* If "rectStart" falls in the middle of a character, and the character
- is a tab, leave it off and leave the outIndent short and it will get
- padded later. If it's a control character, insert it and adjust
- outIndent accordingly. */
- if (inIndent < rectStart && *linePtr != '\0') {
- if (*linePtr == '\t') {
- linePtr++;
- inIndent += len;
- } else {
- *outPtr++ = *linePtr++;
- outIndent += len;
- inIndent += len;
- }
- }
-
- /* skip the characters between rectStart and rectEnd */
- int postRectIndent = rectEnd;
- for (; *linePtr != '\0'; linePtr++) {
- inIndent += Fl_Text_Buffer::character_width(linePtr, inIndent, tabDist);
- if (inIndent >= rectEnd) {
- linePtr++;
- postRectIndent = inIndent;
- break;
- }
- }
-
- /* If there's no text after rectStart and no text to insert, that's all */
- if (*insLine == '\0' && *linePtr == '\0') {
- *outLen = *endOffset = outPtr - outStr;
- return;
- }
-
- /* pad out to rectStart if text is too short */
- if (outIndent < rectStart) {
- addPadding(outPtr, outIndent, rectStart, tabDist, useTabs, &len);
- outPtr += len;
- }
- outIndent = rectStart;
-
- /* Copy the text from "insLine" (if any), recalculating the tabs as if
- the inserted string began at column 0 to its new column destination */
- if (*insLine != '\0') {
- char *retabbedStr =
- realignTabs(insLine, 0, rectStart, tabDist, useTabs, &len);
- for (const char *c = retabbedStr; *c != '\0'; c++) {
- *outPtr++ = *c;
- len = Fl_Text_Buffer::character_width(c, outIndent, tabDist);
- outIndent += len;
- }
- free((void *) retabbedStr);
- }
-
- /* If the original line did not extend past "rectStart", that's all */
- if (*linePtr == '\0') {
- *outLen = *endOffset = outPtr - outStr;
- return;
- }
-
- /* Pad out to rectEnd + (additional original offset
- due to non-breaking character at right boundary) */
- addPadding(outPtr, outIndent, postRectIndent, tabDist, useTabs, &len);
- outPtr += len;
- outIndent = postRectIndent;
-
- /* copy the text beyond "rectEnd" */
- strcpy(outPtr, linePtr);
- *endOffset = outPtr - outStr;
- *outLen = (outPtr - outStr) + strlen(linePtr);
-}
-
-
-// simple setter
-// Unicode safe
void Fl_Text_Selection::set(int startpos, int endpos)
{
mSelected = startpos != endpos;
- mRectangular = 0;
mStart = min(startpos, endpos);
mEnd = max(startpos, endpos);
}
-// simple setter
-// Unicode safe
-void Fl_Text_Selection::set_rectangular(int startpos, int endpos,
- int rectStart, int rectEnd)
-{
- mSelected = rectStart < rectEnd;
- mRectangular = 1;
- mStart = startpos;
- mEnd = endpos;
- mRectStart = rectStart;
- mRectEnd = rectEnd;
-}
-
-
-// simple getter
-// Unicode safe
+/*
+ simple getter.
+ Unicode safe. Start and end will be at a character boundary.
+ */
int Fl_Text_Selection::position(int *startpos, int *endpos) const {
if (!mSelected)
return 0;
@@ -1816,83 +1238,65 @@ int Fl_Text_Selection::position(int *startpos, int *endpos) const {
}
-// simple getter
-// Unicode safe
-int Fl_Text_Selection::position(int *startpos, int *endpos,
- int *isRect, int *rectStart,
- int *rectEnd) const {
- if (!mSelected)
- return 0;
- *isRect = mRectangular;
- *startpos = mStart;
- *endpos = mEnd;
- if (mRectangular)
- {
- *rectStart = mRectStart;
- *rectEnd = mRectEnd;
- }
- return 1;
+/*
+ Return if a position is inside the selected area.
+ Unicode safe. Pos must be at a character boundary.
+ */
+int Fl_Text_Selection::includes(int pos) const {
+ return (selected() && pos >= start() && pos < end() );
}
-// unicode safe
-int Fl_Text_Selection::includes(int pos, int lineStartPos, int dispIndex) const {
- return (selected()
- && ( (!rectangular() && pos >= start() && pos < end())
- || (rectangular() && pos >= start() && lineStartPos <= end()
- && dispIndex >= rect_start() && dispIndex < rect_end()
- )
- )
- );
-}
-
+/*
+ Return a duplicate of the selected text, or an empty string.
+ Unicode safe.
+ */
char *Fl_Text_Buffer::selection_text_(Fl_Text_Selection * sel) const {
- int start, end, isRect, rectStart, rectEnd;
+ int start, end;
/* If there's no selection, return an allocated empty string */
- if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd))
+ if (!sel->position(&start, &end))
{
char *s = (char *) malloc(1);
*s = '\0';
return s;
}
- /* If the selection is not rectangular, return the selected range */
- if (isRect)
- return text_in_rectangle(start, end, rectStart, rectEnd);
- else
+ /* Return the selected range */
return text_range(start, end);
}
+
+/*
+ Remove the selected text.
+ Unicode safe.
+ */
void Fl_Text_Buffer::remove_selection_(Fl_Text_Selection * sel)
{
- int start, end, isRect, rectStart, rectEnd;
+ int start, end;
- if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd))
+ if (!sel->position(&start, &end))
return;
- if (isRect)
- remove_rectangular(start, end, rectStart, rectEnd);
- else {
- remove(start, end);
- //undoyankcut = undocut;
- }
+ remove(start, end);
+ //undoyankcut = undocut;
}
+/*
+ Replace selection with text.
+ Unicode safe.
+ */
void Fl_Text_Buffer::replace_selection_(Fl_Text_Selection * sel,
const char *text)
{
Fl_Text_Selection oldSelection = *sel;
/* If there's no selection, return */
- int start, end, isRect, rectStart, rectEnd;
- if (!sel->position(&start, &end, &isRect, &rectStart, &rectEnd))
+ int start, end;
+ if (!sel->position(&start, &end))
return;
/* Do the appropriate type of replace */
- if (isRect)
- replace_rectangular(start, end, rectStart, rectEnd, text);
- else
replace(start, end, text);
/* Unselect (happens automatically in BufReplace, but BufReplaceRect
@@ -1901,43 +1305,36 @@ void Fl_Text_Buffer::replace_selection_(Fl_Text_Selection * sel,
redisplay_selection(&oldSelection, sel);
}
-static void addPadding(char *string, int startIndent, int toIndent,
- int tabDist, int useTabs, int *charsAdded)
-{
- int indent = startIndent, len;
- char *outPtr = string;
- if (useTabs) {
- while (indent < toIndent) {
- //static char t = '\t';
- len = Fl_Text_Buffer::character_width("\t", indent, tabDist);
- if (len > 1 && indent + len <= toIndent) {
- *outPtr++ = '\t';
- indent += len;
- } else {
- *outPtr++ = ' ';
- indent++;
- }
- }
- } else {
- while (indent < toIndent) {
- *outPtr++ = ' ';
- indent++;
- }
- }
- *charsAdded = outPtr - string;
-}
-
+/*
+ Call all callbacks.
+ Unicode safe.
+ */
void Fl_Text_Buffer::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]);
-} void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) const {
+}
+
+
+/*
+ Call all callbacks.
+ Unicode safe.
+ */
+void Fl_Text_Buffer::call_predelete_callbacks(int pos, int nDeleted) const {
for (int i = 0; i < mNPredeleteProcs; i++)
(*mPredeleteProcs[i]) (pos, nDeleted, mPredeleteCbArgs[i]);
-} void Fl_Text_Buffer::redisplay_selection(Fl_Text_Selection *
+}
+
+
+/*
+ Redisplay a new selected area.
+ Unicode safe.
+ */
+void Fl_Text_Buffer::redisplay_selection(Fl_Text_Selection *
oldSelection,
Fl_Text_Selection *
newSelection) const
@@ -1952,10 +1349,6 @@ void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
newStart = newSelection->mStart;
oldEnd = oldSelection->mEnd;
newEnd = newSelection->mEnd;
- if (oldSelection->mRectangular)
- oldEnd++;
- if (newSelection->mRectangular)
- newEnd++;
/* If the old or new selection is unselected, just redisplay the
single area that is (was) selected and return */
@@ -1971,20 +1364,6 @@ void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
return;
}
- /* If the selection changed from normal to rectangular or visa versa, or
- if a rectangular selection changed boundaries, redisplay everything */
- if ((oldSelection->mRectangular && !newSelection->mRectangular) ||
- (!oldSelection->mRectangular && newSelection->mRectangular) ||
- (oldSelection->mRectangular && ((oldSelection->mRectStart !=
- newSelection->mRectStart)
- || (oldSelection->mRectEnd !=
- newSelection->mRectEnd)))) {
- call_modify_callbacks(min(oldStart, newStart), 0, 0,
- max(oldEnd, newEnd) - min(oldStart,
- newStart), NULL);
- return;
- }
-
/* If the selections are non-contiguous, do two separate updates
and return */
if (oldEnd < newStart || newEnd < oldStart) {
@@ -2006,6 +1385,11 @@ void Fl_Text_Buffer::call_modify_callbacks(int pos, int nDeleted,
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 Fl_Text_Buffer::move_gap(int pos)
{
int gapLen = mGapEnd - mGapStart;
@@ -2018,6 +1402,11 @@ void Fl_Text_Buffer::move_gap(int pos)
mGapStart += pos - mGapStart;
}
+
+/*
+ Create a larger gap.
+ Unicode safe. Start must be at a character boundary.
+ */
void Fl_Text_Buffer::reallocate_with_gap(int newGapStart, int newGapLen)
{
char *newBuf = (char *) malloc(mLength + newGapLen);
@@ -2040,15 +1429,13 @@ void Fl_Text_Buffer::reallocate_with_gap(int newGapStart, int newGapLen)
mBuf = newBuf;
mGapStart = newGapStart;
mGapEnd = newGapEnd;
-#ifdef PURIFY
- {
- int i;
- for (i = mGapStart; i < mGapEnd; i++)
- mBuf[i] = '.';
}
-#endif
-}
+
+/*
+ Update selection range if characters were inserted.
+ Unicode safe. Pos must be at a character boundary.
+ */
void Fl_Text_Buffer::update_selections(int pos, int nDeleted,
int nInserted)
{
@@ -2080,305 +1467,240 @@ void Fl_Text_Selection::update(int pos, int nDeleted, int nInserted)
}
}
-int Fl_Text_Buffer::findchar_forward(int startPos, char searchChar,
- int *foundPos) const {
- if (startPos < 0 || startPos >= mLength)
- {
+
+/*
+ Find a UCS-4 character.
+ StartPos must be at a character boundary, searchChar is UCS-4 encoded.
+ */
+int Fl_Text_Buffer::findchar_forward(int startPos, unsigned searchChar,
+ int *foundPos) const
+{
+ if (startPos >= mLength) {
*foundPos = mLength;
return 0;
}
- int pos = startPos;
- while (pos < mGapStart) {
- if (mBuf[pos] == searchChar) {
- *foundPos = pos;
+ if (startPos<0)
+ startPos = 0;
+
+ for ( ; startPos mLength)
- {
+/*
+ Find a UCS-4 character.
+ StartPos must be at a character boundary, searchChar is UCS-4 encoded.
+ */
+int Fl_Text_Buffer::findchar_backward(int startPos, unsigned int searchChar,
+ int *foundPos) const {
+ if (startPos <= 0) {
*foundPos = 0;
return 0;
}
- int pos = startPos - 1;
- for (int gapLen = mGapEnd - mGapStart; pos >= mGapStart; pos--) {
- if (mBuf[pos + gapLen] == searchChar) {
- *foundPos = pos;
+ 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;
}
}
- for (; pos >= 0; pos--) {
- if (mBuf[pos] == searchChar) {
- *foundPos = pos;
- return 1;
- }
- }
*foundPos = 0;
return 0;
}
-/*
- Copies from \p text to end up to but not including newline (or end of \p text)
- and return the copy as the function value, and the length of the line in
- \p lineLen
- */
-static char *copyLine(const char *text, int *lineLen)
+//#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)
{
- int len = 0;
-
- for (const char *c = text; *c != '\0' && *c != '\n'; c++)
- len++;
- char *outStr = (char *) malloc(len + 1);
- strlcpy(outStr, text, len + 1);
- *lineLen = len;
- return outStr;
+ // 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]);
}
-/*
- Counts the number of newlines in a null-terminated text string.
- Unicode tested.
- */
-static int countLines(const char *string)
+// returns the UCS equivalent of *p in UTF-16 and advances p by 2 (or more for surrogates)
+unsigned utf16toucs(char* &p)
{
- int lineCount = 0;
-
- for (const char *c = string; *c != '\0'; c++)
- if (*c == '\n')
- lineCount++;
- return lineCount;
+ 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;
}
-/*
- Measures the width in displayed characters of string \p text
- */
-static int textWidth(const char *text, int tabDist)
+// 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)
{
- int width = 0, maxWidth = 0;
-
- // HUH? Why is "c" incremented? Shouldn't "text" be incrmented?
- // FIXME: increment is wrong!
- for (const char *c = text; *c != '\0'; c++) {
- if (*c == '\n') {
- if (width > maxWidth)
- maxWidth = width;
- width = 0;
- } else
- width += Fl_Text_Buffer::character_width(c, width, tabDist);
+ 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 = fl_utf8encode( p_trf(p), multibyte );
+ memcpy(q, multibyte, lq);
+ q += lq;
}
- if (width > maxWidth)
- return width;
- return maxWidth;
+ memmove(line, p, endline - p);
+ endline -= (p - line);
+ return q - buffer;
}
+#endif // EXAMPLE_ENCODING
-void Fl_Text_Buffer::rectangular_selection_boundaries(int lineStartPos,
- int rectStart,
- int rectEnd,
- int *selStart,
- int *selEnd) const
+/*
+ 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)
{
- int pos, width, indent = 0;
- char c;
-
- /* find the start of the selection */
- for (pos = lineStartPos; pos < mLength; pos++)
- {
- // FIXME: character is ucs-4
- c = character(pos);
- if (c == '\n')
- break;
- width =
- Fl_Text_Buffer::character_width(&c, indent, mTabDist); // FIXME: c is not unicode
- if (indent + width > rectStart) {
- if (indent != rectStart && c != '\t') {
- pos++;
- indent += width;
+ 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 = fl_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 = fl_utf8decode(p, p+l, &lp);
+ lq = fl_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;
}
- break;
- }
- indent += width;
- }
- *selStart = pos;
-
- /* find the end */
- for (; pos < mLength; pos++) {
- // FIXME: character is ucs-4
- c = character(pos);
- if (c == '\n')
- break;
- width =
- Fl_Text_Buffer::character_width(&c, indent, mTabDist); // FIXME: c is not unicode
- indent += width;
- if (indent > rectEnd) {
- if (indent - width != rectEnd && c != '\t')
- pos++;
- break;
+ memcpy(q, multibyte, lq);
+ q += lq;
+ p += lp;
+ l -= lp;
}
}
- *selEnd = pos;
+ memmove(line, p, endline - p);
+ endline -= (p - line);
+ return q - buffer;
}
+const char *Fl_Text_Buffer::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.";
+
/*
- Adjust the space and tab characters from string \p text so that non-white
- characters remain stationary when the text is shifted from starting at
- \p origIndent to starting at \p newIndent. Returns an allocated string
- which must be freed by the caller with XtFree.
+ 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.
*/
-static char *realignTabs(const char *text, int origIndent, int newIndent,
- int tabDist, int useTabs, int *newLength)
-{
- /* If the tabs settings are the same, retain original tabs */
- int len;
- char *outStr;
- if (origIndent % tabDist == newIndent % tabDist) {
- len = strlen(text);
- outStr = (char *) malloc(len + 1);
- strcpy(outStr, text);
- *newLength = len;
- return outStr;
- }
-
- /* If the tab settings are not the same, brutally convert tabs to
- spaces, then back to tabs in the new position */
- char *expStr = expandTabs(text, origIndent, tabDist, &len);
- if (!useTabs) {
- *newLength = len;
- return expStr;
- }
- outStr =
- unexpandTabs(expStr, newIndent, tabDist, newLength);
- free((void *) expStr);
- return outStr;
-}
-
-/*
- Expand tabs to spaces for a block of text. The additional parameter
- \p startIndent if nonzero, indicates that the text is a rectangular selection
- beginning at column \p startIndent
- */
-static char *expandTabs(const char *text, int startIndent, int tabDist, int *newLen)
-{
- /* rehearse the expansion to figure out length for output string */
- int indent = startIndent, len, outLen = 0;
- const char *c;
- for (c = text; *c != '\0'; c++) {
- if (*c == '\t') {
- len =
- Fl_Text_Buffer::character_width(c, indent, tabDist);
- outLen += len;
- indent += len;
- } else if (*c == '\n') {
- indent = startIndent;
- outLen++;
- } else {
- // FIXME: character_width does not return number of bytes for UTF-8!
- indent +=
- Fl_Text_Buffer::character_width(c, indent, tabDist);
- outLen++;
- }
- }
-
- /* do the expansion */
- char *outStr = (char *) malloc(outLen + 1);
- char *outPtr = outStr;
- indent = startIndent;
- for (c = text; *c != '\0'; c++) {
- if (*c == '\t') {
- len =
- Fl_Text_Buffer::expand_character(c, indent, outPtr, tabDist);
- outPtr += len;
- indent += len;
- } else if (*c == '\n') {
- indent = startIndent;
- *outPtr++ = *c;
- } else {
- // FIXME: character_width does not return number of bytes for UTF-8!
- indent +=
- Fl_Text_Buffer::character_width(c, indent, tabDist);
- *outPtr++ = *c;
- }
- }
- outStr[outLen] = '\0';
- *newLen = outLen;
- return outStr;
-}
-
-/*
- Convert sequences of spaces into tabs. The threshold for conversion is
- when 3 or more spaces can be converted into a single tab, this avoids
- converting double spaces after a period withing a block of text.
- */
-static char *unexpandTabs(char *text, int startIndent, int tabDist, int *newLen)
-{
- char expandedChar[FL_TEXT_MAX_EXP_CHAR_LEN];
- char *outStr = (char *) malloc(strlen(text) + 1);
- char *outPtr = outStr;
- int indent = startIndent, len;
-
- for (const char *c = text; *c != '\0';) {
- if (*c == ' ') {
- static char tab = '\t';
- len =
- Fl_Text_Buffer::expand_character(&tab, indent, expandedChar, tabDist);
- if (len >= 3 && !strncmp(c, expandedChar, len)) {
- c += len;
- *outPtr++ = '\t';
- indent += len;
- } else {
- *outPtr++ = *c++;
- indent++;
- }
- } else if (*c == '\n') {
- indent = startIndent;
- *outPtr++ = *c++;
- } else {
- *outPtr++ = *c++;
- indent++;
- }
- }
- *outPtr = '\0';
- *newLen = outPtr - outStr;
- return outStr;
-}
-
-int Fl_Text_Buffer::insertfile(const char *file, int pos, int buflen)
+ int Fl_Text_Buffer::insertfile(const char *file, int pos, int buflen)
{
FILE *fp;
if (!(fp = fl_fopen(file, "r")))
return 1;
- char *buffer = new char[buflen];
- for (int r; (r = fread(buffer, 1, buflen - 1, fp)) > 0; pos += r) {
- buffer[r] = (char) 0;
+ 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;
}
-int Fl_Text_Buffer::outputfile(const char *file, int start, int end,
- int buflen)
-{
+
+/*
+ Write text to file.
+ Unicode safe.
+ */
+int Fl_Text_Buffer::outputfile(const char *file,
+ int start, int end,
+ int buflen) {
FILE *fp;
- if (!(fp = fl_fopen(file, "wb")))
+ if (!(fp = fl_fopen(file, "w")))
return 1;
for (int n; (n = min(end - start, buflen)); start += n) {
const char *p = text_range(start, start + n);
@@ -2394,6 +1716,79 @@ int Fl_Text_Buffer::outputfile(const char *file, int start, int end,
}
+/*
+ Return the previous character position.
+ Unicode safe.
+ */
+int Fl_Text_Buffer::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 Fl_Text_Buffer::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 Fl_Text_Buffer::next_char(int pos) const
+{
+ IS_UTF8_ALIGNED2(this, (pos))
+ int n = fl_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 Fl_Text_Buffer::next_char_clipped(int pos) const
+{
+ return next_char(pos);
+}
+
+/*
+ Align an index to the current UTF-8 boundary.
+ */
+int Fl_Text_Buffer::utf8_align(int pos) const
+{
+ char c = byte_at(pos);
+ while ( (c&0xc0) == 0x80) {
+ pos--;
+ c = byte_at(pos);
+ }
+ return pos;
+}
+
//
-// End of "$Id: Fl_Text_Buffer.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Text_Buffer.cxx 8040 2010-12-15 17:38:39Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
index c6b5a8195..e6a5b10ce 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Display.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Display.cxx 7527 2010-04-18 14:33:33Z engelsman $"
+// "$Id: Fl_Text_Display.cxx 8659 2011-05-13 07:58:26Z matt $"
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -25,6 +25,9 @@
// http://www.fltk.org/str.php
//
+// TODO: rendering of the "optional hyphen"
+// TODO: make line numbering work again
+
#include
#include
#include
@@ -35,6 +38,7 @@
#include
#include
#include
+#include
#undef min
#undef max
@@ -49,7 +53,7 @@
#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 */
+ integer which describes what drawing calls to use to draw a string */
#define FILL_MASK 0x0100
#define SECONDARY_MASK 0x0200
#define PRIMARY_MASK 0x0400
@@ -59,8 +63,8 @@
#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 */
+ 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 );
@@ -68,7 +72,7 @@ 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. */
+ 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;
@@ -77,47 +81,55 @@ static int scroll_x = 0;
// CET - FIXME
#define TMPFONTWIDTH 6
-/** Creates a new text display widget.*/
-Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
- : Fl_Group(X, Y, W, H, l) {
- int i;
+
+/**
+ \brief Creates a new text display widget.
+
+ \param X, Y, W, H position and size of widget
+ \param l label text, defaults to none
+ */
+Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
+: Fl_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 = dragType = dragging = 0;
+ dragPos = dragging = 0;
+ dragType = DRAG_CHAR;
display_insert_position_hint = 0;
shortcut_ = 0;
-
+
color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
box(FL_DOWN_FRAME);
textsize(FL_NORMAL_SIZE);
textcolor(FL_FOREGROUND_COLOR);
textfont(FL_HELVETICA);
set_flag(SHORTCUT_LABEL);
-
+
text_area.x = 0;
text_area.y = 0;
text_area.w = 0;
text_area.h = 0;
-
+
mVScrollBar = new Fl_Scrollbar(0,0,1,1);
mVScrollBar->callback((Fl_Callback*)v_scrollbar_cb, this);
mHScrollBar = new Fl_Scrollbar(0,0,1,1);
mHScrollBar->callback((Fl_Callback*)h_scrollbar_cb, this);
mHScrollBar->type(FL_HORIZONTAL);
-
+
end();
-
+
scrollbar_width(Fl::scrollbar_size());
scrollbar_align(FL_ALIGN_BOTTOM_RIGHT);
-
+
mCursorOn = 0;
mCursorPos = 0;
mCursorOldY = -100;
mCursorToHint = NO_HINT;
mCursorStyle = NORMAL_CURSOR;
- mCursorPreferredCol = -1;
+ mCursorPreferredXPos = -1;
mBuffer = 0;
mFirstChar = 0;
mLastChar = 0;
@@ -126,10 +138,9 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
mAbsTopLineNum = 1;
mNeedAbsTopLineNum = 0;
mHorizOffset = mHorizOffsetHint = 0;
-
+
mCursor_color = FL_FOREGROUND_COLOR;
-
- mFixedFontWidth = -1;
+
mStyleBuffer = 0;
mStyleTable = 0;
mNStyles = 0;
@@ -141,21 +152,25 @@ Fl_Text_Display::Fl_Text_Display(int X, int Y, int W, int H, const char* l)
mSuppressResync = 0;
mNLinesDeleted = 0;
mModifyingTabDistance = 0;
-
+
mUnfinishedStyle = 0;
mUnfinishedHighlightCB = 0;
mHighlightCBArg = 0;
-
+
mLineNumLeft = mLineNumWidth = 0;
mContinuousWrap = 0;
- mWrapMargin = 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.
-*/
+
+
+/**
+ 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.
+ */
Fl_Text_Display::~Fl_Text_Display() {
if (scroll_direction) {
Fl::remove_timeout(scroll_timer_cb, this);
@@ -168,64 +183,93 @@ Fl_Text_Display::~Fl_Text_Display() {
if (mLineStarts) delete[] mLineStarts;
}
+
+
/**
- Attach a text buffer to display, replacing the current buffer (if any)
-*/
+ Attach a text buffer to display, replacing the current buffer (if any)
+ \param buf attach this text buffer
+ */
void Fl_Text_Display::buffer( Fl_Text_Buffer *buf ) {
/* If the text display is already displaying a buffer, clear it off
- of the display and remove our callback from it */
+ of the display and remove our callback from it */
if ( buf == mBuffer) return;
if ( mBuffer != 0 ) {
- buffer_modified_cb( 0, 0, mBuffer->length(), 0, 0, this );
- mNBufferLines = 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 */
+ 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());
}
-/**
- 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 Fl_Text_Selection
- (see extendRangeForStyleMods for more information on this protocol).
- Style buffers, tables and their associated memory are managed by the caller.
-*/
+
+/**
+ \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 Fl_Text_Selection
+ (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 Fl_Text_Display::highlight_data(Fl_Text_Buffer *styleBuffer,
- const Style_Table_Entry *styleTable,
- int nStyles, char unfinishedStyle,
- Unfinished_Style_Cb unfinishedHighlightCB,
- void *cbArg ) {
+ const Style_Table_Entry *styleTable,
+ int nStyles, char unfinishedStyle,
+ Unfinished_Style_Cb unfinishedHighlightCB,
+ void *cbArg ) {
mStyleBuffer = styleBuffer;
mStyleTable = styleTable;
mNStyles = nStyles;
mUnfinishedStyle = unfinishedStyle;
mUnfinishedHighlightCB = unfinishedHighlightCB;
mHighlightCBArg = cbArg;
-
+ mColumnScale = 0;
+
mStyleBuffer->canUndo(0);
damage(FL_DAMAGE_EXPOSE);
}
+
+
+/**
+ \brief Find the longest line of all visible lines.
+ \return the width of the longest visible line in pixels
+ */
int Fl_Text_Display::longest_vline() const {
int longest = 0;
for (int i = 0; i < mNVisibleLines; i++)
@@ -233,17 +277,21 @@ int Fl_Text_Display::longest_vline() const {
return longest;
}
+
+
/**
- Change the size of the displayed text area
-*/
+ \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 Fl_Text_Display::resize(int X, int Y, int W, int H) {
#ifdef DEBUG
printf("Fl_Text_Display::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);
+ printf(" oldWidth=%d, mContinuousWrap=%d, mWrapMargin=%d\n", oldWidth, mContinuousWrap, mWrapMargin);
#endif // DEBUG
Fl_Widget::resize(X,Y,W,H);
if (!buffer()) return;
@@ -251,44 +299,43 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
Y += Fl::box_dy(box());
W -= Fl::box_dw(box());
H -= Fl::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 = fl_height(textfont(), textsize()); i < mNStyles; i++)
mMaxsize = max(mMaxsize, fl_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;
+ 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 && !mWrapMargin && W!=oldWidth) {
+ 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);
-
+ 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. */
+ size and / or contents. */
int nvlines = (text_area.h + mMaxsize - 1) / mMaxsize;
if (nvlines < 1) nvlines = 1;
if (mNVisibleLines != nvlines) {
@@ -296,13 +343,13 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
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 scroll bar needs to be visible */
+ /* Decide if the vertical scrollbar needs to be visible */
if (scrollbar_align() & (FL_ALIGN_LEFT|FL_ALIGN_RIGHT) &&
mNBufferLines >= mNVisibleLines - 1)
{
@@ -319,28 +366,28 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
scrollbar_width(), text_area.h+TOP_MARGIN+BOTTOM_MARGIN);
}
}
-
+
/*
- Decide if the horizontal scroll bar needs to be visible. If there
- is a vertical scrollbar, a horizontal is always created too. This
- is because the alternatives are unatractive:
- * 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.
- */
+ 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). */
+ 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() & (FL_ALIGN_TOP|FL_ALIGN_BOTTOM) &&
(mVScrollBar->visible() || longest_vline() > text_area.w))
{
@@ -362,87 +409,86 @@ void Fl_Text_Display::resize(int X, int Y, int W, int H) {
}
}
}
-
+
// 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)
+ 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 (mLineStarts[mNVisibleLines-2] == -1)
- scroll_(mTopLineNum-1, mHorizOffset);
-
+ 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();
}
+
+
/**
- Refresh a rectangle of the text display. left and top are in coordinates of
- the text drawing window
-*/
+ \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 Fl_Text_Display::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;
-
+
fl_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);
-
+
+ /* draw the line numbers if exposed area includes them */
+ if (mLineNumWidth != 0 && left <= mLineNumLeft + mLineNumWidth)
+ draw_line_numbers(false);
+
fl_pop_clip();
}
-/** Marks text from start to end as needing a redraw.*/
+
+
+/**
+ \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 Fl_Text_Display::redisplay_range(int startpos, int endpos) {
- int ok = 0;
- while (!ok && startpos > 0) {
- // FIXME: character is ucs-4
- char c = buffer()->character( startpos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- startpos--;
- }
- }
- while (!ok && endpos < buffer()->length()) {
- // FIXME: character is ucs-4
- char c = buffer()->character( endpos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- 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;
@@ -459,26 +505,38 @@ void Fl_Text_Display::redisplay_range(int startpos, int endpos) {
}
damage(FL_DAMAGE_SCROLL);
}
+
+
+
/**
- Refresh all of the text between buffer positions "start" and "end"
- not including the character at the position "end".
- If end points beyond the end of the buffer, refresh the whole display
- after pos, including blank lines which are not technically part of
- any range of characters.
-*/
+ \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 Fl_Text_Display::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;
-
+ 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;
@@ -492,19 +550,18 @@ void Fl_Text_Display::draw_range(int startpos, int endpos) {
lastLine = mNVisibleLines - 1;
}
}
-
+
/* Get the starting and ending positions within the lines */
- startIndex = mLineStarts[ startLine ] == -1 ? 0 :
- startpos - mLineStarts[ startLine ];
+ 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" */
+ line between "start" and "end" */
if ( startLine == lastLine ) {
draw_vline( startLine, 0, INT_MAX, startIndex, endIndex );
return;
@@ -521,74 +578,123 @@ void Fl_Text_Display::draw_range(int startpos, int endpos) {
draw_vline( lastLine, 0, INT_MAX, 0, endIndex );
}
-/** Sets the position of the text insertion cursor for text display */
+
+
+/**
+ \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 Fl_Text_Display::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 == mCursorPos ) return;
if ( newPos < 0 ) newPos = 0;
if ( newPos > mBuffer->length() ) newPos = mBuffer->length();
-
+
/* cursor movement cancels vertical cursor motion column */
- mCursorPreferredCol = -1;
-
- /* erase the cursor at it's previous position */
- redisplay_range(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
-
+ 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(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
+ redisplay_range(buffer()->prev_char_clipped(mCursorPos), buffer()->next_char(mCursorPos));
}
-/** Shows the text cursor */
+
+
+
+/**
+ \brief Shows the text cursor.
+ This function may trigger a redraw.
+ \param b show(1) or hide(0) the text cursor (caret).
+ */
void Fl_Text_Display::show_cursor(int b) {
mCursorOn = b;
- redisplay_range(mCursorPos - 1, mCursorPos + 1); // FIXME utf8
+ redisplay_range(buffer()->prev_char_clipped(mCursorPos), buffer()->next_char(mCursorPos));
}
+
+
/**
- Sets the text cursor style to one of the following:
-
-
-
- - Fl_Text_Display::NORMAL_CURSOR - Shows an I beam.
-
-
- Fl_Text_Display::CARET_CURSOR - Shows a caret under the text.
-
-
- Fl_Text_Display::DIM_CURSOR - Shows a dimmed I beam.
-
-
- Fl_Text_Display::BLOCK_CURSOR - Shows an unfilled box around the current
- character.
-
-
- Fl_Text_Display::HEAVY_CURSOR - Shows a thick I beam.
-
-
-*/
+ \brief Sets the text cursor style.
+ Sets the text cursor style to one of the following:
+
+ \li Fl_Text_Display::NORMAL_CURSOR - Shows an I beam.
+ \li Fl_Text_Display::CARET_CURSOR - Shows a caret under the text.
+ \li Fl_Text_Display::DIM_CURSOR - Shows a dimmed I beam.
+ \li Fl_Text_Display::BLOCK_CURSOR - Shows an unfilled box around the current
+ character.
+ \li Fl_Text_Display::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 Fl_Text_Display::cursor_style(int style) {
mCursorStyle = style;
if (mCursorOn) show_cursor();
}
-/**
- If mode is not zero, this call enables automatic word wrapping at column pos.
- Word-wrapping does not change the text buffer itself, only the way that the text is displayed.
-*/
-void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
- mWrapMargin = wrapMargin;
- mContinuousWrap = wrap;
+
+/**
+ \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 Fl_Text_Display::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 */
+ 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();
@@ -599,53 +705,70 @@ void Fl_Text_Display::wrap_mode(int wrap, int wrapMargin) {
mTopLineNum = 1;
mAbsTopLineNum = 0;
}
-
+
resize(x(), y(), w(), h());
}
-/**
- 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.
-*/
-void Fl_Text_Display::insert(const char* text) {
- int pos = mCursorPos;
+
+/**
+ \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 Fl_Text_Display::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;
}
-/** Replaces text at the current insert position.*/
+
+
+/**
+ \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 Fl_Text_Display::overstrike(const char* text) {
+ IS_UTF8_ALIGNED2(buffer(), mCursorPos)
+ IS_UTF8_ALIGNED(text)
+
int startPos = mCursorPos;
Fl_Text_Buffer *buf = mBuffer;
int lineStart = buf->line_start( startPos );
int textLen = strlen( text );
int i, p, endPos, indent, startIndent, endIndent;
const char *c;
- char ch, *paddedText = NULL;
-
+ 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++ )
- indent += Fl_Text_Buffer::character_width( c, indent, buf->tab_distance() );
+ for ( c = text; *c != '\0'; c += fl_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 */
+ padding to make up for removed control characters at the end */
indent = startIndent;
- for ( p = startPos; ; p++ ) {
+ for ( p = startPos; ; p=buffer()->next_char(p) ) {
if ( p == buf->length() )
break;
- // FIXME: character is ucs-4
- ch = buf->character( p );
+ ch = buf->char_at( p );
if ( ch == '\n' )
break;
- const char *s = buf->address(p);
- indent += Fl_Text_Buffer::character_width(s, indent, buf->tab_distance() ); // FIXME: not unicode
+ indent++;
if ( indent == endIndent ) {
p++;
break;
@@ -662,7 +785,7 @@ void Fl_Text_Display::overstrike(const char* text) {
}
}
endPos = p;
-
+
mCursorToHint = startPos + textLen;
buf->replace( startPos, endPos, paddedText == NULL ? text : paddedText );
mCursorToHint = NO_HINT;
@@ -670,205 +793,205 @@ void Fl_Text_Display::overstrike(const char* text) {
delete [] paddedText;
}
+
+
/**
- 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 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.
-*/
+ \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 Fl_Text_Display::position_to_xy( int pos, int* X, int* Y ) const {
- int charIndex, lineStartPos, fontHeight, lineLen;
- int visLineNum, charLen, outIndex, xStep, charStyle;
- char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
- const char *lineStr;
-
-// printf("position_to_xy(pos=%d, X=%p, Y=%p)\n", pos, X, Y);
+ 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())) {
-// printf(" returning 0\n"
-// " mFirstChar=%d, mLastChar=%d, empty_vlines()=0\n",
-// mFirstChar, mLastChar);
return 0;
}
-
+
/* Calculate Y coordinate */
if (!position_to_line(pos, &visLineNum)) {
-// puts(" returning 0\n"
-// " position_to_line()=0");
return 0;
}
-
if (visLineNum < 0 || visLineNum > mNBufferLines) {
-// printf(" returning 0\n"
-// " visLineNum=%d, mNBufferLines=%d\n",
-// 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 */
+
+ /* 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 );
- lineStr = mBuffer->text_range( lineStartPos, lineStartPos + lineLen );
-
- /* Step through character positions from the beginning of the line
- to "pos" to calculate the X coordinate */
- xStep = text_area.x - mHorizOffset;
- outIndex = 0;
- for (charIndex = 0;
- charIndex < lineLen && charIndex < pos - lineStartPos;
- charIndex += fl_utf8len(lineStr[charIndex]) )
- {
- charLen = Fl_Text_Buffer::expand_character( lineStr+charIndex, outIndex, expandedChar,
- mBuffer->tab_distance());
- charStyle = position_style( lineStartPos, lineLen, charIndex,
- outIndex );
- xStep += string_width( expandedChar, charLen, charStyle );
- outIndex += charLen;
- }
- *X = xStep;
- free((char *)lineStr);
+ *X = text_area.x + handle_vline(GET_WIDTH, lineStartPos, pos-lineStartPos, 0, 0, 0, 0, 0, 0) - mHorizOffset;
return 1;
}
-/**
- Find the line number of position "pos". Note: 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).
-*/
-int Fl_Text_Display::position_to_linecol( int pos, int* lineNum, int* column ) const {
- 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;
- }
+
+/**
+ \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 Fl_Text_Display::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 );
+ *column = mBuffer->count_displayed_characters( mLineStarts[ *lineNum ], pos );
*lineNum += mTopLineNum;
}
return retVal;
}
+
+
/**
- Return 1 if position (X, Y) is inside of the primary Fl_Text_Selection
-*/
+ \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 Fl_Text_Selection
+ */
int Fl_Text_Display::in_selection( int X, int Y ) const {
- int row, column, pos = xy_to_position( X, Y, CHARACTER_POS );
+ int pos = xy_to_position( X, Y, CHARACTER_POS );
+ IS_UTF8_ALIGNED2(buffer(), pos)
Fl_Text_Buffer *buf = mBuffer;
- int ok = 0;
- while (!ok) {
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- pos++;
- }
- }
-
- xy_to_rowcol( X, Y, &row, &column, CHARACTER_POS );
- if (range_touches_selection(buf->primary_selection(), mFirstChar, mLastChar))
- column = wrapped_column(row, column);
- return buf->primary_selection()->includes(pos, buf->line_start( pos ), column);
+ return buf->primary_selection()->includes(pos);
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::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);
+ 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);
}
-/**
- 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.
-*/
-int Fl_Text_Display::wrapped_row(int row) const{
- if (!mContinuousWrap || row < 0 || row > mNVisibleLines)
- return row;
- return buffer()->count_lines(mFirstChar, mLineStarts[row]);
-}
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::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 Fl_Text_Display::display_insert() {
int hOffset, topLine, X, Y;
hOffset = mHorizOffset;
topLine = mTopLineNum;
-
-// FIXME: I don't understand this well enough to know if it is correct
-// it is different than nedit 5.3
+
if (insert_position() < mFirstChar) {
topLine -= count_lines(insert_position(), mFirstChar, false);
- } else if (mLineStarts[mNVisibleLines-2] != -1) {
+ } 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);
+ 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 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
+#ifdef DEBUG
printf ("*** display_insert/position_to_xy # GIVE UP !\n"); fflush(stdout);
- #endif // DEBUG
+#endif // DEBUG
return; /* Give up, it's not worth it (but why does it fail?) */
}
}
@@ -876,56 +999,67 @@ void Fl_Text_Display::display_insert() {
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);
}
-/** Scrolls the text buffer to show the current insert position.*/
+
+/**
+ \brief Scrolls the text buffer to show the current insert position.
+ This function triggers a complete recalculation, ending in a call to
+ Fl_Text_Display::display_insert()
+ */
void Fl_Text_Display::show_insert_position() {
display_insert_position_hint = 1;
resize(x(), y(), w(), h());
}
+
/*
- Cursor movement functions
-*/
-/** Moves the current insert position right one character.*/
+ 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 Fl_Text_Display::move_right() {
- int ok = 0;
- while (!ok) {
if ( mCursorPos >= mBuffer->length() )
return 0;
- insert_position( mCursorPos + 1 );
- int pos = insert_position();
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) ok = 1;
- }
+ int p = insert_position();
+ int q = buffer()->next_char(p);
+ insert_position(q);
return 1;
}
-/** Moves the current insert position left one character.*/
+
+
+
+/**
+ \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 Fl_Text_Display::move_left() {
- int ok = 0;
- while (!ok) {
if ( mCursorPos <= 0 )
return 0;
- insert_position( mCursorPos - 1 );
- int pos = insert_position();
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) ok = 1;
- }
+ int p = insert_position();
+ int q = buffer()->prev_char_clipped(p);
+ insert_position(q);
return 1;
}
-/** Moves the current insert position up one line.*/
-int Fl_Text_Display::move_up() {
- int lineStartPos, column, prevLineStartPos, newPos, visLineNum;
+
+/**
+ \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 Fl_Text_Display::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 possible */
if ( position_to_line( mCursorPos, &visLineNum ) )
lineStartPos = mLineStarts[ visLineNum ];
else {
@@ -934,319 +1068,403 @@ int Fl_Text_Display::move_up() {
}
if ( lineStartPos == 0 )
return 0;
-
+
/* Decide what column to move to, if there's a preferred column use that */
- column = mCursorPreferredCol >= 0 ? mCursorPreferredCol :
- mBuffer->count_displayed_characters( lineStartPos, mCursorPos );
-
+ 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 );
- newPos = mBuffer->skip_displayed_characters( prevLineStartPos, column );
- if (mContinuousWrap)
- newPos = min(newPos, line_end(prevLineStartPos, true));
-
+
+ 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 );
-
- int ok = 0;
- while (!ok) {
- int pos = insert_position();
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- insert_position( mCursorPos + 1 );
- }
- }
-
+
/* if a preferred column wasn't aleady established, establish it */
- mCursorPreferredCol = column;
+ mCursorPreferredXPos = xPos;
return 1;
}
-/** Moves the current insert position down one line.*/
-int Fl_Text_Display::move_down() {
- int lineStartPos, column, nextLineStartPos, newPos, visLineNum;
+
+/**
+ \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 Fl_Text_Display::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;
}
- column = mCursorPreferredCol >= 0 ? mCursorPreferredCol :
- mBuffer->count_displayed_characters( lineStartPos, mCursorPos );
- nextLineStartPos = skip_lines( lineStartPos, 1, true );
- newPos = mBuffer->skip_displayed_characters( nextLineStartPos, column );
- if (mContinuousWrap)
- newPos = min(newPos, line_end(nextLineStartPos, true));
-
- insert_position( newPos );
- int ok = 0;
- while (!ok) {
- int pos = insert_position();
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- insert_position( mCursorPos + 1 );
- }
+ if (mCursorPreferredXPos >= 0) {
+ xPos = mCursorPreferredXPos;
+ } else {
+ xPos = handle_vline(GET_WIDTH, lineStartPos, mCursorPos-lineStartPos,
+ 0, 0, 0, 0, 0, INT_MAX);
}
- mCursorPreferredCol = column;
+
+ 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;
}
+
+
/**
- Same as BufCountLines, but takes in to account wrapping if 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.
-*/
+ \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 Fl_Text_Display::count_lines(int startPos, int endPos,
- bool startPosIsLineStart) const {
- int retLines, retPos, retLineStart, retLineEnd;
-
+ bool startPosIsLineStart) const {
+ IS_UTF8_ALIGNED2(buffer(), startPos)
+ IS_UTF8_ALIGNED2(buffer(), endPos)
+
+ int retLines, retPos, retLineStart, retLineEnd;
+
#ifdef DEBUG
- printf("Fl_Text_Display::count_lines(startPos=%d, endPos=%d, startPosIsLineStart=%d\n",
- startPos, endPos, startPosIsLineStart);
+ printf("Fl_Text_Display::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);
-
+
+ /* 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);
+ printf(" # after WLC: retPos=%d, retLines=%d, retLineStart=%d, retLineEnd=%d\n",
+ retPos, retLines, retLineStart, retLineEnd);
#endif // DEBUG
-
- return retLines;
+
+ return retLines;
}
+
+
/**
- Same as BufCountForwardNLines, but takes in to 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.
-*/
+ \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 Fl_Text_Display::skip_lines(int startPos, int nLines,
- bool startPosIsLineStart) {
- 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);
- return retPos;
+ 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;
}
-/**
- Same as BufEndOfLine, but takes in to 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.
-**
- 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
- 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.
-*/
-int Fl_Text_Display::line_end(int pos, bool startPosIsLineStart) const {
- int retLines, retPos, retLineStart, retLineEnd;
-
- /* If we're not wrapping use more efficien BufEndOfLine */
- if (!mContinuousWrap)
- return buffer()->line_end(pos);
-
- if (pos == buffer()->length())
- return pos;
- wrapped_line_counter(buffer(), pos, buffer()->length(), 1,
- startPosIsLineStart, 0, &retPos, &retLines, &retLineStart,
- &retLineEnd);
- return retLineEnd;
-}
+
/**
- Same as BufStartOfLine, but returns the character after last wrap point
- rather than the last newline.
-*/
+ \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 Fl_Text_Display::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 Fl_Text_Display::line_start(int pos) const {
- int retLines, retPos, retLineStart, retLineEnd;
-
- /* If we're not wrapping, use the more efficient BufStartOfLine */
- if (!mContinuousWrap)
- return buffer()->line_start(pos);
+ IS_UTF8_ALIGNED2(buffer(), pos)
- wrapped_line_counter(buffer(), buffer()->line_start(pos), pos, INT_MAX, true, 0,
- &retPos, &retLines, &retLineStart, &retLineEnd);
- return retLineStart;
+ 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;
}
+
+
/**
- Same as BufCountBackwardNLines, but takes in to account line breaks when
- wrapping is turned on.
-*/
-int Fl_Text_Display::rewind_lines(int startPos, int nLines) {
- Fl_Text_Buffer *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);
+ \brief Skip a number of lines back.
- 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;
- }
+ 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 Fl_Text_Display::rewind_lines(int startPos, int nLines) {
+ IS_UTF8_ALIGNED2(buffer(), startPos)
+
+ Fl_Text_Buffer *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(int c) {
+
+
+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));
}
-/** Moves the current insert position right one word.*/
+
+
+/**
+ \brief Moves the current insert position right one word.
+ */
void Fl_Text_Display::next_word() {
int pos = insert_position();
- // FIXME: character is ucs-4
- while (pos < buffer()->length() && !fl_isseparator(buffer()->character(pos))) {
- pos++;
- }
- // FIXME: character is ucs-4
- while (pos < buffer()->length() && fl_isseparator(buffer()->character(pos))) {
- pos++;
+
+ 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 );
}
-/** Moves the current insert position left one word.*/
+
+
+/**
+ \brief Moves the current insert position left one word.
+ */
void Fl_Text_Display::previous_word() {
int pos = insert_position();
if (pos==0) return;
- pos--;
- // FIXME: character is ucs-4
- while (pos && fl_isseparator(buffer()->character(pos))) {
- pos--;
- }
- // FIXME: character is ucs-4
- while (pos && !fl_isseparator(buffer()->character(pos))) {
- pos--;
- }
- // FIXME: character is ucs-4
- if (fl_isseparator(buffer()->character(pos))) pos++;
+ 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 );
}
-/**
- Callback attached to the text buffer to receive delete information before
- the modifications are actually made.
-*/
-void Fl_Text_Display::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) {
- Fl_Text_Display *textD = (Fl_Text_Display *)cbArg;
- if (textD->mContinuousWrap &&
- (textD->mFixedFontWidth == -1 || textD->mModifyingTabDistance))
- /* 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. */
- textD->measure_deleted_lines(pos, nDeleted);
- else
- textD->mSuppressResync = 0; /* Probably not needed, but just in case */
-}
+
/**
- Callback attached to the text buffer to receive modification information
-*/
+ \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 Fl_Text_Display::buffer_predelete_cb(int pos, int nDeleted, void *cbArg) {
+ Fl_Text_Display *textD = (Fl_Text_Display *)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 Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted,
- int nRestyled, const char *deletedText, void *cbArg ) {
+ int nRestyled, const char *deletedText, void *cbArg ) {
int linesInserted, linesDeleted, startDispPos, endDispPos;
Fl_Text_Display *textD = ( Fl_Text_Display * ) cbArg;
Fl_Text_Buffer *buf = textD->mBuffer;
int oldFirstChar = textD->mFirstChar;
int scrolled, origCursorPos = textD->mCursorPos;
- int wrapModStart, wrapModEnd;
+ 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->mCursorPreferredCol = -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 );
- }
-
+ 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 );
- }
+ 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 (pos + nDeleted < oldFirstChar)
- textD->mAbsTopLineNum += buf->count_lines(pos, pos + nInserted) -
- countlines(deletedText);
- else if (pos < oldFirstChar)
- textD->reset_absolute_top_line_number();
- }
-
+
+ /* 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;
@@ -1257,13 +1475,13 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted,
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(FL_DAMAGE_EXPOSE);
@@ -1271,113 +1489,155 @@ void Fl_Text_Display::buffer_modified_cb( int pos, int nInserted, int nDeleted,
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. */
+ 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, origCursorPos - 1 );
+ 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 {
- endDispPos = textD->mContinuousWrap ? wrapModEnd :
- buf->line_end( pos + nInserted ) + 1;
+ 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);
+
+ if (linesInserted > 1) textD->draw_line_numbers(false);
} else {
- endDispPos = textD->mLastChar + 1;
+ 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);
+ /* 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 */
+ 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 ); // FIXME utf8
+ textD->redisplay_range( startDispPos, endDispPos );
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::maintain_absolute_top_line_number(int state) {
- mNeedAbsTopLineNum = state;
- reset_absolute_top_line_number();
+ mNeedAbsTopLineNum = state;
+ reset_absolute_top_line_number();
}
+
+
/**
- Returns the absolute (non-wrapped) line number of the first line displayed.
- Returns 0 if the absolute top line number is not being maintained.
-*/
+ \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 Fl_Text_Display::get_absolute_top_line_number() const {
- if (!mContinuousWrap)
- return mTopLineNum;
- if (maintaining_absolute_top_line_number())
- return mAbsTopLineNum;
- return 0;
+ if (!mContinuousWrap)
+ return mTopLineNum;
+ if (maintaining_absolute_top_line_number())
+ return mAbsTopLineNum;
+ return 0;
}
+
+
/**
- Re-calculate absolute top line number for a change in scroll position.
-*/
+ \brief Line numbering stuff, currently unused.
+
+ Re-calculate absolute top line number for a change in scroll position.
+ */
void Fl_Text_Display::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);
- }
+ if (maintaining_absolute_top_line_number()) {
+ if (mFirstChar < oldFirstChar)
+ mAbsTopLineNum -= buffer()->count_lines(mFirstChar, oldFirstChar);
+ else
+ mAbsTopLineNum += buffer()->count_lines(oldFirstChar, mFirstChar);
+ }
}
+
+
/**
- Return true if a separate absolute top line number is being maintained
- (for displaying line numbers or showing in the statistics line).
-*/
+ \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 Fl_Text_Display::maintaining_absolute_top_line_number() const {
- return mContinuousWrap &&
- (mLineNumWidth != 0 || mNeedAbsTopLineNum);
+ return mContinuousWrap &&
+ (mLineNumWidth != 0 || mNeedAbsTopLineNum);
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::reset_absolute_top_line_number() {
- mAbsTopLineNum = 1;
- absolute_top_line_number(0);
+ mAbsTopLineNum = 1;
+ absolute_top_line_number(0);
}
-/**
- Find the line number of position "pos" relative to the first line of
- displayed text. Returns 0 if the line is not displayed.
-*/
-int Fl_Text_Display::position_to_line( int pos, int *lineNum ) const {
- int i;
+
+/**
+ \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 Fl_Text_Display::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 ) {
@@ -1389,13 +1649,13 @@ int Fl_Text_Display::position_to_line( int pos, int *lineNum ) const {
}
return ++( *lineNum ) <= mNVisibleLines - 1;
} else {
- position_to_line( mLastChar - 1, lineNum );
+ 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;
@@ -1405,231 +1665,255 @@ int Fl_Text_Display::position_to_line( int pos, int *lineNum ) const {
return 0; /* probably never be reached */
}
+
/**
- Draw the text on a single line represented by "visLineNum" (the
- number of lines down from the top of the display), limited by
- "leftClip" and "rightClip" window coordinates and "leftCharIndex" and
- "rightCharIndex" character positions (not including the character at
- position "rightCharIndex").
-*/
+ 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 Fl_Text_Display::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; itab_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 Fl_Text_Display::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 (ix)
+ 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 Fl_Text_Display::draw_vline(int visLineNum, int leftClip, int rightClip,
int leftCharIndex, int rightCharIndex) {
- Fl_Text_Buffer * buf = mBuffer;
- int i, X, Y, startX, charIndex, lineStartPos, lineLen, fontHeight;
- int stdCharWidth, charWidth, startIndex, charStyle, style;
- int charLen, outStartIndex, outIndex;
- int dispIndexOffset;
- char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ], outStr[ MAX_DISP_LINE_LEN ];
- char *outPtr;
- const char *lineStr;
-
-// printf("draw_vline(visLineNum=%d, leftClip=%d, rightClip=%d, leftCharIndex=%d, rightCharIndex=%d)\n",
-// visLineNum, leftClip, rightClip, leftCharIndex, rightCharIndex);
-// printf("nNVisibleLines=%d\n", mNVisibleLines);
-
+ 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 ];
-// printf("lineStartPos=%d\n", lineStartPos);
if ( lineStartPos == -1 ) {
lineLen = 0;
- lineStr = NULL;
} else {
lineLen = vline_length( visLineNum );
- lineStr = buf->text_range( lineStartPos, lineStartPos + lineLen );
}
-
- /* Space beyond the end of the line is still counted in units of characters
- of a standardized character width (this is done mostly because style
- changes based on character position can still occur in this region due
- to rectangular Fl_Text_Selections). stdCharWidth must be non-zero to
- prevent a potential infinite loop if X does not advance */
- stdCharWidth = TMPFONTWIDTH; //mFontStruct->max_bounds.width;
- if ( stdCharWidth <= 0 ) {
- Fl::error("Fl_Text_Display::draw_vline(): bad font measurement");
- if (lineStr) free((void *)lineStr);
- return;
- }
-
+
/* Shrink the clipping range to the active display area */
leftClip = max( text_area.x, leftClip );
rightClip = min( rightClip, text_area.x + text_area.w );
-
- /* Rectangular Fl_Text_Selections are based on "real" line starts (after
- a newline or start of buffer). Calculate the difference between the
- last newline position and the line start we're using. Since scanning
- back to find a newline is expensive, only do so if there's actually a
- rectangular Fl_Text_Selection which needs it */
- if (mContinuousWrap && (range_touches_selection(buf->primary_selection(),
- lineStartPos, lineStartPos + lineLen) || range_touches_selection(
- buf->secondary_selection(), lineStartPos, lineStartPos + lineLen) ||
- range_touches_selection(buf->highlight_selection(), lineStartPos,
- lineStartPos + lineLen))) {
- dispIndexOffset = buf->count_displayed_characters(
- buf->line_start(lineStartPos), lineStartPos);
- } else
- dispIndexOffset = 0;
-
- /* Step through character positions from the beginning of the line (even if
- that's off the left edge of the displayed area) to find the first
- character position that's not clipped, and the X coordinate for drawing
- that character */
- X = text_area.x - mHorizOffset;
- outIndex = 0;
- for ( charIndex = 0; ; charIndex += lineStr ? fl_utf8len(lineStr[charIndex]) : 1 ) {
- charLen = charIndex >= lineLen ? 1 :
- Fl_Text_Buffer::expand_character( lineStr+charIndex, outIndex,
- expandedChar, buf->tab_distance());
- style = position_style( lineStartPos, lineLen, charIndex,
- outIndex + dispIndexOffset );
- charWidth = charIndex >= lineLen ? stdCharWidth :
- string_width( expandedChar, charLen, style );
- if ( X + charWidth >= leftClip && charIndex >= leftCharIndex ) {
- startIndex = charIndex;
- outStartIndex = outIndex;
- startX = X;
- break;
- }
- X += charWidth;
- outIndex += charLen;
- }
-
- /* Scan character positions from the beginning of the clipping range, and
- draw parts whenever the style changes (also note if the cursor is on
- this line, and where it should be drawn to take advantage of the x
- position which we've gone to so much trouble to calculate) */
- /* since characters between style may overlap, we draw the full
- background first */
- int sX = startX;
- outPtr = outStr;
- outIndex = outStartIndex;
- X = startX;
- for (charIndex = startIndex;
- charIndex < rightCharIndex;
- charIndex += lineStr ? fl_utf8len(lineStr[charIndex]) : 1 )
- {
- charLen = charIndex >= lineLen ? 1 :
- Fl_Text_Buffer::expand_character( lineStr+charIndex, outIndex, expandedChar,
- buf->tab_distance());
- charStyle = position_style( lineStartPos, lineLen, charIndex,
- outIndex + dispIndexOffset );
- for ( i = 0; i < charLen; i++ ) { // FIXME: this rips apart the utf-8 sequneces
- if ( i != 0 && charIndex < lineLen && lineStr[ charIndex ] == '\t' )
- charStyle = position_style( lineStartPos, lineLen,
- charIndex, outIndex + dispIndexOffset );
- if ( charStyle != style ) {
- draw_string( style|BG_ONLY_MASK, sX, Y, X, outStr, outPtr - outStr );
- outPtr = outStr;
- sX = X;
- style = charStyle;
- }
- if ( charIndex < lineLen ) {
- *outPtr = expandedChar[ i ];
- int l = 1;
- if (*outPtr & 0x80) {
- l = fl_utf8len(*outPtr);
- if (l<=0) l = 1;
- }
- charWidth = string_width( &expandedChar[ i ], l, charStyle );
- } else
- charWidth = stdCharWidth;
- outPtr++;
- X += charWidth;
- outIndex++;
- }
- if ( outPtr - outStr + FL_TEXT_MAX_EXP_CHAR_LEN >= MAX_DISP_LINE_LEN || X >= rightClip )
- break;
- }
- draw_string( style|BG_ONLY_MASK, sX, Y, X, outStr, outPtr - outStr );
-
- /* now draw the text over the previously erased background */
- outPtr = outStr;
- outIndex = outStartIndex;
- X = startX;
- for (charIndex = startIndex;
- charIndex < rightCharIndex;
- charIndex += lineStr ? fl_utf8len(lineStr[charIndex]) : 0)
- {
- charLen = charIndex >= lineLen ? 1 :
- Fl_Text_Buffer::expand_character( lineStr+charIndex, outIndex, expandedChar,
- buf->tab_distance());
- charStyle = position_style( lineStartPos, lineLen, charIndex,
- outIndex + dispIndexOffset );
- for ( i = 0; i < charLen; i++ ) { // FIXME: this rips apart the utf-8 sequneces
- if ( i != 0 && charIndex < lineLen && lineStr[ charIndex ] == '\t' )
- charStyle = position_style( lineStartPos, lineLen,
- charIndex, outIndex + dispIndexOffset );
- if ( charStyle != style ) {
- draw_string( style|TEXT_ONLY_MASK, startX, Y, X, outStr, outPtr - outStr );
- outPtr = outStr;
- startX = X;
- style = charStyle;
- }
- if ( charIndex < lineLen ) {
- *outPtr = expandedChar[ i ];
- int l = 1;
- if (*outPtr & 0x80) {
- l = fl_utf8len(*outPtr);
- if (l<=0) l = 1;
- }
- charWidth = string_width( &expandedChar[ i ], l, charStyle );
- } else
- charWidth = stdCharWidth;
- outPtr++;
- X += charWidth;
- outIndex++;
- }
- if ( outPtr - outStr + FL_TEXT_MAX_EXP_CHAR_LEN >= MAX_DISP_LINE_LEN || X >= rightClip )
- break;
- }
-
- /* Draw the remaining style segment */
- draw_string( style|TEXT_ONLY_MASK, startX, Y, X, outStr, outPtr - outStr );
-
- /* Draw the cursor if part of it appeared on the redisplayed part of
- this line. Also check for the cases which are not caught as the
- line is scanned above: when the cursor appears at the very end
- of the redisplayed section. */
- /* CET - FIXME
- if ( mCursorOn )
- {
- if ( hasCursor )
- draw_cursor( cursorX, Y );
- else if ( charIndex < lineLen && ( lineStartPos + charIndex + 1 == cursorPos )
- && X == rightClip )
- {
- if ( cursorPos >= buf->length() )
- draw_cursor( X - 1, Y );
- else
- {
- draw_cursor( X - 1, Y );
- }
- }
- }
- */
- if ( lineStr != NULL )
- free((void *)lineStr);
+
+ handle_vline(DRAW_LINE,
+ lineStartPos, lineLen, leftCharIndex, rightCharIndex,
+ Y, Y+fontHeight, leftClip, rightClip);
+ return;
}
-/**
- Draw a string or blank area according to parameter "style", using the
- appropriate colors and drawing method for that style, with top left
- corner at X, y. If style says to draw text, use "string" as source of
- characters, and draw "nChars", if style is FILL, erase
- rectangle where text would have drawn from X to toX and from Y to
- the maximum Y extent of the current font(s).
-*/
-void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
- const char *string, int nChars ) {
- const Style_Table_Entry * styleRec;
+
+/**
+ \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 Fl_Text_Display::draw_string(int style,
+ int X, int Y, int toX,
+ const char *string, int nChars) const {
+ IS_UTF8_ALIGNED(string)
+
+ const Style_Table_Entry * styleRec;
+
/* Draw blank area rather than text, if that was the request */
if ( style & FILL_MASK ) {
if (style & TEXT_ONLY_MASK) return;
@@ -1637,45 +1921,45 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
return;
}
/* Set font, color, and gc depending on style. For normal text, GCs
- for normal drawing, or drawing within a Fl_Text_Selection or highlight are
- pre-allocated and pre-configured. For syntax highlighting, GCs are
- configured here, on the fly. */
-
+ for normal drawing, or drawing within a Fl_Text_Selection or highlight are
+ pre-allocated and pre-configured. For syntax highlighting, GCs are
+ configured here, on the fly. */
+
Fl_Font font = textfont();
int fsize = textsize();
Fl_Color foreground;
Fl_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 (Fl::focus() == this) background = selection_color();
+ if (Fl::focus() == (Fl_Widget*)this) background = selection_color();
else background = fl_color_average(color(), selection_color(), 0.4f);
} else if (style & HIGHLIGHT_MASK) {
- if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.5f);
+ if (Fl::focus() == (Fl_Widget*)this) background = fl_color_average(color(), selection_color(), 0.5f);
else background = fl_color_average(color(), selection_color(), 0.6f);
} else background = color();
foreground = fl_contrast(styleRec->color, background);
} else if (style & PRIMARY_MASK) {
- if (Fl::focus() == this) background = selection_color();
+ if (Fl::focus() == (Fl_Widget*)this) background = selection_color();
else background = fl_color_average(color(), selection_color(), 0.4f);
foreground = fl_contrast(textcolor(), background);
} else if (style & HIGHLIGHT_MASK) {
- if (Fl::focus() == this) background = fl_color_average(color(), selection_color(), 0.5f);
+ if (Fl::focus() == (Fl_Widget*)this) background = fl_color_average(color(), selection_color(), 0.5f);
else background = fl_color_average(color(), selection_color(), 0.6f);
foreground = fl_contrast(textcolor(), background);
} else {
foreground = textcolor();
background = color();
}
-
+
if (!(style & TEXT_ONLY_MASK)) {
fl_color( background );
fl_rectf( X, Y, toX - X, mMaxsize );
@@ -1683,47 +1967,59 @@ void Fl_Text_Display::draw_string( int style, int X, int Y, int toX,
if (!(style & BG_ONLY_MASK)) {
fl_color( foreground );
fl_font( font, fsize );
+#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
+ // makes sure antialiased ÄÖÜ do not leak on line above
+ fl_push_clip(X, Y, toX - X, mMaxsize);
+#endif
fl_draw( string, nChars, X, Y + mMaxsize - fl_descent());
+#if !(defined(__APPLE__) || defined(WIN32)) && USE_XFT
+ fl_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 */
+ 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);
- */
+ 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 Fl_Text_Selection */
-
+
/*
- if (style & SECONDARY_MASK)
- XDrawLine(XtDisplay(mW), XtWindow(mW), gc, x,
- y + mAscent, toX - 1, Y + fs->ascent);
- */
+ if (style & SECONDARY_MASK)
+ XDrawLine(XtDisplay(mW), XtWindow(mW), gc, x,
+ y + mAscent, toX - 1, Y + fs->ascent);
+ */
}
+
/**
- Clear a rectangle with the appropriate background color for "style"
-*/
-void Fl_Text_Display::clear_rect( int style, int X, int Y,
- int width, int height ) {
+ \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 Fl_Text_Display::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 (Fl::focus()==this) {
+ if (Fl::focus()==(Fl_Widget*)this) {
fl_color(selection_color());
} else {
fl_color(fl_color_average(color(), selection_color(), 0.4f));
}
} else if (style & HIGHLIGHT_MASK) {
- if (Fl::focus()==this) {
+ if (Fl::focus()==(Fl_Widget*)this) {
fl_color(fl_color_average(color(), selection_color(), 0.5f));
} else {
fl_color(fl_color_average(color(), selection_color(), 0.6f));
@@ -1735,10 +2031,14 @@ void Fl_Text_Display::clear_rect( int style, int X, int Y,
}
+
/**
- Draw a cursor with top center at X, y.
-*/
+ \brief Draw a cursor with top center at \p X, \p Y.
+
+ \param X, Y cursor position in pixels
+ */
void Fl_Text_Display::draw_cursor( int X, int Y ) {
+
typedef struct {
int x1, y1, x2, y2;
}
@@ -1751,17 +2051,17 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
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. */
+ 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;
@@ -1797,72 +2097,89 @@ void Fl_Text_Display::draw_cursor( int X, int Y ) {
nSegs = 4;
}
fl_color( mCursor_color );
-
+
for ( int k = 0; k < nSegs; k++ ) {
fl_line( segs[ k ].x1, segs[ k ].y1, segs[ k ].x2, segs[ k ].y2 );
}
}
+
+
/**
- Determine the drawing method to use to draw a specific character from "buf".
- "lineStartPos" gives the character index where the line begins, "lineIndex",
- the number of characters past the beginning of the line, and "dispIndex",
- the number of displayed characters past the beginning of the line. Passing
- 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 Fl_Text_Selection, 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.
-*/
-int Fl_Text_Display::position_style( int lineStartPos,
- int lineLen, int lineIndex, int dispIndex ) const {
+ \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 Fl_Text_Selection, 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 Fl_Text_Display::position_style( int lineStartPos, int lineLen, int lineIndex) const
+{
+ IS_UTF8_ALIGNED2(buffer(), lineStartPos)
+
Fl_Text_Buffer * buf = mBuffer;
Fl_Text_Buffer *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 ) {
- // FIXME: character is ucs-4
- style = ( unsigned char ) styleBuf->character( pos );
+ style = ( unsigned char ) styleBuf->byte_at( pos );
if (style == mUnfinishedStyle && mUnfinishedHighlightCB) {
- /* encountered "unfinished" style, trigger parsing */
- (mUnfinishedHighlightCB)( pos, mHighlightCBArg);
- // FIXME: character is ucs-4
- style = (unsigned char) styleBuf->character( pos);
+ /* encountered "unfinished" style, trigger parsing */
+ (mUnfinishedHighlightCB)( pos, mHighlightCBArg);
+ style = (unsigned char) styleBuf->byte_at( pos);
}
}
- if (buf->primary_selection()->includes(pos, lineStartPos, dispIndex))
+ if (buf->primary_selection()->includes(pos))
style |= PRIMARY_MASK;
- if (buf->highlight_selection()->includes(pos, lineStartPos, dispIndex))
+ if (buf->highlight_selection()->includes(pos))
style |= HIGHLIGHT_MASK;
- if (buf->secondary_selection()->includes(pos, lineStartPos, dispIndex))
+ if (buf->secondary_selection()->includes(pos))
style |= SECONDARY_MASK;
return style;
}
-/**
- Find the width of a string in the font of a particular style
-*/
-int Fl_Text_Display::string_width( const char *string, int length, int style ) const {
- Fl_Font font;
- int fsize;
- if ( style & STYLE_LOOKUP_MASK ) {
+/**
+ \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 Fl_Text_Display::string_width( const char *string, int length, int style ) const {
+ IS_UTF8_ALIGNED(string)
+
+ Fl_Font font;
+ Fl_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 {
@@ -1870,23 +2187,28 @@ int Fl_Text_Display::string_width( const char *string, int length, int style ) c
fsize = textsize();
}
fl_font( font, fsize );
-
- return ( int ) ( fl_width( string, length ) );
+ return fl_width( string, length );
}
-/**
- Translate window coordinates to the nearest (insert cursor or character
- cell) text position. The parameter 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 (X, Y).
-*/
-int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) const {
- int charIndex, lineStart, lineLen, fontHeight;
- int charWidth, charLen, charStyle, visLineNum, xStep, outIndex;
- char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
- const char *lineStr;
+
+/**
+ \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 Fl_Text_Display::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;
@@ -1894,73 +2216,67 @@ int Fl_Text_Display::xy_to_position( int X, int Y, int posType ) const {
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 );
- lineStr = mBuffer->text_range( lineStart, lineStart + lineLen );
-
- /* Step through character positions from the beginning of the line
- to find the character position corresponding to the X coordinate */
- xStep = text_area.x - mHorizOffset;
- outIndex = 0;
- for (charIndex = 0;
- charIndex < lineLen;
- charIndex += fl_utf8len(lineStr[charIndex]) )
- {
- charLen = Fl_Text_Buffer::expand_character( lineStr+charIndex, outIndex, expandedChar,
- mBuffer->tab_distance());
- charStyle = position_style( lineStart, lineLen, charIndex, outIndex );
- charWidth = string_width( expandedChar, charLen, charStyle );
- if ( X < xStep + ( posType == CURSOR_POS ? charWidth / 2 : charWidth ) ) {
- free((char *)lineStr);
- return lineStart + charIndex;
- }
- xStep += charWidth;
- outIndex += charLen;
- }
-
- /* If the X position was beyond the end of the line, return the position
- of the newline at the end of the line */
- free((char *)lineStr);
- return lineStart + lineLen;
+
+ return handle_vline(FIND_INDEX,
+ lineStart, lineLen, 0, 0,
+ 0, 0,
+ text_area.x, X);
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::xy_to_rowcol( int X, int Y, int *row,
- int *column, int posType ) const {
+ 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;
+ if ( *row < 0 ) *row = 0;
+ if ( *row >= mNVisibleLines ) *row = mNVisibleLines - 1;
+
*column = ( ( X - text_area.x ) + mHorizOffset +
- ( posType == CURSOR_POS ? fontWidth / 2 : 0 ) ) / fontWidth;
+ ( posType == CURSOR_POS ? fontWidth / 2 : 0 ) ) / fontWidth;
if ( *column < 0 ) * column = 0;
}
+
+
/**
- 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)
-*/
+ \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 Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
int oldTopLineNum = mTopLineNum;
int oldFirstChar = mFirstChar;
@@ -1969,14 +2285,14 @@ void Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
int *lineStarts = mLineStarts;
int i, lastLineNum;
Fl_Text_Buffer *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) */
+ 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 );
@@ -1986,11 +2302,11 @@ void Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
mFirstChar = lineStarts[ newTopLineNum - oldTopLineNum ];
} else if ( newTopLineNum - lastLineNum < mNBufferLines - newTopLineNum ) {
mFirstChar = skip_lines( lineStarts[ nVisLines - 1 ],
- newTopLineNum - lastLineNum, true );
+ 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-- )
@@ -2002,32 +2318,46 @@ void Fl_Text_Display::offset_line_starts( int newTopLineNum ) {
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);
+
+ /* 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);
}
+
+
/**
- Update the line starts array, mTopLineNum, mFirstChar and lastChar for text
- display "textD" after a modification to the text buffer, given by the
- position where the change began "pos", and the nmubers of characters
- and lines inserted and deleted.
-*/
-void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
- int charsDeleted, int linesInserted, int linesDeleted, int *scrolled ) {
- int * lineStarts = mLineStarts;
+ \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 Fl_Text_Display::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 */
+ 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++ )
@@ -2037,16 +2367,15 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
*scrolled = 0;
return;
}
-
+
/* The change began before the beginning of the displayed text, but
- part or all of the displayed text was deleted */
+ 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 ) {
+ ++lineOfEnd < nVisLines && lineStarts[ lineOfEnd ] != -1 ) {
mTopLineNum = max( 1, mTopLineNum + lineDelta );
- mFirstChar = rewind_lines(
- lineStarts[ lineOfEnd ] + charDelta, lineOfEnd );
+ mFirstChar = rewind_lines(lineStarts[ lineOfEnd ] + charDelta, lineOfEnd );
/* Otherwise anchor on original line number and recount everything */
} else {
if ( mTopLineNum > mNBufferLines + lineDelta ) {
@@ -2061,12 +2390,12 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
*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 */
+ 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 );
@@ -2077,11 +2406,11 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
} else if ( lineDelta > 0 ) {
for ( i = nVisLines - 1; i >= lineOfPos + lineDelta + 1; i-- )
lineStarts[ i ] = lineStarts[ i - lineDelta ] +
- ( lineStarts[ i - lineDelta ] == -1 ? 0 : charDelta );
+ ( 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 );
+ ( lineStarts[ i - lineDelta ] == -1 ? 0 : charDelta );
}
/* fill in the missing line starts */
if ( linesInserted >= 0 )
@@ -2093,9 +2422,9 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
*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 */
+ 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 );
@@ -2103,24 +2432,30 @@ void Fl_Text_Display::update_line_starts( int pos, int charsInserted,
*scrolled = 0;
return;
}
-
+
/* Change was beyond the end of the buffer and not visible, do nothing */
*scrolled = 0;
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::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;
@@ -2128,34 +2463,34 @@ void Fl_Text_Display::calc_line_starts( int startLine, int endLine ) {
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 */
+ 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 */
+ 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 */
+ 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 ) ) {
+ lineEnd != nextLineStart ) ) {
lineStarts[ line ] = bufLen;
line++;
}
@@ -2163,153 +2498,190 @@ void Fl_Text_Display::calc_line_starts( int startLine, int endLine ) {
}
lineStarts[ line ] = startPos;
}
-
+
/* Set any entries beyond the end of the text to -1 */
for ( ; line <= endLine; line++ )
lineStarts[ line ] = -1;
}
+
+
/**
- Given a Fl_Text_Display with a complete, up-to-date lineStarts array, update
- the lastChar entry to point to the last buffer position displayed.
-*/
+ \brief Update last display character index.
+
+ Given a Fl_Text_Display with a complete, up-to-date lineStarts array, update
+ the lastChar entry to point to the last buffer position displayed.
+ */
void Fl_Text_Display::calc_last_char() {
int i;
for (i = mNVisibleLines - 1; i >= 0 && mLineStarts[i] == -1; i--) ;
mLastChar = i < 0 ? 0 : line_end(mLineStarts[i], true);
}
-/** Scrolls the current buffer to start at the specified line and column.*/
+
+
+/**
+ \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 Fl_Text_Display::scroll(int topLineNum, int horizOffset) {
mTopLineNumHint = topLineNum;
mHorizOffsetHint = horizOffset;
resize(x(), y(), w(), h());
}
-void Fl_Text_Display::scroll_(int topLineNum, int horizOffset) {
+
+
+/**
+ \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 Fl_Text_Display::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 */
+ window to draw in yet */
if (mHorizOffset == horizOffset && mTopLineNum == topLineNum)
- return;
-
+ return 0;
+
/* If the vertical scroll position has changed, update the line
- starts array and related counters in the text display */
+ 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(FL_DAMAGE_EXPOSE);
+ return 1;
}
+
+
/**
- Update the minimum, maximum, slider size, page increment, and value
- for vertical scroll bar.
-*/
+ \brief Update vertical scrollbar.
+
+ Update the minimum, maximum, slider size, page increment, and value
+ for vertical scrollbar.
+ */
void Fl_Text_Display::update_v_scrollbar() {
- /* The Vert. scroll bar 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 scroll bar widget happy */
+ /* 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("Fl_Text_Display::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);
}
+
/**
- Update the minimum, maximum, slider size, page increment, and value
- for the horizontal scroll bar.
-*/
+ \brief Update vertical scrollbar.
+
+ Update the minimum, maximum, slider size, page increment, and value
+ for the horizontal scrollbar.
+ */
void Fl_Text_Display::update_h_scrollbar() {
int sliderMax = max(longest_vline(), text_area.w + mHorizOffset);
mHScrollBar->value( mHorizOffset, text_area.w, 0, sliderMax );
}
+
+
/**
- Callbacks for drag or valueChanged on scroll bars
-*/
+ \brief Callbacks for drag or valueChanged on scrollbars.
+ */
void Fl_Text_Display::v_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) {
if (b->value() == textD->mTopLineNum) return;
textD->scroll(b->value(), textD->mHorizOffset);
}
+
+
+/**
+ \brief Callbacks for drag or valueChanged on scrollbars.
+ */
void Fl_Text_Display::h_scrollbar_cb(Fl_Scrollbar* b, Fl_Text_Display* textD) {
if (b->value() == textD->mHorizOffset) return;
textD->scroll(textD->mTopLineNum, b->value());
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::draw_line_numbers(bool /*clearAll*/) {
#if 0
- // FIXME: don't want this yet, so will leave for another time
-
- 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;
+ 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
}
@@ -2321,655 +2693,715 @@ static int min( int i1, int i2 ) {
return i1 <= i2 ? i1 : i2;
}
+
+
/**
- Count the number of newlines in a null-terminated text string;
-*/
+ 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;
}
+
+
+
/**
- Return the width in pixels of the displayed line pointed to by "visLineNum"
-*/
+ \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 Fl_Text_Display::measure_vline( int visLineNum ) const {
- int i, width = 0, len, style, lineLen = vline_length( visLineNum );
- int charCount = 0, lineStartPos = mLineStarts[ visLineNum ];
- char expandedChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
-
+ int lineLen = vline_length( visLineNum );
+ int lineStartPos = mLineStarts[ visLineNum ];
if (lineStartPos < 0 || lineLen == 0) return 0;
- if ( mStyleBuffer == NULL ) {
- for ( i = 0; i < lineLen; i++ ) {
- len = mBuffer->expand_character( lineStartPos + i,
- charCount, expandedChar );
-
- fl_font( textfont(), textsize() );
-
- width += ( int ) fl_width( expandedChar, len );
-
- charCount += len;
- }
- } else {
- for ( i = 0; i < lineLen; i++ ) {
- len = mBuffer->expand_character( lineStartPos + i,
- charCount, expandedChar );
- // FIXME: character is ucs-4
- style = ( unsigned char ) mStyleBuffer->character(
- lineStartPos + i ) - 'A';
-
- if (style < 0) style = 0;
- else if (style >= mNStyles) style = mNStyles - 1;
-
- fl_font( mStyleTable[ style ].font, mStyleTable[ style ].size );
-
- width += ( int ) fl_width( expandedChar, len );
-
- charCount += len;
- }
- }
- return width;
+ return handle_vline(GET_WIDTH, lineStartPos, lineLen, 0, 0, 0, 0, 0, 0);
}
+
+
/**
- Return true if there are lines visible with no corresponding buffer text
-*/
+ \brief Return true if there are lines visible with no corresponding buffer text.
+ \return 1 if there are empty lines
+ */
int Fl_Text_Display::empty_vlines() const {
- return mNVisibleLines > 0 &&
- mLineStarts[ mNVisibleLines - 1 ] == -1;
+ return (mNVisibleLines > 0) && (mLineStarts[ mNVisibleLines - 1 ] == -1);
}
+
+
/**
- Return the length of a line (number of displayable characters) by examining
- entries in the line starts array rather than by scanning for newlines
-*/
+ \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 Fl_Text_Display::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;
- if (wrap_uses_character(nextLineStart-1))
- return nextLineStart-1 - lineStartPos;
+
+ int nextLineStartMinus1 = buffer()->prev_char(nextLineStart);
+ if (wrap_uses_character(nextLineStartMinus1))
+ return nextLineStartMinus1 - lineStartPos;
+
return nextLineStart - lineStartPos;
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::find_wrap_range(const char *deletedText, int pos,
- int nInserted, int nDeleted, int *modRangeStart, int *modRangeEnd,
- int *linesInserted, int *linesDeleted) {
- int length, retPos, retLines, retLineStart, retLineEnd;
- Fl_Text_Buffer *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);
+ int nInserted, int nDeleted,
+ int *modRangeStart, int *modRangeEnd,
+ int *linesInserted, int *linesDeleted) {
+ IS_UTF8_ALIGNED(deletedText)
+ IS_UTF8_ALIGNED2(buffer(), 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;
- *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 &&
- // FIXME: character is ucs-4
- buf->character(lineStart-1) == '\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 pos + nInserted) {
- adjLineStart = lineStart - nInserted + nDeleted;
- while (visLineNum= mFirstChar && pos <= mLastChar) {
+ for (i=nVisLines-1; i>0; i--) {
+ if (lineStarts[i] != -1 && pos >= lineStarts[i]) {
+ 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;
+ if (i > 0) {
+ countFrom = lineStarts[i-1];
+ visLineNum = i-1;
+ } else {
+ countFrom = buf->line_start(pos);
}
-
- length = (pos-countFrom) + nDeleted +(countTo-(pos+nInserted));
- deletedTextBuf = new Fl_Text_Buffer(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;
-}
-
-/**
- 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.
+ } 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 (visLineNumprev_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= 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 &&
- // FIXME: character is ucs-4
- buf->character(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;
-}
-
-/**
- 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.
-**
- Returned values:
-**
- retPos: Position where counting ended. When counting lines, the
- position returned is the start of the line "maxLines"
- lines beyond "startPos".
- retLines: Number of line breaks counted
- retLineStart: Start of the line where counting ended
- retLineEnd: End position of the last line traversed
-*/
-void Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *buf, int startPos,
- int maxPos, int maxLines, bool startPosIsLineStart, int styleBufOffset,
- int *retPos, int *retLines, int *retLineStart, int *retLineEnd,
- bool countLastLineMissingNewLine) const {
- int lineStart, newLineStart = 0, b, p, colNum, wrapMargin;
- int maxWidth, i, foundBreak, width;
- bool countPixels;
- int nLines = 0, tabDist = buffer()->tab_distance();
- unsigned char c;
-
- /* If the font is fixed, or there's a wrap margin set, it's more efficient
- to measure in columns, than to count pixels. Determine if we can count
- in columns (countPixels == False) or must count pixels (countPixels ==
- True), and set the wrap target for either pixels or columns */
- if (mFixedFontWidth != -1 || mWrapMargin != 0) {
- countPixels = false;
- wrapMargin = mWrapMargin ? mWrapMargin : text_area.w / (mFixedFontWidth + 1);
- maxWidth = INT_MAX;
- } else {
- countPixels = true;
- wrapMargin = INT_MAX;
- maxWidth = 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, contines 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; plength(); p++) {
- // FIXME: character is ucs-4
- c = (unsigned char)buf->character(p);
-
- /* 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++;
- if (nLines >= maxLines) {
- *retPos = p + 1;
- *retLines = nLines;
- *retLineStart = p + 1;
- *retLineEnd = p;
- return;
- }
- lineStart = p + 1;
- colNum = 0;
- width = 0;
- } else {
- const char *s = buf->address(p);
- colNum += Fl_Text_Buffer::character_width(s, colNum, tabDist); // FIXME: unicode
- if (countPixels)
- width += measure_proportional_character(s, colNum, p+styleBufOffset);
- }
-
- /* If character exceeded wrap margin, find the break point
- and wrap there */
- if (colNum > wrapMargin || width > maxWidth) {
- foundBreak = false;
- for (b=p; b>=lineStart; b--) {
- // FIXME: character is ucs-4
- c = (unsigned char)buf->character(b);
- if (c == '\t' || c == ' ') {
- newLineStart = b + 1;
- if (countPixels) {
- colNum = 0;
- width = 0;
- for (i=b+1; iaddress(i), colNum,
- i+styleBufOffset);
- colNum++;
- }
- } else
- colNum = buf->count_displayed_characters(b+1, p+1);
- foundBreak = true;
- break;
- }
- }
- if (!foundBreak) { /* no whitespace, just break at margin */
- newLineStart = max(p, lineStart+1);
- const char *s = buf->address(b);
- colNum = Fl_Text_Buffer::character_width(s, colNum, tabDist); // FIXME: unicode
- if (countPixels)
- width = measure_proportional_character(s, colNum, 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 ? b + 1 : max(p, lineStart+1);
- *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);
- *retLineStart = lineStart;
- *retLineEnd = buf->length();
-}
-
-/**
- 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.
-*/
-
-int Fl_Text_Display::measure_proportional_character(const char *s, int colNum, int pos) const {
- int charLen, style;
- char expChar[ FL_TEXT_MAX_EXP_CHAR_LEN ];
- Fl_Text_Buffer *styleBuf = mStyleBuffer;
-
- charLen = Fl_Text_Buffer::expand_character(s, colNum, expChar, buffer()->tab_distance()); // FIXME: unicode
- if (styleBuf == 0) {
- style = 0;
- } else {
- // FIXME: character is ucs-4
- style = (unsigned char)styleBuf->character(pos);
- if (style == mUnfinishedStyle && mUnfinishedHighlightCB) {
- /* encountered "unfinished" style, trigger parsing */
- (mUnfinishedHighlightCB)(pos, mHighlightCBArg);
- // FIXME: character is ucs-4
- style = (unsigned char)styleBuf->character(pos);
- }
- }
- return string_width(expChar, charLen, style);
-}
-
-/**
- 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.
-*/
-void Fl_Text_Display::find_line_end(int startPos, bool startPosIsLineStart,
- int *lineEnd, int *nextLineStart) const {
- int retLines, retLineStart;
-
- /* if we're not wrapping use more efficient BufEndOfLine */
- if (!mContinuousWrap) {
- *lineEnd = buffer()->line_end(startPos);
- *nextLineStart = min(buffer()->length(), *lineEnd + 1);
- 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);
+ 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 Fl_Text_Buffer(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;
}
+
+
/**
- 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.
-*/
+ \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 Fl_Text_Display::measure_deleted_lines(int pos, int nDeleted) {
+ IS_UTF8_ALIGNED2(buffer(), pos)
+
+ int retPos, retLines, retLineStart, retLineEnd;
+ Fl_Text_Buffer *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 Fl_Text_Display::wrapped_line_counter(Fl_Text_Buffer *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; plength(); 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); inext_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 Fl_Text_Display::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 = fl_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 Fl_Text_Display::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 Fl_Text_Display::wrap_uses_character(int lineEndPos) const {
- char c;
-
- if (!mContinuousWrap || lineEndPos == buffer()->length())
- return 1;
-
- // FIXME: character is ucs-4
- c = buffer()->character(lineEndPos);
- return c == '\n' || ((c == '\t' || c == ' ') &&
- lineEndPos + 1 != buffer()->length());
+ 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());
}
-/**
- Return true if the selection "sel" is rectangular, and touches a
- buffer position withing "rangeStart" to "rangeEnd"
-*/
-int Fl_Text_Display::range_touches_selection(const Fl_Text_Selection *sel,
- int rangeStart, int rangeEnd) const {
- return sel->selected() && sel->rectangular() && sel->end() >= rangeStart &&
- sel->start() <= rangeEnd;
-}
+
/**
- 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).
-*/
+ \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 Fl_Text_Display::extend_range_for_styles( int *startpos, int *endpos ) {
+ IS_UTF8_ALIGNED2(buffer(), (*startpos))
+ IS_UTF8_ALIGNED2(buffer(), (*endpos))
+
Fl_Text_Selection * 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 Fl_Text_Selection.
- The style buffer is usually modified in response to a modify callback on
- the text buffer BEFORE Fl_Text_Display.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 Fl_Text_Display 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 it's redraw
- range to show the text color/and font changes as well. */
+ buffer are marked by selecting them with the buffer's primary Fl_Text_Selection.
+ The style buffer is usually modified in response to a modify callback on
+ the text buffer BEFORE Fl_Text_Display.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 Fl_Text_Display 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 Fl_Text_Selection 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 ( mFixedFontWidth == -1 && extended )
+ 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))
}
-// The draw() method. It tries to minimize what is draw as much as possible.
+
+
+/**
+ \brief Draw the widget.
+
+ This function tries to limit drawing to smaller areas if possible.
+ */
void Fl_Text_Display::draw(void) {
// don't even try if there is no associated text buffer!
if (!buffer()) { draw_box(); return; }
-
+
fl_push_clip(x(),y(),w(),h()); // prevent drawing outside widget area
-
+
// draw the non-text, non-scrollbar areas.
if (damage() & FL_DAMAGE_ALL) {
-// printf("drawing all (box = %d)\n", box());
+ // printf("drawing all (box = %d)\n", box());
+ if (Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) {
+ // if to printer, draw the background
+ fl_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
fl_rectf(text_area.x-LEFT_MARGIN, text_area.y-TOP_MARGIN,
LEFT_MARGIN, text_area.h+TOP_MARGIN+BOTTOM_MARGIN,
color());
-
+
// right margin
fl_rectf(text_area.x+text_area.w, text_area.y-TOP_MARGIN,
RIGHT_MARGIN, text_area.h+TOP_MARGIN+BOTTOM_MARGIN,
color());
-
+
// top margin
fl_rectf(text_area.x, text_area.y-TOP_MARGIN,
text_area.w, TOP_MARGIN, color());
-
+
// bottom margin
fl_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())
fl_rectf(mVScrollBar->x(), mHScrollBar->y(),
mVScrollBar->w(), mHScrollBar->h(),
FL_GRAY);
-
+
// blank the previous cursor protrusions
}
else if (damage() & (FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)) {
-// printf("blanking previous cursor extrusions at Y: %d\n", mCursorOldY);
+ // printf("blanking previous cursor extrusions at Y: %d\n", mCursorOldY);
// CET - FIXME - save old cursor position instead and just draw side needed?
fl_push_clip(text_area.x-LEFT_MARGIN,
text_area.y,
@@ -2981,7 +3413,7 @@ void Fl_Text_Display::draw(void) {
RIGHT_MARGIN, mMaxsize, color());
fl_pop_clip();
}
-
+
// draw the scrollbars
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_CHILD)) {
mVScrollBar->damage(FL_DAMAGE_ALL);
@@ -2989,7 +3421,7 @@ void Fl_Text_Display::draw(void) {
}
update_child(*mVScrollBar);
update_child(*mHScrollBar);
-
+
// draw all of the text
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_EXPOSE)) {
//printf("drawing all text\n");
@@ -3018,19 +3450,19 @@ void Fl_Text_Display::draw(void) {
damage_range2_start = damage_range2_end = -1;
fl_pop_clip();
}
-
+
// draw the text cursor
if (damage() & (FL_DAMAGE_ALL | FL_DAMAGE_SCROLL | FL_DAMAGE_EXPOSE)
&& !buffer()->primary_selection()->selected() &&
- mCursorOn && Fl::focus() == this ) {
+ mCursorOn && Fl::focus() == (Fl_Widget*)this ) {
fl_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!");
+ // else puts("position_to_xy() failed - unable to draw cursor!");
//printf("drew cursor at pos: %d (%d,%d)\n", mCursorPos, X, Y);
mCursorOldY = Y;
fl_pop_clip();
@@ -3038,6 +3470,8 @@ void Fl_Text_Display::draw(void) {
fl_pop_clip();
}
+
+
// this processes drag events due to mouse for Fl_Text_Display and
// also drags due to cursor movement with shift held down for
// Fl_Text_Editor
@@ -3070,37 +3504,47 @@ void fl_text_drag_me(int pos, Fl_Text_Display* d) {
}
}
-// 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.
+
+
+/**
+ \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 Fl_Text_Display::scroll_timer_cb(void *user_data) {
Fl_Text_Display *w = (Fl_Text_Display*)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;
+ 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;
}
fl_text_drag_me(pos, w);
Fl::repeat_timeout(.1, scroll_timer_cb, user_data);
}
+
+/**
+ \brief Event handling.
+ */
int Fl_Text_Display::handle(int event) {
if (!buffer()) return 0;
// This isn't very elegant!
@@ -3110,7 +3554,7 @@ int Fl_Text_Display::handle(int event) {
event != FL_KEYBOARD && event != FL_KEYUP) {
return Fl_Group::handle(event);
}
-
+
switch (event) {
case FL_ENTER:
case FL_MOVE:
@@ -3122,137 +3566,144 @@ int Fl_Text_Display::handle(int event) {
} else {
return 0;
}
-
+
case FL_LEAVE:
case FL_HIDE:
if (active_r() && window()) {
window()->cursor(FL_CURSOR_DEFAULT);
-
+
return 1;
} else {
return 0;
}
-
+
case FL_PUSH: {
- if (active_r() && window()) {
- if (Fl::event_inside(text_area.x, text_area.y, text_area.w,
- text_area.h)) window()->cursor(FL_CURSOR_INSERT);
- else window()->cursor(FL_CURSOR_DEFAULT);
- }
-
- if (Fl::focus() != this) {
- Fl::focus(this);
- handle(FL_FOCUS);
- }
- if (Fl_Group::handle(event)) return 1;
- if (Fl::event_state()&FL_SHIFT) return handle(FL_DRAG);
- dragging = 1;
- int pos = xy_to_position(Fl::event_x(), Fl::event_y(), CURSOR_POS);
- int ok = 0;
- while (!ok) {
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- pos++;
- }
- }
- dragType = Fl::event_clicks();
- dragPos = pos;
- if (dragType == DRAG_CHAR)
- buffer()->unselect();
- else if (dragType == DRAG_WORD)
- buffer()->select(word_start(pos), word_end(pos));
- else if (dragType == DRAG_LINE)
- buffer()->select(buffer()->line_start(pos), buffer()->line_end(pos)+1);
-
- if (buffer()->primary_selection()->selected())
- insert_position(buffer()->primary_selection()->end());
- else
- insert_position(pos);
- show_insert_position();
+ if (active_r() && window()) {
+ if (Fl::event_inside(text_area.x, text_area.y, text_area.w,
+ text_area.h)) window()->cursor(FL_CURSOR_INSERT);
+ else window()->cursor(FL_CURSOR_DEFAULT);
+ }
+
+ if (Fl::focus() != this) {
+ Fl::focus(this);
+ handle(FL_FOCUS);
+ }
+ if (Fl_Group::handle(event)) return 1;
+ if (Fl::event_state()&FL_SHIFT) return handle(FL_DRAG);
+ dragging = 1;
+ int pos = xy_to_position(Fl::event_x(), Fl::event_y(), CURSOR_POS);
+ dragPos = pos;
+ if (buffer()->primary_selection()->includes(pos)) {
+ dragType = DRAG_START_DND;
return 1;
}
-
+ dragType = Fl::event_clicks();
+ if (dragType == DRAG_CHAR) {
+ buffer()->unselect();
+ Fl::copy("", 0, 0);
+ }
+ 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 FL_DRAG: {
- if (dragType < 0) return 1;
- int X = Fl::event_x(), Y = Fl::event_y(), pos = 0;
- // 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) {
- Fl::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) {
- Fl::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) {
- Fl::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) {
- Fl::add_timeout(.01, scroll_timer_cb, this);
- }
- scroll_direction = 1;
- } else {
- if (scroll_direction) {
- Fl::remove_timeout(scroll_timer_cb, this);
- scroll_direction = 0;
- }
- pos = xy_to_position(X, Y, CURSOR_POS);
- int ok = 0;
- while (!ok) {
- // FIXME: character is ucs-4
- char c = buffer()->character( pos );
- if (!((c & 0x80) && !(c & 0x40))) {
- ok = 1;
- } else {
- pos++;
- }
- }
+ if (dragType==DRAG_NONE)
+ return 1;
+ if (dragType==DRAG_START_DND) {
+ if (!Fl::event_is_click() && Fl::dnd_text_ops()) {
+ const char* copy = buffer()->selection_text();
+ Fl::dnd();
+ free((void*)copy);
}
- fl_text_drag_me(pos, this);
return 1;
}
-
- case FL_RELEASE: {
- dragging = 0;
+ int X = Fl::event_x(), Y = Fl::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) {
+ Fl::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) {
+ Fl::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) {
+ Fl::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) {
+ Fl::add_timeout(.01, scroll_timer_cb, this);
+ }
+ scroll_direction = 1;
+ } else {
if (scroll_direction) {
Fl::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) Fl::copy(copy, strlen(copy), 0);
- free((void*)copy);
- return 1;
+ pos = xy_to_position(X, Y, CURSOR_POS);
+ pos = buffer()->next_char(pos);
}
-
+ fl_text_drag_me(pos, this);
+ return 1;
+ }
+
+ case FL_RELEASE: {
+ if (Fl::event_is_click() && (! Fl::event_clicks()) &&
+ buffer()->primary_selection()->includes(dragPos) && !(Fl::event_state()&FL_SHIFT) ) {
+ buffer()->unselect(); // clicking in the selection: unselect and move cursor
+ insert_position(dragPos);
+ return 1;
+ } else if (Fl::event_clicks() == DRAG_LINE && Fl::event_button() == FL_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) {
+ Fl::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) Fl::copy(copy, strlen(copy), 0);
+ free((void*)copy);
+ return 1;
+ }
+
case FL_MOUSEWHEEL:
if (Fl::event_dy()) return mVScrollBar->handle(event);
else return mHScrollBar->handle(event);
-
+
case FL_UNFOCUS:
if (active_r() && window()) window()->cursor(FL_CURSOR_DEFAULT);
case FL_FOCUS:
@@ -3272,28 +3723,31 @@ int Fl_Text_Display::handle(int event) {
redisplay_range(start, end);
}
return 1;
-
+
case FL_KEYBOARD:
// Copy?
if ((Fl::event_state()&(FL_CTRL|FL_COMMAND)) && Fl::event_key()=='c') {
- if (!buffer()->selected()) return 1;
- const char *copy = buffer()->selection_text();
- if (*copy) Fl::copy(copy, strlen(copy), 1);
- free((void*)copy);
- return 1;
+ if (!buffer()->selected()) return 1;
+ const char *copy = buffer()->selection_text();
+ if (*copy) Fl::copy(copy, strlen(copy), 1);
+ free((void*)copy);
+ return 1;
}
-
+
// Select all ?
if ((Fl::event_state()&(FL_CTRL|FL_COMMAND)) && Fl::event_key()=='a') {
- buffer()->select(0,buffer()->length());
- return 1;
+ buffer()->select(0,buffer()->length());
+ const char *copy = buffer()->selection_text();
+ if (*copy) Fl::copy(copy, strlen(copy), 0);
+ free((void*)copy);
+ return 1;
}
-
+
if (mVScrollBar->handle(event)) return 1;
if (mHScrollBar->handle(event)) return 1;
-
+
break;
-
+
case FL_SHORTCUT:
if (!(shortcut() ? Fl::test_shortcut(shortcut()) : test_shortcut()))
return 0;
@@ -3304,11 +3758,38 @@ int Fl_Text_Display::handle(int event) {
break;
}
-
+
return 0;
}
+/*
+ Convert an x pixel position into a column number.
+ */
+double Fl_Text_Display::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 Fl_Text_Display::col_to_x(double col) const
+{
+ if (!mColumnScale) {
+ // recalculate column scale value
+ x_to_col(0);
+ }
+ return col*mColumnScale;
+}
+
+
+
+
//
-// End of "$Id: Fl_Text_Display.cxx 7527 2010-04-18 14:33:33Z engelsman $".
+// End of "$Id: Fl_Text_Display.cxx 8659 2011-05-13 07:58:26Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
index a670fb780..553bd0d9e 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Text_Editor.cxx
@@ -1,7 +1,7 @@
//
-// "$Id: Fl_Text_Editor.cxx 7462 2010-04-06 23:00:56Z matt $"
+// "$Id: Fl_Text_Editor.cxx 8034 2010-12-15 12:21:55Z AlbrechtS $"
//
-// Copyright 2001-2009 by Bill Spitzak and others.
+// 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.
//
@@ -223,8 +223,6 @@ void Fl_Text_Editor::add_key_binding(int key, int state, Key_Func function,
////////////////////////////////////////////////////////////////
-#define NORMAL_INPUT_MOVE 0
-
static void kill_selection(Fl_Text_Editor* e) {
if (e->buffer()->selected()) {
e->insert_position(e->buffer()->primary_selection()->start());
@@ -234,6 +232,7 @@ static void kill_selection(Fl_Text_Editor* e) {
/** Inserts the text associated with the key */
int Fl_Text_Editor::kf_default(int c, Fl_Text_Editor* 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;
@@ -253,13 +252,9 @@ int Fl_Text_Editor::kf_ignore(int, Fl_Text_Editor*) {
/** Does a backspace in the current buffer.*/
int Fl_Text_Editor::kf_backspace(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected() && e->move_left()) {
- int l = 1;
- // FIXME: character is ucs-4
- char c = e->buffer()->character(e->insert_position());
- if (c & 0x80 && c & 0x40) {
- l = fl_utf8len(c);
- }
- e->buffer()->select(e->insert_position(), e->insert_position()+l);
+ int p1 = e->insert_position();
+ int p2 = e->buffer()->next_char(p1);
+ e->buffer()->select(p1, p2);
}
kill_selection(e);
e->show_insert_position();
@@ -286,6 +281,7 @@ int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
if (!selected)
e->dragPos = e->insert_position();
e->buffer()->unselect();
+ Fl::copy("", 0, 0);
switch (c) {
case FL_Home:
e->insert_position(e->buffer()->line_start(e->insert_position()));
@@ -320,6 +316,11 @@ int Fl_Text_Editor::kf_move(int c, Fl_Text_Editor* e) {
int Fl_Text_Editor::kf_shift_move(int c, Fl_Text_Editor* e) {
kf_move(c, e);
fl_text_drag_me(e->insert_position(), e);
+ char *copy = e->buffer()->selection_text();
+ if (copy) {
+ Fl::copy(copy, strlen(copy), 0);
+ free(copy);
+ }
return 1;
}
/** Moves the current text cursor in the direction indicated by control key */
@@ -328,6 +329,7 @@ int Fl_Text_Editor::kf_ctrl_move(int c, Fl_Text_Editor* e) {
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
+ Fl::copy("", 0, 0);
e->show_insert_position();
}
switch (c) {
@@ -367,6 +369,7 @@ int Fl_Text_Editor::kf_meta_move(int c, Fl_Text_Editor* e) {
e->dragPos = e->insert_position();
if (c != FL_Up && c != FL_Down) {
e->buffer()->unselect();
+ Fl::copy("", 0, 0);
e->show_insert_position();
}
switch (c) {
@@ -449,13 +452,9 @@ int Fl_Text_Editor::kf_insert(int, Fl_Text_Editor* e) {
/** Does a delete of selected text or the current character in the current buffer.*/
int Fl_Text_Editor::kf_delete(int, Fl_Text_Editor* e) {
if (!e->buffer()->selected()) {
- int l = 1;
- // FIXME: character is ucs-4
- char c = e->buffer()->character(e->insert_position());
- if (c & 0x80 && c & 0x40) {
- l = fl_utf8len(c);
- }
- e->buffer()->select(e->insert_position(), e->insert_position()+l);
+ int p1 = e->insert_position();
+ int p2 = e->buffer()->next_char(p1);
+ e->buffer()->select(p1, p2);
}
kill_selection(e);
@@ -497,11 +496,15 @@ int Fl_Text_Editor::kf_paste(int, Fl_Text_Editor* e) {
/** Selects all text in the current buffer.*/
int Fl_Text_Editor::kf_select_all(int, Fl_Text_Editor* e) {
e->buffer()->select(0, e->buffer()->length());
+ const char *copy = e->buffer()->selection_text();
+ if (*copy) Fl::copy(copy, strlen(copy), 0);
+ free((void*)copy);
return 1;
}
/** Undo last edit in the current buffer. Also deselect previous selection. */
int Fl_Text_Editor::kf_undo(int , Fl_Text_Editor* e) {
e->buffer()->unselect();
+ Fl::copy("", 0, 0);
int crsr;
int ret = e->buffer()->undo(&crsr);
e->insert_position(crsr);
@@ -519,7 +522,11 @@ int Fl_Text_Editor::handle_key() {
// bytes to delete and a string to insert:
int del = 0;
if (Fl::compose(del)) {
- if (del) buffer()->select(insert_position()-del, insert_position());
+ 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 (Fl::event_length()) {
if (insert_mode()) insert(Fl::event_text());
@@ -549,6 +556,8 @@ void Fl_Text_Editor::maybe_do_callback() {
}
int Fl_Text_Editor::handle(int event) {
+ static int dndCursorPos;
+
if (!buffer()) return 0;
switch (event) {
@@ -593,7 +602,12 @@ int Fl_Text_Editor::handle(int event) {
if (Fl::event_button() == 2) {
// don't let the text_display see this event
if (Fl_Group::handle(event)) return 1;
- dragType = -1;
+ dragType = DRAG_NONE;
+ if(buffer()->selected()) {
+ buffer()->unselect();
+ }
+ int pos = xy_to_position(Fl::event_x(), Fl::event_y(), CURSOR_POS);
+ insert_position(pos);
Fl::paste(*this, 0);
Fl::focus(this);
set_changed();
@@ -610,11 +624,29 @@ int Fl_Text_Editor::handle(int event) {
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 FL_DND_ENTER: // save the current cursor position
+ if (Fl::visible_focus() && handle(FL_FOCUS))
+ Fl::focus(this);
+ show_cursor(mCursorOn);
+ dndCursorPos = insert_position();
+ /* fall through */
+ case FL_DND_DRAG: // show a temporary insertion cursor
+ insert_position(xy_to_position(Fl::event_x(), Fl::event_y(), CURSOR_POS));
+ return 1;
+ case FL_DND_LEAVE: // restore original cursor
+ insert_position(dndCursorPos);
+ return 1;
+ case FL_DND_RELEASE: // keep insertion cursor and wait for the FL_PASTE event
+ buffer()->unselect(); // FL_PASTE must not destroy current selection!
+ return 1;
}
return Fl_Text_Display::handle(event);
}
//
-// End of "$Id: Fl_Text_Editor.cxx 7462 2010-04-06 23:00:56Z matt $".
+// End of "$Id: Fl_Text_Editor.cxx 8034 2010-12-15 12:21:55Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
index 762ea7d37..0d245db3a 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tile.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tile.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Tile.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Tile widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -52,17 +52,17 @@ void Fl_Tile::position(int oix, int oiy, int newx, int newy) {
int R = X+o->w();
if (oix) {
int t = p[0];
- if (t == oix || t>oix && Xnewx) X = newx;
+ if (t == oix || (t>oix && Xnewx) ) X = newx;
t = p[1];
- if (t == oix || t>oix && Rnewx) R = newx;
+ if (t == oix || (t>oix && Rnewx) ) R = newx;
}
int Y = o->y();
int B = Y+o->h();
if (oiy) {
int t = p[2];
- if (t == oiy || t>oiy && Ynewy) Y = newy;
+ if (t == oiy || (t>oiy && Ynewy) ) Y = newy;
t = p[3];
- if (t == oiy || t>oiy && Bnewy) B = newy;
+ if (t == oiy || (t>oiy && Bnewy) ) B = newy;
}
o->damage_resize(X,Y,R-X,B-Y);
}
@@ -210,5 +210,5 @@ int Fl_Tile::handle(int event) {
}
//
-// End of "$Id: Fl_Tile.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Tile.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
index 3646d60d5..1857480af 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tiled_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tiled_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Tiled_Image.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Tiled image code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -131,5 +131,5 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position
//
-// End of "$Id: Fl_Tiled_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Tiled_Image.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
index ee02ac88d..05b6e2344 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tooltip.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Tooltip.cxx 6902 2009-09-27 11:06:56Z matt $"
+// "$Id: Fl_Tooltip.cxx 8788 2011-06-08 14:35:22Z matt $"
//
// Tooltip source file for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -30,16 +30,16 @@
#include
#include
+#include // strdup()
float Fl_Tooltip::delay_ = 1.0f;
float Fl_Tooltip::hoverdelay_ = 0.2f;
-int Fl_Tooltip::enabled_ = 1;
Fl_Color Fl_Tooltip::color_ = fl_color_cube(FL_NUM_RED - 1,
FL_NUM_GREEN - 1,
FL_NUM_BLUE - 2);
Fl_Color Fl_Tooltip::textcolor_ = FL_BLACK;
Fl_Font Fl_Tooltip::font_ = FL_HELVETICA;
-Fl_Fontsize Fl_Tooltip::size_ = FL_NORMAL_SIZE;
+Fl_Fontsize Fl_Tooltip::size_ = -1;
#define MAX_WIDTH 400
@@ -59,7 +59,9 @@ public:
void layout();
/** Shows the tooltip windows only if a tooltip text is available. */
void show() {
- if (tip) Fl_Menu_Window::show();
+ if (!tip) return;
+
+ Fl_Menu_Window::show();
}
};
@@ -67,6 +69,14 @@ Fl_Widget* Fl_Tooltip::widget_ = 0;
static Fl_TooltipBox *window = 0;
static int Y,H;
+#ifdef __APPLE__
+// returns the unique tooltip window
+Fl_Window *Fl_Tooltip::current_window(void)
+{
+ return (Fl_Window*)window;
+}
+#endif
+
void Fl_TooltipBox::layout() {
fl_font(Fl_Tooltip::font(), Fl_Tooltip::size());
int ww, hh;
@@ -124,15 +134,20 @@ static void tooltip_timeout(void*) {
if (!tip || !*tip) {
if (window) window->hide();
} else {
- //if (Fl::grab()) return;
- if (!window) window = new Fl_TooltipBox;
- // this cast bypasses the normal Fl_Window label() code:
- ((Fl_Widget*)window)->label(tip);
- window->layout();
- window->redraw();
-// printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n",
-// window, tip ? tip : "(null)");
- window->show();
+ int condition = 1;
+#if !(defined(__APPLE__) || defined(WIN32))
+ condition = (Fl::grab() == NULL);
+#endif
+ if ( condition ) {
+ if (!window) window = new Fl_TooltipBox;
+ // this cast bypasses the normal Fl_Window label() code:
+ ((Fl_Widget*)window)->label(tip);
+ window->layout();
+ window->redraw();
+ // printf("tooltip_timeout: Showing window %p with tooltip \"%s\"...\n",
+ // window, tip ? tip : "(null)");
+ window->show();
+ }
}
Fl::remove_timeout(recent_timeout);
@@ -141,8 +156,8 @@ static void tooltip_timeout(void*) {
}
/**
- This method is called when the mouse pointer enters a widget.
- If this widget or one of it's parents has a tooltip, enter it. This
+ This method is called when the mouse pointer enters a widget.
+
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 Fl_Tooltip::exit_(). If you don't want this behavior (for instance
@@ -267,16 +282,70 @@ void Fl_Tooltip::enter_area(Fl_Widget* wid, int x,int y,int w,int h, const char*
#endif // DEBUG
}
-void Fl_Widget::tooltip(const char *tt) {
+void Fl_Tooltip::set_enter_exit_once_() {
static char beenhere = 0;
if (!beenhere) {
beenhere = 1;
Fl_Tooltip::enter = Fl_Tooltip::enter_;
Fl_Tooltip::exit = Fl_Tooltip::exit_;
}
- tooltip_ = tt;
+}
+
+/**
+ 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 not 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 Fl_Widget::tooltip(const char *text) {
+ Fl_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 Fl_Widget::copy_tooltip(const char *text) {
+ Fl_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: Fl_Tooltip.cxx 6902 2009-09-27 11:06:56Z matt $".
+// End of "$Id: Fl_Tooltip.cxx 8788 2011-06-08 14:35:22Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tree.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tree.cxx
index 76cabe9f0..4bbd229ce 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tree.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tree.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Tree.cxx 8632 2011-05-04 02:59:50Z greg.ercolano $"
//
#include
@@ -9,14 +9,12 @@
#include
#include
-#define SCROLL_W 15
-
//////////////////////
// Fl_Tree.cxx
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -40,34 +38,53 @@ static void scroll_cb(Fl_Widget*,void *data) {
}
// 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: free(arr[0]); free(arr);
+// 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 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 *s = save;
- while ( ( s = strchr(s, '/') ) ) {
- while ( *s == '/' ) { *s++ = 0; seps++; }
- if ( *s ) { arrsize++; }
+ 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;
- s = save;
+ sin = save;
while ( seps-- > 0 ) {
- if ( *s ) { arr[t++] = s; } // skips empty fields, eg. '//'
- s += (strlen(s) + 1);
+ 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(Fl_Tree_Item *item, int count=0) {
count++;
@@ -82,11 +99,14 @@ Fl_Tree::Fl_Tree(int X, int Y, int W, int H, const char *L) : Fl_Group(X,Y,W,H,L
_root = new Fl_Tree_Item(_prefs);
_root->parent(0); // we are root of tree
_root->label("ROOT");
- _item_clicked = 0;
+ _item_focus = 0;
+ _callback_item = 0;
+ _callback_reason = FL_TREE_REASON_NONE;
+ _scrollbar_size = 0; // 0: uses Fl::scrollbar_size()
box(FL_DOWN_BOX);
- color(FL_WHITE);
+ color(FL_BACKGROUND2_COLOR, FL_SELECTION_COLOR);
when(FL_WHEN_CHANGED);
- _vscroll = new Fl_Scrollbar(0,0,0,0); // will be resized by draw()
+ _vscroll = new Fl_Scrollbar(0,0,0,0); // will be resized by draw()
_vscroll->hide();
_vscroll->type(FL_VERTICAL);
_vscroll->step(1);
@@ -102,6 +122,15 @@ Fl_Tree::~Fl_Tree() {
/// 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.
///
Fl_Tree_Item* Fl_Tree::add(const char *path) {
@@ -112,12 +141,13 @@ Fl_Tree_Item* Fl_Tree::add(const char *path) {
}
char **arr = parse_path(path);
Fl_Tree_Item *item = _root->add(_prefs, arr);
- free((void*)arr[0]);
- free((void*)arr);
+ free_path(arr);
return(item);
}
/// Inserts a new item above the specified Fl_Tree_Item, 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.
///
Fl_Tree_Item* Fl_Tree::insert_above(Fl_Tree_Item *above, const char *name) {
@@ -125,50 +155,122 @@ Fl_Tree_Item* Fl_Tree::insert_above(Fl_Tree_Item *above, const char *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.
+///
Fl_Tree_Item* Fl_Tree::insert(Fl_Tree_Item *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.
+///
Fl_Tree_Item* Fl_Tree::add(Fl_Tree_Item *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.
-/// \returns the item, or 0 if not found.
+///
+/// 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()
///
Fl_Tree_Item *Fl_Tree::find_item(const char *path) {
- if ( ! _root ) return(0);
+ if ( ! _root ) return(NULL);
char **arr = parse_path(path);
Fl_Tree_Item *item = _root->find_item(arr);
- free((void*)arr[0]);
- free((void*)arr);
+ free_path(arr);
return(item);
}
/// A const version of Fl_Tree::find_item(const char *path)
const Fl_Tree_Item *Fl_Tree::find_item(const char *path) const {
- if ( ! _root ) return(0);
+ if ( ! _root ) return(NULL);
char **arr = parse_path(path);
const Fl_Tree_Item *item = _root->find_item(arr);
- free((void*)arr[0]);
- free((void*)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 Fl_Tree::item_pathname(char *pathname, int pathnamelen, const Fl_Tree_Item *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 Fl_Tree::draw() {
// Let group draw box+label but *NOT* children.
// We handle drawing children ourselves by calling each item's draw()
//
+ // Handle group's bg
Fl_Group::draw_box();
Fl_Group::draw_label();
+ // Handle tree
if ( ! _root ) return;
int cx = x() + Fl::box_dx(box());
int cy = y() + Fl::box_dy(box());
@@ -178,18 +280,20 @@ void Fl_Tree::draw() {
// '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 W = cw - _prefs.marginleft(); // - _prefs.marginright();
int Ysave = Y;
fl_push_clip(cx,cy,cw,ch);
{
fl_font(_prefs.labelfont(), _prefs.labelsize());
- _root->draw(X, Y, W, this, _prefs);
+ _root->draw(X, Y, W, this,
+ (Fl::focus()==this)?_item_focus:0, // show focus item ONLY if Fl_Tree has focus
+ _prefs);
}
fl_pop_clip();
// Show vertical scrollbar?
int ydiff = (Y+_prefs.margintop())-Ysave; // ydiff=size of tree
- int ytoofar = (cy+ch) - Y; // ytoofar -- scrolled beyond bottom (eg. stow)
+ 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()));
@@ -197,9 +301,11 @@ void Fl_Tree::draw() {
if ( ytoofar > 0 ) ydiff += ytoofar;
if ( Ysave ch || int(_vscroll->value()) > 1 ) {
_vscroll->visible();
- int sx = x()+w()-Fl::box_dx(box())-SCROLL_W;
+
+ int scrollsize = _scrollbar_size ? _scrollbar_size : Fl::scrollbar_size();
+ int sx = x()+w()-Fl::box_dx(box())-scrollsize;
int sy = y()+Fl::box_dy(box());
- int sw = SCROLL_W;
+ int sw = scrollsize;
int sh = h()-Fl::box_dh(box());
_vscroll->show();
_vscroll->range(0.0,ydiff-ch);
@@ -214,125 +320,389 @@ void Fl_Tree::draw() {
fl_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 FL_Down.
+///
+/// \param[in] item The item above/below which we'll find the next visible item
+/// \param[in] dir The direction to search. Can be FL_Up or FL_Down.
+/// \returns The item found, or 0 if there's no visible items above/below the specified \p item.
+///
+Fl_Tree_Item *Fl_Tree::next_visible_item(Fl_Tree_Item *item, int dir) {
+ if ( ! item ) { // no start item?
+ item = ( dir == FL_Up ) ? 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 FL_Up: return(item->prev_displayed(_prefs));
+ case FL_Down: 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 Fl_Tree::set_item_focus(Fl_Tree_Item *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 Fl::event_x()/Fl:event_y().
+///
+/// Use this method /only/ if you've subclassed Fl_Tree, and are receiving
+/// events before Fl_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 Fl_Tree_Item* Fl_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 Fl_Tree manages this value.
+///
+/// Deprecated: use callback_item() instead.
+///
+void Fl_Tree::item_clicked(Fl_Tree_Item* val) {
+ _callback_item = val;
+}
+
+/// Returns the first item in the tree.
+///
+/// Use this to walk the tree in the forward direction, eg:
+/// \code
+/// for ( Fl_Tree_Item *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()
+///
+Fl_Tree_Item* Fl_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 ( Fl_Tree_Item *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()
+///
+Fl_Tree_Item *Fl_Tree::next(Fl_Tree_Item *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 ( Fl_Tree_Item *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()
+///
+Fl_Tree_Item *Fl_Tree::prev(Fl_Tree_Item *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 ( Fl_Tree_Item *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()
+///
+Fl_Tree_Item* Fl_Tree::last() {
+ if ( ! _root ) return(0);
+ Fl_Tree_Item *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 ( Fl_Tree_Item *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.
+///
+Fl_Tree_Item *Fl_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 ( Fl_Tree_Item *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.
+///
+Fl_Tree_Item *Fl_Tree::next_selected_item(Fl_Tree_Item *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 Fl_Tree::handle(int e) {
+ int ret = 0;
+ // Developer note: Fl_Browser_::handle() used for reference here..
+ // #include // for event debugging
+ // fprintf(stderr, "DEBUG: %s (%d)\n", fl_eventnames[e], e);
+ if (e == FL_ENTER || e == FL_LEAVE) return(1);
+ switch (e) {
+ case FL_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 (Fl::event_key()) { // determine if focus was navigated..
+ case FL_Tab: { // received focus via TAB?
+ if ( Fl::event_state(FL_SHIFT) ) { // SHIFT-TAB similar to FL_Up
+ set_item_focus(next_visible_item(0, FL_Up));
+ } else { // TAB similar to FL_Down
+ set_item_focus(next_visible_item(0, FL_Down));
+ }
+ break;
+ }
+ case FL_Left: // received focus via LEFT or UP?
+ case FL_Up: { // XK_ISO_Left_Tab
+ set_item_focus(next_visible_item(0, FL_Up));
+ break;
+ }
+ case FL_Right: // received focus via RIGHT or DOWN?
+ case FL_Down:
+ default: {
+ set_item_focus(next_visible_item(0, FL_Down));
+ break;
+ }
+ }
+ }
+ if ( visible_focus() ) redraw(); // draw focus change
+ return(1);
+ }
+ case FL_UNFOCUS: { // FLTK telling us some other widget took focus.
+ if ( visible_focus() ) redraw(); // draw focus change
+ return(1);
+ }
+ case FL_KEYBOARD: { // keyboard shortcut
+ // Do shortcuts first or scrollbar will get them...
+ if (_prefs.selectmode() > FL_TREE_SELECT_NONE ) {
+ if ( !_item_focus ) {
+ set_item_focus(first());
+ }
+ if ( _item_focus ) {
+ int ekey = Fl::event_key();
+ switch (ekey) {
+ case FL_Enter: // ENTER: selects current item only
+ case FL_KP_Enter:
+ if ( when() & ~FL_WHEN_ENTER_KEY) {
+ select_only(_item_focus);
+ show_item(_item_focus); // STR #2426
+ return(1);
+ }
+ break;
+ case ' ': // toggle selection state
+ switch ( _prefs.selectmode() ) {
+ case FL_TREE_SELECT_NONE:
+ break;
+ case FL_TREE_SELECT_SINGLE:
+ if ( ! _item_focus->is_selected() ) // not selected?
+ select_only(_item_focus); // select only this
+ else
+ deselect_all(); // select nothing
+ break;
+ case FL_TREE_SELECT_MULTI:
+ select_toggle(_item_focus);
+ break;
+ }
+ break;
+ case FL_Right: // open children (if any)
+ case FL_Left: { // close children (if any)
+ if ( _item_focus ) {
+ if ( ekey == FL_Right && _item_focus->is_close() ) {
+ // Open closed item
+ open(_item_focus);
+ redraw();
+ ret = 1;
+ } else if ( ekey == FL_Left && _item_focus->is_open() ) {
+ // Close open item
+ close(_item_focus);
+ redraw();
+ ret = 1;
+ }
+ return(1);
+ }
+ break;
+ }
+ case FL_Up: // next item up
+ case FL_Down: { // 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() == FL_TREE_SELECT_MULTI && // multiselect on?
+ (Fl::event_state() & FL_SHIFT) && // shift key?
+ ! _item_focus->is_selected() ) { // not already selected?
+ select(_item_focus); // extend selection..
+ }
+ return(1);
+ }
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ // Let Fl_Group take a shot at handling the event
+ if (Fl_Group::handle(e)) {
+ return(1); // handled? don't continue below
+ }
+
+ // Handle events the child FLTK widgets didn't need
+
static Fl_Tree_Item *lastselect = 0;
- int changed = 0;
- int ret = Fl_Group::handle(e);
+ // fprintf(stderr, "ERCODEBUG: Fl_Tree::handle(): Event was %s (%d)\n", fl_eventnames[e], e); // DEBUGGING
if ( ! _root ) return(ret);
switch ( e ) {
- case FL_PUSH: {
+ case FL_PUSH: { // clicked on a tree item?
+ if (Fl::visible_focus() && handle(FL_FOCUS)) {
+ Fl::focus(this);
+ }
lastselect = 0;
- item_clicked(0); // assume no item was clicked
Fl_Tree_Item *o = _root->find_clicked(_prefs);
- if ( o ) {
- ret |= 1; // handled
- if ( Fl::event_button() == FL_LEFT_MOUSE ) {
- // Was collapse icon clicked?
- if ( o->event_on_collapse_icon(_prefs) ) {
- o->open_toggle();
- redraw();
- }
- // Item's label clicked?
- else if ( o->event_on_label(_prefs) &&
- (!o->widget() || !Fl::event_inside(o->widget())) &&
- callback() &&
- (!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) {
- item_clicked(o); // save item clicked
-
- // Handle selection behavior
- switch ( _prefs.selectmode() ) {
- case FL_TREE_SELECT_NONE: { // no selection changes
- break;
- }
- case FL_TREE_SELECT_SINGLE: {
- changed = select_only(o);
- break;
- }
- case FL_TREE_SELECT_MULTI: {
- int state = Fl::event_state();
- if ( state & FL_SHIFT ) {
- if ( ! o->is_selected() ) {
- o->select(); // add to selection
- changed = 1; // changed
- }
- } else if ( state & FL_CTRL ) {
- changed = 1; // changed
- o->select_toggle(); // toggle selection state
- lastselect = o; // save we toggled it (prevents oscillation)
- } else {
- changed = select_only(o);
- }
- break;
- }
- }
-
- if ( changed ) {
- redraw(); // make change(s) visible
- if ( when() & FL_WHEN_CHANGED ) {
- set_changed();
- do_callback((Fl_Widget*)this, user_data()); // item callback
- }
- }
- }
- }
+ if ( ! o ) break;
+ set_item_focus(o); // becomes new focus widget
+ redraw();
+ ret |= 1; // handled
+ if ( Fl::event_button() == FL_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() || !Fl::event_inside(o->widget())) && // not inside widget
+ (!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) { // not on scroller
+ switch ( _prefs.selectmode() ) {
+ case FL_TREE_SELECT_NONE:
+ break;
+ case FL_TREE_SELECT_SINGLE:
+ select_only(o);
+ break;
+ case FL_TREE_SELECT_MULTI: {
+ if ( Fl::event_state() & FL_SHIFT ) { // SHIFT+PUSH?
+ select(o); // add to selection
+ } else if ( Fl::event_state() & FL_CTRL ) { // CTRL+PUSH?
+ select_toggle(o); // toggle selection state
+ lastselect = o; // save toggled item (prevent oscillation)
+ } else {
+ select_only(o);
+ }
+ break;
+ }
+ }
+ }
}
break;
}
case FL_DRAG: {
+ // do the scrolling first:
+ int my = Fl::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 ( Fl::event_button() != FL_LEFT_MOUSE ) break;
Fl_Tree_Item *o = _root->find_clicked(_prefs);
- if ( o ) {
- ret |= 1; // handled
- // Item's label clicked?
- if ( o->event_on_label(_prefs) &&
- (!o->widget() || !Fl::event_inside(o->widget())) &&
- callback() &&
- (!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) {
- item_clicked(o); // save item clicked
- // Handle selection behavior
- switch ( _prefs.selectmode() ) {
- case FL_TREE_SELECT_NONE: { // no selection changes
- break;
- }
- case FL_TREE_SELECT_SINGLE: {
- changed = select_only(o);
- break;
- }
- case FL_TREE_SELECT_MULTI: {
- int state = Fl::event_state();
- if ( state & FL_CTRL ) {
- if ( lastselect != o ) {// not already toggled from last microdrag?
- changed = 1; // changed
- o->select_toggle(); // toggle selection
- lastselect = o; // save we toggled it (prevents oscillation)
- }
- } else {
- if ( ! o->is_selected() ) {
- changed = 1; // changed
- o->select(); // select this
- }
- }
- break;
- }
- }
- if ( changed ) {
- redraw(); // make change(s) visible
- if ( when() & FL_WHEN_CHANGED ) {
- set_changed();
- do_callback((Fl_Widget*)this, user_data()); // item callback
- }
- }
- }
- }
- break;
- }
- case FL_RELEASE: {
- if ( Fl::event_button() == FL_LEFT_MOUSE ) {
- ret |= 1;
- if ( when() & FL_WHEN_RELEASE || ( this->changed() && (when() & FL_WHEN_CHANGED)) ) {
- do_callback((Fl_Widget*)this, user_data()); // item callback
- }
+ 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() || !Fl::event_inside(o->widget())) &&
+ (!_vscroll->visible() || !Fl::event_inside(_vscroll)) ) {
+ // Handle selection behavior
+ switch ( _prefs.selectmode() ) {
+ case FL_TREE_SELECT_NONE: break; // no selection changes
+ case FL_TREE_SELECT_SINGLE:
+ select_only(o);
+ break;
+ case FL_TREE_SELECT_MULTI:
+ if ( Fl::event_state() & FL_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;
}
@@ -340,93 +710,217 @@ int Fl_Tree::handle(int e) {
return(ret);
}
-/// Deselect item and all its children.
-/// If item is NULL, root() is used.
-/// Handles calling redraw() if anything was changed.
-/// Returns count of how many items were in the 'selected' state,
-/// ie. how many items were "changed".
+/// 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.
///
-/// \p docallback is an optional paramemter that can either be 0 or 1:
+/// The callback can use callback_item() and callback_reason() respectively to determine
+/// the item changed and the reason the callback was called.
///
-/// - 0 - the callback() is not invoked (default)
-/// - 1 - the callback() is invoked once if \b any items changed state,
-/// and item_clicked() will be NULL (since many items could have been changed).
-//
-/// \todo deselect_all()'s docallback should support '2' (invoke callback for each item changed)
+/// \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 FL_TREE_REASON_DESELECTED
+///
+/// \returns count of how many items were actually changed to the deselected state.
///
int Fl_Tree::deselect_all(Fl_Tree_Item *item, int docallback) {
- item = item ? item : root(); // NULL? use root()
- int count = item->deselect_all();
- if ( count ) {
- redraw(); // anything changed? cause redraw
- if ( docallback == 1 )
- do_callback_for_item(0);
+ 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; tchildren(); t++ ) {
+ count += deselect_all(item->child(t), docallback); // recurse
}
return(count);
}
-/// Select item and all its children.
-/// If item is NULL, root() is used.
-/// Handles calling redraw() if anything was changed.
-/// Returns count of how many items were in the 'deselected' state,
-/// ie. how many items were "changed".
+/// 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.
///
-/// \p docallback is an optional paramemter that can either be 0 or 1:
+/// The callback can use callback_item() and callback_reason() respectively to determine
+/// the item changed and the reason the callback was called.
///
-/// - 0 - the callback() is not invoked (default)
-/// - 1 - the callback() is invoked once if \b any items changed state,
-/// and item_clicked() will be NULL (since many items could have been changed).
-///
-/// \todo select_all()'s docallback should support '2' (invoke callback for each item changed)
+/// \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 FL_TREE_REASON_SELECTED
+/// \returns count of how many items were actually changed to the selected state.
///
int Fl_Tree::select_all(Fl_Tree_Item *item, int docallback) {
- item = item ? item : root(); // NULL? use root()
- int count = item->select_all();
- if ( count ) {
- redraw(); // anything changed? cause redraw
- if (docallback == 1)
- do_callback_for_item(0);
+ 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; tchildren(); t++ ) {
+ count += select_all(item->child(t), docallback); // recurse
}
return(count);
}
-/// Select only this item.
-/// If item is NULL, root() is used.
-/// Handles calling redraw() if anything was changed.
-/// Returns how many items were changed, if any.
+/// 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.
///
-/// \p docallback is an optional paramemter that can either be 0, 1 or 2:
+/// The callback can use callback_item() and callback_reason() respectively to determine
+/// the item changed and the reason the callback was called.
///
-/// - 0 - the callback() is not invoked (default)
-/// - 1 - the callback() is invoked once if \b any items changed state,
-/// and item_clicked() will be NULL (since many items could have been changed).
-/// - 2 - the callback() is invoked once for \b each item that changed state,
-/// and the callback() can use item_clicked() to determine the item changed.
+/// \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 FL_TREE_REASON_SELECTED or
+/// FL_TREE_REASON_DESELECTED
+/// \returns the number of items whose selection states were changed, if any.
///
int Fl_Tree::select_only(Fl_Tree_Item *selitem, int docallback) {
- selitem = selitem ? selitem : root(); // NULL? use root()
+ selitem = selitem ? selitem : first(); // NULL? use first()
+ if ( ! selitem ) return(0);
int changed = 0;
for ( Fl_Tree_Item *item = first(); item; item = item->next() ) {
if ( item == selitem ) {
if ( item->is_selected() ) continue; // don't count if already selected
- item->select();
+ select(item, docallback);
++changed;
- if ( docallback == 2 ) do_callback_for_item(item);
} else {
if ( item->is_selected() ) {
- item->deselect();
+ deselect(item, docallback);
++changed;
- if ( docallback == 2 ) do_callback_for_item(item);
}
}
}
- if ( changed ) {
- redraw(); // anything changed? redraw
- if ( docallback == 1 ) do_callback_for_item(0);
- }
return(changed);
}
+/// Adjust the vertical scroll bar so that \p item is visible
+/// \p yoff pixels from the top of the Fl_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 Fl_Tree::show_item(Fl_Tree_Item *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 Fl_Tree::displayed(Fl_Tree_Item *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 Fl_Tree::show_item(Fl_Tree_Item *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 Fl_Tree::show_item_top(Fl_Tree_Item *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 Fl_Tree::show_item_middle(Fl_Tree_Item *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 Fl_Tree::show_item_bottom(Fl_Tree_Item *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 Fl_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 Fl_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 Fl_Tree::display(Fl_Tree_Item *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
@@ -478,5 +972,5 @@ void Fl_Tree::load(Fl_Preferences &prefs)
}
//
-// End of "$Id: Fl_Tree.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Tree.cxx 8632 2011-05-04 02:59:50Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item.cxx
index 7315ef6ff..deeaf5a4c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree_Item.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Tree_Item.cxx 8589 2011-04-14 13:15:13Z manolo $"
//
#include
@@ -14,7 +14,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -44,8 +44,8 @@ Fl_Tree_Item::Fl_Tree_Item(const Fl_Tree_Prefs &prefs) {
_label = 0;
_labelfont = prefs.labelfont();
_labelsize = prefs.labelsize();
- _labelfgcolor = prefs.fgcolor();
- _labelbgcolor = prefs.bgcolor();
+ _labelfgcolor = prefs.labelfgcolor();
+ _labelbgcolor = prefs.labelbgcolor();
_widget = 0;
_open = 1;
_visible = 1;
@@ -165,12 +165,12 @@ int Fl_Tree_Item::find_child(const char *name) {
return(-1);
}
-/// Find item by descending array of names.
+/// Find child item by descending array of names. Does not include self in search.
/// Only Fl_Tree should need this method.
///
/// \returns item, or 0 if not found
///
-const Fl_Tree_Item *Fl_Tree_Item::find_item(char **arr) const {
+const Fl_Tree_Item *Fl_Tree_Item::find_child_item(char **arr) const {
for ( int t=0; tlabel() ) {
if ( strcmp(child(t)->label(), *arr) == 0 ) { // match?
@@ -185,12 +185,12 @@ const Fl_Tree_Item *Fl_Tree_Item::find_item(char **arr) const {
return(0);
}
-/// Find item by by descending array of names.
-/// Only Fl_Tree should need this method.
+/// Find child item by descending array of names. Does not include self in search.
+/// Only Fl_Tree should need this method. Use Fl_Tree::find_item() instead.
///
/// \returns item, or 0 if not found
///
-Fl_Tree_Item *Fl_Tree_Item::find_item(char **arr) {
+Fl_Tree_Item *Fl_Tree_Item::find_child_item(char **arr) {
for ( int t=0; tlabel() ) {
if ( strcmp(child(t)->label(), *arr) == 0 ) { // match?
@@ -205,6 +205,40 @@ Fl_Tree_Item *Fl_Tree_Item::find_item(char **arr) {
return(0);
}
+/// Find item by descending array of \p names. Includes self in search.
+/// Only Fl_Tree should need this method. Use Fl_Tree::find_item() instead.
+///
+/// \returns item, or 0 if not found
+///
+const Fl_Tree_Item *Fl_Tree_Item::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 Fl_Tree should need this method.
+///
+/// \returns item, or 0 if not found
+///
+Fl_Tree_Item *Fl_Tree_Item::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.
///
@@ -265,7 +299,7 @@ Fl_Tree_Item *Fl_Tree_Item::add(const Fl_Tree_Prefs &prefs, const char *new_labe
///
Fl_Tree_Item *Fl_Tree_Item::add(const Fl_Tree_Prefs &prefs, char **arr) {
int t = find_child(*arr);
- Fl_Tree_Item *item;
+ Fl_Tree_Item *item = 0;
if ( t == -1 ) {
item = (Fl_Tree_Item*)add(prefs, *arr);
} else {
@@ -416,7 +450,7 @@ void Fl_Tree_Item::draw_vertical_connector(int x, int y1, int y2, const Fl_Tree_
/// Find the item that the last event was over.
///
-/// Returns the item if its visible, and mouse is over it.
+/// 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.
///
@@ -446,7 +480,7 @@ const Fl_Tree_Item *Fl_Tree_Item::find_clicked(const Fl_Tree_Prefs &prefs) const
/// Non-const version of the above.
/// Find the item that the last event was over.
///
-/// Returns the item if its visible, and mouse is over it.
+/// 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.
///
@@ -473,8 +507,49 @@ Fl_Tree_Item *Fl_Tree_Item::find_clicked(const Fl_Tree_Prefs &prefs) {
return(0);
}
+static void draw_item_focus(Fl_Boxtype B, Fl_Color C, int X, int Y, int W, int H) {
+ if (!Fl::visible_focus()) return;
+ switch (B) {
+ case FL_DOWN_BOX:
+ case FL_DOWN_FRAME:
+ case FL_THIN_DOWN_BOX:
+ case FL_THIN_DOWN_FRAME:
+ X ++;
+ Y ++;
+ default:
+ break;
+ }
+ fl_color(fl_contrast(FL_BLACK, C));
+
+#if defined(USE_X11) || defined(__APPLE_QUARTZ__)
+ fl_line_style(FL_DOT);
+ fl_rect(X + Fl::box_dx(B), Y + Fl::box_dy(B),
+ W - Fl::box_dw(B) - 1, H - Fl::box_dh(B) - 1);
+ fl_line_style(FL_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 fl_line_style() will not draw horizontal lines
+ // on odd-numbered rows...
+ int i, xx, yy;
+
+ X += Fl::box_dx(B);
+ Y += Fl::box_dy(B);
+ W -= Fl::box_dw(B) + 2;
+ H -= Fl::box_dh(B) + 2;
+
+ for (xx = 0, i = 1; xx < W; xx ++, i ++) if (i & 1) fl_point(X + xx, Y);
+ for (yy = 0; yy < H; yy ++, i ++) if (i & 1) fl_point(X + W, Y + yy);
+ for (xx = W; xx > 0; xx --, i ++) if (i & 1) fl_point(X + xx, Y + H);
+ for (yy = H; yy > 0; yy --, i ++) if (i & 1) fl_point(X, Y + yy);
+#endif
+}
+
/// Draw this item and its children.
-void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
+void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
+ Fl_Tree_Item *itemfocus,
const Fl_Tree_Prefs &prefs, int lastchild) {
if ( ! _visible ) return;
fl_font(_labelfont, _labelsize);
@@ -487,12 +562,12 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
W += prefs.openicon()->w();
}
// Colors, fonts
- Fl_Color fg = _selected ? prefs.bgcolor() : _labelfgcolor;
- Fl_Color bg = _selected ? prefs.selectcolor() : _labelbgcolor;
- if ( ! _active ) {
- fg = fl_inactive(fg);
- if ( _selected ) bg = fl_inactive(bg);
- }
+ Fl_Color fg = _selected ? fl_contrast(_labelfgcolor, tree->selection_color())
+ : _active ? _labelfgcolor
+ : fl_inactive(_labelfgcolor);
+ Fl_Color bg = _selected ? _active ? tree->selection_color()
+ : fl_inactive(tree->selection_color())
+ : _labelbgcolor;
// Update the xywh of this item
_xywh[0] = X;
_xywh[1] = Y;
@@ -598,6 +673,10 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
fl_draw(_label, X+useroff, Y+H-fl_descent()-1);
}
}
+ if ( this == itemfocus && Fl::visible_focus() && Fl::focus() == tree) {
+ // Draw focus box around this item
+ draw_item_focus(FL_NO_BOX,bg,bx+1,by+1,bw-1,bh-1);
+ }
Y += H;
} // end drawthis
// Draw children
@@ -608,7 +687,7 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
int child_y_start = Y;
for ( int t=0; tdraw(child_x, Y, child_w, tree, prefs, lastchild);
+ _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
@@ -736,6 +815,115 @@ Fl_Tree_Item *Fl_Tree_Item::prev() {
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.
+///
+Fl_Tree_Item *Fl_Tree_Item::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.
+///
+Fl_Tree_Item *Fl_Tree_Item::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.
+///
+Fl_Tree_Item *Fl_Tree_Item::next_displayed(Fl_Tree_Prefs &prefs) {
+ Fl_Tree_Item *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 ) {
+ Fl_Tree_Item *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.
+ Fl_Tree_Item *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.
+///
+Fl_Tree_Item *Fl_Tree_Item::prev_displayed(Fl_Tree_Prefs &prefs) {
+ Fl_Tree_Item *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.
+ Fl_Tree_Item *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 Fl_Tree_Item::visible_r() const {
+ for (const Fl_Tree_Item *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: Fl_Tree_Item.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Tree_Item.cxx 8589 2011-04-14 13:15:13Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item_Array.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item_Array.cxx
index 16d5dc547..13600bd88 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item_Array.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Item_Array.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree_Item_Array.cxx 6956 2009-12-08 08:06:44Z greg.ercolano $"
+// "$Id: Fl_Tree_Item_Array.cxx 7903 2010-11-28 21:06:39Z matt $"
//
#include
@@ -14,7 +14,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -153,5 +153,5 @@ int Fl_Tree_Item_Array::remove(Fl_Tree_Item *item) {
}
//
-// End of "$Id: Fl_Tree_Item_Array.cxx 6956 2009-12-08 08:06:44Z greg.ercolano $".
+// End of "$Id: Fl_Tree_Item_Array.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Prefs.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Prefs.cxx
index f200c758f..796c21989 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Tree_Prefs.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Tree_Prefs.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tree_Prefs.cxx 7672 2010-07-10 09:44:45Z matt $"
+// "$Id: Fl_Tree_Prefs.cxx 8340 2011-01-30 20:22:06Z greg.ercolano $"
//
#include
@@ -12,7 +12,7 @@
//////////////////////
//
// Fl_Tree -- This file is part of the Fl_Tree widget for FLTK
-// Copyright (C) 2009 by Greg Ercolano.
+// 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
@@ -136,10 +136,8 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
_usericonmarginleft = 3;
_labelmarginleft = 3;
_linespacing = 0;
- _fgcolor = FL_BLACK;
- _bgcolor = FL_WHITE;
- _selectcolor = FL_DARK_BLUE;
- _inactivecolor = FL_GRAY;
+ _labelfgcolor = FL_BLACK;
+ _labelbgcolor = FL_WHITE;
_connectorcolor = Fl_Color(43);
#ifdef __APPLE__
_connectorstyle = FL_TREE_CONNECTOR_NONE;
@@ -166,5 +164,5 @@ Fl_Tree_Prefs::Fl_Tree_Prefs() {
}
//
-// End of "$Id: Fl_Tree_Prefs.cxx 7672 2010-07-10 09:44:45Z matt $".
+// End of "$Id: Fl_Tree_Prefs.cxx 8340 2011-01-30 20:22:06Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
index d636d5e58..cfa440208 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Valuator.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Valuator.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Valuator.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Valuator widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -192,5 +192,5 @@ int Fl_Valuator::format(char* buffer) {
}
//
-// End of "$Id: Fl_Valuator.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Valuator.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
index a786204c1..f4817d812 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Input.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Input.cxx 7117 2010-02-20 21:14:47Z matt $"
+// "$Id: Fl_Value_Input.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Value input widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -145,5 +145,5 @@ Fl_Value_Input::~Fl_Value_Input() {
}
//
-// End of "$Id: Fl_Value_Input.cxx 7117 2010-02-20 21:14:47Z matt $".
+// End of "$Id: Fl_Value_Input.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
index fb9f1ab9b..7dd3f451f 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Output.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Output.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Value_Output.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Value output widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -104,5 +104,5 @@ Fl_Value_Output::Fl_Value_Output(int X, int Y, int W, int H,const char *l)
}
//
-// End of "$Id: Fl_Value_Output.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Value_Output.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
index e5d0e4388..6c5ff22e5 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Value_Slider.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Value_Slider.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Value_Slider.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Value slider widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -82,5 +82,5 @@ int Fl_Value_Slider::handle(int event) {
}
//
-// End of "$Id: Fl_Value_Slider.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Value_Slider.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
index e05f0f503..96754a9d2 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Widget.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Widget.cxx 7321 2010-03-23 17:37:51Z AlbrechtS $"
+// "$Id: Fl_Widget.cxx 7940 2010-12-02 17:58:58Z greg.ercolano $"
//
// Base widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -168,6 +168,7 @@ extern void fl_throw_focus(Fl_Widget*); // in Fl_x.cxx
Fl_Widget::~Fl_Widget() {
Fl::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
@@ -340,5 +341,5 @@ Fl_Widget::do_callback(Fl_Widget* o,void* arg) {
}
//
-// End of "$Id: Fl_Widget.cxx 7321 2010-03-23 17:37:51Z AlbrechtS $".
+// End of "$Id: Fl_Widget.cxx 7940 2010-12-02 17:58:58Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
index 3f2786718..1aadb0130 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window.cxx 7357 2010-03-29 14:10:54Z matt $"
+// "$Id: Fl_Window.cxx 8472 2011-02-25 08:44:47Z AlbrechtS $"
//
// Window widget class for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -29,7 +29,7 @@
// 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
#include
#include
#include
@@ -40,6 +40,8 @@
#include
#endif
+char *Fl_Window::default_xclass_ = 0L;
+
void Fl_Window::_Fl_Window() {
type(FL_WINDOW);
box(FL_FLAT_BOX);
@@ -134,7 +136,7 @@ void Fl_Window::draw() {
}
#endif
-# if defined(USE_CAIRO)
+# if defined(FLTK_USE_CAIRO)
Fl::cairo_make_current(this); // checkout if an update is necessary
# endif
}
@@ -178,7 +180,114 @@ Fl_Window *Fl_Window::current() {
return current_;
}
+/** Returns the default xclass.
+
+ \see Fl_Window::default_xclass(const char *)
+
+ */
+const char *Fl_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 Fl_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 Fl_Window::xclass(const char *)
+*/
+void Fl_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().
+
+ Under X, 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".
+
+ Under Microsoft Windows, 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 Fl_Window::default_xclass(const char *)
+*/
+void Fl_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 Fl_Window::default_xclass(const char *)
+ \see Fl_Window::xclass(const char *)
+*/
+const char *Fl_Window::xclass() const
+{
+ if (xclass_) {
+ return xclass_;
+ } else {
+ return default_xclass();
+ }
+}
+
+/** Gets the current icon window target dependent data. */
+const void *Fl_Window::icon() const {
+ return icon_;
+}
+
+/** Sets the current icon window target dependent data. */
+void Fl_Window::icon(const void * ic) {
+ icon_ = ic;
+}
+
//
-// End of "$Id: Fl_Window.cxx 7357 2010-03-29 14:10:54Z matt $".
+// End of "$Id: Fl_Window.cxx 8472 2011-02-25 08:44:47Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
index 6635133fd..ea563439d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_fullscreen.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_fullscreen.cxx 6905 2009-09-27 12:06:35Z matt $"
+// "$Id: Fl_Window_fullscreen.cxx 8515 2011-03-12 21:36:21Z manolo $"
//
// Fullscreen window support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -66,18 +66,21 @@ void Fl_Window::fullscreen() {
//determine its thickness
border(0);
#endif
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(WIN32) || defined(USE_X11)
int sx, sy, sw, sh;
- Fl::screen_xywh(sx, sy, sw, sh, x()+w()/2, y()+h()/2);
+ Fl::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 (Fl::x()>=sx && Fl::y()>=sy && Fl::x()+Fl::w()<=sx+sw && Fl::y()+Fl::h()<=sy+sh) {
sx = Fl::x(); sy = Fl::y();
sw = Fl::w(); sh = Fl::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); // force it to call XResizeWindow()
+ if (!x()) x(1); // make sure that we actually execute the resize
resize(0,0,Fl::w(),Fl::h());
#endif
}
@@ -91,5 +94,5 @@ void Fl_Window::fullscreen_off(int X,int Y,int W,int H) {
}
//
-// End of "$Id: Fl_Window_fullscreen.cxx 6905 2009-09-27 12:06:35Z matt $".
+// End of "$Id: Fl_Window_fullscreen.cxx 8515 2011-03-12 21:36:21Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
index 120a79854..92a298f03 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_hotspot.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_hotspot.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Window_hotspot.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Common hotspot routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -96,5 +96,5 @@ void Fl_Window::hotspot(const Fl_Widget *o, int offscreen) {
//
-// End of "$Id: Fl_Window_hotspot.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Window_hotspot.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
index 1caea9f97..10ceda599 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Window_iconize.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Window_iconize.cxx 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: Fl_Window_iconize.cxx 8055 2010-12-18 22:31:01Z manolo $"
//
// Window minification code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -37,7 +37,7 @@ void Fl_Window::iconize() {
#ifdef WIN32
ShowWindow(i->xid, SW_SHOWMINNOACTIVE);
#elif defined(__APPLE__)
- MacCollapseWindow((Window)i->xid);
+ i->collapse();
#else
XIconifyWindow(fl_display, i->xid, fl_screen);
#endif
@@ -45,5 +45,5 @@ void Fl_Window::iconize() {
}
//
-// End of "$Id: Fl_Window_iconize.cxx 7351 2010-03-29 10:35:00Z matt $".
+// End of "$Id: Fl_Window_iconize.cxx 8055 2010-12-18 22:31:01Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx b/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
index 1a0f001e8..3557cfa94 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_Wizard.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_Wizard.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_Wizard.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Fl_Wizard widget routines.
//
-// Copyright 1997-2009 by Easy Software Products.
+// 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
@@ -191,5 +191,5 @@ void Fl_Wizard::value(Fl_Widget *kid)
//
-// End of "$Id: Fl_Wizard.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_Wizard.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
index 7503806da..cb35c1b5c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XBM_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XBM_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_XBM_Image.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Fl_XBM_Image routines.
//
-// Copyright 1997-2009 by Bill Spitzak and others.
+// 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
@@ -108,5 +108,5 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) {
//
-// End of "$Id: Fl_XBM_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_XBM_Image.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XColor.H b/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
index 16cb36671..9162f3ae8 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XColor.H
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XColor.H 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_XColor.H 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// X-specific color definitions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -42,5 +42,5 @@ extern unsigned char fl_redmask, fl_greenmask, fl_bluemask;
extern int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;
//
-// End of "$Id: Fl_XColor.H 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_XColor.H 7913 2010-11-29 18:18:27Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx b/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
index 2d7326aa2..7f66eff82 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_XPM_Image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_XPM_Image.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_XPM_Image.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Fl_XPM_Image routines.
//
-// Copyright 1997-2009 by Bill Spitzak and others.
+// 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
@@ -77,7 +77,7 @@ Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
if (*q == '\\') switch (*++q) {
case '\r':
case '\n':
- fgets(q,(buffer+MAXSIZE+20)-q,f); break;
+ if (!fgets(q,(buffer+MAXSIZE+20)-q,f)) { /* no problem if we hit EOF */ } break;
case 0:
break;
case 'x': {
@@ -132,5 +132,5 @@ Fl_XPM_Image::Fl_XPM_Image(const char *name) : Fl_Pixmap((char *const*)0) {
//
-// End of "$Id: Fl_XPM_Image.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_XPM_Image.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx b/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
index 807092a8c..f85461557 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_abort.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_abort.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_abort.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Warning/error message code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -98,5 +98,5 @@ void (*Fl::error)(const char* format, ...) = ::error;
void (*Fl::fatal)(const char* format, ...) = ::fatal;
//
-// End of "$Id: Fl_abort.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_abort.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx b/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
index ac7caf355..6059ae1c1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_add_idle.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_add_idle.cxx 7334 2010-03-25 14:37:46Z AlbrechtS $"
+// "$Id: Fl_add_idle.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Idle routine support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -119,5 +119,5 @@ void Fl::remove_idle(Fl_Idle_Handler cb, void* data) {
}
//
-// End of "$Id: Fl_add_idle.cxx 7334 2010-03-25 14:37:46Z AlbrechtS $".
+// End of "$Id: Fl_add_idle.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx b/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
index 1a9c36ecc..8ebc75f93 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_arg.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_arg.cxx 7334 2010-03-25 14:37:46Z AlbrechtS $"
+// "$Id: Fl_arg.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -68,11 +68,73 @@ extern const char *fl_bg;
extern const char *fl_bg2;
/**
- Consume a single switch from argv, starting at word i.
+ 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 i. You can use this
- function if you prefer to control the incrementing through the
- arguments yourself.
+ recognized) and adds the same value to \p i.
+
+ This is the default argument handler used internally by Fl::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
+
+ Sets the background color using Fl::background().
+
+ \li -bg2 color or -background2 color
+
+ Sets the secondary background color using Fl::background2().
+
+ \li -display host:n.n
+
+ Sets the X display to use; this option is silently
+ ignored under WIN32 and MacOS.
+
+ \li -dnd and -nodnd
+
+ Enables or disables drag and drop text operations
+ using Fl::dnd_text_ops().
+
+ \li -fg color or -foreground color
+
+ Sets the foreground color using Fl::foreground().
+
+ \li -geometry WxH+X+Y
+
+ Sets the initial window position and size according
+ to the standard X geometry string.
+
+ \li -iconic
+
+ Iconifies the window using Fl_Window::iconize().
+
+ \li -kbd and -nokbd
+
+ Enables or disables visible keyboard focus for
+ non-text widgets using Fl::visible_focus().
+
+ \li -name string
+
+ Sets the window class using Fl_Window::xclass().
+
+ \li -scheme string
+
+ Sets the widget scheme using Fl::scheme().
+
+ \li -title string
+
+ Sets the window title using Fl_Window::label().
+
+ \li -tooltips and -notooltips
+
+ Enables or disables tooltips using Fl_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
+ Fl::args(int,char**,int&,Fl_Args_Handler) explicitly.
*/
int Fl::arg(int argc, char **argv, int &i) {
arg_called = 1;
@@ -167,114 +229,59 @@ int Fl::arg(int argc, char **argv, int &i) {
}
-/**
- Consume all switches from argv. Returns number of words eaten
- Returns zero on error. 'i' will either point at first word that
- does not start with '-', at the error word, or after a '--', or at
- argc. If your program does not take any word arguments you can
- report an error if i < argc.
+/**
+ Parse command line switches using the \p cb argument handler.
- FLTK provides an entirely optional command-line switch parser.
- You don't have to call it if you don't like them! Everything it can do
- can be done with other calls to FLTK.
+ Returns 0 on error, or the number of words processed.
-
To use the switch parser, call Fl::args(...) near the start
- of your program. This does not open the display, instead
- switches that need the display open are stashed into static variables.
- Then you must display your first window by calling
- window->show(argc,argv), which will do anything stored in the
- static variables.
+ FLTK provides this as an entirely optional 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.
-
callback lets you define your own switches. It is called
- with the same argc and argv, and with i the
- index of each word. The callback should return zero if the switch is
- unrecognized, and not change i. It should return non-zero if
- the switch is recognized, and add at least 1 to i (it can add
- more to consume words after the switch). This function is called
- before any other tests, so you can override any FLTK
- switch (this is why FLTK can use very short switches instead of
+ To use the switch parser, call Fl::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
+ window->show(argc,argv), 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
+ you can also override any standard FLTK switch
+ (this is why FLTK can use very short switches instead of
the long ones all other toolkits force you to use).
-
-
On return i is set to the index of the first non-switch.
+ See Fl::arg() for descriptions of the standard switches.
+
+ On return \p i is set to the index of the first non-switch.
This is either:
-
- - The first word that does not start with '-'.
- - The word '-' (used by many programs to name stdin as a file)
- - The first unrecognized switch (return value is 0).
- - argc
-
+ \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 i unless an unrecognized switch is found,
- in which case it is zero. If your program takes no arguments other
+ 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 argc.
+ than \p argc.
-
All switches except -bg2 may be abbreviated one letter and case is ignored:
-
-
- - -bg color or -background color
-
-
Sets the background color using Fl::background().
-
- - -bg2 color or -background2 color
-
-
Sets the secondary background color using Fl::background2().
-
- - -display host:n.n
-
-
Sets the X display to use; this option is silently
- ignored under WIN32 and MacOS.
-
- - -dnd and -nodnd
-
-
Enables or disables drag and drop text operations
- using Fl::dnd_text_ops().
-
- - -fg color or -foreground color
-
-
Sets the foreground color using Fl::foreground().
-
- - -geometry WxH+X+Y
-
-
Sets the initial window position and size according
- to the standard X geometry string.
-
- - -iconic
-
-
Iconifies the window using Fl_Window::iconize().
-
- - -kbd and -nokbd
-
-
Enables or disables visible keyboard focus for
- non-text widgets using Fl::visible_focus().
-
- - -name string
-
-
Sets the window class using Fl_Window::xclass().
-
- - -scheme string
-
-
Sets the widget scheme using Fl::scheme().
-
- - -title string
-
-
Sets the window title using Fl_Window::label().
-
- - -tooltips and -notooltips
-
-
Enables or disables tooltips using Fl_Tooltip::enable().
-
-
-
- The second form of Fl::args() is useful if your program does
- not have command line switches of its own. It parses all the switches,
- and if any are not recognized it calls Fl::abort(Fl::help).
-
-
A usage string is displayed if Fl::args() detects an invalid
- argument on the command-line. You can change the message by setting the
+ A usage string is displayed if Fl::args() detects an invalid argument
+ on the command-line. You can change the message by setting the
Fl::help pointer.
+
+ A very simple command line parser can be found in examples/howto-parse-args.cxx
+
+ The simpler Fl::args(int argc, char **argv) form is useful if your program
+ does not have command line switches of its own.
*/
int Fl::args(int argc, char** argv, int& i, Fl_Args_Handler cb) {
@@ -387,7 +394,15 @@ static const char * const helpmsg =
" -to[oltips]";
const char * const Fl::help = helpmsg+13;
-/** See Fl::args(int argc, char **argv, int& i, int (*cb)(int,char**,int&)) */
+
+/**
+ Parse all command line switches matching standard FLTK options only.
+
+ It parses all the switches, and if any are not recognized it calls
+ Fl::abort(Fl::help), i.e. unlike the long form, an unrecognized
+ switch generates an error message and causes the program to exit.
+
+ */
void Fl::args(int argc, char **argv) {
int i; if (Fl::args(argc,argv,i) < argc) Fl::error(helpmsg);
}
@@ -531,5 +546,5 @@ int XParseGeometry(const char* string, int* x, int* y,
#endif // ifdef WIN32
//
-// End of "$Id: Fl_arg.cxx 7334 2010-03-25 14:37:46Z AlbrechtS $".
+// End of "$Id: Fl_arg.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx b/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
index dce2d11b7..fe72c229d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_compose.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_compose.cxx 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: Fl_compose.cxx 8626 2011-04-27 11:21:57Z manolo $"
//
// Character compose processing for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,223 +28,75 @@
#include
#include
-//
-// MRS: Uncomment the following define to get the original (pre-1.1.2)
-// dead key support code. The original code apparently did not
-// work on Belgian keyboards.
-//
-
-//#define OLD_DEAD_KEY_CODE
-
-
-#ifdef __APPLE__
-
-static const char* const compose_pairs =
-" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "//00A0 ...
-"`A'A^A~A:A*AAE,C`E'E^E:E`I'I^I:I-D~N`O'O^O~O:Ox O/`U'U^U:U'YTHss" //00C0 ...
-"`a'a^a~a:a*aae,c`e'e^e:e`i'i^i:i-d~n`o'o^o~o:o-:o/`u'u^u:u'yth:y";//00E0 ...
-
-#else
-
-static const char* const compose_pairs =
-"=E _'f _\"..+ ++^ %%^S< OE ^Z ^''^^\"\"^-*- --~ TM^s> oe ^z:Y"
-" ! % # $ y=| & : c a <<~ - r _ * +-2 3 ' u p . , 1 o >>141234? "
-"`A'A^A~A:A*AAE,C`E'E^E:E`I'I^I:I-D~N`O'O^O~O:Ox O/`U'U^U:U'YTHss"
-"`a'a^a~a:a*aae,c`e'e^e:e`i'i^i:i-d~n`o'o^o~o:o-:o/`u'u^u:u'yth:y";
-
-#endif
-
-#if !defined(WIN32) && defined(OLD_DEAD_KEY_CODE) // X only
-// X dead-key lookup table. This turns a dead-key keysym into the
-// first of two characters for one of the compose sequences. These
-// keysyms start at 0xFE50.
-// Win32 handles the dead keys before FLTK can see them. This is
-// unfortunate, because you don't get the preview effect.
-static char dead_keys[] = {
- '`', // XK_dead_grave
- '\'', // XK_dead_acute
- '^', // XK_dead_circumflex
- '~', // XK_dead_tilde
- '_', // XK_dead_macron
- 0, // XK_dead_breve
- '.', // XK_dead_abovedot
- ':', // XK_dead_diaeresis
- '*', // XK_dead_abovering
- 0, // XK_dead_doubleacute
- 'v', // XK_dead_caron
- ',' // XK_dead_cedilla
-// 0, // XK_dead_ogonek
-// 0, // XK_dead_iota
-// 0, // XK_dead_voiced_sound
-// 0, // XK_dead_semivoiced_sound
-// 0 // XK_dead_belowdot
-};
-#endif // !WIN32 && OLD_DEAD_KEY_CODE
-
#ifndef FL_DOXYGEN
int Fl::compose_state = 0;
#endif
+#if !defined(WIN32) && !defined(__APPLE__)
+extern XIC fl_xim_ic;
+#endif
+
/** Any text editing widget should call this for each FL_KEYBOARD event.
- Use of this function is very simple.
-
- If true is returned, then it has modified the
- Fl::event_text() and Fl::event_length() to a set of bytes to
- insert (it may be of zero length!). In will also set the "del"
- parameter to the number of bytes to the left of the cursor to
- delete, this is used to delete the results of the previous call to
- Fl::compose().
-
-
If false 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.
-
-
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.
-*/
+ Use of this function is very simple.
+
+
If true is returned, then it has modified the
+ Fl::event_text() and Fl::event_length() to a set of bytes to
+ insert (it may be of zero length!). In will also set the "del"
+ parameter to the number of bytes to the left of the cursor to
+ delete, this is used to delete the results of the previous call to
+ Fl::compose().
+
+
If false 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.
+
+
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 Fl::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(Fl::e_length == 0 || Fl::e_keysym == FL_Enter || Fl::e_keysym == FL_KP_Enter ||
+ Fl::e_keysym == FL_Tab || Fl::e_keysym == FL_Escape || Fl::e_state&(FL_META | FL_CTRL) ) {
+ return 0;
+ }
+#elif defined(WIN32)
unsigned char ascii = (unsigned)e_text[0];
-
- // Alt+letters are reserved for shortcuts. But alt+foreign letters
- // has to be allowed, because some key layouts require alt to be held
- // down in order to type them...
- //
- // OSX users sometimes need to hold down ALT for keys, so we only check
- // for META on OSX...
-#ifdef __APPLE__
- if ((e_state & FL_META) && !(ascii & 128)) return 0;
+ if ((e_state & (FL_ALT | FL_META)) && !(ascii & 128)) return 0;
#else
- if ((e_state & (FL_ALT|FL_META)) && !(ascii & 128)) return 0;
-#endif // __APPLE__
-
- if (compose_state == 1) { // after the compose key
- if ( // do not get distracted by any modifier keys
- e_keysym==FL_Shift_L||
- e_keysym==FL_Shift_R ||
- e_keysym==FL_Alt_L ||
- e_keysym==FL_Alt_R ||
- e_keysym==FL_Meta_L ||
- e_keysym==FL_Meta_R ||
- e_keysym==FL_Control_R ||
- e_keysym==FL_Control_L ||
- e_keysym==FL_Menu
- ) return 0;
-
- if (ascii == ' ') { // space turns into nbsp
-#ifdef __APPLE__
- int len = fl_utf8encode(0xCA, e_text);
- e_text[len] = '\0';
- e_length = len;
- #else
- int len = fl_utf8encode(0xA0, e_text);
- e_text[len] = '\0';
- e_length = len;
+ unsigned char ascii = (unsigned)e_text[0];
+ if ((e_state & (FL_ALT | FL_META | FL_CTRL)) && !(ascii & 128)) return 0;
#endif
- compose_state = 0;
- return 1;
- } else if (ascii < ' ' || ascii == 127) {
- compose_state = 0;
- return 0;
- }
-
- // see if it is either character of any pair:
- for (const char *p = compose_pairs; *p; p += 2)
- if (p[0] == ascii || p[1] == ascii) {
- if (p[1] == ' ') {
- int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
- e_text[len] = '\0';
- e_length = len;
- }
-
- compose_state = ascii;
- return 1;
- }
-
- if (e_length) { // compose key also "quotes" control characters
- compose_state = 0;
- return 1;
- }
-
- } else if (compose_state) { // second character of compose
-
- char c1 = char(compose_state); // retrieve first character
-#ifdef __APPLE__
- if ( (c1==0x60 && ascii==0xab) || (c1==0x27 && ascii==0x60)) {
- del = 1;
- compose_state = '^';
- e_text[0] = 0xf6;
- return 1;
- }
- if (ascii==' ') {
- del = 0;
- compose_state = 0;
- return 0;
- }
+ if(Fl::compose_state) {
+ del = Fl::compose_state;
+ Fl::compose_state = 0;
+#ifndef __APPLE__
+ } else {
+ // Only insert non-control characters:
+ if (! (ascii & ~31 && ascii!=127)) { return 0; }
#endif
- // now search for the pair in either order:
- for (const char *p = compose_pairs; *p; p += 2) {
- if (p[0] == ascii && p[1] == c1 || p[1] == ascii && p[0] == c1) {
- int len = fl_utf8encode((p-compose_pairs)/2+0xA0, e_text);
- e_text[len] = '\0';
- e_length = len;
- del = 1; // delete the old character and insert new one
- compose_state = 0;
- return 1;
- }
- }
-
}
-
- int i = e_keysym;
-
- // See if they type the compose prefix key:
- if (i == FL_Control_R || i == 0xff20/* Multi-Key */) {
- compose_state = 1;
- return 1;
- }
-
-#ifdef WIN32
-#elif (defined __APPLE__)
- if (e_state & 0x40000000) {
- if (ascii<0x80)
- compose_state = ascii;
- else
- compose_state = compose_pairs[(ascii-0x80)*2];
- return 1;
- }
-#else
- // See if they typed a dead key. This gets it into the same state as
- // typing prefix+accent:
- if (i >= 0xfe50 && i <= 0xfe5b) {
-# ifdef OLD_DEAD_KEY_CODE
- ascii = dead_keys[i-0xfe50];
- for (const char *p = compose_pairs; *p; p += 2)
- if (p[0] == ascii) {
- compose_state = ascii;
- return 1;
- }
-# else
- ascii = e_text[0];
- for (const char *p = compose_pairs; *p; p += 2)
- if (p[0] == ascii ||
- (p[1] == ' ' && (p - compose_pairs) / 2 + 0xA0 == ascii)) {
- compose_state = p[0];
- return 1;
- }
-# endif // OLD_DEAD_KEY_CODE
- compose_state = 0;
- return 1;
- }
-#endif
-
- // Only insert non-control characters:
- if (e_length && (ascii & ~31 && ascii!=127)) {compose_state = 0; return 1;}
-
- return 0;
+ return 1;
}
+/**
+ If the user moves the cursor, be sure to call Fl::compose_reset().
+ The next call to Fl::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 Fl::compose_reset()
+{
+ Fl::compose_state = 0;
+#if !defined(WIN32) && !defined(__APPLE__)
+ if (fl_xim_ic) XmbResetIC(fl_xim_ic);
+#endif
+}
+//
+// End of "$Id: Fl_compose.cxx 8626 2011-04-27 11:21:57Z manolo $"
+//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_display.cxx b/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
index 09d74c7c0..c661d236c 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_display.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_display.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_display.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Display function for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -56,5 +56,5 @@ void Fl::display(const char *d) {
}
//
-// End of "$Id: Fl_display.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_display.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
index 065ccda34..80bcf91b1 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_get_key.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -65,5 +65,5 @@ int Fl::get_key(int k) {
#endif
//
-// End of "$Id: Fl_get_key.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_get_key.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
index 17617ad69..167a70665 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key_mac.cxx 7615 2010-05-26 21:25:11Z manolo $"
+// "$Id: Fl_get_key_mac.cxx 8624 2011-04-26 17:28:10Z manolo $"
//
// MacOS keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -34,8 +34,10 @@
#include
// convert an FLTK (X) keysym to a MacOS symbol:
-// See also the inverse converter in Fl_mac.cxx
-// This table is in numeric order by FLTK symbol order for binary search:
+// 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, '/' },
@@ -49,12 +51,12 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 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, FL_BackSpace }, { 48, FL_Tab }, { 36, FL_Enter }, { 127, FL_Pause },
- { 107, FL_Scroll_Lock }, { 53, FL_Escape }, { 0x73, FL_Home }, { 123, FL_Left },
+ { 33, '[' }, { 30, ']' }, { 50, '`' }, { 42, '\\' },
+ { 51, FL_BackSpace }, { 48, FL_Tab }, { 36, FL_Enter }, { 0x7F, FL_Pause },
+ { 0x7F, FL_Scroll_Lock }, { 53, FL_Escape }, { 0x73, FL_Home }, { 123, FL_Left },
{ 126, FL_Up }, { 124, FL_Right }, { 125, FL_Down }, { 0x74, FL_Page_Up },
- { 0x79, FL_Page_Down }, { 119, FL_End }, { 0x71, FL_Print }, { 127, FL_Insert },
- { 0x6e, FL_Menu }, { 114, FL_Help }, /*{ 0x47, FL_Num_Lock },*/
+ { 0x79, FL_Page_Down }, { 119, FL_End }, { 0x7F, FL_Print }, { 0x7F, FL_Insert },
+ { 0x6e, FL_Menu }, { 114, FL_Help }, { 0x47, FL_Num_Lock },
{ 76, FL_KP_Enter }, { 67, FL_KP+'*' }, { 69, FL_KP+'+'}, { 78, FL_KP+'-' }, { 65, FL_KP+'.' }, { 75, FL_KP+'/' },
{ 82, FL_KP+'0' }, { 83, FL_KP+'1' }, { 84, FL_KP+'2' }, { 85, FL_KP+'3' },
{ 86, FL_KP+'4' }, { 87, FL_KP+'5' }, { 88, FL_KP+'6' }, { 89, FL_KP+'7' },
@@ -62,9 +64,10 @@ static const struct {unsigned short vk, fltk;} vktab[] = {
{ 0x7a, FL_F+1 }, { 0x78, FL_F+2 }, { 0x63, FL_F+3 }, { 0x76, FL_F+4 },
{ 0x60, FL_F+5 }, { 0x61, FL_F+6 }, { 0x62, FL_F+7 }, { 0x64, FL_F+8 },
{ 0x65, FL_F+9 }, { 0x6D, FL_F+10 }, { 0x67, FL_F+11 }, { 0x6f, FL_F+12 },
- { 56, FL_Shift_L }, { 56, FL_Shift_R }, { 59, FL_Control_L }, { 59, FL_Control_R },
- { 57, FL_Caps_Lock }, { 55, FL_Meta_L }, { 55, FL_Meta_R },
- { 58, FL_Alt_L }, { 58, FL_Alt_R }, /*{ 0x75, FL_Delete },*/ { 0x47, FL_Delete },
+ { 0x69, FL_F+13 }, { 0x6B, FL_F+14 }, { 0x71, FL_F+15 }, { 0x6A, FL_F+16 },
+ { 0x38, FL_Shift_L }, { 0x3C, FL_Shift_R }, { 0x3B, FL_Control_L }, { 0x3E, FL_Control_R },
+ { 0x39, FL_Caps_Lock }, { 0x37, FL_Meta_L }, { 0x36, FL_Meta_R },
+ { 0x3A, FL_Alt_L }, { 0x3D, FL_Alt_R }, { 0x75, FL_Delete },
};
static int fltk2mac(int fltk) {
@@ -83,8 +86,6 @@ int Fl::event_key(int k) {
return get_key(k);
}
-#include
-
//: returns true, if that key is pressed right now
int Fl::get_key(int k) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
@@ -94,8 +95,13 @@ int Fl::get_key(int k) {
else
#endif
{
- KeyMap foo;
- GetKeys(foo);
+ 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) {
@@ -114,5 +120,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_mac.cxx 7615 2010-05-26 21:25:11Z manolo $".
+// End of "$Id: Fl_get_key_mac.cxx 8624 2011-04-26 17:28:10Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
index 1f14b4cda..e935a2ebf 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_key_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_key_win32.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_get_key_win32.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// WIN32 keyboard state routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -134,5 +134,5 @@ int Fl::get_key(int k) {
}
//
-// End of "$Id: Fl_get_key_win32.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_get_key_win32.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx b/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
index 176fece6c..35e9a9f25 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_get_system_colors.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_get_system_colors.cxx 7352 2010-03-29 10:47:11Z matt $"
+// "$Id: Fl_get_system_colors.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// System color support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -422,5 +422,5 @@ int Fl::reload_scheme() {
//
-// End of "$Id: Fl_get_system_colors.cxx 7352 2010-03-29 10:47:11Z matt $".
+// End of "$Id: Fl_get_system_colors.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx b/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
index 8a609675d..76c9e9e15 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_grab.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_grab.cxx 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: Fl_grab.cxx 8055 2010-12-18 22:31:01Z manolo $"
//
// Grab/release code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -47,7 +47,6 @@ extern HWND fl_capture;
#endif
#ifdef __APPLE__
-extern void MACsetkeywindow(void *nsw);
extern void *fl_capture;
#endif
@@ -59,7 +58,7 @@ void Fl::grab(Fl_Window* win) {
SetCapture(fl_capture);
#elif defined(__APPLE__)
fl_capture = Fl_X::i(first_window())->xid;
- MACsetkeywindow(fl_capture);
+ Fl_X::i(first_window())->set_key_window();
#else
XGrabPointer(fl_display,
fl_xid(first_window()),
@@ -101,5 +100,5 @@ void Fl::grab(Fl_Window* win) {
}
//
-// End of "$Id: Fl_grab.cxx 7351 2010-03-29 10:35:00Z matt $".
+// End of "$Id: Fl_grab.cxx 8055 2010-12-18 22:31:01Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx b/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
index 58ae297e6..e95bceb97 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_lock.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_lock.cxx 6787 2009-05-14 20:16:09Z engelsman $"
+// "$Id: Fl_lock.cxx 8393 2011-02-06 19:46:11Z manolo $"
//
// Multi-threading support code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -121,11 +121,15 @@ int Fl::get_awake_handler_(Fl_Awake_Handler &func, void *&data)
return ret;
}
-//
/**
- Let the main thread know an update is pending
- and have it call a specific function
- See void awake(void* message=0).
+ 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 Fl::awake(void* message=0)
*/
int Fl::awake(Fl_Awake_Handler func, void *data) {
int ret = add_awake_handler_(func, data);
@@ -135,12 +139,13 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
////////////////////////////////////////////////////////////////
// Windows threading...
-/** \fn void Fl::lock()
+/** \fn int Fl::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.
+ 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.
@@ -150,6 +155,9 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
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
*/
@@ -162,7 +170,7 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
See also: \ref advanced_multithreading
*/
/** \fn void Fl::awake(void* msg)
- The awake() method sends a message pointer to the main thread,
+ Sends a message pointer to the main thread,
causing any pending Fl::wait() call to
terminate so that the main thread can retrieve the message and any pending
redraws can be processed.
@@ -172,12 +180,6 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
thousand) depth. The default message handler saves the last message which
can be accessed using the
Fl::thread_message() function.
-
- The second form of awake() registers a function that will be
- called by the main thread during the next message handling cycle.
- awake() will return 0 if the callback function was registered,
- and -1 if registration failed. Over a thousand awake callbacks can be
- registered simultaneously.
In the context of a threaded application, a call to Fl::awake() with no
argument will trigger event loop handling in the main thread. Since
@@ -187,7 +189,6 @@ int Fl::awake(Fl_Awake_Handler func, void *data) {
See also: \ref advanced_multithreading
*/
#ifdef WIN32
-# include
# include
# include
# include
@@ -231,7 +232,7 @@ static void lock_function() {
EnterCriticalSection(&cs);
}
-void Fl::lock() {
+int Fl::lock() {
if (!main_thread) InitializeCriticalSection(&cs);
lock_function();
@@ -241,6 +242,7 @@ void Fl::lock() {
fl_unlock_function = unlock_function;
main_thread = GetCurrentThreadId();
}
+ return 0;
}
void Fl::unlock() {
@@ -305,7 +307,7 @@ static void unlock_function_rec() {
# endif // PTHREAD_MUTEX_RECURSIVE
void Fl::awake(void* msg) {
- write(thread_filedes[1], &msg, sizeof(void*));
+ if (write(thread_filedes[1], &msg, sizeof(void*))==0) { /* ignore */ }
}
static void* thread_message_;
@@ -316,7 +318,9 @@ void* Fl::thread_message() {
}
static void thread_awake_cb(int fd, void*) {
- read(fd, &thread_message_, sizeof(void*));
+ if (read(fd, &thread_message_, sizeof(void*))==0) {
+ /* This should never happen */
+ }
Fl_Awake_Handler func;
void *data;
while (Fl::get_awake_handler_(func, data)==0) {
@@ -328,11 +332,13 @@ static void thread_awake_cb(int fd, void*) {
extern void (*fl_lock_function)();
extern void (*fl_unlock_function)();
-void Fl::lock() {
+int Fl::lock() {
if (!thread_filedes[1]) {
// Initialize thread communication pipe to let threads awake FLTK
// from Fl::wait()
- pipe(thread_filedes);
+ if (pipe(thread_filedes)==-1) {
+ /* this should not happen */
+ }
// Make the write side of the pipe non-blocking to avoid deadlock
// conditions (STR #1537)
@@ -361,6 +367,7 @@ void Fl::lock() {
}
fl_lock_function();
+ return 0;
}
void Fl::unlock() {
@@ -393,8 +400,19 @@ void lock_ring() {
void Fl::awake(void*) {
}
+int Fl::lock() {
+ return 1;
+}
+
+void Fl::unlock() {
+}
+
+void* Fl::thread_message() {
+ return NULL;
+}
+
#endif // WIN32
//
-// End of "$Id: Fl_lock.cxx 6787 2009-05-14 20:16:09Z engelsman $".
+// End of "$Id: Fl_lock.cxx 8393 2011-02-06 19:46:11Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx b/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
index 82d9f6a65..38c0f21ea 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_mac.cxx 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: Fl_mac.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// MacOS specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -2866,5 +2866,5 @@ void MacUnmapWindow(Fl_Window *w, WindowPtr p) {
#endif // FL_DOXYGEN
//
-// End of "$Id: Fl_mac.cxx 7351 2010-03-29 10:35:00Z matt $".
+// End of "$Id: Fl_mac.cxx 7913 2010-11-29 18:18:27Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx b/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
index 17b7bfeeb..3a7668858 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_own_colormap.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_own_colormap.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_own_colormap.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Private colormap support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -86,5 +86,5 @@ void Fl::own_colormap() {
#endif
//
-// End of "$Id: Fl_own_colormap.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_own_colormap.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx b/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
index 7daf75d3b..98c3c3a92 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_visual.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_visual.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: Fl_visual.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Visual support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -151,5 +151,5 @@ int Fl::visual(int flags) {
#endif
//
-// End of "$Id: Fl_visual.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: Fl_visual.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx b/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
index 5dfdb7aae..54d9c813d 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_win32.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_win32.cxx 8759 2011-05-30 12:33:51Z manolo $"
//
// WIN32-specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -29,14 +29,16 @@
// 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 FL_DOXYGEN
#include
-#include
#include
#include
#include
#include
#include
+#include
#include "flstring.h"
#include "Fl_Font.H"
#include
@@ -46,30 +48,25 @@
#ifdef __CYGWIN__
# include
# include
-#else
-# if !defined(USE_WSOCK1)
-# include
-#else
-# include
-# endif
#endif
-#if !defined(USE_WSOCK1)
-# define WSCK_DLL_NAME "WS2_32.DLL"
-#else
-# define WSCK_DLL_NAME "WSOCK32.DLL"
-#endif
-#include
-#include
-#if defined(__GNUC__) && __GNUC__ >= 3
+#if !defined(NO_TRACK_MOUSE)
+# include // 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
#endif
-// The following include files require GCC 3.x or a non-GNU compiler...
-#if !defined(__GNUC__) || __GNUC__ >= 3
-# include
-# include
-#endif // !__GNUC__ || __GNUC__ >= 3
+#include
+#include
#include "aimm.h"
@@ -97,20 +94,24 @@
static Fl_GDI_Graphics_Driver fl_gdi_driver;
static Fl_Display_Device fl_gdi_display(&fl_gdi_driver);
-FL_EXPORT Fl_Display_Device *fl_display_device = (Fl_Display_Device*)&fl_gdi_display; // does not change
FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver = (Fl_Graphics_Driver*)&fl_gdi_driver; // the current target driver of graphics operations
-FL_EXPORT Fl_Surface_Device *fl_surface = (Fl_Surface_Device*)fl_display_device; // the current target surface of graphics operations
+Fl_Surface_Device* Fl_Surface_Device::_surface = (Fl_Surface_Device*)&fl_gdi_display; // the current target surface of graphics operations
+Fl_Display_Device *Fl_Display_Device::_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 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) {
@@ -245,9 +246,7 @@ static Fl_Window *track_mouse_win=0; // current TrackMouseEvent() window
static int maxfd = 0;
static fd_set fdsets[3];
-#if !defined(__GNUC__) || __GNUC__ >= 3
extern IDropTarget *flIDropTarget;
-#endif // !__GNUC__ || __GNUC__ >= 3
static int nfds = 0;
static int fd_array_size = 0;
@@ -568,7 +567,7 @@ void Fl::copy(const char *stuff, int len, int clipboard) {
EmptyClipboard();
HGLOBAL hMem = GlobalAlloc(GHND, utf16_len * 2 + 2); // moveable and zero'ed mem alloc.
LPVOID memLock = GlobalLock(hMem);
- fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len * 2);
+ fl_utf8toUtf16(fl_selection_buffer[clipboard], fl_selection_length[clipboard], (unsigned short*) memLock, utf16_len + 1);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
@@ -743,6 +742,7 @@ static const struct {unsigned short vk, fltk, extended;} vktab[] = {
{VK_LWIN, FL_Meta_L},
{VK_RWIN, FL_Meta_R},
{VK_APPS, FL_Menu},
+ {VK_SLEEP, FL_Sleep},
{VK_MULTIPLY, FL_KP+'*'},
{VK_ADD, FL_KP+'+'},
{VK_SUBTRACT, FL_KP+'-'},
@@ -750,6 +750,23 @@ static const struct {unsigned short vk, fltk, extended;} vktab[] = {
{VK_DIVIDE, FL_KP+'/'},
{VK_NUMLOCK, FL_Num_Lock},
{VK_SCROLL, FL_Scroll_Lock},
+# if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)
+ {VK_BROWSER_BACK, FL_Back},
+ {VK_BROWSER_FORWARD, FL_Forward},
+ {VK_BROWSER_REFRESH, FL_Refresh},
+ {VK_BROWSER_STOP, FL_Stop},
+ {VK_BROWSER_SEARCH, FL_Search},
+ {VK_BROWSER_FAVORITES, FL_Favorites},
+ {VK_BROWSER_HOME, FL_Home_Page},
+ {VK_VOLUME_MUTE, FL_Volume_Mute},
+ {VK_VOLUME_DOWN, FL_Volume_Down},
+ {VK_VOLUME_UP, FL_Volume_Up},
+ {VK_MEDIA_NEXT_TRACK, FL_Media_Next},
+ {VK_MEDIA_PREV_TRACK, FL_Media_Prev},
+ {VK_MEDIA_STOP, FL_Media_Stop},
+ {VK_MEDIA_PLAY_PAUSE, FL_Media_Play},
+ {VK_LAUNCH_MAIL, FL_Mail},
+#endif
{0xba, ';'},
{0xbb, '='},
{0xbc, ','},
@@ -1076,9 +1093,20 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
}
}
- } else if ((lParam & (1<<31))==0){
+ } 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;
+ Fl::e_length = fl_utf8fromwc(buffer, 1024, &u, 1);
+ buffer[Fl::e_length] = 0;
+ } else { // set if "extended key" (never printable?)
+ buffer[0] = 0;
+ Fl::e_length = 0;
+ }
+#else
buffer[0] = 0;
Fl::e_length = 0;
+#endif
}
Fl::e_text = buffer;
if (lParam & (1<<31)) { // key up events.
@@ -1087,7 +1115,11 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
}
// for (int i = lParam&0xff; i--;)
while (window->parent()) window = window->window();
- if (Fl::handle(FL_KEYBOARD,window)) return 0;
+ if (Fl::handle(FL_KEYBOARD,window)) {
+ if (uMsg==WM_DEADCHAR || uMsg==WM_SYSDEADCHAR)
+ Fl::compose_state = 1;
+ return 0;
+ }
break;}
case WM_MOUSEWHEEL: {
@@ -1400,14 +1432,16 @@ Fl_X* Fl_X::make(Fl_Window* w) {
first_class_name = class_name;
}
- const wchar_t* class_namew = L"FLTK";
- const wchar_t* message_namew = L"FLTK::ThreadWakeup";
- if (!class_name_list.has_name(class_name)) {
- WNDCLASSEX wc;
- WNDCLASSEXW wcw;
+ wchar_t class_namew[100]; // (limited) buffer for Windows class name
- memset(&wc, 0, sizeof(wc));
- wc.cbSize = sizeof(WNDCLASSEX);
+ // convert UTF-8 class_name to wchar_t for RegisterClassExW and CreateWindowExW
+
+ fl_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);
@@ -1428,13 +1462,11 @@ Fl_X* Fl_X::make(Fl_Window* w) {
wcw.hbrBackground = NULL;
wcw.lpszMenuName = NULL;
wcw.lpszClassName = class_namew;
- wcw.cbSize = sizeof(WNDCLASSEXW);
RegisterClassExW(&wcw);
- class_name_list.add_name((const char *)class_namew);
+ class_name_list.add_name(class_name);
}
- // const char* message_name = "FLTK::ThreadWakeup";
- // if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessage(message_name);
+ const wchar_t* message_namew = L"FLTK::ThreadWakeup";
if (!fl_wake_msg) fl_wake_msg = RegisterWindowMessageW(message_namew);
HWND parent;
@@ -1547,28 +1579,21 @@ Fl_X* Fl_X::make(Fl_Window* w) {
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 loose the capture.
+ // other windows from the code, or we lose the capture.
ShowWindow(x->xid, !showit ? SW_SHOWMINNOACTIVE :
(Fl::grab() || (style & WS_POPUP)) ? SW_SHOWNOACTIVATE : SW_SHOWNORMAL);
- // Drag-n-drop requires GCC 3.x or a non-GNU compiler...
-#if !defined(__GNUC__) || __GNUC__ >= 3
// Register all windows for potential drag'n'drop operations
- static char oleInitialized = 0;
- if (!oleInitialized) { OleInitialize(0L); oleInitialized=1; }
-
+ fl_OleInitialize();
RegisterDragDrop(x->xid, flIDropTarget);
+
if (!fl_aimm) {
- static char been_here = 0;
- if (!been_here && !oleInitialized) CoInitialize(NULL);
- been_here = 1;
CoCreateInstance(CLSID_CActiveIMM, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveIMMApp, (void**) &fl_aimm);
if (fl_aimm) {
fl_aimm->Activate(TRUE);
}
}
-#endif // !__GNUC__ || __GNUC__ >= 3
if (w->modal()) {Fl::modal_ = w; fl_fix_focus();}
return x;
@@ -1927,13 +1952,73 @@ void fl_cleanup_dc_list(void) { // clean up the list
}
Fl_Region XRectangleRegion(int x, int y, int w, int h) {
- if (Fl_Surface_Device::surface()->type() == Fl_Display_Device::device_type) return CreateRectRgn(x,y,x+w,y+h);
+ if (Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::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 Fl_Window *w) {
+ Fl_X *temp = Fl_X::i(w);
+ return temp ? temp->xid : 0;
+}
+
+int Fl_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 Fl_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 Fl_Paged_Device::print_window(Fl_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;
+ Fl_Display_Device::display_device()->set_current(); // make window current
+ win->show();
+ Fl::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 = fl_read_image(NULL, r.left, r.top, ww, bt + by);
+ uchar *left_image = fl_read_image(NULL, r.left, r.top, bx, wh);
+ uchar *right_image = fl_read_image(NULL, r.right - bx, r.top, bx, wh);
+ uchar *bottom_image = fl_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
+ fl_draw_image(top_image, x_offset, y_offset, ww, bt + by, 3);
+ fl_draw_image(left_image, x_offset, y_offset, bx, wh, 3);
+ fl_draw_image(right_image, x_offset + win->w() + bx, y_offset, bx, wh, 3);
+ fl_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 Fl_Printer class creating a "Print front window" button in a separate window
// contains also preparePrintFront call above
@@ -1949,11 +2034,14 @@ void printFront(Fl_Widget *o, void *data)
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 (win->w() > w || win->h() > h) {
- scale = (float)w/win->w();
- if ((float)h/win->h() < scale) scale = (float)h/win->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
@@ -1964,9 +2052,8 @@ void printFront(Fl_Widget *o, void *data)
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_widget( win );
- //printer.print_window_part( win, 0,0, win->w(), win->h() );
+#else
+ printer.print_window(win);
#endif
printer.end_page();
printer.end_job();
@@ -1989,5 +2076,5 @@ void preparePrintFront(void)
#endif // FL_DOXYGEN
//
-// End of "$Id: Fl_win32.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_win32.cxx 8759 2011-05-30 12:33:51Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/Fl_x.cxx b/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
index 4e9cebc5e..4ef92b064 100644
--- a/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
+++ b/plugins/zynaddsubfx/fltk/src/Fl_x.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: Fl_x.cxx 7659 2010-07-01 13:21:32Z manolo $"
+// "$Id: Fl_x.cxx 8764 2011-05-30 16:47:48Z manolo $"
//
// X specific code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -42,6 +42,7 @@
# include
# include
# include
+# include
# include
# include
# include "flstring.h"
@@ -50,12 +51,13 @@
# include
# include
# include
+# include
static Fl_Xlib_Graphics_Driver fl_xlib_driver;
static Fl_Display_Device fl_xlib_display(&fl_xlib_driver);
-FL_EXPORT Fl_Display_Device *fl_display_device = (Fl_Display_Device*)&fl_xlib_display; // does not change
FL_EXPORT Fl_Graphics_Driver *fl_graphics_driver = (Fl_Graphics_Driver*)&fl_xlib_driver; // the current target device of graphics operations
-FL_EXPORT Fl_Surface_Device *fl_surface = (Fl_Surface_Device*)fl_display_device; // the current target surface of graphics operations
+Fl_Surface_Device* Fl_Surface_Device::_surface = (Fl_Surface_Device*)&fl_xlib_display; // the current target surface of graphics operations
+Fl_Display_Device *Fl_Display_Device::_display = &fl_xlib_display;// the platform display
////////////////////////////////////////////////////////////////
// interface to poll/select call:
@@ -278,6 +280,17 @@ int fl_ready() {
# 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;
@@ -307,8 +320,22 @@ 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();
@@ -338,7 +365,6 @@ void fl_new_ic()
XVaNestedList status_attr = NULL;
static XFontSet fs = NULL;
char *fnt;
- bool must_free_fnt = true;
char **missing_list;
int missing_count;
char *def_string;
@@ -350,21 +376,22 @@ void fl_new_ic()
#if USE_XFT
#if defined(__GNUC__)
-#warning XFT support here
+// FIXME: warning XFT support here
#endif /*__GNUC__*/
if (!fs) {
- fnt = NULL;//fl_get_font_xfld(0, 14);
- if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ 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 = "-misc-fixed-*";must_free_fnt=false;}
+ 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,
@@ -465,16 +492,16 @@ void fl_set_spot(int font, int size, int X, int Y, int W, int H, Fl_Window *win)
#if USE_XFT
#if defined(__GNUC__)
-#warning XFT support here
+// FIXME: warning XFT support here
#endif /*__GNUC__*/
fnt = NULL; // fl_get_font_xfld(font, size);
- if (!fnt) {fnt = "-misc-fixed-*";must_free_fnt=false;}
+ 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 = "-misc-fixed-*";must_free_fnt=false;}
+ if (!fnt) {fnt = (char*)"-misc-fixed-*";must_free_fnt=false;}
fs = XCreateFontSet(fl_display, fnt, &missing_list,
&missing_count, &def_string);
#endif
@@ -509,8 +536,10 @@ void fl_set_status(int x, int y, int w, int h)
XFree(status_attr);
}
-void fl_init_xim()
-{
+void fl_init_xim() {
+ static int xim_warning = 2;
+ if (xim_warning > 0) xim_warning--;
+
//XIMStyle *style;
XIMStyles *xim_styles;
if (!fl_display) return;
@@ -524,27 +553,34 @@ void fl_init_xim()
XGetIMValues (fl_xim_im, XNQueryInputStyle,
&xim_styles, NULL, NULL);
} else {
- Fl::warning("XOpenIM() failed\n");
+ if (xim_warning)
+ Fl::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 {
- Fl::warning("No XIM style found\n");
+ if (xim_warning)
+ Fl::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) {
- Fl::warning("XCreateIC() failed\n");
+ if (xim_warning)
+ Fl::warning("XCreateIC() failed");
XCloseIM(fl_xim_im);
- XFree(xim_styles);
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;
@@ -581,8 +617,17 @@ void fl_open_display(Display* d) {
//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;
Fl::add_fd(ConnectionNumber(d), POLLIN, fd_callback);
@@ -693,7 +738,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard) {
// otherwise get the window server to return it:
fl_selection_requestor = &receiver;
Atom property = clipboard ? CLIPBOARD : XA_PRIMARY;
- XConvertSelection(fl_display, property, fl_XaUtf8String, property,
+ XConvertSelection(fl_display, property, TARGETS, property,
fl_xid(Fl::first_window()), fl_event_time);
}
@@ -793,12 +838,32 @@ static Fl_Window* resize_bug_fix;
static char 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;
- int filtered = 0;
static Window xim_win = 0;
if (fl_xim_ic && xevent.type == DestroyNotify &&
@@ -857,10 +922,8 @@ int fl_handle(const XEvent& thisevent)
#endif
}
- filtered = XFilterEvent((XEvent *)&xevent, 0);
- if (filtered) {
- return 1;
- }
+ if ( XFilterEvent((XEvent *)&xevent, 0) )
+ return(1);
switch (xevent.type) {
@@ -882,24 +945,49 @@ int fl_handle(const XEvent& thisevent)
// 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;
+ 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 (bytesread) { // append to the accumulated buffer
- buffer = (unsigned char*)realloc(buffer, bytesread+count*format/8+remaining);
- memcpy(buffer+bytesread, portion, count*format/8);
- XFree(portion);
- } else { // Use the first section without moving the memory:
- buffer = portion;
+ if (actual == TARGETS || actual == XA_ATOM) {
+ Atom type = XA_STRING;
+ for (unsigned i = 0; ixselectionrequest.time;
e.property = fl_xevent->xselectionrequest.property;
if (e.target == TARGETS) {
- Atom a = fl_XaUtf8String; //XA_STRING;
+ Atom a[3] = {fl_XaUtf8String, XA_STRING, fl_XaText};
XChangeProperty(fl_display, e.requestor, e.property,
- XA_ATOM, sizeof(Atom)*8, 0, (unsigned char*)&a, 1);
+ XA_ATOM, atom_bits, 0, (unsigned char*)a, 3);
} else if (/*e.target == XA_STRING &&*/ fl_selection_length[clipboard]) {
- XChangeProperty(fl_display, e.requestor, e.property,
- e.target, 8, 0,
- (unsigned char *)fl_selection_buffer[clipboard],
- 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);
@@ -970,6 +1069,19 @@ int fl_handle(const XEvent& thisevent)
if (window) switch (xevent.type) {
+ case DestroyNotify: { // an X11 window was closed externally from the program
+ Fl::handle(FL_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;
@@ -1133,33 +1245,30 @@ int fl_handle(const XEvent& thisevent)
int len = 0;
if (fl_xim_ic) {
- if (!filtered) {
- Status status;
- len = XUtf8LookupString(fl_xim_ic, (XKeyPressedEvent *)&xevent.xkey,
- buffer, buffer_len, &keysym, &status);
+ 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);
- }
- } else {
+ 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 = fl_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);
}
- } 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 = fl_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-compatable:
- keysym = XKeycodeToKeysym(fl_display, keycode, 0);
- }
}
// MRS: Can't use Fl::event_state(FL_CTRL) since the state is not
// set until set_event_xy() is called later...
@@ -1172,21 +1281,21 @@ int fl_handle(const XEvent& thisevent)
// 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
+ // ...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
+ // 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,
+ // 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;
@@ -1200,7 +1309,7 @@ int fl_handle(const XEvent& thisevent)
goto KEYPRESS;
}
}
-
+
event = FL_KEYUP;
fl_key_vector[keycode/8] &= ~(1 << (keycode%8));
// keyup events just get the unshifted keysym:
@@ -1225,6 +1334,72 @@ int fl_handle(const XEvent& thisevent)
else if (keysym == FL_BackSpace) 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 = FL_Meta_L;
+ break;
+ case XK_Meta_R:
+ case XK_Hyper_R:
+ case XK_Super_R:
+ keysym = FL_Meta_R;
+ break;
+ }
+ // Convert the multimedia keys to safer, portable values
+ switch (keysym) { // XF names come from X11/XF86keysym.h
+ case 0x1008FF11: // XF86XK_AudioLowerVolume:
+ keysym = FL_Volume_Down;
+ break;
+ case 0x1008FF12: // XF86XK_AudioMute:
+ keysym = FL_Volume_Mute;
+ break;
+ case 0x1008FF13: // XF86XK_AudioRaiseVolume:
+ keysym = FL_Volume_Up;
+ break;
+ case 0x1008FF14: // XF86XK_AudioPlay:
+ keysym = FL_Media_Play;
+ break;
+ case 0x1008FF15: // XF86XK_AudioStop:
+ keysym = FL_Media_Stop;
+ break;
+ case 0x1008FF16: // XF86XK_AudioPrev:
+ keysym = FL_Media_Prev;
+ break;
+ case 0x1008FF17: // XF86XK_AudioNext:
+ keysym = FL_Media_Next;
+ break;
+ case 0x1008FF18: // XF86XK_HomePage:
+ keysym = FL_Home_Page;
+ break;
+ case 0x1008FF19: // XF86XK_Mail:
+ keysym = FL_Mail;
+ break;
+ case 0x1008FF1B: // XF86XK_Search:
+ keysym = FL_Search;
+ break;
+ case 0x1008FF26: // XF86XK_Back:
+ keysym = FL_Back;
+ break;
+ case 0x1008FF27: // XF86XK_Forward:
+ keysym = FL_Forward;
+ break;
+ case 0x1008FF28: // XF86XK_Stop:
+ keysym = FL_Stop;
+ break;
+ case 0x1008FF29: // XF86XK_Refresh:
+ keysym = FL_Refresh;
+ break;
+ case 0x1008FF2F: // XF86XK_Sleep:
+ keysym = FL_Sleep;
+ break;
+ case 0x1008FF30: // XF86XK_Favorites:
+ keysym = FL_Favorites;
+ 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
@@ -1254,6 +1429,10 @@ int fl_handle(const XEvent& thisevent)
Fl::e_original_keysym = (int)keysym;
}
Fl::e_keysym = int(keysym);
+
+ // replace XK_ISO_Left_Tab (Shift-TAB) with FL_Tab (modifier flags are set correctly by X11)
+ if (Fl::e_keysym == 0xfe20) Fl::e_keysym = FL_Tab;
+
set_event_xy();
Fl::e_is_click = 0;
break;}
@@ -1311,6 +1490,12 @@ int fl_handle(const XEvent& thisevent)
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:
@@ -1351,16 +1536,22 @@ int fl_handle(const XEvent& thisevent)
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 Fl_Window about it and set flag to prevent echoing:
- resize_bug_fix = window;
- window->position(xpos, ypos);
+ if ( !wasXExceptionRaised() ) {
+ resize_bug_fix = window;
+ window->position(xpos, ypos);
+ }
break;
}
}
@@ -1373,13 +1564,14 @@ int fl_handle(const XEvent& thisevent)
void Fl_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) {
Fl_Group::resize(X,Y,W,H);
- if (shown()) {redraw(); i->wait_for_expose = 1;}
+ if (shown()) {redraw(); if(is_a_enlarge) i->wait_for_expose = 1;}
} else {
x(X); y(Y);
}
@@ -1559,7 +1751,7 @@ void Fl_X::make_xid(Fl_Window* win, XVisualInfo *visual, Colormap colormap)
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);
@@ -1704,11 +1896,13 @@ void Fl_Window::label(const char *name,const char *iname) {
iconlabel_ = iname;
if (shown() && !parent()) {
if (!name) name = "";
- XChangeProperty(fl_display, i->xid, XA_WM_NAME,
- fl_XaUtf8String, 8, 0, (uchar*)name, strlen(name));
+ int namelen = strlen(name);
if (!iname) iname = fl_filename_name(name);
- XChangeProperty(fl_display, i->xid, XA_WM_ICON_NAME,
- fl_XaUtf8String, 8, 0, (uchar*)iname, strlen(iname));
+ 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
}
}
@@ -1725,7 +1919,7 @@ void Fl_Window::label(const char *name,const char *iname) {
// contents are restored to the area, but this assumes the area
// is cleared to background color. So this is disabled in this version.
// Fl_Window *fl_boxcheat;
-static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
+static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));}
void Fl_Window::show() {
image(Fl::scheme_bg_);
@@ -1765,11 +1959,97 @@ void Fl_Window::make_current() {
current_ = this;
fl_clip_region(0);
-#ifdef USE_CAIRO
+#ifdef FLTK_USE_CAIRO
// update the cairo_t context
if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this);
#endif
+}
+Window fl_xid_(const Fl_Window *w) {
+ Fl_X *temp = Fl_X::i(w);
+ return temp ? temp->xid : 0;
+}
+
+static void decorated_win_size(Fl_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 Fl_Window::decorated_h()
+{
+ int w, h;
+ decorated_win_size(this, w, h);
+ return h;
+}
+
+int Fl_Window::decorated_w()
+{
+ int w, h;
+ decorated_win_size(this, w, h);
+ return w;
+}
+
+void Fl_Paged_Device::print_window(Fl_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;
+ }
+ Fl_Display_Device::display_device()->set_current();
+ win->show();
+ Fl::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 = fl_read_image(NULL, 0, 0, - (win->w() + 2 * bx), bt);
+ if (bx) {
+ left_image = fl_read_image(NULL, 0, bt, -bx, win->h() + bx);
+ right_image = fl_read_image(NULL, win->w() + bx, bt, -bx, win->h() + bx);
+ bottom_image = fl_read_image(NULL, 0, bt + win->h(), -(win->w() + 2*bx), bx);
+ }
+ fl_window = from;
+ this->set_current();
+ if (top_image) {
+ fl_draw_image(top_image, x_offset, y_offset, win->w() + 2 * bx, bt, 3);
+ delete[] top_image;
+ }
+ if (bx) {
+ if (left_image) fl_draw_image(left_image, x_offset, y_offset + bt, bx, win->h() + bx, 3);
+ if (right_image) fl_draw_image(right_image, x_offset + win->w() + bx, y_offset + bt, bx, win->h() + bx, 3);
+ if (bottom_image) fl_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
@@ -1789,9 +2069,11 @@ void printFront(Fl_Widget *o, void *data)
printer.printable_rect(&w,&h);
// scale the printer device so that the window fits on the page
float scale = 1;
- if (win->w() > w || win->h() > h) {
- scale = (float)w/win->w();
- if ((float)h/win->h() < scale) scale = (float)h/win->h();
+ 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);
}
@@ -1803,9 +2085,8 @@ void printFront(Fl_Widget *o, void *data)
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_widget( win );
- //printer.print_window_part( win, 0,0,win->w(), win->h() );
+#else
+ printer.print_window(win);
#endif
printer.end_page();
@@ -1829,5 +2110,5 @@ void preparePrintFront(void)
#endif
//
-// End of "$Id: Fl_x.cxx 7659 2010-07-01 13:21:32Z manolo $".
+// End of "$Id: Fl_x.cxx 8764 2011-05-30 16:47:48Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/aimm.h b/plugins/zynaddsubfx/fltk/src/aimm.h
index 64ed66fa5..0251255cb 100644
--- a/plugins/zynaddsubfx/fltk/src/aimm.h
+++ b/plugins/zynaddsubfx/fltk/src/aimm.h
@@ -1,9 +1,9 @@
//
-// "$Id: aimm.h 6943 2009-11-18 12:43:21Z AlbrechtS $"
+// "$Id: aimm.h 7913 2010-11-29 18:18:27Z greg.ercolano $"
//
// Standard dialog header file for the UTF-8 Fast Light Tool Kit (FLTK-UTF8).
//
-// Copyright 2009 by Bill Spitzak and others.
+// 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
@@ -427,5 +427,5 @@ extern "C" __declspec(dllimport) long __stdcall CoCreateInstance(const GUID & rc
#endif
//
-// End of "$Id: aimm.h 6943 2009-11-18 12:43:21Z AlbrechtS $".
+// End of "$Id: aimm.h 7913 2010-11-29 18:18:27Z greg.ercolano $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx b/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
index 35a5fc7a0..b98d5eeb4 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_absolute.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_absolute.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_absolute.cxx 8146 2010-12-31 22:13:07Z matt $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -121,7 +121,7 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
[..]
chdir("/var/tmp/somedir"); // set cwd to /var/tmp/somedir
[..]
- char out[1024];
+ char out[FL_PATH_MAX];
fl_filename_relative(out, sizeof(out), "/var/tmp/somedir/foo.txt"); // out="foo.txt", return=1
fl_filename_relative(out, sizeof(out), "/var/tmp/foo.txt"); // out="../foo.txt", return=1
fl_filename_relative(out, sizeof(out), "foo.txt"); // out="foo.txt", return=0 (no change)
@@ -136,13 +136,36 @@ int fl_filename_absolute(char *to, int tolen, const char *from) {
int // O - 0 if no change, 1 if changed
fl_filename_relative(char *to, // O - Relative filename
int tolen, // I - Size of "to" buffer
- const char *from) {// I - Absolute filename
- char *newslash; // Directory separator
+ const char *from) // I - Absolute filename
+{
+ char cwd_buf[FL_PATH_MAX]; // Current directory
+ // get the current directory and return if we can't
+ if (!fl_getcwd(cwd_buf, sizeof(cwd_buf))) {
+ strlcpy(to, from, tolen);
+ return 0;
+ }
+ return fl_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
+fl_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_buf[1024]; // Current directory
- char *cwd = cwd_buf;
-
-
+ 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' ||
@@ -152,15 +175,23 @@ fl_filename_relative(char *to, // O - Relative filename
if (from[0] == '\0' || !isdirsep(*from)) {
#endif // WIN32 || __EMX__
strlcpy(to, from, tolen);
+ if (cwd_buf) free(cwd_buf);
return 0;
}
-
- // get the current directory and return if we can't
- if (!fl_getcwd(cwd_buf, sizeof(cwd_buf))) {
+
+ // 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, '\\'))
@@ -169,6 +200,7 @@ fl_filename_relative(char *to, // O - Relative filename
// test for the exact same string and return "." if so
if (!strcasecmp(from, cwd)) {
strlcpy(to, ".", tolen);
+ free(cwd_buf);
return (1);
}
@@ -176,6 +208,7 @@ fl_filename_relative(char *to, // O - Relative filename
if (tolower(*from & 255) != tolower(*cwd & 255)) {
// Not the same drive...
strlcpy(to, from, tolen);
+ free(cwd_buf);
return 0;
}
@@ -185,6 +218,7 @@ fl_filename_relative(char *to, // O - Relative filename
// 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__
@@ -210,6 +244,7 @@ fl_filename_relative(char *to, // O - Relative filename
if (isdirsep(*slash)) slash ++;
// do the same for the current dir
+ if (isdirsep(*newslash)) newslash --;
if (*newslash != '\0')
while (!isdirsep(*newslash) && newslash > cwd) newslash --;
@@ -227,10 +262,11 @@ fl_filename_relative(char *to, // O - Relative filename
// finally add the differing path from "from"
strlcat(to, slash, tolen);
+ free(cwd_buf);
return 1;
}
//
-// End of "$Id: filename_absolute.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_absolute.cxx 8146 2010-12-31 22:13:07Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_expand.cxx b/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
index 7fc5939c9..2591ec4c7 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_expand.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_expand.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_expand.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Filename expansion routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -130,5 +130,5 @@ int fl_filename_expand(char *to,int tolen, const char *from) {
//
-// End of "$Id: filename_expand.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_expand.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_ext.cxx b/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
index 174fe5266..f9be10476 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_ext.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_ext.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_ext.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Filename extension routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -54,5 +54,5 @@ const char *fl_filename_ext(const char *buf) {
}
//
-// End of "$Id: filename_ext.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_ext.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx b/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
index a17bc19d5..253bc078d 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_isdir.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_isdir.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_isdir.cxx 8063 2010-12-19 21:20:10Z matt $"
//
// Directory detection routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -60,7 +60,7 @@ int _fl_filename_isdir_quick(const char* n) {
*/
int fl_filename_isdir(const char* n) {
struct stat s;
- char fn[1024];
+ char fn[FL_PATH_MAX];
int length;
length = strlen(n);
@@ -99,5 +99,5 @@ int fl_filename_isdir(const char* n) {
}
//
-// End of "$Id: filename_isdir.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_isdir.cxx 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_list.cxx b/plugins/zynaddsubfx/fltk/src/filename_list.cxx
index b863c674d..6434d6792 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_list.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_list.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_list.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_list.cxx 8192 2011-01-05 16:50:10Z manolo $"
//
// Filename list routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,6 +28,7 @@
// Wrapper for scandir with const-correct function prototypes.
#include
+#include
#include "flstring.h"
#include
@@ -37,7 +38,6 @@ extern "C" {
int fl_scandir (const char *dir, dirent ***namelist,
int (*select)(dirent *),
int (*compar)(dirent **, dirent **));
-# define scandir fl_scandir
#endif
}
@@ -81,56 +81,126 @@ int fl_casealphasort(struct dirent **a, struct dirent **b) {
*/
int fl_filename_list(const char *d, dirent ***list,
Fl_File_Sort_F *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);
+ fl_utf8to_mb(d, dirlen, dirloc, dirlen + 1);
+#endif
+
#ifndef HAVE_SCANDIR
- int n = scandir(d, list, 0, sort);
-#elif defined(HAVE_SCANDIR_POSIX)
- // HP-UX, Cygwin and POSIX (2008) define the comparison function like this:
- int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
+ // 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(d, list, 0, (int(*)(dirent **, dirent **))sort);
+ int n = scandir(dirloc, list, 0, (int(*)(dirent **, dirent **))sort);
#elif defined(_AIX)
// AIX is almost standard...
- int n = scandir(d, list, 0, (int(*)(void*, void*))sort);
-#elif !defined(__sgi)
+ 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(d, list, 0, (int(*)(const void*,const void*))sort);
-#else
- // This version is when we define our own scandir (WIN32 and perhaps
- // some Unix systems) and apparently on IRIX:
- int n = scandir(d, list, 0, sort);
+ int n = scandir(dirloc, list, 0, (int(*)(const void*,const void*))sort);
#endif
-#if defined(WIN32) && !defined(__CYGWIN__)
- // we did this already during fl_scandir/win32
-#else
- // append a '/' to all filenames that are directories
- int i, dirlen = strlen(d);
+#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+FL_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++ = '/';
+ if (name!=fullname && name[-1]!='/')
+ *name++ = '/';
+
for (i=0; id_name);
- if (de->d_name[len-1]=='/' || len>FL_PATH_MAX) continue;
- // Use memcpy for speed since we already know the length of the string...
- memcpy(name, de->d_name, len+1);
- if (fl_filename_isdir(fullname)) {
- (*list)[i] = de = (dirent*)realloc(de, de->d_name - (char*)de + len + 2);
- char *dst = de->d_name + len;
- *dst++ = '/';
- *dst = 0;
+#ifdef __APPLE__
+ newlen = len;
+#else
+ newlen = fl_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
+ fl_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<=FL_PATH_MAX) {
+ // Use memcpy for speed since we already know the length of the string...
+ memcpy(name, de->d_name, len+1);
+ if (fl_filename_isdir(fullname)) {
+ char *dst = newde->d_name + newlen;
+ *dst++ = '/';
+ *dst = 0;
+ }
}
+
+ free(de);
+ (*list)[i] = newde;
}
free(fullname);
-#endif
+
return n;
+
+#endif // WIN32
}
+/**
+ \brief Free the list of filenames that is generated by fl_filename_list().
+
+ Free everything that was allocated by a previous call to fl_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 fl_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: filename_list.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_list.cxx 8192 2011-01-05 16:50:10Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_match.cxx b/plugins/zynaddsubfx/fltk/src/filename_match.cxx
index 1f3d729f0..41e6dfd47 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_match.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_match.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_match.cxx 7162 2010-02-26 21:10:46Z matt $"
+// "$Id: filename_match.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Pattern matching routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -124,5 +124,5 @@ int fl_filename_match(const char *s, const char *p) {
}
//
-// End of "$Id: filename_match.cxx 7162 2010-02-26 21:10:46Z matt $".
+// End of "$Id: filename_match.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/filename_setext.cxx b/plugins/zynaddsubfx/fltk/src/filename_setext.cxx
index 7dc12cc61..927ea4872 100644
--- a/plugins/zynaddsubfx/fltk/src/filename_setext.cxx
+++ b/plugins/zynaddsubfx/fltk/src/filename_setext.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: filename_setext.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $"
+// "$Id: filename_setext.cxx 8063 2010-12-19 21:20:10Z matt $"
//
// Filename extension routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -40,7 +40,7 @@
\code
#include
[..]
- char buf[1024] = "/path/myfile.cxx";
+ char buf[FL_PATH_MAX] = "/path/myfile.cxx";
fl_filename_setext(buf, sizeof(buf), ".txt"); // buf[] becomes "/path/myfile.txt"
\endcode
@@ -56,5 +56,5 @@ char *fl_filename_setext(char *buf, int buflen, const char *ext) {
//
-// End of "$Id: filename_setext.cxx 6986 2010-01-01 18:30:49Z greg.ercolano $".
+// End of "$Id: filename_setext.cxx 8063 2010-12-19 21:20:10Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_arc.cxx b/plugins/zynaddsubfx/fltk/src/fl_arc.cxx
index 273a39e5d..70b29e7ca 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_arc.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_arc.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_arc.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_arc.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Arc functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -87,5 +87,5 @@ void fl_circle(double x,double y,double r) {
#endif
//
-// End of "$Id: fl_arc.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_arc.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_arci.cxx b/plugins/zynaddsubfx/fltk/src/fl_arci.cxx
index 3327d2d0e..963d62c6d 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_arci.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_arci.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_arci.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_arci.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Arc (integer) drawing functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -127,5 +127,5 @@ void Fl_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
}
//
-// End of "$Id: fl_arci.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_arci.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_ask.cxx b/plugins/zynaddsubfx/fltk/src/fl_ask.cxx
index 8ec31a988..e2dfc0a9b 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_ask.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_ask.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_ask.cxx 7370 2010-03-30 19:44:50Z AlbrechtS $"
+// "$Id: fl_ask.cxx 8616 2011-04-20 14:54:42Z AlbrechtS $"
//
// Standard dialog functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -47,12 +47,6 @@
#include
#include
-#ifdef __APPLE__
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-# include
-# endif
-#endif
-
static Fl_Window *message_form;
static Fl_Box *message;
static Fl_Box *icon;
@@ -60,14 +54,24 @@ static Fl_Button *button[3];
static Fl_Input *input;
static int ret_val;
static const char *iconlabel = "?";
+static const char *message_title_default;
Fl_Font fl_message_font_ = FL_HELVETICA;
-Fl_Fontsize fl_message_size_ = 14;
+Fl_Fontsize fl_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
-static void button_cb(Fl_Widget *bt, void *val) {
- ret_val = (int)(intptr_t)val;
+// 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 (Fl_Widget *) can either be an Fl_Button*
+// pointer to one of the buttons or an Fl_Window* pointer to the
+// message window (message_form).
+static void button_cb(Fl_Widget *, void *val) {
+ ret_val = (fl_intptr_t)val;
message_form->hide();
}
@@ -76,12 +80,13 @@ static Fl_Window *makeform() {
message_form->size(410,103);
return message_form;
}
- // make sure that the dialog does not become the child of some
+ // make sure that the dialog does not become the child of some
// current group
Fl_Group *previously_current_group = Fl_Group::current();
Fl_Group::current(0);
// create a new top level window
- Fl_Window *w = message_form = new Fl_Window(410,103,"");
+ Fl_Window *w = message_form = new Fl_Window(410,103);
+ message_form->callback(button_cb,(void *)0);
// w->clear_border();
// w->box(FL_UP_BOX);
(message = new Fl_Box(60, 25, 340, 20))
@@ -94,6 +99,7 @@ static Fl_Window *makeform() {
o->color(FL_WHITE);
o->labelcolor(FL_BLUE);
}
+ w->end(); // don't add the buttons automatically
// create the buttons (right to left)
for (int b=0, x=310; b<3; b++, x -= 100) {
if (b==1)
@@ -104,6 +110,10 @@ static Fl_Window *makeform() {
button[b]->callback(button_cb,(void *)b);
}
button[0]->shortcut(FL_Escape);
+ // add the buttons (left to right)
+ for (int b=2; b>=0; b--)
+ w->add(button[b]);
+ w->begin();
w->resizable(new Fl_Box(60,10,110-60,27));
w->end();
w->set_modal();
@@ -124,7 +134,7 @@ void resizeform() {
int x, w, h, max_w, max_h;
const int icon_size = 50;
- fl_font(fl_message_font_, fl_message_size_);
+ fl_font(message->labelfont(), message->labelsize());
message_w = message_h = 0;
fl_measure(message->label(), message_w, message_h);
@@ -208,7 +218,10 @@ static int innards(const char* fmt, va_list ap,
}
message->labelfont(fl_message_font_);
- message->labelsize(fl_message_size_);
+ if (fl_message_size_ == -1)
+ message->labelsize(FL_NORMAL_SIZE);
+ else
+ message->labelsize(fl_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);}
@@ -220,14 +233,19 @@ static int innards(const char* fmt, va_list ap,
resizeform();
- if (button[1]->visible() && !input->visible())
+ if (button[1]->visible() && !input->visible())
button[1]->take_focus();
- message_form->hotspot(button[0]);
+ if (enableHotspot)
+ message_form->hotspot(button[0]);
if (b0 && Fl_Widget::label_shortcut(b0))
button[0]->shortcut(0);
else
button[0]->shortcut(FL_Escape);
+ // 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 Fl::grab(), because it is incompatible with modal windows
Fl_Window* g = Fl::grab();
if (g) Fl::grab(0);
@@ -236,6 +254,7 @@ static int innards(const char* fmt, va_list ap,
if (g) // regrab the previous popup menu, if there was one
Fl::grab(g);
icon->label(prev_icon_label);
+ message_form->label(0); // reset window title
avoidRecursion = 0;
return ret_val;
@@ -244,17 +263,17 @@ static int innards(const char* fmt, va_list ap,
/** \addtogroup group_comdlg
@{ */
-// pointers you can use to change FLTK to a foreign language:
-const char* fl_no = "No"; ///< string pointer used in common dialogs, you can change it to a foreign language
-const char* fl_yes= "Yes"; ///< string pointer used in common dialogs, you can change it to a foreign language
-const char* fl_ok = "OK"; ///< string pointer used in common dialogs, you can change it to a foreign language
-const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you can change it to a foreign language
-const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to a foreign language
+// pointers you can use to change FLTK to another language:
+const char* fl_no = "No"; ///< string pointer used in common dialogs, you can change it to another language
+const char* fl_yes= "Yes"; ///< string pointer used in common dialogs, you can change it to another language
+const char* fl_ok = "OK"; ///< string pointer used in common dialogs, you can change it to another language
+const char* fl_cancel= "Cancel"; ///< string pointer used in common dialogs, you can change it to another language
+const char* fl_close= "Close"; ///< string pointer used in common dialogs, you can change it to another language
// fltk functions:
-
/**
Emits a system beep message.
+ \note \#include
*/
void fl_beep(int type) {
#ifdef WIN32
@@ -280,26 +299,7 @@ void fl_beep(int type) {
switch (type) {
case FL_BEEP_DEFAULT :
case FL_BEEP_ERROR :
- // How Apple is not any better than Microsoft:
- /* MacOS 8 */ // SysBeep(30);
- /* OS X 10.1 */ // AlertSoundPlay();
- /* OS X 10.5 */ // AudioServicesPlayAlertSound(kUserPreferredAlert);
- /* OS X 10.6 */ // AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert);
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- if (AudioServicesPlayAlertSound!=0L)
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- AudioServicesPlayAlertSound(kSystemSoundID_UserPreferredAlert);
-# else
- AudioServicesPlayAlertSound(kUserPreferredAlert);
-# endif
- else
-# endif
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
- AlertSoundPlay();
-#else
- {
- }
-#endif
+ NSBeep();
break;
default :
break;
@@ -320,10 +320,13 @@ void fl_beep(int type) {
}
#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
+
\param[in] fmt can be used as an sprintf-like format and variables for the message text
*/
@@ -346,6 +349,7 @@ void fl_message(const char *fmt, ...) {
\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
\param[in] fmt can be used as an sprintf-like format and variables for the message text
*/
@@ -368,6 +372,7 @@ void fl_alert(const char *fmt, ...) {
\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
\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
@@ -392,7 +397,8 @@ int fl_ask(const char *fmt, ...) {
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.
+ can be open at any time. Requests for additional dialog boxes are ignored.
+ \note \#include
\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
@@ -415,10 +421,11 @@ int fl_choice(const char*fmt,const char *b0,const char *b1,const char *b2,...){
va_end(ap);
return r;
}
-/** Gets the Fl_Box icon container of the current default dialog used in
- many common dialogs like fl_message(), fl_alert(),
- fl_ask(), fl_choice(), fl_input(), fl_password()
-*/
+/** Gets the Fl_Box icon container of the current default dialog used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_password()
+ \note \#include
+*/
Fl_Widget *fl_message_icon() {makeform(); return icon;}
static const char* input_innards(const char* fmt, va_list ap,
@@ -440,6 +447,7 @@ static const char* input_innards(const char* fmt, va_list ap,
\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
\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
@@ -465,6 +473,7 @@ const char* fl_input(const char *fmt, const char *defstr, ...) {
\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
\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
@@ -483,8 +492,80 @@ const char *fl_password(const char *fmt, const char *defstr, ...) {
return r;
}
+/** Sets whether or not to move the common message box used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_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
+ \param[in] enable non-zero enables hotspot behavior,
+ 0 disables hotspot
+ */
+void fl_message_hotspot(int enable) {
+ enableHotspot = enable ? 1 : 0;
+}
+
+/** Gets whether or not to move the common message box used in
+ many common dialogs like fl_message(), fl_alert(),
+ fl_ask(), fl_choice(), fl_input(), fl_password() to follow
+ the mouse pointer.
+ \note \#include
+ \return 0 if disable, non-zero otherwise
+ \see fl_message_hotspot(int)
+ */
+int fl_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 fl_message(), fl_alert(), fl_ask(), fl_choice(),
+ fl_input(), fl_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
+ \param[in] title window label, string copied internally
+*/
+void fl_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 fl_message(), fl_alert(), fl_ask(), fl_choice(),
+ fl_input(), fl_password(), unless a specific title has been set
+ with fl_message_title(const char *title).
+
+ The default is no title. You can override the default title for a
+ single dialog with fl_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
+ \param[in] title default window label, string copied internally
+*/
+void fl_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: fl_ask.cxx 7370 2010-03-30 19:44:50Z AlbrechtS $".
+// End of "$Id: fl_ask.cxx 8616 2011-04-20 14:54:42Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_boxtype.cxx b/plugins/zynaddsubfx/fltk/src/fl_boxtype.cxx
index 6a1b76199..ffbc69866 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_boxtype.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_boxtype.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_boxtype.cxx 7469 2010-04-07 23:17:33Z matt $"
+// "$Id: fl_boxtype.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Box drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -81,19 +81,19 @@ void fl_frame(const char* s, int x, int y, int w, int h) {
uchar *g = fl_gray_ramp();
if (h > 0 && w > 0) for (;*s;) {
// draw top line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_xyline(x, y, x+w-1);
y++; if (--h <= 0) break;
// draw left line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_yxline(x, y+h-1, y);
x++; if (--w <= 0) break;
// draw bottom line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_xyline(x, y+h-1, x+w-1);
if (--h <= 0) break;
// draw right line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_yxline(x+w-1, y+h-1, y);
if (--w <= 0) break;
}
@@ -115,19 +115,19 @@ void fl_frame2(const char* s, int x, int y, int w, int h) {
uchar *g = fl_gray_ramp();
if (h > 0 && w > 0) for (;*s;) {
// draw bottom line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_xyline(x, y+h-1, x+w-1);
if (--h <= 0) break;
// draw right line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_yxline(x+w-1, y+h-1, y);
if (--w <= 0) break;
// draw top line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_xyline(x, y, x+w-1);
y++; if (--h <= 0) break;
// draw left line:
- fl_color(g[*s++]);
+ fl_color(g[(int)*s++]);
fl_yxline(x, y+h-1, y);
x++; if (--w <= 0) break;
}
@@ -425,5 +425,5 @@ void Fl_Widget::draw_box(Fl_Boxtype t, int X, int Y, int W, int H, Fl_Color c) c
}
//
-// End of "$Id: fl_boxtype.cxx 7469 2010-04-07 23:17:33Z matt $".
+// End of "$Id: fl_boxtype.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_call_main.c b/plugins/zynaddsubfx/fltk/src/fl_call_main.c
index 2ed215037..00f349fbe 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_call_main.c
+++ b/plugins/zynaddsubfx/fltk/src/fl_call_main.c
@@ -1,7 +1,7 @@
/*
- * "$Id: fl_call_main.c 7352 2010-03-29 10:47:11Z matt $"
+ * "$Id: fl_call_main.c 7903 2010-11-28 21:06:39Z matt $"
*
- * Copyright 1998-2009 by Bill Spitzak and others.
+ * 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++.
@@ -138,6 +138,6 @@ static void dummy(void) {}
#endif /* WIN32 && !FL_DLL && !__GNUC__ */
/*
- * End of "$Id: fl_call_main.c 7352 2010-03-29 10:47:11Z matt $".
+ * End of "$Id: fl_call_main.c 7903 2010-11-28 21:06:39Z matt $".
*/
diff --git a/plugins/zynaddsubfx/fltk/src/fl_color.cxx b/plugins/zynaddsubfx/fltk/src/fl_color.cxx
index 5946976ce..0645f1a5e 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_color.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_color.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_color.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_color.cxx 8384 2011-02-06 12:32:23Z manolo $"
//
// Color functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -124,22 +124,19 @@ Fl_XColor fl_xmap[1][256];
# define fl_overlay 0
# endif
-/** Current color for drawing operations */
-Fl_Color fl_color_;
-
-void Fl_Graphics_Driver::color(Fl_Color i) {
+void Fl_Xlib_Graphics_Driver::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
} else {
- fl_color_ = i;
+ Fl_Graphics_Driver::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 Fl_Graphics_Driver::color(uchar r,uchar g,uchar b) {
- fl_color_ = fl_rgb_color(r, g, b);
+void Fl_Xlib_Graphics_Driver::color(uchar r,uchar g,uchar b) {
+ Fl_Graphics_Driver::color( fl_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));
}
@@ -202,7 +199,7 @@ static inline uchar realcolor(uchar color, uchar mask) {
}
return result;
# else
- return (color&mask) | (~mask)&(mask>>1);
+ return (color&mask) | ( (~mask)&(mask>>1) );
# endif
}
@@ -361,14 +358,12 @@ void Fl::set_color(Fl_Color i, unsigned c) {
#endif // end of X-specific code
/**
- Returns the RGB value(s) for the given FLTK color index. The
- first form returns the RGB values packed in a 32-bit unsigned
+ 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.
-
- The second form returns the red, green, and blue values
- separately in referenced variables.
*/
unsigned Fl::get_color(Fl_Color i) {
if (i & 0xffffff00) return (i);
@@ -383,7 +378,14 @@ void Fl::set_color(Fl_Color i, uchar red, uchar green, uchar blue) {
Fl::set_color((Fl_Color)(i & 255),
((unsigned)red<<24)+((unsigned)green<<16)+((unsigned)blue<<8));
}
-/** See unsigned get_color(Fl_Color c) */
+/**
+ 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(Fl_Color c)
+ */
void Fl::get_color(Fl_Color i, uchar &red, uchar &green, uchar &blue) {
unsigned c;
@@ -465,5 +467,5 @@ Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg) {
@}
*/
//
-// End of "$Id: fl_color.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_color.cxx 8384 2011-02-06 12:32:23Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_color_mac.cxx b/plugins/zynaddsubfx/fltk/src/fl_color_mac.cxx
index def0ae400..c6351c098 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_color_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_color_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_color_mac.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_color_mac.cxx 8384 2011-02-06 12:32:23Z manolo $"
//
// MacOS color functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -47,10 +47,8 @@ Fl_XMap fl_xmap[256];
Fl_XMap* fl_current_xmap;
-Fl_Color fl_color_;
-
-void Fl_Graphics_Driver::color(Fl_Color i) {
- fl_color_ = i;
+void Fl_Quartz_Graphics_Driver::color(Fl_Color i) {
+ Fl_Graphics_Driver::color(i);
int index;
uchar r, g, b;
if (i & 0xFFFFFF00) {
@@ -74,8 +72,8 @@ void Fl_Graphics_Driver::color(Fl_Color i) {
CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
}
-void Fl_Graphics_Driver::color(uchar r, uchar g, uchar b) {
- fl_color_ = fl_rgb_color(r, g, b);
+void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) {
+ Fl_Graphics_Driver::color( fl_rgb_color(r, g, b) );
float fr = r/255.0f;
float fg = g/255.0f;
float fb = b/255.0f;
@@ -90,5 +88,5 @@ void Fl::set_color(Fl_Color i, unsigned c) {
}
//
-// End of "$Id: fl_color_mac.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_color_mac.cxx 8384 2011-02-06 12:32:23Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_color_win32.cxx b/plugins/zynaddsubfx/fltk/src/fl_color_win32.cxx
index 1aab0d77b..7925f2dfe 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_color_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_color_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_color_win32.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_color_win32.cxx 8384 2011-02-06 12:32:23Z manolo $"
//
// WIN32 color functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -92,14 +92,12 @@ static void set_xmap(Fl_XMap& xmap, COLORREF c) {
xmap.brush = -1;
}
-Fl_Color fl_color_;
-
-void Fl_Graphics_Driver::color(Fl_Color i) {
+void Fl_GDI_Graphics_Driver::color(Fl_Color i) {
if (i & 0xffffff00) {
unsigned rgb = (unsigned)i;
fl_color((uchar)(rgb >> 24), (uchar)(rgb >> 16), (uchar)(rgb >> 8));
} else {
- fl_color_ = i;
+ Fl_Graphics_Driver::color(i);
Fl_XMap &xmap = fl_xmap[i];
if (!xmap.pen) {
#if USE_COLORMAP
@@ -118,10 +116,10 @@ void Fl_Graphics_Driver::color(Fl_Color i) {
}
}
-void Fl_Graphics_Driver::color(uchar r, uchar g, uchar b) {
+void Fl_GDI_Graphics_Driver::color(uchar r, uchar g, uchar b) {
static Fl_XMap xmap;
COLORREF c = RGB(r,g,b);
- fl_color_ = fl_rgb_color(r, g, b);
+ Fl_Graphics_Driver::color( fl_rgb_color(r, g, b) );
if (!xmap.pen || c != xmap.rgb) {
clear_xmap(xmap);
set_xmap(xmap, c);
@@ -250,5 +248,5 @@ fl_select_palette(void)
#endif
//
-// End of "$Id: fl_color_win32.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_color_win32.cxx 8384 2011-02-06 12:32:23Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_cursor.cxx b/plugins/zynaddsubfx/fltk/src/fl_cursor.cxx
index 2d454359c..66492551f 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_cursor.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_cursor.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_cursor.cxx 7351 2010-03-29 10:35:00Z matt $"
+// "$Id: fl_cursor.cxx 8055 2010-12-18 22:31:01Z manolo $"
//
// Mouse cursor support for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -134,11 +134,10 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) {
# error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined"
#endif
-extern void *MACSetCursor(Fl_Cursor c);
extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h);
-CGContextRef CreateHelpImage(void)
+CGContextRef Fl_X::help_cursor_image(void)
{
int w = 20, h = 20;
Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h);
@@ -152,7 +151,7 @@ CGContextRef CreateHelpImage(void)
return (CGContextRef)off;
}
-CGContextRef CreateNoneImage(void)
+CGContextRef Fl_X::none_cursor_image(void)
{
int w = 20, h = 20;
Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h);
@@ -163,7 +162,7 @@ CGContextRef CreateNoneImage(void)
return (CGContextRef)off;
}
-CGContextRef CreateWatchImage(void)
+CGContextRef Fl_X::watch_cursor_image(void)
{
int w, h, r = 5;
w = 2*r+6;
@@ -176,19 +175,19 @@ CGContextRef CreateWatchImage(void)
fl_color(FL_WHITE);
fl_circle(0, 0, r+1);
fl_color(FL_BLACK);
- fl_rectf(-r*0.7, -r*1.7, 1.4*r, 3.4*r);
+ fl_rectf(int(-r*0.7), int(-r*1.7), int(1.4*r), int(3.4*r));
fl_rectf(r-1, -1, 3, 3);
fl_color(FL_WHITE);
fl_pie(-r, -r, 2*r, 2*r, 0, 360);
fl_color(FL_BLACK);
fl_circle(0,0,r);
- fl_xyline(0, 0, -r*.7);
- fl_xyline(0, 0, 0, -r*.7);
+ fl_xyline(0, 0, int(-r*.7));
+ fl_xyline(0, 0, 0, int(-r*.7));
fl_end_offscreen();
return (CGContextRef)off;
}
-CGContextRef CreateNESWImage(void)
+CGContextRef Fl_X::nesw_cursor_image(void)
{
int c = 7, r = 2*c;
int w = r, h = r;
@@ -208,7 +207,7 @@ CGContextRef CreateNESWImage(void)
return (CGContextRef)off;
}
-CGContextRef CreateNWSEImage(void)
+CGContextRef Fl_X::nwse_cursor_image(void)
{
int c = 7, r = 2*c;
int w = r, h = r;
@@ -232,10 +231,7 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color, Fl_Color) {
if (c == FL_CURSOR_DEFAULT) {
c = cursor_default;
}
- void *cursor = MACSetCursor( c );
- if (i) {
- i->cursor = cursor;
- }
+ if (i) i->set_cursor(c);
}
#else
@@ -333,5 +329,5 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color fg, Fl_Color bg) {
#endif
//
-// End of "$Id: fl_cursor.cxx 7351 2010-03-29 10:35:00Z matt $".
+// End of "$Id: fl_cursor.cxx 8055 2010-12-18 22:31:01Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_curve.cxx b/plugins/zynaddsubfx/fltk/src/fl_curve.cxx
index 029c05f48..2f8655232 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_curve.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_curve.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_curve.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_curve.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Bezier curve functions for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -106,5 +106,5 @@ void Fl_Graphics_Driver::curve(double X0, double Y0,
}
//
-// End of "$Id: fl_curve.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_curve.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_diamond_box.cxx b/plugins/zynaddsubfx/fltk/src/fl_diamond_box.cxx
index 34ecd89f6..4f4af9175 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_diamond_box.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_diamond_box.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_diamond_box.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: fl_diamond_box.cxx 7903 2010-11-28 21:06:39Z matt $"
//
// Diamond box code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -76,5 +76,5 @@ Fl_Boxtype fl_define_FL_DIAMOND_BOX() {
}
//
-// End of "$Id: fl_diamond_box.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: fl_diamond_box.cxx 7903 2010-11-28 21:06:39Z matt $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_dnd.cxx b/plugins/zynaddsubfx/fltk/src/fl_dnd.cxx
index d9eeb3b6d..701cf10a9 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_dnd.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_dnd.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_dnd.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: fl_dnd.cxx 8055 2010-12-18 22:31:01Z manolo $"
//
// Drag & Drop code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -28,11 +28,11 @@
#ifdef WIN32
# include "fl_dnd_win32.cxx"
#elif defined(__APPLE__)
-# include "fl_dnd_mac.cxx"
+//# include "fl_dnd_mac.cxx"
#else
# include "fl_dnd_x.cxx"
#endif
//
-// End of "$Id: fl_dnd.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: fl_dnd.cxx 8055 2010-12-18 22:31:01Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_dnd_mac.cxx b/plugins/zynaddsubfx/fltk/src/fl_dnd_mac.cxx
deleted file mode 100644
index 032750412..000000000
--- a/plugins/zynaddsubfx/fltk/src/fl_dnd_mac.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// "$Id: fl_dnd_mac.cxx 7563 2010-04-28 03:15:47Z greg.ercolano $"
-//
-// Drag & Drop code for the Fast Light Tool Kit (FLTK).
-//
-// Copyright 1998-2009 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 MacOS-specific code for fltk which is always linked
-// in. Search other files for "__APPLE__" or filenames ending in _mac.cxx
-// for other system-specific code.
-
-#include
-#include
-#include
-#include
-
-// warning: this function is only implemented in Quickdraw. The function
-// below may not work if FLTK is compiled with Quartz enabled
-
-extern EventRef fl_os_event;
-extern char *fl_selection_buffer;
-extern int fl_selection_length;
-
-
-/**
- * drag and drop whatever is in the cut-copy-paste buffer
- * - create a selection first using:
- * Fl::copy(const char *stuff, int len, 0)
- */
-int Fl::dnd()
-{
- extern int MACpreparedrag(void);
- return MACpreparedrag();
-}
-
-
-//
-// End of "$Id: fl_dnd_mac.cxx 7563 2010-04-28 03:15:47Z greg.ercolano $".
-//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_dnd_win32.cxx b/plugins/zynaddsubfx/fltk/src/fl_dnd_win32.cxx
index 84a75b2d2..48cd9c5cb 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_dnd_win32.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_dnd_win32.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_dnd_win32.cxx 7563 2010-04-28 03:15:47Z greg.ercolano $"
+// "$Id: fl_dnd_win32.cxx 8028 2010-12-14 19:46:55Z AlbrechtS $"
//
// Drag & Drop code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -41,8 +41,6 @@
#if defined(__CYGWIN__)
#include
#include
-#else
-#include
#endif
extern char *fl_selection_buffer[2];
@@ -54,9 +52,6 @@ extern unsigned int fl_codepage;
Fl_Window *fl_dnd_target_window = 0;
-// All of the following code requires GCC 3.x or a non-GNU compiler...
-#if !defined(__GNUC__) || __GNUC__ >= 3
-
#include
#include
#include
@@ -177,6 +172,15 @@ public:
HWND hwnd = fl_xid( (Fl_Window*)w );
if (fillCurrentDragData(data)) {
int old_event = Fl::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;
+ Fl::e_text = currDragData;
+ Fl::e_length = b - currDragData;
Fl::belowmouse()->handle(Fl::e_number = FL_PASTE); // e_text will be invalid after this call
Fl::e_number = old_event;
SetForegroundWindow( hwnd );
@@ -210,20 +214,53 @@ private:
// clear currDrag* for a new drag event
clearCurrentDragData();
-
- // fill currDrag* with ASCII data, if available
+
+ 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_TEXT;
- // if it is ASCII text, return a copy of it
+ 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 );
- Fl::e_length = strlen((char*)stuff);
- Fl::e_text = strdup((char*)stuff);
+ unsigned srclen = 0;
+ const wchar_t *wstuff = (const wchar_t *)stuff;
+ while (*wstuff++) srclen++;
+ wstuff = (const wchar_t *)stuff;
+ unsigned utf8len = fl_utf8fromwc(NULL, 0, wstuff, srclen);
+ currDragSize = utf8len;
+ currDragData = (char*)malloc(utf8len + 1);
+ fl_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 = fl_utf8decode(p, last, &len);
+ p += len;
+ len = fl_utf8encode(u, q);
+ q += len;
+ }
+ *q = 0;
+ currDragSize = q - currDragData;
+ currDragData = (char*)realloc(currDragData, currDragSize + 1);
GlobalUnlock( medium.hGlobal );
ReleaseStgMedium( &medium );
currDragResult = 1;
@@ -253,10 +290,10 @@ private:
}
*dst=0;
- Fl::e_text = (char*) malloc(nn * 5 + 1);
+ currDragData = (char*) malloc(nn * 5 + 1);
// Fl::e_length = fl_unicode2utf(bu, nn, Fl::e_text);
- Fl::e_length = fl_utf8fromwc(Fl::e_text, (nn*5+1), bu, nn);
- Fl::e_text[Fl::e_length] = 0;
+ currDragSize = fl_utf8fromwc(currDragData, (nn*5+1), bu, nn);
+ currDragData[currDragSize] = 0;
free(bu);
// Fl::belowmouse()->handle(FL_DROP);
@@ -378,7 +415,7 @@ public:
n = 0;
}
- ~FLEnum(void) {
+ virtual ~FLEnum(void) {
n = 0;
}
};
@@ -413,16 +450,16 @@ public:
delete this;
return nTemp;
}
- // GetData currently allows ASCII text through Global Memory only
+ // 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_TEXT))
+ (pformatetcIn->cfFormat == CF_UNICODETEXT))
{
- HGLOBAL gh = GlobalAlloc( GHND, fl_selection_length[0]+1 );
+ int utf16_len = fl_utf8toUtf16(fl_selection_buffer[0], fl_selection_length[0], 0, 0);
+ HGLOBAL gh = GlobalAlloc( GHND, utf16_len * 2 + 2 );
char *pMem = (char*)GlobalLock( gh );
- memmove( pMem, fl_selection_buffer[0], fl_selection_length[0] );
- pMem[ fl_selection_length[0] ] = 0;
+ fl_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));
@@ -464,7 +501,7 @@ public:
{
if ((pformatetc->dwAspect & DVASPECT_CONTENT) &&
(pformatetc->tymed & TYMED_HGLOBAL) &&
- (pformatetc->cfFormat == CF_TEXT))
+ (pformatetc->cfFormat == CF_UNICODETEXT))
return S_OK;
return DV_E_FORMATETC;
}
@@ -486,13 +523,6 @@ public:
};
-/**
- Drag and drop whatever is in the cut-copy-paste buffer.
-
- Create a selection first using:
-
- Fl::copy(const char *stuff, int len, 0)
-*/
int Fl::dnd()
{
DWORD dropEffect;
@@ -519,15 +549,7 @@ int Fl::dnd()
if ( ret==DRAGDROP_S_DROP ) return 1; // or DD_S_CANCEL
return 0;
}
-#else
-int Fl::dnd()
-{
- // Always indicate DnD failed when using GCC < 3...
- return 1;
-}
-#endif // !__GNUC__ || __GNUC__ >= 3
-
//
-// End of "$Id: fl_dnd_win32.cxx 7563 2010-04-28 03:15:47Z greg.ercolano $".
+// End of "$Id: fl_dnd_win32.cxx 8028 2010-12-14 19:46:55Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_dnd_x.cxx b/plugins/zynaddsubfx/fltk/src/fl_dnd_x.cxx
index 990961659..406287524 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_dnd_x.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_dnd_x.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_dnd_x.cxx 6616 2009-01-01 21:28:26Z matt $"
+// "$Id: fl_dnd_x.cxx 7992 2010-12-09 21:52:07Z manolo $"
//
// Drag & Drop code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -43,6 +43,7 @@ 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];
@@ -87,7 +88,7 @@ static int local_handle(int event, Fl_Window* window) {
int Fl::dnd() {
Fl_Window *source_fl_win = Fl::first_window();
- Fl::first_window()->cursor((Fl_Cursor)21);
+ Fl::first_window()->cursor(FL_CURSOR_MOVE);
Window source_window = fl_xid(Fl::first_window());
fl_local_grab = grabfunc;
Window target_window = 0;
@@ -149,7 +150,7 @@ int Fl::dnd() {
} else {
// Send plain text...
fl_sendClientMessage(target_window, fl_XdndEnter, source_window,
- dndversion<<24, XA_STRING, 0, 0);
+ dndversion<<24, fl_XaUtf8String, 0, 0);
}
}
}
@@ -197,5 +198,5 @@ int Fl::dnd() {
//
-// End of "$Id: fl_dnd_x.cxx 6616 2009-01-01 21:28:26Z matt $".
+// End of "$Id: fl_dnd_x.cxx 7992 2010-12-09 21:52:07Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_draw.cxx b/plugins/zynaddsubfx/fltk/src/fl_draw.cxx
index 129a74406..b88cc70da 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_draw.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_draw.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_draw.cxx 7502 2010-04-14 13:21:10Z manolo $"
+// "$Id: fl_draw.cxx 8763 2011-05-30 16:08:46Z manolo $"
//
// Label drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -32,7 +32,6 @@
// Expands all unprintable characters to ^X or \nnn notation
// Aligns them against the inside of the box.
-#define min(a,b) ((a)<(b)?(a):(b))
#include
#include
#include
@@ -193,7 +192,7 @@ void fl_draw(
char buf[MAXBUF];
int buflen;
char symbol[2][255], *symptr;
- int symwidth[2], symoffset, symtotal;
+ int symwidth[2], symoffset, symtotal, imgtotal;
// count how many lines and put the last one into the buffer:
int lines;
@@ -216,23 +215,24 @@ void fl_draw(
*symptr++ = *str++);
*symptr = '\0';
if (isspace(*str)) str++;
- symwidth[0] = min(w,h);
+ 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] = min(w,h);
+ symwidth[1] = (w < h ? w : h);
}
}
symtotal = symwidth[0] + symwidth[1];
+ imgtotal = (img && (align&FL_ALIGN_IMAGE_NEXT_TO_TEXT)) ? img->w() : 0;
int strw = 0;
int strh;
if (str) {
for (p = str, lines=0; p;) {
- e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen, width,
+ e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen, width,
align&FL_ALIGN_WRAP, draw_symbols);
if (strw1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal, buflen,
+ if (lines>1) e = fl_expand_text(p, buf, MAXBUF, w - symtotal - imgtotal, buflen,
width, align&FL_ALIGN_WRAP, draw_symbols);
else e = "";
@@ -441,7 +441,7 @@ void fl_measure(const char* str, int& w, int& h, int draw_symbols) {
w != 0, draw_symbols);
if ((int)ceil(width) > W) W = (int)ceil(width);
lines++;
- if (!*e || (*e == '@' && draw_symbols)) break;
+ if (!*e || (*e == '@' && e[1] != '@' && draw_symbols)) break;
p = e;
}
@@ -482,5 +482,5 @@ int fl_height(int font, int size) {
}
//
-// End of "$Id: fl_draw.cxx 7502 2010-04-14 13:21:10Z manolo $".
+// End of "$Id: fl_draw.cxx 8763 2011-05-30 16:08:46Z manolo $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_draw_image.cxx b/plugins/zynaddsubfx/fltk/src/fl_draw_image.cxx
index cf527140d..384a4c66f 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_draw_image.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_draw_image.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_draw_image.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_draw_image.cxx 8731 2011-05-23 21:05:22Z AlbrechtS $"
//
// Image drawing routines for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -297,13 +297,15 @@ static void rrr_converter(const uchar *from, uchar *to, int w, int delta) {
# if WORDS_BIGENDIAN
# define INNARDS32(f) \
U64 *t = (U64*)to; \
- int w1 = (w+1)/2; \
- for (; w1--; from += delta) {U64 i = f; from += delta; *t++ = (i<<32)|(f);}
+ 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+1)/2; \
- for (; w1--; from += delta) {U64 i=f; from+= delta; *t++ = ((U64)(f)<<32)|i;}
+ 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
@@ -543,17 +545,17 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
}
}
-void Fl_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Xlib_Graphics_Driver::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 Fl_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Xlib_Graphics_Driver::draw_image(Fl_Draw_Image_Cb 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 Fl_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
+void Fl_Xlib_Graphics_Driver::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 Fl_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
+void Fl_Xlib_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
innards(0,x,y,w,h,d,0,1,cb,data);
}
@@ -572,5 +574,5 @@ void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
#endif
//
-// End of "$Id: fl_draw_image.cxx 7617 2010-05-27 17:20:18Z manolo $".
+// End of "$Id: fl_draw_image.cxx 8731 2011-05-23 21:05:22Z AlbrechtS $".
//
diff --git a/plugins/zynaddsubfx/fltk/src/fl_draw_image_mac.cxx b/plugins/zynaddsubfx/fltk/src/fl_draw_image_mac.cxx
index 0dc5e25b2..73af9927a 100644
--- a/plugins/zynaddsubfx/fltk/src/fl_draw_image_mac.cxx
+++ b/plugins/zynaddsubfx/fltk/src/fl_draw_image_mac.cxx
@@ -1,9 +1,9 @@
//
-// "$Id: fl_draw_image_mac.cxx 7617 2010-05-27 17:20:18Z manolo $"
+// "$Id: fl_draw_image_mac.cxx 8581 2011-04-12 11:38:43Z manolo $"
//
// MacOS image drawing code for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2009 by Bill Spitzak and others.
+// 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
@@ -30,6 +30,7 @@
#include
#include
#include