Browse Source

Bug fixes from Sebastien.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2309 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
pull/168/head
Michael R Sweet 23 years ago
parent
commit
91aa5847ba
  1. 9
      CHANGES
  2. 20
      src/Fl_BMP_Image.cxx
  3. 6
      src/Fl_File_Chooser2.cxx
  4. 15
      src/Fl_File_Icon.cxx
  5. 8
      src/fl_file_dir.cxx
  6. 8
      test/pixmap_browser.cxx

9
CHANGES

@ -1,5 +1,14 @@
CHANGES IN FLTK 1.1.0 CHANGES IN FLTK 1.1.0
- The pixmap_browser demo didn't check for a NULL image
pointer.
- Fl_File_Icon::find() now uses fl_filename_isdir()
under WIN32 to check for directories.
- Fl_File_Chooser's preview code called refcount()
on the deleted image's object.
- Fixed another problem with the Fl_BMP_Image loader.
- The fl_file_chooser() callback was being called with a
NULL filename.
- Documented that fl_push_clip() is preferred over - Documented that fl_push_clip() is preferred over
fl_clip(), with a corresponding source change. fl_clip(), with a corresponding source change.
- Minor changes to the MacOS X event handling code. - Minor changes to the MacOS X event handling code.

20
src/Fl_BMP_Image.cxx

