KiCad PCB EDA Suite
SCH::IFACE Struct Reference
Inheritance diagram for SCH::IFACE:
KIFACE_I KIFACE

Public Member Functions

 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 Function OnKifaceStart is called just once shortly after the DSO is loaded. More...
 
void OnKifaceEnd () override
 Function OnKifaceEnd is called just once just before the DSO is to be unloaded. More...
 
wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
 Function CreateWindow creates a wxWindow for the current project. More...
 
void * IfaceOrAddress (int aDataId) override
 Function IfaceOrAddress return a pointer to the requested object. More...
 
const wxString Name ()
 
wxConfigBase * KifaceSettings () const
 
int StartFlags () const
 Function StartFlags returns whatever was passed as aCtlBits to OnKifaceStart() More...
 
bool IsSingle () const
 Function IsSingle is this KIFACE_I running under single_top? More...
 
const wxString & GetHelpFileName () const
 Function GetHelpFileName returns just the basename portion of the current help file. More...
 
wxFileHistory & GetFileHistory ()
 
SEARCH_STACKKifaceSearch ()
 Only for DSO specific 'non-library' files. More...
 

Protected Member Functions

bool start_common (int aCtlBits)
 Common things to do for a top program module, during OnKifaceStart(). More...
 
void end_common ()
 Common things to do for a top program module, during OnKifaceEnd();. More...
 

Detailed Description

Definition at line 64 of file eeschema.cpp.

Constructor & Destructor Documentation

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

Definition at line 68 of file eeschema.cpp.

References aProgram, OnKifaceEnd(), and OnKifaceStart().

68  :
69  KIFACE_I( aName, aType )
70  {}
KIFACE_I(const char *aKifaceName, KIWAY::FACE_T aId)
Constructor.
Definition: kiface_i.h:78

Member Function Documentation

wxWindow* SCH::IFACE::CreateWindow ( wxWindow *  aParent,
int  aClassId,
KIWAY aKIWAY,
int  aCtlBits = 0 
)
inlineoverridevirtual

Function CreateWindow creates a wxWindow for the current project.

The caller must cast the return value into the known type.

Parameters
aParentmay be NULL, or is otherwise the parent to connect under. If NULL then caller may want to connect the returned wxWindow into some hierarchy after this function returns.
aClassIdidentifies which wxFrame or wxDialog to retrieve, using a value known to the implementing KIFACE.
aKIWAYtells the window which KIWAY (and PROJECT) it is a participant in.
aCtlBitsconsists of bit flags from the set of KFCTL_* #defines above.
Returns
wxWindow* - and if not NULL, should be cast into the known type using and old school cast. dynamic_cast is problematic since it needs typeinfo probably not contained in the caller's link image.

Implements KIFACE_I.

Definition at line 76 of file eeschema.cpp.

References EDA_DRAW_FRAME::CreateServer(), DIALOG_SCH_LIBRARY_TABLE, FRAME_SCH, FRAME_SCH_LIB_EDITOR, FRAME_SCH_VIEWER, FRAME_SCH_VIEWER_MODAL, FRAME_SIMULATOR, InvokeSchEditSymbolLibTable(), KIFACE_I::IsSingle(), KICAD_SCH_PORT_SERVICE_NUMBER, and Kiface().

77  {
78  switch( aClassId )
79  {
80  case FRAME_SCH:
81  {
82  SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
83 
84  if( Kiface().IsSingle() )
85  {
86  // only run this under single_top, not under a project manager.
88  }
89  return frame;
90  }
91  break;
92 
94  {
95  LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway, aParent );
96  return frame;
97  }
98  break;
99 
100 #ifdef KICAD_SPICE
101  case FRAME_SIMULATOR:
102  {
103  SIM_PLOT_FRAME* frame = new SIM_PLOT_FRAME( aKiway, aParent );
104  return frame;
105  }
106  break;
107 #endif /* KICAD_SPICE */
108 
109  case FRAME_SCH_VIEWER:
111  {
112  LIB_VIEW_FRAME* frame = new LIB_VIEW_FRAME( aKiway, aParent, FRAME_T( aClassId ) );
113  return frame;
114  }
115  break;
116 
118  InvokeSchEditSymbolLibTable( aKiway, aParent );
119 
120  // Dialog has completed; nothing to return.
121  return nullptr;
122 
123  default:
124  return NULL;
125  }
126  }
FRAME_T
Enum FRAME_T is the set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
Definition: frame_type.h:34
void InvokeSchEditSymbolLibTable(KIWAY *aKiway, wxWindow *aParent)
Schematic editor (Eeschema) main window.
Symbol library viewer main window.
Definition: viewlib_frame.h:49
#define KICAD_SCH_PORT_SERVICE_NUMBER
Definition: eda_dde.h:42
Implementing SIM_PLOT_FRAME_BASE.
bool IsSingle() const
Function IsSingle is this KIFACE_I running under single_top?
Definition: kiface_i.h:115
The symbol library editor main window.
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: eeschema.cpp:153
void CreateServer(int service, bool local=true)
Definition: eda_dde.cpp:49
void KIFACE_I::end_common ( )
protectedinherited

