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-2018 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 
30 #include <fctsys.h>
31 #include <common.h>
33 #include <class_drawpanel.h>
34 #include <class_draw_panel_gal.h>
35 #include <pcb_draw_panel_gal.h>
36 #include <confirm.h>
37 #include <macros.h>
38 #include <bitmaps.h>
39 #include <msgpanel.h>
41 #include <lib_id.h>
42 #include <fp_lib_table.h>
43 #include <eda_dockart.h>
44 
45 #include <io_mgr.h>
46 #include <class_module.h>
47 #include <class_board.h>
48 #include <pcb_painter.h>
49 
50 #include <cvpcb_mainframe.h>
52 #include <cvpcb_id.h>
53 #include <listboxes.h>
54 
56 #include <view/view.h>
57 
58 #include <tool/tool_manager.h>
59 #include <tool/tool_dispatcher.h>
60 #include <tool/common_tools.h>
61 #include "tools/cvpcb_actions.h"
62 
63 // Colors for layers and items
65 
66 
67 BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
68  EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
69  EVT_TOOL( ID_OPTIONS_SETUP, DISPLAY_FOOTPRINTS_FRAME::InstallOptionsDisplay )
71  EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom )
72  EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid )
73 
77 
78  /*
79  EVT_TOOL and EVT_UPDATE_UI for:
80  ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
81  ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
82  ID_TB_OPTIONS_SHOW_PADS_SKETCH
83  are managed in PCB_BASE_FRAME
84  */
85 END_EVENT_TABLE()
86 
87 
89  PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
90  wxDefaultPosition, wxDefaultSize,
92 {
93  m_showAxis = true; // true to draw axis.
94 
95  // Give an icon
96  wxIcon icon;
97  icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
98  SetIcon( icon );
99 
100  SetBoard( new BOARD() );
101  SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
102 
103  // Don't show the default board solder mask clearance. Only the
104  // footprint or pad clearance setting should be shown if it is not 0.
106 
107  LoadSettings( config() );
108 
109  // Initialize grid id to a default value if not found in config or incorrect:
110  if( !( GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) ) )
112 
113  GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
114 
115  // Initialize some display options
116  auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
117  displ_opts->m_DisplayPadIsol = false; // Pad clearance has no meaning here
118 
119  // Track and via clearance has no meaning here.
120  displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
121 
122  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
123  ReCreateHToolbar();
124  ReCreateVToolbar();
125  ReCreateOptToolbar();
126 
127  // Create GAL canvas
128 #ifdef __WXMAC__
129  // Cairo renderer doesn't handle Retina displays
131 #else
133 #endif
134  auto* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
135  GetGalDisplayOptions(), backend );
136  SetGalCanvas( gal_drawPanel );
137 
138  m_auimgr.SetManagedWindow( this );
139  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
140 
141  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
142  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
143 
144  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
145 
146  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
147  m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
148 
149  m_auimgr.Update();
150 
151  // Create the manager and dispatcher & route draw panel events to the dispatcher
152  m_toolManager = new TOOL_MANAGER;
153  m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
154  gal_drawPanel->GetViewControls(), this );
155  m_actions = new CVPCB_ACTIONS();
156  m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
157  gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
158 
159  m_actions->RegisterAllTools( m_toolManager );
160  m_toolManager->InitTools();
161 
162  // Run the control tool, it is supposed to be always active
163  m_toolManager->InvokeTool( "cvpcb.InteractiveSelection" );
164 
165  auto& galOpts = GetGalDisplayOptions();
166  galOpts.m_axesEnabled = true;
167  UseGalCanvas( true );
168 
169  // Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
170  GetGalCanvas()->GetView()->SetScale( m_lastZoom );
171 
172  updateView();
173 
174  Show( true );
175 }
176 
177 
179 {
181  GetGalCanvas()->GetView()->Clear();
182  // Be sure any event cannot be fired after frame deletion:
183  GetGalCanvas()->SetEvtHandlerEnabled( false );
184 
185  // Be sure a active tool (if exists) is desactivated:
186  if( m_toolManager )
188 
189  delete GetScreen();
190  SetScreen( NULL ); // Be sure there is no double deletion
191 }
192 
193 
194 void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
195 {
196  Destroy();
197 }
198 
199 
201 {
202  // Currently, no vertical right toolbar.
203  // So do nothing
204 }
205 
206 
208 {
209  if( m_optionsToolBar )
210  return;
211 
212  // Create options tool bar.
213  m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
214  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
215 
216  // TODO: these can be moved to the 'proper' right vertical toolbar if and when there are
217  // actual tools to put there. That, or I'll get around to implementing configurable
218  // toolbars.
219  m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
220  KiScaledBitmap( cursor_xpm, this ),
221  wxEmptyString, wxITEM_CHECK );
222 
223  m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
224  KiScaledBitmap( measurement_xpm, this ),
225  _( "Measure distance between two points" ),
226  wxITEM_CHECK );
227 
229 
230  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
231  _( "Hide grid" ), wxITEM_CHECK );
232 
233  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
234  KiScaledBitmap( polar_coord_xpm, this ),
235  _( "Display polar coordinates" ), wxITEM_CHECK );
236 
237  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
238  KiScaledBitmap( unit_inch_xpm, this ),
239  _( "Set units to inches" ), wxITEM_CHECK );
240 
241  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
242  KiScaledBitmap( unit_mm_xpm, this ),
243  _( "Set units to millimeters" ), wxITEM_CHECK );
244 
245 #ifndef __APPLE__
246  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
247  KiScaledBitmap( cursor_shape_xpm, this ),
248  _( "Change cursor shape" ), wxITEM_CHECK );
249 #else
250  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
251  KiScaledBitmap( cursor_shape_xpm, this ),
252  _( "Change cursor shape (not supported in Legacy Toolset)" ),
253  wxITEM_CHECK );
254 #endif
255 
256  m_optionsToolBar->AddSeparator();
257  m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
258  KiScaledBitmap( pad_sketch_xpm, this ),
259  _( "Show pads in outline mode" ), wxITEM_CHECK );
260 
262  KiScaledBitmap( text_sketch_xpm, this ),
263  _( "Show texts in line mode" ), wxITEM_CHECK );
264 
266  KiScaledBitmap( show_mod_edge_xpm, this ),
267  _( "Show outlines in line mode" ), wxITEM_CHECK );
268 
269  m_optionsToolBar->Realize();
270 }
271 
272 
274 {
275  if( m_mainToolBar != NULL )
276  return;
277 
278  m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
279  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
280 
281  m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiScaledBitmap( config_xpm, this ),
282  _( "Display options" ) );
283 
284  m_mainToolBar->AddSeparator();
285 
286  m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ),
287  _( "Zoom in (F1)" ) );
288 
289  m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ),
290  _( "Zoom out (F2)" ) );
291 
292  m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ),
293  _( "Redraw view (F3)" ) );
294 
295  m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ),
296  _( "Zoom to fit footprint (Home)" ) );
297 
298  m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
299  _( "Zoom to selection" ), wxITEM_CHECK );
300 
301  m_mainToolBar->AddSeparator();
302  m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiScaledBitmap( three_d_xpm, this ),
303  _( "3D Display (Alt+3)" ) );
304 
306 
307  // Grid selection choice box.
309  wxDefaultPosition, wxDefaultSize, 0, NULL );
311  m_mainToolBar->AddControl( m_gridSelectBox );
312 
314 
315  // Zoom selection choice box.
317  wxDefaultPosition, wxDefaultSize, 0, NULL );
319  m_mainToolBar->AddControl( m_zoomSelectBox );
320 
321  // after adding the buttons to the toolbar, must call Realize() to reflect
322  // the changes
323  m_mainToolBar->Realize();
324 }
325 
326 
327 void DISPLAY_FOOTPRINTS_FRAME::LoadSettings( wxConfigBase* aCfg )
328 {
330 
331  m_configSettings.Load( aCfg ); // mainly, load the color config
332 
333  aCfg->Read( ConfigBaseName() + AUTO_ZOOM_KEY, &m_autoZoom, true );
334  aCfg->Read( ConfigBaseName() + ZOOM_KEY, &m_lastZoom, 10.0 );
335 }
336 
337 
338 void DISPLAY_FOOTPRINTS_FRAME::SaveSettings( wxConfigBase* aCfg )
339 {
341 
342  aCfg->Write( ConfigBaseName() + AUTO_ZOOM_KEY, m_autoZoom );
343  aCfg->Write( ConfigBaseName() + ZOOM_KEY, GetGalCanvas()->GetView()->GetScale() );
344 }
345 
346 
348 {
349  auto painter = static_cast<KIGFX::PCB_PAINTER*>( GetGalCanvas()->GetView()->GetPainter() );
350  KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
351  settings->LoadDisplayOptions( &m_DisplayOptions, false );
352 
354  GetGalCanvas()->Refresh();
355 }
356 
357 
358 void DISPLAY_FOOTPRINTS_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
359 {
360 }
361 
362 
363 void DISPLAY_FOOTPRINTS_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
364 {
365 }
366 
367 
368 bool DISPLAY_FOOTPRINTS_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
369 {
370  return true;
371 }
372 
373 
374 bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
375  EDA_KEY aHotKey )
376 {
377  bool eventHandled = true;
378 
379  // Filter out the 'fake' mouse motion after a keyboard movement
380  if( !aHotKey && m_movingCursorWithKeyboard )
381  {
383  return false;
384  }
385 
386  wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
387  cmd.SetEventObject( this );
388 
389  wxPoint pos = aPosition;
390  wxPoint oldpos = GetCrossHairPosition();
391  GeneralControlKeyMovement( aHotKey, &pos, true );
392 
393  switch( aHotKey )
394  {
395  case WXK_F1:
396  cmd.SetId( ID_KEY_ZOOM_IN );
397  GetEventHandler()->ProcessEvent( cmd );
398  break;
399 
400  case WXK_F2:
401  cmd.SetId( ID_KEY_ZOOM_OUT );
402  GetEventHandler()->ProcessEvent( cmd );
403  break;
404 
405  case WXK_F3:
406  cmd.SetId( ID_ZOOM_REDRAW );
407  GetEventHandler()->ProcessEvent( cmd );
408  break;
409 
410  case WXK_F4:
411  cmd.SetId( ID_POPUP_ZOOM_CENTER );
412  GetEventHandler()->ProcessEvent( cmd );
413  break;
414 
415  case WXK_HOME:
416  cmd.SetId( ID_ZOOM_PAGE );
417  GetEventHandler()->ProcessEvent( cmd );
418  break;
419 
420  case ' ':
422  break;
423 
424  case GR_KB_ALT + '3':
425  cmd.SetId( ID_CVPCB_SHOW3D_FRAME );
426  GetEventHandler()->ProcessEvent( cmd );
427  break;
428 
429  default:
430  eventHandled = false;
431  }
432 
433  SetCrossHairPosition( pos );
434  RefreshCrossHair( oldpos, aPosition, aDC );
435 
436  UpdateStatusBar(); /* Display new cursor coordinates */
437 
438  return eventHandled;
439 }
440 
441 
442 void DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame( wxCommandEvent& event )
443 {
444  bool forceRecreateIfNotOwner = true;
445  CreateAndShow3D_Frame( forceRecreateIfNotOwner );
446 }
447 
448 
456 {
457 }
458 
459 
461 {
462  return m_drawGrid;
463 }
464 
465 
467 {
468  m_drawGrid = aVisible;
469 }
470 
471 
473 {
474  return COLOR4D( DARKGRAY );
475 }
476 
477 
478 MODULE* DISPLAY_FOOTPRINTS_FRAME::Get_Module( const wxString& aFootprintName )
479 {
480  MODULE* footprint = NULL;
481 
482  try
483  {
484  LIB_ID fpid;
485 
486  if( fpid.Parse( aFootprintName, LIB_ID::ID_PCB ) >= 0 )
487  {
488  DisplayInfoMessage( this, wxString::Format( _( "Footprint ID \"%s\" is not valid." ),
489  GetChars( aFootprintName ) ) );
490  return NULL;
491  }
492 
493  std::string nickname = fpid.GetLibNickname();
494  std::string fpname = fpid.GetLibItemName();
495 
496  wxLogDebug( wxT( "Load footprint \"%s\" from library \"%s\"." ),
497  fpname.c_str(), nickname.c_str() );
498 
499  footprint = Prj().PcbFootprintLibs( Kiway() )->FootprintLoad(
500  FROM_UTF8( nickname.c_str() ), FROM_UTF8( fpname.c_str() ) );
501  }
502  catch( const IO_ERROR& ioe )
503  {
504  DisplayError( this, ioe.What() );
505  return NULL;
506  }
507 
508  if( footprint )
509  {
510  footprint->SetParent( (EDA_ITEM*) GetBoard() );
511  footprint->SetPosition( wxPoint( 0, 0 ) );
512  return footprint;
513  }
514 
515  wxString msg = wxString::Format( _( "Footprint \"%s\" not found" ), aFootprintName.GetData() );
516  DisplayError( this, msg );
517  return NULL;
518 }
519 
520 
522 {
523  CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
524  MODULE* module = nullptr;
525  const FOOTPRINT_INFO* module_info = nullptr;
526 
527  if( GetBoard()->m_Modules.GetCount() )
529 
530  wxString footprintName = parentframe->GetSelectedFootprint();
531 
532  if( footprintName.IsEmpty() )
533  {
534  COMPONENT* comp = parentframe->GetSelectedComponent();
535 
536  if( comp )
537  footprintName = comp->GetFPID().GetUniStringLibId();
538  }
539 
540  if( !footprintName.IsEmpty() )
541  {
542  SetTitle( wxString::Format( _( "Footprint: %s" ), footprintName ) );
543 
544  module = Get_Module( footprintName );
545 
546  module_info = parentframe->m_FootprintsList->GetModuleInfo( footprintName );
547  }
548 
549  if( module )
550  GetBoard()->m_Modules.PushBack( module );
551 
552  if( module_info )
553  SetStatusText( wxString::Format( _( "Lib: %s" ), module_info->GetLibNickname() ), 0 );
554  else
555  SetStatusText( wxEmptyString, 0 );
556 
557  updateView();
558 
559  UpdateStatusBar();
560 
561  GetCanvas()->Refresh();
562  Update3DView();
563 }
564 
565 
567 {
568  PCB_DRAW_PANEL_GAL* dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
569  dp->UseColorScheme( &Settings().Colors() );
570  dp->DisplayBoard( GetBoard() );
571 
573 
574  if( m_autoZoom )
576  else
578 
579  UpdateMsgPanel();
580 }
581 
582 
584 {
585  MODULE* footprint = GetBoard()->m_Modules;
586  MSG_PANEL_ITEMS items;
587 
588  if( footprint )
589  footprint->GetMsgPanelInfo( m_UserUnits, items );
590 
591  SetMsgPanel( items );
592 }
593 
594 
595 void DISPLAY_FOOTPRINTS_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
596 {
597  if( GetBoard() )
598  UpdateMsgPanel();
599 }
600 
601 
602 void DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection( wxUpdateUIEvent& aEvent )
603 {
604  switch( aEvent.GetId() )
605  {
607  aEvent.Check( GetToolId() == ID_TB_MEASUREMENT_TOOL );
608  break;
609 
610  case ID_NO_TOOL_SELECTED:
611  aEvent.Check( GetToolId() == ID_NO_TOOL_SELECTED );
612  break;
613 
614  case ID_ZOOM_SELECTION:
615  aEvent.Check( GetToolId() == ID_ZOOM_SELECTION );
616  break;
617 
618  default:
619  break;
620  }
621 }
622 
623 
624 /*
625  * Redraw the BOARD items but not cursors, axis or grid.
626  */
627 void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
628  GR_DRAWMODE aDrawMode, const wxPoint& aOffset )
629 {
630  if( m_Modules )
631  {
632  m_Modules->Draw( aPanel, aDC, GR_COPY );
633  }
634 }
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:125
#define GR_KB_ALT
int m_SolderMaskMargin
Solder mask margin.
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard) EVT_UPDATE_UI(ID_MODEDIT_INSERT_MODULE_IN_BOARD
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
const LIB_ID & GetFPID() const
Definition: pcb_netlist.h:166
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:53
virtual EDA_DRAW_PANEL * GetCanvas() const
Definition: draw_frame.h:388
FOOTPRINT_INFO * GetModuleInfo(const wxString &aFootprintId)
Get info for a module by id.
Model changes (required full reload)
Definition: tool_base.h:83
COLOR4D GetGridColor() override
Function GetGridColor() , virtual.
This file is part of the common library.
wxString GetLibNickname() const override
void Load(wxConfigBase *aCfg) override
virtual void SetScreen(BASE_SCREEN *aScreen)
Definition: draw_frame.h:181
Class BOARD to handle a board.
MODULE * FootprintLoad(const wxString &aNickname, const wxString &aFootprintName)
Function FootprintLoad.
bool OnRightClick(const wxPoint &MousePos, wxMenu *PopMenu) override
Definition: id.h:241
void UpdateAllItems(int aUpdateFlags)
Updates all items in the view according to the given flags.
Definition: view.cpp:1434
static TOOL_ACTION zoomFitScreen
Definition: actions.h:56
void ApplyDisplaySettingsToGAL()
Updates the GAL with display settings changes.
wxString ConfigBaseName()
Function ConfigBaseName.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
BOARD * GetBoard() const
MODULE * Get_Module(const wxString &CmpName)
#define FOOTPRINTVIEWER_FRAME_NAME
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
void DeleteAll()
Function DeleteAll deletes all items on the list and leaves the list empty.
Definition: dlist.cpp:44
A logical library item identifier and consists of various portions much like a URI.
Definition: lib_id.h:51
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, EDA_BASE_FRAME *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
Item needs to be redrawn.
Definition: view_item.h:61
Class PCB_PAINTER Contains methods for drawing PCB-specific items.
Definition: pcb_painter.h:211
wxPoint m_O_Curseur
Relative Screen cursor coordinate (on grid) in user units.
Definition: base_screen.h:185
wxChoice * m_gridSelectBox
Definition: draw_frame.h:148
void DeactivateTool()
Function DeactivateTool() Deactivates the currently active tool.
void updateView()
update the gal canvas (view, colors ...)
Class DISPLAY_FOOTPRINTS_FRAME is used to display footprints.
static const wxChar AUTO_ZOOM_KEY[]
void OnCloseWindow(wxCloseEvent &Event) override
wxString GetUniStringLibId() const
Definition: lib_id.h:148
void OnLeftClick(wxDC *DC, const wxPoint &MousePos) override
This file contains miscellaneous commonly used macros and functions.
void PushBack(T *aNewElement)
Function PushBack puts aNewElement at the end of the list sequence.
Definition: dlist.h:250
bool GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Handle the common part of GeneralControl dedicated to global cursor keys (i.e.
Class PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:62
Class TOOL_MANAGER.
Definition: tool_manager.h:49
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
Class UNDO_REDO_CONTAINER is a holder to handle alist of undo (or redo) command.
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
static TOOL_ACTION centerContents
Definition: actions.h:59
wxAuiToolBar * m_optionsToolBar
The options tool bar typcially located on the left edge of the main window.
Definition: draw_frame.h:160
EDA_DRAW_FRAME::OnSelectGrid ID_TB_OPTIONS_SELECT_UNIT_INCH
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
Move and refresh the crosshair after movement and call the mouse capture function.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void SetEnvironment(EDA_ITEM *aModel, KIGFX::VIEW *aView, KIGFX::VIEW_CONTROLS *aViewControls, wxWindow *aFrame)
Sets the work environment (model, view, view controls and the parent window).
void DisplayBoard(BOARD *aBoard)
Function DisplayBoard adds all items from the current board to the VIEW, so they can be displayed by ...
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:216
void Clear()
Function Clear() Removes all items from the view.
Definition: view.cpp:1108
GR_DRAWMODE
Drawmode. Compositing mode plus a flag or two.
Definition: gr_basic.h:37
PCB_GENERAL_SETTINGS & Settings()
const UTF8 & GetLibItemName() const
Definition: lib_id.h:114
void OnUIToolSelection(wxUpdateUIEvent &aEvent)
UI events:
wxChoice * m_zoomSelectBox
Definition: draw_frame.h:149
bool IsGridVisible() const override
Function IsGridVisible() , virtual.
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
The common library.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
void ResetTools(TOOL_BASE::RESET_REASON aReason)
Function ResetTools() Resets all tools (i.e.
Class KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within...
Definition: kiway.h:258
void RedrawActiveWindow(wxDC *DC, bool EraseBg) override
uint32_t EDA_KEY
Definition: common.h:73
#define KICAD_DEFAULT_DRAWFRAME_STYLE
PCB_GENERAL_SETTINGS m_configSettings
Class CVPCB_ACTIONS.
Definition: cvpcb_actions.h:42
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
void SetPosition(const wxPoint &aPos) override
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void OnLeftDClick(wxDC *DC, const wxPoint &MousePos) override
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
virtual bool CreateAndShow3D_Frame(bool aForceRecreateIfNotOwner)
Shows the 3D view frame.
Specialization of the wxAuiPaneInfo class for KiCad panels.
wxAuiToolBar * m_mainToolBar
Standard horizontal Toolbar.
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
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...
void UseColorScheme(const COLORS_DESIGN_SETTINGS *aSettings)
Function UseColorScheme Applies layer color settings.
Class TOOL_DISPATCHER.
PCB_DISPLAY_OPTIONS m_DisplayOptions
Class COMPONENT is used to store components and all of their related information found in a netlist...
Definition: pcb_netlist.h:83
BOARD * GetBoard()
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS *aOptions, bool aShowPageLimits)
Function LoadDisplayOptions Loads settings related to display options (high-contrast mode...
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.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
void GetMsgPanelInfo(EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM > &aList) override
>
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
Declaration of the eda_3d_viewer class.
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:205
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_CVPCB_DISPLAY)
DLIST< MODULE > m_Modules
Definition: class_board.h:248
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
int GetToolId() const
Definition: draw_frame.h:519
COMPONENT * GetSelectedComponent()
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:154
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
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
Class COLORS_DESIGN_SETTINGS is a list of color settings for designs in Pcbnew.
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
unsigned GetCount() const
Function GetCount returns the number of elements in the list.
Definition: dlist.h:126
void SetGridVisibility(bool aVisible) override
Function SetGridVisibility() , virtual It may be overloaded by derived classes if you want to store/r...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Return a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:921
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw.
Module description (excepted pads)
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL)
const UTF8 & GetLibNickname() const
Return the logical library name portion of a LIB_ID.
Definition: lib_id.h:97
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Set the screen cross hair position to aPosition in logical (drawing) units.
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
void ClearUndoORRedoList(UNDO_REDO_CONTAINER &aList, int aItemCount=-1) override
Function ClearUndoORRedoList free the undo or redo list from List element Wrappers are deleted...
Definition: undo_redo.cpp:598
Message panel definition file.
EDA_UNITS_T m_UserUnits
Definition: draw_frame.h:120
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Function DisplayInfoMessage displays an informational message box with aMessage.
Definition: confirm.cpp:277
void Show3D_Frame(wxCommandEvent &event) override
Display 3D frame of current footprint selection.
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:245
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Return the current cross hair position in logical (drawing) coordinates.
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
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:173
class PCB_BASE_FRAME basic PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer...
void StopDrawing()
Function StopDrawing() Prevents the GAL canvas from further drawing till it is recreated or StartDraw...
static const wxChar ZOOM_KEY[]
The CvPcb application main window.
bool Update3DView(const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool GeneralControl(wxDC *DC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Perform application specific control using aDC at aPosition in logical units.