KiCad PCB EDA Suite
eeschema/eeschema.cpp File Reference
#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <confirm.h>
#include <gestfich.h>
#include <eda_dde.h>
#include <eeschema_settings.h>
#include <sch_edit_frame.h>
#include <lib_edit_frame.h>
#include <lib_view_frame.h>
#include <general.h>
#include <class_libentry.h>
#include <transform.h>
#include <symbol_lib_table.h>
#include <dialogs/dialog_global_sym_lib_table_config.h>
#include <dialogs/panel_sym_lib_table.h>
#include <kiway.h>
#include <sim/sim_plot_frame.h>
#include <settings/settings_manager.h>
#include <sexpr/sexpr.h>
#include <sexpr/sexpr_parser.h>

Go to the source code of this file.


struct  SCH::IFACE




SCH::IFACE KIFACE_I SCH::kiface ("eeschema", KIWAY::FACE_SCH)
 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...
void SaveFileAs (const wxString &aProjectBasePath, const wxString &aProjectName, const wxString &aNewProjectBasePath, const wxString &aNewProjectName, const wxString &aSrcFilePath, wxString &aErrors) override
 Function SaveFileAs Saving a file under a different name is delegated to the various KIFACEs because the project doesn't know the internal format of the various files (which may have paths in them that need updating). More...
KIFACE_IKiface ()
 Global KIFACE_I "get" accessor. More...
 The global Program "get" accessor. More...
static void traverseSEXPR (SEXPR::SEXPR *aNode, const std::function< void(SEXPR::SEXPR *)> &aVisitor)


TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 )
static PGM_BASEprocess
int aKiwayVersion
int PGM_BASEaProgram
return & kiface

Function Documentation

◆ CreateWindow()

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

Definition at line 248 of file eeschema/eeschema.cpp.

