X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad91e1ade045fd9bc8ca7159aebf828d719e81ca..0bbe61b8c18a1795189f0cf73cc61c14a0fb846d:/src/common/imagtiff.cpp diff --git a/src/common/imagtiff.cpp b/src/common/imagtiff.cpp index c956f6e2d1..3a5e63fb5e 100644 --- a/src/common/imagtiff.cpp +++ b/src/common/imagtiff.cpp @@ -7,6 +7,14 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,6 +36,9 @@ extern "C" { +#ifdef __DMC__ + #include "tif_config.h" +#endif #include "tiff.h" #include "tiffio.h" } @@ -42,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 @@ -165,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* @@ -223,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)