KiCad PCB EDA Suite
pcb_edit_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <collectors.h>
#include <build_version.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.h>
#include <layer_widget.h>
#include <pcb_layer_widget.h>
#include <hotkeys.h>
#include <config_params.h>
#include <footprint_edit_frame.h>
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <dialog_exchange_footprints.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialog_board_setup.h>
#include <dialog_configure_paths.h>
#include <dialog_update_pcb.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <invoke_pcb_dialog.h>
#include <class_track.h>
#include <class_board.h>
#include <class_module.h>
#include <worksheet_viewitem.h>
#include <connectivity/connectivity_data.h>
#include <ratsnest_viewitem.h>
#include <wildcards_and_files_ext.h>
#include <kicad_string.h>
#include <pcb_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <functional>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/selection_tool.h>
#include <tools/picker_tool.h>
#include <tools/point_editor.h>
#include <tools/edit_tool.h>
#include <tools/drawing_tool.h>
#include <tools/pcbnew_control.h>
#include <tools/pcb_editor_control.h>
#include <tools/placement_tool.h>
#include <tools/pad_tool.h>
#include <tools/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 <eda_dockart.h>
#include <board_netlist_updater.h>
#include <netlist_reader.h>
#include <pcb_netlist.h>

Go to the source code of this file.

