]> git.saurik.com Git - wxWidgets.git/commitdiff
cleanup: unreachable code, unused variables, indentation, etc
authorPaul Cornett <paulcor@bullseye.com>
Sun, 16 Nov 2008 18:20:46 +0000 (18:20 +0000)
committerPaul Cornett <paulcor@bullseye.com>
Sun, 16 Nov 2008 18:20:46 +0000 (18:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sizer.cpp
src/generic/splitter.cpp
src/propgrid/advprops.cpp
src/propgrid/manager.cpp
src/propgrid/property.cpp
src/propgrid/propgrid.cpp
src/propgrid/propgridiface.cpp
src/propgrid/propgridpagestate.cpp
src/propgrid/props.cpp

index 206f09a255ff4ee3fe6ea8ec7b881580abf30f38..beb46796bc4b0a8cb479376d27a814cb06893709 100644 (file)
@@ -17,7 +17,6 @@
     #pragma hdrstop
 #endif
 
-#include "wx/display.h"
 #include "wx/sizer.h"
 #include "wx/private/flagscheck.h"
 
@@ -32,6 +31,7 @@
     #include "wx/toplevel.h"
 #endif // WX_PRECOMP
 
+#include "wx/display.h"
 #include "wx/listimpl.cpp"
 
 
@@ -1631,11 +1631,9 @@ wxSize wxFlexGridSizer::CalcMin()
     m_rowHeights.assign(nrows, -1);
     m_colWidths.assign(ncols, -1);
 
-    // n is the index of the item in left-to-right top-to-bottom order
-    size_t n = 0;
     for ( wxSizerItemList::iterator i = m_children.begin();
           i != m_children.end();
-          ++i, ++n )
+          ++i)
     {
         wxSizerItem * const item = *i;
         if ( item->IsShown() )
@@ -1789,21 +1787,21 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz)
         {
             const int col = n % ncols;
             didAdjustMinSize |= (*i)->InformFirstDirection(wxHORIZONTAL, m_colWidths[col], sz.y - m_calculatedMinSize.y);
-    }
+        }
 
         // Only redo if info was actually used
         if( didAdjustMinSize )
-    {
-        DoAdjustForGrowables
-        (
-            sz.x - m_calculatedMinSize.x,
-            m_growableCols,
-            m_colWidths,
-            m_growMode == wxFLEX_GROWMODE_SPECIFIED ? &m_growableColsProportions
-                                                    : NULL
-        );
+        {
+            DoAdjustForGrowables
+            (
+                sz.x - m_calculatedMinSize.x,
+                m_growableCols,
+                m_colWidths,
+                m_growMode == wxFLEX_GROWMODE_SPECIFIED ? &m_growableColsProportions
+                                                        : NULL
+            );
+        }
     }
