Commited latest SciTech changes into CVS. This includes updates to the

applet code (with changes copyright headers) as well as updates to the
wxImage and dib.cpp modules to use virtual file systems so that we can
load these objects from ZIP files correctly. The dib.cpp module was
also extensively cleaned up (although the DIB writing code does not
presently use file streams as we couldn't figure out if it was possible
to write to a ZIP file stream). The code has been tested and functions
correctly for both regular files and ZIP files.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10551 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kendall Bennett
2001-06-12 18:52:03 +00:00
parent dba2120c77
commit 716cd4107b
24 changed files with 2093 additions and 778 deletions

View File

@@ -28,6 +28,7 @@
#include "wx/log.h"
#include "wx/app.h"
#include "wx/filefn.h"
#include "wx/filesys.h"
#include "wx/wfstream.h"
#include "wx/intl.h"
#include "wx/module.h"
@@ -762,18 +763,19 @@ bool wxImage::HasOption(const wxString& name) const
bool wxImage::LoadFile( const wxString& filename, long type )
{
#if wxUSE_STREAMS
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
wxBufferedInputStream bstream( stream );
return LoadFile(bstream, type);
}
else
{
wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
// We want to use wxFileSystem for virtual FS compatibility
wxFileSystem fsys;
wxFSFile *file = fsys.OpenFile(filename);
if (!file) {
wxLogError(_("Can't open file '%s'"), filename);
return FALSE;
}
}
wxInputStream *stream = file->GetStream();
if (!stream) {
wxLogError(_("Can't open stream for file '%s'"), filename);
return FALSE;
}
return LoadFile(*stream, type);
#else // !wxUSE_STREAMS
return FALSE;
#endif // wxUSE_STREAMS
@@ -782,18 +784,19 @@ bool wxImage::LoadFile( const wxString& filename, long type )
bool wxImage::LoadFile( const wxString& filename, const wxString& mimetype )
{
#if wxUSE_STREAMS
if (wxFileExists(filename))
{
wxFileInputStream stream(filename);
wxBufferedInputStream bstream( stream );
return LoadFile(bstream, mimetype);
}
else
{
wxLogError( _("Can't load image from file '%s': file does not exist."), filename.c_str() );
// We want to use wxFileSystem for virtual FS compatibility
wxFileSystem fsys;
wxFSFile *file = fsys.OpenFile(filename);
if (!file) {
wxLogError(_("Can't open file '%s'"), filename);
return FALSE;
}
}
wxInputStream *stream = file->GetStream();
if (!stream) {
wxLogError(_("Can't open stream for file '%s'"), filename);
return FALSE;
}
return LoadFile(*stream, mimetype);
#else // !wxUSE_STREAMS
return FALSE;
#endif // wxUSE_STREAMS