From 66e23ad2081689dad6e829b9667cdbc93ac45154 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 8 May 2001 22:44:34 +0000 Subject: [PATCH] switched to new XPM code in wxMSW git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10082 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/image.cpp | 5 ++++- src/common/resourc2.cpp | 8 -------- src/common/resource.cpp | 9 --------- src/generic/dirctrlg.cpp | 15 --------------- src/gtk/files.lst | 3 +-- src/gtk1/files.lst | 3 +-- src/motif/files.lst | 3 +-- src/msw/bitmap.cpp | 17 ++++++++++++++++- src/msw/gdiimage.cpp | 12 ------------ src/msw/makefile.b32 | 4 +--- src/msw/makefile.bcc | 4 +--- src/msw/makefile.dos | 10 ++-------- src/msw/makefile.g95 | 2 +- src/msw/makefile.sc | 5 ++--- src/msw/makefile.vc | 7 +++++-- src/msw/makefile.wat | 5 +---- src/os2/files.lst | 3 +-- 17 files changed, 37 insertions(+), 78 deletions(-) diff --git a/src/common/image.cpp b/src/common/image.cpp index ece331c695..fbf84266bb 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -1023,7 +1023,10 @@ wxImageHandler *wxImage::FindHandlerMime( const wxString& mimetype ) void wxImage::InitStandardHandlers() { - AddHandler( new wxBMPHandler ); + AddHandler(new wxBMPHandler); +#if !defined(__WXGTK__) && !defined(__WXMOTIF__) + AddHandler(new wxXPMHandler); +#endif } void wxImage::CleanUpHandlers() diff --git a/src/common/resourc2.cpp b/src/common/resourc2.cpp index 7774e5a7c5..2321126dde 100644 --- a/src/common/resourc2.cpp +++ b/src/common/resourc2.cpp @@ -817,7 +817,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table } case wxBITMAP_TYPE_XPM_DATA: { -#if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -826,9 +825,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table return wxNullBitmap; } return wxBitmap(item->GetValue1()); -#else - wxLogWarning(_("No XPM facility available!")); -#endif break; } default: @@ -974,7 +970,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) { // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** /* -#if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -984,9 +979,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) return NULL; } return wxIcon((char **)item->GetValue1()); -#else - wxLogWarning(_("No XPM facility available!")); -#endif */ wxLogWarning(_("No XPM icon facility available!")); break; diff --git a/src/common/resource.cpp b/src/common/resource.cpp index bef7bdb0e4..08709571b9 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -2468,7 +2468,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table } case wxBITMAP_TYPE_XPM_DATA: { -#if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -2476,10 +2475,6 @@ wxBitmap wxResourceCreateBitmap(const wxString& resource, wxResourceTable *table return wxNullBitmap; } return wxBitmap((char **)item->GetValue1()); -#else - wxLogWarning(_("No XPM facility available!")); - break; -#endif } default: { @@ -2625,7 +2620,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) { // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** /* - #if (defined(__WXGTK__)) || (defined(__WXMSW__) && wxUSE_XPM_IN_MSW) wxItemResource *item = table->FindResource(name); if (!item) { @@ -2635,9 +2629,6 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table) return NULL; } return wxIcon((char **)item->GetValue1()); - #else - wxLogWarning(_("No XPM facility available!")); - #endif */ wxLogWarning(_("No XPM icon facility available!")); break; diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index 6ee0ef2ab4..a37f39da70 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -76,7 +76,6 @@ #undef GetFirstChild #endif -#if !defined(__WXMSW__) || wxUSE_XPM_IN_MSW || wxUSE_XPM_IN_OS2 /* Closed folder */ static char * icon1_xpm[] = { /* width height ncolors chars_per_pixel */ @@ -298,7 +297,6 @@ static char * icon8_xpm[] = { " ", " ", " "}; -#endif // !wxMSW static const int ID_DIRCTRL = 1000; static const int ID_TEXTCTRL = 1001; @@ -450,7 +448,6 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, m_filterListCtrl->FillFilterList(filter, defaultFilter); m_imageList = new wxImageList(16, 16, TRUE); -#if !defined(__WXMSW__) || wxUSE_XPM_IN_MSW m_imageList->Add(wxIcon(icon1_xpm)); m_imageList->Add(wxIcon(icon2_xpm)); m_imageList->Add(wxIcon(icon3_xpm)); @@ -459,18 +456,6 @@ bool wxGenericDirCtrl::Create(wxWindow *parent, m_imageList->Add(wxIcon(icon6_xpm)); m_imageList->Add(wxIcon(icon7_xpm)); m_imageList->Add(wxIcon(icon8_xpm)); -#elif defined(__WXMSW__) - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_CLOSED_FOLDER"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_OPEN_FOLDER"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_FILE"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_COMPUTER"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_DRIVE"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_CDROM"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_FLOPPY"), wxBITMAP_TYPE_ICO_RESOURCE)); - m_imageList->Add(wxIcon(wxT("wxICON_SMALL_REMOVEABLE"), wxBITMAP_TYPE_ICO_RESOURCE)); -#else -#error "Sorry, we don't have icons available for this platforms." -#endif m_treeCtrl->SetImageList(m_imageList); m_showHidden = FALSE; diff --git a/src/gtk/files.lst b/src/gtk/files.lst index 2a16902e96..7146561693 100644 --- a/src/gtk/files.lst +++ b/src/gtk/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 16:57, 2001/05/01 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -449,7 +449,6 @@ ALL_HEADERS = \ wxhtml.h \ wxprec.h \ xpmdecod.h \ - xpmhand.h \ zipstrm.h \ zstream.h \ gtk/accel.h \ diff --git a/src/gtk1/files.lst b/src/gtk1/files.lst index 2a16902e96..7146561693 100644 --- a/src/gtk1/files.lst +++ b/src/gtk1/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 16:57, 2001/05/01 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -449,7 +449,6 @@ ALL_HEADERS = \ wxhtml.h \ wxprec.h \ xpmdecod.h \ - xpmhand.h \ zipstrm.h \ zstream.h \ gtk/accel.h \ diff --git a/src/motif/files.lst b/src/motif/files.lst index 9f9975476c..7d281c481c 100644 --- a/src/motif/files.lst +++ b/src/motif/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 01:27, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -445,7 +445,6 @@ ALL_HEADERS = \ wxhtml.h \ wxprec.h \ xpmdecod.h \ - xpmhand.h \ zipstrm.h \ zstream.h \ motif/accel.h \ diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index 959590f879..79b21b8e87 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -45,6 +45,7 @@ #include "wx/msw/dib.h" #include "wx/image.h" +#include "wx/xpmdecod.h" // missing from mingw32 header #ifndef CLR_INVALID @@ -283,9 +284,23 @@ wxBitmap::wxBitmap(const char bits[], int width, int height, int depth) // Create from XPM data bool wxBitmap::CreateFromXpm(const char **data) { +#if wxUSE_IMAGE && wxUSE_XPM Init(); - return Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); + wxCHECK_MSG( data != NULL, FALSE, wxT("invalid bitmap data") ) + + wxXPMDecoder decoder; + wxImage img = decoder.ReadData(data); + wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") ) + + *this = wxBitmap(img); + + if ( wxTheBitmapList ) wxTheBitmapList->AddBitmap(this); + + return TRUE; +#else + return FALSE; +#endif } wxBitmap::wxBitmap(int w, int h, int d) diff --git a/src/msw/gdiimage.cpp b/src/msw/gdiimage.cpp index dfc7900a1d..215ddda18d 100644 --- a/src/msw/gdiimage.cpp +++ b/src/msw/gdiimage.cpp @@ -42,10 +42,6 @@ #include "wx/msw/gdiimage.h" #include "wx/bitmap.h" -#if 0 // wxUSE_XPM_IN_MSW -# include "wx/xpmhand.h" -#endif // wxUSE_XPM_IN_MSW - #ifdef __WIN16__ # include "wx/msw/curico.h" #endif // __WIN16__ @@ -301,14 +297,6 @@ void wxGDIImage::InitStandardHandlers() { AddHandler(new wxBMPResourceHandler); AddHandler(new wxBMPFileHandler); - - // GRG: Add these handlers by default if XPM support is enabled - -#if 0 // wxUSE_XPM_IN_MSW - AddHandler(new wxXPMFileHandler); - AddHandler(new wxXPMDataHandler); -#endif // wxUSE_XPM_IN_MSW - AddHandler(new wxICOResourceHandler); AddHandler(new wxICOFileHandler); } diff --git a/src/msw/makefile.b32 b/src/msw/makefile.b32 index 953d25cc25..d913caf455 100644 --- a/src/msw/makefile.b32 +++ b/src/msw/makefile.b32 @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T! # @@ -601,8 +601,6 @@ $(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF) $(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF) -$(MSWDIR)\xpmhand.obj: $(MSWDIR)\xpmhand.$(SRCSUFF) - ######################################################## diff --git a/src/msw/makefile.bcc b/src/msw/makefile.bcc index 56894f3cb1..16338ef938 100644 --- a/src/msw/makefile.bcc +++ b/src/msw/makefile.bcc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T! # @@ -477,8 +477,6 @@ $(MSWDIR)\wave.obj: $(MSWDIR)\wave.$(SRCSUFF) $(MSWDIR)\window.obj: $(MSWDIR)\window.$(SRCSUFF) -$(MSWDIR)\xpmhand.obj: $(MSWDIR)\xpmhand.$(SRCSUFF) - ######################################################## diff --git a/src/msw/makefile.dos b/src/msw/makefile.dos index 9ec73748f3..27aafb2fa4 100644 --- a/src/msw/makefile.dos +++ b/src/msw/makefile.dos @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T! # @@ -268,8 +268,7 @@ MSWOBJS2 = $(MSWDIR)\palette.obj \ $(MSWDIR)\utils.obj \ $(MSWDIR)\utilsexc.obj \ $(MSWDIR)\wave.obj \ - $(MSWDIR)\window.obj \ - $(MSWDIR)\xpmhand.obj + $(MSWDIR)\window.obj # TODO: Implement XPM and PNG targets in this makefile! # $(OLEDIR)\xpmhand \ @@ -756,11 +755,6 @@ $(MSWDIR)/window.obj: $*.$(SRCSUFF) $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) << -$(MSWDIR)/xpmhand.obj: $*.$(SRCSUFF) - cl @<< -$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) -<< - $(COMMDIR)/appcmn.obj: $*.$(SRCSUFF) cl @<< $(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF) diff --git a/src/msw/makefile.g95 b/src/msw/makefile.g95 index 8f555bfa32..9d6c966d90 100644 --- a/src/msw/makefile.g95 +++ b/src/msw/makefile.g95 @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T! # diff --git a/src/msw/makefile.sc b/src/msw/makefile.sc index f4b3544cb6..2d4e6ed482 100644 --- a/src/msw/makefile.sc +++ b/src/msw/makefile.sc @@ -1,6 +1,6 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T! # Symantec C++ makefile for the msw objects @@ -264,8 +264,7 @@ MSWOBJS = $(MSWDIR)\accel.obj \ $(MSWDIR)\utilsexc.obj \ $(MSWDIR)\ole\uuid.obj \ $(MSWDIR)\wave.obj \ - $(MSWDIR)\window.obj \ - $(MSWDIR)\xpmhand.obj + $(MSWDIR)\window.obj XPMOBJECTS = $(XPMDIR)\crbuffri.obj\ $(XPMDIR)\crdatfri.obj\ diff --git a/src/msw/makefile.vc b/src/msw/makefile.vc index 437f5623ab..f940d3b6aa 100644 --- a/src/msw/makefile.vc +++ b/src/msw/makefile.vc @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T! # File: makefile.vc @@ -464,7 +464,11 @@ $(WXDIR)\lib\$(WXLIBNAME).dll: $(DUMMYOBJ) $(OBJECTS) $(link) @<< $(LINKFLAGS) -out:$(WXDIR)\lib\$(WXLIBNAME).dll +<<<<<<< vc.t + $(DUMMYOBJ) $(OBJECTS) $(guilibsdll) shell32.lib comctl32.lib ctl3d32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib odbc32.lib advapi32.lib winmm.lib $(GL_LIBS) $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib +======= $(DUMMYOBJ) $(OBJECTS) $(guilibsdll) shell32.lib comctl32.lib ctl3d32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib odbc32.lib advapi32.lib winmm.lib $(GL_LIBS) $(WXDIR)\lib\png$(LIBEXT).lib $(WXDIR)\lib\zlib$(LIBEXT).lib $(WXDIR)\lib\jpeg$(LIBEXT).lib $(WXDIR)\lib\tiff$(LIBEXT).lib +>>>>>>> 1.32 delayimp.lib /delayload:ws2_32.dll /delayload:advapi32.dll /delayload:user32.dll /delayload:gdi32.dll /delayload:comdlg32.dll /delayload:shell32.dll /delayload:comctl32.dll /delayload:ole32.dll @@ -653,7 +657,6 @@ clean: $(PERIPH_CLEAN_TARGET) -rmdir ..\common\$(D) -rmdir ..\html\$(D) - # Making documents docs: allhlp allhtml allpdfrtf allhtb allhtmlhelp alldocs: docs diff --git a/src/msw/makefile.wat b/src/msw/makefile.wat index 5ebfeff50f..43e5b5ce18 100644 --- a/src/msw/makefile.wat +++ b/src/msw/makefile.wat @@ -1,6 +1,6 @@ #!/binb/wmake.exe -# This file was automatically generated by tmake at 01:26, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T! # @@ -647,9 +647,6 @@ wave.obj: $(MSWDIR)\wave.cpp window.obj: $(MSWDIR)\window.cpp *$(CCC) $(CPPFLAGS) $(IFLAGS) $< -#xpmhand.obj: $(MSWDIR)\xpmhand.cpp -# *$(CCC) $(CPPFLAGS) $(IFLAGS) $< - ######################################################## diff --git a/src/os2/files.lst b/src/os2/files.lst index 74bae32d7b..9b25470e13 100644 --- a/src/os2/files.lst +++ b/src/os2/files.lst @@ -1,4 +1,4 @@ -# This file was automatically generated by tmake at 01:27, 2001/04/29 +# This file was automatically generated by tmake at 00:44, 2001/05/09 # DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE OS2.T! ALL_SOURCES = \ generic/busyinfo.cpp \ @@ -455,7 +455,6 @@ ALL_HEADERS = \ wxhtml.h \ wxprec.h \ xpmdecod.h \ - xpmhand.h \ zipstrm.h \ zstream.h \ os2/accel.h \ -- 2.45.2