261  {
262  if( destFile.GetName() == aProjectName )
263  destFile.SetName( aNewProjectName );
265  // Sheet paths when auto-generated are relative to the root, so those will stay
266  // pointing to whatever they were pointing at.
267  // The author can create their own absolute and relative sheet paths. Absolute
268  // sheet paths aren't an issue, and relative ones will continue to work as long
269  // as the author didn't include any '..'s. If they did, it's still not clear
270  // whether they should be adjusted or not (as the author may be duplicating an
271  // entire tree with several projects within it), so we leave this as an exercise
272  // to the author.
274  CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
275  }
276  else if( ext == "sym" )
277  {
278  // Symbols are not project-specific. Keep their source names.
279  CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
280  }
281  else if( ext == "lib" )
282  {
283  if( destFile.GetName() == aProjectName )
284  destFile.SetName( aNewProjectName );
285  else if( destFile.GetName() == aProjectName + "-cache" )
286  destFile.SetName( aNewProjectName + "-cache" );
287  else if( destFile.GetName() == aProjectName + "-rescue" )
288  destFile.SetName( aNewProjectName + "-rescue" );
290  CopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
291  }
292  else if( ext == "net" )
293  {
void CopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Function CopyFile.
Definition: gestfich.cpp:363

References CopyFile().


kiface::IFACE ( const char *  aName,

Definition at line 240 of file eeschema/eeschema.cpp.

240 {
241  wxFileName destFile( aSrcFilePath );
242  wxString destPath = destFile.GetPathWithSep();

◆ IfaceOrAddress()

void* kiface::IfaceOrAddress ( int  aDataId)

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.

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

Definition at line 303 of file eeschema/eeschema.cpp.

305  {
306  if( node->IsList() && node->GetNumberOfChildren() > 1

◆ Kiface()

KIFACE_I& Kiface ( )

Global KIFACE_I "get" accessor.

Definition at line 148 of file eeschema/eeschema.cpp.

148 { return kiface; }
return & kiface

References SCH::kiface().

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

◆ MY_API()


◆ OnKifaceEnd()

void kiface::OnKifaceEnd ( )

Definition at line 47 of file mocks_eeschema.cpp.

51  {

◆ OnKifaceStart()

bool kiface::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 

Definition at line 40 of file common_mocks.cpp.

40 {
41  static PGM_TEST_FRAME program;
42  return program;
43 }

◆ Pgm()

PGM_BASE& Pgm ( )

The global Program "get" accessor.

Implemented in: 1) common/single_top.cpp, 2) kicad/kicad.cpp, and 3) scripting/kiway.i

Definition at line 160 of file eeschema/eeschema.cpp.

161 {
162  wxASSERT( process ); // KIFACE_GETTER has already been called.
163  return *process;
164 }
static PGM_BASE * process

References process.

Referenced by SCH::IFACE::OnKifaceEnd().

◆ SaveFileAs()

void kiface::SaveFileAs ( const wxString &  aProjectBasePath,
const wxString &  aProjectName,
const wxString &  aNewProjectBasePath,
const wxString &  aNewProjectName,
const wxString &  aSrcFilePath,
wxString &  aErrors 

Function SaveFileAs Saving a file under a different name is delegated to the various KIFACEs because the project doesn't know the internal format of the various files (which may have paths in them that need updating).

◆ traverseSEXPR()

static void traverseSEXPR ( SEXPR::SEXPR aNode,
const std::function< void(SEXPR::SEXPR *)> &  aVisitor 

Definition at line 224 of file eeschema/eeschema.cpp.

226 {
227  aVisitor( aNode );
229  if( aNode->IsList() )
230  {
231  for( unsigned i = 0; i < aNode->GetNumberOfChildren(); i++ )
232  traverseSEXPR( aNode->GetChild( i ), aVisitor );
233  }
234 }
bool IsList() const
Definition: sexpr.h:54
SEXPR * GetChild(size_t aIndex) const
Definition: sexpr.cpp:47
static void traverseSEXPR(SEXPR::SEXPR *aNode, const std::function< void(SEXPR::SEXPR *)> &aVisitor)
size_t GetNumberOfChildren() const
Definition: sexpr.cpp:69

References SEXPR::SEXPR::GetChild(), SEXPR::SEXPR::GetNumberOfChildren(), and SEXPR::SEXPR::IsList().

Variable Documentation

◆ aKiwayVersion

int aKiwayVersion

Definition at line 153 of file eeschema/eeschema.cpp.

◆ aProgram

int PGM_BASE* aProgram
Initial value:
int PGM_BASE * aProgram
static PGM_BASE * process

Definition at line 154 of file eeschema/eeschema.cpp.

Referenced by SCH::IFACE::OnKifaceStart().

◆ DefaultTransform

◆ g_RootSheet

SCH_SHEET* g_RootSheet = NULL

Definition at line 49 of file eeschema/eeschema.cpp.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDITOR_CONTROL::BackAnnotateFootprints(), BACK_ANNOTATE::BackAnnotateSymbols(), SCH_SCREENS::BuildClientSheetPathList(), CONNECTION_GRAPH::buildConnectionGraph(), SCH_EDIT_FRAME::BuildNetListBase(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_EDIT_FRAME::CheckSheetForRecursion(), SCH_SCREENS::ClearAnnotationOfNewSheetPaths(), SCH_EDIT_FRAME::CreateArchiveLibraryCacheFile(), DIALOG_PLOT_SCHEMATIC::CreateDXFFile(), DIALOG_PLOT_SCHEMATIC::createHPGLFile(), SCH_EDIT_FRAME::CreateNetlist(), DIALOG_PLOT_SCHEMATIC::createPDFFile(), DIALOG_PLOT_SCHEMATIC::createPSFile(), SCH_EDIT_FRAME::CreateScreens(), DIALOG_PLOT_SCHEMATIC::createSVGFile(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_TOOL::Duplicate(), NETLIST_EXPORTER::findAllUnitsOfComponent(), SCH_EDITOR_CONTROL::FindComponentAndItem(), SCH_EDITOR_CONTROL::FindNext(), SCH_EDIT_FRAME::FixupJunctions(), SCH_BASE_FRAME::FocusOnItem(), SCH_SCREEN::GetBusAlias(), SHEETLIST_ERC_ITEMS_PROVIDER::GetCount(), SCH_PRINTOUT::GetPageInfo(), GetRescueLibraryFileName(), SCH_PRINTOUT::HasPage(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), SCH_EDIT_FRAME::importFile(), SCH_DRAWING_TOOLS::Init(), EE_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_EDIT_FRAME::isAutoSaveRequired(), SCH_SCREEN::IsBusAlias(), SCH_EDIT_FRAME::IsContentModified(), SCH_EDIT_FRAME::KiwayMailIn(), SCH_EDITOR_CONTROL::LeaveSheet(), SCH_LEGACY_PLUGIN::LoadContent(), SCH_EDIT_FRAME::LoadSheetFromFile(), NETLIST_EXPORTER_GENERIC::makeComponents(), NETLIST_EXPORTER_GENERIC::makeDesignHeader(), mapExistingAnnotation(), DIALOG_SCH_IMPORT_SETTINGS::OnBrowseClicked(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_ERC::OnERCItemSelected(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), SCH_PRINTOUT::OnPrintPage(), DIALOG_BOM::OnRunGenerator(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Print(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), SCH_EDIT_TOOL::Properties(), SCH_EDIT_FRAME::RecalculateConnections(), SCH_EDIT_FRAME::ReCreateMenuBar(), SCH_EDITOR_CONTROL::ReplaceAll(), SCH_EDIT_FRAME::SaveProject(), SCH_EDIT_FRAME::SaveProjectSettings(), SCH_SCREENS::SCH_SCREENS(), SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), DIALOG_ERC::TestErc(), SCH_SHEET_PATH::TestForRecursion(), SCH_SHEET_LIST::TestForRecursion(), DIALOG_PRINT_USING_PRINTER::TransferDataFromWindow(), DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_BUS_MANAGER::TransferDataToWindow(), NETLIST_EXPORTER_PSPICE::UpdateDirectives(), HIERARCHY_NAVIG_DLG::UpdateHierarchyTree(), SCH_SCREENS::UpdateSymbolLinks(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), DIALOG_ERC::writeReport(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ kiface

return& kiface

Definition at line 156 of file eeschema/eeschema.cpp.

◆ process

PGM_BASE* process

Definition at line 145 of file eeschema/eeschema.cpp.

Referenced by Pgm().