Browse Source

ADDED: Find/Replace for symbol editor.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21397
pull/18/head
Jeff Young 2 months ago
parent
commit
0b90d941d3
  1. 4
      eeschema/CMakeLists.txt
  2. 76
      eeschema/dialogs/dialog_sch_find.cpp
  3. 10
      eeschema/dialogs/dialog_sch_find.h
  4. 48
      eeschema/dialogs/dialog_sch_find_base.cpp
  5. 14
      eeschema/dialogs/dialog_sch_find_base.fbp
  6. 12
      eeschema/dialogs/dialog_sch_find_base.h
  7. 114
      eeschema/sch_base_frame.cpp
  8. 27
      eeschema/sch_base_frame.h
  9. 1
      eeschema/sch_collectors.h
  10. 120
      eeschema/sch_edit_frame.cpp
  11. 16
      eeschema/sch_edit_frame.h
  12. 16
      eeschema/sch_pin.cpp
  13. 211
      eeschema/symbol_diff_frame.cpp
  14. 97
      eeschema/symbol_diff_frame.h
  15. 4
      eeschema/symbol_editor/menubar_symbol_editor.cpp
  16. 8
      eeschema/symbol_editor/symbol_edit_frame.cpp
  17. 4
      eeschema/symbol_editor/toolbars_symbol_editor.cpp
  18. 7
      eeschema/symbol_viewer_frame.cpp
  19. 171
      eeschema/tools/sch_find_replace_tool.cpp
  20. 20
      eeschema/tools/sch_find_replace_tool.h

4
eeschema/CMakeLists.txt

