X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2fd284a4a09793c29078296529d3e9db5acd0a0f..3bcf00abd7aa6b515e776e18b3e295467a693959:/src/msw/bitmap.cpp diff --git a/src/msw/bitmap.cpp b/src/msw/bitmap.cpp index f51174c5b3..e6194fcef9 100644 --- a/src/msw/bitmap.cpp +++ b/src/msw/bitmap.cpp @@ -61,8 +61,8 @@ wxBitmapRefData::~wxBitmapRefData(void) { if (m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap was deleted without selecting out of wxMemoryDC %X.", (unsigned int) m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap was deleted without selecting out of wxMemoryDC %X."), (unsigned int) m_selectedInto); wxFatalError(buf); } if (m_hBitmap) @@ -91,15 +91,15 @@ wxBitmap::~wxBitmap(void) wxTheBitmapList->DeleteObject(this); } -bool wxBitmap::FreeResource(bool force) +bool wxBitmap::FreeResource(bool WXUNUSED(force)) { if ( !M_BITMAPDATA ) return FALSE; if (M_BITMAPDATA->m_selectedInto) { - char buf[200]; - sprintf(buf, "Bitmap %X was deleted without selecting out of wxMemoryDC %X.", (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); + wxChar buf[200]; + wxSprintf(buf, _T("Bitmap %X was deleted without selecting out of wxMemoryDC %X."), (unsigned int) this, (unsigned int) M_BITMAPDATA->m_selectedInto); wxFatalError(buf); } if (M_BITMAPDATA->m_hBitmap) @@ -142,7 +142,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits } // Create from XPM data -wxBitmap::wxBitmap(char **data, wxItem *WXUNUSED(anItem)) +wxBitmap::wxBitmap(char **data, wxControl *WXUNUSED(anItem)) { (void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0); } @@ -187,9 +187,9 @@ bool wxBitmap::Create(int w, int h, int d) } else { - HDC dc = GetDC(NULL); + HDC dc = GetDC((HWND) NULL); M_BITMAPDATA->m_hBitmap = (WXHBITMAP) CreateCompatibleBitmap(dc, w, h); - ReleaseDC(NULL, dc); + ReleaseDC((HWND) NULL, dc); M_BITMAPDATA->m_depth = wxDisplayDepth(); } if (M_BITMAPDATA->m_hBitmap) @@ -208,7 +208,7 @@ bool wxBitmap::LoadFile(const wxString& filename, long type) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -225,7 +225,7 @@ bool wxBitmap::Create(void *data, long type, int width, int height, int depth) wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -238,7 +238,7 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal wxBitmapHandler *handler = FindHandler(type); if ( handler == NULL ) { - wxLogWarning("no bitmap handler for type %d defined.", type); + wxLogWarning(_T("no bitmap handler for type %d defined."), type); return FALSE; } @@ -338,7 +338,7 @@ wxBitmapHandler *wxBitmap::FindHandler(const wxString& name) while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); - if ( handler->GetName() == name ) + if ( (handler->GetName().Cmp(name) == 0) ) return handler; node = node->Next(); } @@ -351,8 +351,8 @@ wxBitmapHandler *wxBitmap::FindHandler(const wxString& extension, long bitmapTyp while ( node ) { wxBitmapHandler *handler = (wxBitmapHandler *)node->Data(); - if ( handler->GetExtension() == extension && - (bitmapType == -1 || handler->GetType() == bitmapType) ) + if ( (handler->GetExtension().Cmp(extension) == 0) && + (bitmapType == -1 || (handler->GetType() == bitmapType)) ) return handler; node = node->Next(); } @@ -385,9 +385,9 @@ wxBitmap wxBitmap::GetBitmapForDC(wxDC& dc) const { wxMemoryDC memDC; wxBitmap tmpBitmap(this->GetWidth(), this->GetHeight(), dc.GetDepth()); - HPALETTE hPal = NULL; + HPALETTE hPal = (HPALETTE) NULL; LPBITMAPINFO lpDib; - void *lpBits = NULL; + void *lpBits = (void*) NULL; /* wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) ); @@ -577,18 +577,18 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour) IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject) -bool wxBitmapHandler::Create(wxBitmap *bitmap, void *data, long type, int width, int height, int depth) +bool wxBitmapHandler::Create(wxBitmap *WXUNUSED(bitmap), void *WXUNUSED(data), long WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height), int WXUNUSED(depth)) { return FALSE; } -bool wxBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long type, - int desiredWidth, int desiredHeight) +bool wxBitmapHandler::LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), long WXUNUSED(type), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { return FALSE; } -bool wxBitmapHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *palette) +bool wxBitmapHandler::SaveFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name), int WXUNUSED(type), const wxPalette *WXUNUSED(palette)) { return FALSE; } @@ -613,24 +613,29 @@ public: }; IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) -bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) +bool wxBMPResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { // TODO: load colourmap. M_BITMAPHANDLERDATA->m_hBitmap = (WXHBITMAP) ::LoadBitmap(wxGetInstance(), name); if (M_BITMAPHANDLERDATA->m_hBitmap) { - M_BITMAPHANDLERDATA->m_ok = TRUE; - BITMAP bm; - GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm); - M_BITMAPHANDLERDATA->m_width = bm.bmWidth; - M_BITMAPHANDLERDATA->m_height = bm.bmHeight; - M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel; - return TRUE; + M_BITMAPHANDLERDATA->m_ok = TRUE; + BITMAP bm; + GetObject((HBITMAP) M_BITMAPHANDLERDATA->m_hBitmap, sizeof(BITMAP), (LPSTR) &bm); + M_BITMAPHANDLERDATA->m_width = bm.bmWidth; + M_BITMAPHANDLERDATA->m_height = bm.bmHeight; + M_BITMAPHANDLERDATA->m_depth = bm.bmBitsPixel; + + if ( bitmap->IsKindOf(CLASSINFO(wxIcon)) ) + { + } + + return TRUE; } // it's probably not found - wxLogError("Can't load bitmap '%s' from resources! Check .rc file.", name.c_str()); + wxLogError(_T("Can't load bitmap '%s' from resources! Check .rc file."), name.c_str()); return FALSE; } @@ -652,8 +657,8 @@ public: }; IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) -bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags, - int desiredWidth, int desiredHeight) +bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long WXUNUSED(flags), + int WXUNUSED(desiredWidth), int WXUNUSED(desiredHeight)) { #if wxUSE_IMAGE_LOADING_IN_MSW wxPalette *palette = NULL; @@ -670,14 +675,17 @@ bool wxBMPFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla palette = NULL; } if (palette) - M_BITMAPHANDLERDATA->m_bitmapPalette = *palette; + { + M_BITMAPHANDLERDATA->m_bitmapPalette = *palette; + delete palette; + } return success; #else return FALSE; #endif } -bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int type, const wxPalette *pal) +bool wxBMPFileHandler::SaveFile(wxBitmap *bitmap, const wxString& name, int WXUNUSED(type), const wxPalette *pal) { #if wxUSE_IMAGE_LOADING_IN_MSW wxPalette *actualPalette = (wxPalette *)pal;