Rework Eeschema find/replace for modern toolset.

Fixes: lp:1827274
* https://bugs.launchpad.net/kicad/+bug/1827274

Fixes: lp:1827240
* https://bugs.launchpad.net/kicad/+bug/1827240
This commit is contained in:
Jeff Young 2019-05-19 22:04:04 +01:00
parent 07b82d19e3
commit 67cc2aac2e
63 changed files with 777 additions and 1800 deletions

View File

@ -132,9 +132,7 @@ SEARCH_RESULT EDA_ITEM::IterateForward( EDA_ITEM* listStart,
void* testData,
const KICAD_T scanTypes[] )
{
EDA_ITEM* p = listStart;
for( ; p; p = p->Pnext )
for( EDA_ITEM* p = listStart; p; p = p->Pnext )
{
if( SEARCH_QUIT == p->Visit( inspector, testData, scanTypes ) )
return SEARCH_QUIT;

View File

@ -29,14 +29,11 @@
#include <status_popup.h>
#include <draw_frame.h>
STATUS_POPUP::STATUS_POPUP( EDA_DRAW_FRAME* aParent ) :
STATUS_POPUP::STATUS_POPUP( wxWindow* aParent ) :
wxPopupWindow( aParent ),
m_frame( aParent ),
m_expireTimer( this )
{
m_panel = new wxPanel( this, wxID_ANY );
m_panel->SetBackgroundColour( *wxLIGHT_GREY );
m_topSizer = new wxBoxSizer( wxVERTICAL );
m_panel->SetSizer( m_topSizer );
m_panel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
@ -59,10 +56,12 @@ void STATUS_POPUP::onCharHook( wxKeyEvent& aEvent )
// the canvas / frame.
aEvent.SetEventType( wxEVT_CHAR );
if( m_frame->IsGalCanvasActive() )
m_frame->GetGalCanvas()->OnEvent( aEvent );
EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( GetParent() );
if( frame )
frame->GetGalCanvas()->OnEvent( aEvent );
else
m_frame->ProcessEvent( aEvent );
GetParent()->GetEventHandler()->ProcessEvent( aEvent );
}
@ -73,6 +72,13 @@ void STATUS_POPUP::Popup( wxWindow* )
}
void STATUS_POPUP::PopupFor( int aMsecs )
{
Popup();
Expire( aMsecs );
}
void STATUS_POPUP::Move( const VECTOR2I& aWhere )
{
SetPosition( wxPoint( aWhere.x, aWhere.y ) );
@ -104,7 +110,7 @@ void STATUS_POPUP::onExpire( wxTimerEvent& aEvent )
}
STATUS_TEXT_POPUP::STATUS_TEXT_POPUP( EDA_DRAW_FRAME* aParent ) :
STATUS_TEXT_POPUP::STATUS_TEXT_POPUP( wxWindow* aParent ) :
STATUS_POPUP( aParent )
{
m_panel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNSHADOW ) );

View File

