KiCad PCB EDA Suite
pcbnew.cpp File Reference

Pcbnew main program. More...

#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <kiface_ids.h>
#include <confirm.h>
#include <macros.h>
#include <make_unique.h>
#include <class_drawpanel.h>
#include <pcb_edit_frame.h>
#include <eda_dde.h>
#include <wx/stdpaths.h>
#include <wx/file.h>
#include <wx/snglinst.h>
#include <wx/dir.h>
#include <gestfich.h>
#include <pcbnew.h>
#include <hotkeys.h>
#include <wildcards_and_files_ext.h>
#include <class_board.h>
#include <class_draw_panel_gal.h>
#include <fp_lib_table.h>
#include <footprint_edit_frame.h>
#include <footprint_viewer_frame.h>
#include <footprint_wizard_frame.h>
#include <footprint_preview_panel.h>
#include <footprint_info_impl.h>
#include <gl_context_mgr.h>
#include "invoke_pcb_dialog.h"
#include "dialog_global_fp_lib_table_config.h"

Go to the source code of this file.

Classes

struct  PCB::IFACE
 

Namespaces

 PCB
 

Functions

bool IsWxPythonLoaded ()
 
PCB::IFACE KIFACE_I PCB::kiface ("pcbnew", KIWAY::FACE_PCB)
 
 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 
void OnKifaceEnd () override
 
wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
 
void * IfaceOrAddress (int aDataId) override
 Function IfaceOrAddress return a pointer to the requested object. More...
 
KIFACE_IKiface ()
 Global KIFACE_I "get" accessor. More...
 
 MY_API (KIFACE *) KIFACE_GETTER(int *aKIFACEversion
 
void PythonPluginsReloadBase ()
 Helper function PythonPluginsReloadBase Reload Python plugins if they are newer than the already loaded, and load new plugins if any It calls the LoadPlugins(bundlepath) Python method see kicadplugins.i. More...
 

Variables

PCB_LAYER_ID g_Route_Layer_TOP
 
PCB_LAYER_ID g_Route_Layer_BOTTOM
 
bool g_Alternate_Track_Posture = false
 
bool g_Raccord_45_Auto = true
 
wxPoint g_Offset_Module
 
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" )
 
DLIST< TRACKg_CurrentTrackList
 
static PGM_BASEprocess
 
int aKiwayVersion
 
int PGM_BASEaProgram
 
return & kiface
 
FP_LIB_TABLE GFootprintTable
 The global footprint library table. More...
 
FOOTPRINT_LIST_IMPL GFootprintList
 The global footprint info table. More...
 

Detailed Description

Pcbnew main program.

Definition in file pcbnew.cpp.

Function Documentation

◆ CreateWindow()

wxWindow* kiface::CreateWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKiway,
int  aCtlBits = 0 
)
override

Definition at line 398 of file pcbnew.cpp.

◆ IFACE()

kiface::IFACE ( const char *  aName,
KIWAY::FACE_T  aType 
)

Definition at line 390 of file pcbnew.cpp.

◆ IfaceOrAddress()

void* kiface::IfaceOrAddress ( int  aDataId)
override

Function IfaceOrAddress return a pointer to the requested object.

The safest way to use this is to retrieve a pointer to a static instance of an interface, similar to how the KIFACE interface is exported. But if you know what you are doing use it to retrieve anything you want.

Parameters
aDataIdidentifies which object you want the address of.
Returns
void* - and must be cast into the know type.

Definition at line 462 of file pcbnew.cpp.

◆ IsWxPythonLoaded()

bool IsWxPythonLoaded ( )

Definition at line 67 of file python_scripting.cpp.

68 {
69  return wxPythonLoaded;
70 }
static bool wxPythonLoaded

◆ Kiface()

KIFACE_I& Kiface ( )

Global KIFACE_I "get" accessor.

Definition at line 204 of file pcbnew.cpp.

204 { return kiface; }
return & kiface
Definition: pcbnew.cpp:212

References PCB::kiface().

