X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/40c7a5fc4e95a9dc291c0cc7dcc135d552b69272..50bcd1ae77ba4953d62c9141a78a36b5f4b57936:/src/msw/dib.cpp diff --git a/src/msw/dib.cpp b/src/msw/dib.cpp index 871197195c..e4f8360ad6 100644 --- a/src/msw/dib.cpp +++ b/src/msw/dib.cpp @@ -49,10 +49,12 @@ #include "wx/msw/dib.h" #ifndef __TWIN32__ +#ifndef wxUSE_NORLANDER_HEADERS #ifdef __GNUWIN32__ #include "wx/msw/gnuwin32/extra.h" #endif #endif +#endif #ifndef SEEK_CUR /* flags for _lseek */ @@ -84,13 +86,13 @@ DWORD PASCAL lread(int fh, VOID FAR *pv, DWORD ul); DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul); -BOOL WriteDIB (LPSTR szFile,HANDLE hdib); +BOOL WriteDIB (LPTSTR szFile,HANDLE hdib); WORD PaletteSize (VOID FAR * pv); WORD DibNumColors (VOID FAR * pv); // HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal); BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *); HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER); -BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette); +BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette); /**************************************************************************** * * @@ -103,7 +105,7 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette); * * ****************************************************************************/ -BOOL WriteDIB(LPSTR szFile, HANDLE hdib) +BOOL WriteDIB(LPTSTR szFile, HANDLE hdib) { BITMAPFILEHEADER hdr; LPBITMAPINFOHEADER lpbi; @@ -113,7 +115,7 @@ BOOL WriteDIB(LPSTR szFile, HANDLE hdib) if (!hdib) return FALSE; - fh = OpenFile(szFile, &of, OF_CREATE | OF_READWRITE); + fh = OpenFile(wxFNCONV(szFile), &of, OF_CREATE | OF_READWRITE); if (fh == -1) return FALSE; @@ -357,7 +359,7 @@ HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal) DWORD PASCAL lread(int fh, void far *pv, DWORD ul) { DWORD ulT = ul; -#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) +#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) BYTE *hp = (BYTE *) pv; #else BYTE huge *hp = (BYTE huge *) pv; @@ -387,7 +389,7 @@ DWORD PASCAL lread(int fh, void far *pv, DWORD ul) DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) { DWORD ulT = ul; -#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) +#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__) BYTE *hp = (BYTE *) pv; #else BYTE huge *hp = (BYTE huge *) pv; @@ -418,7 +420,7 @@ DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul) * FALSE - otherwise * ****************************************************************************/ -BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) +BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) { int fh; LPBITMAPINFOHEADER lpbi; @@ -426,7 +428,7 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) BITMAPFILEHEADER bf; WORD nNumColors; BOOL result = FALSE; - char str[128]; + wxChar str[128]; WORD offBits; HDC hDC; BOOL bCoreHead = FALSE; @@ -434,10 +436,10 @@ BOOL ReadDIB(LPSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette) /* Open the file and get a handle to it's BITMAPINFO */ - fh = OpenFile (lpFileName, &of, OF_READ); + fh = OpenFile (wxFNCONV(lpFileName), &of, OF_READ); if (fh == -1) { - wsprintf(str,"Can't open file '%s'", lpFileName); - MessageBox(NULL, str, "Error", MB_ICONSTOP | MB_OK); + wsprintf(str,_T("Can't open file '%s'"), lpFileName); + MessageBox(NULL, str, _T("Error"), MB_ICONSTOP | MB_OK); return (0); } @@ -642,6 +644,9 @@ BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB, ****************************************************************************/ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) { +#ifdef __WXWINE__ + return (FALSE); +#else NPLOGPALETTE npPal; RGBQUAD far *lpRGB; HPALETTE hLogPal; @@ -658,7 +663,6 @@ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) */ npPal = (NPLOGPALETTE)malloc(sizeof(LOGPALETTE) + (WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY)); - if (!npPal) return(FALSE); @@ -690,9 +694,11 @@ HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo) */ else return((HPALETTE) GetStockObject(DEFAULT_PALETTE)); +#endif + } -bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxPalette **pal) +bool wxLoadIntoBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette **pal) { HBITMAP hBitmap; HPALETTE hPalette; @@ -733,7 +739,7 @@ bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxPalette **pal) else return FALSE; } -wxBitmap *wxLoadBitmap(char *filename, wxPalette **pal) +wxBitmap *wxLoadBitmap(wxChar *filename, wxPalette **pal) { wxBitmap *bitmap = new wxBitmap; if (wxLoadIntoBitmap(filename, bitmap, pal)) @@ -922,7 +928,7 @@ HANDLE BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal) return hDIB; } -bool wxSaveBitmap(char *filename, wxBitmap *bitmap, wxPalette *colourmap) +bool wxSaveBitmap(wxChar *filename, wxBitmap *bitmap, wxPalette *colourmap) { HPALETTE hPalette = 0; if (colourmap)