Eeschema: fix a minor bug and enhances SCH_MARHER::Matches function ( partial use of 0005-SCH_MARKER-fix-a-Woverloaded-virtual.patch, from <fatzer2@gmail.com> ) and other very minor fix.

This commit is contained in:
jean-pierre charras 2015-01-20 13:06:44 +01:00
parent 59f497978a
commit 64dd1f7461
4 changed files with 22 additions and 20 deletions

View File

@ -49,7 +49,7 @@ enum textbox {
EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType )
{ {
InitVars(); initVars();
m_StructType = idType; m_StructType = idType;
m_Parent = parent; m_Parent = parent;
} }
@ -57,14 +57,14 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType )
EDA_ITEM::EDA_ITEM( KICAD_T idType ) EDA_ITEM::EDA_ITEM( KICAD_T idType )
{ {
InitVars(); initVars();
m_StructType = idType; m_StructType = idType;
} }
EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
{ {
InitVars(); initVars();
m_StructType = base.m_StructType; m_StructType = base.m_StructType;
m_Parent = base.m_Parent; m_Parent = base.m_Parent;
m_Flags = base.m_Flags; 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; m_StructType = TYPE_NOT_INIT;
Pnext = NULL; // Linked list: Link (next struct) Pnext = NULL; // Linked list: Link (next struct)

View File

@ -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;
if( aFindLocation )
*aFindLocation = m_Pos; return true;
return true;
}
return false;
} }
if( aFindLocation ) return false;
*aFindLocation = m_Pos;
return true;
} }

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * 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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -89,13 +89,16 @@ public:
void Rotate( wxPoint aPosition ); void Rotate( wxPoint aPosition );
/** /**
* Function Matches, virtual from the base class EDA_ITEM
* Compare DRC marker main and auxiliary text against search string. * Compare DRC marker main and auxiliary text against search string.
* *
* @param aSearchData - Criteria to search against. * @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. * @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. * @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 ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );

View File

@ -186,7 +186,7 @@ protected:
private: private:
void InitVars(); void initVars();
public: public:
@ -428,6 +428,7 @@ public:
/** /**
* Function Matches * Function Matches
* compares \a aText against search criteria in \a aSearchData. * 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 aText A reference to a wxString object containing the string to test.
* @param aSearchData The criteria to search against. * @param aSearchData The criteria to search against.