Re: [fltk.bugs] [MOD] STR #2931: Re-implement fl_scandir for *nix systems that do not provide a native version
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current The patch is also OK with Mac OS X 10.8 Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2931: Re-implement fl_scandir for *nix systems that do not provide a native version
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current Added a patch file to replace the full source files in the uploaded tar file. The patch is against current svn (r 9827). Although bigger than the compressed tar file, I prefer the patch format. The patch contains a few small changes WRT the tar file: - copyright year adjusted (e.g. 1998-2010, 2013 - 1998-2013 - fixed one typo Still testing, but patch looks good AFAICT. I'll post my test results with Cygwin and other available systems later, but this can take some days due to restricted test time. :-( Link: http://www.fltk.org/str.php?L2931 Version: 1.3-currentIndex: FL/filename.H === --- FL/filename.H (revision 9827) +++ FL/filename.H (working copy) @@ -3,7 +3,7 @@ * * Filename header file for the Fast Light Tool Kit (FLTK). * - * Copyright 1998-2010 by Bill Spitzak and others. + * Copyright 1998-2013 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 @@ -107,13 +107,15 @@ # endif /* __cplusplus */ # if !defined(FL_DOXYGEN) -FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **); -FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **); -FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **); -FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **); +/* Parameters changed to 'const struct dirent**' */ +FL_EXPORT int fl_alphasort(const struct dirent **, const struct dirent **); +FL_EXPORT int fl_casealphasort(const struct dirent **, const struct dirent **); +FL_EXPORT int fl_casenumericsort(const struct dirent **, const struct dirent **); +FL_EXPORT int fl_numericsort(const struct dirent **, const struct dirent **); # endif - typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **); /** File sorting function. \see fl_filename_list() */ + /* Changed to match POSIX.1-2008 compliant sort function like 'alphasort()' */ + typedef int (Fl_File_Sort_F)(const struct dirent **, const struct dirent **); /** File sorting function. \see fl_filename_list() */ # if defined(__cplusplus) } Index: src/filename_list.cxx === --- src/filename_list.cxx (revision 9827) +++ src/filename_list.cxx (working copy) @@ -3,7 +3,7 @@ // // Filename list routines for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2013 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,17 +28,18 @@ extern C { #ifndef HAVE_SCANDIR - int fl_scandir (const char *dir, dirent ***namelist, - int (*select)(dirent *), - int (*compar)(dirent **, dirent **)); + /* POSIX.1-2008 compliant prototype for own implementation of 'scandir()' */ + int fl_scandir(const char *dir, struct dirent ***namelist, + int (*select)(const struct dirent *), + int (*compar)(const struct dirent **, const struct dirent **)); #endif } -int fl_alphasort(struct dirent **a, struct dirent **b) { +int fl_alphasort(const struct dirent **a, const struct dirent **b) { return strcmp((*a)-d_name, (*b)-d_name); } -int fl_casealphasort(struct dirent **a, struct dirent **b) { +int fl_casealphasort(const struct dirent **a, const struct dirent **b) { return strcasecmp((*a)-d_name, (*b)-d_name); } @@ -72,8 +73,7 @@ according to their ASCII ordering - uppercase before lowercase. \return the number of entries if no error, a negative value otherwise. */ -int fl_filename_list(const char *d, dirent ***list, - Fl_File_Sort_F *sort) { +int fl_filename_list(const char *d, dirent ***list, Fl_File_Sort_F *sort) { #if defined(WIN32) !defined(__CYGWIN__) !defined(HAVE_SCANDIR) // For Windows we have a special scandir implementation that uses // the Win32 wide functions for lookup, avoiding the code page mess @@ -94,32 +94,29 @@ fl_utf8to_mb(d, dirlen, dirloc, dirlen + 1); #endif + // We should not write 'dirent' here if we mean 'struct dirent' because the + // implicit 'struct' is only allowed with C++ and 'scandir()' is a C function #ifndef HAVE_SCANDIR - // This version is when we define our own scandir + // The system don't provide a usable implementation + // This is e.g. the case on SunOS 5.9 and older versions int n = fl_scandir(dirloc, list, 0, sort); -#elif defined(HAVE_SCANDIR_POSIX) !defined(__APPLE__) - // POSIX (2008) defines the comparison function like this: - int n = scandir(dirloc, list, 0, (int(*)(const dirent **, const dirent
Re: [fltk.bugs] [MOD] STR #2931: Re-implement fl_scandir for *nix systems that do not provide a native version
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current I applied Albrecht's patch to a fresh copy of fltk r9827, and FLTK built on IRIX 6.5 OK, so looks good to me. (IRIX has its own implementation of scandir(), and HAVE_SCANDIR was set to 1 in config.h) There were a bazillion remarks from the compiler while building FLTK (nothing new; it /always/ moans about unused variables and unreached code), but nothing related to the patch. And nothing stopped the compiler. Just to be sure I didn't miss anything in the voluminous remarks warnings, I tried rebuilding just filename_list.o and scandir.o by themselves, and there were no remarks or warnings at all. So you can add IRIX 6.5 to your list. Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
Re: [fltk.bugs] [MOD] STR #2931: Re-implement fl_scandir for *nix systems that do not provide a native version
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current ALbrecht queried whether there are any ABI issues: Micha reports that it looks like there are. In particular, the change of the prototypes of the sorting functions to be more const-correct breaks C++ linkage. Options are perhaps to revert the functions to their previous non-const forms? Greg suggests that we could keep the new forms if we put the ABI guards around them, with the old forms being the default... The new forms are preferred though because they are a better match to the Posix spec. In other, happier, news, Micha reports that the code runs fine on: -- POSIX.1-2008 compliant native 'scandir()': - HP-UX 11.11 (32Bit, big endian) Special AIX native 'scandir()': - AIX 5.1 (32Bit, big endian) -- And Manolo has verified that the special detection of MacOS =10.8 still works. Link: http://www.fltk.org/str.php?L2931 Version: 1.3-current ___ fltk-bugs mailing list fltk-bugs@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-bugs
[fltk.commit] [Library] r9827 - branches/branch-1.3/fluid
Author: ianmacarthur Date: 2013-02-20 02:27:47 -0800 (Wed, 20 Feb 2013) New Revision: 9827 Log: Typo: It turns out that when we stepped the version number up to 1.3.2, we didn't change the hard coded value in fluid's about_panel. Though: Why is this value hard-coded anyway? Should fluid not be picking that up from Enumerations.h at build time, or something? Modified: branches/branch-1.3/fluid/about_panel.cxx branches/branch-1.3/fluid/about_panel.fl branches/branch-1.3/fluid/about_panel.h Modified: branches/branch-1.3/fluid/about_panel.cxx === --- branches/branch-1.3/fluid/about_panel.cxx 2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.cxx 2013-02-20 10:27:47 UTC (rev 9827) @@ -16,7 +16,7 @@ // http://www.fltk.org/str.php // -// generated by Fast Light User Interface Designer (fluid) version 1.0300 +// generated by Fast Light User Interface Designer (fluid) version 1.0302 #include about_panel.h void show_help(const char *name); @@ -269,7 +269,7 @@ { Fl_Box* o = new Fl_Box(10, 10, 115, 120); o-image(image_fluid); } // Fl_Box* o -{ Fl_Box* o = new Fl_Box(135, 10, 200, 70, FLTK User\nInterface Designer\nVersion 1.3.1); +{ Fl_Box* o = new Fl_Box(135, 10, 200, 70, FLTK User\nInterface Designer\nVersion 1.3.2); o-color((Fl_Color)12); o-selection_color(FL_DARK1); o-labelfont(1); Modified: branches/branch-1.3/fluid/about_panel.fl === --- branches/branch-1.3/fluid/about_panel.fl2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.fl2013-02-20 10:27:47 UTC (rev 9827) @@ -1,5 +1,5 @@ # data file for the Fltk User Interface Designer (fluid) -version 1.0300 +version 1.0302 header_name {.h} code_name {.cxx} comment {// @@ -25,10 +25,11 @@ decl {void show_help(const char *name);} {public local } -Function {make_about_panel()} {} { +Function {make_about_panel()} {open +} { Fl_Window about_panel { label {About FLUID} open -xywh {419 216 345 180} type Double color 50 selection_color 47 hotspot non_modal visible +xywh {680 247 345 180} type Double color 50 selection_color 47 hotspot non_modal visible } { Fl_Box {} { image {icons/fluid-96.xpm} xywh {10 10 115 120} @@ -36,7 +37,7 @@ Fl_Box {} { label {FLTK User Interface Designer -Version 1.3.1} +Version 1.3.2} selected xywh {135 10 200 70} color 12 selection_color 47 labelfont 1 labelsize 18 align 21 } Fl_Box {} { Modified: branches/branch-1.3/fluid/about_panel.h === --- branches/branch-1.3/fluid/about_panel.h 2013-02-19 15:25:17 UTC (rev 9826) +++ branches/branch-1.3/fluid/about_panel.h 2013-02-20 10:27:47 UTC (rev 9827) @@ -16,7 +16,7 @@ // http://www.fltk.org/str.php // -// generated by Fast Light User Interface Designer (fluid) version 1.0300 +// generated by Fast Light User Interface Designer (fluid) version 1.0302 #ifndef about_panel_h #define about_panel_h ___ fltk-commit mailing list fltk-commit@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-commit
Re: [fltk.development] [RFE] STR #2904: Native file chooser isn't exactly native on linux
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2904 Version: 1.3-feature A thought: Should Fl_X11_File_Chooser maybe be called Fl_Fltk_File_Chooser or some such thing? In that, it is not really X11 specific, it is just a wrapper for the basic FLTK file chooser, so could be used on any host in principle (though in this case likely only under X11 I concede!) Link: http://www.fltk.org/str.php?L2904 Version: 1.3-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFC] a new class to support Internationalization
I am using small code (200 lines), modified from http://number-none.com/blow/code/mo_file/index.html which is gettext compatible so standard .mo files (or memory areas) can be used. The advantage is that these .mo files are hashed with fast lookup and you can use all gettext tools to extract strings and generate .po and .mo files, use translation editors (like poedit) etc. I would not put i18n as a part of the FLTK itself but fltk uses various strings for messages, stock-widget labels etc. Maybe we can add something like register i18n function which fltk would then be used for labels like OK, Cancel etc. Now you can mostly set these messages explicitly, but if not, fltk can use this registered function for implicit translations by setting/registering this function eg by Fl::i18n(const char * (*)(const char *)); The function would default at the beginning to const char * fl_default_i18n(const char * s){return s;} Note that Fl::i18n() can be overloaded to register different function schemes other than gettext's const char * foo(const char *); Fluid is allready i18n aware, although I am not very happy that static translation of menu labels was removed from fluid in fltk-1.3 (see my rant at STR #2861 and also fluid patch which fixes that, allowing both static and dynamic translation of menu labels) R. On 28/01/2013 21:52, Manolo Gouy wrote: I would like to get input from developers about whether a new class to support internationalization of FLTK apps could be useful. See:http://www.fltk.org/str.php?L2929 ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.general] OT: Making application run once
For portability, I use boost::interprocess::file_lock::try_lock() upon some existing common file. (if it fails, program is already running so you can either exit or send to the other process program arguments or so...) Some parts of boost libraries are nice, some are ugly and bloated as hell... Interprocess is OK(ish). R. On 16/02/2013 13:10, Gonzalo Garramuno wrote: I would like my application to have only one instance of it running at a time. However I am unsure how to implement this. If the user opens another instance the contents of what it opened should go to the already opened instance. As an example, I would put emacs. How would I go about coding this? Pipes? Sockets? None of the above. ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Missing scandir() (STR #2687) - now STR #2931
Greg Ercolano wrote: On 02/20/13 05:15, Michael Baeuerle wrote: Looks like all #ifdef cases are verified now except the ones for Digital and SGI Unix. Unfortunately I don't have access to such machines. I'll check SGI (IRIX 6.5) and follow up in the STR. Albrecht has mentioned the ABI and it looks like this is a problem for 'fl_filename_list()'. The sort functions are exported as C, but 'fl_filename_list()' is exported as C++. I have tried to statically link code that use the new 'filename.H' against an older library and this fails because the parameter types of the C++ function do not exactly match. For the C functions it works and there is not even a warning (as expected because I have restricted what the functions are allowed to do with the parameters). I'm not a C++ expert, is it possible to overload the function declaration without breaking other things? Micha ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
Re: [fltk.general] Missing scandir() (STR #2687) - now STR #2931
On 02/20/13 10:50, Michael Baeuerle wrote: I'm not a C++ expert, is it possible to overload the function declaration without breaking other things? Options I can think of: o Protect the newer declaration with the FLTK_ABI_VERSION macro o Name the conflicting function something else ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk
[fltk.general] change labelfont and labelize in fltk 1.3.2
Hi again, I am reading up on another post regarding this issue. I copied hello.cxx from the docs and compiled but the font comes up tiny- definitely not 36 - and does not change when other values are given as arguments. Nor do the fonts change. If you send me an email address I will send a screenshot with code and the FLTK window. One note is that the compiler g++ could not locate the Xext library so I removed it from the compile statement. Is the label font size and type dependent on the Xext lib? I can rebuild fltk but it was challenging to get the X11 libraries to link up so I would rather find Xext and get it in the right path if that is the problem. Thanks again for your help. Edgar ___ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk