Skip to content

Commit

Permalink
Add Cygwin drive code.
Browse files Browse the repository at this point in the history
Fix typos.

Update dependencies.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Apr 14, 2002
1 parent 8e3cdc0 commit b530634
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
2 changes: 2 additions & 0 deletions 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
Expand Down
60 changes: 42 additions & 18 deletions 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.
//
Expand Down Expand Up @@ -44,15 +44,17 @@
#include <stdlib.h>
#include "flstring.h"

#if defined(WIN32) && ! defined(__CYGWIN__)
#ifdef __CYGWIN__
# include <mntent.h>
#elif defined(WIN32)
# include <windows.h>
# include <direct.h>
#endif /* WIN32 */
#endif /* __CYGWIN__ */

#if defined(__EMX__)
#define INCL_DOS
#define INCL_DOSMISC
#include <os2.h>
# define INCL_DOS
# define INCL_DOSMISC
# include <os2.h>
#endif /* __EMX__ */


Expand Down Expand Up @@ -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)
Expand All @@ -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!)
Expand All @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 $".
//
7 changes: 4 additions & 3 deletions 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).
//
Expand Down Expand Up @@ -29,6 +29,7 @@
#include <FL/Fl.H>
#include <FL/x.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Tooltip.H>
#include <FL/filename.H>
#include <FL/fl_draw.H>
#include <ctype.h>
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 $".
//
4 changes: 2 additions & 2 deletions src/makedepend
Expand Up @@ -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
Expand Down

0 comments on commit b530634

Please sign in to comment.