X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2845ddc25c401eab92825563a27aade46f7cfe3d..2356708db31b737c6eae53c2316b642aa5a2e68d:/src/msw/metafile.cpp?ds=sidebyside diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 921cac0ab5..0d4a30f506 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -54,7 +54,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC) wxMetafileRefData::wxMetafileRefData(void) { m_metafile = 0; - m_windowsMappingMode = MM_ANISOTROPIC; + m_windowsMappingMode = wxMM_ANISOTROPIC; } wxMetafileRefData::~wxMetafileRefData(void) @@ -70,9 +70,9 @@ wxMetafile::wxMetafile(const wxString& file) { m_refData = new wxMetafileRefData; - M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC; + M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC; M_METAFILEDATA->m_metafile = 0; - if (!file.IsNull() && file == "") + if (!file.IsNull() && (file.Cmp(_T("")) == 0)) M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file); } @@ -146,7 +146,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file) if (!file.IsNull() && wxFileExists(file)) wxRemoveFile(file); - if (!file.IsNull() && (file != "")) + if (!file.IsNull() && (file != _T(""))) m_hDC = (WXHDC) CreateMetaFile(file); else m_hDC = (WXHDC) CreateMetaFile(NULL); @@ -154,9 +154,9 @@ wxMetafileDC::wxMetafileDC(const wxString& file) m_ok = (m_hDC != (WXHDC) 0) ; // Actual Windows mapping mode, for future reference. - m_windowsMappingMode = MM_TEXT; - - SetMapMode(MM_TEXT); // NOTE: does not set HDC mapmode (this is correct) + m_windowsMappingMode = wxMM_TEXT; + + SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct) } // New constructor that takes origin and extent. If you use this, don't @@ -167,7 +167,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i m_minY = 10000; m_maxX = -10000; m_maxY = -10000; - if (file != "" && wxFileExists(file)) wxRemoveFile(file); + if (file != _T("") && wxFileExists(file)) wxRemoveFile(file); m_hDC = (WXHDC) CreateMetaFile(file); m_ok = TRUE; @@ -176,9 +176,9 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL); // Actual Windows mapping mode, for future reference. - m_windowsMappingMode = MM_ANISOTROPIC; - - SetMapMode(MM_TEXT); // NOTE: does not set HDC mapmode (this is correct) + m_windowsMappingMode = wxMM_ANISOTROPIC; + + SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct) } wxMetafileDC::~wxMetafileDC(void) @@ -197,15 +197,19 @@ void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y, SIZE sizeRect; TEXTMETRIC tm; - GetTextExtentPoint(dc, (char *)(const char *) string, strlen((char *)(const char *) string), &sizeRect); + GetTextExtentPoint(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); GetTextMetrics(dc, &tm); ReleaseDC(NULL, dc); - *x = XDEV2LOGREL(sizeRect.cx); - *y = YDEV2LOGREL(sizeRect.cy); - if (descent) *descent = tm.tmDescent; - if (externalLeading) *externalLeading = tm.tmExternalLeading; + if ( x ) + *x = sizeRect.cx; + if ( y ) + *y = sizeRect.cy; + if ( descent ) + *descent = tm.tmDescent; + if ( externalLeading ) + *externalLeading = tm.tmExternalLeading; } wxMetafile *wxMetafileDC::Close(void) @@ -237,32 +241,32 @@ void wxMetafileDC::SetMapMode(int mode) switch (mode) { - case MM_TWIPS: + case wxMM_TWIPS: { m_logicalScaleX = (float)(twips2mm * mm2pixelsX); m_logicalScaleY = (float)(twips2mm * mm2pixelsY); break; } - case MM_POINTS: + case wxMM_POINTS: { m_logicalScaleX = (float)(pt2mm * mm2pixelsX); m_logicalScaleY = (float)(pt2mm * mm2pixelsY); break; } - case MM_METRIC: + case wxMM_METRIC: { m_logicalScaleX = mm2pixelsX; m_logicalScaleY = mm2pixelsY; break; } - case MM_LOMETRIC: + case wxMM_LOMETRIC: { m_logicalScaleX = (float)(mm2pixelsX/10.0); m_logicalScaleY = (float)(mm2pixelsY/10.0); break; } default: - case MM_TEXT: + case wxMM_TEXT: { m_logicalScaleX = 1.0; m_logicalScaleY = 1.0; @@ -304,7 +308,7 @@ struct mfPLACEABLEHEADER { /* * Pass filename of existing non-placeable metafile, and bounding box. * Adds a placeable metafile header, sets the mapping mode to anisotropic, - * and sets the window origin and extent to mimic the MM_TEXT mapping mode. + * and sets the window origin and extent to mimic the wxMM_TEXT mapping mode. * */ @@ -336,12 +340,12 @@ bool wxMakeMetafilePlaceable(const wxString& filename, int x1, int y1, int x2, i p < (WORD *)&pMFHead ->checksum; ++p) pMFHead ->checksum ^= *p; - FILE *fd = fopen((char *)(const char *)filename, "rb"); + FILE *fd = fopen(filename.mb_str(wxConvFile), "rb"); if (!fd) return FALSE; - char tempFileBuf[256]; - wxGetTempFileName("mf", tempFileBuf); - FILE *fHandle = fopen(tempFileBuf, "wb"); + wxChar tempFileBuf[256]; + wxGetTempFileName(_T("mf"), tempFileBuf); + FILE *fHandle = fopen(wxConvFile.cWX2MB(tempFileBuf), "wb"); if (!fHandle) return FALSE; fwrite((void *)&header, sizeof(unsigned char), sizeof(mfPLACEABLEHEADER), fHandle);