Common things to do for a top program module, during OnKifaceEnd();.

Definition at line 100 of file kiface_i.cpp.

References BIN_MOD::End(), and KIFACE_I::m_bm.

Referenced by KIFACE_I::KIFACE_I(), KIFACE_I::OnKifaceEnd(), PGE::IFACE::OnKifaceEnd(), CV::IFACE::OnKifaceEnd(), and GERBV::IFACE::OnKifaceEnd().

101 {
102  m_bm.End();
103 }
BIN_MOD m_bm
Definition: kiface_i.h:132
void End()
Definition: bin_mod.cpp:56
wxFileHistory& KIFACE_I::GetFileHistory ( )
inlineinherited
const wxString& KIFACE_I::GetHelpFileName ( ) const
inlineinherited

Function GetHelpFileName returns just the basename portion of the current help file.

Definition at line 121 of file kiface_i.h.

References KIFACE_I::m_bm, and BIN_MOD::m_help_file.

Referenced by EDA_BASE_FRAME::help_name().

121 { return m_bm.m_help_file; }
BIN_MOD m_bm
Definition: kiface_i.h:132
wxString m_help_file
Definition: bin_mod.h:59
void* SCH::IFACE::IfaceOrAddress ( int  aDataId)
inlineoverridevirtual

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.

Implements KIFACE_I.

Definition at line 139 of file eeschema.cpp.

References KIWAY::FACE_SCH, and SCH::kiface().

140  {
141  return NULL;
142  }
bool KIFACE_I::IsSingle ( ) const
inlineinherited

Function IsSingle is this KIFACE_I running under single_top?

Definition at line 115 of file kiface_i.h.

References KFCTL_STANDALONE, and KIFACE_I::m_start_flags.

Referenced by CreateWindow(), PCB::IFACE::CreateWindow(), SCH_EDIT_FRAME::OnOpenPcbnew(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), and SCH_EDIT_FRAME::SendMessageToPCBNEW().

115 { return m_start_flags & KFCTL_STANDALONE; }
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_i.h:134
#define KFCTL_STANDALONE
Am running as a standalone Top.
Definition: kiway.h:159
SEARCH_STACK& KIFACE_I::KifaceSearch ( )
inlineinherited
wxConfigBase* KIFACE_I::KifaceSettings ( ) const
inlineinherited

Definition at line 103 of file kiface_i.h.

References KIFACE_I::m_bm, and BIN_MOD::m_config.

