Commit 4cdc2c50 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: added pin names in search function. Fixed minor issues in search...

Eeschema: added pin names in search function. Fixed minor issues in search function. Known bug: "search next"  searches for pins in next component, not the next pin in the same component.
Pcbnew: fixed an old minor issue when moving the layer manager window (not fully fixed, but  wxAuiManager seems have minor bugs and lacks).
parents 91e26fe8 347f32cc
......@@ -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;
}
......
......@@ -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
......
......@@ -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;
......
......@@ -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:
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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.
......
......@@ -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;
}
......
......@@ -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 );
};
......
......@@ -16,6 +16,7 @@
#include "class_library.h"
#include "dialog_schematic_find.h"
#include "lib_rectangle.h"
#include "class_pin.h"
#include <wx/tokenzr.h>
......@@ -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;
}
......@@ -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)
......
......@@ -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;
}
......
......@@ -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 );
......
This diff is collapsed.
......@@ -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;
......
......@@ -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
};
......
///////////////////////////////////////////////////////////////////////////
// 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 );
}
///////////////////////////////////////////////////////////////////////////
// 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();
......
......@@ -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();
......
......@@ -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++ )
......
......@@ -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; }
/**
......
......@@ -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();
}
......
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment