]> git.saurik.com Git - wxWidgets.git/commitdiff
wxMac Unicode support
authorStefan Csomor <csomor@advancedconcepts.ch>
Thu, 27 Mar 2003 20:33:32 +0000 (20:33 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Thu, 27 Mar 2003 20:33:32 +0000 (20:33 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19841 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

99 files changed:
src/mac/app.cpp
src/mac/bitmap.cpp
src/mac/bmpbuttn.cpp
src/mac/button.cpp
src/mac/carbon/app.cpp
src/mac/carbon/bitmap.cpp
src/mac/carbon/bmpbuttn.cpp
src/mac/carbon/button.cpp
src/mac/carbon/checklst.cpp
src/mac/carbon/choice.cpp
src/mac/carbon/clipbrd.cpp
src/mac/carbon/combobox.cpp
src/mac/carbon/control.cpp
src/mac/carbon/cursor.cpp
src/mac/carbon/dataobj.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcprint.cpp
src/mac/carbon/dirdlg.cpp
src/mac/carbon/dirmac.cpp
src/mac/carbon/dnd.cpp
src/mac/carbon/filedlg.cpp
src/mac/carbon/font.cpp
src/mac/carbon/gauge.cpp
src/mac/carbon/glcanvas.cpp
src/mac/carbon/icon.cpp
src/mac/carbon/joystick.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/macnotfy.cpp
src/mac/carbon/menu.cpp
src/mac/carbon/menuitem.cpp
src/mac/carbon/metafile.cpp
src/mac/carbon/mimetmac.cpp
src/mac/carbon/msgdlg.cpp
src/mac/carbon/notebmac.cpp
src/mac/carbon/pnghand.cpp
src/mac/carbon/printdlg.cpp
src/mac/carbon/printmac.cpp
src/mac/carbon/radiobox.cpp
src/mac/carbon/scrolbar.cpp
src/mac/carbon/slider.cpp
src/mac/carbon/spinbutt.cpp
src/mac/carbon/statlmac.cpp
src/mac/carbon/stattext.cpp
src/mac/carbon/tabctrl.cpp
src/mac/carbon/textctrl.cpp
src/mac/carbon/thread.cpp
src/mac/carbon/toolbar.cpp
src/mac/carbon/tooltip.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/uma.cpp
src/mac/carbon/utils.cpp
src/mac/carbon/wave.cpp
src/mac/carbon/window.cpp
src/mac/checklst.cpp
src/mac/choice.cpp
src/mac/clipbrd.cpp
src/mac/combobox.cpp
src/mac/control.cpp
src/mac/cursor.cpp
src/mac/dataobj.cpp
src/mac/dc.cpp
src/mac/dcprint.cpp
src/mac/dirdlg.cpp
src/mac/dirmac.cpp
src/mac/dnd.cpp
src/mac/filedlg.cpp
src/mac/font.cpp
src/mac/gauge.cpp
src/mac/glcanvas.cpp
src/mac/icon.cpp
src/mac/joystick.cpp
src/mac/listbox.cpp
src/mac/macnotfy.cpp
src/mac/menu.cpp
src/mac/menuitem.cpp
src/mac/metafile.cpp
src/mac/mimetmac.cpp
src/mac/msgdlg.cpp
src/mac/notebmac.cpp
src/mac/pnghand.cpp
src/mac/printdlg.cpp
src/mac/printmac.cpp
src/mac/radiobox.cpp
src/mac/scrolbar.cpp
src/mac/slider.cpp
src/mac/spinbutt.cpp
src/mac/statlmac.cpp
src/mac/stattext.cpp
src/mac/tabctrl.cpp
src/mac/textctrl.cpp
src/mac/thread.cpp
src/mac/toolbar.cpp
src/mac/tooltip.cpp
src/mac/toplevel.cpp
src/mac/uma.cpp
src/mac/utils.cpp
src/mac/wave.cpp
src/mac/window.cpp
src/wxWindowsM8.xml

index b100ef0b8c61602de2ecc58b4d880eeb9db54732..5766c82f22daccd3a56c6dd4e00df429edc28f4d 100644 (file)
@@ -116,7 +116,7 @@ bool      wxApp::s_macSupportPCMenuShortcuts = true ;
 long      wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 long      wxApp::s_macPreferencesMenuItemId = 0 ;
 long      wxApp::s_macExitMenuItemId = wxID_EXIT ;
-wxString  wxApp::s_macHelpMenuTitleName = "&Help" ;
+wxString  wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
 
 //----------------------------------------------------------------------
 // Core Apple Event Support
@@ -538,7 +538,8 @@ bool wxApp::Initialize()
 #endif
 
 #endif
-
+    wxMacSetupConverters() ;
+    
     s_macCursorRgn = ::NewRgn() ;
 
     wxClassInfo::InitializeClasses();
@@ -719,7 +720,8 @@ void wxApp::CleanUp()
     //   __wxterminate in Mach-O shared libraries
     wxStAppResource::CloseSharedLibraryResource();
 #endif
-
+    wxMacCleanupConverters() ;
+    
     UMACleanupToolbox() ;
     if (s_macCursorRgn) {
         ::DisposeRgn((RgnHandle)s_macCursorRgn);
@@ -961,7 +963,17 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
     // we could try to get the open apple events here to adjust argc and argv better
 
     wxTheApp->argc = argc;
+#if wxUSE_UNICODE
+    wxTheApp->argv = new wxChar*[argc+1];
+    int mb_argc ;
+    for ( mb_argc = 0; mb_argc < argc; mb_argc++ )
+    {
+        wxTheApp->argv[mb_argc] = wxStrdup(wxConvLocal.cMB2WX(argv[mb_argc]));
+    }
+    wxTheApp->argv[mb_argc] = (wxChar *)NULL;
+#else
     wxTheApp->argv = argv;
+#endif
 
     // GUI-specific initialization, such as creating an app context.
     wxEntryInitGui();
index ba28f7c08bf2ac63ae9d7d822c0df826f6d13714..5974622370f232596b176f21e01d3bfa73f667f9 100644 (file)
@@ -694,7 +694,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
             return true;
         }
     }
-    wxLogWarning("no bitmap handler for type %d defined.", type);
+    wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
     return false;
 }
 
@@ -707,7 +707,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int
     wxBitmapHandler *handler = FindHandler(type);
 
     if ( handler == NULL ) {
-        wxLogWarning("no bitmap handler for type %d defined.", type);
+        wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
 
         return FALSE;
     }
@@ -944,7 +944,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
         return image.SaveFile(filename, type);
     }
     
-    wxLogWarning("no bitmap handler for type %d defined.", type);
+    wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
     return false;
 }
 
@@ -1282,8 +1282,8 @@ class WXDLLEXPORT wxPICTResourceHandler: public wxBitmapHandler
 public:
     inline wxPICTResourceHandler()
     {
-        m_name = "Macintosh Pict resource";
-        m_extension = "";
+        m_name = wxT("Macintosh Pict resource");
+        m_extension = wxEmptyString;
         m_type = wxBITMAP_TYPE_PICT_RESOURCE;
     };
 
@@ -1296,14 +1296,8 @@ bool  wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
           int desiredWidth, int desiredHeight)
 {
     Str255 theName ;
-    
-#if TARGET_CARBON
-    c2pstrcpy( (StringPtr) theName , name ) ;
-#else
-    strcpy( (char *) theName , name ) ;
-    c2pstr( (char *)theName ) ;
-#endif
-    
+    wxMacStringToPascal( name , theName ) ;
+   
     PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
     if ( thePict )
     {
index ebf802126278a3c96a90ea1d89260ee7e347e0e6..046d54805851a0229afb0de44c4d63586a6c54e0 100644 (file)
@@ -58,14 +58,14 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( m_bmpNormal.Ok() )
         bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
         kControlBehaviorOffsetContents + 
             ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
             kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
           (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     ControlButtonContentInfo info ;
     wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
index 763048808eda4a392ceb7fd53ea906402ac8169b..49c0586734ea223ef79add37d767e5caf26ab028 100644 (file)
@@ -47,7 +47,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
           kControlPushButtonProc , (long) this ) ;
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     MacPostControlCreate() ;
     
index b100ef0b8c61602de2ecc58b4d880eeb9db54732..5766c82f22daccd3a56c6dd4e00df429edc28f4d 100644 (file)
@@ -116,7 +116,7 @@ bool      wxApp::s_macSupportPCMenuShortcuts = true ;
 long      wxApp::s_macAboutMenuItemId = wxID_ABOUT ;
 long      wxApp::s_macPreferencesMenuItemId = 0 ;
 long      wxApp::s_macExitMenuItemId = wxID_EXIT ;
-wxString  wxApp::s_macHelpMenuTitleName = "&Help" ;
+wxString  wxApp::s_macHelpMenuTitleName = wxT("&Help") ;
 
 //----------------------------------------------------------------------
 // Core Apple Event Support
@@ -538,7 +538,8 @@ bool wxApp::Initialize()
 #endif
 
 #endif
-
+    wxMacSetupConverters() ;
+    
     s_macCursorRgn = ::NewRgn() ;
 
     wxClassInfo::InitializeClasses();
@@ -719,7 +720,8 @@ void wxApp::CleanUp()
     //   __wxterminate in Mach-O shared libraries
     wxStAppResource::CloseSharedLibraryResource();
 #endif
-
+    wxMacCleanupConverters() ;
+    
     UMACleanupToolbox() ;
     if (s_macCursorRgn) {
         ::DisposeRgn((RgnHandle)s_macCursorRgn);
@@ -961,7 +963,17 @@ int wxEntry( int argc, char *argv[] , bool enterLoop )
     // we could try to get the open apple events here to adjust argc and argv better
 
     wxTheApp->argc = argc;
+#if wxUSE_UNICODE
+    wxTheApp->argv = new wxChar*[argc+1];
+    int mb_argc ;
+    for ( mb_argc = 0; mb_argc < argc; mb_argc++ )
+    {
+        wxTheApp->argv[mb_argc] = wxStrdup(wxConvLocal.cMB2WX(argv[mb_argc]));
+    }
+    wxTheApp->argv[mb_argc] = (wxChar *)NULL;
+#else
     wxTheApp->argv = argv;
+#endif
 
     // GUI-specific initialization, such as creating an app context.
     wxEntryInitGui();
index ba28f7c08bf2ac63ae9d7d822c0df826f6d13714..5974622370f232596b176f21e01d3bfa73f667f9 100644 (file)
@@ -694,7 +694,7 @@ bool wxBitmap::LoadFile(const wxString& filename, wxBitmapType type)
             return true;
         }
     }
-    wxLogWarning("no bitmap handler for type %d defined.", type);
+    wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
     return false;
 }
 
@@ -707,7 +707,7 @@ bool wxBitmap::Create(void *data, wxBitmapType type, int width, int height, int
     wxBitmapHandler *handler = FindHandler(type);
 
     if ( handler == NULL ) {
-        wxLogWarning("no bitmap handler for type %d defined.", type);
+        wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
 
         return FALSE;
     }
@@ -944,7 +944,7 @@ bool wxBitmap::SaveFile(const wxString& filename, wxBitmapType type,
         return image.SaveFile(filename, type);
     }
     
-    wxLogWarning("no bitmap handler for type %d defined.", type);
+    wxLogWarning(wxT("no bitmap handler for type %d defined."), type);
     return false;
 }
 
@@ -1282,8 +1282,8 @@ class WXDLLEXPORT wxPICTResourceHandler: public wxBitmapHandler
 public:
     inline wxPICTResourceHandler()
     {
-        m_name = "Macintosh Pict resource";
-        m_extension = "";
+        m_name = wxT("Macintosh Pict resource");
+        m_extension = wxEmptyString;
         m_type = wxBITMAP_TYPE_PICT_RESOURCE;
     };
 
@@ -1296,14 +1296,8 @@ bool  wxPICTResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
           int desiredWidth, int desiredHeight)
 {
     Str255 theName ;
-    
-#if TARGET_CARBON
-    c2pstrcpy( (StringPtr) theName , name ) ;
-#else
-    strcpy( (char *) theName , name ) ;
-    c2pstr( (char *)theName ) ;
-#endif
-    
+    wxMacStringToPascal( name , theName ) ;
+   
     PicHandle thePict = (PicHandle ) GetNamedResource( 'PICT' , theName ) ;
     if ( thePict )
     {
index ebf802126278a3c96a90ea1d89260ee7e347e0e6..046d54805851a0229afb0de44c4d63586a6c54e0 100644 (file)
@@ -58,14 +58,14 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
     if ( m_bmpNormal.Ok() )
         bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 
         kControlBehaviorOffsetContents + 
             ( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ? 
             kControlContentCIconHandle : kControlContentPictHandle ) , 0, 
           (( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     ControlButtonContentInfo info ;
     wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
index 763048808eda4a392ceb7fd53ea906402ac8169b..49c0586734ea223ef79add37d767e5caf26ab028 100644 (file)
@@ -47,7 +47,7 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
           kControlPushButtonProc , (long) this ) ;
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     MacPostControlCreate() ;
     
index c50773b137ed9ff0bd6e24380e6a75030a63d6be..d987d94994c68a38b96df15ea58f9b51a5924acc 100644 (file)
@@ -211,7 +211,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
 
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
index 863b944cb4deed30a7f134c003ed2cfe847d6496..19f8e405d288a387c2e3271845829da4dcd31a1c 100644 (file)
@@ -49,7 +49,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
         kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
     
@@ -169,7 +169,7 @@ wxString wxChoice::GetString(int n) const
 void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
-                 "invalid index in wxChoice::SetClientData" );
+                 wxT("invalid index in wxChoice::SetClientData") );
     
     m_datas[n] = (char*) clientData ;
 }
@@ -177,7 +177,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 void *wxChoice::DoGetItemClientData(int n) const
 {
     wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
-                 "invalid index in wxChoice::GetClientData" );
+                 wxT("invalid index in wxChoice::GetClientData") );
     return (void *)m_datas[n];
 }
 
index 47a2b428f909abd55e8b862526c1b3b2858de434..942a17c6fb9f7ec927d913fe707ee3c5c3f3bb16 100644 (file)
@@ -55,6 +55,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         
     case wxDF_TEXT:
         break;
+    case wxDF_UNICODETEXT:
+        break;
     case wxDF_BITMAP :
     case wxDF_METAFILE :
         break ;
@@ -77,15 +79,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         {
             if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
             {
-                if ( dataFormat.GetType() == wxDF_TEXT )
-                    byteCount++ ;
+                Size allocSize = byteCount ;
+                if ( dataFormat.GetType() == wxDF_TEXT )  
+                    allocSize += 1 ;
+                else if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+                    allocSize += 2 ;
                 
-                data = new char[ byteCount ] ;
+                data = new char[ allocSize ] ;
+                    
                 if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
                 {
-                    *len = byteCount ;
+                    *len = allocSize ;
                     if ( dataFormat.GetType() == wxDF_TEXT )  
                         ((char*)data)[byteCount] = 0 ;
+                    if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+                        ((wxChar*)data)[byteCount/2] = 0 ;
                 }
                 else
                 {
@@ -105,14 +113,19 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     if ( GetHandleSize( datahandle ) > 0 )
     {
         byteCount = GetHandleSize( datahandle ) ;
+        Size allocSize = byteCount ;
         if ( dataFormat.GetType() == wxDF_TEXT )  
-            data = new char[ byteCount + 1] ;
-        else
-            data = new char[ byteCount ] ;
-        
+            allocSize += 1 ;
+        else if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+            allocSize += 2 ;
+
+        data = new char[ allocSize ] ;
+
         memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
         if ( dataFormat.GetType() == wxDF_TEXT )  
             ((char*)data)[byteCount] = 0 ;
+        if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+            ((wxChar*)data)[byteCount/2] = 0 ;
         *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
@@ -123,10 +136,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         
         return NULL ;
     }
+
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-        wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
+        wxString st = wxMacMakeStringFromCString( (char*) data ) ;
+#if wxUSE_UNICODE
+        wxCharBuffer buf = st.ToAscii() ;
+#else
+        char* buf = st ;
+#endif
+        char* newdata = new char[strlen(buf)+1] ;
+        memcpy( newdata , buf , strlen(buf)+1 ) ;
+        delete[] ((char*) data ) ;
+        data = newdata ;
     }
+
     return data;
 }
 
@@ -234,19 +258,19 @@ bool wxClipboard::AddData( wxDataObject *data )
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
-                wxString mac ;
-                if ( wxApp::s_macDefaultEncodingIsPC )
-                {
-                    mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
-                }
-                else
-                {
-                    mac = textDataObject->GetText() ;
-                }
-                err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str()  ) ;
+               wxCharBuffer buf = wxMacStringToCString( str ) ;
+               err = UMAPutScrap( strlen(buf) , kScrapFlavorTypeText , (void*) buf.data()  ) ;
            }
            break ;
-
+#if wxUSE_UNICODE
+           case wxDF_UNICODETEXT :
+           {
+               wxTextDataObject* textDataObject = (wxTextDataObject*) data;
+               wxString str(textDataObject->GetText());
+               err = UMAPutScrap( str.Length() * sizeof(wxChar) , kScrapFlavorTypeUnicode , (void*) str.wc_str()  ) ;
+           }
+           break ;
+#endif
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
            {
@@ -255,7 +279,7 @@ bool wxClipboard::AddData( wxDataObject *data )
                   wxMetafile metaFile = metaFileDataObject->GetMetafile();
                 PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
                   HLock( (Handle) pict ) ;
-                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , kScrapFlavorTypePicture , *pict ) ;
                   HUnlock(  (Handle) pict ) ;
            }
            break ;
@@ -270,7 +294,7 @@ bool wxClipboard::AddData( wxDataObject *data )
                    pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
 
                   HLock( (Handle) pict ) ;
-                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , kScrapFlavorTypePicture , *pict ) ;
                   HUnlock(  (Handle) pict ) ;
                   if ( created )
                       KillPicture( pict ) ;
index 7d2a6819ea93aff36c36c0f1310ae2c6050770f2..8ffecd04894a536061a63694480cbb66d4aabaed 100644 (file)
@@ -456,7 +456,7 @@ wxString wxComboBox::GetStringSelection() const
     if (sel > -1)
         return wxString(this->GetString (sel));
     else
-        return wxString("");
+        return wxEmptyString;
 }
 
 bool wxComboBox::SetStringSelection(const wxString& sel)
index e12f3f63da10ce989c4c76d65e1840f158e0a0a0..f0dc6ee7a4ebb3c7a08cac8c81aecb31a6c63f6e 100644 (file)
@@ -208,23 +208,9 @@ void wxControl::SetLabel(const wxString& title)
 {
     m_label = wxStripMenuCodes(title) ;
 
-    if ( (ControlHandle) m_macControl )
+    if ( m_macControl )
     {
-        Str255 maclabel ;
-        wxString label ;
-    
-        if( wxApp::s_macDefaultEncodingIsPC )
-            label = wxMacMakeMacStringFromPC( m_label ) ;
-        else
-            label = m_label ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) maclabel , label ) ;
-#else
-        strcpy( (char *) maclabel , label ) ;
-        c2pstr( (char *) maclabel ) ;
-#endif
-        ::SetControlTitle( (ControlHandle) m_macControl , maclabel ) ;
+               UMASetControlTitle( (ControlHandle) m_macControl , m_label ) ;
     }
     Refresh() ;
 }
@@ -311,7 +297,7 @@ void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *contro
 {
     // adding NULL WindowRef is (first) surely a result of an error and
     // (secondly) breaks menu command processing
-    wxCHECK_RET( inControl != (ControlHandle) NULL, "attempt to add a NULL WindowRef to window list" );
+    wxCHECK_RET( inControl != (ControlHandle) NULL, wxT("attempt to add a NULL WindowRef to window list") );
 
     if ( !wxWinMacControlList->Find((long)inControl) )
         wxWinMacControlList->Append((long)inControl, control);
@@ -361,7 +347,7 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l
 
 void wxControl::MacPostControlCreate()
 {
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
     {
@@ -438,6 +424,10 @@ void wxControl::MacPostControlCreate()
     
     SetSize(pos.x, pos.y, new_size.x, new_size.y);
     
+#if wxUSE_UNICODE
+    UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) ) ;
+#endif
+
     UMAShowControl( (ControlHandle) m_macControl ) ;
     
     SetCursor( *wxSTANDARD_CURSOR ) ;
@@ -907,6 +897,6 @@ bool wxControl::MacCanFocus() const
 
 void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
 }
 
index d6989138909682a871af9056b07771a08e389893..1200fb9c69859474c9fadfedf7d1d3f525b87954 100644 (file)
@@ -292,13 +292,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
     if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
     {
         Str255 theName ;
-
-    #if TARGET_CARBON
-        c2pstrcpy( (StringPtr) theName , cursor_file ) ;
-    #else
-        strcpy( (char *) theName , cursor_file ) ;
-        c2pstr( (char *) theName ) ;
-    #endif
+               wxMacStringToPascal( cursor_file , theName ) ;
         
         wxStAppResource resload ;
         Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
index c1a443a7e5b93ebfe3f788cc7867b21df8cffe56..5949c6300b088c908ee83c8ab1644783dc1fc883 100644 (file)
@@ -1,11 +1,11 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        os2/dataobj.cpp
-// Purpose:     implementation of wx[I]DataObject class
-// Author:      David Webster
+// Name:        mac/dataobj.cpp
+// Purpose:     implementation of wxDataObject class
+// Author:      Stefan Csomor
 // Modified by:
 // Created:     10/21/99
 // RCS-ID:      $Id$
-// Copyright:   (c) 1999 David Webster
+// Copyright:   (c) 1999 Stefan Csomor
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -34,6 +34,7 @@
 #include "wx/mstream.h"
 #include "wx/image.h"
 #include "wx/mac/private.h"
+#include "Scrap.h"
 
 // ----------------------------------------------------------------------------
 // functions
@@ -73,10 +74,12 @@ void wxDataFormat::SetType(  wxDataFormatId  Type )
 {
     m_type = Type;
 
-    if (m_type == wxDF_TEXT)
-        m_format = 'TEXT';
+    if (m_type == wxDF_TEXT )
+        m_format = kScrapFlavorTypeText;
+    else if (m_type == wxDF_UNICODETEXT )
+        m_format = kScrapFlavorTypeUnicode ;
     else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
-        m_format = 'PICT';
+        m_format = kScrapFlavorTypePicture;
     else if (m_type == wxDF_FILENAME)
         m_format = kDragFlavorTypeHFS ;
     else
@@ -92,18 +95,23 @@ wxDataFormatId wxDataFormat::GetType() const
 
 wxString wxDataFormat::GetId() const
 {
-    wxString sRet("");  // TODO: to name of ( m_format ) );
-    return sRet;
+       char text[5] ;
+       strncpy( text , (char*) m_format , 4 ) ;
+       text[4] = 0 ;
+    return wxString::FromAscii( text ) ;
 }
 
 void wxDataFormat::SetId(  NativeFormat  format )
 {
     m_format = format;
 
-    if (m_format == 'TEXT')
+    if (m_format == kScrapFlavorTypeText)
         m_type = wxDF_TEXT;
     else
-    if (m_format == 'PICT')
+    if (m_format == kScrapFlavorTypeUnicode )
+        m_type = wxDF_UNICODETEXT;
+    else
+    if (m_format == kScrapFlavorTypePicture)
         m_type = wxDF_BITMAP;
     else
     if (m_format == kDragFlavorTypeHFS )
@@ -201,9 +209,7 @@ bool wxFileDataObject::SetData(
 {
     m_filenames.Empty();
 
-    wxString sFile( (const char *)pBuf);  /* char, not wxChar */
-
-    AddFile(sFile);
+    AddFile(wxString::FromAscii((char*)pBuf));
 
     return TRUE;
 }
index ed0648f9dce62ea84b431440f5fc6e33fc4b21ec..9bcf525f260cbaefdb8bea58547b81951be66a6a 100644 (file)
@@ -1111,7 +1111,7 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
     }
     if ( mode == kUnsupportedMode )
     {
-        wxFAIL_MSG("unsupported blitting mode" );
+        wxFAIL_MSG(wxT("unsupported blitting mode" ));
         return FALSE ;
     }
     CGrafPtr            sourcePort = (CGrafPtr) source->m_macPort ;
@@ -1295,17 +1295,10 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     }
     if ( str.Length() == 0 )
         return ;
+        
     wxMacPortSetter helper(this) ;
     MacInstallFont() ;
-    wxString text ;
-    if ( wxApp::s_macDefaultEncodingIsPC )
-    {
-        text = wxMacMakeMacStringFromPC( str ) ;
-    }
-    else
-    {
-        text = str ;
-    }
+
     wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
     if ( 0 )
     {
@@ -1314,23 +1307,30 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         m_macAliasWasEnabled = true ;
     }
     OSStatus status = noErr ;
+    ATSUTextLayout atsuLayout ;
+    UniCharCount chars = str.Length() ;
+#if wxUSE_UNICODE
+    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) (const wxChar*) str , 0 , str.Length() , str.Length() , 1 ,
+        &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
+#else
     TECObjectRef ec;
-    status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
-    wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
+    status = TECCreateConverter(&ec, 
+       wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+       
+    wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
     ByteCount byteOutLen ;
-    ByteCount byteInLen = text.Length() ;
+    ByteCount byteInLen = str.Length() ;
     ByteCount byteBufferLen = byteInLen *2 ;
     char* buf = new char[byteBufferLen] ;
-    status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
+    status = TECConvertText(ec, (ConstTextPtr)str.c_str() , byteInLen, &byteInLen,
         (TextPtr)buf, byteBufferLen, &byteOutLen);
-    wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't convert text") ) ;
     status = TECDisposeConverter(ec);
-    wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
-    ATSUTextLayout atsuLayout ;
-    UniCharCount chars = byteOutLen / 2 ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't dispose converter") ) ;
     status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) buf , 0 , byteOutLen / 2 , byteOutLen / 2 , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
-    wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
+#endif
+    wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the rotated text") );
     int iAngle = int( angle );
     int drawX = XLOG2DEVMAC(x) ;
     int drawY = YLOG2DEVMAC(y) ;
@@ -1366,16 +1366,19 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
     status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
         IntToFixed(drawX) , IntToFixed(drawY) );
-    wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
+    wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
     Rect rect ;
     status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
         IntToFixed(drawX) , IntToFixed(drawY) , &rect );
-    wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
+    wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
     OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
+#if wxUSE_UNICODE
+#else
     delete[] buf ;
+#endif
 }
 
 void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
@@ -1411,33 +1414,22 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
     {
         ::TextMode( srcCopy ) ;
     }
-    const char *text = NULL ;
-    int length = 0 ;
-    wxString macText ;
-    if ( wxApp::s_macDefaultEncodingIsPC )
-    {
-        macText = wxMacMakeMacStringFromPC( strtext ) ;
-        text = macText ;
-        length = macText.Length() ;
-    }
-    else
-    {
-        text = strtext ;
-        length = strtext.Length() ;
-    }
+    int length = strtext.Length() ;
+
     int laststop = 0 ;
     int i = 0 ;
     int line = 0 ;
     {
         while( i < length )
         {
-            if( text[i] == 13 || text[i] == 10)
+            if( strtext[i] == 13 || strtext[i] == 10)
             {
+               wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
                 if ( useDrawThemeText )
                 {
                     Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                    wxMacCFStringHolder mString( linetext ) ;
                     if ( m_backgroundMode != wxTRANSPARENT )
                     {
                         Point bounds={0,0} ;
@@ -1460,13 +1452,13 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                         &frame,
                         teJustLeft,
                         nil );
-                    CFRelease( mString ) ;
                     line++ ;
                 }
                 else
 #endif
                 {
-                    ::DrawText( text , laststop , i - laststop ) ;
+                                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+                    ::DrawText( text , 0 , strlen(text) ) ;
                     line++ ;
                     ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
                 }
@@ -1474,11 +1466,12 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
             }
             i++ ;
         }
+        wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
         if ( useDrawThemeText )
         {
             Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
-            CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
+            wxMacCFStringHolder mString( linetext ) ;
 
             if ( m_backgroundMode != wxTRANSPARENT )
             {
@@ -1502,13 +1495,13 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                 &frame,
                 teJustLeft,
                 nil );
-            CFRelease( mString ) ;
         }
         else
 #endif
         {
-            ::DrawText( text , laststop , i - laststop ) ;
-        }
+                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+            ::DrawText( text , 0 , strlen(text) ) ;
+         }
     }
     ::TextMode( srcOr ) ;
 }
@@ -1519,7 +1512,7 @@ bool  wxDC::CanGetTextExtent() const
     return true ;
 }
 
