Remove redundant Text Filter toggle icon and fix <Enter>.
(Enter in the filter textbox should execute the search, not close the dialog.) Fixes https://gitlab.com/kicad/code/kicad/issues/4768
This commit is contained in:
parent
b1b9cef5fb
commit
9806d846b2
|
@ -330,11 +330,6 @@ void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
|
||||||
// If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
|
// If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
|
||||||
// of available footprints which match the filter
|
// of available footprints which match the filter
|
||||||
|
|
||||||
m_currentSearchPattern = m_tcFilterString->GetValue();
|
|
||||||
|
|
||||||
if(( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN ) == 0 )
|
|
||||||
return;
|
|
||||||
|
|
||||||
wxListEvent l_event;
|
wxListEvent l_event;
|
||||||
OnSelectComponent( l_event );
|
OnSelectComponent( l_event );
|
||||||
}
|
}
|
||||||
|
@ -350,7 +345,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
libraryName = m_libListBox->GetSelectedLibrary();
|
libraryName = m_libListBox->GetSelectedLibrary();
|
||||||
|
|
||||||
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
|
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
|
||||||
m_currentSearchPattern, m_filteringOptions);
|
m_tcFilterString->GetValue(), m_filteringOptions );
|
||||||
|
|
||||||
if( component && component->GetFPID().IsValid() )
|
if( component && component->GetFPID().IsValid() )
|
||||||
m_footprintListBox->SetSelectedFootprint( component->GetFPID() );
|
m_footprintListBox->SetSelectedFootprint( component->GetFPID() );
|
||||||
|
@ -541,10 +536,6 @@ void CVPCB_MAINFRAME::SetFootprintFilter( FOOTPRINTS_LISTBOX::FP_FILTER_T aFilte
|
||||||
{
|
{
|
||||||
int option = aFilter;
|
int option = aFilter;
|
||||||
|
|
||||||
// Extract the current search patten when needed
|
|
||||||
if( option == FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN )
|
|
||||||
m_currentSearchPattern = m_tcFilterString->GetValue();
|
|
||||||
|
|
||||||
// Apply the filter accordingly
|
// Apply the filter accordingly
|
||||||
switch( aAction )
|
switch( aAction )
|
||||||
{
|
{
|
||||||
|
@ -589,7 +580,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filters += _( "key words" ) + wxString::Format( wxT( " (%s)" ), msg );
|
filters += _( "key words" );
|
||||||
|
|
||||||
|
if( !msg.IsEmpty() )
|
||||||
|
filters += wxString::Format( wxT( " (%s)" ), msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
|
||||||
|
@ -602,7 +596,10 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
if( !filters.IsEmpty() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( ", " );
|
filters += wxT( ", " );
|
||||||
|
|
||||||
filters += _( "pin count" ) + wxString::Format( wxT( " (%s)" ), msg );
|
filters += _( "pin count" );
|
||||||
|
|
||||||
|
if( !msg.IsEmpty() )
|
||||||
|
filters += wxString::Format( wxT( " (%s)" ), msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
|
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
|
||||||
|
@ -612,15 +609,20 @@ void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
if( !filters.IsEmpty() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( ", " );
|
filters += wxT( ", " );
|
||||||
|
|
||||||
filters += _( "library" ) + wxString::Format( wxT( " (%s)" ), msg );
|
filters += _( "library" );
|
||||||
|
|
||||||
|
if( !msg.IsEmpty() )
|
||||||
|
filters += wxString::Format( wxT( " (%s)" ), msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN ) )
|
wxString textFilter = m_tcFilterString->GetValue();
|
||||||
|
|
||||||
|
if( !textFilter.IsEmpty() )
|
||||||
{
|
{
|
||||||
if( !filters.IsEmpty() )
|
if( !filters.IsEmpty() )
|
||||||
filters += wxT( ", " );
|
filters += wxT( ", " );
|
||||||
|
|
||||||
filters += _( "search text" );
|
filters += _( "search text" ) + wxString::Format( wxT( " (%s)" ), textFilter );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( filters.IsEmpty() )
|
if( filters.IsEmpty() )
|
||||||
|
|
|
@ -61,7 +61,6 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
|
||||||
{
|
{
|
||||||
friend struct CV::IFACE;
|
friend struct CV::IFACE;
|
||||||
|
|
||||||
wxString m_currentSearchPattern;
|
|
||||||
NETLIST m_netlist;
|
NETLIST m_netlist;
|
||||||
int m_filteringOptions;
|
int m_filteringOptions;
|
||||||
ACTION_TOOLBAR* m_mainToolBar;
|
ACTION_TOOLBAR* m_mainToolBar;
|
||||||
|
|
|
@ -149,7 +149,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
|
||||||
if( aFilterType & FILTERING_BY_LIBRARY )
|
if( aFilterType & FILTERING_BY_LIBRARY )
|
||||||
filter.FilterByLibrary( aLibName );
|
filter.FilterByLibrary( aLibName );
|
||||||
|
|
||||||
if( aFilterType & FILTERING_BY_TEXT_PATTERN )
|
if( !aFootPrintFilterPattern.IsEmpty() )
|
||||||
filter.FilterByTextPattern( aFootPrintFilterPattern );
|
filter.FilterByTextPattern( aFootPrintFilterPattern );
|
||||||
|
|
||||||
if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() )
|
if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() )
|
||||||
|
|
|
@ -96,8 +96,7 @@ public:
|
||||||
UNFILTERED_FP_LIST = 0,
|
UNFILTERED_FP_LIST = 0,
|
||||||
FILTERING_BY_COMPONENT_FP_FILTERS = 0x0001,
|
FILTERING_BY_COMPONENT_FP_FILTERS = 0x0001,
|
||||||
FILTERING_BY_PIN_COUNT = 0x0002,
|
FILTERING_BY_PIN_COUNT = 0x0002,
|
||||||
FILTERING_BY_LIBRARY = 0x0004,
|
FILTERING_BY_LIBRARY = 0x0004
|
||||||
FILTERING_BY_TEXT_PATTERN = 0x0008
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id );
|
||||||
|
|
|
@ -79,13 +79,14 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true );
|
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyLibrary, true );
|
||||||
|
|
||||||
m_mainToolBar->AddScaledSeparator( this );
|
m_mainToolBar->AddScaledSeparator( this );
|
||||||
m_mainToolBar->Add( CVPCB_ACTIONS::FilterFPbyTextPattern, true );
|
|
||||||
|
|
||||||
m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT );
|
m_tcFilterString = new wxTextCtrl( m_mainToolBar, ID_CVPCB_FILTER_TEXT_EDIT, wxEmptyString,
|
||||||
|
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
|
||||||
|
|
||||||
|
m_tcFilterString->Bind( wxEVT_TEXT_ENTER, &CVPCB_MAINFRAME::OnEnterFilteringText, this );
|
||||||
|
|
||||||
m_mainToolBar->AddControl( m_tcFilterString );
|
m_mainToolBar->AddControl( m_tcFilterString );
|
||||||
|
|
||||||
|
|
||||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||||
m_mainToolBar->Realize();
|
m_mainToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,5 @@ void CVPCB_MAINFRAME::SyncToolbars()
|
||||||
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) );
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) );
|
||||||
m_mainToolBar->Toggle( CVPCB_ACTIONS::filterFPbyPin,
|
m_mainToolBar->Toggle( CVPCB_ACTIONS::filterFPbyPin,
|
||||||
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) );
|
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) );
|
||||||
m_mainToolBar->Toggle( CVPCB_ACTIONS::FilterFPbyTextPattern,
|
|
||||||
filterActive( FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN ) );
|
|
||||||
m_mainToolBar->Refresh();
|
m_mainToolBar->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,9 +152,3 @@ TOOL_ACTION CVPCB_ACTIONS::FilterFPbyLibrary( "cvpcb.Control.FilterFPbyLibrary",
|
||||||
module_library_list_xpm, AF_NONE,
|
module_library_list_xpm, AF_NONE,
|
||||||
(void*) FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
|
(void*) FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
|
||||||
|
|
||||||
TOOL_ACTION CVPCB_ACTIONS::FilterFPbyTextPattern( "cvpcb.Control.FilterFPbyTextPattern",
|
|
||||||
AS_GLOBAL, 0, "",
|
|
||||||
_( "Filter by display name" ),
|
|
||||||
_( "Filter footprint list using plain text matching or regular expressions" ),
|
|
||||||
module_name_filtered_list_xpm, AF_NONE,
|
|
||||||
(void*) FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN );
|
|
||||||
|
|
|
@ -69,7 +69,6 @@ public:
|
||||||
static TOOL_ACTION FilterFPbyFPFilters;
|
static TOOL_ACTION FilterFPbyFPFilters;
|
||||||
static TOOL_ACTION filterFPbyPin;
|
static TOOL_ACTION filterFPbyPin;
|
||||||
static TOOL_ACTION FilterFPbyLibrary;
|
static TOOL_ACTION FilterFPbyLibrary;
|
||||||
static TOOL_ACTION FilterFPbyTextPattern;
|
|
||||||
|
|
||||||
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
|
||||||
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
|
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
|
||||||
|
|
|
@ -319,5 +319,4 @@ void CVPCB_CONTROL::setTransitions()
|
||||||
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::FilterFPbyFPFilters.MakeEvent() );
|
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::FilterFPbyFPFilters.MakeEvent() );
|
||||||
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::FilterFPbyLibrary.MakeEvent() );
|
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::FilterFPbyLibrary.MakeEvent() );
|
||||||
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::filterFPbyPin.MakeEvent() );
|
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::filterFPbyPin.MakeEvent() );
|
||||||
Go( &CVPCB_CONTROL::ToggleFootprintFilter, CVPCB_ACTIONS::FilterFPbyTextPattern.MakeEvent() );
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue