From 64dd1f74617a6865150af33f8094ad68dca83a35 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 20 Jan 2015 13:06:44 +0100 Subject: [PATCH] Eeschema: fix a minor bug and enhances SCH_MARHER::Matches function ( partial use of 0005-SCH_MARKER-fix-a-Woverloaded-virtual.patch, from ) and other very minor fix. --- common/base_struct.cpp | 8 ++++---- eeschema/sch_marker.cpp | 22 ++++++++++------------ eeschema/sch_marker.h | 9 ++++++--- include/base_struct.h | 3 ++- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 4db32b92e8..683d404038 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -49,7 +49,7 @@ enum textbox { EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) { - InitVars(); + initVars(); m_StructType = idType; m_Parent = parent; } @@ -57,14 +57,14 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) EDA_ITEM::EDA_ITEM( KICAD_T idType ) { - InitVars(); + initVars(); m_StructType = idType; } EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) { - InitVars(); + initVars(); m_StructType = base.m_StructType; m_Parent = base.m_Parent; m_Flags = base.m_Flags; @@ -75,7 +75,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) } -void EDA_ITEM::InitVars() +void EDA_ITEM::initVars() { m_StructType = TYPE_NOT_INIT; Pnext = NULL; // Linked list: Link (next struct) diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index d4c0422a1e..3057e06e13 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -125,22 +125,20 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, } -bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ) +bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData, + wxPoint * aFindLocation ) { - if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ) + if( SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData ) || + SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) || + SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) ) { - if( SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) ) - { - if( aFindLocation ) - *aFindLocation = m_Pos; - return true; - } - return false; + if( aFindLocation ) + *aFindLocation = m_Pos; + + return true; } - if( aFindLocation ) - *aFindLocation = m_Pos; - return true; + return false; } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 6c94bb79cc..343ff6b290 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -1,8 +1,8 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -89,13 +89,16 @@ public: void Rotate( wxPoint aPosition ); /** + * Function Matches, virtual from the base class EDA_ITEM * Compare DRC marker main and auxiliary text against search string. * * @param aSearchData - Criteria to search against. + * @param aAuxData A pointer to optional data required for the search or NULL + * if not used. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if the DRC main or auxiliary text matches the search criteria. */ - bool Matches( wxFindReplaceData& aSearchData, wxPoint* aFindLocation ); + bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); diff --git a/include/base_struct.h b/include/base_struct.h index 8a5332df56..360e4ff6b1 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -186,7 +186,7 @@ protected: private: - void InitVars(); + void initVars(); public: @@ -428,6 +428,7 @@ public: /** * Function Matches * compares \a aText against search criteria in \a aSearchData. + * Helper function used in search and replace dialog * * @param aText A reference to a wxString object containing the string to test. * @param aSearchData The criteria to search against.