]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed old font-related code that caused problems on wxMAC, also replaced all accesses...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 12 Feb 2009 16:55:19 +0000 (16:55 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Thu, 12 Feb 2009 16:55:19 +0000 (16:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/propgrid/editors.cpp
src/propgrid/manager.cpp
src/propgrid/propgrid.cpp
src/propgrid/propgridpagestate.cpp

index 6184734c484484cd1b8ce1c14d4de955853a8504..07df5fb839ee951e1d92240da0024c74dd0fa41d 100644 (file)
@@ -668,7 +668,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb,
         if ( rect.width < 0 )
         {
             wxCoord x, y;
-            GetTextExtent(text, &x, &y, 0, 0, &m_font);
+            pCb->GetTextExtent(text, &x, &y, 0, 0);
             rect.width = cis.x + wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2 + 9 + x;
         }
 
@@ -1333,7 +1333,7 @@ void wxSimpleCheckBox::OnPaint( wxPaintEvent& WXUNUSED(event) )
 
     int state = m_state;
     if ( !(state & wxSCB_STATE_UNSPECIFIED) &&
-         m_font.GetWeight() == wxBOLD )
+         GetFont().GetWeight() == wxBOLD )
         state |= wxSCB_STATE_BOLD;
 
     DrawSimpleCheckBox(dc,rect,m_boxHeight,state,txcol);
index d844503d3899f916ab129246cf0208b41646e91f..f4052c044f1d7042253e3e174a507c3ad6e4d7b3 100644 (file)
@@ -1479,7 +1479,7 @@ void wxPropertyGridManager::SetSplitterLeft( bool subProps, bool allPages )
     else
     {
         wxClientDC dc(this);
-        dc.SetFont(m_pPropGrid->m_font);
+        dc.SetFont(m_pPropGrid->GetFont());
 
         int highest = 0;
         unsigned int i;
index b3970054ed98e3119e57c6fdb5d004270f4dab7c..8a3606fda4460821791e88f0b6bfe01f9c2be30e 100644 (file)
@@ -573,16 +573,7 @@ void wxPropertyGrid::Init2()
        // adjust bitmap icon y position so they are centered
     m_vspacing = wxPG_DEFAULT_VSPACING;
 
-    if ( !m_font.Ok() )
-    {
-        wxFont useFont = wxScrolledWindow::GetFont();
-        wxScrolledWindow::SetOwnFont( useFont );
-    }
-    else
-    {
-        // This should be otherwise called by SetOwnFont
-           CalculateFontAndBitmapStuff( wxPG_DEFAULT_VSPACING );
-    }
+    CalculateFontAndBitmapStuff( wxPG_DEFAULT_VSPACING );
 
     // Allocate cell datas indirectly by calling setter
     m_propertyDefaultCell.SetBgCol(*wxBLACK);
@@ -1045,32 +1036,14 @@ bool wxPropertyGrid::SetFont( const wxFont& font )
     // Must disable active editor.
     ClearSelection(false);
 
-    // TODO: Following code is disabled with wxMac because
-    //   it is reported to fail. I (JMS) cannot debug it
-    //   personally right now.
-    // CS: should be fixed now, leaving old code in just in case, TODO: REMOVE
-#if 1 // !defined(__WXMAC__)
     bool res = wxScrolledWindow::SetFont( font );
     if ( res )
     {
         CalculateFontAndBitmapStuff( m_vspacing );
-
-        if ( m_pState )
-            m_pState->CalculateFontAndBitmapStuff(m_vspacing);
-
         Refresh();
     }
 
     return res;
-#else
-    // ** wxMAC Only **
-    // TODO: Remove after SetFont crash fixed.
-    if ( m_iFlags & wxPG_FL_INITIALIZED )
-    {
-        wxLogDebug(wxT("WARNING: propGrid.cpp: wxPropertyGrid::SetFont has been disabled on wxMac since there has been crash reported in it. If you are willing to debug the cause, replace line '#if !defined(__WXMAC__)' with line '#if 1' in wxPropertyGrid::SetFont."));
-    }
-    return false;
-#endif
 }
 
 // -----------------------------------------------------------------------
@@ -1670,7 +1643,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
 
     int x = m_marginWidth - xRelMod;
 
-    const wxFont& normalfont = m_font;
+    wxFont normalFont = GetFont();
 
     bool reallyFocused = (m_iFlags & wxPG_FL_FOCUSED) != 0;
 
@@ -1707,7 +1680,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
 
     // TODO: Only render columns that are within clipping region.
 
-    dc.SetFont(normalfont);
+    dc.SetFont(normalFont);
 
     wxPropertyGridConstIterator it( state, wxPG_ITERATE_VISIBLE, firstItem );
     int endScanBottomY = lastItemBottomY + lh;
@@ -1983,7 +1956,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
         }
 
         if ( fontChanged )
-            dc.SetFont(normalfont);
+            dc.SetFont(normalFont);
 
         y += rowHeight;
     }
@@ -4294,7 +4267,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxMouseEvent &event
                         if ( space )
                         {
                             int tw, th;
-                           GetTextExtent( tipString, &tw, &th, 0, 0, &m_font );
+                           GetTextExtent( tipString, &tw, &th, 0, 0 );
                             if ( tw > space )
                             {
                                 SetToolTip( tipString );
index 59c3a88a39d4bb15afc8698bde6d7c0aa1455fe6..ed24230a420326a44af619ae57c970f81e885396 100644 (file)
@@ -863,7 +863,7 @@ void wxPropertyGridPageState::SetSplitterLeft( bool subProps )
 {
     wxPropertyGrid* pg = GetGrid();
     wxClientDC dc(pg);
-    dc.SetFont(pg->m_font);
+    dc.SetFont(pg->GetFont());
 
     int maxW = GetColumnFitWidth(dc, m_properties, 0, subProps);
 
@@ -880,7 +880,7 @@ wxSize wxPropertyGridPageState::DoFitColumns( bool WXUNUSED(allowGridResize) )
 {
     wxPropertyGrid* pg = GetGrid();
     wxClientDC dc(pg);
-    dc.SetFont(pg->m_font);
+    dc.SetFont(pg->GetFont());
 
     int marginWidth = pg->m_marginWidth;
     int accWid = marginWidth;