-void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *height,
                             wxCoord *descent, wxCoord *externalLeading ,
                             wxFont *theFont ) const
 {
@@ -1545,8 +1538,9 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         *descent =YDEV2LOGREL( fi.descent );
     if ( externalLeading )
         *externalLeading = YDEV2LOGREL( fi.leading ) ;
+    int length = strtext.Length() ;
+    /*
     const char *text = NULL ;
-    int length = 0 ;
     wxString macText ;
     if ( wxApp::s_macDefaultEncodingIsPC )
     {
@@ -1559,6 +1553,7 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         text = string ;
         length = string.Length() ;
     }
+    */
     int laststop = 0 ;
     int i = 0 ;
     int curwidth = 0 ;
@@ -1567,8 +1562,9 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         *width = 0 ;
         while( i < length )
         {
-            if( text[i] == 13 || text[i] == 10)
+            if( strtext[i] == 13 || strtext[i] == 10)
             {
+               wxString linetext = strtext.Mid( laststop , i - laststop ) ;
                 if ( height )
                     *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
 #if TARGET_CARBON
@@ -1576,20 +1572,20 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
                 {
                     Point bounds={0,0} ;
                     SInt16 baseline ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                    wxMacCFStringHolder mString( linetext ) ;
                     ::GetThemeTextDimensions( mString,
                         kThemeCurrentPortFont,
                         kThemeStateActive,
                         false,
                         &bounds,
                         &baseline );
-                    CFRelease( mString ) ;
                     curwidth = bounds.h ;
                 }
                 else
 #endif
                 {
-                    curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+                       curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
                 }
                 if ( curwidth > *width )
                     *width = XDEV2LOGREL( curwidth ) ;
@@ -1598,25 +1594,26 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
             i++ ;
         }
         
+        wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
         if ( useGetThemeText )
         {
             Point bounds={0,0} ;
             SInt16 baseline ;
-            CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+            wxMacCFStringHolder mString( linetext ) ;
             ::GetThemeTextDimensions( mString,
                 kThemeCurrentPortFont,
                 kThemeStateActive,
                 false,
                 &bounds,
                 &baseline );
-            CFRelease( mString ) ;
             curwidth = bounds.h ;
         }
         else
 #endif
         {
-            curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+            curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
         }
         if ( curwidth > *width )
             *width = XDEV2LOGREL( curwidth ) ;
@@ -1773,7 +1770,7 @@ void wxDC::MacInstallFont() const
     Style qdStyle = font->m_macFontStyle ;
     ATSUFontID    atsuFont = font->m_macATSUFontID ;
     status = ::ATSUCreateStyle(&(ATSUStyle)m_macATSUIStyle) ;
-    wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ;
     ATSUAttributeTag atsuTags[] =
     {
         kATSUFontTag ,
@@ -1819,7 +1816,7 @@ void wxDC::MacInstallFont() const
     } ;
     status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
         atsuTags, atsuSizes, atsuValues);
-    wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
 }
 
 Pattern gHatchPatterns[] =
index 82bdecd0cfb56b8186f465850e6375aa398e94c1..a841324bd36ca643c2dca7d5b6d06aa566eecd91 100644 (file)
@@ -62,8 +62,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     if ( err != noErr )
 #endif
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
 #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease( m_macPrintSessionPort ) ;
@@ -88,8 +88,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         UMAPrClose(NULL) ;
         m_ok = FALSE;
@@ -150,8 +150,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -234,8 +234,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     err = PrError() ;
     if ( err )
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         UMAPrClose(NULL) ;
         m_ok = FALSE;
@@ -258,8 +258,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
   #endif
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -280,8 +280,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -321,8 +321,8 @@ void wxPrinterDC::EndDoc(void)
   #endif
          if ( err != noErr )
          {
-            message.Printf( "Print Error %d", err ) ;
-            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            message.Printf( wxT("Print Error %d"), err ) ;
+            wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
             dialog.ShowModal();
          }
     }
@@ -363,8 +363,8 @@ void wxPrinterDC::StartPage(void)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
            ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
         ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
@@ -382,8 +382,8 @@ void wxPrinterDC::StartPage(void)
   #endif
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if PM_USE_SESSION_APIS
            PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
@@ -421,8 +421,8 @@ void wxPrinterDC::EndPage(void)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld") , err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
         ::UMAPrClose(NULL) ;
@@ -437,8 +437,8 @@ void wxPrinterDC::EndPage(void)
   #endif
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if PM_USE_SESSION_APIS
         PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
index 686405423442d2f944726f597cb2fe81a25d904a..0b4c7df19566e52d9da444682f494bada976329b 100644 (file)
@@ -40,7 +40,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
                          const wxSize& WXUNUSED(size),
                          const wxString& WXUNUSED(name))
 {
-    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
@@ -92,7 +92,7 @@ int wxDirDialog::ShowModal()
                         0L);                            // User Data
     
     if ( (err != noErr) && (err != userCanceledErr) ) {
-        m_path = "" ;
+        m_path = wxT("") ;
         return wxID_CANCEL ;
     }
 
@@ -104,7 +104,7 @@ int wxDirDialog::ShowModal()
         
         OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
         if ( err != noErr ) {
-            m_path = "" ;
+            m_path = wxT("") ;
             return wxID_CANCEL ;
         }            
         folderInfo = **(FSSpec**) specDesc.dataHandle;
@@ -130,7 +130,7 @@ int wxDirDialog::ShowModal()
         
         err = ::PBGetCatInfoSync(&thePB);
         if ( err != noErr ) {
-            m_path = "" ;
+            m_path = wxT("")  ;
             return wxID_CANCEL ;
         }            
                                             // Create cannonical FSSpec
index 9ea9415df48423cec0c40edba9b8af9045c6b541..ff168bafdc552519c5b3fa534f0db7537ebf3110 100644 (file)
@@ -133,7 +133,7 @@ wxDirData::wxDirData(const wxString& dirname)
 
     err = FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
 #endif
-    wxASSERT_MSG( (err == noErr) || (err == nsvErr) , "Error accessing directory " + m_dirname) ;
+    wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
 
     m_CPB.hFileInfo.ioNamePtr = m_name ;
     m_index = 0 ;
@@ -153,9 +153,6 @@ bool wxDirData::Read(wxString *filename)
     if ( !m_isDir )
         return FALSE ;
         
-#if TARGET_CARBON
-    char c_name[256] ;
-#endif
     wxString result;
 
     short err = noErr ;
@@ -169,18 +166,12 @@ bool wxDirData::Read(wxString *filename)
         if ( err != noErr )
             break ;
         
-#if TARGET_CARBON
-        p2cstrcpy( c_name, m_name ) ;
-        strcpy( (char *)m_name, c_name);
-#else
-        p2cstr( m_name ) ;
-#endif
         // its hidden but we don't want it
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) )
             continue ;
 #ifdef __DARWIN__
         // under X, names that start with '.' are hidden
-        if ( ( m_name[0] == '.' ) && !(m_flags & wxDIR_HIDDEN) )
+        if ( ( m_name[1] == '.' ) && !(m_flags & wxDIR_HIDDEN) )
             continue;
 #endif
 #if TARGET_CARBON
@@ -196,18 +187,18 @@ bool wxDirData::Read(wxString *filename)
         if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(m_flags & wxDIR_FILES ) )
             continue ;
         
-        wxString file( m_name ) ;
-        if ( m_filespec.IsEmpty() || m_filespec == "*.*" || m_filespec == "*" )
+        wxString file = wxMacMakeStringFromPascal( m_name ) ;
+        if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
         {
         }
-        else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" )
+        else if ( m_filespec.Length() > 1 && m_filespec.Left(1) == wxT("*") )
         {
             if ( file.Right( m_filespec.Length() - 1 ).Upper() != m_filespec.Mid(1).Upper() )
             {
                 continue ;
             }
         }
-        else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == "*" )
+        else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == wxT("*") )
         {
             if ( file.Left( m_filespec.Length() - 1 ).Upper() != m_filespec.Left( m_filespec.Length() - 1 ).Upper() )
             {
@@ -226,7 +217,7 @@ bool wxDirData::Read(wxString *filename)
         return FALSE ;
     }
     
-    *filename = (char*) m_name ;
+    *filename = wxMacMakeStringFromPascal( m_name )  ;
 
     return TRUE;
 }
index 2ea8ae7c90613b426f53d972f85f282e7486c7ff..d4eb35abba7cd2728476b3fe365bce1bba8e3390 100644 (file)
@@ -205,12 +205,9 @@ bool wxDropTarget::GetData()
                         GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
                         if( theType == 'TEXT' )
                         {
-                            theData[dataSize]=0 ;       
-                            if ( wxApp::s_macDefaultEncodingIsPC )
-                            {
-                                wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
-                            }
-                            m_dataObject->SetData( format, dataSize, theData );
+                            theData[dataSize]=0 ; 
+                            wxString convert = wxMacMakeStringFromCString( theData ) ;    
+                            m_dataObject->SetData( format, convert.Length() * sizeof(wxChar), (const wxChar*) convert );
                         }
                         else if ( theType == kDragFlavorTypeHFS )
                         {
@@ -303,11 +300,10 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
         if ( type == 'TEXT' )
         {
             dataSize-- ;
-            if ( wxApp::s_macDefaultEncodingIsPC )
-            {
-                wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
-            }
-            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
+            dataPtr[ dataSize ] = 0 ;
+            wxString st( (wxChar*) dataPtr ) ;
+            wxCharBuffer buf = wxMacStringToCString( st ) ;
+            AddDragItemFlavor(theDrag, theItem, type , buf.data(), strlen(buf), 0);
         }
         else if (type == kDragFlavorTypeHFS )
         {
index 5a65441f23848a40d30219aed320d939a04147d9..f2b6707baf85faf9bd0c4f6afbe7046a3f4c1d16 100644 (file)
@@ -104,13 +104,12 @@ NavEventProc(
                 Str255 filename ;
                 // get the current filename
                 NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
-                CopyPascalStringToC( filename , (char*) filename ) ;
-                wxString sfilename( filename ) ;
+                wxString sfilename = wxMacMakeStringFromPascal( filename ) ;
                 int pos = sfilename.Find('.',TRUE) ;
                 if ( pos != wxNOT_FOUND )
                 {
                     sfilename = sfilename.Left(pos+1)+extension ;
-                    CopyCStringToPascal( sfilename.c_str() , filename ) ;
+                    wxMacStringToPascal( sfilename , filename ) ;
                     NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
                 }
             }
@@ -118,11 +117,11 @@ NavEventProc(
     }
 }
 
-const char * gfilters[] =
+const wxChar * gfilters[] =
 {
-    "*.TXT" ,
-    "*.TIF" ,
-    "*.JPG" ,
+    wxT("*.TXT") ,
+    wxT("*.TIF") ,
+    wxT("*.JPG") ,
     
     NULL 
 } ;
@@ -162,7 +161,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
                     ++filterIndex ;
                 }
                 isName = !isName ;
-                current = "" ;
+                current = wxEmptyString ;
             }
             else
             {
@@ -172,7 +171,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
         // we allow for compatibility reason to have a single filter expression (like *.*) without
         // an explanatory text, in that case the first part is name and extension at the same time
         
-        wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
+        wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
         if ( current.IsEmpty() )
             myData->extensions.Add( myData->name[filterIndex] ) ;
         else
@@ -189,7 +188,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
             int j ;
             for ( j = 0 ; gfilters[j] ; j++ )
             {
-                if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
+                if ( myData->extensions[i] == gfilters[j]  )
                 {
                     myData->filtermactypes.Add( gfiltersmac[j] ) ;
                     break ;
@@ -205,6 +204,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
 
 static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
 {
+/*
     Str255             filename ;
     
 #if TARGET_CARBON
@@ -214,20 +214,22 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
     p2cstr( filename ) ;
 #endif
     wxString file(filename) ;
+*/
+       wxString file = wxMacMakeStringFromPascal( name ) ;
     file.MakeUpper() ;
     
     if ( data->extensions.GetCount() > 0 )
     {
         //for ( int i = 0 ; i < data->numfilters ; ++i )
         int i = data->currentfilter ;
-        if ( data->extensions[i].Right(2) == ".*" )
+        if ( data->extensions[i].Right(2) == wxT(".*") )
             return true ;
         
         {
             if ( type == (OSType)data->filtermactypes[i] )
                 return true ;
             
-            wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
+            wxStringTokenizer tokenizer( data->extensions[i] , wxT(";") ) ;
             while( tokenizer.HasMoreTokens() )
             {
                 wxString extension = tokenizer.GetNextToken() ;
@@ -272,17 +274,17 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
 
 // end wxmac
 
-wxString wxFileSelector(const char *title,
-                     const char *defaultDir, const char *defaultFileName,
-                     const char *defaultExtension, const char *filter, int flags,
+wxString wxFileSelector(const wxChar *title,
+                     const wxChar *defaultDir, const wxChar *defaultFileName,
+                     const wxChar *defaultExtension, const wxChar *filter, int flags,
                      wxWindow *parent, int x, int y)
 {
     // If there's a default extension specified but no filter, we create a suitable
     // filter.
 
-    wxString filter2("");
+    wxString filter2;
     if ( defaultExtension && !filter )
-        filter2 = wxString("*.") + wxString(defaultExtension) ;
+        filter2 = wxString(wxT("*.")) + wxString(defaultExtension) ;
     else if ( filter )
         filter2 = filter;
 
@@ -290,13 +292,13 @@ wxString wxFileSelector(const char *title,
     if (defaultDir)
         defaultDirString = defaultDir;
     else
-        defaultDirString = "";
+        defaultDirString = wxEmptyString ;
 
     wxString defaultFilenameString;
     if (defaultFileName)
         defaultFilenameString = defaultFileName;
     else
-        defaultFilenameString = "";
+        defaultFilenameString = wxEmptyString;
 
     wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
 
@@ -308,19 +310,19 @@ wxString wxFileSelector(const char *title,
         return wxGetEmptyString();
 }
 
-WXDLLEXPORT wxString wxFileSelectorEx(const char *title,
-                       const char *defaultDir,
-                       const char *defaultFileName,
+WXDLLEXPORT wxString wxFileSelectorEx(const wxChar *title,
+                       const wxChar *defaultDir,
+                       const wxChar *defaultFileName,
                        int* defaultFilterIndex,
-                       const char *filter,
+                       const wxChar *filter,
                        int       flags,
                        wxWindow* parent,
                        int       x,
                        int       y)
 
 {
-    wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
-        defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
+    wxFileDialog fileDialog(parent, title ? title : wxT(""), defaultDir ? defaultDir : wxT(""),
+        defaultFileName ? defaultFileName : wxT(""), filter ? filter : wxT(""), flags, wxPoint(x, y));
 
     if ( fileDialog.ShowModal() == wxID_OK )
     {
@@ -335,18 +337,17 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
         long style, const wxPoint& pos)
 {
-    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
-    m_path = "";
+    m_path = wxT("");
     m_fileName = defaultFileName;
     m_dir = defaultDir;
     m_wildCard = wildCard;
     m_filterIndex = 0;
 }
 
-
 pascal Boolean CrossPlatformFilterCallback (
     AEDesc *theItem, 
     void *info, 
@@ -417,19 +418,8 @@ int wxFileDialog::ShowModal()
             mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
         }
     }
-        
-#if TARGET_CARBON
-    c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
-#else
-    strcpy((char *)mNavOptions.message, m_message) ;
-    c2pstr((char *)mNavOptions.message ) ;
-#endif
-#if TARGET_CARBON
-    c2pstrcpy((StringPtr)mNavOptions.savedFileName, m_fileName) ;
-#else
-    strcpy((char *)mNavOptions.savedFileName, m_fileName) ;
-    c2pstr((char *)mNavOptions.savedFileName ) ;
-#endif
+    wxMacStringToPascal( m_message , (StringPtr)mNavOptions.message ) ;
+    wxMacStringToPascal( m_fileName , (StringPtr)mNavOptions.savedFileName ) ;
 
     // zero all data
     
@@ -450,12 +440,7 @@ int wxFileDialog::ShowModal()
             (*mNavOptions.popupExtension)[i].version     = kNavMenuItemSpecVersion ;
             (*mNavOptions.popupExtension)[i].menuCreator = 'WXNG' ;
             (*mNavOptions.popupExtension)[i].menuType    = i ;
-#if TARGET_CARBON
-            c2pstrcpy((StringPtr)(*mNavOptions.popupExtension)[i].menuItemName, myData.name[i]) ;
-#else
-            strcpy((char *)(*mNavOptions.popupExtension)[i].menuItemName, myData.name[i]) ;
-            c2pstr((char *)(*mNavOptions.popupExtension)[i].menuItemName ) ;
-#endif
+            wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
         }
     }
     if ( m_dialogStyle & wxSAVE )
@@ -519,7 +504,7 @@ int wxFileDialog::ShowModal()
         {
             OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
             if ( err != noErr ) {
-                m_path = "" ;
+                m_path = wxT("") ;
                 return wxID_CANCEL ;
             }            
             outFileSpec = **(FSSpec**) specDesc.dataHandle;
@@ -543,28 +528,30 @@ int wxFileDialog::ShowModal()
 
 // Generic file load/save dialog
 static wxString
-wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxDefaultFileSelector(bool load, const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
-    char *ext = (char *)extension;
-    
-    char prompt[50];
+    wxString prompt;
+
     wxString str;
     if (load)
-        str = "Load %s file";
+        str = wxT("Load %s file");
     else
-        str = "Save %s file";
-    sprintf(prompt, wxGetTranslation(str), what);
+        str = wxT("Save %s file");
+    prompt.Printf( wxGetTranslation(str), what);
     
-    if (*ext == '.') ext++;
-    char wild[60];
-    sprintf(wild, "*.%s", ext);
+    const wxChar *ext = extension;
+    if (*ext == wxT('.'))
+        ext++;
+
+    wxString wild;
+    wild.Printf(wxT("*.%s"), ext);
     
     return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
 }
 
 // Generic file load dialog
 wxString
-wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxLoadFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
     return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
@@ -572,9 +559,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
 
 // Generic file save dialog
 wxString
-wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
     return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }
-
-
index e134003482a5b61f689b823db36d2135eeedd0a2..5ffa4f828b8f3f68b60d63cbe33fe207fee51c67 100644 (file)
@@ -67,7 +67,7 @@ wxFontRefData::~wxFontRefData()
 
 void wxFontRefData::MacFindFont()
 {
-    if( m_faceName == "" )
+    if( m_faceName.Length() == 0 )
     {
         switch( m_family )
         {
@@ -92,14 +92,13 @@ void wxFontRefData::MacFindFont()
         }
         Str255 name ;
         GetFontName( m_macFontNum , name ) ;
-        CopyPascalStringToC( name , (char*) name ) ;
-        m_faceName = (char*) name ;
+        m_faceName = wxMacMakeStringFromPascal( name ) ;
     }
     else
     {
-        if ( m_faceName == "systemfont" )
+        if ( m_faceName == wxT("systemfont") )
             m_macFontNum = ::GetSysFont() ;
-        else if ( m_faceName == "applicationfont" )
+        else if ( m_faceName == wxT("applicationfont") )
             m_macFontNum = ::GetAppFont() ;
         else
         {
@@ -126,7 +125,7 @@ void wxFontRefData::MacFindFont()
     status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
         kFontFullName,    kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
     */
-    wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't retrieve font identifier") ) ;
 }
 
 // ----------------------------------------------------------------------------
index 1a61e4f72378546570d84cdc7b25db76bba3a708..de7dd8c90c9b14a848fe061486751cde114fb10a 100644 (file)
@@ -40,7 +40,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
         size = wxSize( 200 , 16 ) ;
     }
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
         kControlProgressBarProc , (long) this ) ;
index aca2b5be13ec45b924385f45939a9cbe27a7691d..e66592a619c80771f26a3d5f4da536ea31f33b9f 100644 (file)
@@ -91,7 +91,7 @@ void wxGLContext::Update()
     }
 }
 
-void wxGLContext::SetColour(const char *colour)
+void wxGLContext::SetColour(const wxChar *colour)
 {
     float r = 0.0;
     float g = 0.0;
@@ -309,7 +309,7 @@ void wxGLCanvas::SetCurrent()
     }
 }
 
-void wxGLCanvas::SetColour(const char *colour)
+void wxGLCanvas::SetColour(const wxChar *colour)
 {
     if (m_glContext)
         m_glContext->SetColour(colour);
index ef4526a6705916e0a4a04c720f8287c3701a074f..bd1937bc2a45dba54274849335887c399a7832f3 100644 (file)
@@ -83,19 +83,19 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
                                       int desiredWidth, int desiredHeight)
 {
     short theId = -1 ;
-    if ( name == "wxICON_INFORMATION" )
+    if ( name == wxT("wxICON_INFORMATION") )
     {
         theId = kNoteIcon ;
     }
-    else if ( name == "wxICON_QUESTION" )
+    else if ( name == wxT("wxICON_QUESTION") )
     {
         theId = kCautionIcon ;
     }
-    else if ( name == "wxICON_WARNING" )
+    else if ( name == wxT("wxICON_WARNING") )
     {
         theId = kCautionIcon ;
     }
-    else if ( name == "wxICON_ERROR" )
+    else if ( name == wxT("wxICON_ERROR") )
     {
         theId = kStopIcon ;
     }
@@ -103,13 +103,7 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
     {
         Str255 theName ;
         OSType theType ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) theName , name ) ;
-#else
-        strcpy( (char *) theName , name ) ;
-        c2pstr( (char *) theName ) ;
-#endif
+        wxMacStringToPascal( name , theName ) ;
         
         Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
         if ( resHandle != 0L )
index 6a45f419fdc0a85c422b9a1e68fda81f0f7bdeff..156b9b26570395a30a0686d8e3dda3480fdc2f02 100644 (file)
@@ -113,7 +113,7 @@ int wxJoystick::GetProductId() const
 wxString wxJoystick::GetProductName() const
 {
     // TODO
-    return wxString("");
+    return wxString(wxT(""));
 }
 
 int wxJoystick::GetXMin() const
index 2d7dff4fbcea8bdc3ad2b4f73c6e89a2ab90bd6f..12e2c048bb05dd97ae0c5ad503b6cfd6a552c9cc 100644 (file)
@@ -94,7 +94,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
         
     case lDrawMsg:
         {
-            const wxString text = list->m_stringArray[cell.v] ;
+            const wxString linetext = list->m_stringArray[cell.v] ;
             
             //  Save the current clip region, and set the clip region to the area we are about
             //  to draw.
@@ -121,32 +121,27 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
             }
             
 #if TARGET_CARBON
-            bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-            
-               if ( useDrawThemeText )
-               {
-                Rect frame = { drawRect->top, drawRect->left + 4,
-                    drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
-                CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
-                CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
-                CFRelease( sString ) ;
-                ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
-                ::DrawThemeTextBox( mString,
-                    kThemeCurrentPortFont,
-                    kThemeStateActive,
-                    false,
-                    &frame,
-                    teJustLeft,
-                    nil );
-                CFRelease( mString ) ;
-            }
-            else
-#endif
-            {
+                       {
+                               Rect frame = { drawRect->top, drawRect->left + 4,
+                                   drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
+                               CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext) ) ;
+                               ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
+                               ::DrawThemeTextBox( mString,
+                                   kThemeCurrentPortFont,
+                                   kThemeStateActive,
+                                   false,
+                                   &frame,
+                                   teJustLeft,
+                                   nil );
+                               CFRelease( mString ) ;
+                       }
+#else
+            {  
+               wxCharBuffer text = wxMacStringToCString( linetext ) ;
                 MoveTo(drawRect->left + 4 , drawRect->top + 10 );
-                DrawText(text, 0 , text.Length());
+                DrawText(text, 0 , strlen(text) );
             }
-            
+#endif            
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
             
@@ -213,7 +208,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
     
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
@@ -234,8 +229,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     fontSize = 9 ;
     fontStyle = normal ;
 #endif 
-    CopyPascalStringToC( fontName , (char*) fontName ) ;
-    SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
+    SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) ) ) ;
 #if TARGET_CARBON
     Size asize;
 
@@ -388,15 +382,8 @@ void wxListBox::Delete(int N)
 int wxListBox::DoAppend(const wxString& item)
 {
     int index = m_noItems ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        m_stringArray.Add( wxMacMakeMacStringFromPC( item ) ) ;
-        m_dataArray.Add( NULL );
-    }
-    else {
-        m_stringArray.Add( item ) ;
-        m_dataArray.Add( NULL );
-    }
+    m_stringArray.Add( item ) ;
+    m_dataArray.Add( NULL );
     m_noItems ++;
     DoSetItemClientData( index , NULL ) ;
     MacAppend( item ) ;
@@ -451,47 +438,30 @@ bool wxListBox::HasMultipleSelection() const
     return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
 }
 
-int wxListBox::FindString(const wxString& st) const
+int wxListBox::FindString(const wxString& s) const
 {
-    wxString s ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        s = wxMacMakeMacStringFromPC( st ) ;
-    }
-    else
-        s = st ;
     
-    if ( s.Right(1) == "*" )
+    if ( s.Right(1) == wxT("*") )
     {
         wxString search = s.Left( s.Length() - 1 ) ;
         int len = search.Length() ;
         Str255 s1 , s2 ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
-#else
-        strcpy( (char *) s2 , search.c_str() ) ;
-        c2pstr( (char *) s2 ) ;
-#endif
+        wxMacStringToPascal( search , s2 ) ;
         
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
-#if TARGET_CARBON
-            c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ;
-#else
-            strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ;
-            c2pstr( (char *) s1 ) ;
-#endif
+               wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
+
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
-        if ( s.Left(1) == "*" && s.Length() > 1 )
+        if ( s.Left(1) == wxT("*") && s.Length() > 1 )
         {
-            s = st ;
-            s.MakeLower() ;
+            wxString st = s ;
+            st.MakeLower() ;
             for ( int i = 0 ; i < m_noItems ; ++i )
             {
-                if ( GetString(i).Lower().Matches(s) )
+                if ( GetString(i).Lower().Matches(st) )
                     return i ;
             }
         }
@@ -501,21 +471,12 @@ int wxListBox::FindString(const wxString& st) const
     {
         Str255 s1 , s2 ;
         
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
-#else
-        strcpy( (char *) s2 , s.c_str() ) ;
-        c2pstr( (char *) s2 ) ;
-#endif
+        wxMacStringToPascal( s , s2 ) ;
         
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
-#if TARGET_CARBON
-            c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ;
-#else
-            strcpy( (char *) s1 , m_stringArray[i].c_str() ) ;
-            c2pstr( (char *) s1 ) ;
-#endif
+               wxMacStringToPascal( m_stringArray[i] , s1 ) ;
+
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
@@ -535,7 +496,7 @@ void wxListBox::Clear()
 void wxListBox::SetSelection(int N, bool select)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-        "invalid index in wxListBox::SetSelection" );
+        wxT("invalid index in wxListBox::SetSelection") );
     MacSetSelection( N , select ) ;
     GetSelections( m_selectionPreImage ) ;
 }
@@ -543,7 +504,7 @@ void wxListBox::SetSelection(int N, bool select)
 bool wxListBox::IsSelected(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
-        "invalid index in wxListBox::Selected" );
+        wxT("invalid index in wxListBox::Selected") );
     
     return MacIsSelected( N ) ;
 }
@@ -564,7 +525,7 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
 void wxListBox::DoSetItemClientData(int N, void *Client_data)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-        "invalid index in wxListBox::SetClientData" );
+        wxT("invalid index in wxListBox::SetClientData") );
     
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW )
@@ -574,7 +535,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
         wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
     }
 #endif // wxUSE_OWNER_DRAWN
-    wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , "invalid client_data array" ) ;
+    wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , wxT("invalid client_data array") ) ;
     
     if ( m_dataArray.GetCount() > (size_t) N )
     {
@@ -606,12 +567,7 @@ int wxListBox::GetSelection() const
 // Find string for position
 wxString wxListBox::GetString(int N) const
 {
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        return      wxMacMakePCStringFromMac( m_stringArray[N] ) ;
-    }
-    else
-        return m_stringArray[N]  ;
+       return m_stringArray[N]  ;
 }
 
 void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
@@ -633,14 +589,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 
 void wxListBox::SetString(int N, const wxString& s)
 {
-    wxString str ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        str = wxMacMakeMacStringFromPC( s )  ;
-    }
-    else
-        str = s ;
-    m_stringArray[N] = str ;
+    m_stringArray[N] = s ;
     MacSet( N , s ) ;
 }
 
@@ -754,7 +703,7 @@ void wxListBox::MacDelete( int N )
     Refresh();
 }
 
-void wxListBox::MacInsert( int n , const char * text)
+void wxListBox::MacInsert( int n , const wxString& text)
 {
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
@@ -763,7 +712,7 @@ void wxListBox::MacInsert( int n , const char * text)
     Refresh();
 }
 
-void wxListBox::MacAppend( const char * text)
+void wxListBox::MacAppend( const wxString& text)
 {
     Cell cell = { 0 , 0 } ;
     cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
@@ -834,7 +783,7 @@ int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
     return no_sel ;
 }
 
