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
25
#include <
bitmap2cmp_gui.h
>
26
#include <
bitmap2cmp_settings.h
>
27
#include <
kiface_base.h
>
28
#include <
kiway.h
>
29
#include <
pgm_base.h
>
30
#include <
settings/settings_manager.h
>
31
32
33
namespace
BMP2CMP
{
34
35
static
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
{
42
InitSettings
(
new
BITMAP2CMP_SETTINGS
);
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
70
using namespace
BMP2CMP
;
71
72
static
PGM_BASE
*
process
;
73
74
75
KIFACE_BASE
&
Kiface
()
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.
83
KIFACE
*
KIFACE_GETTER
(
int
* aKIFACEversion,
int
aKIWAYversion
,
PGM_BASE
*
aProgram
)
84
{
85
process
= (
PGM_BASE
*)
aProgram
;
86
return
&
kiface
;
87
}
88
89
90
#if defined(BUILD_KIWAY_DLLS)
91
PGM_BASE
&
Pgm
()
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.
99
PGM_BASE
*
PgmOrNull
()
100
{
101
return
process
;
102
}
103
#endif
104
105
106
bool
IFACE::OnKifaceStart
(
PGM_BASE
*
aProgram
,
int
aCtlBits )
107
{
108
return
start_common
( aCtlBits );
109
}
bitmap2cmp_gui.h
KIFACE_GETTER
KIFACE * KIFACE_GETTER(int *aKIFACEversion, int aKIWAYversion, PGM_BASE *aProgram)
No name mangling. Each KIFACE (DSO/DLL) will implement this once.
Definition:
bitmap2cmp_main.cpp:83
process
static PGM_BASE * process
Definition:
bitmap2cmp_main.cpp:72
Kiface
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
Definition:
bitmap2cmp_main.cpp:75
bitmap2cmp_settings.h
BITMAP2CMP_SETTINGS
Definition:
bitmap2cmp_settings.h:30
BM2CMP_FRAME
Definition:
bitmap2cmp_gui.h:86
KIFACE_BASE
A KIFACE implementation.
Definition:
kiface_base.h:39
KIFACE_BASE::InitSettings
void InitSettings(APP_SETTINGS_BASE *aSettings)
Definition:
kiface_base.h:97
KIFACE_BASE::KifaceSettings
APP_SETTINGS_BASE * KifaceSettings() const
Definition:
kiface_base.h:95
KIFACE_BASE::start_common
bool start_common(int aCtlBits)
Common things to do for a top program module, during OnKifaceStart().
Definition:
kiface_base.cpp:32
KIWAY
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition:
kiway.h:279
KIWAY::FACE_T
FACE_T
Known KIFACE implementations.
Definition:
kiway.h:285
KIWAY::FACE_BMP2CMP
@ FACE_BMP2CMP
Definition:
kiway.h:292
PGM_BASE
Container for data for KiCad programs.
Definition:
pgm_base.h:95
aKIWAYversion
int aKIWAYversion
Definition:
cvpcb.cpp:109
aProgram
int PGM_BASE * aProgram
Definition:
cvpcb.cpp:110
PgmOrNull
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
kiface_base.h
kiway.h
BMP2CMP
Definition:
bitmap2cmp_main.cpp:33
BMP2CMP::kiface
BMP2CMP::IFACE KIFACE_BASE kiface("BMP2CMP", KIWAY::FACE_BMP2CMP)
pgm_base.h
see class PGM_BASE
settings_manager.h
Pgm
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition:
single_top.cpp:111
BMP2CMP::IFACE
Definition:
bitmap2cmp_main.cpp:36
BMP2CMP::IFACE::IfaceOrAddress
void * IfaceOrAddress(int aDataId) override
Return a pointer to the requested object.
Definition:
bitmap2cmp_main.cpp:57
BMP2CMP::IFACE::OnKifaceStart
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
Definition:
bitmap2cmp_main.cpp:106
BMP2CMP::IFACE::IFACE
IFACE(const char *aDSOname, KIWAY::FACE_T aType)
Definition:
bitmap2cmp_main.cpp:62
BMP2CMP::IFACE::CreateKiWindow
wxWindow * CreateKiWindow(wxWindow *aParent, int aClassId, KIWAY *aKiway, int aCtlBits=0) override
Create a wxWindow for the current project.
Definition:
bitmap2cmp_main.cpp:39
IFACE::OnKifaceStart
bool OnKifaceStart(PGM_BASE *aProgram, int aCtlBits) override
Typically start_common() is called from here.
Definition:
test_app_main.cpp:60
KIFACE
Implement a participant in the KIWAY alchemy.
Definition:
kiway.h:151
src
bitmap2component
bitmap2cmp_main.cpp
Generated on Mon Mar 6 2023 00:04:20 for KiCad PCB EDA Suite by
1.9.4