Add filters to footprint viewer.

This also allows us to remove button to access the tree dialog
since the only extra it provided was filtering.

Fixes: lp:1465295
* https://bugs.launchpad.net/kicad/+bug/1465295
This commit is contained in:
Jeff Young 2019-08-14 20:44:57 +01:00
parent 3e22b75948
commit a0eaff289a
8 changed files with 147 additions and 364 deletions

View File

@ -315,7 +315,6 @@ set( BMAPS_MID
list_nets
load_gerber
load_module_board
load_module_lib
local_ratsnest
lock_unlock
locked

View File

@ -1,68 +0,0 @@
/* Do not modify this file, it was automatically generated by the
* PNG2cpp CMake script, using a *.png file as input.
*/
#include <bitmaps_png/bitmaps_list.h>
static const unsigned char png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x06, 0x00, 0x00, 0x00, 0xa9, 0x4a, 0x4c,
0xce, 0x00, 0x00, 0x03, 0x2f, 0x49, 0x44, 0x41, 0x54, 0x48, 0xc7, 0xc5, 0x96, 0x5d, 0x48, 0x93,
0x51, 0x18, 0xc7, 0xdf, 0xb9, 0xad, 0x42, 0x0d, 0xfb, 0x10, 0x42, 0xba, 0xa9, 0x88, 0xcc, 0xea,
0xaa, 0xfc, 0x6a, 0x33, 0xd0, 0xcc, 0xa0, 0x88, 0x9c, 0xef, 0xa6, 0xdb, 0xd8, 0xb4, 0xab, 0xba,
0xec, 0xc2, 0x31, 0x27, 0x2d, 0x1b, 0xde, 0x0c, 0x2f, 0x42, 0xdd, 0x9c, 0x39, 0x70, 0x1f, 0xba,
0xbc, 0x1a, 0x62, 0x17, 0xd2, 0x55, 0x10, 0x14, 0x45, 0xc4, 0x86, 0x92, 0x0b, 0xba, 0x89, 0x64,
0x0a, 0xca, 0x26, 0x4c, 0xf1, 0xab, 0xa5, 0x9b, 0x4f, 0xe7, 0x39, 0xe5, 0xdc, 0xbb, 0x0f, 0x75,
0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x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
};
const BITMAP_OPAQUE load_module_lib_xpm[1] = {{ png, sizeof( png ), "load_module_lib_xpm" }};
//EOF

View File

@ -255,7 +255,6 @@ EXTERN_BITMAP( lines90_xpm )
EXTERN_BITMAP( list_nets_xpm )
EXTERN_BITMAP( load_gerber_xpm )
EXTERN_BITMAP( load_module_board_xpm )
EXTERN_BITMAP( load_module_lib_xpm )
EXTERN_BITMAP( local_ratsnest_xpm )
EXTERN_BITMAP( locked_xpm )
EXTERN_BITMAP( lock_unlock_xpm )

View File