@ -43,11 +43,34 @@ TOOL_ACTION ACTIONS::find( "common.Interactive.find",
_( "Find" ), _( "Find text" ),
find_xpm );
TOOL_ACTION ACTIONS::replace( "common.Interactive.findAndReplace",
TOOL_ACTION ACTIONS::findAndReplace( "common.Interactive.findAndReplace",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REPLACE ),
_( "Find and Replace" ), _( "Find and replace text" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::findNext( "common.Interactive.findNext",
AS_GLOBAL, 0,
_( "Find Next" ), _( "Find next match" ),
find_xpm );
TOOL_ACTION ACTIONS::findNextMarker( "common.Interactive.findNextMarker",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FIND_NEXT_MARKER ),
_( "Find Next Marker" ), "",
find_xpm );
TOOL_ACTION ACTIONS::replaceAndFindNext( "common.Interactive.replaceAndFindNext",
AS_GLOBAL, 0,
_( "Replace and Find Next" ), _( "Replace current match and find next" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::replaceAll( "common.Interactive.replaceAll",
AS_GLOBAL, 0,
_( "Replace All" ), _( "Replace all matches" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::updateFind( "common.Control.updateFind",
AS_GLOBAL, 0, "", "" ); // This is an internal event
// View Controls
TOOL_ACTION ACTIONS::zoomRedraw( "common.Control.zoomRedraw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_REDRAW ),

View File

@ -32,11 +32,6 @@ CONDITIONAL_MENU::CONDITIONAL_MENU( bool isContextMenu, TOOL_INTERACTIVE* aTool
m_isContextMenu( isContextMenu )
{
m_tool = aTool;
// wxWidgets 3.0.4 on MSW checks for an empty menu before running the MENU_OPEN
// event. Add a dummy item to ensure that the event is dispatched. Evaluate()
// will clear the menu before evaluating all the items anyway.
Append( wxID_ANY, wxT( "dummy menu for MSW" ) );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2010-2019 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
@ -22,24 +22,20 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dialog_schematic_find.cpp
* @brief Schematic find and replace dialog implementation.
*/
#include <dialog_schematic_find.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <sch_edit_frame.h>
#include <tools/sch_editor_control.h>
DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER )
DEFINE_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB )
DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, wxString* aStatus,
DIALOG_SCH_FIND::DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, wxFindReplaceData* 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_findReplaceData( aData ),
m_status( aStatus )
m_frame( aParent ),
m_editorControl( m_frame->GetToolManager()->GetTool<SCH_EDITOR_CONTROL>() ),
m_findReplaceData( aData )
{
wxASSERT_MSG( m_findReplaceData, wxT( "can't create find dialog without data" ) );
@ -59,7 +55,6 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, w
m_radioBackward->SetValue( ( flags & wxFR_DOWN ) == 0 );
m_checkMatchCase->SetValue( flags & wxFR_MATCHCASE );
m_checkWholeWord->SetValue( flags & wxFR_WHOLEWORD );
m_checkNoWarpCursor->SetValue( flags & FR_NO_WARP_CURSOR );
/* Whole word and wild card searches are mutually exclusive. */
if( !( flags & wxFR_WHOLEWORD ) )
@ -68,10 +63,8 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, w
m_checkAllFields->SetValue( flags & FR_SEARCH_ALL_FIELDS );
m_checkReplaceReferences->SetValue( flags & FR_REPLACE_REFERENCES );
m_checkAllPins->SetValue( flags & FR_SEARCH_ALL_PINS );
m_checkWrap->SetValue( flags & FR_SEARCH_WRAP );
m_checkCurrentSheetOnly->SetValue( flags & FR_CURRENT_SHEET_ONLY );
m_statusLine->SetLabel( wxEmptyString );
m_buttonFind->SetDefault();
SetInitialFocus( m_comboFind );
@ -94,25 +87,24 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, w
SetSize( size );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
Connect( wxEVT_CHAR, wxKeyEventHandler( DIALOG_SCH_FIND::OnChar ), nullptr, this );
}
void DIALOG_SCH_FIND::OnClose( wxCloseEvent& aEvent )
{
SendEvent( wxEVT_COMMAND_FIND_CLOSE );
}
void DIALOG_SCH_FIND::OnUpdateFindUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( !m_comboFind->GetValue().empty() );
// Notify the SCH_EDIT_FRAME
m_frame->OnFindDialogClose();
// Notify the controller
m_editorControl->UpdateFind( ACTIONS::updateFind.MakeEvent() );
}
void DIALOG_SCH_FIND::OnUpdateReplaceUI( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( HasFlag( wxFR_REPLACEDIALOG ) && !m_comboFind->GetValue().empty() &&
(m_findReplaceData->GetFlags() & FR_REPLACE_ITEM_FOUND) );
m_editorControl->HasMatch() );
}
@ -122,15 +114,20 @@ void DIALOG_SCH_FIND::OnUpdateReplaceAllUI( wxUpdateUIEvent& aEvent )
}
void DIALOG_SCH_FIND::OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent )
void DIALOG_SCH_FIND::OnChar( wxKeyEvent& aEvent )
{
aEvent.Enable( !m_checkWildcardMatch->GetValue() );
if( aEvent.GetKeyCode() == WXK_RETURN )
{
wxCommandEvent dummyCommand;
OnFind( dummyCommand );
}
}
void DIALOG_SCH_FIND::OnUpdateWildcardUI( wxUpdateUIEvent& aEvent )
void DIALOG_SCH_FIND::OnSearchForText( wxCommandEvent& aEvent )
{
aEvent.Enable( !m_checkWholeWord->GetValue() );
m_findReplaceData->SetFindString( m_comboFind->GetValue() );
m_editorControl->UpdateFind( ACTIONS::updateFind.MakeEvent() );
}
@ -140,6 +137,36 @@ void DIALOG_SCH_FIND::OnTextEnter( wxCommandEvent& aEvent )
}
void DIALOG_SCH_FIND::OnOptions( wxCommandEvent& aEvent )
{
int flags = 0;
if( m_radioForward->GetValue() )
flags |= wxFR_DOWN;
if( m_checkMatchCase->GetValue() )
flags |= wxFR_MATCHCASE;
if( m_checkWholeWord->GetValue() )
flags |= wxFR_WHOLEWORD;
if( m_checkWildcardMatch->IsShown() && m_checkWildcardMatch->GetValue() )
flags |= FR_MATCH_WILDCARD;
if( m_checkAllFields->GetValue() )
flags |= FR_SEARCH_ALL_FIELDS;
if( m_checkAllPins->GetValue() )
flags |= FR_SEARCH_ALL_PINS;
if( m_checkCurrentSheetOnly->GetValue() )
flags |= FR_CURRENT_SHEET_ONLY;
m_findReplaceData->SetFlags( flags );
m_editorControl->UpdateFind( ACTIONS::updateFind.MakeEvent() );
}
void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent )
{
int index = m_comboFind->FindString( m_comboFind->GetValue(), true );
@ -157,7 +184,7 @@ void DIALOG_SCH_FIND::OnFind( wxCommandEvent& aEvent )
m_comboFind->SetSelection( 0 );
}
SendEvent( wxEVT_COMMAND_FIND );
m_editorControl->FindNext( ACTIONS::findNext.MakeEvent());
}
@ -179,94 +206,9 @@ void DIALOG_SCH_FIND::OnReplace( wxCommandEvent& aEvent )
}
if( aEvent.GetId() == wxID_REPLACE )
SendEvent( wxEVT_COMMAND_FIND_REPLACE );
m_editorControl->FindNext( ACTIONS::replaceAndFindNext.MakeEvent());
else if( aEvent.GetId() == wxID_REPLACE_ALL )
SendEvent( wxEVT_COMMAND_FIND_REPLACE_ALL );
}
void DIALOG_SCH_FIND::OnCancel( wxCommandEvent& aEvent )
{
SendEvent( wxEVT_COMMAND_FIND_CLOSE );
Show( false );
}
void DIALOG_SCH_FIND::SendEvent( const wxEventType& aEventType )
{
wxFindDialogEvent event( aEventType, GetId() );
event.SetEventObject( this );
event.SetFindString( m_comboFind->GetValue() );
int flags = 0;
if ( HasFlag( wxFR_REPLACEDIALOG ) )
{
event.SetReplaceString( m_comboReplace->GetValue() );
flags |= FR_SEARCH_REPLACE;
}
if( m_checkReplaceReferences->GetValue() )
flags |= FR_REPLACE_REFERENCES;
if( m_radioForward->GetValue() )
flags |= wxFR_DOWN;
if( m_checkMatchCase->GetValue() )
flags |= wxFR_MATCHCASE;
if( m_checkWholeWord->GetValue() )
flags |= wxFR_WHOLEWORD;
if( m_checkWildcardMatch->IsShown() && m_checkWildcardMatch->GetValue() )
flags |= FR_MATCH_WILDCARD;
if( m_checkAllFields->GetValue() )
flags |= FR_SEARCH_ALL_FIELDS;
if( m_checkAllPins->GetValue() )
flags |= FR_SEARCH_ALL_PINS;
if( m_checkWrap->GetValue() )
flags |= FR_SEARCH_WRAP;
if( m_checkCurrentSheetOnly->GetValue() )
flags |= FR_CURRENT_SHEET_ONLY;
if( m_checkNoWarpCursor->GetValue() )
flags |= FR_NO_WARP_CURSOR;
m_findReplaceData->SetFindString( event.GetFindString() );
if( HasFlag( wxFR_REPLACEDIALOG )
&& ( event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE
|| event.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL ) )
{
m_findReplaceData->SetReplaceString( event.GetReplaceString() );
}
event.SetFlags( flags );
m_findReplaceData->SetFlags( event.GetFlags() );
// when we are no using the find/replace (just find)
// FR_REPLACE_REFERENCES flag bit is always set to 1 in event flags
// but not set in m_findReplaceData
if ( ! HasFlag( wxFR_REPLACEDIALOG ) )
{
flags |= FR_REPLACE_REFERENCES;
event.SetFlags( flags );
}
if( !GetEventHandler()->ProcessEvent( event ) )
{
GetParent()->GetEventHandler()->ProcessEvent( event );
}
if( event.GetFlags() != flags )
m_findReplaceData->SetFlags( event.GetFlags() );
m_statusLine->SetLabel( *m_status );
m_editorControl->FindNext( ACTIONS::replaceAll.MakeEvent());
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2010-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2010-2019 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
@ -40,6 +40,9 @@
#include <wx/fdrepdlg.h> // Use the wxFindReplaceDialog events, data, and enums.
class SCH_EDIT_FRAME;
class SCH_EDITOR_CONTROL;
/**
* Define schematic specific find and replace dialog flags based on the enum entries
@ -65,9 +68,6 @@ enum SchematicFindReplaceFlags
/// Wrap around the beginning or end of search list.
FR_SEARCH_WRAP = wxFR_MATCHCASE << 5,
/// Don't warp cursor to found item until the dialog is closed.
FR_NO_WARP_CURSOR = wxFR_MATCHCASE << 6,
/// Perform a search for a item that has replaceable text.
FR_SEARCH_REPLACE = wxFR_MATCHCASE << 7,
@ -84,8 +84,7 @@ enum SchematicFindReplaceFlags
* Definition FR_MASK_NON_COMPARE_FLAGS
* is used to mask find/replace flag bits that do not effect the search results.
*/
#define FR_MASK_NON_COMPARE_FLAGS ~( wxFR_DOWN | FR_SEARCH_WRAP | FR_NO_WARP_CURSOR | \
FR_REPLACE_ITEM_FOUND )
#define FR_MASK_NON_COMPARE_FLAGS ~( wxFR_DOWN | FR_SEARCH_WRAP | FR_REPLACE_ITEM_FOUND )
/**
@ -96,7 +95,7 @@ class SCH_FIND_REPLACE_DATA : public wxFindReplaceData
{
public:
SCH_FIND_REPLACE_DATA& operator =( SCH_FIND_REPLACE_DATA& aFindReplaceData )
SCH_FIND_REPLACE_DATA& operator =( const SCH_FIND_REPLACE_DATA& aFindReplaceData )
{
if( this == &aFindReplaceData )
return *this;
@ -120,26 +119,6 @@ public:
return !( *this == aFindReplaceData );
}
/**
* Function ChangesCompare
* tests \a aFindReplaceData to see if it would result in a change in the search string
* comparison results.
*
* @param aFindReplaceData A reference to a #SCH_FIND_REPLACE_DATA object to compare
* against.
* @return True if \a aFindReplaceData would result in a search and/or replace change,
* otherwise false.
*/
bool ChangesCompare( const SCH_FIND_REPLACE_DATA& aFindReplaceData )
{
return ( (GetFindString() != aFindReplaceData.GetFindString())
|| (GetCompareFlags() != aFindReplaceData.GetCompareFlags()) );
}
bool IsReplacing() const { return (GetFlags() & FR_SEARCH_REPLACE) != 0; }
bool IsWrapping() const { return (GetFlags() & FR_SEARCH_WRAP) != 0; }
private:
/**
* Function GetSearchFlags
@ -155,26 +134,24 @@ class DIALOG_SCH_FIND : public DIALOG_SCH_FIND_BASE
protected:
// Handlers for DIALOG_SCH_FIND_BASE events.
void OnClose( wxCloseEvent& aEvent ) override;
void OnSearchForText( wxCommandEvent& aEvent ) override;
void OnTextEnter( wxCommandEvent& event ) override;
void OnUpdateFindUI( wxUpdateUIEvent& aEvent ) override;
void OnOptions( wxCommandEvent& event ) override;
void OnUpdateReplaceUI( wxUpdateUIEvent& aEvent ) override;
void OnUpdateReplaceAllUI( wxUpdateUIEvent& aEvent ) override;
void OnUpdateWholeWordUI( wxUpdateUIEvent& aEvent ) override;
void OnUpdateWildcardUI( wxUpdateUIEvent& aEvent ) override;
void OnChar( wxKeyEvent& aEvent );
void OnFind( wxCommandEvent& aEvent ) override;
void OnReplace( wxCommandEvent& aEvent ) override;
void OnCancel( wxCommandEvent& aEvent ) override;
void SendEvent( const wxEventType& aEventType );
wxFindReplaceData* m_findReplaceData;
wxString* m_status;
SCH_EDIT_FRAME* m_frame;
SCH_EDITOR_CONTROL* m_editorControl;
wxFindReplaceData* m_findReplaceData;
DECLARE_NO_COPY_CLASS( DIALOG_SCH_FIND )
public:
DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData, wxString* aStatus,
DIALOG_SCH_FIND( SCH_EDIT_FRAME* aParent, wxFindReplaceData* aData,
const wxPoint& aPosition = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize, int aStyle = 0 );
@ -186,16 +163,4 @@ public:
};
BEGIN_DECLARE_EVENT_TYPES()
DECLARE_LOCAL_EVENT_TYPE( EVT_COMMAND_FIND_DRC_MARKER, wxID_ANY )
DECLARE_LOCAL_EVENT_TYPE( EVT_COMMAND_FIND_COMPONENT_IN_LIB, wxID_ANY )
END_DECLARE_EVENT_TYPES()
#define EVT_FIND_DRC_MARKER( id, fn ) \
wx__DECLARE_EVT1( EVT_COMMAND_FIND_DRC_MARKER, id, wxFindDialogEventHandler( fn ) )
#define EVT_FIND_COMPONENT_IN_LIB( id, fn ) \
wx__DECLARE_EVT1( EVT_COMMAND_FIND_COMPONENT_IN_LIB, id, wxFindDialogEventHandler( fn ) )
#endif // __dialog_schematic_find__

View File

@ -30,11 +30,11 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
m_staticText1 = new wxStaticText( this, wxID_ANY, _("&Search for:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
leftGridSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 6 );
leftGridSizer->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL, 6 );
m_comboFind = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_DROPDOWN|wxTE_PROCESS_ENTER );
m_comboFind->SetToolTip( _("Text with optional wildcards") );
m_comboFind->SetMinSize( wxSize( 200,-1 ) );
m_comboFind->SetMinSize( wxSize( 220,-1 ) );
leftGridSizer->Add( m_comboFind, 0, wxEXPAND, 6 );
@ -74,42 +74,37 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
leftSizer->Add( leftGridSizer, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* checkBoxes;
checkBoxes = new wxBoxSizer( wxVERTICAL );
m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Match whole wor&d"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkWholeWord->SetValue(true);
checkBoxes->Add( m_checkWholeWord, 0, wxALL, 3 );
wxGridBagSizer* gbSizer2;
gbSizer2 = new wxGridBagSizer( 0, 20 );
gbSizer2->SetFlexibleDirection( wxHORIZONTAL );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
m_checkMatchCase = new wxCheckBox( this, wxID_ANY, _("&Match case"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkMatchCase, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
gbSizer2->Add( m_checkMatchCase, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Search &using simple wildcard matching"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkWildcardMatch, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
m_checkWholeWord = new wxCheckBox( this, wxID_ANY, _("Words"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkWholeWord->SetValue(true);
gbSizer2->Add( m_checkWholeWord, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkWrap = new wxCheckBox( this, wxID_ANY, _("Wrap around &end of search list"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkWrap->SetValue(true);
checkBoxes->Add( m_checkWrap, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
m_checkWildcardMatch = new wxCheckBox( this, wxID_ANY, _("Wildcards"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_checkWildcardMatch, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_checkAllFields = new wxCheckBox( this, wxID_ANY, _("Search all com&ponent fields"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkAllFields, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
gbSizer2->Add( m_checkAllFields, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkAllPins = new wxCheckBox( this, wxID_ANY, _("Search all pin &names and numbers"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkAllPins, 0, wxBOTTOM|wxRIGHT|wxLEFT, 3 );
gbSizer2->Add( m_checkAllPins, wxGBPosition( 2, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkCurrentSheetOnly = new wxCheckBox( this, wxID_ANY, _("Search the current &sheet only"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkCurrentSheetOnly, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
gbSizer2->Add( m_checkCurrentSheetOnly, wxGBPosition( 3, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkReplaceReferences = new wxCheckBox( this, wxID_ANY, _("Replace componen&t reference designators"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkReplaceReferences->Hide();
checkBoxes->Add( m_checkReplaceReferences, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
m_checkNoWarpCursor = new wxCheckBox( this, wxID_ANY, _("D&o not warp cursor to found item"), wxDefaultPosition, wxDefaultSize, 0 );
checkBoxes->Add( m_checkNoWarpCursor, 0, wxBOTTOM|wxLEFT|wxRIGHT, 3 );
gbSizer2->Add( m_checkReplaceReferences, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
leftSizer->Add( checkBoxes, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
leftSizer->Add( gbSizer2, 1, wxEXPAND, 5 );
topSizer->Add( leftSizer, 1, wxEXPAND|wxALL, 5 );
@ -140,21 +135,6 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
mainSizer->Add( topSizer, 1, wxEXPAND, 5 );
wxBoxSizer* statusSizer;
statusSizer = new wxBoxSizer( wxVERTICAL );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
statusSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 3 );
m_statusLine = new wxStaticText( this, wxID_ANY, _("Status..."), wxDefaultPosition, wxDefaultSize, 0 );
m_statusLine->Wrap( -1 );
m_statusLine->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
statusSizer->Add( m_statusLine, 0, wxBOTTOM|wxRIGHT|wxLEFT, 7 );
mainSizer->Add( statusSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( mainSizer );
this->Layout();
@ -164,37 +144,43 @@ DIALOG_SCH_FIND_BASE::DIALOG_SCH_FIND_BASE( wxWindow* parent, wxWindowID id, con
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) );
m_comboFind->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnSearchForText ), NULL, this );
m_comboFind->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnTextEnter ), NULL, this );
m_comboFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_comboReplace->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnTextEnter ), NULL, this );
m_comboReplace->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_checkWholeWord->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this );
m_checkWildcardMatch->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this );
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_checkWildcardMatch->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_checkAllPins->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_buttonFind->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonFind->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), 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 );
m_buttonReplaceAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplaceAll->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceAllUI ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}
DIALOG_SCH_FIND_BASE::~DIALOG_SCH_FIND_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SCH_FIND_BASE::OnClose ) );
m_comboFind->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnSearchForText ), NULL, this );
m_comboFind->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnTextEnter ), NULL, this );
m_comboFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_comboReplace->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnTextEnter ), NULL, this );
m_comboReplace->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateDrcUI ), NULL, this );
m_checkWholeWord->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWholeWordUI ), NULL, this );
m_checkWildcardMatch->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateWildcardUI ), NULL, this );
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_checkWildcardMatch->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_checkAllPins->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_buttonFind->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnFind ), NULL, this );
m_buttonFind->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateFindUI ), NULL, this );
m_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 );
m_buttonReplaceAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnReplace ), NULL, this );
m_buttonReplaceAll->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SCH_FIND_BASE::OnUpdateReplaceAllUI ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_FIND_BASE::OnCancel ), NULL, this );
}

View File

@ -129,7 +129,7 @@
<property name="vgap">3</property>
<object class="sizeritem" expanded="0">
<property name="border">6</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -248,7 +248,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">200,-1</property>
<property name="minimum_size">220,-1</property>
<property name="moveable">1</property>
<property name="name">m_comboFind</property>
<property name="pane_border">1</property>
@ -298,7 +298,7 @@
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnText">OnSearchForText</event>
<event name="OnTextEnter">OnTextEnter</event>
<event name="OnUpdateUI">OnUpdateDrcUI</event>
</object>
@ -753,105 +753,26 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxGridBagSizer" expanded="1">
<property name="empty_cell_size"></property>
<property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols"></property>
<property name="growablerows"></property>
<property name="hgap">20</property>
<property name="minimum_size"></property>
<property name="name">checkBoxes</property>
<property name="orient">wxVERTICAL</property>
<property name="name">gbSizer2</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Match whole wor&amp;d</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkWholeWord</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateWholeWordUI</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<property name="vgap">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -887,7 +808,7 @@
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_checkMatchCase</property>
<property name="pane_border">1</property>
@ -911,7 +832,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -936,98 +857,13 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Search &amp;using simple wildcard matching</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkWildcardMatch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateWildcardUI</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">1</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1057,15 +893,15 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Wrap around &amp;end of search list</property>
<property name="label">Words</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_checkWrap</property>
<property name="name">m_checkWholeWord</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1087,7 +923,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1112,10 +948,104 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Wildcards</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,-1</property>
<property name="moveable">1</property>
<property name="name">m_checkWildcardMatch</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">3</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="row">1</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1175,7 +1105,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1200,10 +1130,13 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">3</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<property name="row">2</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1263,7 +1196,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1288,10 +1221,13 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">3</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="row">3</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1351,7 +1287,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnCheckBox">OnOptions</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
@ -1376,10 +1312,13 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">3</property>
<property name="column">0</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="row">4</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1464,94 +1403,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">D&amp;o not warp cursor to found item</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkNoWarpCursor</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
@ -1650,7 +1501,7 @@
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI">OnUpdateFindUI</event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
@ -1891,7 +1742,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancel</event>
<event name="OnButtonClick"></event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1921,181 +1772,6 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">statusSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">7</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font">,90,90,10,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Status...</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_statusLine</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>

View File

@ -22,8 +22,8 @@
#include <wx/radiobut.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/gbsizer.h>
#include <wx/button.h>
#include <wx/statline.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -44,34 +44,28 @@ class DIALOG_SCH_FIND_BASE : public DIALOG_SHIM
wxStaticText* m_staticDirection;
wxRadioButton* m_radioForward;
wxRadioButton* m_radioBackward;
wxCheckBox* m_checkWholeWord;
wxCheckBox* m_checkMatchCase;
wxCheckBox* m_checkWholeWord;
wxCheckBox* m_checkWildcardMatch;
wxCheckBox* m_checkWrap;
wxCheckBox* m_checkAllFields;
wxCheckBox* m_checkAllPins;
wxCheckBox* m_checkCurrentSheetOnly;
wxCheckBox* m_checkReplaceReferences;
wxCheckBox* m_checkNoWarpCursor;
wxButton* m_buttonFind;
wxButton* m_buttonReplace;
wxButton* m_buttonReplaceAll;
wxButton* m_buttonCancel;
wxStaticLine* m_staticline1;
wxStaticText* m_statusLine;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnSearchForText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextEnter( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateDrcUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnUpdateWholeWordUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnUpdateWildcardUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnOptions( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFind( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateFindUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnReplace( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateReplaceUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnUpdateReplaceAllUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -160,296 +160,6 @@ bool EE_COLLECTOR::IsDraggableJunction() const
}
/**
* A singleton item of this class is returned for a weak reference that no longer exists.
* Its sole purpose is to flag the item as having been deleted.
*/
class DELETED_SCH_ITEM : public SCH_ITEM
{
public:
DELETED_SCH_ITEM() :
SCH_ITEM( nullptr, NOT_USED )
{}
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override
{
return _( "(Deleted Item)" );
}
wxString GetClass() const override
{
return wxT( "DELETED_SCH_ITEM" );
}
// define pure virtuals:
wxPoint GetPosition() const override { return wxPoint(); }
void SetPosition( const wxPoint& ) override {}
void Draw( EDA_DRAW_PANEL* , wxDC* , const wxPoint& ) override {}
#if defined(DEBUG)
void Show( int , std::ostream& ) const override {}
#endif
void Move( const wxPoint& ) override {}
void MirrorY( int ) override {}
void MirrorX( int ) override {}
void Rotate( wxPoint ) override {}
};
DELETED_SCH_ITEM g_DeletedSchItem;
SCH_ITEM* SCH_FIND_COLLECTOR::GetItem( int ndx ) const
{
if( (unsigned)ndx >= (unsigned)GetCount() )
return NULL;
// Do not simply return m_List[ ndx ] as it might have been deleted. Instead
// treat it as a weak reference and search the sheets for an item with the same
// pointer value.
void* weakRef = m_List[ ndx ];
SCH_ITEM* item = &g_DeletedSchItem;
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* candidate, void* testData )
{
if( (void*) candidate == weakRef )
{
item = (SCH_ITEM*) candidate;
return SEARCH_QUIT;
}
return SEARCH_CONTINUE;
};
for( unsigned i = 0; i < m_sheetPaths.size(); i++ )
{
EDA_ITEM::IterateForward( m_sheetPaths[ i ].LastDrawList(),
inspector, nullptr, EE_COLLECTOR::AllItems );
}
return item;
}
SCH_ITEM* SCH_FIND_COLLECTOR::operator[]( int ndx ) const
{
return GetItem( ndx );
}
bool SCH_FIND_COLLECTOR::PassedEnd() const
{
bool retv = false;
wxUint32 flags = m_findReplaceData.GetFlags();
if( GetCount() == 0 )
return true;
if( !(flags & FR_SEARCH_WRAP) || (flags & FR_SEARCH_REPLACE) )
{
if( flags & wxFR_DOWN )
{
if( m_foundIndex >= GetCount() )
retv = true;
}
else
{
if( m_foundIndex < 0 )
retv = true;
}
}
return retv;
}
#if defined(DEBUG)
void SCH_FIND_COLLECTOR::dump()
{
int tmp = m_foundIndex;
wxLogTrace( traceFindReplace, wxT( "%d items found to replace %s with %s." ),
GetCount(), GetChars( m_findReplaceData.GetFindString() ),
GetChars( m_findReplaceData.GetReplaceString() ) );
for( m_foundIndex = 0; m_foundIndex < GetCount(); m_foundIndex++ )
wxLogTrace( traceFindReplace, wxT( " " ) + GetText( MILLIMETRES ) );
m_foundIndex = tmp;
}
#endif
void SCH_FIND_COLLECTOR::UpdateIndex()
{
wxUint32 flags = m_findReplaceData.GetFlags();
if( flags & wxFR_DOWN )
{
if( m_foundIndex < GetCount() )
m_foundIndex += 1;
if( (m_foundIndex >= GetCount()) && (flags & FR_SEARCH_WRAP) )
m_foundIndex = 0;
}
else
{
if( m_foundIndex >= 0 )
m_foundIndex -= 1;
if( (m_foundIndex < 0) && (flags & FR_SEARCH_WRAP) )
m_foundIndex = GetCount() - 1;
}
}
SCH_FIND_COLLECTOR_DATA SCH_FIND_COLLECTOR::GetFindData( int aIndex )
{
wxCHECK_MSG( (unsigned) aIndex < m_data.size(), SCH_FIND_COLLECTOR_DATA(),
wxT( "Attempt to get find data outside of list boundary." ) );
return m_data[ aIndex ];
}
wxString SCH_FIND_COLLECTOR::GetText( EDA_UNITS_T aUnits )
{
wxCHECK_MSG( (GetCount() != 0) && IsValidIndex( m_foundIndex ), wxEmptyString,
wxT( "Cannot get found item at invalid index." ) );
SCH_FIND_COLLECTOR_DATA data = m_data[ m_foundIndex ];
EDA_ITEM* foundItem = GetItem( m_foundIndex );
if( data.GetParent() )
{
return wxString::Format( _( "Match %i of %i: %s of %s in sheet %s" ),
m_foundIndex + 1,
GetCount(),
foundItem->GetSelectMenuText( aUnits ),
data.GetParent()->GetSelectMenuText( aUnits ),
data.GetSheetPath() );
}
else
{
return wxString::Format( _( "Match %i of %i: %s in sheet %s" ),
m_foundIndex + 1,
GetCount(),
foundItem->GetSelectMenuText( aUnits ),
data.GetSheetPath() );
}
}
EDA_ITEM* SCH_FIND_COLLECTOR::GetItem( SCH_FIND_COLLECTOR_DATA& aData )
{
if( PassedEnd() )
return NULL;
aData = m_data[ m_foundIndex ];
return GetItem( m_foundIndex );
}
bool SCH_FIND_COLLECTOR::ReplaceItem( SCH_SHEET_PATH* aSheetPath )
{
if( PassedEnd() )
return false;
wxCHECK_MSG( IsValidIndex( m_foundIndex ), false,
wxT( "Invalid replace list index in SCH_FIND_COLLECTOR." ) );
EDA_ITEM* item = GetItem( m_foundIndex );
bool replaced = item->Replace( m_findReplaceData, aSheetPath );
return replaced;
}
SEARCH_RESULT SCH_FIND_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
{
wxPoint position;
if( aItem->Matches( m_findReplaceData, m_currentSheetPath, &position ) )
{
if( aItem->Type() == SCH_PIN_T )
{
wxCHECK_MSG( aTestData && ( (EDA_ITEM*) aTestData )->Type() == SCH_COMPONENT_T,
SEARCH_CONTINUE, wxT( "Cannot inspect invalid data. Bad programmer!" ) );
// Pin positions are relative to their parent component's position and
// orientation in the schematic. The pin's position must be converted
// schematic coordinates.
SCH_COMPONENT* component = (SCH_COMPONENT*) aTestData;
TRANSFORM transform = component->GetTransform();
position.y = -position.y;
position = transform.TransformCoordinate( position ) + component->GetPosition();
}
Append( aItem );
aItem->SetBrightened();
m_data.push_back( SCH_FIND_COLLECTOR_DATA( position,
m_currentSheetPath->PathHumanReadable(),
(SCH_ITEM*) aTestData ) );
}
return SEARCH_CONTINUE;
}
void SCH_FIND_COLLECTOR::SetReplaceString( const wxString &aReplaceString )
{
m_findReplaceData.SetReplaceString( aReplaceString );
}
void SCH_FIND_COLLECTOR::Collect( SCH_FIND_REPLACE_DATA& aFindReplaceData,
SCH_SHEET_PATH* aSheetPath )
{
if( !IsSearchRequired( aFindReplaceData ) && !m_List.empty() && !m_forceSearch )
return;
m_findReplaceData = aFindReplaceData;
Empty(); // empty the collection just in case
m_data.clear();
m_foundIndex = 0;
m_sheetPaths.clear();
SetForceSearch( false );
if( aSheetPath )
{
m_currentSheetPath = aSheetPath;
m_sheetPaths.push_back( *m_currentSheetPath );
EDA_ITEM::IterateForward( aSheetPath->LastDrawList(), m_inspector, NULL, m_ScanTypes );
}
else
{
SCH_SHEET_LIST schematic( g_RootSheet );
for( unsigned i = 0; i < schematic.size(); i++ )
{
m_currentSheetPath = &schematic[i];
m_sheetPaths.push_back( *m_currentSheetPath );
EDA_ITEM::IterateForward( m_currentSheetPath->LastDrawList(), m_inspector, NULL, m_ScanTypes );
}
}
#if defined(DEBUG)
dump();
#endif
if( m_List.size() != m_data.size() )
{
wxFAIL_MSG( wxT( "List size mismatch." ) );
m_List.clear();
m_data.clear();
}
}
SEARCH_RESULT EE_TYPE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* testData )
{
// The Vist() function only visits the testItem if its type was in the

View File

@ -45,6 +45,8 @@ public:
static const KICAD_T SheetsOnly[];
EE_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems ) :
m_Unit( 0 ),
m_Convert( 0 ),
m_Threshold( 0 ),
m_MenuCancelled( false )
{
@ -114,203 +116,6 @@ public:
};
/**
* Class SCH_FIND_COLLECTOR_DATA
* is used as a data container for the associated item found by the #SCH_FIND_COLLECTOR
* object.
*/
class SCH_FIND_COLLECTOR_DATA
{
/// The position in drawing units of the found item.
wxPoint m_position;
/// The human readable sheet path @see SCH_SHEET_PATH::PathHumanReadable() of the found item.
wxString m_sheetPath;
/// The parent object if the item found is a child object.
SCH_ITEM* m_parent;
public:
SCH_FIND_COLLECTOR_DATA( const wxPoint& aPosition = wxDefaultPosition,
const wxString& aSheetPath = wxEmptyString,
SCH_ITEM* aParent = NULL )
: m_position( aPosition )
, m_sheetPath( aSheetPath )
, m_parent( aParent )
{ }
wxPoint GetPosition() const { return m_position; }
wxString GetSheetPath() const { return m_sheetPath; }
SCH_ITEM* GetParent() const { return m_parent; }
};
/**
* Class SCH_FIND_COLLECTOR
* is used to iterate over all of the items in a schematic or sheet and collect all
* the items that match the given search criteria.
*/
class SCH_FIND_COLLECTOR : public COLLECTOR
{
/// Data associated with each found item.
std::vector< SCH_FIND_COLLECTOR_DATA > m_data;
/// The criteria used to test for matching items.
SCH_FIND_REPLACE_DATA m_findReplaceData;
/// The path of the sheet *currently* being iterated over.
SCH_SHEET_PATH* m_currentSheetPath;
/// The paths of the all the sheets in the collector.
SCH_SHEET_PATHS m_sheetPaths;
/// The current found item list index.
int m_foundIndex;
/// A flag to indicate that the schemtic has been modified and a new search must be
/// performed even if the search criteria hasn't changed.
bool m_forceSearch;
/// last known library change hash, used to detect library changes which
/// should trigger cache obsolescence.
int m_lib_hash;
/**
* Function dump
* is a helper to dump the items in the find list for debugging purposes.
*/
#if defined(DEBUG)
void dump();
#endif
public:
/**
* Constructor SCH_FIND_COLLECTOR
*/
SCH_FIND_COLLECTOR( const KICAD_T* aScanTypes = EE_COLLECTOR::AllItems )
{
SetScanTypes( aScanTypes );
m_foundIndex = 0;
SetForceSearch( false );
m_currentSheetPath = NULL;
m_lib_hash = 0;
}
void Empty()
{
m_foundIndex = 0;
COLLECTOR::Empty();
m_data.clear();
}
SCH_ITEM* GetItem( int ndx ) const;
SCH_ITEM* operator[]( int ndx ) const override;
void SetForceSearch( bool doSearch = true ) { m_forceSearch = doSearch; }
int GetLibHash() const { return m_lib_hash; }
void SetLibHash( int aHash ) { m_lib_hash = aHash; }
int GetFoundIndex() const { return m_foundIndex; }
void SetFoundIndex( int aIndex )
{
m_foundIndex = ( (unsigned) aIndex < m_data.size() ) ? aIndex : 0;
}
/**
* Function PassedEnd
* tests if #m_foundIndex is beyond the end of the list give the current
* find/replace criterial in #m_findReplaceData.
*
* @return True if #m_foundIndex has crossed the end of the found item list.
*/
bool PassedEnd() const;
/**
* Function UpdateIndex
* updates the list index according to the current find and replace criteria.
*/
void UpdateIndex();
/**
* Function GetFindData
* returns the data associated with the item found at \a aIndex.
*
* @param aIndex The list index of the data to return.
* @return The associated found item data at \a aIndex if \a aIndex is within the
* list limits. Otherwise an empty data item will be returned.
*/
SCH_FIND_COLLECTOR_DATA GetFindData( int aIndex );
/**
* Function IsSearchRequired
* checks the current collector state against \a aFindReplaceData to see if a new search
* needs to be performed to update the collector.
*
* @param aFindReplaceData A #SCH_FIND_REPLACE_DATA object containing the search criteria
* to test for changes against the current search criteria.
* @return True if \a aFindReplaceData would require a new search to be performaed or
* the force search flag is true. Otherwise, false is returned.
*/
bool IsSearchRequired( const SCH_FIND_REPLACE_DATA& aFindReplaceData )
{
return m_findReplaceData.ChangesCompare( aFindReplaceData ) || m_forceSearch ||
(m_findReplaceData.IsWrapping() != aFindReplaceData.IsWrapping());
}
/**
* Function GetText()
* @return A wxString object containing the description of the item found at the
* current index or a wxEmptyString if the list is empty or the index is
* invalid.
*/
wxString GetText( EDA_UNITS_T aUnits );
/**
* Function GetItem
* returns the item and associated data of the current index.
*
* @param aFindData A reference to a #SCH_FIND_COLLECTOR_DATA object to place the
* associated data for the current item into if the current item
* index is valid.
* @return A pointer to the current #EDA_ITEM in the list if the list index is valid
* Otherwise NULL is returned and the \a aFindData object is not updated.
*/
EDA_ITEM* GetItem( SCH_FIND_COLLECTOR_DATA& aFindData );
/**
* Function ReplaceItem
* performs a string replace of the item at the current index.
*
* @return True if the text replace occurred otherwise false.
*/
bool ReplaceItem( SCH_SHEET_PATH* aSheetPath = NULL );
SEARCH_RESULT Inspect( EDA_ITEM* aItem, void* aTestData ) override;
/**
* Update the replace string without changing anything else.
*/
void SetReplaceString( const wxString &aReplaceString );
/**
* Function Collect
* scans \a aSheetPath using this class's Inspector method for items matching
* \a aFindReplaceData.
*
* @param aFindReplaceData A #SCH_FIND_REPLACE_DATA object containing the search criteria.
* @param aSheetPath A pointer to a #SCH_SHEET_PATH object to test for matches. A NULL
* value searches the entire schematic hierarchy.
*/
void Collect( SCH_FIND_REPLACE_DATA& aFindReplaceData, SCH_SHEET_PATH* aSheetPath = NULL );
void IncrementIndex() { m_foundIndex += 1; }
};
/**
* Class EE_TYPE_COLLECTOR
* merely gathers up all SCH_ITEMs of a given set of KICAD_T type(s). It does

View File

@ -168,10 +168,8 @@ static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
static EDA_HOTKEY HkFind( _HKI( "Find" ), HK_FIND, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkReplace( _HKI( "Find and Replace" ), HK_REPLACE, 'F' + GR_KB_CTRL + GR_KB_ALT );
static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5,
wxEVT_COMMAND_FIND );
static EDA_HOTKEY HkFindNextMarker( _HKI( "Find Next Marker" ), HK_FIND_NEXT_DRC_MARKER, WXK_F5 + GR_KB_SHIFT,
EVT_COMMAND_FIND_DRC_MARKER );
static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next" ), HK_FIND_NEXT, WXK_F5 );
static EDA_HOTKEY HkFindNextMarker( _HKI( "Find Next Marker" ), HK_FIND_NEXT_MARKER, WXK_F5 + GR_KB_SHIFT );
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5,
ID_ZOOM_SELECTION );
@ -439,27 +437,6 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
case HK_FIND:
case HK_REPLACE:
if( EE_CONDITIONS::Idle( selection ) )
{
cmd.SetId( hotKey->m_IdMenuEvent );
GetEventHandler()->ProcessEvent( cmd );
}
break;
case HK_FIND_NEXT_ITEM:
case HK_FIND_NEXT_DRC_MARKER:
if( EE_CONDITIONS::Idle( selection ) )
{
wxFindDialogEvent event( hotKey->m_IdMenuEvent, GetId() );
event.SetEventObject( this );
event.SetFlags( m_findReplaceData->GetFlags() );
event.SetFindString( m_findReplaceData->GetFindString() );
GetEventHandler()->ProcessEvent( event );
}
break;
case HK_CANVAS_CAIRO:
case HK_CANVAS_OPENGL:
{
@ -493,9 +470,7 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( aHotKey == 0 )
return false;
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
EE_SELECTION_TOOL* selTool = GetToolManager()->GetTool<EE_SELECTION_TOOL>();
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
/* Convert lower to upper case (the usual toupper function has problem

View File

@ -34,10 +34,7 @@
// see also enum common_hotkey_id_command in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_command {
HK_FIND_NEXT_ITEM = HK_COMMON_END,
HK_FIND_NEXT_DRC_MARKER,
HK_DELETE,
HK_REPEAT_LAST,
HK_REPEAT_LAST = HK_COMMON_END,
HK_LIBEDIT_CREATE_PIN,
HK_LIBEDIT_VIEW_DOC,
HK_ROTATE,

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see change_log.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
@ -23,22 +23,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file eeschema/find.cpp
* @brief Functions for searching for a schematic item.
*/
/*
* Search a text (text, value, reference) within a component or
* search a component in libraries, a marker ...,
* in current sheet or whole the project
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <kicad_string.h>
#include <gestfich.h>
#include <sch_edit_frame.h>
#include <base_units.h>
#include <trace_helpers.h>
@ -46,65 +33,9 @@
#include <general.h>
#include <class_library.h>
#include <lib_pin.h>
#include <sch_marker.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <symbol_lib_table.h>
#include <kicad_device_context.h>
#include <dialogs/dialog_schematic_find.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
static SCH_MARKER* lastMarker = NULL;
wxString msg;
SCH_SHEET_LIST schematic( g_RootSheet );
SCH_SHEET_PATH* sheetFoundIn = NULL;
bool wrap = ( event.GetFlags() & FR_SEARCH_WRAP ) != 0;
bool warpCursor = ( ( event.GetId() == wxEVT_COMMAND_FIND_CLOSE ) ||
!( event.GetFlags() & FR_NO_WARP_CURSOR ) );
if( event.GetFlags() & FR_CURRENT_SHEET_ONLY )
{
sheetFoundIn = g_CurrentSheet;
lastMarker = (SCH_MARKER*) g_CurrentSheet->FindNextItem( SCH_MARKER_T, lastMarker, wrap );
}
else
{
lastMarker = (SCH_MARKER*) schematic.FindNextItem( SCH_MARKER_T, &sheetFoundIn,
lastMarker, wrap );
}
if( lastMarker != NULL )
{
if( *sheetFoundIn != *g_CurrentSheet )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*g_CurrentSheet = *sheetFoundIn;
g_CurrentSheet->UpdateAllScreenReferences();
}
SetCrossHairPosition( lastMarker->GetPosition() );
CenterScreen( lastMarker->GetPosition(), warpCursor );
msg.Printf( _( "Design rule check marker found in sheet %s at %s, %s" ),
sheetFoundIn->Path(),
MessageTextFromValue( m_UserUnits, lastMarker->GetPosition().x ),
MessageTextFromValue( m_UserUnits, lastMarker->GetPosition().y ) );
SetStatusText( msg );
}
else
{
SetStatusText( _( "No more markers were found." ) );
}
}
SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
@ -243,210 +174,3 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
return item;
}
bool SCH_EDIT_FRAME::IsSearchCacheObsolete( const SCH_FIND_REPLACE_DATA& aSearchCriteria )
{
int mod_hash = Prj().SchSymbolLibTable()->GetModifyHash();
// the cache is obsolete whenever any library changes.
if( mod_hash != m_foundItems.GetLibHash() )
{
m_foundItems.SetForceSearch();
m_foundItems.SetLibHash( mod_hash );
return true;
}
else if( m_foundItems.IsSearchRequired( aSearchCriteria ) )
return true;
else
return false;
}
void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
SCH_FIND_REPLACE_DATA searchCriteria;
SCH_FIND_COLLECTOR_DATA data;
searchCriteria.SetFlags( aEvent.GetFlags() );
searchCriteria.SetFindString( aEvent.GetFindString() );
searchCriteria.SetReplaceString( aEvent.GetReplaceString() );
if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
{
if( m_foundItems.GetCount() == 0 )
return;
selectionTool->ClearBrightening();
}
else if( IsSearchCacheObsolete( searchCriteria ) )
{
if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
m_foundItems.Collect( searchCriteria, g_CurrentSheet );
else
m_foundItems.Collect( searchCriteria );
for( EDA_ITEM* item : m_foundItems )
selectionTool->BrightenItem( item );
}
else
{
EDA_ITEM* currentItem = m_foundItems.GetItem( data );
if( currentItem != NULL )
currentItem->SetForceVisible( false );
m_foundItems.UpdateIndex();
}
updateFindReplaceView( aEvent );
}
void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
{
EE_SELECTION_TOOL* selectionTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
EDA_ITEM* item;
SCH_SHEET_PATH* sheet;
SCH_SHEET_LIST schematic( g_RootSheet );
SCH_FIND_COLLECTOR_DATA data;
SCH_FIND_REPLACE_DATA searchCriteria;
searchCriteria.SetFlags( aEvent.GetFlags() );
searchCriteria.SetFindString( aEvent.GetFindString() );
searchCriteria.SetReplaceString( aEvent.GetReplaceString() );
m_foundItems.SetReplaceString( aEvent.GetReplaceString() );
if( IsSearchCacheObsolete( searchCriteria ) )
{
if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
m_foundItems.Collect( searchCriteria, g_CurrentSheet );
else
m_foundItems.Collect( searchCriteria );
for( EDA_ITEM* foundItem : m_foundItems )
selectionTool->BrightenItem( foundItem );
}
if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_REPLACE_ALL )
{
while( ( item = m_foundItems.GetItem( data ) ) != NULL )
{
SCH_ITEM* undoItem = data.GetParent();
// Don't save child items in undo list.
if( undoItem == NULL )
undoItem = (SCH_ITEM*) item;
sheet = schematic.GetSheetByPath( data.GetSheetPath() );
wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) + data.GetSheetPath() );
if( m_foundItems.ReplaceItem( sheet ) )
{
GetCanvas()->GetView()->Update( undoItem, KIGFX::ALL );
OnModify();
SaveUndoItemInUndoList( undoItem );
updateFindReplaceView( aEvent );
}
m_foundItems.IncrementIndex();
if( m_foundItems.PassedEnd() )
break;
}
}
else
{
item = m_foundItems.GetItem( data );
wxCHECK_RET( item != NULL, wxT( "Invalid replace item in find collector list." ) );
SCH_ITEM* undoItem = data.GetParent();
if( undoItem == NULL )
undoItem = (SCH_ITEM*) item;
sheet = schematic.GetSheetByPath( data.GetSheetPath() );
wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) + data.GetSheetPath() );
if( m_foundItems.ReplaceItem( sheet ) )
{
GetCanvas()->GetView()->Update( undoItem, KIGFX::ALL );
OnModify();
SaveUndoItemInUndoList( undoItem );
updateFindReplaceView( aEvent );
// A single replace is part of the search; it does not dirty it.
m_foundItems.SetForceSearch( false );
}
m_foundItems.IncrementIndex();
}
// End the replace if we are at the end if the list. This prevents an infinite loop if
// wrap search is selected and all of the items have been replaced with a value that
// still satisfies the search criteria.
if( m_foundItems.PassedEnd() )
aEvent.SetFlags( aEvent.GetFlags() & ~FR_REPLACE_ITEM_FOUND );
}
void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
{
wxString msg;
SCH_SHEET_LIST schematic( g_RootSheet );
SCH_FIND_COLLECTOR_DATA data;
bool warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
if( m_foundItems.GetItem( data ) != NULL )
{
wxLogTrace( traceFindReplace, wxT( "Found " ) + m_foundItems.GetText( MILLIMETRES ) );
SCH_SHEET_PATH* sheet = schematic.GetSheetByPath( data.GetSheetPath() );
wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " ) +
data.GetSheetPath() );
SCH_ITEM* item = (SCH_ITEM*)m_foundItems.GetItem( data );
// Make the item temporarily visible just in case it's hide flag is set. This
// has no effect on objects that don't support hiding. If this is a close find
// dialog event, clear the temporary visibility flag.
if( item )
{
if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
item->SetForceVisible( false );
else if( item->Type() == SCH_FIELD_T && !( (SCH_FIELD*) item )->IsVisible() )
item->SetForceVisible( true );
}
if( sheet->PathHumanReadable() != g_CurrentSheet->PathHumanReadable() )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*g_CurrentSheet = *sheet;
g_CurrentSheet->UpdateAllScreenReferences();
SetScreen( sheet->LastScreen() );
sheet->LastScreen()->TestDanglingEnds();
}
SetCrossHairPosition( data.GetPosition() );
CenterScreen( data.GetPosition(), warpCursor );
msg = m_foundItems.GetText( m_UserUnits );
if( aEvent.GetFlags() & FR_SEARCH_REPLACE )
aEvent.SetFlags( aEvent.GetFlags() | FR_REPLACE_ITEM_FOUND );
}
else
{
if( aEvent.GetFlags() & FR_SEARCH_REPLACE )
aEvent.SetFlags( aEvent.GetFlags() & ~FR_REPLACE_ITEM_FOUND );
msg.Printf( _( "No item found matching %s." ), GetChars( aEvent.GetFindString() ) );
}
*m_findReplaceStatus = msg;
SetStatusText( msg );
}

View File

@ -270,7 +270,6 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
// update the References
g_CurrentSheet->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->SetCanStartBlock( -1 );
if( !screen->m_Initialized )
{

View File

@ -1673,7 +1673,7 @@ wxString LIB_PIN::GetSelectMenuText( EDA_UNITS_T aUnits ) const
}
bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxDat )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
@ -1685,15 +1685,8 @@ bool LIB_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint*
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
if( EDA_ITEM::Matches( GetName(), aSearchData ) || EDA_ITEM::Matches( m_number, aSearchData ) )
{
if( aFindLocation )
*aFindLocation = GetBoundingBox().Centre();
return true;
}
return false;
return EDA_ITEM::Matches( GetName(), aSearchData )
|| EDA_ITEM::Matches( m_number, aSearchData );
}

View File

@ -123,7 +123,7 @@ public:
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList,
SCH_COMPONENT* aComponent );
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
/* Cannot use a default parameter here as it will not be compatible with the virtual. */
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false ); }