-void wxListBox::MacSet( int n , const char * text )
+void wxListBox::MacSet( int n , const wxString& text )
 {
     // our implementation does not store anything in the list
     // so we just have to redraw
@@ -1011,11 +960,11 @@ void wxListBox::OnChar(wxKeyEvent& event)
     {
         if ( event.GetTimestamp() > m_lastTypeIn + 60 )
         {
-            m_typeIn = "" ;
+            m_typeIn = wxEmptyString ;
         }
         m_lastTypeIn = event.GetTimestamp() ;
         m_typeIn += (char) event.GetKeyCode() ;
-        int line = FindString("*"+m_typeIn+"*") ;
+        int line = FindString(wxT("*")+m_typeIn+wxT("*")) ;
         if ( line >= 0 )
         {
             if ( GetSelection() != line )
index b6a170c8ee6b5ac400b66cee34e074c8ccc8d8be..36d7fb3e614bfa2c7c8d62471120b8ae31476e8d 100644 (file)
@@ -88,7 +88,7 @@ void wxMacAddEvent(
     short wakeUp ) 
 {
     wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-    wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
+    wxASSERT_MSG( handler != NULL , wxT("illegal notification proc ptr") ) ;
     /* this should be protected eventually */
     short index = e->top++ ;
     
index cc0aba9ed15893007799ae9e9bee914fa5fd4a28..417240fc0968f99b553ad42ba4cf74bf971006a8 100644 (file)
@@ -107,7 +107,7 @@ void wxMenu::Attach(wxMenuBarBase *menubar)
 // append a new item or submenu to the menu
 bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
 {
-    wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
+    wxASSERT_MSG( pItem != NULL, wxT("can't append NULL item to the menu") );
 
     if ( pItem->IsSeparator() )
     {
@@ -121,7 +121,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
         wxMenu *pSubMenu = pItem->GetSubMenu() ;
         if ( pSubMenu != NULL )
         {
-               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
+               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
             pSubMenu->m_menuParent = this ;
         
             if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
@@ -140,12 +140,12 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
         {
             if ( pos == (size_t)-1 )
             {
-                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
+                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") );
                 pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
             }
             else
             {
-                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
+                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos);
             }
 
             SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
@@ -503,7 +503,7 @@ void wxMenuBar::MacInstallMenuBar()
         
     Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
     wxString message ;
-    wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
+    wxCHECK_RET( menubar != NULL, wxT("can't read MBAR resource") );
     ::SetMenuBar( menubar ) ;
 #if TARGET_API_MAC_CARBON
     ::DisposeMenuBar( menubar ) ;
@@ -550,7 +550,7 @@ void wxMenuBar::MacInstallMenuBar()
         int pos ;
         wxMenu* menu = m_menus[i] , *subMenu = NULL ;
 
-        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+        if( m_titles[i] == wxT("?") || m_titles[i] == wxT("&?")  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
         {
             if ( mh == NULL )
             {
index ce04c08eda6796d67935ecfa83f9c6ae1cc5f4af..807f2a8ee0903f4da8229c380fd475f7e1df368f 100644 (file)
@@ -48,9 +48,9 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
 {
     // In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
     // therefore these item must not be translated
-    if ( wxStripMenuCodes(m_text).Upper() ==  "EXIT" )
+    if ( wxStripMenuCodes(m_text).Upper() ==  wxT("EXIT") )
     {
-        m_text = "Quit\tCtrl+Q" ;
+        m_text =wxT("Quit\tCtrl+Q") ;
     }
 
     m_radioGroup.start = -1;
@@ -152,7 +152,7 @@ void wxMenuItem::UncheckRadio()
 
 void wxMenuItem::Check(bool bDoCheck)
 {
-    wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+    wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
 
     if ( m_isChecked != bDoCheck ) 
     {
index 1f87cb9f4a76c3e472673b1a1da235ffed71805d..aca4bc0ae5b233e18a9c5c17177a2da896b1cda2 100644 (file)
@@ -72,7 +72,7 @@ wxMetaFile::wxMetaFile(const wxString& file)
 
 
     M_METAFILEDATA->m_metafile = 0;
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet") ) ;
 /*
     if (!file.IsNull() && (file.Cmp("") == 0))
         M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
@@ -145,9 +145,9 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
     m_maxX = -10000;
     m_maxY = -10000;
     
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet") ) ;
     
-    m_metaFile = new wxMetaFile("") ;
+    m_metaFile = new wxMetaFile(wxEmptyString) ;
     Rect r={0,0,1000,1000} ;
     
     m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
@@ -167,9 +167,9 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, i
     m_maxX = -10000;
     m_maxY = -10000;
     
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet")) ;
     
-    m_metaFile = new wxMetaFile("") ;
+    m_metaFile = new wxMetaFile(wxEmptyString) ;
     Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
     
     m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
index 393c2870c47dd825c13d1d035b961c6afe7317b4..296c7a81baebad9a1b5b0f6a37569c63055fe88b 100644 (file)
@@ -129,66 +129,66 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
 {
     wxString ext = e ;
     ext = ext.Lower() ;
-    if ( ext == "txt" )
+    if ( ext == wxT("txt") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("text/text");
+        fileType->m_impl->SetFileType(wxT("text/text"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "htm" || ext == "html" )
+    else if ( ext == wxT("htm") || ext == wxT("html") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("text/html");
+        fileType->m_impl->SetFileType(wxT("text/html"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "gif" )
+    else if ( ext == wxT("gif") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/gif");
+        fileType->m_impl->SetFileType(wxT("image/gif"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "png" )
+    else if ( ext == wxT("png" ))
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/png");
+        fileType->m_impl->SetFileType(wxT("image/png"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "jpg" || ext == "jpeg" )
+    else if ( ext == wxT("jpg" )|| ext == wxT("jpeg") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/jpeg");
+        fileType->m_impl->SetFileType(wxT("image/jpeg"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "bmp" )
+    else if ( ext == wxT("bmp") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/bmp");
+        fileType->m_impl->SetFileType(wxT("image/bmp"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "tif" || ext == "tiff" )
+    else if ( ext == wxT("tif") || ext == wxT("tiff") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/tiff");
+        fileType->m_impl->SetFileType(wxT("image/tiff"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "xpm" )
+    else if ( ext == wxT("xpm") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/xpm");
+        fileType->m_impl->SetFileType(wxT("image/xpm"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "xbm" )
+    else if ( ext == wxT("xbm") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/xbm");
+        fileType->m_impl->SetFileType(wxT("image/xbm"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
index 732a2f48bac3efb2f2e7f7cb8b7ab1c88bdda580..670d30644e13967db34cd632e754a64dff3d3597 100644 (file)
@@ -67,7 +67,7 @@ int wxMessageDialog::ShowModal()
     
     short result ;
     
-    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
     
     AlertType alertType = kAlertPlainAlert ;
     if (m_dialogStyle & wxICON_EXCLAMATION)
@@ -83,17 +83,12 @@ int wxMessageDialog::ShowModal()
     if ( UMAGetSystemVersion() >= 0x1000 )
     {
         AlertStdCFStringAlertParamRec param ;
-        CFStringRef cfNoString = NULL ;
-        CFStringRef cfYesString = NULL ;
-        
-        CFStringRef cfTitle = NULL;
-        CFStringRef cfText = NULL;
-        
-        cfTitle = wxMacCreateCFString( m_caption ) ;
-        cfText = wxMacCreateCFString( m_message ) ;
-        cfNoString = wxMacCreateCFString( _("No") ) ;
-        cfYesString = wxMacCreateCFString( _("Yes") ) ;
+        wxMacCFStringHolder cfNoString(_("No")) ;
+        wxMacCFStringHolder cfYesString( _("Yes")) ;
         
+        wxMacCFStringHolder cfTitle(m_caption);
+        wxMacCFStringHolder cfText(m_message);
+                
         param.movable = true;
         param.flags = 0 ;
         
@@ -157,32 +152,13 @@ int wxMessageDialog::ShowModal()
             CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
             RunStandardAlert( alertRef , NULL , &result ) ;
         }
-        if(cfTitle != NULL)
-            CFRelease(cfTitle);   
-        if(cfText != NULL)
-            CFRelease(cfText);   
-        if(cfNoString != NULL)
-            CFRelease(cfNoString);   
-        if(cfYesString != NULL)
-            CFRelease(cfYesString);   
-        if ( skipDialog )
+       if ( skipDialog )
             return wxID_CANCEL ;
     }
     else
 #endif
     {
         AlertStdAlertParamRec    param;
-        char   cText[2048] ;
-        
-        if (wxApp::s_macDefaultEncodingIsPC)
-        {
-            strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
-        }
-        else
-        {
-            strcpy( cText , m_message ) ;
-        }
-        wxMacConvertNewlines( cText , cText ) ;
         
         Str255 yesPString ;
         Str255 noPString ;
@@ -192,7 +168,7 @@ int wxMessageDialog::ShowModal()
         wxMacStringToPascal( m_caption , pascalTitle ) ;
         wxMacStringToPascal( _("Yes") , yesPString ) ;
         wxMacStringToPascal(  _("No") , noPString ) ;
-        CopyCStringToPascal( cText , pascalText ) ;
+        wxMacStringToPascal( m_message , pascalText ) ;
         
         param.movable         = true;
         param.filterProc     = NULL ;
index 56cacb02a2392596999174936c07daf09238d85b..d5f72a32d764aa7d52db76605c441ae1dcceaff8 100644 (file)
@@ -130,7 +130,7 @@ bool wxNotebook::Create(wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
     
     int tabstyle = kControlTabSmallNorthProc ;
     if ( HasFlag(wxNB_LEFT) )
@@ -360,12 +360,8 @@ void wxNotebook::MacSetupTabs()
         page = m_pages[ii];
         info.version = 0;
         info.iconSuiteID = 0;
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
-#else
-        strcpy( (char *) info.name , page->GetLabel() ) ;
-        c2pstr( (char *) info.name ) ;
-#endif
+        wxMacStringToPascal( page->GetLabel() , info.name ) ;
+
         SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
             sizeof( ControlTabInfoRec) , (char*) &info ) ;
         SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
@@ -488,7 +484,7 @@ bool wxNotebook::DoPhase(int /* nPhase */)
 
 void wxNotebook::Command(wxCommandEvent& event)
 {
-    wxFAIL_MSG("wxNotebook::Command not implemented");
+    wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
 }
 
 // ----------------------------------------------------------------------------
index a270cff9e71276abac7a17778572467242d5c0b9..583cbbab7a5c297247bf64d27aa70abf2e660ff8 100644 (file)
@@ -57,7 +57,7 @@ extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
 void
 ima_png_error(png_struct *png_ptr, char *message)
 {
-    wxMessageBox(message, "PNG error");
+    wxMessageBox(wxString::FromAscii(message), wxT("PNG error"));
     longjmp(png_ptr->jmpbuf, 1);
 }
 
@@ -819,8 +819,9 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         strcpy(nameStr, name);
     else
     {
-        strcpy(nameStr, filename);
-        wxStripExtension(nameStr);
+       wxString str = wxString::FromAscii(filename) ;
+       wxStripExtension( str ) ;
+        strcpy(nameStr, str.ToAscii() );
     }
     
     if ( GetDepth() > 4 )
@@ -888,7 +889,7 @@ bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
                                 int desiredWidth, int desiredHeight)
 {
     wxPNGReader reader;
-    if (reader.ReadFile((char*) (const char*) name))
+    if (reader.ReadFile( (char*)(const char*) name.ToAscii() ) )
     {
         return reader.InstantiateBitmap(bitmap);
     }
index 779ee74edd7a2c27ba1d09366e982bbb660df3cb..20bf8dedc71dae5aaa4148ff94a26d7f2a5a26d5 100644 (file)
@@ -97,8 +97,8 @@ int wxPrintDialog::ShowModal()
     }
     else
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message  , wxT(""), wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
     ::UMAPrClose(NULL) ;
@@ -179,8 +179,8 @@ int wxPrintDialog::ShowModal()
     }
     if ((err != noErr) && (err != kPMCancel))
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message  , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
 #else
@@ -245,8 +245,8 @@ int wxPageSetupDialog::ShowModal()
     }
     else
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
     ::UMAPrClose(NULL) ;
@@ -301,8 +301,8 @@ int wxPageSetupDialog::ShowModal()
     }
     if ((err != noErr) && (err != kPMCancel))
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
 #else
index 5f3c79225e0f21fd36cea1c89029e06ce2e1b9c4..274f8b1c9eed87f4ab1bf7dae672594611b7ca2e 100644 (file)
@@ -144,7 +144,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     if (!win)
     {
         wxEndBusyCursor();
-        wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
+        wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
         delete dc;
         return FALSE;
     }
@@ -162,7 +162,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
         if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
         {
             wxEndBusyCursor();
-            wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
+            wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent);
             break;
         }
         if (sm_abortIt)
index 15ac067af755ea432c02602078fc028bb05af95c..141c7971fc8de595f621af88daed12047547229b 100644 (file)
@@ -203,7 +203,7 @@ wxString wxRadioBox::GetString(int item) const
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
-        return wxString("");
+        return wxEmptyString;
     
     i = 0;
     current = m_radioButtonCycle;
@@ -409,7 +409,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     int totWidth,totHeight;
     
     SetFont(GetParent()->GetFont());
-    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
+    GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
     charWidth/=52;
     
     maxWidth=-1;
@@ -490,7 +490,7 @@ wxSize wxRadioBox::DoGetBestSize() const
     int totWidth, totHeight;
     
     wxFont font = GetParent()->GetFont();
-    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+    GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
         &charWidth, &charHeight, NULL, NULL, &font);
     charWidth /= 52;
     
index 6f57b2c40dd86fdcdc818bd583a24773fae410ca..ad843c3fd955bfced9f470e5d6199a018235305e 100644 (file)
@@ -46,12 +46,12 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
         kControlScrollBarLiveProc , (long) this ) ;
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
 
     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
 
index 2a95191da231177787ef538b918480d750a81c37..87d4e586098060c40ae7ebbee9c37ce375554be6 100644 (file)
@@ -74,7 +74,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     
     m_pageSize = (int)((maxValue-minValue)/10);
     
-    MacPreControlCreate( parent, id, "", pos, size, style,
+    MacPreControlCreate( parent, id, wxEmptyString, pos, size, style,
         validator, name, &bounds, title );
     
     procID = kControlSliderProc + kControlSliderLiveFeedback;
@@ -86,15 +86,15 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
         value, minValue, maxValue, procID, (long) this);
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
     
     if(style & wxSL_LABELS)
     {
-        m_macMinimumStatic = new wxStaticText( this, -1, "" );
-        m_macMaximumStatic = new wxStaticText( this, -1, "" );
-        m_macValueStatic = new wxStaticText( this, -1, "" );
+        m_macMinimumStatic = new wxStaticText( this, -1, wxEmptyString );
+        m_macMaximumStatic = new wxStaticText( this, -1, wxEmptyString );
+        m_macValueStatic = new wxStaticText( this, -1, wxEmptyString );
         SetRange(minValue, maxValue);
         SetValue(value);
     }
@@ -132,7 +132,7 @@ int wxSlider::GetValue() const
 void wxSlider::SetValue(int value)
 {
     wxString valuestring ;
-    valuestring.Printf( "%d" , value ) ;    
+    valuestring.Printf( wxT("%d") , value ) ;    
     if ( m_macValueStatic )
         m_macValueStatic->SetLabel( valuestring ) ;
     SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
@@ -149,11 +149,11 @@ void wxSlider::SetRange(int minValue, int maxValue)
     SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
     
     if(m_macMinimumStatic) {
-        value.Printf("%d", m_rangeMin);
+        value.Printf(wxT("%d"), m_rangeMin);
         m_macMinimumStatic->SetLabel(value);
     }
     if(m_macMaximumStatic) {
-        value.Printf("%d", m_rangeMax);
+        value.Printf(wxT("%d"), m_rangeMax);
         m_macMaximumStatic->SetLabel(value);
     }
     SetValue(m_rangeMin);
@@ -283,9 +283,9 @@ wxSize wxSlider::DoGetBestSize() const
         int ht, wd;
         
         // Get maximum text label width and height
-        text.Printf("%d", m_rangeMin);
+        text.Printf(wxT("%d"), m_rangeMin);
         GetTextExtent(text, &textwidth, &textheight);
-        text.Printf("%d", m_rangeMax);
+        text.Printf(wxT("%d"), m_rangeMax);
         GetTextExtent(text, &wd, &ht);
         if(ht > textheight) {
             textheight = ht;
@@ -356,9 +356,9 @@ void wxSlider::MacUpdateDimensions()
         int ht;
         
         // Get maximum text label width and height
-        text.Printf("%d", m_rangeMin);
+        text.Printf(wxT("%d"), m_rangeMin);
         GetTextExtent(text, &minValWidth, &textheight);
-        text.Printf("%d", m_rangeMax);
+        text.Printf(wxT("%d"), m_rangeMax);
         GetTextExtent(text, &maxValWidth, &ht);
         if(ht > textheight) {
             textheight = ht;
index b36c755f7e44ae3c9b67811d613fe4b64947c140..0f4faca5784170109e30e0efccc211e515a43ff0 100644 (file)
@@ -47,12 +47,12 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
         kControlLittleArrowsProc , (long) this ) ;
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     MacPostControlCreate() ;
     
index dc00dcca0f136c56ba4db1822c73dbba1e9c7108..30305cc1cf7d1855524b4c849acf4c13ad218bb1 100644 (file)
@@ -52,7 +52,7 @@ bool wxStaticLine::Create( wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
           kControlSeparatorLineProc , (long) this ) ;
index fc0a5726f933914d9b86e7d4dc090cb9c1f221dc..b2a7d103da4694cb0a3837cf72c7a4d009193e86 100644 (file)
@@ -59,7 +59,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
     return ret;
 }
 
-const wxString punct = " ,.-;:!?";
+const wxString punct = wxT(" ,.-;:!?");
 
 void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
 {
@@ -68,7 +68,7 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
     if (paragraph.Length() == 0)
     {
         // empty line
-        dc.GetTextExtent( "H", &width, &height );
+        dc.GetTextExtent( wxT("H"), &width, &height );
         y += height;
         
         return;
@@ -127,7 +127,7 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
             }
             
             dc.DrawText( paragraph, pos , y) ;
-            paragraph="";
+            paragraph=wxEmptyString;
             y += height ;
         }
     }
@@ -165,7 +165,7 @@ void wxStaticText::OnDraw( wxDC &dc )
         if (text[i] == 13 || text[i] == 10)
         {
             DrawParagraph(dc, paragraph,y);
-            paragraph = "" ;
+            paragraph = wxEmptyString ;
         }
         else
         {
index 6e79c8838681839edd60c613af033d4e388b9dff..4fcf069286d65a65df2d67c365ceec20acd27eee 100644 (file)
@@ -39,7 +39,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     
     m_imageList = NULL;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
         kControlTabSmallProc , (long) this ) ;
@@ -115,7 +115,7 @@ int wxTabCtrl::GetRowCount() const
 wxString wxTabCtrl::GetItemText(int item) const
 {
     // TODO
-    return wxString("");
+    return wxEmptyString;
 }
 
 // Get the item image
index ae6063d20c4bdabdc2a75c439e2af6fe191bb251..0f6f9e9ab7c5e6398ab6bf3f9084e5bbcbf9d936 100644 (file)
@@ -593,6 +593,7 @@ OSStatus mUPOpenControl(ControlHandle theControl, long wxStyle )
           kTXNStartOffset,
           kTXNEndOffset);
         /* set the field's background */
+
     tback.bgType = kTXNBackgroundTypeRGB;
     tback.bg.color = rgbWhite;
     TXNSetBackground( varsp->fTXNRec, &tback);
@@ -701,7 +702,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         mySize.y += 2 * m_macVerticalBorder ;
     }
     */
-    MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , mySize ,style, validator , name , &bounds , title ) ;
 
     if ( m_windowStyle & wxTE_MULTILINE )
     {
@@ -738,16 +739,10 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     }
     MacPostControlCreate() ;
 
-    wxString value ;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-        value = wxMacMakeMacStringFromPC( st ) ;
-    else
-        value = st ;
-        
     if ( !m_macUsesTXN )
     {
-        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
     }
     else
     {
@@ -755,9 +750,15 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
             /* set up locals */
         tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
             /* set the text in the record */
-        TXNSetData( (**tpvars).fTXNRec, kTXNTextData,  (void*)value.c_str(), value.Length(),
-          kTXNStartOffset, kTXNEndOffset);
         m_macTXN =  (**tpvars).fTXNRec ;
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN) , kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2,
+          kTXNStartOffset, kTXNEndOffset);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN) , kTXNTextData,  (void*)text.data(), strlen( text ) ,
+          kTXNStartOffset, kTXNEndOffset);
+#endif
         m_macTXNvars = tpvars ;
         m_macUsesTXN = true ;
         TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
@@ -777,25 +778,23 @@ wxString wxTextCtrl::GetValue() const
         err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
             ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
        
-           if ( err )
-               return wxEmptyString ;
-           
-           if ( actualSize > 0 )
-           {
-            wxChar *ptr = result.GetWriteBuf(actualSize) ;
-            
+       if ( err )
+           return wxEmptyString ;
+       
+       if ( actualSize > 0 )
+       {
+                       wxCharBuffer buf(actualSize) ;            
             ::GetControlData( (ControlHandle) m_macControl, 0,
                 ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
-                actualSize , ptr , &actualSize ) ;
-            ptr[actualSize] = 0 ;
-            result.UngetWriteBuf(actualSize) ;
+                actualSize , buf.data() , &actualSize ) ;
+            result = wxMacMakeStringFromCString( buf ) ;
         }
-        
     }
     else
     {
+#if wxUSE_UNICODE
         Handle theText ;
-        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNUnicodeTextData );
         // all done
         if ( err )
         {
@@ -804,18 +803,38 @@ wxString wxTextCtrl::GetValue() const
         else
         {
             actualSize = GetHandleSize( theText ) ;
-               if ( actualSize > 0 )
-               {
-                wxChar *ptr = result.GetWriteBuf(actualSize) ;
-                strncpy( ptr , *theText , actualSize ) ;
+            if ( actualSize > 0 )
+            {
+                wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ;
+                wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
                 ptr[actualSize] = 0 ;
                 result.UngetWriteBuf( actualSize ) ;
             }
             DisposeHandle( theText ) ;
         }
+#else
+        Handle theText ;
+        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        // all done
+        if ( err )
+        {
+            actualSize = 0 ;
+        }
+        else
+        {
+            actualSize = GetHandleSize( theText ) ;
+            if ( actualSize > 0 )
+            {
+                HLock( theText ) ;
+                result = wxMacMakeStringFromCString( *theText , actualSize ) ;
+                HUnlock( theText ) ;
+            }
+            DisposeHandle( theText ) ;
+        }
+#endif
     }
     
-    return wxMacMakeStringFromMacString( result ) ;
+    return result ;
 }
 
 void wxTextCtrl::GetSelection(long* from, long* to) const
@@ -833,28 +852,24 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
 
 void wxTextCtrl::SetValue(const wxString& st)
 {
-    wxString value;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        value = wxMacMakeMacStringFromPC( st ) ;
-        // value.Replace( "\n", "\r" ); TODO this should be handled by the conversion
-    }
-    else
-        value = st;
-        
-        
     if ( !m_macUsesTXN )
     {
-        ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
     }
     else
     {
         bool formerEditable = IsEditable() ;
         if ( !formerEditable )
             SetEditable(true) ;
-        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2 ,
+          kTXNStartOffset, kTXNEndOffset);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)text.data(), strlen( text ) ,
           kTXNStartOffset, kTXNEndOffset);
+#endif
         TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
         TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
         if ( !formerEditable )
@@ -884,7 +899,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
         if ( style.HasFont() )
         {
             const wxFont &font = style.GetFont() ;
-            CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
+            wxMacStringToPascal( font.GetFaceName() , fontName ) ;
             fontSize = font.GetPointSize() ;
             if ( font.GetUnderlined() )
                 fontStyle |= underline ;
@@ -918,7 +933,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
         {
             OSStatus status = TXNSetTypeAttributes ((TXNObject)m_macTXN, attrCounter , typeAttr,
                 start,end);
-            wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
+            wxASSERT_MSG( status == noErr , wxT("Couldn't set text attributes") ) ;
         }
         if ( !formerEditable )
             SetEditable(formerEditable) ;
@@ -1140,8 +1155,13 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
             SetEditable(true) ;
         TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
         TXNClear( ((TXNObject) m_macTXN) ) ;
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)value.wc_str(), value.Length() * 2 ,
+          kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#else
         TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
             kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#endif
         if ( !formerEditable )
             SetEditable( formerEditable ) ;
     }
@@ -1208,20 +1228,12 @@ bool wxTextCtrl::LoadFile(const wxString& file)
     return FALSE;
 }
 