@ -1,204 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="26"
width="26"
version="1.1"
viewBox="0 0 26 26"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="load_module_lib.svg">
<metadata
id="metadata100">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1855"
inkscape:window-height="1056"
id="namedview98"
showgrid="true"
inkscape:zoom="5.6082484"
inkscape:cx="-9.1772771"
inkscape:cy="24.31826"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="svg2"
inkscape:snap-to-guides="false"
inkscape:snap-grids="false">
<inkscape:grid
type="xygrid"
id="grid3048"
empspacing="1"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true" />
</sodipodi:namedview>
<defs
id="defs4">
<radialGradient
id="e"
gradientUnits="userSpaceOnUse"
cy="20.493999"
cx="35.292999"
gradientTransform="matrix(0,-0.84302,1.0202,0,-4.8963249,41.059418)"
r="16.955999">
<stop
stop-color="#73d216"
offset="0"
id="stop12-7" />
<stop
stop-color="#4e9a06"
offset="1"
id="stop14-2" />
</radialGradient>
<radialGradient
r="16.955999"
gradientTransform="matrix(0,-0.84302,1.0202,0,-4.8963249,41.059418)"
cx="35.292999"
cy="20.493999"
gradientUnits="userSpaceOnUse"
id="radialGradient4831">
<stop
style="stop-color:#1772d9;stop-opacity:1"
id="stop4833"
offset="0"
stop-color="#73d216" />
<stop
style="stop-color:#085ab6;stop-opacity:1"
id="stop4835"
offset="1"
stop-color="#4e9a06" />
</radialGradient>
<radialGradient
r="16.955999"
gradientTransform="matrix(0,-0.84302,1.0202,0,-4.8963249,41.059418)"
cx="35.292999"
cy="20.493999"
gradientUnits="userSpaceOnUse"
id="radialGradient4831-3">
<stop
style="stop-color:#1772d9;stop-opacity:1"
id="stop4833-6"
offset="0"
stop-color="#73d216" />
<stop
style="stop-color:#085ab6;stop-opacity:1"
id="stop4835-7"
offset="1"
stop-color="#4e9a06" />
</radialGradient>
<inkscape:path-effect
effect="spiro"
id="path-effect4425"
is_visible="true" />
</defs>
<g
transform="translate(5e-8,-0.54461362)"
id="g4164">
<path
inkscape:connector-curvature="0"
id="rect51"
d="m 1.5380859,6.5039062 0,4.6249998 a 2.2240581,1.9589449 0 0 1 0,3.822266 l 0,5.642578 22.9238281,0 0,-14.0898438 -22.9238281,0 z"
style="fill:#e6e6e6;stroke:#545454;stroke-width:0.97711289;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<g
transform="translate(-0.53360319,0)"
id="g3983">
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="4.5123401"
x="-8.5317764"
id="rect73" />
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="11.451617"
x="-8.5076618"
id="rect73-5" />
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="18.488895"
x="-8.5498009"
id="rect73-56" />
</g>
<g
id="g3983-1"
transform="translate(-0.53360319,16.090848)">
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="4.5123401"
x="-8.5317764"
id="rect73-0" />
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="11.451617"
x="-8.5076618"
id="rect73-5-4" />
<rect
style="fill:#00c921;fill-opacity:1;stroke:#545454;stroke-width:0.93241322;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
transform="matrix(0,-1,1,0,0,0)"
height="4.0659709"
width="6.0590835"
y="18.488895"
x="-8.5498009"
id="rect73-56-9" />
</g>
</g>
<g
id="g4507"
transform="matrix(0.87570223,0,0,0.87570223,-87.222615,-832.73412)">
<path
inkscape:connector-curvature="0"
d="m 116.8825,964.90909 -4.95539,0 c -0.90849,0 -1.64354,0.74331 -1.64354,1.65179 l -0.008,9.91077 c 0,0.90846 0.7433,1.65177 1.65179,1.65177 l 13.21436,0 c 0.90849,0 1.65179,-0.74331 1.65179,-1.65177 l 0,-8.25897 c 0,-0.90849 -0.7433,-1.6518 -1.65179,-1.6518 l -6.60718,0 -1.65179,-1.65179 z"
id="path4321"
style="fill:#d4aa00;stroke:#ffffff;stroke-width:5;stroke-miterlimit:4;stroke-dasharray:none" />
<path
style="fill:#d4aa00;stroke:#000000;stroke-width:1.65179491;stroke-miterlimit:4;stroke-dasharray:none"
id="path4"
d="m 116.8825,964.90909 -4.95539,0 c -0.90849,0 -1.64354,0.74331 -1.64354,1.65179 l -0.008,9.91077 c 0,0.90846 0.7433,1.65177 1.65179,1.65177 l 13.21436,0 c 0.90849,0 1.65179,-0.74331 1.65179,-1.65177 l 0,-8.25897 c 0,-0.90849 -0.7433,-1.6518 -1.65179,-1.6518 l -6.60718,0 -1.65179,-1.65179 z"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
inkscape:original-d="m 110.51425,966.96584 12.71648,0"
inkscape:path-effect="#path-effect4425"
id="path4423"
d="m 110.51425,966.96584 12.71648,0"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.82589746px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 7.3 KiB

View File

