reverting to native mac pathnames
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -169,11 +169,13 @@ WXDLLEXPORT void wxUnix2DosFilename(wxChar *s);
|
|||||||
|
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
#if defined(__WXMAC__) && !defined(__UNIX__)
|
||||||
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
|
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
|
||||||
|
WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
|
||||||
|
/*
|
||||||
WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
|
WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
|
||||||
WXDLLEXPORT void wxUnixFilename2FSSpec( const char *path , 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 wxMac2UnixFilename( const char *s) ;
|
||||||
WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
|
WXDLLEXPORT wxString wxUnix2MacFilename( const char *s);
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Strip the extension, in situ
|
// Strip the extension, in situ
|
||||||
@@ -268,10 +270,7 @@ WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0);
|
|||||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX
|
||||||
#define wxPATH_SEP wxPATH_SEP_UNIX
|
#define wxPATH_SEP wxPATH_SEP_UNIX
|
||||||
#elif defined(__MAC__)
|
#elif defined(__MAC__)
|
||||||
// TODO find out whether we can really switch back to native file names
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC
|
||||||
// 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 wxPATH_SEP wxPATH_SEP_DOS
|
#define wxPATH_SEP wxPATH_SEP_DOS
|
||||||
#else // Windows and OS/2
|
#else // Windows and OS/2
|
||||||
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
#define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS
|
||||||
|
@@ -794,6 +794,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
|||||||
(void)new wxToggleButton(panel, ID_BUTTON_LABEL,
|
(void)new wxToggleButton(panel, ID_BUTTON_LABEL,
|
||||||
"&Toggle label", wxPoint(250, 20));
|
"&Toggle label", wxPoint(250, 20));
|
||||||
#endif // wxUSE_TOGGLEBTN
|
#endif // wxUSE_TOGGLEBTN
|
||||||
|
|
||||||
m_label = new wxStaticText(panel, -1, "Label with some long text",
|
m_label = new wxStaticText(panel, -1, "Label with some long text",
|
||||||
wxPoint(250, 60), wxDefaultSize,
|
wxPoint(250, 60), wxDefaultSize,
|
||||||
wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
|
wxALIGN_RIGHT /*| wxST_NO_AUTORESIZE*/);
|
||||||
|
@@ -64,20 +64,12 @@ bool wxFFile::Open(const wxChar *filename, const char *mode)
|
|||||||
tmp_fname = new char[fname_len];
|
tmp_fname = new char[fname_len];
|
||||||
wxWX2MB(tmp_fname, filename, 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);
|
m_fp = fopen(tmp_fname, mode);
|
||||||
#endif
|
|
||||||
|
|
||||||
delete tmp_fname;
|
delete tmp_fname;
|
||||||
#else
|
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
|
||||||
m_fp = fopen(wxUnix2MacFilename( filename ), mode);
|
|
||||||
#else
|
#else
|
||||||
m_fp = fopen(filename, mode);
|
m_fp = fopen(filename, mode);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if ( !m_fp )
|
if ( !m_fp )
|
||||||
|
@@ -136,22 +136,15 @@ bool wxFile::Exists(const wxChar *name)
|
|||||||
#if wxUSE_UNICODE && wxMBFILES
|
#if wxUSE_UNICODE && wxMBFILES
|
||||||
wxCharBuffer fname = wxConvFile.cWC2MB(name);
|
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) &&
|
return !wxAccess(fname, 0) &&
|
||||||
!wxStat(wxMBSTRINGCAST fname, &st) &&
|
!wxStat(wxMBSTRINGCAST fname, &st) &&
|
||||||
(st.st_mode & S_IFREG);
|
(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
|
#else
|
||||||
return !wxAccess(name, 0) &&
|
return !wxAccess(name, 0) &&
|
||||||
!wxStat(name, &st) &&
|
!wxStat(name, &st) &&
|
||||||
(st.st_mode & S_IFREG);
|
(st.st_mode & S_IFREG);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxFile::Access(const wxChar *name, OpenMode mode)
|
bool wxFile::Access(const wxChar *name, OpenMode mode)
|
||||||
@@ -195,7 +188,7 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
|
|||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
#if defined(__WXMAC__) && !defined(__UNIX__)
|
||||||
// Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
|
// 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 = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
|
||||||
int fd = creat(wxUnix2MacFilename( szFileName ), accessMode);
|
int fd = creat( szFileName , accessMode);
|
||||||
#else
|
#else
|
||||||
int fd = wxOpen(wxFNCONV(szFileName),
|
int fd = wxOpen(wxFNCONV(szFileName),
|
||||||
O_BINARY | O_WRONLY | O_CREAT |
|
O_BINARY | O_WRONLY | O_CREAT |
|
||||||
@@ -240,11 +233,7 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
|
||||||
int fd = open(wxUnix2MacFilename( szFileName ), flags, access);
|
|
||||||
#else
|
|
||||||
int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
|
int fd = wxOpen(wxFNCONV(szFileName), flags ACCESS(accessMode));
|
||||||
#endif
|
|
||||||
if ( fd == -1 ) {
|
if ( fd == -1 ) {
|
||||||
wxLogSysError(_("can't open file '%s'"), szFileName);
|
wxLogSysError(_("can't open file '%s'"), szFileName);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -555,7 +544,6 @@ bool wxTempFile::Commit()
|
|||||||
{
|
{
|
||||||
m_file.Close();
|
m_file.Close();
|
||||||
|
|
||||||
#if !defined(__WXMAC__) || defined(__UNIX__)
|
|
||||||
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
|
if ( wxFile::Exists(m_strName) && wxRemove(m_strName) != 0 ) {
|
||||||
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
|
wxLogSysError(_("can't remove file '%s'"), m_strName.c_str());
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -565,17 +553,6 @@ bool wxTempFile::Commit()
|
|||||||
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
|
wxLogSysError(_("can't commit changes to file '%s'"), m_strName.c_str());
|
||||||
return FALSE;
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -583,13 +560,8 @@ bool wxTempFile::Commit()
|
|||||||
void wxTempFile::Discard()
|
void wxTempFile::Discard()
|
||||||
{
|
{
|
||||||
m_file.Close();
|
m_file.Close();
|
||||||
#if !defined(__WXMAC__) || defined(__UNIX__)
|
|
||||||
if ( wxRemove(m_strTemp) != 0 )
|
if ( wxRemove(m_strTemp) != 0 )
|
||||||
wxLogSysError(_("can't remove temporary file '%s'"), m_strTemp.c_str());
|
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
|
#endif
|
||||||
|
@@ -802,7 +802,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
{
|
{
|
||||||
FSSpec spec ;
|
FSSpec spec ;
|
||||||
|
|
||||||
wxUnixFilename2FSSpec( m_strLocalFile , &spec ) ;
|
wxMacFilename2FSSpec( m_strLocalFile , &spec ) ;
|
||||||
FInfo finfo ;
|
FInfo finfo ;
|
||||||
if ( FSpGetFInfo( &spec , &finfo ) == noErr )
|
if ( FSpGetFInfo( &spec , &finfo ) == noErr )
|
||||||
{
|
{
|
||||||
|
@@ -142,11 +142,7 @@ const off_t wxInvalidOffset = (off_t)-1;
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// we need to translate Mac filenames before passing them to OS functions
|
// 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())
|
#define OS_FILENAME(s) (s.fn_str())
|
||||||
#endif
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -652,11 +648,15 @@ wxChar *wxFileNameFromPath (wxChar *path)
|
|||||||
tcp = path + wxStrlen (path);
|
tcp = path + wxStrlen (path);
|
||||||
while (--tcp >= path)
|
while (--tcp >= path)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
if (*tcp == wxT(':') )
|
||||||
|
#else
|
||||||
if (*tcp == wxT('/') || *tcp == wxT('\\')
|
if (*tcp == wxT('/') || *tcp == wxT('\\')
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
|| *tcp == wxT(':') || *tcp == wxT(']'))
|
|| *tcp == wxT(':') || *tcp == wxT(']'))
|
||||||
#else
|
#else
|
||||||
)
|
)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return tcp + 1;
|
return tcp + 1;
|
||||||
} /* while */
|
} /* while */
|
||||||
@@ -679,11 +679,15 @@ wxString wxFileNameFromPath (const wxString& path1)
|
|||||||
tcp = path + wxStrlen (path);
|
tcp = path + wxStrlen (path);
|
||||||
while (--tcp >= path)
|
while (--tcp >= path)
|
||||||
{
|
{
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
if (*tcp == wxT(':') )
|
||||||
|
#else
|
||||||
if (*tcp == wxT('/') || *tcp == wxT('\\')
|
if (*tcp == wxT('/') || *tcp == wxT('\\')
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
|| *tcp == wxT(':') || *tcp == wxT(']'))
|
|| *tcp == wxT(':') || *tcp == wxT(']'))
|
||||||
#else
|
#else
|
||||||
)
|
)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return wxString(tcp + 1);
|
return wxString(tcp + 1);
|
||||||
} /* while */
|
} /* while */
|
||||||
@@ -717,7 +721,11 @@ wxPathOnly (wxChar *path)
|
|||||||
while (!done && i > -1)
|
while (!done && i > -1)
|
||||||
{
|
{
|
||||||
// ] is for VMS
|
// ] is for VMS
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
if (path[i] == wxT(':') )
|
||||||
|
#else
|
||||||
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
|
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
@@ -766,7 +774,11 @@ wxString wxPathOnly (const wxString& path)
|
|||||||
while (!done && i > -1)
|
while (!done && i > -1)
|
||||||
{
|
{
|
||||||
// ] is for VMS
|
// ] is for VMS
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
if (path[i] == wxT(':') )
|
||||||
|
#else
|
||||||
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
|
if (path[i] == wxT('/') || path[i] == wxT('\\') || path[i] == wxT(']'))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
@@ -801,7 +813,30 @@ wxString wxPathOnly (const wxString& path)
|
|||||||
// Also, convert to lower case, since case is significant in UNIX.
|
// Also, convert to lower case, since case is significant in UNIX.
|
||||||
|
|
||||||
#if defined(__WXMAC__) && !defined(__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 ] ;
|
static char sMacFileNameConversion[ 1000 ] ;
|
||||||
|
|
||||||
wxString wxMac2UnixFilename (const char *str)
|
wxString wxMac2UnixFilename (const char *str)
|
||||||
@@ -868,24 +903,6 @@ wxString wxUnix2MacFilename (const char *str)
|
|||||||
return wxString (sMacFileNameConversion) ;
|
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 )
|
wxString wxMacFSSpec2UnixFilename( const FSSpec *spec )
|
||||||
{
|
{
|
||||||
return wxMac2UnixFilename( wxMacFSSpec2MacFilename( spec) ) ;
|
return wxMac2UnixFilename( wxMacFSSpec2MacFilename( spec) ) ;
|
||||||
@@ -901,7 +918,7 @@ void wxUnixFilename2FSSpec( const char *path , FSSpec *spec )
|
|||||||
wxString var = wxUnix2MacFilename( path ) ;
|
wxString var = wxUnix2MacFilename( path ) ;
|
||||||
wxMacFilename2FSSpec( var , spec ) ;
|
wxMacFilename2FSSpec( var , spec ) ;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
wxDos2UnixFilename (char *s)
|
wxDos2UnixFilename (char *s)
|
||||||
@@ -1099,7 +1116,7 @@ bool wxRemoveFile(const wxString& file)
|
|||||||
bool wxMkdir(const wxString& dir, int perm)
|
bool wxMkdir(const wxString& dir, int perm)
|
||||||
{
|
{
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
#if defined(__WXMAC__) && !defined(__UNIX__)
|
||||||
return (mkdir(wxUnix2MacFilename( dir ) , 0 ) == 0);
|
return (mkdir( dir , 0 ) == 0);
|
||||||
#else // !Mac
|
#else // !Mac
|
||||||
const wxChar *dirname = dir.c_str();
|
const wxChar *dirname = dir.c_str();
|
||||||
|
|
||||||
@@ -1395,7 +1412,7 @@ wxString wxFindFirstFile(const wxChar *spec, int flags)
|
|||||||
|
|
||||||
FSSpec fsspec ;
|
FSSpec fsspec ;
|
||||||
|
|
||||||
wxUnixFilename2FSSpec( result , &fsspec ) ;
|
wxMacFilename2FSSpec( result , &fsspec ) ;
|
||||||
g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
g_iter.m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
||||||
g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ;
|
g_iter.m_CPB.hFileInfo.ioNamePtr = g_iter.m_name ;
|
||||||
g_iter.m_index = 0 ;
|
g_iter.m_index = 0 ;
|
||||||
@@ -1443,7 +1460,7 @@ wxString wxFindNextFile()
|
|||||||
g_iter.m_name,
|
g_iter.m_name,
|
||||||
&spec) ;
|
&spec) ;
|
||||||
|
|
||||||
return wxMacFSSpec2UnixFilename( &spec ) ;
|
return wxMacFSSpec2MacFilename( &spec ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
@@ -1697,7 +1714,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
|||||||
cwdSpec.vRefNum = pb.ioFCBVRefNum;
|
cwdSpec.vRefNum = pb.ioFCBVRefNum;
|
||||||
cwdSpec.parID = pb.ioFCBParID;
|
cwdSpec.parID = pb.ioFCBParID;
|
||||||
cwdSpec.name[0] = 0 ;
|
cwdSpec.name[0] = 0 ;
|
||||||
wxString res = wxMacFSSpec2UnixFilename( &cwdSpec ) ;
|
wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
|
||||||
|
|
||||||
strcpy( buf , res ) ;
|
strcpy( buf , res ) ;
|
||||||
buf[res.length()-1]=0 ;
|
buf[res.length()-1]=0 ;
|
||||||
|
@@ -227,11 +227,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename)
|
|||||||
{
|
{
|
||||||
wxExprDatabase db;
|
wxExprDatabase db;
|
||||||
|
|
||||||
#if defined(__WXMAC__) && !defined(__UNIX__)
|
|
||||||
FILE *fd = fopen(wxUnix2MacFilename(filename.fn_str()), "r");
|
|
||||||
#else
|
|
||||||
FILE *fd = wxFopen(filename, _T("r"));
|
FILE *fd = wxFopen(filename, _T("r"));
|
||||||
#endif
|
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
bool eof = FALSE;
|
bool eof = FALSE;
|
||||||
|
@@ -67,6 +67,10 @@
|
|||||||
|
|
||||||
#endif // __WXPM__
|
#endif // __WXPM__
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
#include "moreextr.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#include "dos.h"
|
#include "dos.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -593,7 +597,17 @@ void wxGenericDirCtrl::SetupSections()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#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
|
#else
|
||||||
AddSection(wxT("/"), _("The Computer"), 0);
|
AddSection(wxT("/"), _("The Computer"), 0);
|
||||||
AddSection(wxGetHomeDir(), _("My Home"), 0 );
|
AddSection(wxGetHomeDir(), _("My Home"), 0 );
|
||||||
|
@@ -492,7 +492,7 @@ int wxDirDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
@@ -589,7 +589,7 @@ int wxDirDialog::ShowModal()
|
|||||||
name, &outFileSpec);
|
name, &outFileSpec);
|
||||||
|
|
||||||
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
||||||
m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
|
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
|
@@ -113,7 +113,7 @@ wxDirData::wxDirData(const wxString& dirname)
|
|||||||
|
|
||||||
FSSpec fsspec ;
|
FSSpec fsspec ;
|
||||||
|
|
||||||
wxUnixFilename2FSSpec( m_dirname , &fsspec ) ;
|
wxMacFilename2FSSpec( m_dirname , &fsspec ) ;
|
||||||
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
||||||
m_CPB.hFileInfo.ioNamePtr = m_name ;
|
m_CPB.hFileInfo.ioNamePtr = m_name ;
|
||||||
m_index = 0 ;
|
m_index = 0 ;
|
||||||
|
@@ -533,7 +533,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -574,7 +574,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ int wxFileDialog::ShowModal()
|
|||||||
// first appears
|
// first appears
|
||||||
|
|
||||||
FSSpec location ;
|
FSSpec location ;
|
||||||
wxUnixFilename2FSSpec( m_dir , &location ) ;
|
wxMacFilename2FSSpec( m_dir , &location ) ;
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
|
|
||||||
mDefaultLocation.descriptorType = typeNull;
|
mDefaultLocation.descriptorType = typeNull;
|
||||||
@@ -704,7 +704,7 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
|
|
||||||
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
||||||
m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
|
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
||||||
m_paths.Add( m_path ) ;
|
m_paths.Add( m_path ) ;
|
||||||
m_fileNames.Add(m_fileName);
|
m_fileNames.Add(m_fileName);
|
||||||
}
|
}
|
||||||
|
@@ -414,11 +414,8 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
|
|||||||
wxPNGReaderIter iter(this);
|
wxPNGReaderIter iter(this);
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
#ifndef __UNIX__
|
|
||||||
fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
|
|
||||||
#else
|
|
||||||
fp = fopen( ImageFileName , "rb" );
|
fp = fopen( ImageFileName , "rb" );
|
||||||
#endif
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/stattext.h"
|
#include "wx/stattext.h"
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
@@ -61,8 +63,40 @@ void wxStaticText::OnDraw( wxDC &dc )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PrepareDC(dc);
|
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 x = 0 ;
|
||||||
int y = 0 ;
|
int y = 0 ;
|
||||||
wxString text = m_label ;
|
wxString text = m_label ;
|
||||||
|
@@ -329,7 +329,7 @@ wxString wxMacFindFolder( short vol,
|
|||||||
FSSpec file ;
|
FSSpec file ;
|
||||||
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
|
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
|
||||||
{
|
{
|
||||||
strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
|
strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strDir ;
|
return strDir ;
|
||||||
|
@@ -492,7 +492,7 @@ int wxDirDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
@@ -589,7 +589,7 @@ int wxDirDialog::ShowModal()
|
|||||||
name, &outFileSpec);
|
name, &outFileSpec);
|
||||||
|
|
||||||
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
||||||
m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
|
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
|
@@ -113,7 +113,7 @@ wxDirData::wxDirData(const wxString& dirname)
|
|||||||
|
|
||||||
FSSpec fsspec ;
|
FSSpec fsspec ;
|
||||||
|
|
||||||
wxUnixFilename2FSSpec( m_dirname , &fsspec ) ;
|
wxMacFilename2FSSpec( m_dirname , &fsspec ) ;
|
||||||
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
m_CPB.hFileInfo.ioVRefNum = fsspec.vRefNum ;
|
||||||
m_CPB.hFileInfo.ioNamePtr = m_name ;
|
m_CPB.hFileInfo.ioNamePtr = m_name ;
|
||||||
m_index = 0 ;
|
m_index = 0 ;
|
||||||
|
@@ -533,7 +533,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -574,7 +574,7 @@ int wxFileDialog::ShowModal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
|
m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -609,7 +609,7 @@ int wxFileDialog::ShowModal()
|
|||||||
// first appears
|
// first appears
|
||||||
|
|
||||||
FSSpec location ;
|
FSSpec location ;
|
||||||
wxUnixFilename2FSSpec( m_dir , &location ) ;
|
wxMacFilename2FSSpec( m_dir , &location ) ;
|
||||||
OSErr err = noErr ;
|
OSErr err = noErr ;
|
||||||
|
|
||||||
mDefaultLocation.descriptorType = typeNull;
|
mDefaultLocation.descriptorType = typeNull;
|
||||||
@@ -704,7 +704,7 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
|
|
||||||
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
||||||
m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
|
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
||||||
m_paths.Add( m_path ) ;
|
m_paths.Add( m_path ) ;
|
||||||
m_fileNames.Add(m_fileName);
|
m_fileNames.Add(m_fileName);
|
||||||
}
|
}
|
||||||
|
@@ -414,11 +414,8 @@ bool wxPNGReader::ReadFile(char * ImageFileName)
|
|||||||
wxPNGReaderIter iter(this);
|
wxPNGReaderIter iter(this);
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
#ifndef __UNIX__
|
|
||||||
fp = fopen(wxUnix2MacFilename( ImageFileName ), "rb");
|
|
||||||
#else
|
|
||||||
fp = fopen( ImageFileName , "rb" );
|
fp = fopen( ImageFileName , "rb" );
|
||||||
#endif
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/stattext.h"
|
#include "wx/stattext.h"
|
||||||
|
#include "wx/notebook.h"
|
||||||
|
#include "wx/tabctrl.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
#include "wx/dcclient.h"
|
#include "wx/dcclient.h"
|
||||||
|
|
||||||
@@ -61,8 +63,40 @@ void wxStaticText::OnDraw( wxDC &dc )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
PrepareDC(dc);
|
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 x = 0 ;
|
||||||
int y = 0 ;
|
int y = 0 ;
|
||||||
wxString text = m_label ;
|
wxString text = m_label ;
|
||||||
|
@@ -329,7 +329,7 @@ wxString wxMacFindFolder( short vol,
|
|||||||
FSSpec file ;
|
FSSpec file ;
|
||||||
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
|
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
|
||||||
{
|
{
|
||||||
strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ;
|
strDir = wxMacFSSpec2MacFilename( &file ) + ":" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return strDir ;
|
return strDir ;
|
||||||
|
Reference in New Issue
Block a user