-void wxTextCtrl::WriteText(const wxString& text)
-{
-    wxString value ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        value = wxMacMakeMacStringFromPC( text ) ;
-        // value.Replace( "\n", "\r" ); // TODO this should be handled by the conversion
-    }
-    else
-        value = text ;
-        
+void wxTextCtrl::WriteText(const wxString& st)
+{        
     if ( !m_macUsesTXN )
     {
-        TEInsert( value , value.Length() , ((TEHandle) m_macTE) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
     }
     else
     {
@@ -1230,8 +1242,14 @@ void wxTextCtrl::WriteText(const wxString& text)
             SetEditable(true) ;
         long start , end , dummy ;
         GetSelection( &start , &dummy ) ;
-        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2 ,
           kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)text.data(), strlen( text ) ,
+          kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#endif
         GetSelection( &dummy , &end ) ;
         SetStyle( start , end , GetDefaultStyle() ) ;
         if ( !formerEditable )
@@ -1415,7 +1433,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
         if (count == lineNo)
         {
             // Add chars in line then
-            wxString tmp("");
+            wxString tmp;
             
             for (size_t j = i; j < content.Length(); j++)
             {
@@ -1429,7 +1447,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
         }
         if (content[i] == '\r') count++;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 /*
index 3e4b1dfc490d05df06c212a4ba8922416dbf72ef..e31c812c02b2c1de8668e422ed414461e06c3d66 100644 (file)
@@ -852,7 +852,7 @@ bool wxThreadModule::OnInit()
 #endif
     if ( !hasThreadManager )
     {
-        wxMessageBox( "Error" , "Thread Support is not available on this System" , wxOK ) ;
+        wxMessageBox( wxT("Error") , wxT("Thread Support is not available on this System") , wxOK ) ;
         return FALSE ;
     }
 
index 33da0a2d4b9c80d4e16770b8c68c1835ced25f66..42dfe72bab829d4b0bd015bac5bcae495408138c 100644 (file)
@@ -255,7 +255,7 @@ bool wxToolBar::Realize()
               ::SetControlFontStyle( m_macToolHandle , &controlstyle ) ;
             */
             ControlHandle container = (ControlHandle) GetParent()->MacGetContainerForEmbedding() ;
-            wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
+            wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
             ::EmbedControl( m_macToolHandle , container ) ;
             
             if ( GetWindowStyleFlag() & wxTB_VERTICAL )
@@ -507,7 +507,7 @@ wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
     {
         return tool->GetShortHelp() ;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
index 4b00c6f7500684f1761436796ea04c56cd0ca717..bee14fc9fb1174c9f70b4956f099aa27acda052d 100644 (file)
@@ -35,7 +35,7 @@ class wxMacToolTip
         wxMacToolTip( ) ;
         ~wxMacToolTip() ;
         
-        void            Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
+        void            Setup( WindowRef window  , const wxString& text , wxPoint localPosition ) ;
         long            GetMark() { return m_mark ; }
         void             Draw() ;
         void            Clear() ;
@@ -50,8 +50,8 @@ class wxMacToolTip
         bool        m_shown ;
         long        m_mark ;
         wxMacToolTipTimer* m_timer ;
-#ifdef TARGET_CARBON
-        CFStringRef m_helpTextRef ;
+#if TARGET_CARBON
+        wxMacCFStringHolder m_helpTextRef ;
 #endif
 } ;
 
@@ -186,18 +186,14 @@ wxMacToolTip::wxMacToolTip()
     m_mark = 0 ;
     m_shown = false ;
     m_timer = NULL ;
-    m_helpTextRef = NULL ;
 }
 
-void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition ) 
+void wxMacToolTip::Setup( WindowRef win  , const wxString& text , wxPoint localPosition ) 
 {
     m_mark++ ;
     Clear() ;
     m_position = localPosition ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-        m_label = wxMacMakeMacStringFromPC( text ) ;
-     else
-        m_label = text ;
+    m_label = text ;
     m_window =win;
     s_ToolTipWindowRef = m_window ;
     m_backpict = NULL ;
@@ -228,209 +224,147 @@ void wxMacToolTip::Draw()
     {
         m_shown = true ;
 #if TARGET_CARBON
-        if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
-        {
-            HMHelpContentRec tag ;
-            tag.version = kMacHelpVersion;
-            SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
-            GrafPtr port ;
-            GetPort( &port ) ;
-            SetPortWindowPort(m_window) ;
-            LocalToGlobal( (Point *) &tag.absHotRect.top );
-            LocalToGlobal( (Point *) &tag.absHotRect.bottom );
-            SetPort( port );
-            if( m_helpTextRef )
-            {
-                CFRelease( m_helpTextRef ) ;
-                m_helpTextRef = NULL ;
-            }
-            m_helpTextRef = wxMacCreateCFString(m_label) ;
-            tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
-            tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
-            tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
-            tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
-            tag.tagSide = kHMDefaultSide;
-            HMDisplayTag( &tag );
-        }
-        else
-#endif
+        HMHelpContentRec tag ;
+        tag.version = kMacHelpVersion;
+        SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
+        GrafPtr port ;
+        GetPort( &port ) ;
+        SetPortWindowPort(m_window) ;
+        LocalToGlobal( (Point *) &tag.absHotRect.top );
+        LocalToGlobal( (Point *) &tag.absHotRect.bottom );
+        SetPort( port );
+        m_helpTextRef = m_label ;
+        tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
+        tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
+        tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
+        tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
+        tag.tagSide = kHMDefaultSide;
+        HMDisplayTag( &tag );
+#else
+        wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
+        FontFamilyID fontId ;
+        Str255 fontName ;
+        SInt16 fontSize ;
+        Style fontStyle ;
+        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+        GetFNum( fontName, &fontId );
+        
+        TextFont( fontId ) ;
+        TextSize( fontSize ) ;
+        TextFace( fontStyle ) ;
+        FontInfo fontInfo;
+        ::GetFontInfo(&fontInfo);
+        short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
+        short height = 0 ;
+        //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
+        
+        int i = 0 ;
+        int length = m_label.Length() ;
+        int width = 0 ;
+        int thiswidth = 0 ;
+        int laststop = 0 ;
+        wxCharBuffer text = wxMacStringToCString( m_label ) ;
+
+        while( i < length )
         {
-            wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
-#if TARGET_CARBON    
-            bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-#endif        
-            
-            FontFamilyID fontId ;
-            Str255 fontName ;
-            SInt16 fontSize ;
-            Style fontStyle ;
-            GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
-            GetFNum( fontName, &fontId );
-            
-            TextFont( fontId ) ;
-            TextSize( fontSize ) ;
-            TextFace( fontStyle ) ;
-            FontInfo fontInfo;
-            ::GetFontInfo(&fontInfo);
-            short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
-            short height = 0 ;
-            //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
-            
-            int i = 0 ;
-            int length = m_label.Length() ;
-            int width = 0 ;
-            int thiswidth = 0 ;
-            int laststop = 0 ;
-            const char *text = m_label ;
-            while( i < length )
-            {
-                if( text[i] == 13 || text[i] == 10)
-                {
-                    thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                    if ( thiswidth > width )
-                        width = thiswidth ;
-                    
-                    height += lineh ;
-                    laststop = i+1 ;
-                }
-                i++ ;
-            }
-            if ( i - laststop > 0 )
+            if( text[i] == 13 || text[i] == 10)
             {
                 thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
                 if ( thiswidth > width )
                     width = thiswidth ;
+                
                 height += lineh ;
+                laststop = i+1 ;
             }
-            
-            
-            m_rect.left = m_position.x + kTipOffset;
-            m_rect.top = m_position.y + kTipOffset;
-            m_rect.right = m_rect.left + width + 2 * kTipBorder;
-#if TARGET_CARBON    
-            if ( useDrawThemeText )
-                m_rect.right += kTipBorder ;
-#endif
-            m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
-            Rect r ;
-            GetPortBounds( GetWindowPort( m_window ) , &r ) ;
-            if ( m_rect.top < 0 )
-            {
-                m_rect.bottom += -m_rect.top ;
-                m_rect.top = 0 ;
-            }
-            if ( m_rect.left < 0 )
-            {
-                m_rect.right += -m_rect.left ;
-                m_rect.left = 0 ;
-            }
-            if ( m_rect.right > r.right )
-            {
-                m_rect.left -= (m_rect.right - r.right ) ;
-                m_rect.right = r.right ;
-            }
-            if ( m_rect.bottom > r.bottom )
-            {
-                m_rect.top -= (m_rect.bottom - r.bottom) ;
-                m_rect.bottom = r.bottom ;
-            }
-            ClipRect( &m_rect ) ;
-            BackColor( whiteColor ) ;
-            ForeColor(blackColor ) ;
-            GWorldPtr port ;            
-            NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
-            CGrafPtr    origPort ;
-            GDHandle    origDevice ;
-            
-            GetGWorld( &origPort , &origDevice ) ;
-            SetGWorld( port , NULL ) ;
-            
-            m_backpict = OpenPicture(&m_rect);
-            
-            CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
-                GetPortBitMapForCopyBits(port), 
-                &m_rect, 
-                &m_rect, 
-                srcCopy, 
-                NULL);
-            ClosePicture();
-            SetGWorld( origPort , origDevice ) ;
-            DisposeGWorld( port ) ;
-            PenNormal() ;
-            
-            RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
-            BackColor( whiteColor ) ;
-            RGBForeColor( &tooltipbackground ) ;
-            
-            PaintRect( &m_rect ) ;
-            ForeColor(blackColor ) ;
-            FrameRect( &m_rect ) ;
-            SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
-            ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
-            
-            i = 0 ;
-            laststop = 0 ;
-            height = 0 ;
-            
-            while( i < length )
-            {
-                if( text[i] == 13 || text[i] == 10)
-                {
-#if TARGET_CARBON
-                    if ( useDrawThemeText )
-                    {
-                        Rect frame ;
-                        frame.top = m_rect.top + kTipBorder + height ;
-                        frame.left = m_rect.left + kTipBorder ;
-                        frame.bottom = frame.top + 1000 ;
-                        frame.right = frame.left + 1000 ;
-                        CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                        ::DrawThemeTextBox( mString,
-                            kThemeCurrentPortFont,
-                            kThemeStateActive,
-                            true,
-                            &frame,
-                            teJustLeft,
-                            nil );
-                        CFRelease( mString ) ;
-                        height += lineh ;
-                    }
-                    else
-#endif
-                    {
-                        ::DrawText( text , laststop , i - laststop ) ;
-                        height += lineh ;
-                        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
-                    }
-                    laststop = i+1 ;
-                }
-                i++ ;
-            }
-#if TARGET_CARBON
-            if ( useDrawThemeText )
-            {
-                Rect frame ;
-                frame.top = m_rect.top + kTipBorder + height ;
-                frame.left = m_rect.left + kTipBorder ;
-                frame.bottom = frame.top + 1000 ;
-                frame.right = frame.left + 1000 ;
-                CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
-                ::DrawThemeTextBox( mString,
-                    kThemeCurrentPortFont,
-                    kThemeStateActive,
-                    true,
-                    &frame,
-                    teJustLeft,
-                    nil );
-                CFRelease( mString ) ;
-            }
-            else
-#endif
+            i++ ;
+        }
+        if ( i - laststop > 0 )
+        {
+            thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+            if ( thiswidth > width )
+                width = thiswidth ;
+            height += lineh ;
+        }
+        
+        m_rect.left = m_position.x + kTipOffset;
+        m_rect.top = m_position.y + kTipOffset;
+        m_rect.right = m_rect.left + width + 2 * kTipBorder;
+
+        m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
+        Rect r ;
+        GetPortBounds( GetWindowPort( m_window ) , &r ) ;
+        if ( m_rect.top < 0 )
+        {
+            m_rect.bottom += -m_rect.top ;
+            m_rect.top = 0 ;
+        }
+        if ( m_rect.left < 0 )
+        {
+            m_rect.right += -m_rect.left ;
+            m_rect.left = 0 ;
+        }
+        if ( m_rect.right > r.right )
+        {
+            m_rect.left -= (m_rect.right - r.right ) ;
+            m_rect.right = r.right ;
+        }
+        if ( m_rect.bottom > r.bottom )
+        {
+            m_rect.top -= (m_rect.bottom - r.bottom) ;
+            m_rect.bottom = r.bottom ;
+        }
+        ClipRect( &m_rect ) ;
+        BackColor( whiteColor ) ;
+        ForeColor(blackColor ) ;
+        GWorldPtr port ;            
+        NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
+        CGrafPtr    origPort ;
+        GDHandle    origDevice ;
+        
+        GetGWorld( &origPort , &origDevice ) ;
+        SetGWorld( port , NULL ) ;
+        
+        m_backpict = OpenPicture(&m_rect);
+        
+        CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
+            GetPortBitMapForCopyBits(port), 
+            &m_rect, 
+            &m_rect, 
+            srcCopy, 
+            NULL);
+        ClosePicture();
+        SetGWorld( origPort , origDevice ) ;
+        DisposeGWorld( port ) ;
+        PenNormal() ;
+        
+        RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
+        BackColor( whiteColor ) ;
+        RGBForeColor( &tooltipbackground ) ;
+        
+        PaintRect( &m_rect ) ;
+        ForeColor(blackColor ) ;
+        FrameRect( &m_rect ) ;
+        SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
+        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
+        
+        i = 0 ;
+        laststop = 0 ;
+        height = 0 ;
+        
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
             {
                 ::DrawText( text , laststop , i - laststop ) ;
+                height += lineh ;
+                ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
+                laststop = i+1 ;
             }
-            ::TextMode( srcOr ) ;        
-       }
+            i++ ;
+        }
+        ::DrawText( text , laststop , i - laststop ) ;
+        ::TextMode( srcOr ) ;        
+#endif
     }
 }
 
@@ -454,11 +388,7 @@ void wxMacToolTip::Clear()
         return ;
 #if TARGET_CARBON
     HMHideTag() ;
-    if( m_helpTextRef )
-    {
-        CFRelease( m_helpTextRef ) ;
-        m_helpTextRef = NULL ;
-    }
+    m_helpTextRef.Release() ;
 #else         
     if ( m_window == s_ToolTipWindowRef && m_backpict )
     {
index 69708ed1a394759ab2cf657843d69ae74295eaba..2f4de7a5eb9b13b3b05edb890662f62f3309cfd8 100644 (file)
@@ -362,7 +362,7 @@ void wxAssociateWinWithMacWindow(WXWindow inWindowRef, wxTopLevelWindowMac *win)
 {
     // adding NULL WindowRef is (first) surely a result of an error and
     // (secondly) breaks menu command processing
-    wxCHECK_RET( inWindowRef != (WindowRef) NULL, "attempt to add a NULL WindowRef to window list" );
+    wxCHECK_RET( inWindowRef != (WindowRef) NULL, wxT("attempt to add a NULL WindowRef to window list") );
 
     if ( !wxWinMacWindowList->Find((long)inWindowRef) )
         wxWinMacWindowList->Append((long)inWindowRef, win);
@@ -592,12 +592,7 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     
     ::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ;
     wxAssociateWinWithMacWindow( m_macWindow , this ) ;
-    wxString label ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-        label = wxMacMakeMacStringFromPC( title ) ;
-    else
-        label = title ;
-    UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
+    UMASetWTitle( (WindowRef)m_macWindow , title ) ;
     ::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
 #if TARGET_CARBON
     InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
@@ -836,15 +831,7 @@ void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
 void wxTopLevelWindowMac::SetTitle(const wxString& title)
 {
     wxWindow::SetTitle( title ) ;
-    
-    wxString label ;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-        label = wxMacMakeMacStringFromPC( m_label ) ;
-    else
-        label = m_label ;
-
-    UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
+    UMASetWTitle( (WindowRef)m_macWindow , title ) ;
 }
 
 bool wxTopLevelWindowMac::Show(bool show)
index 59daa769db71de98da9e688e22ca1b9bb342bc60..9ec67e6f5467c5bafc22dc96fded78a1229a2ba8 100644 (file)
@@ -189,10 +189,8 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title )
     wxString str = wxStripMenuCodes( title ) ;
     MenuRef menu ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
     CreateNewMenu( id , 0 , &menu ) ;
-    SetMenuTitleWithCFString( menu , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -205,9 +203,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title )
 {
     wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
-    SetMenuTitleWithCFString( menu , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -219,9 +215,7 @@ void UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& tit
 {
     wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
-    SetMenuItemTextWithCFString( menu , item , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -558,17 +552,15 @@ void             UMADisposeWindow( WindowRef inWindowRef )
     DisposeWindow( inWindowRef ) ;
 }
 
-void             UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
+void UMASetWTitle( WindowRef inWindowRef , const wxString& title ) 
 {
-    Str255    ptitle ;
-    strncpy( (char*)ptitle , title , 96 ) ;
-    ptitle[96] = 0 ;
 #if TARGET_CARBON
-    c2pstrcpy( ptitle, (char *)ptitle ) ;
+    SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title) ) ;
 #else
-    c2pstr( (char*)ptitle ) ;
-#endif
+    Str255 ptitle ;
+    wxMacStringToPascal( title , ptitle ) ;
     SetWTitle( inWindowRef , ptitle ) ;
+#endif
 }
 
 void             UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
@@ -583,6 +575,17 @@ void             UMAGetWTitleC( WindowRef inWindowRef , char *title )
 
 // appearance additions
 
+void UMASetControlTitle( ControlHandle inControl , const wxString& title ) 
+{
+#if TARGET_CARBON
+    SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title) ) ;
+#else
+    Str255 ptitle ;
+    wxMacStringToPascal( title , ptitle ) ;
+    SetControlTitle( inControl , ptitle ) ;
+#endif
+}
+
 void UMAActivateControl( ControlHandle inControl ) 
 {
     // we have to add the control after again to the update rgn
@@ -795,7 +798,7 @@ void wxMacPortStateHelper::Setup( GrafPtr newport )
 {
     GetPort( &m_oldPort ) ;
     SetPort( newport ) ;
-    wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
+    wxASSERT_MSG( m_clip == NULL , wxT("Cannot call setup twice") ) ;
     m_clip = NewRgn() ;
     GetClip( m_clip );
     m_textFont = GetPortTextFont( (CGrafPtr) newport);
index 3897dadd575d4f17f6fc18deeea77a8391b6c5d8..014225901ca9f2972b2c5564070a39c8ddad2be0 100644 (file)
 #include <Sound.h>
 #endif
 
+#include "ATSUnicode.h"
+#include "TextCommon.h"
+#include "TextEncodingConverter.h"
+
 #ifndef __DARWIN__
 // defined in unix/utilsunx.cpp for Mac OS X
 
@@ -48,7 +52,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
 }
 
 // Get hostname only (without domain name)
-bool wxGetHostName(char *buf, int maxSize)
+bool wxGetHostName(wxChar *buf, int maxSize)
 {
     // Gets Chooser name of user by examining a System resource.
 
@@ -61,13 +65,11 @@ bool wxGetHostName(char *buf, int maxSize)
 
     if (chooserName && *chooserName)
     {
-      int length = (*chooserName)[0] ;
-      if ( length + 1 > maxSize )
-      {
-        length = maxSize - 1 ;
-      }
-      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-      buf[length] = 0 ;
+        HLock( (Handle) chooserName ) ;
+        wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
+        HUnlock( (Handle) chooserName ) ;
+        ReleaseResource( (Handle) chooserName ) ;
+        wxStrncpy( buf , name , maxSize - 1 ) ;
     }
     else
         buf[0] = 0 ;
@@ -76,7 +78,7 @@ bool wxGetHostName(char *buf, int maxSize)
 }
 
 // Get user ID e.g. jacs
-bool wxGetUserId(char *buf, int maxSize)
+bool wxGetUserId(wxChar *buf, int maxSize)
 {
   return wxGetUserName( buf , maxSize ) ;
 }
@@ -88,7 +90,7 @@ const wxChar* wxGetHomeDir(wxString *pstr)
 }
 
 // Get user name e.g. Stefan Csomor
