corrections for final release of Mac OS X

applied patches proposed by Mark Newsam


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9625 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot 2001-04-01 20:42:05 +00:00
parent 67bd5bad04
commit 5fde6fcc9b
73 changed files with 1242 additions and 872 deletions

View File

@ -77,6 +77,9 @@ protected:
int m_min;
int m_max;
private:
DECLARE_DYNAMIC_CLASS(wxSpinCtrl)
};
#endif // _WX_GENERIC_SPINCTRL_H_

View File

@ -32,7 +32,7 @@
#define wxMulDivInt32( a , b , c ) ::MulDiv( a , b , c )
#elif defined( __WXMAC__ )
#ifdef __WXMAC_X__
#include <CarbonCore/Math64.h>
#include <CoreServices/CoreServices.h>
#else
#include "Math64.h"
#endif

View File

@ -44,6 +44,7 @@ See mod_*.cpp and htmlwin.cpp for example :-)
// This must be part of the module you want to force:
#define FORCE_LINK_ME(module_name) \
int _link_dummy_func_##module_name (); \
int _link_dummy_func_##module_name () \
{ \
return 1; \

View File

@ -61,6 +61,7 @@ public:
bool Create(const wxBitmap& bitmap);
// Implementation
bool PointMasked(int x, int y);
inline WXHBITMAP GetMaskBitmap() const { return m_maskBitmap; }
inline void SetMaskBitmap(WXHBITMAP bmp) { m_maskBitmap = bmp; }
protected:
@ -153,28 +154,33 @@ public:
wxBitmap(int width, int height, int depth = -1);
~wxBitmap();
// get the given part of bitmap
wxBitmap GetSubBitmap( const wxRect& rect ) const;
virtual bool Create(int width, int height, int depth = -1);
virtual bool Create(void *data, long type, int width, int height, int depth = 1);
virtual bool LoadFile(const wxString& name, long type = wxBITMAP_TYPE_BMP_RESOURCE);
virtual bool SaveFile(const wxString& name, int type, const wxPalette *cmap = NULL);
inline bool Ok() const { return (M_BITMAPDATA && M_BITMAPDATA->m_ok); }
inline int GetWidth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_width : 0); }
inline int GetHeight() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_height : 0); }
inline int GetDepth() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_depth : 0); }
inline int GetQuality() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_quality : 0); }
bool Ok() const;
int GetWidth() const;
int GetHeight() const;
int GetDepth() const;
int GetQuality() const;
void SetWidth(int w);
void SetHeight(int h);
void SetDepth(int d);
void SetQuality(int q);
void SetOk(bool isOk);
inline wxPalette* GetPalette() const { return (M_BITMAPDATA ? (& M_BITMAPDATA->m_bitmapPalette) : (wxPalette*) NULL); }
wxPalette* GetPalette() const;
void SetPalette(const wxPalette& palette);
inline wxMask *GetMask() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_bitmapMask : (wxMask*) NULL); }
wxMask *GetMask() const;
void SetMask(wxMask *mask) ;
int GetBitmapType() const;
inline wxBitmap& operator = (const wxBitmap& bitmap) { if (*this == bitmap) return (*this); Ref(bitmap); return *this; }
inline bool operator == (const wxBitmap& bitmap) { return m_refData == bitmap.m_refData; }
inline bool operator != (const wxBitmap& bitmap) { return m_refData != bitmap.m_refData; }
@ -196,8 +202,10 @@ protected:
// TODO: Implementation
public:
void SetHBITMAP(WXHBITMAP bmp);
inline WXHBITMAP GetHBITMAP() const { return (M_BITMAPDATA ? M_BITMAPDATA->m_hBitmap : 0); }
WXHBITMAP GetHBITMAP() const;
PicHandle GetPict() const;
bool FreeResource(bool force = FALSE);
};
#endif

View File

@ -31,7 +31,7 @@ class WXDLLEXPORT wxChoice: public wxChoiceBase
public:
wxChoice() {}
~wxChoice() ;
virtual ~wxChoice() ;
wxChoice(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
@ -52,12 +52,15 @@ class WXDLLEXPORT wxChoice: public wxChoiceBase
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr);
virtual int DoAppend(const wxString& item);
// implement base class pure virtuals
virtual int DoAppend(const wxString& item);
virtual void Delete(int n);
virtual void Clear();
virtual int GetCount() const ;
virtual int GetSelection() const ;
virtual void SetSelection(int n);
virtual int FindString(const wxString& s) const;
virtual wxString GetString(int n) const ;
virtual void SetString( int , const wxString& s ) ;
@ -73,9 +76,9 @@ class WXDLLEXPORT wxChoice: public wxChoiceBase
virtual wxString GetStringSelection() const ;
virtual bool SetStringSelection(const wxString& sel);
virtual inline int Number() const { return m_strings.GetCount(); }
virtual inline int GetCount() const { return m_strings.GetCount(); }
// Mac specific
virtual void Command(wxCommandEvent& event);
void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
virtual inline int GetColumns() const { return 1 ; };
*/

View File

@ -156,7 +156,7 @@ class WXDLLEXPORT wxDropTarget: public wxObject
virtual void OnEnter() { }
virtual void OnLeave() { }
virtual bool OnDrop( long x, long y, const void *pData ) = 0;
virtual bool OnDrop( wxCoord x, wxCoord y, const void *pData ) = 0;
// protected:
@ -178,8 +178,8 @@ class WXDLLEXPORT wxTextDropTarget: public wxDropTarget
public:
wxTextDropTarget() {};
virtual bool OnDrop( long x, long y, const void *pData );
virtual bool OnDropText( long x, long y, const char *psz );
virtual bool OnDrop( wxCoord x, wxCoord y, const void *pData );
virtual bool OnDropText( wxCoord x, wxCoord y, const char *psz );
protected:
@ -197,8 +197,8 @@ class WXDLLEXPORT wxFileDropTarget: public wxDropTarget
wxFileDropTarget() {};
virtual bool OnDrop(long x, long y, const void *pData);
virtual bool OnDropFiles( long x, long y,
virtual bool OnDrop(wxCoord x, wxCoord y, const void *pData);
virtual bool OnDropFiles( wxCoord x, wxCoord y,
size_t nFiles, const char * const aszFiles[]);
protected:

View File

@ -20,7 +20,7 @@
#include "wx/gdiobj.h"
#if wxUSE_DRAG_AND_DROP
#include "wx/dataobj.h" wx/defs.h
#include "wx/dataobj.h"
#endif
/*

View File

@ -63,7 +63,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxControl
// for compatibility with wxMSW
void SetIcon(const wxIcon& icon)
{
SetBitmap( icon );
SetBitmap( (const wxBitmap&) icon );
}
// overriden base class virtuals

View File

@ -17,8 +17,6 @@
#pragma interface "statbar.h"
#endif
#include "wx/generic/statusbr.h"
class WXDLLEXPORT wxStatusBarMac : public wxStatusBarGeneric
{
DECLARE_DYNAMIC_CLASS(wxStatusBarMac);
@ -50,4 +48,4 @@ protected:
};
#endif
// _WX_STATBAR_H_
// _WX_STATBAR_H_

View File

@ -270,7 +270,6 @@ public :
virtual void MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin) ;
virtual void MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindow** rootwin) ;
MacWindowData* MacGetWindowData() { return m_macWindowData ; }
static WindowRef MacGetWindowInUpdate() { return s_macWindowInUpdate ; }
bool MacIsWindowScrollbar( const wxScrollBar* sb ) { return (m_hScrollBar == sb || m_vScrollBar == sb) ; }
static wxWindow* s_lastMouseWindow ;
private:
@ -278,7 +277,6 @@ private:
protected:
MacWindowData* m_macWindowData ;
static WindowRef s_macWindowInUpdate ;
RgnHandle m_macUpdateRgn ;
int m_x ;

View File

@ -115,6 +115,7 @@ WXDLLEXPORT wxObject* wxCreateStoredObject( wxInputStream& stream );
// Single inheritance with one base class
#define IMPLEMENT_DYNAMIC_CLASS(name, basename) \
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void); \
wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \
{ return new name; }\
wxClassInfo name::sm_class##name((wxChar *) wxT(#name), (wxChar *) wxT(#basename), (wxChar *) NULL, (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name);

View File

@ -13,9 +13,9 @@
#define _WX_SPINBUTT_H_BASE_
#ifdef __GNUG__
#ifndef __WXMOTIF__ // because there is no matching .cpp for Motif
#if !defined(__WXMOTIF__) && !defined(__WXMAC__) // because there is no matching .cpp
#pragma interface "spinbutbase.h"
#endif // Motif
#endif
#endif
// ----------------------------------------------------------------------------

View File

@ -54,7 +54,8 @@ protected:
#include "wx/msw/statbr95.h"
typedef wxStatusBar95 wxStatusBarReal;
#elif defined(__WXMAC__) && !defined(__UNIX__)
#elif defined(__WXMAC__) /* && !defined(__UNIX__) */
#include "wx/generic/statusbr.h"
#include "wx/mac/statusbr.h"
typedef wxStatusBarMac wxStatusBarReal;

View File

@ -256,6 +256,7 @@ protected:
wxEVT_COMMAND_TREE_KEY_DOWN
*/
#ifndef __WXMAC_X__
class WXDLLEXPORT wxTreeEvent: public wxCommandEvent
{
DECLARE_DYNAMIC_CLASS(wxTreeEvent)
@ -275,6 +276,7 @@ class WXDLLEXPORT wxTreeEvent: public wxCommandEvent
};
typedef void (wxEvtHandler::*wxTreeEventFunction)(wxTreeEvent&);
#endif
#endif
// _WX_TREECTRL_H_

View File

@ -247,7 +247,7 @@ wxDllLoader::LoadLibrary(const wxString & libname, bool *success)
char zError[256] = "";
wxDllOpen(zError, libname, handle);
#else // !Mac
handle = wxDllOpen(libname);
handle = wxDllOpen((char *)libname);
#endif // OS
if ( !handle )
@ -321,7 +321,7 @@ wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name)
wxDllGetSymbol(dllHandle, symbol);
#else
// mb_str() is necessary in Unicode build
symbol = wxDllGetSymbol(dllHandle, name.mb_str());
symbol = wxDllGetSymbol(dllHandle, (char *)name.mb_str());
#endif
if ( !symbol )

View File

@ -64,7 +64,7 @@ bool wxFFile::Open(const wxChar *filename, const char *mode)
tmp_fname = new char[fname_len];
wxWX2MB(tmp_fname, filename, fname_len);
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
m_fp = fopen(wxUnix2MacFilename( tmp_fname ), mode);
#else
m_fp = fopen(tmp_fname, mode);
@ -72,7 +72,7 @@ bool wxFFile::Open(const wxChar *filename, const char *mode)
delete tmp_fname;
#else
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
m_fp = fopen(wxUnix2MacFilename( filename ), mode);
#else
m_fp = fopen(filename, mode);

View File

@ -136,7 +136,7 @@ bool wxFile::Exists(const wxChar *name)
#if wxUSE_UNICODE && wxMBFILES
wxCharBuffer fname = wxConvFile.cWC2MB(name);
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
#else
return !wxAccess(fname, 0) &&
@ -144,7 +144,7 @@ bool wxFile::Exists(const wxChar *name)
(st.st_mode & S_IFREG);
#endif
#else
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
#else
return !wxAccess(name, 0) &&
@ -192,7 +192,7 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
{
// if bOverwrite we create a new file or truncate the existing one,
// otherwise we only create the new file and fail if it already exists
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
// Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
// int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
int fd = creat(wxUnix2MacFilename( szFileName ), accessMode);
@ -240,7 +240,7 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
break;
}
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
int fd = open(wxUnix2MacFilename( szFileName ), flags, access);
#else
int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
@ -555,7 +555,7 @@ bool wxTempFile::Commit()
{
m_file.Close();
#ifndef __WXMAC__
#if !defined(__WXMAC__) || defined(__UNIX__)
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
return FALSE;
@ -583,7 +583,7 @@ bool wxTempFile::Commit()
void wxTempFile::Discard()
{
m_file.Close();
#ifndef __WXMAC__
#if !defined(__WXMAC__) || defined(__UNIX__)
if ( wxRemove(m_strTemp) != 0 )
wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
#else

View File

@ -797,7 +797,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
bool ret = file.Commit();
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
if ( ret )
{
FSSpec spec ;
@ -811,7 +811,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
FSpSetFInfo( &spec , &finfo ) ;
}
}
#endif // __WXMAC__
#endif // __WXMAC__ && !__UNIX__
#ifdef __UNIX__
// restore the old umask if we changed it

View File

@ -1058,7 +1058,7 @@ wxCopyFile (const wxString& file1, const wxString& file2)
return FALSE;
}
#if !defined(__VISAGECPP__) && !defined(__WXMAC__)
#if !defined(__VISAGECPP__) && !defined(__WXMAC__) || defined(__UNIX__)
// no chmod in VA. SHould be some permission API for HPFS386 partitions however
if ( chmod(OS_FILENAME(file2), fbuf.st_mode) != 0 )
{
@ -1099,7 +1099,7 @@ bool wxRemoveFile(const wxString& file)
bool wxMkdir(const wxString& dir, int perm)
{
#if defined( __WXMAC__ )
#if defined(__WXMAC__) && !defined(__UNIX__)
return (mkdir(wxUnix2MacFilename( dir ) , 0 ) == 0);
#else // !Mac
const wxChar *dirname = dir.c_str();
@ -1664,7 +1664,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
char *cbuf = new char[sz+1];
#ifdef _MSC_VER
if (_getcwd(cbuf, sz) == NULL) {
#elif defined( __WXMAC__)
#elif defined(__WXMAC__) && !defined(__UNIX__)
enum
{
SFSaveDisk = 0x214, CurDirStore = 0x398
@ -1682,7 +1682,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
#else // wxUnicode
#ifdef _MSC_VER
if (_getcwd(buf, sz) == NULL) {
#elif defined( __WXMAC__)
#elif defined(__WXMAC__) && !defined(__UNIX__)
FSSpec cwdSpec ;
FCBPBRec pb;
OSErr error;

View File

@ -1402,17 +1402,11 @@ wxImage::wxImage( const wxBitmap &bitmap )
#ifdef __WXMAC__
#ifdef __UNIX__
#include <QD/PictUtils.h>
#include <ApplicationServices/ApplicationServices.h>
#else
#include <PictUtils.h>
#endif
extern CTabHandle wxMacCreateColorTable( int numColors ) ;
extern void wxMacDestroyColorTable( CTabHandle colors ) ;
extern void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
extern GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
wxBitmap wxImage::ConvertToBitmap() const
{
// width and height of the device-dependent bitmap
@ -1421,35 +1415,27 @@ wxBitmap wxImage::ConvertToBitmap() const
// Create picture
wxBitmap bitmap( width , height , wxDisplayDepth() ) ;
// Create mask
if (HasMask())
{
/*
unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );
mask_image = gdk_image_new_bitmap( gdk_visual_get_system(), mask_data, width, height );
wxMask *mask = new wxMask();
mask->m_bitmap = gdk_pixmap_new( (GdkWindow*)&gdk_root_parent, width, height, 1 );
bitmap.SetMask( mask );
*/
}
// Render
int r_mask = GetMaskRed();
int g_mask = GetMaskGreen();
int b_mask = GetMaskBlue();
wxBitmap bitmap;
wxCHECK_MSG( Ok(), bitmap, wxT("invalid image") );
bitmap.Create( width , height , wxDisplayDepth() ) ;
wxBitmap maskBitmap( width, height, 1);
CGrafPtr origPort ;
GDHandle origDevice ;
LockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
LockPixels( GetGWorldPixMap(maskBitmap.GetHBITMAP()) );
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( bitmap.GetHBITMAP() , NULL ) ;
// Render image
wxColour rgb, maskcolor(GetMaskRed(), GetMaskGreen(), GetMaskBlue());
RGBColor color;
RGBColor white = { 0xffff, 0xffff, 0xffff };
RGBColor black = { 0 , 0 , 0 };
register unsigned char* data = GetData();
@ -1458,158 +1444,96 @@ wxBitmap wxImage::ConvertToBitmap() const
{
for (int x = 0; x < width; x++)
{
unsigned char r = data[index++];
unsigned char g = data[index++];
unsigned char b = data[index++];
RGBColor color ;
color.red = ( r << 8 ) + r ;
color.green = ( g << 8 ) + g ;
color.blue = ( b << 8 ) + b ;
rgb.Set(data[index++], data[index++], data[index++]);
color = rgb.GetPixel();
SetCPixel( x , y , &color ) ;
if (HasMask())
{
SetGWorld(maskBitmap.GetHBITMAP(), NULL);
if (rgb == maskcolor) {
SetCPixel(x,y, &white);
}
else {
SetCPixel(x,y, &black);
}
SetGWorld(bitmap.GetHBITMAP(), NULL);
}
}
} // for height
SetGWorld( origPort , origDevice ) ;
if ( HasMask() )
{
wxColour colour( GetMaskRed(), GetMaskGreen(), GetMaskBlue());
wxMask *mask = new wxMask( bitmap, colour );
bitmap.SetMask( mask );
// Create mask
if ( HasMask() ) {
wxMask *mask = new wxMask( maskBitmap );
}
return bitmap;
UnlockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
UnlockPixels( GetGWorldPixMap(maskBitmap.GetHBITMAP()) );
SetGWorld( origPort, origDevice );
return bitmap;
}
wxImage::wxImage( const wxBitmap &bitmap )
{
// check the bitmap
if( !bitmap.Ok() )
{
wxFAIL_MSG( "invalid bitmap" );
return;
}
wxCHECK_RET( bitmap.Ok(), wxT("Invalid bitmap") );
// create an wxImage object
int width = bitmap.GetWidth();
int height = bitmap.GetHeight();
Create( width, height );
/*
unsigned char *data = GetData();
if( !data )
{
wxFAIL_MSG( "could not allocate data for image" );
return;
}
// calc the number of bytes per scanline and padding in the DIB
int bytePerLine = width*3;
int sizeDWORD = sizeof( DWORD );
div_t lineBoundary = div( bytePerLine, sizeDWORD );
int padding = 0;
if( lineBoundary.rem > 0 )
{
padding = sizeDWORD - lineBoundary.rem;
bytePerLine += padding;
}
wxCHECK_RET( data, wxT("Could not allocate data for image") );
// create a DIB header
int headersize = sizeof(BITMAPINFOHEADER);
LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize );
if( !lpDIBh )
{
wxFAIL_MSG( "could not allocate data for DIB header" );
free( data );
return;
}
// Fill in the DIB header
lpDIBh->bmiHeader.biSize = headersize;
lpDIBh->bmiHeader.biWidth = width;
lpDIBh->bmiHeader.biHeight = -height;
lpDIBh->bmiHeader.biSizeImage = bytePerLine * height;
lpDIBh->bmiHeader.biPlanes = 1;
lpDIBh->bmiHeader.biBitCount = 24;
lpDIBh->bmiHeader.biCompression = BI_RGB;
lpDIBh->bmiHeader.biClrUsed = 0;
// These seem not really needed for our purpose here.
lpDIBh->bmiHeader.biClrImportant = 0;
lpDIBh->bmiHeader.biXPelsPerMeter = 0;
lpDIBh->bmiHeader.biYPelsPerMeter = 0;
// memory for DIB data
unsigned char *lpBits;
lpBits = (unsigned char *) malloc( lpDIBh->bmiHeader.biSizeImage );
if( !lpBits )
{
wxFAIL_MSG( "could not allocate data for DIB" );
free( data );
free( lpDIBh );
return;
}
WXHBITMAP origPort;
GDHandle origDevice;
int index;
RGBColor color;
// background color set to RGB(16,16,16) in consistent with wxGTK
unsigned char mask_r=16, mask_g=16, mask_b=16;
SInt16 r,g,b;
wxMask *mask = bitmap.GetMask();
// copy data from the device-dependent bitmap to the DIB
HDC hdc = ::GetDC(NULL);
HBITMAP hbitmap;
hbitmap = (HBITMAP) bitmap.GetHBITMAP();
::GetDIBits( hdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS );
GetGWorld( &origPort, &origDevice );
LockPixels(GetGWorldPixMap(bitmap.GetHBITMAP()));
SetGWorld( bitmap.GetHBITMAP(), NULL);
// copy DIB data into the wxImage object
int i, j;
unsigned char *ptdata = data;
unsigned char *ptbits = lpBits;
for( i=0; i<height; i++ )
// Copy data into image
index = 0;
for (int yy = 0; yy < height; yy++)
{
for( j=0; j<width; j++ )
for (int xx = 0; xx < width; xx++)
{
*(ptdata++) = *(ptbits+2);
*(ptdata++) = *(ptbits+1);
*(ptdata++) = *(ptbits );
ptbits += 3;
}
ptbits += padding;
}
// similarly, set data according to the possible mask bitmap
if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
{
hbitmap = (HBITMAP) bitmap.GetMask()->GetMaskBitmap();
// memory DC created, color set, data copied, and memory DC deleted
HDC memdc = ::CreateCompatibleDC( hdc );
::SetTextColor( memdc, RGB( 0, 0, 0 ) );
::SetBkColor( memdc, RGB( 255, 255, 255 ) );
::GetDIBits( memdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS );
::DeleteDC( memdc );
// background color set to RGB(16,16,16) in consistent with wxGTK
unsigned char r=16, g=16, b=16;
ptdata = data;
ptbits = lpBits;
for( i=0; i<height; i++ )
{
for( j=0; j<width; j++ )
GetCPixel(xx,yy, &color);
r = ((color.red ) >> 8);
g = ((color.green ) >> 8);
b = ((color.blue ) >> 8);
data[index ] = r;
data[index + 1] = g;
data[index + 2] = b;
if (mask)
{
if( *ptbits != 0 )
ptdata += 3;
else
if (mask->PointMasked(xx,yy))
{
*(ptdata++) = r;
*(ptdata++) = g;
*(ptdata++) = b;
data[index ] = mask_r;
data[index + 1] = mask_g;
data[index + 2] = mask_b;
}
ptbits += 3;
}
ptbits += padding;
index += 3;
}
SetMaskColour( r, g, b );
SetMask( TRUE );
}
else
if (mask)
{
SetMask( FALSE );
SetMaskColour( mask_r, mask_g, mask_b );
SetMask( true );
}
// free allocated resources
::ReleaseDC(NULL, hdc);
free(lpDIBh);
free(lpBits);
*/
// Free resources
UnlockPixels(GetGWorldPixMap(bitmap.GetHBITMAP()));
SetGWorld(origPort, origDevice);
}
#endif

View File

@ -55,9 +55,9 @@
// implementation classes:
#if defined(__WXMSW__)
#include "wx/msw/mimetype.h"
#elif defined (__WXMAC__)
#elif defined(__WXMAC__)
#include "wx/mac/mimetype.h"
#elif defined (__WXPM__)
#elif defined(__WXPM__)
#include "wx/os2/mimetype.h"
#else // Unix
#include "wx/unix/mimetype.h"

View File

@ -227,7 +227,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename)
{
wxExprDatabase db;
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r");
#else
FILE *fd = wxFopen(filename, _T("r"));

View File

@ -358,7 +358,7 @@ local uLong unzlocal_SearchCentralDir(fin)
return uPosFound;
}
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
void wxUnix2MacFilename (char *s) ;
void
wxUnix2MacFilename (char *s)
@ -430,10 +430,10 @@ extern unzFile ZEXPORT unzOpen (path)
if (unz_copyright[0]!=' ')
return NULL;
#ifdef __WXMAC__
#if defined(__WXMAC__) && !defined(__UNIX__)
strcpy( wxBuffer , path ) ;
wxUnix2MacFilename( wxBuffer ) ;
fin=fopen(wxBuffer,"rb");
fin=fopen(wxBuffer,"rb");
#else
fin=fopen(path,"rb");
#endif

View File

@ -34,7 +34,7 @@
#if defined(__WXMSW__) && !defined(__WX_SETUP_H__) && !defined(wxUSE_ZLIB_H_IN_PATH)
#include "../zlib/zlib.h"
#elif defined(__WXMAC__) && defined(__UNIX__)
#include <Zip/zlib.h>
#include <Kernel/net/zlib.h>
#else
#include <zlib.h>
#endif

View File

@ -1,3 +1,4 @@
#include "wx/dc.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"

View File

@ -53,7 +53,7 @@
#if wxUSE_SOCKETS
#ifdef __APPLE__
#include <OT/OpenTransport.h>
#include <CoreServices/CoreServices.h>
#else
#include <OpenTransport.h>
#include <OpenTptInternet.h>
@ -95,25 +95,25 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ;
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ;
}
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ;
}
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ;
}
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
@ -1469,7 +1469,11 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
case suspendResumeMessage :
{
bool isResuming = ev->message & resumeFlag ;
#if !TARGET_CARBON
bool convertClipboard = ev->message & convertClipboardFlag ;
#else
bool convertClipboard = false;
#endif
bool doesActivate = UMAGetProcessModeDoesActivateOnFGSwitch() ;
if ( isResuming )
{

View File

@ -36,7 +36,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#ifdef __UNIX__
#include <QD/PictUtils.h>
#include <ApplicationServices/ApplicationServices.h>
#else
#include <PictUtils.h>
#endif
@ -97,6 +97,97 @@ void wxMacDestroyGWorld( GWorldPtr gw )
DisposeGWorld( gw ) ;
}
PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
{
CGrafPtr origPort ;
GDHandle origDev ;
PicHandle pict; // this is the Picture we give back
RGBColor gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
RGBColor white = { 0xffff ,0xffff , 0xffff } ;
RGBColor black = { 0x0000 ,0x0000 , 0x0000 } ;
unsigned char *maskimage = NULL ;
Rect portRect ;
GetPortBounds( wp , &portRect ) ;
int width = portRect.right - portRect.left ;
int height = portRect.bottom - portRect.top ;
LockPixels( GetGWorldPixMap( wp ) ) ;
GetGWorld( &origPort , &origDev ) ;
if ( mask )
{
maskimage = (unsigned char*) malloc( width * height ) ;
SetGWorld( mask , NULL ) ;
LockPixels( GetGWorldPixMap( mask ) ) ;
for ( int y = 0 ; y < height ; y++ )
{
for( int x = 0 ; x < width ; x++ )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
maskimage[y*width + x] = ( col.red == 0 ) ; // for monochrome masks
}
}
UnlockPixels( GetGWorldPixMap( mask ) ) ;
}
SetGWorld( wp , NULL ) ;
pict = OpenPicture(&portRect); // open a picture, this disables drawing
if(!pict)
return NULL;
if ( maskimage )
{
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
PenMode(transparent);
for ( int y = 0 ; y < height ; ++y )
{
for( int x = 0 ; x < width ; ++x )
{
if ( maskimage[y*width + x] )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
}
else {
// With transparency set this sets a blank pixel not a white one
SetCPixel( x + portRect.left , y + portRect.top , &white);
}
}
}
free( maskimage ) ;
maskimage = NULL ;
}
else
{
RGBBackColor( &gray ) ;
EraseRect(&portRect);
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
CopyBits(GetPortBitMapForCopyBits(wp), /* src PixMap - we copy image over
* itself - */
GetPortBitMapForCopyBits(wp), // dst PixMap - no drawing occurs
&portRect, // srcRect - it will be recorded and compressed -
&portRect, // dstRect - into the picture that is open -
srcCopy,NULL); // copyMode and no clip region
}
ClosePicture(); // We are done recording the picture
UnlockPixels( GetGWorldPixMap( wp ) ) ;
SetGWorld( origPort , origDev ) ;
return pict; // return our groovy pict handle
}
wxBitmapRefData::wxBitmapRefData()
{
m_ok = FALSE;
@ -180,8 +271,18 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
LockPixels( GetGWorldPixMap( M_BITMAPDATA->m_hBitmap ) ) ;
#ifdef __UNIX__
// bits is a word aligned array?? Don't think so
// bits is a char array on MAC OS X however using the benefit of the
// doubt I replaced references to 16 with sizeof(unsigned char)*8
unsigned char* linestart = (unsigned char*) bits ;
int linesize = ( the_width / (sizeof(unsigned char) * 8)) ;
if ( the_width % (sizeof(unsigned char) * 8) ) {
linesize += sizeof(unsigned char);
}
#else
// bits is a word aligned array
unsigned char* linestart = (unsigned char*) bits ;
@ -190,6 +291,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
{
linesize += 2 ;
}
#endif
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
@ -214,7 +316,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
}
}
UnlockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( M_BITMAPDATA->m_hBitmap ) ) ;
SetGWorld( origPort , origDevice ) ;
}
@ -261,6 +363,95 @@ wxBitmap::wxBitmap(char **data)
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
wxCHECK_MSG( Ok() &&
(rect.x >= 0) && (rect.y >= 0) &&
(rect.x+rect.width <= GetWidth()) &&
(rect.y+rect.height <= GetHeight()),
wxNullBitmap, wxT("invalid bitmap or bitmap region") );
wxBitmap ret( rect.width, rect.height, GetDepth() );
wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") );
WXHBITMAP origPort;
GDHandle origDevice;
GetGWorld( &origPort, &origDevice );
// Update the subbitmaps reference data
wxBitmapRefData *ref = (wxBitmapRefData *)ret.GetRefData();
ref->m_numColors = M_BITMAPDATA->m_numColors;
ref->m_bitmapPalette = M_BITMAPDATA->m_bitmapPalette;
ref->m_bitmapType = M_BITMAPDATA->m_bitmapType;
// Copy sub region of this bitmap
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict)
{
printf("GetSubBitmap: Copy a region of a Pict structure - TODO\n");
}
else if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypeGrafWorld)
{
// Copy mask
if(GetMask())
{
WXHBITMAP submask, mask;
RGBColor color;
mask = GetMask()->GetMaskBitmap();
submask = wxMacCreateGWorld(rect.width, rect.height, 1);
LockPixels(GetGWorldPixMap(mask));
LockPixels(GetGWorldPixMap(submask));
for(int yy = 0; yy < rect.height; yy++)
{
for(int xx = 0; xx < rect.width; xx++)
{
SetGWorld(mask, NULL);
GetCPixel(rect.x + xx, rect.y + yy, &color);
SetGWorld(submask, NULL);
SetCPixel(xx,yy, &color);
}
}
UnlockPixels(GetGWorldPixMap(mask));
UnlockPixels(GetGWorldPixMap(submask));
ref->m_bitmapMask = new wxMask;
ref->m_bitmapMask->SetMaskBitmap(submask);
}
// Copy bitmap
if(GetHBITMAP())
{
WXHBITMAP subbitmap, bitmap;
RGBColor color;
bitmap = GetHBITMAP();
subbitmap = wxMacCreateGWorld(rect.width, rect.height, GetDepth());
LockPixels(GetGWorldPixMap(bitmap));
LockPixels(GetGWorldPixMap(subbitmap));
for(int yy = 0; yy < rect.height; yy++)
{
for(int xx = 0; xx < rect.width; xx++)
{
SetGWorld(bitmap, NULL);
GetCPixel(rect.x + xx, rect.y + yy, &color);
SetGWorld(subbitmap, NULL);
SetCPixel(xx, yy, &color);
}
}
UnlockPixels(GetGWorldPixMap(bitmap));
UnlockPixels(GetGWorldPixMap(subbitmap));
ret.SetHBITMAP(subbitmap);
}
}
SetGWorld( origPort, origDevice );
return ret;
}
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
@ -277,6 +468,13 @@ bool wxBitmap::Create(int w, int h, int d)
return M_BITMAPDATA->m_ok;
}
int wxBitmap::GetBitmapType() const
{
wxCHECK_MSG( Ok(), kMacBitmapTypeUnknownType, wxT("invalid bitmap") );
return M_BITMAPDATA->m_bitmapType;
}
void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
@ -331,6 +529,46 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal
return handler->SaveFile(this, filename, type, palette);
}
bool wxBitmap::Ok() const
{
return (M_BITMAPDATA && M_BITMAPDATA->m_ok);
}
int wxBitmap::GetHeight() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_height;
}
int wxBitmap::GetWidth() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_width;
}
int wxBitmap::GetDepth() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_depth;
}
int wxBitmap::GetQuality() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_quality;
}
wxMask *wxBitmap::GetMask() const
{
wxCHECK_MSG( Ok(), (wxMask *) NULL, wxT("invalid bitmap") );
return M_BITMAPDATA->m_bitmapMask;
}
void wxBitmap::SetWidth(int w)
{
if (!M_BITMAPDATA)
@ -371,6 +609,13 @@ void wxBitmap::SetOk(bool isOk)
M_BITMAPDATA->m_ok = isOk;
}
wxPalette *wxBitmap::GetPalette() const
{
wxCHECK_MSG( Ok(), NULL, wxT("Invalid bitmap GetPalette()") );
return &M_BITMAPDATA->m_bitmapPalette;
}
void wxBitmap::SetPalette(const wxPalette& palette)
{
if (!M_BITMAPDATA)
@ -387,6 +632,105 @@ void wxBitmap::SetMask(wxMask *mask)
M_BITMAPDATA->m_bitmapMask = mask ;
}
WXHBITMAP wxBitmap::GetHBITMAP() const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
return M_BITMAPDATA->m_hBitmap;
}
PicHandle wxBitmap::GetPict() const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
PicHandle picture; // This is the returned picture
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
RGBColor gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
RGBColor white = { 0xffff ,0xffff , 0xffff } ;
RGBColor black = { 0x0000 ,0x0000 , 0x0000 } ;
CGrafPtr origPort;
GDHandle origDev ;
wxMask *mask;
Rect portRect ;
GetPortBounds( GetHBITMAP() , &portRect ) ;
int width = portRect.right - portRect.left ;
int height = portRect.bottom - portRect.top ;
LockPixels( GetGWorldPixMap( GetHBITMAP() ) ) ;
GetGWorld( &origPort , &origDev ) ;
mask = GetMask();
SetGWorld( GetHBITMAP() , NULL ) ;
picture = OpenPicture(&portRect); // open a picture, this disables drawing
if(!picture) {
return NULL;
}
if( mask )
{
#ifdef __UNIX__
RGBColor trans = white;
#else
RGBBackColor( &gray );
EraseRect( &portRect );
RGBColor trans = gray;
#endif
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
PenMode(transparent);
for ( int y = 0 ; y < height ; ++y )
{
for( int x = 0 ; x < width ; ++x )
{
if ( !mask->PointMasked(x,y) )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
}
else {
// With transparency this sets a blank pixel
SetCPixel( x + portRect.left , y + portRect.top , &trans);
}
}
}
}
else
{
RGBBackColor( &gray ) ;
EraseRect(&portRect);
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
CopyBits(GetPortBitMapForCopyBits(GetHBITMAP()),
// src PixMap - we copy image over itself -
GetPortBitMapForCopyBits(GetHBITMAP()),
// dst PixMap - no drawing occurs
&portRect, // srcRect - it will be recorded and compressed -
&portRect, // dstRect - into the picture that is open -
srcCopy,NULL); // copyMode and no clip region
}
ClosePicture(); // We are done recording the picture
UnlockPixels( GetGWorldPixMap( GetHBITMAP() ) ) ;
SetGWorld( origPort , origDev ) ;
return picture; // return our groovy pict handle
}
void wxBitmap::AddHandler(wxBitmapHandler *handler)
{
sm_handlers.Append(handler);
@ -493,8 +837,32 @@ wxMask::~wxMask()
// Create a mask from a mono bitmap (copies the bitmap).
bool wxMask::Create(const wxBitmap& bitmap)
{
// TODO
return FALSE;
if ( m_maskBitmap )
{
wxMacDestroyGWorld( m_maskBitmap ) ;
m_maskBitmap = NULL ;
}
wxCHECK_MSG( bitmap.GetBitmapType() == kMacBitmapTypeGrafWorld, false,
wxT("Cannot create mask from this bitmap type (TODO)"));
// other types would require a temporary bitmap. not yet implemented
wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap"));
wxCHECK_MSG(bitmap.GetDepth() == 1, false,
wxT("Cannot create mask from colour bitmap"));
m_maskBitmap = wxMacCreateGWorld(bitmap.GetWidth(), bitmap.GetHeight(), 1);
Rect rect = { 0,0, bitmap.GetHeight(), bitmap.GetWidth() };
LockPixels( GetGWorldPixMap(m_maskBitmap) );
LockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
CopyBits(GetPortBitMapForCopyBits(bitmap.GetHBITMAP()),
GetPortBitMapForCopyBits(m_maskBitmap),
&rect, &rect, srcCopy, 0);
UnlockPixels( GetGWorldPixMap(m_maskBitmap) );
UnlockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
return FALSE;
}
// Create a mask from a bitmap and a palette index indicating
@ -502,6 +870,7 @@ bool wxMask::Create(const wxBitmap& bitmap)
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{
// TODO
wxCHECK_MSG( 0, false, wxT("Not implemented"));
return FALSE;
}
@ -514,39 +883,35 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
wxMacDestroyGWorld( m_maskBitmap ) ;
m_maskBitmap = NULL ;
}
wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
wxCHECK_MSG( bitmap.GetBitmapType() == kMacBitmapTypeGrafWorld, false,
wxT("Cannot create mask from this bitmap type (TODO)"));
// other types would require a temporary bitmap. not yet implemented
if (!bitmap.Ok())
{
return FALSE;
}
wxCHECK_MSG( bitmap.Ok(), false, wxT("Illigal bitmap"));
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
RGBColor maskColor = colour.GetPixel() ;
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 );
LockPixels( GetGWorldPixMap( m_maskBitmap ) );
LockPixels( GetGWorldPixMap( bitmap.GetHBITMAP() ) );
RGBColor maskColor = colour.GetPixel();
// this is not very efficient, but I can't think
// of a better way of doing it
CGrafPtr origPort ;
GDHandle origDevice ;
RGBColor col;
RGBColor colors[2] = {
{ 0xFFFF, 0xFFFF, 0xFFFF },
{ 0, 0, 0 }};
GetGWorld( &origPort , &origDevice ) ;
for (int w = 0; w < bitmap.GetWidth(); w++)
{
for (int h = 0; h < bitmap.GetHeight(); h++)
{
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
RGBColor col ;
SetGWorld( bitmap.GetHBITMAP(), NULL ) ;
GetCPixel( w , h , &col ) ;
SetGWorld( m_maskBitmap , NULL ) ;
if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
if (col.red == maskColor.red && col.green == maskColor.green && col.blue == maskColor.blue)
{
SetCPixel( w , h , &colors[0] ) ;
}
@ -557,12 +922,33 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
}
}
UnlockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( bitmap.GetHBITMAP() ) ) ;
SetGWorld( origPort , origDevice ) ;
return TRUE;
}
bool wxMask::PointMasked(int x, int y)
{
WXHBITMAP origPort;
GDHandle origDevice;
RGBColor color;
bool masked = true;
GetGWorld( &origPort, &origDevice);
//Set port to mask and see if it masked (1) or not ( 0 )
SetGWorld(m_maskBitmap, NULL);
LockPixels(GetGWorldPixMap(m_maskBitmap));
GetCPixel(x,y, &color);
masked = !(color.red == 0 && color.green == 0 && color.blue == 0);
UnlockPixels(GetGWorldPixMap(m_maskBitmap));
SetGWorld( origPort, origDevice);
return masked;
}
/*
* wxBitmapHandler
*/

View File

@ -1,3 +1,4 @@
#include "wx/dc.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"

View File

@ -53,7 +53,7 @@
#if wxUSE_SOCKETS
#ifdef __APPLE__
#include <OT/OpenTransport.h>
#include <CoreServices/CoreServices.h>
#else
#include <OpenTransport.h>
#include <OpenTptInternet.h>
@ -95,25 +95,25 @@ bool wxApp::s_macSupportPCMenuShortcuts = true ;
long wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
wxString wxApp::s_macHelpMenuTitleName = "&Help" ;
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleODoc( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEODoc( (AppleEvent*) event , reply) ;
}
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleOApp( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEOApp( (AppleEvent*) event , reply ) ;
}
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandlePDoc( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEPDoc( (AppleEvent*) event , reply ) ;
}
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , unsigned long refcon )
pascal OSErr AEHandleQuit( const AppleEvent *event , AppleEvent *reply , long refcon )
{
wxApp* app = (wxApp*) refcon ;
return wxTheApp->MacHandleAEQuit( (AppleEvent*) event , reply) ;
@ -1469,7 +1469,11 @@ void wxApp::MacHandleOSEvent( EventRecord *ev )
case suspendResumeMessage :
{
bool isResuming = ev->message & resumeFlag ;
#if !TARGET_CARBON
bool convertClipboard = ev->message & convertClipboardFlag ;
#else
bool convertClipboard = false;
#endif
bool doesActivate = UMAGetProcessModeDoesActivateOnFGSwitch() ;
if ( isResuming )
{

View File

@ -36,7 +36,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
#endif
#ifdef __UNIX__
#include <QD/PictUtils.h>
#include <ApplicationServices/ApplicationServices.h>
#else
#include <PictUtils.h>
#endif
@ -97,6 +97,97 @@ void wxMacDestroyGWorld( GWorldPtr gw )
DisposeGWorld( gw ) ;
}
PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
{
CGrafPtr origPort ;
GDHandle origDev ;
PicHandle pict; // this is the Picture we give back
RGBColor gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
RGBColor white = { 0xffff ,0xffff , 0xffff } ;
RGBColor black = { 0x0000 ,0x0000 , 0x0000 } ;
unsigned char *maskimage = NULL ;
Rect portRect ;
GetPortBounds( wp , &portRect ) ;
int width = portRect.right - portRect.left ;
int height = portRect.bottom - portRect.top ;
LockPixels( GetGWorldPixMap( wp ) ) ;
GetGWorld( &origPort , &origDev ) ;
if ( mask )
{
maskimage = (unsigned char*) malloc( width * height ) ;
SetGWorld( mask , NULL ) ;
LockPixels( GetGWorldPixMap( mask ) ) ;
for ( int y = 0 ; y < height ; y++ )
{
for( int x = 0 ; x < width ; x++ )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
maskimage[y*width + x] = ( col.red == 0 ) ; // for monochrome masks
}
}
UnlockPixels( GetGWorldPixMap( mask ) ) ;
}
SetGWorld( wp , NULL ) ;
pict = OpenPicture(&portRect); // open a picture, this disables drawing
if(!pict)
return NULL;
if ( maskimage )
{
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
PenMode(transparent);
for ( int y = 0 ; y < height ; ++y )
{
for( int x = 0 ; x < width ; ++x )
{
if ( maskimage[y*width + x] )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
}
else {
// With transparency set this sets a blank pixel not a white one
SetCPixel( x + portRect.left , y + portRect.top , &white);
}
}
}
free( maskimage ) ;
maskimage = NULL ;
}
else
{
RGBBackColor( &gray ) ;
EraseRect(&portRect);
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
CopyBits(GetPortBitMapForCopyBits(wp), /* src PixMap - we copy image over
* itself - */
GetPortBitMapForCopyBits(wp), // dst PixMap - no drawing occurs
&portRect, // srcRect - it will be recorded and compressed -
&portRect, // dstRect - into the picture that is open -
srcCopy,NULL); // copyMode and no clip region
}
ClosePicture(); // We are done recording the picture
UnlockPixels( GetGWorldPixMap( wp ) ) ;
SetGWorld( origPort , origDev ) ;
return pict; // return our groovy pict handle
}
wxBitmapRefData::wxBitmapRefData()
{
m_ok = FALSE;
@ -180,8 +271,18 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
GetGWorld( &origPort , &origDevice ) ;
SetGWorld( M_BITMAPDATA->m_hBitmap , NULL ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
LockPixels( GetGWorldPixMap( M_BITMAPDATA->m_hBitmap ) ) ;
#ifdef __UNIX__
// bits is a word aligned array?? Don't think so
// bits is a char array on MAC OS X however using the benefit of the
// doubt I replaced references to 16 with sizeof(unsigned char)*8
unsigned char* linestart = (unsigned char*) bits ;
int linesize = ( the_width / (sizeof(unsigned char) * 8)) ;
if ( the_width % (sizeof(unsigned char) * 8) ) {
linesize += sizeof(unsigned char);
}
#else
// bits is a word aligned array
unsigned char* linestart = (unsigned char*) bits ;
@ -190,6 +291,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
{
linesize += 2 ;
}
#endif
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
@ -214,7 +316,7 @@ wxBitmap::wxBitmap(const char bits[], int the_width, int the_height, int no_bits
}
}
UnlockPixels( GetGWorldPixMap( (CGrafPtr) M_BITMAPDATA->m_hBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( M_BITMAPDATA->m_hBitmap ) ) ;
SetGWorld( origPort , origDevice ) ;
}
@ -261,6 +363,95 @@ wxBitmap::wxBitmap(char **data)
(void) Create((void *)data, wxBITMAP_TYPE_XPM_DATA, 0, 0, 0);
}
wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
{
wxCHECK_MSG( Ok() &&
(rect.x >= 0) && (rect.y >= 0) &&
(rect.x+rect.width <= GetWidth()) &&
(rect.y+rect.height <= GetHeight()),
wxNullBitmap, wxT("invalid bitmap or bitmap region") );
wxBitmap ret( rect.width, rect.height, GetDepth() );
wxASSERT_MSG( ret.Ok(), wxT("GetSubBitmap error") );
WXHBITMAP origPort;
GDHandle origDevice;
GetGWorld( &origPort, &origDevice );
// Update the subbitmaps reference data
wxBitmapRefData *ref = (wxBitmapRefData *)ret.GetRefData();
ref->m_numColors = M_BITMAPDATA->m_numColors;
ref->m_bitmapPalette = M_BITMAPDATA->m_bitmapPalette;
ref->m_bitmapType = M_BITMAPDATA->m_bitmapType;
// Copy sub region of this bitmap
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict)
{
printf("GetSubBitmap: Copy a region of a Pict structure - TODO\n");
}
else if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypeGrafWorld)
{
// Copy mask
if(GetMask())
{
WXHBITMAP submask, mask;
RGBColor color;
mask = GetMask()->GetMaskBitmap();
submask = wxMacCreateGWorld(rect.width, rect.height, 1);
LockPixels(GetGWorldPixMap(mask));
LockPixels(GetGWorldPixMap(submask));
for(int yy = 0; yy < rect.height; yy++)
{
for(int xx = 0; xx < rect.width; xx++)
{
SetGWorld(mask, NULL);
GetCPixel(rect.x + xx, rect.y + yy, &color);
SetGWorld(submask, NULL);
SetCPixel(xx,yy, &color);
}
}
UnlockPixels(GetGWorldPixMap(mask));
UnlockPixels(GetGWorldPixMap(submask));
ref->m_bitmapMask = new wxMask;
ref->m_bitmapMask->SetMaskBitmap(submask);
}
// Copy bitmap
if(GetHBITMAP())
{
WXHBITMAP subbitmap, bitmap;
RGBColor color;
bitmap = GetHBITMAP();
subbitmap = wxMacCreateGWorld(rect.width, rect.height, GetDepth());
LockPixels(GetGWorldPixMap(bitmap));
LockPixels(GetGWorldPixMap(subbitmap));
for(int yy = 0; yy < rect.height; yy++)
{
for(int xx = 0; xx < rect.width; xx++)
{
SetGWorld(bitmap, NULL);
GetCPixel(rect.x + xx, rect.y + yy, &color);
SetGWorld(subbitmap, NULL);
SetCPixel(xx, yy, &color);
}
}
UnlockPixels(GetGWorldPixMap(bitmap));
UnlockPixels(GetGWorldPixMap(subbitmap));
ret.SetHBITMAP(subbitmap);
}
}
SetGWorld( origPort, origDevice );
return ret;
}
bool wxBitmap::Create(int w, int h, int d)
{
UnRef();
@ -277,6 +468,13 @@ bool wxBitmap::Create(int w, int h, int d)
return M_BITMAPDATA->m_ok;
}
int wxBitmap::GetBitmapType() const
{
wxCHECK_MSG( Ok(), kMacBitmapTypeUnknownType, wxT("invalid bitmap") );
return M_BITMAPDATA->m_bitmapType;
}
void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
{
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
@ -331,6 +529,46 @@ bool wxBitmap::SaveFile(const wxString& filename, int type, const wxPalette *pal
return handler->SaveFile(this, filename, type, palette);
}
bool wxBitmap::Ok() const
{
return (M_BITMAPDATA && M_BITMAPDATA->m_ok);
}
int wxBitmap::GetHeight() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_height;
}
int wxBitmap::GetWidth() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_width;
}
int wxBitmap::GetDepth() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_depth;
}
int wxBitmap::GetQuality() const
{
wxCHECK_MSG( Ok(), -1, wxT("invalid bitmap") );
return M_BITMAPDATA->m_quality;
}
wxMask *wxBitmap::GetMask() const
{
wxCHECK_MSG( Ok(), (wxMask *) NULL, wxT("invalid bitmap") );
return M_BITMAPDATA->m_bitmapMask;
}
void wxBitmap::SetWidth(int w)
{
if (!M_BITMAPDATA)
@ -371,6 +609,13 @@ void wxBitmap::SetOk(bool isOk)
M_BITMAPDATA->m_ok = isOk;
}
wxPalette *wxBitmap::GetPalette() const
{
wxCHECK_MSG( Ok(), NULL, wxT("Invalid bitmap GetPalette()") );
return &M_BITMAPDATA->m_bitmapPalette;
}
void wxBitmap::SetPalette(const wxPalette& palette)
{
if (!M_BITMAPDATA)
@ -387,6 +632,105 @@ void wxBitmap::SetMask(wxMask *mask)
M_BITMAPDATA->m_bitmapMask = mask ;
}
WXHBITMAP wxBitmap::GetHBITMAP() const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
return M_BITMAPDATA->m_hBitmap;
}
PicHandle wxBitmap::GetPict() const
{
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
PicHandle picture; // This is the returned picture
// If bitmap already in Pict format return pointer
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
return M_BITMAPDATA->m_hPict;
}
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
// Invalid bitmap
return NULL;
}
RGBColor gray = { 0xCCCC ,0xCCCC , 0xCCCC } ;
RGBColor white = { 0xffff ,0xffff , 0xffff } ;
RGBColor black = { 0x0000 ,0x0000 , 0x0000 } ;
CGrafPtr origPort;
GDHandle origDev ;
wxMask *mask;
Rect portRect ;
GetPortBounds( GetHBITMAP() , &portRect ) ;
int width = portRect.right - portRect.left ;
int height = portRect.bottom - portRect.top ;
LockPixels( GetGWorldPixMap( GetHBITMAP() ) ) ;
GetGWorld( &origPort , &origDev ) ;
mask = GetMask();
SetGWorld( GetHBITMAP() , NULL ) ;
picture = OpenPicture(&portRect); // open a picture, this disables drawing
if(!picture) {
return NULL;
}
if( mask )
{
#ifdef __UNIX__
RGBColor trans = white;
#else
RGBBackColor( &gray );
EraseRect( &portRect );
RGBColor trans = gray;
#endif
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
PenMode(transparent);
for ( int y = 0 ; y < height ; ++y )
{
for( int x = 0 ; x < width ; ++x )
{
if ( !mask->PointMasked(x,y) )
{
RGBColor col ;
GetCPixel( x + portRect.left , y + portRect.top , &col ) ;
SetCPixel( x + portRect.left , y + portRect.top , &col ) ;
}
else {
// With transparency this sets a blank pixel
SetCPixel( x + portRect.left , y + portRect.top , &trans);
}
}
}
}
else
{
RGBBackColor( &gray ) ;
EraseRect(&portRect);
RGBForeColor( &black ) ;
RGBBackColor( &white ) ;
CopyBits(GetPortBitMapForCopyBits(GetHBITMAP()),
// src PixMap - we copy image over itself -
GetPortBitMapForCopyBits(GetHBITMAP()),
// dst PixMap - no drawing occurs
&portRect, // srcRect - it will be recorded and compressed -
&portRect, // dstRect - into the picture that is open -
srcCopy,NULL); // copyMode and no clip region
}
ClosePicture(); // We are done recording the picture
UnlockPixels( GetGWorldPixMap( GetHBITMAP() ) ) ;
SetGWorld( origPort , origDev ) ;
return picture; // return our groovy pict handle
}
void wxBitmap::AddHandler(wxBitmapHandler *handler)
{
sm_handlers.Append(handler);
@ -493,8 +837,32 @@ wxMask::~wxMask()
// Create a mask from a mono bitmap (copies the bitmap).
bool wxMask::Create(const wxBitmap& bitmap)
{
// TODO
return FALSE;
if ( m_maskBitmap )
{
wxMacDestroyGWorld( m_maskBitmap ) ;
m_maskBitmap = NULL ;
}
wxCHECK_MSG( bitmap.GetBitmapType() == kMacBitmapTypeGrafWorld, false,
wxT("Cannot create mask from this bitmap type (TODO)"));
// other types would require a temporary bitmap. not yet implemented
wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap"));
wxCHECK_MSG(bitmap.GetDepth() == 1, false,
wxT("Cannot create mask from colour bitmap"));
m_maskBitmap = wxMacCreateGWorld(bitmap.GetWidth(), bitmap.GetHeight(), 1);
Rect rect = { 0,0, bitmap.GetHeight(), bitmap.GetWidth() };
LockPixels( GetGWorldPixMap(m_maskBitmap) );
LockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
CopyBits(GetPortBitMapForCopyBits(bitmap.GetHBITMAP()),
GetPortBitMapForCopyBits(m_maskBitmap),
&rect, &rect, srcCopy, 0);
UnlockPixels( GetGWorldPixMap(m_maskBitmap) );
UnlockPixels( GetGWorldPixMap(bitmap.GetHBITMAP()) );
return FALSE;
}
// Create a mask from a bitmap and a palette index indicating
@ -502,6 +870,7 @@ bool wxMask::Create(const wxBitmap& bitmap)
bool wxMask::Create(const wxBitmap& bitmap, int paletteIndex)
{
// TODO
wxCHECK_MSG( 0, false, wxT("Not implemented"));
return FALSE;
}
@ -514,39 +883,35 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
wxMacDestroyGWorld( m_maskBitmap ) ;
m_maskBitmap = NULL ;
}
wxASSERT( ((wxBitmapRefData*) bitmap.GetRefData())->m_bitmapType == kMacBitmapTypeGrafWorld ) ;
wxCHECK_MSG( bitmap.GetBitmapType() == kMacBitmapTypeGrafWorld, false,
wxT("Cannot create mask from this bitmap type (TODO)"));
// other types would require a temporary bitmap. not yet implemented
if (!bitmap.Ok())
{
return FALSE;
}
wxCHECK_MSG( bitmap.Ok(), false, wxT("Illigal bitmap"));
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
LockPixels( GetGWorldPixMap( (CGrafPtr) ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
RGBColor maskColor = colour.GetPixel() ;
m_maskBitmap = wxMacCreateGWorld( bitmap.GetWidth() , bitmap.GetHeight() , 1 );
LockPixels( GetGWorldPixMap( m_maskBitmap ) );
LockPixels( GetGWorldPixMap( bitmap.GetHBITMAP() ) );
RGBColor maskColor = colour.GetPixel();
// this is not very efficient, but I can't think
// of a better way of doing it
CGrafPtr origPort ;
GDHandle origDevice ;
RGBColor col;
RGBColor colors[2] = {
{ 0xFFFF, 0xFFFF, 0xFFFF },
{ 0, 0, 0 }};
GetGWorld( &origPort , &origDevice ) ;
for (int w = 0; w < bitmap.GetWidth(); w++)
{
for (int h = 0; h < bitmap.GetHeight(); h++)
{
RGBColor colors[2] = {
{ 0xFFFF , 0xFFFF , 0xFFFF } ,
{ 0, 0 , 0 }
} ;
SetGWorld( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap , NULL ) ;
RGBColor col ;
SetGWorld( bitmap.GetHBITMAP(), NULL ) ;
GetCPixel( w , h , &col ) ;
SetGWorld( m_maskBitmap , NULL ) ;
if (col.red == maskColor.red && col.blue == maskColor.blue && col.green == maskColor.green)
if (col.red == maskColor.red && col.green == maskColor.green && col.blue == maskColor.blue)
{
SetCPixel( w , h , &colors[0] ) ;
}
@ -557,12 +922,33 @@ bool wxMask::Create(const wxBitmap& bitmap, const wxColour& colour)
}
}
UnlockPixels( GetGWorldPixMap( (CGrafPtr) m_maskBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( ((wxBitmapRefData*) bitmap.GetRefData())->m_hBitmap ) ) ;
UnlockPixels( GetGWorldPixMap( bitmap.GetHBITMAP() ) ) ;
SetGWorld( origPort , origDevice ) ;
return TRUE;
}
bool wxMask::PointMasked(int x, int y)
{
WXHBITMAP origPort;
GDHandle origDevice;
RGBColor color;
bool masked = true;
GetGWorld( &origPort, &origDevice);
//Set port to mask and see if it masked (1) or not ( 0 )
SetGWorld(m_maskBitmap, NULL);
LockPixels(GetGWorldPixMap(m_maskBitmap));
GetCPixel(x,y, &color);
masked = !(color.red == 0 && color.green == 0 && color.blue == 0);
UnlockPixels(GetGWorldPixMap(m_maskBitmap));
SetGWorld( origPort, origDevice);
return masked;
}
/*
* wxBitmapHandler
*/

View File

@ -20,6 +20,7 @@
#include "wx/utils.h"
#include "wx/metafile.h"
#include "wx/clipbrd.h"
#include "wx/intl.h"
#define wxUSE_DATAOBJ 1

View File

@ -16,6 +16,7 @@
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/radiobox.h"

View File

@ -21,7 +21,7 @@
#include "wx/cmndata.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif
@ -182,7 +182,7 @@ static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
short *item, void *dataPtr)
{
#pragma unused (dataPtr)
@ -210,7 +210,7 @@ static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRec
// MyDlgHook is a hook routine that maps the select button to Open
// and sets the Select button name
static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, Ptr dataPtr)
static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, void *dataPtr)
{
UserDataRecPtr theUserDataRecPtr;
long desktopDirID;
@ -422,7 +422,7 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
}
}
static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
#pragma unused (dataPtr)

