compilation warnings fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20818 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-06-01 15:16:07 +00:00
parent 550e6c014c
commit 5be55d562f
14 changed files with 144 additions and 128 deletions

View File

@ -237,7 +237,6 @@ wxSize wxChoice::DoGetBestSize() const
#endif
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
Rect drawRect ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
@ -273,7 +272,6 @@ wxSize wxChoice::DoGetBestSize() const
// Add room for the popup arrow
lbWidth += 2 * lbHeight ;
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;

View File

@ -1321,8 +1321,11 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
#else
TECObjectRef ec;
status = TECCreateConverter(&ec,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
status = TECCreateConverter(&ec,
wxApp::s_macDefaultEncodingIsPC
? (int)kTextEncodingWindowsLatin1
: (int)kTextEncodingMacRoman,
kTextEncodingUnicodeDefault);
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
ByteCount byteOutLen ;
@ -1369,8 +1372,8 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
&textBefore , &textAfter, &ascent , &descent );
drawX += sin(angle/RAD2DEG) * FixedToInt(ascent) ;
drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
drawX += (int)(sin(angle/RAD2DEG) * FixedToInt(ascent));
drawY += (int)(cos(angle/RAD2DEG) * FixedToInt(ascent));
status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
IntToFixed(drawX) , IntToFixed(drawY) );
wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
@ -1808,7 +1811,7 @@ void wxDC::MacInstallFont() const
} ;
Boolean kTrue = true ;
Boolean kFalse = false ;
BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
//BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{

View File