-bool wxGetUserName(char *buf, int maxSize)
+bool wxGetUserName(wxChar *buf, int maxSize)
 {
     // Gets Chooser name of user by examining a System resource.
 
@@ -101,13 +103,11 @@ bool wxGetUserName(char *buf, int maxSize)
 
     if (chooserName && *chooserName)
     {
-      int length = (*chooserName)[0] ;
-      if ( length + 1 > maxSize )
-      {
-        length = maxSize - 1 ;
-      }
-      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-      buf[length] = 0 ;
+        HLock( (Handle) chooserName ) ;
+        wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
+        HUnlock( (Handle) chooserName ) ;
+        ReleaseResource( (Handle) chooserName ) ;
+        wxStrncpy( buf , name , maxSize - 1 ) ;
     }
     else
         buf[0] = 0 ;
@@ -250,22 +250,25 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
 
 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%.4f", value);
+    wxString buf;
+    buf.Printf(wxT("%.4f"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%ld", value);
+    wxString buf;
+    buf.Printf(wxT("%ld"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%d", value);
+    wxString buf;
+    buf.Printf(wxT("%d"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
@@ -369,7 +372,7 @@ wxString wxMacFindFolder( short        vol,
 }
 
 #ifndef __DARWIN__
-char *wxGetUserHome (const wxString& user)
+wxChar *wxGetUserHome (const wxString& user)
 {
     // TODO
     return NULL;
@@ -390,7 +393,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
       p = p.Mid(1,pos) ;
     }
     
-    p = p + ":" ;
+    p = p + wxT(":") ;
     
     Str255 volumeName ;
     XVolumeParam pb ;
@@ -501,7 +504,7 @@ wxString wxGetOsDescription()
     // use configure generated description if available
     return wxString("MacOS (") + WXWIN_OS_DESCRIPTION + wxString(")");
 #else
-    return "MacOS" ; //TODO:define further
+    return wxT("MacOS") ; //TODO:define further
 #endif
 }
 
@@ -593,10 +596,185 @@ void wxMacConvertToPC( const char *from , char *to , int len )
     }
 }
 
-wxString wxMacMakeMacStringFromPC( const char * p )
+TECObjectRef s_TECNativeCToUnicode = NULL ;
+TECObjectRef s_TECUnicodeToNativeC = NULL ;
+TECObjectRef s_TECPCToNativeC = NULL ;
+TECObjectRef s_TECNativeCToPC = NULL ;
+void wxMacSetupConverters() 
 {
+    // if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that 
+    // are not yet setup...
+    
+    OSStatus status = noErr ;
+    status = TECCreateConverter(&s_TECNativeCToUnicode, 
+       wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+
+
+    status = TECCreateConverter(&s_TECUnicodeToNativeC, 
+       kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
+
+    if ( !wxApp::s_macDefaultEncodingIsPC )
+    {
+        status = TECCreateConverter(&s_TECPCToNativeC, 
+               kTextEncodingWindowsLatin1, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
+
+               
+        status = TECCreateConverter(&s_TECNativeCToPC, 
+               wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingWindowsLatin1 );
+    }
+}
+
+void wxMacCleanupConverters()
+{
+    OSStatus status = noErr ;
+    status = TECDisposeConverter(s_TECNativeCToUnicode);
+
+    status = TECDisposeConverter(s_TECUnicodeToNativeC);
+
+    status = TECDisposeConverter(s_TECPCToNativeC);
+
+    status = TECDisposeConverter(s_TECNativeCToPC);
+}
+
+wxWCharBuffer wxMacStringToWString( const wxString &from ) 
+{
+#if wxUSE_UNICODE
+    wxWCharBuffer result( from.wc_str() ) ;
+#else
+    OSStatus status = noErr ;
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = from.Length() ;
+    ByteCount byteBufferLen = byteInLen *2 ;
+    wxWCharBuffer result( from.Length() ) ;
+    status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
+        (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+    result.data()[byteOutLen/2] = 0 ;
+#endif
+    return result ;
+}
+
+wxString wxMacMakeStringFromCString( const char * from , int len ) 
+{
+    OSStatus status = noErr ;
     wxString result ;
-    int len = strlen ( p ) ;
+    wxChar* buf = result.GetWriteBuf( len ) ;
+#if wxUSE_UNICODE
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = len ;
+    ByteCount byteBufferLen = len *2 ;
+
+    status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
+        (TextPtr)buf, byteBufferLen, &byteOutLen);
+#else
+    if ( wxApp::s_macDefaultEncodingIsPC )
+        memcpy( buf , from , len ) ;
+    else
+    {
+        OSStatus status = noErr ;
+        ByteCount byteOutLen ;
+        ByteCount byteInLen = len ;
+        ByteCount byteBufferLen = byteInLen ;
+
+        status = TECConvertText(s_TECNativeCToPC, (ConstTextPtr)from , byteInLen, &byteInLen,
+            (TextPtr)buf, byteBufferLen, &byteOutLen);
+    }
+#endif
+    buf[len] = 0 ;
+    result.UngetWriteBuf() ;
+    return result ;
+}
+
+wxString wxMacMakeStringFromCString( const char * from )
+{
+    return wxMacMakeStringFromCString( from , strlen(from) ) ;
+}
+
+wxCharBuffer wxMacStringToCString( const wxString &from ) 
+{
+#if wxUSE_UNICODE
+    OSStatus status = noErr ;
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = from.Length() * 2 ;
+    ByteCount byteBufferLen = from.Length() ;
+    wxCharBuffer result( from.Length() ) ;
+    status = TECConvertText(s_TECUnicodeToNativeC , (ConstTextPtr)from.wc_str() , byteInLen, &byteInLen,
+        (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+    return result ;
+#else
+    if ( wxApp::s_macDefaultEncodingIsPC )
+        return wxCharBuffer( from.c_str() ) ;
+    else
+    {
+        wxCharBuffer result( from.Length() ) ;
+        OSStatus status = noErr ;
+        ByteCount byteOutLen ;
+        ByteCount byteInLen = from.Length() ;
+        ByteCount byteBufferLen = byteInLen ;
+
+        status = TECConvertText(s_TECPCToNativeC, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
+            (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+        return result ;
+    }
+#endif
+}
+
+void wxMacStringToPascal( const wxString&from , StringPtr to ) 
+{
+    wxCharBuffer buf = wxMacStringToCString( from ) ;
+    int len = strlen(buf) ;
+
+    if ( len > 255 )
+        len = 255 ;
+    to[0] = len ;
+    memcpy( (char*) &to[1] , buf , len ) ;
+}
+
+wxString wxMacMakeStringFromPascal( ConstStringPtr from ) 
+{
+    return wxMacMakeStringFromCString( (char*) &from[1] , from[0] ) ;
+}
+
+// 
+// CFStringRefs (Carbon only)
+//
+
+#if TARGET_CARBON
+// converts this string into a carbon foundation string with optional pc 2 mac encoding
+void wxMacCFStringHolder::Assign( const wxString &str ) 
+{
+#if wxUSE_UNICODE
+       m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault, 
+               (const unsigned short*)str.wc_str(), str.Len() );
+#else
+    m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
+        wxApp::s_macDefaultEncodingIsPC ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+#endif
+    m_release = true ;
+}
+
+wxString wxMacCFStringHolder::AsString() 
+{
+    wxString result ;
+    Size len = CFStringGetLength( m_cfs )  ;
+    wxChar* buf = result.GetWriteBuf( len ) ;
+#if wxUSE_UNICODE
+    CFStringGetCharacters( m_cfs , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
+#else
+    CFStringGetCString( m_cfs , buf , len+1 , s_macDefaultEncodingIsPC ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+#endif
+    buf[len] = 0 ;
+    result.UngetWriteBuf() ;
+    return result ;
+}
+
+#if 0
+
+wxString wxMacMakeMacStringFromPC( const wxChar * p )
+{
+    wxString result ;
+    int len = wxStrlen ( p ) ;
     if ( len > 0 )
     {
         wxChar* ptr = result.GetWriteBuf(len) ;
@@ -607,10 +785,10 @@ wxString wxMacMakeMacStringFromPC( const char * p )
     return result ;
 }
 
-wxString wxMacMakePCStringFromMac( const char * p )
+wxString wxMacMakePCStringFromMac( const wxChar * p )
 {
     wxString result ;
-    int len = strlen ( p ) ;
+    int len = wxStrlen ( p ) ;
     if ( len > 0 )
     {
         wxChar* ptr = result.GetWriteBuf(len) ;
@@ -621,7 +799,7 @@ wxString wxMacMakePCStringFromMac( const char * p )
     return result ;
 }
 
-wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding )
+wxString wxMacMakeStringFromMacString( const wxChar* from , bool mac2pcEncoding )
 {
     if (mac2pcEncoding)
     {
@@ -652,7 +830,7 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding )
     }
 }
 
-void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding )
+void wxMacStringToPascal( const wxChar * from , StringPtr to , bool pc2macEncoding )
 {
     if (pc2macEncoding)
     {
@@ -663,19 +841,8 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
       CopyCStringToPascal( from , to ) ;
     }
 }
+#endif
 
-// 
-// CFStringRefs (Carbon only)
-//
-
-#if TARGET_CARBON
-// converts this string into a carbon foundation string with optional pc 2 mac encoding
-CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) 
-{
-    return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
-        pc2macEncoding ? 
-        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
-}
 
 #endif //TARGET_CARBON
 
index 0c5aac8bfcc5fee2bbc1a495ac24e6804cfc1305..35accb91670fa30805afea67f65bf90a326b5dc5 100644 (file)
@@ -135,23 +135,18 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
 //don't know what to do with looped, wth
 bool wxWave::Play(bool async, bool looped) const
 {
-    char lpSnd[32];
     bool ret = false;
 
     if (m_isResource)
     {
-#if TARGET_CARBON
-      c2pstrcpy((unsigned char *)lpSnd, m_sndname);
-#else
-      strcpy(lpSnd, m_sndname);
-      c2pstr((char *) lpSnd);
-#endif
-      SndListHandle hSnd;
+       Str255 snd ;
+       wxMacStringToPascal( m_sndname , snd ) ;
+       SndListHandle hSnd;
 
-      hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
+       hSnd = (SndListHandle) GetNamedResource('snd ', snd);
 
-      if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
-        ret = true;
+       if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
+               ret = true;
     }
 
     return ret;
index 156527a083c29fd7509a09f7da69ead199e44938..9f7a20f4e7a0be3afa0b3844757d33b1002d5032 100644 (file)
@@ -1642,7 +1642,7 @@ wxString wxWindowMac::MacGetToolTipString( wxPoint &pt )
     {
         return m_tooltip->GetTip() ;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 void wxWindowMac::Update()
@@ -1855,13 +1855,13 @@ WXHWND wxWindowMac::MacGetRootWindow() const
 
         iter = iter->GetParent() ;
     }
-    wxASSERT_MSG( 1 , "No valid mac root window" ) ;
+    wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ;
     return NULL ;
 }
 
 void wxWindowMac::MacCreateScrollBars( long style )
 {
-    wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
+    wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ;
 
     bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
     int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
index c50773b137ed9ff0bd6e24380e6a75030a63d6be..d987d94994c68a38b96df15ea58f9b51a5924acc 100644 (file)
@@ -211,7 +211,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
 
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
index 863b944cb4deed30a7f134c003ed2cfe847d6496..19f8e405d288a387c2e3271845829da4dcd31a1c 100644 (file)
@@ -49,7 +49,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 , 
         kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ; 
     
@@ -169,7 +169,7 @@ wxString wxChoice::GetString(int n) const
 void wxChoice::DoSetItemClientData( int n, void* clientData )
 {
     wxCHECK_RET( n >= 0 && (size_t)n < m_datas.GetCount(),
-                 "invalid index in wxChoice::SetClientData" );
+                 wxT("invalid index in wxChoice::SetClientData") );
     
     m_datas[n] = (char*) clientData ;
 }
@@ -177,7 +177,7 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
 void *wxChoice::DoGetItemClientData(int n) const
 {
     wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
-                 "invalid index in wxChoice::GetClientData" );
+                 wxT("invalid index in wxChoice::GetClientData") );
     return (void *)m_datas[n];
 }
 
index 47a2b428f909abd55e8b862526c1b3b2858de434..942a17c6fb9f7ec927d913fe707ee3c5c3f3bb16 100644 (file)
@@ -55,6 +55,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         
     case wxDF_TEXT:
         break;
+    case wxDF_UNICODETEXT:
+        break;
     case wxDF_BITMAP :
     case wxDF_METAFILE :
         break ;
@@ -77,15 +79,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         {
             if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
             {
-                if ( dataFormat.GetType() == wxDF_TEXT )
-                    byteCount++ ;
+                Size allocSize = byteCount ;
+                if ( dataFormat.GetType() == wxDF_TEXT )  
+                    allocSize += 1 ;
+                else if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+                    allocSize += 2 ;
                 
-                data = new char[ byteCount ] ;
+                data = new char[ allocSize ] ;
+                    
                 if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
                 {
-                    *len = byteCount ;
+                    *len = allocSize ;
                     if ( dataFormat.GetType() == wxDF_TEXT )  
                         ((char*)data)[byteCount] = 0 ;
+                    if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+                        ((wxChar*)data)[byteCount/2] = 0 ;
                 }
                 else
                 {
@@ -105,14 +113,19 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     if ( GetHandleSize( datahandle ) > 0 )
     {
         byteCount = GetHandleSize( datahandle ) ;
+        Size allocSize = byteCount ;
         if ( dataFormat.GetType() == wxDF_TEXT )  
-            data = new char[ byteCount + 1] ;
-        else
-            data = new char[ byteCount ] ;
-        
+            allocSize += 1 ;
+        else if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+            allocSize += 2 ;
+
+        data = new char[ allocSize ] ;
+
         memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
         if ( dataFormat.GetType() == wxDF_TEXT )  
             ((char*)data)[byteCount] = 0 ;
+        if ( dataFormat.GetType() == wxDF_UNICODETEXT )  
+            ((wxChar*)data)[byteCount/2] = 0 ;
         *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
@@ -123,10 +136,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
         
         return NULL ;
     }
+
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-        wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
+        wxString st = wxMacMakeStringFromCString( (char*) data ) ;
+#if wxUSE_UNICODE
+        wxCharBuffer buf = st.ToAscii() ;
+#else
+        char* buf = st ;
+#endif
+        char* newdata = new char[strlen(buf)+1] ;
+        memcpy( newdata , buf , strlen(buf)+1 ) ;
+        delete[] ((char*) data ) ;
+        data = newdata ;
     }
+
     return data;
 }
 
@@ -234,19 +258,19 @@ bool wxClipboard::AddData( wxDataObject *data )
            {
                wxTextDataObject* textDataObject = (wxTextDataObject*) data;
                wxString str(textDataObject->GetText());
-                wxString mac ;
-                if ( wxApp::s_macDefaultEncodingIsPC )
-                {
-                    mac = wxMacMakeMacStringFromPC(textDataObject->GetText()) ;
-                }
-                else
-                {
-                    mac = textDataObject->GetText() ;
-                }
-                err = UMAPutScrap( mac.Length() , 'TEXT' , (void*) mac.c_str()  ) ;
+               wxCharBuffer buf = wxMacStringToCString( str ) ;
+               err = UMAPutScrap( strlen(buf) , kScrapFlavorTypeText , (void*) buf.data()  ) ;
            }
            break ;
-
+#if wxUSE_UNICODE
+           case wxDF_UNICODETEXT :
+           {
+               wxTextDataObject* textDataObject = (wxTextDataObject*) data;
+               wxString str(textDataObject->GetText());
+               err = UMAPutScrap( str.Length() * sizeof(wxChar) , kScrapFlavorTypeUnicode , (void*) str.wc_str()  ) ;
+           }
+           break ;
+#endif
 #if wxUSE_DRAG_AND_DROP
         case wxDF_METAFILE:
            {
@@ -255,7 +279,7 @@ bool wxClipboard::AddData( wxDataObject *data )
                   wxMetafile metaFile = metaFileDataObject->GetMetafile();
                 PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
                   HLock( (Handle) pict ) ;
-                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , kScrapFlavorTypePicture , *pict ) ;
                   HUnlock(  (Handle) pict ) ;
            }
            break ;
@@ -270,7 +294,7 @@ bool wxClipboard::AddData( wxDataObject *data )
                    pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
 
                   HLock( (Handle) pict ) ;
-                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , 'PICT' , *pict ) ;
+                  err = UMAPutScrap( GetHandleSize(  (Handle) pict ) , kScrapFlavorTypePicture , *pict ) ;
                   HUnlock(  (Handle) pict ) ;
                   if ( created )
                       KillPicture( pict ) ;
index 7d2a6819ea93aff36c36c0f1310ae2c6050770f2..8ffecd04894a536061a63694480cbb66d4aabaed 100644 (file)
@@ -456,7 +456,7 @@ wxString wxComboBox::GetStringSelection() const
     if (sel > -1)
         return wxString(this->GetString (sel));
     else
-        return wxString("");
+        return wxEmptyString;
 }
 
 bool wxComboBox::SetStringSelection(const wxString& sel)
index e12f3f63da10ce989c4c76d65e1840f158e0a0a0..f0dc6ee7a4ebb3c7a08cac8c81aecb31a6c63f6e 100644 (file)
@@ -208,23 +208,9 @@ void wxControl::SetLabel(const wxString& title)
 {
     m_label = wxStripMenuCodes(title) ;
 
-    if ( (ControlHandle) m_macControl )
+    if ( m_macControl )
     {
-        Str255 maclabel ;
-        wxString label ;
-    
-        if( wxApp::s_macDefaultEncodingIsPC )
-            label = wxMacMakeMacStringFromPC( m_label ) ;
-        else
-            label = m_label ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) maclabel , label ) ;
-#else
-        strcpy( (char *) maclabel , label ) ;
-        c2pstr( (char *) maclabel ) ;
-#endif
-        ::SetControlTitle( (ControlHandle) m_macControl , maclabel ) ;
+               UMASetControlTitle( (ControlHandle) m_macControl , m_label ) ;
     }
     Refresh() ;
 }
@@ -311,7 +297,7 @@ void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *contro
 {
     // adding NULL WindowRef is (first) surely a result of an error and
     // (secondly) breaks menu command processing
-    wxCHECK_RET( inControl != (ControlHandle) NULL, "attempt to add a NULL WindowRef to window list" );
+    wxCHECK_RET( inControl != (ControlHandle) NULL, wxT("attempt to add a NULL WindowRef to window list") );
 
     if ( !wxWinMacControlList->Find((long)inControl) )
         wxWinMacControlList->Append((long)inControl, control);
@@ -361,7 +347,7 @@ void wxControl::MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString l
 
 void wxControl::MacPostControlCreate()
 {
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     if ( IsKindOf( CLASSINFO( wxScrollBar ) ) )
     {
@@ -438,6 +424,10 @@ void wxControl::MacPostControlCreate()
     
     SetSize(pos.x, pos.y, new_size.x, new_size.y);
     
+#if wxUSE_UNICODE
+    UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) ) ;
+#endif
+
     UMAShowControl( (ControlHandle) m_macControl ) ;
     
     SetCursor( *wxSTANDARD_CURSOR ) ;
@@ -907,6 +897,6 @@ bool wxControl::MacCanFocus() const
 
 void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) 
 {
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
 }
 
index d6989138909682a871af9056b07771a08e389893..1200fb9c69859474c9fadfedf7d1d3f525b87954 100644 (file)
@@ -292,13 +292,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
     if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
     {
         Str255 theName ;
-
-    #if TARGET_CARBON
-        c2pstrcpy( (StringPtr) theName , cursor_file ) ;
-    #else
-        strcpy( (char *) theName , cursor_file ) ;
-        c2pstr( (char *) theName ) ;
-    #endif
+               wxMacStringToPascal( cursor_file , theName ) ;
         
         wxStAppResource resload ;
         Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
index c1a443a7e5b93ebfe3f788cc7867b21df8cffe56..5949c6300b088c908ee83c8ab1644783dc1fc883 100644 (file)
@@ -1,11 +1,11 @@
 ///////////////////////////////////////////////////////////////////////////////
-// Name:        os2/dataobj.cpp
-// Purpose:     implementation of wx[I]DataObject class
-// Author:      David Webster
+// Name:        mac/dataobj.cpp
+// Purpose:     implementation of wxDataObject class
+// Author:      Stefan Csomor
 // Modified by:
 // Created:     10/21/99
 // RCS-ID:      $Id$
-// Copyright:   (c) 1999 David Webster
+// Copyright:   (c) 1999 Stefan Csomor
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
 
@@ -34,6 +34,7 @@
 #include "wx/mstream.h"
 #include "wx/image.h"
 #include "wx/mac/private.h"
+#include "Scrap.h"
 
 // ----------------------------------------------------------------------------
 // functions
@@ -73,10 +74,12 @@ void wxDataFormat::SetType(  wxDataFormatId  Type )
 {
     m_type = Type;
 
-    if (m_type == wxDF_TEXT)
-        m_format = 'TEXT';
+    if (m_type == wxDF_TEXT )
+        m_format = kScrapFlavorTypeText;
+    else if (m_type == wxDF_UNICODETEXT )
+        m_format = kScrapFlavorTypeUnicode ;
     else if (m_type == wxDF_BITMAP || m_type == wxDF_METAFILE )
-        m_format = 'PICT';
+        m_format = kScrapFlavorTypePicture;
     else if (m_type == wxDF_FILENAME)
         m_format = kDragFlavorTypeHFS ;
     else
@@ -92,18 +95,23 @@ wxDataFormatId wxDataFormat::GetType() const
 
 wxString wxDataFormat::GetId() const
 {
-    wxString sRet("");  // TODO: to name of ( m_format ) );
-    return sRet;
+       char text[5] ;
+       strncpy( text , (char*) m_format , 4 ) ;
+       text[4] = 0 ;
+    return wxString::FromAscii( text ) ;
 }
 
 void wxDataFormat::SetId(  NativeFormat  format )
 {
     m_format = format;
 
-    if (m_format == 'TEXT')
+    if (m_format == kScrapFlavorTypeText)
         m_type = wxDF_TEXT;
     else
-    if (m_format == 'PICT')
+    if (m_format == kScrapFlavorTypeUnicode )
+        m_type = wxDF_UNICODETEXT;
+    else
+    if (m_format == kScrapFlavorTypePicture)
         m_type = wxDF_BITMAP;
     else
     if (m_format == kDragFlavorTypeHFS )
@@ -201,9 +209,7 @@ bool wxFileDataObject::SetData(
 {
     m_filenames.Empty();
 
-    wxString sFile( (const char *)pBuf);  /* char, not wxChar */
-
-    AddFile(sFile);
+    AddFile(wxString::FromAscii((char*)pBuf));
 
     return TRUE;
 }
index ed0648f9dce62ea84b431440f5fc6e33fc4b21ec..9bcf525f260cbaefdb8bea58547b81951be66a6a 100644 (file)
@@ -1111,7 +1111,7 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
     }
     if ( mode == kUnsupportedMode )
     {
-        wxFAIL_MSG("unsupported blitting mode" );
+        wxFAIL_MSG(wxT("unsupported blitting mode" ));
         return FALSE ;
     }
     CGrafPtr            sourcePort = (CGrafPtr) source->m_macPort ;
@@ -1295,17 +1295,10 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     }
     if ( str.Length() == 0 )
         return ;
+        
     wxMacPortSetter helper(this) ;
     MacInstallFont() ;
-    wxString text ;
-    if ( wxApp::s_macDefaultEncodingIsPC )
-    {
-        text = wxMacMakeMacStringFromPC( str ) ;
-    }
-    else
-    {
-        text = str ;
-    }
+
     wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
     if ( 0 )
     {
@@ -1314,23 +1307,30 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         m_macAliasWasEnabled = true ;
     }
     OSStatus status = noErr ;
+    ATSUTextLayout atsuLayout ;
+    UniCharCount chars = str.Length() ;
+#if wxUSE_UNICODE
+    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) (const wxChar*) str , 0 , str.Length() , str.Length() , 1 ,
+        &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
+#else
     TECObjectRef ec;
-    status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
-    wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
+    status = TECCreateConverter(&ec, 
+       wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+       
+    wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
     ByteCount byteOutLen ;
-    ByteCount byteInLen = text.Length() ;
+    ByteCount byteInLen = str.Length() ;
     ByteCount byteBufferLen = byteInLen *2 ;
     char* buf = new char[byteBufferLen] ;
-    status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
+    status = TECConvertText(ec, (ConstTextPtr)str.c_str() , byteInLen, &byteInLen,
         (TextPtr)buf, byteBufferLen, &byteOutLen);
-    wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't convert text") ) ;
     status = TECDisposeConverter(ec);
-    wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
-    ATSUTextLayout atsuLayout ;
-    UniCharCount chars = byteOutLen / 2 ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't dispose converter") ) ;
     status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) buf , 0 , byteOutLen / 2 , byteOutLen / 2 , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
-    wxASSERT_MSG( status == noErr , "couldn't create the layout of the rotated text" );
+#endif
+    wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the rotated text") );
     int iAngle = int( angle );
     int drawX = XLOG2DEVMAC(x) ;
     int drawY = YLOG2DEVMAC(y) ;
@@ -1366,16 +1366,19 @@ void  wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
     drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
     status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
         IntToFixed(drawX) , IntToFixed(drawY) );
-    wxASSERT_MSG( status == noErr , "couldn't draw the rotated text" );
+    wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
     Rect rect ;
     status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
         IntToFixed(drawX) , IntToFixed(drawY) , &rect );
-    wxASSERT_MSG( status == noErr , "couldn't measure the rotated text" );
+    wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
     OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
+#if wxUSE_UNICODE
+#else
     delete[] buf ;
+#endif
 }
 
 void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
@@ -1411,33 +1414,22 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
     {
         ::TextMode( srcCopy ) ;
     }
-    const char *text = NULL ;
-    int length = 0 ;
-    wxString macText ;
-    if ( wxApp::s_macDefaultEncodingIsPC )
-    {
-        macText = wxMacMakeMacStringFromPC( strtext ) ;
-        text = macText ;
-        length = macText.Length() ;
-    }
-    else
-    {
-        text = strtext ;
-        length = strtext.Length() ;
-    }
+    int length = strtext.Length() ;
+
     int laststop = 0 ;
     int i = 0 ;
     int line = 0 ;
     {
         while( i < length )
         {
-            if( text[i] == 13 || text[i] == 10)
+            if( strtext[i] == 13 || strtext[i] == 10)
             {
+               wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
                 if ( useDrawThemeText )
                 {
                     Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                    wxMacCFStringHolder mString( linetext ) ;
                     if ( m_backgroundMode != wxTRANSPARENT )
                     {
                         Point bounds={0,0} ;
@@ -1460,13 +1452,13 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                         &frame,
                         teJustLeft,
                         nil );
-                    CFRelease( mString ) ;
                     line++ ;
                 }
                 else
 #endif
                 {
-                    ::DrawText( text , laststop , i - laststop ) ;
+                                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+                    ::DrawText( text , 0 , strlen(text) ) ;
                     line++ ;
                     ::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
                 }
@@ -1474,11 +1466,12 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
             }
             i++ ;
         }
+        wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
         if ( useDrawThemeText )
         {
             Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading)  ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
-            CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
+            wxMacCFStringHolder mString( linetext ) ;
 
             if ( m_backgroundMode != wxTRANSPARENT )
             {
@@ -1502,13 +1495,13 @@ void  wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
                 &frame,
                 teJustLeft,
                 nil );
-            CFRelease( mString ) ;
         }
         else
 #endif
         {
-            ::DrawText( text , laststop , i - laststop ) ;
-        }
+                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+            ::DrawText( text , 0 , strlen(text) ) ;
+         }
     }
     ::TextMode( srcOr ) ;
 }
@@ -1519,7 +1512,7 @@ bool  wxDC::CanGetTextExtent() const
     return true ;
 }
 
-void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
+void  wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *height,
                             wxCoord *descent, wxCoord *externalLeading ,
                             wxFont *theFont ) const
 {
@@ -1545,8 +1538,9 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         *descent =YDEV2LOGREL( fi.descent );
     if ( externalLeading )
         *externalLeading = YDEV2LOGREL( fi.leading ) ;
+    int length = strtext.Length() ;
+    /*
     const char *text = NULL ;
-    int length = 0 ;
     wxString macText ;
     if ( wxApp::s_macDefaultEncodingIsPC )
     {
@@ -1559,6 +1553,7 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         text = string ;
         length = string.Length() ;
     }
+    */
     int laststop = 0 ;
     int i = 0 ;
     int curwidth = 0 ;
@@ -1567,8 +1562,9 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
         *width = 0 ;
         while( i < length )
         {
-            if( text[i] == 13 || text[i] == 10)
+            if( strtext[i] == 13 || strtext[i] == 10)
             {
+               wxString linetext = strtext.Mid( laststop , i - laststop ) ;
                 if ( height )
                     *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
 #if TARGET_CARBON
@@ -1576,20 +1572,20 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
                 {
                     Point bounds={0,0} ;
                     SInt16 baseline ;
-                    CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+                    wxMacCFStringHolder mString( linetext ) ;
                     ::GetThemeTextDimensions( mString,
                         kThemeCurrentPortFont,
                         kThemeStateActive,
                         false,
                         &bounds,
                         &baseline );
-                    CFRelease( mString ) ;
                     curwidth = bounds.h ;
                 }
                 else
 #endif
                 {
-                    curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+                       curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
                 }
                 if ( curwidth > *width )
                     *width = XDEV2LOGREL( curwidth ) ;
@@ -1598,25 +1594,26 @@ void  wxDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *he
             i++ ;
         }
         
+        wxString linetext = strtext.Mid( laststop , i - laststop ) ;
 #if TARGET_CARBON
         if ( useGetThemeText )
         {
             Point bounds={0,0} ;
             SInt16 baseline ;
-            CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
+            wxMacCFStringHolder mString( linetext ) ;
             ::GetThemeTextDimensions( mString,
                 kThemeCurrentPortFont,
                 kThemeStateActive,
                 false,
                 &bounds,
                 &baseline );
-            CFRelease( mString ) ;
             curwidth = bounds.h ;
         }
         else
 #endif
         {
-            curwidth = ::TextWidth( text , laststop , i - laststop ) ;
+                       wxCharBuffer text = wxMacStringToCString(linetext) ; 
+            curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
         }
         if ( curwidth > *width )
             *width = XDEV2LOGREL( curwidth ) ;
@@ -1773,7 +1770,7 @@ void wxDC::MacInstallFont() const
     Style qdStyle = font->m_macFontStyle ;
     ATSUFontID    atsuFont = font->m_macATSUFontID ;
     status = ::ATSUCreateStyle(&(ATSUStyle)m_macATSUIStyle) ;
-    wxASSERT_MSG( status == noErr , "couldn't create ATSU style" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't create ATSU style") ) ;
     ATSUAttributeTag atsuTags[] =
     {
         kATSUFontTag ,
@@ -1819,7 +1816,7 @@ void wxDC::MacInstallFont() const
     } ;
     status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
         atsuTags, atsuSizes, atsuValues);
-    wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
 }
 
 Pattern gHatchPatterns[] =
index 82bdecd0cfb56b8186f465850e6375aa398e94c1..a841324bd36ca643c2dca7d5b6d06aa566eecd91 100644 (file)
@@ -62,8 +62,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     if ( err != noErr )
 #endif
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
 #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease( m_macPrintSessionPort ) ;
@@ -88,8 +88,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         UMAPrClose(NULL) ;
         m_ok = FALSE;
@@ -150,8 +150,8 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
     err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -234,8 +234,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     err = PrError() ;
     if ( err )
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         UMAPrClose(NULL) ;
         m_ok = FALSE;
@@ -258,8 +258,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
   #endif
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -280,8 +280,8 @@ bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
     err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
     if ( err != noErr )
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if TARGET_CARBON && PM_USE_SESSION_APIS
         PMRelease(&m_macPrintSessionPort) ;
@@ -321,8 +321,8 @@ void wxPrinterDC::EndDoc(void)
   #endif
          if ( err != noErr )
          {
-            message.Printf( "Print Error %d", err ) ;
-            wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+            message.Printf( wxT("Print Error %d"), err ) ;
+            wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
             dialog.ShowModal();
          }
     }
@@ -363,8 +363,8 @@ void wxPrinterDC::StartPage(void)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
            ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
         ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
@@ -382,8 +382,8 @@ void wxPrinterDC::StartPage(void)
   #endif
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if PM_USE_SESSION_APIS
            PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
@@ -421,8 +421,8 @@ void wxPrinterDC::EndPage(void)
     err = PrError() ;
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld") , err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
         ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort  ) ;
         ::UMAPrClose(NULL) ;
@@ -437,8 +437,8 @@ void wxPrinterDC::EndPage(void)
   #endif
     if ( err != noErr )
     {
-        message.Printf( "Print Error %ld", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %ld"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
   #if PM_USE_SESSION_APIS
         PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
index 686405423442d2f944726f597cb2fe81a25d904a..0b4c7df19566e52d9da444682f494bada976329b 100644 (file)
@@ -40,7 +40,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
                          const wxSize& WXUNUSED(size),
                          const wxString& WXUNUSED(name))
 {
-    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
@@ -92,7 +92,7 @@ int wxDirDialog::ShowModal()
                         0L);                            // User Data
     
     if ( (err != noErr) && (err != userCanceledErr) ) {
-        m_path = "" ;
+        m_path = wxT("") ;
         return wxID_CANCEL ;
     }
 
@@ -104,7 +104,7 @@ int wxDirDialog::ShowModal()
         
         OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
         if ( err != noErr ) {
-            m_path = "" ;
+            m_path = wxT("") ;
             return wxID_CANCEL ;
         }            
         folderInfo = **(FSSpec**) specDesc.dataHandle;
@@ -130,7 +130,7 @@ int wxDirDialog::ShowModal()
         
         err = ::PBGetCatInfoSync(&thePB);
         if ( err != noErr ) {
-            m_path = "" ;
+            m_path = wxT("")  ;
             return wxID_CANCEL ;
         }            
                                             // Create cannonical FSSpec
index 9ea9415df48423cec0c40edba9b8af9045c6b541..ff168bafdc552519c5b3fa534f0db7537ebf3110 100644 (file)
@@ -133,7 +133,7 @@ wxDirData::wxDirData(const wxString& dirname)
 
     err = FSpGetDirectoryID( &fsspec , &m_dirId , &m_isDir ) ;
 #endif
-    wxASSERT_MSG( (err == noErr) || (err == nsvErr) , "Error accessing directory " + m_dirname) ;
+    wxASSERT_MSG( (err == noErr) || (err == nsvErr) , wxT("Error accessing directory " + m_dirname)) ;
 
     m_CPB.hFileInfo.ioNamePtr = m_name ;
     m_index = 0 ;
@@ -153,9 +153,6 @@ bool wxDirData::Read(wxString *filename)
     if ( !m_isDir )
         return FALSE ;
         
-#if TARGET_CARBON
-    char c_name[256] ;
-#endif
     wxString result;
 
     short err = noErr ;
@@ -169,18 +166,12 @@ bool wxDirData::Read(wxString *filename)
         if ( err != noErr )
             break ;
         
-#if TARGET_CARBON
-        p2cstrcpy( c_name, m_name ) ;
-        strcpy( (char *)m_name, c_name);
-#else
-        p2cstr( m_name ) ;
-#endif
         // its hidden but we don't want it
         if ( ( m_CPB.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible ) && !(m_flags & wxDIR_HIDDEN) )
             continue ;
 #ifdef __DARWIN__
         // under X, names that start with '.' are hidden
-        if ( ( m_name[0] == '.' ) && !(m_flags & wxDIR_HIDDEN) )
+        if ( ( m_name[1] == '.' ) && !(m_flags & wxDIR_HIDDEN) )
             continue;
 #endif
 #if TARGET_CARBON
@@ -196,18 +187,18 @@ bool wxDirData::Read(wxString *filename)
         if ( ( m_CPB.dirInfo.ioFlAttrib & ioDirMask) == 0 && !(m_flags & wxDIR_FILES ) )
             continue ;
         
-        wxString file( m_name ) ;
-        if ( m_filespec.IsEmpty() || m_filespec == "*.*" || m_filespec == "*" )
+        wxString file = wxMacMakeStringFromPascal( m_name ) ;
+        if ( m_filespec.IsEmpty() || m_filespec == wxT("*.*") || m_filespec == wxT("*") )
         {
         }
-        else if ( m_filespec.Length() > 1 && m_filespec.Left(1) =="*" )
+        else if ( m_filespec.Length() > 1 && m_filespec.Left(1) == wxT("*") )
         {
             if ( file.Right( m_filespec.Length() - 1 ).Upper() != m_filespec.Mid(1).Upper() )
             {
                 continue ;
             }
         }
-        else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == "*" )
+        else if ( m_filespec.Length() > 1 && m_filespec.Right(1) == wxT("*") )
         {
             if ( file.Left( m_filespec.Length() - 1 ).Upper() != m_filespec.Left( m_filespec.Length() - 1 ).Upper() )
             {
@@ -226,7 +217,7 @@ bool wxDirData::Read(wxString *filename)
         return FALSE ;
     }
     
-    *filename = (char*) m_name ;
+    *filename = wxMacMakeStringFromPascal( m_name )  ;
 
     return TRUE;
 }
index 2ea8ae7c90613b426f53d972f85f282e7486c7ff..d4eb35abba7cd2728476b3fe365bce1bba8e3390 100644 (file)
@@ -205,12 +205,9 @@ bool wxDropTarget::GetData()
                         GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L); 
                         if( theType == 'TEXT' )
                         {
-                            theData[dataSize]=0 ;       
-                            if ( wxApp::s_macDefaultEncodingIsPC )
-                            {
-                                wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
-                            }
-                            m_dataObject->SetData( format, dataSize, theData );
+                            theData[dataSize]=0 ; 
+                            wxString convert = wxMacMakeStringFromCString( theData ) ;    
+                            m_dataObject->SetData( format, convert.Length() * sizeof(wxChar), (const wxChar*) convert );
                         }
                         else if ( theType == kDragFlavorTypeHFS )
                         {
@@ -303,11 +300,10 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
         if ( type == 'TEXT' )
         {
             dataSize-- ;
-            if ( wxApp::s_macDefaultEncodingIsPC )
-            {
-                wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
-            }
-            AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
+            dataPtr[ dataSize ] = 0 ;
+            wxString st( (wxChar*) dataPtr ) ;
+            wxCharBuffer buf = wxMacStringToCString( st ) ;
+            AddDragItemFlavor(theDrag, theItem, type , buf.data(), strlen(buf), 0);
         }
         else if (type == kDragFlavorTypeHFS )
         {
index 5a65441f23848a40d30219aed320d939a04147d9..f2b6707baf85faf9bd0c4f6afbe7046a3f4c1d16 100644 (file)
@@ -104,13 +104,12 @@ NavEventProc(
                 Str255 filename ;
                 // get the current filename
                 NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
-                CopyPascalStringToC( filename , (char*) filename ) ;
-                wxString sfilename( filename ) ;
+                wxString sfilename = wxMacMakeStringFromPascal( filename ) ;
                 int pos = sfilename.Find('.',TRUE) ;
                 if ( pos != wxNOT_FOUND )
                 {
                     sfilename = sfilename.Left(pos+1)+extension ;
-                    CopyCStringToPascal( sfilename.c_str() , filename ) ;
+                    wxMacStringToPascal( sfilename , filename ) ;
                     NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
                 }
             }
@@ -118,11 +117,11 @@ NavEventProc(
     }
 }
 
-const char * gfilters[] =
+const wxChar * gfilters[] =
 {
-    "*.TXT" ,
-    "*.TIF" ,
-    "*.JPG" ,
+    wxT("*.TXT") ,
+    wxT("*.TIF") ,
+    wxT("*.JPG") ,
     
     NULL 
 } ;
@@ -162,7 +161,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
                     ++filterIndex ;
                 }
                 isName = !isName ;
