wxMGL revitalised with OpenWatcom.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-10-31 17:14:55 +00:00
parent b8af111fa5
commit 127eab18f8
16 changed files with 497 additions and 483 deletions

View File

@@ -171,7 +171,7 @@
// 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

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: common/appcmn.cpp
// Name: src/common/appcmn.cpp
// Purpose: wxAppConsole and wxAppBase methods common to all platforms
// Author: Vadim Zeitlin
// Modified by:
@@ -581,13 +581,13 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object)
#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
@@ -605,4 +605,3 @@ GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable()
}
#endif

View File

@@ -287,7 +287,7 @@ wxString wxFileConfig::GetGlobalDir()
#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
@@ -551,21 +551,21 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv)
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();
}
// ----------------------------------------------------------------------------
@@ -738,59 +738,59 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
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[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;
pNextGroup = m_pCurrentGroup->AddSubgroup(aParts[n]);
if ( strPath.empty() ) {
SetRootPath();
return true;
}
m_pCurrentGroup = pNextGroup;
}
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);
}
// recombine path parts in one variable
m_strPath.Empty();
for ( n = 0; n < aParts.Count(); n++ ) {
m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n];
}
// 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;
return true;
pNextGroup = m_pCurrentGroup->AddSubgroup(aParts[n]);
}
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];
}
return true;
}
void wxFileConfig::SetPath(const wxString& strPath)
{
DoSetPath(strPath, true /* create missing path components */);
DoSetPath(strPath, true /* create missing path components */);
}
// ----------------------------------------------------------------------------
@@ -799,66 +799,66 @@ void wxFileConfig::SetPath(const wxString& strPath)
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;
}
// ----------------------------------------------------------------------------
@@ -867,28 +867,28 @@ size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
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;
}
// ----------------------------------------------------------------------------
@@ -897,16 +897,16 @@ bool wxFileConfig::HasEntry(const wxString& strName) const
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

View File

@@ -267,7 +267,9 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
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());

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.cpp
// Name: src/mgl/bitmap.cpp
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
@@ -33,19 +33,19 @@
//-----------------------------------------------------------------------------
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
@@ -56,13 +56,13 @@ static pixel_format_t gs_pixel_format_wxImage =
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));
}
@@ -105,13 +105,14 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
{
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);
@@ -123,8 +124,8 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
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));
@@ -135,11 +136,11 @@ bool wxMask::Create(const wxBitmap& bitmap)
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;
}
@@ -193,7 +194,7 @@ wxBitmap::wxBitmap(int width, int height, int depth)
}
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);
@@ -204,9 +205,10 @@ bool wxBitmap::Create(int width, int height, int depth)
{
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 )
@@ -215,7 +217,7 @@ bool wxBitmap::Create(int width, int height, int 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:
@@ -236,8 +238,7 @@ bool wxBitmap::Create(int width, int height, int depth)
break;
default:
wxASSERT_MSG( 0, wxT("invalid bitmap depth") );
return FALSE;
break;
return false;
}
m_refData = new wxBitmapRefData();
@@ -255,7 +256,7 @@ bool wxBitmap::Create(int width, int height, int depth)
{
// 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));
@@ -266,15 +267,15 @@ bool wxBitmap::Create(int width, int height, int depth)
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)
@@ -282,12 +283,12 @@ 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") );
@@ -299,13 +300,13 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
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));
}
@@ -318,17 +319,17 @@ wxImage wxBitmap::ConvertToImage() const
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
@@ -337,17 +338,17 @@ wxImage wxBitmap::ConvertToImage() const
// 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);
}
@@ -440,7 +441,7 @@ bool wxBitmap::CopyFromIcon(const wxIcon& icon)
{
wxBitmap *bmp = (wxBitmap*)(&icon);
*this = *bmp;
return TRUE;
return true;
}
wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const
@@ -457,7 +458,7 @@ 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;
@@ -501,14 +502,14 @@ MGLDevCtx *wxBitmap::CreateTmpDC() const
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;
@@ -519,43 +520,43 @@ MGLDevCtx *wxBitmap::CreateTmpDC() const
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;
}
}
@@ -566,11 +567,11 @@ bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type)
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 )
@@ -581,7 +582,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, const wxPal
else
{
wxLogError("no bitmap handler for type %d defined.", type);
return FALSE;
return false;
}
}
@@ -604,7 +605,7 @@ void wxBitmap::SetPalette(const wxPalette& palette)
M_BMPDATA->m_palette = NULL;
if ( !palette.Ok() ) return;
M_BMPDATA->m_palette = new wxPalette(palette);
int cnt = palette.GetColoursCount();
@@ -650,17 +651,21 @@ public:
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()
@@ -670,16 +675,16 @@ wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
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:
@@ -691,52 +696,52 @@ bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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:
@@ -744,10 +749,10 @@ bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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;
@@ -761,26 +766,21 @@ bool wxMGLBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
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
{
@@ -793,8 +793,8 @@ public:
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;
@@ -807,30 +807,30 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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 )
{
@@ -841,7 +841,7 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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
@@ -854,10 +854,10 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
dc.SelectObject(wxNullBitmap);
bitmap->SetMask(new wxMask(mask));
}
MGL_unloadBitmap(bmp);
return TRUE;
return true;
}
@@ -868,18 +868,22 @@ class wxICOBitmapHandler: public wxBitmapHandler
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()
@@ -889,9 +893,9 @@ wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
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;
@@ -899,10 +903,10 @@ bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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);
@@ -922,18 +926,20 @@ bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
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;
}