@ -139,8 +139,8 @@ set( EESCHEMA_DLGS
dialogs/dialog_rescue_each_base.cpp
dialogs/dialog_sch_import_settings.cpp
dialogs/dialog_sch_import_settings_base.cpp
dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_sch_find.cpp
dialogs/dialog_sch_find_base.cpp
dialogs/dialog_schematic_setup.cpp
dialogs/dialog_shape_properties.cpp
dialogs/dialog_shape_properties_base.cpp

76
eeschema/dialogs/dialog_schematic_find.cpp → eeschema/dialogs/dialog_sch_find.cpp

@ -22,20 +22,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <dialog_schematic_find.h>
#include <dialog_sch_find.h>
#include <tool/actions.h>
#include <sch_edit_frame.h>
#include <tools/sch_find_replace_tool.h>
DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aData,
DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_BASE_FRAME* aParent, SCH_SEARCH_DATA* aData,
const wxPoint& aPosition, const wxSize& aSize, int aStyle ) :
DIALOG_SCH_FIND_BASE( aParent, wxID_ANY, _( "Find" ), aPosition, aSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | aStyle ),
m_frame( aParent ),
m_findReplaceTool( m_frame->GetToolManager()->GetTool<SCH_FIND_REPLACE_TOOL>() ),
m_findReplaceData( aData ),
m_findDirty( true )
DIALOG_SCH_FIND_BASE( aParent, wxID_ANY, _( "Find" ), aPosition, aSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | aStyle ),
m_frame( aParent ),
m_findReplaceTool( m_frame->GetToolManager()->GetTool<SCH_FIND_REPLACE_TOOL>() ),
m_findReplaceData( aData ),
m_findDirty( true )
{
wxASSERT_MSG( m_findReplaceData, wxT( "can't create find dialog without data" ) );
@ -46,22 +46,35 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aDat
m_buttonReplaceAll->Show( true );
m_staticReplace->Show( true );
m_comboReplace->Show( true );
m_checkSelectedOnly->Show( true );
m_checkReplaceReferences->Show( true );
m_cbSelectedOnly->Show( true );
m_cbReplaceReferences->Show( true );
m_checkRegexMatch->Show( true );
}
if( m_frame->GetFrameType() == FRAME_SCH_SYMBOL_EDITOR )
{
m_findReplaceData->searchAllPins = true;
m_cbCurrentSheetOnly->Hide();
m_cbSearchPins->Hide();
m_cbSearchNetNames->Hide();
m_cbReplaceReferences->Hide();
m_staticline1->Hide();
m_searchPanelLink->Hide();
}
m_checkMatchCase->SetValue( m_findReplaceData->matchCase );
m_checkWholeWord->SetValue( m_findReplaceData->matchMode == EDA_SEARCH_MATCH_MODE::WHOLEWORD );
m_checkRegexMatch->SetValue( m_findReplaceData->matchMode == EDA_SEARCH_MATCH_MODE::REGEX );
m_checkAllFields->SetValue( m_findReplaceData->searchAllFields );
m_checkReplaceReferences->SetValue( m_findReplaceData->replaceReferences );
m_checkAllPins->SetValue( m_findReplaceData->searchAllPins );
m_checkCurrentSheetOnly->SetValue( m_findReplaceData->searchCurrentSheetOnly );
m_checkCurrentSheetOnly->Enable( !m_findReplaceData->searchSelectedOnly );
m_checkSelectedOnly->SetValue( m_findReplaceData->searchSelectedOnly );
m_checkConnections->SetValue( m_findReplaceData->searchNetNames );
m_cbSearchHiddenFields->SetValue( m_findReplaceData->searchAllFields );
m_cbReplaceReferences->SetValue( m_findReplaceData->replaceReferences );
m_cbSearchPins->SetValue( m_findReplaceData->searchAllPins );
m_cbCurrentSheetOnly->SetValue( m_findReplaceData->searchCurrentSheetOnly );
m_cbCurrentSheetOnly->Enable( !m_findReplaceData->searchSelectedOnly );
m_cbSelectedOnly->SetValue( m_findReplaceData->searchSelectedOnly );
m_cbSearchNetNames->SetValue( m_findReplaceData->searchNetNames );
if( int hotkey = ACTIONS::showSearch.GetHotKey() )
{
@ -92,14 +105,9 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aDat
}
DIALOG_SCH_FIND::~DIALOG_SCH_FIND()
{
}
void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
{
// Notify the SCH_EDIT_FRAME
// Notify the SCH_BASE_FRAME
m_frame->OnFindDialogClose();
}
@ -123,7 +131,9 @@ void DIALOG_SCH_FIND::OnCancel( wxCommandEvent& aEvent )
void DIALOG_SCH_FIND::onShowSearchPanel( wxHyperlinkEvent& event )
{
if( m_frame->IsSearchPaneShown() )
wxCHECK2( m_frame->GetFrameType() == FRAME_SCH, /* void */ );
if( static_cast<SCH_EDIT_FRAME*>( m_frame )->IsSearchPaneShown() )
{
EndModal( wxID_CANCEL );
@ -221,11 +231,11 @@ void DIALOG_SCH_FIND::updateFlags()
{
// Rebuild the search flags in m_findReplaceData from dialog settings
m_findReplaceData->matchCase = m_checkMatchCase->GetValue();
m_findReplaceData->searchAllFields = m_checkAllFields->GetValue();
m_findReplaceData->searchAllPins = m_checkAllPins->GetValue();
m_findReplaceData->searchCurrentSheetOnly = m_checkCurrentSheetOnly->GetValue();
m_findReplaceData->replaceReferences = m_checkReplaceReferences->GetValue();
m_findReplaceData->searchNetNames = m_checkConnections->GetValue();
m_findReplaceData->searchAllFields = m_cbSearchHiddenFields->GetValue();
m_findReplaceData->searchAllPins = m_cbSearchPins->GetValue();
m_findReplaceData->searchCurrentSheetOnly = m_cbCurrentSheetOnly->GetValue();
m_findReplaceData->replaceReferences = m_cbReplaceReferences->GetValue();
m_findReplaceData->searchNetNames = m_cbSearchNetNames->GetValue();
if( m_checkWholeWord->GetValue() )
m_findReplaceData->matchMode = EDA_SEARCH_MATCH_MODE::WHOLEWORD;
@ -234,15 +244,15 @@ void DIALOG_SCH_FIND::updateFlags()
else
m_findReplaceData->matchMode = EDA_SEARCH_MATCH_MODE::PLAIN;
if( m_checkSelectedOnly->GetValue() )
if( m_cbSelectedOnly->GetValue() )
{
m_checkCurrentSheetOnly->SetValue( true );
m_checkCurrentSheetOnly->Enable( false );
m_cbCurrentSheetOnly->SetValue( true );
m_cbCurrentSheetOnly->Enable( false );
m_findReplaceData->searchSelectedOnly = true;
}
else
{
m_checkCurrentSheetOnly->Enable( true );
m_cbCurrentSheetOnly->Enable( true );
m_findReplaceData->searchSelectedOnly = false;
}
}

10
eeschema/dialogs/dialog_schematic_find.h → eeschema/dialogs/dialog_sch_find.h

@ -25,11 +25,11 @@
#ifndef DIALOG_SCH_FIND_H
#define DIALOG_SCH_FIND_H
#include "dialog_schematic_find_base.h"
#include "dialog_sch_find_base.h"
#include <wx/fdrepdlg.h> // Use the wxFindReplaceDialog events, data, and enums.
class SCH_EDIT_FRAME;
class SCH_BASE_FRAME;
class SCH_FIND_REPLACE_TOOL;
struct SCH_SEARCH_DATA;
@ -37,10 +37,10 @@ struct SCH_SEARCH_DATA;
class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE
{
public:
DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, SCH_SEARCH_DATA* aData,
DIALOG_SCH_FIND( SCH_BASE_FRAME* aParent, SCH_SEARCH_DATA* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
~DIALOG_SCH_FIND();
~DIALOG_SCH_FIND() override = default;
void SetFindEntries( const wxArrayString& aEntries, const wxString& aFindString );
wxArrayString GetFindEntries() const;
@ -70,7 +70,7 @@ protected:
void updateFlags();
protected:
SCH_EDIT_FRAME* m_frame;
SCH_BASE_FRAME* m_frame;
SCH_FIND_REPLACE_TOOL* m_findReplaceTool;
SCH_SEARCH_DATA* m_findReplaceData;
bool m_findDirty;

48
eeschema/dialogs/dialog_schematic_find_base.cpp → eeschema/dialogs/dialog_sch_find_base.cpp

@ -5,7 +5,7 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_schematic_find_base.h"
#include "dialog_sch_find_base.h"
///////////////////////////////////////////////////////////////////////////
@ -90,25 +90,25 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
m_checkRegexMatch = new wxCheckBox( this, wxID_ANY, _("Regular Expression"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkRegexMatch, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkAllPins = new wxCheckBox( this, wxID_ANY, _("Search pin &names and numbers"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkAllPins, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbSearchPins = new wxCheckBox( this, wxID_ANY, _("Search pin &names and numbers"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_cbSearchPins, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Include &hidden fields"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkAllFields, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbSearchHiddenFields = new wxCheckBox( this, wxID_ANY, _("Include &hidden fields"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_cbSearchHiddenFields, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current &sheet only"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkCurrentSheetOnly, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current &sheet only"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_cbCurrentSheetOnly, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkSelectedOnly = new wxCheckBox( this, wxID_ANY, _("Search the current selection &only"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkSelectedOnly, wxGBPosition( 5, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cbSelectedOnly = new wxCheckBox( this, wxID_ANY, _("Search the current selection &only"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_cbSelectedOnly, wxGBPosition( 5, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkReplaceReferences = new wxCheckBox( this, wxID_ANY, _("Replace matches in reference designators"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkReplaceReferences->Hide();
m_cbReplaceReferences = new wxCheckBox( this, wxID_ANY, _("Replace matches in reference designators"), wxDefaultPosition, wxDefaultSize, 0 );
m_cbReplaceReferences->Hide();
gbSizer2->Add( m_checkReplaceReferences, wxGBPosition( 6, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer2->Add( m_cbReplaceReferences, wxGBPosition( 6, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkConnections = new wxCheckBox( this, wxID_ANY, _("Search &net names"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkConnections, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_cbSearchNetNames = new wxCheckBox( this, wxID_ANY, _("Search &net names"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_cbSearchNetNames, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxLEFT|wxRIGHT, 5 );
leftSizer->Add( gbSizer2, 1, wxEXPAND|wxTOP, 5 );
@ -176,11 +176,11 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
m_checkMatchCase->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkWholeWord->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkRegexMatch->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkAllPins->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkAllFields->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkCurrentSheetOnly->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkSelectedOnly->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkConnections->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchPins->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchHiddenFields->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbCurrentSheetOnly->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSelectedOnly->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchNetNames->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_buttonFind->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonReplace->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplace->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceUI ), NULL, this );
@ -206,11 +206,11 @@ DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
m_checkMatchCase->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkWholeWord->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkRegexMatch->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkAllPins->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkAllFields->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkCurrentSheetOnly->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkSelectedOnly->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_checkConnections->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchPins->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchHiddenFields->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbCurrentSheetOnly->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSelectedOnly->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_cbSearchNetNames->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnOptions ), NULL, this );
m_buttonFind->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonReplace->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplace->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceUI ), NULL, this );

14
eeschema/dialogs/dialog_schematic_find_base.fbp → eeschema/dialogs/dialog_sch_find_base.fbp

@ -13,7 +13,7 @@
<property name="cpp_use_enum">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="file">dialog_schematic_find_base</property>
<property name="file">dialog_sch_find_base</property>
<property name="first_id">1000</property>
<property name="internationalize">1</property>
<property name="lua_skip_events">1</property>
@ -836,7 +836,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkAllPins</property>
<property name="name">m_cbSearchPins</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -905,7 +905,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkAllFields</property>
<property name="name">m_cbSearchHiddenFields</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -974,7 +974,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkCurrentSheetOnly</property>
<property name="name">m_cbCurrentSheetOnly</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1043,7 +1043,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkSelectedOnly</property>
<property name="name">m_cbSelectedOnly</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1112,7 +1112,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_checkReplaceReferences</property>
<property name="name">m_cbReplaceReferences</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1180,7 +1180,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkConnections</property>
<property name="name">m_cbSearchNetNames</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

12
eeschema/dialogs/dialog_schematic_find_base.h → eeschema/dialogs/dialog_sch_find_base.h

@ -50,12 +50,12 @@ class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
wxCheckBox* m_checkMatchCase;
wxCheckBox* m_checkWholeWord;
wxCheckBox* m_checkRegexMatch;
wxCheckBox* m_checkAllPins;
wxCheckBox* m_checkAllFields;
wxCheckBox* m_checkCurrentSheetOnly;
wxCheckBox* m_checkSelectedOnly;
wxCheckBox* m_checkReplaceReferences;
wxCheckBox* m_checkConnections;
wxCheckBox* m_cbSearchPins;
wxCheckBox* m_cbSearchHiddenFields;
wxCheckBox* m_cbCurrentSheetOnly;
wxCheckBox* m_cbSelectedOnly;
wxCheckBox* m_cbReplaceReferences;
wxCheckBox* m_cbSearchNetNames;
wxButton* m_buttonFind;
wxButton* m_buttonReplace;
wxButton* m_buttonReplaceAll;

114
eeschema/sch_base_frame.cpp

@ -46,8 +46,10 @@
#include <symbol_library.h>
#include <symbol_lib_table.h>
#include <sch_base_frame.h>
#include <dialogs/dialog_sch_find.h>
#include <design_block.h>
#include <design_block_lib_table.h>
#include <tool/actions.h>
#include <tool/action_toolbar.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -59,6 +61,7 @@
#include <wx/msgdlg.h>
#include <navlib/nl_schematic_plugin.h>
#include <wx/fdrepdlg.h>
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
@ -101,10 +104,13 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
aFrameName, schIUScale ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
m_selectionFilterPanel( nullptr ),
m_findReplaceDialog( nullptr ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
m_inSymChangeTimerEvent( false )
{
m_findReplaceData = std::make_unique<SCH_SEARCH_DATA>();
if( ( aStyle & wxFRAME_NO_TASKBAR ) == 0 )
createCanvas();
@ -131,6 +137,29 @@ SCH_BASE_FRAME::~SCH_BASE_FRAME()
{}
void SCH_BASE_FRAME::doCloseWindow()
{
GetCanvas()->SetEvtHandlerEnabled( false );
GetCanvas()->StopDrawing();
// Shutdown all running tools
if( m_toolManager )
m_toolManager->ShutdownAllTools();
// Close the find dialog and preserve its setting if it is displayed.
if( m_findReplaceDialog )
{
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr;
}
// This class is pure virtual. Derived class will finish shutdown and Destroy().
}
SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
{
return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen();
@ -496,6 +525,89 @@ COLOR4D SCH_BASE_FRAME::GetLayerColor( SCH_LAYER_ID aLayer )
}
void SCH_BASE_FRAME::ShowFindReplaceDialog( bool aReplace )
{
wxString findString;
SCH_SELECTION& selection = m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
{
EDA_ITEM* front = selection.Front();
switch( front->Type() )
{
case SCH_SYMBOL_T:
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( front );
findString = UnescapeString( symbol->GetField( FIELD_T::VALUE )->GetText() );
break;
}
case SCH_FIELD_T:
findString = UnescapeString( static_cast<SCH_FIELD*>( front )->GetText() );
break;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T:
findString = UnescapeString( static_cast<SCH_LABEL_BASE*>( front )->GetText() );
break;
case SCH_TEXT_T:
findString = UnescapeString( static_cast<SCH_TEXT*>( front )->GetText() );
if( findString.Contains( wxT( "\n" ) ) )
findString = findString.Before( '\n' );
break;
default:
break;
}
}
if( m_findReplaceDialog )
m_findReplaceDialog->Destroy();
m_findReplaceDialog = new DIALOG_SCH_FIND( this, static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ),
wxDefaultPosition, wxDefaultSize, aReplace ? wxFR_REPLACEDIALOG : 0 );
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
m_findReplaceDialog->Show( true );
}
void SCH_BASE_FRAME::ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime )
{
// Prepare the infobar, since we don't know its state
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_infoBar->ShowMessageFor( aMsg, aStatusTime, wxICON_INFORMATION );
}
void SCH_BASE_FRAME::ClearFindReplaceStatus()
{
m_infoBar->Dismiss();
}
void SCH_BASE_FRAME::OnFindDialogClose()
{
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr;
m_toolManager->RunAction( ACTIONS::updateFind );
}
void SCH_BASE_FRAME::CommonSettingsChanged( int aFlags )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aFlags );

27
eeschema/sch_base_frame.h

@ -57,6 +57,7 @@ class EESCHEMA_SETTINGS;
class SYMBOL_EDITOR_SETTINGS;
class NL_SCHEMATIC_PLUGIN;
class PANEL_SCH_SELECTION_FILTER;
class DIALOG_SCH_FIND;
#ifdef wxHAS_INOTIFY
#define wxFileSystemWatcher wxInotifyFileSystemWatcher
@ -230,6 +231,21 @@ public:
*/
void SyncView();
/**
* Run the Find or Find & Replace dialog.
*/
void ShowFindReplaceDialog( bool aReplace );
DIALOG_SCH_FIND* GetFindReplaceDialog() const { return m_findReplaceDialog; }
void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
void ClearFindReplaceStatus();
/**
* Notification that the Find dialog has closed.
*/
void OnFindDialogClose();
void CommonSettingsChanged( int aFlags ) override;
/**
@ -272,6 +288,8 @@ protected:
void handleIconizeEvent( wxIconizeEvent& aEvent ) override;
void doCloseWindow() override;
/**
* Save Symbol Library Tables to disk.
*
@ -293,11 +311,12 @@ protected:
*/
virtual void updateSelectionFilterVisbility() {}
/// These are only used by symbol_editor. Eeschema should be using the one inside
/// the SCHEMATIC.
SCHEMATIC_SETTINGS m_base_frame_defaults;
protected:
PANEL_SCH_SELECTION_FILTER* m_selectionFilterPanel;
DIALOG_SCH_FIND* m_findReplaceDialog;
/// Only used by symbol_editor. Eeschema should be using the one inside the SCHEMATIC.
SCHEMATIC_SETTINGS m_base_frame_defaults;
private:

1
eeschema/sch_collectors.h

@ -28,7 +28,6 @@
#include <lib_symbol.h>
#include <collector.h>
#include <dialogs/dialog_schematic_find.h>
#include <sch_item.h>

120
eeschema/sch_edit_frame.cpp

@ -31,7 +31,6 @@
#include <confirm.h>
#include <connection_graph.h>
#include <dialogs/dialog_erc.h>
#include <dialogs/dialog_schematic_find.h>
#include <dialogs/dialog_book_reporter.h>
#include <dialogs/dialog_symbol_fields_table.h>
#include <widgets/sch_design_block_pane.h>
@ -41,7 +40,6 @@
#include <geometry/shape_segment.h>
#include <gestfich.h>
#include <dialogs/html_message_box.h>
#include <invoke_sch_dialog.h>
#include <string_utils.h>
#include <kiface_base.h>
#include <kiplatform/app.h>
@ -159,10 +157,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_aboutTitle = _HKI( "KiCad Schematic Editor" );
m_show_search = false;
m_findReplaceDialog = nullptr;
m_findReplaceData = std::make_unique<SCH_SEARCH_DATA>();
// Give an icon
wxIcon icon;
wxIconBundle icon_bundle;
@ -1062,8 +1056,7 @@ bool SCH_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
void SCH_EDIT_FRAME::doCloseWindow()
{
GetCanvas()->SetEvtHandlerEnabled( false );
GetCanvas()->StopDrawing();
SCH_BASE_FRAME::doCloseWindow();
SCH_SHEET_LIST sheetlist = Schematic().Hierarchy();
@ -1072,10 +1065,6 @@ void SCH_EDIT_FRAME::doCloseWindow()
wxTheApp->Unbind( EDA_EVT_PLUGIN_AVAILABILITY_CHANGED, &SCH_EDIT_FRAME::onPluginAvailabilityChanged, this );
#endif
// Shutdown all running tools
if( m_toolManager )
m_toolManager->ShutdownAllTools();
// Close modeless dialogs. They're trouble when they get destroyed after the frame.
Unbind( EDA_EVT_CLOSE_DIALOG_BOOK_REPORTER, &SCH_EDIT_FRAME::onCloseSymbolDiffDialog, this );
Unbind( EDA_EVT_CLOSE_ERC_DIALOG, &SCH_EDIT_FRAME::onCloseErcDialog, this );
@ -1083,16 +1072,6 @@ void SCH_EDIT_FRAME::doCloseWindow()
m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGING, &SCH_EDIT_FRAME::onNetNavigatorSelChanging, this );
m_netNavigator->Unbind( wxEVT_TREE_SEL_CHANGED, &SCH_EDIT_FRAME::onNetNavigatorSelection, this );
// Close the find dialog and preserve its setting if it is displayed.
if( m_findReplaceDialog )
{
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr;
}
if( m_diffSymbolDialog )
{
m_diffSymbolDialog->Destroy();
@ -1115,16 +1094,8 @@ void SCH_EDIT_FRAME::doCloseWindow()
if( Prj().GetLocalSettings().ShouldAutoSave() )
SaveProjectLocalSettings();
// Shutdown all running tools
if( m_toolManager )
{
m_toolManager->ShutdownAllTools();
// prevent the canvas from trying to dispatch events during close
GetCanvas()->SetEventDispatcher( nullptr );
delete m_toolManager;
m_toolManager = nullptr;
}
delete m_toolManager;
m_toolManager = nullptr;
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
@ -1274,91 +1245,6 @@ void SCH_EDIT_FRAME::UpdateHierarchySelection()
}
void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
{
wxString findString;
SCH_SELECTION& selection = m_toolManager->GetTool<SCH_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
{
EDA_ITEM* front = selection.Front();
switch( front->Type() )
{
case SCH_SYMBOL_T:
{
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( front );
findString = UnescapeString( symbol->GetField( FIELD_T::VALUE )->GetText() );
break;
}
case SCH_FIELD_T:
findString = UnescapeString( static_cast<SCH_FIELD*>( front )->GetText() );
break;
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
case SCH_SHEET_PIN_T:
findString = UnescapeString( static_cast<SCH_LABEL_BASE*>( front )->GetText() );
break;
case SCH_TEXT_T:
findString = UnescapeString( static_cast<SCH_TEXT*>( front )->GetText() );
if( findString.Contains( wxT( "\n" ) ) )
findString = findString.Before( '\n' );
break;
default:
break;
}
}
if( m_findReplaceDialog )
m_findReplaceDialog->Destroy();
m_findReplaceDialog = new DIALOG_SCH_FIND( this,
static_cast<SCH_SEARCH_DATA*>( m_findReplaceData.get() ),
wxDefaultPosition, wxDefaultSize,
aReplace ? wxFR_REPLACEDIALOG : 0 );
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList, findString );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
m_findReplaceDialog->Show( true );
}
void SCH_EDIT_FRAME::ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime )
{
// Prepare the infobar, since we don't know its state
m_infoBar->RemoveAllButtons();
m_infoBar->AddCloseButton();
m_infoBar->ShowMessageFor( aMsg, aStatusTime, wxICON_INFORMATION );
}
void SCH_EDIT_FRAME::ClearFindReplaceStatus()
{
m_infoBar->Dismiss();
}
void SCH_EDIT_FRAME::OnFindDialogClose()
{
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr;
m_toolManager->RunAction( ACTIONS::updateFind );
}
void SCH_EDIT_FRAME::OnLoadFile( wxCommandEvent& event )
{
wxString fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );

16
eeschema/sch_edit_frame.h

@ -60,7 +60,6 @@ class SCH_DESIGN_BLOCK_PANE;
class DIALOG_BOOK_REPORTER;
class DIALOG_ERC;
class DIALOG_SYMBOL_FIELDS_TABLE;
class DIALOG_SCH_FIND;
class RESCUER;
class HIERARCHY_PANE;
class API_HANDLER_SCH;
@ -225,11 +224,6 @@ public:
*/
void AutoRotateItem( SCH_SCREEN* aScreen, SCH_ITEM* aItem );
/**
* Run the Find or Find & Replace dialog.
*/
void ShowFindReplaceDialog( bool aReplace );
/**
* Update the hierarchy navigation tree and history
*/
@ -249,14 +243,6 @@ public:
*/
void UpdateHierarchySelection();
void ShowFindReplaceStatus( const wxString& aMsg, int aStatusTime );
void ClearFindReplaceStatus();
/**
* Notification that the Find dialog has closed.
*/
void OnFindDialogClose();
/**
* Design block panel options have changed and the panel needs to be refreshed.
*/
@ -1007,7 +993,6 @@ private:
// The schematic editor control class should be able to access some internal
// functions of the editor frame.
friend class SCH_EDITOR_CONTROL;
friend class SCH_FIND_REPLACE_TOOL;
SCHEMATIC* m_schematic; ///< The currently loaded schematic
wxString m_highlightedConn; ///< The highlighted net or bus or empty string.
@ -1020,7 +1005,6 @@ private:
int m_exec_flags; ///< Flags of the wxExecute() function
///< to call a custom net list generator.
DIALOG_SCH_FIND* m_findReplaceDialog;
DIALOG_ERC* m_ercDialog;
DIALOG_BOOK_REPORTER* m_diffSymbolDialog;
HIERARCHY_PANE* m_hierarchy;

16
eeschema/sch_pin.cpp

@ -474,10 +474,18 @@ bool SCH_PIN::Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData )
{
bool isReplaced = false;
/* TODO: waiting on a way to override pins in the schematic...
isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
*/
if( dynamic_cast<LIB_SYMBOL*>( GetParentSymbol() ) )
{
isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
}
else
{
/* TODO: waiting on a way to override pins in the schematic...
isReplaced |= EDA_ITEM::Replace( aSearchData, m_name );
isReplaced |= EDA_ITEM::Replace( aSearchData, m_number );
*/
}
return isReplaced;
}

211
eeschema/symbol_diff_frame.cpp

@ -1,211 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* https://www.gnu.org/licenses/gpl-3.0.html
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <symbol_diff_frame.h>
#include <sch_base_frame.h>
#include <wx/event.h>
BEGIN_EVENT_TABLE( SYMBOL_DIFF_FRAME, SCH_BASE_FRAME )
// Window events
EVT_SIZE( SYMBOL_DIFF_FRAME::OnSize )
EVT_ACTIVATE( SYMBOL_DIFF_FRAME::OnActivate )
// Toolbar events
// EVT_TOOL( ID_LIBVIEW_SELECT_PART, SYMBOL_DIFF_FRAME::OnSelectSymbol )
// EVT_TOOL( ID_LIBVIEW_NEXT, SYMBOL_DIFF_FRAME::onSelectNextSymbol )
// EVT_TOOL( ID_LIBVIEW_PREVIOUS, SYMBOL_DIFF_FRAME::onSelectPreviousSymbol )
// EVT_CHOICE( ID_LIBVIEW_SELECT_UNIT_NUMBER, SYMBOL_DIFF_FRAME::onSelectSymbolUnit )
// listbox events
// EVT_TEXT( ID_LIBVIEW_LIB_FILTER, SYMBOL_DIFF_FRAME::OnLibFilter )
// EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, SYMBOL_DIFF_FRAME::ClickOnLibList )
// EVT_TEXT( ID_LIBVIEW_SYM_FILTER, SYMBOL_DIFF_FRAME::OnSymFilter )
// EVT_LISTBOX( ID_LIBVIEW_SYM_LIST, SYMBOL_DIFF_FRAME::ClickOnSymbolList )
// EVT_LISTBOX_DCLICK( ID_LIBVIEW_SYM_LIST, SYMBOL_DIFF_FRAME::DClickOnSymbolList )
// Menu (and/or hotkey) events
EVT_MENU( wxID_CLOSE, SYMBOL_DIFF_FRAME::CloseLibraryViewer )
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_UNIT_NUMBER, SYMBOL_DIFF_FRAME::onUpdateUnitChoice )
END_EVENT_TABLE()
#define LIB_VIEW_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE )
#define LIB_VIEW_STYLE_MODAL ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT )
SYMBOL_DIFF_FRAME::SYMBOL_DIFF_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aLibraryName ) :
SCH_BASE_FRAME( aKiway, aParent, aFrameType, _( "Symbol Library Browser" ),
wxDefaultPosition, wxDefaultSize, wxS( "SymbolDiff" ) )
{
SetModal( true );
m_aboutTitle = _HKI( "KiCad Symbol Difference Viewer" );
// Give an icon
wxIcon icon;
icon.CopyFromBitmap( KiBitmap( BITMAPS::library_browser ) );
SetIcon( icon );
SetScreen( new SCH_SCREEN );
GetScreen()->m_Center = true; // Axis origin centered on screen.
LoadSettings( config() );
// Ensure axis are always drawn (initial default display was not drawn)
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
gal_opts.m_axesEnabled = true;
gal_opts.m_gridMinSpacing = 10.0;
gal_opts.NotifyChanged();
GetRenderSettings()->LoadColors( GetColorSettings() );
GetCanvas()->GetGAL()->SetAxesColor( m_colorSettings->GetColor( LAYER_SCHEMATIC_GRID_AXES ) );
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_WIDTH_MILS * schIUScale.IU_PER_MILS );
setupTools();
setupUIConditions();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateMenuBar();
wxPanel* libPanel = new wxPanel( this );
wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
wxPanel* symbolPanel = new wxPanel( this );
wxSizer* symbolSizer = new wxBoxSizer( wxVERTICAL );
m_symbolFilter = new wxSearchCtrl( symbolPanel, ID_LIBVIEW_SYM_FILTER, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_symbolFilter->SetDescriptiveText( _( "Filter" ) );
m_symbolFilter->SetToolTip(
_( "Filter on symbol name, keywords, description and pin count.\n"
"Search terms are separated by spaces. All search terms must match.\n"
"A term which is a number will also match against the pin count." ) );
symbolSizer->Add( m_symbolFilter, 0, wxEXPAND, 5 );
#ifdef __WXGTK__
// wxSearchCtrl vertical height is not calculated correctly on some GTK setups
// See https://gitlab.com/kicad/code/kicad/-/issues/9019
m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
m_symbolFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
#endif
m_symbolList = new WX_LISTBOX( symbolPanel, ID_LIBVIEW_SYM_LIST, wxDefaultPosition, wxDefaultSize,
0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
symbolSizer->Add( m_symbolList, 1, wxEXPAND, 5 );
symbolPanel->SetSizer( symbolSizer );
symbolPanel->Fit();
// Preload libraries
loadAllLibraries();
if( aLibraryName.empty() )
{
ReCreateLibList();
}
else
{
m_currentSymbol.SetLibNickname( aLibraryName );
m_currentSymbol.SetLibItemName( "" );
m_unit = 1;
m_convert = 1;
}
m_selection_changed = false;
DisplayLibInfos();
m_auimgr.SetManagedWindow( this );
CreateInfoBar();
// Manage main toolbar
m_auimgr.AddPane( m_tbTopMain, EDA_PANE().HToolbar().Name( "TopMainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ) .Bottom().Layer(6) );
m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
m_auimgr.AddPane( symbolPanel, EDA_PANE().Palette().Name( "Symbols" ).Left().Layer(1)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.GetPane( libPanel ).Show( aLibraryName.empty() );
m_auimgr.Update();
if( m_libListWidth > 0 )
SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Libraries" ), m_libListWidth, -1 );
if( m_symbolListWidth > 0 )
SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Symbols" ), m_symbolListWidth, -1 );
FinishAUIInitialization();
if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
{
Raise();
Show( true );
}
SyncView();
GetCanvas()->SetCanFocus( false );
setupUnits( config() );
// Set the working/draw area size to display a symbol to a reasonable value:
// A 450mm x 450mm with a origin at the area center looks like a large working area
double max_size_x = schIUScale.mmToIU( 450 );
double max_size_y = schIUScale.mmToIU( 450 );
BOX2D bbox;
bbox.SetOrigin( -max_size_x / 2, -max_size_y / 2 );
bbox.SetSize( max_size_x, max_size_y );
GetCanvas()->GetView()->SetBoundary( bbox );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen );
// If a symbol was previously selected in m_symbolList from a previous run, show it
wxString symbName = m_symbolList->GetStringSelection();
if( !symbName.IsEmpty() )
{
SetSelectedSymbol( symbName );
updatePreviewSymbol();
}
}
SYMBOL_DIFF_FRAME::~SYMBOL_DIFF_FRAME()
{
// Shutdown all running tools
if( m_toolManager )
m_toolManager->ShutdownAllTools();
if( m_previewItem )
{
GetCanvas()->GetView()->Remove( m_previewItem.get() );
m_previewItem = nullptr;
}
}

97
eeschema/symbol_diff_frame.h

@ -1,97 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* https://www.gnu.org/licenses/gpl-3.0.html
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __SYMBOL_DIFF_FRAME_H_
#define __SYMBOL_DIFF_FRAME_H_
#include <sch_base_frame.h>
/**
* Symbol library viewer main window.
*/
class SYMBOL_DIFF_FRAME : public SCH_BASE_FRAME
{
public:
/**
* @param aKiway
* @param aParent is the parent frame of the viewer.
* @param aFrameType must be either #FRAME_SCH_LIB_VIEWER or #FRAME_SCH_LIB_VIEWER_MODAL.
* @param aLibrary is the library to open when starting (default = NULL).
*/
SYMBOL_DIFF_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aLibraryName = wxEmptyString );
~SYMBOL_DIFF_FRAME();
/**
* Runs the symbol viewer as a modal dialog.
*
* @param aSymbol an optional FPID string to initialize the viewer with and to
* return a selected footprint through.
*/
bool ShowModal( wxString* aSymbol, wxWindow* aParent ) override;
/**
* Send the selected symbol back to the caller.
*/
void FinishModal();
void OnSize( wxSizeEvent& event ) override;
void doCloseWindow() override;
void ReCreateHToolbar() override;
void ReCreateVToolbar() override;
void ReCreateLeftToolbar() override {}
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
WINDOW_SETTINGS* GetWindowSettings( APP_SETTINGS_BASE* aCfg ) override;
void CommonSettingsChanged( int aFlags ) override;
const BOX2I GetDocumentExtents( bool aIncludeAllVisible = true ) const override;
SELECTION& GetCurrentSelection() override;
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
protected:
void setupUIConditions() override;
void doReCreateMenuBar() override;
private:
// Set up the tool framework.
void setupTools();
/**
* Called when the frame is activated to reload the libraries and symbol lists
* that can be changed by the schematic editor or the library editor.
*/
void OnActivate( wxActivateEvent& event );
DECLARE_EVENT_TABLE()
};
#endif

4
eeschema/symbol_editor/menubar_symbol_editor.cpp

@ -107,6 +107,10 @@ void SYMBOL_EDIT_FRAME::doReCreateMenuBar()
editMenu->Add( ACTIONS::selectAll );
editMenu->Add( ACTIONS::unselectAll );
editMenu->AppendSeparator();
editMenu->Add( ACTIONS::find );
editMenu->Add( ACTIONS::findAndReplace );
editMenu->AppendSeparator();
editMenu->Add( SCH_ACTIONS::pinTable );
editMenu->Add( SCH_ACTIONS::setUnitDisplayName );

8
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -66,6 +66,7 @@
#include <tools/sch_point_editor.h>
#include <tools/ee_grid_helper.h>
#include <tools/sch_selection_tool.h>
#include <tools/sch_find_replace_tool.h>
#include <tools/symbol_editor_control.h>
#include <tools/symbol_editor_drawing_tools.h>
#include <tools/symbol_editor_edit_tool.h>
@ -388,6 +389,7 @@ void SYMBOL_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new SYMBOL_EDITOR_PIN_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_DRAWING_TOOLS );
m_toolManager->RegisterTool( new SCH_POINT_EDITOR );
m_toolManager->RegisterTool( new SCH_FIND_REPLACE_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_MOVE_TOOL );
m_toolManager->RegisterTool( new SYMBOL_EDITOR_EDIT_TOOL );
m_toolManager->RegisterTool( new LIBRARY_EDITOR_CONTROL );
@ -688,12 +690,14 @@ bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
void SYMBOL_EDIT_FRAME::doCloseWindow()
{
GetCanvas()->SetEvtHandlerEnabled( false );
GetCanvas()->StopDrawing();
SCH_BASE_FRAME::doCloseWindow();
if( GetLibTree() )
GetLibTree()->ShutdownPreviews();
delete m_toolManager;
m_toolManager = nullptr;
Destroy();
}

4
eeschema/symbol_editor/toolbars_symbol_editor.cpp

@ -115,6 +115,10 @@ std::optional<TOOLBAR_CONFIGURATION> SYMBOL_EDIT_TOOLBAR_SETTINGS::DefaultToolba
.AppendAction( ACTIONS::undo )
.AppendAction( ACTIONS::redo );
config.AppendSeparator()
.AppendAction( ACTIONS::find )
.AppendAction( ACTIONS::findAndReplace );
config.AppendSeparator()
.AppendAction( ACTIONS::zoomRedraw )
.AppendAction( ACTIONS::zoomInCenter )

7
eeschema/symbol_viewer_frame.cpp

@ -469,8 +469,11 @@ void SYMBOL_VIEWER_FRAME::updatePreviewSymbol()
void SYMBOL_VIEWER_FRAME::doCloseWindow()
{
GetCanvas()->SetEvtHandlerEnabled( false );
GetCanvas()->StopDrawing();
SCH_BASE_FRAME::doCloseWindow();
delete m_toolManager;
m_toolManager = nullptr;
Destroy();
}

171
eeschema/tools/sch_find_replace_tool.cpp

@ -41,18 +41,22 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
{
EDA_SEARCH_DATA& data = m_frame->GetFindReplaceData();
SCH_SEARCH_DATA* schSearchData = dynamic_cast<SCH_SEARCH_DATA*>( &data );
SCH_SHEET_PATH* sheetPath = nullptr;
bool selectedOnly = schSearchData ? schSearchData->searchSelectedOnly : false;
if( m_frame->GetFrameType() == FRAME_SCH )
sheetPath = &static_cast<SCH_EDIT_FRAME*>( m_frame )->GetCurrentSheet();
auto visit =
[&]( EDA_ITEM* aItem, SCH_SHEET_PATH* aSheet )
{
// We may get triggered when the dialog is not opened due to binding
// SelectedItemsModified we also get triggered when the find dialog is
// closed....so we need to double check the dialog is open.
if( m_frame->m_findReplaceDialog != nullptr
&& !data.findString.IsEmpty()
&& aItem->Matches( data, aSheet )
&& ( !selectedOnly || aItem->IsSelected() ) )
if( m_frame->GetFindReplaceDialog() != nullptr
&& !data.findString.IsEmpty()
&& aItem->Matches( data, aSheet )
&& ( !selectedOnly || aItem->IsSelected() ) )
{
aItem->SetForceVisible( true );
m_selectionTool->BrightenItem( aItem );
@ -68,8 +72,19 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
auto visitAll =
[&]()
{
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
visit( item, &m_frame->GetCurrentSheet() );
if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
if( LIB_SYMBOL* symbol = symbolEditor->GetCurSymbol() )
{
for( SCH_ITEM& item : symbol->GetDrawItems() )
visit( &item, nullptr );
}
}
else
{
for( SCH_ITEM* item : m_frame->GetScreen()->Items() )
visit( item, sheetPath );
}
};
if( aEvent.IsAction( &ACTIONS::find ) || aEvent.IsAction( &ACTIONS::findAndReplace )
@ -81,14 +96,14 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
{
for( EDA_ITEM* item : m_selectionTool->GetSelection() )
visit( item, &m_frame->GetCurrentSheet() );
visit( item, sheetPath );
}
else if( aEvent.Matches( EVENTS::PointSelectedEvent )
|| aEvent.Matches( EVENTS::SelectedEvent )
|| aEvent.Matches( EVENTS::UnselectedEvent )
|| aEvent.Matches( EVENTS::ClearedEvent ) )
{
if( !m_frame->m_findReplaceDialog )
if( !m_frame->GetFindReplaceDialog() )
{
if( m_foundItemHighlighted )
{
@ -112,15 +127,13 @@ int SCH_FIND_REPLACE_TOOL::UpdateFind( const TOOL_EVENT& aEvent )
getView()->UpdateItems();
m_frame->GetCanvas()->Refresh();
m_frame->updateTitle();
return 0;
}
SCH_ITEM* SCH_FIND_REPLACE_TOOL::nextMatch( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet,
SCH_ITEM* aAfter, EDA_SEARCH_DATA& aData,
bool reversed )
SCH_ITEM* SCH_FIND_REPLACE_TOOL::nextMatch( SCH_SCREEN* aScreen, SCH_SHEET_PATH* aSheet, SCH_ITEM* aAfter,
EDA_SEARCH_DATA& aData, bool reversed )
{
SCH_SEARCH_DATA* schSearchData = dynamic_cast<SCH_SEARCH_DATA*>( &aData );
bool selectedOnly = schSearchData ? schSearchData->searchSelectedOnly : false;
@ -166,6 +179,14 @@ SCH_ITEM* SCH_FIND_REPLACE_TOOL::nextMatch( SCH_SCREEN* aScreen, SCH_SHEET_PATH*
for( EDA_ITEM* item : m_selectionTool->GetSelection() )
addItem( static_cast<SCH_ITEM*>( item ) );
}
else if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
{
if( LIB_SYMBOL* symbol = symbolEditor->GetCurSymbol() )
{
for( SCH_ITEM& item : symbol->GetDrawItems() )
addItem( &item );
}
}
else
{
for( SCH_ITEM* item : aScreen->Items() )
@ -217,12 +238,19 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
bool selectedOnly = false;
bool isReversed = aEvent.IsAction( &ACTIONS::findPrevious );
SCH_ITEM* item = nullptr;
SCH_SHEET_PATH* afterSheet = &m_frame->GetCurrentSheet();
SCH_SHEET_PATH* currentSheet = nullptr;
SCH_SHEET_PATH* afterSheet = nullptr;
try
{
const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( data );
searchAllSheets = !( schSearchData.searchCurrentSheetOnly );
if( m_frame->GetFrameType() == FRAME_SCH )
{
currentSheet = afterSheet = &static_cast<SCH_EDIT_FRAME*>( m_frame )->GetCurrentSheet();
searchAllSheets = !schSearchData.searchCurrentSheetOnly;
}
selectedOnly = schSearchData.searchSelectedOnly;
}
catch( const std::bad_cast& )
@ -243,47 +271,47 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
}
if( afterSheet || !searchAllSheets )
{
item = nextMatch( m_frame->GetScreen(), &m_frame->GetCurrentSheet(), m_afterItem, data,
isReversed );
}
item = nextMatch( m_frame->GetScreen(), currentSheet, m_afterItem, data, isReversed );
if( !item && searchAllSheets )
{
SCH_SCREENS screens( m_frame->Schematic().Root() );
SCH_SHEET_LIST paths;
if( SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
{
SCH_SCREENS screens( editFrame->Schematic().Root() );
SCH_SHEET_LIST paths;
screens.BuildClientSheetPathList();
screens.BuildClientSheetPathList();
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( SCH_SHEET_PATH& sheet : screen->GetClientSheetPaths() )
paths.push_back( sheet );
}
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( SCH_SHEET_PATH& sheet : screen->GetClientSheetPaths() )
paths.push_back( sheet );
}
paths.SortByPageNumbers( false );
paths.SortByPageNumbers( false );
if( isReversed )
std::reverse( paths.begin(), paths.end() );
if( isReversed )
std::reverse( paths.begin(), paths.end() );
for( SCH_SHEET_PATH& sheet : paths )
{
if( afterSheet )
for( SCH_SHEET_PATH& sheet : paths )
{
if( afterSheet->GetCurrentHash() == sheet.GetCurrentHash() )
afterSheet = nullptr;
if( afterSheet )
{
if( afterSheet->GetCurrentHash() == sheet.GetCurrentHash() )
afterSheet = nullptr;
continue;
}
continue;
}
item = nextMatch( sheet.LastScreen(), &sheet, nullptr, data, isReversed );
item = nextMatch( sheet.LastScreen(), &sheet, nullptr, data, isReversed );
if( item )
{
if( m_frame->Schematic().CurrentSheet() != sheet )
m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet, &sheet );
if( item )
{
if( editFrame->Schematic().CurrentSheet() != sheet )
editFrame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( SCH_ACTIONS::changeSheet, &sheet );
break;
break;
}
}
}
}
@ -314,12 +342,17 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
}
else
{
wxString msg = searchAllSheets ? _( "Reached end of schematic." )
: _( "Reached end of sheet." );
wxString msg;
if( m_frame->GetFrameType() == FRAME_SCH_SYMBOL_EDITOR )
msg = _( "Reached end of symbol." );
else if( searchAllSheets )
msg = _( "Reached end of schematic." );
else
msg = _( "Reached end of sheet." );
// Show the popup during the time period the user can wrap the search
m_frame->ShowFindReplaceStatus( msg + wxS( " " ) +
_( "Find again to wrap around to the start." ), 4000 );
m_frame->ShowFindReplaceStatus( msg + wxS( " " ) + _( "Find again to wrap around to the start." ), 4000 );
m_wrapAroundTimer.StartOnce( 4000 );
}
@ -339,8 +372,12 @@ bool SCH_FIND_REPLACE_TOOL::HasMatch()
{
EDA_SEARCH_DATA& data = m_frame->GetFindReplaceData();
EDA_ITEM* match = getCurrentMatch();
SCH_SHEET_PATH* sheetPath = nullptr;
if( m_frame->GetFrameType() == FRAME_SCH )
sheetPath = &static_cast<SCH_EDIT_FRAME*>( m_frame )->GetCurrentSheet();
return match && match->Matches( data, &m_frame->GetCurrentSheet() );
return match && match->Matches( data, sheetPath );
}
@ -348,7 +385,10 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
{
EDA_SEARCH_DATA& data = m_frame->GetFindReplaceData();
EDA_ITEM* item = getCurrentMatch();
SCH_SHEET_PATH* sheet = &m_frame->GetCurrentSheet();
SCH_SHEET_PATH* currentSheet = nullptr;
if( m_frame->GetFrameType() == FRAME_SCH )
currentSheet = &static_cast<SCH_EDIT_FRAME*>( m_frame )->GetCurrentSheet();
if( data.findString.IsEmpty() )
return FindAndReplace( ACTIONS::find.MakeEvent() );
@ -358,11 +398,13 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
SCH_COMMIT commit( m_frame );
SCH_ITEM* sch_item = static_cast<SCH_ITEM*>( item );
commit.Modify( sch_item, sheet->LastScreen(), RECURSE_MODE::NO_RECURSE );
commit.Modify( sch_item, m_frame->GetScreen(), RECURSE_MODE::NO_RECURSE );
if( item->Replace( data, sheet ) )
if( item->Replace( data, currentSheet ) )
{
m_frame->GetCurrentSheet().UpdateAllScreenReferences();
if( currentSheet )
currentSheet->UpdateAllScreenReferences();
commit.Push( wxS( "Find and Replace" ) );
}
@ -376,14 +418,21 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
{
EDA_SEARCH_DATA& data = m_frame->GetFindReplaceData();
bool currentSheetOnly = false;
SCH_SHEET_PATH* currentSheet = nullptr;
bool currentSheetOnly = true;
bool selectedOnly = false;
try
{
const SCH_SEARCH_DATA& schSearchData = dynamic_cast<const SCH_SEARCH_DATA&>( data );
currentSheetOnly = schSearchData.searchCurrentSheetOnly;
selectedOnly = schSearchData.searchSelectedOnly;
if( m_frame->GetFrameType() == FRAME_SCH )
{
currentSheet = &static_cast<SCH_EDIT_FRAME*>( m_frame )->GetCurrentSheet();
currentSheetOnly = schSearchData.searchCurrentSheetOnly;
}
selectedOnly = schSearchData.searchSelectedOnly;
}
catch( const std::bad_cast& )
{
@ -398,7 +447,7 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
auto doReplace =
[&]( SCH_ITEM* aItem, SCH_SHEET_PATH* aSheet, EDA_SEARCH_DATA& aData )
{
commit.Modify( aItem, aSheet->LastScreen(), RECURSE_MODE::NO_RECURSE );
commit.Modify( aItem, aSheet ? aSheet->LastScreen() : nullptr, RECURSE_MODE::NO_RECURSE );
if( aItem->Replace( aData, aSheet ) )
{
@ -409,8 +458,6 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
if( currentSheetOnly || selectedOnly )
{
SCH_SHEET_PATH* currentSheet = &m_frame->GetCurrentSheet();
SCH_ITEM* item = nextMatch( m_frame->GetScreen(), currentSheet, nullptr, data, false );
while( item )
@ -421,10 +468,10 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
item = nextMatch( m_frame->GetScreen(), currentSheet, item, data, false );
}
}
else
else if( SCH_EDIT_FRAME* schematicFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ) )
{
SCH_SHEET_LIST allSheets = m_frame->Schematic().Hierarchy();
SCH_SCREENS screens( m_frame->Schematic().Root() );
SCH_SHEET_LIST allSheets = schematicFrame->Schematic().Hierarchy();
SCH_SCREENS screens( schematicFrame->Schematic().Root() );
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
@ -458,7 +505,9 @@ int SCH_FIND_REPLACE_TOOL::ReplaceAll( const TOOL_EVENT& aEvent )
if( modified )
{
commit.Push( wxS( "Find and Replace All" ) );
m_frame->GetCurrentSheet().UpdateAllScreenReferences();
if( currentSheet )
currentSheet->UpdateAllScreenReferences();
}
return 0;

20
eeschema/tools/sch_find_replace_tool.h

@ -29,16 +29,15 @@
#include <sch_base_frame.h>
#include <tools/sch_tool_base.h>
class SCH_EDIT_FRAME;
/**
* Handle actions specific to the schematic editor.
*/
class SCH_FIND_REPLACE_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_EDIT_FRAME>
class SCH_FIND_REPLACE_TOOL : public wxEvtHandler, public SCH_TOOL_BASE<SCH_BASE_FRAME>
{
public:
SCH_FIND_REPLACE_TOOL() :
SCH_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.FindReplace" ),
SCH_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.FindReplace" ),
m_foundItemHighlighted( false )
{ }
@ -53,21 +52,6 @@ public:
int UpdateFind( const TOOL_EVENT& aEvent );
/**
* Find a symbol in the schematic and an item in this symbol and select it.
*
* @param aPath The symbol path to find. Pass nullptr to search by aReference.
* @param aReference The symbol reference designator to find, or to display in
* status bar if aPath is specified
* @param aSearchHierarchy If false, search the current sheet only. Otherwise,
* the entire hierarchy
* @param aSearchType A #SCH_SEARCH_T value used to determine what to search for.
* @param aSearchText The text to search for, either in value, reference or elsewhere.
*/
SCH_ITEM* FindSymbolAndItem( const wxString* aPath, const wxString* aReference,
bool aSearchHierarchy, SCH_SEARCH_T aSearchType,
const wxString& aSearchText );
private:
///< Set up handlers for various events.
void setTransitions() override;

Loading…
Cancel
Save