-}
 
     if ( (m_flexDirection & wxVERTICAL) || (m_growMode != wxFLEX_GROWMODE_NONE) )
     {
index fd10afdde2f0bb5030ae30f02e4091dd3c510690..444304ae32c0d36f978f0a3dc2e393d7727dab4f 100644 (file)
@@ -719,7 +719,7 @@ void wxSplitterWindow::SizeWindows()
 // Set pane for unsplit window
 void wxSplitterWindow::Initialize(wxWindow *window)
 {
-    wxASSERT_MSG( (!window || (window && window->GetParent() == this)),
+    wxASSERT_MSG( (!window || window->GetParent() == this),
                   _T("windows in the splitter should have it as parent!") );
 
     if (window && !window->IsShown())
index f2d61cef45bdce4500317b87b68bee312af5025a..819014523d9aa2d36fa3c8df068f8540d3126cb8 100644 (file)
@@ -453,14 +453,7 @@ wxFontProperty::wxFontProperty( const wxString& label, const wxString& name,
     // Initialize font family choices list
     if ( !wxPGGlobalVars->m_fontFamilyChoices )
     {
-        wxFontEnumerator enumerator;
-        enumerator.EnumerateFacenames();
-
-#if wxMINOR_VERSION > 6
-        wxArrayString faceNames = enumerator.GetFacenames();
-#else
-        wxArrayString& faceNames = *enumerator.GetFacenames();
-#endif
+        wxArrayString faceNames = wxFontEnumerator::GetFacenames();
 
         faceNames.Sort();
 
@@ -897,7 +890,6 @@ int wxSystemColourProperty::ColToInd( const wxColour& colour ) const
     return wxNOT_FOUND;
 }
 
-
 void wxSystemColourProperty::OnSetValue()
 {
     // Convert from generic wxobject ptr to wxPGVariantDataColour
@@ -1576,7 +1568,7 @@ const wxString& wxPGGetDefaultImageWildcard()
 
         // Let's iterate over the image handler list.
         //for ( wxList::Node *node = handlers.GetFirst(); node; node = node->GetNext() )
-        for ( node = handlers.begin(); node != handlers.end(); node++ )
+        for ( node = handlers.begin(); node != handlers.end(); ++node )
         {
             wxImageHandler *handler = (wxImageHandler*)*node;
 
index 96494fea55bc79d175d1a0ab3ba60a6b2c009c1b..f2541f7f9f4f94689f56df9bbfe5c3b6a42484ec 100644 (file)
@@ -235,7 +235,7 @@ IMPLEMENT_CLASS(wxPropertyGridManager, wxPanel)
 #define ID_ADVTOOLBAR_OFFSET        1
 #define ID_ADVHELPCAPTION_OFFSET    2
 #define ID_ADVHELPCONTENT_OFFSET    3
-#define ID_ADVBUTTON_OFFSET         4
+//#define ID_ADVBUTTON_OFFSET         4
 #define ID_ADVTBITEMSBASE_OFFSET    5   // Must be last.
 
 // -----------------------------------------------------------------------
index 3ca05b7db987c2898913df28286ca89a8308ed1a..10ba288e6554b55a4e600673b7d572053f2c214f 100644 (file)
@@ -227,15 +227,7 @@ void wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
                 paintdata.m_drawnWidth = imageSize.x;
                 paintdata.m_drawnHeight = imageSize.y;
 
-                if ( !isUnspecified )
-                {
-                    property->OnCustomPaint( dc, imageRect, paintdata );
-                }
-                else
-                {
-                    dc.SetBrush(*wxWHITE_BRUSH);
-                    dc.DrawRectangle(imageRect);
-                }
+                property->OnCustomPaint( dc, imageRect, paintdata );
 
                 imageOffset = paintdata.m_drawnWidth;
             }
@@ -796,7 +788,7 @@ void wxPGProperty::DoGenerateComposedValue( wxString& text,
                 childValue = overrideValue;
             else
                 childValue = curChild->GetValue();
-            node++;
+            ++node;
             if ( node != valueOverrides->end() )
                 overrideValue = *node;
             else
@@ -1047,7 +1039,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
                 {
                     int depth = 1;
 
-                    if ( it != text.end() ) it++;
+                    if ( it != text.end() ) ++it;
                     pos++;
                     size_t startPos = pos;
 
@@ -1055,7 +1047,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
                     while ( it != text.end() && depth > 0 )
                     {
                         a = *it;
-                        it++;
+                        ++it;
                         pos++;
 
                         if ( a == wxS(']') )
@@ -1109,7 +1101,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
                     if ( a == delimeter )
                     {
                         pos--;
-                        it--;
+                        --it;
                     }
                 }
             }
@@ -1118,7 +1110,7 @@ bool wxPGProperty::StringToValue( wxVariant& variant, const wxString& text, int
         if ( a == 0 )
             break;
 
-        it++;
+        ++it;
         if ( it != text.end() )
         {
             a = *it;
@@ -1243,7 +1235,7 @@ void wxPGProperty::SetValue( wxVariant value, wxVariant* pList, int flags )
 
             // Children in list can be in any order, but we will give hint to
             // GetPropertyByNameWH(). This optimizes for full list parsing.
-            for ( node = list.begin(); node != list.end(); node++ )
+            for ( node = list.begin(); node != list.end(); ++node )
             {
                 wxVariant& childValue = *((wxVariant*)*node);
                 wxPGProperty* child = GetPropertyByNameWH(childValue.GetName(), i);
@@ -2311,7 +2303,7 @@ bool wxPGProperty::AreAllChildrenSpecified( wxVariant* pendingList ) const
         {
             const wxString& childName = child->GetBaseName();
 
-            for ( ; node != pList->end(); node++ )
+            for ( ; node != pList->end(); ++node )
             {
                 const wxVariant& item = *((const wxVariant*)*node);
                 if ( item.GetName() == childName )
@@ -2500,7 +2492,7 @@ wxPGAttributeStorage::~wxPGAttributeStorage()
 {
     wxPGHashMapS2P::iterator it;
 
-    for ( it = m_map.begin(); it != m_map.end(); it++ )
+    for ( it = m_map.begin(); it != m_map.end(); ++it )
     {
         wxVariantData* data = (wxVariantData*) it->second;
         data->DecRef();
index 40e2383b6b6724654d0dce502f1e80a8d73ef0ec..f0987ea966b66877fca09ba77222f0d117777127 100644 (file)
 
 
 //#define wxPG_TEXT_INDENT                4 // For the wxComboControl
-#define wxPG_ALLOW_CLIPPING             1 // If 1, GetUpdateRegion() in OnPaint event handler is not ignored
+//#define wxPG_ALLOW_CLIPPING             1 // If 1, GetUpdateRegion() in OnPaint event handler is not ignored
 #define wxPG_GUTTER_DIV                 3 // gutter is max(iconwidth/gutter_div,gutter_min)
 #define wxPG_GUTTER_MIN                 3 // gutter before and after image of [+] or [-]
 #define wxPG_YSPACING_MIN               1
 #define wxPG_DEFAULT_VSPACING           2 // This matches .NET propertygrid's value,
                                           // but causes normal combobox to spill out under MSW
 
-#define wxPG_OPTIMAL_WIDTH              200 // Arbitrary
+//#define wxPG_OPTIMAL_WIDTH              200 // Arbitrary
 
-#define wxPG_MIN_SCROLLBAR_WIDTH        10 // Smallest scrollbar width on any platform
+//#define wxPG_MIN_SCROLLBAR_WIDTH        10 // Smallest scrollbar width on any platform
                                            // Must be larger than largest control border
                                            // width * 2.
 
 
 //#define wxPG_NAT_CHOICE_BORDER_ANY   0
 
-#define wxPG_HIDER_BUTTON_HEIGHT        25
+//#define wxPG_HIDER_BUTTON_HEIGHT        25
 
 #define wxPG_PIXELS_PER_UNIT            m_lineHeight
 
   #define m_iconHeight m_iconWidth
 #endif
 
-#define wxPG_TOOLTIP_DELAY              1000
+//#define wxPG_TOOLTIP_DELAY              1000
 
 // -----------------------------------------------------------------------
 
@@ -959,8 +959,6 @@ static int wxPGGetColAvg( const wxColour& col )
 
 void wxPropertyGrid::RegainColours()
 {
-    wxColour def_bgcol = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
-
     if ( !(m_coloursCustomized & 0x0002) )
     {
         wxColour col = wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE );
@@ -1324,7 +1322,7 @@ wxString& wxPropertyGrid::ExpandEscapeSequences( wxString& dst_str, wxString& sr
 
     dst_str.clear();
 
-    for ( ; i != src_str.end(); i++ )
+    for ( ; i != src_str.end(); ++i )
     {
         wxUniChar a = *i;
 
@@ -1382,7 +1380,7 @@ wxString& wxPropertyGrid::CreateEscapeSequences( wxString& dst_str, wxString& sr
 
     dst_str.clear();
 
-    for ( ; i != src_str.end(); i++ )
+    for ( ; i != src_str.end(); ++i )
     {
         wxChar a = *i;
 
@@ -1683,13 +1681,10 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
 
         //
         // clipRect conversion
-        if ( clipRect )
-        {
-            cr2 = *clipRect;
-            cr2.x -= xRelMod;
-            cr2.y -= yRelMod;
-            clipRect = &cr2;
-        }
+        cr2 = *clipRect;
+        cr2.x -= xRelMod;
+        cr2.y -= yRelMod;
+        clipRect = &cr2;
         firstItemTopY -= yRelMod;
         lastItemBottomY -= yRelMod;
     }
@@ -1701,7 +1696,7 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
 
     const wxFont& normalfont = m_font;
 
-    bool reallyFocused = (m_iFlags & wxPG_FL_FOCUSED) ? true : false;
+    bool reallyFocused = (m_iFlags & wxPG_FL_FOCUSED) != 0;
 
     bool isEnabled = IsEnabled();
 
@@ -1839,10 +1834,10 @@ int wxPropertyGrid::DoDrawItems( wxDC& dc,
         }
         else
         {
-             renderFlags |= wxPGCellRenderer::Selected;
+            renderFlags |= wxPGCellRenderer::Selected;
 
-             if ( !p->IsCategory() )
-             {
+            if ( !p->IsCategory() )
+            {
                 renderFlags |= wxPGCellRenderer::DontUseCellFgCol |
                                wxPGCellRenderer::DontUseCellBgCol;
 
@@ -3369,9 +3364,6 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
 
             wxASSERT( m_wndEditor == (wxWindow*) NULL );
 
-            // Do we need OnMeasureCalls?
-            wxSize imsz = p->OnMeasureImage();
-
             //
             // Only create editor for non-disabled non-caption
             if ( !p->IsCategory() && !(p->m_flags & wxPG_PROP_DISABLED) )
@@ -3717,7 +3709,7 @@ bool wxPropertyGrid::DoExpand( wxPGProperty* p, bool sendEvents )
     }
 
     // Clear dont-center-splitter flag if it wasn't set
-    m_iFlags = m_iFlags & ~(wxPG_FL_DONT_CENTER_SPLITTER) | old_flag;
+    m_iFlags = (m_iFlags & ~wxPG_FL_DONT_CENTER_SPLITTER) | old_flag;
 
     return res;
 }
@@ -3767,8 +3759,7 @@ void wxPropertyGrid::RecalculateVirtualSize( int forceXPos )
     if ( by1 != by2 )
     {
         wxString s = wxString::Format(wxT("VirtualHeight=%i, ActualVirtualHeight=%i, should match!"), by1, by2);
-        wxASSERT_MSG( false,
-                      s.c_str() );
+        wxFAIL_MSG(s.c_str());
         wxLogDebug(s);
     }
 #endif
@@ -4214,9 +4205,9 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxMouseEvent &event
         int curPropHoverY = y - (y % ih);
 
         // On which item it hovers
-        if ( ( !m_propHover )
+        if ( !m_propHover
              ||
-             ( m_propHover && ( sy < m_propHoverY || sy >= (m_propHoverY+ih) ) )
+             ( sy < m_propHoverY || sy >= (m_propHoverY+ih) )
            )
         {
             // Mouse moves on another property
@@ -4328,8 +4319,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y, wxMouseEvent &event
             // (also not if we were dragging and its started
             // outside the splitter region)
 
-            if ( m_propHover &&
-                 !m_propHover->IsCategory() &&
+            if ( !m_propHover->IsCategory() &&
                  !event.Dragging() )
             {
 
@@ -4704,7 +4694,7 @@ void wxPropertyGrid::ClearActionTriggers( int action )
 {
     wxPGHashMapI2I::iterator it;
 
-    for ( it = m_actionTriggers.begin(); it != m_actionTriggers.end(); it++ )
+    for ( it = m_actionTriggers.begin(); it != m_actionTriggers.end(); ++it )
     {
         if ( it->second == action )
         {
@@ -4719,9 +4709,7 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild )
     // Handles key event when editor control is not focused.
     //
 
-    wxASSERT( !m_frozen );
-    if ( m_frozen )
-        return;
+    wxCHECK2(!m_frozen, return);
 
     // Travelsal between items, collapsing/expanding, etc.
     int keycode = event.GetKeyCode();
@@ -5162,7 +5150,7 @@ bool wxPGStringTokenizer::HasMoreTokens()
                 }
                 else
                 {
-                    i++;
+                    ++i;
                     m_curPos = i;
                     return true;
                 }
@@ -5174,7 +5162,7 @@ bool wxPGStringTokenizer::HasMoreTokens()
                 prev_a = wxT('\0');
             }
         }
-        i++;
+        ++i;
     }
 
     m_curPos = str.end();
@@ -5685,7 +5673,7 @@ wxPGChoices wxPropertyGridPopulator::ParseChoices( const wxString& choicesString
             int state = 0;
             bool labelValid = false;
 
-            for ( ; it != choicesString.end(); it++ )
+            for ( ; it != choicesString.end(); ++it )
             {
                 wxChar c = *it;
 
index 3b4bfe078c1538282d4c3711431d55d07e2036fa..8bb38aaa94dcb98579d4f9f3d65fe679d5427b68 100644 (file)
@@ -1003,7 +1003,7 @@ wxString wxPropertyGridInterface::SaveEditableState( int includedStates ) const
 
                 if ( !p->HasFlag(wxPG_PROP_COLLAPSED) )
                     result += EscapeDelimiters(p->GetName());
-                    result += wxS(",");
+                result += wxS(",");
 
             }
 
index fc4f6f14e5b57ba33457220dbdc2012a6d45d4cc..aa5b0244f8f6165ba5183a63ffd124766db2db08 100644 (file)
@@ -74,11 +74,10 @@ void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags
 
 void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags, int startPos, int dir  )
 {
-    wxPGProperty* property;
+    wxPGProperty* property = NULL;
 
     if ( startPos == wxTOP )
     {
-        property = NULL;
         if ( dir == 0 )
             dir = 1;
     }
@@ -90,8 +89,7 @@ void wxPropertyGridIteratorBase::Init( wxPropertyGridPageState* state, int flags
     }
     else
     {
-        wxASSERT_MSG( false, wxT("Only supported stating positions are wxTOP and wxBOTTOM") );
-        property = NULL;
+        wxFAIL_MSG("Only supported starting positions are wxTOP and wxBOTTOM");
     }
 
     Init( state, flags, property, dir );
@@ -470,7 +468,7 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p,
 //   NB: Nowadays only needed for alphabetic/categoric mode switching.
 // -----------------------------------------------------------------------
 
-#define II_INVALID_I    0x00FFFFFF
+//#define II_INVALID_I    0x00FFFFFF
 
 #define ITEM_ITERATION_VARIABLES \
     wxPGProperty* parent; \
@@ -481,6 +479,7 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p,
     parent = m_properties; \
     i = 0;
 
+#if 0
 #define ITEM_ITERATION_INIT(startparent, startindex, state) \
     parent = startparent; \
     i = (unsigned int)startindex; \
@@ -489,6 +488,7 @@ void wxPropertyGridPageState::DoSetPropertyName( wxPGProperty* p,
         parent = state->m_properties; \
         i = 0; \
     }
+#endif
 
 #define ITEM_ITERATION_LOOP_BEGIN \
     do \
@@ -895,8 +895,6 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
     int reduceCol = -1;
     int highestColWidth = 0;
 
-    bool minimizedCols = false;
-
 #ifdef __WXDEBUG__
     if ( debug )
         wxLogDebug(wxT("ColumnWidthCheck (virtualWidth: %i, clientWidth: %i)"), width, clientWidth);
@@ -910,7 +908,6 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
         if ( m_colWidths[i] <= min )
         {
             m_colWidths[i] = min;
-            minimizedCols = true;
         }
         else
         {
@@ -947,10 +944,10 @@ void wxPropertyGridPageState::CheckColumnWidths( int widthChange )
         if ( colsWidth < width )
         {
             // Increase column
-        #ifdef __WXDEBUG__
-        if ( debug )
-            wxLogDebug(wxT("  Adjust last column to %i"), m_colWidths[lastColumn] + widthHigher);
-        #endif
+#ifdef __WXDEBUG__
+            if ( debug )
+                wxLogDebug(wxT("  Adjust last column to %i"), m_colWidths[lastColumn] + widthHigher);
+#endif
             m_colWidths[lastColumn] = m_colWidths[lastColumn] + widthHigher;
         }
         else if ( colsWidth > width )
@@ -1376,7 +1373,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
 
     //
     // Second pass for special entries
-    for ( node = list.begin(); node != list.end(); node++ )
+    for ( node = list.begin(); node != list.end(); ++node )
     {
         wxVariant *current = (wxVariant*)*node;
 
@@ -1440,7 +1437,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
 
     if ( numSpecialEntries )
     {
-        for ( node = list.begin(); node != list.end(); node++ )
+        for ( node = list.begin(); node != list.end(); ++node )
         {
             wxVariant *current = (wxVariant*)*node;
 
@@ -1471,7 +1468,7 @@ void wxPropertyGridPageState::DoSetPropertyValues( const wxVariantList& list, wx
                                 wxVariantList& list2 = current->GetList();
                                 wxVariantList::const_iterator node2;
 
-                                for ( node2 = list2.begin(); node2 != list2.end(); node2++ )
+                                for ( node2 = list2.begin(); node2 != list2.end(); ++node2 )
                                 {
                                     wxVariant *attr = (wxVariant*)*node2;
                                     foundProp->SetAttribute( attr->GetName(), *attr );
index bb9d18a7a0184576b6d46f288dbed763cb1c7f1d..df7efa118a6adb652864859a5f6c7b7a7cd2d8cc 100644 (file)
@@ -200,7 +200,7 @@ bool wxIntProperty::StringToValue( wxVariant& variant, const wxString& text, int
 
         int firstNonZeroPos = 0;
 
-        for ( ; i != iMax; i++ )
+        for ( ; i != iMax; ++i )
         {
             wxChar c = *i;
             if ( c != wxS('0') && c != wxS(' ') )
@@ -606,7 +606,7 @@ void wxPropertyGrid::DoubleToString(wxString& target,
         wxString::const_iterator i = target.end() - 1;
         size_t new_len = target.length() - 1;
 
-        for ( ; i != target.begin(); i-- )
+        for ( ; i != target.begin(); --i )
         {
             if ( *i != wxS('0') )
                 break;
@@ -973,7 +973,7 @@ void wxEnumProperty::OnSetValue()
     else if ( variantType == wxPG_VARIANT_TYPE_STRING )
         ValueFromString_( m_value, m_value.GetString(), 0 );
     else
-        wxASSERT( false );
+        wxFAIL;
 
     if ( ms_nextIndex != -2 )
     {
@@ -2400,16 +2400,13 @@ void wxPropertyGrid::ArrayStringToString( wxString& dst, const wxArrayString& sr
     unsigned int i;
     unsigned int itemCount = src.size();
 
-    wxChar preas[2];
+    wxChar preas[2] = { 0, 0 };
 
     dst.Empty();
 
-    if ( !preDelim )
-        preas[0] = 0;
-    else if ( (flags & 1) )
+    if ( flags & 1 )
     {
         preas[0] = preDelim;
-        preas[1] = 0;
         pdr = wxS("\\");
         pdr += preDelim;
     }