View File

@@ -59,7 +59,7 @@ void wxBitmapToPixPattern(const wxBitmap& bitmap,
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();
}

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.cpp
// Name: src/mgl/cursor.cpp
// Purpose:
// Author: Vaclav Slavik
// Id: $Id$
@@ -109,13 +109,12 @@ wxCursor::wxCursor(int cursorId)
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:
@@ -124,7 +123,7 @@ wxCursor::wxCursor(int cursorId)
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."));
@@ -133,7 +132,7 @@ wxCursor::wxCursor(int cursorId)
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);
}
}
@@ -150,7 +149,7 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[],
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 )
{
@@ -226,7 +225,7 @@ void wxSetCursor(const wxCursor& cursor)
{
if ( g_winMng )
MGL_wmSetGlobalCursor(g_winMng, NULL);
gs_globalCursor = wxNullCursor;
gs_globalCursor = wxNullCursor;
}
}
@@ -285,8 +284,8 @@ bool wxIsBusy()
class wxCursorModule : public wxModule
{
public:
virtual bool OnInit() { return TRUE; }
virtual bool OnInit() { return true; }
virtual void OnExit()
{
wxDELETE(gs_cursorsHash);

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mgl/data.cpp
// Name: src/mgl/data.cpp
// Purpose: wxMGL-specific global data
// Author: Robert Roebling
// Id: $Id$
@@ -7,6 +7,13 @@
// 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"
@@ -15,15 +22,14 @@
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;

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dc.cpp
// Name: src/mgl/dc.cpp
// Purpose: wxDC class
// Author: Vaclav Slavik
// Created: 2001/03/09
@@ -137,10 +137,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
// 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();
@@ -152,8 +152,8 @@ wxDC::wxDC()
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;
}
@@ -171,7 +171,7 @@ void wxDC::SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC)
delete m_MGLDC;
m_MGLDC = mgldc;
m_OwnsMGLDC = OwnsMGLDC;
m_ok = TRUE;
m_ok = true;
if ( !m_globalClippingRegion.IsNull() )
SetClippingRegion(m_globalClippingRegion);
@@ -216,7 +216,7 @@ void wxDC::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoord ch)
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
m_clipping = TRUE;
m_clipping = true;
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
}
@@ -256,7 +256,7 @@ void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
m_clipping = TRUE;
m_clipping = true;
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
}
@@ -268,7 +268,7 @@ void wxDC::DestroyClippingRegion()
{
m_MGLDC->setClipRegion(m_globalClippingRegion.GetMGLRegion());
m_currentClippingRegion = m_globalClippingRegion;
m_clipping = TRUE;
m_clipping = true;
}
else
{
@@ -284,12 +284,12 @@ void wxDC::DestroyClippingRegion()
bool wxDC::CanDrawBitmap() const
{
return TRUE;
return true;
}
bool wxDC::CanGetTextExtent() const
{
return TRUE;
return true;
}
int wxDC::GetDepth() const
@@ -329,13 +329,13 @@ bool wxDC::DoFloodFill(wxCoord x, wxCoord y,
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)
@@ -452,7 +452,7 @@ void wxDC::DoDrawPoint(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") );
@@ -710,7 +710,7 @@ bool wxDC::SelectMGLFont()
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);
@@ -731,7 +731,7 @@ bool wxDC::SelectMGLFont()
m_MGLDC->setTextEncoding(nativeEnc.mglEncoding);
#endif
}
return TRUE;
return true;
}
void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
@@ -795,7 +795,7 @@ 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,
@@ -937,7 +937,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
if ( !m_downloadedPatterns[slot] )
{
m_MGLDC->setPenBitmapPattern(slot, pattern);
m_downloadedPatterns[slot] = TRUE;
m_downloadedPatterns[slot] = true;
}
m_MGLDC->usePenBitmapPattern(slot);
}
@@ -954,7 +954,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
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]);
@@ -963,7 +963,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
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]);
@@ -987,7 +987,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
break;
}
m_MGLDC->setPenPixmapPattern(slot, &pix);
m_downloadedPatterns[slot] = TRUE;
m_downloadedPatterns[slot] = true;
}
m_MGLDC->usePenPixmapPattern(slot);
}
@@ -1039,8 +1039,8 @@ void wxDC::SelectPen()
SelectMGLFatPen(wxSOLID, wxMGL_SELECT_FROM_PEN);
break;
}
m_penSelected = TRUE;
m_brushSelected = FALSE;
m_penSelected = true;
m_brushSelected = false;
}
void wxDC::SelectBrush()
@@ -1063,8 +1063,8 @@ 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);
}
@@ -1074,8 +1074,8 @@ void wxDC::SetPen(const wxPen& pen)
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)
@@ -1083,8 +1083,8 @@ 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)
@@ -1179,10 +1179,10 @@ int wxDC::LogicalFunctionToMGLRop(int logFunc) const
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()
@@ -1264,7 +1264,7 @@ void wxDC::ComputeScaleAndOrigin()
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;
}
@@ -1409,8 +1409,8 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
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);
@@ -1450,7 +1450,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
xx, yy, LogicalFunctionToMGLRop(rop));
}
return TRUE;
return true;
}
void wxDC::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask)
@@ -1467,7 +1467,7 @@ 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);
}
@@ -1553,7 +1553,7 @@ void wxDC::DoDrawSubBitmap(const wxBitmap &bmp,
{
temp = new MGLMemoryDC(dw, dh, GetDepth(), NULL);
wxDC tempdc;
tempdc.SetMGLDC(temp, FALSE);
tempdc.SetMGLDC(temp, false);
tempdc.SetPalette(m_palette);
}
else

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Name: mgl/evtloop.cpp
// Name: src/mgl/evtloop.cpp
// Purpose: implements wxEventLoop for MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
@@ -39,19 +39,19 @@ public:
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; }
@@ -59,7 +59,7 @@ private:
// 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;
};
@@ -87,7 +87,7 @@ void wxEventLoopImpl::Dispatch()
PM_sleep(10);
}
// end of EVT_halt
MGL_wmProcessEvent(g_winMng, &evt);
}
@@ -117,7 +117,7 @@ int wxEventLoop::Run()
wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") );
m_impl = new wxEventLoopImpl;
wxEventLoop *oldLoop = ms_activeLoop;
ms_activeLoop = this;
@@ -154,8 +154,8 @@ void wxEventLoop::Exit(int rc)
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);
@@ -167,18 +167,18 @@ void wxEventLoop::Exit(int rc)
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();

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mgl/fontutil.cpp
// Name: src/mgl/fontutil.cpp
// Purpose: Font helper functions for MGL
// Author: Vaclav Slavik
// Created: 2001/04/29
@@ -45,20 +45,20 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
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;
}
@@ -73,7 +73,7 @@ wxString wxNativeEncodingInfo::ToString() const
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 )
{
@@ -122,29 +122,29 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
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;
}
@@ -156,7 +156,7 @@ WX_DECLARE_LIST(wxMGLFontInstance, wxMGLFontInstanceList);
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;
@@ -167,22 +167,22 @@ wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *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;
@@ -192,7 +192,7 @@ wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
m_fontLib = NULL;
m_instances = new wxMGLFontInstanceList;
m_instances->DeleteContents(TRUE);
m_instances->DeleteContents(true);
}
wxMGLFontLibrary::~wxMGLFontLibrary()
@@ -200,7 +200,7 @@ 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());
@@ -226,14 +226,12 @@ void wxMGLFontLibrary::DecRef()
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 )
@@ -241,7 +239,7 @@ wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
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
@@ -250,38 +248,38 @@ wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
// 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;
}
@@ -289,33 +287,33 @@ wxMGLFontFamily::wxMGLFontFamily(const font_info_t *info)
{
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);
}
@@ -340,8 +338,8 @@ wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
wxMGLFontFamily *family;
int type;
wxString facename = font->GetFaceName();
if ( !facename.IsEmpty() )
if ( !facename.empty() )
family = GetFamily(facename);
else
family = NULL;
@@ -405,7 +403,7 @@ wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
break;
}
}
return family->GetLibrary(type);
}
@@ -419,9 +417,9 @@ static ibool MGLAPI enum_callback(const font_info_t *info, void *cookie)
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);
}
@@ -437,7 +435,7 @@ void wxFontsManager::AddFamily(const font_info_t *info)
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());

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: region.cpp
// Name: src/mgl/region.cpp
// Purpose: Region handling for wxWidgets/MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
@@ -72,7 +72,7 @@ wxRegion::wxRegion()
}
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;
@@ -126,7 +126,7 @@ void wxRegion::Clear()
// 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();
@@ -134,8 +134,8 @@ void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
y = rect.top;
w = rect.right - rect.left;
h = rect.bottom - rect.top;
}
else
}
else
{
x = y = w = h = 0;
}
@@ -151,8 +151,10 @@ wxRect wxRegion::GetBox() const
// 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());
}
//-----------------------------------------------------------------------------
@@ -163,7 +165,7 @@ bool wxRegion::Offset(wxCoord x, wxCoord y)
{
AllocExclusive();
M_REGION.offset(x, y);
return TRUE;
return true;
}
// Union rectangle or region with this.
@@ -171,14 +173,14 @@ bool wxRegion::Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
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.
@@ -186,14 +188,14 @@ bool wxRegion::Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
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:
@@ -202,14 +204,14 @@ bool wxRegion::Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
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.
@@ -220,7 +222,7 @@ bool wxRegion::Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
MGLRegion rg1 = M_REGION + rect,
rg2 = M_REGION & rect;
M_REGION = rg1 - rg2;
return TRUE;
return true;
}
bool wxRegion::Xor(const wxRegion& region)
@@ -229,7 +231,7 @@ 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;
}
@@ -263,11 +265,11 @@ wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) c
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;
@@ -296,7 +298,7 @@ public:
virtual bool OnInit()
{
gs_mutexIterator = new wxMutex();
return TRUE;
return true;
}
virtual void OnExit()
{
@@ -313,7 +315,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMglRegionModule, wxModule)
*/
wxRegionIterator::wxRegionIterator() : m_currentNode(NULL)
{
m_rects.DeleteContents(TRUE);
m_rects.DeleteContents(true);
}
wxRegionIterator::~wxRegionIterator()
@@ -325,23 +327,23 @@ 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;
@@ -350,7 +352,7 @@ void wxRegionIterator::Reset(const wxRegion& region)
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);

