diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 2b633332b2..ab991c847d 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -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" ) } ) diff --git a/common/kiway_player.cpp b/common/kiway_player.cpp index 67f072abc1..4fa97a09fa 100644 --- a/common/kiway_player.cpp +++ b/common/kiway_player.cpp @@ -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 ) : diff --git a/eeschema/sim/simulator_frame.cpp b/eeschema/sim/simulator_frame.cpp index cf9e4fdd83..e1026b48d7 100644 --- a/eeschema/sim/simulator_frame.cpp +++ b/eeschema/sim/simulator_frame.cpp @@ -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 ); diff --git a/include/kiway_player.h b/include/kiway_player.h index 584ad67d36..2fb49f1469 100644 --- a/include/kiway_player.h +++ b/include/kiway_player.h @@ -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 - * 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() diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index a7f04bab12..48cbc1fa8f 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -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 );