cleanup: unreachable code, unused variables, indentation, etc

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2008-11-16 18:20:46 +00:00
parent 470f357fd2
commit b7bc9d806b
9 changed files with 69 additions and 105 deletions

View 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() )

View 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())

View 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;

View 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.
// -----------------------------------------------------------------------

View 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);
}
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();

View File

@@ -92,16 +92,16 @@
//#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.
@@ -111,7 +111,7 @@
//#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
@@ -119,7 +119,7 @@
#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;
}
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();
@@ -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;

View 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
{
@@ -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 );

View 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;
}