pcbnew: search options
-Add a "wrap" option->Search results implemented as a nested list. -Allow to go back with a "Find previous" button -Remove the marker search option -Fix a DLIST issue -Add a result counter ("eg: hit(s): 1/3") -Search history limited to 10 -Fix the search history order -User can include or exclude references/values/texts from results Fixes: lp:1845460 * https://bugs.launchpad.net/kicad/+bug/1845460
This commit is contained in:
parent
102b530162
commit
5d3e6e3d44
|
@ -216,7 +216,7 @@ public:
|
|||
|
||||
//-----< STL like functions >---------------------------------------
|
||||
T* begin() const { return GetFirst(); }
|
||||
T* end() const { return NULL; }
|
||||
T* end() const { return GetLast(); }
|
||||
|
||||
T* PopFront()
|
||||
{
|
||||
|
|
|
@ -23,167 +23,310 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <class_board.h>
|
||||
#include <class_marker_pcb.h>
|
||||
#include <class_module.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <class_text_mod.h>
|
||||
#include <confirm.h>
|
||||
#include <dialog_find.h>
|
||||
#include <fctsys.h>
|
||||
#include <kicad_string.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_marker_pcb.h>
|
||||
#include <class_text_mod.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <dialog_find.h>
|
||||
#include <string>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <wx/fdrepdlg.h>
|
||||
|
||||
//Defined as global because these values have to survive the destructor
|
||||
|
||||
DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aFrame ) :
|
||||
DIALOG_FIND_BASE( aFrame )
|
||||
bool FindOptionCase = false;
|
||||
bool FindOptionWords = false;
|
||||
bool FindOptionWildcards = false;
|
||||
bool FindOptionWrap = true;
|
||||
|
||||
bool FindIncludeTexts = true;
|
||||
bool FindIncludeValues = true;
|
||||
bool FindIncludeReferences = true;
|
||||
//bool findIncludeVias = false;
|
||||
|
||||
DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aFrame ) : DIALOG_FIND_BASE( aFrame )
|
||||
{
|
||||
m_frame = aFrame;
|
||||
m_foundItem = NULL;
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
m_SearchCombo->Append( m_frame->GetFindHistoryList() );
|
||||
m_searchCombo->Append( m_frame->GetFindHistoryList() );
|
||||
|
||||
if( m_SearchCombo->GetCount() )
|
||||
while( m_searchCombo->GetCount() > 10 )
|
||||
{
|
||||
m_SearchCombo->SetSelection( 0 );
|
||||
m_SearchCombo->SelectAll();
|
||||
m_frame->GetFindHistoryList().pop_back();
|
||||
m_searchCombo->Delete( 9 );
|
||||
}
|
||||
|
||||
m_matchCase->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & wxFR_MATCHCASE ) > 0 );
|
||||
m_matchWords->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & wxFR_WHOLEWORD ) > 0 );
|
||||
m_wildcards->SetValue( ( m_frame->GetFindReplaceData().GetFlags() & FR_MATCH_WILDCARD ) > 0 );
|
||||
if( m_searchCombo->GetCount() )
|
||||
{
|
||||
m_searchCombo->SetSelection( 0 );
|
||||
m_searchCombo->SelectAll();
|
||||
}
|
||||
|
||||
m_itemCount = m_markerCount = 0;
|
||||
m_matchCase->SetValue( FindOptionCase );
|
||||
m_matchWords->SetValue( FindOptionWords );
|
||||
m_wildcards->SetValue( FindOptionWildcards );
|
||||
m_wrap->SetValue( FindOptionWrap );
|
||||
|
||||
SetInitialFocus( m_SearchCombo );
|
||||
m_includeTexts->SetValue( FindIncludeTexts );
|
||||
m_includeValues->SetValue( FindIncludeValues );
|
||||
m_includeReferences->SetValue( FindIncludeReferences );
|
||||
|
||||
m_cancel->Show( false );
|
||||
m_gauge->Show( false );
|
||||
m_status->Show( true );
|
||||
m_gauge->SetRange( 100 );
|
||||
m_hitList = new DLIST<BOARD_ITEM>;
|
||||
m_hitList->SetOwnership( false );
|
||||
m_itemCount = 0;
|
||||
isUpToDate = false;
|
||||
SetInitialFocus( m_searchCombo );
|
||||
|
||||
Center();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::OnTextEnter( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onTextEnter( wxCommandEvent& aEvent )
|
||||
{
|
||||
onButtonFindItemClick( aEvent );
|
||||
search( true );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onFindNextClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
Close( true );
|
||||
search( true );
|
||||
}
|
||||
|
||||
void DIALOG_FIND::onFindPreviousClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
search( false );
|
||||
}
|
||||
|
||||
void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onSearchAgainClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
isUpToDate = false;
|
||||
search( true );
|
||||
}
|
||||
|
||||
void DIALOG_FIND::search( bool aDirection )
|
||||
{
|
||||
PCB_SCREEN* screen = m_frame->GetScreen();
|
||||
int flags = 0;
|
||||
int flags;
|
||||
int index;
|
||||
wxString msg;
|
||||
wxString searchString = m_SearchCombo->GetValue();
|
||||
int index = m_SearchCombo->FindString( searchString, true );
|
||||
wxString searchString;
|
||||
|
||||
if( m_matchCase->GetValue() )
|
||||
flags |= wxFR_MATCHCASE;
|
||||
|
||||
if( m_matchWords->GetValue() )
|
||||
flags |= wxFR_WHOLEWORD;
|
||||
|
||||
if( m_wildcards->GetValue() )
|
||||
flags |= FR_MATCH_WILDCARD;
|
||||
// Add/move the search string to the top of the list if it isn't already there
|
||||
searchString = m_searchCombo->GetValue();
|
||||
index = m_searchCombo->FindString( searchString, true );
|
||||
|
||||
if( index == wxNOT_FOUND )
|
||||
{
|
||||
m_SearchCombo->Insert( searchString, 0 );
|
||||
m_searchCombo->Insert( searchString, 0 );
|
||||
m_searchCombo->SetSelection( 0 );
|
||||
isUpToDate = false;
|
||||
m_frame->GetFindHistoryList().Insert( searchString, 0 );
|
||||
if( m_searchCombo->GetCount() > 10 )
|
||||
{
|
||||
m_frame->GetFindHistoryList().pop_back();
|
||||
m_searchCombo->Delete( 10 );
|
||||
}
|
||||
}
|
||||
else if( index != 0 )
|
||||
{
|
||||
/* Move the search string to the top of the list if it isn't already there. */
|
||||
m_SearchCombo->Delete( index );
|
||||
m_SearchCombo->Insert( searchString, 0 );
|
||||
m_SearchCombo->SetSelection( 0 );
|
||||
m_searchCombo->Delete( index );
|
||||
m_searchCombo->Insert( searchString, 0 );
|
||||
m_searchCombo->SetSelection( 0 );
|
||||
isUpToDate = false;
|
||||
|
||||
if( m_frame->GetFindHistoryList().Index( searchString ) )
|
||||
m_frame->GetFindHistoryList().Remove( searchString );
|
||||
m_frame->GetFindHistoryList().Insert( searchString, 0 );
|
||||
}
|
||||
// Update search flags
|
||||
flags = 0;
|
||||
|
||||
wxString last;
|
||||
|
||||
if( !m_frame->GetFindHistoryList().empty() )
|
||||
last = m_frame->GetFindHistoryList().back();
|
||||
|
||||
if( !searchString.IsSameAs( last, false ) )
|
||||
if( FindOptionCase != m_matchCase->GetValue() )
|
||||
{
|
||||
m_itemCount = 0;
|
||||
m_foundItem = NULL;
|
||||
m_frame->GetFindHistoryList().push_back( searchString );
|
||||
FindOptionCase = m_matchCase->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
if( FindOptionWords != m_matchWords->GetValue() )
|
||||
{
|
||||
FindOptionWords = m_matchWords->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
if( FindOptionWildcards != m_wildcards->GetValue() )
|
||||
{
|
||||
FindOptionWildcards = m_wildcards->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
FindOptionWrap = m_wrap->GetValue();
|
||||
if( FindIncludeTexts != m_includeTexts->GetValue() )
|
||||
{
|
||||
FindIncludeTexts = m_includeTexts->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
if( FindIncludeValues != m_includeValues->GetValue() )
|
||||
{
|
||||
FindIncludeValues = m_includeValues->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
if( FindIncludeReferences != m_includeReferences->GetValue() )
|
||||
{
|
||||
FindIncludeReferences = m_includeReferences->GetValue();
|
||||
isUpToDate = false;
|
||||
}
|
||||
if( FindOptionCase )
|
||||
flags |= wxFR_MATCHCASE;
|
||||
|
||||
if( FindOptionWords )
|
||||
flags |= wxFR_WHOLEWORD;
|
||||
|
||||
if( FindOptionWildcards )
|
||||
flags |= FR_MATCH_WILDCARD;
|
||||
|
||||
// Search parameters
|
||||
m_frame->GetFindReplaceData().SetFindString( searchString );
|
||||
m_frame->GetFindReplaceData().SetFlags( flags );
|
||||
|
||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
|
||||
// Refresh the list of results
|
||||
|
||||
int count = 0;
|
||||
|
||||
for( MODULE* module : m_frame->GetBoard()->Modules() )
|
||||
if( !isUpToDate )
|
||||
{
|
||||
if( module->Reference().Matches( m_frame->GetFindReplaceData(), nullptr )
|
||||
|| module->Value().Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
m_status->SetValue( "Searching..." );
|
||||
while( m_hitList->GetCount() > 0 )
|
||||
m_hitList->PopBack();
|
||||
m_foundItem = NULL;
|
||||
|
||||
if( FindIncludeTexts || FindIncludeValues || FindIncludeReferences )
|
||||
{
|
||||
count++;
|
||||
|
||||
if( count > m_itemCount )
|
||||
for( MODULE* module : m_frame->GetBoard()->Modules() )
|
||||
{
|
||||
m_foundItem = module;
|
||||
m_itemCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for( BOARD_ITEM* item : module->GraphicalItems() )
|
||||
{
|
||||
TEXTE_MODULE* textItem = dynamic_cast<TEXTE_MODULE*>( item );
|
||||
|
||||
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
{
|
||||
count++;
|
||||
|
||||
if( count > m_itemCount )
|
||||
if( ( module->Reference().Matches( m_frame->GetFindReplaceData(), nullptr )
|
||||
&& FindIncludeReferences )
|
||||
|| ( module->Value().Matches( m_frame->GetFindReplaceData(), nullptr )
|
||||
&& FindIncludeValues ) )
|
||||
{
|
||||
m_foundItem = module;
|
||||
m_itemCount++;
|
||||
break;
|
||||
m_hitList->Append( module );
|
||||
}
|
||||
|
||||
if( m_includeTexts->GetValue() )
|
||||
{
|
||||
for( BOARD_ITEM* item : module->GraphicalItems() )
|
||||
{
|
||||
TEXTE_MODULE* textItem = dynamic_cast<TEXTE_MODULE*>( item );
|
||||
|
||||
if( textItem
|
||||
&& textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
{
|
||||
m_hitList->Append( module );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( FindIncludeTexts )
|
||||
{
|
||||
for( BOARD_ITEM* item : m_frame->GetBoard()->Drawings() )
|
||||
{
|
||||
TEXTE_PCB* textItem = dynamic_cast<TEXTE_PCB*>( item );
|
||||
|
||||
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
{
|
||||
m_hitList->Append( textItem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_cancel->Show( false );
|
||||
m_gauge->Show( false );
|
||||
m_status->Show( true );
|
||||
m_gauge->SetValue( 100 );
|
||||
m_itemCount = -1;
|
||||
}
|
||||
// Do we want a sorting algorithm ? If so, implement it here.
|
||||
|
||||
for( BOARD_ITEM* item : m_frame->GetBoard()->Drawings() )
|
||||
// Get the item to display
|
||||
if( m_hitList->begin() == NULL )
|
||||
{
|
||||
TEXTE_PCB* textItem = dynamic_cast<TEXTE_PCB*>( item );
|
||||
|
||||
if( textItem && textItem->Matches( m_frame->GetFindReplaceData(), nullptr ) )
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
m_itemCount = 0;
|
||||
m_foundItem = NULL;
|
||||
}
|
||||
else if( m_itemCount == -1 )
|
||||
{
|
||||
m_foundItem = aDirection ? m_hitList->begin() : m_hitList->end();
|
||||
m_itemCount = aDirection ? 0 : m_hitList->GetCount() - 1;
|
||||
isUpToDate = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aDirection )
|
||||
{
|
||||
count++;
|
||||
|
||||
if( count > m_itemCount )
|
||||
if( m_itemCount >= static_cast<int>( m_hitList->GetCount() - 1 ) )
|
||||
{
|
||||
if( m_wrap->GetValue() )
|
||||
{
|
||||
m_itemCount = 0;
|
||||
m_foundItem = m_hitList->begin();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
msg.Printf( _( "No more item to show" ), GetChars( searchString ) );
|
||||
DisplayError( this, msg, 10 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_foundItem = textItem;
|
||||
m_itemCount++;
|
||||
break;
|
||||
m_foundItem = dynamic_cast<BOARD_ITEM*>( m_foundItem->Next() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_itemCount <= 0 )
|
||||
{
|
||||
if( m_wrap->GetValue() )
|
||||
{
|
||||
m_itemCount = m_hitList->GetCount() - 1;
|
||||
m_foundItem = m_hitList->end();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
msg.Printf( _( "No more item to show" ), GetChars( searchString ) );
|
||||
DisplayError( this, msg, 10 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_itemCount--;
|
||||
m_foundItem = dynamic_cast<BOARD_ITEM*>( m_foundItem->Back() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display the item
|
||||
if( m_foundItem )
|
||||
{
|
||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, m_foundItem );
|
||||
m_frame->FocusOnLocation( m_foundItem->GetPosition(), true );
|
||||
msg.Printf( _( "\"%s\" found" ), GetChars( searchString ) );
|
||||
m_frame->SetStatusText( msg );
|
||||
msg = wxEmptyString;
|
||||
msg = msg << "Hit(s): " << m_itemCount + 1 << " / " << m_hitList->GetCount();
|
||||
m_status->SetValue( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -191,64 +334,26 @@ void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
|
|||
msg.Printf( _( "\"%s\" not found" ), GetChars( searchString ) );
|
||||
DisplayError( this, msg, 10 );
|
||||
m_itemCount = 0;
|
||||
m_status->SetValue( "No hit" );
|
||||
}
|
||||
|
||||
if( m_highlightCallback )
|
||||
m_highlightCallback( m_foundItem );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
PCB_SCREEN* screen = m_frame->GetScreen();
|
||||
wxString msg;
|
||||
|
||||
m_foundItem = nullptr;
|
||||
|
||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
m_frame->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y );
|
||||
|
||||
MARKER_PCB* marker = m_frame->GetBoard()->GetMARKER( m_markerCount++ );
|
||||
|
||||
if( marker )
|
||||
m_foundItem = marker;
|
||||
|
||||
if( m_foundItem )
|
||||
{
|
||||
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, m_foundItem );
|
||||
m_frame->FocusOnLocation( m_foundItem->GetPosition() );
|
||||
msg = _( "Marker found" );
|
||||
m_frame->SetStatusText( msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_frame->SetStatusText( wxEmptyString );
|
||||
msg = _( "No marker found" );
|
||||
DisplayError( this, msg, 10 );
|
||||
m_markerCount = 0;
|
||||
}
|
||||
|
||||
if( m_highlightCallback )
|
||||
m_highlightCallback( m_foundItem );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
|
||||
{
|
||||
int flags = 0;
|
||||
FindOptionCase = m_matchCase->GetValue();
|
||||
FindOptionWords = m_matchWords->GetValue();
|
||||
FindOptionWildcards = m_wildcards->GetValue();
|
||||
FindOptionWrap = m_wrap->GetValue();
|
||||
|
||||
if( m_matchCase->GetValue() )
|
||||
flags |= wxFR_MATCHCASE;
|
||||
|
||||
if( m_matchWords->GetValue() )
|
||||
flags |= wxFR_WHOLEWORD;
|
||||
|
||||
if( m_wildcards->GetValue() )
|
||||
flags |= FR_MATCH_WILDCARD;
|
||||
|
||||
m_frame->GetFindReplaceData().SetFlags( flags );
|
||||
FindIncludeTexts = m_includeTexts->GetValue();
|
||||
FindIncludeValues = m_includeValues->GetValue();
|
||||
FindIncludeReferences = m_includeReferences->GetValue();
|
||||
|
||||
while( m_hitList->GetCount() > 0 )
|
||||
m_hitList->PopBack();
|
||||
delete m_hitList;
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,36 +26,45 @@
|
|||
#ifndef DIALOG_FIND_BASE_H
|
||||
#define DIALOG_FIND_BASE_H
|
||||
|
||||
#include <dialog_find_base.h>
|
||||
#include <boost/function.hpp>
|
||||
#include <dialog_find_base.h>
|
||||
#include <dlist.h>
|
||||
#include <iterator>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class DIALOG_FIND : public DIALOG_FIND_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_FIND( PCB_BASE_FRAME* aParent );
|
||||
|
||||
inline BOARD_ITEM* GetItem() const { return m_foundItem; }
|
||||
inline BOARD_ITEM* GetItem() const
|
||||
{
|
||||
return m_foundItem;
|
||||
}
|
||||
|
||||
void SetCallback( boost::function<void (BOARD_ITEM*)> aCallback )
|
||||
void SetCallback( boost::function<void( BOARD_ITEM* )> aCallback )
|
||||
{
|
||||
m_highlightCallback = aCallback;
|
||||
}
|
||||
|
||||
void OnTextEnter( wxCommandEvent& event ) override;
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_frame;
|
||||
PCB_BASE_FRAME* m_frame;
|
||||
int m_itemCount;
|
||||
BOARD_ITEM* m_foundItem;
|
||||
DLIST<BOARD_ITEM>* m_hitList;
|
||||
bool isUpToDate;
|
||||
|
||||
int m_itemCount;
|
||||
int m_markerCount;
|
||||
BOARD_ITEM* m_foundItem;
|
||||
boost::function<void( BOARD_ITEM* )> m_highlightCallback;
|
||||
|
||||
boost::function<void (BOARD_ITEM*)> m_highlightCallback;
|
||||
|
||||
void onButtonFindItemClick( wxCommandEvent& event ) override;
|
||||
void onButtonFindMarkerClick( wxCommandEvent& event ) override;
|
||||
void onButtonCloseClick( wxCommandEvent& event ) override;
|
||||
void onTextEnter( wxCommandEvent& event ) override;
|
||||
void onFindNextClick( wxCommandEvent& event ) override;
|
||||
void onFindPreviousClick( wxCommandEvent& event ) override;
|
||||
void onSearchAgainClick( wxCommandEvent& event ) override;
|
||||
void onClose( wxCloseEvent& event ) override;
|
||||
void search( bool direction );
|
||||
};
|
||||
|
||||
#endif /* DIALOG_FIND_BASE_H */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 22 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -12,78 +12,159 @@
|
|||
DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizerMain;
|
||||
bSizerMain = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerLeft;
|
||||
bSizerLeft = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText1->Wrap( -1 );
|
||||
bSizerLeft->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_SearchCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||
bSizerLeft->Add( m_SearchCombo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_matchCase = new wxCheckBox( this, wxID_ANY, _("Match case"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_matchCase, 0, wxALL, 5 );
|
||||
|
||||
m_matchWords = new wxCheckBox( this, wxID_ANY, _("Words"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_matchWords, 0, wxALL, 5 );
|
||||
|
||||
m_wildcards = new wxCheckBox( this, wxID_ANY, _("Wildcards"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizer4->Add( m_wildcards, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( bSizer4, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerLeft, 1, wxEXPAND|wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerRight;
|
||||
bSizerRight = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_button1->SetDefault();
|
||||
bSizerRight->Add( m_button1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerRight->Add( m_button2, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerRight->Add( m_button3, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( bSizerRight, 0, wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizerMain );
|
||||
this->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) );
|
||||
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVEBORDER ) );
|
||||
|
||||
wxBoxSizer* bSizer10;
|
||||
bSizer10 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer13;
|
||||
bSizer13 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizer131;
|
||||
bSizer131 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
staticText1 = new wxStaticText( this, wxID_ANY, wxT("Search for :"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
staticText1->Wrap( -1 );
|
||||
staticText1->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
bSizer131->Add( staticText1, 0, wxALL, 5 );
|
||||
|
||||
m_searchCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER );
|
||||
m_searchCombo->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
m_searchCombo->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_APPWORKSPACE ) );
|
||||
|
||||
bSizer131->Add( m_searchCombo, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sizerOptions;
|
||||
sizerOptions = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_matchCase = new wxCheckBox( this, wxID_ANY, wxT("Case"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_matchCase->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerOptions->Add( m_matchCase, 0, wxALL, 5 );
|
||||
|
||||
m_matchWords = new wxCheckBox( this, wxID_ANY, wxT("Words"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_matchWords->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerOptions->Add( m_matchWords, 0, wxALL, 5 );
|
||||
|
||||
m_wildcards = new wxCheckBox( this, wxID_ANY, wxT("Wildcards"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_wildcards->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerOptions->Add( m_wildcards, 0, wxALL, 5 );
|
||||
|
||||
m_wrap = new wxCheckBox( this, wxID_ANY, wxT("Wrap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_wrap->SetValue(true);
|
||||
m_wrap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerOptions->Add( m_wrap, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer131->Add( sizerOptions, 1, wxALL|wxEXPAND, 0 );
|
||||
|
||||
staticText2 = new wxStaticText( this, wxID_ANY, wxT("Include :"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
staticText2->Wrap( -1 );
|
||||
staticText2->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
bSizer131->Add( staticText2, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* sizerInclude;
|
||||
sizerInclude = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_includeTexts = new wxCheckBox( this, wxID_ANY, wxT("Texts"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_includeTexts->SetValue(true);
|
||||
m_includeTexts->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerInclude->Add( m_includeTexts, 0, wxALL, 5 );
|
||||
|
||||
m_includeValues = new wxCheckBox( this, wxID_ANY, wxT("Values"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_includeValues->SetValue(true);
|
||||
m_includeValues->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerInclude->Add( m_includeValues, 0, wxALL, 5 );
|
||||
|
||||
m_includeReferences = new wxCheckBox( this, wxID_ANY, wxT("References"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_includeReferences->SetValue(true);
|
||||
m_includeReferences->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
|
||||
sizerInclude->Add( m_includeReferences, 0, wxALL, 5 );
|
||||
|
||||
m_includeVias = new wxCheckBox( this, wxID_ANY, wxT("Vias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_includeVias->SetValue(true);
|
||||
m_includeVias->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
m_includeVias->Hide();
|
||||
|
||||
sizerInclude->Add( m_includeVias, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizer131->Add( sizerInclude, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer13->Add( bSizer131, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sizerButtons;
|
||||
sizerButtons = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_findNext = new wxButton( this, wxID_ANY, wxT("Find Next"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sizerButtons->Add( m_findNext, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_findPrevious = new wxButton( this, wxID_ANY, wxT("Find Previous"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sizerButtons->Add( m_findPrevious, 0, wxALIGN_LEFT|wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_searchAgain = new wxButton( this, wxID_ANY, wxT("Search Again"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sizerButtons->Add( m_searchAgain, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer13->Add( sizerButtons, 0, wxALIGN_RIGHT, 5 );
|
||||
|
||||
|
||||
bSizer10->Add( bSizer13, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* sizerStatus;
|
||||
sizerStatus = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_status = new wxTextCtrl( this, wxID_ANY, wxT("No hit"), wxDefaultPosition, wxDefaultSize, 0|wxBORDER_NONE );
|
||||
m_status->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
|
||||
m_status->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWFRAME ) );
|
||||
|
||||
sizerStatus->Add( m_status, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_cancel = new wxButton( this, wxID_ANY, wxT("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cancel->Hide();
|
||||
|
||||
sizerStatus->Add( m_cancel, 0, wxALL, 5 );
|
||||
|
||||
m_gauge = new wxGauge( this, wxID_ANY, 100, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL );
|
||||
m_gauge->SetValue( 0 );
|
||||
m_gauge->Hide();
|
||||
|
||||
sizerStatus->Add( m_gauge, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizer10->Add( sizerStatus, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer10 );
|
||||
this->Layout();
|
||||
bSizerMain->Fit( this );
|
||||
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FIND_BASE::OnInitDialog ) );
|
||||
m_SearchCombo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::OnTextEnter ), NULL, this );
|
||||
m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
m_searchCombo->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::onTextEnter ), NULL, this );
|
||||
m_findNext->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindNextClick ), NULL, this );
|
||||
m_findPrevious->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindPreviousClick ), NULL, this );
|
||||
m_searchAgain->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onSearchAgainClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_FIND_BASE::~DIALOG_FIND_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) );
|
||||
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_FIND_BASE::OnInitDialog ) );
|
||||
m_SearchCombo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::OnTextEnter ), NULL, this );
|
||||
m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this );
|
||||
m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this );
|
||||
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this );
|
||||
|
||||
m_searchCombo->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_FIND_BASE::onTextEnter ), NULL, this );
|
||||
m_findNext->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindNextClick ), NULL, this );
|
||||
m_findPrevious->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onFindPreviousClick ), NULL, this );
|
||||
m_searchAgain->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onSearchAgainClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +1,14 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Dec 30 2017)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Nov 22 2019)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_FIND_BASE_H__
|
||||
#define __DIALOG_FIND_BASE_H__
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
|
@ -22,7 +20,12 @@
|
|||
#include <wx/checkbox.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/dialog.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/gauge.h>
|
||||
#include <wx/frame.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -33,31 +36,39 @@
|
|||
class DIALOG_FIND_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticText1;
|
||||
wxComboBox* m_SearchCombo;
|
||||
wxStaticText* staticText1;
|
||||
wxComboBox* m_searchCombo;
|
||||
wxCheckBox* m_matchCase;
|
||||
wxCheckBox* m_matchWords;
|
||||
wxCheckBox* m_wildcards;
|
||||
wxButton* m_button1;
|
||||
wxButton* m_button2;
|
||||
wxButton* m_button3;
|
||||
|
||||
wxCheckBox* m_wrap;
|
||||
wxStaticText* staticText2;
|
||||
wxCheckBox* m_includeTexts;
|
||||
wxCheckBox* m_includeValues;
|
||||
wxCheckBox* m_includeReferences;
|
||||
wxCheckBox* m_includeVias;
|
||||
wxButton* m_findNext;
|
||||
wxButton* m_findPrevious;
|
||||
wxButton* m_searchAgain;
|
||||
wxTextCtrl* m_status;
|
||||
wxButton* m_cancel;
|
||||
wxGauge* m_gauge;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||
virtual void OnTextEnter( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
virtual void onTextEnter( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onFindNextClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onFindPreviousClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onSearchAgainClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 504,213 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
|
||||
|
||||
~DIALOG_FIND_BASE();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_FIND_BASE_H__
|
||||
|
|
|
@ -150,31 +150,28 @@ DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent
|
|||
{
|
||||
// these members are initialized to avoid warnings about non initialized vars
|
||||
m_frame = aParent;
|
||||
m_itemCount = m_markerCount = 0;
|
||||
m_itemCount = 0;
|
||||
m_foundItem = nullptr;
|
||||
m_hitList = nullptr;
|
||||
isUpToDate = false;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::OnTextEnter( wxCommandEvent& event )
|
||||
void DIALOG_FIND::onFindNextClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onFindPreviousClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onSearchAgainClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent )
|
||||
void DIALOG_FIND::onTextEnter( wxCommandEvent& event )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_FIND::onClose( wxCloseEvent& aEvent )
|
||||
{
|
||||
}
|
||||
|
@ -188,11 +185,13 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent,
|
|||
long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
// these members are initialized only to avoid warnings about non initialized vars
|
||||
/*
|
||||
m_staticText1 = nullptr;
|
||||
m_SearchCombo = nullptr;
|
||||
m_button1 = nullptr;
|
||||
m_button2 = nullptr;
|
||||
m_button3 = nullptr;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue