KiCad PCB EDA Suite
CV::IFACE Struct Reference
Inheritance diagram for CV::IFACE:
KIFACE_BASE KIFACE

Public Member Functions

 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 !!!!!!!!!!!!!! This code is obsolete because of the merge into Pcbnew, don't bother with it. More...
 
void OnKifaceEnd () override
 Called just once just before the DSO is to be unloaded. More...
 
wxWindow * CreateWindow (wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
 Create a wxWindow for the current project. More...
 
void * IfaceOrAddress (int aDataId) override
 Return a pointer to the requested object. More...
 
const wxString Name ()
 
APP_SETTINGS_BASEKifaceSettings () const
 
void InitSettings (APP_SETTINGS_BASE *aSettings)
 
int StartFlags () const
 Return whatever was passed as aCtlBits to OnKifaceStart(). More...
 
bool IsSingle () const
 Is this KIFACE running under single_top? More...
 
const wxString & GetHelpFileName () const
 Return just the basename portion of the current help file. More...
 
SEARCH_STACKKifaceSearch ()
 Only for DSO specific 'non-library' files. More...
 
virtual void SaveFileAs (const wxString &srcProjectBasePath, const wxString &srcProjectName, const wxString &newProjectBasePath, const wxString &newProjectName, const wxString &srcFilePath, wxString &aErrors)
 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...
 

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 40 of file cvpcb.cpp.

Constructor & Destructor Documentation

◆ IFACE()

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

Definition at line 44 of file cvpcb.cpp.

44  :
45  KIFACE_BASE( aName, aType )
46  {}
KIFACE_BASE(const char *aKifaceName, KIWAY::FACE_T aId)
Definition: kiface_base.h:64

Member Function Documentation

◆ CreateWindow()

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

Create 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
the window created 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_BASE.

Definition at line 52 of file cvpcb.cpp.

54  {
55  switch( aClassId )
56  {
57  case FRAME_CVPCB: return new CVPCB_MAINFRAME( aKiway, aParent );
58  case FRAME_CVPCB_DISPLAY: return new DISPLAY_FOOTPRINTS_FRAME( aKiway, aParent );
59  default: return nullptr;
60  }
61  }
The CvPcb application main window.

References FRAME_CVPCB, and FRAME_CVPCB_DISPLAY.

◆ end_common()

void KIFACE_BASE::end_common ( )
protectedinherited

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

Definition at line 107 of file kiface_base.cpp.

108 {
109  m_bm.End();
110 }
BIN_MOD m_bm
Definition: kiface_base.h:118
void End()
Definition: bin_mod.cpp:50

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

Referenced by PCBCALC::IFACE::OnKifaceEnd(), KIFACE_BASE::OnKifaceEnd(), OnKifaceEnd(), PGE::IFACE::OnKifaceEnd(), GERBV::IFACE::OnKifaceEnd(), PCB::IFACE::OnKifaceEnd(), and SCH::IFACE::OnKifaceEnd().

◆ GetHelpFileName()

const wxString& KIFACE_BASE::GetHelpFileName ( ) const
inlineinherited

Return just the basename portion of the current help file.

Definition at line 109 of file kiface_base.h.

109 { return m_bm.m_help_file; }
BIN_MOD m_bm
Definition: kiface_base.h:118
wxString m_help_file
Definition: bin_mod.h:58

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

Referenced by EDA_BASE_FRAME::help_name().

◆ IfaceOrAddress()

void* CV::IFACE::IfaceOrAddress ( int  aDataId)
inlineoverridevirtual

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
the object requested and must be cast into the known type.

Implements KIFACE_BASE.

Definition at line 73 of file cvpcb.cpp.

74  {
75  switch( aDataId )
76  {
77  // Return a pointer to the global instance of the footprint list.
79  return (void*) &GFootprintList;
80 
81  // Return a new FP_LIB_TABLE with the global table installed as a fallback.
83  return (void*) new FP_LIB_TABLE( &GFootprintTable );
84 
85  // Return a pointer to the global instance of the global footprint table.
87  return (void*) &GFootprintTable;
88 
89  default:
90  return nullptr;
91  }
92  }
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
Return the global FP_LIB_TABLE.
Definition: kiface_ids.h:53
FOOTPRINT_LIST_IMPL GFootprintList
The global footprint info table.
Definition: cvpcb.cpp:140
Return a new FP_LIB_TABLE with the global table installed as a fallback.
Definition: kiface_ids.h:46
Return a pointer to the global instance of FOOTPRINT_LIST from pcbnew.
Definition: kiface_ids.h:39

References GFootprintList, GFootprintTable, KIFACE_FOOTPRINT_LIST, KIFACE_GLOBAL_FOOTPRINT_TABLE, and KIFACE_NEW_FOOTPRINT_TABLE.

◆ InitSettings()

void KIFACE_BASE::InitSettings ( APP_SETTINGS_BASE aSettings)
inlineinherited

Definition at line 94 of file kiface_base.h.

94 { m_bm.InitSettings( aSettings ); }
BIN_MOD m_bm
Definition: kiface_base.h:118
void InitSettings(APP_SETTINGS_BASE *aPtr)
Takes ownership of a new application settings object.
Definition: bin_mod.h:53

References BIN_MOD::InitSettings(), and KIFACE_BASE::m_bm.

Referenced by BMP2CMP::IFACE::CreateWindow(), PCBCALC::IFACE::OnKifaceStart(), OnKifaceStart(), PGE::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), and SCH::IFACE::OnKifaceStart().

◆ IsSingle()

◆ KifaceSearch()

SEARCH_STACK& KIFACE_BASE::KifaceSearch ( )
inlineinherited

Only for DSO specific 'non-library' files.

(The library search path is in the PROJECT class.)

Definition at line 113 of file kiface_base.h.

113 { return m_bm.m_search; }
BIN_MOD m_bm
Definition: kiface_base.h:118
SEARCH_STACK m_search
Definition: bin_mod.h:60

References KIFACE_BASE::m_bm, and BIN_MOD::m_search.

Referenced by CVPCB_MAINFRAME::buildEquivalenceList(), DS_DATA_MODEL::ResolvePath(), and EDA_BASE_FRAME::sys_search().

◆ KifaceSettings()

◆ Name()

const wxString KIFACE_BASE::Name ( )
inlineinherited

Definition at line 87 of file kiface_base.h.

88  {
89  return wxString::FromUTF8( m_bm.m_name );
90  }
BIN_MOD m_bm
Definition: kiface_base.h:118
const char * m_name
name of this binary module, static C string.
Definition: bin_mod.h:55

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

◆ OnKifaceEnd()

void IFACE::OnKifaceEnd ( )
overridevirtual

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.

Reimplemented from KIFACE_BASE.

Definition at line 197 of file cvpcb.cpp.

198 {
199  end_common();
200 }
void end_common()
Common things to do for a top program module, during OnKifaceEnd();.

References KIFACE_BASE::end_common().

◆ OnKifaceStart()

bool IFACE::OnKifaceStart ( PGM_BASE aProgram,
int  aCtlBits 
)
overridevirtual

!!!!!!!!!!!!!! This code is obsolete because of the merge into Pcbnew, don't bother with it.

Implements KIFACE_BASE.

Definition at line 148 of file cvpcb.cpp.

149 {
150  // This is process level, not project level, initialization of the DSO.
151 
152  // Do nothing in here pertinent to a project!
153 
156 
157  start_common( aCtlBits );
158 
159  /* Now that there are no *.mod files in the standard library, this function
160  has no utility. User should simply set the variable manually.
161  Looking for *.mod files which do not exist is fruitless.
162 
163  // SetFootprintLibTablePath();
164  */
165 
166  try
167  {
168  // The global table is not related to a specific project. All projects
169  // will use the same global table. So the KIFACE::OnKifaceStart() contract
170  // of avoiding anything project specific is not violated here.
171 
173  {
174  DisplayInfoMessage( nullptr, _( "You have run CvPcb for the first time using the "
175  "new footprint library table method for finding "
176  "footprints.\nCvPcb has either copied the default "
177  "table or created an empty table in your home "
178  "folder.\nYou must first configure the library "
179  "table to include all footprint libraries not "
180  "included with KiCad.\nSee the \"Footprint Library "
181  "Table\" section of the CvPcb documentation for "
182  "more information." ) );
183  }
184  }
185  catch( const IO_ERROR& ioe )
186  {
187  DisplayErrorMessage( nullptr, _( "An error occurred attempting to load the global "
188  "footprint library table." ),
189  ioe.What() );
190  return false;
191  }
192 
193  return true;
194 }
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:129
FP_LIB_TABLE GFootprintTable
The global footprint library table.
Definition: cvpcb.cpp:134
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition: confirm.cpp:292
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Takes ownership of the pointer passed in.
void InitSettings(APP_SETTINGS_BASE *aSettings)
Definition: kiface_base.h:94
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:30
static bool LoadGlobalTable(FP_LIB_TABLE &aTable)
Load the global footprint library table into aTable.
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_base.cpp:97
#define _(s)
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:92
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
Definition: confirm.cpp:307
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
int PGM_BASE * aProgram
Definition: cvpcb.cpp:110

References _, aProgram, DisplayErrorMessage(), DisplayInfoMessage(), PGM_BASE::GetSettingsManager(), GFootprintTable, KIFACE_BASE::InitSettings(), KIFACE_BASE::KifaceSettings(), FP_LIB_TABLE::LoadGlobalTable(), SETTINGS_MANAGER::RegisterSettings(), KIFACE_BASE::start_common(), and IO_ERROR::What().

◆ SaveFileAs()

virtual void KIFACE::SaveFileAs ( const wxString &  srcProjectBasePath,
const wxString &  srcProjectName,
const wxString &  newProjectBasePath,
const wxString &  newProjectName,
const wxString &  srcFilePath,
wxString &  aErrors 
)
inlinevirtualinherited

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).

Reimplemented in SCH::IFACE, PCB::IFACE, GERBV::IFACE, and PGE::IFACE.

Definition at line 208 of file kiway.h.

214  {
215  // If a KIFACE owns files then it needs to implement this....
216  }

Referenced by SAVE_AS_TRAVERSER::OnFile().

◆ start_common()

bool KIFACE_BASE::start_common ( int  aCtlBits)
protectedinherited

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

Definition at line 97 of file kiface_base.cpp.

98 {
99  m_start_flags = aCtlBits;
100  m_bm.Init();
102 
103  return true;
104 }
BIN_MOD m_bm
Definition: kiface_base.h:118
void Init()
Definition: bin_mod.cpp:38
static void setSearchPaths(SEARCH_STACK *aDst, KIWAY::FACE_T aId)
Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
Definition: kiface_base.cpp:33
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_base.h:120
SEARCH_STACK m_search
Definition: bin_mod.h:60
KIWAY::FACE_T m_id
Definition: kiface_base.h:116

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

Referenced by BMP2CMP::IFACE::OnKifaceStart(), PCBCALC::IFACE::OnKifaceStart(), IFACE::OnKifaceStart(), OnKifaceStart(), PGE::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), and SCH::IFACE::OnKifaceStart().

◆ StartFlags()

int KIFACE_BASE::StartFlags ( ) const
inlineinherited

Return whatever was passed as aCtlBits to OnKifaceStart().

Definition at line 99 of file kiface_base.h.

99 { return m_start_flags; }
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_base.h:120

References KIFACE_BASE::m_start_flags.


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