2019-06-19 16:24:39 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1992-2010 jean-pierre.charras
|
2021-07-16 20:13:26 +00:00
|
|
|
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
2019-06-19 16:24:39 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <bitmap2cmp_gui.h>
|
|
|
|
#include <bitmap2cmp_settings.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2019-06-19 16:24:39 +00:00
|
|
|
#include <kiway.h>
|
|
|
|
#include <pgm_base.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/settings_manager.h>
|
2019-06-19 16:24:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace BMP2CMP {
|
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
static struct IFACE : public KIFACE_BASE
|
2019-06-19 16:24:39 +00:00
|
|
|
{
|
|
|
|
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
|
|
|
|
|
2022-11-08 09:14:40 +00:00
|
|
|
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
2021-07-16 20:13:26 +00:00
|
|
|
int aCtlBits = 0 ) override
|
2019-06-19 16:24:39 +00:00
|
|
|
{
|
2020-01-13 01:44:19 +00:00
|
|
|
InitSettings( new BITMAP2CMP_SETTINGS );
|
|
|
|
Pgm().GetSettingsManager().RegisterSettings( KifaceSettings() );
|
2019-06-19 16:24:39 +00:00
|
|
|
return new BM2CMP_FRAME( aKiway, aParent );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-07-16 20:13:26 +00:00
|
|
|
* Return a pointer to the requested object.
|
2019-06-19 16:24:39 +00:00
|
|
|
*
|
2021-07-16 20:13:26 +00:00
|
|
|
* 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.
|
2019-06-19 16:24:39 +00:00
|
|
|
*
|
2021-07-16 20:13:26 +00:00
|
|
|
* @param aDataId identifies which object you want the address of.
|
|
|
|
* @return the object which must be cast into the known type.
|
2019-06-19 16:24:39 +00:00
|
|
|
*/
|
|
|
|
void* IfaceOrAddress( int aDataId ) override
|
|
|
|
{
|
2021-07-16 20:13:26 +00:00
|
|
|
return nullptr;
|
2019-06-19 16:24:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
IFACE( const char* aDSOname, KIWAY::FACE_T aType ) :
|
2021-09-14 22:45:14 +00:00
|
|
|
KIFACE_BASE( aDSOname, aType )
|
2019-06-19 16:24:39 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
} kiface( "BMP2CMP", KIWAY::FACE_BMP2CMP );
|
|
|
|
|
|
|
|
} // namespace BMP2CMP
|
|
|
|
|
|
|
|
using namespace BMP2CMP;
|
|
|
|
|
|
|
|
static PGM_BASE* process;
|
|
|
|
|
2021-07-16 20:13:26 +00:00
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
KIFACE_BASE& Kiface()
|
2019-06-19 16:24:39 +00:00
|
|
|
{
|
|
|
|
return kiface;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
|
|
|
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
|
|
|
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram )
|
|
|
|
{
|
|
|
|
process = (PGM_BASE*) aProgram;
|
|
|
|
return &kiface;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(BUILD_KIWAY_DLLS)
|
|
|
|
PGM_BASE& Pgm()
|
|
|
|
{
|
|
|
|
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
|
|
|
return *process;
|
|
|
|
}
|
2021-08-14 19:08:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
|
|
|
|
PGM_BASE* PgmOrNull()
|
|
|
|
{
|
|
|
|
return process;
|
|
|
|
}
|
2019-06-19 16:24:39 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
|
|
|
{
|
|
|
|
return start_common( aCtlBits );
|
|
|
|
}
|