@ -1,5 +1,5 @@
// //
// "$Id: Fl_BMP_Image.cxx,v 1.1.2.5 2002/06/10 17:21:49 easysw Exp $" // "$Id: Fl_BMP_Image.cxx,v 1.1.2.6 2002/06/13 18:18:33 easysw Exp $"
// //
// Fl_BMP_Image routines. // Fl_BMP_Image routines.
// //
@ -94,19 +94,23 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
// Then the bitmap information... // Then the bitmap information...
info_size = read_dword(fp); info_size = read_dword(fp);
w(read_long(fp));
h(read_long(fp));
read_word(fp);
depth = read_word(fp);
if (info_size < 40) { if (info_size < 40) {
// Old Windows/OS2 BMP header... // Old Windows/OS2 BMP header...
w(read_word(fp));
h(read_word(fp));
read_word(fp);
depth = read_word(fp);
compression = BI_RGB; compression = BI_RGB;
colors_used = 0; colors_used = 0;
count = info_size - 12; count = info_size - 8;
} else { } else {
// New BMP header... // New BMP header...
w(read_long(fp));
h(read_long(fp));
read_word(fp);
depth = read_word(fp);
compression = read_dword(fp); compression = read_dword(fp);
read_dword(fp); read_dword(fp);
read_long(fp); read_long(fp);
@ -129,7 +133,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
for (count = 0; count < colors_used; count ++) { for (count = 0; count < colors_used; count ++) {
// Read BGR color... // Read BGR color...
fread(colormap, colors_used, 3, fp); fread(colormap[count], colors_used, 3, fp);
// Skip pad byte for new BMP files... // Skip pad byte for new BMP files...
if (info_size > 12) getc(fp); if (info_size > 12) getc(fp);
@ -371,5 +375,5 @@ read_long(FILE *fp) { // I - File to read from
// //
// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.5 2002/06/10 17:21:49 easysw Exp $". // End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.6 2002/06/13 18:18:33 easysw Exp $".
// //

6
src/Fl_File_Chooser2.cxx

@ -1,5 +1,5 @@
// //
// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.15 2002/06/07 15:06:32 easysw Exp $" // "$Id: Fl_File_Chooser2.cxx,v 1.1.2.16 2002/06/13 18:18:33 easysw Exp $"
// //
// More Fl_File_Chooser routines. // More Fl_File_Chooser routines.
// //
@ -864,7 +864,7 @@ Fl_File_Chooser::update_preview()
oldimage = (Fl_Shared_Image *)previewBox->image(); oldimage = (Fl_Shared_Image *)previewBox->image();
if (oldimage) while (oldimage->refcount()) oldimage->release(); if (oldimage) oldimage->release();
previewBox->image(0); previewBox->image(0);
@ -1103,5 +1103,5 @@ unquote_pathname(char *dst, // O - Destination string
// //
// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.15 2002/06/07 15:06:32 easysw Exp $". // End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.16 2002/06/13 18:18:33 easysw Exp $".
// //

15
src/Fl_File_Icon.cxx

@ -1,5 +1,5 @@
// //
// "$Id: Fl_File_Icon.cxx,v 1.1.2.12 2002/05/25 13:38:24 easysw Exp $" // "$Id: Fl_File_Icon.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $"
// //
// Fl_File_Icon routines. // Fl_File_Icon routines.
// //
@ -190,6 +190,13 @@ Fl_File_Icon::find(const char *filename,// I - Name of file */
// Get file information if needed... // Get file information if needed...
if (filetype == ANY) if (filetype == ANY)
{
#ifdef WIN32
if (fl_filename_isdir(filename))
filetype = DIRECTORY;
else
filetype = PLAIN;
#else
if (!stat(filename, &fileinfo)) if (!stat(filename, &fileinfo))
{ {
if (S_ISDIR(fileinfo.st_mode)) if (S_ISDIR(fileinfo.st_mode))
@ -209,6 +216,10 @@ Fl_File_Icon::find(const char *filename,// I - Name of file */
else else
filetype = PLAIN; filetype = PLAIN;
} }
else
filetype = PLAIN;
#endif // WIN32
}
// Look at the base name in the filename // Look at the base name in the filename
name = fl_filename_name(filename); name = fl_filename_name(filename);
@ -464,5 +475,5 @@ Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
// //
// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.12 2002/05/25 13:38:24 easysw Exp $". // End of "$Id: Fl_File_Icon.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $".
// //

8
src/fl_file_dir.cxx

@ -1,5 +1,5 @@
// //
// "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $" // "$Id: fl_file_dir.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $"
// //
// File chooser widget for the Fast Light Tool Kit (FLTK). // File chooser widget for the Fast Light Tool Kit (FLTK).
// //
@ -33,8 +33,8 @@ static void (*current_callback)(const char*) = 0;
static void callback(Fl_File_Chooser *, void*) { static void callback(Fl_File_Chooser *, void*) {
if (current_callback) if (current_callback && fc->value())
(*current_callback)(fc->value(0)); (*current_callback)(fc->value());
} }
@ -142,5 +142,5 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
// //
// End of "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $". // End of "$Id: fl_file_dir.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $".
// //

8
test/pixmap_browser.cxx

@ -1,5 +1,5 @@
// //
// "$Id: pixmap_browser.cxx,v 1.5.2.4.2.5 2002/01/06 17:51:12 easysw Exp $" // "$Id: pixmap_browser.cxx,v 1.5.2.4.2.6 2002/06/13 18:18:33 easysw Exp $"
// //
// A shared image test program for the Fast Light Tool Kit (FLTK). // A shared image test program for the Fast Light Tool Kit (FLTK).
// //
@ -44,6 +44,10 @@ void load_file(const char *n) {
if (img) img->release(); if (img) img->release();
img = Fl_Shared_Image::get(n); img = Fl_Shared_Image::get(n);
if (!img) {
fl_alert("Image file format not recognized!");
return;
}
if (img->w() > b->w() || img->h() > b->h()) { if (img->w() > b->w() || img->h() > b->h()) {
Fl_Image *temp; Fl_Image *temp;
if (img->w() > img->h()) temp = img->copy(b->w(), b->h() * img->h() / img->w()); if (img->w() > img->h()) temp = img->copy(b->w(), b->h() * img->h() / img->w());
@ -94,5 +98,5 @@ int main(int argc, char **argv) {
} }
// //
// End of "$Id: pixmap_browser.cxx,v 1.5.2.4.2.5 2002/01/06 17:51:12 easysw Exp $". // End of "$Id: pixmap_browser.cxx,v 1.5.2.4.2.6 2002/06/13 18:18:33 easysw Exp $".
// //

Loading…
Cancel
Save