Functions

 EVT_TOOL (ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, PCB_EDIT_FRAME::OnSelectOptionToolbar) EVT_TOOL_RANGE(ID_TB_OPTIONS_SHOW_ZONES
 
PCB_EDIT_FRAME::OnSelectOptionToolbar EVT_TOOL (ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, PCB_EDIT_FRAME::OnSelectOptionToolbar) EVT_TOOL_RANGE(ID_PCB_HIGHLIGHT_BUTT
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool EVT_TOOL_RANGE (ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, PCB_EDIT_FRAME::ProcessMuWaveFunctions) EVT_MENU_RANGE(ID_POPUP_PCB_START_RANGE
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_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_MENU_RANGE(ID_POPUP_GENERAL_START_RANGE
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI (ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode) EVT_UPDATE_UI_RANGE(ID_POPUP_PCB_SELECT_WIDTH1
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::OnUpdateSelectTrackWidth EVT_UPDATE_UI_RANGE (ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, PCB_EDIT_FRAME::OnUpdateSelectViaSize) EVT_UPDATE_UI_RANGE(ID_PCB_HIGHLIGHT_BUTT
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::OnUpdateSelectTrackWidth PCB_EDIT_FRAME::OnUpdateVerticalToolbar EVT_UPDATE_UI_RANGE (ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, PCB_EDIT_FRAME::OnUpdateMuWaveToolbar) PCB_EDIT_FRAME
 
bool ExportBoardToHyperlynx (BOARD *aBoard, const wxFileName &aPath)
 

Variables

 ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY
 
PCB_EDIT_FRAME::OnSelectOptionToolbar ID_PCB_MEASUREMENT_TOOL
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool ID_POPUP_PCB_END_RANGE
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions ID_POPUP_GENERAL_END_RANGE
 
PCB_EDIT_FRAME::OnSelectOptionToolbar PCB_EDIT_FRAME::OnSelectTool PCB_EDIT_FRAME::Process_Special_Functions PCB_EDIT_FRAME::Process_Special_Functions ID_POPUP_PCB_SELECT_WIDTH8
 
static const wxString PlotLineWidthEntry = "PlotLineWidth_mm"
 
static const wxString ShowMicrowaveEntry = "ShowMicrowaveTools"
 
static const wxString ShowLayerManagerEntry = "ShowLayerManagerTools"
 
static const wxString ShowPageLimitsEntry = "ShowPageLimits"
 

Function Documentation

◆ EVT_MENU_RANGE()

◆ EVT_TOOL() [1/2]

◆ EVT_TOOL() [2/2]

◆ EVT_TOOL_RANGE()

◆ EVT_UPDATE_UI()

◆ EVT_UPDATE_UI_RANGE() [1/2]

◆ EVT_UPDATE_UI_RANGE() [2/2]

Definition at line 294 of file pcb_edit_frame.cpp.

301  :
302  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
304 {
305  m_showBorderAndTitleBlock = true; // true to display sheet references
306  m_showAxis = false; // true to display X and Y axis
307  m_showOriginAxis = true;
308  m_showGridAxis = true;
309  m_SelTrackWidthBox = NULL;
310  m_SelViaSizeBox = NULL;
311  m_SelLayerBox = NULL;
312  m_show_microwave_tools = false;
313  m_show_layer_manager_tools = true;
314  m_hotkeysDescrList = g_Board_Editor_Hotkeys_Descr;
315  m_hasAutoSave = true;
316  m_microWaveToolBar = NULL;
317  m_Layers = nullptr;
318  m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
319 
320  // We don't know what state board was in when it was lasat saved, so we have to
321  // assume dirty
322  m_ZoneFillsDirty = true;
323 
324  m_rotationAngle = 900;
325  m_AboutTitle = "Pcbnew";
326 
327  // Create GAL canvas
328  auto galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
329  GetGalDisplayOptions(),
331 
332  SetGalCanvas( galCanvas );
333 
334  SetBoard( new BOARD() );
335 
336  // Create the PCB_LAYER_WIDGET *after* SetBoard():
337  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas() );
338 
339  m_drc = new DRC( this ); // these 2 objects point to each other
340 
341  wxIcon icon;
342  icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
343  SetIcon( icon );
344 
345  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
346  // initialize parameters in m_LayersManager
347  LoadSettings( config() );
348 
349  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
350  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
351 
352  // PCB drawings start in the upper left corner.
353  GetScreen()->m_Center = false;
354 
355  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
356 
357  GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
358  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
359 
360  if( m_canvas )
361  m_canvas->SetEnableBlockCommands( true );
362 
363  setupTools();
364  ReCreateMenuBar();
365  ReCreateHToolbar();
366  ReCreateAuxiliaryToolbar();
367  ReCreateVToolbar();
368  ReCreateOptToolbar();
369  ReCreateMicrowaveVToolbar();
370 
371  m_auimgr.SetManagedWindow( this );
372  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
373 
374  // Horizontal items; layers 4 - 6
375  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
376  m_auimgr.AddPane( m_auxiliaryToolBar, EDA_PANE().HToolbar().Name( "AuxToolbar" ).Top().Layer(4) );
377  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
378 
379  // Vertical items; layers 1 - 3
380  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
381 
382  m_auimgr.AddPane( m_microWaveToolBar, EDA_PANE().VToolbar().Name( "MicrowaveToolbar" ).Right().Layer(1) );
383  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(2) );
384  m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
385  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
386  .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
387 
388  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
389  m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
390 
391  m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
392  m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
393 
394  ReFillLayerWidget(); // this is near end because contents establish size
395  m_Layers->ReFillRender(); // Update colors in Render after the config is read
396  syncLayerWidgetLayer();
397 
398  m_auimgr.Update();
399 
400  Zoom_Automatique( false );
401 
402  m_canvasType = LoadCanvasTypeSetting();
403 
404  // Nudge user to switch to OpenGL if they are on legacy or Cairo
405  if( m_firstRunDialogSetting < 1 )
406  {
407  if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
408  {
409  wxString msg = _( "KiCad can use your graphics card to give you a smoother "
410  "and faster experience. This option is turned off by "
411  "default since it is not compatible with all computers.\n\n"
412  "Would you like to try enabling graphics acceleration?\n\n"
413  "If you'd like to choose later, select Modern Toolset "
414  "(Accelerated) in the Preferences menu." );
415 
416  wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
417  wxYES_NO );
418 
419  dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
420 
421  if( dlg.ShowModal() == wxID_YES )
422  {
423  // Save Cairo as default in case OpenGL crashes
424  saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
425 
426  // Switch to OpenGL, which will save the new setting if successful
427  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
428  GetEventHandler()->ProcessEvent( evt );
429 
430  // Switch back to Cairo if OpenGL is not supported
431  if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
432  {
433  wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
434  GetEventHandler()->ProcessEvent( cairoEvt );
435  }
436  }
437  else
438  {
439  // If they were on legacy, or they've been coerced into GAL
440  // due to unavailable legacy (GTK3), switch to Cairo
441  wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
442  GetEventHandler()->ProcessEvent( evt );
443  }
444  }
445 
446  m_firstRunDialogSetting = 1;
447  SaveSettings( config() );
448  }
449 
450  if( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
451  {
452  if( GetGalCanvas()->SwitchBackend( m_canvasType ) )
453  UseGalCanvas( true );
454  }
455 
456  enableGALSpecificMenus();
457 
458  // disable Export STEP item if kicad2step does not exist
459  wxString strK2S = Pgm().GetExecutablePath();
460 
461 #ifdef __WXMAC__
462  if (strK2S.find( "pcbnew.app" ) != wxNOT_FOUND )
463  {
464  // On macOS, we have standalone applications inside the main bundle, so we handle that here:
465  strK2S += "../../";
466  }
467 
468  strK2S += "Contents/MacOS/";
469 #endif
470 
471  wxFileName appK2S( strK2S, "kicad2step" );
472 
473  #ifdef _WIN32
474  appK2S.SetExt( "exe" );
475  #endif
476 
477 // if( !appK2S.FileExists() )
478  // GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
479 }
Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tie...
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:66
#define PCB_EDIT_FRAME_NAME
Definition: draw_frame.h:57
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
GAL not used (the legacy wxDC engine is used)
struct EDA_HOTKEY_CONFIG g_Board_Editor_Hotkeys_Descr[]
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Specialization of the wxAuiPaneInfo class for KiCad panels.
Common, abstract interface for edit frames.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170
VTBL_ENTRY const wxString & GetExecutablePath() const
Definition: pgm_base.h:218
Design Rule Checker object that performs all the DRC tests.
Definition: drc.h:188

References PCAD2KICAD::Center, g_Board_Editor_Hotkeys_Descr, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL, PGM_BASE::GetExecutablePath(), ID_MENU_CANVAS_CAIRO, ID_MENU_CANVAS_OPENGL, ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, KiBitmap(), PCAD2KICAD::Left, Pgm(), PCAD2KICAD::Right, and UNSCALED_UNITS.

◆ ExportBoardToHyperlynx()

bool ExportBoardToHyperlynx ( BOARD aBoard,
const wxFileName &  aPath 
)

Definition at line 591 of file export_hyperlynx.cpp.

592 {
593  HYPERLYNX_EXPORTER exporter;
594  exporter.SetBoard( aBoard );
595  exporter.SetOutputFilename( aPath );
596  return exporter.Run();
597 }
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_PCB_MEASUREMENT_TOOL

◆ ID_POPUP_GENERAL_END_RANGE

◆ ID_POPUP_PCB_END_RANGE

◆ ID_POPUP_PCB_SELECT_WIDTH8

◆ ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY