#if defined(__WXMAC__) && !defined(__UNIX__)
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
+ WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
+ /*
WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) ;
- WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
WXDLLEXPORT wxString wxMac2UnixFilename( const char *s) ;
WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
+*/
#endif
// Strip the extension, in situ
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
#define wxPATH_SEP wxPATH_SEP_UNIX
#elif defined(__MAC__)
-// TODO find out whether we can really switch back to native file names
-// previously this mac was emulating unix/win filename structures
-// #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
- #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
+ #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
#define wxPATH_SEP wxPATH_SEP_DOS
#else // Windows and OS/2
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
(void)new wxToggleButton(panel, ID_BUTTON_LABEL,
"&Toggle label", wxPoint(250, 20));
#endif // wxUSE_TOGGLEBTN
+
m_label = new wxStaticText(panel, -1, "Label with some long text",
wxPoint(250, 60), wxDefaultSize,
wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
tmp_fname = new char[fname_len];
wxWX2MB(tmp_fname, filename, fname_len);
-#if defined(__WXMAC__) && !defined(__UNIX__)
- m_fp = fopen(wxUnix2MacFilename( tmp_fname ), mode);
-#else
m_fp = fopen(tmp_fname, mode);
-#endif
delete tmp_fname;
-#else
-#if defined(__WXMAC__) && !defined(__UNIX__)
- m_fp = fopen(wxUnix2MacFilename( filename ), mode);
#else
m_fp = fopen(filename, mode);
#endif
-#endif
if ( !m_fp )
#if wxUSE_UNICODE && wxMBFILES
wxCharBuffer fname = wxConvFile.cWC2MB(name);
-#if defined(__WXMAC__) && !defined(__UNIX__)
- return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
-#else
return !wxAccess(fname, 0) &&
!wxStat(wxMBSTRINGCAST fname, &st) &&
(st.st_mode & S_IFREG);
-#endif
-#else
-#if defined(__WXMAC__) && !defined(__UNIX__)
- return !access(wxUnix2MacFilename( name ) , 0) && !stat(wxUnix2MacFilename( name ), &st) && (st.st_mode & S_IFREG);
+
#else
return !wxAccess(name, 0) &&
!wxStat(name, &st) &&
(st.st_mode & S_IFREG);
#endif
-#endif
}
bool wxFile::Access(const wxChar *name, OpenMode mode)
#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);
+ int fd = creat( szFileName , accessMode);
#else
int fd = wxOpen(wxFNCONV(szFileName),
O_BINARY | O_WRONLY | O_CREAT |
break;
}
-#if defined(__WXMAC__) && !defined(__UNIX__)
- int fd = open(wxUnix2MacFilename( szFileName ), flags, access);
-#else
int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
-#endif
if ( fd == -1 ) {
wxLogSysError(_("can't open file '%s'"), szFileName);
return FALSE;
{
m_file.Close();
-#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;
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
return FALSE;
}
-#else
- if ( wxFile::Exists(m_strName) && remove(wxUnix2MacFilename( m_strName )) != 0 ) {
- wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
- return FALSE;
- }
-
- if ( rename(wxUnix2MacFilename( m_strTemp ), wxUnix2MacFilename( m_strName )) != 0 ) {
- wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
- return FALSE;
- }
-#endif
return TRUE;
}
void wxTempFile::Discard()
{
m_file.Close();
-#if !defined(__WXMAC__) || defined(__UNIX__)
if ( wxRemove(m_strTemp) != 0 )
wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
-#else
- if ( remove( wxUnix2MacFilename(m_strTemp.fn_str())) != 0 )
- wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
-#endif
}
#endif
{
FSSpec spec ;
- wxUnixFilename2FSSpec( m_strLocalFile , &spec ) ;
+ wxMacFilename2FSSpec( m_strLocalFile , &spec ) ;
FInfo finfo ;
if ( FSpGetFInfo( &spec , &finfo ) == noErr )
{
// ----------------------------------------------------------------------------
// we need to translate Mac filenames before passing them to OS functions
-#ifdef __MAC__
- #define OS_FILENAME(s) (wxUnix2MacFilename(s))
-#else
#define OS_FILENAME(s) (s.fn_str())
-#endif
// ============================================================================
// implementation
tcp = path + wxStrlen (path);
while (--tcp >= path)
{
+#ifdef __WXMAC__
+ if (*tcp == wxT(':') )
+#else
if (*tcp == wxT('/') || *tcp == wxT('\\')
#ifdef __VMS__
|| *tcp == wxT(':') || *tcp == wxT(']'))
#else
)
+#endif
#endif
return tcp + 1;
} /* while */
tcp = path + wxStrlen (path);
while (--tcp >= path)
{
+#ifdef __WXMAC__
+ if (*tcp == wxT(':') )
+#else
if (*tcp == wxT('/') || *tcp == wxT('\\')
#ifdef __VMS__
|| *tcp == wxT(':') || *tcp == wxT(']'))
#else
)
+#endif
#endif
return wxString(tcp + 1);
} /* while */
while (!done && i > -1)
{
// ] is for VMS
+#ifdef __WXMAC__
+ if (path[i] == wxT(':') )
+#else
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
+#endif
{
done = TRUE;
#ifdef __VMS__
while (!done && i > -1)
{
// ] is for VMS
+#ifdef __WXMAC__
+ if (path[i] == wxT(':') )
+#else
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
+#endif
{
done = TRUE;
#ifdef __VMS__
// Also, convert to lower case, since case is significant in UNIX.
#if defined(__WXMAC__) && !defined(__UNIX__)
+wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
+{
+ Handle myPath ;
+ short length ;
+
+ FSpGetFullPath( spec , &length , &myPath ) ;
+ ::SetHandleSize( myPath , length + 1 ) ;
+ ::HLock( myPath ) ;
+ (*myPath)[length] = 0 ;
+ if ( length > 0 && (*myPath)[length-1] ==':' )
+ (*myPath)[length-1] = 0 ;
+
+ wxString result( (char*) *myPath ) ;
+ ::HUnlock( myPath ) ;
+ ::DisposeHandle( myPath ) ;
+ return result ;
+}
+void wxMacFilename2FSSpec( const char *path , FSSpec *spec )
+{
+ FSpLocationFromFullPath( strlen(path ) , path , spec ) ;
+}
+
+/*
static char sMacFileNameConversion[ 1000 ] ;
wxString wxMac2UnixFilename (const char *str)
return wxString (sMacFileNameConversion) ;
}
-wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
-{
- Handle myPath ;
- short length ;
-
- FSpGetFullPath( spec , &length , &myPath ) ;
- ::SetHandleSize( myPath , length + 1 ) ;
- ::HLock( myPath ) ;
- (*myPath)[length] = 0 ;
- if ( length > 0 && (*myPath)[length-1] ==':' )
- (*myPath)[length-1] = 0 ;
-
- wxString result( (char*) *myPath ) ;
- ::HUnlock( myPath ) ;
- ::DisposeHandle( myPath ) ;
- return result ;
-}
-
wxString wxMacFSSpec2UnixFilename( const FSSpec *spec )
{
return wxMac2UnixFilename( wxMacFSSpec2MacFilename( spec) ) ;
wxString var = wxUnix2MacFilename( path ) ;
wxMacFilename2FSSpec( var , spec ) ;
}
-
+*/
#endif
void
wxDos2UnixFilename (char *s)
bool wxMkdir(const wxString& dir, int perm)
{
#if defined(__WXMAC__) && !defined(__UNIX__)
- return (mkdir(wxUnix2MacFilename( dir ) , 0 ) == 0);
+ return (mkdir( dir , 0 ) == 0);
#else // !Mac
const wxChar *dirname = dir.c_str();
FSSpec fsspec ;
- wxUnixFilename2FSSpec( result , &fsspec ) ;
+ wxMacFilename2FSSpec( result , &fsspec ) ;
g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ;
g_iter.m_index = 0 ;
g_iter.m_name,
&spec) ;
- return wxMacFSSpec2UnixFilename( &spec ) ;
+ return wxMacFSSpec2MacFilename( &spec ) ;
}
#elif defined(__WXMSW__)
cwdSpec.vRefNum = pb.ioFCBVRefNum;
cwdSpec.parID = pb.ioFCBParID;
cwdSpec.name[0] = 0 ;
- wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
+ wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
strcpy( buf , res ) ;
buf[res.length()-1]=0 ;
{
wxExprDatabase db;
-#if defined(__WXMAC__) && !defined(__UNIX__)
- FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r");
-#else
FILE *fd = wxFopen(filename, _T("r"));
-#endif
if (!fd)
return FALSE;
bool eof = FALSE;
#endif // __WXPM__
+#ifdef __WXMAC__
+#include "moreextr.h"
+#endif
+
#ifdef __BORLANDC__
#include "dos.h"
#endif
}
}
#endif
-
+#elif defined(__WXMAC__)
+ FSSpec volume ;
+ short index = 1 ;
+ while(1) {
+ short actualCount = 0 ;
+ if ( OnLine( &volume , 1 , &actualCount , &index ) != noErr || actualCount == 0 )
+ break ;
+
+ wxString name = wxMacFSSpec2MacFilename( &volume ) ;
+ AddSection(name+":", name, 0);
+ }
#else
AddSection(wxT("/"), _("The Computer"), 0);
AddSection(wxGetHomeDir(), _("My Home"), 0 );
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
return wxID_CANCEL;
name, &outFileSpec);
// outFolderDirID = thePB.dirInfo.ioDrDirID;
- m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
+ m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
return wxID_OK ;
}
return wxID_CANCEL;
FSSpec fsspec ;
- wxUnixFilename2FSSpec( m_dirname , &fsspec ) ;
+ wxMacFilename2FSSpec( m_dirname , &fsspec ) ;
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
// first appears
FSSpec location ;
- wxUnixFilename2FSSpec( m_dir , &location ) ;
+ wxMacFilename2FSSpec( m_dir , &location ) ;
OSErr err = noErr ;
mDefaultLocation.descriptorType = typeNull;
// outFolderDirID = thePB.dirInfo.ioDrDirID;
- m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
+ m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
m_paths.Add( m_path ) ;
m_fileNames.Add(m_fileName);
}
wxPNGReaderIter iter(this);
/* open the file */
-#ifndef __UNIX__
- fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
-#else
fp = fopen( ImageFileName , "rb" );
-#endif
+
if (!fp)
return FALSE;
#include "wx/app.h"
#include "wx/stattext.h"
+#include "wx/notebook.h"
+#include "wx/tabctrl.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
return;
PrepareDC(dc);
- dc.Clear() ;
+ bool doClear = true ;
+ WindowRef window = GetMacRootWindow() ;
+ if ( window )
+ {
+ wxWindow* win = wxFindWinFromMacWindow( window ) ;
+ if ( win )
+ {
+ wxWindow* parent = GetParent() ;
+ while ( parent )
+ {
+ if( parent->MacGetWindowData() )
+ {
+ break ;
+ }
+
+ if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+ {
+ if ( ((wxControl*)parent)->GetMacControl() ) {
+ Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
+ if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
+ DrawThemeTabPane ( &rect, kThemeStateActive);
+ doClear = false ;
+ }
+ break ;
+ }
+
+ parent = parent->GetParent() ;
+ }
+ }
+ }
+ if ( doClear )
+ dc.Clear() ;
+
int x = 0 ;
int y = 0 ;
wxString text = m_label ;
FSSpec file ;
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
{
- strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
+ strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
}
}
return strDir ;
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
return wxID_CANCEL;
name, &outFileSpec);
// outFolderDirID = thePB.dirInfo.ioDrDirID;
- m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
+ m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
return wxID_OK ;
}
return wxID_CANCEL;
FSSpec fsspec ;
- wxUnixFilename2FSSpec( m_dirname , &fsspec ) ;
+ wxMacFilename2FSSpec( m_dirname , &fsspec ) ;
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
m_CPB.hFileInfo.ioNamePtr = m_name ;
m_index = 0 ;
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
}
else
{
- m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+ m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
return wxID_OK ;
}
}
// first appears
FSSpec location ;
- wxUnixFilename2FSSpec( m_dir , &location ) ;
+ wxMacFilename2FSSpec( m_dir , &location ) ;
OSErr err = noErr ;
mDefaultLocation.descriptorType = typeNull;
// outFolderDirID = thePB.dirInfo.ioDrDirID;
- m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
+ m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
m_paths.Add( m_path ) ;
m_fileNames.Add(m_fileName);
}
wxPNGReaderIter iter(this);
/* open the file */
-#ifndef __UNIX__
- fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
-#else
fp = fopen( ImageFileName , "rb" );
-#endif
+
if (!fp)
return FALSE;
#include "wx/app.h"
#include "wx/stattext.h"
+#include "wx/notebook.h"
+#include "wx/tabctrl.h"
#include "wx/dc.h"
#include "wx/dcclient.h"
return;
PrepareDC(dc);
- dc.Clear() ;
+ bool doClear = true ;
+ WindowRef window = GetMacRootWindow() ;
+ if ( window )
+ {
+ wxWindow* win = wxFindWinFromMacWindow( window ) ;
+ if ( win )
+ {
+ wxWindow* parent = GetParent() ;
+ while ( parent )
+ {
+ if( parent->MacGetWindowData() )
+ {
+ break ;
+ }
+
+ if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
+ {
+ if ( ((wxControl*)parent)->GetMacControl() ) {
+ Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
+ if ( DrawThemeTabPane != (void*)kUnresolvedCFragSymbolAddress )
+ DrawThemeTabPane ( &rect, kThemeStateActive);
+ doClear = false ;
+ }
+ break ;
+ }
+
+ parent = parent->GetParent() ;
+ }
+ }
+ }
+ if ( doClear )
+ dc.Clear() ;
+
int x = 0 ;
int y = 0 ;
wxString text = m_label ;
FSSpec file ;
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
{
- strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
+ strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
}
}
return strDir ;