diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index abbe50cc35..e4a20d9375 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -71,10 +71,6 @@ // Keep linker from discarding wxStockGDIMac wxFORCE_LINK_MODULE(gdiobj) -#if wxUSE_THREADS -extern size_t g_numberOfThreads; -#endif - // statics for implementation static bool s_inYield = false; static bool s_inReceiveEvent = false ; @@ -90,9 +86,7 @@ END_EVENT_TABLE() // platform specific static variables -const short kMacMinHeap = (29 * 1024) ; -const short kwxMacMenuBarResource = 1 ; -const short kwxMacAppleMenuId = 1 ; +static const short kwxMacAppleMenuId = 1 ; wxWindow* wxApp::s_captureWindow = NULL ; long wxApp::s_lastModifiers = 0 ; diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 0f0fbdc08a..f2c79697b6 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -59,7 +59,6 @@ static const int TEXTFOCUSBORDER = 3 ; static const wxCoord MARGIN = 2; static const int TEXTFOCUSBORDER = 0 ; #endif -static const int POPUPHEIGHT = 23; // ---------------------------------------------------------------------------- @@ -119,7 +118,7 @@ protected: wxCommandEvent event( wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() ); event.SetEventObject(def); def->Command(event); - } + } } return; diff --git a/src/mac/carbon/cursor.cpp b/src/mac/carbon/cursor.cpp index 9176de3dc8..df2b686b22 100644 --- a/src/mac/carbon/cursor.cpp +++ b/src/mac/carbon/cursor.cpp @@ -46,8 +46,7 @@ protected: long m_themeCursor; }; -#define M_CURSORDATA ((wxCursorRefData *)m_refData) -#define M_CURSORHANDLERDATA ((wxCursorRefData *)bitmap->m_refData) +#define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData) const short kwxCursorBullseye = 0; const short kwxCursorBlank = 1; diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index 4b75c0fdbf..9bc9f204b5 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -55,9 +55,6 @@ const double RAD2DEG = 180.0 / M_PI; const short kEmulatedMode = -1 ; const short kUnsupportedMode = -2 ; -extern TECObjectRef s_TECNativeCToUnicode ; - - wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) : m_ph( (GrafPtr) dc->m_macPort ) { @@ -154,13 +151,6 @@ wxMacWindowStateSaver::~wxMacWindowStateSaver() SetThemeDrawingState( m_themeDrawingState , true ) ; } -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- -static inline double dmin(double a, double b) { return a < b ? a : b; } -static inline double dmax(double a, double b) { return a > b ? a : b; } -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } - //----------------------------------------------------------------------------- // wxDC //----------------------------------------------------------------------------- diff --git a/src/mac/carbon/dcclient.cpp b/src/mac/carbon/dcclient.cpp index 0e0b775e92..fc005335a2 100644 --- a/src/mac/carbon/dcclient.cpp +++ b/src/mac/carbon/dcclient.cpp @@ -29,8 +29,6 @@ // constants //----------------------------------------------------------------------------- -#define RAD2DEG 57.2957795131 - //----------------------------------------------------------------------------- // wxPaintDC //----------------------------------------------------------------------------- @@ -124,7 +122,6 @@ wxWindowDC::wxWindowDC(wxWindow *window) WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ; int x , y ; x = y = 0 ; - wxSize size = window->GetSize() ; window->MacWindowToRootWindow( &x , &y ) ; m_macPort = UMAGetWindowPort( windowref ) ; m_ok = true ; diff --git a/src/mac/carbon/dirmac.cpp b/src/mac/carbon/dirmac.cpp index 8669577a49..3dd53627a6 100644 --- a/src/mac/carbon/dirmac.cpp +++ b/src/mac/carbon/dirmac.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: msw/dir.cpp +// Name: mac/dirmac.cpp // Purpose: wxDir implementation for Mac // Author: Stefan Csomor // Modified by: @@ -24,37 +24,17 @@ #pragma hdrstop #endif +#include "wx/dir.h" + #ifndef WX_PRECOMP #include "wx/intl.h" #include "wx/log.h" #endif // PCH -#include "wx/dir.h" #include "wx/filefn.h" // for wxDirExists() - -#ifndef __DARWIN__ - #include -#endif - #include "wx/filename.h" #include "wx/mac/private.h" -#include "MoreFilesX.h" - -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -#ifndef MAX_PATH - #define MAX_PATH 260 // from VC++ headers -#endif - -// ---------------------------------------------------------------------------- -// macros -// ---------------------------------------------------------------------------- - -#define M_DIR ((wxDirData *)m_data) - // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -226,7 +206,7 @@ wxDir::wxDir(const wxString& dirname) bool wxDir::Open(const wxString& dirname) { - delete M_DIR; + delete m_data; m_data = new wxDirData(dirname); return true; @@ -242,7 +222,7 @@ wxString wxDir::GetName() const wxString name; if ( m_data ) { - name = M_DIR->GetName(); + name = m_data->GetName(); if ( !name.empty() && (name.Last() == _T('/')) ) { // chop off the last (back)slash @@ -255,10 +235,8 @@ wxString wxDir::GetName() const wxDir::~wxDir() { - if (M_DIR != NULL) { - delete M_DIR; - m_data = NULL; - } + delete m_data; + m_data = NULL; } // ---------------------------------------------------------------------------- @@ -271,10 +249,10 @@ bool wxDir::GetFirst(wxString *filename, { wxCHECK_MSG( IsOpened(), false, _T("must wxDir::Open() first") ); - M_DIR->Rewind(); + m_data->Rewind(); - M_DIR->SetFileSpec(filespec); - M_DIR->SetFlags(flags); + m_data->SetFileSpec(filespec); + m_data->SetFlags(flags); return GetNext(filename); } @@ -285,5 +263,5 @@ bool wxDir::GetNext(wxString *filename) const wxCHECK_MSG( filename, false, _T("bad pointer in wxDir::GetNext()") ); - return M_DIR->Read(filename); + return m_data->Read(filename); } diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index 834533d04a..0a42702a8f 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -17,7 +17,6 @@ #ifndef WX_PRECOMP #include "wx/app.h" - #include "wx/window.h" #include "wx/toplevel.h" #include "wx/gdicmn.h" #endif // WX_PRECOMP @@ -38,8 +37,7 @@ typedef struct wxWindow *m_currentTargetWindow; wxDropTarget *m_currentTarget; wxDropSource *m_currentSource; -} -MacTrackingGlobals; +} MacTrackingGlobals; MacTrackingGlobals gTrackingGlobals; @@ -113,7 +111,6 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() if ( !supported ) { UInt16 items; - OSErr result; ItemReference theItem; FlavorType theType; UInt16 flavors = 0; @@ -127,7 +124,7 @@ bool wxDropTarget::CurrentDragHasSupportedFormat() for ( UInt16 flavor = 1; flavor <= flavors; ++flavor ) { - result = GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType ); + GetFlavorType( (DragReference)m_currentDrag, theItem, flavor, &theType ); if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) ) { supported = true; @@ -338,11 +335,10 @@ wxDragResult wxDropSource::DoDragDrop(int flags) if ((m_data == NULL) || (m_data->GetFormatCount() == 0)) return (wxDragResult)wxDragNone; - OSStatus result; DragReference theDrag; RgnHandle dragRegion; - if ((result = NewDrag( &theDrag )) != noErr) + if (NewDrag( &theDrag ) != noErr) return wxDragNone; // add data to drag @@ -454,7 +450,7 @@ wxDragResult wxDropSource::DoDragDrop(int flags) // only when drag was successfully completed gTrackingGlobals.m_currentSource = this; - result = TrackDrag( theDrag, ev, dragRegion ); + TrackDrag( theDrag, ev, dragRegion ); DisposeRgn( dragRegion ); DisposeDrag( theDrag ); gTrackingGlobals.m_currentSource = NULL; diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index 5fffa73c60..9e73bcf2d3 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -30,12 +30,8 @@ #include "PLStringFuncs.h" #endif -#include "MoreFilesX.h" - IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) -extern bool gUseNavServices; - // the data we need to pass to our standard file hook routine // includes a pointer to the dialog, a pointer to the standard // file reply record (so we can inspect the current selection) @@ -319,7 +315,6 @@ int wxFileDialog::ShowModal() NavDialogRef dialog; NavObjectFilterUPP navFilterUPP = NULL; - CFArrayRef cfArray = NULL; // for popupExtension OpenUserDataRec myData; myData.defaultLocation = m_dir; @@ -386,8 +381,6 @@ int wxFileDialog::ShowModal() // clean up filter related data, etc. if (navFilterUPP) ::DisposeNavObjectFilterUPP(navFilterUPP); - if (cfArray) - ::CFRelease(cfArray); if (err != noErr) return wxID_CANCEL; diff --git a/src/mac/carbon/mdi.cpp b/src/mac/carbon/mdi.cpp index 871d223cb6..108e0371d8 100644 --- a/src/mac/carbon/mdi.cpp +++ b/src/mac/carbon/mdi.cpp @@ -42,20 +42,11 @@ END_EVENT_TABLE() static const wxChar *TRACE_MDI = _T("mdi"); -static const int IDM_WINDOWTILE = 4001; static const int IDM_WINDOWTILEHOR = 4001; static const int IDM_WINDOWCASCADE = 4002; static const int IDM_WINDOWICONS = 4003; static const int IDM_WINDOWNEXT = 4004; static const int IDM_WINDOWTILEVERT = 4005; -static const int IDM_WINDOWPREV = 4006; - -// This range gives a maximum of 500 MDI children. Should be enough :-) -static const int wxFIRST_MDI_CHILD = 4100; -static const int wxLAST_MDI_CHILD = 4600; - -// Status border dimensions -static const int wxTHICK_LINE_BORDER = 3; // ---------------------------------------------------------------------------- // Parent frame diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 391e97b560..75b60c03bf 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -24,7 +24,6 @@ #include "wx/log.h" #include "wx/app.h" #include "wx/utils.h" - #include "wx/window.h" #include "wx/frame.h" #include "wx/menuitem.h" #endif @@ -41,8 +40,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxEvtHandler) // the (popup) menu title has this special id static const int idMenuTitle = -3; -const short kwxMacMenuBarResource = 1 ; -const short kwxMacAppleMenuId = 1 ; +static const short kwxMacAppleMenuId = 1 ; // Find an item given the Macintosh Menu Reference @@ -488,12 +486,10 @@ void wxMenu::MacAfterDisplay( bool isSubMenu ) if ( isSubMenu ) ::DeleteMenu(MacGetMenuId()); - wxMenuItem* previousItem = NULL ; wxMenuItemList::compatibility_iterator node; wxMenuItem *item; - int pos ; - for (pos = 0, node = GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) + for (node = GetMenuItems().GetFirst(); node; node = node->GetNext()) { item = (wxMenuItem *)node->GetData(); wxMenu* subMenu = item->GetSubMenu() ; @@ -505,8 +501,6 @@ void wxMenu::MacAfterDisplay( bool isSubMenu ) { // no need to undo hidings } - - previousItem = item ; } } @@ -663,12 +657,11 @@ void wxMenuBar::MacInstallMenuBar() { wxMenuItemList::compatibility_iterator node; wxMenuItem *item; - int pos ; wxMenu* menu = menuIter->GetData() , *subMenu = NULL ; if ( m_titles[i] == wxT("?") || m_titles[i] == wxT("&?") || m_titles[i] == wxApp::s_macHelpMenuTitleName ) { - for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++) + for (node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext()) { item = (wxMenuItem *)node->GetData(); subMenu = item->GetSubMenu() ; diff --git a/src/mac/carbon/metafile.cpp b/src/mac/carbon/metafile.cpp index 0b15a9e246..8bb2a11842 100644 --- a/src/mac/carbon/metafile.cpp +++ b/src/mac/carbon/metafile.cpp @@ -48,10 +48,6 @@ private: #endif }; - -extern bool wxClipboardIsOpen; - - wxMetafileRefData::wxMetafileRefData() { m_metafile = NULL; diff --git a/src/mac/carbon/mimetmac.cpp b/src/mac/carbon/mimetmac.cpp index 4ee87964e6..aef955dd2d 100644 --- a/src/mac/carbon/mimetmac.cpp +++ b/src/mac/carbon/mimetmac.cpp @@ -1311,7 +1311,6 @@ private: // ---------------------------------------------------------------------------- #define wxCFDATA_RELEASEBUFFER 1 -#define wxCFDATA_RETAINBUFFER 0 class wxCFData { diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index 649aa592a2..da6e258868 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -321,14 +321,11 @@ void wxRadioBox::Command( wxCommandEvent& event ) // void wxRadioBox::SetFocus() { - int i; wxRadioButton *current; - i = 0; current = m_radioButtonCycle; while (!current->GetValue()) { - i++; current = current->NextInCycle(); } diff --git a/src/mac/carbon/radiobut.cpp b/src/mac/carbon/radiobut.cpp index 6ecc2657bc..5a83609f27 100644 --- a/src/mac/carbon/radiobut.cpp +++ b/src/mac/carbon/radiobut.cpp @@ -143,7 +143,7 @@ wxInt32 wxRadioButton::MacControlHit( WXEVENTHANDLERREF WXUNUSED(handler), WXEVE wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle) { - wxRadioButton *next, *current; + wxRadioButton *current; if (cycle == NULL) { @@ -152,7 +152,7 @@ wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle) else { current = cycle; - while ((next = current->m_cycle) != cycle) + while (current->m_cycle != cycle) current = current->m_cycle; m_cycle = cycle; diff --git a/src/mac/carbon/slider.cpp b/src/mac/carbon/slider.cpp index a46467044f..5d3514db51 100644 --- a/src/mac/carbon/slider.cpp +++ b/src/mac/carbon/slider.cpp @@ -22,7 +22,6 @@ BEGIN_EVENT_TABLE(wxSlider, wxControl) END_EVENT_TABLE() // The dimensions of the different styles of sliders (from Aqua document) -#define wxSLIDER_DIMENSIONACROSS 15 #define wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS 24 #define wxSLIDER_DIMENSIONACROSS_ARROW 18 @@ -416,13 +415,11 @@ wxSize wxSlider::DoGetBestSize() const void wxSlider::DoSetSize(int x, int y, int w, int h, int sizeFlags) { - int xborder, yborder; + int yborder = 0; int minValWidth, maxValWidth, textheight; int sliderBreadth; int width = w; - xborder = yborder = 0; - if (GetWindowStyle() & wxSL_LABELS) { wxString text; diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 30e828c631..ebd4a0dbb3 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -64,13 +64,6 @@ #include "wx/mac/uma.h" - -// if this is set to 1 then under OSX 10.2 the 'classic' MLTE implementation will be used -// if set to 0 then the unicode textctrl will be used -#ifndef wxMAC_AWAYS_USE_MLTE -#define wxMAC_AWAYS_USE_MLTE 1 -#endif - #ifndef __WXMAC_OSX__ enum { diff --git a/src/mac/carbon/tglbtn.cpp b/src/mac/carbon/tglbtn.cpp index 69394fbaa6..3e974ca9a4 100644 --- a/src/mac/carbon/tglbtn.cpp +++ b/src/mac/carbon/tglbtn.cpp @@ -26,9 +26,6 @@ #include "wx/mac/uma.h" // Button -static const int kMacOSXHorizontalBorder = 2 ; -static const int kMacOSXVerticalBorder = 4 ; - // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index 94228ad0bf..d1f29edb1a 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -392,8 +392,6 @@ void wxToolBarTool::SetPosition( const wxPoint& position ) m_x = position.x; m_y = position.y; - int x, y; - x = y = 0; int mac_x = position.x; int mac_y = position.y; @@ -714,6 +712,7 @@ CantCreateEvent : return result ; } +#if wxMAC_USE_NATIVE_TOOLBAR static const EventTypeSpec kToolbarEvents[] = { { kEventClassToolbar, kEventToolbarGetDefaultIdentifiers }, @@ -777,6 +776,7 @@ static OSStatus ToolbarDelegateHandler( EventHandlerCallRef inCallRef, EventRef } return result ; } +#endif // wxMAC_USE_NATIVE_TOOLBAR // also for the toolbar we have the dual implementation: // only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar @@ -1070,7 +1070,6 @@ bool wxToolBar::Realize() bool lastIsRadio = false; bool curIsRadio = false; - bool setChoiceInGroup = false; #if wxMAC_USE_NATIVE_TOOLBAR CFIndex currentPosition = 0; @@ -1165,8 +1164,6 @@ bool wxToolBar::Realize() { if ( tool->IsToggled() ) DoToggleTool( tool, true ); - - setChoiceInGroup = false; } else { @@ -1175,7 +1172,6 @@ bool wxToolBar::Realize() if ( tool->Toggle( true ) ) { DoToggleTool( tool, true ); - setChoiceInGroup = true; } } else if ( tool->IsToggled() ) diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index d0251e111e..8d279e9599 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -81,8 +81,6 @@ END_EVENT_TABLE() // Carbon Events // --------------------------------------------------------------------------- -extern long wxMacTranslateKey(unsigned char key, unsigned char code) ; - static const EventTypeSpec eventList[] = { // TODO: remove control related event like key and mouse (except for WindowLeave events) @@ -884,8 +882,7 @@ typedef struct wxPoint m_position ; wxSize m_size ; bool m_wasResizable ; -} -FullScreenData ; +} FullScreenData ; void wxTopLevelWindowMac::Init() { @@ -1530,19 +1527,17 @@ void wxTopLevelWindowMac::MacPerformUpdates() EventRef currentEvent = (EventRef) wxTheApp->MacGetCurrentEvent() ; UInt32 currentEventClass = 0 ; - UInt32 currentEventKind = 0 ; if ( currentEvent != NULL ) { currentEventClass = ::GetEventClass( currentEvent ) ; - currentEventKind = ::GetEventKind( currentEvent ) ; + ::GetEventKind( currentEvent ) ; } if ( currentEventClass != kEventClassMenu ) { // when tracking a menu, strange redraw errors occur if we flush now, so leave.. EventRef theEvent; - OSStatus status = noErr ; - status = ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ; + ReceiveNextEvent( 0 , NULL , kEventDurationNoWait , false , &theEvent ) ; } } } diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index e975a2adf7..7da19bddc9 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -48,8 +48,6 @@ static bool sUMAHasAquaLayout = false ; static bool sUMAHasInittedAppearance = false; -extern int gAGABackgroundColor ; - bool UMAHasAppearance() { return sUMAHasAppearance ; } long UMAGetAppearanceVersion() { return sUMAAppearanceVersion ; } long UMAGetSystemVersion() { return sUMASystemVersion ; }