KiCad PCB EDA Suite
bitmap2cmp_main.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 1992-2010 jean-pierre.charras
5  * Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #include "bitmap2cmp_gui.h"
26 #include <kiface_i.h>
27 #include <kiway.h>
28 #include <pgm_base.h>
29 
30 
31 //-----<KIFACE>-----------------------------------------------------------------
32 
33 namespace BMP2CMP {
34 
35 static struct IFACE : public KIFACE_I
36 {
37  bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
38 
39  wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 ) override
40  {
41  return new BM2CMP_FRAME( aKiway, aParent );
42  }
43 
55  void* IfaceOrAddress( int aDataId ) override
56  {
57  return NULL;
58  }
59 
60  IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
61  KIFACE_I( aDSOname, aType )
62  {}
63 
64 } kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
65 
66 } // namespace BMP2CMP
67 
68 using namespace BMP2CMP;
69 
70 static PGM_BASE* process;
71 
73 {
74  return kiface;
75 }
76 
77 
78 // KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
79 // KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
80 KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
81 {
83  return &kiface;
84 }
85 
86 
87 #if defined(BUILD_KIWAY_DLLS)
88 PGM_BASE& Pgm()
89 {
90  wxASSERT( process ); // KIFACE_GETTER has already been called.
91  return *process;
92 }
93 #endif
94 
95 
96 bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
97 {
98  return start_common( aCtlBits );
99 }
KIFACE_I is a KIFACE (I)mplementation, with some features useful for DSOs which implement a KIFACE.
Definition: kiface_i.h:37
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:98
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_i.cpp:90
PGM_BASE keeps program (whole process) data for KiCad programs.
Definition: pgm_base.h:156
KIFACE * KIFACE_GETTER(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
No name mangling. Each KIFACE (DSO/DLL) will implement this once.
void * IfaceOrAddress(int aDataId) override
Function IfaceOrAddress return a pointer to the requested object.
#define NULL
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
wxWindow * CreateWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Function CreateWindow creates a wxWindow for the current project.
static PGM_BASE * process
KIWAY is a minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the s...
Definition: kiway.h:274
int PGM_BASE * aProgram
Definition: cvpcb/cvpcb.cpp:95
IFACE(const char *aDSOname, KIWAY::FACE_T aType)
FACE_T
Known KIFACE implementations.
Definition: kiway.h:280
see class PGM_BASE
KIFACE is used by a participant in the KIWAY alchemy.
Definition: kiway.h:151
int aKIWAYversion
Definition: cvpcb/cvpcb.cpp:94
BMP2CMP::IFACE KIFACE_I kiface("BMP2CMP", KIWAY::FACE_BMP2CMP)
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Function OnKifaceStart is called just once shortly after the DSO is loaded.