From 1209e9dcd7e1e97bedc747d06ba4eea837562158 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 22 Oct 2023 19:30:37 +0200 Subject: [PATCH] Make Fl_String and Fl_Int_Vector private (#789) - add CMake option 'OPTION_USE_STD' - add configure option '--enable-use_std' - move FL/Fl_String.H to src/Fl_String.H - move FL/Fl_Int_Vector.H to src/Fl_Int_Vector.H - remove Fl_String from demo program examples/callbacks.cxx - remove Fl_Int_Vector from public header FL/Fl_Table.H - some methods of Fl_Table are no longer inline - add CMake option OPTION_USE_STD to allow std::string in some selected functions and methods Experimental, may be removed before release: - use either Fl_Int_Vector or std::vector in Fl_Table depending on CMake OPTION_USE_STD or configure --enable-use_std Move all fl_filename* functions that use Fl_String to fluid Main changes in fluid: - add fluid_filename.h and .cxx - include "fluid_filename.h" rather than Update fl_input(), fl_password() and test/ask - add maxchar parameter to fl_input() and fl_password() - fl_input_str() and fl_password_str() are optional and return std::string if enabled (FLTK_USE_STD) --- CMake/options.cmake | 10 ++ CMakeLists.txt | 40 +++-- FL/Fl_Preferences.H | 11 +- FL/Fl_Table.H | 46 +++-- FL/filename.H | 51 ++++-- FL/fl_ask.H | 36 ++-- README.CMake.txt | 6 + configure.ac | 18 ++ examples/callbacks.cxx | 7 +- fl_config.cmake.in | 15 +- fl_config.in | 13 ++ fluid/CMakeLists.txt | 1 + fluid/Fd_Snap_Action.h | 2 +- fluid/Fluid_Image.cxx | 2 +- fluid/Makefile | 1 + fluid/alignment_panel.fl | 2 +- fluid/alignment_panel.h | 2 +- fluid/code.cxx | 2 +- fluid/code.h | 2 +- fluid/fluid.h | 4 +- fluid/fluid_filename.cxx | 164 ++++++++++++++++++ fluid/fluid_filename.h | 59 +++++++ fluid/makedepend | 96 +++++++--- fluid/shell_command.h | 2 +- fluid/template_panel.cxx | 2 +- fluid/template_panel.fl | 2 +- fluid/undo.cxx | 2 +- src/Fl_Help_View.cxx | 4 +- {FL => src}/Fl_Int_Vector.H | 6 +- src/Fl_Int_Vector.cxx | 2 +- src/Fl_Message.cxx | 15 +- src/Fl_Message.h | 6 +- src/Fl_Preferences.cxx | 88 +++++----- {FL => src}/Fl_String.H | 4 +- src/Fl_String.cxx | 2 +- src/Fl_Table.cxx | 163 +++++++++++++---- .../Wayland/Fl_Wayland_Screen_Driver.cxx | 2 +- src/filename_absolute.cxx | 56 +++--- src/fl_ask.cxx | 108 +++++++++--- src/makedepend | 38 +--- test/ask.cxx | 19 +- test/makedepend | 31 +--- test/unittest_core.cxx | 6 +- 43 files changed, 838 insertions(+), 310 deletions(-) create mode 100644 fluid/fluid_filename.cxx create mode 100644 fluid/fluid_filename.h rename {FL => src}/Fl_Int_Vector.H (95%) rename {FL => src}/Fl_String.H (98%) diff --git a/CMake/options.cmake b/CMake/options.cmake index 17fcda3f2..9f3079595 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -311,6 +311,16 @@ if (APPLE) endif (CMAKE_OSX_SYSROOT) endif (APPLE) +####################################################################### +option (OPTION_USE_STD "allow FLTK to use some std:: features" OFF) +if (OPTION_USE_STD) + set (FLTK_USE_STD 1) +else () + set (FLTK_USE_STD 0) +endif () + +####################################################################### + # find X11 libraries and headers set (PATH_TO_XLIBS) if ((NOT APPLE OR OPTION_APPLE_X11) AND NOT WIN32 AND NOT OPTION_USE_WAYLAND) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad47d4139..3c3b8c938 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,56 +262,62 @@ else () endif () if (FLTK_USE_BUILTIN_JPEG) - message (STATUS "Image Libraries: JPEG = Builtin") + message (STATUS "Image Libraries : JPEG = Builtin") else () - message (STATUS "Image Libraries: JPEG = System") + message (STATUS "Image Libraries : JPEG = System") endif () if (FLTK_USE_BUILTIN_PNG) - message (STATUS " PNG = Builtin") + message (STATUS " : PNG = Builtin") else () - message (STATUS " PNG = System") + message (STATUS " : PNG = System") endif () if (FLTK_USE_BUILTIN_ZLIB) - message (STATUS " ZLIB = Builtin") + message (STATUS " : ZLIB = Builtin") else () - message (STATUS " ZLIB = System") + message (STATUS " : ZLIB = System") endif () if (UNIX AND NOT (APPLE AND NOT OPTION_APPLE_X11)) if (OPTION_USE_WAYLAND) - message (STATUS "Use Wayland: Yes (when available at run-time)") + message (STATUS "Use Wayland : Yes (if available at run-time)") else () - message (STATUS "Use Wayland: No (therefore, X11 is used)") + message (STATUS "Use Wayland : No (therefore, X11 is used)") endif () if (FLTK_USE_CAIRO) - message (STATUS "All drawing uses Cairo: Yes") + message (STATUS "All drawing uses Cairo : Yes") else () - message (STATUS "All drawing uses Cairo: No") + message (STATUS "All drawing uses Cairo : No") endif () if (USE_PANGO) - message (STATUS "Use Pango: Yes") + message (STATUS "Use Pango : Yes") else (USE_PANGO) - message (STATUS "Use Pango: No") + message (STATUS "Use Pango : No") if (USE_XFT) - message (STATUS "Use Xft: Yes") + message (STATUS "Use Xft : Yes") else () - message (STATUS "Use Xft: No") + message (STATUS "Use Xft : No") endif (USE_XFT) endif (USE_PANGO) endif (UNIX AND NOT (APPLE AND NOT OPTION_APPLE_X11)) if (FLTK_HAVE_CAIROEXT) - message (STATUS "Fl_Cairo_Window support: Yes (extended)") + message (STATUS "Fl_Cairo_Window support : Yes (extended)") elseif (FLTK_HAVE_CAIRO) - message (STATUS "Fl_Cairo_Window support: Yes (standard)") + message (STATUS "Fl_Cairo_Window support : Yes (standard)") else () - message (STATUS "Fl_Cairo_Window support: No") + message (STATUS "Fl_Cairo_Window support : No") +endif () + +if (FLTK_USE_STD) + message (STATUS "Use std:: : Yes") +else () + message (STATUS "Use std:: : No") endif () message ("") diff --git a/FL/Fl_Preferences.H b/FL/Fl_Preferences.H index adf976706..98cc42523 100644 --- a/FL/Fl_Preferences.H +++ b/FL/Fl_Preferences.H @@ -25,6 +25,9 @@ # include "fl_attr.h" //class Fl_String; +#if (FLTK_USE_STD) +#include +#endif /** \brief Fl_Preferences store user settings between application starts. @@ -241,7 +244,6 @@ public: char set( const char *entry, double value, int precision ); char set( const char *entry, const char *value ); char set( const char *entry, const void *value, int size ); -// char set( const char *entry, const Fl_String &value ); char get( const char *entry, int &value, int defaultValue ); char get( const char *entry, float &value, float defaultValue ); @@ -251,8 +253,15 @@ public: char get( const char *entry, void *&value, const void *defaultValue, int defaultSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize ); char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int *size ); + +// char set( const char *entry, const Fl_String &value ); // char get( const char *entry, Fl_String &value, const Fl_String &defaultValue ); +#if (FLTK_USE_STD) + char set( const char *entry, const std::string &value ); + char get( const char *entry, std::string &value, const std::string &defaultValue ); +#endif + int size( const char *entry ); char get_userdata_path( char *path, int pathlen ); diff --git a/FL/Fl_Table.H b/FL/Fl_Table.H index 9f31fa020..1adc29255 100644 --- a/FL/Fl_Table.H +++ b/FL/Fl_Table.H @@ -3,6 +3,7 @@ // // Copyright 2002 by Greg Ercolano. // Copyright (c) 2004 O'ksi'D +// Copyright 2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -20,7 +21,18 @@ #include #include -#include + +// EXPERIMENTAL +// We use either std::vector or the private class Fl_Int_Vector +// depending on the build option OPTION_USE_STD or --enable-use_std. +// This option allows to use std::string and std::vector in FLTK 1.4.x + +#if (FLTK_USE_STD) +#include +typedef std::vector Fl_Int_Vector; +#else +class Fl_Int_Vector; // private class declared in src/Fl_Int_Vector.H +#endif /** A table of widgets or other content. @@ -155,8 +167,12 @@ private: }; unsigned int flags_; - Fl_Int_Vector _colwidths; // column widths in pixels - Fl_Int_Vector _rowheights; // row heights in pixels + Fl_Int_Vector *_colwidths; // column widths in pixels + Fl_Int_Vector *_rowheights; // row heights in pixels + + // number of columns and rows == size of corresponding vectors + int col_size(); // size of the column widths vector + int row_size(); // size of the row heights vector Fl_Cursor _last_cursor; // last mouse cursor before changed to 'resize' cursor @@ -433,7 +449,7 @@ public: return(table->box()); } - virtual void rows(int val); // set/get number of rows + virtual void rows(int val); // set number of rows /** Returns the number of rows in the table. @@ -442,7 +458,7 @@ public: return(_rows); } - virtual void cols(int val); // set/get number of columns + virtual void cols(int val); // set number of columns /** Get the number of columns in the table. @@ -656,23 +672,15 @@ public: return(_col_header_color); } - void row_height(int row, int height); // set/get row height + void row_height(int row, int height); // set row height in pixels - /** - Returns the current height of the specified row as a value in pixels. - */ - inline int row_height(int row) { - return((row<0 || row>=(int)_rowheights.size()) ? 0 : _rowheights[row]); - } + // Returns the current height of the specified row as a value in pixels. + int row_height(int row); - void col_width(int col, int width); // set/get a column's width + void col_width(int col, int width); // set a column's width in pixels - /** - Returns the current width of the specified column in pixels. - */ - inline int col_width(int col) { - return((col<0 || col>=(int)_colwidths.size()) ? 0 : _colwidths[col]); - } + // Returns the current width of the specified column in pixels. + int col_width(int col); /** Convenience method to set the height of all rows to the diff --git a/FL/filename.H b/FL/filename.H index b5b76f92f..92bf96f73 100644 --- a/FL/filename.H +++ b/FL/filename.H @@ -1,7 +1,7 @@ /* * Filename header file for the Fast Light Tool Kit (FLTK). * - * Copyright 1998-2018 by Bill Spitzak and others. + * Copyright 1998-2023 by Bill Spitzak and others. * * This library is free software. Distribution and use rights are outlined in * the file "COPYING" which should have been included with this file. If this @@ -14,16 +14,30 @@ * https://www.fltk.org/bugs.php */ -/** \file - File names and URI utility functions. +/* + * Note to devs: + * Under Windows, we include filename.H from numericsort.c; this should probably change. + * This implies that we need C-style comments and '#ifdef __cplusplus ... #endif' */ +/** \file + File names and URI utility functions. +*/ + #ifndef FL_FILENAME_H # define FL_FILENAME_H #include "Fl_Export.H" #include +#ifdef __cplusplus + +// The following include is not (yet) used in FLTK 1.4 +// In FLTK 1.5 or 4.0 using std::string would be default. +// #include + +#endif /* __cplusplus */ + /** \addtogroup filenames File names and URI utility functions File names and URI functions defined in @{ */ @@ -55,22 +69,25 @@ FL_EXPORT int fl_filename_isdir(const char *name); # if defined(__cplusplus) -class Fl_String; - -FL_EXPORT Fl_String fl_filename_name(const Fl_String &filename); -FL_EXPORT Fl_String fl_filename_path(const Fl_String &filename); -FL_EXPORT Fl_String fl_filename_ext(const Fl_String &filename); -FL_EXPORT Fl_String fl_filename_setext(const Fl_String &filename, const Fl_String &new_extension); -FL_EXPORT Fl_String fl_filename_expand(const Fl_String &from); FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from, const char *cwd); -FL_EXPORT Fl_String fl_filename_absolute(const Fl_String &from); -FL_EXPORT Fl_String fl_filename_absolute(const Fl_String &from, const Fl_String &base); FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd); -FL_EXPORT Fl_String fl_filename_relative(const Fl_String &from); -FL_EXPORT Fl_String fl_filename_relative(const Fl_String &from, const Fl_String &base); -FL_EXPORT Fl_String fl_getcwd(); -# endif + +// FIXME: We can't do this in 1.4.x - enable this block in 1.5 or higher. +// See fluid/fluid_filename.{h|cxx} for an implementation using Fl_String. + +// FL_EXPORT std::string fl_filename_name(const std::string &filename); +// FL_EXPORT std::string fl_filename_path(const std::string &filename); +// FL_EXPORT std::string fl_filename_ext(const std::string &filename); +// FL_EXPORT std::string fl_filename_setext(const std::string &filename, const std::string &new_extension); +// FL_EXPORT std::string fl_filename_expand(const std::string &from); +// FL_EXPORT std::string fl_filename_absolute(const std::string &from); +// FL_EXPORT std::string fl_filename_absolute(const std::string &from, const std::string &base); +// FL_EXPORT std::string fl_filename_relative(const std::string &from); +// FL_EXPORT std::string fl_filename_relative(const std::string &from, const std::string &base); +// FL_EXPORT std::string fl_getcwd(); + +# endif /* defined(__cplusplus) */ # if defined(__cplusplus) && !defined(FL_DOXYGEN) /* @@ -120,7 +137,7 @@ FL_EXPORT void fl_decode_uri(char *uri); # endif /* __cplusplus */ /* - * FLTK 1.0.x compatibility definitions (FLTK_1_0_COMPAT) dropped in 1.4.0 + * Note: FLTK 1.0.x compatibility definitions (FLTK_1_0_COMPAT) dropped in 1.4.0 */ #endif /* FL_FILENAME_H */ diff --git a/FL/fl_ask.H b/FL/fl_ask.H index c4eb3ab86..2387a1947 100644 --- a/FL/fl_ask.H +++ b/FL/fl_ask.H @@ -22,9 +22,12 @@ #define _FL_fl_ask_H_ #include -#include #include +#if (FLTK_USE_STD) +#include +#endif + class Fl_Widget; /** Defines the different system beeps available. @@ -65,22 +68,35 @@ FL_EXPORT const char *fl_password(const char *label, const char *deflt = 0, ...) FL_EXPORT int fl_choice_n(const char *q, const char *b0, const char *b1, const char *b2, ...) __fl_attr((__format__(__printf__, 1, 5))); -// since FLTK 1.4.0: -// - fl_input_str() with limited input size -// - fl_password_str() with limited input size (*_str) +// since FLTK 1.4.0: with 'maxchar' to limit input size -FL_EXPORT Fl_String fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...) +FL_EXPORT const char *fl_input(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); -FL_EXPORT Fl_String fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) - __fl_attr((__format__(__printf__, 3, 5))); - -FL_EXPORT Fl_String fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...) +FL_EXPORT const char *fl_password(int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 2, 4))); -FL_EXPORT Fl_String fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) +// since FLTK 1.4.0 -- only with option FLTK_USE_STD + +// - fl_input_str() with limited input size, returns std::string +// - fl_password_str() with limited input size, returns std::string + +#if (FLTK_USE_STD) + +FL_EXPORT std::string fl_input_str(int maxchar, const char *label, const char *deflt = 0, ...) + __fl_attr((__format__(__printf__, 2, 4))); + +FL_EXPORT std::string fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) __fl_attr((__format__(__printf__, 3, 5))); +FL_EXPORT std::string fl_password_str(int maxchar, const char *label, const char *deflt = 0, ...) + __fl_attr((__format__(__printf__, 2, 4))); + +FL_EXPORT std::string fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) + __fl_attr((__format__(__printf__, 3, 5))); + +#endif + FL_EXPORT Fl_Widget *fl_message_icon(); extern FL_EXPORT Fl_Font fl_message_font_; extern FL_EXPORT Fl_Fontsize fl_message_size_; diff --git a/README.CMake.txt b/README.CMake.txt index 97cf7822f..8a6ba0834 100644 --- a/README.CMake.txt +++ b/README.CMake.txt @@ -215,6 +215,12 @@ OPTION_USE_GDIPLUS - default ON Makes FLTK use GDI+ to draw oblique lines and curves resulting in antialiased graphics (Windows platform only). +OPTION_USE_STD - default OFF + This option allow FLTK to use some specific features of modern C++ + like std::string in the public API of FLTK 1.4.x. Users turning this + option ON can benefit from some new functions and methods that return + std::string or use std::string as input parameters. + OPTION_USE_SYSTEM_LIBDECOR - default OFF This option makes FLTK use package libdecor-0 to draw window titlebars under Wayland. It's mainly meant for future use, when that package diff --git a/configure.ac b/configure.ac index 9c8b9ad2c..8630e5943 100644 --- a/configure.ac +++ b/configure.ac @@ -114,6 +114,8 @@ AC_ARG_ENABLE([wayland], AS_HELP_STRING([--disable-wayland], [turn off hybrid Wa AC_ARG_ENABLE([usecairo], AS_HELP_STRING([--enable-usecairo], [all drawing to X11 windows uses Cairo])) +AC_ARG_ENABLE([use_std], AS_HELP_STRING([--enable-use_std], [allow FLTK to use std::string etc.])) + AC_ARG_ENABLE([print], AS_HELP_STRING([--disable-print], [turn off print support (X11)])) AS_IF([test x$enable_print = xno], [ AC_DEFINE([FL_NO_PRINT_SUPPORT], [Disable X11 print support?]) @@ -911,6 +913,14 @@ UNINSTALL_DESKTOP="" AS_IF([test x$enable_fluid != xno], [FLUIDDIR="fluid"]) +dnl Option use_std - allow std::string and maybe more +AS_IF([test x$enable_use_std = xyes], [ + AC_DEFINE([FLTK_USE_STD]) + ] +) + +dnl Platform specific Processing + AS_CASE([$host_os_gui], [cygwin* | mingw*], [ dnl Cygwin environment, using windows GDI ... # Recent versions of Cygwin are seriously broken and the size @@ -1408,6 +1418,8 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [ UNINSTALL_DESKTOP="uninstall-linux" ]) +dnl End of platform specific Processing + AC_SUBST([GLDEMOS]) AC_SUBST([GLLIBS]) AC_SUBST([HLINKS]) @@ -1823,6 +1835,12 @@ AS_IF([test x$THREADS = x], [ echo " Threads: YES" ]) +AS_IF([test x$enable_use_std != xyes], [ + echo " Allow std:: : NO" +], [ + echo " Allow std:: : YES" +]) + dnl Set empty BINARY_DIR variable for fltk-config.in (CMake compatibility) BINARY_DIR= AC_SUBST([BINARY_DIR]) diff --git a/examples/callbacks.cxx b/examples/callbacks.cxx index 3fb240d30..d657b3573 100644 --- a/examples/callbacks.cxx +++ b/examples/callbacks.cxx @@ -19,7 +19,6 @@ #include #include #include -#include #include #include @@ -34,8 +33,8 @@ void hello_0_args_cb() { fl_message("Hello with 0 arguments"); } -void hello_2_args_cb(Fl_String &text, int number) { - fl_message("Hello with 2 arguments,\n\"%s\" and '%d'", text.c_str(), number); +void hello_2_args_cb(const char *text, int number) { + fl_message("Hello with 2 arguments,\n\"%s\" and '%d'", text, number); } void hello_4_args_cb(int a1, int a2, int a3, int a4) { @@ -89,7 +88,7 @@ int main(int argc, char ** argv) { FL_FUNCTION_CALLBACK_0(func_cb_btn_0, hello_0_args_cb); Fl_Button *func_cb_btn_2 = new Fl_Button(10, 60, 180, 25, "2 args"); - FL_FUNCTION_CALLBACK_2(func_cb_btn_2, hello_2_args_cb, Fl_String, "FLTK", int, 2); + FL_FUNCTION_CALLBACK_2(func_cb_btn_2, hello_2_args_cb, const char *, "FLTK", int, 2); Fl_Button *func_cb_btn_4 = new Fl_Button(10, 90, 180, 25, "4 args"); FL_FUNCTION_CALLBACK_4(func_cb_btn_4, hello_4_args_cb, int, 1, int, 2, int, 3, int, 4); diff --git a/fl_config.cmake.in b/fl_config.cmake.in index 0acc7a8ff..a6e3b086e 100644 --- a/fl_config.cmake.in +++ b/fl_config.cmake.in @@ -19,7 +19,7 @@ #define _FL_fl_config_h_ /* - * FL_ABI_VERSION (ABI version): + * FL_ABI_VERSION (ABI version) * * define FL_ABI_VERSION: 1xxyy for 1.x.y (xx,yy with leading zero) */ @@ -75,4 +75,17 @@ #cmakedefine FLTK_USE_WAYLAND 1 + +/* + * FLTK_USE_STD + * + * May we use std::string and std::vector for the current build? + * + * This is a build configuration option which allows FLTK to add some + * features based on std::string and std::vector in FLTK 1.4.x + * + */ + +#cmakedefine01 FLTK_USE_STD + #endif /* _FL_fl_config_h_ */ diff --git a/fl_config.in b/fl_config.in index 992c3cd61..444d85212 100644 --- a/fl_config.in +++ b/fl_config.in @@ -74,4 +74,17 @@ #undef FLTK_USE_WAYLAND + +/* + * FLTK_USE_STD + * + * May we use std::string and std::vector for the current build? + * + * This is a build configuration option which allows FLTK to add some + * features based on std::string and std::vector in FLTK 1.4.x + * + */ + +#define FLTK_USE_STD 0 + #endif /* _FL_fl_config_h_ */ diff --git a/fluid/CMakeLists.txt b/fluid/CMakeLists.txt index e7990367e..c28b2780f 100644 --- a/fluid/CMakeLists.txt +++ b/fluid/CMakeLists.txt @@ -36,6 +36,7 @@ set (CPPFILES custom_widgets.cxx factory.cxx file.cxx + fluid_filename.cxx function_panel.cxx pixmaps.cxx shell_command.cxx diff --git a/fluid/Fd_Snap_Action.h b/fluid/Fd_Snap_Action.h index fefb4618f..f0ca98be4 100644 --- a/fluid/Fd_Snap_Action.h +++ b/fluid/Fd_Snap_Action.h @@ -20,7 +20,7 @@ #include "fluid.h" #include "Fl_Window_Type.h" -#include +#include "../src/Fl_String.H" struct Fl_Menu_Item; diff --git a/fluid/Fluid_Image.cxx b/fluid/Fluid_Image.cxx index dd24bd2d2..c57d54c85 100644 --- a/fluid/Fluid_Image.cxx +++ b/fluid/Fluid_Image.cxx @@ -25,7 +25,7 @@ #include #include #include -#include +#include "fluid_filename.h" #include #include // fl_fopen() #include diff --git a/fluid/Makefile b/fluid/Makefile index e24c185e0..23e44dcbf 100644 --- a/fluid/Makefile +++ b/fluid/Makefile @@ -37,6 +37,7 @@ CPPFILES = \ factory.cxx \ file.cxx \ fluid.cxx \ + fluid_filename.cxx \ function_panel.cxx \ pixmaps.cxx \ shell_command.cxx \ diff --git a/fluid/alignment_panel.fl b/fluid/alignment_panel.fl index 96316d2cb..f886c6776 100644 --- a/fluid/alignment_panel.fl +++ b/fluid/alignment_panel.fl @@ -70,7 +70,7 @@ decl {\#include } {public local decl {\#include } {public local } -decl {\#include } {public local +decl {\#include "fluid_filename.h"} {public local } decl {\#include } {public local diff --git a/fluid/alignment_panel.h b/fluid/alignment_panel.h index 932398ee5..104d96341 100644 --- a/fluid/alignment_panel.h +++ b/fluid/alignment_panel.h @@ -25,7 +25,7 @@ #include "shell_command.h" #include #include -#include +#include "fluid_filename.h" #include #include /** diff --git a/fluid/code.cxx b/fluid/code.cxx index ba82ba562..f9f28c3ec 100644 --- a/fluid/code.cxx +++ b/fluid/code.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include "fluid_filename.h" #include "../src/flstring.h" #include diff --git a/fluid/code.h b/fluid/code.h index c327b9f21..4374ac585 100644 --- a/fluid/code.h +++ b/fluid/code.h @@ -18,7 +18,7 @@ #define _FLUID_CODE_H #include -#include +#include "../src/Fl_String.H" #include #include diff --git a/fluid/fluid.h b/fluid/fluid.h index 402194edd..201b7dc30 100644 --- a/fluid/fluid.h +++ b/fluid/fluid.h @@ -17,10 +17,10 @@ #ifndef _FLUID_FLUID_H #define _FLUID_FLUID_H -#include +#include "fluid_filename.h" #include #include -#include +#include "../src/Fl_String.H" #define BROWSERWIDTH 300 #define BROWSERHEIGHT 500 diff --git a/fluid/fluid_filename.cxx b/fluid/fluid_filename.cxx new file mode 100644 index 000000000..dc323c2aa --- /dev/null +++ b/fluid/fluid_filename.cxx @@ -0,0 +1,164 @@ +// +// Filename expansion routines for the Fast Light Tool Kit (FLTK). +// +// Copyright 1998-2023 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + +/** \file fluid/fluid_filename.cxx + + \brief File names and URI utility functions for FLUID only. + + This file defines all fl_filename* functions using Fl_String and also + includes the main header file . + + \note This file contains some filename functions using Fl_String which + which are used in FLTK 1.4.x but will be removed in the next minor + or major release after 1.4.x (i.e. 1.5 or maybe 4.0). + + \note This entire file should become obsolete in 1.5 or higher, whatever + the next release after 1.4.x will be. We'll use std::string instead! +*/ + +#include + +#include +#include +#include + +#include "../src/Fl_String.H" // NOTE: FLTK 1.4.x only ! +#include "../src/flstring.h" + + +/** + Return a new string that contains the name part of the filename. + \param[in] filename file path and name + \return the name part of a filename + \see fl_filename_name(const char *filename) + */ +Fl_String fl_filename_name(const Fl_String &filename) { + return Fl_String(fl_filename_name(filename.c_str())); +} + +/** + Return a new string that contains the path part of the filename. + \param[in] filename file path and name + \return the path part of a filename without the name + \see fl_filename_name(const char *filename) + */ +Fl_String fl_filename_path(const Fl_String &filename) { + const char *base = filename.c_str(); + const char *name = fl_filename_name(base); + if (name) { + return Fl_String(base, (int)(name-base)); + } else { + return Fl_String(); + } +} + +/** + Return a new string that contains the filename extension. + \param[in] filename file path and name + \return the filename extension including the prepending '.', or an empty + string if the filename has no extension + \see fl_filename_ext(const char *buf) + */ +Fl_String fl_filename_ext(const Fl_String &filename) { + return Fl_String(fl_filename_ext(filename.c_str())); +} + +/** + Return a copy of the old filename with the new extension. + \param[in] filename file path and name + \param[in] new_extension new filename extension, starts with a '.' + \return the new filename + \see fl_filename_setext(char *to, int tolen, const char *ext) + */ +Fl_String fl_filename_setext(const Fl_String &filename, const Fl_String &new_extension) { + char buffer[FL_PATH_MAX]; + fl_strlcpy(buffer, filename.c_str(), FL_PATH_MAX); + fl_filename_setext(buffer, FL_PATH_MAX, new_extension.c_str()); + return Fl_String(buffer); +} + +/** + Expands a filename containing shell variables and tilde (~). + \param[in] from file path and name + \return the new, expanded filename + \see fl_filename_expand(char *to, int tolen, const char *from) +*/ +Fl_String fl_filename_expand(const Fl_String &from) { + char buffer[FL_PATH_MAX]; + fl_filename_expand(buffer, FL_PATH_MAX, from.c_str()); + return Fl_String(buffer); +} + +/** + Makes a filename absolute from a filename relative to the current working directory. + \param[in] from relative filename + \return the new, absolute filename + \see fl_filename_absolute(char *to, int tolen, const char *from) + */ +Fl_String fl_filename_absolute(const Fl_String &from) { + char buffer[FL_PATH_MAX]; + fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str()); + return Fl_String(buffer); +} + +/** + Append the relative filename `from` to the absolute filename `base` to form + the new absolute path. + \param[in] from relative filename + \param[in] base `from` is relative to this absolute file path + \return the new, absolute filename + \see fl_filename_absolute(char *to, int tolen, const char *from, const char *base) + */ +Fl_String fl_filename_absolute(const Fl_String &from, const Fl_String &base) { + char buffer[FL_PATH_MAX]; + fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str(), base.c_str()); + return Fl_String(buffer); +} + +/** + Makes a filename relative to the current working directory. + \param[in] from file path and name + \return the new, relative filename + \see fl_filename_relative(char *to, int tolen, const char *from) + */ +Fl_String fl_filename_relative(const Fl_String &from) { + char buffer[FL_PATH_MAX]; + fl_filename_relative(buffer, FL_PATH_MAX, from.c_str()); + return Fl_String(buffer); +} + +/** + Makes a filename relative to any directory. + \param[in] from file path and name + \param[in] base relative to this absolute path + \return the new, relative filename + \see fl_filename_relative(char *to, int tolen, const char *from, const char *base) + */ +Fl_String fl_filename_relative(const Fl_String &from, const Fl_String &base) { + char buffer[FL_PATH_MAX]; + fl_filename_relative(buffer, FL_PATH_MAX, from.c_str(), base.c_str()); + return Fl_String(buffer); +} + +/** Cross-platform function to get the current working directory + as a UTF-8 encoded value in an Fl_String. + \return the CWD encoded as UTF-8 + */ +Fl_String fl_getcwd() { + char buffer[FL_PATH_MAX]; + fl_getcwd(buffer, FL_PATH_MAX); + return Fl_String(buffer); +} diff --git a/fluid/fluid_filename.h b/fluid/fluid_filename.h new file mode 100644 index 000000000..afd2aed7e --- /dev/null +++ b/fluid/fluid_filename.h @@ -0,0 +1,59 @@ +/* + * Filename header file for the Fast Light Tool Kit (FLTK). + * + * Copyright 1998-2023 by Bill Spitzak and others. + * + * This library is free software. Distribution and use rights are outlined in + * the file "COPYING" which should have been included with this file. If this + * file is missing or damaged, see the license at: + * + * https://www.fltk.org/COPYING.php + * + * Please see the following page on how to report bugs and issues: + * + * https://www.fltk.org/bugs.php + */ + +/** \file fluid/fluid_filename.h + + \brief File names and URI utility functions for FLUID only. + + This file declares all fl_filename* functions using Fl_String and also + includes the main header file . + + \note This file contains some filename functions using Fl_String which + which are used in FLTK 1.4.x but will be removed in the next minor + or major release after 1.4.x (i.e. 1.5 or maybe 4.0). + + \note This entire file should become obsolete in 1.5 or higher, whatever + the next release after 1.4.x will be. We'll use std::string instead! +*/ + +#ifndef FLUID_FILENAME_H +# define FLUID_FILENAME_H + +#include +#include + +#include + +# if defined(__cplusplus) + +class Fl_String; + +Fl_String fl_filename_name(const Fl_String &filename); +Fl_String fl_filename_path(const Fl_String &filename); +Fl_String fl_filename_ext(const Fl_String &filename); +Fl_String fl_filename_setext(const Fl_String &filename, const Fl_String &new_extension); +Fl_String fl_filename_expand(const Fl_String &from); +Fl_String fl_filename_absolute(const Fl_String &from); +Fl_String fl_filename_absolute(const Fl_String &from, const Fl_String &base); +Fl_String fl_filename_relative(const Fl_String &from); +Fl_String fl_filename_relative(const Fl_String &from, const Fl_String &base); +Fl_String fl_getcwd(); + +# endif + +/** @} */ + +#endif /* FLUID_FILENAME_H */ diff --git a/fluid/makedepend b/fluid/makedepend index eb8f7614a..01f72ae12 100644 --- a/fluid/makedepend +++ b/fluid/makedepend @@ -77,7 +77,6 @@ alignment_panel.o: ../FL/Fl_Shortcut_Button.H alignment_panel.o: ../FL/Fl_Simple_Terminal.H alignment_panel.o: ../FL/Fl_Slider.H alignment_panel.o: ../FL/Fl_Spinner.H -alignment_panel.o: ../FL/Fl_String.H alignment_panel.o: ../FL/fl_string_functions.h alignment_panel.o: ../FL/Fl_Tabs.H alignment_panel.o: ../FL/Fl_Text_Buffer.H @@ -94,10 +93,12 @@ alignment_panel.o: ../FL/Fl_Window.H alignment_panel.o: ../FL/Fl_Wizard.H alignment_panel.o: ../FL/platform_types.h alignment_panel.o: ../src/flstring.h +alignment_panel.o: ../src/Fl_String.H alignment_panel.o: alignment_panel.h alignment_panel.o: code.h alignment_panel.o: Fd_Snap_Action.h alignment_panel.o: fluid.h +alignment_panel.o: fluid_filename.h alignment_panel.o: Fl_Group_Type.h alignment_panel.o: Fl_Type.h alignment_panel.o: Fl_Widget_Type.h @@ -127,7 +128,6 @@ align_widget.o: ../FL/Fl_Plugin.H align_widget.o: ../FL/Fl_Preferences.H align_widget.o: ../FL/Fl_Rect.H align_widget.o: ../FL/Fl_RGB_Image.H -align_widget.o: ../FL/Fl_String.H align_widget.o: ../FL/Fl_Tabs.H align_widget.o: ../FL/fl_types.h align_widget.o: ../FL/fl_utf8.h @@ -135,9 +135,11 @@ align_widget.o: ../FL/Fl_Widget.H align_widget.o: ../FL/Fl_Window.H align_widget.o: ../FL/Fl_Wizard.H align_widget.o: ../FL/platform_types.h +align_widget.o: ../src/Fl_String.H align_widget.o: align_widget.h align_widget.o: code.h align_widget.o: fluid.h +align_widget.o: fluid_filename.h align_widget.o: Fl_Group_Type.h align_widget.o: Fl_Type.h align_widget.o: Fl_Widget_Type.h @@ -195,7 +197,6 @@ code.o: ../FL/Fl_Shortcut_Button.H code.o: ../FL/Fl_Simple_Terminal.H code.o: ../FL/Fl_Slider.H code.o: ../FL/Fl_Spinner.H -code.o: ../FL/Fl_String.H code.o: ../FL/fl_string_functions.h code.o: ../FL/Fl_Tabs.H code.o: ../FL/Fl_Text_Buffer.H @@ -211,12 +212,14 @@ code.o: ../FL/Fl_Window.H code.o: ../FL/Fl_Wizard.H code.o: ../FL/platform_types.h code.o: ../src/flstring.h +code.o: ../src/Fl_String.H code.o: alignment_panel.h code.o: code.h code.o: ExternalCodeEditor_UNIX.h code.o: Fd_Snap_Action.h code.o: file.h code.o: fluid.h +code.o: fluid_filename.h code.o: Fluid_Image.h code.o: Fl_Function_Type.h code.o: Fl_Group_Type.h @@ -294,7 +297,6 @@ custom_widgets.o: ../FL/Fl_RGB_Image.H custom_widgets.o: ../FL/Fl_Scrollbar.H custom_widgets.o: ../FL/Fl_Shortcut_Button.H custom_widgets.o: ../FL/Fl_Slider.H -custom_widgets.o: ../FL/Fl_String.H custom_widgets.o: ../FL/fl_string_functions.h custom_widgets.o: ../FL/Fl_Tabs.H custom_widgets.o: ../FL/Fl_Text_Buffer.H @@ -312,11 +314,13 @@ custom_widgets.o: ../FL/platform.H custom_widgets.o: ../FL/platform_types.h custom_widgets.o: ../FL/x11.H custom_widgets.o: ../src/flstring.h +custom_widgets.o: ../src/Fl_String.H custom_widgets.o: code.h custom_widgets.o: CodeEditor.h custom_widgets.o: custom_widgets.h custom_widgets.o: factory.h custom_widgets.o: fluid.h +custom_widgets.o: fluid_filename.h custom_widgets.o: Fl_Group_Type.h custom_widgets.o: Fl_Type.h custom_widgets.o: Fl_Widget_Type.h @@ -337,14 +341,15 @@ ExternalCodeEditor_UNIX.o: ../FL/Fl_Export.H ExternalCodeEditor_UNIX.o: ../FL/Fl_Image.H ExternalCodeEditor_UNIX.o: ../FL/Fl_Menu_Item.H ExternalCodeEditor_UNIX.o: ../FL/Fl_Preferences.H -ExternalCodeEditor_UNIX.o: ../FL/Fl_String.H ExternalCodeEditor_UNIX.o: ../FL/fl_string_functions.h ExternalCodeEditor_UNIX.o: ../FL/fl_types.h ExternalCodeEditor_UNIX.o: ../FL/fl_utf8.h ExternalCodeEditor_UNIX.o: ../FL/Fl_Widget.H ExternalCodeEditor_UNIX.o: ../FL/platform_types.h +ExternalCodeEditor_UNIX.o: ../src/Fl_String.H ExternalCodeEditor_UNIX.o: ExternalCodeEditor_UNIX.h ExternalCodeEditor_UNIX.o: fluid.h +ExternalCodeEditor_UNIX.o: fluid_filename.h factory.o: ../config.h factory.o: ../FL/Enumerations.H factory.o: ../FL/filename.H @@ -397,7 +402,6 @@ factory.o: ../FL/Fl_Scrollbar.H factory.o: ../FL/Fl_Simple_Terminal.H factory.o: ../FL/Fl_Slider.H factory.o: ../FL/Fl_Spinner.H -factory.o: ../FL/Fl_String.H factory.o: ../FL/Fl_Tabs.H factory.o: ../FL/Fl_Text_Buffer.H factory.o: ../FL/Fl_Text_Display.H @@ -417,10 +421,12 @@ factory.o: ../FL/Fl_Window.H factory.o: ../FL/Fl_Wizard.H factory.o: ../FL/platform_types.h factory.o: ../src/flstring.h +factory.o: ../src/Fl_String.H factory.o: code.h factory.o: factory.h factory.o: Fd_Snap_Action.h factory.o: fluid.h +factory.o: fluid_filename.h factory.o: Fl_Button_Type.h factory.o: Fl_Group_Type.h factory.o: Fl_Menu_Type.h @@ -480,7 +486,6 @@ Fd_Snap_Action.o: ../FL/Fl_Shortcut_Button.H Fd_Snap_Action.o: ../FL/Fl_Simple_Terminal.H Fd_Snap_Action.o: ../FL/Fl_Slider.H Fd_Snap_Action.o: ../FL/Fl_Spinner.H -Fd_Snap_Action.o: ../FL/Fl_String.H Fd_Snap_Action.o: ../FL/fl_string_functions.h Fd_Snap_Action.o: ../FL/Fl_Tabs.H Fd_Snap_Action.o: ../FL/Fl_Text_Buffer.H @@ -495,11 +500,13 @@ Fd_Snap_Action.o: ../FL/Fl_Widget.H Fd_Snap_Action.o: ../FL/Fl_Window.H Fd_Snap_Action.o: ../FL/Fl_Wizard.H Fd_Snap_Action.o: ../FL/platform_types.h +Fd_Snap_Action.o: ../src/Fl_String.H Fd_Snap_Action.o: alignment_panel.h Fd_Snap_Action.o: code.h Fd_Snap_Action.o: Fd_Snap_Action.h Fd_Snap_Action.o: file.h Fd_Snap_Action.o: fluid.h +Fd_Snap_Action.o: fluid_filename.h Fd_Snap_Action.o: Fl_Group_Type.h Fd_Snap_Action.o: Fl_Type.h Fd_Snap_Action.o: Fl_Widget_Type.h @@ -560,7 +567,6 @@ file.o: ../FL/Fl_Shortcut_Button.H file.o: ../FL/Fl_Simple_Terminal.H file.o: ../FL/Fl_Slider.H file.o: ../FL/Fl_Spinner.H -file.o: ../FL/Fl_String.H file.o: ../FL/fl_string_functions.h file.o: ../FL/Fl_Tabs.H file.o: ../FL/Fl_Text_Buffer.H @@ -576,6 +582,7 @@ file.o: ../FL/Fl_Window.H file.o: ../FL/Fl_Wizard.H file.o: ../FL/platform_types.h file.o: ../src/flstring.h +file.o: ../src/Fl_String.H file.o: alignment_panel.h file.o: code.h file.o: ExternalCodeEditor_UNIX.h @@ -583,6 +590,7 @@ file.o: factory.h file.o: Fd_Snap_Action.h file.o: file.h file.o: fluid.h +file.o: fluid_filename.h file.o: Fluid_Image.h file.o: Fl_Function_Type.h file.o: Fl_Group_Type.h @@ -651,7 +659,6 @@ fluid.o: ../FL/Fl_Shortcut_Button.H fluid.o: ../FL/Fl_Simple_Terminal.H fluid.o: ../FL/Fl_Slider.H fluid.o: ../FL/Fl_Spinner.H -fluid.o: ../FL/Fl_String.H fluid.o: ../FL/fl_string_functions.h fluid.o: ../FL/Fl_Tabs.H fluid.o: ../FL/Fl_Text_Buffer.H @@ -668,6 +675,7 @@ fluid.o: ../FL/Fl_Window.H fluid.o: ../FL/Fl_Wizard.H fluid.o: ../FL/platform_types.h fluid.o: ../src/flstring.h +fluid.o: ../src/Fl_String.H fluid.o: about_panel.h fluid.o: alignment_panel.h fluid.o: code.h @@ -677,6 +685,7 @@ fluid.o: factory.h fluid.o: Fd_Snap_Action.h fluid.o: file.h fluid.o: fluid.h +fluid.o: fluid_filename.h fluid.o: Fluid_Image.h fluid.o: Fl_Function_Type.h fluid.o: Fl_Group_Type.h @@ -691,6 +700,21 @@ fluid.o: StyleParse.h fluid.o: template_panel.h fluid.o: undo.h fluid.o: widget_browser.h +fluid_filename.o: ../config.h +fluid_filename.o: ../FL/Enumerations.H +fluid_filename.o: ../FL/filename.H +fluid_filename.o: ../FL/Fl.H +fluid_filename.o: ../FL/fl_attr.h +fluid_filename.o: ../FL/Fl_Cairo.H +fluid_filename.o: ../FL/fl_casts.H +fluid_filename.o: ../FL/fl_config.h +fluid_filename.o: ../FL/Fl_Export.H +fluid_filename.o: ../FL/fl_string_functions.h +fluid_filename.o: ../FL/fl_types.h +fluid_filename.o: ../FL/fl_utf8.h +fluid_filename.o: ../FL/platform_types.h +fluid_filename.o: ../src/flstring.h +fluid_filename.o: ../src/Fl_String.H Fluid_Image.o: ../config.h Fluid_Image.o: ../FL/Enumerations.H Fluid_Image.o: ../FL/filename.H @@ -735,7 +759,6 @@ Fluid_Image.o: ../FL/Fl_Rect.H Fluid_Image.o: ../FL/Fl_Return_Button.H Fluid_Image.o: ../FL/Fl_RGB_Image.H Fluid_Image.o: ../FL/Fl_Shared_Image.H -Fluid_Image.o: ../FL/Fl_String.H Fluid_Image.o: ../FL/fl_string_functions.h Fluid_Image.o: ../FL/Fl_SVG_Image.H Fluid_Image.o: ../FL/Fl_Tabs.H @@ -747,9 +770,11 @@ Fluid_Image.o: ../FL/Fl_Window.H Fluid_Image.o: ../FL/Fl_Wizard.H Fluid_Image.o: ../FL/platform_types.h Fluid_Image.o: ../src/flstring.h +Fluid_Image.o: ../src/Fl_String.H Fluid_Image.o: code.h Fluid_Image.o: file.h Fluid_Image.o: fluid.h +Fluid_Image.o: fluid_filename.h Fluid_Image.o: Fluid_Image.h Fluid_Image.o: Fl_Group_Type.h Fluid_Image.o: Fl_Type.h @@ -783,17 +808,18 @@ Fl_Button_Type.o: ../FL/Fl_Repeat_Button.H Fl_Button_Type.o: ../FL/Fl_Return_Button.H Fl_Button_Type.o: ../FL/Fl_RGB_Image.H Fl_Button_Type.o: ../FL/Fl_Round_Button.H -Fl_Button_Type.o: ../FL/Fl_String.H Fl_Button_Type.o: ../FL/Fl_Tabs.H Fl_Button_Type.o: ../FL/fl_types.h Fl_Button_Type.o: ../FL/fl_utf8.h Fl_Button_Type.o: ../FL/Fl_Widget.H Fl_Button_Type.o: ../FL/Fl_Wizard.H Fl_Button_Type.o: ../FL/platform_types.h +Fl_Button_Type.o: ../src/Fl_String.H Fl_Button_Type.o: code.h Fl_Button_Type.o: Fd_Snap_Action.h Fl_Button_Type.o: file.h Fl_Button_Type.o: fluid.h +Fl_Button_Type.o: fluid_filename.h Fl_Button_Type.o: Fl_Button_Type.h Fl_Button_Type.o: Fl_Group_Type.h Fl_Button_Type.o: Fl_Type.h @@ -844,7 +870,6 @@ Fl_Function_Type.o: ../FL/Fl_RGB_Image.H Fl_Function_Type.o: ../FL/Fl_Scrollbar.H Fl_Function_Type.o: ../FL/Fl_Shared_Image.H Fl_Function_Type.o: ../FL/Fl_Slider.H -Fl_Function_Type.o: ../FL/Fl_String.H Fl_Function_Type.o: ../FL/fl_string_functions.h Fl_Function_Type.o: ../FL/Fl_Tabs.H Fl_Function_Type.o: ../FL/Fl_Text_Buffer.H @@ -859,12 +884,14 @@ Fl_Function_Type.o: ../FL/Fl_Window.H Fl_Function_Type.o: ../FL/Fl_Wizard.H Fl_Function_Type.o: ../FL/platform_types.h Fl_Function_Type.o: ../src/flstring.h +Fl_Function_Type.o: ../src/Fl_String.H Fl_Function_Type.o: code.h Fl_Function_Type.o: CodeEditor.h Fl_Function_Type.o: comments.h Fl_Function_Type.o: ExternalCodeEditor_UNIX.h Fl_Function_Type.o: file.h Fl_Function_Type.o: fluid.h +Fl_Function_Type.o: fluid_filename.h Fl_Function_Type.o: Fluid_Image.h Fl_Function_Type.o: Fl_Function_Type.h Fl_Function_Type.o: Fl_Group_Type.h @@ -884,6 +911,7 @@ Fl_Grid_Type.o: ../FL/Fl_Browser_.H Fl_Grid_Type.o: ../FL/Fl_Button.H Fl_Grid_Type.o: ../FL/Fl_Cairo.H Fl_Grid_Type.o: ../FL/fl_casts.H +Fl_Grid_Type.o: ../FL/Fl_Choice.H Fl_Grid_Type.o: ../FL/fl_config.h Fl_Grid_Type.o: ../FL/Fl_Device.H Fl_Grid_Type.o: ../FL/fl_draw.H @@ -895,6 +923,7 @@ Fl_Grid_Type.o: ../FL/Fl_Group.H Fl_Grid_Type.o: ../FL/Fl_Image.H Fl_Grid_Type.o: ../FL/Fl_Input.H Fl_Grid_Type.o: ../FL/Fl_Input_.H +Fl_Grid_Type.o: ../FL/Fl_Menu_.H Fl_Grid_Type.o: ../FL/Fl_Menu_Item.H Fl_Grid_Type.o: ../FL/Fl_Pack.H Fl_Grid_Type.o: ../FL/Fl_Pixmap.H @@ -904,7 +933,6 @@ Fl_Grid_Type.o: ../FL/Fl_Rect.H Fl_Grid_Type.o: ../FL/Fl_RGB_Image.H Fl_Grid_Type.o: ../FL/Fl_Scrollbar.H Fl_Grid_Type.o: ../FL/Fl_Slider.H -Fl_Grid_Type.o: ../FL/Fl_String.H Fl_Grid_Type.o: ../FL/Fl_Tabs.H Fl_Grid_Type.o: ../FL/fl_types.h Fl_Grid_Type.o: ../FL/fl_utf8.h @@ -914,11 +942,13 @@ Fl_Grid_Type.o: ../FL/Fl_Widget.H Fl_Grid_Type.o: ../FL/Fl_Wizard.H Fl_Grid_Type.o: ../FL/platform_types.h Fl_Grid_Type.o: ../src/flstring.h +Fl_Grid_Type.o: ../src/Fl_String.H Fl_Grid_Type.o: code.h Fl_Grid_Type.o: custom_widgets.h Fl_Grid_Type.o: Fd_Snap_Action.h Fl_Grid_Type.o: file.h Fl_Grid_Type.o: fluid.h +Fl_Grid_Type.o: fluid_filename.h Fl_Grid_Type.o: Fl_Grid_Type.h Fl_Grid_Type.o: Fl_Group_Type.h Fl_Grid_Type.o: Fl_Type.h @@ -944,7 +974,6 @@ Fl_Group_Type.o: ../FL/Fl_Flex.H Fl_Group_Type.o: ../FL/Fl_Graphics_Driver.H Fl_Group_Type.o: ../FL/Fl_Group.H Fl_Group_Type.o: ../FL/Fl_Image.H -Fl_Group_Type.o: ../FL/Fl_Int_Vector.H Fl_Group_Type.o: ../FL/Fl_Menu_Item.H Fl_Group_Type.o: ../FL/fl_message.H Fl_Group_Type.o: ../FL/Fl_Pack.H @@ -956,7 +985,6 @@ Fl_Group_Type.o: ../FL/Fl_RGB_Image.H Fl_Group_Type.o: ../FL/Fl_Scroll.H Fl_Group_Type.o: ../FL/Fl_Scrollbar.H Fl_Group_Type.o: ../FL/Fl_Slider.H -Fl_Group_Type.o: ../FL/Fl_String.H Fl_Group_Type.o: ../FL/Fl_Table.H Fl_Group_Type.o: ../FL/Fl_Tabs.H Fl_Group_Type.o: ../FL/fl_types.h @@ -966,10 +994,12 @@ Fl_Group_Type.o: ../FL/Fl_Widget.H Fl_Group_Type.o: ../FL/Fl_Wizard.H Fl_Group_Type.o: ../FL/platform_types.h Fl_Group_Type.o: ../src/flstring.h +Fl_Group_Type.o: ../src/Fl_String.H Fl_Group_Type.o: code.h Fl_Group_Type.o: Fd_Snap_Action.h Fl_Group_Type.o: file.h Fl_Group_Type.o: fluid.h +Fl_Group_Type.o: fluid_filename.h Fl_Group_Type.o: Fl_Group_Type.h Fl_Group_Type.o: Fl_Type.h Fl_Group_Type.o: Fl_Widget_Type.h @@ -1033,7 +1063,6 @@ Fl_Menu_Type.o: ../FL/Fl_Shortcut_Button.H Fl_Menu_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Menu_Type.o: ../FL/Fl_Slider.H Fl_Menu_Type.o: ../FL/Fl_Spinner.H -Fl_Menu_Type.o: ../FL/Fl_String.H Fl_Menu_Type.o: ../FL/fl_string_functions.h Fl_Menu_Type.o: ../FL/Fl_Tabs.H Fl_Menu_Type.o: ../FL/Fl_Text_Buffer.H @@ -1049,12 +1078,14 @@ Fl_Menu_Type.o: ../FL/Fl_Window.H Fl_Menu_Type.o: ../FL/Fl_Wizard.H Fl_Menu_Type.o: ../FL/platform_types.h Fl_Menu_Type.o: ../src/flstring.h +Fl_Menu_Type.o: ../src/Fl_String.H Fl_Menu_Type.o: alignment_panel.h Fl_Menu_Type.o: code.h Fl_Menu_Type.o: custom_widgets.h Fl_Menu_Type.o: Fd_Snap_Action.h Fl_Menu_Type.o: file.h Fl_Menu_Type.o: fluid.h +Fl_Menu_Type.o: fluid_filename.h Fl_Menu_Type.o: Fluid_Image.h Fl_Menu_Type.o: Fl_Button_Type.h Fl_Menu_Type.o: Fl_Group_Type.h @@ -1092,7 +1123,6 @@ Fl_Type.o: ../FL/Fl_RGB_Image.H Fl_Type.o: ../FL/Fl_Scrollbar.H Fl_Type.o: ../FL/Fl_Shared_Image.H Fl_Type.o: ../FL/Fl_Slider.H -Fl_Type.o: ../FL/Fl_String.H Fl_Type.o: ../FL/Fl_Tabs.H Fl_Type.o: ../FL/fl_types.h Fl_Type.o: ../FL/fl_utf8.h @@ -1101,11 +1131,13 @@ Fl_Type.o: ../FL/Fl_Widget.H Fl_Type.o: ../FL/Fl_Wizard.H Fl_Type.o: ../FL/platform_types.h Fl_Type.o: ../src/flstring.h +Fl_Type.o: ../src/Fl_String.H Fl_Type.o: code.h Fl_Type.o: ExternalCodeEditor_UNIX.h Fl_Type.o: Fd_Snap_Action.h Fl_Type.o: file.h Fl_Type.o: fluid.h +Fl_Type.o: fluid_filename.h Fl_Type.o: Fluid_Image.h Fl_Type.o: Fl_Function_Type.h Fl_Type.o: Fl_Group_Type.h @@ -1148,7 +1180,6 @@ Fl_Widget_Type.o: ../FL/Fl_Input.H Fl_Widget_Type.o: ../FL/Fl_Input_.H Fl_Widget_Type.o: ../FL/Fl_Input_Choice.H Fl_Widget_Type.o: ../FL/Fl_Int_Input.H -Fl_Widget_Type.o: ../FL/Fl_Int_Vector.H Fl_Widget_Type.o: ../FL/Fl_Light_Button.H Fl_Widget_Type.o: ../FL/Fl_Menu.H Fl_Widget_Type.o: ../FL/Fl_Menu_.H @@ -1175,7 +1206,6 @@ Fl_Widget_Type.o: ../FL/fl_show_colormap.H Fl_Widget_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Widget_Type.o: ../FL/Fl_Slider.H Fl_Widget_Type.o: ../FL/Fl_Spinner.H -Fl_Widget_Type.o: ../FL/Fl_String.H Fl_Widget_Type.o: ../FL/fl_string_functions.h Fl_Widget_Type.o: ../FL/Fl_Table.H Fl_Widget_Type.o: ../FL/Fl_Tabs.H @@ -1192,6 +1222,7 @@ Fl_Widget_Type.o: ../FL/Fl_Window.H Fl_Widget_Type.o: ../FL/Fl_Wizard.H Fl_Widget_Type.o: ../FL/platform_types.h Fl_Widget_Type.o: ../src/flstring.h +Fl_Widget_Type.o: ../src/Fl_String.H Fl_Widget_Type.o: alignment_panel.h Fl_Widget_Type.o: code.h Fl_Widget_Type.o: CodeEditor.h @@ -1200,6 +1231,7 @@ Fl_Widget_Type.o: ExternalCodeEditor_UNIX.h Fl_Widget_Type.o: Fd_Snap_Action.h Fl_Widget_Type.o: file.h Fl_Widget_Type.o: fluid.h +Fl_Widget_Type.o: fluid_filename.h Fl_Widget_Type.o: Fluid_Image.h Fl_Widget_Type.o: Fl_Button_Type.h Fl_Widget_Type.o: Fl_Function_Type.h @@ -1270,7 +1302,6 @@ Fl_Window_Type.o: ../FL/Fl_Shortcut_Button.H Fl_Window_Type.o: ../FL/Fl_Simple_Terminal.H Fl_Window_Type.o: ../FL/Fl_Slider.H Fl_Window_Type.o: ../FL/Fl_Spinner.H -Fl_Window_Type.o: ../FL/Fl_String.H Fl_Window_Type.o: ../FL/fl_string_functions.h Fl_Window_Type.o: ../FL/Fl_Tabs.H Fl_Window_Type.o: ../FL/Fl_Text_Buffer.H @@ -1288,6 +1319,7 @@ Fl_Window_Type.o: ../FL/platform.H Fl_Window_Type.o: ../FL/platform_types.h Fl_Window_Type.o: ../FL/x11.H Fl_Window_Type.o: ../src/flstring.h +Fl_Window_Type.o: ../src/Fl_String.H Fl_Window_Type.o: alignment_panel.h Fl_Window_Type.o: code.h Fl_Window_Type.o: CodeEditor.h @@ -1296,6 +1328,8 @@ Fl_Window_Type.o: factory.h Fl_Window_Type.o: Fd_Snap_Action.h Fl_Window_Type.o: file.h Fl_Window_Type.o: fluid.h +Fl_Window_Type.o: fluid_filename.h +Fl_Window_Type.o: Fl_Grid_Type.h Fl_Window_Type.o: Fl_Group_Type.h Fl_Window_Type.o: Fl_Type.h Fl_Window_Type.o: Fl_Widget_Type.h @@ -1340,7 +1374,6 @@ function_panel.o: ../FL/Fl_Return_Button.H function_panel.o: ../FL/Fl_RGB_Image.H function_panel.o: ../FL/Fl_Scrollbar.H function_panel.o: ../FL/Fl_Slider.H -function_panel.o: ../FL/Fl_String.H function_panel.o: ../FL/Fl_Text_Buffer.H function_panel.o: ../FL/Fl_Text_Display.H function_panel.o: ../FL/Fl_Text_Editor.H @@ -1350,11 +1383,13 @@ function_panel.o: ../FL/Fl_Valuator.H function_panel.o: ../FL/Fl_Widget.H function_panel.o: ../FL/Fl_Window.H function_panel.o: ../FL/platform_types.h +function_panel.o: ../src/Fl_String.H function_panel.o: code.h function_panel.o: CodeEditor.h function_panel.o: custom_widgets.h function_panel.o: factory.h function_panel.o: fluid.h +function_panel.o: fluid_filename.h function_panel.o: Fl_Type.h function_panel.o: function_panel.h function_panel.o: pixmaps.h @@ -1376,10 +1411,10 @@ pixmaps.o: ../FL/Fl_Plugin.H pixmaps.o: ../FL/Fl_Preferences.H pixmaps.o: ../FL/Fl_Rect.H pixmaps.o: ../FL/Fl_RGB_Image.H -pixmaps.o: ../FL/Fl_String.H pixmaps.o: ../FL/fl_types.h pixmaps.o: ../FL/Fl_Widget.H pixmaps.o: ../FL/platform_types.h +pixmaps.o: ../src/Fl_String.H pixmaps.o: code.h pixmaps.o: Fl_Type.h pixmaps.o: pixmaps.h @@ -1497,7 +1532,6 @@ shell_command.o: ../FL/Fl_Shortcut_Button.H shell_command.o: ../FL/Fl_Simple_Terminal.H shell_command.o: ../FL/Fl_Slider.H shell_command.o: ../FL/Fl_Spinner.H -shell_command.o: ../FL/Fl_String.H shell_command.o: ../FL/fl_string_functions.h shell_command.o: ../FL/Fl_Tabs.H shell_command.o: ../FL/Fl_Text_Buffer.H @@ -1512,11 +1546,13 @@ shell_command.o: ../FL/Fl_Widget.H shell_command.o: ../FL/Fl_Window.H shell_command.o: ../FL/Fl_Wizard.H shell_command.o: ../FL/platform_types.h +shell_command.o: ../src/Fl_String.H shell_command.o: alignment_panel.h shell_command.o: code.h shell_command.o: Fd_Snap_Action.h shell_command.o: file.h shell_command.o: fluid.h +shell_command.o: fluid_filename.h shell_command.o: Fl_Group_Type.h shell_command.o: Fl_Type.h shell_command.o: Fl_Widget_Type.h @@ -1550,7 +1586,6 @@ sourceview_panel.o: ../FL/Fl_Rect.H sourceview_panel.o: ../FL/Fl_RGB_Image.H sourceview_panel.o: ../FL/Fl_Scrollbar.H sourceview_panel.o: ../FL/Fl_Slider.H -sourceview_panel.o: ../FL/Fl_String.H sourceview_panel.o: ../FL/Fl_Tabs.H sourceview_panel.o: ../FL/Fl_Text_Buffer.H sourceview_panel.o: ../FL/Fl_Text_Display.H @@ -1562,10 +1597,12 @@ sourceview_panel.o: ../FL/Fl_Widget.H sourceview_panel.o: ../FL/Fl_Window.H sourceview_panel.o: ../FL/platform_types.h sourceview_panel.o: ../src/flstring.h +sourceview_panel.o: ../src/Fl_String.H sourceview_panel.o: code.h sourceview_panel.o: CodeEditor.h sourceview_panel.o: file.h sourceview_panel.o: fluid.h +sourceview_panel.o: fluid_filename.h sourceview_panel.o: Fl_Type.h sourceview_panel.o: sourceview_panel.h sourceview_panel.o: StyleParse.h @@ -1593,7 +1630,6 @@ template_panel.o: ../FL/Fl_Menu_Item.H template_panel.o: ../FL/Fl_Preferences.H template_panel.o: ../FL/Fl_Return_Button.H template_panel.o: ../FL/Fl_Shared_Image.H -template_panel.o: ../FL/Fl_String.H template_panel.o: ../FL/fl_string_functions.h template_panel.o: ../FL/fl_types.h template_panel.o: ../FL/fl_utf8.h @@ -1601,7 +1637,9 @@ template_panel.o: ../FL/Fl_Widget.H template_panel.o: ../FL/Fl_Window.H template_panel.o: ../FL/platform_types.h template_panel.o: ../src/flstring.h +template_panel.o: ../src/Fl_String.H template_panel.o: fluid.h +template_panel.o: fluid_filename.h template_panel.o: template_panel.h undo.o: ../config.h undo.o: ../FL/Enumerations.H @@ -1628,7 +1666,6 @@ undo.o: ../FL/Fl_Rect.H undo.o: ../FL/Fl_RGB_Image.H undo.o: ../FL/Fl_Scrollbar.H undo.o: ../FL/Fl_Slider.H -undo.o: ../FL/Fl_String.H undo.o: ../FL/fl_types.h undo.o: ../FL/fl_utf8.h undo.o: ../FL/Fl_Valuator.H @@ -1636,9 +1673,11 @@ undo.o: ../FL/Fl_Widget.H undo.o: ../FL/Fl_Window.H undo.o: ../FL/platform_types.h undo.o: ../src/flstring.h +undo.o: ../src/Fl_String.H undo.o: code.h undo.o: file.h undo.o: fluid.h +undo.o: fluid_filename.h undo.o: Fl_Type.h undo.o: Fl_Widget_Type.h undo.o: undo.h @@ -1665,14 +1704,15 @@ widget_browser.o: ../FL/Fl_Rect.H widget_browser.o: ../FL/Fl_RGB_Image.H widget_browser.o: ../FL/Fl_Scrollbar.H widget_browser.o: ../FL/Fl_Slider.H -widget_browser.o: ../FL/Fl_String.H widget_browser.o: ../FL/fl_types.h widget_browser.o: ../FL/fl_utf8.h widget_browser.o: ../FL/Fl_Valuator.H widget_browser.o: ../FL/Fl_Widget.H widget_browser.o: ../FL/platform_types.h +widget_browser.o: ../src/Fl_String.H widget_browser.o: code.h widget_browser.o: fluid.h +widget_browser.o: fluid_filename.h widget_browser.o: Fl_Type.h widget_browser.o: Fl_Widget_Type.h widget_browser.o: pixmaps.h @@ -1712,7 +1752,6 @@ widget_panel.o: ../FL/Fl_RGB_Image.H widget_panel.o: ../FL/Fl_Scrollbar.H widget_panel.o: ../FL/Fl_Shortcut_Button.H widget_panel.o: ../FL/Fl_Slider.H -widget_panel.o: ../FL/Fl_String.H widget_panel.o: ../FL/Fl_Tabs.H widget_panel.o: ../FL/Fl_Text_Buffer.H widget_panel.o: ../FL/Fl_Text_Display.H @@ -1725,6 +1764,7 @@ widget_panel.o: ../FL/Fl_Value_Input.H widget_panel.o: ../FL/Fl_Widget.H widget_panel.o: ../FL/Fl_Window.H widget_panel.o: ../FL/platform_types.h +widget_panel.o: ../src/Fl_String.H widget_panel.o: code.h widget_panel.o: CodeEditor.h widget_panel.o: custom_widgets.h diff --git a/fluid/shell_command.h b/fluid/shell_command.h index e2e553d7b..84de3630a 100644 --- a/fluid/shell_command.h +++ b/fluid/shell_command.h @@ -19,7 +19,7 @@ #include "fluid.h" -#include +#include "../src/Fl_String.H" #include #include diff --git a/fluid/template_panel.cxx b/fluid/template_panel.cxx index 67b31a536..0654724f0 100644 --- a/fluid/template_panel.cxx +++ b/fluid/template_panel.cxx @@ -21,7 +21,7 @@ #include #include #include -#include +#include "fluid_filename.h" #include "../src/flstring.h" #include #include diff --git a/fluid/template_panel.fl b/fluid/template_panel.fl index 3d30be846..1f6f801f0 100644 --- a/fluid/template_panel.fl +++ b/fluid/template_panel.fl @@ -32,7 +32,7 @@ decl {\#include } {private local decl {\#include } {private local } -decl {\#include } {private local +decl {\#include "fluid_filename.h"} {private local } decl {\#include "../src/flstring.h"} {private local diff --git a/fluid/undo.cxx b/fluid/undo.cxx index 92f84a666..08b1ed6f4 100644 --- a/fluid/undo.cxx +++ b/fluid/undo.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include "fluid_filename.h" #include "../src/flstring.h" #if defined(_WIN32) && !defined(__CYGWIN__) diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 26860987f..2dcf5fad9 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -50,8 +50,8 @@ #include #include #include -#include -#include +#include "Fl_Int_Vector.H" +#include "Fl_String.H" #include #include diff --git a/FL/Fl_Int_Vector.H b/src/Fl_Int_Vector.H similarity index 95% rename from FL/Fl_Int_Vector.H rename to src/Fl_Int_Vector.H index d21e8668c..6d89f596e 100644 --- a/FL/Fl_Int_Vector.H +++ b/src/Fl_Int_Vector.H @@ -20,7 +20,7 @@ #include -/** \file FL/Fl_Int_Vector.H +/** \file src/Fl_Int_Vector.H An STL-ish vector implemented without templates. */ @@ -33,7 +33,7 @@ Common use: \code #include - #include + #include "Fl_Int_Vector.H" int main() { Fl_Int_Vector v; @@ -56,6 +56,8 @@ \endcode \todo + - Note: this class is only for internal use and deprecated by design. + It will be replaced with std::vector in the next version after 1.4.x. - Add other std::vector methods like erase(), etc. - Make memory blocking size flexible, and add related methods like capacity(), reserve(), shrink_to_fit(), etc. - Add non-std methods that are nevertheless needed, e.g. insert(index,val), delete(index), delete(start, end), swap(a_idx,b_idx) diff --git a/src/Fl_Int_Vector.cxx b/src/Fl_Int_Vector.cxx index 455dd381d..bbbf149dd 100644 --- a/src/Fl_Int_Vector.cxx +++ b/src/Fl_Int_Vector.cxx @@ -15,7 +15,7 @@ // https://www.fltk.org/bugs.php // -#include +#include "Fl_Int_Vector.H" #include #include diff --git a/src/Fl_Message.cxx b/src/Fl_Message.cxx index 246835d6c..ee3f61cd3 100644 --- a/src/Fl_Message.cxx +++ b/src/Fl_Message.cxx @@ -445,9 +445,18 @@ Fl_Box *Fl_Message::message_icon() { /** Does all Fl_Message window internals for messages with a text input field. + \param[in] fmt printf style format used in the user function call + \param[in] ap argument list provided by the user function call + \param[in] defstr default string given by the user + \param[in] type either FL_NORMAL_INPUT or FL_SECRET_INPUT (password) + \param[in] maxchar max. number of allowed characters (not bytes) + \param[in] str true: return type is string, false: internal buffer + + \returns pointer to string or NULL if cancel or escape were hit + \see innards() */ -const char *Fl_Message::input_innards(const char *fmt, va_list ap, const char *defstr, uchar type, int maxchar) { +const char *Fl_Message::input_innards(const char *fmt, va_list ap, const char *defstr, uchar type, int maxchar, bool str) { message_->position(60, 10); input_->type(type); input_->show(); @@ -465,7 +474,7 @@ const char *Fl_Message::input_innards(const char *fmt, va_list ap, const char *d int size = input_->size() + 1; - if (maxchar < 0) { // need to store the value in pre-allocated buffer + if (!str) { // need to store the value in pre-allocated buffer // The allocated input buffer starts with size 0 and is allocated // in multiples of 128 bytes >= size. If both the size and the pointer @@ -485,7 +494,7 @@ const char *Fl_Message::input_innards(const char *fmt, va_list ap, const char *d input_buffer_[input_->size()] = '\0'; return (input_buffer_); - } else { // new version: return value() which will be copied + } else { // string version: return value() which will be copied return input_->value(); } diff --git a/src/Fl_Message.h b/src/Fl_Message.h index 2f33df1d1..4b0581a8c 100644 --- a/src/Fl_Message.h +++ b/src/Fl_Message.h @@ -88,10 +88,6 @@ private: // and fl_password() return their input text, we *need* to store // the text in an internal (static) buffer. :-( - // The newer functions fl_input_str() and fl_password_str() return the - // text in an Fl_String object that must be allocated and free()'d by - // the caller. - static char *input_buffer_; // points to the allocated text buffer static int input_size_; // size of allocated text buffer @@ -169,7 +165,7 @@ public: int innards(const char *fmt, va_list ap, const char *b0, const char *b1, const char *b2); - const char *input_innards(const char *fmt, va_list ap, const char *defstr, uchar type, int maxchar = -1); + const char *input_innards(const char *fmt, va_list ap, const char *defstr, uchar type, int maxchar = -1, bool str = false); }; /** diff --git a/src/Fl_Preferences.cxx b/src/Fl_Preferences.cxx index 6a6150fad..f4a769d69 100644 --- a/src/Fl_Preferences.cxx +++ b/src/Fl_Preferences.cxx @@ -1,8 +1,8 @@ // // Preferences methods for the Fast Light Tool Kit (FLTK). // -// Copyright 2011-2022 by Bill Spitzak and others. // Copyright 2002-2010 by Matthias Melcher. +// Copyright 2011-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -28,6 +28,9 @@ #include #include +#if (FLTK_USE_STD) +#include +#endif char Fl_Preferences::nameBuffer[128]; char Fl_Preferences::uuidBuffer[40]; @@ -844,46 +847,36 @@ 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 -// (non-zero) or the default was used (0). -// -// \param[in] key name of entry -// \param[out] value returned from preferences or default value if none was set -// \param[in] defaultValue default value to be used if no preference was set -// \return 0 if the default value was used -// */ -//char Fl_Preferences::get( const char *key, Fl_String &value, const Fl_String &defaultValue ) { -// const char *v = node->get( key ); -// if (v) { -// if ( strchr( v, '\\' ) ) { -// char *text = decodeText( v ); -// value = text; -// ::free(text); -// } else { -// value = v; -// } -// return 1; -// } else { -// value = defaultValue; -// return 0; -// } -//} +#if (FLTK_USE_STD) -// /** -// Sets an entry (name/value pair). The return value indicates if there -// was a problem storing the data in memory. However it does not -// reflect if the value was actually stored in the preference file. -// -// \param[in] entry name of entry -// \param[in] value set this entry to value (stops at the first nul character). -// \return 0 if setting the value failed -// */ -//char Fl_Preferences::set( const char *entry, const Fl_String &value ) { -// return set(entry, value.c_str()); -//} +/** + Reads an entry from the group. A default value must be + supplied. The return value indicates if the value was available + (non-zero) or the default was used (0). + \param[in] key name of entry + \param[out] value returned from preferences or default value if none was set + \param[in] defaultValue default value to be used if no preference was set + \return 0 if the default value was used + */ +char Fl_Preferences::get( const char *key, std::string &value, const std::string &defaultValue ) { + const char *v = node->get( key ); + if (v) { + if ( strchr( v, '\\' ) ) { + char *text = decodeText( v ); + value = text; + ::free(text); + } else { + value = v; + } + return 1; + } else { + value = defaultValue; + return 0; + } +} + +#endif /** Sets an entry (name/value pair). The return value indicates if there @@ -1055,6 +1048,23 @@ char Fl_Preferences::set( const char *key, const void *data, int dsize ) { return 1; } +#if (FLTK_USE_STD) + +/** + Sets an entry (name/value pair). The return value indicates if there + was a problem storing the data in memory. However it does not + reflect if the value was actually stored in the preference file. + + \param[in] entry name of entry + \param[in] value set this entry to value (stops at the first nul character). + \return 0 if setting the value failed + */ +char Fl_Preferences::set( const char *entry, const std::string &value ) { + return set(entry, value.c_str()); +} + +#endif // FLTK_USE_STD + /** Returns the size of the value part of an entry. diff --git a/FL/Fl_String.H b/src/Fl_String.H similarity index 98% rename from FL/Fl_String.H rename to src/Fl_String.H index f8e273d65..8c8569e8d 100644 --- a/FL/Fl_String.H +++ b/src/Fl_String.H @@ -17,11 +17,11 @@ #ifndef _FL_Fl_String_H_ #define _FL_Fl_String_H_ -/** \file FL/Fl_String.H +/** \file src/Fl_String.H Basic Fl_String class for FLTK. */ -#include "Fl_Export.H" +#include // See: https://en.cppreference.com/w/cpp/string/basic_string/basic_string diff --git a/src/Fl_String.cxx b/src/Fl_String.cxx index e285519ff..c17578dd5 100644 --- a/src/Fl_String.cxx +++ b/src/Fl_String.cxx @@ -14,7 +14,7 @@ // https://www.fltk.org/bugs.php // -#include +#include "Fl_String.H" #include #include diff --git a/src/Fl_Table.cxx b/src/Fl_Table.cxx index 91ebe262e..09b4dbdf8 100644 --- a/src/Fl_Table.cxx +++ b/src/Fl_Table.cxx @@ -1,8 +1,9 @@ // -// Fl_Table -- A table widget +// Fl_Table -- A table widget for the Fast Light Tool Kit (FLTK). // // Copyright 2002 by Greg Ercolano. // Copyright (c) 2004 O'ksi'D +// Copyright 2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -16,10 +17,22 @@ // #include - #include #include +// DEBUG - remove this when done, set to 0 to disable debug output +#define DEBUG_ROW_COL_RESIZE 1 + +// EXPERIMENTAL +// We use either std::vector or the private class Fl_Int_Vector +// depending on the build option OPTION_USE_STD or equivalent. +// This option allows to use std::string and maybe std::vector +// already in FLTK 1.4.x + +#if (!FLTK_USE_STD) +#include "Fl_Int_Vector.H" // Note: MUST NOT be included in Fl_Table.H +#endif + #include #include // memcpy #include // fprintf @@ -144,6 +157,15 @@ Fl_Table::Fl_Table(int X, int Y, int W, int H, const char *l) : Fl_Group(X,Y,W,H select_col = -1; _scrollbar_size = 0; flags_ = 0; // TABCELLNAV off + +#if (FLTK_USE_STDXX) + _colwidths = new std::vector; // column widths in pixels + _rowheights = new std::vector; // row heights in pixels +#else + _colwidths = new Fl_Int_Vector(); // column widths in pixels + _rowheights = new Fl_Int_Vector(); // row heights in pixels +#endif + box(FL_THIN_DOWN_FRAME); vscrollbar = new Fl_Scrollbar(x()+w()-Fl::scrollbar_size(), y(), @@ -177,6 +199,31 @@ Fl_Table::Fl_Table(int X, int Y, int W, int H, const char *l) : Fl_Group(X,Y,W,H */ Fl_Table::~Fl_Table() { // The parent Fl_Group takes care of destroying scrollbars + delete _colwidths; + delete _rowheights; +} + + +/** + Returns the current number of columns. + + This is equivalent to the size of the column widths vector. + + \returns Number of columns. +*/ +int Fl_Table::col_size() { + return int(_colwidths->size()); +} + +/** + Returns the current number of rows. + + This is equivalent to the size of the row heights vector. + + \returns Number of rows. +*/ +int Fl_Table::row_size() { + return int(_rowheights->size()); } /** @@ -187,17 +234,21 @@ Fl_Table::~Fl_Table() { */ void Fl_Table::row_height(int row, int height) { if ( row < 0 ) return; - if ( row < (int)_rowheights.size() && _rowheights[row] == height ) { + if ( row < row_size() && (*_rowheights)[row] == height ) { return; // OPTIMIZATION: no change? avoid redraw } // Add row heights, even if none yet - int now_size = (int)_rowheights.size(); - if ( row >= now_size ) { - _rowheights.size(row); + int now_size = row_size(); + if (row >= now_size) { +#if (FLTK_USE_STD) + _rowheights->resize(row, height); +#else + _rowheights->size(row); while (now_size < row) - _rowheights[now_size++] = height; + (*_rowheights)[now_size++] = height; +#endif // FLTK_USE_STD } - _rowheights[row] = height; + (*_rowheights)[row] = height; table_resized(); if ( row <= botrow ) { // OPTIMIZATION: only redraw if onscreen or above screen redraw(); @@ -216,18 +267,21 @@ void Fl_Table::row_height(int row, int height) { void Fl_Table::col_width(int col, int width) { if ( col < 0 ) return; - if ( col < (int)_colwidths.size() && _colwidths[col] == width ) { + if ( col < col_size() && (*_colwidths)[col] == width ) { return; // OPTIMIZATION: no change? avoid redraw } // Add column widths, even if none yet - int now_size = (int)_colwidths.size(); + int now_size = col_size(); if ( col >= now_size ) { - _colwidths.size(col+1); - while (now_size < col) { - _colwidths[now_size++] = width; - } +#if (FLTK_USE_STD) + _colwidths->resize(col+1, width); +#else + _colwidths->size(col+1); + while (now_size < col) + (*_colwidths)[now_size++] = width; +#endif } - _colwidths[col] = width; + (*_colwidths)[col] = width; table_resized(); if ( col <= rightcol ) { // OPTIMIZATION: only redraw if onscreen or to the left redraw(); @@ -635,14 +689,30 @@ void Fl_Table::scroll_cb(Fl_Widget*w, void *data) { void Fl_Table::rows(int val) { int oldrows = _rows; _rows = val; - { - int default_h = ( _rowheights.size() > 0 ) ? _rowheights.back() : 25; - int now_size = _rowheights.size(); - _rowheights.size(val); // enlarge or shrink as needed - while ( now_size < val ) { - _rowheights[now_size++] = default_h; // fill new - } - } + + int default_h = row_size() > 0 ? _rowheights->back() : 25; + int now_size = row_size(); + +#if DEBUG_ROW_COL_RESIZE + fprintf(stderr, "Fl_Table::rows(%d) from %d, FLTK_USE_STD = %d\n", val, now_size, FLTK_USE_STD); + fflush(stderr); + Fl_Timestamp start = Fl::now(); +#endif + +#if (FLTK_USE_STD) + if (now_size != val) + _rowheights->resize(val, default_h); // enlarge or shrink as needed +#else + _rowheights->size(val); // enlarge or shrink as needed + while (now_size < val) + (*_rowheights)[now_size++] = default_h; // fill new +#endif + +#if DEBUG_ROW_COL_RESIZE + fprintf(stderr, "Fl_Table::rows(%d) - done in %7.3f ms\n", val, Fl::seconds_since(start)*1000); + fflush(stderr); +#endif + table_resized(); // OPTIMIZATION: redraw only if change is visible. @@ -658,14 +728,31 @@ void Fl_Table::rows(int val) { */ void Fl_Table::cols(int val) { _cols = val; - { - int default_w = ( _colwidths.size() > 0 ) ? _colwidths[_colwidths.size()-1] : 80; - int now_size = _colwidths.size(); - _colwidths.size(val); // enlarge or shrink as needed - while ( now_size < val ) { - _colwidths[now_size++] = default_w; // fill new - } - } + + int default_w = col_size() > 0 ? (*_colwidths)[col_size()-1] : 80; + int now_size = col_size(); + +#if DEBUG_ROW_COL_RESIZE + fprintf(stderr, "Fl_Table::cols(%d) from %d, FLTK_USE_STD = %d\n", val, now_size, FLTK_USE_STD); + fflush(stderr); + Fl_Timestamp start = Fl::now(); +#endif + +#if (FLTK_USE_STD) + if (now_size != val) + _colwidths->resize(val, default_w); // enlarge or shrink as needed +#else + _colwidths->size(val); // enlarge or shrink as needed + while (now_size < val) + (*_colwidths)[now_size++] = default_w; // fill new +#endif + +#if DEBUG_ROW_COL_RESIZE + double delta = Fl::seconds_since(start) * 1000; + fprintf(stderr, "Fl_Table::cols(%d) - done in %7.3f ms\n", val, delta); + fflush(stderr); +#endif + table_resized(); redraw(); } @@ -1368,3 +1455,17 @@ void Fl_Table::draw() { } fl_pop_clip(); } + +/** + Returns the current height of the specified row as a value in pixels. +*/ +int Fl_Table::row_height(int row) { + return((row < 0 || row >= row_size()) ? 0 : (*_rowheights)[row]); +} + +/** + Returns the current width of the specified column in pixels. +*/ +int Fl_Table::col_width(int col) { + return((col < 0 || col >= col_size()) ? 0 : (*_colwidths)[col]); +} diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 01c799fad..b42e17814 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -26,7 +26,7 @@ #include #include #include -#include +#include "../../Fl_Int_Vector.H" #include "../../print_button.h" #include #include diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx index c1a65ba91..da4dd816b 100644 --- a/src/filename_absolute.cxx +++ b/src/filename_absolute.cxx @@ -22,7 +22,6 @@ #include #include -#include #include #include "Fl_System_Driver.H" #include @@ -165,8 +164,10 @@ int Fl_System_Driver::filename_absolute(char *to, int tolen, const char *from, c \param[in] from absolute filename \return 0 if no change, non zero otherwise \see fl_filename_relative(char *to, int tolen, const char *from, const char *base) - \see fl_filename_relative(const Fl_String &from, const Fl_String &base) - \see fl_filename_relative(const Fl_String &from) + */ int fl_filename_relative(char *to, int tolen, const char *from) { @@ -284,6 +285,10 @@ int Fl_System_Driver::filename_relative(char *to, int tolen, const char *dest_di \endcond */ +// FIXME: '0 &&' => We can't do that in 1.4.x, enable this block in 1.5 or higher. +// There would be too many naming conflicts with fluid's usage of these functions. + +#if (0 && FLTK_USE_STD) /** Return a new string that contains the name part of the filename. @@ -291,8 +296,8 @@ int Fl_System_Driver::filename_relative(char *to, int tolen, const char *dest_di \return the name part of a filename \see fl_filename_name(const char *filename) */ -Fl_String fl_filename_name(const Fl_String &filename) { - return Fl_String(fl_filename_name(filename.c_str())); +std::string fl_filename_name(const std::string &filename) { + return std::string(fl_filename_name(filename.c_str())); } /** @@ -301,13 +306,13 @@ Fl_String fl_filename_name(const Fl_String &filename) { \return the path part of a filename without the name \see fl_filename_name(const char *filename) */ -Fl_String fl_filename_path(const Fl_String &filename) { +std::string fl_filename_path(const std::string &filename) { const char *base = filename.c_str(); const char *name = fl_filename_name(base); if (name) { - return Fl_String(base, (int)(name-base)); + return std::string(base, (int)(name-base)); } else { - return Fl_String(); + return std::string(); } } @@ -318,8 +323,8 @@ Fl_String fl_filename_path(const Fl_String &filename) { string if the filename has no extension \see fl_filename_ext(const char *buf) */ -Fl_String fl_filename_ext(const Fl_String &filename) { - return Fl_String(fl_filename_ext(filename.c_str())); +std::string fl_filename_ext(const std::string &filename) { + return std::string(fl_filename_ext(filename.c_str())); } /** @@ -329,11 +334,11 @@ Fl_String fl_filename_ext(const Fl_String &filename) { \return the new filename \see fl_filename_setext(char *to, int tolen, const char *ext) */ -Fl_String fl_filename_setext(const Fl_String &filename, const Fl_String &new_extension) { +std::string fl_filename_setext(const std::string &filename, const std::string &new_extension) { char buffer[FL_PATH_MAX]; fl_strlcpy(buffer, filename.c_str(), FL_PATH_MAX); fl_filename_setext(buffer, FL_PATH_MAX, new_extension.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** @@ -342,10 +347,10 @@ Fl_String fl_filename_setext(const Fl_String &filename, const Fl_String &new_ext \return the new, expanded filename \see fl_filename_expand(char *to, int tolen, const char *from) */ -Fl_String fl_filename_expand(const Fl_String &from) { +std::string fl_filename_expand(const std::string &from) { char buffer[FL_PATH_MAX]; fl_filename_expand(buffer, FL_PATH_MAX, from.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** @@ -354,10 +359,10 @@ Fl_String fl_filename_expand(const Fl_String &from) { \return the new, absolute filename \see fl_filename_absolute(char *to, int tolen, const char *from) */ -Fl_String fl_filename_absolute(const Fl_String &from) { +std::string fl_filename_absolute(const std::string &from) { char buffer[FL_PATH_MAX]; fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** @@ -368,10 +373,10 @@ Fl_String fl_filename_absolute(const Fl_String &from) { \return the new, absolute filename \see fl_filename_absolute(char *to, int tolen, const char *from, const char *base) */ -Fl_String fl_filename_absolute(const Fl_String &from, const Fl_String &base) { +std::string fl_filename_absolute(const std::string &from, const std::string &base) { char buffer[FL_PATH_MAX]; fl_filename_absolute(buffer, FL_PATH_MAX, from.c_str(), base.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** @@ -380,10 +385,10 @@ Fl_String fl_filename_absolute(const Fl_String &from, const Fl_String &base) { \return the new, relative filename \see fl_filename_relative(char *to, int tolen, const char *from) */ -Fl_String fl_filename_relative(const Fl_String &from) { +std::string fl_filename_relative(const std::string &from) { char buffer[FL_PATH_MAX]; fl_filename_relative(buffer, FL_PATH_MAX, from.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** @@ -393,19 +398,20 @@ Fl_String fl_filename_relative(const Fl_String &from) { \return the new, relative filename \see fl_filename_relative(char *to, int tolen, const char *from, const char *base) */ -Fl_String fl_filename_relative(const Fl_String &from, const Fl_String &base) { +std::string fl_filename_relative(const std::string &from, const std::string &base) { char buffer[FL_PATH_MAX]; fl_filename_relative(buffer, FL_PATH_MAX, from.c_str(), base.c_str()); - return Fl_String(buffer); + return std::string(buffer); } /** Cross-platform function to get the current working directory - as a UTF-8 encoded value in an Fl_String. + as a UTF-8 encoded value in an std::string. \return the CWD encoded as UTF-8 */ -Fl_String fl_getcwd() { +std::string fl_getcwd() { char buffer[FL_PATH_MAX]; fl_getcwd(buffer, FL_PATH_MAX); - return Fl_String(buffer); + return std::string(buffer); } +#endif // FLTK_USE_STD diff --git a/src/fl_ask.cxx b/src/fl_ask.cxx index 6ed6b2667..29221d494 100644 --- a/src/fl_ask.cxx +++ b/src/fl_ask.cxx @@ -292,14 +292,10 @@ Fl_Widget *fl_message_icon() { /** Shows an input dialog displaying the \p fmt message with variable arguments. - This version of fl_input() is deprecated. The return value points - to an internal allocated string that may be changed later. You must - copy the string immediately after return from this method - at least + Returns the string in an internally allocated buffer that may be changed later. + You \b must copy the string immediately after return from this method - at least before the next execution of the event loop. - \deprecated Please use - fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) instead. - \code #include \endcode \param[in] fmt can be used as an sprintf-like format and variables for the message text @@ -313,11 +309,45 @@ const char *fl_input(const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, -1); + const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, 0, false); va_end(ap); return r; } + +/** Shows an input dialog displaying the \p fmt message with variable arguments. + + This is the same as const char *fl_input(const char *fmt, const char *defstr, ...) + except that it has an additional parameter to limit the number of characters + the user can input. + + Returns the string in an internally allocated buffer that may be changed later. + You \b must copy the string immediately after return from this method - at least + before the next execution of the event loop. + + \code #include \endcode + + \param[in] fmt can be used as an sprintf-like format and variables for the message text + \param[in] defstr defines the default returned string if no text is entered + + \return the user string input if OK was pushed + \retval NULL if Cancel was pushed or the window was closed by the user +*/ +const char *fl_input(int maxchar, const char *fmt, const char *defstr, ...) { + + Fl_Message msg("?"); + if (maxchar < 0) maxchar = 0; + va_list ap; + va_start(ap, defstr); + const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar, false); + va_end(ap); + return r; +} + + + +#if (FLTK_USE_STD) + /** Shows an input dialog displaying the \p fmt message with variable arguments. Like fl_input(), but this method has the additional argument \p maxchar @@ -326,7 +356,7 @@ const char *fl_input(const char *fmt, const char *defstr, ...) { in the string is larger than \p maxchar. Other than the deprecated fl_input() method w/o the \p maxchar argument, this one - returns the string in an Fl_String object that must be released after use. This + returns the string in an std::string object that must be released after use. This can be a local/automatic variable. The \p ret variable is set to 0 if the user clicked OK, and to a negative @@ -338,7 +368,7 @@ const char *fl_input(const char *fmt, const char *defstr, ...) { Example: \code { int ret; - Fl_String str = fl_input_str(ret, 0, "Enter text:", ""); + std::string str = fl_input_str(ret, 0, "Enter text:", ""); if (ret < 0) printf("Text input was canceled.\n"); else @@ -356,31 +386,33 @@ const char *fl_input(const char *fmt, const char *defstr, ...) { \since 1.4.0 */ -Fl_String fl_input_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { +std::string fl_input_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); if (maxchar < 0) maxchar = 0; va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar); + const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar, true); va_end(ap); ret = (r == NULL) ? -1 : 0; - return Fl_String(r); + return (r == NULL) ? std::string("") : std::string(r); } /** Shows an input dialog displaying the \p fmt message with variable arguments. \note No information is given if the user canceled the dialog or clicked OK. \see fl_input_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) */ -Fl_String fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) { +std::string fl_input_str(int maxchar, const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); if (maxchar < 0) maxchar = 0; va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar); + const char *r = msg.input_innards(fmt, ap, defstr, FL_NORMAL_INPUT, maxchar, true); va_end(ap); - return Fl_String(r); + return (r == NULL) ? std::string("") : std::string(r); } +#endif // FLTK_USE_STD + /** Shows an input dialog displaying the \p fmt message with variable arguments. Like fl_input() except the input text is not shown, @@ -401,18 +433,44 @@ const char *fl_password(const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT); + const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, 0, false); va_end(ap); return r; } +/** Shows an input dialog displaying the \p fmt message with variable arguments. + + Like fl_input() except the input text is not shown, + '*' or similar replacement characters are displayed instead. + + \code #include \endcode + + \param[in] maxchar input lenght limit in chars, 0 = no limit + \param[in] fmt can be used as an sprintf-like format and variables for the message text + \param[in] defstr defines the default returned string if no text is entered + + \return the user string input if OK was pushed + \retval NULL if Cancel was pushed or the window was closed by the user +*/ +const char *fl_password(int maxchar, const char *fmt, const char *defstr, ...) { + Fl_Message msg("?"); + if (maxchar < 0) maxchar = 0; + va_list ap; + va_start(ap, defstr); + const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar, false); + va_end(ap); + return r; +} + +#if (FLTK_USE_STD) + /** Shows an input dialog displaying the \p fmt message with variable arguments. Like fl_input_str() except the input text is not shown, '*' or similar replacement characters are displayed instead. - Other than the deprecated fl_password() method w/o the \p maxchar argument, this - one returns the string in an Fl_String object that must be released after use. + Other than the fl_password() method w/o the \p maxchar argument, this one + returns the string in an std::string object that must be released after use. This can be a local/automatic variable. For an example see fl_input_str() @@ -429,31 +487,33 @@ const char *fl_password(const char *fmt, const char *defstr, ...) { \since 1.4.0 */ -Fl_String fl_password_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { +std::string fl_password_str(int &ret, int maxchar, const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); if (maxchar < 0) maxchar = 0; va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar); + const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar, true); va_end(ap); ret = (r == NULL) ? -1 : 0; - return Fl_String(r); + return (r == NULL) ? std::string("") : std::string(r); } /** Shows an input dialog displaying the \p fmt message with variable arguments. \note No information is given if the user canceled the dialog or clicked OK. \see fl_password_str(int &ret, int maxchar, const char *label, const char *deflt = 0, ...) */ -Fl_String fl_password_str(int maxchar, const char *fmt, const char *defstr, ...) { +std::string fl_password_str(int maxchar, const char *fmt, const char *defstr, ...) { Fl_Message msg("?"); if (maxchar < 0) maxchar = 0; va_list ap; va_start(ap, defstr); - const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar); + const char *r = msg.input_innards(fmt, ap, defstr, FL_SECRET_INPUT, maxchar, true); va_end(ap); - return Fl_String(r); + return (r == NULL) ? std::string("") : std::string(r); } +#endif // FLTK_USE_STD + /** Sets the preferred position for the message box used in many common dialogs like fl_message(), fl_alert(), diff --git a/src/makedepend b/src/makedepend index 0f973b847..bbb4fe04d 100644 --- a/src/makedepend +++ b/src/makedepend @@ -205,7 +205,6 @@ drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/Fl_Repeat_Button.H drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/Fl_Return_Button.H drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/Fl_Round_Button.H drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/Fl_Spinner.H -drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/Fl_String.H drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/fl_string_functions.h drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/fl_types.h drivers/Posix/Fl_Posix_Printer_Driver.o: ../FL/fl_utf8.h @@ -276,7 +275,6 @@ drivers/PostScript/Fl_PostScript.o: ../FL/Fl_PostScript.H drivers/PostScript/Fl_PostScript.o: ../FL/Fl_Preferences.H drivers/PostScript/Fl_PostScript.o: ../FL/Fl_Return_Button.H drivers/PostScript/Fl_PostScript.o: ../FL/Fl_Shared_Image.H -drivers/PostScript/Fl_PostScript.o: ../FL/Fl_String.H drivers/PostScript/Fl_PostScript.o: ../FL/fl_string_functions.h drivers/PostScript/Fl_PostScript.o: ../FL/Fl_Tile.H drivers/PostScript/Fl_PostScript.o: ../FL/fl_types.h @@ -531,7 +529,6 @@ drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_RGB_Image.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Scrollbar.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Shared_Image.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Slider.H -drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_String.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Text_Buffer.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Text_Display.H drivers/X11/Fl_X11_Screen_Driver.o: ../FL/Fl_Text_Editor.H @@ -580,7 +577,6 @@ drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_RGB_Image.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Scrollbar.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Shared_Image.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Slider.H -drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_String.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Text_Buffer.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Text_Display.H drivers/X11/Fl_X11_Window_Driver.o: ../FL/Fl_Text_Editor.H @@ -901,7 +897,6 @@ filename_absolute.o: ../FL/fl_casts.H filename_absolute.o: ../FL/fl_config.h filename_absolute.o: ../FL/Fl_Export.H filename_absolute.o: ../FL/Fl_Preferences.H -filename_absolute.o: ../FL/Fl_String.H filename_absolute.o: ../FL/fl_string_functions.h filename_absolute.o: ../FL/fl_types.h filename_absolute.o: ../FL/fl_utf8.h @@ -1147,7 +1142,6 @@ fl_ask.o: ../FL/Fl_Rect.H fl_ask.o: ../FL/Fl_RGB_Image.H fl_ask.o: ../FL/Fl_Scrollbar.H fl_ask.o: ../FL/Fl_Slider.H -fl_ask.o: ../FL/Fl_String.H fl_ask.o: ../FL/Fl_Text_Buffer.H fl_ask.o: ../FL/Fl_Text_Display.H fl_ask.o: ../FL/Fl_Text_Editor.H @@ -1815,7 +1809,6 @@ Fl_File_Chooser.o: ../FL/Fl_Menu_Button.H Fl_File_Chooser.o: ../FL/Fl_Menu_Item.H Fl_File_Chooser.o: ../FL/Fl_Preferences.H Fl_File_Chooser.o: ../FL/Fl_Return_Button.H -Fl_File_Chooser.o: ../FL/Fl_String.H Fl_File_Chooser.o: ../FL/Fl_Tile.H Fl_File_Chooser.o: ../FL/fl_types.h Fl_File_Chooser.o: ../FL/fl_utf8.h @@ -1854,7 +1847,6 @@ Fl_File_Chooser2.o: ../FL/Fl_Menu_Item.H Fl_File_Chooser2.o: ../FL/Fl_Preferences.H Fl_File_Chooser2.o: ../FL/Fl_Return_Button.H Fl_File_Chooser2.o: ../FL/Fl_Shared_Image.H -Fl_File_Chooser2.o: ../FL/Fl_String.H Fl_File_Chooser2.o: ../FL/fl_string_functions.h Fl_File_Chooser2.o: ../FL/Fl_Tile.H Fl_File_Chooser2.o: ../FL/fl_types.h @@ -1896,7 +1888,6 @@ fl_file_dir.o: ../FL/Fl_Menu_Button.H fl_file_dir.o: ../FL/Fl_Menu_Item.H fl_file_dir.o: ../FL/Fl_Preferences.H fl_file_dir.o: ../FL/Fl_Return_Button.H -fl_file_dir.o: ../FL/Fl_String.H fl_file_dir.o: ../FL/Fl_Tile.H fl_file_dir.o: ../FL/fl_types.h fl_file_dir.o: ../FL/fl_utf8.h @@ -2305,7 +2296,6 @@ Fl_Help_Dialog.o: ../FL/Fl_RGB_Image.H Fl_Help_Dialog.o: ../FL/Fl_Scrollbar.H Fl_Help_Dialog.o: ../FL/Fl_Shared_Image.H Fl_Help_Dialog.o: ../FL/Fl_Slider.H -Fl_Help_Dialog.o: ../FL/Fl_String.H Fl_Help_Dialog.o: ../FL/fl_types.h Fl_Help_Dialog.o: ../FL/fl_utf8.h Fl_Help_Dialog.o: ../FL/Fl_Valuator.H @@ -2329,7 +2319,6 @@ Fl_Help_View.o: ../FL/Fl_Graphics_Driver.H Fl_Help_View.o: ../FL/Fl_Group.H Fl_Help_View.o: ../FL/Fl_Help_View.H Fl_Help_View.o: ../FL/Fl_Image.H -Fl_Help_View.o: ../FL/Fl_Int_Vector.H Fl_Help_View.o: ../FL/Fl_Pixmap.H Fl_Help_View.o: ../FL/Fl_Plugin.H Fl_Help_View.o: ../FL/Fl_Preferences.H @@ -2338,7 +2327,6 @@ Fl_Help_View.o: ../FL/Fl_RGB_Image.H Fl_Help_View.o: ../FL/Fl_Scrollbar.H Fl_Help_View.o: ../FL/Fl_Shared_Image.H Fl_Help_View.o: ../FL/Fl_Slider.H -Fl_Help_View.o: ../FL/Fl_String.H Fl_Help_View.o: ../FL/fl_string_functions.h Fl_Help_View.o: ../FL/fl_types.h Fl_Help_View.o: ../FL/fl_utf8.h @@ -2347,6 +2335,8 @@ Fl_Help_View.o: ../FL/Fl_Widget.H Fl_Help_View.o: ../FL/Fl_Window.H Fl_Help_View.o: ../FL/platform_types.h Fl_Help_View.o: flstring.h +Fl_Help_View.o: Fl_Int_Vector.H +Fl_Help_View.o: Fl_String.H Fl_ICO_Image.o: ../config.h Fl_ICO_Image.o: ../FL/Enumerations.H Fl_ICO_Image.o: ../FL/Fl.H @@ -2460,7 +2450,6 @@ Fl_Input.o: ../FL/Fl_RGB_Image.H Fl_Input.o: ../FL/Fl_Scrollbar.H Fl_Input.o: ../FL/Fl_Secret_Input.H Fl_Input.o: ../FL/Fl_Slider.H -Fl_Input.o: ../FL/Fl_String.H Fl_Input.o: ../FL/Fl_Text_Buffer.H Fl_Input.o: ../FL/Fl_Text_Display.H Fl_Input.o: ../FL/Fl_Text_Editor.H @@ -2498,7 +2487,6 @@ Fl_Input_.o: ../FL/Fl_Rect.H Fl_Input_.o: ../FL/Fl_RGB_Image.H Fl_Input_.o: ../FL/Fl_Scrollbar.H Fl_Input_.o: ../FL/Fl_Slider.H -Fl_Input_.o: ../FL/Fl_String.H Fl_Input_.o: ../FL/Fl_Text_Buffer.H Fl_Input_.o: ../FL/Fl_Text_Display.H Fl_Input_.o: ../FL/Fl_Text_Editor.H @@ -2531,7 +2519,7 @@ Fl_Input_Choice.o: ../FL/fl_utf8.h Fl_Input_Choice.o: ../FL/Fl_Widget.H Fl_Input_Choice.o: ../FL/platform_types.h Fl_Int_Vector.o: ../FL/Fl_Export.H -Fl_Int_Vector.o: ../FL/Fl_Int_Vector.H +Fl_Int_Vector.o: Fl_Int_Vector.H Fl_JPEG_Image.o: ../config.h Fl_JPEG_Image.o: ../FL/Enumerations.H Fl_JPEG_Image.o: ../FL/Fl.H @@ -2745,7 +2733,6 @@ Fl_Message.o: ../FL/Fl_Input.H Fl_Message.o: ../FL/Fl_Input_.H Fl_Message.o: ../FL/Fl_Return_Button.H Fl_Message.o: ../FL/Fl_Secret_Input.H -Fl_Message.o: ../FL/Fl_String.H Fl_Message.o: ../FL/fl_string_functions.h Fl_Message.o: ../FL/fl_types.h Fl_Message.o: ../FL/fl_utf8.h @@ -2798,7 +2785,6 @@ Fl_Native_File_Chooser.o: ../FL/Fl_Menu_Item.H Fl_Native_File_Chooser.o: ../FL/Fl_Native_File_Chooser.H Fl_Native_File_Chooser.o: ../FL/Fl_Preferences.H Fl_Native_File_Chooser.o: ../FL/Fl_Return_Button.H -Fl_Native_File_Chooser.o: ../FL/Fl_String.H Fl_Native_File_Chooser.o: ../FL/Fl_Tile.H Fl_Native_File_Chooser.o: ../FL/fl_types.h Fl_Native_File_Chooser.o: ../FL/fl_utf8.h @@ -2835,7 +2821,6 @@ Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_Menu_Item.H Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_Native_File_Chooser.H Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_Preferences.H Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_Return_Button.H -Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_String.H Fl_Native_File_Chooser_FLTK.o: ../FL/Fl_Tile.H Fl_Native_File_Chooser_FLTK.o: ../FL/fl_types.h Fl_Native_File_Chooser_FLTK.o: ../FL/fl_utf8.h @@ -2886,7 +2871,6 @@ Fl_Native_File_Chooser_GTK.o: ../FL/Fl_RGB_Image.H Fl_Native_File_Chooser_GTK.o: ../FL/Fl_Scrollbar.H Fl_Native_File_Chooser_GTK.o: ../FL/Fl_Shared_Image.H Fl_Native_File_Chooser_GTK.o: ../FL/Fl_Slider.H -Fl_Native_File_Chooser_GTK.o: ../FL/Fl_String.H Fl_Native_File_Chooser_GTK.o: ../FL/fl_string_functions.h Fl_Native_File_Chooser_GTK.o: ../FL/Fl_Text_Buffer.H Fl_Native_File_Chooser_GTK.o: ../FL/Fl_Text_Display.H @@ -2950,7 +2934,6 @@ Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Return_Button.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_RGB_Image.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Scrollbar.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Slider.H -Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_String.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Text_Buffer.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Text_Display.H Fl_Native_File_Chooser_Kdialog.o: ../FL/Fl_Text_Editor.H @@ -2996,7 +2979,6 @@ Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_Menu_Item.H Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_Native_File_Chooser.H Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_Preferences.H Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_Return_Button.H -Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_String.H Fl_Native_File_Chooser_Zenity.o: ../FL/Fl_Tile.H Fl_Native_File_Chooser_Zenity.o: ../FL/fl_types.h Fl_Native_File_Chooser_Zenity.o: ../FL/fl_utf8.h @@ -3244,7 +3226,6 @@ Fl_Preferences.o: ../FL/fl_config.h Fl_Preferences.o: ../FL/Fl_Export.H Fl_Preferences.o: ../FL/Fl_Plugin.H Fl_Preferences.o: ../FL/Fl_Preferences.H -Fl_Preferences.o: ../FL/Fl_String.H Fl_Preferences.o: ../FL/fl_string_functions.h Fl_Preferences.o: ../FL/fl_types.h Fl_Preferences.o: ../FL/fl_utf8.h @@ -3734,7 +3715,7 @@ Fl_Spinner.o: ../FL/Fl_Repeat_Button.H Fl_Spinner.o: ../FL/Fl_Spinner.H Fl_Spinner.o: ../FL/Fl_Widget.H Fl_String.o: ../FL/Fl_Export.H -Fl_String.o: ../FL/Fl_String.H +Fl_String.o: Fl_String.H fl_string_functions.o: ../FL/Enumerations.H fl_string_functions.o: ../FL/filename.H fl_string_functions.o: ../FL/Fl.H @@ -3849,7 +3830,6 @@ Fl_Table.o: ../FL/fl_config.h Fl_Table.o: ../FL/fl_draw.H Fl_Table.o: ../FL/Fl_Export.H Fl_Table.o: ../FL/Fl_Group.H -Fl_Table.o: ../FL/Fl_Int_Vector.H Fl_Table.o: ../FL/Fl_Scroll.H Fl_Table.o: ../FL/Fl_Scrollbar.H Fl_Table.o: ../FL/Fl_Slider.H @@ -3859,6 +3839,7 @@ Fl_Table.o: ../FL/fl_utf8.h Fl_Table.o: ../FL/Fl_Valuator.H Fl_Table.o: ../FL/Fl_Widget.H Fl_Table.o: ../FL/platform_types.h +Fl_Table.o: Fl_Int_Vector.H Fl_Table_Row.o: ../FL/Enumerations.H Fl_Table_Row.o: ../FL/Fl.H Fl_Table_Row.o: ../FL/fl_attr.h @@ -3868,7 +3849,6 @@ Fl_Table_Row.o: ../FL/fl_config.h Fl_Table_Row.o: ../FL/fl_draw.H Fl_Table_Row.o: ../FL/Fl_Export.H Fl_Table_Row.o: ../FL/Fl_Group.H -Fl_Table_Row.o: ../FL/Fl_Int_Vector.H Fl_Table_Row.o: ../FL/Fl_Scroll.H Fl_Table_Row.o: ../FL/Fl_Scrollbar.H Fl_Table_Row.o: ../FL/Fl_Slider.H @@ -3907,7 +3887,6 @@ Fl_Text_Buffer.o: ../FL/Fl_Cairo.H Fl_Text_Buffer.o: ../FL/fl_casts.H Fl_Text_Buffer.o: ../FL/fl_config.h Fl_Text_Buffer.o: ../FL/Fl_Export.H -Fl_Text_Buffer.o: ../FL/Fl_String.H Fl_Text_Buffer.o: ../FL/fl_string_functions.h Fl_Text_Buffer.o: ../FL/Fl_Text_Buffer.H Fl_Text_Buffer.o: ../FL/fl_types.h @@ -3971,7 +3950,6 @@ Fl_Text_Editor.o: ../FL/Fl_Rect.H Fl_Text_Editor.o: ../FL/Fl_RGB_Image.H Fl_Text_Editor.o: ../FL/Fl_Scrollbar.H Fl_Text_Editor.o: ../FL/Fl_Slider.H -Fl_Text_Editor.o: ../FL/Fl_String.H Fl_Text_Editor.o: ../FL/Fl_Text_Buffer.H Fl_Text_Editor.o: ../FL/Fl_Text_Display.H Fl_Text_Editor.o: ../FL/Fl_Text_Editor.H @@ -4490,7 +4468,6 @@ Fl_x.o: ../FL/Fl_RGB_Image.H Fl_x.o: ../FL/Fl_Scrollbar.H Fl_x.o: ../FL/Fl_Shared_Image.H Fl_x.o: ../FL/Fl_Slider.H -Fl_x.o: ../FL/Fl_String.H Fl_x.o: ../FL/Fl_Text_Buffer.H Fl_x.o: ../FL/Fl_Text_Display.H Fl_x.o: ../FL/Fl_Text_Editor.H @@ -4595,7 +4572,6 @@ forms_bitmap.o: ../FL/Fl_RGB_Image.H forms_bitmap.o: ../FL/Fl_Round_Button.H forms_bitmap.o: ../FL/fl_show_colormap.H forms_bitmap.o: ../FL/Fl_Slider.H -forms_bitmap.o: ../FL/Fl_String.H forms_bitmap.o: ../FL/Fl_Tile.H forms_bitmap.o: ../FL/Fl_Timer.H forms_bitmap.o: ../FL/fl_types.h @@ -4655,7 +4631,6 @@ forms_compatibility.o: ../FL/Fl_RGB_Image.H forms_compatibility.o: ../FL/Fl_Round_Button.H forms_compatibility.o: ../FL/fl_show_colormap.H forms_compatibility.o: ../FL/Fl_Slider.H -forms_compatibility.o: ../FL/Fl_String.H forms_compatibility.o: ../FL/Fl_Tile.H forms_compatibility.o: ../FL/Fl_Timer.H forms_compatibility.o: ../FL/fl_types.h @@ -4727,7 +4702,6 @@ forms_fselect.o: ../FL/Fl_RGB_Image.H forms_fselect.o: ../FL/Fl_Round_Button.H forms_fselect.o: ../FL/fl_show_colormap.H forms_fselect.o: ../FL/Fl_Slider.H -forms_fselect.o: ../FL/Fl_String.H forms_fselect.o: ../FL/Fl_Tile.H forms_fselect.o: ../FL/Fl_Timer.H forms_fselect.o: ../FL/fl_types.h @@ -4787,7 +4761,6 @@ forms_pixmap.o: ../FL/Fl_RGB_Image.H forms_pixmap.o: ../FL/Fl_Round_Button.H forms_pixmap.o: ../FL/fl_show_colormap.H forms_pixmap.o: ../FL/Fl_Slider.H -forms_pixmap.o: ../FL/Fl_String.H forms_pixmap.o: ../FL/Fl_Tile.H forms_pixmap.o: ../FL/Fl_Timer.H forms_pixmap.o: ../FL/fl_types.h @@ -4846,7 +4819,6 @@ forms_timer.o: ../FL/Fl_RGB_Image.H forms_timer.o: ../FL/Fl_Round_Button.H forms_timer.o: ../FL/fl_show_colormap.H forms_timer.o: ../FL/Fl_Slider.H -forms_timer.o: ../FL/Fl_String.H forms_timer.o: ../FL/Fl_Tile.H forms_timer.o: ../FL/Fl_Timer.H forms_timer.o: ../FL/fl_types.h diff --git a/test/ask.cxx b/test/ask.cxx index 973a42d11..9ff06b45a 100644 --- a/test/ask.cxx +++ b/test/ask.cxx @@ -35,7 +35,8 @@ void rename_button(Fl_Widget *o, void *v) { int what = fl_int(v); int ret = 0; - Fl_String input; +#if (FLTK_USE_STD) + std::string input; if (what == 0) { fl_message_icon_label("§"); input = fl_input_str(ret, 0, "Input (no size limit, use ctrl/j for newline):", o->label()); @@ -47,6 +48,22 @@ void rename_button(Fl_Widget *o, void *v) { o->copy_label(input.c_str()); o->redraw(); } +#else + const char *input; + if (what == 0) { + fl_message_icon_label("§"); + input = fl_input("Input (no size limit, use ctrl/j for newline):", o->label()); + if (!input) ret = 1; + } else { + fl_message_icon_label("€"); + input = fl_password(20, "Enter password (max. 20 characters):", o->label()); + if (!input) ret = 1; + } + if (ret == 0) { + o->copy_label(input); + o->redraw(); + } +#endif // FLTK_USE_STD } void window_callback(Fl_Widget *win, void *) { diff --git a/test/makedepend b/test/makedepend index dfd430bf3..24ad1c171 100644 --- a/test/makedepend +++ b/test/makedepend @@ -91,7 +91,6 @@ ask.o: ../FL/Fl_Image.H ask.o: ../FL/Fl_Input.H ask.o: ../FL/Fl_Input_.H ask.o: ../FL/Fl_Return_Button.H -ask.o: ../FL/Fl_String.H ask.o: ../FL/fl_types.h ask.o: ../FL/fl_utf8.h ask.o: ../FL/Fl_Widget.H @@ -225,7 +224,6 @@ browser.o: ../FL/Fl_Scrollbar.H browser.o: ../FL/Fl_Select_Browser.H browser.o: ../FL/Fl_Simple_Terminal.H browser.o: ../FL/Fl_Slider.H -browser.o: ../FL/Fl_String.H browser.o: ../FL/Fl_Text_Buffer.H browser.o: ../FL/Fl_Text_Display.H browser.o: ../FL/fl_types.h @@ -246,7 +244,6 @@ button.o: ../FL/fl_config.h button.o: ../FL/Fl_Export.H button.o: ../FL/Fl_Group.H button.o: ../FL/Fl_Image.H -button.o: ../FL/Fl_String.H button.o: ../FL/fl_types.h button.o: ../FL/fl_utf8.h button.o: ../FL/Fl_Widget.H @@ -331,7 +328,6 @@ checkers.o: ../FL/Fl_Preferences.H checkers.o: ../FL/Fl_Rect.H checkers.o: ../FL/Fl_RGB_Image.H checkers.o: ../FL/Fl_Slider.H -checkers.o: ../FL/Fl_String.H checkers.o: ../FL/fl_types.h checkers.o: ../FL/fl_utf8.h checkers.o: ../FL/Fl_Valuator.H @@ -383,7 +379,6 @@ clipboard.o: ../FL/Fl_RGB_Image.H clipboard.o: ../FL/Fl_Scrollbar.H clipboard.o: ../FL/Fl_Shared_Image.H clipboard.o: ../FL/Fl_Slider.H -clipboard.o: ../FL/Fl_String.H clipboard.o: ../FL/Fl_Tabs.H clipboard.o: ../FL/Fl_Text_Buffer.H clipboard.o: ../FL/Fl_Text_Display.H @@ -432,7 +427,6 @@ colbrowser.o: ../FL/Fl_Hold_Browser.H colbrowser.o: ../FL/Fl_Image.H colbrowser.o: ../FL/Fl_Scrollbar.H colbrowser.o: ../FL/Fl_Slider.H -colbrowser.o: ../FL/Fl_String.H colbrowser.o: ../FL/fl_types.h colbrowser.o: ../FL/fl_utf8.h colbrowser.o: ../FL/Fl_Valuator.H @@ -553,7 +547,6 @@ cube.o: ../FL/Fl_Printer.H cube.o: ../FL/Fl_Radio_Light_Button.H cube.o: ../FL/Fl_Rect.H cube.o: ../FL/Fl_Slider.H -cube.o: ../FL/Fl_String.H cube.o: ../FL/Fl_Sys_Menu_Bar.H cube.o: ../FL/fl_types.h cube.o: ../FL/fl_utf8.h @@ -702,7 +695,6 @@ demo.o: ../FL/Fl_Scheme_Choice.H demo.o: ../FL/Fl_Scrollbar.H demo.o: ../FL/Fl_Simple_Terminal.H demo.o: ../FL/Fl_Slider.H -demo.o: ../FL/Fl_String.H demo.o: ../FL/Fl_Text_Buffer.H demo.o: ../FL/Fl_Text_Display.H demo.o: ../FL/fl_types.h @@ -763,7 +755,6 @@ device.o: ../FL/Fl_Round_Button.H device.o: ../FL/Fl_Scrollbar.H device.o: ../FL/Fl_Shared_Image.H device.o: ../FL/Fl_Slider.H -device.o: ../FL/Fl_String.H device.o: ../FL/Fl_SVG_File_Surface.H device.o: ../FL/Fl_Tile.H device.o: ../FL/fl_types.h @@ -847,7 +838,6 @@ editor.o: ../FL/Fl_Return_Button.H editor.o: ../FL/Fl_RGB_Image.H editor.o: ../FL/Fl_Scrollbar.H editor.o: ../FL/Fl_Slider.H -editor.o: ../FL/Fl_String.H editor.o: ../FL/Fl_Text_Buffer.H editor.o: ../FL/Fl_Text_Display.H editor.o: ../FL/Fl_Text_Editor.H @@ -923,7 +913,6 @@ file_chooser.o: ../FL/Fl_Scrollbar.H file_chooser.o: ../FL/Fl_Shared_Image.H file_chooser.o: ../FL/Fl_Simple_Terminal.H file_chooser.o: ../FL/Fl_Slider.H -file_chooser.o: ../FL/Fl_String.H file_chooser.o: ../FL/Fl_Text_Buffer.H file_chooser.o: ../FL/Fl_Text_Display.H file_chooser.o: ../FL/Fl_Tile.H @@ -987,7 +976,6 @@ fltk-versions.o: ../FL/fl_config.h fltk-versions.o: ../FL/Fl_Export.H fltk-versions.o: ../FL/Fl_Group.H fltk-versions.o: ../FL/Fl_Image.H -fltk-versions.o: ../FL/Fl_String.H fltk-versions.o: ../FL/fl_types.h fltk-versions.o: ../FL/fl_utf8.h fltk-versions.o: ../FL/Fl_Widget.H @@ -1034,7 +1022,6 @@ fonts.o: ../FL/Fl_Return_Button.H fonts.o: ../FL/Fl_RGB_Image.H fonts.o: ../FL/Fl_Scrollbar.H fonts.o: ../FL/Fl_Slider.H -fonts.o: ../FL/Fl_String.H fonts.o: ../FL/Fl_Tile.H fonts.o: ../FL/fl_types.h fonts.o: ../FL/fl_utf8.h @@ -1092,7 +1079,6 @@ forms.o: ../FL/Fl_Round_Button.H forms.o: ../FL/Fl_Scrollbar.H forms.o: ../FL/fl_show_colormap.H forms.o: ../FL/Fl_Slider.H -forms.o: ../FL/Fl_String.H forms.o: ../FL/Fl_Tile.H forms.o: ../FL/Fl_Timer.H forms.o: ../FL/fl_types.h @@ -1173,7 +1159,6 @@ fullscreen.o: ../FL/Fl_Menu_Item.H fullscreen.o: ../FL/Fl_Scrollbar.H fullscreen.o: ../FL/Fl_Single_Window.H fullscreen.o: ../FL/Fl_Slider.H -fullscreen.o: ../FL/Fl_String.H fullscreen.o: ../FL/Fl_Toggle_Light_Button.H fullscreen.o: ../FL/fl_types.h fullscreen.o: ../FL/fl_utf8.h @@ -1643,7 +1628,6 @@ menubar.o: ../FL/Fl_Scheme_Choice.H menubar.o: ../FL/Fl_Scrollbar.H menubar.o: ../FL/Fl_Simple_Terminal.H menubar.o: ../FL/Fl_Slider.H -menubar.o: ../FL/Fl_String.H menubar.o: ../FL/fl_string_functions.h menubar.o: ../FL/Fl_Sys_Menu_Bar.H menubar.o: ../FL/Fl_Text_Buffer.H @@ -1667,7 +1651,6 @@ message.o: ../FL/fl_config.h message.o: ../FL/Fl_Export.H message.o: ../FL/Fl_Group.H message.o: ../FL/Fl_Image.H -message.o: ../FL/Fl_String.H message.o: ../FL/fl_types.h message.o: ../FL/fl_utf8.h message.o: ../FL/Fl_Widget.H @@ -1738,7 +1721,6 @@ native-filechooser.o: ../FL/Fl_RGB_Image.H native-filechooser.o: ../FL/Fl_Scrollbar.H native-filechooser.o: ../FL/Fl_Simple_Terminal.H native-filechooser.o: ../FL/Fl_Slider.H -native-filechooser.o: ../FL/Fl_String.H native-filechooser.o: ../FL/Fl_Text_Buffer.H native-filechooser.o: ../FL/Fl_Text_Display.H native-filechooser.o: ../FL/Fl_Tile.H @@ -1946,7 +1928,6 @@ pixmap_browser.o: ../FL/Fl_Return_Button.H pixmap_browser.o: ../FL/Fl_Scrollbar.H pixmap_browser.o: ../FL/Fl_Shared_Image.H pixmap_browser.o: ../FL/Fl_Slider.H -pixmap_browser.o: ../FL/Fl_String.H pixmap_browser.o: ../FL/Fl_SVG_File_Surface.H pixmap_browser.o: ../FL/Fl_Tile.H pixmap_browser.o: ../FL/fl_types.h @@ -1982,7 +1963,6 @@ preferences.o: ../FL/Fl_Menu_Item.H preferences.o: ../FL/Fl_Preferences.H preferences.o: ../FL/Fl_Round_Button.H preferences.o: ../FL/Fl_Slider.H -preferences.o: ../FL/Fl_String.H preferences.o: ../FL/fl_types.h preferences.o: ../FL/fl_utf8.h preferences.o: ../FL/Fl_Valuator.H @@ -2242,7 +2222,6 @@ resizebox.o: ../FL/Fl_Preferences.H resizebox.o: ../FL/Fl_Radio_Button.H resizebox.o: ../FL/Fl_Rect.H resizebox.o: ../FL/Fl_RGB_Image.H -resizebox.o: ../FL/Fl_String.H resizebox.o: ../FL/fl_types.h resizebox.o: ../FL/fl_utf8.h resizebox.o: ../FL/Fl_Widget.H @@ -2398,7 +2377,6 @@ sudoku.o: ../FL/Fl_RGB_Image.H sudoku.o: ../FL/Fl_Scrollbar.H sudoku.o: ../FL/Fl_Shared_Image.H sudoku.o: ../FL/Fl_Slider.H -sudoku.o: ../FL/Fl_String.H sudoku.o: ../FL/Fl_Sys_Menu_Bar.H sudoku.o: ../FL/fl_types.h sudoku.o: ../FL/fl_utf8.h @@ -2458,7 +2436,6 @@ table.o: ../FL/Fl_Group.H table.o: ../FL/Fl_Image.H table.o: ../FL/Fl_Input.H table.o: ../FL/Fl_Input_.H -table.o: ../FL/Fl_Int_Vector.H table.o: ../FL/Fl_Light_Button.H table.o: ../FL/Fl_Menu_.H table.o: ../FL/Fl_Menu_Item.H @@ -2471,7 +2448,6 @@ table.o: ../FL/Fl_Scroll.H table.o: ../FL/Fl_Scrollbar.H table.o: ../FL/Fl_Simple_Terminal.H table.o: ../FL/Fl_Slider.H -table.o: ../FL/Fl_String.H table.o: ../FL/Fl_Table.H table.o: ../FL/Fl_Table_Row.H table.o: ../FL/Fl_Text_Buffer.H @@ -2503,7 +2479,6 @@ tabs.o: ../FL/Fl_Input_.H tabs.o: ../FL/Fl_Menu_.H tabs.o: ../FL/Fl_Menu_Item.H tabs.o: ../FL/Fl_Return_Button.H -tabs.o: ../FL/Fl_String.H tabs.o: ../FL/Fl_Tabs.H tabs.o: ../FL/fl_types.h tabs.o: ../FL/fl_utf8.h @@ -2529,7 +2504,6 @@ threads.o: ../FL/Fl_Group.H threads.o: ../FL/Fl_Image.H threads.o: ../FL/Fl_Scrollbar.H threads.o: ../FL/Fl_Slider.H -threads.o: ../FL/Fl_String.H threads.o: ../FL/fl_types.h threads.o: ../FL/fl_utf8.h threads.o: ../FL/Fl_Valuator.H @@ -2623,7 +2597,6 @@ tree.o: ../FL/Fl_RGB_Image.H tree.o: ../FL/Fl_Scrollbar.H tree.o: ../FL/Fl_Simple_Terminal.H tree.o: ../FL/Fl_Slider.H -tree.o: ../FL/Fl_String.H tree.o: ../FL/Fl_Text_Buffer.H tree.o: ../FL/Fl_Text_Display.H tree.o: ../FL/Fl_Tile.H @@ -2689,7 +2662,6 @@ unittests.o: ../FL/Fl_RGB_Image.H unittests.o: ../FL/Fl_Scrollbar.H unittests.o: ../FL/Fl_Simple_Terminal.H unittests.o: ../FL/Fl_Slider.H -unittests.o: ../FL/Fl_String.H unittests.o: ../FL/fl_string_functions.h unittests.o: ../FL/Fl_Text_Buffer.H unittests.o: ../FL/Fl_Text_Display.H @@ -2818,7 +2790,6 @@ unittest_core.o: ../FL/Fl_RGB_Image.H unittest_core.o: ../FL/Fl_Scrollbar.H unittest_core.o: ../FL/Fl_Simple_Terminal.H unittest_core.o: ../FL/Fl_Slider.H -unittest_core.o: ../FL/Fl_String.H unittest_core.o: ../FL/Fl_Text_Buffer.H unittest_core.o: ../FL/Fl_Text_Display.H unittest_core.o: ../FL/fl_types.h @@ -2827,6 +2798,7 @@ unittest_core.o: ../FL/Fl_Valuator.H unittest_core.o: ../FL/Fl_Widget.H unittest_core.o: ../FL/Fl_Window.H unittest_core.o: ../FL/platform_types.h +unittest_core.o: ../src/Fl_String.H unittest_core.o: unittests.h unittest_fast_shapes.o: ../config.h unittest_fast_shapes.o: ../FL/Enumerations.H @@ -2985,7 +2957,6 @@ unittest_scrollbarsize.o: ../FL/Fl_Export.H unittest_scrollbarsize.o: ../FL/Fl_Graphics_Driver.H unittest_scrollbarsize.o: ../FL/Fl_Group.H unittest_scrollbarsize.o: ../FL/Fl_Image.H -unittest_scrollbarsize.o: ../FL/Fl_Int_Vector.H unittest_scrollbarsize.o: ../FL/Fl_Pixmap.H unittest_scrollbarsize.o: ../FL/Fl_Plugin.H unittest_scrollbarsize.o: ../FL/Fl_Preferences.H diff --git a/test/unittest_core.cxx b/test/unittest_core.cxx index e1e8e6e85..2d109680f 100644 --- a/test/unittest_core.cxx +++ b/test/unittest_core.cxx @@ -19,7 +19,7 @@ #include #include #include -#include +#include "../src/Fl_String.H" #include #include #include @@ -177,6 +177,8 @@ TEST(Fl_String, Operations) { return true; } +#if (0) // FIXME - Fl_String + /* Test all Fl_String functions that are no part of the class. */ TEST(Fl_String, Non-Member Functions) { Fl_String a = "a", b = "b", empty = "", result; @@ -356,6 +358,8 @@ TEST(Fl_Callback_Macros, FL_INLINE_CALLBACK) { return true; } +#endif // FIXME - Fl_String + // //------- test aspects of the FLTK core library ---------- //