From 9d46359178b28cd86e189e877015a8e69ff5bbaa Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Fri, 16 Nov 2007 21:04:50 +0000 Subject: [PATCH] cleanup mac git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/app.cpp | 4 + src/mac/carbon/bitmap.cpp | 21 +- src/mac/carbon/bmpbuttn.cpp | 4 - src/mac/carbon/button.cpp | 3 - src/mac/carbon/checklst.cpp | 4 - src/mac/carbon/choice.cpp | 2 - src/mac/carbon/clipbrd.cpp | 98 ++------ src/mac/carbon/colordlg.cpp | 16 -- src/mac/carbon/combobox.cpp | 5 - src/mac/carbon/databrow.cpp | 6 - src/mac/carbon/dialog.cpp | 6 - src/mac/carbon/display.cpp | 479 +----------------------------------- src/mac/carbon/dnd.cpp | 3 +- src/mac/carbon/listbox.cpp | 6 - src/mac/carbon/menu.cpp | 4 - src/mac/carbon/menuitem.cpp | 4 - src/mac/carbon/notebmac.cpp | 5 +- src/mac/carbon/printmac.cpp | 2 - src/mac/carbon/sound.cpp | 8 - src/mac/carbon/srchctrl.cpp | 11 +- src/mac/carbon/statbox.cpp | 13 +- src/mac/carbon/tabctrl.cpp | 5 +- src/mac/carbon/textctrl.cpp | 82 ++---- src/mac/carbon/toolbar.cpp | 28 +-- src/mac/carbon/toplevel.cpp | 20 +- src/mac/carbon/uma.cpp | 200 --------------- src/mac/carbon/utils.cpp | 6 - src/mac/carbon/window.cpp | 24 +- 28 files changed, 62 insertions(+), 1007 deletions(-) diff --git a/src/mac/carbon/app.cpp b/src/mac/carbon/app.cpp index cbb3c6f22b..524f623b83 100644 --- a/src/mac/carbon/app.cpp +++ b/src/mac/carbon/app.cpp @@ -766,6 +766,8 @@ extern "C" void macPostedEventCallback(void *WXUNUSED(unused)) wxTheApp->ProcessPendingEvents(); } +ProcessSerialNumber gAppProcess ; + bool wxApp::Initialize(int& argc, wxChar **argv) { // Mac-specific @@ -796,6 +798,8 @@ bool wxApp::Initialize(int& argc, wxChar **argv) if ( !wxAppBase::Initialize(argc, argv) ) return false; + GetCurrentProcess(&gAppProcess); + #if wxUSE_INTL wxFont::SetDefaultEncoding(wxLocale::GetSystemEncoding()); #endif diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 808871deae..b0999e2aca 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -28,12 +28,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject) IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject) -#ifdef __DARWIN__ - #include - #include -#else - #include -#endif +#include +#include #include "wx/mac/uma.h" @@ -171,10 +167,7 @@ void wxBitmapRefData::Init() m_bytesPerRow = 0; m_ok = false ; m_bitmapMask = NULL ; - -#ifdef __WXMAC_OSX__ m_cgImageRef = NULL ; -#endif m_iconRef = NULL ; m_pictHandle = NULL ; @@ -304,7 +297,6 @@ void *wxBitmapRefData::BeginRawAccess() ++m_rawAccessCount ; -#ifdef __WXMAC_OSX__ // we must destroy an existing cached image, as // the bitmap data may change now if ( m_cgImageRef ) @@ -312,7 +304,6 @@ void *wxBitmapRefData::BeginRawAccess() CGImageRelease( m_cgImageRef ) ; m_cgImageRef = NULL ; } -#endif return m_memBuf.GetData() ; } @@ -687,7 +678,6 @@ PicHandle wxBitmapRefData::GetPictHandle() return m_pictHandle ; } -#ifdef __WXMAC_OSX__ void wxMacMemoryBufferReleaseProc(void *info, const void *data, size_t WXUNUSED(size)) { wxMemoryBuffer* membuf = (wxMemoryBuffer*) info ; @@ -704,7 +694,7 @@ CGImageRef wxBitmapRefData::CGImageCreate() const CGImageRef image ; if ( m_rawAccessCount > 0 || m_cgImageRef == NULL ) { -#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && wxMAC_USE_CORE_GRAPHICS +#if wxMAC_USE_CORE_GRAPHICS if ( UMAGetSystemVersion() >= 0x1040 && m_depth != 1 && m_bitmapMask == NULL ) { if ( m_bitmapMask ) @@ -809,7 +799,6 @@ CGImageRef wxBitmapRefData::CGImageCreate() const return image ; } -#endif #if wxMAC_USE_CORE_GRAPHICS CGContextRef wxBitmapRefData::GetBitmapContext() const @@ -871,13 +860,11 @@ void wxBitmapRefData::Free() { wxASSERT_MSG( m_rawAccessCount == 0 , wxT("Bitmap still selected when destroyed") ) ; -#ifdef __WXMAC_OSX__ if ( m_cgImageRef ) { CGImageRelease( m_cgImageRef ) ; m_cgImageRef = NULL ; } -#endif if ( m_iconRef ) { @@ -1130,14 +1117,12 @@ void wxBitmap::EndRawAccess() M_BITMAPDATA->EndRawAccess() ; } -#ifdef __WXMAC_OSX__ WXCGIMAGEREF wxBitmap::CGImageCreate() const { wxCHECK_MSG( Ok(), NULL , wxT("invalid bitmap") ) ; return M_BITMAPDATA->CGImageCreate() ; } -#endif wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const { diff --git a/src/mac/carbon/bmpbuttn.cpp b/src/mac/carbon/bmpbuttn.cpp index 2c688e59e4..aae979a862 100644 --- a/src/mac/carbon/bmpbuttn.cpp +++ b/src/mac/carbon/bmpbuttn.cpp @@ -118,7 +118,6 @@ bool wxBitmapButton::Create( wxWindow *parent, m_bmpNormal = bitmap; -#ifdef __WXMAC_OSX__ if ( HasFlag( wxBORDER_NONE ) ) { // contrary to the docs this control only works with iconrefs @@ -128,7 +127,6 @@ bool wxBitmapButton::Create( wxWindow *parent, &bounds, &info, false, m_peer->GetControlRefAddr() ); } else -#endif { wxMacCreateBitmapButton( &info, m_bmpNormal ); err = CreateBevelButtonControl( @@ -158,7 +156,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) ControlButtonContentInfo info; -#ifdef __WXMAC_OSX__ if ( HasFlag( wxBORDER_NONE ) ) { wxMacCreateBitmapButton( &info, m_bmpNormal, kControlContentIconRef ); @@ -166,7 +163,6 @@ void wxBitmapButton::SetBitmapLabel( const wxBitmap& bitmap ) m_peer->SetData( kControlIconPart, kControlIconContentTag, info ); } else -#endif { wxMacCreateBitmapButton( &info, m_bmpNormal ); if ( info.contentType != kControlNoContent ) diff --git a/src/mac/carbon/button.cpp b/src/mac/carbon/button.cpp index 42e2004f51..37e2e0c960 100644 --- a/src/mac/carbon/button.cpp +++ b/src/mac/carbon/button.cpp @@ -61,7 +61,6 @@ bool wxButton::Create(wxWindow *parent, } else if ( label.Find('\n' ) == wxNOT_FOUND && label.Find('\r' ) == wxNOT_FOUND) { -#if TARGET_API_MAC_OSX // Button height is static in Mac, can't be changed, so we need to force it here if ( GetWindowVariant() == wxWINDOW_VARIANT_NORMAL || GetWindowVariant() == wxWINDOW_VARIANT_LARGE ) { @@ -78,8 +77,6 @@ bool wxButton::Create(wxWindow *parent, bounds.bottom = bounds.top + 15 ; m_maxHeight = 15 ; } -#endif - err = CreatePushButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, CFSTR(""), m_peer->GetControlRefAddr() ); diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index 8b12a0590d..1505803cc8 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -24,10 +24,6 @@ #include "wx/mac/uma.h" -#ifndef __DARWIN__ -#include -#endif - IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox) BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox) diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index a3e049f593..22bb683721 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -268,12 +268,10 @@ wxSize wxChoice::DoGetBestSize() const int lbHeight = 20; int wLine; -#if TARGET_CARBON SInt32 metric ; GetThemeMetric( kThemeMetricPopupButtonHeight , &metric ); lbHeight = metric ; -#endif { #if wxMAC_USE_CORE_GRAPHICS diff --git a/src/mac/carbon/clipbrd.cpp b/src/mac/carbon/clipbrd.cpp index 99a8fba35c..2c6aaa81e2 100644 --- a/src/mac/carbon/clipbrd.cpp +++ b/src/mac/carbon/clipbrd.cpp @@ -41,88 +41,34 @@ static const wxChar *TRACE_CLIPBOARD = wxT("clipboard"); IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) -// in order to keep the binary interface the same this class -// serves just to have a few additional member variables inside -// the clipboard class - -class wxMacBinaryCompatHelper : public wxDataObject -{ -public : - wxMacBinaryCompatHelper() - { - m_trueData = NULL; - } - - ~wxMacBinaryCompatHelper() - { - if (m_trueData != NULL) - { - delete m_trueData; - m_trueData = NULL; - } - } - - virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const - { - return wxDataFormat(); - } - - virtual size_t GetFormatCount(Direction dir = Get) const - { - return 0; - } - - virtual void GetAllFormats(wxDataFormat *formats, - Direction dir = Get) const - { - } - - virtual size_t GetDataSize(const wxDataFormat& format) const - { - return 0; - } - - virtual bool GetDataHere(const wxDataFormat& format, void *buf) const - { - return false; - } - - // only relevant from here on - - wxDataObject* m_trueData; - wxCFRef m_pasteboard; -}; - -#define M_CLIPBOARD ((wxMacBinaryCompatHelper*)m_data) - wxClipboard::wxClipboard() { m_open = false; - m_data = new wxMacBinaryCompatHelper() ; + m_data = NULL ; PasteboardRef clipboard = 0; OSStatus err = PasteboardCreate( kPasteboardClipboard, &clipboard ); if (err != noErr) { wxLogSysError( wxT("Failed to create the clipboard.") ); } - M_CLIPBOARD->m_pasteboard.reset(clipboard); + m_pasteboard.reset(clipboard); } wxClipboard::~wxClipboard() { - M_CLIPBOARD->m_pasteboard.reset((PasteboardRef)0); - delete m_data; + m_pasteboard.reset((PasteboardRef)0); + delete m_data; } void wxClipboard::Clear() { - if (M_CLIPBOARD->m_trueData != NULL) + if (m_data != NULL) { - delete M_CLIPBOARD->m_trueData; - M_CLIPBOARD->m_trueData = NULL; + delete m_data; + m_data = NULL; } - OSStatus err = PasteboardClear( M_CLIPBOARD->m_pasteboard ); + OSStatus err = PasteboardClear( m_pasteboard ); if (err != noErr) { wxLogSysError( wxT("Failed to empty the clipboard.") ); @@ -174,13 +120,13 @@ bool wxClipboard::AddData( wxDataObject *data ) // we can only store one wxDataObject Clear(); - PasteboardSyncFlags syncFlags = PasteboardSynchronize( M_CLIPBOARD->m_pasteboard ); + PasteboardSyncFlags syncFlags = PasteboardSynchronize( m_pasteboard ); wxCHECK_MSG( !(syncFlags&kPasteboardModified), false, wxT("clipboard modified after clear") ); wxCHECK_MSG( (syncFlags&kPasteboardClientIsOwner), false, wxT("client couldn't own clipboard") ); - M_CLIPBOARD->m_trueData = data; + m_data = data; - data->AddToPasteboard( M_CLIPBOARD->m_pasteboard, 1 ); + data->AddToPasteboard( m_pasteboard, 1 ); return true; } @@ -194,18 +140,18 @@ void wxClipboard::Close() // Get rid of cached object. // If this is not done, copying data from // another application will only work once - if (M_CLIPBOARD->m_trueData) + if (m_data) { - delete M_CLIPBOARD->m_trueData; - M_CLIPBOARD->m_trueData = (wxDataObject*) NULL; + delete m_data; + m_data = (wxDataObject*) NULL; } } bool wxClipboard::IsSupported( const wxDataFormat &dataFormat ) { - if ( M_CLIPBOARD->m_trueData ) - return M_CLIPBOARD->m_trueData->IsSupported( dataFormat ); - return wxDataObject::IsFormatInPasteboard( M_CLIPBOARD->m_pasteboard, dataFormat ); + if ( m_data ) + return m_data->IsSupported( dataFormat ); + return wxDataObject::IsFormatInPasteboard( m_pasteboard, dataFormat ); } bool wxClipboard::GetData( wxDataObject& data ) @@ -222,14 +168,14 @@ bool wxClipboard::GetData( wxDataObject& data ) bool transferred = false; - if ( M_CLIPBOARD->m_trueData ) + if ( m_data ) { for (size_t i = 0; !transferred && i < formatcount; i++) { wxDataFormat format = array[ i ]; - if ( M_CLIPBOARD->m_trueData->IsSupported( format ) ) + if ( m_data->IsSupported( format ) ) { - int dataSize = M_CLIPBOARD->m_trueData->GetDataSize( format ); + int dataSize = m_data->GetDataSize( format ); transferred = true; if (dataSize == 0) @@ -239,7 +185,7 @@ bool wxClipboard::GetData( wxDataObject& data ) else { char *d = new char[ dataSize ]; - M_CLIPBOARD->m_trueData->GetDataHere( format, (void*)d ); + m_data->GetDataHere( format, (void*)d ); data.SetData( format, dataSize, d ); delete [] d; } @@ -250,7 +196,7 @@ bool wxClipboard::GetData( wxDataObject& data ) // get formats from wxDataObjects if ( !transferred ) { - transferred = data.GetFromPasteboard( M_CLIPBOARD->m_pasteboard ) ; + transferred = data.GetFromPasteboard( m_pasteboard ) ; } delete [] array; diff --git a/src/mac/carbon/colordlg.cpp b/src/mac/carbon/colordlg.cpp index 6948802acd..bdb49c62c9 100644 --- a/src/mac/carbon/colordlg.cpp +++ b/src/mac/carbon/colordlg.cpp @@ -21,9 +21,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog) #include "wx/mac/private.h" -#ifndef __DARWIN__ -#include -#endif /* * wxColourDialog @@ -52,7 +49,6 @@ int wxColourDialog::ShowModal() { RGBColor currentColor = *((RGBColor*)m_colourData.m_dataColour.GetPixel()) ; -#if TARGET_API_MAC_OSX NColorPickerInfo info; OSStatus err ; memset(&info, 0, sizeof(info)) ; @@ -72,18 +68,6 @@ int wxColourDialog::ShowModal() return wxID_OK; } -#else - RGBColor newColor ; - Point where ; - - where.h = where.v = -1; - - if (GetColor( where, "\pSelect a new palette color.", ¤tColor, &newColor )) - { - m_colourData.m_dataColour.Set( (WXCOLORREF*) &newColor ) ; - return wxID_OK; - } -#endif return wxID_CANCEL; } diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index dddce8211e..3f7ca169d5 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -50,16 +50,11 @@ MenuHandle NewUniqueMenu() // ---------------------------------------------------------------------------- // the margin between the text control and the choice -#if TARGET_API_MAC_OSX // margin should be bigger on OS X due to blue highlight // around text control. static const wxCoord MARGIN = 4; // this is the border a focus rect on OSX is needing static const int TEXTFOCUSBORDER = 3 ; -#else -static const wxCoord MARGIN = 2; -static const int TEXTFOCUSBORDER = 0 ; -#endif // ---------------------------------------------------------------------------- diff --git a/src/mac/carbon/databrow.cpp b/src/mac/carbon/databrow.cpp index e5bd7a5da2..1527547d93 100644 --- a/src/mac/carbon/databrow.cpp +++ b/src/mac/carbon/databrow.cpp @@ -134,7 +134,6 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee flags |= kDataBrowserSelectOnlyOne; (void) this->SetSelectionFlags(flags); } /* if */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 OptionBits attributes; // variable definition if (this->GetAttributes(&attributes) == noErr) // get default settings @@ -145,7 +144,6 @@ wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow* pee attributes &= ~kDataBrowserAttributeListViewDrawColumnDividers; (void) this->SetAttributes(attributes); } /* if */ -#endif if ((style & wxDV_NO_HEADER) != 0) this->SetHeaderButtonHeight(0); } /* wxMacDataBrowserTableViewControl::wxMacDataBrowserTableViewControl(wxWindow*, wxPoint const&, wxSize const&, long) */ @@ -190,12 +188,10 @@ OSStatus wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool enabl return ::SetDataBrowserTableViewGeometry(this->GetControlRef(),enableWidth,enableHeight); } /* wxMacDataBrowserTableViewControl::EnableCellSizeModification(bool, bool) */ -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 OSStatus wxMacDataBrowserTableViewControl::GetAttributes(OptionBits* attributes) { return ::DataBrowserGetAttributes(this->GetControlRef(),attributes); } /* wxMacDataBrowserTableViewControl::GetAttributes(OptionBits*) */ -#endif OSStatus wxMacDataBrowserTableViewControl::GetColumnWidth(DataBrowserPropertyID propertyID, UInt16* width) const { @@ -232,12 +228,10 @@ OSStatus wxMacDataBrowserTableViewControl::GetScrollPosition( UInt32 *top , UInt return GetDataBrowserScrollPosition(this->m_controlRef, top , left ); } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 OSStatus wxMacDataBrowserTableViewControl::SetAttributes(OptionBits attributes) { return ::DataBrowserChangeAttributes(this->GetControlRef(),attributes,~attributes); } /* wxMacDataBrowserTableViewControl::SetAttributes(OptionBits) */ -#endif OSStatus wxMacDataBrowserTableViewControl::SetColumnWidth(DataBrowserPropertyID propertyID, UInt16 width) { diff --git a/src/mac/carbon/dialog.cpp b/src/mac/carbon/dialog.cpp index aa23b77e34..966b6001ba 100644 --- a/src/mac/carbon/dialog.cpp +++ b/src/mac/carbon/dialog.cpp @@ -64,9 +64,7 @@ void wxDialog::SetModal( bool flag ) wxModelessWindows.DeleteObject( this ); -#if TARGET_CARBON SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ; -#endif } else { @@ -128,10 +126,6 @@ bool wxDialog::Show(bool show) return true; } -#if !TARGET_CARBON -extern bool s_macIsInModalLoop ; -#endif - void wxDialog::DoShowModal() { wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") ); diff --git a/src/mac/carbon/display.cpp b/src/mac/carbon/display.cpp index 3e9d8d50a1..99c51f04ce 100644 --- a/src/mac/carbon/display.cpp +++ b/src/mac/carbon/display.cpp @@ -34,16 +34,7 @@ #include "wx/gdicmn.h" #endif -#ifdef __DARWIN__ - #include -#else - #include - #include - #include - #include // for VDSwitchInfoRec - #include - #include -#endif +#include #include "wx/display_impl.h" @@ -51,8 +42,6 @@ // display classes implementation // ---------------------------------------------------------------------------- -#ifdef __WXMAC_OSX__ - class wxDisplayImplMacOSX : public wxDisplayImpl { public: @@ -263,470 +252,4 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) return new wxDisplayFactoryMacOSX; } -#else // !__WXMAC_OSX__ - -class wxDisplayImplMac : public wxDisplayImpl -{ -public: - wxDisplayImplMac(unsigned n, GDHandle hndl) - : wxDisplayImpl(n), - m_hndl(hndl) - { - } - - virtual wxRect GetGeometry() const; - virtual wxString GetName() const { return wxString(); } - - virtual wxArrayVideoModes GetModes(const wxVideoMode& mode) const; - virtual wxVideoMode GetCurrentMode() const; - virtual bool ChangeMode(const wxVideoMode& mode); - -private: - GDHandle m_hndl; - - DECLARE_NO_COPY_CLASS(wxDisplayImplMac) -}; - -class wxDisplayFactoryMac : public wxDisplayFactory -{ -public: - wxDisplayFactoryMac(); - - virtual wxDisplayImpl *CreateDisplay(unsigned n); - virtual unsigned GetCount(); - virtual int GetFromPoint(const wxPoint& pt); - -protected: - DECLARE_NO_COPY_CLASS(wxDisplayFactoryMac) -}; - -// ============================================================================ -// wxDisplayFactoryMac implementation -// ============================================================================ - -unsigned wxDisplayFactoryMac::GetCount() -{ - unsigned num = 0; - GDHandle hndl = DMGetFirstScreenDevice(true); - while(hndl) - { - num++; - hndl = DMGetNextScreenDevice(hndl, true); - } - return num; -} - -int wxDisplayFactoryMac::GetFromPoint(const wxPoint &p) -{ - unsigned num = 0; - GDHandle hndl = DMGetFirstScreenDevice(true); - while(hndl) - { - Rect screenrect = (*hndl)->gdRect; - if (p.x >= screenrect.left && - p.x <= screenrect.right && - p.y >= screenrect.top && - p.y <= screenrect.bottom) - { - return num; - } - num++; - hndl = DMGetNextScreenDevice(hndl, true); - } - - return wxNOT_FOUND; -} - -wxDisplayImpl *wxDisplayFactoryMac::CreateDisplay(unsigned n) -{ - unsigned nOrig = n; - - GDHandle hndl = DMGetFirstScreenDevice(true); - while(hndl) - { - if (n == 0) - { - return new wxDisplayImplMac(nOrig, hndl); - } - n--; - hndl = DMGetNextScreenDevice(hndl, true); - } - - return NULL; -} - -// ============================================================================ -// wxDisplayImplMac implementation -// ============================================================================ - -wxRect wxDisplayImplMac::GetGeometry() const -{ - Rect screenrect = (*m_hndl)->gdRect; - return wxRect(screenrect.left, screenrect.top, - screenrect.right - screenrect.left, - screenrect.bottom - screenrect.top); -} - -struct DMModeIteratorRec -{ - wxArrayVideoModes* pModes; - const wxVideoMode* pMatchMode; -}; - -pascal void DMModeListIteratorProc( - void* pData, - DMListIndexType nIndex, - DMDisplayModeListEntryPtr pInfo) -{ - DMModeIteratorRec* pInfoData = (DMModeIteratorRec*) pData; - - // Note that in testing the refresh rate is always 0 on my ibook - RN - int refresh = (int) Fix2Long(pInfo->displayModeResolutionInfo->csRefreshRate); - -#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock - - for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i) - { - if (wxVideoMode( (int) pInfo->displayModeResolutionInfo->csHorizontalPixels, - (int) pInfo->displayModeResolutionInfo->csVerticalLines, - (int) pDBI->vpPixelSize, - refresh).Matches(*pInfoData->pMatchMode) ) - { - pInfoData->pModes->Add( - wxVideoMode( - (int) pInfo->displayModeResolutionInfo->csHorizontalPixels, - (int) pInfo->displayModeResolutionInfo->csVerticalLines, - (int) pDBI->vpPixelSize, - refresh ) ); - } - } - -#undef pDBI -} - -struct DMModeInfoRec -{ - const wxVideoMode* pMode; - VDSwitchInfoRec sMode; - bool bMatched; -}; - -pascal void DMModeInfoProc( - void* pData, - DMListIndexType nIndex, - DMDisplayModeListEntryPtr pInfo ) -{ - DMModeInfoRec* pInfoData = (DMModeInfoRec*) pData; - Fixed refresh = Long2Fix(pInfoData->pMode->refresh); - -#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock - - for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i) - { - if (pInfoData->pMode->w == (int&) pInfo->displayModeResolutionInfo->csHorizontalPixels && - pInfoData->pMode->h == (int&) pInfo->displayModeResolutionInfo->csVerticalLines && - pInfoData->pMode->bpp == (int) pDBI->vpPixelSize && - refresh == pInfo->displayModeResolutionInfo->csRefreshRate) - { - memcpy( - &pInfoData->sMode, - pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthSwitchInfo, - sizeof(VDSwitchInfoRec)); - pInfoData->sMode.csMode = pDBI->vpPixelSize; - pInfoData->bMatched = true; - break; - } - } - -#undef pDBI -} - -struct DMModeTransRec -{ - wxVideoMode Mode; - const VDSwitchInfoRec* psMode; - bool bMatched; -}; - -pascal void DMModeTransProc( - void* pData, - DMListIndexType nIndex, - DMDisplayModeListEntryPtr pInfo) -{ - DMModeTransRec* pInfoData = (DMModeTransRec*) pData; - -#define pDBI pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthVPBlock - - for (unsigned long i = 0; i < pInfo->displayModeDepthBlockInfo->depthBlockCount; ++i) - { - if (pInfoData->psMode->csData == pInfo->displayModeDepthBlockInfo->depthVPBlock[i].depthSwitchInfo->csData) - { - pInfoData->Mode = wxVideoMode( - (int) pInfo->displayModeResolutionInfo->csHorizontalPixels, - (int) pInfo->displayModeResolutionInfo->csVerticalLines, - (int) pDBI->vpPixelSize, - (int) Fix2Long(pInfo->displayModeResolutionInfo->csRefreshRate) ); - pInfoData->bMatched = true; - break; - } - } - -#undef pDBI -} - -wxArrayVideoModes wxDisplayImplMac::GetModes(const wxVideoMode& mode) const -{ - wxArrayVideoModes Modes; - unsigned long dwDMVer; - - // Check DM version == 2 - // (for backward compatibility only - 7.5.3+ use 2.0) - Gestalt( gestaltDisplayMgrVers, (long*) &dwDMVer ); - if (dwDMVer >= 0x020000) - { - DMListIndexType nNumModes; - DMListType pModes; - DMDisplayModeListIteratorUPP uppMLI; - DisplayIDType nDisplayID; - OSErr err; - - err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false); - verify_noerr( err ); - - // Create a new list... - err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes); - wxASSERT_MSG( err == noErr, wxT("Could not create a new display mode list") ); - - uppMLI = NewDMDisplayModeListIteratorUPP(DMModeListIteratorProc); - wxASSERT( uppMLI ); - - DMModeIteratorRec sModeInfo; - sModeInfo.pModes = &Modes; - sModeInfo.pMatchMode = &mode; - - for (DMListIndexType i = 0; i < nNumModes; ++i) - { - err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo); - verify_noerr( err ); - } - - DisposeDMDisplayModeListIteratorUPP(uppMLI); - err = DMDisposeList(pModes); - verify_noerr( err ); - } - else // DM 1.0, 1.2, 1.x - { - wxLogSysError( - wxString::Format( - wxT("Display Manager Version %u Not Supported! Present? %s"), - (unsigned int) dwDMVer / 0x10000, - (dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) ) ); - } - - return Modes; -} - -wxVideoMode wxDisplayImplMac::GetCurrentMode() const -{ - unsigned long dwDMVer; - wxVideoMode RetMode; - - // Check DM version == 2 - // (for backward compatibility only - 7.5.3+ use 2.0) - Gestalt( gestaltDisplayMgrVers, (long*) &dwDMVer ); - if (dwDMVer >= 0x020000) - { - VDSwitchInfoRec sMode; // Note: csMode member also contains the bit depth - OSErr err; - - err = DMGetDisplayMode( m_hndl, &sMode ); - if (err == noErr) - { - DMListIndexType nNumModes; - DMListType pModes; - DMDisplayModeListIteratorUPP uppMLI; - DisplayIDType nDisplayID; - - err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false); - verify_noerr( err ); - - // Create a new list... - err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes); - wxASSERT_MSG( err == noErr, wxT("Could not create a new display mode list") ); - - uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc); - wxASSERT( uppMLI ); - - DMModeTransRec sModeInfo; - sModeInfo.bMatched = false; - sModeInfo.psMode = &sMode; - for (DMListIndexType i = 0; i < nNumModes; ++i) - { - err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo); - verify_noerr( err ); - - if ( sModeInfo.bMatched ) - { - RetMode = sModeInfo.Mode; - break; - } - } - - DisposeDMDisplayModeListIteratorUPP(uppMLI); - err = DMDisposeList(pModes); - verify_noerr( err ); - } - else // Can't get current mode? - { - wxLogSysError( - wxString::Format( - wxT("Couldn't obtain current display mode!!!\ndwDMVer:%u"), - (unsigned int) dwDMVer)); - } - } - else // DM ver 1 - { - wxLogSysError( - wxString::Format( - wxT("Display Manager Version %u Not Supported! Present? %s"), - (unsigned int) dwDMVer / 0x10000, - (dwDMVer & (1 << gestaltDisplayMgrPresent) ? wxT("Yes") : wxT("No")) ) ); - } - - return RetMode; -} - -bool wxDisplayImplMac::ChangeMode(const wxVideoMode& mode) -{ - unsigned long dwDMVer; - - Gestalt( gestaltDisplayMgrVers, (long*)&dwDMVer ); - if (GetCount() == 1 || dwDMVer >= 0x020000) - { - if (mode == wxDefaultVideoMode) - { - return true; - -#if 0 -//#ifndef __DARWIN__ -// Handle hDisplayState; -// if (DMBeginConfigureDisplays(&hDisplayState) != noErr) -// { -// wxLogSysError(wxT("Could not lock display for display mode changing!")); -// return false; -// } -// -// wxASSERT( DMUseScreenPrefs(true, hDisplayState) == noErr); -// DMEndConfigureDisplays(hDisplayState); -// return true; -//#else - // hmmmmm.... -// return true; -//#endif -#endif - } - - //0 & NULL for params 2 & 3 of DMSetVideoMode signal it to use defaults (current mode) - //DM 2.0+ doesn't use params 2 & 3 of DMSetDisplayMode - //so we have to use this icky structure - VDSwitchInfoRec sMode; - memset( &sMode, 0, sizeof(VDSwitchInfoRec) ); - - DMListIndexType nNumModes; - DMListType pModes; - DMDisplayModeListIteratorUPP uppMLI; - DisplayIDType nDisplayID; - OSErr err; - - err = DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false); - verify_noerr( err ); - - // Create a new list... - err = DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes); - wxASSERT_MSG(err == noErr, wxT("Could not create a new display mode list") ); - - uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc); - wxASSERT(uppMLI); - - DMModeInfoRec sModeInfo; - sModeInfo.bMatched = false; - sModeInfo.pMode = &mode; - unsigned int i; - - for (i = 0; i < nNumModes; ++i) - { - err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo); - verify_noerr( err ); - - if (sModeInfo.bMatched) - { - sMode = sModeInfo.sMode; - break; - } - } - - if (i == nNumModes) - return false; - - DisposeDMDisplayModeListIteratorUPP(uppMLI); - - err = DMDisposeList(pModes); - verify_noerr( err ); - - // For the really paranoid - - // unsigned long flags; - // Boolean bok; - // wxASSERT(noErr == DMCheckDisplayMode(m_hndl, sMode.csData, - // sMode.csMode, &flags, NULL, &bok)); - // wxASSERT(bok); - - Handle hDisplayState; - if (DMBeginConfigureDisplays(&hDisplayState) != noErr) - { - wxLogSysError(wxT("Could not lock display for display mode changing!")); - - return false; - } - - unsigned long dwBPP = (unsigned long) mode.bpp; - err = DMSetDisplayMode( - m_hndl, sMode.csData, - (unsigned long*) &(dwBPP), - NULL, //(unsigned long) &sMode - hDisplayState ); - - if (err != noErr) - { - DMEndConfigureDisplays(hDisplayState); - wxLogError(wxT("Could not set the display mode")); - - return false; - } - - DMEndConfigureDisplays(hDisplayState); - } - else // DM 1.0, 1.2, 1.x - { - wxLogSysError( - wxString::Format( - wxT("Monitor gravitation not supported yet. dwDMVer:%u"), - (unsigned int) dwDMVer)); - - return false; - } - - return true; -} - -// ============================================================================ -// wxDisplay::CreateFactory() -// ============================================================================ - -/* static */ wxDisplayFactory *wxDisplay::CreateFactory() -{ - return new wxDisplayFactoryMac; -} - -#endif // !OSX - #endif // wxUSE_DISPLAY diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index dc9b4b60b1..67e9bbf452 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -389,8 +389,7 @@ pascal OSErr wxMacWindowDragTrackingHandler( { wxWindow *win = NULL; ControlPartCode controlPart; - ControlRef control = wxMacFindControlUnderMouse( - toplevel, localMouse, theWindow, &controlPart ); + ControlRef control = FindControlUnderMouse( localMouse, theWindow, &controlPart ); if ( control ) win = wxFindControlFromMacControl( control ); else diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index a620ae111c..ab9e40f0c9 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -326,12 +326,6 @@ int wxListBox::DoListHitTest(const wxPoint& inpoint) const wxPoint point = inpoint; - // interestingly enough 10.2 (and below?) have GetDataBrowserItemPartBounds - // giving root window coordinates but 10.3 and above give client coordinates - // so we only compare using root window coordinates on 10.3 and up - if ( UMAGetSystemVersion() < 0x1030 ) - MacClientToRootWindow(&point.x, &point.y); - // get column property ID (req. for call to itempartbounds) DataBrowserTableViewColumnID colId = 0; err = GetDataBrowserTableViewColumnProperty(m_peer->GetControlRef(), 0, &colId); diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index a947e73f60..b717e52e6b 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -465,7 +465,6 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu ) } else // normal item { -#if TARGET_CARBON // what we do here is to hide the special items which are // shown in the application menu anyhow -- it doesn't make // sense to show them in their normal place as well @@ -520,7 +519,6 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu ) 0 ); } } -#endif // TARGET_CARBON } previousItem = item ; @@ -751,7 +749,6 @@ void wxMenuBar::MacInstallMenuBar() helpMenuHandle = NULL ; } -#if TARGET_CARBON if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId) { wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ; @@ -773,7 +770,6 @@ void wxMenuBar::MacInstallMenuBar() else EnableMenuCommand( NULL , kHICommandQuit ) ; } -#endif wxString strippedHelpMenuTitle = wxStripMenuCodes( wxApp::s_macHelpMenuTitleName ) ; wxString strippedTranslatedHelpMenuTitle = wxStripMenuCodes( wxString( _("&Help") ) ) ; diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index 39156dce67..bc6f0dd3d4 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -100,7 +100,6 @@ void wxMenuItem::UpdateItemStatus() if ( IsSeparator() ) return ; -#if TARGET_CARBON if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId) { if ( !IsEnabled() ) @@ -116,7 +115,6 @@ void wxMenuItem::UpdateItemStatus() else EnableMenuCommand( NULL , kHICommandQuit ) ; } -#endif { MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; @@ -163,7 +161,6 @@ void wxMenuItem::UpdateItemText() void wxMenuItem::Enable(bool bDoEnable) { if (( m_isEnabled != bDoEnable -#if TARGET_CARBON // avoid changing menuitem state when menu is disabled // eg. BeginAppModalStateForWindow() will disable menus and ignore this change // which in turn causes m_isEnabled to become out of sync with real menuitem state @@ -172,7 +169,6 @@ void wxMenuItem::Enable(bool bDoEnable) || ( GetId() == wxApp::s_macPreferencesMenuItemId || GetId() == wxApp::s_macExitMenuItemId || GetId() == wxApp::s_macAboutMenuItemId -#endif )) { wxMenuItemBase::Enable( bDoEnable ) ; diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 6d3562e882..e3ffb8f3ad 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -105,10 +105,7 @@ bool wxNotebook::Create( wxWindow *parent, switch (GetWindowVariant()) { case wxWINDOW_VARIANT_MINI: - if ( UMAGetSystemVersion() >= 0x1030 ) - tabsize = 3 ; - else - tabsize = kControlSizeSmall; + tabsize = 3 ; break; case wxWINDOW_VARIANT_SMALL: diff --git a/src/mac/carbon/printmac.cpp b/src/mac/carbon/printmac.cpp index 9e45b9e38b..606e813946 100644 --- a/src/mac/carbon/printmac.cpp +++ b/src/mac/carbon/printmac.cpp @@ -509,9 +509,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) } else { -#if TARGET_CARBON if ( UMAGetSystemVersion() >= 0x1000 ) -#endif { #if !wxMAC_USE_CORE_GRAPHICS GrafPtr thePort ; diff --git a/src/mac/carbon/sound.cpp b/src/mac/carbon/sound.cpp index c99967756a..c3afc15e01 100644 --- a/src/mac/carbon/sound.cpp +++ b/src/mac/carbon/sound.cpp @@ -52,15 +52,7 @@ #endif #endif -#if defined __WXMAC__ && defined __DARWIN__/*TARGET_CARBON*/ -#ifdef __APPLE_CC__ #include -#else -#include -#endif -#else -#include -#endif //quicktime media layer only required for mac emulation on pc #ifndef __WXMAC__ diff --git a/src/mac/carbon/srchctrl.cpp b/src/mac/carbon/srchctrl.cpp index a99d216649..b71ad561ac 100644 --- a/src/mac/carbon/srchctrl.cpp +++ b/src/mac/carbon/srchctrl.cpp @@ -408,16 +408,7 @@ void wxSearchCtrl::CreatePeer( const wxPoint& pos, const wxSize& size, long style ) { -#ifdef __WXMAC_OSX__ - if ( UMAGetSystemVersion() >= 0x1030 ) - { - m_peer = new wxMacSearchFieldControl( this , str , pos , size , style ); - } -#endif - if ( !m_peer ) - { - wxTextCtrl::CreatePeer( str, pos, size, style ); - } + m_peer = new wxMacSearchFieldControl( this , str , pos , size , style ); } #endif // wxUSE_NATIVE_SEARCH_CONTROL diff --git a/src/mac/carbon/statbox.cpp b/src/mac/carbon/statbox.cpp index 9080cab4f1..398fc5fcb2 100644 --- a/src/mac/carbon/statbox.cpp +++ b/src/mac/carbon/statbox.cpp @@ -58,14 +58,11 @@ void wxStaticBox::GetBordersForSizer(int *borderTop, int *borderOther) const // Later on, the staticbox's font height is added to this. extraTop = 0; - if ( UMAGetSystemVersion() >= 0x1030 ) // Panther - { - // As indicated by the HIG, Panther needs an extra border of 11 - // pixels (otherwise overlapping occurs at the top). The "other" - // border has to be 11. - extraTop = 11; - other = 11; - } + // As indicated by the HIG, Panther needs an extra border of 11 + // pixels (otherwise overlapping occurs at the top). The "other" + // border has to be 11. + extraTop = 11; + other = 11; } *borderTop = extraTop; diff --git a/src/mac/carbon/tabctrl.cpp b/src/mac/carbon/tabctrl.cpp index cad5bab4e0..bd557b762d 100644 --- a/src/mac/carbon/tabctrl.cpp +++ b/src/mac/carbon/tabctrl.cpp @@ -56,10 +56,7 @@ bool wxTabCtrl::Create( wxWindow *parent, tabsize = kControlTabSizeSmall ; else if ( GetWindowVariant() == wxWINDOW_VARIANT_MINI ) { - if (UMAGetSystemVersion() >= 0x1030 ) - tabsize = 3 ; - else - tabsize = kControlSizeSmall; + tabsize = 3 ; } m_peer = new wxMacControl( this ); diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index df31f82039..341d97c5e9 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -45,30 +45,9 @@ #include "wx/filefn.h" #include "wx/sysopt.h" -#if defined(__BORLANDC__) && !defined(__WIN32__) - #include -#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__DARWIN__) - #include -#endif - -#ifndef __DARWIN__ -#include -#include -#include -#include -#endif - #include "wx/mac/uma.h" #include "wx/mac/carbon/private/mactext.h" -#ifndef __WXMAC_OSX__ -enum -{ - kTXNVisibilityTag = 'visb' // set the visibility state of the object -}; -#endif - - class wxMacFunctor { public : @@ -302,7 +281,6 @@ private : Rect m_txnControlBounds ; Rect m_txnVisBounds ; -#ifdef __WXMAC_OSX__ static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ; static pascal void TXNScrollInfoProc( SInt32 iValue, SInt32 iMaximumValue, @@ -312,7 +290,6 @@ private : SInt32 m_lastHorizontalValue ; ControlRef m_sbVertical ; SInt32 m_lastVerticalValue ; -#endif }; @@ -415,7 +392,7 @@ void wxTextCtrl::CreatePeer( if ( UMAGetSystemVersion() >= 0x1050 ) forceMLTE = false; - if ( UMAGetSystemVersion() >= 0x1030 && !forceMLTE ) + if ( !forceMLTE ) { if ( m_windowStyle & wxTE_MULTILINE ) m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ; @@ -1741,26 +1718,23 @@ void wxMacMLTEControl::AdjustCreationAttributes(const wxColour &background, // setting the default font: // under 10.2 this causes a visible caret, therefore we avoid it - if ( UMAGetSystemVersion() >= 0x1030 ) - { - Str255 fontName ; - SInt16 fontSize ; - Style fontStyle ; + Str255 fontName ; + SInt16 fontSize ; + Style fontStyle ; - GetThemeFont( kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; + GetThemeFont( kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; - TXNTypeAttributes typeAttr[] = - { - { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } , - { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } , - { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } , - } ; - - err = TXNSetTypeAttributes( - m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes), - typeAttr, kTXNStartOffset, kTXNEndOffset ); - verify_noerr( err ); - } + TXNTypeAttributes typeAttr[] = + { + { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } , + { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } , + { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } , + } ; + + err = TXNSetTypeAttributes( + m_txn, sizeof(typeAttr) / sizeof(TXNTypeAttributes), + typeAttr, kTXNStartOffset, kTXNEndOffset ); + verify_noerr( err ); if ( m_windowStyle & wxTE_PASSWORD ) { @@ -2327,8 +2301,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const // while this can be solved on 10.3 by reassigning them the correct place, on 10.2 there is // no way out, therefore we are using our own implementation and our own scrollbars .... -#ifdef __WXMAC_OSX__ - TXNScrollInfoUPP gTXNScrollInfoProc = NULL ; ControlActionUPP gTXNScrollActionProc = NULL ; @@ -2432,7 +2404,6 @@ pascal void wxMacMLTEClassicControl::TXNScrollActionProc( ControlRef controlRef mlte->m_lastVerticalValue = newValue ; } } -#endif // make correct activations void wxMacMLTEClassicControl::MacActivatePaneText(bool setActive) @@ -2502,7 +2473,6 @@ void wxMacMLTEClassicControl::MacUpdatePosition() m_txnVisBounds = visBounds ; wxMacWindowClipper cl( textctrl ) ; -#ifdef __WXMAC_OSX__ if ( m_sbHorizontal || m_sbVertical ) { int w = bounds.right - bounds.left ; @@ -2564,13 +2534,6 @@ void wxMacMLTEClassicControl::MacUpdatePosition() m_txnControlBounds.right - (m_sbVertical ? 14 : 0), m_txnFrameID ); #endif -#else - - TXNSetFrameBounds( - m_txn, m_txnControlBounds.top, m_txnControlBounds.left, - wxMax( m_txnControlBounds.bottom, m_txnControlBounds.top ), - wxMax( m_txnControlBounds.right, m_txnControlBounds.left ), m_txnFrameID ); -#endif // the SetFrameBounds method under Classic sometimes does not correctly scroll a selection into sight after a // movement, therefore we have to force it @@ -2807,8 +2770,6 @@ void wxMacMLTEClassicControl::SuperChangedPosition() wxMacControl::SuperChangedPosition() ; } -#ifdef __WXMAC_OSX__ - ControlUserPaneDrawUPP gTPDrawProc = NULL; ControlUserPaneHitTestUPP gTPHitProc = NULL; ControlUserPaneTrackingUPP gTPTrackProc = NULL; @@ -2891,8 +2852,6 @@ static pascal void wxMacControlUserPaneBackgroundProc(ControlRef control, Contro } #endif -#endif // __WXMAC_OSX__ - // TXNRegisterScrollInfoProc OSStatus wxMacMLTEClassicControl::DoCreate() @@ -2901,7 +2860,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate() OSStatus err = noErr ; // set up our globals -#ifdef __WXMAC_OSX__ if (gTPDrawProc == NULL) gTPDrawProc = NewControlUserPaneDrawUPP(wxMacControlUserPaneDrawProc); if (gTPHitProc == NULL) gTPHitProc = NewControlUserPaneHitTestUPP(wxMacControlUserPaneHitTestProc); if (gTPTrackProc == NULL) gTPTrackProc = NewControlUserPaneTrackingUPP(wxMacControlUserPaneTrackingProc); @@ -2912,14 +2870,12 @@ OSStatus wxMacMLTEClassicControl::DoCreate() if (gTXNScrollInfoProc == NULL ) gTXNScrollInfoProc = NewTXNScrollInfoUPP(TXNScrollInfoProc) ; if (gTXNScrollActionProc == NULL ) gTXNScrollActionProc = NewControlActionUPP(TXNScrollActionProc) ; -#endif // set the initial settings for our private data m_txnWindow = GetControlOwner(m_controlRef); m_txnPort = (GrafPtr) GetWindowPort(m_txnWindow); -#ifdef __WXMAC_OSX__ // set up the user pane procedures SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneDrawProcTag, sizeof(gTPDrawProc), &gTPDrawProc); SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneHitTestProcTag, sizeof(gTPHitProc), &gTPHitProc); @@ -2928,7 +2884,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate() SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneKeyDownProcTag, sizeof(gTPKeyProc), &gTPKeyProc); SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneActivateProcTag, sizeof(gTPActivateProc), &gTPActivateProc); SetControlData(m_controlRef, kControlEntireControl, kControlUserPaneFocusProcTag, sizeof(gTPFocusProc), &gTPFocusProc); -#endif // calculate the rectangles used by the control UMAGetControlBoundsInWindowCoords( m_controlRef, &bounds ); @@ -2945,7 +2900,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate() // create the new edit field TXNFrameOptions frameOptions = FrameOptionsFromWXStyle( m_windowStyle ); -#ifdef __WXMAC_OSX__ // the scrollbars are not correctly embedded but are inserted at the root: // this gives us problems as we have erratic redraws even over the structure area @@ -2975,8 +2929,6 @@ OSStatus wxMacMLTEClassicControl::DoCreate() frameOptions &= ~(kTXNWantHScrollBarMask | kTXNDrawGrowIconMask); } -#endif - err = TXNNewObject( NULL, m_txnWindow, &bounds, frameOptions, kTXNTextEditStyleFrameType, kTXNTextensionFile, kTXNSystemDefaultEncoding, @@ -2996,9 +2948,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate() verify_noerr( TXNSetTXNObjectControls( m_txn, false, toptag, iControlTags, iControlData ) ); #endif -#ifdef __WXMAC_OSX__ TXNRegisterScrollInfoProc( m_txn, gTXNScrollInfoProc, (SInt32)this ); -#endif SetGWorld( origPort , origDev ) ; diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index a0c917fec5..a5e47fe1a5 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -25,21 +25,12 @@ #include "wx/sysopt.h" -#ifdef __WXMAC_OSX__ const short kwxMacToolBarToolDefaultWidth = 16; const short kwxMacToolBarToolDefaultHeight = 16; const short kwxMacToolBarTopMargin = 4; const short kwxMacToolBarLeftMargin = 4; const short kwxMacToolBorder = 0; const short kwxMacToolSpacing = 6; -#else -const short kwxMacToolBarToolDefaultWidth = 24; -const short kwxMacToolBarToolDefaultHeight = 22; -const short kwxMacToolBarTopMargin = 2; -const short kwxMacToolBarLeftMargin = 2; -const short kwxMacToolBorder = 4; -const short kwxMacToolSpacing = 0; -#endif IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl) @@ -243,9 +234,7 @@ private: static const EventTypeSpec eventList[] = { { kEventClassControl, kEventControlHit }, -#ifdef __WXMAC_OSX__ { kEventClassControl, kEventControlHitTest }, -#endif }; static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef WXUNUSED(handler), EventRef event, void *data ) @@ -266,11 +255,7 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef { bool shouldToggle; -#ifdef __WXMAC_OSX__ shouldToggle = !tbartool->IsToggled(); -#else - shouldToggle = (GetControl32BitValue( (ControlRef)(tbartool->GetControlHandle()) ) != 0); -#endif tbar->ToggleTool( tbartool->GetId(), shouldToggle ); } @@ -281,7 +266,6 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef } break; -#ifdef __WXMAC_OSX__ case kEventControlHitTest: { HIPoint pt = cEvent.GetParameter(kEventParamMouseLocation); @@ -295,7 +279,6 @@ static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef result = noErr; } break; -#endif default: break; @@ -451,7 +434,6 @@ void wxToolBarTool::SetPosition( const wxPoint& position ) else { // separator -#ifdef __WXMAC_OSX__ Rect contrlRect; GetControlBounds( m_controlHandle, &contrlRect ); int former_mac_x = contrlRect.left; @@ -459,13 +441,11 @@ void wxToolBarTool::SetPosition( const wxPoint& position ) if ( mac_x != former_mac_x || mac_y != former_mac_y ) UMAMoveControl( m_controlHandle, mac_x, mac_y ); -#endif } } void wxToolBarTool::UpdateToggleImage( bool toggle ) { -#ifdef __WXMAC_OSX__ if ( toggle ) { int w = m_bmpNormal.GetWidth(); @@ -516,9 +496,6 @@ void wxToolBarTool::UpdateToggleImage( bool toggle ) sizeof(transform), (Ptr)&transform ); HIViewSetNeedsDisplay( m_controlHandle, true ); -#else - ::SetControl32BitValue( m_controlHandle, toggle ); -#endif } wxToolBarTool::wxToolBarTool( @@ -1741,10 +1718,9 @@ void wxToolBar::OnPaint(wxPaintEvent& event) GetSize( &w, &h ); bool drawMetalTheme = MacGetTopLevelWindow()->MacGetMetalAppearance(); - bool minimumUmaAvailable = (UMAGetSystemVersion() >= 0x1030); #if wxMAC_USE_CORE_GRAPHICS - if ( !drawMetalTheme && minimumUmaAvailable ) + if ( !drawMetalTheme ) { HIThemePlacardDrawInfo info; memset( &info, 0, sizeof(info) ); @@ -1768,7 +1744,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event) { wxMacPortSetter helper( &dc ); - if ( !drawMetalTheme || !minimumUmaAvailable ) + if ( !drawMetalTheme ) { Rect toolbarrect = { dc.YLOG2DEVMAC(0), dc.XLOG2DEVMAC(0), dc.YLOG2DEVMAC(h), dc.XLOG2DEVMAC(w) }; diff --git a/src/mac/carbon/toplevel.cpp b/src/mac/carbon/toplevel.cpp index 3bb2a084e8..572ff2e81d 100644 --- a/src/mac/carbon/toplevel.cpp +++ b/src/mac/carbon/toplevel.cpp @@ -442,18 +442,6 @@ ControlRef wxMacFindSubControl( wxTopLevelWindowMac* toplevelWindow, const Point return NULL ; } -ControlRef wxMacFindControlUnderMouse( wxTopLevelWindowMac* toplevelWindow , const Point& location , WindowRef window , ControlPartCode *outPart ) -{ -#if TARGET_API_MAC_OSX - if ( UMAGetSystemVersion() >= 0x1030 ) - return FindControlUnderMouse( location , window , outPart ) ; -#endif - - ControlRef rootControl = NULL ; - verify_noerr( GetRootControl( window , &rootControl ) ) ; - - return wxMacFindSubControl( toplevelWindow , location , rootControl , outPart ) ; -} #define NEW_CAPTURE_HANDLING 1 @@ -620,13 +608,7 @@ wxMacTopLevelMouseEventHandler(EventHandlerCallRef WXUNUSED(handler), // if built-in find control is finding the wrong control (ie static box instead of overlaid // button, we cannot let the standard handler do its job, but must handle manually - if ( ( cEvent.GetKind() == kEventMouseDown ) -#ifdef __WXMAC_OSX__ - && - (FindControlUnderMouse(windowMouseLocation , window , &dummyPart) != - wxMacFindControlUnderMouse( toplevelWindow , windowMouseLocation , window , &dummyPart ) ) -#endif - ) + if ( cEvent.GetKind() == kEventMouseDown ) { if ( currentMouseWindow->MacIsReallyEnabled() ) { diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index 75132f7124..3ab477e672 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -18,19 +18,6 @@ #include "wx/toplevel.h" #include "wx/dc.h" -#ifndef __DARWIN__ -# include -# include -# if defined(TARGET_CARBON) -# if PM_USE_SESSION_APIS -# include -# endif -# include -# else -# include -# endif -#endif - #include "wx/mac/uma.h" // since we have decided that we only support 8.6 upwards we are @@ -116,14 +103,8 @@ MenuRef UMANewMenu( SInt16 id , const wxString& title , wxFontEncoding encoding wxString str = wxStripMenuCodes( title ) ; MenuRef menu ; -#if TARGET_CARBON CreateNewMenu( id , 0 , &menu ) ; SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding ) ) ; -#else - Str255 ptitle ; - wxMacStringToPascal( str , ptitle ) ; - menu = ::NewMenu( id , ptitle ) ; -#endif return menu ; } @@ -132,14 +113,7 @@ void UMASetMenuTitle( MenuRef menu , const wxString& title , wxFontEncoding enco { wxString str = wxStripMenuCodes( title ) ; -#if TARGET_CARBON SetMenuTitleWithCFString( menu , wxMacCFStringHolder(str , encoding) ) ; - -#else - Str255 ptitle ; - wxMacStringToPascal( str , ptitle ) ; - SetMenuTitle( menu , ptitle ) ; -#endif } void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title, wxFontEncoding encoding ) @@ -147,14 +121,7 @@ void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& titl // we don't strip the accels here anymore, must be done before wxString str = title ; -#if TARGET_CARBON SetMenuItemTextWithCFString( menu , item , wxMacCFStringHolder(str , encoding) ) ; - -#else - Str255 ptitle ; - wxMacStringToPascal( str , ptitle ) ; - SetMenuItemText( menu , item , ptitle ) ; -#endif } UInt32 UMAMenuEvent( EventRecord *inEvent ) @@ -346,54 +313,6 @@ void UMAInsertMenuItem( MenuRef menu , const wxString& title, wxFontEncoding enc UMASetMenuItemShortcut( menu , item+1 , entry ) ; } -// quickdraw - -#if !TARGET_CARBON - -int gPrOpenCounter = 0 ; - -OSStatus UMAPrOpen() -{ - OSErr err = noErr ; - - ++gPrOpenCounter ; - - if ( gPrOpenCounter == 1 ) - { - PrOpen() ; - err = PrError() ; - wxASSERT( err == noErr ) ; - } - - return err ; -} - -OSStatus UMAPrClose() -{ - OSErr err = noErr ; - - wxASSERT( gPrOpenCounter >= 1 ) ; - - if ( gPrOpenCounter == 1 ) - { - PrClose() ; - err = PrError() ; - wxASSERT( err == noErr ) ; - } - - --gPrOpenCounter ; - - return err ; -} - -pascal QDGlobalsPtr GetQDGlobalsPtr() ; -pascal QDGlobalsPtr GetQDGlobalsPtr() -{ - return QDGlobalsPtr (* (Ptr*) LMGetCurrentA5 ( ) - 0xCA); -} - -#endif - void UMAShowWatchCursor() { SetThemeCursor(kThemeWatchCursor); @@ -410,11 +329,7 @@ GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) { wxASSERT( inWindowRef != NULL ) ; -#if TARGET_CARBON return (GrafPtr) GetWindowPort( inWindowRef ) ; -#else - return (GrafPtr) inWindowRef ; -#endif } void UMADisposeWindow( WindowRef inWindowRef ) @@ -426,128 +341,34 @@ void UMADisposeWindow( WindowRef inWindowRef ) void UMASetWTitle( WindowRef inWindowRef , const wxString& title , wxFontEncoding encoding ) { -#if TARGET_CARBON SetWindowTitleWithCFString( inWindowRef , wxMacCFStringHolder(title , encoding) ) ; - -#else - Str255 ptitle ; - wxMacStringToPascal( title , ptitle ) ; - SetWTitle( inWindowRef , ptitle ) ; -#endif } // appearance additions void UMASetControlTitle( ControlRef inControl , const wxString& title , wxFontEncoding encoding ) { -#if TARGET_CARBON SetControlTitleWithCFString( inControl , wxMacCFStringHolder(title , encoding) ) ; - -#else - Str255 ptitle ; - wxMacStringToPascal( title , ptitle ) ; - SetControlTitle( inControl , ptitle ) ; -#endif } void UMAActivateControl( ControlRef inControl ) { -#if TARGET_API_MAC_OSX ::ActivateControl( inControl ) ; - -#else - // we have to add the control after again to the update rgn - // otherwise updates get lost - if ( !IsControlActive( inControl ) ) - { - bool visible = IsControlVisible( inControl ) ; - if ( visible ) - SetControlVisibility( inControl , false , false ) ; - - ::ActivateControl( inControl ) ; - - if ( visible ) - { - SetControlVisibility( inControl , true , false ) ; - - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ; - } - } -#endif } void UMAMoveControl( ControlRef inControl , short x , short y ) { -#if TARGET_API_MAC_OSX - ::MoveControl( inControl , x , y ) ; - -#else - bool visible = IsControlVisible( inControl ) ; - if ( visible ) - { - SetControlVisibility( inControl , false , false ) ; - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ; - } - ::MoveControl( inControl , x , y ) ; - - if ( visible ) - { - SetControlVisibility( inControl , true , false ) ; - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ; - } -#endif } void UMASizeControl( ControlRef inControl , short x , short y ) { -#if TARGET_API_MAC_OSX ::SizeControl( inControl , x , y ) ; - -#else - bool visible = IsControlVisible( inControl ) ; - if ( visible ) - { - SetControlVisibility( inControl , false , false ) ; - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ; - } - - ::SizeControl( inControl , x , y ) ; - - if ( visible ) - { - SetControlVisibility( inControl , true , false ) ; - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), GetControlBounds(inControl, &ctrlBounds) ) ; - } -#endif } void UMADeactivateControl( ControlRef inControl ) { -#if TARGET_API_MAC_OSX - ::DeactivateControl( inControl ) ; - -#else - // we have to add the control after again to the update rgn - // otherwise updates get lost - bool visible = IsControlVisible( inControl ) ; - if ( visible ) - SetControlVisibility( inControl , false , false ) ; - ::DeactivateControl( inControl ) ; - - if ( visible ) - { - SetControlVisibility( inControl , true , false ) ; - Rect ctrlBounds ; - InvalWindowRect( GetControlOwner(inControl), UMAGetControlBoundsInWindowCoords(inControl, &ctrlBounds) ) ; - } -#endif } // shows the control and adds the region to the update region @@ -639,11 +460,6 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) #endif } -#if !TARGET_CARBON -static OSStatus helpMenuStatus = noErr ; -static MenuItemIndex firstCustomItemIndex = 0 ; -#endif - static OSStatus UMAGetHelpMenu( MenuRef * outHelpMenu, MenuItemIndex * outFirstCustomItemIndex, @@ -654,7 +470,6 @@ static OSStatus UMAGetHelpMenu( MenuItemIndex * outFirstCustomItemIndex, bool allowHelpMenuCreation) { -#if TARGET_CARBON static bool s_createdHelpMenu = false ; if ( !s_createdHelpMenu && !allowHelpMenuCreation ) @@ -665,21 +480,6 @@ static OSStatus UMAGetHelpMenu( OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; s_createdHelpMenu = ( status == noErr ) ; return status ; -#else - wxUnusedVar( allowHelpMenuCreation ) ; - MenuRef helpMenuHandle ; - - helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ; - if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr ) - firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ; - - if ( outFirstCustomItemIndex ) - *outFirstCustomItemIndex = firstCustomItemIndex ; - - *outHelpMenu = helpMenuHandle ; - - return helpMenuStatus ; -#endif } OSStatus UMAGetHelpMenu( diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index c93b2e4a39..e38a307434 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -671,7 +671,6 @@ void wxMacWakeUp() SameProcess( &gAppProcess , &psn , &isSame ); if ( isSame ) { -#if TARGET_CARBON OSStatus err = noErr; #if 0 @@ -697,9 +696,6 @@ void wxMacWakeUp() kEventAttributeNone ); err = PostEventToQueue(GetMainEventQueue(), wakeupEvent, kEventPriorityHigh ); -#endif -#else - PostEvent( nullEvent , 0 ); #endif } else @@ -2207,7 +2203,6 @@ OSStatus wxMacControl::SetTabEnabled( SInt16 tabNo , bool enable ) // Quartz Support // -#ifdef __WXMAC_OSX__ // snippets from Sketch Sample from Apple : #define kGenericRGBProfilePathStr "/System/Library/ColorSync/Profiles/Generic RGB Profile.icc" @@ -2277,7 +2272,6 @@ CGColorSpaceRef wxMacGetGenericRGBColorSpace() return genericRGBColorSpace; } -#endif #ifndef __LP64__ diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index b1e009c4df..21f7e881b1 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -329,11 +329,9 @@ static pascal OSStatus wxMacWindowControlEventHandler( EventHandlerCallRef handl Boolean focusEverything = false ; ControlPartCode controlPart = cEvent.GetParameter(kEventParamControlPart , typeControlPartCode ); -#ifdef __WXMAC_OSX__ if ( cEvent.GetParameter(kEventParamControlFocusEverything , &focusEverything ) == noErr ) { } -#endif if ( thisWindow->MacIsUserPane() ) result = noErr ; @@ -1156,17 +1154,9 @@ void wxWindowMac::DoSetWindowVariant( wxWindowVariant variant ) break ; case wxWINDOW_VARIANT_MINI : - if (UMAGetSystemVersion() >= 0x1030 ) - { - // not always defined in the headers - size = 3 ; - themeFont = 109 ; - } - else - { - size = kControlSizeSmall; - themeFont = kThemeSmallSystemFont ; - } + // not always defined in the headers + size = 3 ; + themeFont = 109 ; break ; case wxWINDOW_VARIANT_LARGE : @@ -1730,7 +1720,7 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) GetMouse( &pt ) ; #endif - control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ; + control = FindControlUnderMouse( pt , window , &part ) ; if ( control ) mouseWin = wxFindControlFromMacControl( control ) ; @@ -1842,13 +1832,7 @@ void wxWindowMac::MacInvalidateBorders() RectRgn( updateOuter, &rect ) ; DiffRgn( updateOuter, updateInner , updateOuter ) ; -#ifdef __WXMAC_OSX__ GetParent()->m_peer->SetNeedsDisplay( updateOuter ) ; -#else - WindowRef tlw = (WindowRef) MacGetTopLevelWindowRef() ; - if ( tlw ) - InvalWindowRgn( tlw , updateOuter ) ; -#endif DisposeRgn( updateOuter ) ; DisposeRgn( updateInner ) ; -- 2.45.2