View File

@@ -1,9 +1,9 @@
/////////////////////////////////////////////////////////////////////////////
// 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".
@@ -28,7 +28,7 @@ static wxFont *gs_fontDefault = NULL;
class wxSystemSettingsModule : public wxModule
{
public:
virtual bool OnInit() { return TRUE; }
virtual bool OnInit() { return true; }
virtual void OnExit()
{
delete gs_fontDefault;
@@ -65,18 +65,18 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
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:
@@ -87,22 +87,21 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
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;
}

View File

@@ -167,13 +167,13 @@ static ibool MGLAPI wxWindowMouseHandler(window_t *wnd, event_t *e)
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)
{
@@ -435,10 +435,10 @@ static bool wxHandleSpecialKeys(wxKeyEvent& event)
)
{
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)
@@ -454,14 +454,14 @@ 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 )
{
@@ -481,7 +481,7 @@ static ibool MGLAPI wxWindowKeybHandler(window_t *wnd, event_t *e)
// 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);
@@ -544,8 +544,8 @@ void wxWindowMGL::Init()
// mgl specific:
m_wnd = NULL;
m_isShown = TRUE;
m_frozen = FALSE;
m_isShown = true;
m_frozen = false;
m_paintMGLDC = NULL;
m_eraseBackground = -1;
}
@@ -555,7 +555,7 @@ wxWindowMGL::~wxWindowMGL()
{
SendDestroyEvent();
m_isBeingDeleted = TRUE;
m_isBeingDeleted = true;
if ( gs_mouseCapture == this )
ReleaseMouse();
@@ -597,7 +597,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
const wxString& name)
{
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
return FALSE;
return false;
if ( parent )
parent->AddChild(this);
@@ -627,7 +627,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
{
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;
}
@@ -638,7 +638,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
SetMGLwindow_t(wnd);
return TRUE;
return true;
}
void wxWindowMGL::SetMGLwindow_t(struct window_t *wnd)
@@ -649,7 +649,7 @@ 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);
@@ -688,13 +688,13 @@ void wxWindowMGL::SetFocus()
{
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);
}
@@ -746,7 +746,7 @@ wxWindow *wxWindowBase::DoFindFocus()
bool wxWindowMGL::Show(bool show)
{
if ( !wxWindowBase::Show(show) )
return FALSE;
return false;
MGL_wmShowWindow(m_wnd, show);
@@ -769,7 +769,7 @@ bool wxWindowMGL::Show(bool show)
}
}
return TRUE;
return true;
}
// Raise the window to the top of the Z order
@@ -811,7 +811,7 @@ bool wxWindowMGL::SetCursor(const wxCursor& cursor)
if ( !wxWindowBase::SetCursor(cursor) )
{
// no change
return FALSE;
return false;
}
if ( m_cursor.Ok() )
@@ -819,7 +819,7 @@ bool wxWindowMGL::SetCursor(const wxCursor& cursor)
else
MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor());
return TRUE;
return true;
}
void wxWindowMGL::WarpPointer(int x, int y)
@@ -844,11 +844,11 @@ 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;
}
@@ -874,7 +874,7 @@ void wxWindowMGL::SetDropTarget(wxDropTarget *pDropTarget)
// 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();
@@ -1043,7 +1043,8 @@ void wxWindowMGL::DoSetSize(int x, int y, int width, int height, int sizeFlags)
{
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);
}
@@ -1123,13 +1124,13 @@ void wxWindowMGL::Update()
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();
}
@@ -1139,7 +1140,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
if ( m_frozen )
{
// Don't paint anything if the window is frozen.
m_refreshAfterThaw = TRUE;
m_refreshAfterThaw = true;
return;
}

