KiCad PCB EDA Suite
pcb_edit_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <fp_lib_table.h>
#include <bitmaps.h>
#include <trace_helpers.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <drc/drc.h>
#include <pcbnew_settings.h>
#include <layer_widget.h>
#include <pcb_layer_widget.h>
#include <footprint_edit_frame.h>
#include <dialog_plot.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <convert_to_biu.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
#include <class_module.h>
#include <ws_proxy_view_item.h>
#include <connectivity/connectivity_data.h>
#include <wildcards_and_files_ext.h>
#include <kicad_string.h>
#include <pcb_draw_panel_gal.h>
#include <functional>
#include <project/project_file.h>
#include <settings/settings_manager.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/selection_tool.h>
#include <tools/pcbnew_picker_tool.h>
#include <tools/point_editor.h>
#include <tools/edit_tool.h>
#include <tools/global_edit_tool.h>
#include <tools/drawing_tool.h>
#include <tools/pcbnew_control.h>
#include <tools/pcb_editor_control.h>
#include <tools/pcb_inspection_tool.h>
#include <tools/pcb_viewer_tools.h>
#include <tools/placement_tool.h>
#include <tools/pad_tool.h>
#include <microwave/microwave_tool.h>
#include <tools/position_relative_tool.h>
#include <tools/zone_filler_tool.h>
#include <tools/pcb_actions.h>
#include <router/router_tool.h>
#include <router/length_tuner_tool.h>
#include <autorouter/autoplacer_tool.h>
#include <gestfich.h>
#include <executable_names.h>
#include <netlist_reader/board_netlist_updater.h>
#include <netlist_reader/netlist_reader.h>
#include <netlist_reader/pcb_netlist.h>
#include <wx/wupdlock.h>
#include <dialog_drc.h>
#include <ratsnest/ratsnest_viewitem.h>
#include <widgets/panel_selection_filter.h>
#include <widgets/infobar.h>

Go to the source code of this file.

