]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/display.cpp
Fix centering of top-level children of wxMDIParentFrame on Mac
[wxWidgets.git] / src / mac / carbon / display.cpp
index bd1d5e8d7332389d4173c3d7f18a6b6c964eab17..313c2f26cc1ff224c4f5832fb2983421fa4db14e 100644 (file)
@@ -1,11 +1,11 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        display.cpp
 // Purpose:     Mac implementation of wxDisplay class
 /////////////////////////////////////////////////////////////////////////////
 // Name:        display.cpp
 // Purpose:     Mac implementation of wxDisplay class
-// Author:      Brian Victor
-// Modified by: Royce Mitchell III & Ryan Norton
+// Author:      Ryan Norton & Brian Victor
+// Modified by: Royce Mitchell III 
 // Created:     06/21/02
 // RCS-ID:      $Id$
 // Created:     06/21/02
 // RCS-ID:      $Id$
-// Copyright:   (c) wxWindows team
+// Copyright:   (c) wxWidgets team
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
@@ -25,6 +25,7 @@
 #ifndef WX_PRECOMP
    #include "wx/dynarray.h"
    #include "wx/log.h"
 #ifndef WX_PRECOMP
    #include "wx/dynarray.h"
    #include "wx/log.h"
+   #include "wx/msgdlg.h"
 #endif
 
 #ifdef __DARWIN__
 #endif
 
 #ifdef __DARWIN__
@@ -243,10 +244,14 @@ wxArrayVideoModes
        DMListType pModes;
        DMDisplayModeListIteratorUPP uppMLI;
        DisplayIDType nDisplayID;
        DMListType pModes;
        DMDisplayModeListIteratorUPP uppMLI;
        DisplayIDType nDisplayID;
+        OSErr err;
 
 
-       wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr); 
+        err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
+       wxASSERT(err == noErr); 
+        
        //Create a new list...
        //Create a new list...
-       wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes,                                                   &pModes) == noErr, wxT("Could not create a new display mode 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);
 
        uppMLI = NewDMDisplayModeListIteratorUPP(DMModeListIteratorProc);
        wxASSERT(uppMLI);
@@ -256,11 +261,13 @@ wxArrayVideoModes
        sModeInfo.pMatchMode = &mode;
        for (DMListIndexType i = 0; i < nNumModes; ++i)
        {
        sModeInfo.pMatchMode = &mode;
        for (DMListIndexType i = 0; i < nNumModes; ++i)
        {
-           wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
-                                             uppMLI, &sModeInfo) == noErr);
+            err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
+           wxASSERT(err == noErr);
        }
        DisposeDMDisplayModeListIteratorUPP(uppMLI);
        }
        DisposeDMDisplayModeListIteratorUPP(uppMLI);
-       wxASSERT(DMDisposeList(pModes) == noErr);       
+        
+        err = DMDisposeList(pModes);
+       wxASSERT(err == noErr); 
     }
     else //DM 1.0, 1.2, 1.x
     {
     }
     else //DM 1.0, 1.2, 1.x
     {
@@ -289,11 +296,14 @@ wxVideoMode wxDisplay::GetCurrentMode() const
            DMListType pModes;
                DMDisplayModeListIteratorUPP uppMLI;
            DisplayIDType nDisplayID;
            DMListType pModes;
                DMDisplayModeListIteratorUPP uppMLI;
            DisplayIDType nDisplayID;
+            OSErr err;
 
 
-           wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
+            err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
+           wxASSERT(err == noErr);
+            
            //Create a new list...
            //Create a new list...
-           wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
-                                 wxT("Could not create a new display mode 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);
                
                uppMLI = NewDMDisplayModeListIteratorUPP(DMModeTransProc);
                wxASSERT(uppMLI);
@@ -303,8 +313,8 @@ wxVideoMode wxDisplay::GetCurrentMode() const
                sModeInfo.psMode = &sMode;
                for (DMListIndexType i = 0; i < nNumModes; ++i)
                {
                sModeInfo.psMode = &sMode;
                for (DMListIndexType i = 0; i < nNumModes; ++i)
                {
-                       wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
-                                                                                       uppMLI, &sModeInfo) == noErr);
+                err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
+                       wxASSERT(err == noErr);
 
                        if ( sModeInfo.bMatched == true )
                        {
 
                        if ( sModeInfo.bMatched == true )
                        {
@@ -314,7 +324,9 @@ wxVideoMode wxDisplay::GetCurrentMode() const
                }
 
            DisposeDMDisplayModeListIteratorUPP(uppMLI);
                }
 
            DisposeDMDisplayModeListIteratorUPP(uppMLI);
-           wxASSERT(DMDisposeList(pModes) == noErr);
+            
+            err = DMDisposeList(pModes);
+           wxASSERT(err == noErr);
        }
        else //Can't get current mode?
        {
        }
        else //Can't get current mode?
        {
@@ -367,11 +379,14 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
        DMListType pModes;
        DMDisplayModeListIteratorUPP uppMLI;
        DisplayIDType nDisplayID;
        DMListType pModes;
        DMDisplayModeListIteratorUPP uppMLI;
        DisplayIDType nDisplayID;
+        OSErr err;
 
 
-       wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
+        err = DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false);
+       wxASSERT(err == noErr);
+        
        //Create a new list...
        //Create a new list...
-       wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
-                         wxT("Could not create a new display mode 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);
 
        uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
        wxASSERT(uppMLI);
@@ -382,8 +397,9 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
        unsigned int i;
        for(i = 0; i < nNumModes; ++i)
        {
        unsigned int i;
        for(i = 0; i < nNumModes; ++i)
        {
-               wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
-                                                                                  uppMLI, &sModeInfo) == noErr);
+            err = DMGetIndexedDisplayModeFromList(pModes, i, NULL, uppMLI, &sModeInfo);
+               wxASSERT(err == noErr);
+            
                if (sModeInfo.bMatched == true)
                {
                        sMode = sModeInfo.sMode;
                if (sModeInfo.bMatched == true)
                {
                        sMode = sModeInfo.sMode;
@@ -394,7 +410,9 @@ bool wxDisplay::ChangeMode(const wxVideoMode& mode)
                return false;
 
        DisposeDMDisplayModeListIteratorUPP(uppMLI);
                return false;
 
        DisposeDMDisplayModeListIteratorUPP(uppMLI);
-       wxASSERT(DMDisposeList(pModes) == noErr);
+       
+        err = DMDisposeList(pModes);
+        wxASSERT(err == noErr);
 
        // For the really paranoid -
        //          unsigned long flags;
 
        // For the really paranoid -
        //          unsigned long flags;