KiCad PCB EDA Suite
display_footprints_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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 2007-2020 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 
26 #include <bitmaps.h>
27 #include <board.h>
28 #include <footprint.h>
29 #include <common.h>
30 #include <confirm.h>
31 #include <cvpcb_settings.h>
33 #include <fp_lib_table.h>
34 #include <id.h>
35 #include <kiface_i.h>
36 #include <lib_id.h>
37 #include <macros.h>
38 #include <widgets/msgpanel.h>
39 #include <pcb_draw_panel_gal.h>
40 #include <pcb_painter.h>
41 #include <pgm_base.h>
42 #include <reporter.h>
44 #include <tool/action_toolbar.h>
45 #include <tool/common_tools.h>
46 #include <tool/tool_dispatcher.h>
47 #include <tool/tool_manager.h>
48 #include <tool/zoom_tool.h>
49 #include <cvpcb_mainframe.h>
51 #include <tools/cvpcb_actions.h>
52 #include <tools/pcb_actions.h>
53 #include <tools/pcb_editor_conditions.h> // Shared conditions with other pcbnew frames
54 #include <tools/pcb_viewer_tools.h> // shared tools with other pcbnew frames
56 #include <widgets/infobar.h>
57 #include <wx/debug.h>
58 
59 
60 BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
61  EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
64 END_EVENT_TABLE()
65 
66 
68  PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
69  wxDefaultPosition, wxDefaultSize,
71 {
72  // Give an icon
73  wxIcon icon;
74  icon.CopyFromBitmap( KiBitmap( BITMAPS::icon_cvpcb ) );
75  SetIcon( icon );
76 
77  SetBoard( new BOARD() );
78 
79  // This board will only be used to hold a footprint for viewing
81 
82  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
83 
84  // Create GAL canvas before loading settings
85  auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_frameSize,
86  GetGalDisplayOptions(),
88  SetCanvas( gal_drawPanel );
89 
90  // Don't show the default board solder mask clearance. Only the
91  // footprint or pad clearance setting should be shown if it is not 0.
93 
94  LoadSettings( config() );
95 
96  // Initialize some display options
97  auto displ_opts = GetDisplayOptions();
98  displ_opts.m_DisplayPadClearance = false; // Pad clearance has no meaning here
99 
100  // Track and via clearance has no meaning here.
101  displ_opts.m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
102  SetDisplayOptions( displ_opts );
103 
104  // Create the manager and dispatcher & route draw panel events to the dispatcher
105  m_toolManager = new TOOL_MANAGER;
106  m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
107  gal_drawPanel->GetViewControls(), config(), this );
108  m_actions = new CVPCB_ACTIONS();
109  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
110  gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
111 
112  m_toolManager->RegisterTool( new COMMON_TOOLS );
113  m_toolManager->RegisterTool( new ZOOM_TOOL );
114  m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
115  m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
116 
117  m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
118 
119  m_toolManager->InitTools();
120 
121  setupUIConditions();
122 
123  // Run the control tool, it is supposed to be always active
124  m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" );
125 
126  ReCreateHToolbar();
127  ReCreateVToolbar();
128  ReCreateOptToolbar();
129 
130  m_auimgr.SetManagedWindow( this );
131 
132  CreateInfoBar();
133  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" )
134  .Top().Layer( 6 ) );
135  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" )
136  .Left().Layer( 3 ) );
137  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" )
138  .Center() );
139  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" )
140  .Bottom().Layer( 6 ) );
141 
142  FinishAUIInitialization();
143 
144  auto& galOpts = GetGalDisplayOptions();
145  galOpts.m_axesEnabled = true;
146 
147  ActivateGalCanvas();
148 
149  setupUnits( config() );
150 
151  // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
152  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
153 
154  if( cfg )
155  GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
156 
157  updateView();
158 
159  Show( true );
160 
161  // Register a call to update the toolbar sizes. It can't be done immediately because
162  // it seems to require some sizes calculated that aren't yet (at least on GTK).
163  CallAfter( [&]()
164  {
165  // Ensure the controls on the toolbars all are correctly sized
166  UpdateToolbarControlSizes();
167  } );
168 }
169 
170 
172 {
173  // Shutdown all running tools
174  if( m_toolManager )
176 
178  GetCanvas()->StopDrawing();
179  GetCanvas()->GetView()->Clear();
180  // Be sure any event cannot be fired after frame deletion:
181  GetCanvas()->SetEvtHandlerEnabled( false );
182 
183  delete GetScreen();
184  SetScreen( NULL ); // Be sure there is no double deletion
185 }
186 
187 
189 {
191 
193  PCB_EDITOR_CONDITIONS cond( this );
194 
195  wxASSERT( mgr );
196 
197 #define CHECK( x ) ACTION_CONDITIONS().Check( x )
198 
202 
205 
209 
210 
211  auto autoZoomCond =
212  [this] ( const SELECTION& aSel )
213  {
214  return GetAutoZoom();
215  };
216 
222 
223 #undef CHECK
224 }
225 
226 
228 {
229  Destroy();
230 }
231 
232 
234 {
235  // Currently, no vertical right toolbar.
236 }
237 
238 
240 {
241  if( m_optionsToolBar )
242  {
244  }
245  else
246  {
247  m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition,
248  wxDefaultSize,
249  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
251  }
252 
255 
263 
269 
270  m_optionsToolBar->Realize();
271 }
272 
273 
275 {
276  // Note:
277  // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
278  // all wxAuiToolBarItems.
279  // However the wxAuiToolBarItems are not the owners of controls managed by
280  // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
281  // So we do not recreate them after clearing the tools.
282 
283  if( m_mainToolBar )
284  {
286  }
287  else
288  {
289  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
290  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
292  }
293 
300 
303 
305 
306  // Grid selection choice box.
307  if( !m_gridSelectBox )
309 
311  m_mainToolBar->AddControl( m_gridSelectBox );
312 
314 
315  // Zoom selection choice box.
316  if( !m_zoomSelectBox )
318 
320  m_mainToolBar->AddControl( m_zoomSelectBox );
321 
324 
325  // after adding the buttons to the toolbar, must call Realize() to reflect
326  // the changes
327  m_mainToolBar->Realize();
328 }
329 
330 
332 {
333  if( m_mainToolBar )
334  {
335  // Update the item widths
338  }
339 }
340 
341 
343 {
344  auto cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
345  wxCHECK( cfg, /* void */ );
346 
347  // We don't allow people to change this right now, so make sure it's on
349 
351 
352  SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
353 }
354 
355 
357 {
358  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
359  wxCHECK( cfg, /* void */ );
360 
362 
364 
366 }
367 
368 
370 {
371  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
372  wxCHECK( cfg, nullptr );
373  return &cfg->m_FootprintViewer;
374 }
375 
376 
378 {
379  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( Kiface().KifaceSettings() );
380  wxCHECK( cfg, nullptr );
382 }
383 
384 
386 {
387  return COLOR4D( DARKGRAY );
388 }
389 
390 
391 FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintName,
392  REPORTER& aReporter )
393 {
394  FOOTPRINT* footprint = NULL;
395  LIB_ID fpid;
396 
397  if( fpid.Parse( aFootprintName ) >= 0 )
398  {
399  aReporter.Report( wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
400  aFootprintName ),
402  return NULL;
403  }
404 
405  wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
406  wxString fpName = FROM_UTF8( fpid.GetLibItemName().c_str() );
407 
408  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs( Kiway() );
409  wxASSERT( fpTable );
410 
411  // See if the library requested is in the library table
412  if( !fpTable->HasLibrary( libNickname ) )
413  {
414  aReporter.Report( wxString::Format( _( "Library \"%s\" is not in the footprint library table." ),
415  libNickname ),
417  return NULL;
418  }
419 
420  // See if the footprint requested is in the library
421  if( !fpTable->FootprintExists( libNickname, fpName ) )
422  {
423  aReporter.Report( wxString::Format( _( "Footprint \"%s\" not found." ), aFootprintName ),
425  return NULL;
426  }
427 
428  try
429  {
430  const FOOTPRINT* fp = fpTable->GetEnumeratedFootprint( libNickname, fpName );
431 
432  if( fp )
433  footprint = static_cast<FOOTPRINT*>( fp->Duplicate() );
434  }
435  catch( const IO_ERROR& ioe )
436  {
437  DisplayError( this, ioe.What() );
438  return NULL;
439  }
440 
441  if( footprint )
442  {
443  footprint->SetParent( (EDA_ITEM*) GetBoard() );
444  footprint->SetPosition( wxPoint( 0, 0 ) );
445  return footprint;
446  }
447 
448  aReporter.Report( wxString::Format( _( "Footprint \"%s\" not found." ), aFootprintName ),
450  return NULL;
451 }
452 
453 
455 {
456  CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
457  FOOTPRINT* footprint = nullptr;
458  const FOOTPRINT_INFO* fpInfo = nullptr;
459 
461  GetCanvas()->GetView()->Clear();
462 
463  wxString footprintName = parentframe->GetSelectedFootprint();
464 
465  if( footprintName.IsEmpty() )
466  {
467  COMPONENT* comp = parentframe->GetSelectedComponent();
468 
469  if( comp )
470  footprintName = comp->GetFPID().GetUniStringLibId();
471  }
472 
473  INFOBAR_REPORTER infoReporter( m_infoBar );
474  m_infoBar->Dismiss();
475 
476  if( !footprintName.IsEmpty() )
477  {
478  SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
479 
480  footprint = GetFootprint( footprintName, infoReporter );
481 
482  fpInfo = parentframe->m_FootprintsList->GetFootprintInfo( footprintName );
483  }
484 
485  if( footprint )
486  GetBoard()->Add( footprint );
487 
488  if( fpInfo )
489  SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
490  else
491  SetStatusText( wxEmptyString, 0 );
492 
493  infoReporter.Finalize();
494 
495  updateView();
496 
497  UpdateStatusBar();
498 
499  GetCanvas()->Refresh();
500  Update3DView( true, true );
501 }
502 
503 
505 {
506  PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
507  dp->UpdateColors();
508  dp->DisplayBoard( GetBoard() );
509 
511 
512  if( GetAutoZoom() )
514  else
516 
517  UpdateMsgPanel();
518 }
519 
520 
522 {
523  FOOTPRINT* footprint = GetBoard()->GetFirstFootprint();
524  MSG_PANEL_ITEMS items;
525 
526  if( footprint )
527  footprint->GetMsgPanelInfo( this, items );
528 
529  SetMsgPanel( items );
530 }
531 
532 
534 {
535  auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
536 
537  if( settings )
538  return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
539  else
540  return Pgm().GetSettingsManager().GetColorSettings();
541 }
542 
543 
545 {
546  return GetBoard()->GetFirstFootprint();
547 }
548 
549 
551 {
552  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
553  wxCHECK( cfg, /* void */ );
554  cfg->m_FootprintViewerAutoZoom = aAutoZoom;
555 }
556 
557 
559 {
560  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
561  wxCHECK( cfg, false );
562  return cfg->m_FootprintViewerAutoZoom;
563 }
564 
565 
567 {
569 }
void ShutdownAllTools()
Shutdown all tools with a currently registered event loop in this tool manager by waking them up with...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
Definition: confirm.cpp:252
static TOOL_ACTION show3DViewer
Definition: actions.h:161
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void SetAutoZoom(bool aAutoZoom) override
Set if the canvas should automatically zoom to the footprint on load.
Define the structure of a toolbar with buttons that invoke ACTIONs.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:106
KIWAY & Kiway() const
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
FOOTPRINT_LIST * m_FootprintsList
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: footprint.cpp:815
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110
static TOOL_ACTION zoomInCenter
Definition: actions.h:96
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
Model changes (required full reload)
Definition: tool_base.h:81
This file is part of the common library.
wxString GetLibNickname() const override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
Redraw the message panel.
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
ACTION_TOOLBAR * m_optionsToolBar
virtual void SetScreen(BASE_SCREEN *aScreen)
static constexpr bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:102
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
SELECTION_CONDITION TextFillDisplay()
Create a functor that tests if the frame fills text items.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
double m_FootprintViewerZoom
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Create a functor testing if the specified tool is the current active tool in the frame.
static constexpr GAL_TYPE GAL_FALLBACK
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:141
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.h:593
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
wxAuiManager m_auimgr
#define FOOTPRINTVIEWER_FRAME_NAME
ACTION_TOOLBAR * m_mainToolBar
Manage TOOL_ACTION objects.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
static TOOL_ACTION zoomFootprintAutomatically
Definition: pcb_actions.h:255
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
bool always_show_cursor
Definition: app_settings.h:42
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxChoice * m_gridSelectBox
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
void updateView()
Update the gal canvas (view, colors ...).
virtual void SetParent(EDA_ITEM *aParent)
Definition: eda_item.h:166
static TOOL_ACTION zoomOutCenter
Definition: actions.h:97
This file contains miscellaneous commonly used macros and functions.
const char * c_str() const
Definition: utf8.h:102
MAGNETIC_SETTINGS m_FootprintViewerMagneticSettings
Selection tool for the footprint viewer in cvpcb.
BOARD_ITEM_CONTAINER * GetModel() const override
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:132
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
Master controller class:
Definition: tool_manager.h:52
static TOOL_ACTION measureTool
Definition: actions.h:157
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Definition: board.cpp:563
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions, bool aRefresh=true)
Updates the current display options from the given options struct.
static constexpr bool CANCEL
void Dismiss() override
Dismisses the infobar and updates the containing layout and AUI manager (if one is provided).
Definition: infobar.cpp:176
static TOOL_ACTION centerContents
Definition: actions.h:103
FOOTPRINT * GetFirstFootprint() const
Gets the first footprint on the board or nullptr.
Definition: board.h:382
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
CURSOR_SETTINGS cursor
Definition: app_settings.h:88
WINDOW_SETTINGS * GetWindowSettings(APP_SETTINGS_BASE *aCfg) override
Return a pointer to the window settings for this frame.
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
#define NULL
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void DisplayBoard(BOARD *aBoard)
Add all items from the current board to the VIEW, so they can be displayed by GAL.
void Clear()
Remove all items from the view.
Definition: view.cpp:1091
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:254
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static TOOL_ACTION inchesUnits
Definition: actions.h:147
wxChoice * m_zoomSelectBox
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void UpdateControlWidth(int aID)
Update the toolbar item width of a control using its best size.
static TOOL_ACTION togglePolarCoords
Definition: actions.h:152
bool GetAutoZoom() override
Get if the canvas should automatically zoom to the footprint on load.
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Reset all tools (i.e.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:260
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:92
BOARD_ITEM * Duplicate() const override
Create a copy of this BOARD_ITEM.
Definition: footprint.cpp:1601
FOOTPRINT_INFO * GetFootprintInfo(const wxString &aFootprintName)
Get info for a footprint by id.
bool m_FootprintViewerAutoZoom
WINDOW_SETTINGS m_FootprintViewer
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void Finalize()
Update the infobar with the reported text.
Definition: reporter.cpp:207
Gather all the actions that are shared by tools.
Definition: cvpcb_actions.h:40
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
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
Specialization of the wxAuiPaneInfo class for KiCad panels.
COLOR_SETTINGS * GetColorSettings() const override
Helper to retrieve the current color settings.
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...
static TOOL_ACTION milsUnits
Definition: actions.h:148
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
FOOTPRINT * GetFootprint(const wxString &aFootprintName, REPORTER &aReporter)
Handles action that are shared between different applications.
Definition: common_tools.h:37
void UpdateColors()
Update the color settings in the painter and GAL.
Store all of the related footprint information found in a netlist.
Definition: pcb_netlist.h:83
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
SELECTION_CONDITION PadNumbersDisplay()
Create a functor that tests if the pad numbers are displayed.
BOARD * GetBoard()
virtual FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:285
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:248
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:394
wxString GetSelectedFootprint()
void InitDisplay()
Refresh the full display for this frame: Set the title, the status line and redraw the canvas Must be...
int Parse(const UTF8 &aId, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
virtual void UpdateStatusBar() override
Update the status bar information.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
see class PGM_BASE
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
SELECTION_CONDITION GraphicsFillDisplay()
Create a functor that tests if the frame fills graphics items.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
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).
WX_INFOBAR * m_infoBar
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION zoomRedraw
Definition: actions.h:93
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:150
The common library.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
PCB_DISPLAY_OPTIONS m_FootprintViewerDisplayOptions
Tool useful for viewing footprints.
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
ACTION_MANAGER * GetActionManager() const
Definition: tool_manager.h:197
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
void UpdateMsgPanel() override
Redraw the message panel.
void DeleteAllFootprints()
Removes all footprints from the deque and frees the memory associated with them.
Definition: board.h:390
wxString GetUniStringLibId() const
Definition: lib_id.h:142
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD * GetBoard() const
void SetPosition(const wxPoint &aPos) override
Definition: footprint.cpp:1438
double GetScale() const
Definition: view.h:263
Message panel definition file.
Group generic conditions for PCB editor states.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
A wrapper for reporting to a WX_INFOBAR UI element.
Definition: reporter.h:309
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
void SetBoardUse(BOARD_USE aUse)
Set what the board is going to be used for.
Definition: board.h:262
static TOOL_ACTION selectionTool
Definition: actions.h:156
The CvPcb application main window.
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:397
void ClearToolbar()
Clear the toolbar and remove all associated menus.
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98
#define CHECK(x)