-                current = "" ;
+                current = wxEmptyString ;
             }
             else
             {
@@ -172,7 +171,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
         // we allow for compatibility reason to have a single filter expression (like *.*) without
         // an explanatory text, in that case the first part is name and extension at the same time
         
-        wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
+        wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
         if ( current.IsEmpty() )
             myData->extensions.Add( myData->name[filterIndex] ) ;
         else
@@ -189,7 +188,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
             int j ;
             for ( j = 0 ; gfilters[j] ; j++ )
             {
-                if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
+                if ( myData->extensions[i] == gfilters[j]  )
                 {
                     myData->filtermactypes.Add( gfiltersmac[j] ) ;
                     break ;
@@ -205,6 +204,7 @@ void MakeUserDataRec(OpenUserDataRec    *myData , const wxString& filter )
 
 static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
 {
+/*
     Str255             filename ;
     
 #if TARGET_CARBON
@@ -214,20 +214,22 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
     p2cstr( filename ) ;
 #endif
     wxString file(filename) ;
+*/
+       wxString file = wxMacMakeStringFromPascal( name ) ;
     file.MakeUpper() ;
     
     if ( data->extensions.GetCount() > 0 )
     {
         //for ( int i = 0 ; i < data->numfilters ; ++i )
         int i = data->currentfilter ;
-        if ( data->extensions[i].Right(2) == ".*" )
+        if ( data->extensions[i].Right(2) == wxT(".*") )
             return true ;
         
         {
             if ( type == (OSType)data->filtermactypes[i] )
                 return true ;
             
-            wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
+            wxStringTokenizer tokenizer( data->extensions[i] , wxT(";") ) ;
             while( tokenizer.HasMoreTokens() )
             {
                 wxString extension = tokenizer.GetNextToken() ;
@@ -272,17 +274,17 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat
 
 // end wxmac
 
-wxString wxFileSelector(const char *title,
-                     const char *defaultDir, const char *defaultFileName,
-                     const char *defaultExtension, const char *filter, int flags,
+wxString wxFileSelector(const wxChar *title,
+                     const wxChar *defaultDir, const wxChar *defaultFileName,
+                     const wxChar *defaultExtension, const wxChar *filter, int flags,
                      wxWindow *parent, int x, int y)
 {
     // If there's a default extension specified but no filter, we create a suitable
     // filter.
 
-    wxString filter2("");
+    wxString filter2;
     if ( defaultExtension && !filter )
-        filter2 = wxString("*.") + wxString(defaultExtension) ;
+        filter2 = wxString(wxT("*.")) + wxString(defaultExtension) ;
     else if ( filter )
         filter2 = filter;
 
@@ -290,13 +292,13 @@ wxString wxFileSelector(const char *title,
     if (defaultDir)
         defaultDirString = defaultDir;
     else
-        defaultDirString = "";
+        defaultDirString = wxEmptyString ;
 
     wxString defaultFilenameString;
     if (defaultFileName)
         defaultFilenameString = defaultFileName;
     else
-        defaultFilenameString = "";
+        defaultFilenameString = wxEmptyString;
 
     wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString, filter2, flags, wxPoint(x, y));
 
@@ -308,19 +310,19 @@ wxString wxFileSelector(const char *title,
         return wxGetEmptyString();
 }
 
-WXDLLEXPORT wxString wxFileSelectorEx(const char *title,
-                       const char *defaultDir,
-                       const char *defaultFileName,
+WXDLLEXPORT wxString wxFileSelectorEx(const wxChar *title,
+                       const wxChar *defaultDir,
+                       const wxChar *defaultFileName,
                        int* defaultFilterIndex,
-                       const char *filter,
+                       const wxChar *filter,
                        int       flags,
                        wxWindow* parent,
                        int       x,
                        int       y)
 
 {
-    wxFileDialog fileDialog(parent, title ? title : "", defaultDir ? defaultDir : "",
-        defaultFileName ? defaultFileName : "", filter ? filter : "", flags, wxPoint(x, y));
+    wxFileDialog fileDialog(parent, title ? title : wxT(""), defaultDir ? defaultDir : wxT(""),
+        defaultFileName ? defaultFileName : wxT(""), filter ? filter : wxT(""), flags, wxPoint(x, y));
 
     if ( fileDialog.ShowModal() == wxID_OK )
     {
@@ -335,18 +337,17 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
         const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
         long style, const wxPoint& pos)
 {
-    wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
+    wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
     m_message = message;
     m_dialogStyle = style;
     m_parent = parent;
-    m_path = "";
+    m_path = wxT("");
     m_fileName = defaultFileName;
     m_dir = defaultDir;
     m_wildCard = wildCard;
     m_filterIndex = 0;
 }
 
-
 pascal Boolean CrossPlatformFilterCallback (
     AEDesc *theItem, 
     void *info, 
@@ -417,19 +418,8 @@ int wxFileDialog::ShowModal()
             mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
         }
     }
-        
-#if TARGET_CARBON
-    c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
-#else
-    strcpy((char *)mNavOptions.message, m_message) ;
-    c2pstr((char *)mNavOptions.message ) ;
-#endif
-#if TARGET_CARBON
-    c2pstrcpy((StringPtr)mNavOptions.savedFileName, m_fileName) ;
-#else
-    strcpy((char *)mNavOptions.savedFileName, m_fileName) ;
-    c2pstr((char *)mNavOptions.savedFileName ) ;
-#endif
+    wxMacStringToPascal( m_message , (StringPtr)mNavOptions.message ) ;
+    wxMacStringToPascal( m_fileName , (StringPtr)mNavOptions.savedFileName ) ;
 
     // zero all data
     
@@ -450,12 +440,7 @@ int wxFileDialog::ShowModal()
             (*mNavOptions.popupExtension)[i].version     = kNavMenuItemSpecVersion ;
             (*mNavOptions.popupExtension)[i].menuCreator = 'WXNG' ;
             (*mNavOptions.popupExtension)[i].menuType    = i ;
-#if TARGET_CARBON
-            c2pstrcpy((StringPtr)(*mNavOptions.popupExtension)[i].menuItemName, myData.name[i]) ;
-#else
-            strcpy((char *)(*mNavOptions.popupExtension)[i].menuItemName, myData.name[i]) ;
-            c2pstr((char *)(*mNavOptions.popupExtension)[i].menuItemName ) ;
-#endif
+            wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ;
         }
     }
     if ( m_dialogStyle & wxSAVE )
@@ -519,7 +504,7 @@ int wxFileDialog::ShowModal()
         {
             OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
             if ( err != noErr ) {
-                m_path = "" ;
+                m_path = wxT("") ;
                 return wxID_CANCEL ;
             }            
             outFileSpec = **(FSSpec**) specDesc.dataHandle;
@@ -543,28 +528,30 @@ int wxFileDialog::ShowModal()
 
 // Generic file load/save dialog
 static wxString
-wxDefaultFileSelector(bool load, const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxDefaultFileSelector(bool load, const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
-    char *ext = (char *)extension;
-    
-    char prompt[50];
+    wxString prompt;
+
     wxString str;
     if (load)
-        str = "Load %s file";
+        str = wxT("Load %s file");
     else
-        str = "Save %s file";
-    sprintf(prompt, wxGetTranslation(str), what);
+        str = wxT("Save %s file");
+    prompt.Printf( wxGetTranslation(str), what);
     
-    if (*ext == '.') ext++;
-    char wild[60];
-    sprintf(wild, "*.%s", ext);
+    const wxChar *ext = extension;
+    if (*ext == wxT('.'))
+        ext++;
+
+    wxString wild;
+    wild.Printf(wxT("*.%s"), ext);
     
     return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
 }
 
 // Generic file load dialog
 wxString
-wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxLoadFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
     return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
 }
@@ -572,9 +559,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
 
 // Generic file save dialog
 wxString
-wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
+wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name, wxWindow *parent)
 {
     return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
 }
-
-
index e134003482a5b61f689b823db36d2135eeedd0a2..5ffa4f828b8f3f68b60d63cbe33fe207fee51c67 100644 (file)
@@ -67,7 +67,7 @@ wxFontRefData::~wxFontRefData()
 
 void wxFontRefData::MacFindFont()
 {
-    if( m_faceName == "" )
+    if( m_faceName.Length() == 0 )
     {
         switch( m_family )
         {
@@ -92,14 +92,13 @@ void wxFontRefData::MacFindFont()
         }
         Str255 name ;
         GetFontName( m_macFontNum , name ) ;
-        CopyPascalStringToC( name , (char*) name ) ;
-        m_faceName = (char*) name ;
+        m_faceName = wxMacMakeStringFromPascal( name ) ;
     }
     else
     {
-        if ( m_faceName == "systemfont" )
+        if ( m_faceName == wxT("systemfont") )
             m_macFontNum = ::GetSysFont() ;
-        else if ( m_faceName == "applicationfont" )
+        else if ( m_faceName == wxT("applicationfont") )
             m_macFontNum = ::GetAppFont() ;
         else
         {
@@ -126,7 +125,7 @@ void wxFontRefData::MacFindFont()
     status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
         kFontFullName,    kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage  ,  (UInt32*)&m_macATSUFontID ) ;
     */
-    wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
+    wxASSERT_MSG( status == noErr , wxT("couldn't retrieve font identifier") ) ;
 }
 
 // ----------------------------------------------------------------------------
index 1a61e4f72378546570d84cdc7b25db76bba3a708..de7dd8c90c9b14a848fe061486751cde114fb10a 100644 (file)
@@ -40,7 +40,7 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
         size = wxSize( 200 , 16 ) ;
     }
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range, 
         kControlProgressBarProc , (long) this ) ;
index aca2b5be13ec45b924385f45939a9cbe27a7691d..e66592a619c80771f26a3d5f4da536ea31f33b9f 100644 (file)
@@ -91,7 +91,7 @@ void wxGLContext::Update()
     }
 }
 
-void wxGLContext::SetColour(const char *colour)
+void wxGLContext::SetColour(const wxChar *colour)
 {
     float r = 0.0;
     float g = 0.0;
@@ -309,7 +309,7 @@ void wxGLCanvas::SetCurrent()
     }
 }
 
-void wxGLCanvas::SetColour(const char *colour)
+void wxGLCanvas::SetColour(const wxChar *colour)
 {
     if (m_glContext)
         m_glContext->SetColour(colour);
index ef4526a6705916e0a4a04c720f8287c3701a074f..bd1937bc2a45dba54274849335887c399a7832f3 100644 (file)
@@ -83,19 +83,19 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
                                       int desiredWidth, int desiredHeight)
 {
     short theId = -1 ;
-    if ( name == "wxICON_INFORMATION" )
+    if ( name == wxT("wxICON_INFORMATION") )
     {
         theId = kNoteIcon ;
     }
-    else if ( name == "wxICON_QUESTION" )
+    else if ( name == wxT("wxICON_QUESTION") )
     {
         theId = kCautionIcon ;
     }
-    else if ( name == "wxICON_WARNING" )
+    else if ( name == wxT("wxICON_WARNING") )
     {
         theId = kCautionIcon ;
     }
-    else if ( name == "wxICON_ERROR" )
+    else if ( name == wxT("wxICON_ERROR") )
     {
         theId = kStopIcon ;
     }
@@ -103,13 +103,7 @@ bool  wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
     {
         Str255 theName ;
         OSType theType ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) theName , name ) ;
-#else
-        strcpy( (char *) theName , name ) ;
-        c2pstr( (char *) theName ) ;
-#endif
+        wxMacStringToPascal( name , theName ) ;
         
         Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
         if ( resHandle != 0L )
index 6a45f419fdc0a85c422b9a1e68fda81f0f7bdeff..156b9b26570395a30a0686d8e3dda3480fdc2f02 100644 (file)
@@ -113,7 +113,7 @@ int wxJoystick::GetProductId() const
 wxString wxJoystick::GetProductName() const
 {
     // TODO
-    return wxString("");
+    return wxString(wxT(""));
 }
 
 int wxJoystick::GetXMin() const
index 2d7dff4fbcea8bdc3ad2b4f73c6e89a2ab90bd6f..12e2c048bb05dd97ae0c5ad503b6cfd6a552c9cc 100644 (file)
@@ -94,7 +94,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
         
     case lDrawMsg:
         {
-            const wxString text = list->m_stringArray[cell.v] ;
+            const wxString linetext = list->m_stringArray[cell.v] ;
             
             //  Save the current clip region, and set the clip region to the area we are about
             //  to draw.
@@ -121,32 +121,27 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
             }
             
 #if TARGET_CARBON
-            bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-            
-               if ( useDrawThemeText )
-               {
-                Rect frame = { drawRect->top, drawRect->left + 4,
-                    drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
-                CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
-                CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
-                CFRelease( sString ) ;
-                ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
-                ::DrawThemeTextBox( mString,
-                    kThemeCurrentPortFont,
-                    kThemeStateActive,
-                    false,
-                    &frame,
-                    teJustLeft,
-                    nil );
-                CFRelease( mString ) ;
-            }
-            else
-#endif
-            {
+                       {
+                               Rect frame = { drawRect->top, drawRect->left + 4,
+                                   drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
+                               CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext) ) ;
+                               ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
+                               ::DrawThemeTextBox( mString,
+                                   kThemeCurrentPortFont,
+                                   kThemeStateActive,
+                                   false,
+                                   &frame,
+                                   teJustLeft,
+                                   nil );
+                               CFRelease( mString ) ;
+                       }
+#else
+            {  
+               wxCharBuffer text = wxMacStringToCString( linetext ) ;
                 MoveTo(drawRect->left + 4 , drawRect->top + 10 );
-                DrawText(text, 0 , text.Length());
+                DrawText(text, 0 , strlen(text) );
             }
-            
+#endif            
             //  If the cell is hilited, do the hilite now. Paint the cell contents with the
             //  appropriate QuickDraw transform mode.
             
@@ -213,7 +208,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
     
     ListDefSpec listDef;
     listDef.defType = kListDefUserProcType;
@@ -234,8 +229,7 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
     fontSize = 9 ;
     fontStyle = normal ;
 #endif 
-    CopyPascalStringToC( fontName , (char*) fontName ) ;
-    SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
+    SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , wxMacMakeStringFromPascal( fontName ) ) ) ;
 #if TARGET_CARBON
     Size asize;
 
@@ -388,15 +382,8 @@ void wxListBox::Delete(int N)
 int wxListBox::DoAppend(const wxString& item)
 {
     int index = m_noItems ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        m_stringArray.Add( wxMacMakeMacStringFromPC( item ) ) ;
-        m_dataArray.Add( NULL );
-    }
-    else {
-        m_stringArray.Add( item ) ;
-        m_dataArray.Add( NULL );
-    }
+    m_stringArray.Add( item ) ;
+    m_dataArray.Add( NULL );
     m_noItems ++;
     DoSetItemClientData( index , NULL ) ;
     MacAppend( item ) ;
@@ -451,47 +438,30 @@ bool wxListBox::HasMultipleSelection() const
     return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
 }
 
-int wxListBox::FindString(const wxString& st) const
+int wxListBox::FindString(const wxString& s) const
 {
-    wxString s ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        s = wxMacMakeMacStringFromPC( st ) ;
-    }
-    else
-        s = st ;
     
-    if ( s.Right(1) == "*" )
+    if ( s.Right(1) == wxT("*") )
     {
         wxString search = s.Left( s.Length() - 1 ) ;
         int len = search.Length() ;
         Str255 s1 , s2 ;
-        
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
-#else
-        strcpy( (char *) s2 , search.c_str() ) ;
-        c2pstr( (char *) s2 ) ;
-#endif
+        wxMacStringToPascal( search , s2 ) ;
         
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
-#if TARGET_CARBON
-            c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ;
-#else
-            strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ;
-            c2pstr( (char *) s1 ) ;
-#endif
+               wxMacStringToPascal( m_stringArray[i].Left( len ) , s1 ) ;
+
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
-        if ( s.Left(1) == "*" && s.Length() > 1 )
+        if ( s.Left(1) == wxT("*") && s.Length() > 1 )
         {
-            s = st ;
-            s.MakeLower() ;
+            wxString st = s ;
+            st.MakeLower() ;
             for ( int i = 0 ; i < m_noItems ; ++i )
             {
-                if ( GetString(i).Lower().Matches(s) )
+                if ( GetString(i).Lower().Matches(st) )
                     return i ;
             }
         }
@@ -501,21 +471,12 @@ int wxListBox::FindString(const wxString& st) const
     {
         Str255 s1 , s2 ;
         
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
-#else
-        strcpy( (char *) s2 , s.c_str() ) ;
-        c2pstr( (char *) s2 ) ;
-#endif
+        wxMacStringToPascal( s , s2 ) ;
         
         for ( int i = 0 ; i < m_noItems ; ++ i )
         {
-#if TARGET_CARBON
-            c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ;
-#else
-            strcpy( (char *) s1 , m_stringArray[i].c_str() ) ;
-            c2pstr( (char *) s1 ) ;
-#endif
+               wxMacStringToPascal( m_stringArray[i] , s1 ) ;
+
             if ( EqualString( s1 , s2 , false , false ) )
                 return i ;
         }
@@ -535,7 +496,7 @@ void wxListBox::Clear()
 void wxListBox::SetSelection(int N, bool select)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-        "invalid index in wxListBox::SetSelection" );
+        wxT("invalid index in wxListBox::SetSelection") );
     MacSetSelection( N , select ) ;
     GetSelections( m_selectionPreImage ) ;
 }
@@ -543,7 +504,7 @@ void wxListBox::SetSelection(int N, bool select)
 bool wxListBox::IsSelected(int N) const
 {
     wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
-        "invalid index in wxListBox::Selected" );
+        wxT("invalid index in wxListBox::Selected") );
     
     return MacIsSelected( N ) ;
 }
@@ -564,7 +525,7 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
 void wxListBox::DoSetItemClientData(int N, void *Client_data)
 {
     wxCHECK_RET( N >= 0 && N < m_noItems,
-        "invalid index in wxListBox::SetClientData" );
+        wxT("invalid index in wxListBox::SetClientData") );
     
 #if wxUSE_OWNER_DRAWN
     if ( m_windowStyle & wxLB_OWNERDRAW )
@@ -574,7 +535,7 @@ void wxListBox::DoSetItemClientData(int N, void *Client_data)
         wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
     }
 #endif // wxUSE_OWNER_DRAWN
-    wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , "invalid client_data array" ) ;
+    wxASSERT_MSG( m_dataArray.GetCount() >= (size_t) N , wxT("invalid client_data array") ) ;
     
     if ( m_dataArray.GetCount() > (size_t) N )
     {
@@ -606,12 +567,7 @@ int wxListBox::GetSelection() const
 // Find string for position
 wxString wxListBox::GetString(int N) const
 {
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        return      wxMacMakePCStringFromMac( m_stringArray[N] ) ;
-    }
-    else
-        return m_stringArray[N]  ;
+       return m_stringArray[N]  ;
 }
 
 void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
@@ -633,14 +589,7 @@ void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
 
 void wxListBox::SetString(int N, const wxString& s)
 {
-    wxString str ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        str = wxMacMakeMacStringFromPC( s )  ;
-    }
-    else
-        str = s ;
-    m_stringArray[N] = str ;
+    m_stringArray[N] = s ;
     MacSet( N , s ) ;
 }
 
@@ -754,7 +703,7 @@ void wxListBox::MacDelete( int N )
     Refresh();
 }
 
-void wxListBox::MacInsert( int n , const char * text)
+void wxListBox::MacInsert( int n , const wxString& text)
 {
     Cell cell = { 0 , 0 } ;
     cell.v = n ;
@@ -763,7 +712,7 @@ void wxListBox::MacInsert( int n , const char * text)
     Refresh();
 }
 
-void wxListBox::MacAppend( const char * text)
+void wxListBox::MacAppend( const wxString& text)
 {
     Cell cell = { 0 , 0 } ;
     cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
@@ -834,7 +783,7 @@ int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
     return no_sel ;
 }
 
