KiCad PCB EDA Suite
eeschema.cpp File Reference

the main file More...

#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
#include <eda_dde.h>
#include <schframe.h>
#include <libeditframe.h>
#include <viewlib_frame.h>
#include <eda_text.h>
#include <general.h>
#include <class_libentry.h>
#include <hotkeys.h>
#include <transform.h>
#include <wildcards_and_files_ext.h>
#include <symbol_lib_table.h>
#include "dialogs/dialog_global_sym_lib_table_config.h"
#include <kiway.h>
#include <sim/sim_plot_frame.h>

Go to the source code of this file.

Classes

struct  SCH::IFACE
 

Namespaces

 SCH
 

Macros

#define CLR(x, y, z)
 

Functions

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...
 
KIFACE_IKiface ()
 Global KIFACE_I "get" accessor. More...
 
 MY_API (KIFACE *) KIFACE_GETTER(int *aKIFACEversion
 
PGM_BASEPgm ()
 The global Program "get" accessor. More...
 
COLOR4D GetLayerColor (SCH_LAYER_ID aLayer)
 
void SetLayerColor (COLOR4D aColor, SCH_LAYER_ID aLayer)
 
static PARAM_CFG_ARRAYcfg_params ()
 

Variables

SCH_SHEETg_RootSheet = NULL
 
TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 )
 
static PGM_BASEprocess
 
int aKiwayVersion
 
int PGM_BASEaProgram
 
return & kiface
 
static COLOR4D s_layerColor [SCH_LAYER_ID_COUNT]
 

Detailed Description

the main file

Definition in file eeschema.cpp.

Macro Definition Documentation

#define CLR (   x,
  y,
 
)
Value:
ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ),\
static COLOR4D s_layerColor[SCH_LAYER_ID_COUNT]
Definition: eeschema.cpp:165
#define SCH_LAYER_INDEX(x)
Configuration parameter - SetColor Class.

Referenced by cfg_params().

Function Documentation

static PARAM_CFG_ARRAY& cfg_params ( )
static

Definition at line 182 of file eeschema.cpp.

References BLACK, BLUE, BROWN, CLR, CYAN, DARKGRAY, GREEN, LAYER_BRIGHTENED, LAYER_BUS, LAYER_DEVICE, LAYER_DEVICE_BACKGROUND, LAYER_ERC_ERR, LAYER_ERC_WARN, LAYER_FIELDS, LAYER_GLOBLABEL, LAYER_HIERLABEL, LAYER_JUNCTION, LAYER_LOCLABEL, LAYER_NETNAM, LAYER_NOCONNECT, LAYER_NOTES, LAYER_PIN, LAYER_PINNAM, LAYER_PINNUM, LAYER_REFERENCEPART, LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_GRID, LAYER_SHEET, LAYER_SHEETFILENAME, LAYER_SHEETLABEL, LAYER_SHEETNAME, LAYER_VALUEPART, LAYER_WIRE, LIGHTBLUE, LIGHTYELLOW, MAGENTA, PUREMAGENTA, RED, and WHITE.

Referenced by SCH::IFACE::OnKifaceEnd(), and SCH::IFACE::OnKifaceStart().

