2014-02-03 15:10:37 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2021-10-06 02:46:53 +00:00
|
|
|
* Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.TXT for contributors.
|
2014-02-03 15:10:37 +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
|
|
|
|
*/
|
|
|
|
|
2016-01-12 16:33:33 +00:00
|
|
|
#ifndef KIWAY_H_
|
|
|
|
#define KIWAY_H_
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2020-12-19 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* The KIWAY and KIFACE classes are used to communicate between various process
|
|
|
|
* modules, all residing within a single process. The program modules are either
|
|
|
|
* top level like an *.exe or subsidiary like a *.dll. In much of the documentation
|
|
|
|
* the term DSO is used to refer to the *.dll portions, that is the term used on
|
|
|
|
* linux. But it should be taken to mean DLL on Windows.
|
|
|
|
*
|
|
|
|
* <p>These are a couple of reasons why this design was chosen:
|
|
|
|
*
|
|
|
|
* <ol>
|
|
|
|
*
|
|
|
|
* <li>By using DSOs within a single process, it is not necessary to use IPC.
|
|
|
|
* The DSOs can send wxEvents between themselves using wxEvtHandler interfaces in
|
|
|
|
* a platform independent way. There can also be function calls from one DSO to
|
|
|
|
* another.</li>
|
|
|
|
*
|
|
|
|
* <li>The use of a number of separately linked DSOs closely resembles the original
|
|
|
|
* KiCad program design, consisting of Eeschema and Pcbnew. But it also allows
|
|
|
|
* separate compilation and linking of those two DSOs without a ton of inter-DSO
|
|
|
|
* dependencies and common data structures. Linking smaller, purpose specific DSOs
|
|
|
|
* is thought to be better for maintenance simplicity than a large single link
|
|
|
|
* image. </li>
|
|
|
|
*
|
|
|
|
* <li>By keeping the core functionality in DSOs rather than EXE tops, it becomes
|
|
|
|
* possible to re-use the DSOs under different program tops. For example, a DSO
|
|
|
|
* named _pcbnew.so can be used under a C++ top or under a python top. Only one
|
|
|
|
* CMake target must be defined to build either. Whether that is a separate build
|
|
|
|
* or not is not the important thing. Simply having a single CMake target has
|
|
|
|
* advantages. (Each builder person will have his/her own intentions relative to
|
|
|
|
* use of python or not.) Once a DSO is python capable, it can be driven by any
|
|
|
|
* number of python program tops, including demo-ing (automation) and testing
|
|
|
|
* separately.</li>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* </ol>
|
|
|
|
*
|
|
|
|
* All KiCad source code is UTF8 encoded by law, so make sure your editor is set
|
|
|
|
* as such! As such, it is OK to use UTF8 characters:
|
|
|
|
*
|
|
|
|
* ┏ ┗ ┓ ┛ ━ ┃
|
|
|
|
*
|
|
|
|
* <pre>
|
|
|
|
*
|
|
|
|
* ┏━━━process top━━━━━┓
|
|
|
|
* ┃ ┃ wxEvent channels
|
|
|
|
* ┏━━━━━━━━━━━━━━━━━━━-━[KIWAY project 1]━-━━━━━━━━━━━━━━━━━━━━━━┓
|
|
|
|
* ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┏━━━━━━━━━━━━━-━[KIWAY project 2]━-━━━━━━━━━━┓ ┃
|
|
|
|
* ┃ ┃ ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┏━-━[KIWAY project 3]━-━┓ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┗━━━━━━━━━━━━━━━━━━━┛ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┃ ┃ ┃
|
|
|
|
* ┏━━━━━━━━|━━━━━|━━━━━━━━━━━|━━━━━━━━━┓ ┏━━━━━━━━|━━━━━━━━|━━━━━━━━━━━|━━━━━┓
|
|
|
|
* ┃ KIFACE ┃ ┃ ┃ ┃ ┃ KIFACE ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃
|
|
|
|
* ┃┏━━━━━━━+━┓ ┏━+━━━━━━━┓ ┏━+━━━━━━━┓ ┃ ┃┏━━━━━━━+━┓ ┏━━━━+━━━━┓ ┏━━━━+━━━━┓┃
|
|
|
|
* ┃┃wxFrame ┃ ┃wxFrame ┃ ┃wxFrame ┃ ┃ ┃┃wxFrame ┃ ┃wxFrame ┃ ┃wxFrame ┃┃
|
|
|
|
* ┃┃project 1┃ ┃project 2┃ ┃project 3┃ ┃ ┃┃project 3┃ ┃project 2┃ ┃project 1┃┃
|
|
|
|
* ┃┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┃ ┃┗━━━━━━━━━┛ ┗━━━━━━━━━┛ ┗━━━━━━━━━┛┃
|
|
|
|
* ┃ ┃ ┃ ┃
|
|
|
|
* ┃ ┃ ┃ ┃
|
|
|
|
* ┗━━━━━━ eeschema DSO ━━━━━━━━━━━━━━━━┛ ┗━━━━━━ pcbnew DSO ━━━━━━━━━━━━━━━━━┛
|
|
|
|
*
|
|
|
|
* </pre>
|
|
|
|
*
|
|
|
|
*/
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
|
2021-07-02 19:07:26 +00:00
|
|
|
#include <atomic>
|
|
|
|
#include <wx/defs.h>
|
2014-02-03 15:10:37 +00:00
|
|
|
#include <wx/event.h>
|
|
|
|
#include <import_export.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <search_stack.h>
|
|
|
|
#include <project.h>
|
2014-04-19 18:47:20 +00:00
|
|
|
#include <frame_type.h>
|
2014-04-22 15:16:19 +00:00
|
|
|
#include <mail_type.h>
|
2016-09-20 15:59:43 +00:00
|
|
|
#include <ki_exception.h>
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#define KIFACE_VERSION 1
|
|
|
|
#define KIFACE_GETTER KIFACE_1
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2020-12-19 16:00:52 +00:00
|
|
|
// The KIFACE acquisition function is declared extern "C" so its name should not
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// be mangled.
|
|
|
|
#define KIFACE_INSTANCE_NAME_AND_VERSION "KIFACE_1"
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
#ifndef SWIG
|
2014-12-16 20:47:47 +00:00
|
|
|
#if defined(__linux__) || defined(__FreeBSD__)
|
2014-02-03 15:10:37 +00:00
|
|
|
#define LIB_ENV_VAR wxT( "LD_LIBRARY_PATH" )
|
|
|
|
#elif defined(__WXMAC__)
|
|
|
|
#define LIB_ENV_VAR wxT( "DYLD_LIBRARY_PATH" )
|
2016-03-01 15:55:44 +00:00
|
|
|
#elif defined(_WIN32)
|
2014-02-03 15:10:37 +00:00
|
|
|
#define LIB_ENV_VAR wxT( "PATH" )
|
2016-03-01 15:55:44 +00:00
|
|
|
#else
|
|
|
|
#error Platform support missing
|
2014-02-03 15:10:37 +00:00
|
|
|
#endif
|
2016-09-20 15:59:43 +00:00
|
|
|
#endif // SWIG
|
2014-02-03 15:10:37 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
class wxConfigBase;
|
2014-02-03 15:10:37 +00:00
|
|
|
class wxWindow;
|
2014-04-18 02:05:40 +00:00
|
|
|
class PGM_BASE;
|
|
|
|
class KIWAY;
|
2014-04-19 18:47:20 +00:00
|
|
|
class KIWAY_PLAYER;
|
2018-01-01 09:41:43 +00:00
|
|
|
class wxTopLevelWindow;
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Implement a participant in the KIWAY alchemy.
|
|
|
|
*
|
|
|
|
* KIWAY is a minimalistic software bus for communications between various DLLs/DSOs
|
|
|
|
* (DSOs) within the same KiCad process. It makes it possible to call between DSOs
|
|
|
|
* without having to link them together. Most all calls are via virtual functions
|
|
|
|
* which means C++ vtables are used to hold function pointers and eliminate the need
|
|
|
|
* to link to specific object code libraries. There is one KIWAY in the launching
|
|
|
|
* portion of the process for each open KiCad project. Each project has its own KIWAY.
|
|
|
|
* Within a KIWAY is an actual PROJECT data structure. A KIWAY also facilitates
|
|
|
|
* communicating between DSOs on the topic of the project in question.
|
2014-02-03 15:10:37 +00:00
|
|
|
*/
|
|
|
|
struct KIFACE
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// The order of functions establishes the vtable sequence, do not change the
|
|
|
|
// order of functions in this listing unless you recompile all clients of
|
|
|
|
// this interface.
|
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
virtual ~KIFACE() throw() {}
|
|
|
|
|
2020-12-19 16:00:52 +00:00
|
|
|
#define KFCTL_STANDALONE (1<<0) ///< Running as a standalone Top.
|
|
|
|
#define KFCTL_CPP_PROJECT_SUITE (1<<1) ///< Running under C++ project mgr, possibly with others.
|
2014-04-18 02:05:40 +00:00
|
|
|
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Called just once shortly after the DSO is loaded.
|
|
|
|
* It is the second function called, immediately after the KIFACE_GETTER(). However
|
|
|
|
* before either of those, static C++ constructors are called. The DSO implementation
|
|
|
|
* should do process level initialization here, not project specific since there will
|
|
|
|
* be multiple projects open eventually.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @param aProgram is the process block: #PGM_BASE*.
|
2014-04-18 02:05:40 +00:00
|
|
|
* @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return true if DSO initialized OK, false if not. When returning false, the loader
|
|
|
|
* may optionally decide to terminate the process or not, but will not put out
|
|
|
|
* any UI because that is the duty of this function to say why it is returning
|
|
|
|
* false. Never return false without having reported to the UI why.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) = 0;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Called just once just before the DSO is to be unloaded.
|
|
|
|
*
|
|
|
|
* It is called before static C++ destructors are called. A default implementation
|
|
|
|
* is supplied.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void OnKifaceEnd() = 0;
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Create a wxWindow for the current project.
|
2014-02-03 15:10:37 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* The caller must cast the return value into the known type.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @param aParent may be NULL or is otherwise the parent to connect under. If NULL
|
|
|
|
* then caller may want to connect the returned wxWindow into some
|
|
|
|
* hierarchy after this function returns.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* @param aClassId identifies which wxFrame or wxDialog to retrieve, using a value
|
2020-12-19 16:00:52 +00:00
|
|
|
* known to the implementing KIFACE.
|
2014-02-03 15:10:37 +00:00
|
|
|
* @param aKIWAY tells the window which KIWAY (and PROJECT) it is a participant in.
|
2014-03-20 14:18:32 +00:00
|
|
|
* @param aCtlBits consists of bit flags from the set of KFCTL_* \#defines above.
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return the window created and if not NULL, should be cast into the known type using
|
|
|
|
* and old school cast. dynamic_cast is problematic since it needs typeinfo probably
|
|
|
|
* not contained in the caller's link image.
|
2014-02-03 15:10:37 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual wxWindow* CreateWindow( wxWindow* aParent, int aClassId,
|
|
|
|
KIWAY* aKIWAY, int aCtlBits = 0 ) = 0;
|
2019-11-09 19:39:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Saving a file under a different name is delegated to the various KIFACEs because
|
|
|
|
* the project doesn't know the internal format of the various files (which may have
|
|
|
|
* paths in them that need updating).
|
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void SaveFileAs( const wxString& srcProjectBasePath,
|
|
|
|
const wxString& srcProjectName,
|
|
|
|
const wxString& newProjectBasePath,
|
|
|
|
const wxString& newProjectName,
|
|
|
|
const wxString& srcFilePath,
|
|
|
|
wxString& aErrors )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
// If a KIFACE owns files then it needs to implement this....
|
|
|
|
}
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Return pointer to the requested object.
|
2014-02-03 15:10:37 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +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. Segfaults are your fault.
|
2014-02-03 15:10:37 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @param aDataId identifies which object you want the address of, and consists of
|
|
|
|
* choices known in advance by the implementing KIFACE.
|
|
|
|
* @return the requested object which must be cast into the known type.
|
2014-02-03 15:10:37 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void* IfaceOrAddress( int aDataId ) = 0;
|
2014-02-03 15:10:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within
|
|
|
|
* the same KiCad process.
|
|
|
|
*
|
|
|
|
* It makes it possible to call between DSOs without having to link them together, and
|
|
|
|
* without having to link to the top process module which houses the KIWAY(s). More
|
|
|
|
* importantly it makes it possible to send custom wxEvents between DSOs and from the top
|
|
|
|
* process module down into the DSOs. The latter capability is thought useful for driving
|
|
|
|
* the lower DSOs from a python test rig or for demo (automation) purposes.
|
2014-02-03 15:10:37 +00:00
|
|
|
* <p>
|
2020-12-19 16:00:52 +00:00
|
|
|
* Most all calls are via virtual functions, which means C++ vtables are used to hold
|
|
|
|
* function pointers and eliminate the need to link to specific object code libraries,
|
|
|
|
* speeding development and encouraging clearly defined interface design. Unlike Microsoft
|
|
|
|
* COM, which is a multi-vendor design supporting DLL's built at various points in time,
|
|
|
|
* the KIWAY alchemy is single project, with all components being built at the same time.
|
|
|
|
* So one should expect solid compatibility between all KiCad components, as long at they
|
|
|
|
* are compiled at the same time.
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* <p>
|
2020-12-19 16:00:52 +00:00
|
|
|
* There is one KIWAY in the launching portion of the process for each open KiCad project.
|
|
|
|
* Each project has its own KIWAY. Available to each KIWAY is an actual PROJECT data
|
|
|
|
* structure. If you have a KIWAY, you can get to the PROJECT using #KIWAY::Prj().
|
2014-02-03 19:26:18 +00:00
|
|
|
* <p>
|
2020-12-19 16:00:52 +00:00
|
|
|
* In summary, a KIWAY facilitates communicating between DSOs, where the topic of the
|
|
|
|
* communication is project specific. Here a "project" means a #BOARD and a #SCHEMATIC
|
|
|
|
* and a #NETLIST, (anything relating to production of a single #BOARD and added to class
|
|
|
|
* #PROJECT.)
|
2014-02-03 15:10:37 +00:00
|
|
|
*/
|
|
|
|
class KIWAY : public wxEvtHandler
|
|
|
|
{
|
2014-11-15 13:43:23 +00:00
|
|
|
friend struct PGM_SINGLE_TOP; // can use set_kiface()
|
2014-02-03 15:10:37 +00:00
|
|
|
|
|
|
|
public:
|
2014-04-19 18:47:20 +00:00
|
|
|
/// Known KIFACE implementations
|
2014-02-03 15:10:37 +00:00
|
|
|
enum FACE_T
|
|
|
|
{
|
2014-04-19 18:47:20 +00:00
|
|
|
FACE_SCH, ///< eeschema DSO
|
|
|
|
FACE_PCB, ///< pcbnew DSO
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
FACE_CVPCB,
|
|
|
|
FACE_GERBVIEW,
|
|
|
|
FACE_PL_EDITOR,
|
|
|
|
FACE_PCB_CALCULATOR,
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
FACE_BMP2CMP,
|
2021-03-01 23:22:34 +00:00
|
|
|
FACE_PYTHON,
|
2014-02-03 15:10:37 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
KIWAY_FACE_COUNT
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
};
|
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
~KIWAY() throw () {}
|
|
|
|
|
2014-04-19 18:47:20 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* A simple mapping function which returns the FACE_T which is known to implement
|
|
|
|
* @a aFrameType.
|
2014-04-19 18:47:20 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return a valid value #KIWAY::FACE_T or FACE_T(-1) if given a bad @a aFrameType.
|
2014-04-19 18:47:20 +00:00
|
|
|
*/
|
|
|
|
static FACE_T KifaceType( FRAME_T aFrameType );
|
|
|
|
|
|
|
|
// If you change the vtable, recompile all of KiCad.
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2014-04-18 02:05:40 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Return the KIFACE* given a FACE_T.
|
|
|
|
*
|
|
|
|
* If it is not already loaded, the KIFACE is loaded and initialized with a call to
|
|
|
|
* KIFACE::OnKifaceStart().
|
2014-04-18 02:05:40 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual KIFACE* KiFACE( FACE_T aFaceId, bool doLoad = true );
|
2014-04-19 18:47:20 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Return 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.
|
2014-04-19 18:47:20 +00:00
|
|
|
*
|
2014-04-20 04:35:34 +00:00
|
|
|
* @param aFrameType is from enum #FRAME_T.
|
2020-12-19 16:00:52 +00:00
|
|
|
* @param doCreate when true asks that the player be created if it is not already created,
|
|
|
|
* false means do not create and maybe return NULL.
|
|
|
|
* @param aParent is a parent for modal #KIWAY_PLAYER frames, otherwise NULL used only
|
|
|
|
* when doCreate = true and by KIWAY_PLAYER frames created in modal form
|
2014-04-20 04:35:34 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return a valid opened #KIWAY_PLAYER or NULL if there is something wrong or doCreate
|
|
|
|
* was false and the player has yet to be created.
|
2016-09-20 15:59:43 +00:00
|
|
|
*
|
|
|
|
* @throw IO_ERROR if the *.kiface file could not be found, filled with text saying what.
|
2014-04-19 18:47:20 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true,
|
|
|
|
wxTopLevelWindow* aParent = nullptr );
|
2014-04-19 18:47:20 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Call 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.
|
2014-04-19 18:47:20 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return true if the window is closed and not vetoed, else false.
|
2014-04-19 18:47:20 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual bool PlayerClose( FRAME_T aFrameType, bool doForce );
|
2014-04-19 18:47:20 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Call the KIWAY_PLAYER::Close( bool force ) function on all the windows and if none
|
|
|
|
* are vetoed, returns true, else false.
|
|
|
|
*
|
|
|
|
* If any window actually closes, then* this KIWAY marks it as not opened internally.
|
2014-04-19 18:47:20 +00:00
|
|
|
*
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return true indicates that all windows closed because none were vetoed, false means
|
|
|
|
* at least one cast a veto. Any that cast a veto are still open.
|
2014-04-19 18:47:20 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual bool PlayersClose( bool doForce );
|
2014-04-19 18:47:20 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Send @a aPayload to @a aDestination from @a aSource.
|
|
|
|
*
|
|
|
|
* The recipient receives this in its #KIWAY_PLAYER::KiwayMailIn() function and can
|
|
|
|
* efficiently switch() based on @a aCommand in there.
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void ExpressMail( FRAME_T aDestination, MAIL_T aCommand, std::string& aPayload,
|
|
|
|
wxWindow* aSource = nullptr );
|
2014-04-19 18:47:20 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Return the #PROJECT associated with this KIWAY.
|
|
|
|
*
|
|
|
|
* This is here as an accessor, so that there is freedom to put the actual PROJECT storage
|
2014-04-19 18:47:20 +00:00
|
|
|
* in a place decided by the implementation, and not known to the caller.
|
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual PROJECT& Prj() const;
|
2014-04-18 02:05:40 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Change the language and then calls ShowChangedLanguage() on all #KIWAY_PLAYERs.
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void SetLanguage( int aLanguage );
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
2017-03-02 13:46:18 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Call CommonSettingsChanged() on all KIWAY_PLAYERs.
|
|
|
|
*
|
|
|
|
* Use after changing suite-wide options such as panning, autosave interval, etc.
|
2017-03-02 13:46:18 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged );
|
2017-03-02 13:46:18 +00:00
|
|
|
|
2020-08-09 18:49:26 +00:00
|
|
|
/**
|
|
|
|
* Calls ProjectChanged() on all KIWAY_PLAYERs.
|
|
|
|
* Used after changing the project to ensure all players are updated correctly.
|
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
virtual void ProjectChanged();
|
2020-08-09 18:49:26 +00:00
|
|
|
|
2020-12-19 16:00:52 +00:00
|
|
|
KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop = nullptr );
|
2014-02-03 15:10:37 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Tell this KIWAY about the top most frame in the program and optionally allows it to
|
|
|
|
* play the role of one of the KIWAY_PLAYERs if launched from single_top.cpp.
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
*
|
|
|
|
* @param aTop is the top most wxFrame in the entire program.
|
|
|
|
*/
|
2014-04-19 19:44:59 +00:00
|
|
|
void SetTop( wxFrame* aTop );
|
2021-03-18 13:28:04 +00:00
|
|
|
wxFrame* GetTop() { return m_top; }
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2019-06-25 04:44:34 +00:00
|
|
|
void OnKiCadExit();
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
void OnKiwayEnd();
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool ProcessEvent( wxEvent& aEvent ) override;
|
2014-04-21 06:28:17 +00:00
|
|
|
|
2014-02-03 15:10:37 +00:00
|
|
|
private:
|
2016-09-20 15:59:43 +00:00
|
|
|
/// Get the [path &] name of the DSO holding the requested FACE_T.
|
|
|
|
const wxString dso_search_path( FACE_T aFaceId );
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2016-03-21 16:36:06 +00:00
|
|
|
#if 0
|
2014-04-19 19:44:59 +00:00
|
|
|
/// hooked into m_top in SetTop(), marks child frame as closed.
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
void player_destroy_handler( wxWindowDestroyEvent& event );
|
2016-03-21 16:36:06 +00:00
|
|
|
#endif
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
|
|
|
|
bool set_kiface( FACE_T aFaceType, KIFACE* aKiface )
|
|
|
|
{
|
2019-03-27 22:37:26 +00:00
|
|
|
if( (unsigned) aFaceType < (unsigned) KIWAY_FACE_COUNT )
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
{
|
|
|
|
m_kiface[aFaceType] = aKiface;
|
|
|
|
return true;
|
|
|
|
}
|
2020-12-19 16:00:52 +00:00
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
return false;
|
|
|
|
}
|
2014-04-19 19:44:59 +00:00
|
|
|
|
2016-01-06 07:36:08 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return the reference of the KIWAY_PLAYER having the type @a aFrameType if exists,
|
|
|
|
* or NULL if this KIWAY_PLAYER was not yet created, or was closed
|
2016-01-06 07:36:08 +00:00
|
|
|
*/
|
|
|
|
KIWAY_PLAYER* GetPlayerFrame( FRAME_T aFrameType );
|
|
|
|
|
2014-04-19 18:47:20 +00:00
|
|
|
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
|
|
|
|
static int m_kiface_version[KIWAY_FACE_COUNT];
|
|
|
|
|
2014-04-19 19:44:59 +00:00
|
|
|
PGM_BASE* m_program;
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
int m_ctl;
|
2016-03-21 16:36:06 +00:00
|
|
|
|
2016-01-06 07:36:08 +00:00
|
|
|
wxFrame* m_top; // Usually m_top is the Project manager
|
|
|
|
|
2021-07-02 19:07:26 +00:00
|
|
|
// An array to store the window ID of PLAYER frames which were run.
|
2016-03-21 16:36:06 +00:00
|
|
|
// A non empty name means only a PLAYER was run at least one time.
|
2021-07-02 19:07:26 +00:00
|
|
|
// Empty entries are represented by wxID_NONE.
|
|
|
|
// They can be closed, and the stored window ID may be invalid.
|
|
|
|
// Call: wxWindow::FindWindowById( m_playerFrameId[aFrameType] )
|
2016-03-21 16:36:06 +00:00
|
|
|
// to know if still exists (or GetPlayerFrame( FRAME_T aFrameType )
|
2021-07-02 19:07:26 +00:00
|
|
|
std::atomic<wxWindowID> m_playerFrameId[KIWAY_PLAYER_COUNT];
|
2014-02-03 15:10:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
#ifndef SWIG
|
|
|
|
// provided by single_top.cpp and kicad.cpp;
|
|
|
|
extern KIWAY Kiway;
|
|
|
|
// whereas python launchers: single_top.py and project manager instantiate as a python object
|
|
|
|
#endif
|
2014-04-19 18:47:20 +00:00
|
|
|
|
|
|
|
|
2014-02-03 15:10:37 +00:00
|
|
|
/**
|
2020-12-19 16:00:52 +00:00
|
|
|
* Point to the one and only KIFACE export.
|
|
|
|
*
|
|
|
|
* The export's address is looked up via symbolic string and should be extern "C" to avoid name
|
|
|
|
* mangling. This function will only be called one time. The DSO itself however may be asked
|
|
|
|
* to support multiple Top windows, i.e. multiple projects within its lifetime.
|
2014-02-03 15:10:37 +00:00
|
|
|
*
|
|
|
|
* @param aKIFACEversion is where to put the API version implemented by the KIFACE.
|
|
|
|
* @param aKIWAYversion tells the KIFACE what KIWAY version will be available.
|
2014-03-20 16:32:34 +00:00
|
|
|
* @param aProgram is a pointer to the PGM_BASE for this process.
|
2020-12-19 16:00:52 +00:00
|
|
|
* @return unconditionally, cannot fail.
|
2014-02-03 15:10:37 +00:00
|
|
|
*/
|
2020-12-19 16:00:52 +00:00
|
|
|
typedef KIFACE* KIFACE_GETTER_FUNC( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
|
2014-02-03 15:10:37 +00:00
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
|
2014-03-20 16:32:34 +00:00
|
|
|
/// No name mangling. Each KIFACE (DSO/DLL) will implement this once.
|
2016-05-28 17:10:06 +00:00
|
|
|
extern "C" {
|
|
|
|
#if defined(BUILD_KIWAY_DLL)
|
2016-09-20 15:59:43 +00:00
|
|
|
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
|
2016-05-28 17:10:06 +00:00
|
|
|
#else
|
2016-09-20 15:59:43 +00:00
|
|
|
KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKIWAYversion, PGM_BASE* aProgram );
|
2016-05-28 17:10:06 +00:00
|
|
|
#endif
|
|
|
|
}
|
2014-02-03 19:26:18 +00:00
|
|
|
|
2016-09-20 15:59:43 +00:00
|
|
|
#endif // SWIG
|
2014-04-19 18:47:20 +00:00
|
|
|
|
2014-02-03 15:10:37 +00:00
|
|
|
#endif // KIWAY_H_
|