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

View File

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

View File

@@ -363,7 +363,7 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
void wxMenu::MacBeforeDisplay( bool isSubMenu ) void wxMenu::MacBeforeDisplay( bool isSubMenu )
{ {
wxMenuItem* previousItem = NULL ; wxMenuItem* previousItem = NULL ;
int pos ; size_t pos ;
wxMenuItemList::Node *node; wxMenuItemList::Node *node;
wxMenuItem *item; wxMenuItem *item;
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 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) if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{ {
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 ); 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 ); 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) ) ) ; (int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
data->SetMinMarginBottomRight( wxPoint ( data->SetMinMarginBottomRight( wxPoint (
((double) rPaper.right - rPage.right ) * pt2mm , (wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
((double) rPaper.bottom - rPage.bottom ) * pt2mm ) ) ; (wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -363,7 +363,7 @@ void wxMenu::MacEnableMenu( bool bDoEnable )
void wxMenu::MacBeforeDisplay( bool isSubMenu ) void wxMenu::MacBeforeDisplay( bool isSubMenu )
{ {
wxMenuItem* previousItem = NULL ; wxMenuItem* previousItem = NULL ;
int pos ; size_t pos ;
wxMenuItemList::Node *node; wxMenuItemList::Node *node;
wxMenuItem *item; wxMenuItem *item;
for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) 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) if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
{ {
ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 ); 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 ); 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) ) ) ; (int)(((double) rPage.top - rPaper.top ) * pt2mm) ) ) ;
data->SetMinMarginBottomRight( wxPoint ( data->SetMinMarginBottomRight( wxPoint (
((double) rPaper.right - rPage.right ) * pt2mm , (wxCoord)(((double) rPaper.right - rPage.right ) * pt2mm),
((double) rPaper.bottom - rPage.bottom ) * pt2mm ) ) ; (wxCoord)(((double) rPaper.bottom - rPage.bottom ) * pt2mm)) ) ;
} }
} }
} }

View File

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

View File

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