]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/microwin.c
fix bug with wxCSConv("ASCII")
[wxWidgets.git] / src / msw / microwin.c
index cdee637987a5116e51390cd7c43eb7f931bf265e..9b66f8aeb17b93aeb14de4a88177c97b7adc55ea 100644 (file)
@@ -6,15 +6,11 @@
 // Created:     2001-05-31
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:     wxWindows licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 */
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-    #pragma implementation "microwin.h"
-#endif
-
 #include "mwtypes.h"
 #include "windows.h"
 #include "wintern.h"
@@ -46,7 +42,7 @@ int GetScrollPosWX (HWND hWnd, int iSBar)
 }
 
 BOOL ScrollWindow(HWND hWnd, int xAmount, int yAmount,
-                 CONST RECT* lpRect, CONST RECT* lpClipRect)
+                  CONST RECT* lpRect, CONST RECT* lpClipRect)
 {
     /* TODO */
     return FALSE;
@@ -247,34 +243,34 @@ int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj)
 
         GdGetFontInfo(((MWFONTOBJ*) hFont)->pfont, &fi);
 
-       /* FIXME many items are guessed for the time being*/
-       logFont->lfHeight = fi.height;
+        /* FIXME many items are guessed for the time being*/
+        logFont->lfHeight = fi.height;
 
-        /* reversed for kaffe port
-       logFont->tmAscent = fi.height - fi.baseline;
-       logFont->tmDescent= fi.baseline;
-        */
+        /* reversed for kaffe port
+           logFont->tmAscent = fi.height - fi.baseline;
+           logFont->tmDescent= fi.baseline;
+           */
 
-       logFont->lfWidth = fi.widths['x'];
-       logFont->lfWeight = FW_NORMAL;
+        logFont->lfWidth = fi.widths['x'];
+        logFont->lfWeight = FW_NORMAL;
         logFont->lfEscapement = 0;
         logFont->lfOrientation = 0;
         logFont->lfOutPrecision = OUT_OUTLINE_PRECIS;
         logFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
         logFont->lfQuality = DEFAULT_QUALITY;
-       logFont->lfItalic = 0;
-       logFont->lfUnderline = 0;
-       logFont->lfStrikeOut = 0;
-       /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
-       logFont->lfPitchAndFamily = fi.fixed?
-                       FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
-       logFont->lfCharSet = OEM_CHARSET;
-       /* TODO I don't know how to get the font name. May
-        * test for different font classes.
+        logFont->lfItalic = 0;
+        logFont->lfUnderline = 0;
+        logFont->lfStrikeOut = 0;
+        /* note that win32 has the TMPF_FIXED_PITCH flags REVERSED...*/
+        logFont->lfPitchAndFamily = fi.fixed?
+            FF_DONTCARE: (FF_DONTCARE | TMPF_FIXED_PITCH);
+        logFont->lfCharSet = OEM_CHARSET;
+        /* TODO I don't know how to get the font name. May
+         * test for different font classes.
          */
         logFont->lfFaceName[0] = 0;
 #if 0
-       strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName));
+        strncpy(logFont->lfFaceName, ??, sizeof(logFont->lfFaceName));
 #endif
         return sz;
     }
@@ -289,36 +285,36 @@ int GetObject(HGDIOBJ hObj, int sz, LPVOID logObj)
 HBITMAP WINAPI
 CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
 {
-       MWBITMAPOBJ *   hbitmap;
-       int             size;
-       int             linelen;
+    MWBITMAPOBJ *hbitmap;
+    int size;
+    int linelen;
 
-       if(!hdc)
-               return NULL;
+    if(!hdc)
+        return NULL;
 
-       nWidth = MWMAX(nWidth, 1);
-       nHeight = MWMAX(nHeight, 1);
+    nWidth = MWMAX(nWidth, 1);
+    nHeight = MWMAX(nHeight, 1);
 
-       /* calc memory allocation size and linelen from width and height*/
-       if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen))
-               return NULL;
+    /* calc memory allocation size and linelen from width and height*/
+    if(!GdCalcMemGCAlloc(hdc->psd, nWidth, nHeight, 0, 0, &size, &linelen))
+        return NULL;
 
-       /* allocate gdi object*/
-       hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
-       if(!hbitmap)
-               return NULL;
-       hbitmap->hdr.type = OBJ_BITMAP;
-       hbitmap->hdr.stockobj = FALSE;
-       hbitmap->width = nWidth;
-       hbitmap->height = nHeight;
+    /* allocate gdi object*/
+    hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
+    if(!hbitmap)
+        return NULL;
+    hbitmap->hdr.type = OBJ_BITMAP;
+    hbitmap->hdr.stockobj = FALSE;
+    hbitmap->width = nWidth;
+    hbitmap->height = nHeight;
 
-       /* create compatible with hdc*/
-       hbitmap->planes = hdc->psd->planes;
-       hbitmap->bpp = hdc->psd->bpp;
-       hbitmap->linelen = linelen;
-       hbitmap->size = size;
+    /* create compatible with hdc*/
+    hbitmap->planes = hdc->psd->planes;
+    hbitmap->bpp = hdc->psd->bpp;
+    hbitmap->linelen = linelen;
+    hbitmap->size = size;
 
-       return (HBRUSH)hbitmap;
+    return (HBRUSH)hbitmap;
 }
 #endif
 
@@ -329,41 +325,41 @@ CreateCompatibleBitmap(HDC hdc, int nWidth, int nHeight)
 HBITMAP WINAPI
 CreateBitmap( int nWidth, int nHeight, int nPlanes, int bPP, LPCVOID lpData)
 {
-       MWBITMAPOBJ *   hbitmap;
-       int             size;
-       int             linelen;
+    MWBITMAPOBJ *hbitmap;
+    int size;
+    int linelen;
 
-        HDC hScreenDC;
+    HDC hScreenDC;
 
-        hScreenDC = GetDC(NULL);
+    hScreenDC = GetDC(NULL);
 
-       nWidth = MWMAX(nWidth, 1);
-       nHeight = MWMAX(nHeight, 1);
+    nWidth = MWMAX(nWidth, 1);
+    nHeight = MWMAX(nHeight, 1);
 
-       /* calc memory allocation size and linelen from width and height*/
-       if(!GdCalcMemGCAlloc(hScreenDC->psd, nWidth, nHeight, nPlanes, bPP, &size, &linelen))
-        {
-                ReleaseDC(NULL, hScreenDC);
-               return NULL;
-       }
+    /* calc memory allocation size and linelen from width and height*/
+    if(!GdCalcMemGCAlloc(hScreenDC->psd, nWidth, nHeight, nPlanes, bPP, &size, &linelen))
+    {
         ReleaseDC(NULL, hScreenDC);
-
-       /* allocate gdi object*/
-       hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
-       if(!hbitmap)
-               return NULL;
-       hbitmap->hdr.type = OBJ_BITMAP;
-       hbitmap->hdr.stockobj = FALSE;
-       hbitmap->width = nWidth;
-       hbitmap->height = nHeight;
-
-       /* create with specified parameters */
-       hbitmap->planes = nPlanes;
-       hbitmap->bpp = bPP;
-       hbitmap->linelen = linelen;
-       hbitmap->size = size;
-
-        /* TODO: copy data */
-
-       return (HBRUSH)hbitmap;
+        return NULL;
+    }
+    ReleaseDC(NULL, hScreenDC);
+
+    /* allocate gdi object*/
+    hbitmap = (MWBITMAPOBJ *)GdItemAlloc(sizeof(MWBITMAPOBJ)-1+size);
+    if(!hbitmap)
+        return NULL;
+    hbitmap->hdr.type = OBJ_BITMAP;
+    hbitmap->hdr.stockobj = FALSE;
+    hbitmap->width = nWidth;
+    hbitmap->height = nHeight;
+
+    /* create with specified parameters */
+    hbitmap->planes = nPlanes;
+    hbitmap->bpp = bPP;
+    hbitmap->linelen = linelen;
+    hbitmap->size = size;
+
+    /* TODO: copy data */
+
+    return (HBRUSH)hbitmap;
 }