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-2021 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
26#include <bitmap2cmp_settings.h>
27#include <kiface_base.h>
28#include <kiway.h>
29#include <pgm_base.h>
31
32
33namespace BMP2CMP {
34
35static struct IFACE : public KIFACE_BASE
36{
37 bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
38
39 wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
40 int aCtlBits = 0 ) override
41 {
43 Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
44 return new BM2CMP_FRAME( aKiway, aParent );
45 }
46
57 void* IfaceOrAddress( int aDataId ) override
58 {
59 return nullptr;
60 }
61
62 IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
63 KIFACE_BASE( aDSOname, aType )
64 {}
65
66} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
67
68} // namespace BMP2CMP
69
70using namespace BMP2CMP;
71
73
74
76{
77 return kiface;
78}
79
80
81// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
82// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
83KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
84{
86 return &kiface;
87}
88
89
90#if defined(BUILD_KIWAY_DLLS)
92{
93 wxASSERT( process ); // KIFACE_GETTER has already been called.
94 return *process;
95}
96
97
98// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
100{
101 return process;
102}
103#endif
104
105
107{
108 return start_common( aCtlBits );
109}
KIFACE * KIFACE_GETTER(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
No name mangling. Each KIFACE (DSO/DLL) will implement this once.
static PGM_BASE * process
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
A KIFACE implementation.
Definition: kiface_base.h:39
void InitSettings(APP_SETTINGS_BASE *aSettings)
Definition: kiface_base.h:95
APP_SETTINGS_BASE * KifaceSettings() const
Definition: kiface_base.h:93
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition: kiface_base.cpp:97
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:273
FACE_T
Known KIFACE implementations.
Definition: kiway.h:279
@ FACE_BMP2CMP
Definition: kiway.h:286
Container for data for KiCad programs.
Definition: pgm_base.h:94
int aKIWAYversion
Definition: cvpcb.cpp:109
int PGM_BASE * aProgram
Definition: cvpcb.cpp:110
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
Definition: cvpcb.cpp:125
BMP2CMP::IFACE KIFACE_BASE kiface("BMP2CMP", KIWAY::FACE_BMP2CMP)
see class PGM_BASE
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:111
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
IFACE(const char *aDSOname, KIWAY::FACE_T aType)
wxWindow * CreateKiWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Create a wxWindow for the current project.
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
Implement a participant in the KIWAY alchemy.
Definition: kiway.h:151