Referenced by AUTOPLACER::AUTOPLACER(), PCB_EDIT_FRAME::Begin_Zone(), EDA_BASE_FRAME::config(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GENDRILL::DIALOG_GENDRILL(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC(), DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), FOOTPRINT_EDIT_FRAME::Export_Module(), FOOTPRINT_EDIT_FRAME::Import_Module(), DIALOG_GEN_FOOTPRINT_POSITION::initDialog(), DIALOG_ANNOTATE::InitValues(), EDA_DRAW_FRAME::LoadCanvasTypeSetting(), NETLIST_DIALOG::NETLIST_DIALOG(), LAYERS_MAP_DIALOG::OnGetSetup(), OnKifaceEnd(), OnKifaceStart(), LAYERS_MAP_DIALOG::OnStoreSetup(), SCH_EDIT_FRAME::OpenProjectFiles(), EDA_DRAW_FRAME::saveCanvasTypeSetting(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow(), and EDA_DRAW_PANEL::~EDA_DRAW_PANEL().

103 { return m_bm.m_config; }
BIN_MOD m_bm
Definition: kiface_i.h:132
wxConfigBase * m_config
maybe from $HOME/.${m_name}
Definition: bin_mod.h:57
const wxString KIFACE_I::Name ( )
inlineinherited

Definition at line 101 of file kiface_i.h.

References KIFACE_I::m_bm, and BIN_MOD::m_name.

101 { return wxString::FromUTF8( m_bm.m_name ); }
BIN_MOD m_bm
Definition: kiface_i.h:132
const char * m_name
name of this binary module, static C string.
Definition: bin_mod.h:55
void IFACE::OnKifaceEnd ( )
overridevirtual

Function OnKifaceEnd is called just once just before the DSO is to be unloaded.

It is called before static C++ destructors are called. A default implementation is supplied.

Implements KIFACE.

Definition at line 297 of file eeschema.cpp.

References cfg_params(), KIFACE_I::KifaceSettings(), and wxConfigSaveSetups().

Referenced by IFACE().

298 {
300  end_common();
301 }
void end_common()
Common things to do for a top program module, during OnKifaceEnd();.
Definition: kiface_i.cpp:100
static PARAM_CFG_ARRAY & cfg_params()
Definition: eeschema.cpp:195
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
bool IFACE::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
overridevirtual

Function OnKifaceStart is called just once shortly after the DSO is loaded.

It is the second function called, immediately after the KIFACE_GETTER(). However before either of those, static C++ constructors are called. The DSO implementation should do process level initialization here, not project specific since there will be multiple projects open eventually.

Parameters
aProgramis the process block: PGM_BASE*
aCtlBitsconsists of bit flags from the set of KFCTL_* #defines above.
Returns
bool - true if DSO initialized OK, false if not. When returning false, the loader may optionally decide to terminate the process or not, but will not put out any UI because that is the duty of this function to say why it is returning false. Never return false without having reported to the UI why.

Implements KIFACE_I.

Definition at line 240 of file eeschema.cpp.

References cfg_params(), DARKGRAY, DisplayErrorMessage(), g_Eeschema_Hokeys_Descr, SYMBOL_LIB_TABLE::GetGlobalLibTable(), SYMBOL_LIB_TABLE::GetGlobalTableFileName(), KIFACE_I::KifaceSettings(), LAYER_SCHEMATIC_BACKGROUND, SYMBOL_LIB_TABLE::LoadGlobalTable(), ReadHotkeyConfig(), SCH_EDIT_FRAME_NAME, SCH_LAYER_ID_END, SCH_LAYER_ID_START, SetLayerColor(), KIFACE_I::start_common(), IO_ERROR::What(), WHITE, and wxConfigLoadSetups().

Referenced by IFACE().

241 {
242  // This is process level, not project level, initialization of the DSO.
243 
244  // Do nothing in here pertinent to a project!
245 
246  start_common( aCtlBits );
247 
248  // Give a default colour for all layers
249  // (actual color will be initialized by config)
250  for( SCH_LAYER_ID ii = SCH_LAYER_ID_START; ii < SCH_LAYER_ID_END; ++ii )
251  SetLayerColor( COLOR4D( DARKGRAY ), ii );
252 
254 
255  // Must be called before creating the main frame in order to
256  // display the real hotkeys in menus or tool tips
258 
260 
262 
263  if( !fn.FileExists() )
264  {
265  DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG fpDialog( NULL );
266 
267  fpDialog.ShowModal();
268  }
269  else
270  {
271  try
272  {
273  // The global table is not related to a specific project. All projects
274  // will use the same global table. So the KIFACE::OnKifaceStart() contract
275  // of avoiding anything project specific is not violated here.
277  return false;
278  }
279  catch( const IO_ERROR& ioe )
280  {
281  // if we are here, a incorrect global symbol library table was found.
282  // Incorrect global symbol library table is not a fatal error:
283  // the user just has to edit the (partially) loaded table.
284  wxString msg = _(
285  "An error occurred attempting to load the global symbol library table.\n"
286  "Please edit this global symbol library table in Preferences menu."
287  );
288 
289  DisplayErrorMessage( NULL, msg, ioe.What() );
290  }
291  }
292 
293  return true;
294 }
static SYMBOL_LIB_TABLE & GetGlobalLibTable()
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_i.cpp:90
void SetLayerColor(COLOR4D aColor, SCH_LAYER_ID aLayer)
Definition: eeschema.cpp:181
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Function DisplayErrorMessage displays an error message with aMessage.
Definition: confirm.cpp:247
#define SCH_EDIT_FRAME_NAME
Definition: draw_frame.h:50
static bool LoadGlobalTable(SYMBOL_LIB_TABLE &aTable)
Load the global symbol library table into aTable.
static PARAM_CFG_ARRAY & cfg_params()
Definition: eeschema.cpp:195
struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[]
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
SCH_LAYER_ID
Eeschema drawing layers.
int ReadHotkeyConfig(const wxString &aAppname, struct EDA_HOTKEY_CONFIG *aDescList)
Function ReadHotkeyConfig Read configuration data and fill the current hotkey list with hotkeys...
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
Definition: colors.h:49
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:76
static wxString GetGlobalTableFileName()
Fetch the global symbol library table file name.
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
bool KIFACE_I::start_common ( int  aCtlBits)
protectedinherited

Common things to do for a top program module, during OnKifaceStart().

Definition at line 90 of file kiface_i.cpp.

References BIN_MOD::Init(), KIFACE_I::m_bm, KIFACE_I::m_id, BIN_MOD::m_search, KIFACE_I::m_start_flags, and setSearchPaths().

Referenced by KIFACE_I::KIFACE_I(), PGE::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), CV::IFACE::OnKifaceStart(), OnKifaceStart(), and PCB::IFACE::OnKifaceStart().

91 {
92  m_start_flags = aCtlBits;
93  m_bm.Init();
95 
96  return true;
97 }
KIWAY::FACE_T m_id
Definition: kiface_i.h:130
void Init()
Definition: bin_mod.cpp:36
BIN_MOD m_bm
Definition: kiface_i.h:132
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_i.h:134
SEARCH_STACK m_search
Definition: bin_mod.h:61
static void setSearchPaths(SEARCH_STACK *aDst, KIWAY::FACE_T aId)
Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
Definition: kiface_i.cpp:38
int KIFACE_I::StartFlags ( ) const
inlineinherited

Function StartFlags returns whatever was passed as aCtlBits to OnKifaceStart()

Definition at line 109 of file kiface_i.h.

References KIFACE_I::m_start_flags.

109 { return m_start_flags; }
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_i.h:134

The documentation for this struct was generated from the following file: