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

Public Member Functions

 IFACE (const char *aName, KIWAY::FACE_T aType)
 
bool OnKifaceStart (PGM_BASE *aProgram, int aCtlBits) override
 Typically start_common() is called from here. 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
 Function IfaceOrAddress return a pointer to the requested object. More...
 
void SaveFileAs (const wxString &aProjectBasePath, const wxString &aSrcProjectName, 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...
 
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_I 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...
 

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 pl_editor.cpp.

Constructor & Destructor Documentation

◆ IFACE()

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

Definition at line 44 of file pl_editor.cpp.

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

Member Function Documentation

◆ CreateWindow()

wxWindow* PGE::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_I.

Definition at line 52 of file pl_editor.cpp.

53  {
54  switch( aClassId )
55  {
56  case FRAME_PL_EDITOR:
57  {
58  PL_EDITOR_FRAME* frame = new PL_EDITOR_FRAME( aKiway, aParent );
59  return frame;
60  }
61  break;
62 
63  default:
64  ;
65  }
66 
67  return NULL;
68  }
PL_EDITOR_FRAME is the main window used in the drawing sheet editor.
#define NULL

References FRAME_PL_EDITOR, and NULL.

◆ end_common()

void KIFACE_I::end_common ( )
protectedinherited

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

Definition at line 94 of file kiface_i.cpp.

95 {
96  m_bm.End();
97 }
BIN_MOD m_bm
Definition: kiface_i.h:118
void End()
Definition: bin_mod.cpp:50

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

Referenced by KIFACE_I::OnKifaceEnd(), PCBCALC::IFACE::OnKifaceEnd(), OnKifaceEnd(), CV::IFACE::OnKifaceEnd(), GERBV::IFACE::OnKifaceEnd(), PCB::IFACE::OnKifaceEnd(), and SCH::IFACE::OnKifaceEnd().

◆ GetHelpFileName()

const wxString& KIFACE_I::GetHelpFileName ( ) const
inlineinherited

Return just the basename portion of the current help file.

Definition at line 109 of file kiface_i.h.

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

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

Referenced by EDA_BASE_FRAME::help_name().

◆ IfaceOrAddress()

void* PGE::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 81 of file pl_editor.cpp.

82  {
83  return NULL;
84  }
#define NULL

References NULL.

◆ InitSettings()

void KIFACE_I::InitSettings ( APP_SETTINGS_BASE aSettings)
inlineinherited

Definition at line 94 of file kiface_i.h.

94 { m_bm.InitSettings( aSettings ); }
BIN_MOD m_bm
Definition: kiface_i.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_I::m_bm.

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

◆ IsSingle()

◆ KifaceSearch()

SEARCH_STACK& KIFACE_I::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_i.h.

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

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

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

◆ KifaceSettings()

◆ Name()

const wxString KIFACE_I::Name ( )
inlineinherited

Definition at line 87 of file kiface_i.h.

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

References KIFACE_I::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_I.

Definition at line 138 of file pl_editor.cpp.

139 {
140  end_common();
141 }
void end_common()
Common things to do for a top program module, during OnKifaceEnd();.
Definition: kiface_i.cpp:94

References KIFACE_I::end_common().

◆ OnKifaceStart()

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

Typically start_common() is called from here.

Implements KIFACE_I.

Definition at line 129 of file pl_editor.cpp.

130 {
133  start_common( aCtlBits );
134  return true;
135 }
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition: pgm_base.h:166
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_i.cpp:84
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_i.h:92
int PGM_BASE * aProgram
Definition: pl_editor.cpp:110
JSON_SETTINGS * RegisterSettings(JSON_SETTINGS *aSettings, bool aLoadNow=true)
Takes ownership of the pointer passed in.
void InitSettings(APP_SETTINGS_BASE *aSettings)
Definition: kiface_i.h:94

References aProgram, PGM_BASE::GetSettingsManager(), KIFACE_I::InitSettings(), KIFACE_I::KifaceSettings(), SETTINGS_MANAGER::RegisterSettings(), and KIFACE_I::start_common().

◆ SaveFileAs()

void IFACE::SaveFileAs ( const wxString &  aProjectBasePath,
const wxString &  aSrcProjectName,
const wxString &  aNewProjectBasePath,
const wxString &  aNewProjectName,
const wxString &  aSrcFilePath,
wxString &  aErrors 
)
overridevirtual

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

Reimplemented from KIFACE.

Definition at line 144 of file pl_editor.cpp.

147 {
148  wxFileName destFile( aSrcFilePath );
149  wxString destPath = destFile.GetPathWithSep();
150  wxUniChar pathSep = wxFileName::GetPathSeparator();
151  wxString ext = destFile.GetExt();
152 
153  if( destPath.StartsWith( aProjectBasePath + pathSep ) )
154  {
155  destPath.Replace( aProjectBasePath, aNewProjectBasePath, false );
156  destFile.SetPath( destPath );
157  }
158 
159  if( ext == "kicad_wks" )
160  {
161  if( destFile.GetName() == aSrcProjectName )
162  destFile.SetName( aNewProjectName );
163 
164  KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
165  }
166  else
167  {
168  wxFAIL_MSG( "Unexpected filetype for Pcbnew::SaveFileAs()" );
169  }
170 }
void KiCopyFile(const wxString &aSrcPath, const wxString &aDestPath, wxString &aErrors)
Definition: gestfich.cpp:363

◆ start_common()

bool KIFACE_I::start_common ( int  aCtlBits)
protectedinherited

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

Definition at line 84 of file kiface_i.cpp.

85 {
86  m_start_flags = aCtlBits;
87  m_bm.Init();
89 
90  return true;
91 }
KIWAY::FACE_T m_id
Definition: kiface_i.h:116
void Init()
Definition: bin_mod.cpp:38
BIN_MOD m_bm
Definition: kiface_i.h:118
int m_start_flags
flags provided in OnKifaceStart()
Definition: kiface_i.h:120
SEARCH_STACK m_search
Definition: bin_mod.h:60
static void setSearchPaths(SEARCH_STACK *aDst, KIWAY::FACE_T aId)
Initialize aDst SEARCH_STACK with KIFACE (DSO) specific settings.
Definition: kiface_i.cpp:33

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 BMP2CMP::IFACE::OnKifaceStart(), PCBCALC::IFACE::OnKifaceStart(), IFACE::OnKifaceStart(), OnKifaceStart(), CV::IFACE::OnKifaceStart(), GERBV::IFACE::OnKifaceStart(), PCB::IFACE::OnKifaceStart(), and SCH::IFACE::OnKifaceStart().

◆ StartFlags()

int KIFACE_I::StartFlags ( ) const
inlineinherited

Return whatever was passed as aCtlBits to OnKifaceStart().

Definition at line 99 of file kiface_i.h.

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

References KIFACE_I::m_start_flags.


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