View File

@ -39,20 +39,22 @@ wxDropTarget::~wxDropTarget()
// ----------------------------------------------------------------------------
// wxTextDropTarget
// ----------------------------------------------------------------------------
bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
#ifndef __WXMAC_X__
bool wxTextDropTarget::OnDrop( wxCoord x, wxCoord y, const void *pData )
{
OnDropText( x, y, (const char*)pData );
return TRUE;
};
#endif
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
bool wxTextDropTarget::OnDropText( wxCoord x, wxCoord y, const wxString &psz )
{
printf( "Got dropped text: %s.\n", psz );
printf( "Got dropped text: %s.\n", (char *)psz );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
};
#ifndef __WXMAC_X__
size_t wxTextDropTarget::GetFormatCount() const
{
return 1;
@ -62,25 +64,27 @@ wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_TEXT;
}
#endif
// ----------------------------------------------------------------------------
// wxFileDropTarget
// ----------------------------------------------------------------------------
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
#ifndef __WXMAC_X__
bool wxFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
{
printf( "Got %d dropped files.\n", (int)nFiles );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
}
#endif
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
bool wxFileDropTarget::OnDrop(wxCoord x, wxCoord y, const wxArrayString& filenames)
{
char *str = "/this/is/a/path.txt";
return OnDropFiles(x, y, 1, &str );
return OnDropFiles(x, y, 1, &filenames);
}
#ifndef __WXMAC_X__
size_t wxFileDropTarget::GetFormatCount() const
{
return 1;
@ -90,6 +94,7 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_FILENAME;
}
#endif
//-------------------------------------------------------------------------
// wxDropSource

View File

@ -14,6 +14,7 @@
#endif
#include "wx/defs.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/filedlg.h"
@ -30,7 +31,7 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
// begin wxmac
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif
@ -73,6 +74,7 @@ NavEventProc(
#endif
*/
wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
}
}
@ -210,7 +212,7 @@ static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
short *item, void *dataPtr)
{
#pragma unused (dataPtr)
@ -371,7 +373,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
}
}
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
Str255 filename ;
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;

View File

@ -19,11 +19,8 @@
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#define OTUNIXERRORS 1
#ifdef __UNIX__
#include <CarbonCore/CarbonCore.h>
#include <OT/OpenTransport.h>
#include <OT/OpenTransportProviders.h>
#include <CoreServices/CoreServices.h>
#ifndef FALSE
#define FALSE 0
@ -32,6 +29,7 @@
#define TRUE 1
#endif
#else
#define OTUNIXERRORS 1
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
@ -123,7 +121,11 @@ OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode)
ret.opt.maxlen = kOTFourByteOptionSize;
opt->level = INET_IP; // dealing with an IP Level function
#ifdef __UNIX__
opt->name = kIP_REUSEADDR;
#else
opt->name = IP_REUSEADDR;
#endif
opt->len = kOTFourByteOptionSize;
opt->status = 0;
*(UInt32*)opt->value = enableReuseIPMode; // set the desired option level, true or false
@ -1043,8 +1045,8 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size)
{
OTFlags flags ;
OTResult res ;
OTByteCount sz = 0 ;
size_t sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
res = OTRcv( socket->m_endpoint , buffer , size , &flags ) ;
if ( res < 0 )
@ -1055,7 +1057,7 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size)
// we simulate another read event if there are still bytes
if ( socket->m_takesEvents )
{
size_t sz = 0 ;
OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( sz > 0 )
{
@ -1365,7 +1367,7 @@ GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t
assert(address != NULL);
CHECK_ADDRESS(address, INET, GSOCK_INVADDR);
OTInetAddressToName( gInetSvcRef , address->m_host , &name ) ;
OTInetAddressToName( gInetSvcRef , address->m_host , name ) ;
strncpy( hostname , name , sbuf ) ;
return GSOCK_NOERROR;
}
@ -1397,7 +1399,7 @@ void _GSocket_Enable_Events(GSocket *socket)
state = OTGetEndpointState(socket->m_endpoint);
{
size_t sz = 0 ;
OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( state == T_INCON || sz > 0 )
{
@ -1437,7 +1439,7 @@ GSocketError _GSocket_Input_Timeout(GSocket *socket)
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < socket->m_timeout * 1000.0 )
{
OTResult state ;
size_t sz = 0 ;
OTByteCount sz = 0 ;
state = OTGetEndpointState(socket->m_endpoint);
OTCountDataBytes( socket->m_endpoint , &sz ) ;

View File

@ -414,7 +414,11 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
wxPNGReaderIter iter(this);
/* open the file */
#ifndef __UNIX__
fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
#else
fp = fopen( ImageFileName , "rb" );
#endif
if (!fp)
return FALSE;

View File

@ -17,12 +17,13 @@
// headers
// ----------------------------------------------------------------------------
#include "wx/mac/statusbr.h"
#include "wx/defs.h"
#include "wx/statusbr.h"
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarXX, wxStatusBar);
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBar);
BEGIN_EVENT_TABLE(wxStatusBarXX, wxStatusBar)
EVT_SIZE(wxStatusBarXX::OnSize)
BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBar)
EVT_SIZE(wxStatusBarMac::OnSize)
END_EVENT_TABLE()
@ -31,20 +32,15 @@ END_EVENT_TABLE()
// ============================================================================
// ----------------------------------------------------------------------------
// wxStatusBarXX class
// wxStatusBarMac class
// ----------------------------------------------------------------------------
wxStatusBarXX::wxStatusBarXX()
wxStatusBarMac::wxStatusBarMac()
{
SetParent(NULL);
}
wxStatusBarXX::wxStatusBarXX(wxWindow *parent, wxWindowID id, long style)
{
Create(parent, id, style);
}
bool wxStatusBarXX::Create(wxWindow *parent, wxWindowID id, long style)
bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name = wxPanelNameStr)
{
SetParent(parent);
@ -57,7 +53,7 @@ bool wxStatusBarXX::Create(wxWindow *parent, wxWindowID id, long style)
return FALSE;
}
void wxStatusBarXX::SetFieldsCount(int nFields, const int widths[])
void wxStatusBarMac::SetFieldsCount(int nFields, const int widths[])
{
wxASSERT( (nFields > 0) && (nFields < 255) );
@ -67,7 +63,7 @@ void wxStatusBarXX::SetFieldsCount(int nFields, const int widths[])
SetFieldsWidth();
}
void wxStatusBarXX::SetStatusWidths(int n, const int widths[])
void wxStatusBarMac::SetStatusWidths(int n, const int widths[])
{
wxASSERT( n == m_nFields );
@ -75,7 +71,7 @@ void wxStatusBarXX::SetStatusWidths(int n, const int widths[])
SetFieldsWidth();
}
void wxStatusBarXX::CopyFieldsWidth(const int widths[])
void wxStatusBarMac::CopyFieldsWidth(const int widths[])
{
if (widths && !m_statusWidths)
m_statusWidths = new int[m_nFields];
@ -90,7 +86,7 @@ void wxStatusBarXX::CopyFieldsWidth(const int widths[])
}
}
void wxStatusBarXX::SetFieldsWidth()
void wxStatusBarMac::SetFieldsWidth()
{
int *pWidths = new int[m_nFields];
@ -140,12 +136,12 @@ void wxStatusBarXX::SetFieldsWidth()
delete [] pWidths;
}
void wxStatusBarXX::SetStatusText(const wxString& strText, int nField)
void wxStatusBarMac::SetStatusText(const wxString& strText, int nField)
{
// TODO
}
wxString wxStatusBarXX::GetStatusText(int nField) const
wxString wxStatusBarMac::GetStatusText(int nField) const
{
wxASSERT( (nField > -1) && (nField < m_nFields) );
@ -153,7 +149,7 @@ wxString wxStatusBarXX::GetStatusText(int nField) const
return wxString("");
}
void wxStatusBarXX::OnSize(wxSizeEvent& event)
void wxStatusBarMac::OnSize(wxSizeEvent& event)
{
// adjust fields widths to the new size
SetFieldsWidth();

View File

@ -22,6 +22,7 @@
#include <fstream.h>
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/button.h"
#include "wx/panel.h"
#include "wx/textctrl.h"

View File

@ -16,6 +16,7 @@
#if wxUSE_TOOLTIPS
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/window.h"
#include "wx/tooltip.h"
#include "wx/timer.h"

View File

@ -1,9 +1,10 @@
#include "wx/defs.h"
#include "wx/dc.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#ifdef __UNIX__
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif

View File

@ -260,6 +260,7 @@ bool wxIsBusy()
return (wxBusyCursorCount > 0);
}
#ifndef __UNIX__
wxString wxMacFindFolder( short vol,
OSType folderType,
Boolean createFolder)
@ -278,6 +279,7 @@ wxString wxMacFindFolder( short vol,
}
return strDir ;
}
#endif
#ifndef __UNIX__
char *wxGetUserHome (const wxString& user)
@ -343,6 +345,11 @@ void wxDisplaySize(int *width, int *height)
#endif
}
void wxDisplaySizeMM(int *width, int *height)
{
wxDisplaySize(width, height);
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);

