More protection around an exceedingly dangerous hack.
The API is needed for wxFormBuilder, and I couldn't figure out any way around it, but we can at least reduce the risk of someone calling it accidentally (again).
This commit is contained in:
parent
f3eac6a12f
commit
46564055f4
|
@ -148,6 +148,7 @@ END_EVENT_TABLE()
|
|||
BM2CMP_FRAME::BM2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
BM2CMP_FRAME_BASE( aParent )
|
||||
{
|
||||
m_ident = FRAME_BM2CMP; // Initialized to wxID_ANY by wxFormBuilder
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
for( wxString unit : { _( "mm" ), _( "Inch" ), _( "DPI" ) } )
|
||||
|
|
|
@ -55,6 +55,12 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
|
|||
}
|
||||
|
||||
|
||||
// Don't use this one; it's only for wxFormBuilder, and it must be augmented with code to
|
||||
// correct the m_ident and set the m_kiway early in derived constructor.
|
||||
//
|
||||
// Because of its inherent danger, it's also declared private and requires friend-class
|
||||
// declarations for each usage.
|
||||
//
|
||||
KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName ) :
|
||||
|
|
|
@ -473,6 +473,7 @@ SIMULATOR_FRAME::SIMULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_simFinished( false ),
|
||||
m_workbookModified( false )
|
||||
{
|
||||
m_ident = FRAME_SIMULATOR; // Initialized to wxID_ANY by wxFormBuilder
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
m_schematicFrame = (SCH_EDIT_FRAME*) Kiway().Player( FRAME_SCH, false );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2017-2020 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2017-2023 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -69,12 +69,6 @@ public:
|
|||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString& aFrameName, const EDA_IU_SCALE& aIuScale );
|
||||
|
||||
/// Don't use this one, only wxformbuilder uses it, and it must be augmented with
|
||||
/// a SetKiway() early in derived constructor.
|
||||
KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
~KIWAY_PLAYER() throw();
|
||||
|
||||
// For the aCtl argument of OpenProjectFiles()
|
||||
|
@ -182,6 +176,16 @@ public:
|
|||
virtual void ExecuteRemoteCommand( const char* cmdline ){}
|
||||
|
||||
|
||||
private:
|
||||
friend class BM2CMP_FRAME_BASE;
|
||||
friend class SIMULATOR_FRAME_BASE;
|
||||
|
||||
/// Don't use this one, only wxformbuilder uses it, and it must be augmented with correcting
|
||||
/// m_ident and calling a SetKiway() early in derived constructor.
|
||||
KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& aTitle,
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aWdoName = wxFrameNameStr );
|
||||
|
||||
protected:
|
||||
|
||||
/// event handler, routes to derivative specific virtual KiwayMailIn()
|
||||
|
|
|
@ -47,16 +47,15 @@
|
|||
|
||||
|
||||
PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
KIWAY_PLAYER( aParent, wxID_ANY, _( "Calculator Tools" ), wxDefaultPosition, wxSize( 646, 361 ),
|
||||
KIWAY_PLAYER( aKiway, aParent, FRAME_CALC, _( "Calculator Tools" ), wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL,
|
||||
wxT( "calculator_tools" ) ),
|
||||
wxT( "calculator_tools" ), unityScale ),
|
||||
m_lastNotebookPage( -1 )
|
||||
{
|
||||
SHAPE_POLY_SET dummy; // A ugly trick to force the linker to include
|
||||
// some methods in code and avoid link errors
|
||||
|
||||
SetKiway( this, aKiway );
|
||||
|
||||
SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
m_mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
|
Loading…
Reference in New Issue