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:
@@ -171,7 +171,7 @@
|
|||||||
// Default is 1
|
// Default is 1
|
||||||
//
|
//
|
||||||
// Recommended setting: 1 for win32 else 0
|
// Recommended setting: 1 for win32 else 0
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__) || defined(__WATCOMC__)
|
||||||
#define wxUSE_WCHAR_T 1
|
#define wxUSE_WCHAR_T 1
|
||||||
#else
|
#else
|
||||||
#define wxUSE_WCHAR_T 0
|
#define wxUSE_WCHAR_T 0
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: common/appcmn.cpp
|
// Name: src/common/appcmn.cpp
|
||||||
// Purpose: wxAppConsole and wxAppBase methods common to all platforms
|
// Purpose: wxAppConsole and wxAppBase methods common to all platforms
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -581,13 +581,13 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object)
|
|||||||
#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__)
|
#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__)
|
||||||
#include "wx/unix/gsockunx.h"
|
#include "wx/unix/gsockunx.h"
|
||||||
#elif defined(__WXMAC__)
|
#elif defined(__WXMAC__)
|
||||||
#include <MacHeaders.c>
|
#include <MacHeaders.c>
|
||||||
#define OTUNIXERRORS 1
|
#define OTUNIXERRORS 1
|
||||||
#include <OpenTransport.h>
|
#include <OpenTransport.h>
|
||||||
#include <OpenTransportProviders.h>
|
#include <OpenTransportProviders.h>
|
||||||
#include <OpenTptInternet.h>
|
#include <OpenTptInternet.h>
|
||||||
|
|
||||||
#include "wx/mac/gsockmac.h"
|
#include "wx/mac/gsockmac.h"
|
||||||
#else
|
#else
|
||||||
#error "Must include correct GSocket header here"
|
#error "Must include correct GSocket header here"
|
||||||
#endif
|
#endif
|
||||||
@@ -605,4 +605,3 @@ GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -287,7 +287,7 @@ wxString wxFileConfig::GetGlobalDir()
|
|||||||
#elif defined(__DOS__)
|
#elif defined(__DOS__)
|
||||||
// There's no such thing as global cfg dir in MS-DOS, let's return
|
// There's no such thing as global cfg dir in MS-DOS, let's return
|
||||||
// current directory (FIXME_MGL?)
|
// current directory (FIXME_MGL?)
|
||||||
return wxT(".\\");
|
strDir = wxT(".\\");
|
||||||
#elif defined(__WXWINCE__)
|
#elif defined(__WXWINCE__)
|
||||||
strDir = wxT("\\Windows\\");
|
strDir = wxT("\\Windows\\");
|
||||||
#else // Windows
|
#else // Windows
|
||||||
@@ -551,21 +551,21 @@ wxFileConfig::wxFileConfig(wxInputStream &inStream, wxMBConv& conv)
|
|||||||
|
|
||||||
void wxFileConfig::CleanUp()
|
void wxFileConfig::CleanUp()
|
||||||
{
|
{
|
||||||
delete m_pRootGroup;
|
delete m_pRootGroup;
|
||||||
|
|
||||||
wxFileConfigLineList *pCur = m_linesHead;
|
wxFileConfigLineList *pCur = m_linesHead;
|
||||||
while ( pCur != NULL ) {
|
while ( pCur != NULL ) {
|
||||||
wxFileConfigLineList *pNext = pCur->Next();
|
wxFileConfigLineList *pNext = pCur->Next();
|
||||||
delete pCur;
|
delete pCur;
|
||||||
pCur = pNext;
|
pCur = pNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileConfig::~wxFileConfig()
|
wxFileConfig::~wxFileConfig()
|
||||||
{
|
{
|
||||||
Flush();
|
Flush();
|
||||||
|
|
||||||
CleanUp();
|
CleanUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -738,59 +738,59 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
|
|||||||
|
|
||||||
void wxFileConfig::SetRootPath()
|
void wxFileConfig::SetRootPath()
|
||||||
{
|
{
|
||||||
m_strPath.Empty();
|
m_strPath.Empty();
|
||||||
m_pCurrentGroup = m_pRootGroup;
|
m_pCurrentGroup = m_pRootGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
wxFileConfig::DoSetPath(const wxString& strPath, bool createMissingComponents)
|
wxFileConfig::DoSetPath(const wxString& strPath, bool createMissingComponents)
|
||||||
{
|
{
|
||||||
wxArrayString aParts;
|
wxArrayString aParts;
|
||||||
|
|
||||||
if ( strPath.empty() ) {
|
if ( strPath.empty() ) {
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
return true;
|
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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
// change current group
|
||||||
m_strPath.Empty();
|
size_t n;
|
||||||
for ( n = 0; n < aParts.Count(); n++ ) {
|
m_pCurrentGroup = m_pRootGroup;
|
||||||
m_strPath << wxCONFIG_PATH_SEPARATOR << aParts[n];
|
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)
|
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
|
bool wxFileConfig::GetFirstGroup(wxString& str, long& lIndex) const
|
||||||
{
|
{
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextGroup(str, lIndex);
|
return GetNextGroup(str, lIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
|
bool wxFileConfig::GetNextGroup (wxString& str, long& lIndex) const
|
||||||
{
|
{
|
||||||
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
|
if ( size_t(lIndex) < m_pCurrentGroup->Groups().Count() ) {
|
||||||
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
|
str = m_pCurrentGroup->Groups()[(size_t)lIndex++]->Name();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
|
bool wxFileConfig::GetFirstEntry(wxString& str, long& lIndex) const
|
||||||
{
|
{
|
||||||
lIndex = 0;
|
lIndex = 0;
|
||||||
return GetNextEntry(str, lIndex);
|
return GetNextEntry(str, lIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
|
bool wxFileConfig::GetNextEntry (wxString& str, long& lIndex) const
|
||||||
{
|
{
|
||||||
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
|
if ( size_t(lIndex) < m_pCurrentGroup->Entries().Count() ) {
|
||||||
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
|
str = m_pCurrentGroup->Entries()[(size_t)lIndex++]->Name();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
|
size_t wxFileConfig::GetNumberOfEntries(bool bRecursive) const
|
||||||
{
|
{
|
||||||
size_t n = m_pCurrentGroup->Entries().Count();
|
size_t n = m_pCurrentGroup->Entries().Count();
|
||||||
if ( bRecursive ) {
|
if ( bRecursive ) {
|
||||||
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
|
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
|
||||||
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
||||||
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
||||||
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
||||||
n += GetNumberOfEntries(true);
|
n += GetNumberOfEntries(true);
|
||||||
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
|
size_t wxFileConfig::GetNumberOfGroups(bool bRecursive) const
|
||||||
{
|
{
|
||||||
size_t n = m_pCurrentGroup->Groups().Count();
|
size_t n = m_pCurrentGroup->Groups().Count();
|
||||||
if ( bRecursive ) {
|
if ( bRecursive ) {
|
||||||
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
|
wxFileConfigGroup *pOldCurrentGroup = m_pCurrentGroup;
|
||||||
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
size_t nSubgroups = m_pCurrentGroup->Groups().Count();
|
||||||
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
for ( size_t nGroup = 0; nGroup < nSubgroups; nGroup++ ) {
|
||||||
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
CONST_CAST m_pCurrentGroup = m_pCurrentGroup->Groups()[nGroup];
|
||||||
n += GetNumberOfGroups(true);
|
n += GetNumberOfGroups(true);
|
||||||
CONST_CAST m_pCurrentGroup = pOldCurrentGroup;
|
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
|
bool wxFileConfig::HasGroup(const wxString& strName) const
|
||||||
{
|
{
|
||||||
// special case: DoSetPath("") does work as it's equivalent to DoSetPath("/")
|
// special case: DoSetPath("") does work as it's equivalent to DoSetPath("/")
|
||||||
// but there is no group with empty name so treat this separately
|
// but there is no group with empty name so treat this separately
|
||||||
if ( strName.empty() )
|
if ( strName.empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const wxString pathOld = GetPath();
|
const wxString pathOld = GetPath();
|
||||||
|
|
||||||
wxFileConfig *self = wx_const_cast(wxFileConfig *, this);
|
wxFileConfig *self = wx_const_cast(wxFileConfig *, this);
|
||||||
const bool
|
const bool
|
||||||
rc = self->DoSetPath(strName, false /* don't create missing components */);
|
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
|
bool wxFileConfig::HasEntry(const wxString& strName) const
|
||||||
{
|
{
|
||||||
wxConfigPathChanger path(this, strName);
|
wxConfigPathChanger path(this, strName);
|
||||||
|
|
||||||
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
|
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
|
||||||
return pEntry != NULL;
|
return pEntry != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -897,16 +897,16 @@ bool wxFileConfig::HasEntry(const wxString& strName) const
|
|||||||
|
|
||||||
bool wxFileConfig::DoReadString(const wxString& key, wxString* pStr) 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());
|
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(path.Name());
|
||||||
if (pEntry == NULL) {
|
if (pEntry == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pStr = pEntry->Value();
|
*pStr = pEntry->Value();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
|
bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
|
||||||
|
@@ -267,7 +267,9 @@ size_t wxGetAvailableDrives(wxArrayString &paths, wxArrayString &names, wxArrayI
|
|||||||
bool wxIsDriveAvailable(const wxString& dirName)
|
bool wxIsDriveAvailable(const wxString& dirName)
|
||||||
{
|
{
|
||||||
// FIXME_MGL - this method leads to hang up under Watcom for some reason
|
// 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(':') )
|
if ( dirName.Len() == 3 && dirName[1u] == wxT(':') )
|
||||||
{
|
{
|
||||||
wxString dirNameLower(dirName.Lower());
|
wxString dirNameLower(dirName.Lower());
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: bitmap.cpp
|
// Name: src/mgl/bitmap.cpp
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
||||||
@@ -33,19 +33,19 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static pixel_format_t gs_pixel_format_15 =
|
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 =
|
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 =
|
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 =
|
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 =
|
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
|
// helpers
|
||||||
@@ -56,13 +56,13 @@ static pixel_format_t gs_pixel_format_wxImage =
|
|||||||
static wxColour wxQuantizeColour(const wxColour& clr, const wxBitmap& bmp)
|
static wxColour wxQuantizeColour(const wxColour& clr, const wxBitmap& bmp)
|
||||||
{
|
{
|
||||||
pixel_format_t *pf = bmp.GetMGLbitmap_t()->pf;
|
pixel_format_t *pf = bmp.GetMGLbitmap_t()->pf;
|
||||||
|
|
||||||
if ( pf->redAdjust == 0 && pf->greenAdjust == 0 && pf->blueAdjust == 0 )
|
if ( pf->redAdjust == 0 && pf->greenAdjust == 0 && pf->blueAdjust == 0 )
|
||||||
return clr;
|
return clr;
|
||||||
else
|
else
|
||||||
return wxColour((clr.Red() >> pf->redAdjust) << pf->redAdjust,
|
return wxColour((unsigned char)((clr.Red() >> pf->redAdjust) << pf->redAdjust),
|
||||||
(clr.Green() >> pf->greenAdjust) << pf->greenAdjust,
|
(unsigned char)((clr.Green() >> pf->greenAdjust) << pf->greenAdjust),
|
||||||
(clr.Blue() >> pf->blueAdjust) << pf->blueAdjust);
|
(unsigned char)((clr.Blue() >> pf->blueAdjust) << pf->blueAdjust));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,13 +105,14 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
|
|||||||
{
|
{
|
||||||
delete m_bitmap;
|
delete m_bitmap;
|
||||||
m_bitmap = NULL;
|
m_bitmap = NULL;
|
||||||
|
|
||||||
wxColour clr(wxQuantizeColour(colour, bitmap));
|
wxColour clr(wxQuantizeColour(colour, bitmap));
|
||||||
|
|
||||||
wxImage imgSrc(bitmap.ConvertToImage());
|
wxImage imgSrc(bitmap.ConvertToImage());
|
||||||
imgSrc.SetMask(FALSE);
|
imgSrc.SetMask(false);
|
||||||
wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue()));
|
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);
|
m_bitmap = new wxBitmap(image, 1);
|
||||||
|
|
||||||
@@ -123,8 +124,8 @@ bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
|
|||||||
unsigned char r,g,b;
|
unsigned char r,g,b;
|
||||||
wxPalette *pal = bitmap.GetPalette();
|
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);
|
pal->GetRGB(paletteIndex, &r, &g, &b);
|
||||||
|
|
||||||
return Create(bitmap, wxColour(r, g, b));
|
return Create(bitmap, wxColour(r, g, b));
|
||||||
@@ -135,11 +136,11 @@ bool wxMask::Create(const wxBitmap& bitmap)
|
|||||||
delete m_bitmap;
|
delete m_bitmap;
|
||||||
m_bitmap = NULL;
|
m_bitmap = NULL;
|
||||||
|
|
||||||
wxCHECK_MSG( bitmap.Ok(), FALSE, wxT("Invalid bitmap") );
|
wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap") );
|
||||||
wxCHECK_MSG( bitmap.GetDepth() == 1, FALSE, wxT("Cannot create mask from colour bitmap") );
|
wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") );
|
||||||
|
|
||||||
m_bitmap = new wxBitmap(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)
|
int bpp, pixel_format_t *pf)
|
||||||
{
|
{
|
||||||
MGLMemoryDC mdc(width, height, bpp, pf);
|
MGLMemoryDC mdc(width, height, bpp, pf);
|
||||||
@@ -204,9 +205,10 @@ bool wxBitmap::Create(int width, int height, int depth)
|
|||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
wxCHECK_MSG( (width > 0) && (height > 0), FALSE, wxT("invalid bitmap size") )
|
wxCHECK_MSG( (width > 0) && (height > 0), false, wxT("invalid bitmap size") )
|
||||||
|
|
||||||
pixel_format_t pf_dummy, *pf;
|
pixel_format_t pf_dummy;
|
||||||
|
pixel_format_t *pf;
|
||||||
int mglDepth = depth;
|
int mglDepth = depth;
|
||||||
|
|
||||||
switch ( 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.") );
|
wxASSERT_MSG( g_displayDC, wxT("MGL display DC not created yet.") );
|
||||||
|
|
||||||
g_displayDC->getPixelFormat(pf_dummy);
|
g_displayDC->getPixelFormat(pf_dummy);
|
||||||
mglDepth = g_displayDC->getBitsPerPixel();
|
mglDepth = g_displayDC->getBitsPerPixel();
|
||||||
pf = &pf_dummy;
|
pf = &pf_dummy;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
@@ -236,8 +238,7 @@ bool wxBitmap::Create(int width, int height, int depth)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
wxASSERT_MSG( 0, wxT("invalid bitmap depth") );
|
wxASSERT_MSG( 0, wxT("invalid bitmap depth") );
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData();
|
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
|
// 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
|
// 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);
|
M_BMPDATA->m_bitmap = MyMGL_createBitmap(width, height, 8, pf);
|
||||||
SetMonoPalette(wxColour(255, 255, 255), wxColour(0, 0, 0));
|
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)
|
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;
|
wxXPMDecoder decoder;
|
||||||
wxImage img = decoder.ReadData(bits);
|
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);
|
*this = wxBitmap(img);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap::wxBitmap(const wxImage& image, int depth)
|
wxBitmap::wxBitmap(const wxImage& image, int depth)
|
||||||
@@ -282,12 +283,12 @@ wxBitmap::wxBitmap(const wxImage& image, int depth)
|
|||||||
long width, height;
|
long width, height;
|
||||||
|
|
||||||
wxCHECK_RET( image.Ok(), wxT("invalid image") )
|
wxCHECK_RET( image.Ok(), wxT("invalid image") )
|
||||||
|
|
||||||
width = image.GetWidth();
|
width = image.GetWidth();
|
||||||
height = image.GetHeight();
|
height = image.GetHeight();
|
||||||
|
|
||||||
if ( !Create(width, height, depth) ) return;
|
if ( !Create(width, height, depth) ) return;
|
||||||
|
|
||||||
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
|
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
|
||||||
width * 3, (void*)image.GetData(), NULL);
|
width * 3, (void*)image.GetData(), NULL);
|
||||||
wxASSERT_MSG( idc.isValid(), wxT("cannot create custom MGLDC") );
|
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);
|
bdc->bitBlt(idc, 0, 0, width, height, 0, 0, MGL_REPLACE_MODE);
|
||||||
delete bdc;
|
delete bdc;
|
||||||
|
|
||||||
if ( image.HasMask() )
|
if ( image.HasMask() )
|
||||||
{
|
{
|
||||||
wxImage mask_image = image.ConvertToMono(image.GetMaskRed(),
|
wxImage mask_image = image.ConvertToMono(image.GetMaskRed(),
|
||||||
image.GetMaskGreen(),
|
image.GetMaskGreen(),
|
||||||
image.GetMaskBlue());
|
image.GetMaskBlue());
|
||||||
mask_image.SetMask(FALSE);
|
mask_image.SetMask(false);
|
||||||
wxBitmap mask_bmp(mask_image, 1);
|
wxBitmap mask_bmp(mask_image, 1);
|
||||||
SetMask(new wxMask(mask_bmp));
|
SetMask(new wxMask(mask_bmp));
|
||||||
}
|
}
|
||||||
@@ -318,17 +319,17 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
int width, height;
|
int width, height;
|
||||||
width = GetWidth();
|
width = GetWidth();
|
||||||
height = GetHeight();
|
height = GetHeight();
|
||||||
|
|
||||||
wxImage image(width, height);
|
wxImage image(width, height);
|
||||||
wxASSERT_MSG( image.Ok(), wxT("cannot create image") );
|
wxASSERT_MSG( image.Ok(), wxT("cannot create image") );
|
||||||
|
|
||||||
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
|
MGLMemoryDC idc(width, height, 24, &gs_pixel_format_wxImage,
|
||||||
width * 3, (void*)image.GetData(), NULL);
|
width * 3, (void*)image.GetData(), NULL);
|
||||||
wxASSERT_MSG( idc.isValid(), wxT("cannot create custom MGLDC") );
|
wxASSERT_MSG( idc.isValid(), wxT("cannot create custom MGLDC") );
|
||||||
|
|
||||||
if ( M_BMPDATA->m_palette )
|
if ( M_BMPDATA->m_palette )
|
||||||
image.SetPalette(*(M_BMPDATA->m_palette));
|
image.SetPalette(*(M_BMPDATA->m_palette));
|
||||||
|
|
||||||
if ( GetMask() )
|
if ( GetMask() )
|
||||||
{
|
{
|
||||||
// in consistency with other ports, we convert parts covered
|
// 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>
|
// bg colour set to black and fg colour to <16,16,16>
|
||||||
|
|
||||||
image.SetMaskColour(16, 16, 16);
|
image.SetMaskColour(16, 16, 16);
|
||||||
image.SetMask(TRUE);
|
image.SetMask(true);
|
||||||
|
|
||||||
wxDC tmpDC;
|
wxDC tmpDC;
|
||||||
tmpDC.SetMGLDC(&idc, FALSE);
|
tmpDC.SetMGLDC(&idc, false);
|
||||||
tmpDC.SetBackground(wxBrush(wxColour(16,16,16), wxSOLID));
|
tmpDC.SetBackground(wxBrush(wxColour(16,16,16), wxSOLID));
|
||||||
tmpDC.Clear();
|
tmpDC.Clear();
|
||||||
tmpDC.DrawBitmap(*this, 0, 0, TRUE);
|
tmpDC.DrawBitmap(*this, 0, 0, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
image.SetMask(FALSE);
|
image.SetMask(false);
|
||||||
idc.putBitmap(0, 0, M_BMPDATA->m_bitmap, MGL_REPLACE_MODE);
|
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);
|
wxBitmap *bmp = (wxBitmap*)(&icon);
|
||||||
*this = *bmp;
|
*this = *bmp;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const
|
wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const
|
||||||
@@ -457,7 +458,7 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect& rect) const
|
|||||||
ret.SetPalette(*GetPalette());
|
ret.SetPalette(*GetPalette());
|
||||||
|
|
||||||
MGLDevCtx *tdc = ret.CreateTmpDC();
|
MGLDevCtx *tdc = ret.CreateTmpDC();
|
||||||
tdc->putBitmapSection(rect.x, rect.y,
|
tdc->putBitmapSection(rect.x, rect.y,
|
||||||
rect.x + rect.width, rect.y + rect.height,
|
rect.x + rect.width, rect.y + rect.height,
|
||||||
0, 0, M_BMPDATA->m_bitmap, MGL_REPLACE_MODE);
|
0, 0, M_BMPDATA->m_bitmap, MGL_REPLACE_MODE);
|
||||||
delete tdc;
|
delete tdc;
|
||||||
@@ -501,14 +502,14 @@ MGLDevCtx *wxBitmap::CreateTmpDC() const
|
|||||||
M_BMPDATA->m_bitmap->bitsPerPixel,
|
M_BMPDATA->m_bitmap->bitsPerPixel,
|
||||||
M_BMPDATA->m_bitmap->pf,
|
M_BMPDATA->m_bitmap->pf,
|
||||||
M_BMPDATA->m_bitmap->bytesPerLine,
|
M_BMPDATA->m_bitmap->bytesPerLine,
|
||||||
M_BMPDATA->m_bitmap->surface,
|
M_BMPDATA->m_bitmap->surface,
|
||||||
NULL);
|
NULL);
|
||||||
wxCHECK_MSG( tdc->isValid(), NULL, wxT("cannot create temporary MGLDC") );
|
wxCHECK_MSG( tdc->isValid(), NULL, wxT("cannot create temporary MGLDC") );
|
||||||
|
|
||||||
if ( M_BMPDATA->m_bitmap->pal != NULL )
|
if ( M_BMPDATA->m_bitmap->pal != NULL )
|
||||||
{
|
{
|
||||||
int cnt;
|
int cnt;
|
||||||
|
|
||||||
switch (M_BMPDATA->m_bitmap->bitsPerPixel)
|
switch (M_BMPDATA->m_bitmap->bitsPerPixel)
|
||||||
{
|
{
|
||||||
case 2: cnt = 2; break;
|
case 2: cnt = 2; break;
|
||||||
@@ -519,43 +520,43 @@ MGLDevCtx *wxBitmap::CreateTmpDC() const
|
|||||||
wxFAIL_MSG( wxT("bitmap with this depth cannot have palette") );
|
wxFAIL_MSG( wxT("bitmap with this depth cannot have palette") );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tdc->setPalette(M_BMPDATA->m_bitmap->pal, cnt, 0);
|
tdc->setPalette(M_BMPDATA->m_bitmap->pal, cnt, 0);
|
||||||
tdc->realizePalette(cnt, 0, FALSE);
|
tdc->realizePalette(cnt, 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tdc;
|
return tdc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type)
|
bool wxBitmap::LoadFile(const wxString &name, wxBitmapType type)
|
||||||
{
|
{
|
||||||
UnRef();
|
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 )
|
type == wxBITMAP_TYPE_PCX || type == wxBITMAP_TYPE_JPEG )
|
||||||
{
|
{
|
||||||
// prevent accidental loading of bitmap from $MGL_ROOT:
|
// prevent accidental loading of bitmap from $MGL_ROOT:
|
||||||
if ( !wxFileExists(name) )
|
if ( !wxFileExists(name) )
|
||||||
{
|
{
|
||||||
wxLogError(_("File %s does not exist."), name.c_str());
|
wxLogError(_("File %s does not exist."), name.c_str());
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapHandler *handler = FindHandler(type);
|
wxBitmapHandler *handler = FindHandler(type);
|
||||||
|
|
||||||
if ( handler == NULL )
|
if ( handler == NULL )
|
||||||
{
|
{
|
||||||
wxImage image;
|
wxImage image;
|
||||||
if ( !image.LoadFile(name, type) || !image.Ok() )
|
if ( !image.LoadFile(name, type) || !image.Ok() )
|
||||||
{
|
{
|
||||||
wxLogError("no bitmap handler for type %d defined.", type);
|
wxLogError("no bitmap handler for type %d defined.", type);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*this = wxBitmap(image);
|
*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
|
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);
|
wxBitmapHandler *handler = FindHandler(type);
|
||||||
|
|
||||||
if ( handler == NULL )
|
if ( handler == NULL )
|
||||||
{
|
{
|
||||||
wxImage image = ConvertToImage();
|
wxImage image = ConvertToImage();
|
||||||
if ( palette )
|
if ( palette )
|
||||||
@@ -581,7 +582,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type, const wxPal
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxLogError("no bitmap handler for type %d defined.", type);
|
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;
|
M_BMPDATA->m_palette = NULL;
|
||||||
|
|
||||||
if ( !palette.Ok() ) return;
|
if ( !palette.Ok() ) return;
|
||||||
|
|
||||||
M_BMPDATA->m_palette = new wxPalette(palette);
|
M_BMPDATA->m_palette = new wxPalette(palette);
|
||||||
|
|
||||||
int cnt = palette.GetColoursCount();
|
int cnt = palette.GetColoursCount();
|
||||||
@@ -650,17 +651,21 @@ public:
|
|||||||
wxMGLBitmapHandler(wxBitmapType type,
|
wxMGLBitmapHandler(wxBitmapType type,
|
||||||
const wxString& extension, const wxString& name);
|
const wxString& extension, const wxString& name);
|
||||||
|
|
||||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
|
||||||
int width, int height, int depth = 1)
|
void *WXUNUSED(data),
|
||||||
{ return FALSE; }
|
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,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight);
|
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);
|
int type, const wxPalette *palette = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
|
wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
|
||||||
const wxString& extension,
|
const wxString& extension,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxBitmapHandler()
|
: wxBitmapHandler()
|
||||||
@@ -670,16 +675,16 @@ wxMGLBitmapHandler::wxMGLBitmapHandler(wxBitmapType type,
|
|||||||
SetExtension(extension);
|
SetExtension(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
||||||
long flags,
|
long flags,
|
||||||
int WXUNUSED(desiredWidth),
|
int WXUNUSED(desiredWidth),
|
||||||
int WXUNUSED(desiredHeight))
|
int WXUNUSED(desiredHeight))
|
||||||
{
|
{
|
||||||
int width, height, bpp;
|
int width, height, bpp;
|
||||||
pixel_format_t pf;
|
pixel_format_t pf;
|
||||||
wxString fullname;
|
wxString fullname;
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
|
|
||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
case wxBITMAP_TYPE_BMP_RESOURCE:
|
case wxBITMAP_TYPE_BMP_RESOURCE:
|
||||||
@@ -691,52 +696,52 @@ bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
default:
|
default:
|
||||||
fullname= name;
|
fullname= name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (flags)
|
switch (flags)
|
||||||
{
|
{
|
||||||
case wxBITMAP_TYPE_BMP:
|
case wxBITMAP_TYPE_BMP:
|
||||||
case wxBITMAP_TYPE_BMP_RESOURCE:
|
case wxBITMAP_TYPE_BMP_RESOURCE:
|
||||||
if ( !MGL_getBitmapSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
if ( !MGL_getBitmapSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
||||||
return FALSE;
|
return false;
|
||||||
bitmap->Create(width, height, -1);
|
bitmap->Create(width, height, -1);
|
||||||
if ( !bitmap->Ok() ) return FALSE;
|
if ( !bitmap->Ok() ) return false;
|
||||||
dc.SelectObject(*bitmap);
|
dc.SelectObject(*bitmap);
|
||||||
if ( !dc.GetMGLDC()->loadBitmapIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
if ( !dc.GetMGLDC()->loadBitmapIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBITMAP_TYPE_JPEG:
|
case wxBITMAP_TYPE_JPEG:
|
||||||
case wxBITMAP_TYPE_JPEG_RESOURCE:
|
case wxBITMAP_TYPE_JPEG_RESOURCE:
|
||||||
if ( !MGL_getJPEGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
if ( !MGL_getJPEGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
||||||
return FALSE;
|
return false;
|
||||||
bitmap->Create(width, height, -1);
|
bitmap->Create(width, height, -1);
|
||||||
if ( !bitmap->Ok() ) return FALSE;
|
if ( !bitmap->Ok() ) return false;
|
||||||
dc.SelectObject(*bitmap);
|
dc.SelectObject(*bitmap);
|
||||||
if ( !dc.GetMGLDC()->loadJPEGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
if ( !dc.GetMGLDC()->loadJPEGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBITMAP_TYPE_PNG:
|
case wxBITMAP_TYPE_PNG:
|
||||||
case wxBITMAP_TYPE_PNG_RESOURCE:
|
case wxBITMAP_TYPE_PNG_RESOURCE:
|
||||||
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
||||||
return FALSE;
|
return false;
|
||||||
bitmap->Create(width, height, -1);
|
bitmap->Create(width, height, -1);
|
||||||
if ( !bitmap->Ok() ) return FALSE;
|
if ( !bitmap->Ok() ) return false;
|
||||||
dc.SelectObject(*bitmap);
|
dc.SelectObject(*bitmap);
|
||||||
if ( !dc.GetMGLDC()->loadPNGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
if ( !dc.GetMGLDC()->loadPNGIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxBITMAP_TYPE_PCX:
|
case wxBITMAP_TYPE_PCX:
|
||||||
case wxBITMAP_TYPE_PCX_RESOURCE:
|
case wxBITMAP_TYPE_PCX_RESOURCE:
|
||||||
if ( !MGL_getPCXSize(fullname.mb_str(), &width, &height, &bpp) )
|
if ( !MGL_getPCXSize(fullname.mb_str(), &width, &height, &bpp) )
|
||||||
return FALSE;
|
return false;
|
||||||
bitmap->Create(width, height, -1);
|
bitmap->Create(width, height, -1);
|
||||||
if ( !bitmap->Ok() ) return FALSE;
|
if ( !bitmap->Ok() ) return false;
|
||||||
dc.SelectObject(*bitmap);
|
dc.SelectObject(*bitmap);
|
||||||
if ( !dc.GetMGLDC()->loadPCXIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
if ( !dc.GetMGLDC()->loadPCXIntoDC(fullname.mb_str(), 0, 0, TRUE) )
|
||||||
return FALSE;
|
return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -744,10 +749,10 @@ bool wxMGLBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
break;
|
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))
|
int type, const wxPalette * WXUNUSED(palette))
|
||||||
{
|
{
|
||||||
wxMemoryDC mem;
|
wxMemoryDC mem;
|
||||||
@@ -761,26 +766,21 @@ bool wxMGLBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case wxBITMAP_TYPE_BMP:
|
case wxBITMAP_TYPE_BMP:
|
||||||
return tdc->saveBitmapFromDC(name.mb_str(), 0, 0, w, h);
|
return (bool)tdc->saveBitmapFromDC(name.mb_str(), 0, 0, w, h);
|
||||||
break;
|
|
||||||
case wxBITMAP_TYPE_JPEG:
|
case wxBITMAP_TYPE_JPEG:
|
||||||
return tdc->saveJPEGFromDC(name.mb_str(), 0, 0, w, h, 75);
|
return (bool)tdc->saveJPEGFromDC(name.mb_str(), 0, 0, w, h, 75);
|
||||||
break;
|
|
||||||
case wxBITMAP_TYPE_PNG:
|
case wxBITMAP_TYPE_PNG:
|
||||||
return tdc->savePNGFromDC(name.mb_str(), 0, 0, w, h);
|
return (bool)tdc->savePNGFromDC(name.mb_str(), 0, 0, w, h);
|
||||||
break;
|
|
||||||
case wxBITMAP_TYPE_PCX:
|
case wxBITMAP_TYPE_PCX:
|
||||||
return tdc->savePCXFromDC(name.mb_str(), 0, 0, w, h);
|
return (bool)tdc->savePCXFromDC(name.mb_str(), 0, 0, w, h);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
// which we can access via bitmap_t most easily
|
||||||
class wxPNGBitmapHandler: public wxMGLBitmapHandler
|
class wxPNGBitmapHandler: public wxMGLBitmapHandler
|
||||||
{
|
{
|
||||||
@@ -793,8 +793,8 @@ public:
|
|||||||
int desiredWidth, int desiredHeight);
|
int desiredWidth, int desiredHeight);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
||||||
long flags,
|
long flags,
|
||||||
int desiredWidth, int desiredHeight)
|
int desiredWidth, int desiredHeight)
|
||||||
{
|
{
|
||||||
int width, height, bpp;
|
int width, height, bpp;
|
||||||
@@ -807,30 +807,30 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
fullname = name;
|
fullname = name;
|
||||||
|
|
||||||
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
if ( !MGL_getPNGSize(fullname.mb_str(), &width, &height, &bpp, &pf) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( bpp != 32 )
|
if ( bpp != 32 )
|
||||||
{
|
{
|
||||||
// We can load ordinary PNGs faster with 'normal' MGL handler.
|
// We can load ordinary PNGs faster with 'normal' MGL handler.
|
||||||
// Only RGBA PNGs need to be processed in special way because
|
// Only RGBA PNGs need to be processed in special way because
|
||||||
// we have to convert alpha channel to mask
|
// we have to convert alpha channel to mask
|
||||||
return wxMGLBitmapHandler::LoadFile(bitmap, name, flags,
|
return wxMGLBitmapHandler::LoadFile(bitmap, name, flags,
|
||||||
desiredWidth, desiredHeight);
|
desiredWidth, desiredHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
bitmap_t *bmp = MGL_loadPNG(fullname.mb_str(), TRUE);
|
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);
|
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:
|
// convert bmp to display's depth and write it to *bitmap:
|
||||||
wxMemoryDC dc;
|
wxMemoryDC dc;
|
||||||
dc.SelectObject(*bitmap);
|
dc.SelectObject(*bitmap);
|
||||||
dc.GetMGLDC()->putBitmap(0, 0, bmp, MGL_REPLACE_MODE);
|
dc.GetMGLDC()->putBitmap(0, 0, bmp, MGL_REPLACE_MODE);
|
||||||
dc.SelectObject(wxNullBitmap);
|
dc.SelectObject(wxNullBitmap);
|
||||||
|
|
||||||
// create mask, if bmp contains alpha channel (ARGB format):
|
// create mask, if bmp contains alpha channel (ARGB format):
|
||||||
if ( bmp->bitsPerPixel == 32 )
|
if ( bmp->bitsPerPixel == 32 )
|
||||||
{
|
{
|
||||||
@@ -841,7 +841,7 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
s = ((wxUint32*)bmp->surface) + y * bmp->bytesPerLine/4;
|
s = ((wxUint32*)bmp->surface) + y * bmp->bytesPerLine/4;
|
||||||
for (x = 0; x < bmp->width; x++, s ++)
|
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 )
|
<< bmp->pf->alphaAdjust) < 128 )
|
||||||
*s = 0;
|
*s = 0;
|
||||||
else
|
else
|
||||||
@@ -854,10 +854,10 @@ bool wxPNGBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
dc.SelectObject(wxNullBitmap);
|
dc.SelectObject(wxNullBitmap);
|
||||||
bitmap->SetMask(new wxMask(mask));
|
bitmap->SetMask(new wxMask(mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
MGL_unloadBitmap(bmp);
|
MGL_unloadBitmap(bmp);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -868,18 +868,22 @@ class wxICOBitmapHandler: public wxBitmapHandler
|
|||||||
public:
|
public:
|
||||||
wxICOBitmapHandler(wxBitmapType type,
|
wxICOBitmapHandler(wxBitmapType type,
|
||||||
const wxString& extension, const wxString& name);
|
const wxString& extension, const wxString& name);
|
||||||
|
|
||||||
virtual bool Create(wxBitmap *bitmap, void *data, long flags,
|
virtual bool Create(wxBitmap *WXUNUSED(bitmap),
|
||||||
int width, int height, int depth = 1)
|
void *WXUNUSED(data),
|
||||||
{ return FALSE; }
|
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,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight);
|
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);
|
int type, const wxPalette *palette = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
|
wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
|
||||||
const wxString& extension,
|
const wxString& extension,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
: wxBitmapHandler()
|
: wxBitmapHandler()
|
||||||
@@ -889,9 +893,9 @@ wxICOBitmapHandler::wxICOBitmapHandler(wxBitmapType type,
|
|||||||
SetExtension(extension);
|
SetExtension(extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
||||||
long flags,
|
long flags,
|
||||||
int WXUNUSED(desiredWidth),
|
int WXUNUSED(desiredWidth),
|
||||||
int WXUNUSED(desiredHeight))
|
int WXUNUSED(desiredHeight))
|
||||||
{
|
{
|
||||||
icon_t *icon = NULL;
|
icon_t *icon = NULL;
|
||||||
@@ -899,10 +903,10 @@ bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
|
|
||||||
if ( flags == wxBITMAP_TYPE_ICO_RESOURCE )
|
if ( flags == wxBITMAP_TYPE_ICO_RESOURCE )
|
||||||
icon = MGL_loadIcon(wxString(name + wxT(".ico")).mb_str(), TRUE);
|
icon = MGL_loadIcon(wxString(name + wxT(".ico")).mb_str(), TRUE);
|
||||||
else
|
else
|
||||||
icon = MGL_loadIcon(name.mb_str(), TRUE);
|
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);
|
bitmap->Create(icon->xorMask.width, icon->xorMask.height);
|
||||||
|
|
||||||
@@ -922,18 +926,20 @@ bool wxICOBitmapHandler::LoadFile(wxBitmap *bitmap, const wxString& name,
|
|||||||
dc->clearDevice();
|
dc->clearDevice();
|
||||||
dc->putMonoImage(0, 0, icon->xorMask.width, icon->byteWidth,
|
dc->putMonoImage(0, 0, icon->xorMask.width, icon->byteWidth,
|
||||||
icon->xorMask.height, (void*)icon->andMask);
|
icon->xorMask.height, (void*)icon->andMask);
|
||||||
|
|
||||||
bitmap->SetMask(new wxMask(mask));
|
bitmap->SetMask(new wxMask(mask));
|
||||||
|
|
||||||
MGL_unloadIcon(icon);
|
MGL_unloadIcon(icon);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxICOBitmapHandler::SaveFile(const wxBitmap *bitmap, const wxString& name,
|
bool wxICOBitmapHandler::SaveFile(const wxBitmap *WXUNUSED(bitmap),
|
||||||
int type, const wxPalette * WXUNUSED(palette))
|
const wxString& WXUNUSED(name),
|
||||||
|
int WXUNUSED(type),
|
||||||
|
const wxPalette * WXUNUSED(palette))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ void wxBitmapToPixPattern(const wxBitmap& bitmap,
|
|||||||
mask->p[y] = 0;
|
mask->p[y] = 0;
|
||||||
for (x = 0; x < 8; x++)
|
for (x = 0; x < 8; x++)
|
||||||
if ( dc->getPixelFast(x, y) != 0 )
|
if ( dc->getPixelFast(x, y) != 0 )
|
||||||
mask->p[y] |= 1 << (7 - x);
|
mask->p[y] = (uchar)(mask->p[y] | (1 << (7 - x)));
|
||||||
}
|
}
|
||||||
dc->endPixel();
|
dc->endPixel();
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: cursor.cpp
|
// Name: src/mgl/cursor.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -109,13 +109,12 @@ wxCursor::wxCursor(int cursorId)
|
|||||||
case wxCURSOR_NONE:
|
case wxCURSOR_NONE:
|
||||||
*this = wxNullCursor;
|
*this = wxNullCursor;
|
||||||
return;
|
return;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG(wxT("unsupported cursor type"));
|
wxFAIL_MSG(wxT("unsupported cursor type"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
M_CURSORDATA->m_cursor = new MGLCursor(cursorname);
|
M_CURSORDATA->m_cursor = new MGLCursor(cursorname);
|
||||||
|
|
||||||
// if we cannot load arrow cursor, use MGL's default arrow cursor:
|
// 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;
|
delete M_CURSORDATA->m_cursor;
|
||||||
M_CURSORDATA->m_cursor = new MGLCursor(MGL_DEF_CURSOR);
|
M_CURSORDATA->m_cursor = new MGLCursor(MGL_DEF_CURSOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !M_CURSORDATA->m_cursor->valid() )
|
if ( !M_CURSORDATA->m_cursor->valid() )
|
||||||
{
|
{
|
||||||
wxLogError(_("Couldn't create cursor."));
|
wxLogError(_("Couldn't create cursor."));
|
||||||
@@ -133,7 +132,7 @@ wxCursor::wxCursor(int cursorId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
(*gs_cursorsHash)[cursorId] = *this;
|
(*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);
|
cursorId, cursorname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[],
|
|||||||
|
|
||||||
wxCursor::wxCursor(const wxString& cursor_file,
|
wxCursor::wxCursor(const wxString& cursor_file,
|
||||||
long flags,
|
long flags,
|
||||||
int hotSpotX, int hotSpotY)
|
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY))
|
||||||
{
|
{
|
||||||
if ( flags == wxBITMAP_TYPE_CUR || flags == wxBITMAP_TYPE_CUR_RESOURCE )
|
if ( flags == wxBITMAP_TYPE_CUR || flags == wxBITMAP_TYPE_CUR_RESOURCE )
|
||||||
{
|
{
|
||||||
@@ -226,7 +225,7 @@ void wxSetCursor(const wxCursor& cursor)
|
|||||||
{
|
{
|
||||||
if ( g_winMng )
|
if ( g_winMng )
|
||||||
MGL_wmSetGlobalCursor(g_winMng, NULL);
|
MGL_wmSetGlobalCursor(g_winMng, NULL);
|
||||||
gs_globalCursor = wxNullCursor;
|
gs_globalCursor = wxNullCursor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,8 +284,8 @@ bool wxIsBusy()
|
|||||||
class wxCursorModule : public wxModule
|
class wxCursorModule : public wxModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool OnInit() { return TRUE; }
|
virtual bool OnInit() { return true; }
|
||||||
|
|
||||||
virtual void OnExit()
|
virtual void OnExit()
|
||||||
{
|
{
|
||||||
wxDELETE(gs_cursorsHash);
|
wxDELETE(gs_cursorsHash);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mgl/data.cpp
|
// Name: src/mgl/data.cpp
|
||||||
// Purpose: wxMGL-specific global data
|
// Purpose: wxMGL-specific global data
|
||||||
// Author: Robert Roebling
|
// Author: Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
@@ -7,6 +7,13 @@
|
|||||||
// Licence: wxWindows licence
|
// 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/defs.h"
|
||||||
#include "wx/cursor.h"
|
#include "wx/cursor.h"
|
||||||
|
|
||||||
@@ -15,15 +22,14 @@
|
|||||||
wxCursor g_globalCursor;
|
wxCursor g_globalCursor;
|
||||||
|
|
||||||
/* Don't allow event propagation during drag */
|
/* Don't allow event propagation during drag */
|
||||||
bool g_blockEventsOnDrag = FALSE;
|
bool g_blockEventsOnDrag = false;
|
||||||
|
|
||||||
/* Don't allow mouse event propagation during scroll */
|
/* 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 */
|
/* Don't allow window closing if there are open dialogs */
|
||||||
int g_openDialogs = 0;
|
int g_openDialogs = 0;
|
||||||
|
|
||||||
/* TRUE when the message queue is empty. this gets set to
|
/* true when the message queue is empty. this gets set to
|
||||||
FALSE by all event callbacks before anything else is done */
|
false by all event callbacks before anything else is done */
|
||||||
bool g_isIdle = FALSE;
|
bool g_isIdle = false;
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: dc.cpp
|
// Name: src/mgl/dc.cpp
|
||||||
// Purpose: wxDC class
|
// Purpose: wxDC class
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Created: 2001/03/09
|
// Created: 2001/03/09
|
||||||
@@ -137,10 +137,10 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxDCBase)
|
|||||||
// Default constructor
|
// Default constructor
|
||||||
wxDC::wxDC()
|
wxDC::wxDC()
|
||||||
{
|
{
|
||||||
m_isMemDC = FALSE;
|
m_isMemDC = false;
|
||||||
m_MGLDC = NULL;
|
m_MGLDC = NULL;
|
||||||
m_OwnsMGLDC = FALSE;
|
m_OwnsMGLDC = false;
|
||||||
m_ok = FALSE; // must call SetMGLDevCtx() before using it
|
m_ok = false; // must call SetMGLDevCtx() before using it
|
||||||
|
|
||||||
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
|
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
|
||||||
(double)wxGetDisplaySizeMM().GetWidth();
|
(double)wxGetDisplaySizeMM().GetWidth();
|
||||||
@@ -152,8 +152,8 @@ wxDC::wxDC()
|
|||||||
m_brush = *wxWHITE_BRUSH;
|
m_brush = *wxWHITE_BRUSH;
|
||||||
m_penOfsX = m_penOfsY = 0;
|
m_penOfsX = m_penOfsY = 0;
|
||||||
|
|
||||||
m_penSelected = m_brushSelected = FALSE;
|
m_penSelected = m_brushSelected = false;
|
||||||
m_downloadedPatterns[0] = m_downloadedPatterns[1] = FALSE;
|
m_downloadedPatterns[0] = m_downloadedPatterns[1] = false;
|
||||||
|
|
||||||
m_mglFont = NULL;
|
m_mglFont = NULL;
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ void wxDC::SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC)
|
|||||||
delete m_MGLDC;
|
delete m_MGLDC;
|
||||||
m_MGLDC = mgldc;
|
m_MGLDC = mgldc;
|
||||||
m_OwnsMGLDC = OwnsMGLDC;
|
m_OwnsMGLDC = OwnsMGLDC;
|
||||||
m_ok = TRUE;
|
m_ok = true;
|
||||||
|
|
||||||
if ( !m_globalClippingRegion.IsNull() )
|
if ( !m_globalClippingRegion.IsNull() )
|
||||||
SetClippingRegion(m_globalClippingRegion);
|
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_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
|
||||||
|
|
||||||
m_clipping = TRUE;
|
m_clipping = true;
|
||||||
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
|
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region)
|
|||||||
|
|
||||||
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
|
m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion());
|
||||||
|
|
||||||
m_clipping = TRUE;
|
m_clipping = true;
|
||||||
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
|
DO_SET_CLIPPING_BOX(m_currentClippingRegion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ void wxDC::DestroyClippingRegion()
|
|||||||
{
|
{
|
||||||
m_MGLDC->setClipRegion(m_globalClippingRegion.GetMGLRegion());
|
m_MGLDC->setClipRegion(m_globalClippingRegion.GetMGLRegion());
|
||||||
m_currentClippingRegion = m_globalClippingRegion;
|
m_currentClippingRegion = m_globalClippingRegion;
|
||||||
m_clipping = TRUE;
|
m_clipping = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -284,12 +284,12 @@ void wxDC::DestroyClippingRegion()
|
|||||||
|
|
||||||
bool wxDC::CanDrawBitmap() const
|
bool wxDC::CanDrawBitmap() const
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDC::CanGetTextExtent() const
|
bool wxDC::CanGetTextExtent() const
|
||||||
{
|
{
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDC::GetDepth() const
|
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
|
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;
|
uchar r, g, b;
|
||||||
m_MGLDC->unpackColorFast(m_MGLDC->getPixel(XLOG2DEV(x), YLOG2DEV(y)),
|
m_MGLDC->unpackColorFast(m_MGLDC->getPixel(XLOG2DEV(x), YLOG2DEV(y)),
|
||||||
r, g, b);
|
r, g, b);
|
||||||
col->Set(r, g, b);
|
col->Set(r, g, b);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoCrossHair(wxCoord x, wxCoord y)
|
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") );
|
wxCHECK_RET( Ok(), wxT("invalid dc") );
|
||||||
|
|
||||||
@@ -710,7 +710,7 @@ bool wxDC::SelectMGLFont()
|
|||||||
bool antialiased = (GetDepth() > 8);
|
bool antialiased = (GetDepth() > 8);
|
||||||
|
|
||||||
m_mglFont = m_font.GetMGLfont_t(scale, antialiased);
|
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);
|
m_MGLDC->useFont(m_mglFont);
|
||||||
wxLogTrace("mgl_font", "useFont(%p)", m_mglFont);
|
wxLogTrace("mgl_font", "useFont(%p)", m_mglFont);
|
||||||
@@ -731,7 +731,7 @@ bool wxDC::SelectMGLFont()
|
|||||||
m_MGLDC->setTextEncoding(nativeEnc.mglEncoding);
|
m_MGLDC->setTextEncoding(nativeEnc.mglEncoding);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y)
|
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_MGLDC->line(x1, y1, x2, y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_penSelected = m_brushSelected = FALSE;
|
m_penSelected = m_brushSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawRotatedText(const wxString& text,
|
void wxDC::DoDrawRotatedText(const wxString& text,
|
||||||
@@ -937,7 +937,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
|
|||||||
if ( !m_downloadedPatterns[slot] )
|
if ( !m_downloadedPatterns[slot] )
|
||||||
{
|
{
|
||||||
m_MGLDC->setPenBitmapPattern(slot, pattern);
|
m_MGLDC->setPenBitmapPattern(slot, pattern);
|
||||||
m_downloadedPatterns[slot] = TRUE;
|
m_downloadedPatterns[slot] = true;
|
||||||
}
|
}
|
||||||
m_MGLDC->usePenBitmapPattern(slot);
|
m_MGLDC->usePenBitmapPattern(slot);
|
||||||
}
|
}
|
||||||
@@ -954,7 +954,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
|
|||||||
case 8:
|
case 8:
|
||||||
for (y = 0; y < 8; y++)
|
for (y = 0; y < 8; y++)
|
||||||
for (x = 0; x < 8; x++)
|
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][0],
|
||||||
pixPattern->p[x][y][1],
|
pixPattern->p[x][y][1],
|
||||||
pixPattern->p[x][y][2]);
|
pixPattern->p[x][y][2]);
|
||||||
@@ -963,7 +963,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
|
|||||||
case 16:
|
case 16:
|
||||||
for (y = 0; y < 8; y++)
|
for (y = 0; y < 8; y++)
|
||||||
for (x = 0; x < 8; x++)
|
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][0],
|
||||||
pixPattern->p[x][y][1],
|
pixPattern->p[x][y][1],
|
||||||
pixPattern->p[x][y][2]);
|
pixPattern->p[x][y][2]);
|
||||||
@@ -987,7 +987,7 @@ void wxDC::SelectMGLFatPen(int style, int flag)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_MGLDC->setPenPixmapPattern(slot, &pix);
|
m_MGLDC->setPenPixmapPattern(slot, &pix);
|
||||||
m_downloadedPatterns[slot] = TRUE;
|
m_downloadedPatterns[slot] = true;
|
||||||
}
|
}
|
||||||
m_MGLDC->usePenPixmapPattern(slot);
|
m_MGLDC->usePenPixmapPattern(slot);
|
||||||
}
|
}
|
||||||
@@ -1039,8 +1039,8 @@ void wxDC::SelectPen()
|
|||||||
SelectMGLFatPen(wxSOLID, wxMGL_SELECT_FROM_PEN);
|
SelectMGLFatPen(wxSOLID, wxMGL_SELECT_FROM_PEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m_penSelected = TRUE;
|
m_penSelected = true;
|
||||||
m_brushSelected = FALSE;
|
m_brushSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SelectBrush()
|
void wxDC::SelectBrush()
|
||||||
@@ -1063,8 +1063,8 @@ void wxDC::SelectBrush()
|
|||||||
|
|
||||||
m_MGLDC->setColorRGB(fg.Red(), fg.Green(), fg.Blue());
|
m_MGLDC->setColorRGB(fg.Red(), fg.Green(), fg.Blue());
|
||||||
m_MGLDC->setBackColor(m_MGLDC->packColorFast(bg.Red(), bg.Green(), bg.Blue()));
|
m_MGLDC->setBackColor(m_MGLDC->packColorFast(bg.Red(), bg.Green(), bg.Blue()));
|
||||||
m_penSelected = FALSE;
|
m_penSelected = false;
|
||||||
m_brushSelected = TRUE;
|
m_brushSelected = true;
|
||||||
|
|
||||||
SelectMGLFatPen(m_brush.GetStyle(), wxMGL_SELECT_FROM_BRUSH);
|
SelectMGLFatPen(m_brush.GetStyle(), wxMGL_SELECT_FROM_BRUSH);
|
||||||
}
|
}
|
||||||
@@ -1074,8 +1074,8 @@ void wxDC::SetPen(const wxPen& pen)
|
|||||||
if ( !pen.Ok() ) return;
|
if ( !pen.Ok() ) return;
|
||||||
if ( m_pen == pen ) return;
|
if ( m_pen == pen ) return;
|
||||||
m_pen = pen;
|
m_pen = pen;
|
||||||
m_penSelected = FALSE;
|
m_penSelected = false;
|
||||||
m_downloadedPatterns[0] = FALSE;
|
m_downloadedPatterns[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetBrush(const wxBrush& brush)
|
void wxDC::SetBrush(const wxBrush& brush)
|
||||||
@@ -1083,8 +1083,8 @@ void wxDC::SetBrush(const wxBrush& brush)
|
|||||||
if ( !brush.Ok() ) return;
|
if ( !brush.Ok() ) return;
|
||||||
if ( m_brush == brush ) return;
|
if ( m_brush == brush ) return;
|
||||||
m_brush = brush;
|
m_brush = brush;
|
||||||
m_brushSelected = FALSE;
|
m_brushSelected = false;
|
||||||
m_downloadedPatterns[1] = FALSE;
|
m_downloadedPatterns[1] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetPalette(const wxPalette& palette)
|
void wxDC::SetPalette(const wxPalette& palette)
|
||||||
@@ -1179,10 +1179,10 @@ int wxDC::LogicalFunctionToMGLRop(int logFunc) const
|
|||||||
return (int)rop;
|
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.
|
// We might be previewing, so return true to let it continue.
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::EndDoc()
|
void wxDC::EndDoc()
|
||||||
@@ -1264,7 +1264,7 @@ void wxDC::ComputeScaleAndOrigin()
|
|||||||
m_mglFont = NULL;
|
m_mglFont = NULL;
|
||||||
// make sure m_penOfs{X,Y} will be reevaluated before drawing:
|
// make sure m_penOfs{X,Y} will be reevaluated before drawing:
|
||||||
if ( newY != m_scaleY || newX != m_scaleX )
|
if ( newY != m_scaleY || newX != m_scaleX )
|
||||||
m_penSelected = FALSE;
|
m_penSelected = false;
|
||||||
|
|
||||||
m_scaleX = newX, m_scaleY = newY;
|
m_scaleX = newX, m_scaleY = newY;
|
||||||
}
|
}
|
||||||
@@ -1409,8 +1409,8 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
|||||||
int rop, bool useMask,
|
int rop, bool useMask,
|
||||||
wxCoord xsrcMask, wxCoord ysrcMask)
|
wxCoord xsrcMask, wxCoord ysrcMask)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), FALSE, wxT("invalid dc") );
|
wxCHECK_MSG( Ok(), false, wxT("invalid dc") );
|
||||||
wxCHECK_MSG( source, FALSE, wxT("invalid source dc") );
|
wxCHECK_MSG( source, false, wxT("invalid source dc") );
|
||||||
|
|
||||||
// transform the source DC coords to the device ones
|
// transform the source DC coords to the device ones
|
||||||
xsrc = source->LogicalToDeviceX(xsrc);
|
xsrc = source->LogicalToDeviceX(xsrc);
|
||||||
@@ -1450,7 +1450,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
|
|||||||
xx, yy, LogicalFunctionToMGLRop(rop));
|
xx, yy, LogicalFunctionToMGLRop(rop));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask)
|
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)
|
void wxDC::DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
|
||||||
{
|
{
|
||||||
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
|
// 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);
|
temp = new MGLMemoryDC(dw, dh, GetDepth(), NULL);
|
||||||
wxDC tempdc;
|
wxDC tempdc;
|
||||||
tempdc.SetMGLDC(temp, FALSE);
|
tempdc.SetMGLDC(temp, false);
|
||||||
tempdc.SetPalette(m_palette);
|
tempdc.SetPalette(m_palette);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mgl/evtloop.cpp
|
// Name: src/mgl/evtloop.cpp
|
||||||
// Purpose: implements wxEventLoop for MGL
|
// Purpose: implements wxEventLoop for MGL
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@@ -39,19 +39,19 @@ public:
|
|||||||
wxEventLoopImpl()
|
wxEventLoopImpl()
|
||||||
{
|
{
|
||||||
SetExitCode(0);
|
SetExitCode(0);
|
||||||
SetKeepLooping(TRUE);
|
SetKeepLooping(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process an event
|
// process an event
|
||||||
void Dispatch();
|
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();
|
bool SendIdleEvent();
|
||||||
|
|
||||||
// set/get the exit code
|
// set/get the exit code
|
||||||
void SetExitCode(int exitcode) { m_exitcode = exitcode; }
|
void SetExitCode(int exitcode) { m_exitcode = exitcode; }
|
||||||
int GetExitCode() const { return m_exitcode; }
|
int GetExitCode() const { return m_exitcode; }
|
||||||
|
|
||||||
void SetKeepLooping(bool k) { m_keepLooping = k; }
|
void SetKeepLooping(bool k) { m_keepLooping = k; }
|
||||||
bool GetKeepLooping() const { return m_keepLooping; }
|
bool GetKeepLooping() const { return m_keepLooping; }
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ private:
|
|||||||
|
|
||||||
// the exit code of the event loop
|
// the exit code of the event loop
|
||||||
int m_exitcode;
|
int m_exitcode;
|
||||||
// FALSE if the loop should end
|
// false if the loop should end
|
||||||
bool m_keepLooping;
|
bool m_keepLooping;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ void wxEventLoopImpl::Dispatch()
|
|||||||
PM_sleep(10);
|
PM_sleep(10);
|
||||||
}
|
}
|
||||||
// end of EVT_halt
|
// end of EVT_halt
|
||||||
|
|
||||||
MGL_wmProcessEvent(g_winMng, &evt);
|
MGL_wmProcessEvent(g_winMng, &evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ int wxEventLoop::Run()
|
|||||||
wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") );
|
wxCHECK_MSG( !IsRunning(), -1, _T("can't reenter a message loop") );
|
||||||
|
|
||||||
m_impl = new wxEventLoopImpl;
|
m_impl = new wxEventLoopImpl;
|
||||||
|
|
||||||
wxEventLoop *oldLoop = ms_activeLoop;
|
wxEventLoop *oldLoop = ms_activeLoop;
|
||||||
ms_activeLoop = this;
|
ms_activeLoop = this;
|
||||||
|
|
||||||
@@ -154,8 +154,8 @@ void wxEventLoop::Exit(int rc)
|
|||||||
wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );
|
wxCHECK_RET( IsRunning(), _T("can't call Exit() if not running") );
|
||||||
|
|
||||||
m_impl->SetExitCode(rc);
|
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
|
// Send a dummy event so that the app won't block in EVT_halt if there
|
||||||
// are no user-generated events in the queue:
|
// are no user-generated events in the queue:
|
||||||
EVT_post(0, EVT_USEREVT, 0, 0);
|
EVT_post(0, EVT_USEREVT, 0, 0);
|
||||||
@@ -167,18 +167,18 @@ void wxEventLoop::Exit(int rc)
|
|||||||
|
|
||||||
bool wxEventLoop::Pending() const
|
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:
|
// changes take effect immediately, not after emptying events queue:
|
||||||
MGL_wmUpdateDC(g_winMng);
|
MGL_wmUpdateDC(g_winMng);
|
||||||
|
|
||||||
// is there an event in the queue?
|
// is there an event in the queue?
|
||||||
event_t evt;
|
event_t evt;
|
||||||
return EVT_peekNext(&evt, EVT_EVERYEVT);
|
return (bool)(EVT_peekNext(&evt, EVT_EVERYEVT));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxEventLoop::Dispatch()
|
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();
|
m_impl->Dispatch();
|
||||||
return m_impl->GetKeepLooping();
|
return m_impl->GetKeepLooping();
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mgl/fontutil.cpp
|
// Name: src/mgl/fontutil.cpp
|
||||||
// Purpose: Font helper functions for MGL
|
// Purpose: Font helper functions for MGL
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Created: 2001/04/29
|
// Created: 2001/04/29
|
||||||
@@ -45,20 +45,20 @@ bool wxNativeEncodingInfo::FromString(const wxString& s)
|
|||||||
wxString encid = tokenizer.GetNextToken();
|
wxString encid = tokenizer.GetNextToken();
|
||||||
long enc;
|
long enc;
|
||||||
if ( !encid.ToLong(&enc) )
|
if ( !encid.ToLong(&enc) )
|
||||||
return FALSE;
|
return false;
|
||||||
encoding = (wxFontEncoding)enc;
|
encoding = (wxFontEncoding)enc;
|
||||||
|
|
||||||
// ok even if empty
|
// ok even if empty
|
||||||
facename = tokenizer.GetNextToken();
|
facename = tokenizer.GetNextToken();
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxNativeEncodingInfo::ToString() const
|
wxString wxNativeEncodingInfo::ToString() const
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
s << (long)encoding;
|
s << (long)encoding;
|
||||||
if ( !!facename )
|
if ( !facename.empty() )
|
||||||
{
|
{
|
||||||
s << _T(';') << facename;
|
s << _T(';') << facename;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ wxString wxNativeEncodingInfo::ToString() const
|
|||||||
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
||||||
wxNativeEncodingInfo *info)
|
wxNativeEncodingInfo *info)
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( info, FALSE, _T("bad pointer in wxGetNativeFontEncoding") );
|
wxCHECK_MSG( info, false, _T("bad pointer in wxGetNativeFontEncoding") );
|
||||||
|
|
||||||
if ( encoding == wxFONTENCODING_DEFAULT )
|
if ( encoding == wxFONTENCODING_DEFAULT )
|
||||||
{
|
{
|
||||||
@@ -122,29 +122,29 @@ bool wxGetNativeFontEncoding(wxFontEncoding encoding,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// encoding not known to MGL
|
// encoding not known to MGL
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->encoding = encoding;
|
info->encoding = encoding;
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
|
bool wxTestFontEncoding(const wxNativeEncodingInfo& info)
|
||||||
{
|
{
|
||||||
if ( !info.facename )
|
if ( !info.facename )
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
wxMGLFontFamily *family = wxTheFontsManager->GetFamily(info.facename);
|
wxMGLFontFamily *family = wxTheFontsManager->GetFamily(info.facename);
|
||||||
if ( !family )
|
if ( !family )
|
||||||
return FALSE;
|
return false;
|
||||||
if ( family->GetInfo()->fontLibType == MGL_BITMAPFONT_LIB )
|
if ( family->GetInfo()->fontLibType == MGL_BITMAPFONT_LIB )
|
||||||
return (info.mglEncoding == MGL_ENCODING_ASCII ||
|
return (info.mglEncoding == MGL_ENCODING_ASCII ||
|
||||||
info.mglEncoding == MGL_ENCODING_ISO8859_1 ||
|
info.mglEncoding == MGL_ENCODING_ISO8859_1 ||
|
||||||
info.mglEncoding == MGL_ENCODING_ISO8859_15 ||
|
info.mglEncoding == MGL_ENCODING_ISO8859_15 ||
|
||||||
info.mglEncoding == MGL_ENCODING_CP1252);
|
info.mglEncoding == MGL_ENCODING_CP1252);
|
||||||
else
|
else
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ WX_DECLARE_LIST(wxMGLFontInstance, wxMGLFontInstanceList);
|
|||||||
WX_DEFINE_LIST(wxMGLFontInstanceList);
|
WX_DEFINE_LIST(wxMGLFontInstanceList);
|
||||||
WX_DEFINE_LIST(wxMGLFontFamilyList);
|
WX_DEFINE_LIST(wxMGLFontFamilyList);
|
||||||
|
|
||||||
wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *fontLib,
|
wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *fontLib,
|
||||||
float pt, bool slant, bool aa)
|
float pt, bool slant, bool aa)
|
||||||
{
|
{
|
||||||
m_fontLib = fontLib;
|
m_fontLib = fontLib;
|
||||||
@@ -167,22 +167,22 @@ wxMGLFontInstance::wxMGLFontInstance(wxMGLFontLibrary *fontLib,
|
|||||||
|
|
||||||
float slantAngle = m_slant ? 15.0 : 0.0;
|
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_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);
|
m_pt, slantAngle, 0.0, aa);
|
||||||
wxASSERT_MSG( m_font, wxT("Cannot create font instance.") );
|
wxASSERT_MSG( m_font, wxT("Cannot create font instance.") );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMGLFontInstance::~wxMGLFontInstance()
|
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);
|
m_fontLib->GetMGLfont_lib_t()->name, m_slant, m_pt, m_aa);
|
||||||
if ( m_font )
|
if ( m_font )
|
||||||
MGL_unloadFontInstance(m_font);
|
MGL_unloadFontInstance(m_font);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
|
wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
|
||||||
wxMGLFontFamily *parentFamily)
|
wxMGLFontFamily *parentFamily)
|
||||||
{
|
{
|
||||||
m_family = parentFamily;
|
m_family = parentFamily;
|
||||||
@@ -192,7 +192,7 @@ wxMGLFontLibrary::wxMGLFontLibrary(const wxString& filename, int type,
|
|||||||
m_fontLib = NULL;
|
m_fontLib = NULL;
|
||||||
|
|
||||||
m_instances = new wxMGLFontInstanceList;
|
m_instances = new wxMGLFontInstanceList;
|
||||||
m_instances->DeleteContents(TRUE);
|
m_instances->DeleteContents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMGLFontLibrary::~wxMGLFontLibrary()
|
wxMGLFontLibrary::~wxMGLFontLibrary()
|
||||||
@@ -200,7 +200,7 @@ wxMGLFontLibrary::~wxMGLFontLibrary()
|
|||||||
wxLogTrace("mgl_font", "font library dtor '%s'", m_fileName.mb_str());
|
wxLogTrace("mgl_font", "font library dtor '%s'", m_fileName.mb_str());
|
||||||
delete m_instances;
|
delete m_instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMGLFontLibrary::IncRef()
|
void wxMGLFontLibrary::IncRef()
|
||||||
{
|
{
|
||||||
wxLogTrace("mgl_font", "incRef(%u) '%s'", m_refs, m_fileName.c_str());
|
wxLogTrace("mgl_font", "incRef(%u) '%s'", m_refs, m_fileName.c_str());
|
||||||
@@ -226,14 +226,12 @@ void wxMGLFontLibrary::DecRef()
|
|||||||
|
|
||||||
static int gs_antialiasingThreshold = -1;
|
static int gs_antialiasingThreshold = -1;
|
||||||
|
|
||||||
wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
||||||
float scale, bool aa)
|
float scale, bool aa)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_refs > 0 && m_fontLib, wxT("font library not loaded!"));
|
wxASSERT_MSG(m_refs > 0 && m_fontLib, wxT("font library not loaded!"));
|
||||||
|
|
||||||
wxString facename;
|
wxString facename;
|
||||||
bool slant;
|
|
||||||
bool antialiased;
|
|
||||||
float pt = (float)font->GetPointSize() * scale;
|
float pt = (float)font->GetPointSize() * scale;
|
||||||
|
|
||||||
if ( gs_antialiasingThreshold == -1 )
|
if ( gs_antialiasingThreshold == -1 )
|
||||||
@@ -241,7 +239,7 @@ wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
|||||||
gs_antialiasingThreshold = 10;
|
gs_antialiasingThreshold = 10;
|
||||||
#if wxUSE_SYSTEM_OPTIONS
|
#if wxUSE_SYSTEM_OPTIONS
|
||||||
if ( wxSystemOptions::HasOption(wxT("mgl.aa-threshold")) )
|
if ( wxSystemOptions::HasOption(wxT("mgl.aa-threshold")) )
|
||||||
gs_antialiasingThreshold =
|
gs_antialiasingThreshold =
|
||||||
wxSystemOptions::GetOptionInt(wxT("mgl.aa-threshold"));
|
wxSystemOptions::GetOptionInt(wxT("mgl.aa-threshold"));
|
||||||
wxLogTrace("mgl_font", "AA threshold set to %i", gs_antialiasingThreshold);
|
wxLogTrace("mgl_font", "AA threshold set to %i", gs_antialiasingThreshold);
|
||||||
#endif
|
#endif
|
||||||
@@ -250,38 +248,38 @@ wxMGLFontInstance *wxMGLFontLibrary::GetFontInstance(wxFont *font,
|
|||||||
// Small characters don't look good when antialiased with the algorithm
|
// Small characters don't look good when antialiased with the algorithm
|
||||||
// that FreeType uses (mere 2x2 supersampling), so lets disable it AA
|
// that FreeType uses (mere 2x2 supersampling), so lets disable it AA
|
||||||
// completely for small fonts.
|
// completely for small fonts.
|
||||||
if ( pt <= gs_antialiasingThreshold )
|
bool antialiased = false;
|
||||||
antialiased = FALSE;
|
if (( pt > gs_antialiasingThreshold ) &&
|
||||||
else
|
( m_fontLib->fontLibType != MGL_BITMAPFONT_LIB ) )
|
||||||
antialiased = (m_fontLib->fontLibType == MGL_BITMAPFONT_LIB) ? FALSE : aa;
|
antialiased = aa;
|
||||||
|
|
||||||
slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
|
bool slant = (((m_type & wxFONTFACE_ITALIC) == 0) &&
|
||||||
(font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
|
(font->GetStyle() == wxSLANT || font->GetStyle() == wxITALIC));
|
||||||
|
|
||||||
// FIXME_MGL -- MGL does not yet support slant, although the API is there
|
// 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);
|
m_fileName.mb_str(), slant, pt, antialiased);
|
||||||
|
|
||||||
wxMGLFontInstance *i;
|
wxMGLFontInstance *i;
|
||||||
wxMGLFontInstanceList::Node *node;
|
wxMGLFontInstanceList::Node *node;
|
||||||
|
|
||||||
for (node = m_instances->GetFirst(); node; node = node->GetNext())
|
for (node = m_instances->GetFirst(); node; node = node->GetNext())
|
||||||
{
|
{
|
||||||
i = node->GetData();
|
i = node->GetData();
|
||||||
if ( i->GetPt() == pt && i->GetSlant() == slant &&
|
if ( i->GetPt() == pt && i->GetSlant() == slant &&
|
||||||
i->GetAA() == antialiased )
|
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());
|
i->GetSlant(), i->GetPt(), i->GetAA());
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = new wxMGLFontInstance(this, pt, slant, antialiased);
|
i = new wxMGLFontInstance(this, pt, slant, antialiased);
|
||||||
m_instances->Append(i);
|
m_instances->Append(i);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -289,33 +287,33 @@ wxMGLFontFamily::wxMGLFontFamily(const font_info_t *info)
|
|||||||
{
|
{
|
||||||
m_name = info->familyName;
|
m_name = info->familyName;
|
||||||
m_fontInfo = info;
|
m_fontInfo = info;
|
||||||
|
|
||||||
if ( info->regularFace[0] == '\0' )
|
if ( info->regularFace[0] == '\0' )
|
||||||
m_fontLibs[wxFONTFACE_REGULAR] = NULL;
|
m_fontLibs[wxFONTFACE_REGULAR] = NULL;
|
||||||
else
|
else
|
||||||
m_fontLibs[wxFONTFACE_REGULAR] =
|
m_fontLibs[wxFONTFACE_REGULAR] =
|
||||||
new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR, this);
|
new wxMGLFontLibrary(info->regularFace, wxFONTFACE_REGULAR, this);
|
||||||
|
|
||||||
if ( info->italicFace[0] == '\0' )
|
if ( info->italicFace[0] == '\0' )
|
||||||
m_fontLibs[wxFONTFACE_ITALIC] = NULL;
|
m_fontLibs[wxFONTFACE_ITALIC] = NULL;
|
||||||
else
|
else
|
||||||
m_fontLibs[wxFONTFACE_ITALIC] =
|
m_fontLibs[wxFONTFACE_ITALIC] =
|
||||||
new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC, this);
|
new wxMGLFontLibrary(info->italicFace, wxFONTFACE_ITALIC, this);
|
||||||
|
|
||||||
if ( info->boldFace[0] == '\0' )
|
if ( info->boldFace[0] == '\0' )
|
||||||
m_fontLibs[wxFONTFACE_BOLD] = NULL;
|
m_fontLibs[wxFONTFACE_BOLD] = NULL;
|
||||||
else
|
else
|
||||||
m_fontLibs[wxFONTFACE_BOLD] =
|
m_fontLibs[wxFONTFACE_BOLD] =
|
||||||
new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD, this);
|
new wxMGLFontLibrary(info->boldFace, wxFONTFACE_BOLD, this);
|
||||||
|
|
||||||
if ( info->boldItalicFace[0] == '\0' )
|
if ( info->boldItalicFace[0] == '\0' )
|
||||||
m_fontLibs[wxFONTFACE_BOLD_ITALIC] = NULL;
|
m_fontLibs[wxFONTFACE_BOLD_ITALIC] = NULL;
|
||||||
else
|
else
|
||||||
m_fontLibs[wxFONTFACE_BOLD_ITALIC] =
|
m_fontLibs[wxFONTFACE_BOLD_ITALIC] =
|
||||||
new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC, this);
|
new wxMGLFontLibrary(info->boldItalicFace, wxFONTFACE_BOLD_ITALIC, this);
|
||||||
|
|
||||||
wxLogTrace("mgl_font", "new family '%s' (r=%s, i=%s, b=%s, bi=%s)\n",
|
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);
|
info->boldFace, info->boldItalicFace);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -340,8 +338,8 @@ wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
|
|||||||
wxMGLFontFamily *family;
|
wxMGLFontFamily *family;
|
||||||
int type;
|
int type;
|
||||||
wxString facename = font->GetFaceName();
|
wxString facename = font->GetFaceName();
|
||||||
|
|
||||||
if ( !facename.IsEmpty() )
|
if ( !facename.empty() )
|
||||||
family = GetFamily(facename);
|
family = GetFamily(facename);
|
||||||
else
|
else
|
||||||
family = NULL;
|
family = NULL;
|
||||||
@@ -405,7 +403,7 @@ wxMGLFontLibrary *wxFontsManager::GetFontLibrary(wxFont *font)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return family->GetLibrary(type);
|
return family->GetLibrary(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,9 +417,9 @@ static ibool MGLAPI enum_callback(const font_info_t *info, void *cookie)
|
|||||||
wxFontsManager::wxFontsManager()
|
wxFontsManager::wxFontsManager()
|
||||||
{
|
{
|
||||||
m_hash = new wxHashTable(wxKEY_STRING);
|
m_hash = new wxHashTable(wxKEY_STRING);
|
||||||
m_hash->DeleteContents(FALSE);
|
m_hash->DeleteContents(false);
|
||||||
m_list = new wxMGLFontFamilyList;
|
m_list = new wxMGLFontFamilyList;
|
||||||
m_list->DeleteContents(TRUE);
|
m_list->DeleteContents(true);
|
||||||
MGL_enumerateFonts(enum_callback, (void*)this);
|
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_hash->Put(f->GetName().Lower(), f);
|
||||||
m_list->Append(f);
|
m_list->Append(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMGLFontFamily *wxFontsManager::GetFamily(const wxString& name) const
|
wxMGLFontFamily *wxFontsManager::GetFamily(const wxString& name) const
|
||||||
{
|
{
|
||||||
return (wxMGLFontFamily*)m_hash->Get(name.Lower());
|
return (wxMGLFontFamily*)m_hash->Get(name.Lower());
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: region.cpp
|
// Name: src/mgl/region.cpp
|
||||||
// Purpose: Region handling for wxWidgets/MGL
|
// Purpose: Region handling for wxWidgets/MGL
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@@ -72,7 +72,7 @@ wxRegion::wxRegion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||||
{
|
{
|
||||||
m_refData = new wxRegionRefData;
|
m_refData = new wxRegionRefData;
|
||||||
MGLRect rect(x, y, x + w, y + h);
|
MGLRect rect(x, y, x + w, y + h);
|
||||||
M_REGION = rect;
|
M_REGION = rect;
|
||||||
@@ -126,7 +126,7 @@ void wxRegion::Clear()
|
|||||||
// Outer bounds of region
|
// Outer bounds of region
|
||||||
void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
|
void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
|
||||||
{
|
{
|
||||||
if (m_refData)
|
if (m_refData)
|
||||||
{
|
{
|
||||||
rect_t rect;
|
rect_t rect;
|
||||||
rect = M_REGION.getBounds();
|
rect = M_REGION.getBounds();
|
||||||
@@ -134,8 +134,8 @@ void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
|
|||||||
y = rect.top;
|
y = rect.top;
|
||||||
w = rect.right - rect.left;
|
w = rect.right - rect.left;
|
||||||
h = rect.bottom - rect.top;
|
h = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
x = y = w = h = 0;
|
x = y = w = h = 0;
|
||||||
}
|
}
|
||||||
@@ -151,8 +151,10 @@ wxRect wxRegion::GetBox() const
|
|||||||
// Is region empty?
|
// Is region empty?
|
||||||
bool wxRegion::Empty() const
|
bool wxRegion::Empty() const
|
||||||
{
|
{
|
||||||
if (!m_refData) return TRUE;
|
if (!m_refData)
|
||||||
return M_REGION.isEmpty();
|
return true;
|
||||||
|
|
||||||
|
return (bool)(M_REGION.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -163,7 +165,7 @@ bool wxRegion::Offset(wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION.offset(x, y);
|
M_REGION.offset(x, y);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Union rectangle or region with this.
|
// Union rectangle or region with this.
|
||||||
@@ -171,14 +173,14 @@ bool wxRegion::Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION += MGLRect(x, y, x + width, y + height);
|
M_REGION += MGLRect(x, y, x + width, y + height);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::Union(const wxRegion& region)
|
bool wxRegion::Union(const wxRegion& region)
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION += M_REGION_OF(region);
|
M_REGION += M_REGION_OF(region);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intersect rectangle or region with this.
|
// Intersect rectangle or region with this.
|
||||||
@@ -186,14 +188,14 @@ bool wxRegion::Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION &= MGLRect(x, y, x + width, y + height);
|
M_REGION &= MGLRect(x, y, x + width, y + height);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::Intersect(const wxRegion& region)
|
bool wxRegion::Intersect(const wxRegion& region)
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION &= M_REGION_OF(region);
|
M_REGION &= M_REGION_OF(region);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subtract rectangle or region from this:
|
// Subtract rectangle or region from this:
|
||||||
@@ -202,14 +204,14 @@ bool wxRegion::Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
|
|||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION -= MGLRect(x, y, x + width, y + height);
|
M_REGION -= MGLRect(x, y, x + width, y + height);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::Subtract(const wxRegion& region)
|
bool wxRegion::Subtract(const wxRegion& region)
|
||||||
{
|
{
|
||||||
AllocExclusive();
|
AllocExclusive();
|
||||||
M_REGION -= M_REGION_OF(region);
|
M_REGION -= M_REGION_OF(region);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XOR: the union of two combined regions except for any overlapping areas.
|
// 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,
|
MGLRegion rg1 = M_REGION + rect,
|
||||||
rg2 = M_REGION & rect;
|
rg2 = M_REGION & rect;
|
||||||
M_REGION = rg1 - rg2;
|
M_REGION = rg1 - rg2;
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::Xor(const wxRegion& region)
|
bool wxRegion::Xor(const wxRegion& region)
|
||||||
@@ -229,7 +231,7 @@ bool wxRegion::Xor(const wxRegion& region)
|
|||||||
MGLRegion rg1 = M_REGION + M_REGION_OF(region),
|
MGLRegion rg1 = M_REGION + M_REGION_OF(region),
|
||||||
rg2 = M_REGION & M_REGION_OF(region);
|
rg2 = M_REGION & M_REGION_OF(region);
|
||||||
M_REGION = rg1 - rg2;
|
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);
|
MGLRect rect(x, y, x + w, y + h);
|
||||||
MGLRegion rg;
|
MGLRegion rg;
|
||||||
|
|
||||||
// 1) is the rectangle entirely covered by the region?
|
// 1) is the rectangle entirely covered by the region?
|
||||||
rg = MGLRegion(rect) - M_REGION;
|
rg = MGLRegion(rect) - M_REGION;
|
||||||
if (rg.isEmpty()) return wxInRegion;
|
if (rg.isEmpty()) return wxInRegion;
|
||||||
|
|
||||||
// 2) is the rectangle completely outside the region?
|
// 2) is the rectangle completely outside the region?
|
||||||
rg = M_REGION & rect; // intersection
|
rg = M_REGION & rect; // intersection
|
||||||
if (rg.isEmpty()) return wxOutRegion;
|
if (rg.isEmpty()) return wxOutRegion;
|
||||||
@@ -296,7 +298,7 @@ public:
|
|||||||
virtual bool OnInit()
|
virtual bool OnInit()
|
||||||
{
|
{
|
||||||
gs_mutexIterator = new wxMutex();
|
gs_mutexIterator = new wxMutex();
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
virtual void OnExit()
|
virtual void OnExit()
|
||||||
{
|
{
|
||||||
@@ -313,7 +315,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMglRegionModule, wxModule)
|
|||||||
*/
|
*/
|
||||||
wxRegionIterator::wxRegionIterator() : m_currentNode(NULL)
|
wxRegionIterator::wxRegionIterator() : m_currentNode(NULL)
|
||||||
{
|
{
|
||||||
m_rects.DeleteContents(TRUE);
|
m_rects.DeleteContents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegionIterator::~wxRegionIterator()
|
wxRegionIterator::~wxRegionIterator()
|
||||||
@@ -325,23 +327,23 @@ wxRegionIterator::~wxRegionIterator()
|
|||||||
*/
|
*/
|
||||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
||||||
{
|
{
|
||||||
m_rects.DeleteContents(TRUE);
|
m_rects.DeleteContents(true);
|
||||||
Reset(region);
|
Reset(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset iterator for a new /e region.
|
* Reset iterator for a new /e region.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static wxRegionRectList *gs_rectList;
|
static wxRegionRectList *gs_rectList;
|
||||||
|
|
||||||
static void MGLAPI wxMGL_region_callback(const rect_t *r)
|
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));
|
r->right - r->left, r->bottom - r->top));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRegionIterator::Reset(const wxRegion& region)
|
void wxRegionIterator::Reset(const wxRegion& region)
|
||||||
{
|
{
|
||||||
m_currentNode = NULL;
|
m_currentNode = NULL;
|
||||||
@@ -350,7 +352,7 @@ void wxRegionIterator::Reset(const wxRegion& region)
|
|||||||
if (!region.Empty())
|
if (!region.Empty())
|
||||||
{
|
{
|
||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
wxMutexLocker(*gs_mutexIterator);
|
wxMutexLocker lock(*gs_mutexIterator);
|
||||||
#endif
|
#endif
|
||||||
gs_rectList = &m_rects;
|
gs_rectList = &m_rects;
|
||||||
M_REGION_OF(region).traverse(wxMGL_region_callback);
|
M_REGION_OF(region).traverse(wxMGL_region_callback);
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: settings.h
|
// Name: src/mgl/settings.cpp
|
||||||
// Author: Vaclav Slavik, Robert Roebling
|
// Author: Vaclav Slavik, Robert Roebling
|
||||||
// Id: $Id$
|
// Id: $Id$
|
||||||
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
@@ -28,7 +28,7 @@ static wxFont *gs_fontDefault = NULL;
|
|||||||
class wxSystemSettingsModule : public wxModule
|
class wxSystemSettingsModule : public wxModule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool OnInit() { return TRUE; }
|
virtual bool OnInit() { return true; }
|
||||||
virtual void OnExit()
|
virtual void OnExit()
|
||||||
{
|
{
|
||||||
delete gs_fontDefault;
|
delete gs_fontDefault;
|
||||||
@@ -65,18 +65,18 @@ wxFont wxSystemSettingsNative::GetFont(wxSystemFont index)
|
|||||||
case wxSYS_DEFAULT_GUI_FONT:
|
case wxSYS_DEFAULT_GUI_FONT:
|
||||||
{
|
{
|
||||||
if ( !gs_fontDefault )
|
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;
|
return *gs_fontDefault;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
return wxNullFont;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return wxNullFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
|
int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(win))
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case wxSYS_SCREEN_X:
|
case wxSYS_SCREEN_X:
|
||||||
@@ -87,22 +87,21 @@ int wxSystemSettingsNative::GetMetric(wxSystemMetric index, wxWindow* WXUNUSED(w
|
|||||||
return val;
|
return val;
|
||||||
case wxSYS_VSCROLL_X:
|
case wxSYS_VSCROLL_X:
|
||||||
case wxSYS_HSCROLL_Y:
|
case wxSYS_HSCROLL_Y:
|
||||||
return 15;
|
return 15;
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -1; // unsupported metric
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return -1; // unsupported metric
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
|
bool wxSystemSettingsNative::HasFeature(wxSystemFeature index)
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case wxSYS_CAN_ICONIZE_FRAME:
|
case wxSYS_CAN_ICONIZE_FRAME:
|
||||||
return FALSE; break;
|
return false;
|
||||||
case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
|
case wxSYS_CAN_DRAW_FRAME_DECORATIONS:
|
||||||
return FALSE; break;
|
return false;
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -167,13 +167,13 @@ static ibool MGLAPI wxWindowMouseHandler(window_t *wnd, event_t *e)
|
|||||||
event.SetTimestamp(e->when);
|
event.SetTimestamp(e->when);
|
||||||
event.m_x = where.x - orig.x;
|
event.m_x = where.x - orig.x;
|
||||||
event.m_y = where.y - orig.y;
|
event.m_y = where.y - orig.y;
|
||||||
event.m_shiftDown = e->modifiers & EVT_SHIFTKEY;
|
event.m_shiftDown = ( e->modifiers & EVT_SHIFTKEY ) == EVT_SHIFTKEY;
|
||||||
event.m_controlDown = e->modifiers & EVT_CTRLSTATE;
|
event.m_controlDown = ( e->modifiers & EVT_CTRLSTATE ) == EVT_CTRLSTATE;
|
||||||
event.m_altDown = e->modifiers & EVT_LEFTALT;
|
event.m_altDown = ( e->modifiers & EVT_LEFTALT ) == EVT_LEFTALT;
|
||||||
event.m_metaDown = e->modifiers & EVT_RIGHTALT;
|
event.m_metaDown = ( e->modifiers & EVT_RIGHTALT ) == EVT_RIGHTALT;
|
||||||
event.m_leftDown = e->modifiers & EVT_LEFTBUT;
|
event.m_leftDown = ( e->modifiers & EVT_LEFTBUT ) == EVT_LEFTBUT;
|
||||||
event.m_middleDown = e->modifiers & EVT_MIDDLEBUT;
|
event.m_middleDown = ( e->modifiers & EVT_MIDDLEBUT ) == EVT_MIDDLEBUT;
|
||||||
event.m_rightDown = e->modifiers & EVT_RIGHTBUT;
|
event.m_rightDown = ( e->modifiers & EVT_RIGHTBUT ) == EVT_RIGHTBUT;
|
||||||
|
|
||||||
switch (e->what)
|
switch (e->what)
|
||||||
{
|
{
|
||||||
@@ -435,10 +435,10 @@ static bool wxHandleSpecialKeys(wxKeyEvent& event)
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
wxCaptureScreenshot(event.m_altDown/*only active wnd?*/);
|
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)
|
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;
|
wxKeyEvent event;
|
||||||
event.SetEventObject(win);
|
event.SetEventObject(win);
|
||||||
event.SetTimestamp(e->when);
|
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_scanCode = 0; // not used by wx at all
|
||||||
event.m_x = where.x;
|
event.m_x = where.x;
|
||||||
event.m_y = where.y;
|
event.m_y = where.y;
|
||||||
event.m_shiftDown = e->modifiers & EVT_SHIFTKEY;
|
event.m_shiftDown = ( e->modifiers & EVT_SHIFTKEY ) == EVT_SHIFTKEY;
|
||||||
event.m_controlDown = e->modifiers & EVT_CTRLSTATE;
|
event.m_controlDown = ( e->modifiers & EVT_CTRLSTATE ) == EVT_CTRLSTATE;
|
||||||
event.m_altDown = e->modifiers & EVT_LEFTALT;
|
event.m_altDown = ( e->modifiers & EVT_LEFTALT ) == EVT_LEFTALT;
|
||||||
event.m_metaDown = e->modifiers & EVT_RIGHTALT;
|
event.m_metaDown = ( e->modifiers & EVT_RIGHTALT ) == EVT_RIGHTALT;
|
||||||
|
|
||||||
if ( e->what == EVT_KEYUP )
|
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
|
// wxMSW doesn't send char events with Alt pressed
|
||||||
// Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
// Only send wxEVT_CHAR event if not processed yet. Thus, ALT-x
|
||||||
// will only be sent if it is not in an accelerator table:
|
// 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 )
|
if ( !ret && event2.m_keyCode != 0 )
|
||||||
{
|
{
|
||||||
event2.SetEventType(wxEVT_CHAR);
|
event2.SetEventType(wxEVT_CHAR);
|
||||||
@@ -544,8 +544,8 @@ void wxWindowMGL::Init()
|
|||||||
|
|
||||||
// mgl specific:
|
// mgl specific:
|
||||||
m_wnd = NULL;
|
m_wnd = NULL;
|
||||||
m_isShown = TRUE;
|
m_isShown = true;
|
||||||
m_frozen = FALSE;
|
m_frozen = false;
|
||||||
m_paintMGLDC = NULL;
|
m_paintMGLDC = NULL;
|
||||||
m_eraseBackground = -1;
|
m_eraseBackground = -1;
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ wxWindowMGL::~wxWindowMGL()
|
|||||||
{
|
{
|
||||||
SendDestroyEvent();
|
SendDestroyEvent();
|
||||||
|
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = true;
|
||||||
|
|
||||||
if ( gs_mouseCapture == this )
|
if ( gs_mouseCapture == this )
|
||||||
ReleaseMouse();
|
ReleaseMouse();
|
||||||
@@ -597,7 +597,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
@@ -627,7 +627,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
|
|||||||
{
|
{
|
||||||
mgl_style |= MGL_WM_ALWAYS_ON_TOP;
|
mgl_style |= MGL_WM_ALWAYS_ON_TOP;
|
||||||
// it is created hidden as other top level windows
|
// it is created hidden as other top level windows
|
||||||
m_isShown = FALSE;
|
m_isShown = false;
|
||||||
wnd_parent = NULL;
|
wnd_parent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,7 +638,7 @@ bool wxWindowMGL::Create(wxWindow *parent,
|
|||||||
|
|
||||||
SetMGLwindow_t(wnd);
|
SetMGLwindow_t(wnd);
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMGL::SetMGLwindow_t(struct window_t *wnd)
|
void wxWindowMGL::SetMGLwindow_t(struct window_t *wnd)
|
||||||
@@ -649,7 +649,7 @@ void wxWindowMGL::SetMGLwindow_t(struct window_t *wnd)
|
|||||||
m_wnd = wnd;
|
m_wnd = wnd;
|
||||||
if ( !m_wnd ) return;
|
if ( !m_wnd ) return;
|
||||||
|
|
||||||
m_isShown = m_wnd->visible;
|
m_isShown = (bool)m_wnd->visible;
|
||||||
|
|
||||||
MGL_wmSetWindowUserData(m_wnd, (void*) this);
|
MGL_wmSetWindowUserData(m_wnd, (void*) this);
|
||||||
MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
|
MGL_wmSetWindowPainter(m_wnd, wxWindowPainter);
|
||||||
@@ -688,13 +688,13 @@ void wxWindowMGL::SetFocus()
|
|||||||
{
|
{
|
||||||
if ( gs_activeFrame )
|
if ( gs_activeFrame )
|
||||||
{
|
{
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, FALSE, gs_activeFrame->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, false, gs_activeFrame->GetId());
|
||||||
event.SetEventObject(gs_activeFrame);
|
event.SetEventObject(gs_activeFrame);
|
||||||
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
|
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
gs_activeFrame = active;
|
gs_activeFrame = active;
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, gs_activeFrame->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, true, gs_activeFrame->GetId());
|
||||||
event.SetEventObject(gs_activeFrame);
|
event.SetEventObject(gs_activeFrame);
|
||||||
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
|
gs_activeFrame->GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
@@ -746,7 +746,7 @@ wxWindow *wxWindowBase::DoFindFocus()
|
|||||||
bool wxWindowMGL::Show(bool show)
|
bool wxWindowMGL::Show(bool show)
|
||||||
{
|
{
|
||||||
if ( !wxWindowBase::Show(show) )
|
if ( !wxWindowBase::Show(show) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
MGL_wmShowWindow(m_wnd, show);
|
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
|
// Raise the window to the top of the Z order
|
||||||
@@ -811,7 +811,7 @@ bool wxWindowMGL::SetCursor(const wxCursor& cursor)
|
|||||||
if ( !wxWindowBase::SetCursor(cursor) )
|
if ( !wxWindowBase::SetCursor(cursor) )
|
||||||
{
|
{
|
||||||
// no change
|
// no change
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_cursor.Ok() )
|
if ( m_cursor.Ok() )
|
||||||
@@ -819,7 +819,7 @@ bool wxWindowMGL::SetCursor(const wxCursor& cursor)
|
|||||||
else
|
else
|
||||||
MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor());
|
MGL_wmSetWindowCursor(m_wnd, *wxSTANDARD_CURSOR->GetMGLCursor());
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMGL::WarpPointer(int x, int y)
|
void wxWindowMGL::WarpPointer(int x, int y)
|
||||||
@@ -844,11 +844,11 @@ void wxWindowMGL::WarpPointer(int x, int y)
|
|||||||
bool wxWindowMGL::Reparent(wxWindowBase *parent)
|
bool wxWindowMGL::Reparent(wxWindowBase *parent)
|
||||||
{
|
{
|
||||||
if ( !wxWindowBase::Reparent(parent) )
|
if ( !wxWindowBase::Reparent(parent) )
|
||||||
return FALSE;
|
return false;
|
||||||
|
|
||||||
MGL_wmReparentWindow(m_wnd, parent->GetHandle());
|
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
|
// old style file-manager drag&drop support: we retain the old-style
|
||||||
// DragAcceptFiles in parallel with SetDropTarget.
|
// DragAcceptFiles in parallel with SetDropTarget.
|
||||||
void wxWindowMGL::DragAcceptFiles(bool accept)
|
void wxWindowMGL::DragAcceptFiles(bool WXUNUSED(accept))
|
||||||
{
|
{
|
||||||
#if 0 // FIXME_MGL
|
#if 0 // FIXME_MGL
|
||||||
HWND hWnd = GetHwnd();
|
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);
|
DoMoveWindow(x, y, width, height);
|
||||||
|
|
||||||
wxSizeEvent event(wxSize(width, height), GetId());
|
wxSize newSize(width, height);
|
||||||
|
wxSizeEvent event(newSize, GetId());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
@@ -1123,13 +1124,13 @@ void wxWindowMGL::Update()
|
|||||||
|
|
||||||
void wxWindowMGL::Freeze()
|
void wxWindowMGL::Freeze()
|
||||||
{
|
{
|
||||||
m_frozen = TRUE;
|
m_frozen = true;
|
||||||
m_refreshAfterThaw = FALSE;
|
m_refreshAfterThaw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowMGL::Thaw()
|
void wxWindowMGL::Thaw()
|
||||||
{
|
{
|
||||||
m_frozen = FALSE;
|
m_frozen = false;
|
||||||
if ( m_refreshAfterThaw )
|
if ( m_refreshAfterThaw )
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1140,7 @@ void wxWindowMGL::HandlePaint(MGLDevCtx *dc)
|
|||||||
if ( m_frozen )
|
if ( m_frozen )
|
||||||
{
|
{
|
||||||
// Don't paint anything if the window is frozen.
|
// Don't paint anything if the window is frozen.
|
||||||
m_refreshAfterThaw = TRUE;
|
m_refreshAfterThaw = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: src/palmos/dir.cpp
|
// Name: src/msdos/dir.cpp
|
||||||
// Purpose: wxDir implementation for PalmOS
|
// Purpose: wxDir implementation for DOS
|
||||||
// Author: William Osborne - minimal working wxPalmOS port
|
// Author: derived from wxPalmOS code
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 10.13.04
|
// Created: 10.13.04
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
bool wxDir::Exists(const wxString& dir)
|
bool wxDir::Exists(const wxString& WXUNUSED(dir))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -72,11 +72,11 @@ bool wxDir::Exists(const wxString& dir)
|
|||||||
// wxDir construction/destruction
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -88,9 +88,7 @@ bool wxDir::IsOpened() const
|
|||||||
|
|
||||||
wxString wxDir::GetName() const
|
wxString wxDir::GetName() const
|
||||||
{
|
{
|
||||||
wxString name;
|
return wxEmptyString;
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDir::~wxDir()
|
wxDir::~wxDir()
|
||||||
@@ -101,15 +99,14 @@ wxDir::~wxDir()
|
|||||||
// wxDir enumerating
|
// wxDir enumerating
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxDir::GetFirst(wxString *filename,
|
bool wxDir::GetFirst(wxString *WXUNUSED(filename),
|
||||||
const wxString& filespec,
|
const wxString& WXUNUSED(filespec),
|
||||||
int flags) const
|
int WXUNUSED(flags)) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDir::GetNext(wxString *filename) const
|
bool wxDir::GetNext(wxString *WXUNUSED(filename)) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: mac/mimetype.cpp
|
// Name: src/msdos/mimetype.cpp
|
||||||
// Purpose: classes and functions to manage MIME types
|
// Purpose: classes and functions to manage MIME types
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -43,25 +43,28 @@
|
|||||||
// in case we're compiling in non-GUI mode
|
// in case we're compiling in non-GUI mode
|
||||||
class WXDLLEXPORT wxIcon;
|
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& WXUNUSED(extensions))
|
||||||
bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
|
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
|
bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
|
||||||
@@ -69,47 +72,49 @@ bool wxFileTypeImpl::GetMimeType(wxString *mimeType) const
|
|||||||
if ( m_strFileType.Length() > 0 )
|
if ( m_strFileType.Length() > 0 )
|
||||||
{
|
{
|
||||||
*mimeType = m_strFileType ;
|
*mimeType = m_strFileType ;
|
||||||
return TRUE ;
|
return true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
|
bool wxFileTypeImpl::GetMimeTypes(wxArrayString& mimeTypes) const
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
|
|
||||||
if (GetMimeType(&s))
|
if (GetMimeType(&s))
|
||||||
{
|
{
|
||||||
mimeTypes.Clear();
|
mimeTypes.Clear();
|
||||||
mimeTypes.Add(s);
|
mimeTypes.Add(s);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
|
bool wxFileTypeImpl::GetIcon(wxIconLocation *WXUNUSED(icon)) const
|
||||||
{
|
{
|
||||||
// no such file type or no value or incorrect icon entry
|
// 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
|
size_t
|
||||||
wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
|
wxFileTypeImpl::GetAllCommands(wxArrayString * WXUNUSED(verbs),
|
||||||
const wxFileType::MessageParameters& params) const
|
wxArrayString * WXUNUSED(commands),
|
||||||
|
const wxFileType::MessageParameters& WXUNUSED(params)) const
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
|
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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") );
|
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Initialize() not yet implemented") );
|
||||||
}
|
}
|
||||||
@@ -196,12 +201,12 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
|
|||||||
|
|
||||||
// MIME type -> extension -> file type
|
// MIME type -> extension -> file type
|
||||||
wxFileType *
|
wxFileType *
|
||||||
wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& mimeType)
|
wxMimeTypesManagerImpl::GetFileTypeFromMimeType(const wxString& WXUNUSED(mimeType))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
|
size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& WXUNUSED(mimetypes))
|
||||||
{
|
{
|
||||||
// VZ: don't know anything about this for Mac
|
// VZ: don't know anything about this for Mac
|
||||||
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
|
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::EnumAllFileTypes() not yet implemented") );
|
||||||
@@ -210,7 +215,7 @@ size_t wxMimeTypesManagerImpl::EnumAllFileTypes(wxArrayString& mimetypes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxFileType *
|
wxFileType *
|
||||||
wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
|
wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& WXUNUSED(ftInfo))
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
|
wxFAIL_MSG( _T("wxMimeTypesManagerImpl::Associate() not yet implemented") );
|
||||||
|
|
||||||
@@ -218,9 +223,9 @@ wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
wxMimeTypesManagerImpl::Unassociate(wxFileType *ft)
|
wxMimeTypesManagerImpl::Unassociate(wxFileType *WXUNUSED(ft))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_MIMETYPE
|
#endif // wxUSE_MIMETYPE
|
||||||
|
Reference in New Issue
Block a user