diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index ecb1a7c211..404fe321a1 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -83,14 +83,13 @@ DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aFrame ) : DIALOG_FIND_BASE( aFrame ) m_includeReferences->SetValue( FindIncludeReferences ); m_includeMarkers->SetValue( FindIncludeMarkers ); - m_cancel->Show( false ); - m_gauge->Show( false ); - m_status->Show( true ); - m_gauge->SetRange( 100 ); + m_status->SetLabel( wxEmptyString); m_hitList = new DLIST; m_hitList->SetOwnership( false ); m_itemCount = 0; isUpToDate = false; + + m_findNext->SetDefault(); SetInitialFocus( m_searchCombo ); Center(); @@ -154,6 +153,7 @@ void DIALOG_FIND::search( bool aDirection ) m_frame->GetFindHistoryList().Insert( searchString, 0 ); } + // Update search flags flags = 0; @@ -216,8 +216,8 @@ void DIALOG_FIND::search( bool aDirection ) 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 + // Refresh the list of results if( !isUpToDate ) { m_status->SetLabel( _( "Searching..." ) ); @@ -279,12 +279,9 @@ void DIALOG_FIND::search( bool aDirection ) } } - 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. // Get the item to display @@ -375,7 +372,7 @@ void DIALOG_FIND::search( bool aDirection ) m_highlightCallback( m_foundItem ); } -void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) +void DIALOG_FIND::onClose( wxCommandEvent& aEvent ) { FindOptionCase = m_matchCase->GetValue(); FindOptionWords = m_matchWords->GetValue(); diff --git a/pcbnew/dialogs/dialog_find.h b/pcbnew/dialogs/dialog_find.h index b33ec0efae..a2d3f02aac 100644 --- a/pcbnew/dialogs/dialog_find.h +++ b/pcbnew/dialogs/dialog_find.h @@ -63,7 +63,7 @@ private: void onFindNextClick( wxCommandEvent& event ) override; void onFindPreviousClick( wxCommandEvent& event ) override; void onSearchAgainClick( wxCommandEvent& event ) override; - void onClose( wxCloseEvent& event ) override; + void onClose( wxCommandEvent& event ) override; void search( bool direction ); }; diff --git a/pcbnew/dialogs/dialog_find_base.cpp b/pcbnew/dialogs/dialog_find_base.cpp index 3be588ed2d..14311b5c22 100644 --- a/pcbnew/dialogs/dialog_find_base.cpp +++ b/pcbnew/dialogs/dialog_find_base.cpp @@ -12,31 +12,30 @@ 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 ); - this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); wxBoxSizer* bSizer10; bSizer10 = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bSizer13; - bSizer13 = new wxBoxSizer( wxHORIZONTAL ); + wxBoxSizer* topSizer; + topSizer = new wxBoxSizer( wxHORIZONTAL ); - wxBoxSizer* bSizer131; - bSizer131 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* leftSizer; + leftSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizer8; bSizer8 = new wxBoxSizer( wxHORIZONTAL ); - staticText1 = new wxStaticText( this, wxID_ANY, wxT("Search for :"), wxDefaultPosition, wxDefaultSize, 0 ); - staticText1->Wrap( -1 ); - bSizer8->Add( staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + searchStringLabel = new wxStaticText( this, wxID_ANY, wxT("Search for:"), wxDefaultPosition, wxDefaultSize, 0 ); + searchStringLabel->Wrap( -1 ); + bSizer8->Add( searchStringLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_searchCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxTE_PROCESS_ENTER ); - m_searchCombo->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); + m_searchCombo = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxTE_PROCESS_ENTER ); + m_searchCombo->SetToolTip( wxT("Text with optional wildcards") ); bSizer8->Add( m_searchCombo, 1, wxALL|wxEXPAND, 5 ); - bSizer131->Add( bSizer8, 1, wxEXPAND, 5 ); + leftSizer->Add( bSizer8, 1, wxEXPAND, 5 ); wxBoxSizer* sizerOptions; sizerOptions = new wxBoxSizer( wxHORIZONTAL ); @@ -55,24 +54,24 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr sizerOptions->Add( m_wrap, 0, wxALL, 5 ); - bSizer131->Add( sizerOptions, 1, wxALL|wxEXPAND, 0 ); + leftSizer->Add( sizerOptions, 1, wxALL|wxEXPAND, 0 ); wxBoxSizer* sizerInclude; sizerInclude = new wxBoxSizer( wxVERTICAL ); - m_includeTexts = new wxCheckBox( this, wxID_ANY, wxT("Search for texts"), wxDefaultPosition, wxDefaultSize, 0 ); - m_includeTexts->SetValue(true); - sizerInclude->Add( m_includeTexts, 0, wxALL, 5 ); - - m_includeValues = new wxCheckBox( this, wxID_ANY, wxT("Search for item values"), wxDefaultPosition, wxDefaultSize, 0 ); + m_includeValues = new wxCheckBox( this, wxID_ANY, wxT("Search footprint values"), wxDefaultPosition, wxDefaultSize, 0 ); m_includeValues->SetValue(true); sizerInclude->Add( m_includeValues, 0, wxALL, 5 ); - m_includeReferences = new wxCheckBox( this, wxID_ANY, wxT("Search for item references"), wxDefaultPosition, wxDefaultSize, 0 ); + m_includeReferences = new wxCheckBox( this, wxID_ANY, wxT("Search footprint references"), wxDefaultPosition, wxDefaultSize, 0 ); m_includeReferences->SetValue(true); sizerInclude->Add( m_includeReferences, 0, wxALL, 5 ); - m_includeMarkers = new wxCheckBox( this, wxID_ANY, wxT("Search for DRC markers"), wxDefaultPosition, wxDefaultSize, 0 ); + m_includeTexts = new wxCheckBox( this, wxID_ANY, wxT("Search other text items"), wxDefaultPosition, wxDefaultSize, 0 ); + m_includeTexts->SetValue(true); + sizerInclude->Add( m_includeTexts, 0, wxALL, 5 ); + + m_includeMarkers = new wxCheckBox( this, wxID_ANY, wxT("Search DRC markers"), wxDefaultPosition, wxDefaultSize, 0 ); m_includeMarkers->SetValue(true); sizerInclude->Add( m_includeMarkers, 0, wxALL, 5 ); @@ -83,46 +82,44 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr sizerInclude->Add( m_includeVias, 0, wxALL, 5 ); - bSizer131->Add( sizerInclude, 0, wxEXPAND, 5 ); + leftSizer->Add( sizerInclude, 0, wxEXPAND, 5 ); - bSizer13->Add( bSizer131, 1, wxEXPAND, 5 ); + topSizer->Add( leftSizer, 1, wxEXPAND, 5 ); - wxBoxSizer* sizerButtons; - sizerButtons = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* buttonSizer; + buttonSizer = 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_findNext->SetDefault(); + buttonSizer->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 ); + buttonSizer->Add( m_findPrevious, 0, wxALIGN_LEFT|wxALL|wxEXPAND, 5 ); m_searchAgain = new wxButton( this, wxID_ANY, wxT("Restart Search"), wxDefaultPosition, wxDefaultSize, 0 ); - sizerButtons->Add( m_searchAgain, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 ); + buttonSizer->Add( m_searchAgain, 0, wxALIGN_RIGHT|wxALL|wxEXPAND, 5 ); + + m_closeButton = new wxButton( this, wxID_CANCEL, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + buttonSizer->Add( m_closeButton, 0, wxALL|wxEXPAND, 5 ); - bSizer13->Add( sizerButtons, 0, wxALIGN_RIGHT, 5 ); + topSizer->Add( buttonSizer, 0, wxALIGN_RIGHT, 5 ); - bSizer10->Add( bSizer13, 0, wxEXPAND, 5 ); + bSizer10->Add( topSizer, 0, wxEXPAND, 5 ); + + wxStaticLine* staticline1; + staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bSizer10->Add( staticline1, 0, wxEXPAND | wxALL, 5 ); wxBoxSizer* sizerStatus; sizerStatus = new wxBoxSizer( wxHORIZONTAL ); m_status = new wxStaticText( this, wxID_ANY, wxT("Status"), wxDefaultPosition, wxDefaultSize, 0 ); m_status->Wrap( -1 ); - sizerStatus->Add( m_status, 0, wxALL, 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 ); + sizerStatus->Add( m_status, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bSizer10->Add( sizerStatus, 0, wxEXPAND, 5 ); @@ -130,24 +127,25 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr this->SetSizer( bSizer10 ); this->Layout(); + bSizer10->Fit( this ); this->Centre( wxBOTH ); // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); 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 ); + m_closeButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onClose ), NULL, this ); } DIALOG_FIND_BASE::~DIALOG_FIND_BASE() { // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); 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 ); + m_closeButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onClose ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_find_base.fbp b/pcbnew/dialogs/dialog_find_base.fbp index b0ec26fbfb..0c5a3d2efd 100644 --- a/pcbnew/dialogs/dialog_find_base.fbp +++ b/pcbnew/dialogs/dialog_find_base.fbp @@ -27,10 +27,10 @@ UI 0 0 - + 0 wxAUI_MGR_DEFAULT - wxSYS_COLOUR_WINDOW + wxBOTH 1 @@ -45,16 +45,14 @@ DIALOG_FIND_BASE - 648,305 - wxDEFAULT_FRAME_STYLE + + wxDEFAULT_DIALOG_STYLE DIALOG_SHIM; dialog_shim.h; forward_declare - Find + - wxTAB_TRAVERSAL - 1 - onClose + bSizer10 @@ -66,7 +64,7 @@ 0 - bSizer13 + topSizer wxHORIZONTAL none @@ -75,14 +73,14 @@ 1 - bSizer131 + leftSizer wxVERTICAL none - + 5 wxEXPAND 1 - + bSizer8 wxHORIZONTAL @@ -119,7 +117,7 @@ 0 0 wxID_ANY - Search for : + Search for: 0 0 @@ -128,7 +126,7 @@ 0 1 - staticText1 + searchStringLabel 1 @@ -162,7 +160,7 @@ - wxSYS_COLOUR_WINDOW + 1 0 @@ -199,10 +197,10 @@ -1 1 - wxTE_PROCESS_ENTER + wxCB_DROPDOWN|wxTE_PROCESS_ENTER 0 - + Text with optional wildcards wxFILTER_NONE wxDefaultValidator @@ -216,11 +214,11 @@ - + 0 wxALL|wxEXPAND 1 - + sizerOptions wxHORIZONTAL @@ -483,11 +481,11 @@ - + 5 wxEXPAND 0 - + sizerInclude wxVERTICAL @@ -525,71 +523,7 @@ 0 0 wxID_ANY - Search for texts - - 0 - - - 0 - - 1 - m_includeTexts - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Search for item values + Search footprint values 0 @@ -653,7 +587,7 @@ 0 0 wxID_ANY - Search for item references + Search footprint references 0 @@ -684,11 +618,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -717,7 +651,71 @@ 0 0 wxID_ANY - Search for DRC markers + Search other text items + + 0 + + + 0 + + 1 + m_includeTexts + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Search DRC markers 0 @@ -822,7 +820,7 @@ 0 - sizerButtons + buttonSizer wxVERTICAL none @@ -848,7 +846,7 @@ 1 - 0 + 1 0 Dock @@ -1044,10 +1042,141 @@ onSearchAgainClick + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_CANCEL + Close + + 0 + + 0 + + + 0 + + 1 + m_closeButton + 1 + + + protected + 1 + + + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onClose + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + staticline1 + 1 + + + none + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + ; ; forward_declare + 0 + + + + + + 5 wxEXPAND @@ -1057,11 +1186,11 @@ sizerStatus wxHORIZONTAL none - + 5 - wxALL + wxBOTTOM|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1118,142 +1247,6 @@ -1 - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 1 - - 1 - - - 0 - 1 - wxID_ANY - Cancel - - 0 - - 0 - - - 0 - - 1 - m_cancel - 1 - - - protected - 1 - - - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxALL|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 1 - wxID_ANY - - 0 - - - 0 - - 1 - m_gauge - 1 - - - protected - 1 - - 100 - Resizable - 1 - - wxGA_HORIZONTAL - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 0 - - - - - diff --git a/pcbnew/dialogs/dialog_find_base.h b/pcbnew/dialogs/dialog_find_base.h index 8ec63f7306..8198ed4c32 100644 --- a/pcbnew/dialogs/dialog_find_base.h +++ b/pcbnew/dialogs/dialog_find_base.h @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include /////////////////////////////////////////////////////////////////////////// @@ -37,36 +37,34 @@ class DIALOG_FIND_BASE : public DIALOG_SHIM private: protected: - wxStaticText* staticText1; + wxStaticText* searchStringLabel; wxComboBox* m_searchCombo; wxCheckBox* m_matchCase; wxCheckBox* m_matchWords; wxCheckBox* m_wildcards; wxCheckBox* m_wrap; - wxCheckBox* m_includeTexts; wxCheckBox* m_includeValues; wxCheckBox* m_includeReferences; + wxCheckBox* m_includeTexts; wxCheckBox* m_includeMarkers; wxCheckBox* m_includeVias; wxButton* m_findNext; wxButton* m_findPrevious; wxButton* m_searchAgain; + wxButton* m_closeButton; wxStaticText* 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 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(); } + virtual void onClose( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 648,305 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL ); - + DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); ~DIALOG_FIND_BASE(); }; diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 114c9b11f3..2e8ced459b 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -172,7 +172,7 @@ void DIALOG_FIND::onTextEnter( wxCommandEvent& event ) { } -void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) +void DIALOG_FIND::onClose( wxCommandEvent& aEvent ) { }