KiCad PCB EDA Suite
Loading...
Searching...
No Matches
footprint_viewer_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) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008-2016 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-2023 KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
27#include <bitmaps.h>
28#include <board_commit.h>
29#include <board.h>
30#include <footprint.h>
31#include <confirm.h>
32#include <eda_pattern_match.h>
33#include <footprint_info.h>
35#include <fp_lib_table.h>
36#include <kiway.h>
37#include <kiway_express.h>
39#include <widgets/msgpanel.h>
40#include <widgets/wx_listbox.h>
43#include <pcb_draw_panel_gal.h>
44#include <pcb_painter.h>
45#include <pcbnew_id.h>
47#include <pgm_base.h>
48#include <project_pcb.h>
51#include <tool/action_toolbar.h>
52#include <tool/common_control.h>
53#include <tool/common_tools.h>
54#include <tool/selection.h>
56#include <tool/tool_manager.h>
57#include <tool/zoom_tool.h>
59#include <tools/pcb_actions.h>
61#include <tools/pcb_control.h>
67#include <wx/srchctrl.h>
68#include <wx/tokenzr.h>
69#include <wx/choice.h>
70#include <wx/hyperlink.h>
71
72#include "invoke_pcb_dialog.h"
73
74using namespace std::placeholders;
75
76
77#define NEW_PART 0
78#define NEXT_PART 1
79#define PREVIOUS_PART 2
80#define RELOAD_PART 3
81
82
83BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, PCB_BASE_FRAME )
84 // Window events
87
88 EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::OnExitKiCad )
90
91 // Toolbar events
97
99
102
103 // listbox events
106
107END_EVENT_TABLE()
108
109
111 PCB_BASE_FRAME( aKiway, aParent, FRAME_FOOTPRINT_VIEWER, _( "Footprint Library Browser" ),
112 wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
114 m_comp( LIB_ID(), wxEmptyString, wxEmptyString, KIID_PATH(), {} )
115{
116 m_aboutTitle = _HKI( "KiCad Footprint Library Browser" );
117
118 // Force the items to always snap
119 m_magneticItems.pads = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
120 m_magneticItems.tracks = MAGNETIC_OPTIONS::CAPTURE_ALWAYS;
121 m_magneticItems.graphics = true;
122
123 // Force the frame name used in config. the footprint viewer frame has a name
124 // depending on aFrameType (needed to identify the frame by wxWidgets),
125 // but only one configuration is preferable.
126 m_configName = FOOTPRINT_VIEWER_FRAME_NAME;
127
128 // Give an icon
129 wxIcon icon;
130 icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_footprint_browser ) );
131 SetIcon( icon );
132
133 m_libListWidth = 200;
134 m_fpListWidth = 300;
135
136 wxPanel* libPanel = new wxPanel( this );
137 wxSizer* libSizer = new wxBoxSizer( wxVERTICAL );
138
139 m_libFilter = new wxSearchCtrl( libPanel, ID_MODVIEW_LIB_FILTER, wxEmptyString,
140 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
141 m_libFilter->SetDescriptiveText( _( "Filter" ) );
142 libSizer->Add( m_libFilter, 0, wxEXPAND, 5 );
143
144 m_libList = new WX_LISTBOX( libPanel, ID_MODVIEW_LIB_LIST, wxDefaultPosition, wxDefaultSize,
145 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
146 libSizer->Add( m_libList, 1, wxEXPAND, 5 );
147
148 libPanel->SetSizer( libSizer );
149 libPanel->Fit();
150
151 wxPanel* fpPanel = new wxPanel( this );
152 wxSizer* fpSizer = new wxBoxSizer( wxVERTICAL );
153
154 m_fpFilter = new wxSearchCtrl( fpPanel, ID_MODVIEW_FOOTPRINT_FILTER, wxEmptyString,
155 wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
156 m_fpFilter->SetDescriptiveText( _( "Filter" ) );
157 m_fpFilter->SetToolTip(
158 _( "Filter on footprint name, keywords, description and pad count.\n"
159 "Search terms are separated by spaces. All search terms must match.\n"
160 "A term which is a number will also match against the pad count." ) );
161 fpSizer->Add( m_fpFilter, 0, wxEXPAND, 5 );
162
163#ifdef __WXGTK__
164 // wxSearchCtrl vertical height is not calculated correctly on some GTK setups
165 // See https://gitlab.com/kicad/code/kicad/-/issues/9019
166 m_libFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
167 m_fpFilter->SetMinSize( wxSize( -1, GetTextExtent( wxT( "qb" ) ).y + 10 ) );
168#endif
169
170 m_fpList = new WX_LISTBOX( fpPanel, ID_MODVIEW_FOOTPRINT_LIST, wxDefaultPosition, wxDefaultSize,
171 0, nullptr, wxLB_HSCROLL | wxNO_BORDER );
172
173 m_fpList->Connect( wxEVT_LEFT_DCLICK,
175 nullptr, this );
176 fpSizer->Add( m_fpList, 1, wxEXPAND, 5 );
177
178 fpPanel->SetSizer( fpSizer );
179 fpPanel->Fit();
180
181 // Create GAL canvas
182 m_canvasType = loadCanvasTypeSetting();
183
184 PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
185 GetGalDisplayOptions(), m_canvasType );
186 SetCanvas( drawPanel );
187
188 SetBoard( new BOARD() );
189
190 // This board will only be used to hold a footprint for viewing
192
193 // In viewer, the default net clearance is not known (it depends on the actual board).
194 // So we do not show the default clearance, by setting it to 0
195 // The footprint or pad specific clearance will be shown
196 GetBoard()->GetDesignSettings().m_NetSettings->m_DefaultNetClass->SetClearance( 0 );
197
198 // Don't show the default board solder mask clearance in the footprint viewer. Only the
199 // footprint or pad clearance setting should be shown if it is not 0.
201
202 // Ensure all layers and items are visible:
204 SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
205
206 GetScreen()->m_Center = true; // Center coordinate origins on screen.
207 LoadSettings( config() );
208 GetGalDisplayOptions().m_axesEnabled = true;
209
210 // Create the manager and dispatcher & route draw panel events to the dispatcher
211 m_toolManager = new TOOL_MANAGER;
212 m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
213 drawPanel->GetViewControls(), config(), this );
214 m_actions = new PCB_ACTIONS();
215 m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
216 drawPanel->SetEventDispatcher( m_toolDispatcher );
217
218 m_toolManager->RegisterTool( new PCB_CONTROL );
219 m_toolManager->RegisterTool( new PCB_SELECTION_TOOL );
220 m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid)
221 m_toolManager->RegisterTool( new COMMON_CONTROL );
222 m_toolManager->RegisterTool( new PCB_PICKER_TOOL ); // for setting grid origin
223 m_toolManager->RegisterTool( new ZOOM_TOOL );
224 m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
225
226 m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
227
228 m_toolManager->InitTools();
229 m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
230
231 setupUIConditions();
232 ReCreateMenuBar();
233 ReCreateHToolbar();
234 ReCreateVToolbar();
235 ReCreateOptToolbar();
236
237 ReCreateLibraryList();
238 UpdateTitle();
239
240 // Call resolveCanvasType after loading settings:
241 resolveCanvasType();
242
243 // If a footprint was previously loaded, reload it
244 if( getCurNickname().size() && getCurFootprintName().size() )
245 {
246 LIB_ID id;
247
248 id.SetLibNickname( getCurNickname() );
249 id.SetLibItemName( getCurFootprintName() );
250
251 FOOTPRINT* footprint = loadFootprint( id );
252
253 if( footprint )
254 {
255 GetBoard()->Add( footprint );
256 setFPWatcher( footprint );
257 }
258 }
259
260 drawPanel->DisplayBoard( m_pcb );
261
262 m_auimgr.SetManagedWindow( this );
263
264 // Horizontal items; layers 4 - 6
265 m_auimgr.AddPane( m_mainToolBar, EDA_PANE().VToolbar().Name( "MainToolbar" ).Top().Layer(6) );
266 m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
267 m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
268
269 // Vertical items; layers 1 - 3
270 m_auimgr.AddPane( libPanel, EDA_PANE().Palette().Name( "Libraries" ).Left().Layer(2)
271 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 200, -1 ) );
272 m_auimgr.AddPane( fpPanel, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)
273 .CaptionVisible( false ).MinSize( 100, -1 ).BestSize( 300, -1 ) );
274
275 m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
276
277 // after changing something to the aui manager call Update() to reflect the changes
278 m_auimgr.Update();
279
280 if( m_libListWidth > 0 )
281 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Libraries" ), m_libListWidth, -1 );
282
283 if( m_fpListWidth > 0 )
284 SetAuiPaneSize( m_auimgr, m_auimgr.GetPane( "Footprints" ), m_fpListWidth, -1 );
285
286 // The canvas should not steal the focus from the list boxes
287 GetCanvas()->SetCanFocus( false );
288 GetCanvas()->GetGAL()->SetAxesEnabled( true );
289 ActivateGalCanvas();
290
291 // Restore last zoom and auto zoom option. (If auto-zooming we'll adjust when we load the footprint.)
292 PCBNEW_SETTINGS* cfg = GetPcbNewSettings();
293 wxASSERT( cfg );
294 GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
295
296 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_FPVIEWER_AUTOZOOM_TOOL );
297
299 toolOpt->SetState( wxAUI_BUTTON_STATE_CHECKED );
300 else
301 toolOpt->SetState( 0 );
302
303 updateView();
304 setupUnits( config() );
305
306 ReCreateFootprintList();
307 Raise(); // On some window managers, this is needed
308 Show( true );
309}
310
311
313{
314 // Shutdown all running tools
315 if( m_toolManager )
317
319 GetCanvas()->GetView()->Clear();
320 // Be sure any event cannot be fired after frame deletion:
321 GetCanvas()->SetEvtHandlerEnabled( false );
322 m_fpList->Disconnect( wxEVT_LEFT_DCLICK,
324 nullptr, this );
325 setFPWatcher( nullptr );
326}
327
328
330{
331 return m_toolManager->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
332}
333
334
336{
338
339 if( FOOTPRINT* fp = static_cast<FOOTPRINT*>( GetModel() ) )
340 {
341 std::vector<MSG_PANEL_ITEM> msgItems;
342 fp->GetMsgPanelInfo( this, msgItems );
343 SetMsgPanel( msgItems );
344 }
345}
346
347
349{
351
353 PCB_EDITOR_CONDITIONS cond( this );
354
355 wxASSERT( mgr );
356
357#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
358#define CHECK( x ) ACTION_CONDITIONS().Check( x )
359
362 mgr->SetConditions( ACTIONS::millimetersUnits, CHECK( cond.Units( EDA_UNITS::MILLIMETRES ) ) );
363 mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) );
364 mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) );
365
366
373
379
380#undef ENABLE
381#undef CHECK
382}
383
384
386{
387 // A workaround to avoid flicker, in modal mode when modview frame is destroyed,
388 // when the aui toolbar is not docked (i.e. shown in a miniframe)
389 // (useful on windows only)
390 m_mainToolBar->SetFocus();
391
393
394 Destroy();
395}
396
397
398void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
399{
400 if( m_auimgr.GetManagedWindow() )
401 m_auimgr.Update();
402
403 SizeEv.Skip();
404}
405
406
408{
409 m_libList->Clear();
410
413 std::vector<wxString> nicknames = PROJECT_PCB::PcbFootprintLibs( &Prj() )->GetLogicalLibs();
414 std::vector<wxString> pinnedMatches;
415 std::vector<wxString> otherMatches;
416
417 auto process =
418 [&]( const wxString& aNickname )
419 {
420 if( alg::contains( project.m_PinnedFootprintLibs, aNickname )
421 || alg::contains( cfg->m_Session.pinned_fp_libs, aNickname ) )
422 {
423 pinnedMatches.push_back( aNickname );
424 }
425 else
426 {
427 otherMatches.push_back( aNickname );
428 }
429 };
430
431 if( m_libFilter->GetValue().IsEmpty() )
432 {
433 for( const wxString& nickname : nicknames )
434 process( nickname );
435 }
436 else
437 {
438 wxStringTokenizer tokenizer( m_libFilter->GetValue() );
439
440 while( tokenizer.HasMoreTokens() )
441 {
442 const wxString term = tokenizer.GetNextToken().Lower();
443 EDA_COMBINED_MATCHER matcher( term, CTX_LIBITEM );
444
445 for( const wxString& nickname : nicknames )
446 {
447 if( matcher.Find( nickname.Lower() ) )
448 process( nickname );
449 }
450 }
451 }
452
453 for( const wxString& nickname : pinnedMatches )
455
456 for( const wxString& nickname : otherMatches )
457 m_libList->Append( nickname );
458
459 // Search for a previous selection:
460 int index = m_libList->FindString( getCurNickname(), true );
461
462 if( index == wxNOT_FOUND )
463 {
464 if( m_libList->GetCount() > 0 )
465 {
466 m_libList->SetSelection( 0 );
467 wxCommandEvent dummy;
469 }
470 else
471 {
472 setCurNickname( wxEmptyString );
473 setCurFootprintName( wxEmptyString );
474 }
475 }
476 else
477 {
478 m_libList->SetSelection( index, true );
479 wxCommandEvent dummy;
481 }
482
483 GetCanvas()->Refresh();
484}
485
486
488{
489 m_fpList->Clear();
490
491 if( !getCurNickname() )
492 setCurFootprintName( wxEmptyString );
493
494 auto fp_info_list = FOOTPRINT_LIST::GetInstance( Kiway() );
495
496 wxString nickname = getCurNickname();
497
498 fp_info_list->ReadFootprintFiles( PROJECT_PCB::PcbFootprintLibs( &Prj() ), !nickname ? nullptr : &nickname );
499
500 if( fp_info_list->GetErrorCount() )
501 {
502 fp_info_list->DisplayErrors( this );
503
504 // For footprint libraries that support one footprint per file, there may have been
505 // valid footprints read so show the footprints that loaded properly.
506 if( fp_info_list->GetList().empty() )
507 return;
508 }
509
510 std::set<wxString> excludes;
511
512 if( !m_fpFilter->GetValue().IsEmpty() )
513 {
514 wxStringTokenizer tokenizer( m_fpFilter->GetValue() );
515
516 while( tokenizer.HasMoreTokens() )
517 {
518 const wxString filterTerm = tokenizer.GetNextToken().Lower();
519 EDA_COMBINED_MATCHER matcher( filterTerm, CTX_LIBITEM );
520
521 for( const std::unique_ptr<FOOTPRINT_INFO>& footprint : fp_info_list->GetList() )
522 {
523 std::vector<SEARCH_TERM> searchTerms = footprint->GetSearchTerms();
524 int matched = matcher.ScoreTerms( searchTerms );
525
526 if( filterTerm.IsNumber() && wxAtoi( filterTerm ) == (int)footprint->GetPadCount() )
527 matched++;
528
529 if( !matched )
530 excludes.insert( footprint->GetFootprintName() );
531 }
532 }
533 }
534
535 for( const std::unique_ptr<FOOTPRINT_INFO>& footprint : fp_info_list->GetList() )
536 {
537 if( !excludes.count( footprint->GetFootprintName() ) )
538 m_fpList->Append( footprint->GetFootprintName() );
539 }
540
541 int index = m_fpList->FindString( getCurFootprintName(), true );
542
543 if( index == wxNOT_FOUND )
544 {
545 if( m_fpList->GetCount() > 0 )
546 {
547 m_fpList->SetSelection( 0 );
548 m_fpList->EnsureVisible( 0 );
549
550 wxCommandEvent dummy;
552 }
553 else
554 {
555 setCurFootprintName( wxEmptyString );
556 }
557 }
558 else
559 {
560 m_fpList->SetSelection( index, true );
561 m_fpList->EnsureVisible( index );
562 }
563}
564
565
566void FOOTPRINT_VIEWER_FRAME::OnLibFilter( wxCommandEvent& aEvent )
567{
569
570 // Required to avoid interaction with SetHint()
571 // See documentation for wxTextEntry::SetHint
572 aEvent.Skip();
573}
574
575
576void FOOTPRINT_VIEWER_FRAME::OnFPFilter( wxCommandEvent& aEvent )
577{
579
580 // Required to avoid interaction with SetHint()
581 // See documentation for wxTextEntry::SetHint
582 aEvent.Skip();
583}
584
585
586void FOOTPRINT_VIEWER_FRAME::OnCharHook( wxKeyEvent& aEvent )
587{
588 if( aEvent.GetKeyCode() == WXK_UP )
589 {
590 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
592 else
594 }
595 else if( aEvent.GetKeyCode() == WXK_DOWN )
596 {
597 if( m_libFilter->HasFocus() || m_libList->HasFocus() )
599 else
601 }
602 else if( aEvent.GetKeyCode() == WXK_TAB && m_libFilter->HasFocus() )
603 {
604 if( !aEvent.ShiftDown() )
605 m_fpFilter->SetFocus();
606 else
607 aEvent.Skip();
608 }
609 else if( aEvent.GetKeyCode() == WXK_TAB && m_fpFilter->HasFocus() )
610 {
611 if( aEvent.ShiftDown() )
612 m_libFilter->SetFocus();
613 else
614 aEvent.Skip();
615 }
616 else if( ( aEvent.GetKeyCode() == WXK_RETURN || aEvent.GetKeyCode() == WXK_NUMPAD_ENTER )
617 && m_fpList->GetSelection() >= 0 )
618 {
619 wxCommandEvent dummy;
621 }
622 else
623 {
624 aEvent.Skip();
625 }
626}
627
628
630{
631 int prev = aListBox->GetSelection() - 1;
632
633 if( prev >= 0 )
634 {
635 aListBox->SetSelection( prev );
636 aListBox->EnsureVisible( prev );
637
638 wxCommandEvent dummy;
639
640 if( aListBox == m_libList )
642 else
644 }
645}
646
647
649{
650 int next = aListBox->GetSelection() + 1;
651
652 if( next < (int)aListBox->GetCount() )
653 {
654 aListBox->SetSelection( next );
655 aListBox->EnsureVisible( next );
656
657 wxCommandEvent dummy;
658
659 if( aListBox == m_libList )
661 else
663 }
664}
665
666
667void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& aEvent )
668{
669 int ii = m_libList->GetSelection();
670
671 if( ii < 0 )
672 return;
673
674 wxString name = m_libList->GetBaseString( ii );
675
676 if( getCurNickname() == name )
677 return;
678
680
681 // Ensure the displayed footprint is loade/reloaded from the new library
682 setCurFootprintName( wxEmptyString );
683
685 UpdateTitle();
686}
687
688
690{
691 if( m_fpList->GetCount() == 0 )
692 return;
693
694 int ii = m_fpList->GetSelection();
695
696 if( ii < 0 )
697 return;
698
699 wxString name = m_fpList->GetBaseString( ii );
700
701 if( getCurFootprintName().CmpNoCase( name ) != 0 )
702 {
705 }
706}
707
708
710{
711 for( PAD* pad : aFootprint->Pads() )
712 {
713 const COMPONENT_NET& net = m_comp.GetNet( pad->GetNumber() );
714
715 if( !net.GetPinFunction().IsEmpty() )
716 {
717 NETINFO_ITEM* netinfo = new NETINFO_ITEM( GetBoard() );
718 netinfo->SetNetname( net.GetPinFunction() );
719 GetBoard()->Add( netinfo );
720 pad->SetNet( netinfo );
721 }
722 }
723
724 GetBoard()->Add( aFootprint );
725}
726
727
729{
730 wxCommandEvent evt;
731 AddFootprintToPCB( evt );
732}
733
734
735void FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB( wxCommandEvent& aEvent )
736{
737 if( GetBoard()->GetFirstFootprint() )
738 {
739 PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB_EDITOR, false );
740 PCBNEW_SETTINGS* cfg = pcbframe->GetPcbNewSettings();
741
742 if( pcbframe == nullptr ) // happens when the board editor is not active (or closed)
743 {
744 DisplayErrorMessage( this, _( "No board currently open." ) );
745 return;
746 }
747
748 TOOL_MANAGER* toolMgr = pcbframe->GetToolManager();
749
751 {
752 DisplayError( this, _( "Previous footprint placement still in progress." ) );
753 return;
754 }
755
756 wxWindow* blocking_dialog = pcbframe->Kiway().GetBlockingDialog();
757
758 if( blocking_dialog )
759 blocking_dialog->Close( true );
760
762 BOARD_COMMIT commit( pcbframe );
763
764 // Create the "new" footprint
765 FOOTPRINT* newFootprint = (FOOTPRINT*) GetBoard()->GetFirstFootprint()->Duplicate();
766 newFootprint->SetParent( pcbframe->GetBoard() );
767 newFootprint->SetLink( niluuid );
768 newFootprint->SetFlags(IS_NEW ); // whatever
769
770 for( PAD* pad : newFootprint->Pads() )
771 {
772 // Set the pads ratsnest settings to the global settings
773 pad->SetLocalRatsnestVisible( cfg->m_Display.m_ShowGlobalRatsnest );
774
775 // Pads in the library all have orphaned nets. Replace with Default.
776 pad->SetNetCode( 0 );
777 }
778
779 // Put it on FRONT layer,
780 // (Can be stored flipped if the lib is an archive built from a board)
781 if( newFootprint->IsFlipped() )
782 newFootprint->Flip( newFootprint->GetPosition(), cfg->m_FlipLeftRight );
783
784 KIGFX::VIEW_CONTROLS* viewControls = pcbframe->GetCanvas()->GetViewControls();
785 VECTOR2D cursorPos = viewControls->GetCursorPosition();
786
787 commit.Add( newFootprint );
788 viewControls->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
789 pcbframe->PlaceFootprint( newFootprint );
790
791 newFootprint->SetPosition( VECTOR2I( 0, 0 ) );
792 viewControls->SetCrossHairCursorPosition( cursorPos, false );
793 commit.Push( wxT( "Insert footprint" ) );
794
795 pcbframe->Raise();
796 toolMgr->PostAction( PCB_ACTIONS::placeFootprint, newFootprint );
797
798 newFootprint->ClearFlags();
799 }
800}
801
802
804{
805 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
806 wxCHECK( cfg, /*void*/ );
807
808 // We don't allow people to change this right now, so make sure it's on
810
812
813 // Fetch display and grid settings from Footprint Editor
815 m_displayOptions = fpedit->m_Display;
816 GetGalDisplayOptions().ReadWindowSettings( fpedit->m_Window );
817
820
821 // Set parameters to a reasonable value.
822 int maxWidth = cfg->m_FootprintViewer.state.size_x - 80;
823
824 if( m_libListWidth + m_fpListWidth > maxWidth )
825 {
827 m_fpListWidth = maxWidth - m_libListWidth;
828 }
829}
830
831
833{
834 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
835 wxCHECK( cfg, /*void*/ );
836
838
839 // We don't want to store anything other than the window settings
841
842 if( GetCanvas() && GetCanvas()->GetView() )
844
845 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_FPVIEWER_AUTOZOOM_TOOL );
846 cfg->m_FootprintViewerAutoZoomOnSelect = ( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED );
847 cfg->m_FootprintViewerLibListWidth = m_libList->GetSize().x;
848 cfg->m_FootprintViewerFPListWidth = m_fpList->GetSize().x;
849
850}
851
852
854{
855 PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
856 wxCHECK_MSG( cfg, nullptr, wxT( "config not existing" ) );
857
858 return &cfg->m_FootprintViewer;
859}
860
861
863{
865
866 if( settings )
867 return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
868 else
870}
871
872
873void FOOTPRINT_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
874{
875 PCB_BASE_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
876
878
879 if( aEnvVarsChanged )
881}
882
883
885{
887}
888
889
890void FOOTPRINT_VIEWER_FRAME::setCurNickname( const wxString& aNickname )
891{
893}
894
895
897{
899}
900
901
903{
905}
906
907
908void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
909{
910 if( event.GetActive() )
911 {
912 // Ensure we have the right library list:
913 std::vector< wxString > libNicknames = PROJECT_PCB::PcbFootprintLibs( &Prj() )->GetLogicalLibs();
914 bool stale = false;
915
916 if( libNicknames.size() != m_libList->GetCount() )
917 stale = true;
918 else
919 {
920 for( unsigned ii = 0; ii < libNicknames.size(); ii++ )
921 {
922 if( libNicknames[ii] != m_libList->GetBaseString( ii ) )
923 {
924 stale = true;
925 break;
926 }
927 }
928 }
929
930 if( stale )
931 {
933 UpdateTitle();
934 }
935 }
936
937 event.Skip(); // required under wxMAC
938}
939
940
942{
943 aEvent.Enable( GetBoard()->GetFirstFootprint() != nullptr );
944}
945
946
948{
949 setCurNickname( aFootprint->GetFPID().GetLibNickname() );
950 setCurFootprintName( aFootprint->GetFPID().GetLibItemName() );
952}
953
954
956{
959 ReloadFootprint( GetBoard()->GetFirstFootprint() );
960}
961
963{
964 switch( mail.Command() )
965 {
966 case MAIL_RELOAD_LIB:
968 break;
969
970 default:
971 break;
972 }
973}
974
975
976void FOOTPRINT_VIEWER_FRAME::Update3DView( bool aMarkDirty, bool aRefresh, const wxString* aTitle )
977{
978 wxString title = _( "3D Viewer" ) + wxT( " \u2014 " ) + getCurFootprintName();
979 PCB_BASE_FRAME::Update3DView( aMarkDirty, aRefresh, &title );
980}
981
982
984{
986}
987
988
990{
991 switch( event.GetId() )
992 {
993 case ID_MODVIEW_NEXT:
995 break;
996
999 break;
1000
1001 default:
1002 wxString id = wxString::Format( wxT( "%i" ), event.GetId() );
1003 wxFAIL_MSG( wxT( "FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList error: id = " ) + id );
1004 }
1005}
1006
1007
1009{
1010 wxString title;
1011
1012 if( !getCurNickname().IsEmpty() )
1013 {
1014 try
1015 {
1017 const LIB_TABLE_ROW* row = libtable->FindRow( getCurNickname() );
1018
1019 title = getCurNickname() + wxT( " \u2014 " ) + row->GetFullURI( true );
1020 }
1021 catch( ... )
1022 {
1023 title = _( "[no library selected]" );
1024 }
1025 }
1026 else
1027 {
1028 title = _( "[no library selected]" );
1029 }
1030
1031 title += wxT( " \u2014 " ) + _( "Footprint Library Browser" );
1032
1033 SetTitle( title );
1034}
1035
1036
1038{
1039 if( !getCurNickname() )
1040 return;
1041
1042 int selection = m_fpList->FindString( getCurFootprintName(), true );
1043
1044 if( aMode == NEXT_PART )
1045 {
1046 if( selection != wxNOT_FOUND && selection < (int)m_fpList->GetCount() - 1 )
1047 selection++;
1048 }
1049
1050 if( aMode == PREVIOUS_PART )
1051 {
1052 if( selection != wxNOT_FOUND && selection > 0 )
1053 selection--;
1054 }
1055
1056 if( selection != wxNOT_FOUND )
1057 {
1058 m_fpList->SetSelection( selection );
1059 m_fpList->EnsureVisible( selection );
1060
1062
1063 // Delete the current footprint
1065 selectionTool->ClearSelection( true /* quiet mode */ );
1066
1068 GetBoard()->RemoveUnusedNets( nullptr );
1069
1072
1073 if( footprint )
1074 displayFootprint( footprint );
1075
1076 if( aMode != RELOAD_PART )
1077 setFPWatcher( footprint );
1078
1079 Update3DView( true, true );
1080 updateView();
1081 }
1082
1083 UpdateTitle();
1084
1085 GetCanvas()->Refresh();
1086}
1087
1088
1090{
1093
1095
1096 wxAuiToolBarItem* toolOpt = m_mainToolBar->FindTool( ID_FPVIEWER_AUTOZOOM_TOOL );
1097
1098 if( toolOpt->GetState() & wxAUI_BUTTON_STATE_CHECKED )
1100 else
1102
1104}
1105
1106
1107void FOOTPRINT_VIEWER_FRAME::OnExitKiCad( wxCommandEvent& event )
1108{
1109 Kiway().OnKiCadExit();
1110}
1111
1112
1114{
1115 Close( false );
1116}
1117
1118
1120{
1121 return GetBoard()->GetFirstFootprint();
1122}
1123
const char * name
Definition: DXF_plotter.cpp:57
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104
@ icon_footprint_browser
static TOOL_ACTION toggleGrid
Definition: actions.h:176
static TOOL_ACTION millimetersUnits
Definition: actions.h:184
static TOOL_ACTION milsUnits
Definition: actions.h:183
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:136
static TOOL_ACTION centerContents
Definition: actions.h:131
static TOOL_ACTION inchesUnits
Definition: actions.h:182
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:133
static TOOL_ACTION measureTool
Definition: actions.h:192
static TOOL_ACTION selectionTool
Definition: actions.h:191
static TOOL_ACTION zoomFitScreen
Definition: actions.h:125
static TOOL_ACTION zoomTool
Definition: actions.h:128
Manage TOOL_ACTION objects.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
std::shared_ptr< NET_SETTINGS > m_NetSettings
Handle actions specific to the board editor in PcbNew.
bool PlacingFootprint() const
Re-entrancy checker for above.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:282
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
Definition: board.cpp:882
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:294
FOOTPRINT * GetFirstFootprint() const
Get the first footprint on the board or nullptr.
Definition: board.h:433
void SetVisibleAlls()
Change the bit-mask of visible element categories and layers.
Definition: board.cpp:726
void RemoveUnusedNets(BOARD_COMMIT *aCommit)
Definition: board.h:858
void DeleteAllFootprints()
Remove all footprints from the deque and free the memory associated with them.
Definition: board.cpp:1277
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:794
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
Definition: commit.h:80
Handle actions that are shared between different applications.
Handles action that are shared between different applications.
Definition: common_tools.h:38
Used to store the component pin name to net name (and pin function) associations stored in a netlist.
Definition: pcb_netlist.h:45
const wxString & GetPinFunction() const
Definition: pcb_netlist.h:60
const COMPONENT_NET & GetNet(unsigned aIndex) const
Definition: pcb_netlist.h:112
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
wxAuiManager m_auimgr
int ScoreTerms(std::vector< SEARCH_TERM > &aWeightedTerms)
bool Find(const wxString &aTerm, int &aMatchersTriggered, int &aPosition)
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
GAL_DISPLAY_OPTIONS_IMPL & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
ACTION_TOOLBAR * m_mainToolBar
virtual void UpdateMsgPanel()
Redraw the message panel.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Return a pointer to the #VIEW_CONTROLS instance used in the panel.
void ForceRefresh()
Force a redraw.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Set a dispatcher that processes events and forwards them to tools.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition: eda_item.h:126
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: eda_item.h:128
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:103
Specialization of the wxAuiPaneInfo class for KiCad panels.
SELECTION_CONDITION BoundingBoxes()
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
static FOOTPRINT_LIST * GetInstance(KIWAY &aKiway)
Factory function to return a FOOTPRINT_LIST via Kiway.
Component library viewer main window.
void displayFootprint(FOOTPRINT *aFootprint)
BOARD_ITEM_CONTAINER * GetModel() const override
void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr) override
Update the 3D view, if the viewer is opened by this frame.
void OnLibFilter(wxCommandEvent &aEvent)
void DClickOnFootprintList(wxMouseEvent &aEvent)
void KiwayMailIn(KIWAY_EXPRESS &mail) override
Receive KIWAY_EXPRESS messages from other players.
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
void OnCharHook(wxKeyEvent &aEvent) override
Capture the key event before it is sent to the GUI.
void selectPrev(WX_LISTBOX *aListBox)
void ReCreateLibraryList()
Create or recreate the list of current loaded libraries.
void CloseFootprintViewer(wxCommandEvent &event)
void OnIterateFootprintList(wxCommandEvent &event)
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void ReloadFootprint(FOOTPRINT *aFootprint) override
Override from PCB_BASE_FRAME which reloads the footprint from the library without setting the footpri...
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void HardRedraw() override
Rebuild the GAL and redraws the screen.
virtual COLOR4D GetGridColor() override
void SelectAndViewFootprint(int aMode)
Select and load the next or the previous footprint.
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
void OnUpdateFootprintButton(wxUpdateUIEvent &aEvent)
Update the ID_ADD_FOOTPRINT_TO_BOARD tool state in main toolbar.
void OnActivate(wxActivateEvent &event)
Called when the frame frame is activate to reload the libraries and component lists that can be chang...
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void setCurFootprintName(const wxString &aName)
void OnSize(wxSizeEvent &event) override
Recalculate the size of toolbars and display panel when the frame size changes.
void OnExitKiCad(wxCommandEvent &event)
void setCurNickname(const wxString &aNickname)
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void OnFPFilter(wxCommandEvent &aEvent)
void AddFootprintToPCB(wxCommandEvent &aEvent)
Export the current footprint name and close the library browser.
void UpdateMsgPanel() override
Redraw the message panel.
void UpdateTitle()
Update the window title with current library information.
void selectNext(WX_LISTBOX *aListBox)
void ClickOnLibList(wxCommandEvent &aEvent)
void ClickOnFootprintList(wxCommandEvent &aEvent)
void SetPosition(const VECTOR2I &aPos) override
Definition: footprint.cpp:2330
void SetLink(const KIID &aLink)
Definition: footprint.h:840
unsigned GetPadCount(INCLUDE_NPTH_T aIncludeNPTH=INCLUDE_NPTH_T(INCLUDE_NPTH)) const
Return the number of pads.
Definition: footprint.cpp:1848
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:2429
bool IsFlipped() const
Definition: footprint.h:378
PADS & Pads()
Definition: footprint.h:193
const LIB_ID & GetFPID() const
Definition: footprint.h:235
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: footprint.cpp:2271
VECTOR2I GetPosition() const override
Definition: footprint.h:211
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName, bool aCheckIfEnabled=false)
Return an FP_LIB_TABLE_ROW if aNickName is found in this table or in any chained fall back table frag...
FOOTPRINT * FootprintLoad(const wxString &aNickname, const wxString &aFootprintName, bool aKeepUUID=false)
Load a footprint having aFootprintName from the library given by aNickname.
void ReadWindowSettings(WINDOW_SETTINGS &aCfg)
Read GAL config options from application-level config.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
bool m_axesEnabled
Fullscreen crosshair or small cross.
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void SetCrossHairCursorPosition(const VECTOR2D &aPosition, bool aWarpView=true)=0
Move the graphic crosshair cursor to the requested position expressed in world coordinates.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
double GetScale() const
Definition: view.h:271
void Clear()
Remove all items from the view.
Definition: view.cpp:1124
Carry a payload from one KIWAY_PLAYER to another within a PROJECT.
Definition: kiway_express.h:40
MAIL_T Command()
Returns the MAIL_T associated with this mail.
Definition: kiway_express.h:50
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:55
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:279
void OnKiCadExit()
Definition: kiway.cpp:717
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:406
wxWindow * GetBlockingDialog()
Gets the window pointer to the blocking dialog (to send it signals)
Definition: kiway.cpp:669
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:196
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:49
int SetLibNickname(const UTF8 &aLibNickname)
Override the logical library name portion of the LIB_ID to aLibNickname.
Definition: lib_id.cpp:99
const UTF8 & GetLibItemName() const
Definition: lib_id.h:102
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:87
Hold a record identifying a library accessed by the appropriate plug in object in the LIB_TABLE.
const wxString GetFullURI(bool aSubstituted=false) const
Return the full location specifying URI for the LIB, either in original UI form or in environment var...
std::vector< wxString > GetLogicalLibs()
Return the logical library names, all of them that are pertinent to a look up done on this LIB_TABLE.
static const wxString GetPinningSymbol()
Handle the data for a net.
Definition: netinfo.h:56
void SetNetname(const wxString &aNewName)
Set the long netname to aNetName, the short netname to the last token in the long netname's path,...
Definition: netinfo.h:139
Definition: pad.h:53
double m_FootprintViewerZoom
The last zoom level used (0 for auto)
DISPLAY_OPTIONS m_Display
bool m_FootprintViewerAutoZoomOnSelect
true to use automatic zoom on fp selection
WINDOW_SETTINGS m_FootprintViewer
int m_FootprintViewerFPListWidth
int m_FootprintViewerLibListWidth
Gather all the actions that are shared by tools.
Definition: pcb_actions.h:50
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:330
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:68
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:484
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:487
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:337
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:223
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void setFPWatcher(FOOTPRINT *aFootprint)
Creates (or removes) a watcher on the specified footprint.
PCBNEW_SETTINGS * GetPcbNewSettings() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
BOARD * GetBoard() const
void PlaceFootprint(FOOTPRINT *aFootprint, bool aRecreateRatsnest=true)
Places aFootprint at the current cursor position and updates footprint coordinates with the new posit...
PCB_DISPLAY_OPTIONS m_displayOptions
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Handle actions that are shared between different frames in PcbNew.
Definition: pcb_control.h:47
void UpdateColors()
Update the color settings in the painter and GAL.
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
void DisplayBoard(BOARD *aBoard, PROGRESS_REPORTER *aReporter=nullptr)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
Group generic conditions for PCB editor states.
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
SELECTION_CONDITION PadNumbersDisplay()
Create a functor that tests if the pad numbers are displayed.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
The main frame for Pcbnew.
Generic tool for picking an item.
The selection tool: currently supports:
Tool useful for viewing footprints.
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:678
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:142
The backing store for a PROJECT, in JSON format.
Definition: project_file.h:70
static FP_LIB_TABLE * PcbFootprintLibs(PROJECT *aProject)
Return the table of footprint libraries without Kiway.
Definition: project_pcb.cpp:37
@ PCB_FOOTPRINT_VIEWER_FP_NAME
Definition: project.h:194
@ PCB_FOOTPRINT_VIEWER_LIB_NICKNAME
Definition: project.h:195
virtual PROJECT_FILE & GetProjectFile() const
Definition: project.h:166
virtual void SetRString(RSTRING_T aStringId, const wxString &aString)
Store a "retained string", which is any session and project specific string identified in enum RSTRIN...
Definition: project.cpp:269
virtual const wxString & GetRString(RSTRING_T aStringId)
Return a "retained string", which is any session and project specific string identified in enum RSTRI...
Definition: project.cpp:280
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.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: tools_holder.h:55
@ MODEL_RELOAD
Model changes (the sheet for a schematic)
Definition: tool_base.h:80
Master controller class:
Definition: tool_manager.h:62
bool RunAction(const std::string &aActionName, T aParam)
Run the specified action immediately, pausing the current action to run the new one.
Definition: tool_manager.h:150
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:302
bool PostAction(const std::string &aActionName, T aParam)
Run the specified action after the current action (coroutine) ends.
Definition: tool_manager.h:235
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Set the work environment (model, view, view controls and the parent window).
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
wxString GetBaseString(int n) const
Definition: wx_listbox.cpp:61
int FindString(const wxString &s, bool bCase=false) const override
Definition: wx_listbox.cpp:72
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:170
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:195
This file is part of the common library.
#define CHECK(x)
#define _HKI(x)
#define _(s)
Declaration of the eda_3d_viewer class.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
#define FOOTPRINT_VIEWER_FRAME_NAME
#define IS_NEW
New item, just created.
Abstract pattern-matching tool and implementations.
@ CTX_LIBITEM
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectHighlightChoice EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnUpdateLayerSelectBox) void GERBVIEW_FRAME
#define NEW_PART
#define RELOAD_PART
#define PREVIOUS_PART
#define NEXT_PART
@ FRAME_PCB_EDITOR
Definition: frame_type.h:42
@ FRAME_FOOTPRINT_VIEWER
Definition: frame_type.h:45
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
PROJECT & Prj()
Definition: kicad.cpp:595
KIID niluuid(0)
@ LAYER_GRID
Definition: layer_ids.h:209
@ MAIL_RELOAD_LIB
Definition: mail_type.h:56
Message panel definition file.
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
Definition: kicad_algo.h:100
@ ID_ADD_FOOTPRINT_TO_BOARD
Definition: pcbnew_id.h:116
@ ID_MODVIEW_FOOTPRINT_LIST
Definition: pcbnew_id.h:103
@ ID_MODVIEW_PREVIOUS
Definition: pcbnew_id.h:104
@ ID_FPVIEWER_AUTOZOOM_TOOL
Definition: pcbnew_id.h:106
@ ID_MODVIEW_FOOTPRINT_FILTER
Definition: pcbnew_id.h:102
@ ID_MODVIEW_LIB_FILTER
Definition: pcbnew_id.h:100
@ ID_MODVIEW_LIB_LIST
Definition: pcbnew_id.h:101
@ ID_MODVIEW_NEXT
Definition: pcbnew_id.h:105
BOARD * GetBoard()
static PGM_BASE * process
Definition: pgm_base.cpp:1057
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1059
see class PGM_BASE
CITER next(CITER it)
Definition: ptree.cpp:126
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
std::vector< wxString > pinned_fp_libs
bool always_show_cursor
Definition: app_settings.h:44
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:74
CURSOR_SETTINGS cursor
Definition: app_settings.h:80
WINDOW_STATE state
Definition: app_settings.h:75
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:638
VECTOR2< double > VECTOR2D
Definition: vector2d.h:637
Definition of file extensions used in Kicad.
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.