define wxTIFFHandler ctor in the .cpp file even if wxUSE_STREAMS==0 as it's declared in the header in this case (this doesn't really make much sense as the class is unusable anyhow but the other handlers do it like this so let's do the same thing here for consistency and maybe fix all of them at once later)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2007-10-28 00:08:27 +00:00
parent 96a4cdebda
commit 426272a35e

View File

@ -7,6 +7,14 @@
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
@ -30,7 +38,7 @@ extern "C"
{
#ifdef __DMC__
#include "tif_config.h"
#endif
#endif
#include "tiff.h"
#include "tiffio.h"
}
@ -45,12 +53,67 @@ extern "C"
#endif
#endif
// ============================================================================
// implementation
// ============================================================================
// ----------------------------------------------------------------------------
// TIFF library error/warning handlers
// ----------------------------------------------------------------------------
extern "C"
{
static void
TIFFwxWarningHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{
if (module != NULL)
wxLogWarning(_("tiff module: %s"), wxString::FromAscii(module).c_str());
// FIXME: this is not terrible informative but better than crashing!
#if wxUSE_UNICODE
wxLogWarning(_("TIFF library warning."));
#else
wxVLogWarning(fmt, ap);
#endif
}
static void
TIFFwxErrorHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{
if (module != NULL)
wxLogError(_("tiff module: %s"), wxString::FromAscii(module).c_str());
// FIXME: as above
#if wxUSE_UNICODE
wxLogError(_("TIFF library error."));
#else
wxVLogError(fmt, ap);
#endif
}
} // extern "C"
//-----------------------------------------------------------------------------
// wxTIFFHandler
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTIFFHandler,wxImageHandler)
wxTIFFHandler::wxTIFFHandler()
{
m_name = wxT("TIFF file");
m_extension = wxT("tif");
m_type = wxBITMAP_TYPE_TIF;
m_mime = wxT("image/tiff");
TIFFSetWarningHandler((TIFFErrorHandler) TIFFwxWarningHandler);
TIFFSetErrorHandler((TIFFErrorHandler) TIFFwxErrorHandler);
}
#if wxUSE_STREAMS
// helper to translate our, possibly 64 bit, wxFileOffset to TIFF, always 32
@ -168,38 +231,6 @@ wxTIFFUnmapProc(thandle_t WXUNUSED(handle),
{
}
static void
TIFFwxWarningHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{
if (module != NULL)
wxLogWarning(_("tiff module: %s"), wxString::FromAscii(module).c_str());
// FIXME: this is not terrible informative but better than crashing!
#if wxUSE_UNICODE
wxLogWarning(_("TIFF library warning."));
#else
wxVLogWarning(fmt, ap);
#endif
}
static void
TIFFwxErrorHandler(const char* module,
const char* WXUNUSED_IN_UNICODE(fmt),
va_list WXUNUSED_IN_UNICODE(ap))
{
if (module != NULL)
wxLogError(_("tiff module: %s"), wxString::FromAscii(module).c_str());
// FIXME: as above
#if wxUSE_UNICODE
wxLogError(_("TIFF library error."));
#else
wxVLogError(fmt, ap);
#endif
}
} // extern "C"
TIFF*
@ -226,16 +257,6 @@ TIFFwxOpen(wxOutputStream &stream, const char* name, const char* mode)
return tif;
}
wxTIFFHandler::wxTIFFHandler()
{
m_name = wxT("TIFF file");
m_extension = wxT("tif");
m_type = wxBITMAP_TYPE_TIF;
m_mime = wxT("image/tiff");
TIFFSetWarningHandler((TIFFErrorHandler) TIFFwxWarningHandler);
TIFFSetErrorHandler((TIFFErrorHandler) TIFFwxErrorHandler);
}
bool wxTIFFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose, int index )
{
if (index == -1)