From a9412f8f03171fdd3606a4ad3db9c9da8fe6bd7c Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sun, 8 Feb 2004 06:23:07 +0000 Subject: [PATCH] font encoding support git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/choice.cpp | 6 +++--- src/mac/carbon/control.cpp | 6 +++--- src/mac/carbon/dc.cpp | 8 ++++---- src/mac/carbon/filedlg.cpp | 10 +++++----- src/mac/carbon/listbox.cpp | 4 ++-- src/mac/carbon/menu.cpp | 24 ++++++++++++------------ src/mac/carbon/menuitem.cpp | 4 ++-- src/mac/carbon/msgdlg.cpp | 8 ++++---- src/mac/carbon/printmac.cpp | 2 +- src/mac/carbon/tooltip.cpp | 2 +- src/mac/choice.cpp | 6 +++--- src/mac/control.cpp | 6 +++--- src/mac/dc.cpp | 8 ++++---- src/mac/filedlg.cpp | 10 +++++----- src/mac/listbox.cpp | 4 ++-- src/mac/menu.cpp | 24 ++++++++++++------------ src/mac/menuitem.cpp | 4 ++-- src/mac/msgdlg.cpp | 8 ++++---- src/mac/printmac.cpp | 2 +- src/mac/tooltip.cpp | 2 +- 20 files changed, 74 insertions(+), 74 deletions(-) diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index a18113dbf3..9f8494db9a 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -90,7 +90,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, // ---------------------------------------------------------------------------- int wxChoice::DoAppend(const wxString& item) { - UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item); + UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item, m_font.GetEncoding() ); m_strings.Add( item ) ; m_datas.Add( NULL ) ; int index = m_strings.GetCount() - 1 ; @@ -107,7 +107,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) if (pos == GetCount()) return DoAppend(item); - UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item); + UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item, m_font.GetEncoding() ); m_strings.Insert( item, pos ) ; m_datas.Insert( NULL, pos ) ; DoSetItemClientData( pos , NULL ) ; @@ -277,7 +277,7 @@ wxSize wxChoice::DoGetBestSize() const #if wxUSE_UNICODE Point bounds={0,0} ; SInt16 baseline ; - ::GetThemeTextDimensions( wxMacCFStringHolder( str ) , + ::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) , kThemeCurrentPortFont, kThemeStateActive, false, diff --git a/src/mac/carbon/control.cpp b/src/mac/carbon/control.cpp index 31e38de31a..b469c40ef4 100644 --- a/src/mac/carbon/control.cpp +++ b/src/mac/carbon/control.cpp @@ -207,7 +207,7 @@ void wxControl::SetLabel(const wxString& title) if ( m_macControl ) { - UMASetControlTitle( (ControlHandle) m_macControl , m_label ) ; + UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ; } Refresh() ; } @@ -338,7 +338,7 @@ void wxControl::MacPostControlCreate() controlstyle.flags = kControlUseFontMask ; if (IsKindOf( CLASSINFO( wxButton ) ) ) - controlstyle.font = kControlFontSmallSystemFont ; // eventually kControlFontBigSystemFont ; + controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ; else controlstyle.font = kControlFontSmallSystemFont ; @@ -400,7 +400,7 @@ void wxControl::MacPostControlCreate() SetSize(pos.x, pos.y, new_size.x, new_size.y); #if wxUSE_UNICODE - UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) ) ; + UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ; #endif if ( m_macControlIsShown ) diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index 15bf719bd1..7b95aef88a 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -1485,7 +1485,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) if ( useDrawThemeText ) { Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; if ( m_backgroundMode != wxTRANSPARENT ) { Point bounds={0,0} ; @@ -1527,7 +1527,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) if ( useDrawThemeText ) { Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding()) ; if ( m_backgroundMode != wxTRANSPARENT ) { @@ -1614,7 +1614,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h { Point bounds={0,0} ; SInt16 baseline ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; ::GetThemeTextDimensions( mString, kThemeCurrentPortFont, kThemeStateActive, @@ -1642,7 +1642,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h { Point bounds={0,0} ; SInt16 baseline ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; ::GetThemeTextDimensions( mString, kThemeCurrentPortFont, kThemeStateActive, diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index e70ffbdf4c..677a77151e 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -141,7 +141,7 @@ NavEventProc( { sfilename = sfilename.Left(pos+1)+extension ; #if TARGET_CARBON - cfString = sfilename ; + cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ; NavDialogSetSaveFileName( ioParams->context , cfString ) ; #else wxMacStringToPascal( sfilename , filename ) ; @@ -356,7 +356,7 @@ int wxFileDialog::ShowModal() #else CFStringRef titleRef = ::CFStringCreateWithCString(NULL, m_message.c_str(), - CFStringGetSystemEncoding()); + m_font.GetEncoding() ); #endif dialogCreateOptions.windowTitle = titleRef; #if wxUSE_UNICODE @@ -366,7 +366,7 @@ int wxFileDialog::ShowModal() #else CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL, m_fileName.c_str(), - CFStringGetSystemEncoding()); + m_font.GetEncoding()); #endif dialogCreateOptions.saveFileName = defaultFileNameRef; NavDialogRef dialog; @@ -403,7 +403,7 @@ int wxFileDialog::ShowModal() myData.menuitems = dialogCreateOptions.popupExtension ; for ( size_t i = 0 ; i < numfilters ; ++i ) { - CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ; + CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , m_font.GetEncoding() ) ) ; } } @@ -484,7 +484,7 @@ int wxFileDialog::ShowModal() CFURLPathStyle pathstyle = kCFURLHFSPathStyle; #endif CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle); - thePath = wxMacCFStringHolder(cfString).AsString(); + thePath = wxMacCFStringHolder(cfString).AsString(m_font.GetEncoding()); if (!thePath) { ::NavDisposeReply(&navReply); diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index ea675aaf1c..128f87af9e 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -123,7 +123,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect { Rect frame = { drawRect->top, drawRect->left + 4, drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ; - CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext) ) ; + CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext , list->GetFont().GetEncoding()) ) ; ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ; ::DrawThemeTextBox( mString, kThemeCurrentPortFont, @@ -636,7 +636,7 @@ wxSize wxListBox::DoGetBestSize() const #if wxUSE_UNICODE Point bounds={0,0} ; SInt16 baseline ; - ::GetThemeTextDimensions( wxMacCFStringHolder( str ) , + ::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) , kThemeCurrentPortFont, kThemeStateActive, false, diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index e4e0879b02..9a04c36935 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -70,7 +70,7 @@ void wxMenu::Init() // create the menu m_macMenuId = s_macNextMenuId++; - m_hMenu = UMANewMenu(m_macMenuId, m_title); + m_hMenu = UMANewMenu(m_macMenuId, m_title, wxFont::GetDefaultEncoding() ); if ( !m_hMenu ) { @@ -130,9 +130,9 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) } if ( pos == (size_t)-1 ) - UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId); + UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pSubMenu->m_macMenuId); else - UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId); + UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pos, pSubMenu->m_macMenuId); pItem->UpdateItemBitmap() ; pItem->UpdateItemStatus() ; } @@ -140,7 +140,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) { if ( pos == (size_t)-1 ) { - UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") ); + UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , wxFont::GetDefaultEncoding() ); pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ; } else @@ -148,7 +148,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // MacOS counts menu items from 1 and inserts after, therefore having the // same effect as wx 0 based and inserting before, we must correct pos // after however for updates to be correct - UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos); + UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a"), wxFont::GetDefaultEncoding(), pos); pos += 1 ; } @@ -273,7 +273,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) void wxMenu::SetTitle(const wxString& label) { m_title = label ; - UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ; + UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ; } bool wxMenu::ProcessCommand(wxCommandEvent & event) { @@ -580,7 +580,7 @@ void wxMenuBar::MacInstallMenuBar() if ( item->GetId() == wxApp::s_macAboutMenuItemId ) { - UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() ); + UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() , wxFont::GetDefaultEncoding() ); UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true ); SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ; UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ; @@ -589,7 +589,7 @@ void wxMenuBar::MacInstallMenuBar() { if ( mh ) { - UMAAppendMenuItem(mh, item->GetText() , entry ); + UMAAppendMenuItem(mh, item->GetText() , wxFont::GetDefaultEncoding(), entry); SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ; } } @@ -601,7 +601,7 @@ void wxMenuBar::MacInstallMenuBar() } else { - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], m_font.GetEncoding() ) ; m_menus[i]->MacBeforeDisplay(false) ; ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); } @@ -684,7 +684,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ; { menu->MacBeforeDisplay( false ) ; - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( pos == m_menus.GetCount() - 1) { ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; @@ -709,7 +709,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) m_titles.Insert(title, pos); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( IsAttached() && s_macInstalledMenuBar == this ) { @@ -762,7 +762,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) m_titles.Add(title); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( IsAttached() ) { diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index c48bf24a81..6cc3aa1a79 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -130,7 +130,7 @@ void wxMenuItem::UpdateItemStatus() else ::SetItemMark( mhandle , index , 0 ) ; // no mark - UMASetMenuItemText( mhandle , index , m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; @@ -147,7 +147,7 @@ void wxMenuItem::UpdateItemText() if( mhandle == NULL || index == 0) return ; - UMASetMenuItemText( mhandle , index , m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; diff --git a/src/mac/carbon/msgdlg.cpp b/src/mac/carbon/msgdlg.cpp index b02af638f2..73548ad9f2 100644 --- a/src/mac/carbon/msgdlg.cpp +++ b/src/mac/carbon/msgdlg.cpp @@ -53,11 +53,11 @@ int wxMessageDialog::ShowModal() if ( UMAGetSystemVersion() >= 0x1000 ) { AlertStdCFStringAlertParamRec param ; - wxMacCFStringHolder cfNoString(_("No")) ; - wxMacCFStringHolder cfYesString( _("Yes")) ; + wxMacCFStringHolder cfNoString(_("No") , m_font.GetEncoding()) ; + wxMacCFStringHolder cfYesString( _("Yes") , m_font.GetEncoding()) ; - wxMacCFStringHolder cfTitle(m_caption); - wxMacCFStringHolder cfText(m_message); + wxMacCFStringHolder cfTitle(m_caption , m_font.GetEncoding()); + wxMacCFStringHolder cfText(m_message , m_font.GetEncoding()); param.movable = true; param.flags = 0 ; diff --git a/src/mac/carbon/printmac.cpp b/src/mac/carbon/printmac.cpp index 97e496f600..e95c44b3d0 100644 --- a/src/mac/carbon/printmac.cpp +++ b/src/mac/carbon/printmac.cpp @@ -144,7 +144,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintData* data ) // collate cannot be set #if 0 // not yet tested if ( m_printerName.Length() > 0 ) - PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName ) ) ; + PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ; #endif PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; diff --git a/src/mac/carbon/tooltip.cpp b/src/mac/carbon/tooltip.cpp index 3334d6b70b..f269196711 100644 --- a/src/mac/carbon/tooltip.cpp +++ b/src/mac/carbon/tooltip.cpp @@ -233,7 +233,7 @@ void wxMacToolTip::Draw() LocalToGlobal( (Point *) &tag.absHotRect.top ); LocalToGlobal( (Point *) &tag.absHotRect.bottom ); SetPort( port ); - m_helpTextRef = m_label ; + m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ; tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ; diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index a18113dbf3..9f8494db9a 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -90,7 +90,7 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, // ---------------------------------------------------------------------------- int wxChoice::DoAppend(const wxString& item) { - UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item); + UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item, m_font.GetEncoding() ); m_strings.Add( item ) ; m_datas.Add( NULL ) ; int index = m_strings.GetCount() - 1 ; @@ -107,7 +107,7 @@ int wxChoice::DoInsert(const wxString& item, int pos) if (pos == GetCount()) return DoAppend(item); - UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item); + UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item, m_font.GetEncoding() ); m_strings.Insert( item, pos ) ; m_datas.Insert( NULL, pos ) ; DoSetItemClientData( pos , NULL ) ; @@ -277,7 +277,7 @@ wxSize wxChoice::DoGetBestSize() const #if wxUSE_UNICODE Point bounds={0,0} ; SInt16 baseline ; - ::GetThemeTextDimensions( wxMacCFStringHolder( str ) , + ::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) , kThemeCurrentPortFont, kThemeStateActive, false, diff --git a/src/mac/control.cpp b/src/mac/control.cpp index 31e38de31a..b469c40ef4 100644 --- a/src/mac/control.cpp +++ b/src/mac/control.cpp @@ -207,7 +207,7 @@ void wxControl::SetLabel(const wxString& title) if ( m_macControl ) { - UMASetControlTitle( (ControlHandle) m_macControl , m_label ) ; + UMASetControlTitle( (ControlHandle) m_macControl , m_label , m_font.GetEncoding() ) ; } Refresh() ; } @@ -338,7 +338,7 @@ void wxControl::MacPostControlCreate() controlstyle.flags = kControlUseFontMask ; if (IsKindOf( CLASSINFO( wxButton ) ) ) - controlstyle.font = kControlFontSmallSystemFont ; // eventually kControlFontBigSystemFont ; + controlstyle.font = kControlFontBigSystemFont ; // eventually kControlFontBigSystemFont ; else controlstyle.font = kControlFontSmallSystemFont ; @@ -400,7 +400,7 @@ void wxControl::MacPostControlCreate() SetSize(pos.x, pos.y, new_size.x, new_size.y); #if wxUSE_UNICODE - UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) ) ; + UMASetControlTitle( (ControlHandle) m_macControl , wxStripMenuCodes(m_label) , m_font.GetEncoding() ) ; #endif if ( m_macControlIsShown ) diff --git a/src/mac/dc.cpp b/src/mac/dc.cpp index 15bf719bd1..7b95aef88a 100644 --- a/src/mac/dc.cpp +++ b/src/mac/dc.cpp @@ -1485,7 +1485,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) if ( useDrawThemeText ) { Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; if ( m_backgroundMode != wxTRANSPARENT ) { Point bounds={0,0} ; @@ -1527,7 +1527,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) if ( useDrawThemeText ) { Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding()) ; if ( m_backgroundMode != wxTRANSPARENT ) { @@ -1614,7 +1614,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h { Point bounds={0,0} ; SInt16 baseline ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; ::GetThemeTextDimensions( mString, kThemeCurrentPortFont, kThemeStateActive, @@ -1642,7 +1642,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h { Point bounds={0,0} ; SInt16 baseline ; - wxMacCFStringHolder mString( linetext ) ; + wxMacCFStringHolder mString( linetext , m_font.GetEncoding() ) ; ::GetThemeTextDimensions( mString, kThemeCurrentPortFont, kThemeStateActive, diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index e70ffbdf4c..677a77151e 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -141,7 +141,7 @@ NavEventProc( { sfilename = sfilename.Left(pos+1)+extension ; #if TARGET_CARBON - cfString = sfilename ; + cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ; NavDialogSetSaveFileName( ioParams->context , cfString ) ; #else wxMacStringToPascal( sfilename , filename ) ; @@ -356,7 +356,7 @@ int wxFileDialog::ShowModal() #else CFStringRef titleRef = ::CFStringCreateWithCString(NULL, m_message.c_str(), - CFStringGetSystemEncoding()); + m_font.GetEncoding() ); #endif dialogCreateOptions.windowTitle = titleRef; #if wxUSE_UNICODE @@ -366,7 +366,7 @@ int wxFileDialog::ShowModal() #else CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL, m_fileName.c_str(), - CFStringGetSystemEncoding()); + m_font.GetEncoding()); #endif dialogCreateOptions.saveFileName = defaultFileNameRef; NavDialogRef dialog; @@ -403,7 +403,7 @@ int wxFileDialog::ShowModal() myData.menuitems = dialogCreateOptions.popupExtension ; for ( size_t i = 0 ; i < numfilters ; ++i ) { - CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ; + CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , m_font.GetEncoding() ) ) ; } } @@ -484,7 +484,7 @@ int wxFileDialog::ShowModal() CFURLPathStyle pathstyle = kCFURLHFSPathStyle; #endif CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle); - thePath = wxMacCFStringHolder(cfString).AsString(); + thePath = wxMacCFStringHolder(cfString).AsString(m_font.GetEncoding()); if (!thePath) { ::NavDisposeReply(&navReply); diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index ea675aaf1c..128f87af9e 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -123,7 +123,7 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect { Rect frame = { drawRect->top, drawRect->left + 4, drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ; - CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext) ) ; + CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , wxMacCFStringHolder(linetext , list->GetFont().GetEncoding()) ) ; ::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ; ::DrawThemeTextBox( mString, kThemeCurrentPortFont, @@ -636,7 +636,7 @@ wxSize wxListBox::DoGetBestSize() const #if wxUSE_UNICODE Point bounds={0,0} ; SInt16 baseline ; - ::GetThemeTextDimensions( wxMacCFStringHolder( str ) , + ::GetThemeTextDimensions( wxMacCFStringHolder( str , m_font.GetEncoding() ) , kThemeCurrentPortFont, kThemeStateActive, false, diff --git a/src/mac/menu.cpp b/src/mac/menu.cpp index e4e0879b02..9a04c36935 100644 --- a/src/mac/menu.cpp +++ b/src/mac/menu.cpp @@ -70,7 +70,7 @@ void wxMenu::Init() // create the menu m_macMenuId = s_macNextMenuId++; - m_hMenu = UMANewMenu(m_macMenuId, m_title); + m_hMenu = UMANewMenu(m_macMenuId, m_title, wxFont::GetDefaultEncoding() ); if ( !m_hMenu ) { @@ -130,9 +130,9 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) } if ( pos == (size_t)-1 ) - UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId); + UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pSubMenu->m_macMenuId); else - UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId); + UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), wxFont::GetDefaultEncoding() , pos, pSubMenu->m_macMenuId); pItem->UpdateItemBitmap() ; pItem->UpdateItemStatus() ; } @@ -140,7 +140,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) { if ( pos == (size_t)-1 ) { - UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") ); + UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , wxFont::GetDefaultEncoding() ); pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ; } else @@ -148,7 +148,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) // MacOS counts menu items from 1 and inserts after, therefore having the // same effect as wx 0 based and inserting before, we must correct pos // after however for updates to be correct - UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a") , pos); + UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), wxT("a"), wxFont::GetDefaultEncoding(), pos); pos += 1 ; } @@ -273,7 +273,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) void wxMenu::SetTitle(const wxString& label) { m_title = label ; - UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ; + UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label , wxFont::GetDefaultEncoding() ) ; } bool wxMenu::ProcessCommand(wxCommandEvent & event) { @@ -580,7 +580,7 @@ void wxMenuBar::MacInstallMenuBar() if ( item->GetId() == wxApp::s_macAboutMenuItemId ) { - UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() ); + UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() , wxFont::GetDefaultEncoding() ); UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true ); SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ; UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ; @@ -589,7 +589,7 @@ void wxMenuBar::MacInstallMenuBar() { if ( mh ) { - UMAAppendMenuItem(mh, item->GetText() , entry ); + UMAAppendMenuItem(mh, item->GetText() , wxFont::GetDefaultEncoding(), entry); SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ; } } @@ -601,7 +601,7 @@ void wxMenuBar::MacInstallMenuBar() } else { - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i], m_font.GetEncoding() ) ; m_menus[i]->MacBeforeDisplay(false) ; ::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0); } @@ -684,7 +684,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title) ::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ; { menu->MacBeforeDisplay( false ) ; - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( pos == m_menus.GetCount() - 1) { ::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ; @@ -709,7 +709,7 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title) m_titles.Insert(title, pos); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( IsAttached() && s_macInstalledMenuBar == this ) { @@ -762,7 +762,7 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title) m_titles.Add(title); - UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ; + UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title , m_font.GetEncoding() ) ; if ( IsAttached() ) { diff --git a/src/mac/menuitem.cpp b/src/mac/menuitem.cpp index c48bf24a81..6cc3aa1a79 100644 --- a/src/mac/menuitem.cpp +++ b/src/mac/menuitem.cpp @@ -130,7 +130,7 @@ void wxMenuItem::UpdateItemStatus() else ::SetItemMark( mhandle , index , 0 ) ; // no mark - UMASetMenuItemText( mhandle , index , m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; @@ -147,7 +147,7 @@ void wxMenuItem::UpdateItemText() if( mhandle == NULL || index == 0) return ; - UMASetMenuItemText( mhandle , index , m_text ) ; + UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ; wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ; UMASetMenuItemShortcut( mhandle , index , entry ) ; delete entry ; diff --git a/src/mac/msgdlg.cpp b/src/mac/msgdlg.cpp index b02af638f2..73548ad9f2 100644 --- a/src/mac/msgdlg.cpp +++ b/src/mac/msgdlg.cpp @@ -53,11 +53,11 @@ int wxMessageDialog::ShowModal() if ( UMAGetSystemVersion() >= 0x1000 ) { AlertStdCFStringAlertParamRec param ; - wxMacCFStringHolder cfNoString(_("No")) ; - wxMacCFStringHolder cfYesString( _("Yes")) ; + wxMacCFStringHolder cfNoString(_("No") , m_font.GetEncoding()) ; + wxMacCFStringHolder cfYesString( _("Yes") , m_font.GetEncoding()) ; - wxMacCFStringHolder cfTitle(m_caption); - wxMacCFStringHolder cfText(m_message); + wxMacCFStringHolder cfTitle(m_caption , m_font.GetEncoding()); + wxMacCFStringHolder cfText(m_message , m_font.GetEncoding()); param.movable = true; param.flags = 0 ; diff --git a/src/mac/printmac.cpp b/src/mac/printmac.cpp index 97e496f600..e95c44b3d0 100644 --- a/src/mac/printmac.cpp +++ b/src/mac/printmac.cpp @@ -144,7 +144,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintData* data ) // collate cannot be set #if 0 // not yet tested if ( m_printerName.Length() > 0 ) - PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName ) ) ; + PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ; #endif PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; diff --git a/src/mac/tooltip.cpp b/src/mac/tooltip.cpp index 3334d6b70b..f269196711 100644 --- a/src/mac/tooltip.cpp +++ b/src/mac/tooltip.cpp @@ -233,7 +233,7 @@ void wxMacToolTip::Draw() LocalToGlobal( (Point *) &tag.absHotRect.top ); LocalToGlobal( (Point *) &tag.absHotRect.bottom ); SetPort( port ); - m_helpTextRef = m_label ; + m_helpTextRef.Assign( m_label , wxFONTENCODING_DEFAULT ) ; tag.content[kHMMinimumContentIndex].contentType = kHMCFStringContent ; tag.content[kHMMinimumContentIndex].u.tagCFString = m_helpTextRef ; tag.content[kHMMaximumContentIndex].contentType = kHMCFStringContent ; -- 2.45.2