View File

@ -101,7 +101,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Find
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::replace, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::findAndReplace, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
// Update field values

View File

@ -1505,8 +1505,7 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition )
}
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
wxPoint* aFindLocation )
bool SCH_COMPONENT::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );

View File

@ -550,7 +550,7 @@ public:
void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
void GetEndPoints( std::vector<DANGLING_END_ITEM>& aItemList ) override;

View File

@ -278,13 +278,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
/* Search dialog events. */
EVT_FIND_CLOSE( wxID_ANY, SCH_EDIT_FRAME::OnFindDialogClose )
EVT_FIND_DRC_MARKER( wxID_ANY, SCH_EDIT_FRAME::OnFindDrcMarker )
EVT_FIND( wxID_ANY, SCH_EDIT_FRAME::OnFindSchematicItem )
EVT_FIND_REPLACE( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
EVT_FIND_REPLACE_ALL( wxID_ANY, SCH_EDIT_FRAME::OnFindReplace )
END_EVENT_TABLE()
@ -305,14 +298,15 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_printSheetReference = true;
SetShowPageLimits( true );
m_hotkeysDescrList = g_Schematic_Hotkeys_Descr;
m_dlgFindReplace = NULL;
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_findReplaceStatus = new wxString( wxEmptyString );
m_undoItem = NULL;
m_hasAutoSave = true;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
m_AboutTitle = "Eeschema";
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
m_findReplaceDialog = nullptr;
m_findReplaceStatusPopup = nullptr;
SetForceHVLines( true );
SetSpiceAjustPassiveValues( false );
@ -385,7 +379,6 @@ SCH_EDIT_FRAME::~SCH_EDIT_FRAME()
delete g_ConnectionGraph;
delete m_undoItem;
delete m_findReplaceData;
delete m_findReplaceStatus;
delete g_RootSheet;
g_CurrentSheet = nullptr;
@ -635,12 +628,15 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
}
// Close the find dialog and preserve it's setting if it is displayed.
if( m_dlgFindReplace )
if( m_findReplaceDialog )
{
m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
m_dlgFindReplace->Destroy();
m_dlgFindReplace = NULL;
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = nullptr;
m_findReplaceStatusPopup->Destroy();
m_findReplaceStatusPopup = nullptr;
}
SCH_SCREENS screens;
@ -726,8 +722,6 @@ void SCH_EDIT_FRAME::OnModify()
GetScreen()->SetModify();
GetScreen()->SetSave();
m_foundItems.SetForceSearch();
if( ADVANCED_CFG::GetCfg().m_realTimeConnectivity && CONNECTION_GRAPH::m_allowRealTime )
RecalculateConnections( false );
@ -826,15 +820,24 @@ void SCH_EDIT_FRAME::OnLaunchBusManager( wxCommandEvent& )
}
void SCH_EDIT_FRAME::DoFindReplace( bool aReplace )
wxFindReplaceData* SCH_EDIT_FRAME::GetFindReplaceData()
{
wxCHECK_RET( m_findReplaceData != NULL,
wxT( "Forgot to create find/replace data. Bad Programmer!" ) );
if( m_dlgFindReplace )
if( m_findReplaceDialog && m_findReplaceDialog->IsVisible()
&& !m_findReplaceData->GetFindString().IsEmpty() )
{
delete m_dlgFindReplace;
m_dlgFindReplace = NULL;
return m_findReplaceData;
}
return nullptr;
}
void SCH_EDIT_FRAME::ShowFindReplaceDialog( bool aReplace )
{
if( m_findReplaceDialog )
{
delete m_findReplaceDialog;
delete m_findReplaceStatusPopup;
}
int style = 0;
@ -842,28 +845,40 @@ void SCH_EDIT_FRAME::DoFindReplace( bool aReplace )
if( aReplace )
style = wxFR_REPLACEDIALOG;
m_dlgFindReplace = new DIALOG_SCH_FIND( this, m_findReplaceData, m_findReplaceStatus,
wxDefaultPosition, wxDefaultSize, style );
m_findReplaceDialog = new DIALOG_SCH_FIND( this, m_findReplaceData, wxDefaultPosition,
wxDefaultSize, style );
m_dlgFindReplace->SetFindEntries( m_findStringHistoryList );
m_dlgFindReplace->SetReplaceEntries( m_replaceStringHistoryList );
m_dlgFindReplace->Show( true );
m_findReplaceDialog->SetFindEntries( m_findStringHistoryList );
m_findReplaceDialog->SetReplaceEntries( m_replaceStringHistoryList );
m_findReplaceDialog->Show( true );
m_findReplaceStatusPopup = new STATUS_TEXT_POPUP( m_findReplaceDialog );
m_findReplaceStatusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
}
void SCH_EDIT_FRAME::OnFindDialogClose( wxFindDialogEvent& event )
void SCH_EDIT_FRAME::ShowFindReplaceStatus( const wxString& aMsg )
{
// If the user dismissed the dialog with the mouse, this will send the cursor back
// to the last item found.
OnFindSchematicItem( event );
wxPoint pos = wxGetMousePosition() - m_findReplaceStatusPopup->GetSize() - wxPoint( 10, 10 );
if( m_dlgFindReplace )
{
m_findStringHistoryList = m_dlgFindReplace->GetFindEntries();
m_replaceStringHistoryList = m_dlgFindReplace->GetReplaceEntries();
m_dlgFindReplace->Destroy();
m_dlgFindReplace = NULL;
}
m_findReplaceStatusPopup->SetText( aMsg );
m_findReplaceStatusPopup->Move( pos );
m_findReplaceStatusPopup->PopupFor( 3000 );
}
void SCH_EDIT_FRAME::ClearFindReplaceStatus()
{
m_findReplaceStatusPopup->Hide();
}
void SCH_EDIT_FRAME::OnFindDialogClose()
{
m_findStringHistoryList = m_findReplaceDialog->GetFindEntries();
m_replaceStringHistoryList = m_findReplaceDialog->GetReplaceEntries();
m_findReplaceDialog->Destroy();
m_findReplaceDialog = NULL;
}

