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 <class_board.h>
28 #include <class_module.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 <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( icon_cvpcb_xpm ) );
75  SetIcon( icon );
76 
77  SetBoard( new BOARD() );
78  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
79 
80  // Create GAL canvas before loading settings
81  auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
82  GetGalDisplayOptions(),
84  SetCanvas( gal_drawPanel );
85 
86  // Don't show the default board solder mask clearance. Only the
87  // footprint or pad clearance setting should be shown if it is not 0.
89 
90  LoadSettings( config() );
91 
92  // Initialize some display options
93  auto displ_opts = GetDisplayOptions();
94  displ_opts.m_DisplayPadIsol = false; // Pad clearance has no meaning here
95 
96  // Track and via clearance has no meaning here.
97  displ_opts.m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
98  SetDisplayOptions( displ_opts );
99 
100  // Create the manager and dispatcher & route draw panel events to the dispatcher
101  m_toolManager = new TOOL_MANAGER;
102  m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
103  gal_drawPanel->GetViewControls(), config(), this );
104  m_actions = new CVPCB_ACTIONS();
105  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
106  gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
107 
108  m_toolManager->RegisterTool( new COMMON_TOOLS );
109  m_toolManager->RegisterTool( new ZOOM_TOOL );
110  m_toolManager->RegisterTool( new CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL );
111  m_toolManager->RegisterTool( new PCB_VIEWER_TOOLS );
112 
113  m_toolManager->GetTool<PCB_VIEWER_TOOLS>()->SetFootprintFrame( true );
114 
115  m_toolManager->InitTools();
116 
117  setupUIConditions();
118 
119  // Run the control tool, it is supposed to be always active
120  m_toolManager->InvokeTool( "cvpcb.FootprintViewerInteractiveSelection" );
121 
122  ReCreateHToolbar();
123  ReCreateVToolbar();
124  ReCreateOptToolbar();
125 
126  // Create the infobar
127  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
128 
129  m_auimgr.SetManagedWindow( this );
130 
131  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
132  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
133  m_auimgr.AddPane( m_infoBar, EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
134  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
135  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
136 
137  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
138  // hidding it.
139  m_auimgr.Update();
140 
141  // We don't want the infobar displayed right away
142  m_auimgr.GetPane( "InfoBar" ).Hide();
143  m_auimgr.Update();
144 
145  auto& galOpts = GetGalDisplayOptions();
146  galOpts.m_axesEnabled = true;
147 
148  ActivateGalCanvas();
149 
150  // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
151  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
152 
153  if( cfg )
154  GetCanvas()->GetView()->SetScale( cfg->m_FootprintViewerZoom );
155 
156  updateView();
157 
158  Show( true );
159 }
160 
161 
163 {
164  // Shutdown all running tools
165  if( m_toolManager )
167 
169  GetCanvas()->StopDrawing();
170  GetCanvas()->GetView()->Clear();
171  // Be sure any event cannot be fired after frame deletion:
172  GetCanvas()->SetEvtHandlerEnabled( false );
173 
174  delete GetScreen();
175  SetScreen( NULL ); // Be sure there is no double deletion
176 }
177 
178 
180 {
182 
184  PCB_EDITOR_CONDITIONS cond( this );
185 
186  wxASSERT( mgr );
187 
188 #define CHECK( x ) ACTION_CONDITIONS().Check( x )
189 
193 
196 
199 
200 
201  auto autoZoomCond =
202  [this] ( const SELECTION& aSel )
203  {
204  return GetAutoZoom();
205  };
206 
212 
213 #undef CHECK
214 }
215 
216 
218 {
219  Destroy();
220 }
221 
222 
224 {
225  // Currently, no vertical right toolbar.
226 }
227 
228 
230 {
231  if( m_optionsToolBar )
233  else
234  m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
235  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
236 
239 
246 
252 
253  m_optionsToolBar->Realize();
254 }
255 
256 
258 {
259  // Note:
260  // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
261  // all wxAuiToolBarItems.
262  // However the wxAuiToolBarItems are not the owners of controls managed by
263  // them ( m_zoomSelectBox and m_gridSelectBox ), and therefore do not delete them
264  // So we do not recreate them after clearing the tools.
265 
266  if( m_mainToolBar )
268  else
269  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
270  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
271 
278 
281 
283 
284  // Grid selection choice box.
285  if( !m_gridSelectBox )
287  wxDefaultPosition, wxDefaultSize, 0, NULL );
288 
290  m_mainToolBar->AddControl( m_gridSelectBox );
291 
293 
294  // Zoom selection choice box.
295  if( !m_zoomSelectBox )
297  wxDefaultPosition, wxDefaultSize, 0, NULL );
298 
300  m_mainToolBar->AddControl( m_zoomSelectBox );
301 
302  // after adding the buttons to the toolbar, must call Realize() to reflect
303  // the changes
304  m_mainToolBar->Realize();
305 }
306 
307 
309 {
310  auto cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
311  wxCHECK( cfg, /* void */ );
312 
313  // We don't allow people to change this right now, so make sure it's on
315 
317 
318  SetDisplayOptions( cfg->m_FootprintViewerDisplayOptions );
319 }
320 
321 
323 {
324  auto cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
325  wxCHECK( cfg, /* void */ );
326 
328 
329  cfg->m_FootprintViewerDisplayOptions = GetDisplayOptions();
330 
331  cfg->m_FootprintViewerZoom = GetCanvas()->GetView()->GetScale();
332 }
333 
334 
336 {
337  auto cfg = dynamic_cast<CVPCB_SETTINGS*>( aCfg );
338  wxCHECK( cfg, nullptr );
339  return &cfg->m_FootprintViewer;
340 }
341 
342 
344 {
345  auto cfg = dynamic_cast<CVPCB_SETTINGS*>( Kiface().KifaceSettings() );
346  wxCHECK( cfg, nullptr );
347  return &cfg->m_FootprintViewerMagneticSettings;
348 }
349 
350 
352 {
353  return COLOR4D( DARKGRAY );
354 }
355 
356 
357 MODULE* DISPLAY_FOOTPRINTS_FRAME::GetModule( const wxString& aFootprintName, REPORTER& aReporter )
358 {
359  MODULE* footprint = NULL;
360 
361  LIB_ID fpid;
362 
363  if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
364  {
365  aReporter.Report( wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
366  aFootprintName ),
368  return NULL;
369  }
370 
371  wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
372  wxString fpName = FROM_UTF8( fpid.GetLibItemName().c_str() );
373 
374  FP_LIB_TABLE* fpTable = Prj().PcbFootprintLibs( Kiway() );
375  wxASSERT( fpTable );
376 
377  // See if the library requested is in the library table
378  if( !fpTable->HasLibrary( libNickname ) )
379  {
380  aReporter.Report( wxString::Format( _( "Library \"%s\" is not in the footprint library table." ),
381  libNickname ),
383  return NULL;
384  }
385 
386  // See if the footprint requested is in the library
387  if( !fpTable->FootprintExists( libNickname, fpName ) )
388  {
389  aReporter.Report( wxString::Format( _( "Footprint \"%s\" not found." ), aFootprintName ),
391  return NULL;
392  }
393 
394  try
395  {
396  footprint = fpTable->FootprintLoad( libNickname, fpName );
397  }
398  catch( const IO_ERROR& ioe )
399  {
400  DisplayError( this, ioe.What() );
401  return NULL;
402  }
403 
404  if( footprint )
405  {
406  footprint->SetParent( (EDA_ITEM*) GetBoard() );
407  footprint->SetPosition( wxPoint( 0, 0 ) );
408  return footprint;
409  }
410 
411  aReporter.Report( wxString::Format( _( "Footprint \"%s\" not found." ), aFootprintName ),
413  return NULL;
414 }
415 
416 
418 {
419  CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
420  MODULE* module = nullptr;
421  const FOOTPRINT_INFO* module_info = nullptr;
422 
424  GetCanvas()->GetView()->Clear();
425 
426  wxString footprintName = parentframe->GetSelectedFootprint();
427 
428  if( footprintName.IsEmpty() )
429  {
430  COMPONENT* comp = parentframe->GetSelectedComponent();
431 
432  if( comp )
433  footprintName = comp->GetFPID().GetUniStringLibId();
434  }
435 
436  INFOBAR_REPORTER infoReporter( m_infoBar );
437  m_infoBar->Dismiss();
438 
439  if( !footprintName.IsEmpty() )
440  {
441  SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
442 
443  module = GetModule( footprintName, infoReporter );
444 
445  module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
446  }
447 
448  if( module )
449  GetBoard()->Add( module );
450 
451  if( module_info )
452  SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetLibNickname() ), 0 );
453  else
454  SetStatusText( wxEmptyString, 0 );
455 
456  infoReporter.Finalize();
457 
458  updateView();
459 
460  UpdateStatusBar();
461 
462  GetCanvas()->Refresh();
463  Update3DView( true );
464 }
465 
466 
468 {
469  PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetCanvas() );
470  dp->UpdateColors();
471  dp->DisplayBoard( GetBoard() );
472 
474 
475  if( GetAutoZoom() )
477  else
479 
480  UpdateMsgPanel();
481 }
482 
483 
485 {
486  MODULE* footprint = GetBoard()->GetFirstModule();
487  MSG_PANEL_ITEMS items;
488 
489  if( footprint )
490  footprint->GetMsgPanelInfo( this, items );
491 
492  SetMsgPanel( items );
493 }
494 
495 
497 {
498  auto* settings = Pgm().GetSettingsManager().GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
499 
500  if( settings )
501  return Pgm().GetSettingsManager().GetColorSettings( settings->m_ColorTheme );
502  else
503  return Pgm().GetSettingsManager().GetColorSettings();
504 }
505 
506 
508 {
509  return GetBoard()->GetFirstModule();
510 }
511 
512 
514 {
515  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
516  wxCHECK( cfg, /* void */ );
517  cfg->m_FootprintViewerAutoZoom = aAutoZoom;
518 }
519 
520 
522 {
523  CVPCB_SETTINGS* cfg = dynamic_cast<CVPCB_SETTINGS*>( config() );
524  wxCHECK( cfg, false );
525  return cfg->m_FootprintViewerAutoZoom;
526 }
527 
528 
530 {
532 }
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
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:239
static TOOL_ACTION show3DViewer
Definition: actions.h:154
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.
ACTION_TOOLBAR.
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
const BITMAP_OPAQUE icon_cvpcb_xpm[1]
Definition: icon_cvpcb.cpp:158
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
FOOTPRINT_LIST * m_FootprintsList
static wxString FROM_UTF8(const char *cstring)
function FROM_UTF8 converts a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:114
static TOOL_ACTION zoomInCenter
Definition: actions.h:91
virtual APP_SETTINGS_BASE * config() const
Returns the settings object used in SaveSettings(), and is overloaded in KICAD_MANAGER_FRAME.
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintId)
Get info for a module by id.
Model changes (required full reload)
Definition: tool_base.h:82
COLOR4D GetGridColor() override
Function GetGridColor() , virtual.
This file is part of the common library.
wxString GetLibNickname() const override
MAGNETIC_SETTINGS * GetMagneticItemsSettings() override
SELECTION_CONDITION FullscreenCursor()
Creates a functor testing if the cursor is full screen in a frame.
COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
ACTION_TOOLBAR * m_optionsToolBar
MODULE * GetModule(const wxString &CmpName, REPORTER &aReporter)
virtual void SetScreen(BASE_SCREEN *aScreen)
static constexpr bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:97
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()
Creates 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)
Adds a TOOL_ACTION-based button to the toolbar.
SELECTION_CONDITION CurrentTool(const TOOL_ACTION &aTool)
Creates 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:94
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:531
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
#define FOOTPRINTVIEWER_FRAME_NAME
ACTION_TOOLBAR * m_mainToolBar
ACTION_MANAGER.
REPORTER is 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:235
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
bool always_show_cursor
Definition: app_settings.h:42
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
static TOOL_ACTION imperialUnits
Definition: actions.h:142
wxChoice * m_gridSelectBox
SELECTION_CONDITION PadFillDisplay()
Creates 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: base_struct.h:196
static TOOL_ACTION zoomOutCenter
Definition: actions.h:92
DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
This file contains miscellaneous commonly used macros and functions.
const char * c_str() const
Definition: utf8.h:107
CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL.
BOARD_ITEM_CONTAINER * GetModel() const override
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:157
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
TOOL_MANAGER.
Definition: tool_manager.h:51
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
static TOOL_ACTION measureTool
Definition: actions.h:150
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT) override
Adds an item to the container.
Stores the common settings that are saved and loaded for each window / frame.
Definition: app_settings.h:81
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:139
static TOOL_ACTION centerContents
Definition: actions.h:98
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
Returns a pointer to the window settings for this frame.
SELECTION_CONDITION GridVisible()
Creates 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)
Creates 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)
Function DisplayBoard adds all items from the current board to the VIEW, so they can be displayed by ...
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1107
static TOOL_ACTION toggleGrid
Definition: actions.h:138
static TOOL_ACTION showPadNumbers
Definition: pcb_actions.h:234
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxChoice * m_zoomSelectBox
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
static TOOL_ACTION togglePolarCoords
Definition: actions.h:145
bool GetAutoZoom() override
Get if the canvas should automatically zoom to the footprint on load.
MODULE * GetFirstModule() const
Gets the first module in the list (used in footprint viewer/editor) or NULL if none.
Definition: class_board.h:310
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:273
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
bool m_FootprintViewerAutoZoom
#define KICAD_DEFAULT_DRAWFRAME_STYLE
void Finalize()
Update the infobar with the reported text.
Definition: reporter.cpp:179
CVPCB_ACTIONS.
Definition: cvpcb_actions.h:40
void SetPosition(const wxPoint &aPos) override
virtual KIGFX::PCB_VIEW * GetView() const override
Function GetView() Returns a pointer to the VIEW instance used in the panel.
Specialization of the wxAuiPaneInfo class for KiCad panels.
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...
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...
COMMON_TOOLS.
Definition: common_tools.h:38
void UpdateColors()
Updates the color settings in the painter and GAL.
COMPONENT is used to store components and all of their related information found in a netlist.
Definition: pcb_netlist.h:80
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Saves common frame parameters to a configuration data file.
SELECTION_CONDITION PadNumbersDisplay()
Creates a functor that tests if the pad numbers are displayed.
BOARD * GetBoard()
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
Definition: project.cpp:286
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:228
static TOOL_ACTION graphicsOutlines
Display module edges as outlines.
Definition: pcb_actions.h:372
static TOOL_ACTION metricUnits
Definition: actions.h:143
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:68
wxString GetSelectedFootprint()
void InitDisplay()
Function InitDisplay Refresh the full display for this frame: Set the title, the status line and redr...
virtual void UpdateStatusBar() override
Update the status bar information.
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:50
see class PGM_BASE
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
SELECTION_CONDITION GraphicsFillDisplay()
Creates a functor that tests if the frame fills graphics items.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
ACTION_MANAGER * GetActionManager()
Definition: tool_manager.h:199
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, APP_SETTINGS_BASE *aSettings, TOOLS_HOLDER *aFrame)
Sets 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:88
COMPONENT * GetSelectedComponent()
Get the selected component from the component listbox.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
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:102
PCB_VIEWER_TOOLS.
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
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 DeleteAllModules()
Removes all modules from the deque and frees the memory associated with them.
Definition: class_board.h:318
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
wxString GetUniStringLibId() const
Definition: lib_id.h:148
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:100
Abstract interface for BOARD_ITEMs capable of storing other items inside.
BOARD * GetBoard() const
virtual void Update3DView(bool aForceReload, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
double GetScale() const
Function GetScale()
Definition: view.h:257
int Parse(const UTF8 &aId, LIB_ID_TYPE aType, bool aFix=false)
Parse LIB_ID with the information from aId.
Definition: lib_id.cpp:122
Message panel definition file.
Class that groups generic conditions for PCB editor states.
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
INFOBAR_REPORTER is a wrapper for reporting to a WX_INFOBAR UI element.
Definition: reporter.h:292
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
static TOOL_ACTION selectionTool
Definition: actions.h:149
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:375
void ClearToolbar()
Clear the toolbar and remove all associated menus.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99
#define CHECK(x)