-void wxListBox::MacSet( int n , const char * text )
+void wxListBox::MacSet( int n , const wxString& text )
 {
     // our implementation does not store anything in the list
     // so we just have to redraw
@@ -1011,11 +960,11 @@ void wxListBox::OnChar(wxKeyEvent& event)
     {
         if ( event.GetTimestamp() > m_lastTypeIn + 60 )
         {
-            m_typeIn = "" ;
+            m_typeIn = wxEmptyString ;
         }
         m_lastTypeIn = event.GetTimestamp() ;
         m_typeIn += (char) event.GetKeyCode() ;
-        int line = FindString("*"+m_typeIn+"*") ;
+        int line = FindString(wxT("*")+m_typeIn+wxT("*")) ;
         if ( line >= 0 )
         {
             if ( GetSelection() != line )
index b6a170c8ee6b5ac400b66cee34e074c8ccc8d8be..36d7fb3e614bfa2c7c8d62471120b8ae31476e8d 100644 (file)
@@ -88,7 +88,7 @@ void wxMacAddEvent(
     short wakeUp ) 
 {
     wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
-    wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
+    wxASSERT_MSG( handler != NULL , wxT("illegal notification proc ptr") ) ;
     /* this should be protected eventually */
     short index = e->top++ ;
     
index cc0aba9ed15893007799ae9e9bee914fa5fd4a28..417240fc0968f99b553ad42ba4cf74bf971006a8 100644 (file)
@@ -107,7 +107,7 @@ void wxMenu::Attach(wxMenuBarBase *menubar)
 // append a new item or submenu to the menu
 bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
 {
-    wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
+    wxASSERT_MSG( pItem != NULL, wxT("can't append NULL item to the menu") );
 
     if ( pItem->IsSeparator() )
     {
@@ -121,7 +121,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
         wxMenu *pSubMenu = pItem->GetSubMenu() ;
         if ( pSubMenu != NULL )
         {
-               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
+               wxASSERT_MSG( pSubMenu->m_hMenu != NULL , wxT("invalid submenu added"));
             pSubMenu->m_menuParent = this ;
         
             if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar) 
@@ -140,12 +140,12 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
         {
             if ( pos == (size_t)-1 )
             {
-                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
+                UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") );
                 pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
             }
             else
             {
-                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
+                UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos);
             }
 
             SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
@@ -503,7 +503,7 @@ void wxMenuBar::MacInstallMenuBar()
         
     Handle menubar = ::GetNewMBar( kwxMacMenuBarResource ) ;
     wxString message ;
-    wxCHECK_RET( menubar != NULL, "can't read MBAR resource" );
+    wxCHECK_RET( menubar != NULL, wxT("can't read MBAR resource") );
     ::SetMenuBar( menubar ) ;
 #if TARGET_API_MAC_CARBON
     ::DisposeMenuBar( menubar ) ;
@@ -550,7 +550,7 @@ void wxMenuBar::MacInstallMenuBar()
         int pos ;
         wxMenu* menu = m_menus[i] , *subMenu = NULL ;
 
-        if( m_titles[i] == "?" || m_titles[i] == "&?"  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
+        if( m_titles[i] == wxT("?") || m_titles[i] == wxT("&?")  || m_titles[i] == wxApp::s_macHelpMenuTitleName )
         {
             if ( mh == NULL )
             {
index ce04c08eda6796d67935ecfa83f9c6ae1cc5f4af..807f2a8ee0903f4da8229c380fd475f7e1df368f 100644 (file)
@@ -48,9 +48,9 @@ wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
 {
     // In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
     // therefore these item must not be translated
-    if ( wxStripMenuCodes(m_text).Upper() ==  "EXIT" )
+    if ( wxStripMenuCodes(m_text).Upper() ==  wxT("EXIT") )
     {
-        m_text = "Quit\tCtrl+Q" ;
+        m_text =wxT("Quit\tCtrl+Q") ;
     }
 
     m_radioGroup.start = -1;
@@ -152,7 +152,7 @@ void wxMenuItem::UncheckRadio()
 
 void wxMenuItem::Check(bool bDoCheck)
 {
-    wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
+    wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
 
     if ( m_isChecked != bDoCheck ) 
     {
index 1f87cb9f4a76c3e472673b1a1da235ffed71805d..aca4bc0ae5b233e18a9c5c17177a2da896b1cda2 100644 (file)
@@ -72,7 +72,7 @@ wxMetaFile::wxMetaFile(const wxString& file)
 
 
     M_METAFILEDATA->m_metafile = 0;
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet") ) ;
 /*
     if (!file.IsNull() && (file.Cmp("") == 0))
         M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
@@ -145,9 +145,9 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
     m_maxX = -10000;
     m_maxY = -10000;
     
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet") ) ;
     
-    m_metaFile = new wxMetaFile("") ;
+    m_metaFile = new wxMetaFile(wxEmptyString) ;
     Rect r={0,0,1000,1000} ;
     
     m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
@@ -167,9 +167,9 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, i
     m_maxX = -10000;
     m_maxY = -10000;
     
-    wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
+    wxASSERT_MSG( file.IsEmpty() , wxT("no file based metafile support yet")) ;
     
-    m_metaFile = new wxMetaFile("") ;
+    m_metaFile = new wxMetaFile(wxEmptyString) ;
     Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
     
     m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
index 393c2870c47dd825c13d1d035b961c6afe7317b4..296c7a81baebad9a1b5b0f6a37569c63055fe88b 100644 (file)
@@ -129,66 +129,66 @@ wxMimeTypesManagerImpl::GetFileTypeFromExtension(const wxString& e)
 {
     wxString ext = e ;
     ext = ext.Lower() ;
-    if ( ext == "txt" )
+    if ( ext == wxT("txt") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("text/text");
+        fileType->m_impl->SetFileType(wxT("text/text"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "htm" || ext == "html" )
+    else if ( ext == wxT("htm") || ext == wxT("html") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("text/html");
+        fileType->m_impl->SetFileType(wxT("text/html"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "gif" )
+    else if ( ext == wxT("gif") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/gif");
+        fileType->m_impl->SetFileType(wxT("image/gif"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "png" )
+    else if ( ext == wxT("png" ))
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/png");
+        fileType->m_impl->SetFileType(wxT("image/png"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "jpg" || ext == "jpeg" )
+    else if ( ext == wxT("jpg" )|| ext == wxT("jpeg") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/jpeg");
+        fileType->m_impl->SetFileType(wxT("image/jpeg"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "bmp" )
+    else if ( ext == wxT("bmp") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/bmp");
+        fileType->m_impl->SetFileType(wxT("image/bmp"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "tif" || ext == "tiff" )
+    else if ( ext == wxT("tif") || ext == wxT("tiff") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/tiff");
+        fileType->m_impl->SetFileType(wxT("image/tiff"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "xpm" )
+    else if ( ext == wxT("xpm") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/xpm");
+        fileType->m_impl->SetFileType(wxT("image/xpm"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
-    else if ( ext == "xbm" )
+    else if ( ext == wxT("xbm") )
     {
         wxFileType *fileType = new wxFileType;
-        fileType->m_impl->SetFileType("image/xbm");
+        fileType->m_impl->SetFileType(wxT("image/xbm"));
         fileType->m_impl->SetExt(ext);
         return fileType;
     }
index 732a2f48bac3efb2f2e7f7cb8b7ab1c88bdda580..670d30644e13967db34cd632e754a64dff3d3597 100644 (file)
@@ -67,7 +67,7 @@ int wxMessageDialog::ShowModal()
     
     short result ;
     
-    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
+    wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , wxT("this style is not supported on mac") ) ;
     
     AlertType alertType = kAlertPlainAlert ;
     if (m_dialogStyle & wxICON_EXCLAMATION)
@@ -83,17 +83,12 @@ int wxMessageDialog::ShowModal()
     if ( UMAGetSystemVersion() >= 0x1000 )
     {
         AlertStdCFStringAlertParamRec param ;
-        CFStringRef cfNoString = NULL ;
-        CFStringRef cfYesString = NULL ;
-        
-        CFStringRef cfTitle = NULL;
-        CFStringRef cfText = NULL;
-        
-        cfTitle = wxMacCreateCFString( m_caption ) ;
-        cfText = wxMacCreateCFString( m_message ) ;
-        cfNoString = wxMacCreateCFString( _("No") ) ;
-        cfYesString = wxMacCreateCFString( _("Yes") ) ;
+        wxMacCFStringHolder cfNoString(_("No")) ;
+        wxMacCFStringHolder cfYesString( _("Yes")) ;
         
+        wxMacCFStringHolder cfTitle(m_caption);
+        wxMacCFStringHolder cfText(m_message);
+                
         param.movable = true;
         param.flags = 0 ;
         
@@ -157,32 +152,13 @@ int wxMessageDialog::ShowModal()
             CreateStandardAlert( alertType , cfTitle , cfText , &param , &alertRef ) ;
             RunStandardAlert( alertRef , NULL , &result ) ;
         }
-        if(cfTitle != NULL)
-            CFRelease(cfTitle);   
-        if(cfText != NULL)
-            CFRelease(cfText);   
-        if(cfNoString != NULL)
-            CFRelease(cfNoString);   
-        if(cfYesString != NULL)
-            CFRelease(cfYesString);   
-        if ( skipDialog )
+       if ( skipDialog )
             return wxID_CANCEL ;
     }
     else
 #endif
     {
         AlertStdAlertParamRec    param;
-        char   cText[2048] ;
-        
-        if (wxApp::s_macDefaultEncodingIsPC)
-        {
-            strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
-        }
-        else
-        {
-            strcpy( cText , m_message ) ;
-        }
-        wxMacConvertNewlines( cText , cText ) ;
         
         Str255 yesPString ;
         Str255 noPString ;
@@ -192,7 +168,7 @@ int wxMessageDialog::ShowModal()
         wxMacStringToPascal( m_caption , pascalTitle ) ;
         wxMacStringToPascal( _("Yes") , yesPString ) ;
         wxMacStringToPascal(  _("No") , noPString ) ;
-        CopyCStringToPascal( cText , pascalText ) ;
+        wxMacStringToPascal( m_message , pascalText ) ;
         
         param.movable         = true;
         param.filterProc     = NULL ;
index 56cacb02a2392596999174936c07daf09238d85b..d5f72a32d764aa7d52db76605c441ae1dcceaff8 100644 (file)
@@ -130,7 +130,7 @@ bool wxNotebook::Create(wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
     
     int tabstyle = kControlTabSmallNorthProc ;
     if ( HasFlag(wxNB_LEFT) )
@@ -360,12 +360,8 @@ void wxNotebook::MacSetupTabs()
         page = m_pages[ii];
         info.version = 0;
         info.iconSuiteID = 0;
-#if TARGET_CARBON
-        c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
-#else
-        strcpy( (char *) info.name , page->GetLabel() ) ;
-        c2pstr( (char *) info.name ) ;
-#endif
+        wxMacStringToPascal( page->GetLabel() , info.name ) ;
+
         SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
             sizeof( ControlTabInfoRec) , (char*) &info ) ;
         SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
@@ -488,7 +484,7 @@ bool wxNotebook::DoPhase(int /* nPhase */)
 
 void wxNotebook::Command(wxCommandEvent& event)
 {
-    wxFAIL_MSG("wxNotebook::Command not implemented");
+    wxFAIL_MSG(wxT("wxNotebook::Command not implemented"));
 }
 
 // ----------------------------------------------------------------------------
index a270cff9e71276abac7a17778572467242d5c0b9..583cbbab7a5c297247bf64d27aa70abf2e660ff8 100644 (file)
@@ -57,7 +57,7 @@ extern void wxMacDestroyGWorld( GWorldPtr gw ) ;
 void
 ima_png_error(png_struct *png_ptr, char *message)
 {
-    wxMessageBox(message, "PNG error");
+    wxMessageBox(wxString::FromAscii(message), wxT("PNG error"));
     longjmp(png_ptr->jmpbuf, 1);
 }
 
@@ -819,8 +819,9 @@ bool wxPNGReader::SaveXPM(char *filename, char *name)
         strcpy(nameStr, name);
     else
     {
-        strcpy(nameStr, filename);
-        wxStripExtension(nameStr);
+       wxString str = wxString::FromAscii(filename) ;
+       wxStripExtension( str ) ;
+        strcpy(nameStr, str.ToAscii() );
     }
     
     if ( GetDepth() > 4 )
@@ -888,7 +889,7 @@ bool wxPNGFileHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long fla
                                 int desiredWidth, int desiredHeight)
 {
     wxPNGReader reader;
-    if (reader.ReadFile((char*) (const char*) name))
+    if (reader.ReadFile( (char*)(const char*) name.ToAscii() ) )
     {
         return reader.InstantiateBitmap(bitmap);
     }
index 779ee74edd7a2c27ba1d09366e982bbb660df3cb..20bf8dedc71dae5aaa4148ff94a26d7f2a5a26d5 100644 (file)
@@ -97,8 +97,8 @@ int wxPrintDialog::ShowModal()
     }
     else
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message  , wxT(""), wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
     ::UMAPrClose(NULL) ;
@@ -179,8 +179,8 @@ int wxPrintDialog::ShowModal()
     }
     if ((err != noErr) && (err != kPMCancel))
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message  , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
 #else
@@ -245,8 +245,8 @@ int wxPageSetupDialog::ShowModal()
     }
     else
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
     ::UMAPrClose(NULL) ;
@@ -301,8 +301,8 @@ int wxPageSetupDialog::ShowModal()
     }
     if ((err != noErr) && (err != kPMCancel))
     {
-        message.Printf( "Print Error %d", err ) ;
-        wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+        message.Printf( wxT("Print Error %d"), err ) ;
+        wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
 #else
index 5f3c79225e0f21fd36cea1c89029e06ce2e1b9c4..274f8b1c9eed87f4ab1bf7dae672594611b7ca2e 100644 (file)
@@ -144,7 +144,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     if (!win)
     {
         wxEndBusyCursor();
-        wxMessageBox("Sorry, could not create an abort dialog.", "Print Error", wxOK, parent);
+        wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent);
         delete dc;
         return FALSE;
     }
@@ -162,7 +162,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
         if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage()))
         {
             wxEndBusyCursor();
-            wxMessageBox("Could not start printing.", "Print Error", wxOK, parent);
+            wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent);
             break;
         }
         if (sm_abortIt)
index 15ac067af755ea432c02602078fc028bb05af95c..141c7971fc8de595f621af88daed12047547229b 100644 (file)
@@ -203,7 +203,7 @@ wxString wxRadioBox::GetString(int item) const
     wxRadioButton *current;
     
     if ((item < 0) || (item >= m_noItems))
-        return wxString("");
+        return wxEmptyString;
     
     i = 0;
     current = m_radioButtonCycle;
@@ -409,7 +409,7 @@ void wxRadioBox::DoSetSize(int x, int y, int width, int height, int sizeFlags)
     int totWidth,totHeight;
     
     SetFont(GetParent()->GetFont());
-    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
+    GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), &charWidth, &charHeight);
     charWidth/=52;
     
     maxWidth=-1;
@@ -490,7 +490,7 @@ wxSize wxRadioBox::DoGetBestSize() const
     int totWidth, totHeight;
     
     wxFont font = GetParent()->GetFont();
-    GetTextExtent(wxString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
+    GetTextExtent(wxT("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"),
         &charWidth, &charHeight, NULL, NULL, &font);
     charWidth /= 52;
     
index 6f57b2c40dd86fdcdc818bd583a24773fae410ca..ad843c3fd955bfced9f470e5d6199a018235305e 100644 (file)
@@ -46,12 +46,12 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, validator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , true , 0 , 0 , 100, 
         kControlScrollBarLiveProc , (long) this ) ;
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
 
     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
 
index 2a95191da231177787ef538b918480d750a81c37..87d4e586098060c40ae7ebbee9c37ce375554be6 100644 (file)
@@ -74,7 +74,7 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     
     m_pageSize = (int)((maxValue-minValue)/10);
     
-    MacPreControlCreate( parent, id, "", pos, size, style,
+    MacPreControlCreate( parent, id, wxEmptyString, pos, size, style,
         validator, name, &bounds, title );
     
     procID = kControlSliderProc + kControlSliderLiveFeedback;
@@ -86,15 +86,15 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()), &bounds, title, false,
         value, minValue, maxValue, procID, (long) this);
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     ::SetControlAction( (ControlHandle) m_macControl , wxMacLiveScrollbarActionUPP ) ;
     
     if(style & wxSL_LABELS)
     {
-        m_macMinimumStatic = new wxStaticText( this, -1, "" );
-        m_macMaximumStatic = new wxStaticText( this, -1, "" );
-        m_macValueStatic = new wxStaticText( this, -1, "" );
+        m_macMinimumStatic = new wxStaticText( this, -1, wxEmptyString );
+        m_macMaximumStatic = new wxStaticText( this, -1, wxEmptyString );
+        m_macValueStatic = new wxStaticText( this, -1, wxEmptyString );
         SetRange(minValue, maxValue);
         SetValue(value);
     }
@@ -132,7 +132,7 @@ int wxSlider::GetValue() const
 void wxSlider::SetValue(int value)
 {
     wxString valuestring ;
-    valuestring.Printf( "%d" , value ) ;    
+    valuestring.Printf( wxT("%d") , value ) ;    
     if ( m_macValueStatic )
         m_macValueStatic->SetLabel( valuestring ) ;
     SetControl32BitValue( (ControlHandle) m_macControl , value ) ;
@@ -149,11 +149,11 @@ void wxSlider::SetRange(int minValue, int maxValue)
     SetControl32BitMaximum( (ControlHandle) m_macControl, m_rangeMax);
     
     if(m_macMinimumStatic) {
-        value.Printf("%d", m_rangeMin);
+        value.Printf(wxT("%d"), m_rangeMin);
         m_macMinimumStatic->SetLabel(value);
     }
     if(m_macMaximumStatic) {
-        value.Printf("%d", m_rangeMax);
+        value.Printf(wxT("%d"), m_rangeMax);
         m_macMaximumStatic->SetLabel(value);
     }
     SetValue(m_rangeMin);
@@ -283,9 +283,9 @@ wxSize wxSlider::DoGetBestSize() const
         int ht, wd;
         
         // Get maximum text label width and height
-        text.Printf("%d", m_rangeMin);
+        text.Printf(wxT("%d"), m_rangeMin);
         GetTextExtent(text, &textwidth, &textheight);
-        text.Printf("%d", m_rangeMax);
+        text.Printf(wxT("%d"), m_rangeMax);
         GetTextExtent(text, &wd, &ht);
         if(ht > textheight) {
             textheight = ht;
@@ -356,9 +356,9 @@ void wxSlider::MacUpdateDimensions()
         int ht;
         
         // Get maximum text label width and height
-        text.Printf("%d", m_rangeMin);
+        text.Printf(wxT("%d"), m_rangeMin);
         GetTextExtent(text, &minValWidth, &textheight);
-        text.Printf("%d", m_rangeMax);
+        text.Printf(wxT("%d"), m_rangeMax);
         GetTextExtent(text, &maxValWidth, &ht);
         if(ht > textheight) {
             textheight = ht;
index b36c755f7e44ae3c9b67811d613fe4b64947c140..0f4faca5784170109e30e0efccc211e515a43ff0 100644 (file)
@@ -47,12 +47,12 @@ bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, c
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style,*( (wxValidator*) NULL ) , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 100, 
         kControlLittleArrowsProc , (long) this ) ;
     
-    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
+    wxASSERT_MSG( (ControlHandle) m_macControl != NULL , wxT("No valid mac control") ) ;
     
     MacPostControlCreate() ;
     
index dc00dcca0f136c56ba4db1822c73dbba1e9c7108..30305cc1cf7d1855524b4c849acf4c13ad218bb1 100644 (file)
@@ -52,7 +52,7 @@ bool wxStaticLine::Create( wxWindow *parent,
     Rect bounds ;
     Str255 title ;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
 
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
           kControlSeparatorLineProc , (long) this ) ;
index fc0a5726f933914d9b86e7d4dc090cb9c1f221dc..b2a7d103da4694cb0a3837cf72c7a4d009193e86 100644 (file)
@@ -59,7 +59,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id,
     return ret;
 }
 
-const wxString punct = " ,.-;:!?";
+const wxString punct = wxT(" ,.-;:!?");
 
 void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
 {
@@ -68,7 +68,7 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
     if (paragraph.Length() == 0)
     {
         // empty line
-        dc.GetTextExtent( "H", &width, &height );
+        dc.GetTextExtent( wxT("H"), &width, &height );
         y += height;
         
         return;
@@ -127,7 +127,7 @@ void wxStaticText::DrawParagraph(wxDC &dc, wxString paragraph, int &y)
             }
             
             dc.DrawText( paragraph, pos , y) ;
-            paragraph="";
+            paragraph=wxEmptyString;
             y += height ;
         }
     }
@@ -165,7 +165,7 @@ void wxStaticText::OnDraw( wxDC &dc )
         if (text[i] == 13 || text[i] == 10)
         {
             DrawParagraph(dc, paragraph,y);
-            paragraph = "" ;
+            paragraph = wxEmptyString ;
         }
         else
         {
index 6e79c8838681839edd60c613af033d4e388b9dff..4fcf069286d65a65df2d67c365ceec20acd27eee 100644 (file)
@@ -39,7 +39,7 @@ bool wxTabCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons
     
     m_imageList = NULL;
     
-    MacPreControlCreate( parent , id ,  "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
     
     m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1, 
         kControlTabSmallProc , (long) this ) ;
@@ -115,7 +115,7 @@ int wxTabCtrl::GetRowCount() const
 wxString wxTabCtrl::GetItemText(int item) const
 {
     // TODO
-    return wxString("");
+    return wxEmptyString;
 }
 
 // Get the item image
index ae6063d20c4bdabdc2a75c439e2af6fe191bb251..0f6f9e9ab7c5e6398ab6bf3f9084e5bbcbf9d936 100644 (file)
@@ -593,6 +593,7 @@ OSStatus mUPOpenControl(ControlHandle theControl, long wxStyle )
           kTXNStartOffset,
           kTXNEndOffset);
         /* set the field's background */
+
     tback.bgType = kTXNBackgroundTypeRGB;
     tback.bg.color = rgbWhite;
     TXNSetBackground( varsp->fTXNRec, &tback);
@@ -701,7 +702,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
         mySize.y += 2 * m_macVerticalBorder ;
     }
     */
-    MacPreControlCreate( parent , id ,  "" , pos , mySize ,style, validator , name , &bounds , title ) ;
+    MacPreControlCreate( parent , id ,  wxEmptyString , pos , mySize ,style, validator , name , &bounds , title ) ;
 
     if ( m_windowStyle & wxTE_MULTILINE )
     {
@@ -738,16 +739,10 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
     }
     MacPostControlCreate() ;
 
-    wxString value ;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-        value = wxMacMakeMacStringFromPC( st ) ;
-    else
-        value = st ;
-        
     if ( !m_macUsesTXN )
     {
-        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
     }
     else
     {
@@ -755,9 +750,15 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
             /* set up locals */
         tpvars = (STPTextPaneVars **) GetControlReference((ControlHandle) m_macControl);
             /* set the text in the record */
-        TXNSetData( (**tpvars).fTXNRec, kTXNTextData,  (void*)value.c_str(), value.Length(),
-          kTXNStartOffset, kTXNEndOffset);
         m_macTXN =  (**tpvars).fTXNRec ;
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN) , kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2,
+          kTXNStartOffset, kTXNEndOffset);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN) , kTXNTextData,  (void*)text.data(), strlen( text ) ,
+          kTXNStartOffset, kTXNEndOffset);
+#endif
         m_macTXNvars = tpvars ;
         m_macUsesTXN = true ;
         TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
@@ -777,25 +778,23 @@ wxString wxTextCtrl::GetValue() const
         err = ::GetControlDataSize((ControlHandle) m_macControl, 0,
             ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, &actualSize ) ;
        
-           if ( err )
-               return wxEmptyString ;
-           
-           if ( actualSize > 0 )
-           {
-            wxChar *ptr = result.GetWriteBuf(actualSize) ;
-            
+       if ( err )
+           return wxEmptyString ;
+       
+       if ( actualSize > 0 )
+       {
+                       wxCharBuffer buf(actualSize) ;            
             ::GetControlData( (ControlHandle) m_macControl, 0,
                 ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag, 
-                actualSize , ptr , &actualSize ) ;
-            ptr[actualSize] = 0 ;
-            result.UngetWriteBuf(actualSize) ;
+                actualSize , buf.data() , &actualSize ) ;
+            result = wxMacMakeStringFromCString( buf ) ;
         }
-        
     }
     else
     {
+#if wxUSE_UNICODE
         Handle theText ;
-        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNUnicodeTextData );
         // all done
         if ( err )
         {
@@ -804,18 +803,38 @@ wxString wxTextCtrl::GetValue() const
         else
         {
             actualSize = GetHandleSize( theText ) ;
-               if ( actualSize > 0 )
-               {
-                wxChar *ptr = result.GetWriteBuf(actualSize) ;
-                strncpy( ptr , *theText , actualSize ) ;
+            if ( actualSize > 0 )
+            {
+                wxChar *ptr = result.GetWriteBuf(actualSize*sizeof(wxChar)) ;
+                wxStrncpy( ptr , (wxChar*) *theText , actualSize ) ;
                 ptr[actualSize] = 0 ;
                 result.UngetWriteBuf( actualSize ) ;
             }
             DisposeHandle( theText ) ;
         }
+#else
+        Handle theText ;
+        err = TXNGetDataEncoded( ((TXNObject) m_macTXN), kTXNStartOffset, kTXNEndOffset, &theText , kTXNTextData );
+        // all done
+        if ( err )
+        {
+            actualSize = 0 ;
+        }
+        else
+        {
+            actualSize = GetHandleSize( theText ) ;
+            if ( actualSize > 0 )
+            {
+                HLock( theText ) ;
+                result = wxMacMakeStringFromCString( *theText , actualSize ) ;
+                HUnlock( theText ) ;
+            }
+            DisposeHandle( theText ) ;
+        }
+#endif
     }
     
-    return wxMacMakeStringFromMacString( result ) ;
+    return result ;
 }
 
 void wxTextCtrl::GetSelection(long* from, long* to) const
@@ -833,28 +852,24 @@ void wxTextCtrl::GetSelection(long* from, long* to) const
 
 void wxTextCtrl::SetValue(const wxString& st)
 {
-    wxString value;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        value = wxMacMakeMacStringFromPC( st ) ;
-        // value.Replace( "\n", "\r" ); TODO this should be handled by the conversion
-    }
-    else
-        value = st;
-        
-        
     if ( !m_macUsesTXN )
     {
-        ::SetControlData((ControlHandle)  m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        ::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
     }
     else
     {
         bool formerEditable = IsEditable() ;
         if ( !formerEditable )
             SetEditable(true) ;
-        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2 ,
+          kTXNStartOffset, kTXNEndOffset);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)text.data(), strlen( text ) ,
           kTXNStartOffset, kTXNEndOffset);
+#endif
         TXNSetSelection( (TXNObject) m_macTXN, 0, 0);
         TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
         if ( !formerEditable )
@@ -884,7 +899,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
         if ( style.HasFont() )
         {
             const wxFont &font = style.GetFont() ;
-            CopyCStringToPascal( font.GetFaceName().c_str() , fontName ) ;
+            wxMacStringToPascal( font.GetFaceName() , fontName ) ;
             fontSize = font.GetPointSize() ;
             if ( font.GetUnderlined() )
                 fontStyle |= underline ;
@@ -918,7 +933,7 @@ bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
         {
             OSStatus status = TXNSetTypeAttributes ((TXNObject)m_macTXN, attrCounter , typeAttr,
                 start,end);
-            wxASSERT_MSG( status == noErr , "Couldn't set text attributes" ) ;
+            wxASSERT_MSG( status == noErr , wxT("Couldn't set text attributes") ) ;
         }
         if ( !formerEditable )
             SetEditable(formerEditable) ;
@@ -1140,8 +1155,13 @@ void wxTextCtrl::Replace(long from, long to, const wxString& value)
             SetEditable(true) ;
         TXNSetSelection( ((TXNObject) m_macTXN) , from , to ) ;
         TXNClear( ((TXNObject) m_macTXN) ) ;
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)value.wc_str(), value.Length() * 2 ,
+          kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#else
         TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)value.c_str(), value.Length(),
             kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#endif
         if ( !formerEditable )
             SetEditable( formerEditable ) ;
     }
@@ -1208,20 +1228,12 @@ bool wxTextCtrl::LoadFile(const wxString& file)
     return FALSE;
 }
 
-void wxTextCtrl::WriteText(const wxString& text)
-{
-    wxString value ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-    {
-        value = wxMacMakeMacStringFromPC( text ) ;
-        // value.Replace( "\n", "\r" ); // TODO this should be handled by the conversion
-    }
-    else
-        value = text ;
-        
+void wxTextCtrl::WriteText(const wxString& st)
+{        
     if ( !m_macUsesTXN )
     {
-        TEInsert( value , value.Length() , ((TEHandle) m_macTE) ) ;
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
     }
     else
     {
@@ -1230,8 +1242,14 @@ void wxTextCtrl::WriteText(const wxString& text)
             SetEditable(true) ;
         long start , end , dummy ;
         GetSelection( &start , &dummy ) ;
-        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*) (const char*)value, value.Length(),
+#if wxUSE_UNICODE
+        TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData,  (void*)st.wc_str(), st.Length() * 2 ,
           kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#else
+       wxCharBuffer text = wxMacStringToCString( st ) ;
+        TXNSetData( ((TXNObject) m_macTXN), kTXNTextData,  (void*)text.data(), strlen( text ) ,
+          kTXNUseCurrentSelection, kTXNUseCurrentSelection);
+#endif
         GetSelection( &dummy , &end ) ;
         SetStyle( start , end , GetDefaultStyle() ) ;
         if ( !formerEditable )
@@ -1415,7 +1433,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
         if (count == lineNo)
         {
             // Add chars in line then
-            wxString tmp("");
+            wxString tmp;
             
             for (size_t j = i; j < content.Length(); j++)
             {
@@ -1429,7 +1447,7 @@ wxString wxTextCtrl::GetLineText(long lineNo) const
         }
         if (content[i] == '\r') count++;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 /*
index 3e4b1dfc490d05df06c212a4ba8922416dbf72ef..e31c812c02b2c1de8668e422ed414461e06c3d66 100644 (file)
@@ -852,7 +852,7 @@ bool wxThreadModule::OnInit()
 #endif
     if ( !hasThreadManager )
     {
-        wxMessageBox( "Error" , "Thread Support is not available on this System" , wxOK ) ;
+        wxMessageBox( wxT("Error") , wxT("Thread Support is not available on this System") , wxOK ) ;
         return FALSE ;
     }
 
index 33da0a2d4b9c80d4e16770b8c68c1835ced25f66..42dfe72bab829d4b0bd015bac5bcae495408138c 100644 (file)
@@ -255,7 +255,7 @@ bool wxToolBar::Realize()
               ::SetControlFontStyle( m_macToolHandle , &controlstyle ) ;
             */
             ControlHandle container = (ControlHandle) GetParent()->MacGetContainerForEmbedding() ;
-            wxASSERT_MSG( container != NULL , "No valid mac container control" ) ;
+            wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
             ::EmbedControl( m_macToolHandle , container ) ;
             
             if ( GetWindowStyleFlag() & wxTB_VERTICAL )
@@ -507,7 +507,7 @@ wxString wxToolBar::MacGetToolTipString( wxPoint &pt )
     {
         return tool->GetShortHelp() ;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 void wxToolBar::DoEnableTool(wxToolBarToolBase *t, bool enable)
index 4b00c6f7500684f1761436796ea04c56cd0ca717..bee14fc9fb1174c9f70b4956f099aa27acda052d 100644 (file)
@@ -35,7 +35,7 @@ class wxMacToolTip
         wxMacToolTip( ) ;
         ~wxMacToolTip() ;
         
-        void            Setup( WindowRef window  , wxString text , wxPoint localPosition ) ;
+        void            Setup( WindowRef window  , const wxString& text , wxPoint localPosition ) ;
         long            GetMark() { return m_mark ; }
         void             Draw() ;
         void            Clear() ;
@@ -50,8 +50,8 @@ class wxMacToolTip
         bool        m_shown ;
         long        m_mark ;
         wxMacToolTipTimer* m_timer ;
-#ifdef TARGET_CARBON
-        CFStringRef m_helpTextRef ;
+#if TARGET_CARBON
+        wxMacCFStringHolder m_helpTextRef ;
 #endif
 } ;
 
@@ -186,18 +186,14 @@ wxMacToolTip::wxMacToolTip()
     m_mark = 0 ;
     m_shown = false ;
     m_timer = NULL ;
-    m_helpTextRef = NULL ;
 }
 
-void wxMacToolTip::Setup( WindowRef win  , wxString text , wxPoint localPosition ) 
+void wxMacToolTip::Setup( WindowRef win  , const wxString& text , wxPoint localPosition ) 
 {
     m_mark++ ;
     Clear() ;
     m_position = localPosition ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-        m_label = wxMacMakeMacStringFromPC( text ) ;
-     else
-        m_label = text ;
+    m_label = text ;
     m_window =win;
     s_ToolTipWindowRef = m_window ;
     m_backpict = NULL ;
@@ -228,209 +224,147 @@ void wxMacToolTip::Draw()
     {
         m_shown = true ;
 #if TARGET_CARBON
-        if ( HMDisplayTag != (void*) kUnresolvedCFragSymbolAddress )
-        {
-            HMHelpContentRec tag ;
-            tag.version = kMacHelpVersion;
-            SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
-            GrafPtr port ;
-            GetPort( &port ) ;
-            SetPortWindowPort(m_window) ;
-            LocalToGlobal( (Point *) &tag.absHotRect.top );
-            LocalToGlobal( (Point *) &tag.absHotRect.bottom );
-            SetPort( port );
-            if( m_helpTextRef )
-            {
-                CFRelease( m_helpTextRef ) ;
-                m_helpTextRef = NULL ;
-            }
-            m_helpTextRef = wxMacCreateCFString(m_label) ;
-            tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
-            tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
-            tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
-            tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
-            tag.tagSide = kHMDefaultSide;
-            HMDisplayTag( &tag );
-        }
-        else
-#endif
+        HMHelpContentRec tag ;
+        tag.version = kMacHelpVersion;
+        SetRect( &tag.absHotRect , m_position.x - 2 , m_position.y - 2 , m_position.x + 2 , m_position.y + 2 ) ;
+        GrafPtr port ;
+        GetPort( &port ) ;
+        SetPortWindowPort(m_window) ;
+        LocalToGlobal( (Point *) &tag.absHotRect.top );
+        LocalToGlobal( (Point *) &tag.absHotRect.bottom );
+        SetPort( port );
+        m_helpTextRef = m_label ;
+        tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ;
+        tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ;
+        tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ;
+        tag.content[kHMMaximumContentIndex].u.tagCFString = m_helpTextRef ;
+        tag.tagSide = kHMDefaultSide;
+        HMDisplayTag( &tag );
+#else
+        wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
+        FontFamilyID fontId ;
+        Str255 fontName ;
+        SInt16 fontSize ;
+        Style fontStyle ;
+        GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+        GetFNum( fontName, &fontId );
+        
+        TextFont( fontId ) ;
+        TextSize( fontSize ) ;
+        TextFace( fontStyle ) ;
+        FontInfo fontInfo;
+        ::GetFontInfo(&fontInfo);
+        short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
+        short height = 0 ;
+        //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
+        
+        int i = 0 ;
+        int length = m_label.Length() ;
+        int width = 0 ;
+        int thiswidth = 0 ;
+        int laststop = 0 ;
+        wxCharBuffer text = wxMacStringToCString( m_label ) ;
+
+        while( i < length )
         {
-            wxMacPortStateHelper help( (GrafPtr) GetWindowPort( m_window ) );
-#if TARGET_CARBON    
-            bool useDrawThemeText =  ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
-#endif        
-            
-            FontFamilyID fontId ;
-            Str255 fontName ;
-            SInt16 fontSize ;
-            Style fontStyle ;
-            GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
-            GetFNum( fontName, &fontId );
-            
-            TextFont( fontId ) ;
-            TextSize( fontSize ) ;
-            TextFace( fontStyle ) ;
-            FontInfo fontInfo;
-            ::GetFontInfo(&fontInfo);
-            short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
-            short height = 0 ;
-            //    short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
-            
-            int i = 0 ;
-            int length = m_label.Length() ;
-            int width = 0 ;
-            int thiswidth = 0 ;
-            int laststop = 0 ;
-            const char *text = m_label ;
-            while( i < length )
-            {
-                if( text[i] == 13 || text[i] == 10)
-                {
-                    thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
-                    if ( thiswidth > width )
-                        width = thiswidth ;
-                    
-                    height += lineh ;
-                    laststop = i+1 ;
-                }
-                i++ ;
-            }
-            if ( i - laststop > 0 )
+            if( text[i] == 13 || text[i] == 10)
             {
                 thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
                 if ( thiswidth > width )
                     width = thiswidth ;
+                
                 height += lineh ;
+                laststop = i+1 ;
             }
-            
-            
-            m_rect.left = m_position.x + kTipOffset;
-            m_rect.top = m_position.y + kTipOffset;
-            m_rect.right = m_rect.left + width + 2 * kTipBorder;
-#if TARGET_CARBON    
-            if ( useDrawThemeText )
-                m_rect.right += kTipBorder ;
-#endif
-            m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
-            Rect r ;
-            GetPortBounds( GetWindowPort( m_window ) , &r ) ;
-            if ( m_rect.top < 0 )
-            {
-                m_rect.bottom += -m_rect.top ;
-                m_rect.top = 0 ;
-            }
-            if ( m_rect.left < 0 )
-            {
-                m_rect.right += -m_rect.left ;
-                m_rect.left = 0 ;
-            }
-            if ( m_rect.right > r.right )
-            {
-                m_rect.left -= (m_rect.right - r.right ) ;
-                m_rect.right = r.right ;
-            }
-            if ( m_rect.bottom > r.bottom )
-            {
-                m_rect.top -= (m_rect.bottom - r.bottom) ;
-                m_rect.bottom = r.bottom ;
-            }
-            ClipRect( &m_rect ) ;
-            BackColor( whiteColor ) ;
-            ForeColor(blackColor ) ;
-            GWorldPtr port ;            
-            NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
-            CGrafPtr    origPort ;
-            GDHandle    origDevice ;
-            
-            GetGWorld( &origPort , &origDevice ) ;
-            SetGWorld( port , NULL ) ;
-            
-            m_backpict = OpenPicture(&m_rect);
-            
-            CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
-                GetPortBitMapForCopyBits(port), 
-                &m_rect, 
-                &m_rect, 
-                srcCopy, 
-                NULL);
-            ClosePicture();
-            SetGWorld( origPort , origDevice ) ;
-            DisposeGWorld( port ) ;
-            PenNormal() ;
-            
-            RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
-            BackColor( whiteColor ) ;
-            RGBForeColor( &tooltipbackground ) ;
-            
-            PaintRect( &m_rect ) ;
-            ForeColor(blackColor ) ;
-            FrameRect( &m_rect ) ;
-            SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
-            ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
-            
-            i = 0 ;
-            laststop = 0 ;
-            height = 0 ;
-            
-            while( i < length )
-            {
-                if( text[i] == 13 || text[i] == 10)
-                {
-#if TARGET_CARBON
-                    if ( useDrawThemeText )
-                    {
-                        Rect frame ;
-                        frame.top = m_rect.top + kTipBorder + height ;
-                        frame.left = m_rect.left + kTipBorder ;
-                        frame.bottom = frame.top + 1000 ;
-                        frame.right = frame.left + 1000 ;
-                        CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
-                        ::DrawThemeTextBox( mString,
-                            kThemeCurrentPortFont,
-                            kThemeStateActive,
-                            true,
-                            &frame,
-                            teJustLeft,
-                            nil );
-                        CFRelease( mString ) ;
-                        height += lineh ;
-                    }
-                    else
-#endif
-                    {
-                        ::DrawText( text , laststop , i - laststop ) ;
-                        height += lineh ;
-                        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
-                    }
-                    laststop = i+1 ;
-                }
-                i++ ;
-            }
-#if TARGET_CARBON
-            if ( useDrawThemeText )
-            {
-                Rect frame ;
-                frame.top = m_rect.top + kTipBorder + height ;
-                frame.left = m_rect.left + kTipBorder ;
-                frame.bottom = frame.top + 1000 ;
-                frame.right = frame.left + 1000 ;
-                CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
-                ::DrawThemeTextBox( mString,
-                    kThemeCurrentPortFont,
-                    kThemeStateActive,
-                    true,
-                    &frame,
-                    teJustLeft,
-                    nil );
-                CFRelease( mString ) ;
-            }
-            else
-#endif
+            i++ ;
+        }
+        if ( i - laststop > 0 )
+        {
+            thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
+            if ( thiswidth > width )
+                width = thiswidth ;
+            height += lineh ;
+        }
+        
+        m_rect.left = m_position.x + kTipOffset;
+        m_rect.top = m_position.y + kTipOffset;
+        m_rect.right = m_rect.left + width + 2 * kTipBorder;
+
+        m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
+        Rect r ;
+        GetPortBounds( GetWindowPort( m_window ) , &r ) ;
+        if ( m_rect.top < 0 )
+        {
+            m_rect.bottom += -m_rect.top ;
+            m_rect.top = 0 ;
+        }
+        if ( m_rect.left < 0 )
+        {
+            m_rect.right += -m_rect.left ;
+            m_rect.left = 0 ;
+        }
+        if ( m_rect.right > r.right )
+        {
+            m_rect.left -= (m_rect.right - r.right ) ;
+            m_rect.right = r.right ;
+        }
+        if ( m_rect.bottom > r.bottom )
+        {
+            m_rect.top -= (m_rect.bottom - r.bottom) ;
+            m_rect.bottom = r.bottom ;
+        }
+        ClipRect( &m_rect ) ;
+        BackColor( whiteColor ) ;
+        ForeColor(blackColor ) ;
+        GWorldPtr port ;            
+        NewGWorld( &port , wxDisplayDepth() , &m_rect , NULL , NULL , 0 ) ;
+        CGrafPtr    origPort ;
+        GDHandle    origDevice ;
+        
+        GetGWorld( &origPort , &origDevice ) ;
+        SetGWorld( port , NULL ) ;
+        
+        m_backpict = OpenPicture(&m_rect);
+        
+        CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)), 
+            GetPortBitMapForCopyBits(port), 
+            &m_rect, 
+            &m_rect, 
+            srcCopy, 
+            NULL);
+        ClosePicture();
+        SetGWorld( origPort , origDevice ) ;
+        DisposeGWorld( port ) ;
+        PenNormal() ;
+        
+        RGBColor tooltipbackground = { 0xFFFF , 0xFFFF , 0xC000 } ;
+        BackColor( whiteColor ) ;
+        RGBForeColor( &tooltipbackground ) ;
+        
+        PaintRect( &m_rect ) ;
+        ForeColor(blackColor ) ;
+        FrameRect( &m_rect ) ;
+        SetThemeTextColor(kThemeTextColorNotification,wxDisplayDepth(),true) ;
+        ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
+        
+        i = 0 ;
+        laststop = 0 ;
+        height = 0 ;
+        
+        while( i < length )
+        {
+            if( text[i] == 13 || text[i] == 10)
             {
                 ::DrawText( text , laststop , i - laststop ) ;
+                height += lineh ;
+                ::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
+                laststop = i+1 ;
             }
-            ::TextMode( srcOr ) ;        
-       }
+            i++ ;
+        }
+        ::DrawText( text , laststop , i - laststop ) ;
+        ::TextMode( srcOr ) ;        
+#endif
     }
 }
 