View File

@ -39,6 +39,7 @@
// enum PINSHEETLABEL_SHAPE
#include <sch_text.h>
#include <tool/selection.h>
#include <status_popup.h>
class SCH_ITEM;
class EDA_ITEM;
@ -112,16 +113,10 @@ private:
PARAM_CFG_ARRAY m_configSettings;
ERC_SETTINGS m_ercSettings;
wxPageSetupDialogData m_pageSetupData;
wxFindReplaceData* m_findReplaceData;
wxString* m_findReplaceStatus;
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printSheetReference;
DIALOG_SCH_FIND* m_dlgFindReplace;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command.
int m_repeatLabelDelta; ///< Repeat label number increment step.
SCH_FIND_COLLECTOR m_foundItems; ///< List of find/replace items.
SCH_ITEM* m_undoItem; ///< Copy of the current item being edited.
wxString m_simulatorCommand; ///< Command line used to call the circuit
///< simulator (gnucap, spice, ...)
@ -137,8 +132,11 @@ private:
bool m_autoplaceAlign; ///< align autoplaced fields to the grid
bool m_footprintPreview; ///< whether to show footprint previews
/// An index to the last find item in the found items list #m_foundItems.
int m_foundItemIndex;
wxFindReplaceData* m_findReplaceData;
DIALOG_SCH_FIND* m_findReplaceDialog;
STATUS_TEXT_POPUP* m_findReplaceStatusPopup;
wxArrayString m_findStringHistoryList;
wxArrayString m_replaceStringHistoryList;
/// Flag to indicate show hidden pins.
bool m_showAllPins;
@ -181,8 +179,6 @@ protected:
*/
virtual bool isAutoSaveRequired() const override;
void updateFindReplaceView( wxFindDialogEvent& aEvent );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences );
/**
@ -361,7 +357,20 @@ public:
/**
* Run the Find or Find & Replace dialog.
*/
void DoFindReplace( bool aReplace );
void ShowFindReplaceDialog( bool aReplace );
void ShowFindReplaceStatus( const wxString& aMsg );
void ClearFindReplaceStatus();
/**
* Get the find criteria (as set by the dialog).
*/
wxFindReplaceData* GetFindReplaceData();
/**
* Notification that the Find dialog has closed.
*/
void OnFindDialogClose();
/**
* Breaks a single segment into two at the specified point.
@ -697,9 +706,6 @@ public:
bool aSaveUnderNewName = false,
bool aCreateBackupFile = CREATE_BACKUP_FILE );
// General search:
bool IsSearchCacheObsolete( const SCH_FIND_REPLACE_DATA& aSearchCriteria );
/**
* Checks if any of the screens has unsaved changes and asks the user whether to save or
@ -758,23 +764,6 @@ private:
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnLaunchBomManager( wxCommandEvent& event );
void OnLaunchBusManager( wxCommandEvent& event );
void OnFindDialogClose( wxFindDialogEvent& event );
void OnFindDrcMarker( wxFindDialogEvent& event );
/**
* Find an item in the schematic matching the search criteria in \a aEvent.
*
* @param aEvent - Find dialog event containing the find parameters.
*/
void OnFindSchematicItem( wxFindDialogEvent& aEvent );
/**
* Perform a search and replace of text in an item in the schematic matching the
* search and replace criteria in \a aEvent.
*
* @param aEvent - Find dialog event containing the search and replace parameters.
*/
void OnFindReplace( wxFindDialogEvent& aEvent );
void OnLoadFile( wxCommandEvent& event );
void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event );

