89 #include <wx/wupdlock.h> 99 #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON) 101 #if defined(KICAD_SCRIPTING_ACTION_MENU) 107 using namespace std::placeholders;
154 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU) 179 m_maximizeByDefault =
true;
180 m_showBorderAndTitleBlock =
true;
181 m_SelTrackWidthBox =
NULL;
182 m_SelViaSizeBox =
NULL;
183 m_SelLayerBox =
NULL;
184 m_show_layer_manager_tools =
true;
185 m_hasAutoSave =
true;
189 m_ZoneFillsDirty =
true;
191 m_rotationAngle = 900;
192 m_aboutTitle =
_(
"KiCad PCB Editor" );
196 GetGalDisplayOptions(),
201 SetBoard(
new BOARD() );
204 wxIconBundle icon_bundle;
207 icon_bundle.AddIcon( icon );
209 icon_bundle.AddIcon( icon );
211 icon_bundle.AddIcon( icon );
213 SetIcons( icon_bundle );
217 LoadSettings( config() );
219 SetScreen(
new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
222 GetScreen()->m_Center =
false;
229 ReCreateAuxiliaryToolbar();
231 ReCreateOptToolbar();
237 m_auimgr.SetManagedWindow(
this );
241 unsigned int auiFlags = wxAUI_MGR_DEFAULT;
242 #if !defined( _WIN32 ) 244 auiFlags |= wxAUI_MGR_LIVE_RESIZE;
246 m_auimgr.SetFlags( auiFlags );
249 m_auimgr.AddPane( m_mainToolBar,
EDA_PANE().HToolbar().Name(
"MainToolbar" )
251 m_auimgr.AddPane( m_auxiliaryToolBar,
EDA_PANE().HToolbar().Name(
"AuxToolbar" )
253 m_auimgr.AddPane( m_messagePanel,
EDA_PANE().Messages().Name(
"MsgPanel" )
254 .Bottom().Layer( 6 ) );
257 m_auimgr.AddPane( m_optionsToolBar,
EDA_PANE().VToolbar().Name(
"OptToolbar" )
258 .
Left().Layer( 3 ) );
260 m_auimgr.AddPane( m_drawToolBar,
EDA_PANE().VToolbar().Name(
"ToolsToolbar" )
261 .
Right().Layer( 3 ) );
263 m_auimgr.AddPane( m_appearancePanel,
EDA_PANE().Name(
"LayersManager" )
265 .Caption(
_(
"Appearance" ) ).PaneBorder(
false )
266 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
268 m_auimgr.AddPane( m_selectionFilterPanel,
EDA_PANE().Name(
"SelectionFilter" )
269 .
Right().Layer( 4 ).Position( 2 )
270 .Caption(
_(
"Selection Filter" ) ).PaneBorder(
false )
271 .MinSize( 180, -1 ).BestSize( 180, -1 ) );
274 m_auimgr.AddPane( GetCanvas(),
EDA_PANE().Canvas().Name(
"DrawFrame" )
277 m_auimgr.GetPane(
"LayersManager" ).Show( m_show_layer_manager_tools );
278 m_auimgr.GetPane(
"SelectionFilter" ).Show( m_show_layer_manager_tools );
281 m_auimgr.GetPane(
"SelectionFilter" ).dock_proportion = 0;
283 m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_ACTIVE_CAPTION_TEXT_COLOUR,
284 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
285 m_auimgr.GetArtProvider()->SetColour( wxAUI_DOCKART_INACTIVE_CAPTION_TEXT_COLOUR,
286 wxSystemSettings::GetColour( wxSYS_COLOUR_BTNTEXT ) );
288 FinishAUIInitialization();
290 if(
PCBNEW_SETTINGS* settings = dynamic_cast<PCBNEW_SETTINGS*>( config() ) )
292 if( settings->m_AuiPanels.right_panel_width > 0 )
294 wxAuiPaneInfo& layersManager = m_auimgr.GetPane(
"LayersManager" );
298 layersManager.MinSize( settings->m_AuiPanels.right_panel_width, -1 );
299 layersManager.Fixed();
303 layersManager.MinSize( 180, -1 );
304 layersManager.Resizable();
308 m_appearancePanel->SetTabIndex( settings->m_AuiPanels.appearance_panel_tab );
319 setupUnits( config() );
322 PythonSyncEnvironmentVariables();
323 PythonSyncProjectName();
325 GetCanvas()->SwitchBackend( m_canvasType );
332 wxString strK2S =
Pgm().GetExecutablePath();
335 if( strK2S.Find(
"pcbnew.app" ) != wxNOT_FOUND )
341 strK2S +=
"Contents/MacOS/";
344 wxFileName appK2S( strK2S,
"kicad2step" );
347 appK2S.SetExt(
"exe" );
362 m_appearancePanel->OnBoardChanged();
375 open_dlg->Close(
true );
379 m_toolManager->ShutdownAllTools();
384 delete m_selectionFilterPanel;
385 delete m_appearancePanel;
392 m_pcb->ClearProject();
416 &m_pcb->GetPageSettings(),
418 &m_pcb->GetTitleBlock() );
419 drawingSheet->
SetSheetName( std::string( GetScreenDesc().mb_str() ) );
433 GetCanvas()->SetDrawingSheet( drawingSheet );
439 return GetScreen() && GetScreen()->IsModify();
446 return GetScreen()->IsSave();
463 GetCanvas()->GetViewControls(), config(),
this );
471 m_toolManager->RegisterTool(
new ZOOM_TOOL );
475 m_toolManager->RegisterTool(
new EDIT_TOOL );
477 m_toolManager->RegisterTool(
new PAD_TOOL );
489 m_toolManager->RegisterTool(
new DRC_TOOL );
492 m_toolManager->RegisterTool(
new GROUP_TOOL );
493 m_toolManager->InitTools();
496 m_toolManager->InvokeTool(
"pcbnew.InteractiveSelection" );
509 #define ENABLE( x ) ACTION_CONDITIONS().Enable( x ) 510 #define CHECK( x ) ACTION_CONDITIONS().Check( x ) 543 #if defined( KICAD_SCRIPTING_WXPYTHON ) 544 auto pythonConsoleCond =
550 return console && console->IsShown();
559 auto enableZoneControlConition =
563 && GetDisplayOptions().m_ZoneOpacity > 0.0;
573 auto enableBoardSetupCondition =
577 return !tool->IsDRCDialogShown();
582 auto boardFlippedCond =
585 return GetCanvas()->GetView()->IsMirroredX();
588 auto layerManagerCond =
591 return LayerManagerShown();
594 auto highContrastCond =
600 auto globalRatsnestCond =
603 return GetDisplayOptions().m_ShowGlobalRatsnest;
606 auto curvedRatsnestCond =
609 return GetDisplayOptions().m_DisplayRatsnestLinesCurved;
620 auto isHighlightMode =
634 auto isWalkaroundMode =
652 if( bci->GetNetCode() > 0 )
689 #define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) ) 706 #define CURRENT_EDIT_TOOL( action ) mgr->SetConditions( action, ACTION_CONDITIONS().Check( cond.CurrentTool( action ) ).Enable( isDrcRunning ) ) 737 #undef CURRENT_EDIT_TOOL 745 if( event.GetId() == wxID_EXIT )
760 if( marker->IsExcluded() )
771 commit.
Add( marker );
773 commit.
Push( wxEmptyString,
false,
false );
777 if( marker->IsExcluded() )
779 GetCanvas()->GetView()->Remove( marker );
780 GetCanvas()->GetView()->Add( marker );
790 && IsContentModified() )
795 if( IsContentModified() )
798 wxString msg =
_(
"Save changes to \"%s\" before closing?" );
815 open_dlg->Close(
true );
829 GetCanvas()->SetEvtHandlerEnabled(
false );
831 GetCanvas()->StopDrawing();
837 fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
841 if( !fn.IsOk() || !fn.IsDirWritable() )
842 fn.SetPath( wxFileName::GetTempDir() );
844 wxLogTrace(
traceAutoSave,
"Deleting auto save file <" + fn.GetFullPath() +
">" );
847 if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
849 wxString msg =
wxString::Format(
_(
"The auto save file \"%s\" could not be removed!" ),
851 wxMessageBox( msg,
Pgm().App().GetAppName(), wxOK | wxICON_ERROR,
this );
855 SaveProjectSettings();
860 if( m_show_layer_manager_tools )
861 m_auimgr.GetPane(
"LayersManager" ).Show(
false );
868 Clear_Pcb(
false,
true );
881 GetCanvas()->UpdateColors();
882 GetCanvas()->Refresh();
893 if( !aInitialPage.IsEmpty() )
901 SaveProjectSettings();
904 ReCreateAuxiliaryToolbar();
907 GetCanvas()->Refresh();
914 m_toolManager->ProcessEvent( toolEvent );
917 GetCanvas()->SetFocus();
941 auto cfg = dynamic_cast<PCBNEW_SETTINGS*>( aCfg );
946 cfg->m_RotationAngle = m_rotationAngle;
947 cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
948 cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
949 cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex();
950 cfg->m_ShowPageLimits = m_showPageLimits;
959 return GetColorSettings()->GetColor(
LAYER_GRID );
966 GetColorSettings()->SetColor(
LAYER_GRID, aColor );
967 GetCanvas()->GetGAL()->SetGridColor( aColor );
975 if( oldLayer == aLayer )
980 m_appearancePanel->OnLayerChanged();
983 GetCanvas()->SetFocus();
984 GetCanvas()->SetHighContrastLayer( aLayer );
986 GetCanvas()->GetView()->UpdateAllItemsConditionally(
KIGFX::REPAINT,
989 if(
VIA* via = dynamic_cast<VIA*>( aItem ) )
996 else if(
PAD* pad = dynamic_cast<PAD*>( aItem ) )
1000 if( GetDisplayOptions().m_DisplayPadIsol )
1007 if( ( oldLayer ==
F_Cu || aLayer ==
F_Cu ) && pad->IsOnLayer(
F_Cu ) )
1010 if( ( oldLayer ==
B_Cu || aLayer ==
B_Cu ) && pad->IsOnLayer(
B_Cu ) )
1017 else if(
TRACK* track = dynamic_cast<TRACK*>( aItem ) )
1021 if( GetDisplayOptions().m_ShowTrackClearanceMode )
1024 return track->IsOnLayer( oldLayer ) || track->IsOnLayer( aLayer );
1031 GetCanvas()->Refresh();
1041 drcTool->
GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1054 if( fn.FileExists() && !fn.IsFileWritable() )
1056 m_infoBar->RemoveAllButtons();
1057 m_infoBar->AddCloseButton();
1058 m_infoBar->ShowMessage(
_(
"Board file is read only." ), wxICON_WARNING );
1064 GetCanvas()->SyncLayersVisibility( m_pcb );
1066 SetElementVisibility(
LAYER_RATSNEST, GetDisplayOptions().m_ShowGlobalRatsnest );
1068 m_appearancePanel->OnBoardChanged();
1079 unitsChangeRefresh();
1082 Zoom_Automatique(
false );
1085 GetCanvas()->GetView()->UpdateAllItems(
KIGFX::ALL );
1090 SetStatusText( wxEmptyString );
1098 m_appearancePanel->UpdateDisplayOptions();
1104 m_appearancePanel->OnLayerAlphaChanged();
1118 GetCanvas()->GetView()->SetLayerVisible( aElement,
true );
1120 GetCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
1131 wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_appearancePanel );
1132 pane_info.Caption(
_(
"Appearance" ) );
1135 m_appearancePanel->OnBoardChanged();
1144 return wxEmptyString;
1146 wxFileName absoluteFileName = project.
m_PcbLastPath[ aType ];
1149 absoluteFileName.MakeAbsolute( pcbFileName.GetPath() );
1150 return absoluteFileName.GetFullPath();
1158 wxFileName relativeFileName = aLastPath;
1161 relativeFileName.MakeRelativeTo( pcbFileName.GetPath() );
1163 if( relativeFileName.GetFullPath() != project.
m_PcbLastPath[ aType ] )
1165 project.
m_PcbLastPath[ aType ] = relativeFileName.GetFullPath();
1166 SaveProjectSettings();
1175 Update3DView(
true );
1177 if( !GetTitle().StartsWith(
"*" ) )
1180 m_ZoneFillsDirty =
true;
1193 bool readOnly =
false;
1194 bool unsaved =
false;
1196 if( fn.IsOk() && fn.FileExists() )
1197 readOnly = !fn.IsFileWritable();
1202 IsContentModified() ?
"*" :
"",
1204 readOnly ?
_(
"[Read Only]" ) + wxS(
" " ) :
"",
1205 unsaved ?
_(
"[Unsaved]" ) + wxS(
" " ) :
"" ) );
1216 Compile_Ratsnest(
true );
1223 if( !activeLayers.test( GetActiveLayer() ) )
1224 SetActiveLayer( activeLayers.
Seq().front() );
1226 m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
1238 layerEnum.
Map( *seq,
GetBoard()->GetLayerName( *seq ) );
1249 m_appearancePanel->OnBoardChanged();
1253 #if defined( KICAD_SCRIPTING_WXPYTHON ) 1255 void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable()
1257 wxWindow * pythonPanelFrame = findPythonConsole();
1258 bool pythonPanelShown =
true;
1260 if( pythonPanelFrame ==
NULL )
1261 pythonPanelFrame = CreatePythonShellWindow(
this, pythonConsoleNameId() );
1263 pythonPanelShown = ! pythonPanelFrame->IsShown();
1265 if( pythonPanelFrame )
1266 pythonPanelFrame->Show( pythonPanelShown );
1268 wxMessageBox( wxT(
"Error: unable to create the Python Console" ) );
1303 wxFAIL_MSG(
"ToPlotter(): unexpected plot type" );
break;
1307 SetPlotSettings( plotSettings );
1323 if(
Kiface().IsSingle() )
1330 if( !frame->IsShown() )
1332 wxFileName fn(
Prj().GetProjectPath(),
Prj().GetProjectName(),
1337 if( !fn.FileExists() )
1341 if( !fn.FileExists() )
1343 DisplayError(
this,
_(
"The schematic for this board cannot be found." ) );
1352 frame->Show(
true );
1375 if( !TestStandalone() )
1378 "stand-alone mode. In order to create or update PCBs from " 1379 "schematics, you must launch the KiCad project manager and " 1380 "create a project." ) );
1386 std::string payload( aAnnotateMessage );
1390 if( payload == aAnnotateMessage )
1419 if( !schematic.FileExists() )
1423 if( legacySchematic.FileExists() )
1425 schematic = legacySchematic;
1429 msg.Printf(
_(
"Schematic file \"%s\" not found." ), schematic.GetFullPath() );
1430 wxMessageBox( msg,
_(
"KiCad Error" ), wxOK | wxICON_ERROR,
this );
1435 if(
Kiface().IsSingle() )
1437 wxString filename = wxT(
"\"" ) + schematic.GetFullPath( wxPATH_NATIVE ) + wxT(
"\"" );
1460 wxMessageBox(
_(
"Eeschema failed to load:\n" ) + err.
What(),
1461 _(
"KiCad Error" ), wxOK | wxICON_ERROR, this );
1466 if( !frame->IsShown() )
1469 frame->
OpenProjectFiles( std::vector<wxString>( 1, schematic.GetFullPath() ) );
1470 frame->Show(
true );
1475 if( frame->IsIconized() )
1477 frame->Iconize(
false );
1480 frame->Maximize(
false );
1491 #if defined(KICAD_SCRIPTING) 1492 #if defined(KICAD_SCRIPTING_ACTION_MENU) 1501 #if defined(KICAD_SCRIPTING_ACTION_MENU) 1513 #if defined(KICAD_SCRIPTING) 1520 system( msg.c_str() );
1527 wxLaunchDefaultApplication( pypath );
1535 #if defined( KICAD_SCRIPTING ) 1540 for(
auto& var : vars )
1545 for(
auto& var : vars )
1546 wxSetEnv( var.first, var.second.GetValue() );
1553 #if defined( KICAD_SCRIPTING ) 1567 if( aFootprint ==
NULL )
1588 GetCanvas()->Refresh();
1594 editor->LoadFootprintFromBoard( aFootprint );
1596 editor->Show(
true );
1604 editor->LoadFootprintFromLibrary( aFootprint->
GetFPID() );
1606 editor->Show(
true );
1612 ShowExchangeFootprintsDialog( aFootprint,
true,
true );
1617 ShowExchangeFootprintsDialog( aFootprint,
false,
true );
1623 bool aSelectedMode )
1635 GetAppearancePanel()->OnColorThemeChanged();
1643 drcTool->
GetDRCEngine()->InitEngine( GetDesignRulesPath() );
1648 wxHyperlinkCtrl* button =
new wxHyperlinkCtrl( infobar, wxID_ANY,
_(
"Edit design rules" ),
1651 button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<
void( wxHyperlinkEvent& aEvent )>(
1652 [&]( wxHyperlinkEvent& aEvent )
1654 ShowBoardSetupDialog(
_(
"Custom Rules" ) );
1657 infobar->RemoveAllButtons();
1658 infobar->AddButton( button );
1659 infobar->AddCloseButton();
1660 infobar->ShowMessage(
_(
"Could not compile custom design rules." ), wxICON_ERROR );
1664 if( aEnvVarsChanged )
1665 PythonSyncEnvironmentVariables();
1674 PythonSyncProjectName();
1683 wxString wildcard = wxT(
"*.hyp" );
1686 fn.SetExt( wxT(
"hyp") );
1688 wxFileDialog dlg(
this,
_(
"Export Hyperlynx Layout" ), fn.GetPath(), fn.GetFullName(),
1689 wildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
1691 if( dlg.ShowModal() != wxID_OK )
1697 fn.SetExt( wxT(
"hyp" ) );
1711 return m_auimgr.GetPane(
"LayersManager" ).IsShown();
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
void UpdateTitle()
Set the main window title bar text.
static bool ShowAlways(const SELECTION &aSelection)
The default condition function (always returns true).
static TOOL_ACTION drawLine
virtual bool OpenProjectFiles(const std::vector< wxString > &aFileList, int aCtl=0)
Open a project or set of files given by aFileList.
Filled polygons are shown.
static TOOL_ACTION drawCenterDimension
void OnModify() override
Must be called after a board change to set the modified flag.
bool HandleUnsavedChanges(wxWindow *aParent, const wxString &aMessage, const std::function< bool()> &aSaveFunction)
Display a dialog with Save, Cancel and Discard Changes buttons.
#define CURRENT_EDIT_TOOL(action)
void SetPageSettings(const PAGE_INFO &aPageSettings) override
void RecreateCmpFileFromBoard(wxCommandEvent &aEvent)
Recreates a .cmp file from the current loaded board.
A wxFrame capable of the OpenProjectFiles function, meaning it can load a portion of a KiCad project.
virtual void ShowChangedLanguage() override
Redraw the menus and what not in current language.
const PAGE_INFO & GetPageSettings() const
void SetElementVisibility(GAL_LAYER_ID aElement, bool aNewState)
Change the visibility of an element category.
void OnExportIDF3(wxCommandEvent &event)
Will export the current BOARD to a IDFv3 board and lib files.
static TOOL_ACTION unlock
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Change the visibility of an element category.
static const KICAD_T Tracks[]
A scan list for only TRACKs.
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void OnExportHyperlynx(wxCommandEvent &event)
Will export the current BOARD to a Hyperlynx HYP file.
KICAD_NETLIST_READER read the new s-expression based KiCad netlist format.
SELECTION & GetCurrentSelection() override
Get the current selection from the canvas area.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
This file is part of the common library TODO brief description.
const wxChar *const traceAutoSave
Flag to enable auto save feature debug tracing.
static TOOL_ACTION drawSimilarZone
static TOOL_ACTION drillOrigin
SELECTION_CONDITION HasItems()
Create a functor that tests if there are items in the board.
static TOOL_ACTION doDelete
static TOOL_ACTION drawArc
SELECTION_CONDITION TrackFillDisplay()
Create a functor that tests if the frame fills tracks.
void ToPlotter(int aID)
Open a dialog frame to create plot and drill files relative to the current board.
static TOOL_ACTION hideNet
SELECTION_CONDITION FullscreenCursor()
Create a functor testing if the cursor is full screen in a frame.
static SELECTION_CONDITION MoreThan(int aNumber)
Create a functor that tests if the number of selected items is greater than the value given as parame...
static TOOL_ACTION microwaveCreateStubArc
void OnSockRequestServer(wxSocketEvent &evt)
COMMIT & Add(EDA_ITEM *aItem)
Notify observers that aItem has been added.
Outlines of filled polygons are shown.
void SetInitialPage(const wxString &aPage, const wxString &aParentPage=wxEmptyString)
void doCloseWindow() override
static TOOL_ACTION ratsnestLineMode
static TOOL_ACTION zoomTool
void pcbnewUpdatePythonEnvVar(const wxString &aVar, const wxString &aValue)
Set an environment variable in the current Python interpreter.
static bool Idle(const SELECTION &aSelection)
Test if there no items selected or being edited.
ENUM_MAP & Undefined(T aValue)
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Notification event that some of the common (suite-wide) settings have changed.
static TOOL_ACTION zoneDisplayOutlines
Control for copper zone opacity/visibility (color ignored)
virtual PROJECT_FILE & GetProjectFile() const
void ActivateGalCanvas() override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
void OnExportSTEP(wxCommandEvent &event)
Export the current BOARD to a STEP assembly.
void ResolveDRCExclusions()
Update markers to match recorded exclusions.
static TOOL_ACTION toggleLine45degMode
Toggle 45 degree line drawing mode.
static TOOL_ACTION selectNet
Select all connections belonging to a single net.
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
#define PROJECT_VAR_NAME
A variable name whose value holds the current project directory.
void SetFileName(const std::string &aFileName)
Set the file name displayed in the title block.
static TOOL_ACTION drawAlignedDimension
Smd pad, appears on the solder paste layer (default)
static constexpr GAL_TYPE GAL_FALLBACK
static TOOL_ACTION zoneDisplayDisable
virtual void setupUIConditions()
Setup the UI conditions for the various actions and their controls in this frame.
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION zoomFitScreen
static TOOL_ACTION millimetersUnits
static ENUM_MAP< T > & Instance()
The project local settings are things that are attached to a particular project, but also might be pa...
GAL_LAYER_ID
GAL layers are "virtual" layers, i.e.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings Returns a bit-mask of all t...
static TOOL_ACTION drawPolygon
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
static TOOL_ACTION microwaveCreateLine
BOARD_NETLIST_UPDATER class definition.
bool canCloseWindow(wxCloseEvent &aCloseEvent) override
NET_SETTINGS & NetSettings()
static TOOL_ACTION showPythonConsole
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
virtual KIWAY_PLAYER * Player(FRAME_T aFrameType, bool doCreate=true, wxTopLevelWindow *aParent=nullptr)
Return the KIWAY_PLAYER* given a FRAME_T.
virtual void ExpressMail(FRAME_T aDestination, MAIL_T aCommand, std::string &aPayload, wxWindow *aSource=nullptr)
Send aPayload to aDestination from aSource.
void ExportToGenCAD(wxCommandEvent &event)
Create a file in GenCAD 1.4 format from the current board.
static TOOL_ACTION showLayersManager
void SetGridColor(COLOR4D aColor) override
void SetSheetCount(int aSheetCount)
Changes the sheet-count number displayed in the title block.
SELECTION_CONDITION RedoAvailable()
Create a functor that tests if there are any items in the redo queue.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings Returns a bit-mask of all t...
bool FetchNetlistFromSchematic(NETLIST &aNetlist, const wxString &aAnnotateMessage)
PCB_LAYER_ID m_ActiveLayer
The current (active) board layer for editing.
SELECTION_CONDITION Line45degMode()
Create a functor that tests whether only 45 degree graphic lines should be drawn.
Manage TOOL_ACTION objects.
static TOOL_ACTION ungroup
static TOOL_ACTION localRatsnestTool
wxString m_PcbLastPath[LAST_PATH_SIZE]
MRU path storage.
An abstract base class for deriving all objects that can be added to a VIEW.
static SELECTION_CONDITION Count(int aNumber)
Create a functor that tests if the number of selected items is equal to the value given as parameter.
void RecordDRCExclusions()
Scan existing markers and record data from any that are Excluded.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
int ShowExchangeFootprintsDialog(FOOTPRINT *aFootprint, bool aUpdateMode, bool aSelectedMode)
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
const wxString & GetFileName() const
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
void SetSheetName(const std::string &aSheetName)
Set the sheet name displayed in the title block.
static wxWindow * findPythonConsole()
static SELECTION_CONDITION SameLayer()
Creates a functor that tests if selection contains items that belong exclusively to the same layer.
static TOOL_ACTION placeText
PROJECT_FILE is the backing store for a PROJECT, in JSON format.
static TOOL_ACTION zoneFill
SELECTION_CONDITION PadFillDisplay()
Create a functor that tests if the frame fills the pads.
wxString GetLastPath(LAST_PATH_TYPE aType)
Get the last path for a particular type.
static void UnloadAll()
Unloads (deregisters) all action plugins.
void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged) override
Called after the preferences dialog is run.
void LoadSettings(APP_SETTINGS_BASE *aCfg) override
Load common frame parameters from a configuration file.
virtual PROJECT_LOCAL_SETTINGS & GetLocalSettings() const
const wxString & GetPageNumber() const
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
bool isAutoSaveRequired() const override
Return true if the board has been modified.
void doCloseWindow() override
bool TestStandalone(void)
Test if standalone mode.
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
static TOOL_ACTION highlightNetTool
void SynchronizeNetsAndNetClasses()
Copy NETCLASS info to each NET, based on NET membership in a NETCLASS.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
void OnClearFileHistory(wxCommandEvent &aEvent)
static TOOL_ACTION measureTool
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
virtual void LoadNetlist() override
Function LoadNetlist loads the contents of the netlist file into aNetlist.
PCB_LAYER_ID
A quick note on layer IDs:
void Tracks_and_Vias_Size_Event(wxCommandEvent &event)
bool ExportBoardToHyperlynx(BOARD *aBoard, const wxFileName &aPath)
static TOOL_ACTION rotateCw
Rotation of selected objects.
Item needs to be redrawn.
const wxString EESCHEMA_EXE
LSET is a set of PCB_LAYER_IDs.
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString)
void ProjectChanged() override
Notification event that the project has changed.
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
NETLIST stores all of information read from a netlist along with the flags used to update the NETLIST...
SELECTION_CONDITION GridVisible()
Create a functor testing if the grid is visible in a frame.
bool IsSingle() const
Is this KIFACE_I running under single_top?
bool IsContentModified() override
Get if the current board has been modified but not saved.
BOARD_ITEM_CONTAINER * GetModel() const override
virtual const wxString What() const
A composite of Problem() and Where()
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
SELECTION_CONDITION Units(EDA_UNITS aUnit)
Create a functor that tests if the frame has the specified units.
void RemoveListener(BOARD_LISTENER *aListener)
Remove the specified listener.
std::map< wxString, ENV_VAR_ITEM > ENV_VAR_MAP
wxString m_ActiveLayerPreset
The name of a LAYER_PRESET that is currently activated (or blank if none)
static const wxChar * Name(PCB_LAYER_ID aLayerId)
Return the fixed name association with aLayerId.
static TOOL_ACTION toggleGrid
Handle actions that are shared between different frames in PcbNew.
void onBoardLoaded()
Update the state of the GUI after a new board is loaded or created.
GAL_SET GetVisibleElements() const
Returns a set of all the element categories that are visible.
Describe the page size and margins of a paper page on which to eventually print or plot.
static TOOL_ACTION inchesUnits
Handles how to draw a screen (a board, a schematic ...)
void ResolveNetClassAssignments(bool aRebuildFromScratch=false)
Explodes the list of netclass assignments to include atomic members of composite labels (buses).
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Non-active layers are shown normally (no high-contrast mode)
void ExportSVG(wxCommandEvent &event)
Show the Export to SVG file dialog.
wxString PyPluginsPath(bool aUserPath)
static TOOL_ACTION zoneMerge
static TOOL_ACTION togglePolarCoords
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
virtual ~PCB_EDIT_FRAME()
Handle actions specific to the board editor in PcbNew.
Definition of file extensions used in Kicad.
static const KICAD_T Zones[]
A scan list for zones outlines only.
void OnUpdateSelectAutoWidth(wxUpdateUIEvent &aEvent)
#define DIALOG_DRC_WINDOW_NAME
static TOOL_ACTION showRatsnest
void ShowChangedLanguage() override
Redraw the menus and what not in current language.
COLOR4D GetGridColor() override
static TOOL_ACTION drawRectangle
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
static TOOL_ACTION microwaveCreateGap
wxLogTrace helper definitions.
static LSET AllLayersMask()
void AddDelimiterString(wxString &string)
Add un " to the start and the end of string (if not already done).
virtual void OnSize(wxSizeEvent &event)
Recalculate the size of toolbars and display panel when the frame size changes.
void SetLayerVisible(int aLayer, bool aVisible=true)
Control the visibility of a particular layer.
static TOOL_ACTION drawVia
#define KICAD_DEFAULT_DRAWFRAME_STYLE
std::function< bool(const SELECTION &)> SELECTION_CONDITION
< Functor type that checks a specific condition for selected items.
void BuildConnectivity()
Builds or rebuilds the board connectivity database for the board, especially the list of connected it...
void OnQuit(wxCommandEvent &event)
void UpdateUserInterface()
Update the layer manager and other widgets from the board setup (layer and items visibility,...
void PythonPluginsShowFolder()
Open the plugins folder in the default system file browser.
void PythonSyncEnvironmentVariables()
Synchronize the environment variables from KiCad's environment into the Python interpreter.
virtual void SetActiveLayer(PCB_LAYER_ID aLayer)
void SetFormat(PLOT_FORMAT aFormat)
const BITMAP_OPAQUE icon_pcbnew_32_xpm[1]
PCB_PLOT_PARAMS handles plot parameters and options when plotting/printing a board.
static TOOL_ACTION drawZoneCutout
Handle actions that are shared between different applications.
static TOOL_ACTION routerWalkaroundMode
LAST_PATH_TYPE
For storing PcbNew MRU paths of various types.
static TOOL_ACTION placeTarget
SELECTION_CONDITION ZoneDisplayMode(ZONE_DISPLAY_MODE aMode)
Create a functor that tests the current zone display mode in the frame.
Specialization of the wxAuiPaneInfo class for KiCad panels.
const std::string LegacySchematicFileExtension
SETTINGS_MANAGER * GetSettingsManager()
SELECTION_CONDITION PolarCoordinates()
Create a functor testing if polar coordinates are current being used.
void SetConditions(const TOOL_ACTION &aAction, const ACTION_CONDITIONS &aConditions)
Set the conditions the UI elements for activating a specific tool action should use for determining t...
static TOOL_ACTION milsUnits
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
static TOOL_ACTION boardSetup
DIALOG_PLOT is the dialog to set the plot options, and create plot files in various formats.
class FOOTPRINT, a footprint
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
SELECTION_CONDITION NoActiveTool()
Create a functor testing if there are no tools active in the frame.
static TOOL_ACTION microwaveCreateStub
static TOOL_ACTION zoneUnfill
static TOOL_ACTION pasteSpecial
static TOOL_ACTION padDisplayMode
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
static TOOL_ACTION rotateCcw
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
static TOOL_ACTION drawCircle
static TOOL_ACTION viaDisplayMode
void SetProject(PROJECT *aProject)
Links a board to a given project.
static TOOL_ACTION zoneDuplicate
Duplicate zone onto another layer.
A modified version of the wxInfoBar class that allows us to:
void PythonPluginsReloadBase()
Helper function PythonPluginsReloadBase Reload Python plugins if they are newer than the already load...
void OnSockRequest(wxSocketEvent &evt)
virtual void OnModify()
Must be called after a change in order to set the "modify" flag of the current screen and update the ...
static TOOL_ACTION microwaveCreateFunctionShape
static TOOL_ACTION layerChanged
Gather all the actions that are shared by tools.
void OnFileHistory(wxCommandEvent &event)
static TOOL_ACTION placeFootprint
static TOOL_ACTION showNet
static TOOL_ACTION drawLeader
A filename or source description, a problem input line, a line number, a byte offset,...
Class PCBNEW_ACTION_PLUGINS.
static TOOL_ACTION drawRuleArea
Ignore collisions, mark obstacles.
void SaveSettings(APP_SETTINGS_BASE *aCfg) override
Save common frame parameters to a configuration data file.
Tool that displays edit points allowing to modify items by dragging the points.
void OnUpdateLayerAlpha(wxUpdateUIEvent &aEvent) override
Update the UI to reflect changes to the current layer's transparency.
void OnSelectGrid(wxCommandEvent &event)
Command event handler for selecting grid sizes.
void SetBoard(BOARD *aBoard) override
Declaration of the eda_3d_viewer class.
void PythonSyncProjectName()
Synchronize the project name from KiCad's environment into the Python interpreter.
static TOOL_ACTION highlightNet
#define CURRENT_TOOL(action)
Common, abstract interface for edit frames.
void Process_Special_Functions(wxCommandEvent &event)
virtual void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType)
Changes the current rendering backend.
Only the zone outline is shown.
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
Information pertinent to a Pcbnew printed circuit board.
void setupUIConditions() override
Setup the UI conditions for the various actions and their controls in this frame.
void Files_io(wxCommandEvent &event)
Call Files_io_from_id with the wxCommandEvent id.
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
SELECTION_CONDITION UndoAvailable()
Create a functor that tests if there are any items in the undo queue.
virtual void SetBoard(BOARD *aBoard) override
Set the #m_Pcb member in such as way as to ensure deleting any previous BOARD.
void OnExportVRML(wxCommandEvent &event)
Export the current BOARD to a VRML file.
void OnUpdateSelectViaSize(wxUpdateUIEvent &aEvent)
static SELECTION_CONDITION OnlyType(KICAD_T aType)
Create a functor that tests if the selected items are only of given type.
const std::string KiCadSchematicFileExtension
The main frame for Pcbnew.
void SaveColorSettings(COLOR_SETTINGS *aSettings, const std::string &aNamespace="")
Safely saves a COLOR_SETTINGS to disk, preserving any changes outside the given namespace.
SELECTION_CONDITION ViaFillDisplay()
Create a functor that tests if the frame fills vias.
A base class for most all the KiCad significant classes used in schematics and boards.
virtual void Push(const wxString &aMessage=wxT("A commit"), bool aCreateUndoEntry=true, bool aSetDirtyBit=true) override
Revert the commit by restoring the modified items state.
static TOOL_ACTION deselectNet
Remove all connections belonging to a single net from the active selection.
bool InvokeExportSVG(PCB_EDIT_FRAME *aCaller, BOARD *aBoard)
Function InvokeExportSVG shows the Export SVG dialog.
virtual void SetPageSettings(const PAGE_INFO &aPageSettings) override
bool ReannotateSchematic(std::string &aNetlist)
Send a command to Eeschema to re-annotate the schematic.
virtual void CommonSettingsChanged(bool aEnvVarsChanged, bool aTextVarsChanged)
Call CommonSettingsChanged() on all KIWAY_PLAYERs.
static TOOL_ACTION deleteTool
void SetPageNumber(const std::string &aPageNumber)
Changes the page number displayed in the title block.
void onSize(wxSizeEvent &aEvent)
static SELECTION_CONDITION SameNet(bool aAllowUnconnected=false)
Create a functor that tests if selection contains items belonging to the same net or are unconnected ...
void OnUpdateSelectTrackWidth(wxUpdateUIEvent &aEvent)
#define PCB_EDIT_FRAME_NAME
void OnGridSettings(wxCommandEvent &event)
static TOOL_ACTION toggleCursorStyle
static TOOL_ACTION flipBoard
GERBVIEW_FRAME::OnZipFileHistory GERBVIEW_FRAME::OnSelectDisplayMode EVT_CHOICE(ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice) EVT_UPDATE_UI(ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER
Abstract interface for BOARD_ITEMs capable of storing other items inside.
static TOOL_ACTION gridSetOrigin
const BITMAP_OPAQUE icon_pcbnew_xpm[1]
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
bool IsElementVisible(GAL_LAYER_ID aElement) const
Test whether a given element category is visible.
ENUM_MAP & Map(T aValue, const wxString &aName)
std::set< wxString > m_DrcExclusions
void SwitchCanvas(EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType) override
Switch currently used canvas (Cairo / OpenGL).
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
ID_POPUP_PCB_SELECT_WIDTH8
wxString GetCurrentFileName() const override
Get the full filename + path of the currently opened file in the frame.
int ExecuteFile(wxWindow *frame, const wxString &ExecFile, const wxString ¶m, wxProcess *callback)
Call the executable file ExecFile with the command line parameters param.
Group generic conditions for PCB editor states.
static TOOL_ACTION routerShoveMode
static TOOL_ACTION highContrastMode
void PythonPluginsReload()
Reload the Python plugins if they are newer than the already loaded, and load new plugins if any.
void OnDisplayOptionsChanged() override
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
static TOOL_ACTION selectAll
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
const BITMAP_OPAQUE icon_pcbnew_16_xpm[1]
static TOOL_ACTION drawZone
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
static TOOL_ACTION duplicate
static TOOL_ACTION trackDisplayMode
static TOOL_ACTION selectionTool
virtual void OnSelectZoom(wxCommandEvent &event)
Set the zoom factor when selected by the zoom list box in the main tool bar.
void SetLastPath(LAST_PATH_TYPE aType, const wxString &aLastPath)
Set the path of the last file successfully read.
static TOOL_ACTION selectSameSheet
Select all components on the same sheet as the selected footprint.
Container for design settings for a BOARD object.
A color representation with 4 components: red, green, blue, alpha.
static TOOL_ACTION zoneDisplayEnable
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
bool Contains(GAL_LAYER_ID aPos)