// Default is 1
//
// Recommended setting: 1 for win32 else 0
-#if defined(__WIN32__)
+#if defined(__WIN32__) || defined(__WATCOMC__)
#define wxUSE_WCHAR_T 1
#else
#define wxUSE_WCHAR_T 0
/////////////////////////////////////////////////////////////////////////////
-// Name: common/appcmn.cpp
+// Name: src/common/appcmn.cpp
// Purpose: wxAppConsole and wxAppBase methods common to all platforms
// Author: Vadim Zeitlin
// Modified by:
#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__)
#include "wx/unix/gsockunx.h"
#elif defined(__WXMAC__)
- #include <MacHeaders.c>
- #define OTUNIXERRORS 1
- #include <OpenTransport.h>
- #include <OpenTransportProviders.h>
- #include <OpenTptInternet.h>
+ #include <MacHeaders.c>
+ #define OTUNIXERRORS 1
+ #include <OpenTransport.h>
+ #include <OpenTransportProviders.h>
+ #include <OpenTptInternet.h>
- #include "wx/mac/gsockmac.h"
+ #include "wx/mac/gsockmac.h"
#else
#error "Must include correct GSocket header here"
#endif
}
#endif
-
#elif defined(__DOS__)
// There's no such thing as global cfg dir in MS-DOS, let's return
// current directory (FIXME_MGL?)
- return wxT(".\\");
+ strDir = wxT(".\\");
#elif defined(__WXWINCE__)
strDir = wxT("\\Windows\\");
#else // Windows
void wxFileConfig::CleanUp()
{
- delete m_pRootGroup;
+ delete m_pRootGroup;
- wxFileConfigLineList *pCur = m_linesHead;
- while ( pCur != NULL ) {
- wxFileConfigLineList *pNext = pCur->Next();
- delete pCur;
- pCur = pNext;
- }
+ wxFileConfigLineList *pCur = m_linesHead;
+ while ( pCur != NULL ) {
+ wxFileConfigLineList *pNext = pCur->Next();
+ delete pCur;
+ pCur = pNext;
+ }
}
wxFileConfig::~wxFileConfig()
{
- Flush();
+ Flush();
- CleanUp();
+ CleanUp();
}
// ----------------------------------------------------------------------------
void wxFileConfig::SetRootPath()
{
- m_strPath.Empty();
- m_pCurrentGroup = m_pRootGroup;
+ m_strPath.Empty();
+ m_pCurrentGroup = m_pRootGroup;
}
bool
wxFileConfig::DoSetPath(const wxString& strPath, bool createMissingComponents)
{
- wxArrayString aParts;
+ wxArrayString aParts;
- if ( strPath.empty() ) {
- SetRootPath();
- return true;
- }
+ if ( strPath.empty() ) {
+ SetRootPath();
+ return true;
+ }
- if ( strPath[0] == wxCONFIG_PATH_SEPARATOR ) {
- // absolute path
- wxSplitPath(aParts, strPath);
- }
- else {
- // relative path, combine with current one
- wxString strFullPath = m_strPath;
- strFullPath << wxCONFIG_PATH_SEPARATOR << strPath;
- wxSplitPath(aParts, strFullPath);
- }
+ if ( strPath[0] == wxCONFIG_PATH_SEPARATOR ) {
+ // absolute path
+ wxSplitPath(aParts, strPath);
+ }
+ else {
+ // relative path, combine with current one
+ wxString strFullPath = m_strPath;
+ strFullPath << wxCONFIG_PATH_SEPARATOR << strPath;
+ wxSplitPath(aParts, strFullPath);
+ }
- // change current group
- size_t n;
- m_pCurrentGroup = m_pRootGroup;
- for ( n = 0; n < aParts.Count(); n++ ) {
- wxFileConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]);
- if ( pNextGroup == NULL )
- {
- if ( !createMissingComponents )
- return false;
+ // change current group
+ size_t n;
+ m_pCurrentGroup = m_pRootGroup;
+ for ( n = 0; n < aParts.Count(); n++ ) {
+ wxFileConfigGroup *pNextGroup = m_pCurrentGroup->FindSubgroup(aParts[n]);
+ if ( pNextGroup == NULL )
+ {
+ if ( !createMissingComponents )
+ return false;
- pNextGroup = m_pCurrentGroup->AddSubgroup(aParts[n]);
- }
+ pNextGroup = m_pCurrentGroup->AddSubgroup(aParts[n]);
+ }
- m_pCurrentGroup = pNextGroup;
- }
+ m_pCurrentGroup = pNextGroup;
+ }
- // recombine path parts in one variable
- m_strPath.Empty();
- for ( n = 0; n < aParts.Count(); n++ ) {
- m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n];
- }
+ // recombine path parts in one variable
+ m_strPath.Empty();
+ for ( n = 0; n < aParts.Count(); n++ ) {
+ m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n];
+ }
- return true;
+ return true;
}
void wxFileConfig::SetPath(const wxString& strPath)
{
- DoSetPath(strPath, true /* create missing path components */);
+ DoSetPath(strPath, true /* create missing path components */);
}
// ----------------------------------------------------------------------------
bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const
{
- lIndex = 0;
- return GetNextGroup(str, lIndex);
+ lIndex = 0;
+ return GetNextGroup(str, lIndex);
}
bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
{
- if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
- str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
- return true;
- }
- else
- return false;
+ if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
+ str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
+ return true;
+ }
+ else
+ return false;
}
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
{
- lIndex = 0;
- return GetNextEntry(str, lIndex);
+ lIndex = 0;
+ return GetNextEntry(str, lIndex);
}
bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
{
- if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
- str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
- return true;
- }
- else
- return false;
+ if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
+ str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
+ return true;
+ }
+ else
+ return false;
}
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
{
- size_t n = m_pCurrentGroup->Entries().Count();
- if ( bRecursive ) {
- wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
- size_t nSubgroups = m_pCurrentGroup->Groups().Count();
- for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
- CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
- n += GetNumberOfEntries(true);
- CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
+ size_t n = m_pCurrentGroup->Entries().Count();
+ if ( bRecursive ) {
+ wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
+ size_t nSubgroups = m_pCurrentGroup->Groups().Count();
+ for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
+ CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
+ n += GetNumberOfEntries(true);
+ CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
+ }
}
- }
- return n;
+ return n;
}
size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
{
- size_t n = m_pCurrentGroup->Groups().Count();
- if ( bRecursive ) {
- wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
- size_t nSubgroups = m_pCurrentGroup->Groups().Count();
- for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
- CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
- n += GetNumberOfGroups(true);
- CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
+ size_t n = m_pCurrentGroup->Groups().Count();
+ if ( bRecursive ) {
+ wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
+ size_t nSubgroups = m_pCurrentGroup->Groups().Count();
+ for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
+ CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
+ n += GetNumberOfGroups(true);
+ CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
+ }
}
- }
- return n;
+ return n;
}
// ----------------------------------------------------------------------------
bool wxFileConfig::HasGroup(const wxString& strName) const
{
- // special case: DoSetPath("") does work as it's equivalent to DoSetPath("/")
- // but there is no group with empty name so treat this separately
- if ( strName.empty() )
- return false;
+ // special case: DoSetPath("") does work as it's equivalent to DoSetPath("/")
+ // but there is no group with empty name so treat this separately
+ if ( strName.empty() )
+ return false;
- const wxString pathOld = GetPath();
+ const wxString pathOld = GetPath();
- wxFileConfig *self = wx_const_cast(wxFileConfig *, this);
- const bool
- rc = self->DoSetPath(strName, false /* don't create missing components */);
+ wxFileConfig *self = wx_const_cast(wxFileConfig *, this);
+ const bool
+ rc = self->DoSetPath(strName, false /* don't create missing components */);
- self->SetPath(pathOld);
+ self->SetPath(pathOld);
- return rc;
+ return rc;
}
bool wxFileConfig::HasEntry(const wxString& strName) const
{
- wxConfigPathChanger path(this, strName);
+ wxConfigPathChanger path(this, strName);
- wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
- return pEntry != NULL;
+ wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
+ return pEntry != NULL;
}
// ----------------------------------------------------------------------------
bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) const
{
- wxConfigPathChanger path(this, key);
+ wxConfigPathChanger path(this, key);
- wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
- if (pEntry == NULL) {
- return false;
- }
+ wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
+ if (pEntry == NULL) {
+ return false;
+ }
- *pStr = pEntry->Value();
+ *pStr = pEntry->Value();
- return true;
+ return true;
}
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
bool wxIsDriveAvailable(const wxString& dirName)
{
// FIXME_MGL - this method leads to hang up under Watcom for some reason
-#ifndef __WATCOMC__
+#ifdef __WATCOMC__
+ wxUnusedVar(dirName);
+#else
if ( dirName.Len() == 3 && dirName[1u] == wxT(':') )
{
wxString dirNameLower(dirName.Lower());
/////////////////////////////////////////////////////////////////////////////
-// Name: bitmap.cpp
+// Name: src/mgl/bitmap.cpp
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
//-----------------------------------------------------------------------------
static pixel_format_t gs_pixel_format_15 =
- {0x1F,0x0A,3, 0x1F,0x05,3, 0x1F,0x00,3, 0x01,0x0F,7}; // 555 15bpp
-
+ {0x1F,0x0A,3, 0x1F,0x05,3, 0x1F,0x00,3, 0x01,0x0F,7}; // 555 15bpp
+
static pixel_format_t gs_pixel_format_16 =
- {0x1F,0x0B,3, 0x3F,0x05,2, 0x1F,0x00,3, 0x00,0x00,0}; // 565 16bpp
+ {0x1F,0x0B,3, 0x3F,0x05,2, 0x1F,0x00,3, 0x00,0x00,0}; // 565 16bpp
static pixel_format_t gs_pixel_format_24 =
- {0xFF,0x10,0, 0xFF,0x08,0, 0xFF,0x00,0, 0x00,0x00,0}; // RGB 24bpp
+ {0xFF,0x10,0, 0xFF,0x08,0, 0xFF,0x00,0, 0x00,0x00,0}; // RGB 24bpp
static pixel_format_t gs_pixel_format_32 =
- {0xFF,0x18,0, 0xFF,0x10,0, 0xFF,0x08,0, 0xFF,0x00,0}; // RGBA 32bpp
+ {0xFF,0x18,0, 0xFF,0x10,0, 0xFF,0x08,0, 0xFF,0x00,0}; // RGBA 32bpp
static pixel_format_t gs_pixel_format_wxImage =
- {0xFF,0x00,0, 0xFF,0x08,0, 0xFF,0x10,0, 0x00,0x00,0}; // RGB 24bpp for wxImage
+ {0xFF,0x00,0, 0xFF,0x08,0, 0xFF,0x10,0, 0x00,0x00,0}; // RGB 24bpp for wxImage
//-----------------------------------------------------------------------------
// helpers
static wxColour wxQuantizeColour(const wxColour& clr, const wxBitmap& bmp)
{
pixel_format_t *pf = bmp.GetMGLbitmap_t()->pf;
-
+
if ( pf->redAdjust == 0 && pf->greenAdjust == 0 && pf->blueAdjust == 0 )
return clr;
else
- return wxColour((clr.Red() >> pf->redAdjust) << pf->redAdjust,
- (clr.Green() >> pf->greenAdjust) << pf->greenAdjust,
- (clr.Blue() >> pf->blueAdjust) << pf->blueAdjust);
+ return wxColour((unsigned char)((clr.Red() >> pf->redAdjust) << pf->redAdjust),
+ (unsigned char)((clr.Green() >> pf->greenAdjust) << pf->greenAdjust),
+ (unsigned char)((clr.Blue() >> pf->blueAdjust) << pf->blueAdjust));
}
{
delete m_bitmap;
m_bitmap = NULL;
-
+
wxColour clr(wxQuantizeColour(colour, bitmap));
wxImage imgSrc(bitmap.ConvertToImage());
- imgSrc.SetMask(FALSE);
+ imgSrc.SetMask(false);
wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue()));
- if ( !image.Ok() ) return FALSE;
+ if ( !image.Ok() )
+ return false;
m_bitmap = new wxBitmap(image, 1);
unsigned char r,g,b;
wxPalette *pal = bitmap.GetPalette();
- wxCHECK_MSG( pal, FALSE, wxT("Cannot create mask from bitmap without palette") );
-
+ wxCHECK_MSG( pal, false, wxT("Cannot create mask from bitmap without palette") );
+
pal->GetRGB(paletteIndex, &r, &g, &b);
return Create(bitmap, wxColour(r, g, b));
delete m_bitmap;
m_bitmap = NULL;
- wxCHECK_MSG( bitmap.Ok(), FALSE, wxT("Invalid bitmap") );
- wxCHECK_MSG( bitmap.GetDepth() == 1, FALSE, wxT("Cannot create mask from colour bitmap") );
+ wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap") );
+ wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") );
m_bitmap = new wxBitmap(bitmap);
- return TRUE;
+ return true;
}
}
-static bitmap_t *MyMGL_createBitmap(int width, int height,
+static bitmap_t *MyMGL_createBitmap(int width, int height,
int bpp, pixel_format_t *pf)
{
MGLMemoryDC mdc(width, height, bpp, pf);
{
UnRef();
- wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
-
- pixel_format_t pf_dummy, *pf;
+ wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") )
+
+ pixel_format_t pf_dummy;
+ pixel_format_t *pf;
int mglDepth = depth;
switch ( depth )
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
g_displayDC->getPixelFormat(pf_dummy);
- mglDepth = g_displayDC->getBitsPerPixel();
+ mglDepth = g_displayDC->getBitsPerPixel();
pf = &pf_dummy;
break;
case 1:
break;
default:
wxASSERT_MSG( 0, wxT("invalid bitmap depth") );
- return FALSE;
- break;
+ return false;
}
m_refData = new wxBitmapRefData();
{
// MGL does not support mono DCs, so we have to emulate them with
// 8bpp ones. We do that by using a special palette with color 0
- // set to black and all other colors set to white.
+ // set to black and all other colors set to white.
M_BMPDATA->m_bitmap = MyMGL_createBitmap(width, height, 8, pf);
SetMonoPalette(wxColour(255, 255, 255), wxColour(0, 0, 0));
bool wxBitmap::CreateFromXpm(const char **bits)
{
- wxCHECK_MSG( bits != NULL, FALSE, wxT("invalid bitmap data") )
-
+ wxCHECK_MSG( bits != NULL, false, wxT("invalid bitmap data") )
+
wxXPMDecoder decoder;
wxImage img = decoder.ReadData(bits);
- wxCHECK_MSG( img.Ok(), FALSE, wxT("invalid bitmap data") )
-
+ wxCHECK_MSG( img.Ok(), false, wxT("invalid bitmap data") )
+
*this = wxBitmap(img);
-
- return TRUE;
+
+ return true;
}
wxBitmap::wxBitmap(const wxImage& image, int depth)
long width, height;
wxCHECK_RET( image.Ok(), wxT("invalid image") )
-
+
width = image.GetWidth();
height = image.GetHeight();
if ( !Create(width, height, depth) ) return;
-
+
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
width * 3, (void*)image.GetData(), NULL);
wxASSERT_MSG( idc.isValid(), wxT("cannot create custom MGLDC") );
bdc->bitBlt(idc, 0, 0, width, height, 0, 0, MGL_REPLACE_MODE);
delete bdc;
-
+
if ( image.HasMask() )
{
wxImage mask_image = image.ConvertToMono(image.GetMaskRed(),
image.GetMaskGreen(),
image.GetMaskBlue());
- mask_image.SetMask(FALSE);
+ mask_image.SetMask(false);
wxBitmap mask_bmp(mask_image, 1);
SetMask(new wxMask(mask_bmp));
}
int width, height;
width = GetWidth();
height = GetHeight();
-
+
wxImage image(width, height);
wxASSERT_MSG( image.Ok(), wxT("cannot create image") );
-
+
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
width * 3, (void*)image.GetData(), NULL);
wxASSERT_MSG( idc.isValid(), wxT("cannot create custom MGLDC") );
if ( M_BMPDATA->m_palette )
image.SetPalette(*(M_BMPDATA->m_palette));
-
+
if ( GetMask() )
{
// in consistency with other ports, we convert parts covered
// bg colour set to black and fg colour to <16,16,16>
image.SetMaskColour(16, 16, 16);
- image.SetMask(TRUE);
+ image.SetMask(true);
wxDC tmpDC;
- tmpDC.SetMGLDC(&idc, FALSE);
+ tmpDC.SetMGLDC(&idc, false);
tmpDC.SetBackground(wxBrush(wxColour(16,16,16), wxSOLID));
tmpDC.Clear();
- tmpDC.DrawBitmap(*this, 0, 0, TRUE);
+ tmpDC.DrawBitmap(*this, 0, 0, true);
}
else
{
- image.SetMask(FALSE);
+ image.SetMask(false);
idc.putBitmap(0, 0, M_BMPDATA->m_bitmap, MGL_REPLACE_MODE);
}
{
wxBitmap *bmp = (wxBitmap*)(&icon);
*this = *bmp;
- return TRUE;
+ return true;
}
wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const
ret.SetPalette(*GetPalette());
MGLDevCtx *tdc = ret.CreateTmpDC();
- tdc->putBitmapSection(rect.x, rect.y,
+ tdc->putBitmapSection(rect.x, rect.y,
rect.x + rect.width, rect.y + rect.height,
0, 0, M_BMPDATA->m_bitmap, MGL_REPLACE_MODE);
delete tdc;
M_BMPDATA->m_bitmap->bitsPerPixel,
M_BMPDATA->m_bitmap->pf,
M_BMPDATA->m_bitmap->bytesPerLine,
- M_BMPDATA->m_bitmap->surface,
+ M_BMPDATA->m_bitmap->surface,
NULL);
wxCHECK_MSG( tdc->isValid(), NULL, wxT("cannot create temporary MGLDC") );
if ( M_BMPDATA->m_bitmap->pal != NULL )
{
int cnt;
-
+
switch (M_BMPDATA->m_bitmap->bitsPerPixel)
{
case 2: cnt = 2; break;
wxFAIL_MSG( wxT("bitmap with this depth cannot have palette") );
break;
}
-
+
tdc->setPalette(M_BMPDATA->m_bitmap->pal, cnt, 0);
tdc->realizePalette(cnt, 0, FALSE);
}
-
+
return tdc;
}
bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type)
{
UnRef();
-
- if ( type == wxBITMAP_TYPE_BMP || type == wxBITMAP_TYPE_PNG ||
+
+ if ( type == wxBITMAP_TYPE_BMP || type == wxBITMAP_TYPE_PNG ||
type == wxBITMAP_TYPE_PCX || type == wxBITMAP_TYPE_JPEG )
{
// prevent accidental loading of bitmap from $MGL_ROOT:
if ( !wxFileExists(name) )
{
wxLogError(_("File %s does not exist."), name.c_str());
- return FALSE;
+ return false;
}
}
-
+
wxBitmapHandler *handler = FindHandler(type);
- if ( handler == NULL )
+ if ( handler == NULL )
{
wxImage image;
if ( !image.LoadFile(name, type) || !image.Ok() )
{
- wxLogError("no bitmap handler for type %d defined.", type);
- return FALSE;
+ wxLogError("no bitmap handler for type %d defined.", type);
+ return false;
}
else
{
*this = wxBitmap(image);
- return TRUE;
+ return true;
}
}
bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, const wxPalette *palette) const
{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid bitmap") );
+ wxCHECK_MSG( Ok(), false, wxT("invalid bitmap") );
wxBitmapHandler *handler = FindHandler(type);
- if ( handler == NULL )
+ if ( handler == NULL )
{
wxImage image = ConvertToImage();
if ( palette )
else
{
wxLogError("no bitmap handler for type %d defined.", type);
- return FALSE;
+ return false;
}
}
M_BMPDATA->m_palette = NULL;
if ( !palette.Ok() ) return;
-
+
M_BMPDATA->m_palette = new wxPalette(palette);
int cnt = palette.GetColoursCount();
wxMGLBitmapHandler(wxBitmapType type,
const wxString& extension, const wxString& name);
- virtual bool Create(wxBitmap *bitmap, void *data, long flags,
- int width, int height, int depth = 1)
- { return FALSE; }
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap),
+ void *WXUNUSED(data),
+ long WXUNUSED(flags),
+ int WXUNUSED(width),
+ int WXUNUSED(height),
+ int WXUNUSED(depth) = 1)
+ { return false; }
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
- virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
+ virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
};
-wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
+wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
const wxString& extension,
const wxString& name)
: wxBitmapHandler()
SetExtension(extension);
}
-bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
- long flags,
- int WXUNUSED(desiredWidth),
+bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
+ long flags,
+ int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
int width, height, bpp;
pixel_format_t pf;
wxString fullname;
wxMemoryDC dc;
-
+
switch (flags)
{
case wxBITMAP_TYPE_BMP_RESOURCE:
default:
fullname= name;
break;
- }
+ }
switch (flags)
{
case wxBITMAP_TYPE_BMP:
case wxBITMAP_TYPE_BMP_RESOURCE:
if ( !MGL_getBitmapSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
- return FALSE;
+ return false;
bitmap->Create(width, height, -1);
- if ( !bitmap->Ok() ) return FALSE;
+ if ( !bitmap->Ok() ) return false;
dc.SelectObject(*bitmap);
if ( !dc.GetMGLDC()->loadBitmapIntoDC(fullname.mb_str(), 0, 0, TRUE) )
- return FALSE;
+ return false;
break;
case wxBITMAP_TYPE_JPEG:
case wxBITMAP_TYPE_JPEG_RESOURCE:
if ( !MGL_getJPEGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
- return FALSE;
+ return false;
bitmap->Create(width, height, -1);
- if ( !bitmap->Ok() ) return FALSE;
+ if ( !bitmap->Ok() ) return false;
dc.SelectObject(*bitmap);
if ( !dc.GetMGLDC()->loadJPEGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
- return FALSE;
+ return false;
break;
case wxBITMAP_TYPE_PNG:
case wxBITMAP_TYPE_PNG_RESOURCE:
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
- return FALSE;
+ return false;
bitmap->Create(width, height, -1);
- if ( !bitmap->Ok() ) return FALSE;
+ if ( !bitmap->Ok() ) return false;
dc.SelectObject(*bitmap);
if ( !dc.GetMGLDC()->loadPNGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
- return FALSE;
+ return false;
break;
case wxBITMAP_TYPE_PCX:
case wxBITMAP_TYPE_PCX_RESOURCE:
if ( !MGL_getPCXSize(fullname.mb_str(), &width, &height, &bpp) )
- return FALSE;
+ return false;
bitmap->Create(width, height, -1);
- if ( !bitmap->Ok() ) return FALSE;
+ if ( !bitmap->Ok() ) return false;
dc.SelectObject(*bitmap);
if ( !dc.GetMGLDC()->loadPCXIntoDC(fullname.mb_str(), 0, 0, TRUE) )
- return FALSE;
+ return false;
break;
default:
break;
}
- return TRUE;
+ return true;
}
-bool wxMGLBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
+bool wxMGLBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette * WXUNUSED(palette))
{
wxMemoryDC mem;
switch (type)
{
case wxBITMAP_TYPE_BMP:
- return tdc->saveBitmapFromDC(name.mb_str(), 0, 0, w, h);
- break;
+ return (bool)tdc->saveBitmapFromDC(name.mb_str(), 0, 0, w, h);
case wxBITMAP_TYPE_JPEG:
- return tdc->saveJPEGFromDC(name.mb_str(), 0, 0, w, h, 75);
- break;
+ return (bool)tdc->saveJPEGFromDC(name.mb_str(), 0, 0, w, h, 75);
case wxBITMAP_TYPE_PNG:
- return tdc->savePNGFromDC(name.mb_str(), 0, 0, w, h);
- break;
+ return (bool)tdc->savePNGFromDC(name.mb_str(), 0, 0, w, h);
case wxBITMAP_TYPE_PCX:
- return tdc->savePCXFromDC(name.mb_str(), 0, 0, w, h);
- break;
- default:
- return FALSE;
- break;
+ return (bool)tdc->savePCXFromDC(name.mb_str(), 0, 0, w, h);
}
+
+ return false;
}
-// let's handle PNGs in special way because they have alpha channel
+// let's handle PNGs in special way because they have alpha channel
// which we can access via bitmap_t most easily
class wxPNGBitmapHandler: public wxMGLBitmapHandler
{
int desiredWidth, int desiredHeight);
};
-bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
- long flags,
+bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
+ long flags,
int desiredWidth, int desiredHeight)
{
int width, height, bpp;
fullname = name;
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
- return FALSE;
+ return false;
if ( bpp != 32 )
{
// We can load ordinary PNGs faster with 'normal' MGL handler.
// Only RGBA PNGs need to be processed in special way because
// we have to convert alpha channel to mask
- return wxMGLBitmapHandler::LoadFile(bitmap, name, flags,
+ return wxMGLBitmapHandler::LoadFile(bitmap, name, flags,
desiredWidth, desiredHeight);
}
-
+
bitmap_t *bmp = MGL_loadPNG(fullname.mb_str(), TRUE);
-
- if ( bmp == NULL ) return FALSE;
+
+ if ( bmp == NULL ) return false;
bitmap->Create(bmp->width, bmp->height, -1);
- if ( !bitmap->Ok() ) return FALSE;
-
+ if ( !bitmap->Ok() ) return false;
+
// convert bmp to display's depth and write it to *bitmap:
wxMemoryDC dc;
dc.SelectObject(*bitmap);
dc.GetMGLDC()->putBitmap(0, 0, bmp, MGL_REPLACE_MODE);
dc.SelectObject(wxNullBitmap);
-
+
// create mask, if bmp contains alpha channel (ARGB format):
if ( bmp->bitsPerPixel == 32 )
{
s = ((wxUint32*)bmp->surface) + y * bmp->bytesPerLine/4;
for (x = 0; x < bmp->width; x++, s ++)
{
- if ( ((((*s) >> bmp->pf->alphaPos) & bmp->pf->alphaMask)
+ if ( ((((*s) >> bmp->pf->alphaPos) & bmp->pf->alphaMask)
<< bmp->pf->alphaAdjust) < 128 )
*s = 0;
else
dc.SelectObject(wxNullBitmap);
bitmap->SetMask(new wxMask(mask));
}
-
+
MGL_unloadBitmap(bmp);
-
- return TRUE;
+
+ return true;
}
public:
wxICOBitmapHandler(wxBitmapType type,
const wxString& extension, const wxString& name);
-
- virtual bool Create(wxBitmap *bitmap, void *data, long flags,
- int width, int height, int depth = 1)
- { return FALSE; }
-
+
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap),
+ void *WXUNUSED(data),
+ long WXUNUSED(flags),
+ int WXUNUSED(width),
+ int WXUNUSED(height),
+ int WXUNUSED(depth) = 1)
+ { return false; }
+
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
int desiredWidth, int desiredHeight);
- virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
+ virtual bool SaveFile(const wxBitmap *bitmap, const wxString& name,
int type, const wxPalette *palette = NULL);
};
-wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
+wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
const wxString& extension,
const wxString& name)
: wxBitmapHandler()
SetExtension(extension);
}
-bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
- long flags,
- int WXUNUSED(desiredWidth),
+bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
+ long flags,
+ int WXUNUSED(desiredWidth),
int WXUNUSED(desiredHeight))
{
icon_t *icon = NULL;
if ( flags == wxBITMAP_TYPE_ICO_RESOURCE )
icon = MGL_loadIcon(wxString(name + wxT(".ico")).mb_str(), TRUE);
- else
+ else
icon = MGL_loadIcon(name.mb_str(), TRUE);
- if ( icon == NULL ) return FALSE;
+ if ( icon == NULL ) return false;
bitmap->Create(icon->xorMask.width, icon->xorMask.height);
dc->clearDevice();
dc->putMonoImage(0, 0, icon->xorMask.width, icon->byteWidth,
icon->xorMask.height, (void*)icon->andMask);
-
+
bitmap->SetMask(new wxMask(mask));
MGL_unloadIcon(icon);
-
- return TRUE;
+
+ return true;
}
-bool wxICOBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
- int type, const wxPalette * WXUNUSED(palette))
+bool wxICOBitmapHandler::SaveFile(const wxBitmap *WXUNUSED(bitmap),
+ const wxString& WXUNUSED(name),
+ int WXUNUSED(type),
+ const wxPalette * WXUNUSED(palette))
{
- return FALSE;
+ return false;
}
mask->p[y] = 0;
for (x = 0; x < 8; x++)
if ( dc->getPixelFast(x, y) != 0 )
- mask->p[y] |= 1 << (7 - x);
+ mask->p[y] = (uchar)(mask->p[y] | (1 << (7 - x)));
}
dc->endPixel();
}
/////////////////////////////////////////////////////////////////////////////
-// Name: cursor.cpp
+// Name: src/mgl/cursor.cpp
// Purpose:
// Author: Vaclav Slavik
// Id: $Id$
case wxCURSOR_NONE:
*this = wxNullCursor;
return;
- break;
default:
wxFAIL_MSG(wxT("unsupported cursor type"));
break;
}
-
+
M_CURSORDATA->m_cursor = new MGLCursor(cursorname);
// if we cannot load arrow cursor, use MGL's default arrow cursor:
delete M_CURSORDATA->m_cursor;
M_CURSORDATA->m_cursor = new MGLCursor(MGL_DEF_CURSOR);
}
-
+
if ( !M_CURSORDATA->m_cursor->valid() )
{
wxLogError(_("Couldn't create cursor."));
else
{
(*gs_cursorsHash)[cursorId] = *this;
- wxLogTrace(_T("mglcursor"), _T("cursor id %i added to cache (%s)"),
+ wxLogTrace(_T("mglcursor"), _T("cursor id %i added to cache (%s)"),
cursorId, cursorname);
}
}
wxCursor::wxCursor(const wxString& cursor_file,
long flags,
- int hotSpotX, int hotSpotY)
+ int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY))
{
if ( flags == wxBITMAP_TYPE_CUR || flags == wxBITMAP_TYPE_CUR_RESOURCE )
{
{
if ( g_winMng )
MGL_wmSetGlobalCursor(g_winMng, NULL);
- gs_globalCursor = wxNullCursor;
+ gs_globalCursor = wxNullCursor;
}
}
class wxCursorModule : public wxModule
{
public:
- virtual bool OnInit() { return TRUE; }
-
+ virtual bool OnInit() { return true; }
+
virtual void OnExit()
{
wxDELETE(gs_cursorsHash);
/////////////////////////////////////////////////////////////////////////////
-// Name: mgl/data.cpp
+// Name: src/mgl/data.cpp
// Purpose: wxMGL-specific global data
// Author: Robert Roebling
// Id: $Id$
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
#include "wx/defs.h"
#include "wx/cursor.h"
wxCursor g_globalCursor;
/* Don't allow event propagation during drag */
-bool g_blockEventsOnDrag = FALSE;
+bool g_blockEventsOnDrag = false;
/* Don't allow mouse event propagation during scroll */
-bool g_blockEventsOnScroll = FALSE;
+bool g_blockEventsOnScroll = false;
/* Don't allow window closing if there are open dialogs */
int g_openDialogs = 0;
-/* TRUE when the message queue is empty. this gets set to
- FALSE by all event callbacks before anything else is done */
-bool g_isIdle = FALSE;
-
+/* true when the message queue is empty. this gets set to
+ false by all event callbacks before anything else is done */
+bool g_isIdle = false;
/////////////////////////////////////////////////////////////////////////////
-// Name: dc.cpp
+// Name: src/mgl/dc.cpp
// Purpose: wxDC class
// Author: Vaclav Slavik
// Created: 2001/03/09
// Default constructor
wxDC::wxDC()
{
- m_isMemDC = FALSE;
+ m_isMemDC = false;
m_MGLDC = NULL;
- m_OwnsMGLDC = FALSE;
- m_ok = FALSE; // must call SetMGLDevCtx() before using it
+ m_OwnsMGLDC = false;
+ m_ok = false; // must call SetMGLDevCtx() before using it
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
(double)wxGetDisplaySizeMM().GetWidth();
m_brush = *wxWHITE_BRUSH;
m_penOfsX = m_penOfsY = 0;
- m_penSelected = m_brushSelected = FALSE;
- m_downloadedPatterns[0] = m_downloadedPatterns[1] = FALSE;
+ m_penSelected = m_brushSelected = false;
+ m_downloadedPatterns[0] = m_downloadedPatterns[1] = false;
m_mglFont = NULL;
}
delete m_MGLDC;
m_MGLDC = mgldc;
m_OwnsMGLDC = OwnsMGLDC;
- m_ok = TRUE;
+ m_ok = true;
if ( !m_globalClippingRegion.IsNull() )
SetClippingRegion(m_globalClippingRegion);
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
- m_clipping = TRUE;
+ m_clipping = true;
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
}
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
- m_clipping = TRUE;
+ m_clipping = true;
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
}
{
m_MGLDC->setClipRegion(m_globalClippingRegion.GetMGLRegion());
m_currentClippingRegion = m_globalClippingRegion;
- m_clipping = TRUE;
+ m_clipping = true;
}
else
{
bool wxDC::CanDrawBitmap() const
{
- return TRUE;
+ return true;
}
bool wxDC::CanGetTextExtent() const
{
- return TRUE;
+ return true;
}
int wxDC::GetDepth() const
bool wxDC::DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const
{
- wxCHECK_MSG( col, FALSE, _T("NULL colour parameter in wxDC::GetPixel"));
+ wxCHECK_MSG( col, false, _T("NULL colour parameter in wxDC::GetPixel"));
uchar r, g, b;
m_MGLDC->unpackColorFast(m_MGLDC->getPixel(XLOG2DEV(x), YLOG2DEV(y)),
r, g, b);
col->Set(r, g, b);
- return TRUE;
+ return true;
}
void wxDC::DoCrossHair(wxCoord x, wxCoord y)
}
}
-void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int fillStyle)
+void wxDC::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset,int WXUNUSED(fillStyle))
{
wxCHECK_RET( Ok(), wxT("invalid dc") );
bool antialiased = (GetDepth() > 8);
m_mglFont = m_font.GetMGLfont_t(scale, antialiased);
- wxCHECK_MSG( m_mglFont, FALSE, wxT("invalid font") );
+ wxCHECK_MSG( m_mglFont, false, wxT("invalid font") );
m_MGLDC->useFont(m_mglFont);
wxLogTrace("mgl_font", "useFont(%p)", m_mglFont);
m_MGLDC->setTextEncoding(nativeEnc.mglEncoding);
#endif
}
- return TRUE;
+ return true;
}
void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
m_MGLDC->line(x1, y1, x2, y2);
}
- m_penSelected = m_brushSelected = FALSE;
+ m_penSelected = m_brushSelected = false;
}
void wxDC::DoDrawRotatedText(const wxString& text,
if ( !m_downloadedPatterns[slot] )
{
m_MGLDC->setPenBitmapPattern(slot, pattern);
- m_downloadedPatterns[slot] = TRUE;
+ m_downloadedPatterns[slot] = true;
}
m_MGLDC->usePenBitmapPattern(slot);
}
case 8:
for (y = 0; y < 8; y++)
for (x = 0; x < 8; x++)
- pix.b8.p[x][y] = m_MGLDC->packColorFast(
+ pix.b8.p[x][y] = (uchar)m_MGLDC->packColorFast(
pixPattern->p[x][y][0],
pixPattern->p[x][y][1],
pixPattern->p[x][y][2]);
case 16:
for (y = 0; y < 8; y++)
for (x = 0; x < 8; x++)
- pix.b16.p[x][y] = m_MGLDC->packColorFast(
+ pix.b16.p[x][y] = (M_uint16)m_MGLDC->packColorFast(
pixPattern->p[x][y][0],
pixPattern->p[x][y][1],
pixPattern->p[x][y][2]);
break;
}
m_MGLDC->setPenPixmapPattern(slot, &pix);
- m_downloadedPatterns[slot] = TRUE;
+ m_downloadedPatterns[slot] = true;
}
m_MGLDC->usePenPixmapPattern(slot);
}
SelectMGLFatPen(wxSOLID, wxMGL_SELECT_FROM_PEN);
break;
}
- m_penSelected = TRUE;
- m_brushSelected = FALSE;
+ m_penSelected = true;
+ m_brushSelected = false;
}
void wxDC::SelectBrush()
m_MGLDC->setColorRGB(fg.Red(), fg.Green(), fg.Blue());
m_MGLDC->setBackColor(m_MGLDC->packColorFast(bg.Red(), bg.Green(), bg.Blue()));
- m_penSelected = FALSE;
- m_brushSelected = TRUE;
+ m_penSelected = false;
+ m_brushSelected = true;
SelectMGLFatPen(m_brush.GetStyle(), wxMGL_SELECT_FROM_BRUSH);
}
if ( !pen.Ok() ) return;
if ( m_pen == pen ) return;
m_pen = pen;
- m_penSelected = FALSE;
- m_downloadedPatterns[0] = FALSE;
+ m_penSelected = false;
+ m_downloadedPatterns[0] = false;
}
void wxDC::SetBrush(const wxBrush& brush)
if ( !brush.Ok() ) return;
if ( m_brush == brush ) return;
m_brush = brush;
- m_brushSelected = FALSE;
- m_downloadedPatterns[1] = FALSE;
+ m_brushSelected = false;
+ m_downloadedPatterns[1] = false;
}
void wxDC::SetPalette(const wxPalette& palette)
return (int)rop;
}
-bool wxDC::StartDoc(const wxString& message)
+bool wxDC::StartDoc(const wxString& WXUNUSED(message))
{
- // We might be previewing, so return TRUE to let it continue.
- return TRUE;
+ // We might be previewing, so return true to let it continue.
+ return true;
}
void wxDC::EndDoc()
m_mglFont = NULL;
// make sure m_penOfs{X,Y} will be reevaluated before drawing:
if ( newY != m_scaleY || newX != m_scaleX )
- m_penSelected = FALSE;
+ m_penSelected = false;
m_scaleX = newX, m_scaleY = newY;
}
int rop, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask)
{
- wxCHECK_MSG( Ok(), FALSE, wxT("invalid dc") );
- wxCHECK_MSG( source, FALSE, wxT("invalid source dc") );
+ wxCHECK_MSG( Ok(), false, wxT("invalid dc") );
+ wxCHECK_MSG( source, false, wxT("invalid source dc") );
// transform the source DC coords to the device ones
xsrc = source->LogicalToDeviceX(xsrc);
xx, yy, LogicalFunctionToMGLRop(rop));
}
- return TRUE;
+ return true;
}
void wxDC::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask)
void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
- DoDrawBitmap((const wxBitmap&)icon, x, y, (bool)TRUE);
+ DoDrawBitmap((const wxBitmap&)icon, x, y, true);
}
{
temp = new MGLMemoryDC(dw, dh, GetDepth(), NULL);
wxDC tempdc;
- tempdc.SetMGLDC(temp, FALSE);
+ tempdc.SetMGLDC(temp, false);
tempdc.SetPalette(m_palette);
}
else
///////////////////////////////////////////////////////////////////////////////
-// Name: mgl/evtloop.cpp
+// Name: src/mgl/evtloop.cpp
// Purpose: implements wxEventLoop for MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
wxEventLoopImpl()
{
SetExitCode(0);
- SetKeepLooping(TRUE);
+ SetKeepLooping(true);
}
// process an event
void Dispatch();
- // generate an idle event, return TRUE if more idle time requested
+ // generate an idle event, return true if more idle time requested
bool SendIdleEvent();
// set/get the exit code
void SetExitCode(int exitcode) { m_exitcode = exitcode; }
int GetExitCode() const { return m_exitcode; }
-
+
void SetKeepLooping(bool k) { m_keepLooping = k; }
bool GetKeepLooping() const { return m_keepLooping; }
// the exit code of the event loop
int m_exitcode;
- // FALSE if the loop should end
+ // false if the loop should end
bool m_keepLooping;
};
PM_sleep(10);
}
// end of EVT_halt
-
+
MGL_wmProcessEvent(g_winMng, &evt);
}
wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") );
m_impl = new wxEventLoopImpl;
-
+
wxEventLoop *oldLoop = ms_activeLoop;
ms_activeLoop = this;
wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );
m_impl->SetExitCode(rc);
- m_impl->SetKeepLooping(FALSE);
-
+ m_impl->SetKeepLooping(false);
+
// Send a dummy event so that the app won't block in EVT_halt if there
// are no user-generated events in the queue:
EVT_post(0, EVT_USEREVT, 0, 0);
bool wxEventLoop::Pending() const
{
- // update the display here, so that wxYield refreshes display and
+ // update the display here, so that wxYield refreshes display and
// changes take effect immediately, not after emptying events queue:
MGL_wmUpdateDC(g_winMng);
-
+
// is there an event in the queue?
event_t evt;
- return EVT_peekNext(&evt, EVT_EVERYEVT);
+ return (bool)(EVT_peekNext(&evt, EVT_EVERYEVT));
}
bool wxEventLoop::Dispatch()
{
- wxCHECK_MSG( IsRunning(), FALSE, _T("can't call Dispatch() if not running") );
+ wxCHECK_MSG( IsRunning(), false, _T("can't call Dispatch() if not running") );
m_impl->Dispatch();
return m_impl->GetKeepLooping();
/////////////////////////////////////////////////////////////////////////////
-// Name: mgl/fontutil.cpp
+// Name: src/mgl/fontutil.cpp
// Purpose: Font helper functions for MGL
// Author: Vaclav Slavik
// Created: 2001/04/29
wxString encid = tokenizer.GetNextToken();
long enc;
if ( !encid.ToLong(&enc) )
- return FALSE;
+ return false;
encoding = (wxFontEncoding)enc;
// ok even if empty
facename = tokenizer.GetNextToken();
- return TRUE;
+ return true;
}
wxString wxNativeEncodingInfo::ToString() const
{
wxString s;
s << (long)encoding;
- if ( !!facename )
+ if ( !facename.empty() )
{
s << _T(';') << facename;
}
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo *info)
{
- wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") );
+ wxCHECK_MSG( info, false, _T("bad pointer in wxGetNativeFontEncoding") );
if ( encoding == wxFONTENCODING_DEFAULT )
{
default:
// encoding not known to MGL
- return FALSE;
+ return false;
}
info->encoding = encoding;
- return TRUE;
+ return true;
}
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
{
if ( !info.facename )
- return TRUE;
-
+ return true;
+
wxMGLFontFamily *family = wxTheFontsManager->GetFamily(info.facename);
if ( !family )
- return FALSE;
+ return false;
if ( family->GetInfo()->fontLibType == MGL_BITMAPFONT_LIB )
return (info.mglEncoding == MGL_ENCODING_ASCII ||
info.mglEncoding == MGL_ENCODING_ISO8859_1 ||
info.mglEncoding == MGL_ENCODING_ISO8859_15 ||
info.mglEncoding == MGL_ENCODING_CP1252);
else
- return TRUE;
+ return true;
}
WX_DEFINE_LIST(wxMGLFontInstanceList);
WX_DEFINE_LIST(wxMGLFontFamilyList);
-wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *fontLib,
+wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *fontLib,
float pt, bool slant, bool aa)
{
m_fontLib = fontLib;
float slantAngle = m_slant ? 15.0 : 0.0;
- wxLogTrace("mgl_font", "loading instance of '%s' slant=%i pt=%0.1f aa=%i",
+ wxLogTrace("mgl_font", "loading instance of '%s' slant=%i pt=%0.1f aa=%i",
m_fontLib->GetMGLfont_lib_t()->name, m_slant, m_pt, m_aa);
- m_font = MGL_loadFontInstance(m_fontLib->GetMGLfont_lib_t(),
+ m_font = MGL_loadFontInstance(m_fontLib->GetMGLfont_lib_t(),
m_pt, slantAngle, 0.0, aa);
wxASSERT_MSG( m_font, wxT("Cannot create font instance.") );
}
wxMGLFontInstance::~wxMGLFontInstance()
{
- wxLogTrace("mgl_font", "unloading instance of '%s' slant=%i pt=%0.1f aa=%i",
+ wxLogTrace("mgl_font", "unloading instance of '%s' slant=%i pt=%0.1f aa=%i",
m_fontLib->GetMGLfont_lib_t()->name, m_slant, m_pt, m_aa);
if ( m_font )
MGL_unloadFontInstance(m_font);
}
-
-wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
+
+wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
wxMGLFontFamily *parentFamily)
{
m_family = parentFamily;
m_fontLib = NULL;
m_instances = new wxMGLFontInstanceList;
- m_instances->DeleteContents(TRUE);
+ m_instances->DeleteContents(true);
}
wxMGLFontLibrary::~wxMGLFontLibrary()
wxLogTrace("mgl_font", "font library dtor '%s'", m_fileName.mb_str());
delete m_instances;
}
-
+
void wxMGLFontLibrary::IncRef()
{
wxLogTrace("mgl_font", "incRef(%u) '%s'", m_refs, m_fileName.c_str());
static int gs_antialiasingThreshold = -1;
-wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
+wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
float scale, bool aa)
{
wxASSERT_MSG(m_refs > 0 && m_fontLib, wxT("font library not loaded!"));
wxString facename;
- bool slant;
- bool antialiased;
float pt = (float)font->GetPointSize() * scale;
if ( gs_antialiasingThreshold == -1 )
gs_antialiasingThreshold = 10;
#if wxUSE_SYSTEM_OPTIONS
if ( wxSystemOptions::HasOption(wxT("mgl.aa-threshold")) )
- gs_antialiasingThreshold =
+ gs_antialiasingThreshold =
wxSystemOptions::GetOptionInt(wxT("mgl.aa-threshold"));
wxLogTrace("mgl_font", "AA threshold set to %i", gs_antialiasingThreshold);
#endif
// Small characters don't look good when antialiased with the algorithm
// that FreeType uses (mere 2x2 supersampling), so lets disable it AA
// completely for small fonts.
- if ( pt <= gs_antialiasingThreshold )
- antialiased = FALSE;
- else
- antialiased = (m_fontLib->fontLibType == MGL_BITMAPFONT_LIB) ? FALSE : aa;
+ bool antialiased = false;
+ if (( pt > gs_antialiasingThreshold ) &&
+ ( m_fontLib->fontLibType != MGL_BITMAPFONT_LIB ) )
+ antialiased = aa;
- slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
+ bool slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
(font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
// FIXME_MGL -- MGL does not yet support slant, although the API is there
- slant = FALSE;
+ slant = false;
- wxLogTrace("mgl_font", "requested instance of '%s' slant=%i pt=%0.1f aa=%i",
+ wxLogTrace("mgl_font", "requested instance of '%s' slant=%i pt=%0.1f aa=%i",
m_fileName.mb_str(), slant, pt, antialiased);
wxMGLFontInstance *i;
wxMGLFontInstanceList::Node *node;
-
+
for (node = m_instances->GetFirst(); node; node = node->GetNext())
{
i = node->GetData();
if ( i->GetPt() == pt && i->GetSlant() == slant &&
i->GetAA() == antialiased )
{
- wxLogTrace("mgl_font", " got from cache: slant=%i pt=%0.1f aa=%i",
+ wxLogTrace("mgl_font", " got from cache: slant=%i pt=%0.1f aa=%i",
i->GetSlant(), i->GetPt(), i->GetAA());
return i;
}
- }
-
+ }
+
i = new wxMGLFontInstance(this, pt, slant, antialiased);
m_instances->Append(i);
- return i;
+ return i;
}
{
m_name = info->familyName;
m_fontInfo = info;
-
+
if ( info->regularFace[0] == '\0' )
m_fontLibs[wxFONTFACE_REGULAR] = NULL;
else
- m_fontLibs[wxFONTFACE_REGULAR] =
+ m_fontLibs[wxFONTFACE_REGULAR] =
new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR, this);
-
+
if ( info->italicFace[0] == '\0' )
m_fontLibs[wxFONTFACE_ITALIC] = NULL;
else
- m_fontLibs[wxFONTFACE_ITALIC] =
+ m_fontLibs[wxFONTFACE_ITALIC] =
new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC, this);
-
+
if ( info->boldFace[0] == '\0' )
m_fontLibs[wxFONTFACE_BOLD] = NULL;
else
- m_fontLibs[wxFONTFACE_BOLD] =
+ m_fontLibs[wxFONTFACE_BOLD] =
new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD, this);
-
+
if ( info->boldItalicFace[0] == '\0' )
m_fontLibs[wxFONTFACE_BOLD_ITALIC] = NULL;
else
- m_fontLibs[wxFONTFACE_BOLD_ITALIC] =
+ m_fontLibs[wxFONTFACE_BOLD_ITALIC] =
new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC, this);
-
+
wxLogTrace("mgl_font", "new family '%s' (r=%s, i=%s, b=%s, bi=%s)\n",
- info->familyName, info->regularFace, info->italicFace,
+ info->familyName, info->regularFace, info->italicFace,
info->boldFace, info->boldItalicFace);
}
wxMGLFontFamily *family;
int type;
wxString facename = font->GetFaceName();
-
- if ( !facename.IsEmpty() )
+
+ if ( !facename.empty() )
family = GetFamily(facename);
else
family = NULL;
break;
}
}
-
+
return family->GetLibrary(type);
}
wxFontsManager::wxFontsManager()
{
m_hash = new wxHashTable(wxKEY_STRING);
- m_hash->DeleteContents(FALSE);
+ m_hash->DeleteContents(false);
m_list = new wxMGLFontFamilyList;
- m_list->DeleteContents(TRUE);
+ m_list->DeleteContents(true);
MGL_enumerateFonts(enum_callback, (void*)this);
}
m_hash->Put(f->GetName().Lower(), f);
m_list->Append(f);
}
-
+
wxMGLFontFamily *wxFontsManager::GetFamily(const wxString& name) const
{
return (wxMGLFontFamily*)m_hash->Get(name.Lower());
/////////////////////////////////////////////////////////////////////////////
-// Name: region.cpp
+// Name: src/mgl/region.cpp
// Purpose: Region handling for wxWidgets/MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
}
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
-{
+{
m_refData = new wxRegionRefData;
MGLRect rect(x, y, x + w, y + h);
M_REGION = rect;
// Outer bounds of region
void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
{
- if (m_refData)
+ if (m_refData)
{
rect_t rect;
rect = M_REGION.getBounds();
y = rect.top;
w = rect.right - rect.left;
h = rect.bottom - rect.top;
- }
- else
+ }
+ else
{
x = y = w = h = 0;
}
// Is region empty?
bool wxRegion::Empty() const
{
- if (!m_refData) return TRUE;
- return M_REGION.isEmpty();
+ if (!m_refData)
+ return true;
+
+ return (bool)(M_REGION.isEmpty());
}
//-----------------------------------------------------------------------------
{
AllocExclusive();
M_REGION.offset(x, y);
- return TRUE;
+ return true;
}
// Union rectangle or region with this.
{
AllocExclusive();
M_REGION += MGLRect(x, y, x + width, y + height);
- return TRUE;
+ return true;
}
bool wxRegion::Union(const wxRegion& region)
{
AllocExclusive();
M_REGION += M_REGION_OF(region);
- return TRUE;
+ return true;
}
// Intersect rectangle or region with this.
{
AllocExclusive();
M_REGION &= MGLRect(x, y, x + width, y + height);
- return TRUE;
+ return true;
}
bool wxRegion::Intersect(const wxRegion& region)
{
AllocExclusive();
M_REGION &= M_REGION_OF(region);
- return TRUE;
+ return true;
}
// Subtract rectangle or region from this:
{
AllocExclusive();
M_REGION -= MGLRect(x, y, x + width, y + height);
- return TRUE;
+ return true;
}
bool wxRegion::Subtract(const wxRegion& region)
{
AllocExclusive();
M_REGION -= M_REGION_OF(region);
- return TRUE;
+ return true;
}
// XOR: the union of two combined regions except for any overlapping areas.
MGLRegion rg1 = M_REGION + rect,
rg2 = M_REGION & rect;
M_REGION = rg1 - rg2;
- return TRUE;
+ return true;
}
bool wxRegion::Xor(const wxRegion& region)
MGLRegion rg1 = M_REGION + M_REGION_OF(region),
rg2 = M_REGION & M_REGION_OF(region);
M_REGION = rg1 - rg2;
- return TRUE;
+ return true;
}
MGLRect rect(x, y, x + w, y + h);
MGLRegion rg;
-
+
// 1) is the rectangle entirely covered by the region?
rg = MGLRegion(rect) - M_REGION;
if (rg.isEmpty()) return wxInRegion;
-
+
// 2) is the rectangle completely outside the region?
rg = M_REGION & rect; // intersection
if (rg.isEmpty()) return wxOutRegion;
virtual bool OnInit()
{
gs_mutexIterator = new wxMutex();
- return TRUE;
+ return true;
}
virtual void OnExit()
{
*/
wxRegionIterator::wxRegionIterator() : m_currentNode(NULL)
{
- m_rects.DeleteContents(TRUE);
+ m_rects.DeleteContents(true);
}
wxRegionIterator::~wxRegionIterator()
*/
wxRegionIterator::wxRegionIterator(const wxRegion& region)
{
- m_rects.DeleteContents(TRUE);
+ m_rects.DeleteContents(true);
Reset(region);
}
/*
* Reset iterator for a new /e region.
*/
-
+
static wxRegionRectList *gs_rectList;
static void MGLAPI wxMGL_region_callback(const rect_t *r)
{
- gs_rectList->Append(new wxRect(r->left, r->top,
+ gs_rectList->Append(new wxRect(r->left, r->top,
r->right - r->left, r->bottom - r->top));
}
-
+
void wxRegionIterator::Reset(const wxRegion& region)
{
m_currentNode = NULL;
if (!region.Empty())
{
#if wxUSE_THREADS
- wxMutexLocker(*gs_mutexIterator);
+ wxMutexLocker lock(*gs_mutexIterator);
#endif
gs_rectList = &m_rects;
M_REGION_OF(region).traverse(wxMGL_region_callback);
/////////////////////////////////////////////////////////////////////////////
-// Name: settings.h
+// Name: src/mgl/settings.cpp
// Author: Vaclav Slavik, Robert Roebling
// Id: $Id$
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
class wxSystemSettingsModule : public wxModule
{
public:
- virtual bool OnInit() { return TRUE; }
+ virtual bool OnInit() { return true; }
virtual void OnExit()
{
delete gs_fontDefault;
case wxSYS_DEFAULT_GUI_FONT:
{
if ( !gs_fontDefault )
- gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, FALSE, "Arial");
+ gs_fontDefault = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL, false, "Arial");
return *gs_fontDefault;
}
- default:
- return wxNullFont;
}
+
+ return wxNullFont;
}
int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
{
int val;
-
+
switch (index)
{
case wxSYS_SCREEN_X:
return val;
case wxSYS_VSCROLL_X:
case wxSYS_HSCROLL_Y:
- return 15;
- break;
- default:
- return -1; // unsupported metric
+ return 15;
}
+
+ return -1; // unsupported metric
}
bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
{
switch (index)
{
- case wxSYS_CAN_ICONIZE_FRAME:
- return FALSE; break;
+ case wxSYS_CAN_ICONIZE_FRAME:
+ return false;
case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
- return FALSE; break;
- default:
- return FALSE;
+ return false;
}
+
+ return false;
}
event.SetTimestamp(e->when);
event.m_x = where.x - orig.x;
event.m_y = where.y - orig.y;
- event.m_shiftDown = e->modifiers & EVT_SHIFTKEY;
- event.m_controlDown = e->modifiers & EVT_CTRLSTATE;
- event.m_altDown = e->modifiers & EVT_LEFTALT;
- event.m_metaDown = e->modifiers & EVT_RIGHTALT;
- event.m_leftDown = e->modifiers & EVT_LEFTBUT;
- event.m_middleDown = e->modifiers & EVT_MIDDLEBUT;
- event.m_rightDown = e->modifiers & EVT_RIGHTBUT;
+ event.m_shiftDown = ( e->modifiers & EVT_SHIFTKEY ) == EVT_SHIFTKEY;
+ event.m_controlDown = ( e->modifiers & EVT_CTRLSTATE ) == EVT_CTRLSTATE;
+ event.m_altDown = ( e->modifiers & EVT_LEFTALT ) == EVT_LEFTALT;
+ event.m_metaDown = ( e->modifiers & EVT_RIGHTALT ) == EVT_RIGHTALT;
+ event.m_leftDown = ( e->modifiers & EVT_LEFTBUT ) == EVT_LEFTBUT;
+ event.m_middleDown = ( e->modifiers & EVT_MIDDLEBUT ) == EVT_MIDDLEBUT;
+ event.m_rightDown = ( e->modifiers & EVT_RIGHTBUT ) == EVT_RIGHTBUT;
switch (e->what)
{
)
{
wxCaptureScreenshot(event.m_altDown/*only active wnd?*/);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
static ibool MGLAPI wxWindowKeybHandler(window_t *wnd, event_t *e)
wxKeyEvent event;
event.SetEventObject(win);
event.SetTimestamp(e->when);
- event.m_keyCode = wxScanToKeyCode(e, TRUE);
+ event.m_keyCode = wxScanToKeyCode(e, true);
event.m_scanCode = 0; // not used by wx at all
event.m_x = where.x;
event.m_y = where.y;
- event.m_shiftDown = e->modifiers & EVT_SHIFTKEY;
- event.m_controlDown = e->modifiers & EVT_CTRLSTATE;
- event.m_altDown = e->modifiers & EVT_LEFTALT;
- event.m_metaDown = e->modifiers & EVT_RIGHTALT;
+ event.m_shiftDown = ( e->modifiers & EVT_SHIFTKEY ) == EVT_SHIFTKEY;
+ event.m_controlDown = ( e->modifiers & EVT_CTRLSTATE ) == EVT_CTRLSTATE;
+ event.m_altDown = ( e->modifiers & EVT_LEFTALT ) == EVT_LEFTALT;
+ event.m_metaDown = ( e->modifiers & EVT_RIGHTALT ) == EVT_RIGHTALT;
if ( e->what == EVT_KEYUP )
{
// wxMSW doesn't send char events with Alt pressed
// Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
// will only be sent if it is not in an accelerator table:
- event2.m_keyCode = wxScanToKeyCode(e, FALSE);
+ event2.m_keyCode = wxScanToKeyCode(e, false);
if ( !ret && event2.m_keyCode != 0 )
{
event2.SetEventType(wxEVT_CHAR);
// mgl specific:
m_wnd = NULL;
- m_isShown = TRUE;
- m_frozen = FALSE;
+ m_isShown = true;
+ m_frozen = false;
m_paintMGLDC = NULL;
m_eraseBackground = -1;
}
{
SendDestroyEvent();
- m_isBeingDeleted = TRUE;
+ m_isBeingDeleted = true;
if ( gs_mouseCapture == this )
ReleaseMouse();
const wxString& name)
{
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
- return FALSE;
+ return false;
if ( parent )
parent->AddChild(this);
{
mgl_style |= MGL_WM_ALWAYS_ON_TOP;
// it is created hidden as other top level windows
- m_isShown = FALSE;
+ m_isShown = false;
wnd_parent = NULL;
}
SetMGLwindow_t(wnd);
- return TRUE;
+ return true;
}
void wxWindowMGL::SetMGLwindow_t(struct window_t *wnd)
m_wnd = wnd;
if ( !m_wnd ) return;
- m_isShown = m_wnd->visible;
+ m_isShown = (bool)m_wnd->visible;
MGL_wmSetWindowUserData(m_wnd, (void*) this);
MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
{
if ( gs_activeFrame )
{
- wxActivateEvent event(wxEVT_ACTIVATE, FALSE, gs_activeFrame->GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE, false, gs_activeFrame->GetId());
event.SetEventObject(gs_activeFrame);
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
}
gs_activeFrame = active;
- wxActivateEvent event(wxEVT_ACTIVATE, TRUE, gs_activeFrame->GetId());
+ wxActivateEvent event(wxEVT_ACTIVATE, true, gs_activeFrame->GetId());
event.SetEventObject(gs_activeFrame);
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
}
bool wxWindowMGL::Show(bool show)
{
if ( !wxWindowBase::Show(show) )
- return FALSE;
+ return false;
MGL_wmShowWindow(m_wnd, show);
}
}
- return TRUE;
+ return true;
}
// Raise the window to the top of the Z order
if ( !wxWindowBase::SetCursor(cursor) )
{
// no change
- return FALSE;
+ return false;
}
if ( m_cursor.Ok() )
else
MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor());
- return TRUE;
+ return true;
}
void wxWindowMGL::WarpPointer(int x, int y)
bool wxWindowMGL::Reparent(wxWindowBase *parent)
{
if ( !wxWindowBase::Reparent(parent) )
- return FALSE;
+ return false;
MGL_wmReparentWindow(m_wnd, parent->GetHandle());
- return TRUE;
+ return true;
}
// old style file-manager drag&drop support: we retain the old-style
// DragAcceptFiles in parallel with SetDropTarget.
-void wxWindowMGL::DragAcceptFiles(bool accept)
+void wxWindowMGL::DragAcceptFiles(bool WXUNUSED(accept))
{
#if 0 // FIXME_MGL
HWND hWnd = GetHwnd();
{
DoMoveWindow(x, y, width, height);
- wxSizeEvent event(wxSize(width, height), GetId());
+ wxSize newSize(width, height);
+ wxSizeEvent event(newSize, GetId());
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
}
void wxWindowMGL::Freeze()
{
- m_frozen = TRUE;
- m_refreshAfterThaw = FALSE;
+ m_frozen = true;
+ m_refreshAfterThaw = false;
}
void wxWindowMGL::Thaw()
{
- m_frozen = FALSE;
+ m_frozen = false;
if ( m_refreshAfterThaw )
Refresh();
}
if ( m_frozen )
{
// Don't paint anything if the window is frozen.
- m_refreshAfterThaw = TRUE;
+ m_refreshAfterThaw = true;
return;
}
/////////////////////////////////////////////////////////////////////////////
-// Name: src/palmos/dir.cpp
-// Purpose: wxDir implementation for PalmOS
-// Author: William Osborne - minimal working wxPalmOS port
+// Name: src/msdos/dir.cpp
+// Purpose: wxDir implementation for DOS
+// Author: derived from wxPalmOS code
// Modified by:
// Created: 10.13.04
// RCS-ID: $Id$
// ----------------------------------------------------------------------------
/* static */
-bool wxDir::Exists(const wxString& dir)
+bool wxDir::Exists(const wxString& WXUNUSED(dir))
{
return false;
}
// wxDir construction/destruction
// ----------------------------------------------------------------------------
-wxDir::wxDir(const wxString& dirname)
+wxDir::wxDir(const wxString& WXUNUSED(dirname))
{
}
-bool wxDir::Open(const wxString& dirname)
+bool wxDir::Open(const wxString& WXUNUSED(dirname))
{
return false;
}
wxString wxDir::GetName() const
{
- wxString name;
-
- return name;
+ return wxEmptyString;
}
wxDir::~wxDir()
// wxDir enumerating
// ----------------------------------------------------------------------------
-bool wxDir::GetFirst(wxString *filename,
- const wxString& filespec,
- int flags) const
+bool wxDir::GetFirst(wxString *WXUNUSED(filename),
+ const wxString& WXUNUSED(filespec),
+ int WXUNUSED(flags)) const
{
return false;
}
-bool wxDir::GetNext(wxString *filename) const
+bool wxDir::GetNext(wxString *WXUNUSED(filename)) const
{
return false;
}
-
/////////////////////////////////////////////////////////////////////////////
-// Name: mac/mimetype.cpp
+// Name: src/msdos/mimetype.cpp
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
// in case we're compiling in non-GUI mode
class WXDLLEXPORT wxIcon;
-bool wxFileTypeImpl::SetCommand(const wxString& cmd, const wxString& verb, bool overwriteprompt)
+bool wxFileTypeImpl::SetCommand(const wxString& WXUNUSED(cmd),
+ const wxString& WXUNUSED(verb),
+ bool WXUNUSED(overwriteprompt))
{
- return FALSE;
+ return false;
}
-bool wxFileTypeImpl::SetDefaultIcon(const wxString& strIcon, int index)
+bool wxFileTypeImpl::SetDefaultIcon(const wxString& WXUNUSED(strIcon),
+ int WXUNUSED(index))
{
- return FALSE;
+ return false;
}
-bool wxFileTypeImpl::GetCommand(wxString *command, const char *verb) const
+bool wxFileTypeImpl::GetCommand(wxString *WXUNUSED(command),
+ const char *WXUNUSED(verb)) const
{
- return FALSE;
+ return false;
}
-// @@ this function is half implemented
-bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
+bool wxFileTypeImpl::GetExtensions(wxArrayString& WXUNUSED(extensions))
{
- return FALSE;
+ return false;
}
bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
if ( m_strFileType.Length() > 0 )
{
*mimeType = m_strFileType ;
- return TRUE ;
+ return true ;
}
else
- return FALSE;
+ return false;
}
bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
{
wxString s;
-
+
if (GetMimeType(&s))
{
mimeTypes.Clear();
mimeTypes.Add(s);
- return TRUE;
+ return true;
}
- else
- return FALSE;
+ else
+ return false;
}
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
{
// no such file type or no value or incorrect icon entry
- return FALSE;
+ return false;
}
-bool wxFileTypeImpl::GetDescription(wxString *desc) const
+bool wxFileTypeImpl::GetDescription(wxString *WXUNUSED(desc)) const
{
- return FALSE;
+ return false;
}
size_t
-wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
- const wxFileType::MessageParameters& params) const
+wxFileTypeImpl::GetAllCommands(wxArrayString * WXUNUSED(verbs),
+ wxArrayString * WXUNUSED(commands),
+ const wxFileType::MessageParameters& WXUNUSED(params)) const
{
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
return 0;
}
void
-wxMimeTypesManagerImpl::Initialize(int mailcapStyles, const wxString& extraDir)
+wxMimeTypesManagerImpl::Initialize(int WXUNUSED(mailcapStyles),
+ const wxString& WXUNUSED(extraDir))
{
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
}
// MIME type -> extension -> file type
wxFileType *
-wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
+wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& WXUNUSED(mimeType))
{
return NULL;
}
-size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
+size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& WXUNUSED(mimetypes))
{
// VZ: don't know anything about this for Mac
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
}
wxFileType *
-wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
+wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& WXUNUSED(ftInfo))
{
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
}
bool
-wxMimeTypesManagerImpl::Unassociate(wxFileType *ft)
+wxMimeTypesManagerImpl::Unassociate(wxFileType *WXUNUSED(ft))
{
- return FALSE;
+ return false;
}
#endif // wxUSE_MIMETYPE