View File

@ -320,15 +320,16 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
}
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
bool match;
wxString text = GetFullyQualifiedText();
// User defined fields have an ID of -1.
if( ((m_id > VALUE || m_id < REFERENCE) && !(aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS))
|| ((m_id == REFERENCE) && !(aSearchData.GetFlags() & FR_REPLACE_REFERENCES)) )
{
return false;
}
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
@ -346,17 +347,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
text << LIB_PART::SubReference( component->GetUnit() );
}
match = SCH_ITEM::Matches( text, aSearchData );
if( match )
{
if( aFindLocation )
*aFindLocation = GetBoundingBox().Centre();
return true;
}
return false;
return SCH_ITEM::Matches( text, aSearchData );
}

View File

@ -182,7 +182,7 @@ public:
{
}
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;

View File

@ -87,20 +87,11 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
}
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
wxPoint * aFindLocation )
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
if( SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData ) ||
SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ||
SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) )
{
if( aFindLocation )
*aFindLocation = m_Pos;
return true;
}
return false;
return SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData )
|| SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData )
|| SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData );
}

View File

@ -79,7 +79,7 @@ public:
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if the DRC main or auxiliary text matches the search criteria.
*/
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxDat ) override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM >& aList ) override;

View File

@ -225,11 +225,12 @@ bool SCH_PAINTER::isUnitAndConversionShown( const LIB_ITEM* aItem )
COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aOnBackgroundLayer )
{
if( aItem->IsBrightened() )
return m_schSettings.GetLayerColor( LAYER_BRIGHTENED );
COLOR4D color = m_schSettings.GetLayerColor( aLayer );
const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
COLOR4D color = line ? line->GetLineColor() : m_schSettings.GetLayerColor( aLayer );
if( aItem->IsBrightened() )
color = m_schSettings.GetLayerColor( LAYER_BRIGHTENED );
else if( aItem->Type() == SCH_LINE_T )
color = static_cast<const SCH_LINE*>( aItem )->GetLineColor();
if( aItem->IsSelected() )
{

View File

@ -714,7 +714,7 @@ void SCH_SHEET::Resize( const wxSize& aSize )
}
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
@ -722,17 +722,11 @@ bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
if( !(aSearchData.GetFlags() & FR_SEARCH_REPLACE)
&& SCH_ITEM::Matches( m_fileName, aSearchData ) )
{
if( aFindLocation )
*aFindLocation = GetFileNamePosition();
return true;
}
if( SCH_ITEM::Matches( m_name, aSearchData ) )
{
if( aFindLocation )
*aFindLocation = GetSheetNamePosition();
return true;
}

View File

@ -167,7 +167,7 @@ public:
void MirrorY( int aYaxis_position ) override;
void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override
{
@ -476,7 +476,7 @@ public:
void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData = NULL ) override;

View File

@ -797,3 +797,15 @@ SCH_SHEET* SCH_SHEET_LIST::FindSheetByName( const wxString& aSheetName )
return NULL;
}
SCH_SHEET_PATH* SCH_SHEET_LIST::FindSheetForScreen( SCH_SCREEN* aScreen )
{
for( SCH_SHEET_PATH& sheetpath : *this )
{
if( sheetpath.LastScreen() == aScreen )
return &sheetpath;
}
return nullptr;
}

