KiCad PCB EDA Suite
moduleframe.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
7  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
32 #include <fctsys.h>
33 #include <pgm_base.h>
34 #include <kiway.h>
35 #include <project.h>
36 #include <kicad_plugin.h>
37 #include <class_drawpanel.h>
38 #include <pcb_draw_panel_gal.h>
39 #include <confirm.h>
40 #include <wxPcbStruct.h>
41 #include <dialog_helpers.h>
43 #include <msgpanel.h>
44 #include <fp_lib_table.h>
45 #include <bitmaps.h>
47 
48 #include <class_board.h>
49 #include <class_module.h>
50 
51 #include <pcbnew.h>
52 #include <pcbnew_id.h>
53 #include <hotkeys.h>
55 #include <dialog_hotkeys_editor.h>
56 #include <module_editor_frame.h>
57 #include <modview_frame.h>
59 #include <class_pcb_layer_widget.h>
60 #include <invoke_pcb_dialog.h>
61 
62 #include <tool/tool_manager.h>
63 #include <tool/common_tools.h>
64 #include <tool/tool_dispatcher.h>
65 
66 #include "tools/selection_tool.h"
67 #include "tools/zoom_tool.h"
68 #include "tools/edit_tool.h"
69 #include "tools/drawing_tool.h"
70 #include "tools/point_editor.h"
71 #include "tools/pcbnew_control.h"
73 #include "tools/placement_tool.h"
74 #include "tools/picker_tool.h"
75 #include "tools/pad_tool.h"
76 #include "tools/pcb_actions.h"
77 
78 
79 BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
81  PCB_BASE_FRAME::ProcessItemSelection )
82  EVT_CLOSE( FOOTPRINT_EDIT_FRAME::OnCloseWindow )
83  EVT_MENU( wxID_EXIT, FOOTPRINT_EDIT_FRAME::CloseModuleEditor )
84 
85  EVT_SIZE( FOOTPRINT_EDIT_FRAME::OnSize )
86 
87  EVT_CHOICE( ID_ON_ZOOM_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectZoom )
88  EVT_CHOICE( ID_ON_GRID_SELECT, FOOTPRINT_EDIT_FRAME::OnSelectGrid )
89 
90  EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
91 
93 
94  EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
95  EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
96 
97  EVT_TOOL( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
98  EVT_TOOL( ID_MODEDIT_NEW_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
100  EVT_TOOL( ID_MODEDIT_IMPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
101  EVT_TOOL( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
103  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
104  EVT_TOOL( ID_MODEDIT_SHEET_SET, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
105  EVT_TOOL( ID_GEN_IMPORT_DXF_FILE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
106  EVT_TOOL( wxID_PRINT, FOOTPRINT_EDIT_FRAME::ToPrinter )
107  EVT_TOOL( ID_MODEDIT_LOAD_MODULE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
108  EVT_TOOL( ID_MODEDIT_CHECK, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
109  EVT_TOOL( ID_MODEDIT_PAD_SETTINGS, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
114  EVT_TOOL( wxID_UNDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromUndoList )
115  EVT_TOOL( wxID_REDO, FOOTPRINT_EDIT_FRAME::RestoreCopyFromRedoList )
116 
117  // Vertical tool bar button click event handler.
118  EVT_TOOL( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
119  EVT_TOOL( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
121  FOOTPRINT_EDIT_FRAME::OnVerticalToolbar )
122 
123  // Options Toolbar (ID_TB_OPTIONS_SHOW_PADS_SKETCH id is managed in PCB_BASE_FRAME)
127 
128  // Preferences and option menus
130  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
132  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
134  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
136  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
138  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
140  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
141  EVT_MENU( wxID_PREFERENCES,
142  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
144  FOOTPRINT_EDIT_FRAME::ProcessPreferences )
146 
147  // popup commands
149  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
150 
152  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
153 
155  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
157  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
159  FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
161 
162  // Module transformations
163  EVT_MENU( ID_MODEDIT_MODULE_ROTATE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
164  EVT_MENU( ID_MODEDIT_MODULE_MIRROR, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
165  EVT_MENU( ID_MODEDIT_MODULE_MOVE_EXACT, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
166 
167  EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
168  EVT_MENU( ID_PCB_PAD_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
169  EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
170 
171  // Menu Help
172  EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
173  EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
174  EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
175  EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
176 
177  // Menu 3D Frame
179 
180  // Switching canvases
184 
185  // UI update events.
186  EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected )
187  EVT_UPDATE_UI( ID_MODEDIT_SELECT_CURRENT_LIB, FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib )
188  EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
189  EVT_UPDATE_UI( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
190  FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
191  EVT_UPDATE_UI( ID_MODEDIT_SAVE_LIBMODULE, FOOTPRINT_EDIT_FRAME::OnUpdateLibAndModuleSelected )
192  EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
193  FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
194  EVT_UPDATE_UI( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
195  FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard )
196  EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
197  FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard )
198  EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
199  EVT_UPDATE_UI( ID_ZOOM_SELECTION, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
200 
201  EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL,
202  FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
203 
204  // Option toolbar:
205  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
206  FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
207  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
208  FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
209  EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
210  FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
211 
212  EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE,
213  FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
214 
215 END_EVENT_TABLE()
216 
217 #define FOOTPRINT_EDIT_FRAME_NAME wxT( "ModEditFrame" )
218 
219 FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
220  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
221  wxDefaultPosition, wxDefaultSize,
222  KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
223 {
224  m_showBorderAndTitleBlock = false; // true to show the frame references
225  m_showAxis = true; // true to show X and Y axis on screen
226  m_showGridAxis = true; // show the grid origin axis
227  m_hotkeysDescrList = g_Module_Editor_Hokeys_Descr;
228 
229  // Give an icon
230  wxIcon icon;
231  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
232  SetIcon( icon );
233 
234  // Show a title (frame title + footprint name):
235  updateTitle();
236 
237  // Create GAL canvas
238  PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
239  PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
240  GetGalDisplayOptions(),
241  parentFrame->GetGalCanvas()->GetBackend() );
242  SetGalCanvas( drawPanel );
243 
244  SetBoard( new BOARD() );
245  // In modedit, the default net clearance is not known.
246  // (it depends on the actual board)
247  // So we do not show the default clearance, by setting it to 0
248  // The footprint or pad specific clearance will be shown
249  GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
250 
251  // Don't show the default board solder mask clearance in the footprint editor. Only the
252  // footprint or pad clearance setting should be shown if it is not 0.
254 
255  // restore the last footprint from the project, if any
256  restoreLastFootprint();
257 
258  // Ensure all layers and items are visible:
259  // In footprint editor, some layers have no meaning or
260  // cannot be used, but we show all of them, at least to be able
261  // to edit a bad layer
263 
264  wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
265  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), font.GetPointSize(), true );
266 
267  LoadSettings( config() );
268  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
269  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
270  GetScreen()->SetCurItem( NULL );
271 
272  GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
273  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
274 
275  // In modedit, set the default paper size to A4:
276  // this should be OK for all footprint to plot/print
277  SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
278 
279  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
280  ReCreateMenuBar();
281  ReCreateHToolbar();
282  ReCreateAuxiliaryToolbar();
283  ReCreateVToolbar();
284  ReCreateOptToolbar();
285 
286  if( m_canvas )
287  m_canvas->SetEnableBlockCommands( true );
288 
289  m_auimgr.SetManagedWindow( this );
290 
291  EDA_PANEINFO horiz;
292  horiz.HorizontalToolbarPane();
293 
294  EDA_PANEINFO vert;
295  vert.VerticalToolbarPane();
296 
297  EDA_PANEINFO mesg_pane;
298  mesg_pane.MessageToolbarPane();
299 
300  // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
301  // LAYER_WIDGET is floatable, but initially docked at far right
302  EDA_PANEINFO lyrs;
303  lyrs.LayersToolbarPane();
304  lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
305  lyrs.BestSize( m_Layers->GetBestSize() );
306  lyrs.Caption( _( "Visibles" ) );
307 
308  m_auimgr.AddPane( m_mainToolBar,
309  wxAuiPaneInfo( horiz ).Name( "m_mainToolBar" ).Top(). Row( 0 ) );
310 
311  m_auimgr.AddPane( m_auxiliaryToolBar,
312  wxAuiPaneInfo( horiz ).Name( "m_auxiliaryToolBar" ).Top().Row( 1 ) );
313 
314  // The main right vertical toolbar
315  m_auimgr.AddPane( m_drawToolBar,
316  wxAuiPaneInfo( vert ).Name( "m_VToolBar" ).Right().Layer(1) );
317 
318  // Add the layer manager ( most right side of pcbframe )
319  m_auimgr.AddPane( m_Layers, lyrs.Name( "m_LayersManagerToolBar" ).Right().Layer( 2 ) );
320  // Layers manager is visible
321  m_auimgr.GetPane( "m_LayersManagerToolBar" ).Show( true );
322 
323  // The left vertical toolbar (fast acces to display options)
324  m_auimgr.AddPane( m_optionsToolBar,
325  wxAuiPaneInfo( vert ).Name( "m_optionsToolBar" ). Left().Layer(1) );
326 
327  m_auimgr.AddPane( m_canvas,
328  wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
329  m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
330  wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
331 
332  m_auimgr.AddPane( m_messagePanel,
333  wxAuiPaneInfo( mesg_pane ).Name( "MsgPanel" ).Bottom().Layer(10) );
334 
335  // Create the manager and dispatcher & route draw panel events to the dispatcher
336  setupTools();
337  GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
338  UseGalCanvas( parentFrame->IsGalCanvasActive() );
339 
340  if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() )
341  {
342  m_Layers->ReFill();
343  m_Layers->ReFillRender();
344 
345  GetScreen()->m_Active_Layer = F_SilkS;
346  m_Layers->SelectLayer( F_SilkS );
347  m_Layers->OnLayerSelected();
348  }
349 
350  m_auimgr.Update();
351 
352  Raise(); // On some window managers, this is needed
353  Show( true );
354 
355  Zoom_Automatique( false );
356 }
357 
358 
360 {
361  // save the footprint in the PROJECT
363 
364  delete m_Layers;
365 }
366 
367 
369 {
370  return GetBoard()->m_Modules;
371 }
372 
373 
375 {
376  try
377  {
378  const wxString& nickname = GetCurrentLib();
379 
380  const FP_LIB_TABLE_ROW* row = Prj().PcbFootprintLibs()->FindRow( nickname );
381 
382  return row->GetFullURI( true );
383  }
384  catch( const IO_ERROR& )
385  {
386  return wxEmptyString;
387  }
388 }
389 
390 
392 {
394 };
395 
396 
398 {
399  PCB_IO pcb_io;
400  MODULE* module = GetBoard()->m_Modules;
401 
402  if( module )
403  {
404  pcb_io.Format( module );
405 
406  wxString pretty = FROM_UTF8( pcb_io.GetStringOutput( true ).c_str() );
407 
408  // save the footprint in the RSTRING facility.
410  }
411 }
412 
413 
415 {
416  wxString pretty = Prj().GetRString( PROJECT::PCB_FOOTPRINT );
417 
418  if( !!pretty )
419  {
420  PCB_IO pcb_io;
421  MODULE* module = NULL;
422 
423  try
424  {
425  module = (MODULE*) pcb_io.Parse( pretty );
426  }
427  catch( const PARSE_ERROR& )
428  {
429  // unlikely to be a problem, since we produced the pretty string.
430  wxLogError( "PARSE_ERROR" );
431  }
432  catch( const IO_ERROR& )
433  {
434  // unlikely to be a problem, since we produced the pretty string.
435  wxLogError( "IO_ERROR" );
436  }
437 
438  if( module )
439  {
440  // assumes BOARD is empty.
441  wxASSERT( GetBoard()->m_Modules == NULL );
442 
443  // no idea, its monkey see monkey do. I would encapsulate this into
444  // a member function if its actually necessary.
445  module->SetParent( GetBoard() );
446  module->SetLink( 0 );
447 
448  GetBoard()->Add( module );
449  }
450  }
451 }
452 
453 
455 {
457 }
458 
459 
461 {
462  return GetBoard()->GetDesignSettings();
463 }
464 
465 
467 {
468  GetBoard()->SetDesignSettings( aSettings );
469 }
470 
471 
473 {
474  // get the settings from the parent editor, not our BOARD.
475 
476  // @todo(DICK) change the routing to some default or the board directly, parent may not exist
477  PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
478  wxASSERT( parentFrame );
479 
480  return parentFrame->GetPlotSettings();
481 }
482 
483 
485 {
486  // set the settings into parent editor, not our BOARD.
487 
488  // @todo(DICK) change the routing to some default or the board directly, parent may not exist
489  PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
490  wxASSERT( parentFrame );
491 
492  parentFrame->SetPlotSettings( aSettings );
493 }
494 
495 
496 void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
497 {
500 
501  // Ensure some params are valid
503 
504  // Usually, graphic items are drawn on F_SilkS or F_Fab layer
505  // Force these layers if not default
506  if( ( settings.m_RefDefaultlayer != F_SilkS ) && ( settings.m_RefDefaultlayer != F_Fab ) )
507  settings.m_RefDefaultlayer = F_SilkS;
508 
509  if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) )
510  settings.m_ValueDefaultlayer = F_Fab;
511 }
512 
513 
514 void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
515 {
518 }
519 
520 
521 void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
522 {
523  if( GetScreen()->IsModify() )
524  {
525  int ii = DisplayExitDialog( this, _( "Save the changes to the footprint before closing?" ) );
526 
527  switch( ii )
528  {
529  case wxID_NO:
530  break;
531 
532  case wxID_YES:
533  // code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions,
534  // at case ID_MODEDIT_SAVE_LIBMODULE
535  if( GetBoard()->m_Modules && GetCurrentLib().size() )
536  {
537  if( SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true ) )
538  {
539  // save was correct
540  GetScreen()->ClrModify();
541  break;
542  }
543  }
544  else
545  {
546  DisplayError( this, _( "Library is not set, the footprint could not be saved." ) );
547  }
548  // fall through: cancel the close because of an error
549 
550  case wxID_CANCEL:
551  Event.Veto();
552  return;
553  }
554  }
555 
556  if( IsGalCanvasActive() )
558 
559  //close the editor
560  Destroy();
561 }
562 
563 
564 void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
565 {
566  Close();
567 }
568 
569 
570 void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
571 {
572  aEvent.Enable( GetBoard()->m_Modules != NULL );
573 
574  if( aEvent.GetEventObject() == m_drawToolBar )
575  aEvent.Check( GetToolId() == aEvent.GetId() );
576 }
577 
578 
579 void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
580 {
581  int id = aEvent.GetId();
583 
584  bool state = false;
585 
586  switch( id )
587  {
588  case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
589  state = displ_opts->m_DisplayModTextFill == SKETCH;
590  break;
591 
592  case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
593  state = displ_opts->m_DisplayModEdgeFill == SKETCH;
594  break;
595 
596  case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
597  state = displ_opts->m_ContrastModeDisplay;
598  break;
599 
600  default:
601  wxMessageBox( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" );
602  break;
603  }
604 
605  aEvent.Check( state );
606 }
607 
608 
609 void FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected( wxUpdateUIEvent& aEvent )
610 {
611  bool enable = getLibPath() != wxEmptyString;
612  aEvent.Enable( enable );
613  GetMenuBar()->Enable( ID_MODEDIT_SAVE_LIBRARY_AS, enable );
614 }
615 
616 
617 void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
618 {
619  aEvent.Enable( GetBoard()->m_Modules != NULL );
620 }
621 
622 
624 {
625  aEvent.Enable( getLibPath() != wxEmptyString && GetBoard()->m_Modules != NULL );
626 }
627 
628 
630 {
631  PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
632 
633  aEvent.Enable( frame && frame->GetBoard()->m_Modules != NULL );
634 }
635 
636 
638 {
639  PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
640 
641  MODULE* module_in_edit = GetBoard()->m_Modules;
642  bool canInsert = frame && module_in_edit && !module_in_edit->GetLink();
643 
644  // If the source was deleted, the module can inserted but not updated in the board.
645  if( frame && module_in_edit && module_in_edit->GetLink() ) // this is not a new module
646  {
647  BOARD* mainpcb = frame->GetBoard();
648  MODULE* source_module = mainpcb->m_Modules;
649 
650  // search if the source module was not deleted:
651  for( ; source_module != NULL; source_module = source_module->Next() )
652  {
653  if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
654  break;
655  }
656 
657  canInsert = ( source_module == NULL );
658  }
659 
660  aEvent.Enable( canInsert );
661 }
662 
663 
665 {
666  PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
667 
668  MODULE* module_in_edit = GetBoard()->m_Modules;
669  bool canReplace = frame && module_in_edit && module_in_edit->GetLink();
670 
671  if( canReplace ) // this is not a new module, but verify if the source is still on board
672  {
673  BOARD* mainpcb = frame->GetBoard();
674  MODULE* source_module = mainpcb->m_Modules;
675 
676  // search if the source module was not deleted:
677  for( ; source_module != NULL; source_module = source_module->Next() )
678  {
679  if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
680  break;
681  }
682 
683  canReplace = ( source_module != NULL );
684  }
685 
686  aEvent.Enable( canReplace );
687 }
688 
689 
690 void FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent )
691 {
692  FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs();
693 
694  aEvent.Enable( fptbl && !fptbl->IsEmpty() );
695 }
696 
697 
698 void FOOTPRINT_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
699 {
700  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
701 
702  if( draw3DFrame )
703  {
704  // Raising the window does not show the window on Windows if iconized.
705  // This should work on any platform.
706  if( draw3DFrame->IsIconized() )
707  draw3DFrame->Iconize( false );
708 
709  draw3DFrame->Raise();
710 
711  // Raising the window does not set the focus on Linux. This should work on any platform.
712  if( wxWindow::FindFocus() != draw3DFrame )
713  draw3DFrame->SetFocus();
714 
715  return;
716  }
717 
718  draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
719  draw3DFrame->Raise(); // Needed with some Window Managers
720  draw3DFrame->Show( true );
721 }
722 
723 
724 bool FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey )
725 {
726  bool eventHandled = true;
727 
728  // Filter out the 'fake' mouse motion after a keyboard movement
729  if( !aHotKey && m_movingCursorWithKeyboard )
730  {
732  return false;
733  }
734 
735  // when moving mouse, use the "magnetic" grid, unless the shift+ctrl keys is pressed
736  // for next cursor position
737  // ( shift or ctrl key down are PAN command with mouse wheel)
738  bool snapToGrid = true;
739 
740  if( !aHotKey && wxGetKeyState( WXK_SHIFT ) && wxGetKeyState( WXK_CONTROL ) )
741  snapToGrid = false;
742 
743  wxPoint oldpos = GetCrossHairPosition();
744  wxPoint pos = aPosition;
745  GeneralControlKeyMovement( aHotKey, &pos, snapToGrid );
746 
747  SetCrossHairPosition( pos, snapToGrid );
748  RefreshCrossHair( oldpos, aPosition, aDC );
749 
750  if( aHotKey )
751  {
752  eventHandled = OnHotKey( aDC, aHotKey, aPosition );
753  }
754 
755  UpdateStatusBar();
756 
757  return eventHandled;
758 }
759 
760 
762 {
764 
765  EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
766 
767  if( draw3DFrame )
768  draw3DFrame->ReloadRequest();
769 }
770 
771 
773 {
774  wxString nickname = GetCurrentLib();
775  wxString nickname_display = _( "no active library" );
776  bool writable = true;
777 
778  if( !!nickname )
779  {
780  try
781  {
782  writable = Prj().PcbFootprintLibs()->IsFootprintLibWritable( nickname );
783 
784  nickname_display = nickname;
785  }
786  catch( const IO_ERROR& )
787  {
788  // user may be bewildered as to why after selecting a library it is not showing up
789  // in the title, we could show an error message, but that should have been done at time
790  // of libary selection UI.
791  }
792  }
793 
794  wxString path_display;
795  if( nickname.size() )
796  {
797  FP_LIB_TABLE* libtable = Prj().PcbFootprintLibs();
798  const FP_LIB_TABLE_ROW* row = libtable->FindRow( nickname );
799 
800  if( row )
801  path_display = L" \u2014 " + row->GetFullURI( true );
802  }
803 
804  wxString title;
805  title.Printf( _( "Footprint Editor" ) + L" \u2014 %s%s%s",
806  nickname_display,
807  writable ? wxString( wxEmptyString ) : _( " [Read Only]" ),
808  path_display );
809 
810  SetTitle( title );
811 }
812 
813 
815 {
816  static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
819 }
820 
821 
823 {
824  return IsElementVisible( LAYER_GRID );
825 }
826 
827 
829 {
830  SetElementVisibility( LAYER_GRID, aVisible );
831 }
832 
833 
835 {
836  return GetBoard()->IsElementVisible( aElement );
837 }
838 
839 
841 {
842  GetGalCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
843  GetBoard()->SetElementVisibility( aElement, aNewState );
844  m_Layers->SetRenderState( aElement, aNewState );
845 }
846 
847 
848 void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
849 {
850  int id = event.GetId();
851 
852  switch( id )
853  {
854  // Hotkey IDs
855  case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
857  break;
858 
859  case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
861  break;
862 
863  case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
865  break;
866 
867  case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
868  // Display current hotkey list for the footprint editor.
870  break;
871 
872  case ID_PCB_LIB_WIZARD:
873  case ID_PCB_LIB_TABLE_EDIT:
874  {
875  bool tableChanged = false;
876  int r = 0;
877 
878  if( id == ID_PCB_LIB_TABLE_EDIT )
879  r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
880  else
881  r = InvokeFootprintWizard( this, &GFootprintTable, Prj().PcbFootprintLibs() );
882 
883  if( r & 1 )
884  {
885  try
886  {
888 
889  GFootprintTable.Format( &sf, 0 );
890  tableChanged = true;
891  }
892  catch( const IO_ERROR& ioe )
893  {
894  wxString msg = wxString::Format( _(
895  "Error occurred saving the global footprint library "
896  "table:\n\n%s" ),
897  GetChars( ioe.What().GetData() )
898  );
899  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
900  }
901  }
902 
903  if( r & 2 )
904  {
905  wxString tblName = Prj().FootprintLibTblName();
906 
907  try
908  {
909  Prj().PcbFootprintLibs()->Save( tblName );
910  tableChanged = true;
911  }
912  catch( const IO_ERROR& ioe )
913  {
914  wxString msg = wxString::Format( _(
915  "Error occurred saving project specific footprint library "
916  "table:\n\n%s" ),
917  GetChars( ioe.What() )
918  );
919  wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
920  }
921  }
922 
923  FOOTPRINT_VIEWER_FRAME* viewer;
925 
926  if( tableChanged && viewer != NULL )
927  viewer->ReCreateLibraryList();
928  }
929  break;
930 
931  case wxID_PREFERENCES:
932  InvokeFPEditorPrefsDlg( this );
933  break;
934 
935  case ID_PCB_DISPLAY_OPTIONS_SETUP:
937  break;
938 
939  default:
940  DisplayError( this, "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" );
941  }
942 }
943 
944 
945 void FOOTPRINT_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
946 {
947  Pgm().ConfigurePaths( this );
948 }
949 
950 
952 {
953  PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
954 
955  // Create the manager and dispatcher & route draw panel events to the dispatcher
957  m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
958  drawPanel->GetViewControls(), this );
959  m_actions = new PCB_ACTIONS();
961 
962  drawPanel->SetEventDispatcher( m_toolDispatcher );
963 
975 
976  m_toolManager->GetTool<PAD_TOOL>()->SetEditModules( true );
977  m_toolManager->GetTool<SELECTION_TOOL>()->SetEditModules( true );
978  m_toolManager->GetTool<EDIT_TOOL>()->SetEditModules( true );
979  m_toolManager->GetTool<DRAWING_TOOL>()->SetEditModules( true );
980 
982 
983  m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
984 }
985 
986 
988 {
990 
991  if( aEnable )
992  updateView();
993 }
void OnUpdateVerticalToolbar(wxUpdateUIEvent &aEvent)
EDA_PANEINFO & HorizontalToolbarPane()
Function HorizontalToolbarPane Change *this to a horizontal toolbar for KiCad.
Definition: wxstruct.h:474
TOOL_MANAGER * m_toolManager
Definition: draw_frame.h:94
int m_SolderMaskMargin
Solder mask margin.
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Definition: wxstruct.h:55
bool IsFootprintLibWritable(const wxString &aNickname)
Function IsFootprintLibWritable.
Definition of class FOOTPRINT_EDIT_FRAME.
bool IsElementVisible(GAL_LAYER_ID LAYER_aPCB) const
Function IsElementVisible tests whether a given element category is visible.
void OnConfigurePaths(wxCommandEvent &aEvent)
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
BOARD_ITEM * Parse(const wxString &aClipboardSourceInput)
Class PCB_IO is a PLUGIN derivation for saving and loading Pcbnew s-expression formatted files...
NETCLASSPTR GetDefault() const
Function GetDefault.
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
BOARD_DESIGN_SETTINGS & GetDesignSettings() const override
Function GetDesignSettings returns the BOARD_DESIGN_SETTINGS for the BOARD owned by this frame...
Class FP_LIB_TABLE_ROW.
Definition: fp_lib_table.h:42
Model changes (required full reload)
Definition: tool_base.h:83
GAL_TYPE GetBackend() const
Function GetBackend Returns the type of backend currently used by GAL canvas.
This file is part of the common library.
TOOL_DISPATCHER * m_toolDispatcher
Definition: draw_frame.h:95
Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tie...
Class SELECTION_TOOL.
Class BOARD to handle a board.
void OnUpdateLibAndModuleSelected(wxUpdateUIEvent &aEvent)
void ExportHotkeyConfigToFile(EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it...
Component library viewer main window.
Definition: modview_frame.h:44
MODULE * Next() const
Definition: class_module.h:100
PCB_LAYER_WIDGET * m_Layers
void OnCloseWindow(wxCloseEvent &Event) override
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences ID_POPUP_PCB_END_RANGE
Class PAD_TOOL.
Definition: pad_tool.h:37
static TOOL_ACTION zoomFitScreen
Definition: actions.h:56
void OnUpdateReplaceModuleInBoard(wxUpdateUIEvent &aEvent)
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
virtual void SetGridVisibility(bool aVisible) override
Function SetGridVisibility() , virtual It may be overloaded by derived classes if you want to store/r...
bool m_DisplayModEdgeFill
Definition: pcbstruct.h:69
BOARD * GetBoard() const
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
int m_ValueDefaultlayer
Default value text layer on fp creation.
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard EVT_UPDATE_UI_RANGE(ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar) EVT_UPDATE_UI(ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
#define FOOTPRINT_EDIT_FRAME_NAME
void OnUpdateLoadModuleFromBoard(wxUpdateUIEvent &aEvent)
int InvokeFootprintWizard(wxTopLevelWindow *aParent, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
Function InvokeFootprintWizard Runs the footprint library wizard for easy library addition...
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
EDA_PANEINFO & LayersToolbarPane()
Function LayersToolbarPane Change *this to a layers toolbar for KiCad.
Definition: wxstruct.h:526
void OnUpdateLibSelected(wxUpdateUIEvent &aEvent)
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
Specialization of the wxAuiPaneInfo class for KiCad panels.
Definition: wxstruct.h:465
const wxString GetFullURI(bool aSubstituted=false) const
Function GetFullURI.
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Pcbnew hotkeys.
void UseGalCanvas(bool aEnable) override
>
bool InvokeFPEditorPrefsDlg(FOOTPRINT_EDIT_FRAME *aCaller)
Function InvokeSVGPrint shows the SVG print dialog.
Class PCBNEW_CONTROL.
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: pcbnew.cpp:321
const wxString GetCurrentLib() const
Return the current library nickname.
Generic tool for picking a point.
Definition: picker_tool.h:35
virtual void UseGalCanvas(bool aEnable) override
>
VTBL_ENTRY void ConfigurePaths(wxWindow *aParent=NULL)
Function ConfigurePaths.
Definition: pgm_base.cpp:897
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::ProcessPreferences 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_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected) EVT_UPDATE_UI(ID_MODEDIT_LOAD_MODULE_FROM_BOARD
bool IsElementVisible(GAL_LAYER_ID aElement) const
Function IsElementVisible tests whether a given element category is visible.
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)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
EDA_PANEINFO & VerticalToolbarPane()
Function VerticalToolbarPane Change *this to a vertical toolbar for KiCad.
Definition: wxstruct.h:492
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
void OnUpdateOptionsToolbar(wxUpdateUIEvent &aEvent)
FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_TOOL_RANGE(ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnVerticalToolbar) EVT_MENU(ID_PREFERENCES_HOTKEY_EXPORT_CONFIG
VTBL_ENTRY KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, KIWAY_PLAYER *aParent=NULL)
Function Player returns the KIWAY_PLAYER* given a FRAME_T.
Definition: kiway.cpp:302
int InvokePcbLibTableEditor(wxTopLevelWindow *aParent, FP_LIB_TABLE *aGlobal, FP_LIB_TABLE *aProject)
Function InvokePcbLibTableEditor shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib ...
virtual bool IsGridVisible() const override
Function IsGridVisible() , virtual.
void RefreshCrossHair(const wxPoint &aOldPos, const wxPoint &aEvtPos, wxDC *aDC)
virtual void OnModify() override
Virtual Function OnModify() Must be called after a footprint change in order to set the "modify" flag...
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 LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
std::string GetStringOutput(bool doClear)
Class DRAWING_TOOL.
Definition: drawing_tool.h:49
void SetParent(EDA_ITEM *aParent)
Definition: base_struct.h:213
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool Enable(bool enable) override
Definition: basicframe.cpp:192
time_t GetLink() const
Definition: class_module.h:520
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_INSERT) override
>
void SetElementVisibility(GAL_LAYER_ID LAYER_aPCB, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::ProcessPreferences EVT_MENU(ID_PREFERENCES_HOTKEY_IMPORT_CONFIG, FOOTPRINT_EDIT_FRAME::ProcessPreferences) EVT_MENU(ID_PREFERENCES_HOTKEY_SHOW_EDITOR
bool m_ContrastModeDisplay
Definition: pcbstruct.h:85
void Show3D_Frame(wxCommandEvent &event) override
Function Show3D_Frame displays 3D view of the footprint (module) being edited.
The common library.
Helper dialog and control classes.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:530
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:257
uint32_t EDA_KEY
Definition: common.h:52
virtual void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings)
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:795
static const wxChar A4[]
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aDesignSettings)
Function SetDesignSettings.
Definition: class_board.h:540
void SetLayerVisible(int aLayer, bool aVisible=true)
Function SetLayerVisible() Controls the visibility of a particular layer.
Definition: view.h:387
void Save(const wxString &aFileName) const
Function Save.
EVT_TOOL(ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard) EVT_TOOL(ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT
void ProcessPreferences(wxCommandEvent &event)
ID_POPUP_GRID_USER
Definition: draw_frame.cpp:105
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
VTBL_ENTRY const wxString FootprintLibTblName() const
Function FootprintLibTblName returns the path and filename of this project's fp-lib-table, i.e.
Definition: project.cpp:114
static bool Invoke(FOOTPRINT_EDIT_FRAME &aCaller)
FOOTPRINT_EDIT_FRAME(KIWAY *aKiway, wxWindow *aParent)
protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
Class PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board...
void Format(BOARD_ITEM *aItem, int aNestLevel=0) const
Function Format outputs aItem to aFormatter in s-expression format.
Class EDIT_TOOL.
Definition: edit_tool.h:43
wxAuiToolBar * m_drawToolBar
The tool bar that contains the buttons for quick access to the application draw tools.
Definition: draw_frame.h:122
const PCB_PLOT_PARAMS & GetPlotSettings() const override
Function GetPlotSettings returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
Class COMMON_TOOLS.
Definition: common_tools.h:38
Class TOOL_DISPATCHER.
time_t GetTimeStamp() const
Definition: base_struct.h:204
virtual void Format(OUTPUTFORMATTER *aOutput, int aIndentLevel) const override
Function Format.
Class DISPLAY_OPTIONS handles display options like enable/disable some optional drawings.
Definition: pcbstruct.h:62
VTBL_ENTRY void SetRString(RSTRING_T aStringId, const wxString &aString)
Function SetRString stores a "retained string", which is any session and project specific string iden...
Definition: project.cpp:162
bool OnHotKey(wxDC *aDC, int aHotKey, const wxPoint &aPosition, EDA_ITEM *aItem=NULL) override
Function OnHotKey handle hot key events.
BOARD * GetBoard()
VTBL_ENTRY FP_LIB_TABLE * PcbFootprintLibs(KIWAY &aKiway)
Return the table of footprint libraries.
const FP_LIB_TABLE_ROW * FindRow(const wxString &aNickName)
Function FindRow.
void InstallHotkeyFrame(EDA_BASE_FRAME *aParent, EDA_HOTKEY_CONFIG *aHotkeys)
Function InstallHotkeyFrame Create a hotkey editor dialog window with the provided hotkey configurati...
void SetDesignSettings(const BOARD_DESIGN_SETTINGS &aSettings) override
void updateTitle()
Function UpdateTitle updates window title according to getLibNickName().
virtual void OnModify()
Function OnModify Virtual Must be called after a change in order to set the "modify" flag of the curr...
void SaveSettings(wxConfigBase *aCfg) override
Function SaveSettings saves common frame parameters to a configuration data file. ...
VTBL_ENTRY const wxString & GetRString(RSTRING_T aStringId)
Function GetRString returns a "retained string", which is any session and project specific string ide...
Definition: project.cpp:177
virtual void UpdateStatusBar() override
Function UpdateStatusBar updates the status bar information.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
EDA_PANEINFO & MessageToolbarPane()
Function MessageToolbarPane Change *this to a message pane for KiCad.
Definition: wxstruct.h:511
int DisplayExitDialog(wxWindow *parent, const wxString &aMessage)
Function DisplayExitDialog displays a dialog with 3 buttons: Save and Exit Cancel Exit without save...
Definition: confirm.cpp:58
Class PCB_ACTIONS.
Definition: pcb_actions.h:42
void OnUpdateSelectCurrentLib(wxUpdateUIEvent &aEvent)
struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[]
Struct PARSE_ERROR contains a filename or source description, a problem input line, a line number, a byte offset, and an error message which contains the the caller's report and his call site information: CPP source file, function, and line number.
Definition: ki_exception.h:94
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
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
see class PGM_BASE
void SetPlotSettings(const PCB_PLOT_PARAMS &aSettings) override
Declaration of the eda_3d_viewer class.
void GeneralControlKeyMovement(int aHotKey, wxPoint *aPos, bool aSnapToGrid)
Function GeneralControlKeyMovement Handle the common part of GeneralControl dedicated to global curso...
Common, abstract interface for edit frames.
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:166
Class MODULE_EDITOR_TOOLS.
void SetEventDispatcher(TOOL_DISPATCHER *aEventDispatcher)
Function SetEventDispatcher() Sets a dispatcher that processes events and forwards them to tools...
PARAM_CFG_ARRAY & GetConfigurationSettings()
Function GetConfigurationSettings returns the footpr�int editor settings list.
DLIST< MODULE > m_Modules
Definition: class_board.h:243
void LoadSettings(wxConfigBase *aCfg) override
Function LoadSettings loads common frame parameters from a configuration file.
bool GeneralControl(wxDC *aDC, const wxPoint &aPosition, EDA_KEY aHotKey=0) override
Function GeneralControl performs application specific control using aDC at aPosition in logical units...
void OnUpdateInsertModuleInBoard(wxUpdateUIEvent &aEvent)
int GetToolId() const
Definition: draw_frame.h:406
const wxString getLibPath()
The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
Definition: wxstruct.h:112
BOARD_ITEM_CONTAINER * GetModel() const override
>
void ReCreateLibraryList()
Function ReCreateLibraryList.
void updateView()
Reloads displayed items and sets view.
void SetLink(time_t aLink)
Definition: class_module.h:521
EVT_MENU_RANGE(ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, PCB_BASE_FRAME::ProcessItemSelection) EVT_TOOL(ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART
Class POINT_EDITOR.
Definition: point_editor.h:41
int m_RefDefaultlayer
Default ref text layer on fp creation.
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Class FILE_OUTPUTFORMATTER may be used for text file output.
Definition: richio.h:492
bool Destroy() override
Our version of Destroy() which is virtual from wxWidgets.
KIGFX::VIEW_CONTROLS * GetViewControls() const
Function GetViewControls() Returns a pointer to the VIEW_CONTROLS instance used in the panel...
LIB_EDIT_FRAME::Process_Config ID_POPUP_GENERAL_END_RANGE
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:803
Class EDA_3D_VIEWER Create and handle a window for the 3d viewer connected to a Kiway and a pcbboard...
Definition: eda_3d_viewer.h:50
void CloseModuleEditor(wxCommandEvent &Event)
Module description (excepted pads)
void InitTools()
Function InitTools() Initializes all registered tools.
Abstract interface for BOARD_ITEMs capable of storing other items inside.
bool SaveFootprintInLibrary(const wxString &aLibName, MODULE *aModule, bool aOverwrite, bool aDisplayDialog)
Function SaveFootprintInLibrary Save in an existing library a given footprint.
Definition: librairi.cpp:629
void SetCrossHairPosition(const wxPoint &aPosition, bool aSnapToGrid=true)
Function SetCrossHairPosition sets the screen cross hair position to aPosition in logical (drawing) u...
void OnUpdateModuleSelected(wxUpdateUIEvent &aEvent)
Message panel definition file.
void SetRenderState(int aId, bool isSet)
Function SetRenderState sets the state of the checkbox associated with aId within the Render tab grou...
void ImportHotkeyConfigFromFile(EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.
ACTIONS * m_actions
Definition: draw_frame.h:96
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
EDA_3D_VIEWER * Get3DViewerFrame()
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition 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:47
bool m_movingCursorWithKeyboard
One-shot to avoid a recursive mouse event during hotkey movement.
Definition: draw_frame.h:138
bool m_DisplayModTextFill
Definition: pcbstruct.h:70
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 wxString GetGlobalTableFileName()
Function GetGlobalTableFileName.
static const wxChar * GetFootprintEditorFrameName()
Function GetFootprintEditorFrameName (static)
bool IsEmpty(bool aIncludeFallback=true)
Function IsEmpty.
void RegisterTool(TOOL_BASE *aTool)
Function RegisterTool() Adds a tool to the manager set and sets it up.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
KIWAY Kiway