@ -34,7 +34,6 @@
#include <lib_id.h>
#include <confirm.h>
#include <bitmaps.h>
#include <gal/graphics_abstraction_layer.h>
#include <eda_dockart.h>
#include <pcb_painter.h>
#include <class_board.h>
@ -44,7 +43,6 @@
#include <footprint_viewer_frame.h>
#include <footprint_info.h>
#include <wildcards_and_files_ext.h>
#include <config_params.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
@ -53,9 +51,10 @@
#include "tools/pcbnew_control.h"
#include "tools/pcb_actions.h"
#include "board_commit.h"
#include <functional>
#include <memory>
#include <eda_pattern_match.h>
#include <wx/tokenzr.h>
using namespace std::placeholders;
@ -74,7 +73,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_CLOSE, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer )
// Toolbar events
EVT_TOOL( ID_MODVIEW_SELECT_PART, FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint )
EVT_TOOL( ID_MODVIEW_OPTIONS, FOOTPRINT_VIEWER_FRAME::InstallDisplayOptions )
EVT_TOOL( ID_MODVIEW_NEXT, FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList )
EVT_TOOL( ID_MODVIEW_PREVIOUS, FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList )
@ -86,6 +84,9 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, FOOTPRINT_VIEWER_FRAME::OnUpdateSelectZoom )
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD, FOOTPRINT_VIEWER_FRAME::OnUpdateFootprintButton )
EVT_TEXT( ID_MODVIEW_LIB_FILTER, FOOTPRINT_VIEWER_FRAME::OnLibFilter )
EVT_TEXT( ID_MODVIEW_FOOTPRINT_FILTER, FOOTPRINT_VIEWER_FRAME::OnFPFilter )
// listbox events
EVT_LISTBOX( ID_MODVIEW_LIB_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnLibList )
EVT_LISTBOX( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList )
@ -99,12 +100,6 @@ END_EVENT_TABLE()
* In modal mode:
* a tool to export the selected footprint is shown in the toolbar
* the style is wxFRAME_FLOAT_ON_PARENT
* Note:
* On windows, when the frame with type wxFRAME_FLOAT_ON_PARENT is displayed
* its parent frame is sometimes brought to the foreground when closing the
* LIB_VIEW_FRAME frame.
* If it still happens, it could be better to use wxSTAY_ON_TOP
* instead of wxFRAME_FLOAT_ON_PARENT
*/
#define PARENT_STYLE ( KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT )
@ -137,11 +132,38 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) );
SetIcon( icon );
m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
wxPanel* libPanel = new wxPanel( this );
wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
m_libFilter = new wxTextCtrl( libPanel, ID_MODVIEW_LIB_FILTER, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_libFilter->SetHint( _( "Filter" ) );
libSizer->Add( m_libFilter, 0, wxEXPAND, 5 );
m_libList = new wxListBox( libPanel, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
libSizer->Add( m_libList, 1, wxEXPAND, 5 );
libPanel->SetSizer( libSizer );
libPanel->Fit();
wxPanel* fpPanel = new wxPanel( this );
wxSizer* fpSizer = new wxBoxSizer( wxVERTICAL );
m_fpFilter = new wxTextCtrl( fpPanel, ID_MODVIEW_FOOTPRINT_FILTER, wxEmptyString,
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_fpFilter->SetHint( _( "Filter" ) );
m_fpFilter->SetToolTip( _( "Filter on footprint name, keywords, description and pad count.\n"
"Search terms are separated by spaces. All search terms must match.\n"
"A term which is a number will also match against the pad count." ) );
fpSizer->Add( m_fpFilter, 0, wxEXPAND, 5 );
m_fpList = new wxListBox( fpPanel, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
0, NULL, wxLB_HSCROLL | wxNO_BORDER );
fpSizer->Add( m_fpList, 1, wxEXPAND, 5 );
fpPanel->SetSizer( fpSizer );
fpPanel->Fit();
SetBoard( new BOARD() );
// In viewer, the default net clearance is not known (it depends on the actual board).
@ -211,9 +233,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
// Vertical items; layers 1 - 3
m_auimgr.AddPane( m_libList, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
m_auimgr.AddPane( m_footprintList, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)
m_auimgr.AddPane( fpPanel, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer( 1)
.CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
@ -284,10 +306,32 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
{
m_libList->Clear();
std::vector< wxString > nicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
std::vector<wxString> nicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
std::set<wxString> excludes;
for( unsigned ii = 0; ii < nicknames.size(); ii++ )
m_libList->Append( nicknames[ii] );
if( !m_libFilter->GetValue().IsEmpty() )
{
wxStringTokenizer tokenizer( m_libFilter->GetValue() );
while( tokenizer.HasMoreTokens() )
{
const wxString term = tokenizer.GetNextToken().Lower();
EDA_COMBINED_MATCHER matcher( term );
int matches, position;
for( const wxString& nickname : nicknames )
{
if( !matcher.Find( nickname.Lower(), matches, position ) )
excludes.insert( nickname );
}
}
}
for( const wxString& nickname : nicknames )
{
if( !excludes.count( nickname ) )
m_libList->Append( nickname );
}
// Search for a previous selection:
int index = m_libList->FindString( getCurNickname(), true );
@ -312,7 +356,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
{
m_footprintList->Clear();
m_fpList->Clear();
if( !getCurNickname() )
{
@ -332,28 +376,75 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
// For footprint libraries that support one footprint per file, there may have been
// valid footprints read so show the footprints that loaded properly.
if( fp_info_list->GetList().size() == 0 )
if( fp_info_list->GetList().empty() )
return;
}
for( auto& footprint : fp_info_list->GetList() )
std::set<wxString> excludes;
if( !m_fpFilter->GetValue().IsEmpty() )
{
m_footprintList->Append( footprint->GetFootprintName() );
wxStringTokenizer tokenizer( m_fpFilter->GetValue() );
while( tokenizer.HasMoreTokens() )
{
const wxString term = tokenizer.GetNextToken().Lower();
EDA_COMBINED_MATCHER matcher( term );
int matches, position;
for( const unique_ptr<FOOTPRINT_INFO>& footprint : fp_info_list->GetList() )
{
wxString search = footprint->GetFootprintName() + footprint->GetSearchText();
bool matched = matcher.Find( search.Lower(), matches, position );
if( !matched && term.IsNumber() )
matched = wxAtoi( term ) == footprint->GetPadCount();
if( !matched )
excludes.insert( footprint->GetFootprintName() );
}
}
}
int index = m_footprintList->FindString( getCurFootprintName(), true );
for( const unique_ptr<FOOTPRINT_INFO>& footprint : fp_info_list->GetList() )
{
if( !excludes.count( footprint->GetFootprintName() ) )
m_fpList->Append( footprint->GetFootprintName() );
}
int index = m_fpList->FindString( getCurFootprintName(), true );
if( index == wxNOT_FOUND )
setCurFootprintName( wxEmptyString );
else
{
m_footprintList->SetSelection( index, true );
m_footprintList->EnsureVisible( index );
m_fpList->SetSelection( index, true );
m_fpList->EnsureVisible( index );
}
}
void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::OnLibFilter( wxCommandEvent& aEvent )
{
ReCreateLibraryList();
// Required to avoid interaction with SetHint()
// See documentation for wxTextEntry::SetHint
aEvent.Skip();
}
void FOOTPRINT_VIEWER_FRAME::OnFPFilter( wxCommandEvent& aEvent )
{
ReCreateFootprintList();
// Required to avoid interaction with SetHint()
// See documentation for wxTextEntry::SetHint
aEvent.Skip();
}
void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& aEvent )
{
int ii = m_libList->GetSelection();
@ -372,17 +463,17 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
}
void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& aEvent )
{
if( m_footprintList->GetCount() == 0 )
if( m_fpList->GetCount() == 0 )
return;
int ii = m_footprintList->GetSelection();
int ii = m_fpList->GetSelection();
if( ii < 0 )
return;
wxString name = m_footprintList->GetString( ii );
wxString name = m_fpList->GetString( ii );
if( getCurFootprintName().CmpNoCase( name ) != 0 )
{
@ -422,19 +513,19 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
}
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& aEvent )
{
AddFootprintToPCB( event );
AddFootprintToPCB( aEvent );
}
void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& event )
void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
{
if( IsModal() )
{
if( m_footprintList->GetSelection() >= 0 )
if( m_fpList->GetSelection() >= 0 )
{
LIB_ID fpid( getCurNickname(), m_footprintList->GetStringSelection() );
LIB_ID fpid( getCurNickname(), m_fpList->GetStringSelection() );
DismissModal( true, fpid.Format() );
}
else
@ -684,44 +775,16 @@ void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
}
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{
LIB_ID current( getCurNickname(), getCurFootprintName() );
MODULE* module = SelectFootprintFromLibTree( current, false );
if( module )
{
const LIB_ID& fpid = module->GetFPID();
setCurNickname( fpid.GetLibNickname() );
setCurFootprintName( fpid.GetLibItemName() );
int index = m_libList->FindString( fpid.GetLibNickname(), true );
if( index != wxNOT_FOUND )
{
m_libList->SetSelection( index, true );
m_libList->EnsureVisible( index );
}
ReCreateFootprintList();
SelectAndViewFootprint( NEW_PART );
}
}
void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
{
if( !getCurNickname() )
return;
int selection = m_footprintList->FindString( getCurFootprintName(), true );
int selection = m_fpList->FindString( getCurFootprintName(), true );
if( aMode == NEXT_PART )
{
if( selection != wxNOT_FOUND && selection < (int)m_footprintList->GetCount()-1 )
if( selection != wxNOT_FOUND && selection < (int)m_fpList->GetCount() - 1 )
selection++;
}
@ -733,10 +796,10 @@ void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
if( selection != wxNOT_FOUND )
{
m_footprintList->SetSelection( selection );
m_footprintList->EnsureVisible( selection );
m_fpList->SetSelection( selection );
m_fpList->EnsureVisible( selection );
setCurFootprintName( m_footprintList->GetString( (unsigned) selection ) );
setCurFootprintName( m_fpList->GetString((unsigned) selection ) );
// Delete the current footprint
GetBoard()->DeleteAllModules();

View File

@ -83,9 +83,10 @@ public:
bool ShowModal( wxString* aFootprint, wxWindow* aParent ) override;
private:
wxListBox* m_libList; // The list of libs names
wxListBox* m_footprintList; // The list of footprint names
wxTextCtrl* m_libFilter;
wxListBox* m_libList; // The list of libs names
wxTextCtrl* m_fpFilter;
wxListBox* m_fpList; // The list of footprint names
bool m_autoZoom;
double m_lastZoom;
@ -115,11 +116,14 @@ private:
void ReCreateVToolbar() override;
void ReCreateMenuBar() override;
void ClickOnLibList( wxCommandEvent& event );
void ClickOnFootprintList( wxCommandEvent& event );
void DClickOnFootprintList( wxCommandEvent& event );
void OnLibFilter( wxCommandEvent& aEvent );
void OnFPFilter( wxCommandEvent& aEvent );
void InstallDisplayOptions( wxCommandEvent& event );
void ClickOnLibList( wxCommandEvent& aEvent );
void ClickOnFootprintList( wxCommandEvent& aEvent );
void DClickOnFootprintList( wxCommandEvent& aEvent );
void InstallDisplayOptions( wxCommandEvent& aEvent );
void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override;
@ -132,17 +136,11 @@ private:
*/
void OnActivate( wxActivateEvent& event );
/**
* Function SelectCurrentFootprint
* Selects the current footprint name and display it
*/
void SelectCurrentFootprint( wxCommandEvent& event );
/**
* Function AddFootprintToPCB
* exports the current footprint name and close the library browser.
*/
void AddFootprintToPCB( wxCommandEvent& event );
void AddFootprintToPCB( wxCommandEvent& aEvent );
/**
* Function SelectAndViewFootprint

View File

@ -130,9 +130,10 @@ enum pcbnew_ids
ID_MODEDIT_NEW_MODULE_FROM_WIZARD,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
ID_MODVIEW_LIB_FILTER,
ID_MODVIEW_LIB_LIST,
ID_MODVIEW_FOOTPRINT_FILTER,
ID_MODVIEW_FOOTPRINT_LIST,
ID_MODVIEW_SELECT_PART,
ID_MODVIEW_OPTIONS,
ID_MODVIEW_PREVIOUS,
ID_MODVIEW_NEXT,

View File

@ -50,11 +50,6 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_PART, wxEmptyString,
KiScaledBitmap( load_module_lib_xpm, this ),
_( "Select footprint to browse" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODVIEW_OPTIONS, wxEmptyString,
KiScaledBitmap( config_xpm, this ),
_( "Display options" ) );