View File

@ -14,11 +14,15 @@
#endif
#include "wx/utils.h"
#ifdef __UNIX__
#include "wx/unix/execute.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef __UNIX__
#define wxEXECUTE_WIN_MESSAGE 10000
long wxExecute(const wxString& command, bool sync, wxProcess *handler)
@ -26,3 +30,12 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler)
// TODO
return 0;
}
#endif
#ifdef __UNIX__
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
wxFAIL_MSG(wxT("wxAddProcessCallback() function not ready"));
return 0;
}
#endif

View File

@ -126,14 +126,18 @@ bool wxWave::Play(bool async, bool looped) const
if (m_isResource)
{
strcpy(lpSnd, m_sndname);
c2pstr((char *) lpSnd);
SndListHandle hSnd;
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
#if TARGET_CARBON
c2pstrcpy((unsigned char *)lpSnd, m_sndname);
#else
strcpy(lpSnd, m_sndname);
c2pstr((char *) lpSnd);
#endif
SndListHandle hSnd;
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
if ((hSnd != NULL) && (SndPlay(m_sndChan, hSnd, async) == noErr))
ret = true;
if ((hSnd != NULL) && (SndPlay(m_sndChan, hSnd, async) == noErr))
ret = true;
}
return ret;

View File

@ -15,6 +15,7 @@
#include "wx/setup.h"
#include "wx/menu.h"
#include "wx/window.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/utils.h"
@ -33,9 +34,6 @@
#include "wx/tabctrl.h"
#include "wx/tooltip.h"
#include "wx/statusbr.h"
// TODO remove the line below, just for lookup-up convenience CS
#include "wx/window.h"
#include "wx/menuitem.h"
#include "wx/log.h"
@ -763,6 +761,11 @@ void wxWindow::MacSuperShown( bool show )
bool wxWindow::MacIsReallyShown() const
{
if ( m_isShown && (m_parent != NULL) ) {
return m_parent->MacIsReallyShown();
}
return m_isShown;
/*
bool status = m_isShown ;
wxWindow * win = this ;
while ( status && win->m_parent != NULL )
@ -771,6 +774,7 @@ bool wxWindow::MacIsReallyShown() const
status = win->m_isShown ;
}
return status ;
*/
}
int wxWindow::GetCharHeight() const
@ -794,7 +798,7 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
wxClientDC dc( (wxWindow*) this ) ;
long lx,ly,ld,le ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
if ( externalLeading )
*externalLeading = le ;
if ( descent )
@ -2306,7 +2310,37 @@ long wxWindow::MacRemoveBordersFromStyle( long style )
{
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
}
/*
wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindow *rootwin ;
m_currentPort = NULL ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
theWindow->MacSetPortFocusParams( localOrigin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
wxMacFocusHelper::~wxMacFocusHelper()
{
if ( m_ok )
{
SetPort( m_currentPort ) ;
SetOrigin( 0 , 0 ) ;
}
if ( m_formerPort != m_currentPort )
SetPort( m_formerPort ) ;
}
*/
wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow )
{

Binary file not shown.

View File

@ -20,6 +20,7 @@
#include "wx/utils.h"
#include "wx/metafile.h"
#include "wx/clipbrd.h"
#include "wx/intl.h"
#define wxUSE_DATAOBJ 1

View File

@ -16,6 +16,7 @@
#include "wx/control.h"
#include "wx/panel.h"
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/notebook.h"
#include "wx/tabctrl.h"
#include "wx/radiobox.h"

View File

@ -21,7 +21,7 @@
#include "wx/cmndata.h"
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif
@ -182,7 +182,7 @@ static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
short *item, void *dataPtr)
{
#pragma unused (dataPtr)
@ -210,7 +210,7 @@ static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRec
// MyDlgHook is a hook routine that maps the select button to Open
// and sets the Select button name
static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, Ptr dataPtr)
static pascal short SFGetFolderDialogHook(short item, DialogPtr theDlgPtr, void *dataPtr)
{
UserDataRecPtr theUserDataRecPtr;
long desktopDirID;
@ -422,7 +422,7 @@ void StandardGetFolder( ConstStr255Param message , ConstStr255Param path , FileF
}
}
static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
static pascal Boolean OnlyVisibleFoldersCustomFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
#pragma unused (dataPtr)

View File

@ -39,20 +39,22 @@ wxDropTarget::~wxDropTarget()
// ----------------------------------------------------------------------------
// wxTextDropTarget
// ----------------------------------------------------------------------------
bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
#ifndef __WXMAC_X__
bool wxTextDropTarget::OnDrop( wxCoord x, wxCoord y, const void *pData )
{
OnDropText( x, y, (const char*)pData );
return TRUE;
};
#endif
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
bool wxTextDropTarget::OnDropText( wxCoord x, wxCoord y, const wxString &psz )
{
printf( "Got dropped text: %s.\n", psz );
printf( "Got dropped text: %s.\n", (char *)psz );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
};
#ifndef __WXMAC_X__
size_t wxTextDropTarget::GetFormatCount() const
{
return 1;
@ -62,25 +64,27 @@ wxDataFormat wxTextDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_TEXT;
}
#endif
// ----------------------------------------------------------------------------
// wxFileDropTarget
// ----------------------------------------------------------------------------
bool wxFileDropTarget::OnDropFiles( long x, long y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
#ifndef __WXMAC_X__
bool wxFileDropTarget::OnDropFiles( wxCoord x, wxCoord y, size_t nFiles, const char * const WXUNUSED(aszFiles)[] )
{
printf( "Got %d dropped files.\n", (int)nFiles );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
}
#endif
bool wxFileDropTarget::OnDrop(long x, long y, const void *WXUNUSED(pData) )
bool wxFileDropTarget::OnDrop(wxCoord x, wxCoord y, const wxArrayString& filenames)
{
char *str = "/this/is/a/path.txt";
return OnDropFiles(x, y, 1, &str );
return OnDropFiles(x, y, 1, &filenames);
}
#ifndef __WXMAC_X__
size_t wxFileDropTarget::GetFormatCount() const
{
return 1;
@ -90,6 +94,7 @@ wxDataFormat wxFileDropTarget::GetFormat(size_t WXUNUSED(n)) const
{
return wxDF_FILENAME;
}
#endif
//-------------------------------------------------------------------------
// wxDropSource

View File

@ -14,6 +14,7 @@
#endif
#include "wx/defs.h"
#include "wx/app.h"
#include "wx/utils.h"
#include "wx/dialog.h"
#include "wx/filedlg.h"
@ -30,7 +31,7 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
// begin wxmac
#if defined(__UNIX__)
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif
@ -73,6 +74,7 @@ NavEventProc(
#endif
*/
wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
}
}
@ -210,7 +212,7 @@ static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
// flashing of the button when the key is hit
static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
short *item, Ptr dataPtr)
short *item, void *dataPtr)
{
#pragma unused (dataPtr)
@ -371,7 +373,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
}
}
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
Str255 filename ;
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;