183 {
184  static PARAM_CFG_ARRAY ca;
185 
186  if( !ca.size() )
187  {
188  // These are KIFACE specific, they need to be loaded once when the
189  // eeschema KIFACE comes in.
190 
191 #define CLR(x, y, z)\
192  ca.push_back( new PARAM_CFG_SETCOLOR( true, wxT( x ),\
193  &s_layerColor[SCH_LAYER_INDEX( y )], z ) );
194 
195  CLR( "Color4DWireEx", LAYER_WIRE, COLOR4D( GREEN ) )
196  CLR( "Color4DBusEx", LAYER_BUS, COLOR4D( BLUE ) )
197  CLR( "Color4DConnEx", LAYER_JUNCTION, COLOR4D( GREEN ) )
198  CLR( "Color4DLLabelEx", LAYER_LOCLABEL, COLOR4D( BLACK ) )
199  CLR( "Color4DHLabelEx", LAYER_HIERLABEL, COLOR4D( BROWN ) )
200  CLR( "Color4DGLabelEx", LAYER_GLOBLABEL, COLOR4D( RED ) )
201  CLR( "Color4DPinNumEx", LAYER_PINNUM, COLOR4D( RED ) )
202  CLR( "Color4DPinNameEx", LAYER_PINNAM, COLOR4D( CYAN ) )
203  CLR( "Color4DFieldEx", LAYER_FIELDS, COLOR4D( MAGENTA ) )
204  CLR( "Color4DReferenceEx", LAYER_REFERENCEPART, COLOR4D( CYAN ) )
205  CLR( "Color4DValueEx", LAYER_VALUEPART, COLOR4D( CYAN ) )
206  CLR( "Color4DNoteEx", LAYER_NOTES, COLOR4D( LIGHTBLUE ) )
207  CLR( "Color4DBodyEx", LAYER_DEVICE, COLOR4D( RED ) )
208  CLR( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND, COLOR4D( LIGHTYELLOW ) )
209  CLR( "Color4DNetNameEx", LAYER_NETNAM, COLOR4D( DARKGRAY ) )
210  CLR( "Color4DPinEx", LAYER_PIN, COLOR4D( RED ) )
211  CLR( "Color4DSheetEx", LAYER_SHEET, COLOR4D( MAGENTA ) )
212  CLR( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME, COLOR4D( BROWN ) )
213  CLR( "Color4DSheetNameEx", LAYER_SHEETNAME, COLOR4D( CYAN ) )
214  CLR( "Color4DSheetLabelEx", LAYER_SHEETLABEL, COLOR4D( BROWN ) )
215  CLR( "Color4DNoConnectEx", LAYER_NOCONNECT, COLOR4D( BLUE ) )
216  CLR( "Color4DErcWEx", LAYER_ERC_WARN, COLOR4D( GREEN ) )
217  CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ) )
218  CLR( "Color4DGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
219  CLR( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
220  CLR( "Color4DBrighenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
221  }
222 
223  return ca;
224 }
Definition: colors.h:57
A list of parameters type.
Definition: colors.h:61
#define CLR(x, y, z)
Definition: colors.h:59
Definition: colors.h:60
Definition: colors.h:58
Definition: colors.h:49
Definition: colors.h:45
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62
wxWindow* kiface::CreateWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKiway,
int  aCtlBits = 0 
)
override

Definition at line 295 of file eeschema.cpp.

COLOR4D GetLayerColor ( SCH_LAYER_ID  aLayer)

Definition at line 167 of file eeschema.cpp.

References DIM, and SCH_LAYER_INDEX.

