diff --git a/eeschema/class_drawsheet.cpp b/eeschema/class_drawsheet.cpp index 45276cc20d..23fd4c61c9 100644 --- a/eeschema/class_drawsheet.cpp +++ b/eeschema/class_drawsheet.cpp @@ -341,6 +341,45 @@ int SCH_SHEET::GetPenSize() } +/** function GetSheetNamePosition + * @return the position of the anchor of sheet name text + */ +wxPoint SCH_SHEET::GetSheetNamePosition() +{ + wxPoint pos = m_Pos; + if( IsVerticalOrientation() ) + { + pos.x -= 8; + pos.y += m_Size.y; + } + else + { + pos.y -= 8; + } + + return pos; +} + +/** function GetFileNamePosition + * @return the position of the anchor of filename text + */ +wxPoint SCH_SHEET::GetFileNamePosition() +{ + wxPoint pos = m_Pos; + if( IsVerticalOrientation() ) + { + pos.x += m_Size.x+4; + pos.y += m_Size.y; + } + else + { + pos.y += m_Size.y + 4; + } + + return pos; +} + + /** Function Draw * Draw the hierarchical sheet shape * @param aPanel = the current DrawPanel @@ -369,18 +408,15 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y, pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color ); + + pos_sheetname = GetSheetNamePosition() + aOffset; + pos_filename = GetFileNamePosition() + aOffset; + if( IsVerticalOrientation() ) - { - pos_sheetname = wxPoint( pos.x-8, pos.y+m_Size.y ); - pos_filename = wxPoint( pos.x+m_Size.x+4, pos.y+m_Size.y ); name_orientation = TEXT_ORIENT_VERT; - } else - { - pos_sheetname = wxPoint( pos.x, pos.y - 8 ); - pos_filename = wxPoint( pos.x, pos.y + m_Size.y + 4 ); name_orientation = TEXT_ORIENT_HORIZ; - } + /* Draw text : SheetName */ if( aColor > 0 ) txtcolor = aColor; @@ -823,12 +859,30 @@ void SCH_SHEET::Resize( const wxSize& aSize ) } -bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData ) +/** Compare schematic sheet entry (filename and sheetname) against search string. + * @param aSearchData - Criteria to search against. + * @param aAuxData - a pointer on auxiliary data, not used here. + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. + * @return True if this item matches the search criteria. + */ +bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ) { - if( !SCH_ITEM::Matches( m_SheetName, aSearchData ) ) - return SCH_ITEM::Matches( m_FileName, aSearchData ); + if( SCH_ITEM::Matches( m_FileName, aSearchData ) ) + { + if( aFindLocation ) + *aFindLocation = GetFileNamePosition(); + return true; + } - return true; + if( SCH_ITEM::Matches( m_SheetName, aSearchData ) ) + { + if( aFindLocation ) + *aFindLocation = GetSheetNamePosition(); + return true; + } + + return false; } diff --git a/eeschema/class_drawsheet.h b/eeschema/class_drawsheet.h index 83c929a079..6354379229 100644 --- a/eeschema/class_drawsheet.h +++ b/eeschema/class_drawsheet.h @@ -158,13 +158,18 @@ public: virtual void Mirror_X( int aXaxis_position ); - /** - * Compare schematic sheet entry (pin?) name against search string. + /** function Matches + * Compare hierarchical pin name against search string. * * @param aSearchData - Criteria to search against. + * @param aAuxData - a pointer on auxiliary data, if needed. + * When searching string in REFERENCE field we must know the sheet path + * This param is used in this case + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if this item matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData ); + virtual bool Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ); }; @@ -425,10 +430,15 @@ public: * Compare schematic sheet file and sheet name against search string. * * @param aSearchData - Criteria to search against. + * @param aAuxData - a pointer on auxiliary data, if needed. + * When searching string in REFERENCE field we must know the sheet path + * This param is used in this case + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * * @return True if this item matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData ); + virtual bool Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ); /** * Resize this sheet to aSize and adjust all of the labels accordingly. @@ -437,6 +447,16 @@ public: */ void Resize( const wxSize& aSize ); + /** function GetSheetNamePosition + * @return the position of the anchor of sheet name text + */ + wxPoint GetSheetNamePosition (); + + /** function GetFileNamePosition + * @return the position of the anchor of filename text + */ + wxPoint GetFileNamePosition (); + #if defined(DEBUG) // comment inherited by Doxygen from Base_Struct diff --git a/eeschema/class_drawsheetpath.cpp b/eeschema/class_drawsheetpath.cpp index 6bf79b4bd6..36d57fa62d 100644 --- a/eeschema/class_drawsheetpath.cpp +++ b/eeschema/class_drawsheetpath.cpp @@ -320,7 +320,8 @@ SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem, SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData, - SCH_ITEM* aLastItem ) + SCH_ITEM* aLastItem, + wxPoint * aFindLocation ) { bool hasWrapped = false; bool firstItemFound = false; @@ -335,7 +336,7 @@ SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData, } else { - if( drawItem->Matches( aSearchData, this ) ) + if( drawItem->Matches( aSearchData, this, aFindLocation ) ) return drawItem; } @@ -618,7 +619,8 @@ SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aShe SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData, SCH_SHEET_PATH** aSheetFoundIn, - SCH_ITEM* aLastItem ) + SCH_ITEM* aLastItem, + wxPoint * aFindLocation ) { bool hasWrapped = false; bool firstItemFound = false; @@ -638,7 +640,7 @@ SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData, } else { - if( drawItem->Matches( aSearchData, sheet ) ) + if( drawItem->Matches( aSearchData, sheet, aFindLocation ) ) { if( aSheetFoundIn ) *aSheetFoundIn = sheet; diff --git a/eeschema/class_drawsheetpath.h b/eeschema/class_drawsheetpath.h index 1feaa2aec7..f32d096fad 100644 --- a/eeschema/class_drawsheetpath.h +++ b/eeschema/class_drawsheetpath.h @@ -202,9 +202,11 @@ public: * * @param aSearchData - Criteria to search item against. * @param aLastItem - Find next item after aLastItem if not NULL. + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return If found, Returns the next schematic item. Otherwise, returns NULL. */ - SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem = NULL ); + SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem, + wxPoint * aFindLocation ); bool operator=( const SCH_SHEET_PATH& d1 ); @@ -338,11 +340,13 @@ public: * @param aSheetFound - The sheet the item was found in. NULL if the next item * is not found. * @param aLastItem - Find next item after aLastItem if not NULL. + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return If found, Returns the next schematic item. Otherwise, returns NULL. */ SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, - SCH_SHEET_PATH** aSheetFound = NULL, - SCH_ITEM* aLastItem = NULL ); + SCH_SHEET_PATH** aSheetFound, + SCH_ITEM* aLastItem, + wxPoint * aFindLocation ); private: diff --git a/eeschema/class_hierarchical_PIN_sheet.cpp b/eeschema/class_hierarchical_PIN_sheet.cpp index dabcf45dc2..af88daa653 100644 --- a/eeschema/class_hierarchical_PIN_sheet.cpp +++ b/eeschema/class_hierarchical_PIN_sheet.cpp @@ -259,9 +259,24 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const } -bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData ) +/** function Matches + * Compare hierarchical pin name against search string. + * @param aSearchData - Criteria to search against. + * @param aAuxData - a pointer on auxiliary data, not used here + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. + * @return True if this item matches the search criteria. + */ +bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ) { - return SCH_ITEM::Matches( m_Text, aSearchData ); + if( SCH_ITEM::Matches( m_Text, aSearchData ) ) + { + if( aFindLocation ) + *aFindLocation = m_Pos; + return true; + } + + return false; } diff --git a/eeschema/class_marker_sch.cpp b/eeschema/class_marker_sch.cpp index f36752feba..c6daaefa6a 100644 --- a/eeschema/class_marker_sch.cpp +++ b/eeschema/class_marker_sch.cpp @@ -115,11 +115,21 @@ void SCH_MARKER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, } -bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData ) +bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ) { if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ) - return 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; } diff --git a/eeschema/class_marker_sch.h b/eeschema/class_marker_sch.h index a91bb1e5a9..0993471985 100644 --- a/eeschema/class_marker_sch.h +++ b/eeschema/class_marker_sch.h @@ -104,9 +104,10 @@ public: * Compare DRC marker main and auxiliary text against search string. * * @param aSearchData - Criteria to search against. + * @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. */ - virtual bool Matches( wxFindReplaceData& aSearchData ); + virtual bool Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ); /** * Show the marker electronics rule check error on the message panel. diff --git a/eeschema/class_sch_cmp_field.cpp b/eeschema/class_sch_cmp_field.cpp index 122f9a5b1a..b98a9a8997 100644 --- a/eeschema/class_sch_cmp_field.cpp +++ b/eeschema/class_sch_cmp_field.cpp @@ -405,10 +405,15 @@ void SCH_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC ) } -bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation ) { + bool match; if( aAuxData && m_FieldId == REFERENCE ) { + // reference is a special field because: + // >> a part identifier is added in multi parts per package + // (the .m_AddExtraText of the field is set in this case ) + // >> In complex hierarchies, the actual reference depend on the sheet path. SCH_COMPONENT* pSch = (SCH_COMPONENT*) m_Parent; SCH_SHEET_PATH* sheet = (SCH_SHEET_PATH*) aAuxData; wxString fulltext = pSch->GetRef( sheet ); @@ -419,10 +424,19 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) int part_id = pSch->GetUnitSelection( sheet ); fulltext << LIB_COMPONENT::ReturnSubReference( part_id ); } - return SCH_ITEM::Matches( fulltext, aSearchData ); + match = SCH_ITEM::Matches( fulltext, aSearchData ); } - return SCH_ITEM::Matches( m_Text, aSearchData ); + else + match = SCH_ITEM::Matches( m_Text, aSearchData ); + if( match ) + { + EDA_Rect BoundaryBox = GetBoundaryBox(); + if( aFindLocation ) + *aFindLocation = GetBoundaryBox().Centre(); + return true; + } + return false; } diff --git a/eeschema/class_sch_cmp_field.h b/eeschema/class_sch_cmp_field.h index 7cb835c506..bccc8ee23f 100644 --- a/eeschema/class_sch_cmp_field.h +++ b/eeschema/class_sch_cmp_field.h @@ -149,9 +149,11 @@ public: * the sheet path is needed for REFERENCE field because m_Text * value is just the valeur displayed, and in complex hierarchies * this is only one of all references (one per sheet path) + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if this field text matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ); + virtual bool Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ); }; diff --git a/eeschema/class_sch_component.cpp b/eeschema/class_sch_component.cpp index 4df8d1407d..8c58be656b 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/class_sch_component.cpp @@ -16,6 +16,7 @@ #include "class_library.h" #include "dialog_schematic_find.h" #include "lib_rectangle.h" +#include "class_pin.h" #include @@ -183,11 +184,9 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int DrawMode, int Color, bool DrawPinText ) { - LIB_COMPONENT* Entry; - int ii; bool dummy = FALSE; - Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); + LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); if( Entry == NULL ) { @@ -218,7 +217,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, } } - for( ii = VALUE; ii < GetFieldCount(); ii++ ) + for( int ii = VALUE; ii < GetFieldCount(); ii++ ) { field = GetField( ii ); @@ -1242,12 +1241,12 @@ void SCH_COMPONENT::Rotate( wxPoint rotationPoint ) } -bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation ) { // Search reference. // reference is a special field because a part identifier is added // in multi parts per package - // the .m_AddExtraText of the field msut be set to add this identifier: + // the .m_AddExtraText of the field must be set to add this identifier: LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); if( Entry && Entry->GetPartCount() > 1 ) @@ -1255,10 +1254,10 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) else GetField( REFERENCE )->m_AddExtraText = false; - if( GetField( REFERENCE )->Matches( aSearchData, aAuxData ) ) + if( GetField( REFERENCE )->Matches( aSearchData, aAuxData, aFindLocation ) ) return true; - if( GetField( VALUE )->Matches( aSearchData, aAuxData ) ) + if( GetField( VALUE )->Matches( aSearchData, aAuxData, aFindLocation ) ) return true; if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS ) ) @@ -1266,9 +1265,41 @@ bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) for( size_t i = VALUE + 1; i < m_Fields.size(); i++ ) { - if( GetField( i )->Matches( aSearchData, aAuxData ) ) + if( GetField( i )->Matches( aSearchData, aAuxData, aFindLocation ) ) return true; } + // Search for a match in pin name or pin number. + // @TODO: see if the Matches method must be made in LIB_PIN. + // when Matches method will be used in Libedit, this is the best + // Currently, Pins are tested here. + if( !( aSearchData.GetFlags() & FR_SEARCH_ALL_PINS ) ) + return false; + + if( Entry ) + { + LIB_PIN_LIST pinList; + Entry->GetPins( pinList, m_Multi, m_Convert ); + // Search for a match in pinList + for( unsigned ii = 0; ii < pinList.size(); ii ++ ) + { + LIB_PIN* pin = pinList[ii]; + wxString pinNum; + pin->ReturnPinStringNum( pinNum ); + if( SCH_ITEM::Matches(pin->m_PinName, aSearchData ) || + SCH_ITEM::Matches(pinNum, aSearchData ) ) + { + if( aFindLocation ) + { + wxPoint pinpos = pin->m_Pos; + pinpos = TransformCoordinate( m_Transform, pinpos ); + *aFindLocation = pinpos + m_Pos; + } + return true; + } + + } + } + return false; } diff --git a/eeschema/class_sch_component.h b/eeschema/class_sch_component.h index 37d5348baa..5dfc659fcc 100644 --- a/eeschema/class_sch_component.h +++ b/eeschema/class_sch_component.h @@ -351,9 +351,11 @@ public: * @param aAuxData - a pointer on auxiliary data, if needed. * When searching string in REFERENCE field we must know the sheet path * This param is used in this case + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if this component reference or value field matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ); + virtual bool Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ); #if defined(DEBUG) diff --git a/eeschema/class_text-label.cpp b/eeschema/class_text-label.cpp index af81cde20f..90f599d9ed 100644 --- a/eeschema/class_text-label.cpp +++ b/eeschema/class_text-label.cpp @@ -181,9 +181,17 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() } -bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData ) +bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation ) { - return SCH_ITEM::Matches( m_Text, aSearchData ); + if( SCH_ITEM::Matches( m_Text, aSearchData ) ) + { + EDA_Rect BoundaryBox = GetBoundingBox(); + if( aFindLocation ) + *aFindLocation = BoundaryBox.Centre(); + return true; + } + + return false; } diff --git a/eeschema/class_text-label.h b/eeschema/class_text-label.h index 93a56b1145..7e4c455826 100644 --- a/eeschema/class_text-label.h +++ b/eeschema/class_text-label.h @@ -164,9 +164,11 @@ public: * * @param aSearchData - Criterial to search against. * @param aAuxData - a pointer on auxiliary data, if needed. Can be null + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if this schematic text item matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ); + virtual bool Matches( wxFindReplaceData& aSearchData, + void* aAuxData, wxPoint * aFindLocation ); #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ); diff --git a/eeschema/dialog_sch_find.fbp b/eeschema/dialog_sch_find.fbp index 06e6376df1..be797093ff 100644 --- a/eeschema/dialog_sch_find.fbp +++ b/eeschema/dialog_sch_find.fbp @@ -1,10 +1,12 @@ - + C++ 1 + source_name + 0 UTF-8 connect dialog_schematic_find_base @@ -16,13 +18,16 @@ . 1 + 1 0 0 wxBOTH + 1 1 + impl_virtual @@ -37,6 +42,10 @@ Find + + wxFILTER_NONE + wxDefaultValidator + @@ -107,6 +116,7 @@ + 1 1 @@ -122,6 +132,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -159,6 +173,7 @@ + 1 1 @@ -173,6 +188,10 @@ wxCB_DROPDOWN + + wxFILTER_NONE + wxDefaultValidator + @@ -212,6 +231,7 @@ + 1 1 @@ -227,6 +247,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -264,6 +288,7 @@ + 1 1 @@ -278,6 +303,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -317,6 +346,7 @@ + 1 1 @@ -332,6 +362,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -377,6 +411,7 @@ + 1 1 @@ -392,6 +427,10 @@ wxRB_GROUP + + wxFILTER_NONE + wxDefaultValidator + 0 @@ -429,6 +468,7 @@ + 1 1 @@ -444,6 +484,10 @@ + + wxFILTER_NONE + wxDefaultValidator + 0 @@ -486,6 +530,7 @@ 0 + 1 1 @@ -501,6 +546,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -538,6 +587,7 @@ 0 + 1 1 @@ -553,6 +603,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -590,6 +644,7 @@ 0 + 1 1 @@ -605,6 +660,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -642,6 +701,7 @@ 1 + 1 1 @@ -657,6 +717,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -688,12 +752,13 @@ 6 - wxBOTTOM|wxLEFT|wxRIGHT + wxALL 0 0 + 1 1 @@ -709,6 +774,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -740,12 +809,70 @@ 6 - wxBOTTOM|wxLEFT|wxRIGHT + wxBOTTOM|wxRIGHT|wxLEFT 0 0 + 1 + 1 + + + 0 + wxID_ANY + Search all pin names and numbers + + + m_checkAllPins + protected + + + + + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6 + wxALL + 0 + + + 0 + + 1 1 @@ -761,6 +888,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -803,11 +934,12 @@ none 6 - wxALL + wxALL|wxEXPAND 0 + 1 1 1 @@ -824,6 +956,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -860,6 +996,7 @@ + 1 0 1 @@ -876,6 +1013,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -912,6 +1053,7 @@ + 1 0 1 @@ -928,6 +1070,10 @@ + + wxFILTER_NONE + wxDefaultValidator + @@ -959,11 +1105,12 @@ 6 - wxBOTTOM|wxLEFT|wxRIGHT + wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND 0 + 1 0 1 @@ -980,6 +1127,10 @@ + + wxFILTER_NONE + wxDefaultValidator + diff --git a/eeschema/dialog_schematic_find.cpp b/eeschema/dialog_schematic_find.cpp index 4260217edc..ec49b9c640 100644 --- a/eeschema/dialog_schematic_find.cpp +++ b/eeschema/dialog_schematic_find.cpp @@ -26,11 +26,12 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, m_checkMatchCase->SetValue( flags & wxFR_MATCHCASE ); m_checkWholeWord->SetValue( flags & wxFR_WHOLEWORD ); - /* Whole work and wild card searches are mutually exclusive. */ + /* Whole word and wild card searches are mutually exclusive. */ if( !( flags & wxFR_WHOLEWORD ) ) m_checkWildcardMatch->SetValue( flags & FR_MATCH_WILDCARD ); m_checkAllFields->SetValue( flags & FR_SEARCH_ALL_FIELDS ); + m_checkAllPins->SetValue( flags & FR_SEARCH_ALL_PINS ); m_checkWrap->SetValue( flags & FR_SEARCH_WRAP ); m_checkCurrentSheetOnly->SetValue( flags & FR_CURRENT_SHEET_ONLY ); @@ -121,6 +122,9 @@ void DIALOG_SCH_FIND::SendEvent( const wxEventType& aEventType ) if( m_checkAllFields->GetValue() ) flags |= FR_SEARCH_ALL_FIELDS; + if( m_checkAllPins->GetValue() ) + flags |= FR_SEARCH_ALL_PINS; + if( m_checkWrap->GetValue() ) flags |= FR_SEARCH_WRAP; diff --git a/eeschema/dialog_schematic_find.h b/eeschema/dialog_schematic_find.h index 4dc9adaf89..23128cf4d5 100644 --- a/eeschema/dialog_schematic_find.h +++ b/eeschema/dialog_schematic_find.h @@ -31,11 +31,14 @@ enum SchematicFindReplaceFlags /* Search all fields in component, not just the value and reference fields. */ FR_SEARCH_ALL_FIELDS = wxFR_MATCHCASE << 2, + /* Search texts (name and number (a 4 letters text) )in pins. */ + FR_SEARCH_ALL_PINS = wxFR_MATCHCASE << 3, + /* Perform search using simple wild card matching (* & ?). */ - FR_MATCH_WILDCARD = wxFR_MATCHCASE << 3, + FR_MATCH_WILDCARD = wxFR_MATCHCASE << 4, /* Wrap around the beginning or end of search list. */ - FR_SEARCH_WRAP = wxFR_MATCHCASE << 4 + FR_SEARCH_WRAP = wxFR_MATCHCASE << 5 }; diff --git a/eeschema/dialog_schematic_find_base.cpp b/eeschema/dialog_schematic_find_base.cpp index 0198709937..27357f0513 100644 --- a/eeschema/dialog_schematic_find_base.cpp +++ b/eeschema/dialog_schematic_find_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Sep 8 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -68,29 +68,26 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con leftSizer->Add( leftGridSizer, 1, wxALL|wxEXPAND, 6 ); m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Match &whole word"), wxDefaultPosition, wxDefaultSize, 0 ); - leftSizer->Add( m_checkWholeWord, 0, wxALL, 6 ); m_checkMatchCase = new wxCheckBox( this, wxID_ANY, _("&Match case"), wxDefaultPosition, wxDefaultSize, 0 ); - leftSizer->Add( m_checkMatchCase, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Search &using simple wildcard matching"), wxDefaultPosition, wxDefaultSize, 0 ); - leftSizer->Add( m_checkWildcardMatch, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); m_checkWrap = new wxCheckBox( this, wxID_ANY, _("Wrap around &end of search list"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkWrap->SetValue(true); - + m_checkWrap->SetValue(true); leftSizer->Add( m_checkWrap, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search all component &fields"), wxDefaultPosition, wxDefaultSize, 0 ); + leftSizer->Add( m_checkAllFields, 0, wxALL, 6 ); - leftSizer->Add( m_checkAllFields, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + m_checkAllPins = new wxCheckBox( this, wxID_ANY, _("Search all pin names and numbers"), wxDefaultPosition, wxDefaultSize, 0 ); + leftSizer->Add( m_checkAllPins, 0, wxBOTTOM|wxRIGHT|wxLEFT, 6 ); m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current sheet on&ly"), wxDefaultPosition, wxDefaultSize, 0 ); - - leftSizer->Add( m_checkCurrentSheetOnly, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + leftSizer->Add( m_checkCurrentSheetOnly, 0, wxALL, 6 ); mainSizer->Add( leftSizer, 1, wxALL|wxEXPAND, 6 ); @@ -99,7 +96,7 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con m_buttonFind = new wxButton( this, wxID_FIND, _("&Find"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonFind->SetDefault(); - rightSizer->Add( m_buttonFind, 0, wxALL, 6 ); + rightSizer->Add( m_buttonFind, 0, wxALL|wxEXPAND, 6 ); m_buttonReplace = new wxButton( this, wxID_ANY, _("&Replace"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonReplace->Hide(); @@ -112,7 +109,7 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con rightSizer->Add( m_buttonReplaceAll, 0, wxALL, 5 ); m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT, 6 ); + rightSizer->Add( m_buttonCancel, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 6 ); mainSizer->Add( rightSizer, 0, wxALL|wxEXPAND, 6 ); @@ -144,4 +141,5 @@ DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE() m_buttonFind->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this ); m_buttonFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this ); m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this ); + } diff --git a/eeschema/dialog_schematic_find_base.h b/eeschema/dialog_schematic_find_base.h index 4aecd44ae7..0d0dd24aa1 100644 --- a/eeschema/dialog_schematic_find_base.h +++ b/eeschema/dialog_schematic_find_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Sep 8 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -46,6 +46,7 @@ class DIALOG_SCH_FIND_BASE : public wxDialog wxCheckBox* m_checkWildcardMatch; wxCheckBox* m_checkWrap; wxCheckBox* m_checkAllFields; + wxCheckBox* m_checkAllPins; wxCheckBox* m_checkCurrentSheetOnly; wxButton* m_buttonFind; wxButton* m_buttonReplace; @@ -53,16 +54,17 @@ class DIALOG_SCH_FIND_BASE : public wxDialog wxButton* m_buttonCancel; // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ){ event.Skip(); } - virtual void OnUpdateDrcUI( wxUpdateUIEvent& event ){ event.Skip(); } - virtual void OnUpdateWholeWordUI( wxUpdateUIEvent& event ){ event.Skip(); } - virtual void OnUpdateWildcardUI( wxUpdateUIEvent& event ){ event.Skip(); } - virtual void OnFind( wxCommandEvent& event ){ event.Skip(); } - virtual void OnUpdateFindUI( wxUpdateUIEvent& event ){ event.Skip(); } - virtual void OnCancel( wxCommandEvent& event ){ event.Skip(); } + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnUpdateDrcUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnUpdateWholeWordUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnUpdateWildcardUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnFind( wxCommandEvent& event ) { event.Skip(); } + virtual void OnUpdateFindUI( wxUpdateUIEvent& event ) { event.Skip(); } + virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); } public: + DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SCH_FIND_BASE(); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 886d744de4..4b4e8dcb5c 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -290,7 +290,11 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( const wxString& component */ void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) { - static SCH_ITEM* lastItem = NULL; + static SCH_ITEM* lastItem = NULL; /* last item found when searching a match + * note: the actual matched item can be a + * part of lastItem (for instance a field in a component + */ + static wxPoint lastItemPosition; // the actual position of the matched sub item SCH_SHEET_LIST schematic; wxString msg; @@ -304,11 +308,11 @@ void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) if( event.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 ) { sheetFoundIn = m_CurrentSheet; - lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem ); + lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem, &lastItemPosition ); } else { - lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem ); + lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem, &lastItemPosition ); } if( lastItem != NULL ) @@ -321,7 +325,8 @@ void WinEDA_SchematicFrame::OnFindSchematicItem( wxFindDialogEvent& event ) m_CurrentSheet->UpdateAllScreenReferences(); } - sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre(); +// sheetFoundIn->LastScreen()->m_Curseur = lastItem->GetBoundingBox().Centre(); + sheetFoundIn->LastScreen()->m_Curseur = lastItemPosition; Recadre_Trace( true ); msg = event.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable(); diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 52270a8ecf..47dfc961ff 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -325,7 +325,7 @@ void FindBestNetNameForEachNet( NETLIST_OBJECT_LIST& aNetItemBuffer ) item = aNetItemBuffer[ii]; if( netcode != item->GetNet() ) // End of net found { - if( candidates.size() ) // O,e or more labels exists, find the best + if( candidates.size() ) // One or more labels exists, find the best { NETLIST_OBJECT* bestlabel = FindBestNetName( candidates ); for (unsigned jj = idxstart; jj < ii; jj++ ) diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index dcf5429972..ce5a933d2a 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -106,9 +106,11 @@ public: * @param aAuxData - a pointer on auxiliary data, if needed (NULL if not used). * When searching string in REFERENCE field we must know the sheet path * This param is used in such cases + * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @return True if this schematic text item matches the search criteria. */ - virtual bool Matches( wxFindReplaceData& aSearchData, void * aAuxData ) + virtual bool Matches( wxFindReplaceData& aSearchData, + void * aAuxData, wxPoint * aFindLocation ) { return false; } /** diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 1039fb7c60..e200d788b2 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -324,6 +324,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, m_auimgr.SetManagedWindow( this ); + // Create a wxAuiPaneInfo template for other wxAuiPaneInfo items + // Actual wxAuiPaneInfo items will be built from this item. wxAuiPaneInfo horiz; horiz.Gripper( false ); horiz.DockFixed( true ); @@ -332,11 +334,16 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, horiz.CloseButton( false ); horiz.CaptionVisible( false ); + // Create a second template from the first: wxAuiPaneInfo vert( horiz ); + // Set specific options for horizontal and vertical toolbars, using horiz and vert + // wxAuiPaneInfo items to manage them. vert.TopDockable( false ).BottomDockable( false ); horiz.LeftDockable( false ).RightDockable( false ); + horiz.ToolbarPane().Gripper( false ); + // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template. // LAYER_WIDGET is floatable, but initially docked at far right wxAuiPaneInfo lyrs; lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget @@ -347,12 +354,16 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, if( m_HToolBar ) + { m_auimgr.AddPane( m_HToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); + } if( m_AuxiliaryToolBar ) + { m_auimgr.AddPane( m_AuxiliaryToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) ); + } if( m_AuxVToolBar ) m_auimgr.AddPane( m_AuxVToolBar, @@ -367,7 +378,8 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, if( m_OptionsToolBar ) { m_auimgr.AddPane( m_OptionsToolBar, - wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); + wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() + .ToolbarPane().Gripper( false )); m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, m_show_layer_manager_tools ); m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); @@ -384,11 +396,11 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, m_auimgr.AddPane( MsgPanel, wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); - m_auimgr.Update(); - SetToolbars(); ReFillLayerWidget(); // this is near end because contents establish size syncLayerWidget(); + m_auimgr.Update(); + } diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 68d318dbc2..69cd7e3bfd 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -288,6 +288,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar() wxBitmap( web_support_xpm ), _( "Fast access to the Web Based FreeROUTE advanced router" ) ); + m_HToolBar->AddSeparator(); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes @@ -391,6 +392,7 @@ void WinEDA_PcbFrame::ReCreateOptToolbar() wxITEM_CHECK ); + m_OptionsToolBar->AddSeparator(); m_OptionsToolBar->Realize(); } @@ -674,6 +676,7 @@ an existing track use its width\notherwise, use current width setting" ), } m_TrackAndViasSizesList_Changed = true; + m_AuxiliaryToolBar->AddSeparator(); ReCreateLayerBox( NULL ); }