From b5306348048f705280427c74ca3fae03862a1938 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Sun, 14 Apr 2002 12:51:56 +0000 Subject: [PATCH] Add Cygwin drive code. Fix typos. Update dependencies. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 2 ++ src/Fl_File_Browser.cxx | 60 ++++++++++++++++++++++++++++------------- src/Fl_arg.cxx | 7 ++--- src/makedepend | 4 +-- 4 files changed, 50 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index 361beb7d4..076f40744 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,7 @@ CHANGES IN FLTK 1.1.0 + - Fl_File_Browser::load() didn't properly show drives + when compiled in Cygwin mode. - Now pass correctly pass keyboard and mouse events to widget under tooltip as needed... - Added new Fl::dnd_text_ops() methods to enable/disable diff --git a/src/Fl_File_Browser.cxx b/src/Fl_File_Browser.cxx index 5b1bcd270..8d17bb345 100644 --- a/src/Fl_File_Browser.cxx +++ b/src/Fl_File_Browser.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_File_Browser.cxx,v 1.1.2.8 2002/03/29 14:16:03 easysw Exp $" +// "$Id: Fl_File_Browser.cxx,v 1.1.2.9 2002/04/14 12:51:55 easysw Exp $" // // Fl_File_Browser routines. // @@ -44,15 +44,17 @@ #include #include "flstring.h" -#if defined(WIN32) && ! defined(__CYGWIN__) +#ifdef __CYGWIN__ +# include +#elif defined(WIN32) # include # include -#endif /* WIN32 */ +#endif /* __CYGWIN__ */ #if defined(__EMX__) -#define INCL_DOS -#define INCL_DOSMISC -#include +# define INCL_DOS +# define INCL_DOSMISC +# include #endif /* __EMX__ */ @@ -409,9 +411,26 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load if ((icon = Fl_File_Icon::find("any", Fl_File_Icon::DEVICE)) == NULL) icon = Fl_File_Icon::find("any", Fl_File_Icon::DIRECTORY); -#if defined(WIN32) && ! defined (__CYGWIN__) - DWORD drives; // Drive available bits +#ifdef WIN32 +# ifdef __CYGWIN__ + // + // Cygwin provides an implementation of setmntent() to get the list + // of available drives... + // + FILE *m = setmntent("/-not-used-", "r"); + struct mntent *p; + while ((p = getmntent (m)) != NULL) { + add(p->mnt_dir, icon); + num_files ++; + } + + endmntent(m); +# else + // + // Normal WIN32 code uses drive bits... + // + DWORD drives; // Drive available bits drives = GetLogicalDrives(); for (i = 'A'; i <= 'Z'; i ++, drives >>= 1) @@ -426,7 +445,11 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load num_files ++; } +# endif // __CYGWIN__ #elif defined(__EMX__) + // + // OS/2 code uses drive bits... + // ULONG curdrive; // Current drive ULONG drives; // Drive available bits int start = 3; // 'C' (MRS - dunno if this is correct!) @@ -443,22 +466,23 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load num_files ++; } #else + // + // UNIX code uses /etc/fstab or similar... + // FILE *mtab; // /etc/mtab or /etc/mnttab file char line[1024]; // Input line - // // Open the file that contains a list of mounted filesystems... // -# if defined(hpux) || defined(__sun) + mtab = fopen("/etc/mnttab", "r"); // Fairly standard -# elif defined(__sgi) || defined(linux) - mtab = fopen("/etc/mtab", "r"); // More standard -# else - mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list if (mtab == NULL) - mtab = fopen("/etc/vfstab", "r"); -# endif + mtab = fopen("/etc/mtab", "r"); // More standard + if (mtab == NULL) + mtab = fopen("/etc/fstab", "r"); // Otherwise fallback to full list + if (mtab == NULL) + mtab = fopen("/etc/vfstab", "r"); // Alternate full list file if (mtab != NULL) { @@ -489,7 +513,7 @@ Fl_File_Browser::load(const char *directory)// I - Directory to load // Build the file list... // -#if (defined(WIN32) && ! defined(__CYGWIN__)) || defined(__EMX__) +#if (defined(WIN32) && !defined(__CYGWIN__)) || defined(__EMX__) strncpy(filename, directory_, sizeof(filename) - 1); filename[sizeof(filename) - 1] = '\0'; i = strlen(filename) - 1; @@ -559,5 +583,5 @@ Fl_File_Browser::filter(const char *pattern) // I - Pattern string // -// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.8 2002/03/29 14:16:03 easysw Exp $". +// End of "$Id: Fl_File_Browser.cxx,v 1.1.2.9 2002/04/14 12:51:55 easysw Exp $". // diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx index 5f576ea41..85bbb4375 100644 --- a/src/Fl_arg.cxx +++ b/src/Fl_arg.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_arg.cxx,v 1.5.2.8.2.10 2002/04/14 02:43:48 easysw Exp $" +// "$Id: Fl_arg.cxx,v 1.5.2.8.2.11 2002/04/14 12:51:56 easysw Exp $" // // Optional argument initialization code for the Fast Light Tool Kit (FLTK). // @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -263,7 +264,7 @@ static const char * const helpmsg = " -nok[bd]\n" " -not[ooltips]\n" " -s[cheme] scheme\n" -" -ti[tle] windowtitle\n"; +" -ti[tle] windowtitle\n" " -to[oltips]"; const char * const Fl::help = helpmsg+13; @@ -411,5 +412,5 @@ int XParseGeometry(const char* string, int* x, int* y, #endif // ifdef WIN32 // -// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.10 2002/04/14 02:43:48 easysw Exp $". +// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.11 2002/04/14 12:51:56 easysw Exp $". // diff --git a/src/makedepend b/src/makedepend index e2ee50cd1..d6ad3dbd8 100644 --- a/src/makedepend +++ b/src/makedepend @@ -268,8 +268,8 @@ Fl_abort.o: ../config.h Fl_add_idle.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_arg.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/x.H Fl_arg.o: ../FL/Fl_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H -Fl_arg.o: ../FL/Fl_Widget.H ../FL/filename.H ../FL/fl_draw.H flstring.h -Fl_arg.o: ../config.h +Fl_arg.o: ../FL/Fl_Widget.H ../FL/Fl_Tooltip.H ../FL/Fl_Widget.H +Fl_arg.o: ../FL/filename.H ../FL/fl_draw.H flstring.h ../config.h Fl_compose.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H Fl_display.o: ../FL/Fl.H ../FL/Enumerations.H ../FL/Fl_Export.H flstring.h Fl_display.o: ../config.h