Referenced by WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls(), SCH_MARKER::Draw(), SCH_NO_CONNECT::Draw(), SCH_JUNCTION::Draw(), SCH_BUS_ENTRY_BASE::Draw(), SCH_LINE::Draw(), SCH_TEXT::Draw(), SCH_FIELD::Draw(), SCH_GLOBALLABEL::Draw(), SCH_HIERLABEL::Draw(), SCH_SHEET::Draw(), LIB_CIRCLE::drawGraphic(), LIB_POLYLINE::drawGraphic(), LIB_RECTANGLE::drawGraphic(), LIB_BEZIER::drawGraphic(), LIB_ARC::drawGraphic(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinSymbol(), LIB_PIN::DrawPinTexts(), DrawSegment(), SCH_LINE::GetDefaultColor(), LIB_FIELD::GetDefaultColor(), LIB_ITEM::GetDefaultColor(), SCH_BASE_FRAME::GetDrawBgColor(), SCH_LINE::GetLineColor(), LIB_VIEW_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSettings(), LIB_EDIT_FRAME::LoadSettings(), LIB_BEZIER::Plot(), LIB_CIRCLE::Plot(), SCH_JUNCTION::Plot(), LIB_RECTANGLE::Plot(), SCH_NO_CONNECT::Plot(), LIB_POLYLINE::Plot(), SCH_BUS_ENTRY_BASE::Plot(), LIB_ARC::Plot(), SCH_BITMAP::Plot(), SCH_LINE::Plot(), SCH_FIELD::Plot(), SCH_TEXT::Plot(), LIB_PART::Plot(), SCH_SHEET::Plot(), LIB_PART::PlotLibFields(), LIB_PIN::PlotPinTexts(), LIB_PIN::PlotSymbol(), and WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl().

168 {
169  unsigned layer = SCH_LAYER_INDEX( aLayer );
170  wxASSERT( layer < DIM( s_layerColor ) );
171  return s_layerColor[layer];
172 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
static COLOR4D s_layerColor[SCH_LAYER_ID_COUNT]
Definition: eeschema.cpp:165
#define SCH_LAYER_INDEX(x)
kiface::IFACE ( const char *  aName,
KIWAY::FACE_T  aType 
)

Definition at line 287 of file eeschema.cpp.

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 352 of file eeschema.cpp.

KIFACE_I& Kiface ( )

Global KIFACE_I "get" accessor.

Definition at line 146 of file eeschema.cpp.

References SCH::kiface().

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

146 { return kiface; }
return & kiface
Definition: eeschema.cpp:154
MY_API ( KIFACE )
void kiface::OnKifaceEnd ( )
override
bool kiface::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
override
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 158 of file eeschema.cpp.

References process.

159 {
160  wxASSERT( process ); // KIFACE_GETTER has already been called.
161  return *process;
162 }
static PGM_BASE * process
Definition: eeschema.cpp:143
void SetLayerColor ( COLOR4D  aColor,
SCH_LAYER_ID  aLayer 
)

Definition at line 174 of file eeschema.cpp.

References DIM, and SCH_LAYER_INDEX.

Referenced by SCH::IFACE::OnKifaceStart(), SCH_BASE_FRAME::SetDrawBgColor(), and WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl().

175 {
176  unsigned layer = SCH_LAYER_INDEX( aLayer );
177  wxASSERT( layer < DIM( s_layerColor ) );
178  s_layerColor[layer] = aColor;
179 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
static COLOR4D s_layerColor[SCH_LAYER_ID_COUNT]
Definition: eeschema.cpp:165
#define SCH_LAYER_INDEX(x)

Variable Documentation

int aKiwayVersion

Definition at line 151 of file eeschema.cpp.

int PGM_BASE* aProgram
Initial value:
{
int PGM_BASE * aProgram
Definition: eeschema.cpp:152
static PGM_BASE * process
Definition: eeschema.cpp:143

Definition at line 152 of file eeschema.cpp.

SCH_SHEET* g_RootSheet = NULL

Definition at line 55 of file eeschema.cpp.

Referenced by NETLIST_EXPORTER_GENERIC::addComponentFields(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::AppendSchematic(), SCH_EDIT_FRAME::backAnnotateFootprints(), SCH_EDIT_FRAME::BuildNetListBase(), SCH_SHEET_LIST::BuildSheetList(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_FIND_COLLECTOR::Collect(), 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_ERC::DisplayERC_MarkersList(), SCH_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), NETLIST_EXPORTER::findAllUnitsOfComponent(), SCH_EDIT_FRAME::FindComponentAndItem(), NETLIST_DIALOG::GenNetlist(), SCH_PRINTOUT::GetPageInfo(), GetRescueLibraryFileName(), SCH_PRINTOUT::HasPage(), HIERARCHY_NAVIG_DLG::HIERARCHY_NAVIG_DLG(), SCH_EDIT_FRAME::ImportFile(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), SCH_EDIT_FRAME::isAutoSaveRequired(), DIALOG_BOM_EDITOR::LoadComponents(), NETLIST_EXPORTER_GENERIC::makeComponents(), NETLIST_EXPORTER_GENERIC::makeDesignHeader(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnFindDrcMarker(), SCH_EDIT_FRAME::OnFindReplace(), SCH_EDIT_FRAME::OnFindSchematicItem(), DIALOG_ERC::OnLeftClickMarkersList(), NETLIST_DIALOG::OnNetlistTypeSelection(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbModuleEditor(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked(), SCH_EDIT_FRAME::OnPrint(), SCH_PRINTOUT::OnPrintPage(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), SCH_EDIT_FRAME::OnSaveProject(), SCH_EDIT_FRAME::OnUpdateHierarchySheet(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OnUpdateSave(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), NETLIST_EXPORTER_PSPICE::ProcessNetlist(), NETLIST_DIALOG::RunSimulator(), SCH_EDIT_FRAME::SaveProjectSettings(), SCH_SCREENS::SCH_SCREENS(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), DIALOG_ERC::TestErc(), SCH_SHEET_PATH::TestForRecursion(), SCH_SHEET_LIST::TestForRecursion(), NETLIST_EXPORTER_PSPICE::UpdateDirectives(), SCH_EDIT_FRAME::updateFindReplaceView(), WriteDiagnosticERC(), NETLIST_EXPORTER_ORCADPCB2::WriteNetlist(), NETLIST_EXPORTER_CADSTAR::WriteNetlist(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

return& kiface

Definition at line 154 of file eeschema.cpp.

PGM_BASE* process
static

Definition at line 143 of file eeschema.cpp.

Referenced by Pgm().

COLOR4D s_layerColor[SCH_LAYER_ID_COUNT]
static

Definition at line 165 of file eeschema.cpp.