From bedaf53eaf4e2a860b34d4ff5e0b1928ce8fa5c9 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 24 May 2001 21:22:04 +0000 Subject: [PATCH] reverting to native mac pathnames git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10314 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/filefn.h | 9 ++--- samples/controls/controls.cpp | 1 + src/common/ffile.cpp | 8 ---- src/common/file.cpp | 32 +--------------- src/common/fileconf.cpp | 2 +- src/common/filefn.cpp | 71 ++++++++++++++++++++++------------- src/common/resource.cpp | 4 -- src/generic/dirctrlg.cpp | 16 +++++++- src/mac/carbon/dirdlg.cpp | 4 +- src/mac/carbon/dirmac.cpp | 2 +- src/mac/carbon/filedlg.cpp | 8 ++-- src/mac/carbon/pnghand.cpp | 5 +-- src/mac/carbon/stattext.cpp | 36 +++++++++++++++++- src/mac/carbon/utils.cpp | 2 +- src/mac/dirdlg.cpp | 4 +- src/mac/dirmac.cpp | 2 +- src/mac/filedlg.cpp | 8 ++-- src/mac/pnghand.cpp | 5 +-- src/mac/stattext.cpp | 36 +++++++++++++++++- src/mac/utils.cpp | 2 +- 20 files changed, 155 insertions(+), 102 deletions(-) diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 8021da6a17..8e247c9571 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -169,11 +169,13 @@ WXDLLEXPORT void wxUnix2DosFilename(wxChar *s); #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 @@ -268,10 +270,7 @@ WXDLLEXPORT bool wxRmdir(const wxString& dir, int flags = 0); #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 diff --git a/samples/controls/controls.cpp b/samples/controls/controls.cpp index 8fe30a9a9a..bb4c790817 100644 --- a/samples/controls/controls.cpp +++ b/samples/controls/controls.cpp @@ -794,6 +794,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) (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*/); diff --git a/src/common/ffile.cpp b/src/common/ffile.cpp index a3eaac2586..afbd6d14ea 100644 --- a/src/common/ffile.cpp +++ b/src/common/ffile.cpp @@ -64,20 +64,12 @@ bool wxFFile::Open(const wxChar *filename, const char *mode) 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 ) diff --git a/src/common/file.cpp b/src/common/file.cpp index 243bdc0373..f0209434b2 100644 --- a/src/common/file.cpp +++ b/src/common/file.cpp @@ -136,22 +136,15 @@ bool wxFile::Exists(const wxChar *name) #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) @@ -195,7 +188,7 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode) #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 | @@ -240,11 +233,7 @@ bool wxFile::Open(const wxChar *szFileName, OpenMode mode, int accessMode) 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; @@ -555,7 +544,6 @@ bool wxTempFile::Commit() { 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; @@ -565,17 +553,6 @@ bool wxTempFile::Commit() 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; } @@ -583,13 +560,8 @@ bool wxTempFile::Commit() 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 diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index b8fec80df7..a4cefd642a 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -802,7 +802,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */) { FSSpec spec ; - wxUnixFilename2FSSpec( m_strLocalFile , &spec ) ; + wxMacFilename2FSSpec( m_strLocalFile , &spec ) ; FInfo finfo ; if ( FSpGetFInfo( &spec , &finfo ) == noErr ) { diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 968a1d14a5..8108e29a51 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -142,11 +142,7 @@ const off_t wxInvalidOffset = (off_t)-1; // ---------------------------------------------------------------------------- // 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 @@ -652,11 +648,15 @@ wxChar *wxFileNameFromPath (wxChar *path) 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 */ @@ -679,11 +679,15 @@ wxString wxFileNameFromPath (const wxString& path1) 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 */ @@ -717,7 +721,11 @@ wxPathOnly (wxChar *path) 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__ @@ -766,7 +774,11 @@ wxString wxPathOnly (const wxString& path) 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__ @@ -801,7 +813,30 @@ wxString wxPathOnly (const wxString& path) // 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) @@ -868,24 +903,6 @@ wxString wxUnix2MacFilename (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) ) ; @@ -901,7 +918,7 @@ void wxUnixFilename2FSSpec( const char *path , FSSpec *spec ) wxString var = wxUnix2MacFilename( path ) ; wxMacFilename2FSSpec( var , spec ) ; } - +*/ #endif void wxDos2UnixFilename (char *s) @@ -1099,7 +1116,7 @@ bool wxRemoveFile(const wxString& file) 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(); @@ -1395,7 +1412,7 @@ wxString wxFindFirstFile(const wxChar *spec, int flags) 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 ; @@ -1443,7 +1460,7 @@ wxString wxFindNextFile() g_iter.m_name, &spec) ; - return wxMacFSSpec2UnixFilename( &spec ) ; + return wxMacFSSpec2MacFilename( &spec ) ; } #elif defined(__WXMSW__) @@ -1697,7 +1714,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz) 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 ; diff --git a/src/common/resource.cpp b/src/common/resource.cpp index 08709571b9..8096c9163f 100644 --- a/src/common/resource.cpp +++ b/src/common/resource.cpp @@ -227,11 +227,7 @@ bool wxResourceTable::ParseResourceFile(const wxString& filename) { 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; diff --git a/src/generic/dirctrlg.cpp b/src/generic/dirctrlg.cpp index d878e874fa..eb535c74c7 100644 --- a/src/generic/dirctrlg.cpp +++ b/src/generic/dirctrlg.cpp @@ -67,6 +67,10 @@ #endif // __WXPM__ +#ifdef __WXMAC__ +#include "moreextr.h" +#endif + #ifdef __BORLANDC__ #include "dos.h" #endif @@ -593,7 +597,17 @@ void wxGenericDirCtrl::SetupSections() } } #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 ); diff --git a/src/mac/carbon/dirdlg.cpp b/src/mac/carbon/dirdlg.cpp index 89b3892451..d1d906478c 100644 --- a/src/mac/carbon/dirdlg.cpp +++ b/src/mac/carbon/dirdlg.cpp @@ -492,7 +492,7 @@ int wxDirDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } return wxID_CANCEL; @@ -589,7 +589,7 @@ int wxDirDialog::ShowModal() name, &outFileSpec); // outFolderDirID = thePB.dirInfo.ioDrDirID; - m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ; + m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ; return wxID_OK ; } return wxID_CANCEL; diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index e37f079382..2a3e4c7221 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -113,7 +113,7 @@ wxDirData::wxDirData(const wxString& dirname) 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 ; diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index 406ce43b19..42c94640ef 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -533,7 +533,7 @@ int wxFileDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } } @@ -574,7 +574,7 @@ int wxFileDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } } @@ -609,7 +609,7 @@ int wxFileDialog::ShowModal() // first appears FSSpec location ; - wxUnixFilename2FSSpec( m_dir , &location ) ; + wxMacFilename2FSSpec( m_dir , &location ) ; OSErr err = noErr ; mDefaultLocation.descriptorType = typeNull; @@ -704,7 +704,7 @@ int wxFileDialog::ShowModal() // outFolderDirID = thePB.dirInfo.ioDrDirID; - m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ; + m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ; m_paths.Add( m_path ) ; m_fileNames.Add(m_fileName); } diff --git a/src/mac/carbon/pnghand.cpp b/src/mac/carbon/pnghand.cpp index af7b3a6f99..5e6840f40d 100644 --- a/src/mac/carbon/pnghand.cpp +++ b/src/mac/carbon/pnghand.cpp @@ -414,11 +414,8 @@ 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; diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 33e784261d..3ad2b159b5 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -15,6 +15,8 @@ #include "wx/app.h" #include "wx/stattext.h" +#include "wx/notebook.h" +#include "wx/tabctrl.h" #include "wx/dc.h" #include "wx/dcclient.h" @@ -61,8 +63,40 @@ void wxStaticText::OnDraw( wxDC &dc ) 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 ; diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index b3137eaf09..9389888343 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -329,7 +329,7 @@ wxString wxMacFindFolder( short vol, FSSpec file ; if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) { - strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ; + strDir = wxMacFSSpec2MacFilename( &file ) + ":" ; } } return strDir ; diff --git a/src/mac/dirdlg.cpp b/src/mac/dirdlg.cpp index 89b3892451..d1d906478c 100644 --- a/src/mac/dirdlg.cpp +++ b/src/mac/dirdlg.cpp @@ -492,7 +492,7 @@ int wxDirDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } return wxID_CANCEL; @@ -589,7 +589,7 @@ int wxDirDialog::ShowModal() name, &outFileSpec); // outFolderDirID = thePB.dirInfo.ioDrDirID; - m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ; + m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ; return wxID_OK ; } return wxID_CANCEL; diff --git a/src/mac/dirmac.cpp b/src/mac/dirmac.cpp index e37f079382..2a3e4c7221 100644 --- a/src/mac/dirmac.cpp +++ b/src/mac/dirmac.cpp @@ -113,7 +113,7 @@ wxDirData::wxDirData(const wxString& dirname) 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 ; diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index 406ce43b19..42c94640ef 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -533,7 +533,7 @@ int wxFileDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } } @@ -574,7 +574,7 @@ int wxFileDialog::ShowModal() } else { - m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ; + m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ; return wxID_OK ; } } @@ -609,7 +609,7 @@ int wxFileDialog::ShowModal() // first appears FSSpec location ; - wxUnixFilename2FSSpec( m_dir , &location ) ; + wxMacFilename2FSSpec( m_dir , &location ) ; OSErr err = noErr ; mDefaultLocation.descriptorType = typeNull; @@ -704,7 +704,7 @@ int wxFileDialog::ShowModal() // outFolderDirID = thePB.dirInfo.ioDrDirID; - m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ; + m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ; m_paths.Add( m_path ) ; m_fileNames.Add(m_fileName); } diff --git a/src/mac/pnghand.cpp b/src/mac/pnghand.cpp index af7b3a6f99..5e6840f40d 100644 --- a/src/mac/pnghand.cpp +++ b/src/mac/pnghand.cpp @@ -414,11 +414,8 @@ 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; diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 33e784261d..3ad2b159b5 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -15,6 +15,8 @@ #include "wx/app.h" #include "wx/stattext.h" +#include "wx/notebook.h" +#include "wx/tabctrl.h" #include "wx/dc.h" #include "wx/dcclient.h" @@ -61,8 +63,40 @@ void wxStaticText::OnDraw( wxDC &dc ) 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 ; diff --git a/src/mac/utils.cpp b/src/mac/utils.cpp index b3137eaf09..9389888343 100644 --- a/src/mac/utils.cpp +++ b/src/mac/utils.cpp @@ -329,7 +329,7 @@ wxString wxMacFindFolder( short vol, FSSpec file ; if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr ) { - strDir = wxMacFSSpec2UnixFilename( &file ) + "/" ; + strDir = wxMacFSSpec2MacFilename( &file ) + ":" ; } } return strDir ; -- 2.45.2