fixing 10.5 only compiles
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50357 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
|
||||||
|
|
||||||
#include "wx/mac/private.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// wxFontDialog
|
// wxFontDialog
|
||||||
@@ -66,18 +66,33 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
wxFontDialog *fontdialog = (wxFontDialog*) userData ;
|
wxFontDialog *fontdialog = (wxFontDialog*) userData ;
|
||||||
wxFontData& fontdata= fontdialog->GetFontData() ;
|
wxFontData& fontdata= fontdialog->GetFontData() ;
|
||||||
|
|
||||||
wxMacCarbonEvent cEvent( event );
|
wxMacCarbonEvent cEvent( event );
|
||||||
switch(cEvent.GetKind())
|
switch(cEvent.GetKind())
|
||||||
{
|
{
|
||||||
case kEventFontSelection :
|
case kEventFontSelection :
|
||||||
{
|
{
|
||||||
|
bool setup = false ;
|
||||||
|
#if wxMAC_USE_CORE_TEXT
|
||||||
|
if ( UMAGetSystemVersion() >= 0x1050 )
|
||||||
|
{
|
||||||
|
CTFontDescriptorRef descr;
|
||||||
|
if ( cEvent.GetParameter<CTFontDescriptorRef>( kEventParamCTFontDescriptor, typeCTFontDescriptorRef, &descr ) == noErr )
|
||||||
|
{
|
||||||
|
wxFont font;
|
||||||
|
font.MacCreateFromCTFontDescriptor(descr);
|
||||||
|
fontdata.SetChosenFont( font ) ;
|
||||||
|
setup = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if wxMAC_USE_ATSU_TEXT
|
||||||
ATSUFontID fontId = 0 ;
|
ATSUFontID fontId = 0 ;
|
||||||
if ( cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr )
|
if ( !setup && (cEvent.GetParameter<ATSUFontID>(kEventParamATSUFontID, &fontId) == noErr) )
|
||||||
{
|
{
|
||||||
FMFontStyle fontStyle = cEvent.GetParameter<FMFontStyle>(kEventParamFMFontStyle);
|
FMFontStyle fontStyle = cEvent.GetParameter<FMFontStyle>(kEventParamFMFontStyle);
|
||||||
FMFontSize fontSize = cEvent.GetParameter<FMFontSize>(kEventParamFMFontSize);
|
FMFontSize fontSize = cEvent.GetParameter<FMFontSize>(kEventParamFMFontSize);
|
||||||
|
|
||||||
CFStringRef cfName = NULL;
|
CFStringRef cfName = NULL;
|
||||||
#if 1
|
#if 1
|
||||||
FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
|
FMFontFamily fontFamily = cEvent.GetParameter<FMFontFamily>(kEventParamFMFontFamily);
|
||||||
@@ -89,25 +104,25 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
ByteCount actualLength = 0;
|
ByteCount actualLength = 0;
|
||||||
char *c = NULL;
|
char *c = NULL;
|
||||||
OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
OSStatus err = ATSUFindFontName(fontId , kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
||||||
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
||||||
if ( err == noErr)
|
if ( err == noErr)
|
||||||
{
|
{
|
||||||
actualLength += 1 ;
|
actualLength += 1 ;
|
||||||
char *c = (char*)malloc( actualLength );
|
char *c = (char*)malloc( actualLength );
|
||||||
err = ATSUFindFontName(fontId, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
err = ATSUFindFontName(fontId, kFontFamilyName, kFontUnicodePlatform, kFontNoScriptCode,
|
||||||
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
||||||
cfName = CFStringCreateWithCharacters(NULL, (UniChar*) c, (actualLength-1) >> 1);
|
cfName = CFStringCreateWithCharacters(NULL, (UniChar*) c, (actualLength-1) >> 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = ATSUFindFontName(fontId , kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
err = ATSUFindFontName(fontId , kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
||||||
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
kFontNoLanguageCode , 0 , NULL , &actualLength , NULL );
|
||||||
if ( err == noErr )
|
if ( err == noErr )
|
||||||
{
|
{
|
||||||
actualLength += 1 ;
|
actualLength += 1 ;
|
||||||
c = (char*)malloc(actualLength);
|
c = (char*)malloc(actualLength);
|
||||||
err = ATSUFindFontName(fontId, kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
err = ATSUFindFontName(fontId, kFontFamilyName, kFontNoPlatformCode, kFontNoScriptCode,
|
||||||
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
kFontNoLanguageCode, actualLength, c , NULL, NULL);
|
||||||
c[actualLength-1] = 0;
|
c[actualLength-1] = 0;
|
||||||
cfName = CFStringCreateWithCString(NULL, c, kCFStringEncodingMacRoman );
|
cfName = CFStringCreateWithCString(NULL, c, kCFStringEncodingMacRoman );
|
||||||
}
|
}
|
||||||
@@ -115,7 +130,6 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
if ( c!=NULL )
|
if ( c!=NULL )
|
||||||
free(c);
|
free(c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( cfName!=NULL )
|
if ( cfName!=NULL )
|
||||||
{
|
{
|
||||||
fontdata.m_chosenFont.SetFaceName(wxMacCFStringHolder(cfName).AsString(wxLocale::GetSystemEncoding()));
|
fontdata.m_chosenFont.SetFaceName(wxMacCFStringHolder(cfName).AsString(wxLocale::GetSystemEncoding()));
|
||||||
@@ -125,7 +139,9 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
|
fontdata.m_chosenFont.SetWeight(fontStyle & bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // wxMAC_USE_ATSU_TEXT
|
||||||
|
|
||||||
|
// retrieving the color
|
||||||
RGBColor fontColor ;
|
RGBColor fontColor ;
|
||||||
if ( cEvent.GetParameter<RGBColor>(kEventParamFontColor, &fontColor) == noErr )
|
if ( cEvent.GetParameter<RGBColor>(kEventParamFontColor, &fontColor) == noErr )
|
||||||
{
|
{
|
||||||
@@ -143,8 +159,8 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
CFDataRef sizesData;
|
CFDataRef sizesData;
|
||||||
CFDataRef valuesData;
|
CFDataRef valuesData;
|
||||||
if ( CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeTagsKey, (const void **)&tagsData) &&
|
if ( CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeTagsKey, (const void **)&tagsData) &&
|
||||||
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeSizesKey, (const void **)&sizesData) &&
|
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeSizesKey, (const void **)&sizesData) &&
|
||||||
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeValuesKey, (const void **)&valuesData) )
|
CFDictionaryGetValueIfPresent(attributesDict, kFontPanelAttributeValuesKey, (const void **)&valuesData) )
|
||||||
{
|
{
|
||||||
ItemCount count = CFDataGetLength(tagsData)/sizeof(ATSUAttributeTag);
|
ItemCount count = CFDataGetLength(tagsData)/sizeof(ATSUAttributeTag);
|
||||||
ATSUAttributeTag *tagPtr = (ATSUAttributeTag *)CFDataGetBytePtr(tagsData);
|
ATSUAttributeTag *tagPtr = (ATSUAttributeTag *)CFDataGetBytePtr(tagsData);
|
||||||
@@ -167,7 +183,7 @@ wxMacCarbonFontPanelHandler(EventHandlerCallRef WXUNUSED(nextHandler),
|
|||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,8 +217,23 @@ int wxFontDialog::ShowModal()
|
|||||||
font = m_fontData.m_initialFont ;
|
font = m_fontData.m_initialFont ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle();
|
bool setup = false;
|
||||||
err = SetFontInfoForSelection (kFontSelectionATSUIType,1, &style , NULL);
|
#if wxMAC_USE_CORE_TEXT
|
||||||
|
if ( UMAGetSystemVersion() >= 0x1050 )
|
||||||
|
{
|
||||||
|
CTFontDescriptorRef descr = (CTFontDescriptorRef)font.MacGetCTFontDescriptor();
|
||||||
|
err = SetFontInfoForSelection (kFontSelectionCoreTextType,1, &descr , NULL);
|
||||||
|
setup = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if wxMAC_USE_ATSU_TEXT
|
||||||
|
if ( !setup )
|
||||||
|
{
|
||||||
|
ATSUStyle style = (ATSUStyle)font.MacGetATSUStyle();
|
||||||
|
err = SetFontInfoForSelection (kFontSelectionATSUIType,1, &style , NULL);
|
||||||
|
setup = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
// just clicking on ENTER will not send us any font setting event, therefore we have to make sure
|
// just clicking on ENTER will not send us any font setting event, therefore we have to make sure
|
||||||
// that field is already correct
|
// that field is already correct
|
||||||
m_fontData.m_chosenFont = font ;
|
m_fontData.m_chosenFont = font ;
|
||||||
|
@@ -2769,26 +2769,34 @@ void wxMacDataBrowserListCtrlControl::DrawItem(
|
|||||||
|
|
||||||
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
|
HIThemeTextHorizontalFlush hFlush = kHIThemeTextHorizontalFlushLeft;
|
||||||
HIThemeTextInfo info;
|
HIThemeTextInfo info;
|
||||||
|
bool setup = false;
|
||||||
#ifdef __LP64__
|
#if wxMAC_USE_CORE_TEXT
|
||||||
info.version = kHIThemeTextInfoVersionOne;
|
if ( UMAGetSystemVersion() >= 0x1050 )
|
||||||
info.fontID = kThemeViewsFont;
|
|
||||||
if (font.Ok())
|
|
||||||
{
|
{
|
||||||
info.fontID = kThemeSpecifiedFont;
|
info.version = kHIThemeTextInfoVersionOne;
|
||||||
info.font = (CTFontRef) font.MacGetCTFont();
|
info.fontID = kThemeViewsFont;
|
||||||
|
if (font.Ok())
|
||||||
|
{
|
||||||
|
info.fontID = kThemeSpecifiedFont;
|
||||||
|
info.font = (CTFontRef) font.MacGetCTFont();
|
||||||
|
setup = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#endif
|
||||||
info.version = kHIThemeTextInfoVersionZero;
|
#if wxMAC_USE_ATSU_TEXT
|
||||||
info.fontID = kThemeViewsFont;
|
if ( !setup )
|
||||||
|
|
||||||
if (font.Ok())
|
|
||||||
{
|
{
|
||||||
if (font.GetFamily() != wxFONTFAMILY_DEFAULT)
|
info.version = kHIThemeTextInfoVersionZero;
|
||||||
info.fontID = font.MacGetThemeFontID();
|
info.fontID = kThemeViewsFont;
|
||||||
|
|
||||||
::TextSize( (short)(font.MacGetFontSize()) ) ;
|
if (font.Ok())
|
||||||
::TextFace( font.MacGetFontStyle() ) ;
|
{
|
||||||
|
if (font.GetFamily() != wxFONTFAMILY_DEFAULT)
|
||||||
|
info.fontID = font.MacGetThemeFontID();
|
||||||
|
|
||||||
|
::TextSize( (short)(font.MacGetFontSize()) ) ;
|
||||||
|
::TextFace( font.MacGetFontStyle() ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -1101,7 +1101,7 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant )
|
|||||||
m_peer->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
|
m_peer->SetData<ControlSize>(kControlEntireControl, kControlSizeTag, &size ) ;
|
||||||
|
|
||||||
wxFont font ;
|
wxFont font ;
|
||||||
font.MacCreateThemeFont( themeFont ) ;
|
font.MacCreateFromThemeFont( themeFont ) ;
|
||||||
SetFont( font ) ;
|
SetFont( font ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user