X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c1fa2fda3c72886f62def1e650a7306c82e72f2f..3527f29c8769e09d796c547c0c309f8b86407012:/contrib/src/ogl/mfutils.cpp diff --git a/contrib/src/ogl/mfutils.cpp b/contrib/src/ogl/mfutils.cpp index a565739380..17111d481e 100644 --- a/contrib/src/ogl/mfutils.cpp +++ b/contrib/src/ogl/mfutils.cpp @@ -27,7 +27,8 @@ #include #include -#include +#include "wx/ogl/ogl.h" + #include static char _buf[1024]; // a temp buffer to use inplace of wxBuffer, which is deprecated. @@ -58,7 +59,10 @@ static int getsignedshort(FILE *fp) { int c, c1; c = getc(fp); c1 = getc(fp); +#if 0 + // this is not used value, no need to execute it int testRes = ((unsigned int) c) + (((unsigned int) c1) << 8); +#endif unsigned long res1 = ((unsigned int) c) + (((unsigned int) c1) << 8); int res = 0; if (res1 > 32767) @@ -98,7 +102,7 @@ wxMetaRecord::~wxMetaRecord(void) if (stringParam) delete[] stringParam; } -wxXMetaFile::wxXMetaFile(char *file) +wxXMetaFile::wxXMetaFile(const wxChar *file) { ok = FALSE; top = 0.0; @@ -162,11 +166,11 @@ int AddMetaRecordHandle(wxMetaRecord *record) return (HandleTableSize - 1); } -bool wxXMetaFile::ReadFile(char *file) +bool wxXMetaFile::ReadFile(const wxChar *file) { HandleTableSize = 0; - FILE *handle = fopen(file, "rb"); + FILE *handle = wxFopen(file, wxT("rb")); if (!handle) return FALSE; // Read placeable metafile header, if any @@ -174,7 +178,7 @@ bool wxXMetaFile::ReadFile(char *file) if (key == (long) 0x9AC6CDD7) { - long hmf = getshort(handle); + /* long hmf = */ getshort(handle); int iLeft, iTop, iRight, iBottom; iLeft = getsignedshort(handle); iTop = getsignedshort(handle); @@ -186,9 +190,9 @@ bool wxXMetaFile::ReadFile(char *file) right = (double)iRight; bottom = (double)iBottom; - int inch = getshort(handle); - long reserved = getint(handle); - int checksum = getshort(handle); + /* int inch = */ getshort(handle); + /* long reserved = */ getint(handle); + /* int checksum = */ getshort(handle); /* double widthInUnits = (double)right - left; double heightInUnits = (double)bottom - top; @@ -207,7 +211,7 @@ bool wxXMetaFile::ReadFile(char *file) return FALSE; } - int mtHeaderSize = getshort(handle); + /* int mtHeaderSize = */ getshort(handle); int mtVersion = getshort(handle); if (mtVersion != 0x0300 && mtVersion != 0x0100) @@ -216,10 +220,10 @@ bool wxXMetaFile::ReadFile(char *file) return FALSE; } - long mtSize = getint(handle); - int mtNoObjects = getshort(handle); - long mtMaxRecord = getint(handle); - int mtNoParameters = getshort(handle); + /* long mtSize = */ getint(handle); + /* int mtNoObjects = */ getshort(handle); + /* long mtMaxRecord = */ getint(handle); + /* int mtNoParameters = */ getshort(handle); while (!feof(handle)) { @@ -479,7 +483,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } // case META_STRETCHDIB: @@ -504,7 +508,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEBRUSH: @@ -514,7 +518,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEPATTERNBRUSH: @@ -524,7 +528,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEPENINDIRECT: @@ -532,7 +536,7 @@ bool wxXMetaFile::ReadFile(char *file) wxMetaRecord *rec = new wxMetaRecord(META_CREATEPENINDIRECT); int msStyle = getshort(handle); // Style: 2 bytes int x = getshort(handle); // X: 2 bytes - int y = getshort(handle); // Y: 2 bytes + /* int y = */ getshort(handle); // Y: 2 bytes long colorref = getint(handle); // COLORREF 4 bytes int style; @@ -550,7 +554,7 @@ bool wxXMetaFile::ReadFile(char *file) gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); // For some reason, the size of this record is sometimes 9 words!!! // instead of the usual 8. So read 2 characters extra. @@ -564,17 +568,17 @@ bool wxXMetaFile::ReadFile(char *file) { wxMetaRecord *rec = new wxMetaRecord(META_CREATEFONTINDIRECT); int lfHeight = getshort(handle); // 2 bytes - int lfWidth = getshort(handle); // 2 bytes - int lfEsc = getshort(handle); // 2 bytes - int lfOrient = getshort(handle); // 2 bytes + /* int lfWidth = */ getshort(handle); // 2 bytes + /* int lfEsc = */ getshort(handle); // 2 bytes + /* int lfOrient = */ getshort(handle); // 2 bytes int lfWeight = getshort(handle); // 2 bytes char lfItalic = getc(handle); // 1 byte char lfUnderline = getc(handle); // 1 byte - char lfStrikeout = getc(handle); // 1 byte - char lfCharSet = getc(handle); // 1 byte - char lfOutPrecision = getc(handle); // 1 byte - char lfClipPrecision = getc(handle); // 1 byte - char lfQuality = getc(handle); // 1 byte + /* char lfStrikeout = */ getc(handle); // 1 byte + /* char lfCharSet = */ getc(handle); // 1 byte + /* char lfOutPrecision = */ getc(handle); // 1 byte + /* char lfClipPrecision = */ getc(handle); // 1 byte + /* char lfQuality = */ getc(handle); // 1 byte char lfPitchAndFamily = getc(handle); // 1 byte (18th) char lfFacename[32]; // Read the rest of the record, which is total record size @@ -622,7 +626,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEBRUSHINDIRECT: @@ -679,7 +683,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEBITMAPINDIRECT: @@ -690,7 +694,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEBITMAP: @@ -701,7 +705,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } case META_CREATEREGION: @@ -712,7 +716,7 @@ bool wxXMetaFile::ReadFile(char *file) metaRecords.Append(rec); gdiObjects.Append(rec); AddMetaRecordHandle(rec); - rec->param2 = (long)(gdiObjects.Number() - 1); + rec->param2 = (long)(gdiObjects.GetCount() - 1); break; } default: @@ -728,28 +732,28 @@ bool wxXMetaFile::ReadFile(char *file) wxXMetaFile::~wxXMetaFile(void) { - wxNode *node = metaRecords.First(); + wxNode *node = metaRecords.GetFirst(); while (node) { - wxMetaRecord *rec = (wxMetaRecord *)node->Data(); + wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); delete rec; - wxNode *next = node->Next(); + wxNode *next = node->GetNext(); delete node; node = next; } } -bool wxXMetaFile::SetClipboard(int width, int height) +bool wxXMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) { return FALSE; } bool wxXMetaFile::Play(wxDC *dc) { - wxNode *node = metaRecords.First(); + wxNode *node = metaRecords.GetFirst(); while (node) { - wxMetaRecord *rec = (wxMetaRecord *)node->Data(); + wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); int rdFunction = rec->metaFunction; switch (rdFunction) @@ -1080,7 +1084,7 @@ bool wxXMetaFile::Play(wxDC *dc) break; } } - node = node->Next(); + node = node->GetNext(); } return TRUE; }