Referenced by PCB::IFACE::CreateWindow().

◆ MY_API()

MY_API ( KIFACE )

◆ OnKifaceEnd()

void kiface::OnKifaceEnd ( )
override

◆ OnKifaceStart()

bool kiface::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
override

◆ PythonPluginsReloadBase()

void PythonPluginsReloadBase ( )

Helper function PythonPluginsReloadBase Reload Python plugins if they are newer than the already loaded, and load new plugins if any It calls the LoadPlugins(bundlepath) Python method see kicadplugins.i.

Definition at line 304 of file pcbnew.cpp.

305 {
306 #if defined(KICAD_SCRIPTING)
307  //Reload plugin list: reload Python plugins if they are newer than
308  // the already loaded, and load new plugins
309  char cmd[1024];
310 
311  snprintf( cmd, sizeof(cmd),
312  "pcbnew.LoadPlugins(\"%s\")", TO_UTF8( PyScriptingPath() ) );
313 
314  PyLOCK lock;
315 
316  // ReRun the Python method pcbnew.LoadPlugins
317  // (already called when starting Pcbnew)
318  PyRun_SimpleString( cmd );
319 #endif
320 }
#define TO_UTF8(wxstring)
Macro TO_UTF8 converts a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition: macros.h:47
wxString PyScriptingPath()
Find the Python scripting path.

References PyScriptingPath(), and TO_UTF8.

Referenced by PCB_EDIT_FRAME::PythonPluginsReload().

Variable Documentation

◆ aKiwayVersion

int aKiwayVersion

Definition at line 209 of file pcbnew.cpp.

◆ aProgram

int PGM_BASE* aProgram
Initial value:
{
static PGM_BASE * process
Definition: pcbnew.cpp:201
int PGM_BASE * aProgram
Definition: pcbnew.cpp:210

Definition at line 210 of file pcbnew.cpp.

Referenced by KIGFX::SHADER::programInfo().

◆ g_Alternate_Track_Posture

bool g_Alternate_Track_Posture = false

Definition at line 73 of file pcbnew.cpp.

Referenced by ComputeBreakPoint(), and PCB_EDIT_FRAME::Process_Special_Functions().

◆ g_CurrentTrackList

◆ g_DocModulesFileName

wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" )

Definition at line 83 of file pcbnew.cpp.

Referenced by PCB_EDIT_FRAME::Process_Special_Functions().

◆ g_Offset_Module

◆ g_Raccord_45_Auto

bool g_Raccord_45_Auto = true

Definition at line 74 of file pcbnew.cpp.

Referenced by PCB_EDIT_FRAME::Begin_Route().

◆ g_Route_Layer_BOTTOM

PCB_LAYER_ID g_Route_Layer_BOTTOM

◆ g_Route_Layer_TOP

PCB_LAYER_ID g_Route_Layer_TOP

◆ GFootprintList

FOOTPRINT_LIST_IMPL GFootprintList

The global footprint info table.

This is performance-intensive to build so we keep a hash-stamped global version. Any deviation from the request vs. stored hash will result in it being rebuilt.

Definition at line 331 of file pcbnew.cpp.

Referenced by FP_TREE_MODEL_ADAPTER::getFootprints(), PCB::IFACE::IfaceOrAddress(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ GFootprintTable

FP_LIB_TABLE GFootprintTable

The global footprint library table.

This is not dynamically allocated because in a multiple project environment we must keep its address constant (since it is the fallback table for multiple projects).

Definition at line 326 of file pcbnew.cpp.

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), FOOTPRINT_TREE_PANE::FOOTPRINT_TREE_PANE(), FP_TREE_SYNCHRONIZING_ADAPTER::GetLibrariesCount(), PCB::IFACE::IfaceOrAddress(), InvokePcbLibTableEditor(), PCB::IFACE::OnKifaceStart(), PROJECT::PcbFootprintLibs(), and DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG::TransferDataFromWindow().

◆ kiface

◆ process

PGM_BASE* process
static

Definition at line 201 of file pcbnew.cpp.