X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c4e7c2aa5822f9a6e97d8d7848b95ea2eadcd98b..520e470fdd0daef09c77938db642e4583933c90d:/src/msw/metafile.cpp?ds=sidebyside diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index c22d980311..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" @@ -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; } @@ -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