View File

@@ -1,7 +1,7 @@
/////////////////////////////////////////////////////////////////////////////
// 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$
@@ -63,7 +63,7 @@
// ----------------------------------------------------------------------------
/* static */
bool wxDir::Exists(const wxString& dir)
bool wxDir::Exists(const wxString& WXUNUSED(dir))
{
return false;
}
@@ -72,11 +72,11 @@ bool wxDir::Exists(const wxString& dir)
// 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;
}
@@ -88,9 +88,7 @@ bool wxDir::IsOpened() const
wxString wxDir::GetName() const
{
wxString name;
return name;
return wxEmptyString;
}
wxDir::~wxDir()
@@ -101,15 +99,14 @@ 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;
}

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mac/mimetype.cpp
// Name: src/msdos/mimetype.cpp
// Purpose: classes and functions to manage MIME types
// Author: Vadim Zeitlin
// Modified by:
@@ -43,25 +43,28 @@
// 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
@@ -69,47 +72,49 @@ 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") );
}
@@ -196,12 +201,12 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
// 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") );
@@ -210,7 +215,7 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
}
wxFileType *
wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& WXUNUSED(ftInfo))
{
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
@@ -218,9 +223,9 @@ wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
}
bool
wxMimeTypesManagerImpl::Unassociate(wxFileType *ft)
wxMimeTypesManagerImpl::Unassociate(wxFileType *WXUNUSED(ft))
{
return FALSE;
return false;
}
#endif // wxUSE_MIMETYPE