@@ -454,11 +388,7 @@ void wxMacToolTip::Clear()
         return ;
 #if TARGET_CARBON
     HMHideTag() ;
-    if( m_helpTextRef )
-    {
-        CFRelease( m_helpTextRef ) ;
-        m_helpTextRef = NULL ;
-    }
+    m_helpTextRef.Release() ;
 #else         
     if ( m_window == s_ToolTipWindowRef && m_backpict )
     {
index 69708ed1a394759ab2cf657843d69ae74295eaba..2f4de7a5eb9b13b3b05edb890662f62f3309cfd8 100644 (file)
@@ -362,7 +362,7 @@ void wxAssociateWinWithMacWindow(WXWindow inWindowRef, wxTopLevelWindowMac *win)
 {
     // adding NULL WindowRef is (first) surely a result of an error and
     // (secondly) breaks menu command processing
-    wxCHECK_RET( inWindowRef != (WindowRef) NULL, "attempt to add a NULL WindowRef to window list" );
+    wxCHECK_RET( inWindowRef != (WindowRef) NULL, wxT("attempt to add a NULL WindowRef to window list") );
 
     if ( !wxWinMacWindowList->Find((long)inWindowRef) )
         wxWinMacWindowList->Append((long)inWindowRef, win);
@@ -592,12 +592,7 @@ void  wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
     
     ::CreateNewWindow( wclass , attr , &theBoundsRect , (WindowRef*)&m_macWindow ) ;
     wxAssociateWinWithMacWindow( m_macWindow , this ) ;
-    wxString label ;
-    if( wxApp::s_macDefaultEncodingIsPC )
-        label = wxMacMakeMacStringFromPC( title ) ;
-    else
-        label = title ;
-    UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
+    UMASetWTitle( (WindowRef)m_macWindow , title ) ;
     ::CreateRootControl( (WindowRef)m_macWindow , (ControlHandle*)&m_macRootControl ) ;
 #if TARGET_CARBON
     InstallStandardEventHandler( GetWindowEventTarget(MAC_WXHWND(m_macWindow)) ) ;
@@ -836,15 +831,7 @@ void wxTopLevelWindowMac::MacKeyDown( WXEVENTREF ev )
 void wxTopLevelWindowMac::SetTitle(const wxString& title)
 {
     wxWindow::SetTitle( title ) ;
-    
-    wxString label ;
-    
-    if( wxApp::s_macDefaultEncodingIsPC )
-        label = wxMacMakeMacStringFromPC( m_label ) ;
-    else
-        label = m_label ;
-
-    UMASetWTitleC( (WindowRef)m_macWindow , label ) ;
+    UMASetWTitle( (WindowRef)m_macWindow , title ) ;
 }
 
 bool wxTopLevelWindowMac::Show(bool show)
index 59daa769db71de98da9e688e22ca1b9bb342bc60..9ec67e6f5467c5bafc22dc96fded78a1229a2ba8 100644 (file)
@@ -189,10 +189,8 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title )
     wxString str = wxStripMenuCodes( title ) ;
     MenuRef menu ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
     CreateNewMenu( id , 0 , &menu ) ;
-    SetMenuTitleWithCFString( menu , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -205,9 +203,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title )
 {
     wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
-    SetMenuTitleWithCFString( menu , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -219,9 +215,7 @@ void UMASetMenuItemText(  MenuRef menu,  MenuItemIndex item, const wxString& tit
 {
     wxString str = wxStripMenuCodes( title ) ;
 #if TARGET_CARBON
-    CFStringRef cfs = wxMacCreateCFString( str ) ;
-    SetMenuItemTextWithCFString( menu , item , cfs ) ;
-    CFRelease( cfs ) ;
+    SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str) ) ;
 #else
     Str255 ptitle ;
     wxMacStringToPascal( str , ptitle ) ;
@@ -558,17 +552,15 @@ void             UMADisposeWindow( WindowRef inWindowRef )
     DisposeWindow( inWindowRef ) ;
 }
 
-void             UMASetWTitleC( WindowRef inWindowRef , const char *title ) 
+void UMASetWTitle( WindowRef inWindowRef , const wxString& title ) 
 {
-    Str255    ptitle ;
-    strncpy( (char*)ptitle , title , 96 ) ;
-    ptitle[96] = 0 ;
 #if TARGET_CARBON
-    c2pstrcpy( ptitle, (char *)ptitle ) ;
+    SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title) ) ;
 #else
-    c2pstr( (char*)ptitle ) ;
-#endif
+    Str255 ptitle ;
+    wxMacStringToPascal( title , ptitle ) ;
     SetWTitle( inWindowRef , ptitle ) ;
+#endif
 }
 
 void             UMAGetWTitleC( WindowRef inWindowRef , char *title ) 
@@ -583,6 +575,17 @@ void             UMAGetWTitleC( WindowRef inWindowRef , char *title )
 
 // appearance additions
 
+void UMASetControlTitle( ControlHandle inControl , const wxString& title ) 
+{
+#if TARGET_CARBON
+    SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title) ) ;
+#else
+    Str255 ptitle ;
+    wxMacStringToPascal( title , ptitle ) ;
+    SetControlTitle( inControl , ptitle ) ;
+#endif
+}
+
 void UMAActivateControl( ControlHandle inControl ) 
 {
     // we have to add the control after again to the update rgn
@@ -795,7 +798,7 @@ void wxMacPortStateHelper::Setup( GrafPtr newport )
 {
     GetPort( &m_oldPort ) ;
     SetPort( newport ) ;
-    wxASSERT_MSG( m_clip == NULL , "Cannot call setup twice" ) ;
+    wxASSERT_MSG( m_clip == NULL , wxT("Cannot call setup twice") ) ;
     m_clip = NewRgn() ;
     GetClip( m_clip );
     m_textFont = GetPortTextFont( (CGrafPtr) newport);
index 3897dadd575d4f17f6fc18deeea77a8391b6c5d8..014225901ca9f2972b2c5564070a39c8ddad2be0 100644 (file)
 #include <Sound.h>
 #endif
 
+#include "ATSUnicode.h"
+#include "TextCommon.h"
+#include "TextEncodingConverter.h"
+
 #ifndef __DARWIN__
 // defined in unix/utilsunx.cpp for Mac OS X
 
@@ -48,7 +52,7 @@ bool wxGetFullHostName(wxChar *buf, int maxSize)
 }
 
 // Get hostname only (without domain name)
-bool wxGetHostName(char *buf, int maxSize)
+bool wxGetHostName(wxChar *buf, int maxSize)
 {
     // Gets Chooser name of user by examining a System resource.
 
@@ -61,13 +65,11 @@ bool wxGetHostName(char *buf, int maxSize)
 
     if (chooserName && *chooserName)
     {
-      int length = (*chooserName)[0] ;
-      if ( length + 1 > maxSize )
-      {
-        length = maxSize - 1 ;
-      }
-      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-      buf[length] = 0 ;
+        HLock( (Handle) chooserName ) ;
+        wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
+        HUnlock( (Handle) chooserName ) ;
+        ReleaseResource( (Handle) chooserName ) ;
+        wxStrncpy( buf , name , maxSize - 1 ) ;
     }
     else
         buf[0] = 0 ;
@@ -76,7 +78,7 @@ bool wxGetHostName(char *buf, int maxSize)
 }
 
 // Get user ID e.g. jacs
-bool wxGetUserId(char *buf, int maxSize)
+bool wxGetUserId(wxChar *buf, int maxSize)
 {
   return wxGetUserName( buf , maxSize ) ;
 }
@@ -88,7 +90,7 @@ const wxChar* wxGetHomeDir(wxString *pstr)
 }
 
 // Get user name e.g. Stefan Csomor
-bool wxGetUserName(char *buf, int maxSize)
+bool wxGetUserName(wxChar *buf, int maxSize)
 {
     // Gets Chooser name of user by examining a System resource.
 
@@ -101,13 +103,11 @@ bool wxGetUserName(char *buf, int maxSize)
 
     if (chooserName && *chooserName)
     {
-      int length = (*chooserName)[0] ;
-      if ( length + 1 > maxSize )
-      {
-        length = maxSize - 1 ;
-      }
-      strncpy( buf , (char*) &(*chooserName)[1] , length ) ;
-      buf[length] = 0 ;
+        HLock( (Handle) chooserName ) ;
+        wxString name = wxMacMakeStringFromPascal( *chooserName ) ;
+        HUnlock( (Handle) chooserName ) ;
+        ReleaseResource( (Handle) chooserName ) ;
+        wxStrncpy( buf , name , maxSize - 1 ) ;
     }
     else
         buf[0] = 0 ;
@@ -250,22 +250,25 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
 
 bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%.4f", value);
+    wxString buf;
+    buf.Printf(wxT("%.4f"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%ld", value);
+    wxString buf;
+    buf.Printf(wxT("%ld"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
 bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file)
 {
-    char buf[50];
-    sprintf(buf, "%d", value);
+    wxString buf;
+    buf.Printf(wxT("%d"), value);
+
     return wxWriteResource(section, entry, buf, file);
 }
 
@@ -369,7 +372,7 @@ wxString wxMacFindFolder( short        vol,
 }
 
 #ifndef __DARWIN__
-char *wxGetUserHome (const wxString& user)
+wxChar *wxGetUserHome (const wxString& user)
 {
     // TODO
     return NULL;
@@ -390,7 +393,7 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
       p = p.Mid(1,pos) ;
     }
     
-    p = p + ":" ;
+    p = p + wxT(":") ;
     
     Str255 volumeName ;
     XVolumeParam pb ;
@@ -501,7 +504,7 @@ wxString wxGetOsDescription()
     // use configure generated description if available
     return wxString("MacOS (") + WXWIN_OS_DESCRIPTION + wxString(")");
 #else
-    return "MacOS" ; //TODO:define further
+    return wxT("MacOS") ; //TODO:define further
 #endif
 }
 
@@ -593,10 +596,185 @@ void wxMacConvertToPC( const char *from , char *to , int len )
     }
 }
 
-wxString wxMacMakeMacStringFromPC( const char * p )
+TECObjectRef s_TECNativeCToUnicode = NULL ;
+TECObjectRef s_TECUnicodeToNativeC = NULL ;
+TECObjectRef s_TECPCToNativeC = NULL ;
+TECObjectRef s_TECNativeCToPC = NULL ;
+void wxMacSetupConverters() 
 {
+    // if we assume errors are happening here we need low level debugging since the high level assert will use the encoders that 
+    // are not yet setup...
+    
+    OSStatus status = noErr ;
+    status = TECCreateConverter(&s_TECNativeCToUnicode, 
+       wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+
+
+    status = TECCreateConverter(&s_TECUnicodeToNativeC, 
+       kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
+
+    if ( !wxApp::s_macDefaultEncodingIsPC )
+    {
+        status = TECCreateConverter(&s_TECPCToNativeC, 
+               kTextEncodingWindowsLatin1, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
+
+               
+        status = TECCreateConverter(&s_TECNativeCToPC, 
+               wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingWindowsLatin1 );
+    }
+}
+
+void wxMacCleanupConverters()
+{
+    OSStatus status = noErr ;
+    status = TECDisposeConverter(s_TECNativeCToUnicode);
+
+    status = TECDisposeConverter(s_TECUnicodeToNativeC);
+
+    status = TECDisposeConverter(s_TECPCToNativeC);
+
+    status = TECDisposeConverter(s_TECNativeCToPC);
+}
+
+wxWCharBuffer wxMacStringToWString( const wxString &from ) 
+{
+#if wxUSE_UNICODE
+    wxWCharBuffer result( from.wc_str() ) ;
+#else
+    OSStatus status = noErr ;
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = from.Length() ;
+    ByteCount byteBufferLen = byteInLen *2 ;
+    wxWCharBuffer result( from.Length() ) ;
+    status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
+        (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+    result.data()[byteOutLen/2] = 0 ;
+#endif
+    return result ;
+}
+
+wxString wxMacMakeStringFromCString( const char * from , int len ) 
+{
+    OSStatus status = noErr ;
     wxString result ;
-    int len = strlen ( p ) ;
+    wxChar* buf = result.GetWriteBuf( len ) ;
+#if wxUSE_UNICODE
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = len ;
+    ByteCount byteBufferLen = len *2 ;
+
+    status = TECConvertText(s_TECNativeCToUnicode, (ConstTextPtr)from , byteInLen, &byteInLen,
+        (TextPtr)buf, byteBufferLen, &byteOutLen);
+#else
+    if ( wxApp::s_macDefaultEncodingIsPC )
+        memcpy( buf , from , len ) ;
+    else
+    {
+        OSStatus status = noErr ;
+        ByteCount byteOutLen ;
+        ByteCount byteInLen = len ;
+        ByteCount byteBufferLen = byteInLen ;
+
+        status = TECConvertText(s_TECNativeCToPC, (ConstTextPtr)from , byteInLen, &byteInLen,
+            (TextPtr)buf, byteBufferLen, &byteOutLen);
+    }
+#endif
+    buf[len] = 0 ;
+    result.UngetWriteBuf() ;
+    return result ;
+}
+
+wxString wxMacMakeStringFromCString( const char * from )
+{
+    return wxMacMakeStringFromCString( from , strlen(from) ) ;
+}
+
+wxCharBuffer wxMacStringToCString( const wxString &from ) 
+{
+#if wxUSE_UNICODE
+    OSStatus status = noErr ;
+    ByteCount byteOutLen ;
+    ByteCount byteInLen = from.Length() * 2 ;
+    ByteCount byteBufferLen = from.Length() ;
+    wxCharBuffer result( from.Length() ) ;
+    status = TECConvertText(s_TECUnicodeToNativeC , (ConstTextPtr)from.wc_str() , byteInLen, &byteInLen,
+        (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+    return result ;
+#else
+    if ( wxApp::s_macDefaultEncodingIsPC )
+        return wxCharBuffer( from.c_str() ) ;
+    else
+    {
+        wxCharBuffer result( from.Length() ) ;
+        OSStatus status = noErr ;
+        ByteCount byteOutLen ;
+        ByteCount byteInLen = from.Length() ;
+        ByteCount byteBufferLen = byteInLen ;
+
+        status = TECConvertText(s_TECPCToNativeC, (ConstTextPtr)from.c_str() , byteInLen, &byteInLen,
+            (TextPtr)result.data(), byteBufferLen, &byteOutLen);
+        return result ;
+    }
+#endif
+}
+
+void wxMacStringToPascal( const wxString&from , StringPtr to ) 
+{
+    wxCharBuffer buf = wxMacStringToCString( from ) ;
+    int len = strlen(buf) ;
+
+    if ( len > 255 )
+        len = 255 ;
+    to[0] = len ;
+    memcpy( (char*) &to[1] , buf , len ) ;
+}
+
+wxString wxMacMakeStringFromPascal( ConstStringPtr from ) 
+{
+    return wxMacMakeStringFromCString( (char*) &from[1] , from[0] ) ;
+}
+
+// 
+// CFStringRefs (Carbon only)
+//
+
+#if TARGET_CARBON
+// converts this string into a carbon foundation string with optional pc 2 mac encoding
+void wxMacCFStringHolder::Assign( const wxString &str ) 
+{
+#if wxUSE_UNICODE
+       m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault, 
+               (const unsigned short*)str.wc_str(), str.Len() );
+#else
+    m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
+        wxApp::s_macDefaultEncodingIsPC ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+#endif
+    m_release = true ;
+}
+
+wxString wxMacCFStringHolder::AsString() 
+{
+    wxString result ;
+    Size len = CFStringGetLength( m_cfs )  ;
+    wxChar* buf = result.GetWriteBuf( len ) ;
+#if wxUSE_UNICODE
+    CFStringGetCharacters( m_cfs , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
+#else
+    CFStringGetCString( m_cfs , buf , len+1 , s_macDefaultEncodingIsPC ? 
+        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
+#endif
+    buf[len] = 0 ;
+    result.UngetWriteBuf() ;
+    return result ;
+}
+
+#if 0
+
+wxString wxMacMakeMacStringFromPC( const wxChar * p )
+{
+    wxString result ;
+    int len = wxStrlen ( p ) ;
     if ( len > 0 )
     {
         wxChar* ptr = result.GetWriteBuf(len) ;
@@ -607,10 +785,10 @@ wxString wxMacMakeMacStringFromPC( const char * p )
     return result ;
 }
 
-wxString wxMacMakePCStringFromMac( const char * p )
+wxString wxMacMakePCStringFromMac( const wxChar * p )
 {
     wxString result ;
-    int len = strlen ( p ) ;
+    int len = wxStrlen ( p ) ;
     if ( len > 0 )
     {
         wxChar* ptr = result.GetWriteBuf(len) ;
@@ -621,7 +799,7 @@ wxString wxMacMakePCStringFromMac( const char * p )
     return result ;
 }
 
-wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding )
+wxString wxMacMakeStringFromMacString( const wxChar* from , bool mac2pcEncoding )
 {
     if (mac2pcEncoding)
     {
@@ -652,7 +830,7 @@ wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding )
     }
 }
 
-void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding )
+void wxMacStringToPascal( const wxChar * from , StringPtr to , bool pc2macEncoding )
 {
     if (pc2macEncoding)
     {
@@ -663,19 +841,8 @@ void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding
       CopyCStringToPascal( from , to ) ;
     }
 }
+#endif
 
-// 
-// CFStringRefs (Carbon only)
-//
-
-#if TARGET_CARBON
-// converts this string into a carbon foundation string with optional pc 2 mac encoding
-CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) 
-{
-    return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
-        pc2macEncoding ? 
-        kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
-}
 
 #endif //TARGET_CARBON
 
index 0c5aac8bfcc5fee2bbc1a495ac24e6804cfc1305..35accb91670fa30805afea67f65bf90a326b5dc5 100644 (file)
@@ -135,23 +135,18 @@ bool wxWave::Create(const wxString& fileName, bool isResource)
 //don't know what to do with looped, wth
 bool wxWave::Play(bool async, bool looped) const
 {
-    char lpSnd[32];
     bool ret = false;
 
     if (m_isResource)
     {
-#if TARGET_CARBON
-      c2pstrcpy((unsigned char *)lpSnd, m_sndname);
-#else
-      strcpy(lpSnd, m_sndname);
-      c2pstr((char *) lpSnd);
-#endif
-      SndListHandle hSnd;
+       Str255 snd ;
+       wxMacStringToPascal( m_sndname , snd ) ;
+       SndListHandle hSnd;
 
-      hSnd = (SndListHandle) GetNamedResource('snd ',(const unsigned char *) lpSnd);
+       hSnd = (SndListHandle) GetNamedResource('snd ', snd);
 
-      if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
-        ret = true;
+       if ((hSnd != NULL) && (SndPlay((SndChannelPtr)m_sndChan, (SndListHandle) hSnd, async) == noErr))
+               ret = true;
     }
 
     return ret;
index 156527a083c29fd7509a09f7da69ead199e44938..9f7a20f4e7a0be3afa0b3844757d33b1002d5032 100644 (file)
@@ -1642,7 +1642,7 @@ wxString wxWindowMac::MacGetToolTipString( wxPoint &pt )
     {
         return m_tooltip->GetTip() ;
     }
-    return "" ;
+    return wxEmptyString ;
 }
 
 void wxWindowMac::Update()
@@ -1855,13 +1855,13 @@ WXHWND wxWindowMac::MacGetRootWindow() const
 
         iter = iter->GetParent() ;
     }
-    wxASSERT_MSG( 1 , "No valid mac root window" ) ;
+    wxASSERT_MSG( 1 , wxT("No valid mac root window") ) ;
     return NULL ;
 }
 
 void wxWindowMac::MacCreateScrollBars( long style )
 {
-    wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , "attempt to create window twice" ) ;
+    wxASSERT_MSG( m_vScrollBar == NULL && m_hScrollBar == NULL , wxT("attempt to create window twice") ) ;
 
     bool hasBoth = ( style & wxVSCROLL ) && ( style & wxHSCROLL ) ;
     int adjust = hasBoth ? MAC_SCROLLBAR_SIZE - 1: 0 ;
index 3b238dd0b27e4c101f4b71582629e06a697acffb..98622f11b09b893658f75303acac91c32f78350a 100755 (executable)
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS></FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS></FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <FILEKIND>Text</FILEKIND>
                     <FILEFLAGS>Debug</FILEFLAGS>
                 </FILE>
-                <FILE>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                    <FILEKIND>Text</FILEKIND>
-                    <FILEFLAGS>Debug</FILEFLAGS>
-                </FILE>
                 <FILE>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcprint.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:mac:</ACCESSPATH>
-                    <PATH>:aga.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:appcmn.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:common:</ACCESSPATH>
-                    <PATH>:odbc.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                     <PATH>:dcbuffer.cpp</PATH>
                     <PATHFORMAT>MacOS</PATHFORMAT>
                 </FILEREF>
-                <FILEREF>
-                    <PATHTYPE>PathRelative</PATHTYPE>
-                    <PATHROOT>Project</PATHROOT>
-                    <ACCESSPATH>:generic:</ACCESSPATH>
-                    <PATH>:gridg.cpp</PATH>
-                    <PATHFORMAT>MacOS</PATHFORMAT>
-                </FILEREF>
                 <FILEREF>
                     <PATHTYPE>PathRelative</PATHTYPE>
                     <PATHROOT>Project</PATHROOT>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <!-- Settings for "FTP Panel" panel -->
                 <SETTING><NAME>MWFTP_Post_hostName</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_username</NAME><VALUE></VALUE></SETTING>
-                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#151;&#244;0#&#222;#&#144;#&#222;\1f&#200;</VALUE></SETTING>
+                <SETTING><NAME>MWFTP_Post_password</NAME><VALUE>0&#255;&#196; \ 5&#230;\a&#248;&#144;"&#178;&#184;</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_remoteDir</NAME><VALUE></VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathVersion</NAME><VALUE>1</VALUE></SETTING>
                 <SETTING><NAME>MWFTP_Post_ftp_PathType</NAME><VALUE>0</VALUE></SETTING>
                 <PATH>:object.cpp</PATH>
                 <PATHFORMAT>MacOS</PATHFORMAT>
             </FILEREF>
-            <FILEREF>
-                <TARGETNAME>wxlib PPC debug</TARGETNAME>
-                <PATHTYPE>PathRelative</PATHTYPE>
-                <PATHROOT>Project</PATHROOT>
-                <ACCESSPATH>:common:</ACCESSPATH>
-                <PATH>:odbc.cpp</PATH>
-                <PATHFORMAT>MacOS</PATHFORMAT>
-            </FILEREF>
             <FILEREF>
                 <TARGETNAME>wxlib PPC debug</TARGETNAME>
                 <PATHTYPE>PathRelative</PATHTYPE>
                 <PATH>:gridctrl.cpp</PATH>
                 <PATHFORMAT>MacOS</PATHFORMAT>
             </FILEREF>
-            <FILEREF>
-                <TARGETNAME>wxlib PPC debug</TARGETNAME>
-                <PATHTYPE>PathRelative</PATHTYPE>
-                <PATHROOT>Project</PATHROOT>
-                <ACCESSPATH>:generic:</ACCESSPATH>
-                <PATH>:gridg.cpp</PATH>
-                <PATHFORMAT>MacOS</PATHFORMAT>
-            </FILEREF>
             <FILEREF>
                 <TARGETNAME>wxlib PPC debug</TARGETNAME>
                 <PATHTYPE>PathRelative</PATHTYPE>
                 <PATH>:accel.cpp</PATH>
                 <PATHFORMAT>MacOS</PATHFORMAT>
             </FILEREF>
-            <FILEREF>
-                <TARGETNAME>wxlib PPC debug</TARGETNAME>
-                <PATHTYPE>PathRelative</PATHTYPE>
-                <PATHROOT>Project</PATHROOT>
-                <ACCESSPATH>:mac:</ACCESSPATH>
-                <PATH>:aga.cpp</PATH>
-                <PATHFORMAT>MacOS</PATHFORMAT>
-            </FILEREF>
             <FILEREF>
                 <TARGETNAME>wxlib PPC debug</TARGETNAME>
                 <PATHTYPE>PathRelative</PATHTYPE>