View File

@ -19,11 +19,8 @@
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
#define OTUNIXERRORS 1
#ifdef __UNIX__
#include <CarbonCore/CarbonCore.h>
#include <OT/OpenTransport.h>
#include <OT/OpenTransportProviders.h>
#include <CoreServices/CoreServices.h>
#ifndef FALSE
#define FALSE 0
@ -32,6 +29,7 @@
#define TRUE 1
#endif
#else
#define OTUNIXERRORS 1
#include <OpenTransport.h>
#include <OpenTransportProviders.h>
#include <OpenTptInternet.h>
@ -123,7 +121,11 @@ OSStatus DoNegotiateIPReuseAddrOption(EndpointRef ep, Boolean enableReuseIPMode)
ret.opt.maxlen = kOTFourByteOptionSize;
opt->level = INET_IP; // dealing with an IP Level function
#ifdef __UNIX__
opt->name = kIP_REUSEADDR;
#else
opt->name = IP_REUSEADDR;
#endif
opt->len = kOTFourByteOptionSize;
opt->status = 0;
*(UInt32*)opt->value = enableReuseIPMode; // set the desired option level, true or false
@ -1043,8 +1045,8 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size)
{
OTFlags flags ;
OTResult res ;
OTByteCount sz = 0 ;
size_t sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
res = OTRcv( socket->m_endpoint , buffer , size , &flags ) ;
if ( res < 0 )
@ -1055,7 +1057,7 @@ int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size)
// we simulate another read event if there are still bytes
if ( socket->m_takesEvents )
{
size_t sz = 0 ;
OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( sz > 0 )
{
@ -1365,7 +1367,7 @@ GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t
assert(address != NULL);
CHECK_ADDRESS(address, INET, GSOCK_INVADDR);
OTInetAddressToName( gInetSvcRef , address->m_host , &name ) ;
OTInetAddressToName( gInetSvcRef , address->m_host , name ) ;
strncpy( hostname , name , sbuf ) ;
return GSOCK_NOERROR;
}
@ -1397,7 +1399,7 @@ void _GSocket_Enable_Events(GSocket *socket)
state = OTGetEndpointState(socket->m_endpoint);
{
size_t sz = 0 ;
OTByteCount sz = 0 ;
OTCountDataBytes( socket->m_endpoint , &sz ) ;
if ( state == T_INCON || sz > 0 )
{
@ -1437,7 +1439,7 @@ GSocketError _GSocket_Input_Timeout(GSocket *socket)
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < socket->m_timeout * 1000.0 )
{
OTResult state ;
size_t sz = 0 ;
OTByteCount sz = 0 ;
state = OTGetEndpointState(socket->m_endpoint);
OTCountDataBytes( socket->m_endpoint , &sz ) ;

View File

@ -1,7 +1,7 @@
#pragma once
#if defined(__UNIX__)
#include <HIToolbox/lists.h>
#include <Carbon/Carbon.h>
#else
#include <Lists.h>
#endif

Binary file not shown.

View File

@ -414,7 +414,11 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
wxPNGReaderIter iter(this);
/* open the file */
#ifndef __UNIX__
fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
#else
fp = fopen( ImageFileName , "rb" );
#endif
if (!fp)
return FALSE;

View File

@ -17,12 +17,13 @@
// headers
// ----------------------------------------------------------------------------
#include "wx/mac/statusbr.h"
#include "wx/defs.h"
#include "wx/statusbr.h"
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarXX, wxStatusBar);
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBar);
BEGIN_EVENT_TABLE(wxStatusBarXX, wxStatusBar)
EVT_SIZE(wxStatusBarXX::OnSize)
BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBar)
EVT_SIZE(wxStatusBarMac::OnSize)
END_EVENT_TABLE()
@ -31,20 +32,15 @@ END_EVENT_TABLE()
// ============================================================================
// ----------------------------------------------------------------------------
// wxStatusBarXX class
// wxStatusBarMac class
// ----------------------------------------------------------------------------
wxStatusBarXX::wxStatusBarXX()
wxStatusBarMac::wxStatusBarMac()
{
SetParent(NULL);
}
wxStatusBarXX::wxStatusBarXX(wxWindow *parent, wxWindowID id, long style)
{
Create(parent, id, style);
}
bool wxStatusBarXX::Create(wxWindow *parent, wxWindowID id, long style)
bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name = wxPanelNameStr)
{
SetParent(parent);
@ -57,7 +53,7 @@ bool wxStatusBarXX::Create(wxWindow *parent, wxWindowID id, long style)
return FALSE;
}
void wxStatusBarXX::SetFieldsCount(int nFields, const int widths[])
void wxStatusBarMac::SetFieldsCount(int nFields, const int widths[])
{
wxASSERT( (nFields > 0) && (nFields < 255) );
@ -67,7 +63,7 @@ void wxStatusBarXX::SetFieldsCount(int nFields, const int widths[])
SetFieldsWidth();
}
void wxStatusBarXX::SetStatusWidths(int n, const int widths[])
void wxStatusBarMac::SetStatusWidths(int n, const int widths[])
{
wxASSERT( n == m_nFields );
@ -75,7 +71,7 @@ void wxStatusBarXX::SetStatusWidths(int n, const int widths[])
SetFieldsWidth();
}
void wxStatusBarXX::CopyFieldsWidth(const int widths[])
void wxStatusBarMac::CopyFieldsWidth(const int widths[])
{
if (widths && !m_statusWidths)
m_statusWidths = new int[m_nFields];
@ -90,7 +86,7 @@ void wxStatusBarXX::CopyFieldsWidth(const int widths[])
}
}
void wxStatusBarXX::SetFieldsWidth()
void wxStatusBarMac::SetFieldsWidth()
{
int *pWidths = new int[m_nFields];
@ -140,12 +136,12 @@ void wxStatusBarXX::SetFieldsWidth()
delete [] pWidths;
}
void wxStatusBarXX::SetStatusText(const wxString& strText, int nField)
void wxStatusBarMac::SetStatusText(const wxString& strText, int nField)
{
// TODO
}
wxString wxStatusBarXX::GetStatusText(int nField) const
wxString wxStatusBarMac::GetStatusText(int nField) const
{
wxASSERT( (nField > -1) && (nField < m_nFields) );
@ -153,7 +149,7 @@ wxString wxStatusBarXX::GetStatusText(int nField) const
return wxString("");
}
void wxStatusBarXX::OnSize(wxSizeEvent& event)
void wxStatusBarMac::OnSize(wxSizeEvent& event)
{
// adjust fields widths to the new size
SetFieldsWidth();

View File

@ -22,6 +22,7 @@
#include <fstream.h>
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/button.h"
#include "wx/panel.h"
#include "wx/textctrl.h"

View File

@ -16,6 +16,7 @@
#if wxUSE_TOOLTIPS
#include "wx/app.h"
#include "wx/dc.h"
#include "wx/window.h"
#include "wx/tooltip.h"
#include "wx/timer.h"

View File

@ -1,9 +1,10 @@
#include "wx/defs.h"
#include "wx/dc.h"
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
#ifdef __UNIX__
#include <NavigationServices/Navigation.h>
#include <Carbon/Carbon.h>
#else
#include <Navigation.h>
#endif

View File

@ -260,6 +260,7 @@ bool wxIsBusy()
return (wxBusyCursorCount > 0);
}
#ifndef __UNIX__
wxString wxMacFindFolder( short vol,
OSType folderType,
Boolean createFolder)
@ -278,6 +279,7 @@ wxString wxMacFindFolder( short vol,
}
return strDir ;
}
#endif
#ifndef __UNIX__
char *wxGetUserHome (const wxString& user)
@ -343,6 +345,11 @@ void wxDisplaySize(int *width, int *height)
#endif
}
void wxDisplaySizeMM(int *width, int *height)
{
wxDisplaySize(width, height);
}
wxWindow* wxFindWindowAtPoint(const wxPoint& pt)
{
return wxGenericFindWindowAtPoint(pt);

View File

@ -14,11 +14,15 @@
#endif
#include "wx/utils.h"
#ifdef __UNIX__
#include "wx/unix/execute.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef __UNIX__
#define wxEXECUTE_WIN_MESSAGE 10000
long wxExecute(const wxString& command, bool sync, wxProcess *handler)
@ -26,3 +30,12 @@ long wxExecute(const wxString& command, bool sync, wxProcess *handler)
// TODO
return 0;
}
#endif
#ifdef __UNIX__
int wxAddProcessCallback(wxEndProcessData *proc_data, int fd)
{
wxFAIL_MSG(wxT("wxAddProcessCallback() function not ready"));
return 0;
}
#endif

View File

@ -126,14 +126,18 @@ bool wxWave::Play(bool async, bool looped) const
if (m_isResource)
{
strcpy(lpSnd, m_sndname);
c2pstr((char *) lpSnd);
SndListHandle hSnd;
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
#if TARGET_CARBON
c2pstrcpy((unsigned char *)lpSnd, m_sndname);
#else
strcpy(lpSnd, m_sndname);
c2pstr((char *) lpSnd);
#endif
SndListHandle hSnd;
hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
if ((hSnd != NULL) && (SndPlay(m_sndChan, hSnd, async) == noErr))
ret = true;
if ((hSnd != NULL) && (SndPlay(m_sndChan, hSnd, async) == noErr))
ret = true;
}
return ret;

View File

