X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/58fbf2616ff19dca7b10841a3819afcd6cd5d140..55410bb4f67febe1ca20654f078ea4fb9a6223ae:/src/propgrid/propgrid.cpp?ds=inline diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 29fde9f3a0..6a5a83ab25 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -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 } // ----------------------------------------------------------------------- @@ -1562,7 +1535,7 @@ void wxPropertyGrid::DrawItems( wxDC& dc, if ( dcPtr ) { dc.SetClippingRegion( *clipRect ); - paintFinishY = DoDrawItems( *dcPtr, NULL, NULL, clipRect, isBuffered ); + paintFinishY = DoDrawItems( *dcPtr, clipRect, isBuffered ); } #if wxPG_DOUBLE_BUFFER @@ -1588,30 +1561,17 @@ void wxPropertyGrid::DrawItems( wxDC& dc, // ----------------------------------------------------------------------- int wxPropertyGrid::DoDrawItems( wxDC& dc, - const wxPGProperty* firstItem, - const wxPGProperty* lastItem, const wxRect* clipRect, bool isBuffered ) const { - // TODO: This should somehow be eliminated. - wxRect tempClipRect; - if ( !clipRect ) - { - wxASSERT(firstItem); - wxASSERT(lastItem); - tempClipRect = GetPropertyRect(firstItem, lastItem); - clipRect = &tempClipRect; - } + const wxPGProperty* firstItem; + const wxPGProperty* lastItem; - if ( !firstItem ) - firstItem = DoGetItemAtY(clipRect->y); + firstItem = DoGetItemAtY(clipRect->y); + lastItem = DoGetItemAtY(clipRect->y+clipRect->height-1); if ( !lastItem ) - { - lastItem = DoGetItemAtY(clipRect->y+clipRect->height-1); - if ( !lastItem ) - lastItem = GetLastItem( wxPG_ITERATE_VISIBLE ); - } + lastItem = GetLastItem( wxPG_ITERATE_VISIBLE ); if ( m_frozen || m_height < 1 || firstItem == NULL ) return clipRect->y; @@ -1683,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; @@ -1720,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; @@ -1996,7 +1956,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc, } if ( fontChanged ) - dc.SetFont(normalfont); + dc.SetFont(normalFont); y += rowHeight; } @@ -2154,8 +2114,6 @@ void wxPropertyGrid::Refresh( bool WXUNUSED(eraseBackground), void wxPropertyGrid::Clear() { - ClearSelection(false); - m_pState->DoClear(); m_propHover = NULL; @@ -3829,7 +3787,7 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos ) else if ( xPos > (xAmount-(width/wxPG_PIXELS_PER_UNIT)) ) xPos = 0; - int yAmount = (y+wxPG_PIXELS_PER_UNIT+2)/wxPG_PIXELS_PER_UNIT; + int yAmount = y / wxPG_PIXELS_PER_UNIT; int yPos = GetScrollPos( wxVERTICAL ); SetScrollbars( wxPG_PIXELS_PER_UNIT, wxPG_PIXELS_PER_UNIT, @@ -4307,7 +4265,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 ); @@ -5300,15 +5258,15 @@ wxPGChoiceEntry& wxPGChoicesData::Insert( int index, IMPLEMENT_DYNAMIC_CLASS(wxPropertyGridEvent, wxCommandEvent) -wxDEFINE_EVENT( wxEVT_PG_SELECTED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_CHANGING, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_CHANGED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent ) -wxDEFINE_EVENT( wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent ) +wxDEFINE_EVENT( wxEVT_PG_SELECTED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_CHANGING, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_CHANGED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent ); +wxDEFINE_EVENT( wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent ); // -----------------------------------------------------------------------