mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 17:59:17 +00:00
*) Switch kicad.exe to using KIFACE modules for all major top level windows.
Eeschema, Pcbnew, and Cvpcb all run under the same process now, FOR THE VERY FIRST TIME! *) Added KIWAY::PlayerCreate(), PlayerClose(), and PlayersClose(). *) Factored FRAME_T into <frame_type.h> from ID_DRAWFRAME_TYPE. *) Found that the following command line is helpful for collecting all the *.kiface files into the <build>/kicad/ directory so that kicad can find them. $ cp `find . -name '*.kiface'` kicad/ Maybe somebody will want to rework how the CMake files are organized so all the binaries can go into the same place. See python-a-mingw-us. *) This might fix the problem on the Mac where child process windows were not coming to the front. See ->Raise() in kicad/mainframe.cpp. *) You can set USE_KIFACE to 0 in kicad/mainframe.cpp to chain load child exes instead of using the KIFACE modules directly, i.e. revert.
This commit is contained in:
parent
ee3e97e6ca
commit
0d6560a218
3d-viewer
common
cvpcb
eeschema
CMakeLists.txteeschema.cpplib_pin.cpplibeditframe.cppsch_base_frame.cppschframe.cppviewlib_frame.cpp
gerbview
include
kicad
pagelayout_editor
pcbnew
@ -81,7 +81,7 @@ END_EVENT_TABLE()
|
||||
|
||||
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
|
||||
const wxString& aTitle, long style ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, DISPLAY3D_FRAME_TYPE, aTitle,
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle,
|
||||
wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
|
||||
{
|
||||
m_canvas = NULL;
|
||||
|
@ -62,7 +62,7 @@ static const wxChar entryPerspective[] = wxT( "Perspective" );
|
||||
|
||||
|
||||
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName ) :
|
||||
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||
|
@ -90,7 +90,7 @@ END_EVENT_TABLE()
|
||||
|
||||
|
||||
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aFrameType,
|
||||
FRAME_T aFrameType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName ) :
|
||||
|
140
common/kiway.cpp
140
common/kiway.cpp
@ -24,21 +24,29 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <macros.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_player.h>
|
||||
#include <config.h>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
KIWAY::KIWAY()
|
||||
KIFACE* KIWAY::m_kiface[KIWAY_FACE_COUNT];
|
||||
int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
|
||||
|
||||
|
||||
KIWAY::KIWAY( PGM_BASE* aProgram, wxFrame* aTop ):
|
||||
m_program( aProgram ),
|
||||
m_top( aTop )
|
||||
{
|
||||
memset( &m_kiface, 0, sizeof( m_kiface ) );
|
||||
memset( m_player, 0, sizeof( m_player ) );
|
||||
}
|
||||
|
||||
|
||||
const wxString KIWAY::dso_full_path( FACE_T aFaceId )
|
||||
{
|
||||
const wxChar* name = wxT("");
|
||||
const wxChar* name;
|
||||
|
||||
switch( aFaceId )
|
||||
{
|
||||
@ -68,22 +76,24 @@ PROJECT& KIWAY::Prj() const
|
||||
}
|
||||
|
||||
|
||||
KIFACE* KIWAY::KiFACE( PGM_BASE* aProgram, FACE_T aFaceId, bool doLoad )
|
||||
KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
|
||||
{
|
||||
switch( aFaceId )
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFaceId.
|
||||
if( unsigned( aFaceId ) >= DIM( m_kiface ) )
|
||||
{
|
||||
// case FACE_SCH:
|
||||
case FACE_PCB:
|
||||
if( m_kiface[aFaceId] )
|
||||
return m_kiface[aFaceId];
|
||||
break;
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
default:
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFaceId" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// DSO with KIFACE has not been loaded yet, does user want to load it?
|
||||
// return the previously loaded KIFACE, if it was.
|
||||
if( m_kiface[aFaceId] )
|
||||
return m_kiface[aFaceId];
|
||||
|
||||
// DSO with KIFACE has not been loaded yet, does caller want to load it?
|
||||
if( doLoad )
|
||||
{
|
||||
wxString dname = dso_full_path( aFaceId );
|
||||
@ -108,7 +118,7 @@ KIFACE* KIWAY::KiFACE( PGM_BASE* aProgram, FACE_T aFaceId, bool doLoad )
|
||||
{
|
||||
KIFACE_GETTER_FUNC* getter = (KIFACE_GETTER_FUNC*) addr;
|
||||
|
||||
KIFACE* kiface = getter( &m_kiface_version[aFaceId], KIFACE_VERSION, aProgram );
|
||||
KIFACE* kiface = getter( &m_kiface_version[aFaceId], KIFACE_VERSION, m_program );
|
||||
|
||||
// KIFACE_GETTER_FUNC function comment (API) says the non-NULL is unconditional.
|
||||
wxASSERT_MSG( kiface,
|
||||
@ -116,7 +126,7 @@ KIFACE* KIWAY::KiFACE( PGM_BASE* aProgram, FACE_T aFaceId, bool doLoad )
|
||||
|
||||
// Give the DSO a single chance to do its "process level" initialization.
|
||||
// "Process level" specifically means stay away from any projects in there.
|
||||
if( kiface->OnKifaceStart( aProgram, KFCTL_PROJECT_SUITE ) )
|
||||
if( kiface->OnKifaceStart( m_program, KFCTL_PROJECT_SUITE ) )
|
||||
{
|
||||
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image.
|
||||
(void) dso.Detach();
|
||||
@ -131,3 +141,105 @@ KIFACE* KIWAY::KiFACE( PGM_BASE* aProgram, FACE_T aFaceId, bool doLoad )
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
|
||||
{
|
||||
switch( aFrameType )
|
||||
{
|
||||
case FRAME_SCH:
|
||||
case FRAME_SCH_LIB_EDITOR:
|
||||
case FRAME_SCH_VIEWER:
|
||||
return FACE_SCH;
|
||||
|
||||
case FRAME_PCB:
|
||||
case FRAME_PCB_MODULE_EDITOR:
|
||||
case FRAME_PCB_MODULE_VIEWER:
|
||||
case FRAME_PCB_FOOTPRINT_WIZARD:
|
||||
case FRAME_PCB_DISPLAY3D:
|
||||
return FACE_PCB;
|
||||
|
||||
case FRAME_CVPCB:
|
||||
case FRAME_CVPCB_DISPLAY:
|
||||
return FACE_CVPCB;
|
||||
|
||||
case FRAME_GERBER:
|
||||
return FACE_GERBVIEW;
|
||||
|
||||
case FRAME_PL_EDITOR:
|
||||
return FACE_PL_EDITOR;
|
||||
|
||||
default:
|
||||
return FACE_T( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER* KIWAY::PlayerCreate( FRAME_T aFrameType )
|
||||
{
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFrameType.
|
||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
||||
{
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// return the previously opened window
|
||||
if( m_player[aFrameType] )
|
||||
return m_player[aFrameType];
|
||||
|
||||
FACE_T face_type = KifaceType( aFrameType );
|
||||
|
||||
wxASSERT( face_type != FACE_T(-1) );
|
||||
|
||||
KIFACE* kiface = KiFACE( face_type );
|
||||
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE );
|
||||
|
||||
return m_player[aFrameType] = frame;
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
|
||||
{
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFrameType.
|
||||
if( unsigned( aFrameType ) >= DIM( m_player ) )
|
||||
{
|
||||
// @todo : throw an exception here for python's benefit, at least that
|
||||
// way it gets some explanatory text.
|
||||
|
||||
wxASSERT_MSG( 0, wxT( "caller has a bug, passed a bad aFrameType" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_player[aFrameType] )
|
||||
{
|
||||
if( m_player[aFrameType]->Close( doForce ) )
|
||||
{
|
||||
m_player[aFrameType] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // window is closed already.
|
||||
}
|
||||
|
||||
|
||||
bool KIWAY::PlayersClose( bool doForce )
|
||||
{
|
||||
bool ret = true;
|
||||
|
||||
for( unsigned i=0; i < DIM( m_player ); ++i )
|
||||
{
|
||||
ret = ret && PlayerClose( FRAME_T( i ), doForce );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ static const wxString dso_full_path( const wxString& aAbsoluteArgv0 )
|
||||
|
||||
// Only a single KIWAY is supported in this single_top top level component,
|
||||
// which is dedicated to loading only a single DSO.
|
||||
static KIWAY kiway;
|
||||
KIWAY Kiway( &Pgm() );
|
||||
|
||||
|
||||
// implement a PGM_BASE and a wxApp side by side:
|
||||
@ -304,17 +304,17 @@ bool PGM_SINGLE_TOP::OnPgmInit( wxApp* aWxApp )
|
||||
|
||||
// Use KIFACE to create a top window that the KIFACE knows about.
|
||||
// TOP_FRAME is passed on compiler command line from CMake, and is one of
|
||||
// the types in ID_DRAWFRAME_TYPE.
|
||||
// the types in FRAME_T.
|
||||
// KIFACE::CreateWindow() is a virtual so we don't need to link to it.
|
||||
// Remember its in the *.kiface DSO.
|
||||
#if 0
|
||||
// this pulls in EDA_DRAW_FRAME type info, which we don't want in
|
||||
// the single_top link image.
|
||||
KIWAY_PLAYER* frame = dynamic_cast<KIWAY_PLAYER*>( kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE ) );
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE ) );
|
||||
#else
|
||||
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||
NULL, TOP_FRAME, &kiway, KFCTL_STANDALONE );
|
||||
NULL, TOP_FRAME, &Kiway, KFCTL_STANDALONE );
|
||||
#endif
|
||||
|
||||
App().SetTopWindow( frame ); // wxApp gets a face.
|
||||
|
@ -81,7 +81,7 @@ if( USE_KIWAY_DLLS )
|
||||
${CVPCB_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=CVPCB_FRAME_TYPE;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CVPCB;PGM_DATA_FILE_EXT=\"net\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( cvpcb
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
@ -72,7 +72,7 @@ END_EVENT_TABLE()
|
||||
|
||||
|
||||
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, CVPCB_MAINFRAME* aParent ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, CVPCB_DISPLAY_FRAME_TYPE, _( "Footprint Viewer" ),
|
||||
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ END_EVENT_TABLE()
|
||||
|
||||
|
||||
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aKiway, aParent, CVPCB_FRAME_TYPE, wxT( "CvPCB" ), wxDefaultPosition,
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
|
||||
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
|
||||
{
|
||||
m_FrameName = CVPCB_MAINFRAME_NAME;
|
||||
|
@ -108,7 +108,7 @@ static struct IFACE : public KIFACE_I
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case CVPCB_FRAME_TYPE:
|
||||
case FRAME_CVPCB:
|
||||
{
|
||||
CVPCB_MAINFRAME* frame = new CVPCB_MAINFRAME( aKiway, aParent );
|
||||
return frame;
|
||||
|
@ -251,7 +251,7 @@ if( USE_KIWAY_DLLS )
|
||||
${EESCHEMA_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( eeschema
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
@ -345,7 +345,7 @@ else()
|
||||
)
|
||||
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=SCHEMATIC_FRAME_TYPE;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"sch\";BUILD_KIWAY_DLL"
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
|
@ -79,7 +79,7 @@ static struct IFACE : public KIFACE_I
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case SCHEMATIC_FRAME_TYPE:
|
||||
case FRAME_SCH:
|
||||
{
|
||||
SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
|
||||
|
||||
@ -97,7 +97,7 @@ static struct IFACE : public KIFACE_I
|
||||
}
|
||||
break;
|
||||
|
||||
case LIBEDITOR_FRAME_TYPE:
|
||||
case FRAME_SCH_LIB_EDITOR:
|
||||
{
|
||||
LIB_EDIT_FRAME* frame = new LIB_EDIT_FRAME( aKiway,
|
||||
dynamic_cast<SCH_EDIT_FRAME*>( aParent ) );
|
||||
|
@ -810,7 +810,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
|
||||
if( aPanel && aPanel->GetParent() )
|
||||
frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
|
||||
|
||||
if( frame && frame->IsType( SCHEMATIC_FRAME_TYPE ) &&
|
||||
if( frame && frame->IsType( FRAME_SCH ) &&
|
||||
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
|
||||
return;
|
||||
|
||||
|
@ -190,7 +190,7 @@ END_EVENT_TABLE()
|
||||
#define LIB_EDIT_FRAME_NAME wxT( "LibeditFrame" )
|
||||
|
||||
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, SCH_EDIT_FRAME* aParent ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, LIBEDITOR_FRAME_TYPE, _( "Library Editor" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GetLibEditFrameName() )
|
||||
{
|
||||
wxASSERT( aParent ); // LIB_EDIT_FRAME needs a parent, since it peeks up there.
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aWindowType, const wxString& aTitle,
|
||||
FRAME_T aWindowType, const wxString& aTitle,
|
||||
const wxPoint& aPosition, const wxSize& aSize, long aStyle,
|
||||
const wxString& aFrameName ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition,
|
||||
|
@ -176,7 +176,7 @@ END_EVENT_TABLE()
|
||||
#define SCH_EDIT_FRAME_NAME wxT( "SchematicFrame" )
|
||||
|
||||
SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
SCH_BASE_FRAME( aKiway, aParent, SCHEMATIC_FRAME_TYPE, wxT( "Eeschema" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH, wxT( "Eeschema" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, SCH_EDIT_FRAME_NAME ),
|
||||
m_item_to_repeat( 0 )
|
||||
{
|
||||
@ -821,7 +821,7 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||
{
|
||||
KIFACE_I& kf = Kiface();
|
||||
|
||||
wxWindow* w = kf.CreateWindow( this, LIBEDITOR_FRAME_TYPE, &Kiway(), kf.StartFlags() );
|
||||
wxWindow* w = kf.CreateWindow( this, FRAME_SCH_LIB_EDITOR, &Kiway(), kf.StartFlags() );
|
||||
libeditFrame = dynamic_cast<LIB_EDIT_FRAME*>( w );
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ static wxAcceleratorEntry accels[] =
|
||||
|
||||
LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, SCH_BASE_FRAME* aParent,
|
||||
CMP_LIBRARY* aLibrary, wxSemaphore* aSemaphore, long aStyle ) :
|
||||
SCH_BASE_FRAME( aKiway, aParent, VIEWER_FRAME_TYPE, _( "Library Browser" ),
|
||||
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_VIEWER, _( "Library Browser" ),
|
||||
wxDefaultPosition, wxDefaultSize, aStyle, GetLibViewerFrameName() )
|
||||
{
|
||||
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
||||
|
@ -100,7 +100,7 @@ if( USE_KIWAY_DLLS )
|
||||
${GERBVIEW_RESOURCES}
|
||||
)
|
||||
set_source_files_properties( ../common/single_top.cpp PROPERTIES
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=GERBER_FRAME_TYPE;BUILD_KIWAY_DLL"
|
||||
COMPILE_DEFINITIONS "TOP_FRAME=FRAME_GERBER;BUILD_KIWAY_DLL"
|
||||
)
|
||||
target_link_libraries( gerbview
|
||||
#singletop # replaces common, giving us restrictive control and link warnings.
|
||||
|
@ -81,7 +81,7 @@ static struct IFACE : public KIFACE_I
|
||||
{
|
||||
switch( aClassId )
|
||||
{
|
||||
case GERBER_FRAME_TYPE:
|
||||
case FRAME_GERBER:
|
||||
{
|
||||
GERBVIEW_FRAME* frame = new GERBVIEW_FRAME( aKiway, aParent );
|
||||
|
||||
|
@ -65,7 +65,7 @@ static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBloc
|
||||
#define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
|
||||
|
||||
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
EDA_DRAW_FRAME( aKiway, aParent, GERBER_FRAME_TYPE, wxT( "GerbView" ),
|
||||
EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
|
||||
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
|
||||
{
|
||||
m_colorsSettings = &g_ColorsSettings;
|
||||
|
@ -118,7 +118,7 @@ protected:
|
||||
|
||||
public:
|
||||
EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aFrameType,
|
||||
FRAME_T aFrameType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle,
|
||||
|
32
include/frame_type.h
Normal file
32
include/frame_type.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef FRAME_T_H_
|
||||
#define FRAME_T_H_
|
||||
|
||||
/**
|
||||
* Enum FRAME_T
|
||||
* is the set of EDA_BASE_FRAME derivatives, typically stored in
|
||||
* EDA_BASE_FRAME::m_Ident.
|
||||
*/
|
||||
enum FRAME_T
|
||||
{
|
||||
FRAME_SCH,
|
||||
FRAME_SCH_LIB_EDITOR,
|
||||
FRAME_SCH_VIEWER,
|
||||
FRAME_PCB,
|
||||
FRAME_PCB_MODULE_EDITOR,
|
||||
FRAME_PCB_MODULE_VIEWER,
|
||||
FRAME_PCB_FOOTPRINT_WIZARD,
|
||||
FRAME_PCB_DISPLAY3D,
|
||||
FRAME_CVPCB,
|
||||
FRAME_CVPCB_DISPLAY,
|
||||
FRAME_GERBER,
|
||||
|
||||
KIWAY_PLAYER_COUNT, // counts subset of FRAME_T's tracked in class KIWAY
|
||||
|
||||
KICAD_MAIN_FRAME_T = KIWAY_PLAYER_COUNT,
|
||||
FRAME_PL_EDITOR,
|
||||
//TEXT_EDITOR_FRAME_T,
|
||||
|
||||
FRAME_T_COUNT
|
||||
};
|
||||
|
||||
#endif // FRAME_T_H_
|
@ -101,6 +101,7 @@ as such! As such, it is OK to use UTF8 characters:
|
||||
#include <import_export.h>
|
||||
#include <search_stack.h>
|
||||
#include <project.h>
|
||||
#include <frame_type.h>
|
||||
|
||||
|
||||
#define VTBL_ENTRY virtual
|
||||
@ -126,6 +127,7 @@ class wxWindow;
|
||||
class wxConfigBase;
|
||||
class PGM_BASE;
|
||||
class KIWAY;
|
||||
class KIWAY_PLAYER;
|
||||
|
||||
|
||||
/**
|
||||
@ -248,50 +250,109 @@ class KIWAY : public wxEvtHandler
|
||||
{
|
||||
|
||||
public:
|
||||
/// Possible KIFACEs on *this* KIWAY
|
||||
/// Known KIFACE implementations
|
||||
enum FACE_T
|
||||
{
|
||||
FACE_SCH, ///< eeschema DSO
|
||||
// FACE_LIB,
|
||||
FACE_PCB, ///< pcbnew DSO
|
||||
// FACE_MOD,
|
||||
FACE_SCH, ///< eeschema DSO
|
||||
FACE_PCB, ///< pcbnew DSO
|
||||
FACE_CVPCB,
|
||||
|
||||
FACE_BMP2CMP,
|
||||
/// count of those above here, which is the subset managed in a KIWAY.
|
||||
KIWAY_FACE_COUNT,
|
||||
|
||||
FACE_BMP2CMP = KIWAY_FACE_COUNT,
|
||||
FACE_GERBVIEW,
|
||||
FACE_PL_EDITOR,
|
||||
FACE_PCB_CALCULATOR,
|
||||
|
||||
FACE_COUNT, ///< how many KIWAY player types
|
||||
FACE_COUNT
|
||||
};
|
||||
|
||||
// If you change the vtable, recompile all of KiCad.
|
||||
/**
|
||||
* Function KifaceType
|
||||
* is a simple mapping function which returns the FACE_T which is known to
|
||||
* implement @a aFrameType.
|
||||
*
|
||||
* @return KIWAY::FACE_T - a valid value or FACE_T(-1) if given a bad aFrameType.
|
||||
*/
|
||||
static FACE_T KifaceType( FRAME_T aFrameType );
|
||||
|
||||
|
||||
// If you change the vtable, recompile all of KiCad.
|
||||
|
||||
/**
|
||||
* Function KiFACE
|
||||
* returns the KIFACE* given a FACE_T. If it is not already loaded, the
|
||||
* KIFACE is loaded and initialized with a call to KIFACE::OnKifaceStart()
|
||||
*/
|
||||
VTBL_ENTRY KIFACE* KiFACE( PGM_BASE* aProgram,
|
||||
FACE_T aFaceId, bool doLoad = true );
|
||||
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad = true );
|
||||
|
||||
VTBL_ENTRY PROJECT& Prj() const;
|
||||
/**
|
||||
* Function PlayerCreate
|
||||
* returns the KIWAY_PLAYER* given a FRAME_T. If it is not already created,
|
||||
* the required KIFACE is found and loaded and initialized if necessary, then
|
||||
* the KIWAY_PLAYER window is created but not shown. Caller must Show() it.
|
||||
* If it is already created, then the existing KIWAY_PLAYER* pointer is returned.
|
||||
*
|
||||
* @return KIWAY_PLAYER* - a valid opened KIWAY_PLAYER or NULL if there
|
||||
* is something wrong.
|
||||
*/
|
||||
VTBL_ENTRY KIWAY_PLAYER* PlayerCreate( FRAME_T aFrameType );
|
||||
|
||||
KIWAY();
|
||||
/**
|
||||
* Function PlayerClose
|
||||
* calls the KIWAY_PLAYER::Close( bool force ) function on the window and
|
||||
* if not vetoed, returns true, else false. If window actually closes, then
|
||||
* this KIWAY marks it as not opened internally.
|
||||
*
|
||||
* @return bool - true the window is closed and not vetoed, else false.
|
||||
*/
|
||||
VTBL_ENTRY bool PlayerClose( FRAME_T aFrameType, bool doForce );
|
||||
|
||||
/**
|
||||
* Function PlayersClose
|
||||
* calls the KIWAY_PLAYER::Close( bool force ) function on all the windows and
|
||||
* if none are vetoed, returns true, else false. If window actually closes, then
|
||||
* this KIWAY marks it as not opened internally.
|
||||
*
|
||||
* @return bool - true the window is closed and not vetoed, else false.
|
||||
*/
|
||||
VTBL_ENTRY bool PlayersClose( bool doForce );
|
||||
|
||||
|
||||
/**
|
||||
* Function Prj
|
||||
* returns the PROJECT associated with this KIWAY. This is here as an
|
||||
* accessor, so that there is freedom to put the actual PROJECT storage
|
||||
* in a place decided by the implementation, and not known to the caller.
|
||||
*/
|
||||
VTBL_ENTRY PROJECT& Prj() const;
|
||||
|
||||
KIWAY( PGM_BASE* aProgram, wxFrame* aTop = NULL );
|
||||
|
||||
/// In case aTop may not be known at time of KIWAY construction:
|
||||
void SetTop( wxFrame* aTop ) { m_top = aTop; }
|
||||
|
||||
private:
|
||||
|
||||
/// Get the full path & name of the DSO holding the requested FACE_T.
|
||||
static const wxString dso_full_path( FACE_T aFaceId );
|
||||
|
||||
KIFACE* m_kiface[FACE_COUNT];
|
||||
int m_kiface_version[FACE_COUNT];
|
||||
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
|
||||
static int m_kiface_version[KIWAY_FACE_COUNT];
|
||||
|
||||
PROJECT m_project; // do not assume this is here, use Prj().
|
||||
KIWAY_PLAYER* m_player[KIWAY_PLAYER_COUNT]; // from frame_type.h
|
||||
|
||||
PROJECT m_project; // do not assume this is here, use Prj().
|
||||
|
||||
PGM_BASE* m_program;
|
||||
wxFrame* m_top;
|
||||
};
|
||||
|
||||
|
||||
extern KIWAY Kiway; // provided by single_top.cpp and kicad.cpp
|
||||
|
||||
|
||||
/**
|
||||
* Function Pointer KIFACE_GETTER_FUNC
|
||||
* points to the one and only KIFACE export. The export's address
|
||||
@ -310,4 +371,5 @@ typedef KIFACE* KIFACE_GETTER_FUNC( int* aKIFACEversion, int aKIWAYversion,
|
||||
/// No name mangling. Each KIFACE (DSO/DLL) will implement this once.
|
||||
extern "C" KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
|
||||
|
||||
|
||||
#endif // KIWAY_H_
|
||||
|
@ -98,7 +98,7 @@ private:
|
||||
class KIWAY_PLAYER : public EDA_BASE_FRAME, public KIWAY_HOLDER
|
||||
{
|
||||
public:
|
||||
KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aWdoName = wxFrameNameStr ) :
|
||||
EDA_BASE_FRAME( aParent, aFrameType, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
@ -110,7 +110,7 @@ public:
|
||||
KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr ) :
|
||||
EDA_BASE_FRAME( aParent, (ID_DRAWFRAME_TYPE) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
|
||||
KIWAY_HOLDER( 0 )
|
||||
{}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class SCH_BASE_FRAME : public EDA_DRAW_FRAME
|
||||
{
|
||||
public:
|
||||
SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
ID_DRAWFRAME_TYPE aWindowType,
|
||||
FRAME_T aWindowType,
|
||||
const wxString& aTitle,
|
||||
const wxPoint& aPosition, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName );
|
||||
|
@ -115,7 +115,7 @@ protected:
|
||||
static const LAYER_NUM GAL_LAYER_ORDER[];
|
||||
|
||||
public:
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||
PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName );
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user