@ -15,6 +15,7 @@
#include "wx/setup.h"
#include "wx/menu.h"
#include "wx/window.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
#include "wx/utils.h"
@ -33,9 +34,6 @@
#include "wx/tabctrl.h"
#include "wx/tooltip.h"
#include "wx/statusbr.h"
// TODO remove the line below, just for lookup-up convenience CS
#include "wx/window.h"
#include "wx/menuitem.h"
#include "wx/log.h"
@ -763,6 +761,11 @@ void wxWindow::MacSuperShown( bool show )
bool wxWindow::MacIsReallyShown() const
{
if ( m_isShown && (m_parent != NULL) ) {
return m_parent->MacIsReallyShown();
}
return m_isShown;
/*
bool status = m_isShown ;
wxWindow * win = this ;
while ( status && win->m_parent != NULL )
@ -771,6 +774,7 @@ bool wxWindow::MacIsReallyShown() const
status = win->m_isShown ;
}
return status ;
*/
}
int wxWindow::GetCharHeight() const
@ -794,7 +798,7 @@ void wxWindow::GetTextExtent(const wxString& string, int *x, int *y,
wxClientDC dc( (wxWindow*) this ) ;
long lx,ly,ld,le ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, fontToUse ) ;
dc.GetTextExtent( string , &lx , &ly , &ld, &le, (wxFont *)fontToUse ) ;
if ( externalLeading )
*externalLeading = le ;
if ( descent )
@ -2306,7 +2310,37 @@ long wxWindow::MacRemoveBordersFromStyle( long style )
{
return style & ~( wxDOUBLE_BORDER | wxSUNKEN_BORDER | wxRAISED_BORDER | wxBORDER | wxSTATIC_BORDER ) ;
}
/*
wxMacFocusHelper::wxMacFocusHelper( wxWindow * theWindow )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindow *rootwin ;
m_currentPort = NULL ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
theWindow->MacSetPortFocusParams( localOrigin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
wxMacFocusHelper::~wxMacFocusHelper()
{
if ( m_ok )
{
SetPort( m_currentPort ) ;
SetOrigin( 0 , 0 ) ;
}
if ( m_formerPort != m_currentPort )
SetPort( m_formerPort ) ;
}
*/
wxMacDrawingHelper::wxMacDrawingHelper( wxWindow * theWindow )
{

View File

@ -40,10 +40,6 @@
#include "wx/setup.h"
#ifdef macintosh
#ifdef __std
#undef __std
#define __std()
#endif
#include <stat.h>
#include <unix.h>
#include <unistd.h>

View File

@ -35,10 +35,6 @@
#include "wx/setup.h"
#ifdef macintosh
#ifdef __std
#undef __std
#define __std()
#endif
#include <stat.h>
#include <unix.h>
#include <unistd.h>

View File

@ -1,487 +0,0 @@
/*
* Copyright (C) 1989-95 GROUPE BULL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of GROUPE BULL shall not be
* used in advertising or otherwise to promote the sale, use or other dealings
* in this Software without prior written authorization from GROUPE BULL.
*/
/*****************************************************************************\
* data.c: *
* *
* XPM library *
* IO utilities *
* *
* Developed by Arnaud Le Hors *
\*****************************************************************************/
#ifndef CXPMPROG
/* Official version number */
static char *RCS_Version = "$XpmVersion: 3.4k $";
/* Internal version number */
static char *RCS_Id = "$Id$";
#include "XpmI.h"
#endif
#include <ctype.h>
#ifndef CXPMPROG
#define Getc(data, file) getc(file)
#define Ungetc(data, c, file) ungetc(c, file)
#endif
static int
ParseComment(data)
xpmData *data;
{
if (data->type == XPMBUFFER) {
register char c;
register unsigned int n = 0;
unsigned int notend;
char *s, *s2;
s = data->Comment;
*s = data->Bcmt[0];
/* skip the string beginning comment */
s2 = data->Bcmt;
do {
c = *data->cptr++;
*++s = c;
n++;
s2++;
} while (c == *s2 && *s2 != '\0' && c);
if (*s2 != '\0') {
/* this wasn't the beginning of a comment */
data->cptr -= n;
return 0;
}
/* store comment */
data->Comment[0] = *s;
s = data->Comment;
notend = 1;
n = 0;
while (notend) {
s2 = data->Ecmt;
while (*s != *s2 && c) {
c = *data->cptr++;
if (n == XPMMAXCMTLEN - 1) { /* forget it */
s = data->Comment;
n = 0;
}
*++s = c;
n++;
}
data->CommentLength = n;
do {
c = *data->cptr++;
if (n == XPMMAXCMTLEN - 1) { /* forget it */
s = data->Comment;
n = 0;
}
*++s = c;
n++;
s2++;
} while (c == *s2 && *s2 != '\0' && c);
if (*s2 == '\0') {
/* this is the end of the comment */
notend = 0;
data->cptr--;
}
}
return 0;
} else {
FILE *file = data->stream.file;
register int c;
register unsigned int n = 0, a;
unsigned int notend;
char *s, *s2;
s = data->Comment;
*s = data->Bcmt[0];
/* skip the string beginning comment */
s2 = data->Bcmt;
do {
c = Getc(data, file);
*++s = c;
n++;
s2++;
} while (c == *s2 && *s2 != '\0' && c != EOF);
if (*s2 != '\0') {
/* this wasn't the beginning of a comment */
/* put characters back in the order that we got them */
for (a = n; a > 0; a--, s--)
Ungetc(data, *s, file);
return 0;
}
/* store comment */
data->Comment[0] = *s;
s = data->Comment;
notend = 1;
n = 0;
while (notend) {
s2 = data->Ecmt;
while (*s != *s2 && c != EOF) {
c = Getc(data, file);
if (n == XPMMAXCMTLEN - 1) { /* forget it */
s = data->Comment;
n = 0;
}
*++s = c;
n++;
}
data->CommentLength = n;
do {
c = Getc(data, file);
if (n == XPMMAXCMTLEN - 1) { /* forget it */
s = data->Comment;
n = 0;
}
*++s = c;
n++;
s2++;
} while (c == *s2 && *s2 != '\0' && c != EOF);
if (*s2 == '\0') {
/* this is the end of the comment */
notend = 0;
Ungetc(data, *s, file);
}
}
return 0;
}
}
/*
* skip to the end of the current string and the beginning of the next one
*/
int
xpmNextString(data)
xpmData *data;
{
if (!data->type)
data->cptr = (data->stream.data)[++data->line];
else if (data->type == XPMBUFFER) {
register char c;
/* get to the end of the current string */
if (data->Eos)
while ((c = *data->cptr++)!=NULL && c != data->Eos)
{}
/*
* then get to the beginning of the next string looking for possible
* comment
*/
if (data->Bos) {
while ((c = *data->cptr++)!=NULL && c != data->Bos)
if (data->Bcmt && c == data->Bcmt[0])
ParseComment(data);
} else if (data->Bcmt) { /* XPM2 natural */
while ((c = *data->cptr++) == data->Bcmt[0])
ParseComment(data);
data->cptr--;
}
} else {
register int c;
FILE *file = data->stream.file;
/* get to the end of the current string */
if (data->Eos)
while ((c = Getc(data, file))!=NULL != data->Eos && c != EOF)
{}
/*
* then get to the beginning of the next string looking for possible
* comment
*/
if (data->Bos) {
while ((c = Getc(data, file)) != data->Bos && c != EOF)
if (data->Bcmt && c == data->Bcmt[0])
ParseComment(data);
} else if (data->Bcmt) { /* XPM2 natural */
while ((c = Getc(data, file)) == data->Bcmt[0])
ParseComment(data);
Ungetc(data, c, file);
}
}
return 0;
}
/*
* skip whitespace and return the following word
*/
unsigned int
xpmNextWord(data, buf, buflen)
xpmData *data;
char *buf;
unsigned int buflen;
{
register unsigned int n = 0;
int c;
if (!data->type || data->type == XPMBUFFER) {
while (isspace(c = *data->cptr) && c != data->Eos)
data->cptr++;
do {
c = *data->cptr++;
*buf++ = c;
n++;
} while (!isspace(c) && c != data->Eos && n < buflen);
n--;
data->cptr--;
} else {
FILE *file = data->stream.file;
while ((c = Getc(data, file)) != EOF && isspace(c) && c != data->Eos)
{
}
while (!isspace(c) && c != data->Eos && c != EOF && n < buflen) {
*buf++ = c;
n++;
c = Getc(data, file);
}
Ungetc(data, c, file);
}
return (n);
}
/*
* skip whitespace and compute the following unsigned int,
* returns 1 if one is found and 0 if not
*/
int
xpmNextUI(data, ui_return)
xpmData *data;
unsigned int *ui_return;
{
char buf[BUFSIZ];
int l;
l = xpmNextWord(data, buf, BUFSIZ);
return xpmatoui(buf, l, ui_return);
}
/*
* return end of string - WARNING: malloc!
*/
int
xpmGetString(data, sptr, l)
xpmData *data;
char **sptr;
unsigned int *l;
{
unsigned int i, n = 0;
int c;
char *p = NULL, *q, buf[BUFSIZ];
if (!data->type || data->type == XPMBUFFER) {
if (data->cptr) {
char *start = data->cptr;
while ((c = *data->cptr)!=NULL && c != data->Eos)
data->cptr++;
n = data->cptr - start + 1;
p = (char *) XpmMalloc(n);
if (!p)
return (XpmNoMemory);
strncpy(p, start, n);
if (data->type) /* XPMBUFFER */
p[n - 1] = '\0';
}
} else {
FILE *file = data->stream.file;
if ((c = Getc(data, file)) == EOF)
return (XpmFileInvalid);
i = 0;
q = buf;
p = (char *) XpmMalloc(1);
while (c != data->Eos && c != EOF) {
if (i == BUFSIZ) {
/* get to the end of the buffer */
/* malloc needed memory */
q = (char *) XpmRealloc(p, n + i);
if (!q) {
XpmFree(p);
return (XpmNoMemory);
}
p = q;
q += n;
/* and copy what we already have */
strncpy(q, buf, i);
n += i;
i = 0;
q = buf;
}
*q++ = c;
i++;
c = Getc(data, file);
}
if (c == EOF) {
XpmFree(p);
return (XpmFileInvalid);
}
if (n + i != 0) {
/* malloc needed memory */
q = (char *) XpmRealloc(p, n + i + 1);
if (!q) {
XpmFree(p);
return (XpmNoMemory);
}
p = q;
q += n;
/* and copy the buffer */
strncpy(q, buf, i);
n += i;
p[n++] = '\0';
} else {
*p = '\0';
n = 1;
}
Ungetc(data, c, file);
}
*sptr = p;
*l = n;
return (XpmSuccess);
}
/*
* get the current comment line
*/
int
xpmGetCmt(data, cmt)
xpmData *data;
char **cmt;
{
if (!data->type)
*cmt = NULL;
else if (data->CommentLength) {
*cmt = (char *) XpmMalloc(data->CommentLength + 1);
strncpy(*cmt, data->Comment, data->CommentLength);
(*cmt)[data->CommentLength] = '\0';
data->CommentLength = 0;
} else
*cmt = NULL;
return 0;
}
xpmDataType xpmDataTypes[] =
{
"", "!", "\n", '\0', '\n', "", "", "", "", /* Natural type */
"C", "/*", "*/", '"', '"', ",\n", "static char *", "[] = {\n", "};\n",
"Lisp", ";", "\n", '"', '"', "\n", "(setq ", " '(\n", "))\n",
#ifdef VMS
NULL
#else
NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL
#endif
};
/*
* parse xpm header
*/
int
xpmParseHeader(data)
xpmData *data;
{
char buf[BUFSIZ];
int l, n = 0;
if (data->type) {
data->Bos = '\0';
data->Eos = '\n';
data->Bcmt = data->Ecmt = NULL;
l = xpmNextWord(data, buf, BUFSIZ);
if (l == 7 && !strncmp("#define", buf, 7)) {
/* this maybe an XPM 1 file */
char *ptr;
l = xpmNextWord(data, buf, BUFSIZ);
if (!l)
return (XpmFileInvalid);
buf[l] = '\0';
#if defined(macintosh) || defined(__APPLE__)
ptr = strrchr(buf, '_');
#else
ptr = rindex(buf, '_');
#endif
if (!ptr || strncmp("_format", ptr, l - (ptr - buf)))
return XpmFileInvalid;
/* this is definitely an XPM 1 file */
data->format = 1;
n = 1; /* handle XPM1 as mainly XPM2 C */
} else {
/*
* skip the first word, get the second one, and see if this is
* XPM 2 or 3
*/
l = xpmNextWord(data, buf, BUFSIZ);
if ((l == 3 && !strncmp("XPM", buf, 3)) ||
(l == 4 && !strncmp("XPM2", buf, 4))) {
if (l == 3)
n = 1; /* handle XPM as XPM2 C */
else {
/* get the type key word */
l = xpmNextWord(data, buf, BUFSIZ);
/*
* get infos about this type
*/
while (xpmDataTypes[n].type
&& strncmp(xpmDataTypes[n].type, buf, l))
n++;
}
data->format = 0;
} else
/* nope this is not an XPM file */
return XpmFileInvalid;
}
if (xpmDataTypes[n].type) {
if (n == 0) { /* natural type */
data->Bcmt = xpmDataTypes[n].Bcmt;
data->Ecmt = xpmDataTypes[n].Ecmt;
xpmNextString(data); /* skip the end of the headerline */
data->Bos = xpmDataTypes[n].Bos;
data->Eos = xpmDataTypes[n].Eos;
} else {
data->Bcmt = xpmDataTypes[n].Bcmt;
data->Ecmt = xpmDataTypes[n].Ecmt;
if (!data->format) { /* XPM 2 or 3 */
data->Bos = xpmDataTypes[n].Bos;
data->Eos = '\0';
/* get to the beginning of the first string */
xpmNextString(data);
data->Eos = xpmDataTypes[n].Eos;
} else /* XPM 1 skip end of line */
xpmNextString(data);
}
} else
/* we don't know about that type of XPM file... */
return XpmFileInvalid;
}
return XpmSuccess;
}

Binary file not shown.

View File

@ -680,7 +680,7 @@ wxDialUpManagerImpl::CheckIfconfig()
cmd << " -a";
#elif defined(__LINUX__) || defined(__SGI__)
// nothing to be added to ifconfig
#elif defined(__FREEBSD__)
#elif defined(__FREEBSD__) || defined(__WXMAC__)
// add -l flag
cmd << " -l";
#elif defined(__HPUX__)
@ -775,7 +775,7 @@ wxDialUpManagerImpl::NetConnection wxDialUpManagerImpl::CheckPing()
cmd << m_PingPath << ' ';
#if defined(__SOLARIS__) || defined (__SUNOS__)
// nothing to add to ping command
#elif defined(__LINUX__) || defined ( __FREEBSD__)
#elif defined(__LINUX__) || defined ( __FREEBSD__) || defined(__WXMAC__)
cmd << "-c 1 "; // only ping once
#elif defined(__HPUX__)
cmd << "64 1 "; // only ping once (need also specify the packet size)