View File

@ -520,6 +520,13 @@ public:
*/
SCH_SHEET* FindSheetByName( const wxString& aSheetName );
/**
* Function FindSheetForScreen
*
* returns the first sheetPath (not necessarily the only one) using a particular screen
*/
SCH_SHEET_PATH* FindSheetForScreen( SCH_SCREEN* aScreen );
/**
* Function BuildSheetList
* builds the list of sheets and their sheet path from \a aSheet.

View File

@ -196,23 +196,14 @@ void SCH_SHEET_PIN::ConstrainOnEdge( wxPoint Pos )
}
bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData,
void* aAuxData, wxPoint* aFindLocation )
bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
wxCHECK_MSG( GetParent() != NULL, false,
wxT( "Sheet pin " ) + m_Text + wxT( " does not have a parent sheet!" ) );
wxLogTrace( traceFindItem, wxT( " child item " ) + GetSelectMenuText( MILLIMETRES ) );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
if( aFindLocation )
*aFindLocation = GetBoundingBox().Centre();
return true;
}
return false;
return SCH_ITEM::Matches( m_Text, aSearchData );
}

View File

@ -162,21 +162,11 @@ wxPoint SCH_TEXT::GetSchematicTextOffset() const
}
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint * aFindLocation )
bool SCH_TEXT::Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
wxLogTrace( traceFindItem, wxT( " item " ) + GetSelectMenuText( MILLIMETRES ) );
if( SCH_ITEM::Matches( m_Text, aSearchData ) )
{
EDA_RECT BoundaryBox = GetBoundingBox();
if( aFindLocation )
*aFindLocation = BoundaryBox.Centre();
return true;
}
return false;
return SCH_ITEM::Matches( m_Text, aSearchData );
}

View File

@ -161,7 +161,7 @@ public:
void MirrorX( int aXaxis_position ) override;
void Rotate( wxPoint aPosition ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) override;
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override
{

View File

@ -84,7 +84,7 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::find );
m_mainToolBar->Add( ACTIONS::replace );
m_mainToolBar->Add( ACTIONS::findAndReplace );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );

View File

@ -46,10 +46,10 @@ OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
return EE_ACTIONS::unfoldBus.MakeEvent();
case ID_MOUSE_CLICK:
return EE_ACTIONS::cursorClick.MakeEvent();
return ACTIONS::cursorClick.MakeEvent();
case ID_MOUSE_DOUBLECLICK:
return EE_ACTIONS::cursorDblClick.MakeEvent();
return ACTIONS::cursorDblClick.MakeEvent();
}
return OPT<TOOL_EVENT>();

View File

@ -154,11 +154,6 @@ public:
static TOOL_ACTION editWithLibEdit;
static TOOL_ACTION showLibraryBrowser;
/// Clipboard
static TOOL_ACTION cut;
static TOOL_ACTION copy;
static TOOL_ACTION paste;
// Miscellaneous
static TOOL_ACTION enterSheet;
static TOOL_ACTION leaveSheet;

View File

@ -39,7 +39,6 @@
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tools/sch_wire_bus_tool.h>
#include <ee_actions.h>
#include <ee_collectors.h>
#include <painter.h>
#include <eeschema_id.h>
@ -265,7 +264,7 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
}
else
// Restore previous properties of selected items and remove them from containers
clearSelection();
ClearSelection();
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
getView()->Remove( &m_selection );
@ -341,7 +340,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
// If no modifier keys are pressed, clear the selection
if( !m_additive )
clearSelection();
ClearSelection();
SelectPoint( evt->Position());
}
@ -359,7 +358,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
if( !selectionCancelled )
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selection );
}
// double click? Display the properties window
@ -404,7 +403,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else
{
// No -> clear the selection list
clearSelection();
ClearSelection();
}
}
}
@ -432,13 +431,13 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
else if( evt->IsAction( &ACTIONS::cancelInteractive ) || evt->IsCancel() )
{
clearSelection();
ClearSelection();
m_toolMgr->RunAction( EE_ACTIONS::clearHighlight, true );
}
else if( evt->Action() == TA_UNDO_REDO_PRE )
{
clearSelection();
ClearSelection();
}
else if( evt->Action() == TA_CONTEXT_MENU_CLOSED )
@ -523,7 +522,7 @@ EDA_ITEM* EE_SELECTION_TOOL::SelectPoint( const VECTOR2I& aWhere, const KICAD_T*
}
if( !m_additive && anyCollected )
clearSelection();
ClearSelection();
return nullptr;
}
@ -596,7 +595,7 @@ SELECTION& EE_SELECTION_TOOL::RequestSelection( const KICAD_T aFilterList[] )
{
VECTOR2D cursorPos = getViewControls()->GetCursorPosition( true );
clearSelection();
ClearSelection();
SelectPoint( cursorPos, aFilterList );
m_selection.SetIsHover( true );
m_selection.ClearReferencePoint();
@ -878,28 +877,15 @@ void EE_SELECTION_TOOL::BrightenItem( EDA_ITEM* aItem )
}
void EE_SELECTION_TOOL::ClearBrightening()
void EE_SELECTION_TOOL::UnbrightenItem( EDA_ITEM* aItem )
{
EDA_ITEM* start = nullptr;
if( m_isLibEdit )
start = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
else
start = m_frame->GetScreen()->GetDrawItems();
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
{
unhighlight( item, BRIGHTENED );
return SEARCH_CONTINUE;
};
EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );
unhighlight( aItem, BRIGHTENED );
}
int EE_SELECTION_TOOL::ClearSelection( const TOOL_EVENT& aEvent )
{
clearSelection();
ClearSelection();
return 0;
}
@ -1065,7 +1051,7 @@ bool EE_SELECTION_TOOL::selectable( const EDA_ITEM* aItem, bool checkVisibilityO
}
void EE_SELECTION_TOOL::clearSelection()
void EE_SELECTION_TOOL::ClearSelection()
{
if( m_selection.Empty() )
return;
@ -1095,7 +1081,7 @@ void EE_SELECTION_TOOL::toggleSelection( EDA_ITEM* aItem, bool aForce )
else
{
if( !m_additive )
clearSelection();
ClearSelection();
// Prevent selection of invisible or inactive items
if( aForce || selectable( aItem ) )

View File

@ -33,7 +33,6 @@
class SCH_BASE_FRAME;
class SCH_ITEM;
class EE_COLLECTOR;
namespace KIGFX
{
@ -117,7 +116,7 @@ public:
void RemoveItemsFromSel( EDA_ITEMS* aList, bool aQuietMode = false );
void BrightenItem( EDA_ITEM* aItem );
void ClearBrightening();
void UnbrightenItem( EDA_ITEM* aItem );
///> Find (but don't select) node under cursor
EDA_ITEM* GetNode( VECTOR2I aPosition );
@ -131,6 +130,8 @@ public:
///> Clear current selection event handler.
int ClearSelection( const TOOL_EVENT& aEvent );
void ClearSelection();
/**
* Function SelectionMenu()
* Shows a popup menu to trim the COLLECTOR passed as aEvent's parameter down to a single
@ -170,12 +171,6 @@ private:
*/
bool doSelectionMenu( EE_COLLECTOR* aItems );
/**
* Function clearSelection()
* Clears the current selection.
*/
void clearSelection();
/**
* Function toggleSelection()
* Changes selection status of a given item.

View File

@ -250,7 +250,7 @@ int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !item )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( item && ( evt->IsAction( &EE_ACTIONS::refreshPreview ) || evt->IsMotion() ) )
@ -384,7 +384,7 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
if( !item )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
// Enable autopanning and cursor capture only when there is a shape being drawn
@ -436,7 +436,7 @@ int LIB_DRAWING_TOOLS::PlaceAnchor( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
}

View File

@ -242,7 +242,7 @@ int LIB_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
//------------------------------------------------------------------------
// Handle drop

View File

@ -232,11 +232,9 @@ int SCH_DRAWING_TOOLS::AddSheetPin( const TOOL_EVENT& aEvent )
if( !label )
{
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
m_statusPopup->Popup();
m_statusPopup->Expire( 2000 );
m_statusPopup->PopupFor( 2000 );
return 0;
}
}
@ -367,7 +365,7 @@ int SCH_DRAWING_TOOLS::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTE
if( !aComponent )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CONTEXT_MENU_CHOICE )
{
@ -501,7 +499,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
if( !image )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( image && ( evt->IsAction( &EE_ACTIONS::refreshPreview )
|| evt->IsMotion() ) )
@ -609,7 +607,7 @@ int SCH_DRAWING_TOOLS::doSingleClickPlace( KICAD_T aType )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
}
@ -721,11 +719,9 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !sheet )
{
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
m_statusPopup->SetText( _( "Click over a sheet." ) );
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
m_statusPopup->Popup();
m_statusPopup->Expire( 2000 );
m_statusPopup->PopupFor( 2000 );
break;
}
@ -736,11 +732,9 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !label )
{
m_statusPopup.reset( new STATUS_TEXT_POPUP( m_frame ) );
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
m_statusPopup->SetText( _( "No new hierarchical labels found." ) );
m_statusPopup->Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
m_statusPopup->Popup();
m_statusPopup->Expire( 2000 );
m_statusPopup->PopupFor( 2000 );
break;
}
}
@ -783,7 +777,7 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !item )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( item && TOOL_EVT_UTILS::IsSelectionEvent( evt.get() ) )
{
@ -893,7 +887,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
if( !sheet )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
// Enable autopanning and cursor capture only when there is a sheet to be placed

View File

@ -1024,8 +1024,7 @@ static bool deleteItem( SCH_BASE_FRAME* aFrame, const VECTOR2D& aPosition )
{
STATUS_TEXT_POPUP statusPopup( aFrame );
statusPopup.SetText( _( "Item locked." ) );
statusPopup.Expire( 2000 );
statusPopup.Popup();
statusPopup.PopupFor( 2000 );
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
return true;
}

View File

@ -24,11 +24,8 @@
#include <fctsys.h>
#include <kiway.h>
#include <sch_view.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_bitmap.h>
#include <connection_graph.h>
#include <erc.h>
#include <eeschema_id.h>
@ -39,7 +36,7 @@
#include <tools/sch_editor_control.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_drawing_tools.h>
#include <project.h>
#include <tools/sch_wire_bus_tool.h>
#include <ee_hotkeys.h>
#include <advanced_config.h>
#include <simulation_cursors.h>
@ -47,9 +44,8 @@
#include <sch_legacy_plugin.h>
#include <class_library.h>
#include <confirm.h>
#include <lib_edit_frame.h>
#include <sch_painter.h>
#include "sch_wire_bus_tool.h"
#include <status_popup.h>
TOOL_ACTION EE_ACTIONS::refreshPreview( "eeschema.EditorControl.refreshPreview",
AS_GLOBAL, 0, "", "" );
@ -122,6 +118,243 @@ TOOL_ACTION EE_ACTIONS::toggleForceHV( "eeschema.EditorControl.forceHVLines",
lines90_xpm );
// A timer during which a subsequent FindNext will result in a wrap-around
static wxTimer g_wrapAroundTimer;
// A dummy wxFindReplaceData signalling any marker should be found
static wxFindReplaceData g_markersOnly;
int SCH_EDITOR_CONTROL::FindAndReplace( const TOOL_EVENT& aEvent )
{
m_frame->ShowFindReplaceDialog( aEvent.IsAction( &ACTIONS::findAndReplace ));
return UpdateFind( aEvent );
}
int SCH_EDITOR_CONTROL::UpdateFind( const TOOL_EVENT& aEvent )
{
wxFindReplaceData* data = m_frame->GetFindReplaceData();
if( aEvent.IsAction( &ACTIONS::find )
|| aEvent.IsAction( &ACTIONS::findAndReplace )
|| aEvent.IsAction( &ACTIONS::updateFind ) )
{
m_selectionTool->ClearSelection();
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* )
{
if( data && item->Matches( *data, nullptr ) )
{
m_selectionTool->BrightenItem( item );
if( m_selectionTool->GetSelection().GetSize() == 0 )
m_selectionTool->AddItemToSel( item );
}
else if( item->IsBrightened() )
{
m_selectionTool->UnbrightenItem( item );
}
return SEARCH_CONTINUE;
};
EDA_ITEM* start = m_frame->GetScreen()->GetDrawItems();
EDA_ITEM::IterateForward( start, inspector, nullptr, EE_COLLECTOR::AllItems );
}
else if( aEvent.Matches( EVENTS::SelectedItemsModified ) )
{
for( EDA_ITEM* item : m_selectionTool->GetSelection() )
{
if( data && item->Matches( *data, nullptr ) )
m_selectionTool->BrightenItem( item );
else if( item->IsBrightened() )
m_selectionTool->UnbrightenItem( item );
}
}
getView()->UpdateItems();
m_frame->GetCanvas()->Refresh();
return 0;
}
EDA_ITEM* nextMatch( SCH_SCREEN* aScreen, EDA_ITEM* after, wxFindReplaceData* data )
{
EDA_ITEM* found = nullptr;
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData )
{
if( after )
{
if( after == item )
after = nullptr;
return SEARCH_CONTINUE;
}
if( ( data == &g_markersOnly && item->Type() == SCH_MARKER_T )
|| item->Matches( *data, nullptr ) )
{
found = item;
return SEARCH_QUIT;
}
return SEARCH_CONTINUE;
};
EDA_ITEM::IterateForward( aScreen->GetDrawItems(), inspector, nullptr, EE_COLLECTOR::AllItems );
return found;
}
int SCH_EDITOR_CONTROL::FindNext( const TOOL_EVENT& aEvent )
{
wxFindReplaceData* data = m_frame->GetFindReplaceData();
if( aEvent.IsAction( &ACTIONS::findNextMarker ) )
{
if( data )
g_markersOnly.SetFlags( data->GetFlags() );
data = &g_markersOnly;
}
else if( !data )
{
return FindAndReplace( ACTIONS::find.MakeEvent() );
}
bool searchAllSheets = !( data->GetFlags() & FR_CURRENT_SHEET_ONLY );
SELECTION& selection = m_selectionTool->GetSelection();
SCH_SCREEN* afterScreen = m_frame->GetScreen();
EDA_ITEM* afterItem = selection.Front();
EDA_ITEM* item = nullptr;
if( g_wrapAroundTimer.IsRunning() )
{
afterScreen = nullptr;
afterItem = nullptr;
g_wrapAroundTimer.Stop();
m_frame->ClearFindReplaceStatus();
}
m_selectionTool->ClearSelection();
if( afterScreen || !searchAllSheets )
item = nextMatch( m_frame->GetScreen(), afterItem, data );
if( !item && searchAllSheets )
{
SCH_SHEET_LIST schematic( g_RootSheet );
SCH_SCREENS screens;
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
if( afterScreen )
{
if( afterScreen == screen )
afterScreen = nullptr;
continue;
}
item = nextMatch( screen, nullptr, data );
if( item )
{
SCH_SHEET_PATH* sheet = schematic.FindSheetForScreen( screen );
wxCHECK_MSG( sheet, 0, "Sheet not found for " + screen->GetFileName() );
*g_CurrentSheet = *sheet;
g_CurrentSheet->UpdateAllScreenReferences();
screen->SetZoom( m_frame->GetScreen()->GetZoom() );
screen->TestDanglingEnds();
m_frame->SetScreen( screen );
UpdateFind( ACTIONS::updateFind.MakeEvent() );
break;
}
}
}
if( item )
{
m_selectionTool->AddItemToSel( item );
getView()->SetCenter( item->GetBoundingBox().GetCenter() );
m_frame->GetCanvas()->Refresh();
}
else
{
wxString msg;
if( searchAllSheets )
msg = _( "Reached end of schematic." );
else
msg = _( "Reached end of sheet." );
m_frame->ShowFindReplaceStatus( msg + _( "\nFind again to wrap around to the start." ) );
g_wrapAroundTimer.StartOnce( 4000 );
}
return 0;
}
bool SCH_EDITOR_CONTROL::HasMatch()
{
wxFindReplaceData* data = m_frame->GetFindReplaceData();
EDA_ITEM* item = m_selectionTool->GetSelection().Front();
return data && item && item->Matches( *data, nullptr );
}
int SCH_EDITOR_CONTROL::ReplaceAndFindNext( const TOOL_EVENT& aEvent )
{
wxFindReplaceData* data = m_frame->GetFindReplaceData();
EDA_ITEM* item = m_selectionTool->GetSelection().Front();
if( !data )
return FindAndReplace( ACTIONS::find.MakeEvent() );
if( item && item->Matches( *data, nullptr ) )
{
item->Replace( *data, g_CurrentSheet );
FindNext( ACTIONS::findNext.MakeEvent() );
}
return 0;
}
int SCH_EDITOR_CONTROL::ReplaceAll( const TOOL_EVENT& aEvent )
{
wxFindReplaceData* data = m_frame->GetFindReplaceData();
if( !data )
return FindAndReplace( ACTIONS::find.MakeEvent() );
SCH_SHEET_LIST schematic( g_RootSheet );
SCH_SCREENS screens;
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( EDA_ITEM* item = nextMatch( screen, nullptr, data );
item;
item = nextMatch( screen, item, data ) )
{
item->Replace( *data, schematic.FindSheetForScreen( screen ) );
}
}
return 0;
}
int SCH_EDITOR_CONTROL::CrossProbeToPcb( const TOOL_EVENT& aEvent )
{
doCrossProbeSchToPcb( aEvent, false );
@ -698,13 +931,6 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::FindReplace( const TOOL_EVENT& aEvent )
{
m_frame->DoFindReplace( aEvent.IsAction( &ACTIONS::replace ) );
return 0;
}
int SCH_EDITOR_CONTROL::EditWithLibEdit( const TOOL_EVENT& aEvent )
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
@ -800,6 +1026,15 @@ int SCH_EDITOR_CONTROL::ToggleForceHV( const TOOL_EVENT& aEvent )
void SCH_EDITOR_CONTROL::setTransitions()
{
Go( &SCH_EDITOR_CONTROL::FindAndReplace, ACTIONS::find.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindAndReplace, ACTIONS::findAndReplace.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindNext, ACTIONS::findNext.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindNext, ACTIONS::findNextMarker.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ReplaceAndFindNext, ACTIONS::replaceAndFindNext.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ReplaceAll, ACTIONS::replaceAll.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateFind, ACTIONS::updateFind.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdateFind, EVENTS::SelectedItemsModified );
/*
Go( &SCH_EDITOR_CONTROL::ToggleLockSelected, EE_ACTIONS::toggleLock.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::LockSelected, EE_ACTIONS::lock.MakeEvent() );
@ -827,8 +1062,6 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindReplace, ACTIONS::find.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::FindReplace, ACTIONS::replace.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithLibEdit, EE_ACTIONS::editWithLibEdit.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSymbolEditor, EE_ACTIONS::showSymbolEditor.MakeEvent() );

View File

@ -27,6 +27,7 @@
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
#include <status_popup.h>
class SCH_EDIT_FRAME;
@ -45,6 +46,15 @@ public:
~SCH_EDITOR_CONTROL() { }
int FindAndReplace( const TOOL_EVENT& aEvent );
int FindNext( const TOOL_EVENT& aEvent );
bool HasMatch();
int ReplaceAndFindNext( const TOOL_EVENT& aEvent );
int ReplaceAll( const TOOL_EVENT& aEvent );
int UpdateFind( const TOOL_EVENT& aEvent );
int ToggleLockSelected( const TOOL_EVENT& aEvent );
int LockSelected( const TOOL_EVENT& aEvent );
int UnlockSelected( const TOOL_EVENT& aEvent );
@ -81,8 +91,6 @@ public:
int Copy( const TOOL_EVENT& aEvent );
int Paste( const TOOL_EVENT& aEvent );
int FindReplace( const TOOL_EVENT& aEvent );
int EditWithLibEdit( const TOOL_EVENT& aEvent );
int ShowSymbolEditor( const TOOL_EVENT& aEvent );
int ShowLibraryBrowser( const TOOL_EVENT& aEvent );

View File

@ -414,7 +414,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
//
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
//------------------------------------------------------------------------
// Handle drop

View File

@ -765,7 +765,7 @@ int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment )
if( !aSegment )
m_toolMgr->VetoContextMenuMouseWarp();
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
}
else if( evt->Category() == TC_COMMAND && evt->Action() == TA_CONTEXT_MENU_CHOICE )
{

View File

@ -451,11 +451,9 @@ public:
* search criteria.
* @param aAuxData A pointer to optional data required for the search or NULL
* if not used.
* @param aFindLocation A pointer to a wxPoint object to store the location of
* matched item. The pointer can be NULL if it is not used.
* @return True if the item's text matches the search criteria in \a aSearchData.
*/
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation )
virtual bool Matches( wxFindReplaceData& aSearchData, void* aAuxData )
{
return false;
}