@ -363,7 +363,7 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
void wxMenu::MacBeforeDisplay( bool isSubMenu )
{
wxMenuItem* previousItem = NULL ;
int pos ;
size_t pos ;
wxMenuItemList::Node *node;
wxMenuItem *item;
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
@ -382,7 +382,9 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
if ( GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
if ( GetMenuItems().GetCount() == pos + 1 &&
previousItem != NULL &&
previousItem->IsSeparator() )
{
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
}

View File

@ -234,8 +234,8 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
(int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
data->SetMinMarginBottomRight( wxPoint (
((double) rPaper.right - rPage.right ) * pt2mm ,
((double) rPaper.bottom - rPage.bottom ) * pt2mm ) ) ;
(wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
(wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
}
}
}

View File

@ -325,8 +325,6 @@ bool wxToolBar::Realize()
node = node->GetNext();
}
int separatorSize = GetToolSize().x / 4 ;
node = m_tools.GetFirst();
while (node)
{

View File

@ -844,7 +844,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
if ( kind == mouseDown )
{
if ( timestamp - gs_lastWhen <= GetDblTime() )
if ( timestamp - gs_lastWhen <= (long) GetDblTime() )
{
if ( abs( localwhere.h - gs_lastWhere.h ) < 3 && abs( localwhere.v - gs_lastWhere.v ) < 3 )
{

View File

@ -57,7 +57,7 @@ bool wxGetHostName(wxChar *buf, int maxSize)
// Gets Chooser name of user by examining a System resource.
const short kComputerNameID = -16413;
short oldResFile = CurResFile() ;
UseResFile(0);
StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
@ -95,7 +95,7 @@ bool wxGetUserName(wxChar *buf, int maxSize)
// Gets Chooser name of user by examining a System resource.
const short kChooserNameID = -16096;
short oldResFile = CurResFile() ;
UseResFile(0);
StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
@ -143,7 +143,7 @@ bool wxShell(const wxString& command)
return FALSE;
}
// Shutdown or reboot the PC
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
{
// TODO
@ -159,7 +159,7 @@ long wxGetFreeMemory()
void wxUsleep(unsigned long milliseconds)
{
clock_t start = clock() ;
do
do
{
YieldToAnyThread() ;
} while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
@ -182,17 +182,17 @@ void wxDebugMsg(const char *fmt ...)
{
va_list ap;
static char buffer[512];
if (!wxTheApp->GetWantDebugOutput())
return ;
va_start(ap, fmt);
vsprintf(buffer,fmt,ap) ;
strcat(buffer,";g") ;
c2pstr(buffer) ;
DebugStr((unsigned char*) buffer) ;
va_end(ap);
}
@ -223,9 +223,9 @@ void wxBell()
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
long theSystem ;
// are there x-platform conventions ?
Gestalt(gestaltSystemVersion, &theSystem) ;
if (minorVsn != NULL) {
*minorVsn = (theSystem & 0xFF ) ;
@ -338,7 +338,7 @@ void wxEndBusyCursor()
{
wxCHECK_RET( gs_wxBusyCursorCount > 0,
wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
if (--gs_wxBusyCursorCount == 0)
{
gMacStoredActiveCursor.MacInstall() ;
@ -359,7 +359,7 @@ wxString wxMacFindFolder( short vol,
short vRefNum ;
long dirID ;
wxString strDir ;
if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
{
FSSpec file ;
@ -382,19 +382,19 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
if ( path.empty() )
return FALSE;
wxString p = path ;
if (p[0] == ':' ) {
p = wxGetCwd() + p ;
}
int pos = p.Find(':') ;
if ( pos != wxNOT_FOUND ) {
p = p.Mid(1,pos) ;
}
p = p + wxT(":") ;
Str255 volumeName ;
XVolumeParam pb ;
@ -457,11 +457,11 @@ void wxDisplaySize(int *width, int *height)
{
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
if (width != NULL) {
if (width != NULL) {
*width = screenBits.bounds.right - screenBits.bounds.left ;
}
if (height != NULL) {
if (height != NULL) {
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
}
}
@ -472,10 +472,10 @@ void wxDisplaySizeMM(int *width, int *height)
// on mac 72 is fixed (at least now ;-)
float cvPt2Mm = 25.4 / 72;
if (width != NULL) {
if (width != NULL) {
*width = int( *width * cvPt2Mm );
}
if (height != NULL) {
if (height != NULL) {
*height = int( *height * cvPt2Mm );
}
}
@ -488,10 +488,10 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
if (x) *x = 0;
if (y) *y = 0;
if (width != NULL) {
if (width != NULL) {
*width = screenBits.bounds.right - screenBits.bounds.left ;
}
if (height != NULL) {
if (height != NULL) {
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
}
@ -501,7 +501,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
#else
mheight = LMGetMBarHeight() ;
#endif
if (height != NULL) {
if (height != NULL) {
*height -= mheight ;
}
if (y)
@ -615,27 +615,35 @@ TECObjectRef s_TECNativeCToUnicode = NULL ;
TECObjectRef s_TECUnicodeToNativeC = NULL ;
TECObjectRef s_TECPlatformToNativeC = NULL ;
TECObjectRef s_TECNativeCToPlatform = NULL ;
void wxMacSetupConverters()
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...
// 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...
const int kEncoding = wxApp::s_macDefaultEncodingIsPC
? (int)kTextEncodingWindowsLatin1
: (int)kTextEncodingMacRoman;
OSStatus status = noErr ;
status = TECCreateConverter(&s_TECNativeCToUnicode,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
status = TECCreateConverter(&s_TECNativeCToUnicode,
kEncoding,
kTextEncodingUnicodeDefault);
status = TECCreateConverter(&s_TECUnicodeToNativeC,
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
status = TECCreateConverter(&s_TECUnicodeToNativeC,
kTextEncodingUnicodeDefault,
kEncoding);
if ( wxApp::s_macDefaultEncodingIsPC )
{
status = TECCreateConverter(&s_TECPlatformToNativeC,
kTextEncodingMacRoman, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
status = TECCreateConverter(&s_TECPlatformToNativeC,
kTextEncodingMacRoman,
kTextEncodingWindowsLatin1);
status = TECCreateConverter(&s_TECNativeCToPlatform,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingMacRoman );
status = TECCreateConverter(&s_TECNativeCToPlatform,
kTextEncodingWindowsLatin1,
kTextEncodingMacRoman);
}
}
@ -651,7 +659,7 @@ void wxMacCleanupConverters()
status = TECDisposeConverter(s_TECNativeCToPlatform);
}
wxWCharBuffer wxMacStringToWString( const wxString &from )
wxWCharBuffer wxMacStringToWString( const wxString &from )
{
#if wxUSE_UNICODE
wxWCharBuffer result( from.wc_str() ) ;
@ -668,7 +676,7 @@ wxWCharBuffer wxMacStringToWString( const wxString &from )
return result ;
}
wxString wxMacMakeStringFromCString( const char * from , int len )
wxString wxMacMakeStringFromCString( const char * from , int len )
{
OSStatus status = noErr ;
wxString result ;
@ -685,7 +693,6 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
memcpy( buf , from , len ) ;
else
{
OSStatus status = noErr ;
ByteCount byteOutLen ;
ByteCount byteInLen = len ;
ByteCount byteBufferLen = byteInLen ;
@ -704,7 +711,7 @@ wxString wxMacMakeStringFromCString( const char * from )
return wxMacMakeStringFromCString( from , strlen(from) ) ;
}
wxCharBuffer wxMacStringToCString( const wxString &from )
wxCharBuffer wxMacStringToCString( const wxString &from )
{
#if wxUSE_UNICODE
OSStatus status = noErr ;
@ -733,7 +740,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
#endif
}
void wxMacStringToPascal( const wxString&from , StringPtr to )
void wxMacStringToPascal( const wxString&from , StringPtr to )
{
wxCharBuffer buf = wxMacStringToCString( from ) ;
int len = strlen(buf) ;
@ -744,31 +751,31 @@ void wxMacStringToPascal( const wxString&from , StringPtr to )
memcpy( (char*) &to[1] , buf , len ) ;
}
wxString wxMacMakeStringFromPascal( ConstStringPtr from )
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 )
void wxMacCFStringHolder::Assign( const wxString &str )
{
#if wxUSE_UNICODE
m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
(const unsigned short*)str.wc_str(), str.Len() );
#else
m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
wxApp::s_macDefaultEncodingIsPC ?
wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
#endif
m_release = true ;
}
wxString wxMacCFStringHolder::AsString()
wxString wxMacCFStringHolder::AsString()
{
wxString result ;
Size len = CFStringGetLength( m_cfs ) ;
@ -776,7 +783,7 @@ wxString wxMacCFStringHolder::AsString()
#if wxUSE_UNICODE
CFStringGetCharacters( m_cfs , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
#else
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
#endif
buf[len] = 0 ;
@ -826,7 +833,7 @@ wxString wxMacMakeStringFromMacString( const wxChar* from , bool mac2pcEncoding
}
}
//
//
// Pascal Strings
//

View File

@ -237,7 +237,6 @@ wxSize wxChoice::DoGetBestSize() const
#endif
{
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
Rect drawRect ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
if ( font )
{
@ -273,7 +272,6 @@ wxSize wxChoice::DoGetBestSize() const
// Add room for the popup arrow
lbWidth += 2 * lbHeight ;
// And just a bit more
int cy = 12 ;
int cx = ::TextWidth( "X" , 0 , 1 ) ;
lbWidth += cx ;

View File

@ -1321,8 +1321,11 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
#else
TECObjectRef ec;
status = TECCreateConverter(&ec,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
status = TECCreateConverter(&ec,
wxApp::s_macDefaultEncodingIsPC
? (int)kTextEncodingWindowsLatin1
: (int)kTextEncodingMacRoman,
kTextEncodingUnicodeDefault);
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
ByteCount byteOutLen ;
@ -1369,8 +1372,8 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
&textBefore , &textAfter, &ascent , &descent );
drawX += sin(angle/RAD2DEG) * FixedToInt(ascent) ;
drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
drawX += (int)(sin(angle/RAD2DEG) * FixedToInt(ascent));
drawY += (int)(cos(angle/RAD2DEG) * FixedToInt(ascent));
status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
IntToFixed(drawX) , IntToFixed(drawY) );
wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
@ -1808,7 +1811,7 @@ void wxDC::MacInstallFont() const
} ;
Boolean kTrue = true ;
Boolean kFalse = false ;
BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
//BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{

View File

@ -363,7 +363,7 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
void wxMenu::MacBeforeDisplay( bool isSubMenu )
{
wxMenuItem* previousItem = NULL ;
int pos ;
size_t pos ;
wxMenuItemList::Node *node;
wxMenuItem *item;
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
@ -382,7 +382,9 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
if ( GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
if ( GetMenuItems().GetCount() == pos + 1 &&
previousItem != NULL &&
previousItem->IsSeparator() )
{
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
}

View File

@ -234,8 +234,8 @@ void wxMacCarbonPrintData::TransferTo( wxPageSetupData* data )
(int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
data->SetMinMarginBottomRight( wxPoint (
((double) rPaper.right - rPage.right ) * pt2mm ,
((double) rPaper.bottom - rPage.bottom ) * pt2mm ) ) ;
(wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
(wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
}
}
}

View File

@ -325,8 +325,6 @@ bool wxToolBar::Realize()
node = node->GetNext();
}
int separatorSize = GetToolSize().x / 4 ;
node = m_tools.GetFirst();
while (node)
{

View File

@ -844,7 +844,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent(
if ( kind == mouseDown )
{
if ( timestamp - gs_lastWhen <= GetDblTime() )
if ( timestamp - gs_lastWhen <= (long) GetDblTime() )
{
if ( abs( localwhere.h - gs_lastWhere.h ) < 3 && abs( localwhere.v - gs_lastWhere.v ) < 3 )
{

View File

@ -57,7 +57,7 @@ bool wxGetHostName(wxChar *buf, int maxSize)
// Gets Chooser name of user by examining a System resource.
const short kComputerNameID = -16413;
short oldResFile = CurResFile() ;
UseResFile(0);
StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
@ -95,7 +95,7 @@ bool wxGetUserName(wxChar *buf, int maxSize)
// Gets Chooser name of user by examining a System resource.
const short kChooserNameID = -16096;
short oldResFile = CurResFile() ;
UseResFile(0);
StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
@ -143,7 +143,7 @@ bool wxShell(const wxString& command)
return FALSE;
}
// Shutdown or reboot the PC
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
{
// TODO
@ -159,7 +159,7 @@ long wxGetFreeMemory()
void wxUsleep(unsigned long milliseconds)
{
clock_t start = clock() ;
do
do
{
YieldToAnyThread() ;
} while( clock() - start < milliseconds / 1000.0 * CLOCKS_PER_SEC ) ;
@ -182,17 +182,17 @@ void wxDebugMsg(const char *fmt ...)
{
va_list ap;
static char buffer[512];
if (!wxTheApp->GetWantDebugOutput())
return ;
va_start(ap, fmt);
vsprintf(buffer,fmt,ap) ;
strcat(buffer,";g") ;
c2pstr(buffer) ;
DebugStr((unsigned char*) buffer) ;
va_end(ap);
}
@ -223,9 +223,9 @@ void wxBell()
int wxGetOsVersion(int *majorVsn, int *minorVsn)
{
long theSystem ;
// are there x-platform conventions ?
Gestalt(gestaltSystemVersion, &theSystem) ;
if (minorVsn != NULL) {
*minorVsn = (theSystem & 0xFF ) ;
@ -338,7 +338,7 @@ void wxEndBusyCursor()
{
wxCHECK_RET( gs_wxBusyCursorCount > 0,
wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
if (--gs_wxBusyCursorCount == 0)
{
gMacStoredActiveCursor.MacInstall() ;
@ -359,7 +359,7 @@ wxString wxMacFindFolder( short vol,
short vRefNum ;
long dirID ;
wxString strDir ;
if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
{
FSSpec file ;
@ -382,19 +382,19 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
if ( path.empty() )
return FALSE;
wxString p = path ;
if (p[0] == ':' ) {
p = wxGetCwd() + p ;
}
int pos = p.Find(':') ;
if ( pos != wxNOT_FOUND ) {
p = p.Mid(1,pos) ;
}
p = p + wxT(":") ;
Str255 volumeName ;
XVolumeParam pb ;
@ -457,11 +457,11 @@ void wxDisplaySize(int *width, int *height)
{
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
if (width != NULL) {
if (width != NULL) {
*width = screenBits.bounds.right - screenBits.bounds.left ;
}
if (height != NULL) {
if (height != NULL) {
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
}
}
@ -472,10 +472,10 @@ void wxDisplaySizeMM(int *width, int *height)
// on mac 72 is fixed (at least now ;-)
float cvPt2Mm = 25.4 / 72;
if (width != NULL) {
if (width != NULL) {
*width = int( *width * cvPt2Mm );
}
if (height != NULL) {
if (height != NULL) {
*height = int( *height * cvPt2Mm );
}
}
@ -488,10 +488,10 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
if (x) *x = 0;
if (y) *y = 0;
if (width != NULL) {
if (width != NULL) {
*width = screenBits.bounds.right - screenBits.bounds.left ;
}
if (height != NULL) {
if (height != NULL) {
*height = screenBits.bounds.bottom - screenBits.bounds.top ;
}
@ -501,7 +501,7 @@ void wxClientDisplayRect(int *x, int *y, int *width, int *height)
#else
mheight = LMGetMBarHeight() ;
#endif
if (height != NULL) {
if (height != NULL) {
*height -= mheight ;
}
if (y)
@ -615,27 +615,35 @@ TECObjectRef s_TECNativeCToUnicode = NULL ;
TECObjectRef s_TECUnicodeToNativeC = NULL ;
TECObjectRef s_TECPlatformToNativeC = NULL ;
TECObjectRef s_TECNativeCToPlatform = NULL ;
void wxMacSetupConverters()
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...
// 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...
const int kEncoding = wxApp::s_macDefaultEncodingIsPC
? (int)kTextEncodingWindowsLatin1
: (int)kTextEncodingMacRoman;
OSStatus status = noErr ;
status = TECCreateConverter(&s_TECNativeCToUnicode,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
status = TECCreateConverter(&s_TECNativeCToUnicode,
kEncoding,
kTextEncodingUnicodeDefault);
status = TECCreateConverter(&s_TECUnicodeToNativeC,
kTextEncodingUnicodeDefault, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
status = TECCreateConverter(&s_TECUnicodeToNativeC,
kTextEncodingUnicodeDefault,
kEncoding);
if ( wxApp::s_macDefaultEncodingIsPC )
{
status = TECCreateConverter(&s_TECPlatformToNativeC,
kTextEncodingMacRoman, wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman);
status = TECCreateConverter(&s_TECPlatformToNativeC,
kTextEncodingMacRoman,
kTextEncodingWindowsLatin1);
status = TECCreateConverter(&s_TECNativeCToPlatform,
wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman , kTextEncodingMacRoman );
status = TECCreateConverter(&s_TECNativeCToPlatform,
kTextEncodingWindowsLatin1,
kTextEncodingMacRoman);
}
}
@ -651,7 +659,7 @@ void wxMacCleanupConverters()
status = TECDisposeConverter(s_TECNativeCToPlatform);
}
wxWCharBuffer wxMacStringToWString( const wxString &from )
wxWCharBuffer wxMacStringToWString( const wxString &from )
{
#if wxUSE_UNICODE
wxWCharBuffer result( from.wc_str() ) ;
@ -668,7 +676,7 @@ wxWCharBuffer wxMacStringToWString( const wxString &from )
return result ;
}
wxString wxMacMakeStringFromCString( const char * from , int len )
wxString wxMacMakeStringFromCString( const char * from , int len )
{
OSStatus status = noErr ;
wxString result ;
@ -685,7 +693,6 @@ wxString wxMacMakeStringFromCString( const char * from , int len )
memcpy( buf , from , len ) ;
else
{
OSStatus status = noErr ;
ByteCount byteOutLen ;
ByteCount byteInLen = len ;
ByteCount byteBufferLen = byteInLen ;
@ -704,7 +711,7 @@ wxString wxMacMakeStringFromCString( const char * from )
return wxMacMakeStringFromCString( from , strlen(from) ) ;
}
wxCharBuffer wxMacStringToCString( const wxString &from )
wxCharBuffer wxMacStringToCString( const wxString &from )
{
#if wxUSE_UNICODE
OSStatus status = noErr ;
@ -733,7 +740,7 @@ wxCharBuffer wxMacStringToCString( const wxString &from )
#endif
}
void wxMacStringToPascal( const wxString&from , StringPtr to )
void wxMacStringToPascal( const wxString&from , StringPtr to )
{
wxCharBuffer buf = wxMacStringToCString( from ) ;
int len = strlen(buf) ;
@ -744,31 +751,31 @@ void wxMacStringToPascal( const wxString&from , StringPtr to )
memcpy( (char*) &to[1] , buf , len ) ;
}
wxString wxMacMakeStringFromPascal( ConstStringPtr from )
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 )
void wxMacCFStringHolder::Assign( const wxString &str )
{
#if wxUSE_UNICODE
m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
m_cfs = CFStringCreateWithCharacters( kCFAllocatorDefault,
(const unsigned short*)str.wc_str(), str.Len() );
#else
m_cfs = CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() ,
wxApp::s_macDefaultEncodingIsPC ?
wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
#endif
m_release = true ;
}
wxString wxMacCFStringHolder::AsString()
wxString wxMacCFStringHolder::AsString()
{
wxString result ;
Size len = CFStringGetLength( m_cfs ) ;
@ -776,7 +783,7 @@ wxString wxMacCFStringHolder::AsString()
#if wxUSE_UNICODE
CFStringGetCharacters( m_cfs , CFRangeMake( 0 , len ) , (UniChar*) buf ) ;
#else
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
CFStringGetCString( m_cfs , buf , len+1 , wxApp::s_macDefaultEncodingIsPC ?
kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ;
#endif
buf[len] = 0 ;
@ -826,7 +833,7 @@ wxString wxMacMakeStringFromMacString( const wxChar* from , bool mac2pcEncoding
}
}
//
//
// Pascal Strings
//