KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_chooser_frame.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2023 CERN
5 * Copyright (C) 2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#include <pgm_base.h>
26#include <kiface_base.h>
27#include <kiway.h>
28#include <kiway_express.h>
29#include <board.h>
30#include <wx/button.h>
31#include <wx/checkbox.h>
32#include <kiplatform/ui.h>
33#include <lset.h>
38#include "wx/display.h"
40#include <project_pcb.h>
43
44
45static wxArrayString s_FootprintHistoryList;
46static unsigned s_FootprintHistoryMaxCount = 8;
47
48static void AddFootprintToHistory( const wxString& aName )
49{
50 // Remove duplicates
51 for( int ii = (int) s_FootprintHistoryList.GetCount() - 1; ii >= 0; --ii )
52 {
53 if( s_FootprintHistoryList[ ii ] == aName )
54 s_FootprintHistoryList.RemoveAt( (size_t) ii );
55 }
56
57 // Add the new name at the beginning of the history list
58 s_FootprintHistoryList.Insert( aName, 0 );
59
60 // Remove extra names
62 s_FootprintHistoryList.RemoveAt( s_FootprintHistoryList.GetCount() - 1 );
63}
64
65
66BEGIN_EVENT_TABLE( FOOTPRINT_CHOOSER_FRAME, PCB_BASE_FRAME )
68 EVT_BUTTON( wxID_OK, FOOTPRINT_CHOOSER_FRAME::OnOK )
69 EVT_BUTTON( wxID_CANCEL, FOOTPRINT_CHOOSER_FRAME::closeFootprintChooser )
71END_EVENT_TABLE()
72
73
74#define MODAL_FRAME ( wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN \
75 | wxWANTS_CHARS | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT )
76
77
79 PCB_BASE_FRAME( aKiway, aParent, FRAME_FOOTPRINT_CHOOSER, _( "Footprint Chooser" ),
80 wxDefaultPosition, wxDefaultSize, MODAL_FRAME,
82 m_filterByPinCount( nullptr ),
83 m_filterByFPFilters( nullptr ),
84 m_boardAdapter(),
85 m_currentCamera( m_trackBallCamera ),
86 m_trackBallCamera( 2 * RANGE_SCALE_3D ),
87 m_pinCount( 0 ),
88 m_firstPaintEvent( true )
89{
90 SetModal( true );
91
92 m_showFpMode = true;
93 m_show3DMode = false;
94 m_messagePanel->Hide();
95
96 wxPanel* bottomPanel = new wxPanel( this );
97 wxBoxSizer* bottomSizer = new wxBoxSizer( wxVERTICAL );
98 wxBoxSizer* frameSizer = new wxBoxSizer( wxVERTICAL );
99
101 // Filter
102 [this]( LIB_TREE_NODE& aNode ) -> bool
103 {
104 return filterFootprint( aNode );
105 },
106 // Accept handler
107 [this]()
108 {
109 wxCommandEvent dummy;
110 OnOK( dummy );
111 },
112 // Escape handler
113 [this]()
114 {
115 DismissModal( false );
116 } );
117
118 frameSizer->Add( m_chooserPanel, 1, wxEXPAND );
119
120 SetBoard( new BOARD() );
121
122 // This board will only be used to hold a footprint for viewing
123 GetBoard()->SetBoardUse( BOARD_USE::FPHOLDER );
124
125 build3DCanvas(); // must be called after creating m_chooserPanel
127
128 // buttonsSizer contains the BITMAP buttons
129 wxBoxSizer* buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
130
131 buttonsSizer->Add( 0, 0, 1, 0, 5 ); // Add spacer to right-align buttons
132
133 BITMAP_BUTTON* separator = new BITMAP_BUTTON( bottomPanel, wxID_ANY, wxNullBitmap );
134 separator->SetIsSeparator();
135 buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
136
137 m_grButton3DView = new BITMAP_BUTTON( bottomPanel, wxID_ANY, wxNullBitmap );
139 m_grButton3DView->SetBitmap( KiBitmapBundle( BITMAPS::shape_3d ) );
141 buttonsSizer->Add( m_grButton3DView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
142
143 m_grButtonFpView = new BITMAP_BUTTON( bottomPanel, wxID_ANY, wxNullBitmap );
145 m_grButtonFpView->SetBitmap( KiBitmapBundle( BITMAPS::module ) );
147 buttonsSizer->Add( m_grButtonFpView, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
148
149 separator = new BITMAP_BUTTON( bottomPanel, wxID_ANY, wxNullBitmap );
150 separator->SetIsSeparator();
151 buttonsSizer->Add( separator, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 1 );
152
153 m_show3DViewer = new wxCheckBox( bottomPanel, wxID_ANY, _( "Show 3D viewer in own window" ) );
154 buttonsSizer->Add( m_show3DViewer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 3 );
155
156 wxStdDialogButtonSizer* sdbSizer = new wxStdDialogButtonSizer();
157 wxButton* okButton = new wxButton( bottomPanel, wxID_OK );
158 wxButton* cancelButton = new wxButton( bottomPanel, wxID_CANCEL );
159
160 sdbSizer->AddButton( okButton );
161 sdbSizer->AddButton( cancelButton );
162 sdbSizer->Realize();
163
164 buttonsSizer->Add( 20, 0, 0, 0, 5 ); // Add spacer
165 buttonsSizer->Add( sdbSizer, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );
166 bottomSizer->Add( buttonsSizer, 0, wxEXPAND, 5 );
167
168 bottomPanel->SetSizer( bottomSizer );
169 frameSizer->Add( bottomPanel, 0, wxEXPAND );
170
171 SetSizer( frameSizer );
172
173 SetTitle( GetTitle() + wxString::Format( _( " (%d items loaded)" ),
175
176 Layout();
178
179 // Connect Events
180 m_grButton3DView->Connect( wxEVT_COMMAND_BUTTON_CLICKED ,
181 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::on3DviewReq ),
182 nullptr, this );
183
184 m_grButtonFpView->Connect( wxEVT_COMMAND_BUTTON_CLICKED ,
185 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::onFpViewReq ),
186 nullptr, this );
187
188 m_show3DViewer->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED ,
190 nullptr, this );
191
192 Connect( FP_SELECTION_EVENT, // custom event fired by a PANEL_FOOTPRINT_CHOOSER
193 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::onFpChanged ), nullptr, this );
194
195 // Needed on Linux to fix the position of widgets in bottomPanel
196 PostSizeEvent();
197}
198
199
201{
202 // Disconnect Events
203 m_grButton3DView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
204 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::on3DviewReq ),
205 nullptr, this );
206 m_grButtonFpView->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
207 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::onFpViewReq ),
208 nullptr, this );
209
210 m_show3DViewer->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED ,
212 nullptr, this );
213
214 Disconnect( FP_SELECTION_EVENT,
215 wxCommandEventHandler( FOOTPRINT_CHOOSER_FRAME::onFpChanged ), nullptr, this );
216
217 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
218 {
220 cfg->m_FootprintChooser.use_fp_filters = m_filterByFPFilters->GetValue();
221
223 cfg->m_FootprintChooser.filter_on_pin_count = m_filterByPinCount->GetValue();
224 }
225}
226
227
229{
230 if( aEvent.IsChecked() )
231 {
233 Show3DViewerFrame(); // show external 3D viewer
234 }
235 else
236 {
237 // Close the external 3D viewer frame, if it is still enabled
239
240 if( viewer3D )
241 viewer3D->Close( true );
242 }
243
245}
246
247
249{
250 bool do_reload_board = true; // reload board flag
251
252 // At EDA_3D_VIEWER_FRAME creation, the current board is loaded, so disable loading
253 // the current board if the 3D frame is not yet created
254 if( Get3DViewerFrame() == nullptr )
255 do_reload_board = false;
256
258
259 // A stronger version of Raise() which promotes the window to its parent's level.
260 KIPLATFORM::UI::ReparentModal( draw3DFrame );
261
262 // And load or update the current board (if needed)
263 if( do_reload_board )
264 Update3DView( true, true );
265}
266
267
269 bool aRefresh, const wxString* aTitle )
270{
272 wxString footprintName;
273
274 if( fpID.IsValid() )
275 footprintName << fpID.Format();
276
277 wxString title = _( "3D Viewer" ) + wxT( " \u2014 " ) + footprintName;
278 PCB_BASE_FRAME::Update3DView( aMarkDirty, aRefresh, &title );
279}
280
281
283{
285 return m_filterByPinCount->GetValue();
286
287 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
288 return cfg->m_FootprintChooser.filter_on_pin_count;
289
290 return false;
291}
292
293
295{
297 return m_filterByFPFilters->GetValue();
298
299 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
300 return cfg->m_FootprintChooser.use_fp_filters;
301
302 return false;
303}
304
305
307{
308 if( aNode.m_Type == LIB_TREE_NODE::TYPE::LIBRARY )
309 {
310 // Normally lib nodes get scored by the max of their children's scores. However, if a
311 // lib node *has* no children then the scorer will call the filter on the lib node itself,
312 // and we just want to return true if we're not filtering at all.
313 return !filterByPinCount() && !filterByFPFilters();
314 }
315
316 auto patternMatch =
317 []( LIB_ID& id, std::vector<std::unique_ptr<EDA_PATTERN_MATCH>>& filters ) -> bool
318 {
319 // The matching is case insensitive
320 wxString name;
321
322 for( const std::unique_ptr<EDA_PATTERN_MATCH>& filter : filters )
323 {
324 name.Empty();
325
326 // If the filter contains a ':' then include the library name in the pattern
327 if( filter->GetPattern().Contains( wxS( ":" ) ) )
328 name = id.GetUniStringLibNickname().Lower() + wxS( ":" );
329
330 name += id.GetUniStringLibItemName().Lower();
331
332 if( filter->Find( name ) )
333 return true;
334 }
335
336 return false;
337 };
338
339 if( m_pinCount > 0 && filterByPinCount() )
340 {
341 if( aNode.m_PinCount != m_pinCount )
342 return false;
343 }
344
345 if( !m_fpFilters.empty() && filterByFPFilters() )
346 {
347 if( !patternMatch( aNode.m_LibId, m_fpFilters ) )
348 return false;
349 }
350
351 return true;
352}
353
354
356{
357 // Only dismiss a modal frame once, so that the return values set by
358 // the prior DismissModal() are not bashed for ShowModal().
359 if( !IsDismissed() )
360 DismissModal( false );
361
362 // window to be destroyed by the caller of KIWAY_PLAYER::ShowModal()
363}
364
365
367{
368 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
369 wxCHECK_MSG( cfg, nullptr, wxT( "config not existing" ) );
370
371 return &cfg->m_FootprintViewer;
372}
373
374
376{
378
379 if( cfg )
380 return Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme );
381 else
383}
384
385
386static wxRect s_dialogRect( 0, 0, 0, 0 );
387
388
390{
391 const std::string& payload = mail.GetPayload();
392
393 switch( mail.Command() )
394 {
396 {
397 wxSizer* filtersSizer = m_chooserPanel->GetFiltersSizer();
398 wxWindow* filtersWindow = filtersSizer->GetContainingWindow();
399 wxString msg;
400
401 m_pinCount = 0;
402 m_fpFilters.clear();
403
404 /*
405 * Symbol netlist format:
406 * pinNumber pinName <tab> pinNumber pinName...
407 * fpFilter fpFilter...
408 */
409 std::map<wxString, wxString> pinNames;
410 std::vector<std::string> strings = split( payload, "\r" );
411
412 if( strings.size() >= 1 && !strings[0].empty() )
413 {
414 for( const wxString& pin : wxSplit( strings[0], '\t' ) )
415 pinNames[ pin.BeforeFirst( ' ' ) ] = pin.AfterFirst( ' ' );
416
417 m_pinCount = pinNames.size();
418
419 if( m_pinCount > 0 )
420 {
421 msg.Printf( _( "Filter by pin count (%d)" ), m_pinCount );
422 m_filterByPinCount = new wxCheckBox( filtersWindow, wxID_ANY, msg );
423
424 m_filterByPinCount->Bind( wxEVT_CHECKBOX,
425 [&]( wxCommandEvent& evt )
426 {
428 } );
429
430 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
431 m_filterByPinCount->SetValue( cfg->m_FootprintChooser.filter_on_pin_count );
432 }
433 }
434
435 if( strings.size() >= 2 && !strings[1].empty() )
436 {
437 for( const wxString& filter : wxSplit( strings[1], ' ' ) )
438 {
439 m_fpFilters.push_back( std::make_unique<EDA_PATTERN_MATCH_WILDCARD_ANCHORED>() );
440 m_fpFilters.back()->SetPattern( filter.Lower() );
441 }
442
443 msg.Printf( _( "Apply footprint filters (%s)" ), strings[1] );
444 m_filterByFPFilters = new wxCheckBox( filtersWindow, wxID_ANY, msg );
445
446 m_filterByFPFilters->Bind( wxEVT_CHECKBOX,
447 [&]( wxCommandEvent& evt )
448 {
450 } );
451
452 if( PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
453 m_filterByFPFilters->SetValue( cfg->m_FootprintChooser.use_fp_filters );
454 }
455
457 m_chooserPanel->GetFiltersSizer()->Add( m_filterByFPFilters, 0, wxEXPAND|wxBOTTOM, 4 );
458
460 m_chooserPanel->GetFiltersSizer()->Add( m_filterByPinCount, 0, wxEXPAND|wxBOTTOM, 4 );
461
463
464 // Save the wxFormBuilder size of the dialog...
465 if( s_dialogRect.GetSize().x == 0 || s_dialogRect.GetSize().y == 0 )
466 s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
467
468 // ... and then give it a kick to get it to layout the new items
469 GetSizer()->SetSizeHints( this );
470 break;
471 }
472
473 default:
474 break;
475 }
476}
477
478
479bool FOOTPRINT_CHOOSER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aParent )
480{
481 if( aFootprint && !aFootprint->IsEmpty() )
482 {
483 LIB_ID fpid;
484
485 fpid.Parse( *aFootprint, true );
486
487 if( fpid.IsValid() )
489 }
490
491 return KIWAY_PLAYER::ShowModal( aFootprint, aParent );
492}
493
494
495void FOOTPRINT_CHOOSER_FRAME::SetPosition( const wxPoint& aNewPosition )
496{
497 PCB_BASE_FRAME::SetPosition( aNewPosition );
498
499 s_dialogRect.SetPosition( aNewPosition );
500}
501
502
504{
505 bool ret;
506
507 // Show or hide the window. If hiding, save current position and size.
508 // If showing, use previous position and size.
509 if( show )
510 {
511#ifndef __WINDOWS__
512 PCB_BASE_FRAME::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
513#endif
514 ret = PCB_BASE_FRAME::Show( show );
515
516 // returns a zeroed-out default wxRect if none existed before.
517 wxRect savedDialogRect = s_dialogRect;
518
519 if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
520 {
521 SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
522 std::max( wxWindow::GetSize().x, savedDialogRect.GetSize().x ),
523 std::max( wxWindow::GetSize().y, savedDialogRect.GetSize().y ),
524 0 );
525 }
526
527 // Be sure that the dialog appears in a visible area
528 // (the dialog position might have been stored at the time when it was
529 // shown on another display)
530 if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
531 Centre();
532 }
533 else
534 {
535 s_dialogRect = wxRect( wxWindow::GetPosition(), wxWindow::GetSize() );
536 ret = PCB_BASE_FRAME::Show( show );
537 }
538
539 return ret;
540}
541
542
543void FOOTPRINT_CHOOSER_FRAME::OnPaint( wxPaintEvent& aEvent )
544{
546 {
549
550 m_firstPaintEvent = false;
551 }
552
553 aEvent.Skip();
554}
555
556
557void FOOTPRINT_CHOOSER_FRAME::OnOK( wxCommandEvent& aEvent )
558{
560
561 if( fpID.IsValid() )
562 {
563 wxString footprint = fpID.Format();
564
565 AddFootprintToHistory( footprint );
566 DismissModal( true, footprint );
567 }
568 else
569 {
570 DismissModal( false );
571 }
572}
573
574
576{
577 Close( false );
578}
579
580
581void FOOTPRINT_CHOOSER_FRAME::onFpChanged( wxCommandEvent& event )
582{
583 updateViews();
584}
585
586
588{
589 // Create the dummy board used by the 3D canvas
591 m_dummyBoard->SetProject( &Prj(), true );
592
593 // This board will only be used to hold a footprint for viewing
594 m_dummyBoard->SetBoardUse( BOARD_USE::FPHOLDER );
595
598 m_boardAdapter.m_IsPreviewer = true; // Force display 3D models, regardless the 3D viewer options
599
601 m_boardAdapter.m_Cfg = cfg;
602
603 // Build the 3D canvas
605 OGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE::AA_8X ),
608
609 m_chooserPanel->m_RightPanelSizer->Add( m_preview3DCanvas, 1, wxALL | wxEXPAND, 5 );
610 m_chooserPanel->m_RightPanel->Layout();
611
613 dummy_bds.SetBoardThickness( pcbIUScale.mmToIU( 1.6 ) );
616 dummy_board_stackup.RemoveAll();
617 dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
618}
619
620
621void FOOTPRINT_CHOOSER_FRAME::on3DviewReq( wxCommandEvent& event )
622{
623 if( m_show3DMode == true )
624 {
625 if( m_showFpMode == true )
626 {
627 m_show3DMode = false;
630 }
631 }
632 else
633 {
634 if( m_show3DViewer->IsChecked() )
635 {
637 }
638 else
639 {
640 // Close 3D viewer frame, if it is still enabled
642 if( viewer3D )
643 viewer3D->Close( true );
644 }
645
646 m_show3DMode = true;
649 }
650}
651
652
653void FOOTPRINT_CHOOSER_FRAME::onFpViewReq( wxCommandEvent& event )
654{
655 if( m_showFpMode == true )
656 {
657 if( m_show3DMode == true )
658 {
659 m_showFpMode = false;
662 }
663 }
664 else
665 {
666 m_showFpMode = true;
669 }
670}
671
672
674{
676 bool reloadFp = viewer3D || m_preview3DCanvas->IsShown();
677
678 if( reloadFp )
679 {
681
684
685 }
686
687 if( m_preview3DCanvas->IsShown() )
688 {
691 }
692
693 if( viewer3D )
694 {
695 Update3DView( true, true );
696 }
697
698 m_chooserPanel->m_RightPanel->Layout();
699 m_chooserPanel->m_RightPanel->Refresh();
700}
701
703{
705 viewFpPanel->Show( m_showFpMode );
707
708 updateViews();
709}
710
const char * name
Definition: DXF_plotter.cpp:57
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
#define RANGE_SCALE_3D
This defines the range that all coord will have to be rendered.
Definition: board_adapter.h:66
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
A bitmap button widget that behaves like an AUI toolbar item's button when it is drawn.
Definition: bitmap_button.h:42
void SetIsRadioButton()
bool IsChecked() const
void Check(bool aCheck=true)
Check the control.
void SetIsSeparator()
Render button as a toolbar separator.
void SetBitmap(const wxBitmapBundle &aBmp)
Set the bitmap shown when the button is enabled.
bool m_IsPreviewer
true if we're in a 3D preview panel, false for the standard 3D viewer
void SetBoard(BOARD *aBoard) noexcept
Set current board to be rendered.
EDA_3D_VIEWER_SETTINGS * m_Cfg
Container for design settings for a BOARD object.
void SetEnabledLayers(LSET aMask)
Change the bit-mask of enabled layers to aMask.
BOARD_STACKUP & GetStackupDescriptor()
void SetBoardThickness(int aThickness)
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:290
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:1000
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:302
void SetProject(PROJECT *aProject, bool aReferenceOnly=false)
Link a board to a given project.
Definition: board.cpp:197
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1395
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:892
Color settings are a bit different than most of the settings objects in that there can be more than o...
Implement a canvas based on a wxGLCanvas.
Definition: eda_3d_canvas.h:49
void ReloadRequest(BOARD *aBoard=nullptr, S3D_CACHE *aCachePointer=nullptr)
void Request_refresh(bool aRedrawImmediately=true)
Schedule a refresh update of the canvas.
Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard.
EDA_MSG_PANEL * m_messagePanel
void onFpViewReq(wxCommandEvent &event)
void updateViews()
Must be called after loading a new footprint: update footprint and/or 3D views.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void closeFootprintChooser(wxCommandEvent &aEvent)
bool filterFootprint(LIB_TREE_NODE &aNode)
void on3DviewReq(wxCommandEvent &event)
void onFpChanged(wxCommandEvent &event)
FOOTPRINT_CHOOSER_FRAME(KIWAY *aKiway, wxWindow *aParent)
bool ShowModal(wxString *aFootprint, wxWindow *aParent) override
void OnPaint(wxPaintEvent &aEvent)
bool Show(bool show) override
void OnOK(wxCommandEvent &aEvent)
void updatePanelsVisibility()
Show hide footprint view panel and/or 3d view panel according to the options (display 3D shapes and u...
void SetPosition(const wxPoint &aNewPosition)
Force the position of the dialog to a new position.
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
std::vector< std::unique_ptr< EDA_PATTERN_MATCH > > m_fpFilters
void onExternalViewer3DEnable(wxCommandEvent &aEvent)
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh) const override
Helper to retrieve the current color settings.
PANEL_FOOTPRINT_CHOOSER * m_chooserPanel
void SetPinFunctions(const std::map< wxString, wxString > &aPinFunctions)
Set the pin functions from the symbol's netlist.
EDA_ITEM * Clone() const override
Invoke a function on all children.
Definition: footprint.cpp:2032
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
std::string & GetPayload()
Return the payload, which can be any text but it typically self identifying s-expression.
Definition: kiway_express.h:58
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:50
virtual bool ShowModal(wxString *aResult=nullptr, wxWindow *aResultantFocusWindow=nullptr)
Show this wxFrame as if it were a modal dialog, with all other instantiated wxFrames disabled until t...
bool IsDismissed()
void SetModal(bool aIsModal)
Definition: kiway_player.h:155
void DismissModal(bool aRetVal, const wxString &aResult=wxEmptyString)
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:284
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:51
bool IsValid() const
Check if this LID_ID is valid.
Definition: lib_id.h:172
UTF8 Format() const
Definition: lib_id.cpp:118
Model class in the component selector Model-View-Adapter (mediated MVC) architecture.
enum TYPE m_Type
static LSET FrontMask()
Return a mask holding all technical layers and the external CU layer on front side.
Definition: lset.cpp:772
static LSET BackMask()
Return a mask holding all technical layers and the external CU layer on back side.
Definition: lset.cpp:779
static const wxGLAttributes GetAttributesList(ANTIALIASING_MODE aAntiAliasingMode, bool aAlpha=false)
Get a list of attributes to pass to wxGLCanvas.
wxWindow * GetFocusTarget() const
FOOTPRINT_PREVIEW_WIDGET * GetViewerPanel() const
void SetPreselect(const LIB_ID &aPreselect)
LIB_ID GetSelectedLibId() const
To be called after this dialog returns from ShowModal().
WINDOW_SETTINGS m_FootprintViewer
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
virtual void SetBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
BOARD * GetBoard() const
EDA_3D_VIEWER_FRAME * CreateAndShow3D_Frame()
Shows the 3D view frame.
EDA_3D_VIEWER_FRAME * Get3DViewerFrame()
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
static S3D_CACHE * Get3DCacheManager(PROJECT *aProject, bool updateProjDir=false)
Return a pointer to an instance of the 3D cache manager.
Definition: project_pcb.cpp:77
T * GetAppSettings()
Returns a handle to the a given settings by type If the settings have already been loaded,...
COLOR_SETTINGS * GetColorSettings(const wxString &aName="user")
Retrieves a color settings object that applications can read colors from.
#define _(s)
Declaration of the eda_3d_viewer class.
#define FOOTPRINT_CHOOSER_FRAME_NAME
static wxRect s_dialogRect(0, 0, 0, 0)
static wxArrayString s_FootprintHistoryList
static unsigned s_FootprintHistoryMaxCount
static void AddFootprintToHistory(const wxString &aName)
#define MODAL_FRAME
@ FRAME_FOOTPRINT_CHOOSER
Definition: frame_type.h:44
PROJECT & Prj()
Definition: kicad.cpp:595
@ MAIL_SYMBOL_NETLIST
Definition: mail_type.h:45
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: wxgtk/ui.cpp:94
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: wxgtk/ui.cpp:67
void ReparentModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: wxgtk/ui.cpp:88
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
std::vector< FAB_LAYER_COLOR > dummy
static std::vector< std::string > split(const std::string &aStr, const std::string &aDelim)
Split the input string into a vector of output strings.
Definition: string_utils.h:317
constexpr int mmToIU(double mm) const
Definition: base_units.h:88
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74