X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bda0e173844e8e0f8acf4e8ad8b5c26e5c6fe5d..44c4a3348693414bace13852e50d926c1aa9f08b:/src/msw/metafile.cpp diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index fe52d2438b..dd7f16f38b 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -24,7 +24,7 @@ #include "wx/setup.h" #endif -#if USE_METAFILE +#if wxUSE_METAFILE #ifndef WX_PRECOMP #include "wx/utils.h" @@ -62,7 +62,7 @@ wxMetaFile::wxMetaFile(const wxString& file) wxMetaFile::~wxMetaFile(void) { if (m_metaFile) - { DeleteMetaFile((HANDLE) m_metaFile); m_metaFile = 0; } + { DeleteMetaFile((HMETAFILE) m_metaFile); m_metaFile = 0; } } bool wxMetaFile::SetClipboard(int width, int height) @@ -73,7 +73,7 @@ bool wxMetaFile::SetClipboard(int width, int height) wxOpenClipboard(); if (!wxEmptyClipboard()) return FALSE; } - bool success = wxSetClipboardData(wxCF_METAFILE,this, width,height); + bool success = wxSetClipboardData(wxDF_METAFILE,this, width,height); if (!alreadyOpen) wxCloseClipboard(); return (bool) success; } @@ -83,7 +83,7 @@ bool wxMetaFile::Play(wxDC *dc) dc->BeginDrawing(); if (dc->GetHDC() && m_metaFile) - PlayMetaFile((HDC) dc->GetHDC(), (HANDLE) m_metaFile); + PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) m_metaFile); dc->EndDrawing(); @@ -108,9 +108,13 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file) if (!file.IsNull() && wxFileExists(file)) wxRemoveFile(file); - m_hDC = (WXHDC) CreateMetaFile(file); - m_ok = TRUE; + if (!file.IsNull() && (file != "")) + m_hDC = (WXHDC) CreateMetaFile(file); + else + m_hDC = (WXHDC) CreateMetaFile(NULL); + + m_ok = (m_hDC != (WXHDC) 0) ; // Actual Windows mapping mode, for future reference. m_windowsMappingMode = MM_TEXT; @@ -145,12 +149,12 @@ wxMetaFileDC::~wxMetaFileDC(void) m_hDC = 0; } -void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y, - float *descent, float *externalLeading, wxFont *theFont, bool use16bit) +void wxMetaFileDC::GetTextExtent(const wxString& string, long *x, long *y, + long *descent, long *externalLeading, wxFont *theFont, bool use16bit) const { wxFont *fontToUse = theFont; if (!fontToUse) - fontToUse = &m_font; + fontToUse = (wxFont*) &m_font; HDC dc = GetDC(NULL); @@ -161,10 +165,10 @@ void wxMetaFileDC::GetTextExtent(const wxString& string, float *x, float *y, ReleaseDC(NULL, dc); - *x = (float)XDEV2LOGREL(sizeRect.cx); - *y = (float)YDEV2LOGREL(sizeRect.cy); - if (descent) *descent = (float)tm.tmDescent; - if (externalLeading) *externalLeading = (float)tm.tmExternalLeading; + *x = XDEV2LOGREL(sizeRect.cx); + *y = YDEV2LOGREL(sizeRect.cy); + if (descent) *descent = tm.tmDescent; + if (externalLeading) *externalLeading = tm.tmExternalLeading; } wxMetaFile *wxMetaFileDC::Close(void) @@ -370,4 +374,4 @@ bool wxMakeMetaFilePlaceable(const wxString& filename, int x1, int y1, int x2, i return TRUE; } -#endif // USE_METAFILE +#endif // wxUSE_METAFILE