From 6a35140686e316865d24dc26e675709ddaacf0a5 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 5 Apr 2019 09:06:06 -0700 Subject: [PATCH] Remove redundant conditionals --- demos/poem/wxpoem.cpp | 3 --- src/gtk/dataview.cpp | 9 --------- src/propgrid/editors.cpp | 15 ++++----------- src/richtext/richtextctrl.cpp | 5 +---- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/demos/poem/wxpoem.cpp b/demos/poem/wxpoem.cpp index f75ec1c397..0990137dec 100644 --- a/demos/poem/wxpoem.cpp +++ b/demos/poem/wxpoem.cpp @@ -161,10 +161,7 @@ void MainWindow::ScanBuffer(wxDC *dc, bool DrawIt, int *max_x, int *max_y) y = (*max_y - poem_height)/2; width = *max_x; height = *max_y; - } - if (DrawIt) - { dc->SetBrush(*wxLIGHT_GREY_BRUSH); dc->SetPen(*wxGREY_PEN); dc->DrawRectangle(0, 0, width, height); diff --git a/src/gtk/dataview.cpp b/src/gtk/dataview.cpp index d17c2dd2fd..f4e14017b1 100644 --- a/src/gtk/dataview.cpp +++ b/src/gtk/dataview.cpp @@ -4099,15 +4099,6 @@ gboolean wxDataViewCtrlInternal::iter_children( GtkTreeIter *iter, GtkTreeIter * } else { - if (iter == NULL) - { - if (m_root->GetChildCount() == 0) return FALSE; - iter->stamp = m_gtk_model->stamp; - iter->user_data = (gpointer) m_root->GetChildren().Item( 0 ); - return TRUE; - } - - wxDataViewItem item; if (parent) item = wxDataViewItem( (void*) parent->user_data ); diff --git a/src/propgrid/editors.cpp b/src/propgrid/editors.cpp index f4a954495a..2397f10bff 100644 --- a/src/propgrid/editors.cpp +++ b/src/propgrid/editors.cpp @@ -781,7 +781,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, const wxBitmap* itemBitmap = NULL; - if ( item >= 0 && choices.IsOk() && choices.Item(item).GetBitmap().IsOk() && comValIndex == -1 ) + if ( choices.IsOk() && choices.Item(item).GetBitmap().IsOk() && comValIndex == -1 ) itemBitmap = &choices.Item(item).GetBitmap(); // @@ -853,7 +853,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, // image will not appear on the control row (it may be too // large to fit, for instance). Also do not draw custom image // if no choice was selected. - if ( !p->HasFlag(wxPG_PROP_CUSTOMIMAGE) || item < 0 ) + if ( !p->HasFlag(wxPG_PROP_CUSTOMIMAGE) ) useCustomPaintProcedure = false; } else @@ -897,13 +897,9 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, renderer->Render( dc, r, this, p, m_selColumn, comValIndex, renderFlags ); return; } - else if ( item >= 0 ) - { - p->OnCustomPaint( dc, r, paintdata ); - } else { - dc.DrawRectangle( r ); + p->OnCustomPaint( dc, r, paintdata ); } pt.x += paintdata.m_drawnWidth + wxCC_CUSTOM_IMAGE_MARGIN2 - 1; @@ -915,10 +911,7 @@ void wxPropertyGrid::OnComboItemPaint( const wxPGComboBox* pCb, // sure if it is needed, but seems to not cause any harm. pt.x -= 1; - if ( item < 0 && (flags & wxODCB_PAINTING_CONTROL) ) - item = pCb->GetSelection(); - - if ( choices.IsOk() && item >= 0 && comValIndex < 0 ) + if ( choices.IsOk() && comValIndex < 0 ) { // This aligns bitmap horizontally so that it is // on the same position as bitmap drawn for static content diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 844f264419..7840ef29a9 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -2737,7 +2737,7 @@ long wxRichTextCtrl::FindNextWordPosition(int direction) const if (text.empty()) // End of paragraph, or maybe an image return wxMax(-1, i - 1); - else if (wxRichTextCtrlIsWhitespace(text) || text.empty()) + else if (wxRichTextCtrlIsWhitespace(text)) i += direction; else { @@ -5407,10 +5407,7 @@ void wxRichTextCaret::DoSize() { m_countVisible = 0; DoHide(); - } - if (countVisible > 0) - { m_countVisible = countVisible; DoShow(); }