View File

@ -270,7 +270,10 @@ enum common_hotkey_id_command {
HK_CUT,
HK_COPY,
HK_PASTE,
HK_DELETE,
HK_FIND,
HK_FIND_NEXT,
HK_FIND_NEXT_MARKER,
HK_REPLACE,
HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,

View File

@ -42,10 +42,11 @@ class EDA_DRAW_FRAME;
class STATUS_POPUP: public wxPopupWindow
{
public:
STATUS_POPUP( EDA_DRAW_FRAME* aParent );
STATUS_POPUP( wxWindow* aParent );
virtual ~STATUS_POPUP() {}
virtual void Popup( wxWindow* aFocus = nullptr );
virtual void PopupFor( int aMsecs );
virtual void Move( const wxPoint &aWhere );
virtual void Move( const VECTOR2I& aWhere );
@ -64,7 +65,6 @@ protected:
///> Expire timer even handler
void onExpire( wxTimerEvent& aEvent );
EDA_DRAW_FRAME* m_frame;
wxPanel* m_panel;
wxBoxSizer* m_topSizer;
wxTimer m_expireTimer;
@ -79,7 +79,7 @@ protected:
class STATUS_TEXT_POPUP : public STATUS_POPUP
{
public:
STATUS_TEXT_POPUP( EDA_DRAW_FRAME* aParent );
STATUS_TEXT_POPUP( wxWindow* aParent );
virtual ~STATUS_TEXT_POPUP() {}
/**

View File

@ -52,8 +52,15 @@ public:
static TOOL_ACTION cut;
static TOOL_ACTION copy;
static TOOL_ACTION paste;
// Find and Replace
static TOOL_ACTION find;
static TOOL_ACTION replace;
static TOOL_ACTION findAndReplace;
static TOOL_ACTION findNext;
static TOOL_ACTION findNextMarker;
static TOOL_ACTION replaceAndFindNext;
static TOOL_ACTION replaceAll;
static TOOL_ACTION updateFind;
// View controls
static TOOL_ACTION zoomRedraw;

View File

@ -113,26 +113,20 @@ bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
KiBitmap( move_xpm ) );
}
msg = AddHotkeyName( _( "Move Item" ), PlEditorHotkeysDescr,
HK_MOVE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, msg,
KiBitmap( move_xpm ) );
msg = AddHotkeyName( _( "Move Item" ), PlEditorHotkeysDescr, HK_MOVE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_MOVE, msg, KiBitmap( move_xpm ) );
aPopMenu->AppendSeparator();
msg = AddHotkeyName( _( "Delete" ), PlEditorHotkeysDescr,
HK_DELETE_ITEM );
msg = AddHotkeyName( _( "Delete" ), PlEditorHotkeysDescr, HK_DELETE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_DELETE, msg, KiBitmap( delete_xpm ) );
aPopMenu->AppendSeparator();
}
}
else // An item is currently in edit
{
msg = AddHotkeyName( _( "Place Item" ), PlEditorHotkeysDescr,
HK_PLACE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, msg,
KiBitmap( move_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE_CANCEL, _( "Cancel" ),
KiBitmap( cancel_xpm ) );
msg = AddHotkeyName( _( "Place Item" ), PlEditorHotkeysDescr, HK_PLACE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE, msg, KiBitmap( move_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_ITEM_PLACE_CANCEL, _( "Cancel" ), KiBitmap( cancel_xpm ) );
aPopMenu->AppendSeparator();
}

View File

@ -35,8 +35,7 @@
// see also enum common_hotkey_id_command in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_command {
HK_DELETE = HK_COMMON_END,
HK_BACK_SPACE,
HK_BACK_SPACE = HK_COMMON_END,
HK_ROTATE_ITEM,
HK_ROTATE_ITEM_CLOCKWISE,
HK_FLIP_ITEM,

View File

@ -31,7 +31,9 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter )
if( !placer )
return;
SetText( placer->TuningInfo( m_frame->GetUserUnits() ) );
EDA_DRAW_FRAME* frame = static_cast<EDA_DRAW_FRAME*>( GetParent() );
SetText( placer->TuningInfo( frame->GetUserUnits() ) );
// Determine the background color first and choose a contrasting value
COLOR4D bg( m_panel->GetBackgroundColour() );

View File

@ -341,8 +341,6 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
BOARD_ITEM* text = NULL;
const BOARD_DESIGN_SETTINGS& dsnSettings = m_frame->GetDesignSettings();
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
@ -388,7 +386,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) )
{
@ -491,8 +489,8 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
else if( text && evt->IsMotion() )
{
text->SetPosition( (wxPoint) cursorPos );
selection.SetReferencePoint( cursorPos );
m_view->Update( &selection );
selection().SetReferencePoint( cursorPos );
m_view->Update( &selection() );
frame()->SetMsgPanel( text );
}
@ -596,7 +594,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) )
{
@ -882,7 +880,7 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) )
{
@ -940,7 +938,7 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
break;
@ -1051,7 +1049,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic, OPT<VECTOR2D
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
{
@ -1269,7 +1267,7 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsAction( &PCB_ACTIONS::incWidth ) )
{
@ -1430,7 +1428,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
// events that lock in nodes
else if( evt->IsClick( BUT_LEFT )
@ -1490,8 +1488,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
{
wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
status.Move( p );
status.Popup( m_frame );
status.Expire( 1500 );
status.PopupFor( 1500 );
}
else
{

View File

@ -962,8 +962,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
m_lockedSelected = true;
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &lockedItems );
statusPopup.SetText( _( "Delete again to remove locked items" ) );
statusPopup.Expire( 2000 );
statusPopup.Popup();
statusPopup.PopupFor( 2000 );
statusPopup.Move( wxGetMousePosition() + wxPoint( 20, 20 ) );
Activate();
@ -1354,7 +1353,7 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
}

View File

@ -309,7 +309,7 @@ int MODULE_EDITOR_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
// Prepare the next loop by updating the old cursor mouse position

View File

@ -367,7 +367,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
}

View File

@ -439,8 +439,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
MODULE* module = aEvent.Parameter<MODULE*>();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
BOARD_COMMIT commit( m_frame );
BOARD* board = getModel<BOARD>();
@ -525,14 +523,14 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( module && evt->IsMotion() )
{
module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
selection.SetReferencePoint( cursorPos );
getView()->Update( &selection );
selection().SetReferencePoint( cursorPos );
getView()->Update( & selection() );
}
else if( module && evt->IsAction( &PCB_ACTIONS::properties ) )
@ -680,7 +678,7 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( evt->IsMotion() )

View File

@ -175,7 +175,7 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer
}
else if( evt->IsClick( BUT_RIGHT ) )
{
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( selection() );
}
else if( newItem && evt->Category() == TC_COMMAND )
{

View File

@ -109,7 +109,10 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
}
else if( evt->IsClick( BUT_RIGHT ) )
m_menu.ShowContextMenu();
{
SELECTION dummy;
m_menu.ShowContextMenu( dummy );
}
else
m_toolMgr->PassEvent();

View File

@ -258,7 +258,7 @@ void POINT_EDITOR::Reset( RESET_REASON aReason )
m_statusPopup.reset( new STATUS_TEXT_POPUP( getEditFrame<PCB_BASE_EDIT_FRAME>() ) );
m_statusPopup->SetTextColor( wxColour( 255, 0, 0 ) );
m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed" ) );
m_statusPopup->SetText( _( "Self-intersecting polygons are not allowed." ) );
}
@ -685,8 +685,7 @@ bool POINT_EDITOR::validatePolygon( SHAPE_POLY_SET& aModified, const SHAPE_POLY_
{
wxPoint p = wxGetMousePosition() + wxPoint( 20, 20 );
m_statusPopup->Move( p );
m_statusPopup->Popup( getEditFrame<PCB_BASE_FRAME>() );
m_statusPopup->Expire( 1500 );
m_statusPopup->PopupFor( 1500 );
}
if( aOriginal )

View File

@ -304,7 +304,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
if( !selectionCancelled )
m_menu.ShowContextMenu();
m_menu.ShowContextMenu( m_selection );
}
// double click? Display the properties window