Functions

 EVT_MENU_RANGE (ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
 
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE (ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) PCB_EDIT_FRAME
 
bool ExportBoardToHyperlynx (BOARD *aBoard, const wxFileName &aPath)
 

Variables

 ID_POPUP_PCB_SELECT_WIDTH8
 

Function Documentation

◆ EVT_MENU_RANGE()

◆ EVT_UPDATE_UI_RANGE()

Definition at line 162 of file pcb_edit_frame.cpp.

169  :
170  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_EDITOR, wxT( "Pcbnew" ), wxDefaultPosition,
172 {
173  m_showBorderAndTitleBlock = true; // true to display sheet references
174  m_SelTrackWidthBox = NULL;
175  m_SelViaSizeBox = NULL;
176  m_SelLayerBox = NULL;
177  m_show_microwave_tools = false;
178  m_show_layer_manager_tools = true;
179  m_hasAutoSave = true;
180  m_microWaveToolBar = NULL;
181  m_Layers = nullptr;
182 
183  // We don't know what state board was in when it was lasat saved, so we have to
184  // assume dirty
185  m_ZoneFillsDirty = true;
186 
187  m_rotationAngle = 900;
188  m_AboutTitle = "Pcbnew";
189 
190  // Create GAL canvas
191  auto canvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
192  GetGalDisplayOptions(),
194 
195  SetCanvas( canvas );
196 
197  SetBoard( new BOARD() );
198 
199  // Create the PCB_LAYER_WIDGET *after* SetBoard():
200  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas() );
201 
202  wxIcon icon;
203  icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
204  SetIcon( icon );
205 
206  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
207  // initialize parameters in m_LayersManager
208  LoadSettings( config() );
209 
210  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
211  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
212 
213  // PCB drawings start in the upper left corner.
214  GetScreen()->m_Center = false;
215 
216  setupTools();
217  ReCreateMenuBar();
218  ReCreateHToolbar();
219  ReCreateAuxiliaryToolbar();
220  ReCreateVToolbar();
221  ReCreateOptToolbar();
222  ReCreateMicrowaveVToolbar();
223 
224  m_selectionFilterPanel = new PANEL_SELECTION_FILTER( this );
225 
226  // Create the infobar
227  m_infoBar = new WX_INFOBAR( this, &m_auimgr );
228 
229  m_auimgr.SetManagedWindow( this );
230  m_auimgr.SetFlags( wxAUI_MGR_LIVE_RESIZE );
231 
232  // Horizontal items; layers 4 - 6
233  m_auimgr.AddPane( m_mainToolBar,
234  EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
235  m_auimgr.AddPane( m_auxiliaryToolBar,
236  EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(5) );
237  m_auimgr.AddPane( m_messagePanel,
238  EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
239  m_auimgr.AddPane( m_infoBar,
240  EDA_PANE().InfoBar().Name( "InfoBar" ).Top().Layer(1) );
241 
242  // Vertical items; layers 1 - 3
243  m_auimgr.AddPane( m_optionsToolBar,
244  EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
245 
246  m_auimgr.AddPane( m_microWaveToolBar,
247  EDA_PANE().VToolbar().Name( "MicrowaveToolbar" ).Right().Layer(2) );
248  m_auimgr.AddPane( m_drawToolBar,
249  EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(3) );
250  m_auimgr.AddPane( m_Layers,
251  EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(4)
252  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
253  .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ).Maximize() );
254  m_auimgr.AddPane( m_selectionFilterPanel,
255  EDA_PANE().Palette().Name( "SelectionFilter" ).Right().Layer( 4 )
256  .Caption( _( "Selection Filter" ) ).PaneBorder( false ).Position( 2 )
257  .MinSize( 160, -1 ).BestSize( m_selectionFilterPanel->GetBestSize() ) );
258 
259  m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
260 
261  m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
262  m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
263  m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
264 
265  m_Layers->ReFillRender(); // Update colors in Render after the config is read
266  ReFillLayerWidget(); // this is near end and after ReFillRender()
267  // because contents establish size
268  syncLayerWidgetLayer();
269 
270  // The selection filter doesn't need to grow in the vertical direction when docked
271  m_auimgr.GetPane( "SelectionFilter" ).dock_proportion = 0;
272 
273  // Call Update() to fix all pane default sizes, especially the "InfoBar" pane before
274  // hidding it.
275  m_auimgr.Update();
276 
277  // We don't want the infobar displayed right away
278  m_auimgr.GetPane( "InfoBar" ).Hide();
279  m_auimgr.Update();
280 
281  GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
282 
283  m_canvasType = LoadCanvasTypeSetting();
284 
285  // Nudge user to switch to OpenGL if they are on Cairo
286  if( m_firstRunDialogSetting < 1 )
287  {
288  if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
289  {
290  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
291  "and faster experience. This option is turned off by "
292  "default since it is not compatible with all computers.\n\n"
293  "Would you like to try enabling graphics acceleration?\n\n"
294  "If you'd like to choose later, select Accelerated Graphics "
295  "in the Preferences menu." );
296 
297  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ), wxYES_NO );
298 
299  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
300 
301  if( dlg.ShowModal() == wxID_YES )
302  {
303  // Save Cairo as default in case OpenGL crashes
304  saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
305 
306  // Switch to OpenGL, which will save the new setting if successful
307  GetToolManager()->RunAction( ACTIONS::acceleratedGraphics, true );
308 
309  // Switch back to Cairo if OpenGL is not supported
310  if( GetCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
311  GetToolManager()->RunAction( ACTIONS::standardGraphics, true );
312  }
313  else
314  {
315  // If they were on legacy, switch to Cairo
316  GetToolManager()->RunAction( ACTIONS::standardGraphics, true );
317  }
318  }
319 
320  m_firstRunDialogSetting = 1;
321  SaveSettings( config() );
322  }
323 
324  InitExitKey();
325 
326  GetCanvas()->SwitchBackend( m_canvasType );
327  ActivateGalCanvas();
328 
329  // Default shutdown reason until a file is loaded
330  SetShutdownBlockReason( _( "New PCB file is unsaved" ) );
331 
332  // disable Export STEP item if kicad2step does not exist
333  wxString strK2S = Pgm().GetExecutablePath();
334 
335 #ifdef __WXMAC__
336  if (strK2S.find( "pcbnew.app" ) != wxNOT_FOUND )
337  {
338  // On macOS, we have standalone applications inside the main bundle, so we handle that here:
339  strK2S += "../../";
340  }
341 
342  strK2S += "Contents/MacOS/";
343 #endif
344 
345  wxFileName appK2S( strK2S, "kicad2step" );
346 
347  #ifdef _WIN32
348  appK2S.SetExt( "exe" );
349  #endif
350 
351  // Ensure the window is on top
352  Raise();
353 
354 // if( !appK2S.FileExists() )
355  // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
356 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tied into...
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
static TOOL_ACTION standardGraphics
Definition: actions.h:159
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:80
#define NULL
GAL not used (the legacy wxDC engine is used)
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Specialization of the wxAuiPaneInfo class for KiCad panels.
A modified version of the wxInfoBar class that allows us to:
Definition: infobar.h:68
Common, abstract interface for edit frames.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION acceleratedGraphics
Definition: actions.h:158
#define PCB_EDIT_FRAME_NAME
const BITMAP_OPAQUE icon_pcbnew_xpm[1]
Definition: icon_pcbnew.cpp:49

References _, ACTIONS::acceleratedGraphics, PCAD2KICAD::Center, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, icon_pcbnew_xpm, KiBitmap(), PCAD2KICAD::Left, NULL, Pgm(), PCAD2KICAD::Right, ACTIONS::standardGraphics, and ACTIONS::zoomFitScreen.

◆ ExportBoardToHyperlynx()

bool ExportBoardToHyperlynx ( BOARD aBoard,
const wxFileName &  aPath 
)

Definition at line 602 of file export_hyperlynx.cpp.

603 {
604  HYPERLYNX_EXPORTER exporter;
605  exporter.SetBoard( aBoard );
606  exporter.SetOutputFilename( aPath );
607  return exporter.Run();
608 }
void SetOutputFilename(const wxFileName &aPath)
void SetBoard(BOARD *aBoard)
virtual bool Run() override

References HYPERLYNX_EXPORTER::Run(), BOARD_EXPORTER_BASE::SetBoard(), and BOARD_EXPORTER_BASE::SetOutputFilename().

Referenced by PCB_EDIT_FRAME::OnExportHyperlynx().

Variable Documentation

◆ ID_POPUP_PCB_SELECT_WIDTH8

ID_POPUP_PCB_SELECT_WIDTH8

Definition at line 160 of file pcb_edit_frame.cpp.

Referenced by PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event().