2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-11-14 07:23:02 +00:00
|
|
|
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2023-03-19 11:30:53 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 19:56:32 +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
|
|
|
|
*/
|
|
|
|
|
2021-02-06 01:01:50 +00:00
|
|
|
#include <pcbnew_scripting_helpers.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 <pgm_base.h>
|
2023-08-14 00:31:19 +00:00
|
|
|
#include <cli_progress_reporter.h>
|
|
|
|
#include <confirm.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2017-03-23 00:59:25 +00:00
|
|
|
#include <kiface_ids.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <eda_dde.h>
|
2021-03-20 15:35:37 +00:00
|
|
|
#include <macros.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
#include <wx/snglinst.h>
|
2014-03-22 08:28:39 +00:00
|
|
|
#include <gestfich.h>
|
2021-03-23 01:25:03 +00:00
|
|
|
#include <paths.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2021-08-29 23:33:08 +00:00
|
|
|
#include <footprint_editor_settings.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/settings_manager.h>
|
2023-04-18 20:40:25 +00:00
|
|
|
#include <settings/cvpcb_settings.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 <fp_lib_table.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2018-01-31 12:37:36 +00:00
|
|
|
#include <footprint_viewer_frame.h>
|
2023-09-26 17:31:45 +00:00
|
|
|
#include <footprint_chooser_frame.h>
|
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
|
|
|
#include <footprint_wizard_frame.h>
|
2017-03-10 19:11:41 +00:00
|
|
|
#include <footprint_preview_panel.h>
|
2017-03-23 00:59:25 +00:00
|
|
|
#include <footprint_info_impl.h>
|
2020-10-25 13:36:19 +00:00
|
|
|
#include <dialogs/dialog_configure_paths.h>
|
2023-08-26 12:29:24 +00:00
|
|
|
#include <dialogs/panel_grid_settings.h>
|
2021-08-29 23:33:08 +00:00
|
|
|
#include <dialog_global_fp_lib_table_config.h>
|
2023-09-04 11:46:52 +00:00
|
|
|
#include <panel_pcb_display_options.h>
|
2021-08-29 23:33:08 +00:00
|
|
|
#include <panel_edit_options.h>
|
|
|
|
#include <panel_fp_editor_defaults.h>
|
|
|
|
#include <panel_fp_editor_color_settings.h>
|
|
|
|
#include <panel_pcbnew_color_settings.h>
|
|
|
|
#include <panel_pcbnew_action_plugins.h>
|
|
|
|
#include <panel_pcbnew_display_origin.h>
|
|
|
|
#include <panel_3D_display_options.h>
|
|
|
|
#include <panel_3D_opengl_options.h>
|
|
|
|
#include <panel_3D_raytracing_options.h>
|
2021-03-08 14:54:22 +00:00
|
|
|
#include <python_scripting.h>
|
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
#include "invoke_pcb_dialog.h"
|
2021-03-03 01:06:25 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2022-10-04 01:53:37 +00:00
|
|
|
#include "pcbnew_jobs_handler.h"
|
2018-01-29 20:58:58 +00:00
|
|
|
|
2022-12-08 04:55:47 +00:00
|
|
|
#include <wx/crt.h>
|
2012-08-01 11:54:20 +00:00
|
|
|
|
2021-03-18 13:28:04 +00:00
|
|
|
/* init functions defined by swig */
|
|
|
|
|
|
|
|
extern "C" PyObject* PyInit__pcbnew( void );
|
|
|
|
|
* 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
|
|
|
namespace PCB {
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER
|
* 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
|
|
|
{
|
|
|
|
// Of course all are virtual overloads, implementations of the KIFACE.
|
2011-09-26 20:32:56 +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
|
|
|
IFACE( const char* aName, KIWAY::FACE_T aType ) :
|
2022-12-03 19:31:41 +00:00
|
|
|
KIFACE_BASE( aName, aType ),
|
|
|
|
UNITS_PROVIDER( pcbIUScale, EDA_UNITS::MILLIMETRES )
|
* 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
|
|
|
{}
|
|
|
|
|
2024-02-02 23:04:56 +00:00
|
|
|
bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway ) override;
|
* 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
|
|
|
|
2023-01-19 00:14:31 +00:00
|
|
|
void Reset() override;
|
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnKifaceEnd() override;
|
* 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
|
|
|
|
2022-11-08 09:14:40 +00:00
|
|
|
wxWindow* CreateKiWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
|
2023-04-03 16:10:15 +00:00
|
|
|
int aCtlBits = 0 ) override
|
* 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
|
|
|
{
|
|
|
|
switch( aClassId )
|
|
|
|
{
|
2019-09-05 22:00:47 +00:00
|
|
|
case FRAME_PCB_EDITOR:
|
2018-04-04 11:01:47 +00:00
|
|
|
{
|
|
|
|
auto frame = new PCB_EDIT_FRAME( aKiway, aParent );
|
* 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
|
|
|
|
2015-02-15 00:23:54 +00:00
|
|
|
// give the scripting helpers access to our frame
|
2018-04-04 11:01:47 +00:00
|
|
|
ScriptingSetPcbEditFrame( frame );
|
* 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
|
|
|
|
2015-02-15 00:23:54 +00:00
|
|
|
if( Kiface().IsSingle() )
|
|
|
|
{
|
|
|
|
// only run this under single_top, not under a project manager.
|
2018-04-04 11:01:47 +00:00
|
|
|
frame->CreateServer( KICAD_PCB_PORT_SERVICE_NUMBER );
|
* 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
|
|
|
}
|
2015-02-15 00:23:54 +00:00
|
|
|
|
2018-04-04 11:01:47 +00:00
|
|
|
return frame;
|
|
|
|
}
|
* 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
|
|
|
|
2019-09-05 22:00:47 +00:00
|
|
|
case FRAME_FOOTPRINT_EDITOR:
|
2021-11-21 20:32:39 +00:00
|
|
|
return new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
|
2019-08-13 23:28:11 +00:00
|
|
|
|
2019-09-05 22:00:47 +00:00
|
|
|
case FRAME_FOOTPRINT_VIEWER:
|
2023-09-26 17:31:45 +00:00
|
|
|
return new FOOTPRINT_VIEWER_FRAME( aKiway, aParent );
|
|
|
|
|
|
|
|
case FRAME_FOOTPRINT_CHOOSER:
|
|
|
|
return new FOOTPRINT_CHOOSER_FRAME( aKiway, aParent );
|
* 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
|
|
|
|
2019-09-05 22:00:47 +00:00
|
|
|
case FRAME_FOOTPRINT_WIZARD:
|
2018-04-04 11:01:47 +00:00
|
|
|
return new FOOTPRINT_WIZARD_FRAME( aKiway, aParent, FRAME_T( aClassId ) );
|
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
|
|
|
|
2019-09-05 22:00:47 +00:00
|
|
|
case FRAME_FOOTPRINT_PREVIEW:
|
2023-09-02 21:13:48 +00:00
|
|
|
return FOOTPRINT_PREVIEW_PANEL::New( aKiway, aParent, this );
|
2017-02-19 02:39:55 +00:00
|
|
|
|
2019-06-02 23:17:27 +00:00
|
|
|
case DIALOG_CONFIGUREPATHS:
|
|
|
|
{
|
2022-09-26 01:08:51 +00:00
|
|
|
DIALOG_CONFIGURE_PATHS dlg( aParent );
|
2019-06-24 09:22:49 +00:00
|
|
|
|
2020-05-29 20:52:20 +00:00
|
|
|
// The dialog's constructor probably failed to set its Kiway because the
|
2021-06-09 19:32:58 +00:00
|
|
|
// dynamic_cast fails when aParent was allocated by a separate compilation
|
2020-05-29 20:52:20 +00:00
|
|
|
// module. So set it directly.
|
|
|
|
dlg.SetKiway( &dlg, aKiway );
|
|
|
|
|
2020-10-28 23:06:48 +00:00
|
|
|
// Use QuasiModal so that HTML help window will work
|
|
|
|
if( dlg.ShowQuasiModal() == wxID_OK )
|
2020-07-17 20:04:14 +00:00
|
|
|
aKiway->CommonSettingsChanged( true, false );
|
2019-06-24 09:22:49 +00:00
|
|
|
|
2019-06-02 23:17:27 +00:00
|
|
|
// Dialog has completed; nothing to return.
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
case DIALOG_PCB_LIBRARY_TABLE:
|
|
|
|
InvokePcbLibTableEditor( aKiway, aParent );
|
|
|
|
// Dialog has completed; nothing to return.
|
|
|
|
return nullptr;
|
|
|
|
|
2021-08-29 23:33:08 +00:00
|
|
|
case PANEL_FP_DISPLAY_OPTIONS:
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
|
|
|
|
2023-09-04 11:46:52 +00:00
|
|
|
return new PANEL_PCB_DISPLAY_OPTIONS( aParent, cfg );
|
2021-08-29 23:33:08 +00:00
|
|
|
}
|
|
|
|
|
2023-08-26 12:29:24 +00:00
|
|
|
case PANEL_FP_GRIDS:
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
|
|
|
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
|
|
|
|
|
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
|
|
|
|
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
|
|
|
|
|
|
|
if( frame )
|
|
|
|
SetUserUnits( frame->GetUserUnits() );
|
|
|
|
|
|
|
|
return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_FOOTPRINT_EDITOR );
|
|
|
|
}
|
|
|
|
|
2023-10-26 09:59:06 +00:00
|
|
|
case PANEL_FP_ORIGINS_AXES:
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<FOOTPRINT_EDITOR_SETTINGS>();
|
|
|
|
|
|
|
|
return new PANEL_PCBNEW_DISPLAY_ORIGIN( aParent, cfg, FRAME_FOOTPRINT_EDITOR );
|
|
|
|
}
|
|
|
|
|
2021-08-29 23:33:08 +00:00
|
|
|
case PANEL_FP_EDIT_OPTIONS:
|
|
|
|
{
|
2022-12-03 19:31:41 +00:00
|
|
|
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( frame )
|
2023-04-03 16:10:15 +00:00
|
|
|
SetUserUnits( frame->GetUserUnits() );
|
|
|
|
|
|
|
|
return new PANEL_EDIT_OPTIONS( aParent, this, frame, true );
|
2022-12-03 19:31:41 +00:00
|
|
|
}
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
case PANEL_FP_DEFAULT_VALUES:
|
|
|
|
{
|
|
|
|
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
|
|
|
|
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
|
|
|
|
|
|
|
if( frame )
|
2023-04-03 16:10:15 +00:00
|
|
|
SetUserUnits( frame->GetUserUnits() );
|
|
|
|
|
|
|
|
return new PANEL_FP_EDITOR_DEFAULTS( aParent, this );
|
2021-08-29 23:33:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case PANEL_FP_COLORS:
|
|
|
|
return new PANEL_FP_EDITOR_COLOR_SETTINGS( aParent );
|
|
|
|
|
2023-09-04 11:46:52 +00:00
|
|
|
case PANEL_PCB_DISPLAY_OPTS:
|
2021-08-29 23:33:08 +00:00
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
2023-10-26 09:59:06 +00:00
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
2021-08-29 23:33:08 +00:00
|
|
|
|
2023-09-04 11:46:52 +00:00
|
|
|
return new PANEL_PCB_DISPLAY_OPTIONS( aParent, cfg );
|
2021-08-29 23:33:08 +00:00
|
|
|
}
|
|
|
|
|
2023-08-26 12:29:24 +00:00
|
|
|
case PANEL_PCB_GRIDS:
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
|
|
|
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
|
|
|
|
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
|
|
|
|
|
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
|
|
|
|
|
|
|
if( frame )
|
|
|
|
SetUserUnits( frame->GetUserUnits() );
|
|
|
|
|
|
|
|
return new PANEL_GRID_SETTINGS( aParent, this, frame, cfg, FRAME_PCB_EDITOR );
|
|
|
|
}
|
|
|
|
|
2023-10-26 09:59:06 +00:00
|
|
|
case PANEL_PCB_ORIGINS_AXES:
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
|
|
|
|
|
|
|
return new PANEL_PCBNEW_DISPLAY_ORIGIN( aParent, cfg, FRAME_PCB_EDITOR );
|
|
|
|
}
|
|
|
|
|
2021-08-29 23:33:08 +00:00
|
|
|
case PANEL_PCB_EDIT_OPTIONS:
|
2022-01-19 13:24:02 +00:00
|
|
|
{
|
2022-12-03 19:31:41 +00:00
|
|
|
EDA_BASE_FRAME* frame = aKiway->Player( FRAME_PCB_EDITOR, false );
|
2022-01-19 13:24:02 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_EDITOR, false );
|
2022-01-19 13:24:02 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( !frame )
|
|
|
|
frame = aKiway->Player( FRAME_FOOTPRINT_VIEWER, false );
|
2022-01-19 13:24:02 +00:00
|
|
|
|
2022-12-03 19:31:41 +00:00
|
|
|
if( frame )
|
2023-04-03 16:10:15 +00:00
|
|
|
SetUserUnits( frame->GetUserUnits() );
|
|
|
|
|
|
|
|
return new PANEL_EDIT_OPTIONS( aParent, this, frame, false );
|
2022-01-19 13:24:02 +00:00
|
|
|
}
|
2021-08-29 23:33:08 +00:00
|
|
|
|
|
|
|
case PANEL_PCB_COLORS:
|
|
|
|
{
|
|
|
|
BOARD* board = nullptr;
|
|
|
|
EDA_BASE_FRAME* boardProvider = aKiway->Player( FRAME_PCB_EDITOR, false );
|
|
|
|
|
|
|
|
if( boardProvider )
|
|
|
|
board = static_cast<PCB_EDIT_FRAME*>( boardProvider )->GetBoard();
|
|
|
|
|
|
|
|
return new PANEL_PCBNEW_COLOR_SETTINGS( aParent, board );
|
|
|
|
}
|
|
|
|
|
|
|
|
case PANEL_PCB_ACTION_PLUGINS:
|
|
|
|
return new PANEL_PCBNEW_ACTION_PLUGINS( aParent );
|
|
|
|
|
|
|
|
case PANEL_3DV_DISPLAY_OPTIONS:
|
|
|
|
return new PANEL_3D_DISPLAY_OPTIONS( aParent );
|
|
|
|
|
|
|
|
case PANEL_3DV_OPENGL:
|
|
|
|
return new PANEL_3D_OPENGL_OPTIONS( aParent );
|
|
|
|
|
|
|
|
case PANEL_3DV_RAYTRACING:
|
|
|
|
return new PANEL_3D_RAYTRACING_OPTIONS( aParent );
|
|
|
|
|
* 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
|
|
|
default:
|
2018-04-04 11:01:47 +00:00
|
|
|
return nullptr;
|
* 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-07-19 23:56:05 +00:00
|
|
|
* Return a pointer to the requested object.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
* 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 aDataId identifies which object you want the address of.
|
2021-07-19 23:56:05 +00:00
|
|
|
* @return the object which must be cast into the know 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
|
|
|
*/
|
2016-09-25 17:06:49 +00:00
|
|
|
void* IfaceOrAddress( int aDataId ) override
|
* 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
|
|
|
{
|
2017-03-23 00:59:25 +00:00
|
|
|
switch( aDataId )
|
|
|
|
{
|
2018-05-01 20:46:05 +00:00
|
|
|
// Return a pointer to the global instance of the footprint list.
|
|
|
|
case KIFACE_FOOTPRINT_LIST:
|
2018-03-25 12:48:13 +00:00
|
|
|
return (void*) &GFootprintList;
|
2017-03-23 00:59:25 +00:00
|
|
|
|
2018-05-01 20:46:05 +00:00
|
|
|
// Return a new FP_LIB_TABLE with the global table installed as a fallback.
|
|
|
|
case KIFACE_NEW_FOOTPRINT_TABLE:
|
2017-03-23 00:59:25 +00:00
|
|
|
return (void*) new FP_LIB_TABLE( &GFootprintTable );
|
|
|
|
|
2018-05-01 20:46:05 +00:00
|
|
|
// Return a pointer to the global instance of the global footprint table.
|
|
|
|
case KIFACE_GLOBAL_FOOTPRINT_TABLE:
|
|
|
|
return (void*) &GFootprintTable;
|
|
|
|
|
2021-03-18 13:28:04 +00:00
|
|
|
case KIFACE_SCRIPTING_LEGACY:
|
|
|
|
return reinterpret_cast<void*>( PyInit__pcbnew );
|
|
|
|
|
2017-03-23 00:59:25 +00:00
|
|
|
default:
|
|
|
|
return nullptr;
|
|
|
|
}
|
* 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
|
|
|
}
|
|
|
|
|
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).
|
|
|
|
*/
|
2019-11-10 08:37:39 +00:00
|
|
|
void SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcProjectName,
|
|
|
|
const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
|
|
|
|
const wxString& aSrcFilePath, wxString& aErrors ) override;
|
2019-11-09 19:39:08 +00:00
|
|
|
|
2022-10-04 01:53:37 +00:00
|
|
|
int HandleJob( JOB* aJob ) override;
|
|
|
|
|
|
|
|
private:
|
2023-01-19 00:14:31 +00:00
|
|
|
bool loadGlobalLibTable();
|
|
|
|
|
2022-10-04 01:53:37 +00:00
|
|
|
std::unique_ptr<PCBNEW_JOBS_HANDLER> m_jobHandler;
|
|
|
|
|
* 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
|
|
|
} kiface( "pcbnew", KIWAY::FACE_PCB );
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2021-07-19 23:56:05 +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
|
|
|
using namespace PCB;
|
|
|
|
|
|
|
|
|
|
|
|
static PGM_BASE* process;
|
|
|
|
|
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
KIFACE_BASE& Kiface() { return 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
|
|
|
|
|
|
|
|
|
|
|
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
|
|
|
|
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
|
2023-09-09 00:44:08 +00:00
|
|
|
KIFACE_API KIFACE* KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
|
2010-02-24 18:36:01 +00:00
|
|
|
{
|
2015-11-04 08:48:34 +00:00
|
|
|
process = aProgram;
|
* 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
|
|
|
return &kiface;
|
|
|
|
}
|
2010-02-24 15:33:03 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2015-02-15 00:23:54 +00:00
|
|
|
#if defined( BUILD_KIWAY_DLL )
|
* 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
|
|
|
PGM_BASE& Pgm()
|
|
|
|
{
|
|
|
|
wxASSERT( process ); // KIFACE_GETTER has already been called.
|
|
|
|
return *process;
|
2010-01-16 19:42:58 +00:00
|
|
|
}
|
2019-10-05 08:39:12 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2019-11-10 14:51:06 +00:00
|
|
|
// Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from a python script.
|
2019-10-05 08:39:12 +00:00
|
|
|
PGM_BASE* PgmOrNull()
|
|
|
|
{
|
|
|
|
return process;
|
|
|
|
}
|
2014-04-08 04:55:53 +00:00
|
|
|
#endif
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
|
2014-03-20 06:24:33 +00:00
|
|
|
/// The global footprint library table. This is not dynamically allocated because
|
|
|
|
/// in a multiple project environment we must keep its address constant (since it is
|
|
|
|
/// the fallback table for multiple projects).
|
2018-03-25 12:48:13 +00:00
|
|
|
FP_LIB_TABLE GFootprintTable;
|
|
|
|
|
|
|
|
/// The global footprint info table. This is performance-intensive to build so we
|
|
|
|
/// keep a hash-stamped global version. Any deviation from the request vs. stored
|
|
|
|
/// hash will result in it being rebuilt.
|
|
|
|
FOOTPRINT_LIST_IMPL GFootprintList;
|
|
|
|
|
2013-01-04 17:47:59 +00:00
|
|
|
|
2024-02-02 23:04:56 +00:00
|
|
|
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits, KIWAY* aKiway )
|
2014-03-20 06:24:33 +00:00
|
|
|
{
|
2019-11-10 14:51:06 +00:00
|
|
|
// This is process-level-initialization, not project-level-initialization of the DSO.
|
2014-03-20 06:24:33 +00:00
|
|
|
// Do nothing in here pertinent to a project!
|
2020-01-13 01:44:19 +00:00
|
|
|
InitSettings( new PCBNEW_SETTINGS );
|
2023-09-05 03:22:39 +00:00
|
|
|
aProgram->GetSettingsManager().RegisterSettings( new FOOTPRINT_EDITOR_SETTINGS );
|
|
|
|
aProgram->GetSettingsManager().RegisterSettings( new EDA_3D_VIEWER_SETTINGS );
|
|
|
|
|
|
|
|
// We intentionally register KifaceSettings after FOOTPRINT_EDITOR_SETTINGS and EDA_3D_VIEWER_SETTINGS
|
|
|
|
// In legacy configs, many settings were in a single editor config and the migration routine
|
|
|
|
// for the main editor file will try and call into the now separate settings stores
|
|
|
|
// to move the settings into them
|
2023-09-05 02:41:03 +00:00
|
|
|
aProgram->GetSettingsManager().RegisterSettings( KifaceSettings() );
|
2013-01-04 17:47:59 +00:00
|
|
|
|
2023-04-18 20:40:25 +00:00
|
|
|
// Register the footprint editor settings as well because they share a KiFACE and need to be
|
|
|
|
// loaded prior to use to avoid threading deadlocks
|
2023-09-05 02:41:03 +00:00
|
|
|
aProgram->GetSettingsManager().RegisterSettings( new CVPCB_SETTINGS );
|
2023-04-18 20:40:25 +00:00
|
|
|
|
2014-04-18 02:05:40 +00:00
|
|
|
start_common( aCtlBits );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2023-01-19 00:14:31 +00:00
|
|
|
if( !loadGlobalLibTable() )
|
|
|
|
return false;
|
|
|
|
|
2024-02-02 23:04:56 +00:00
|
|
|
m_jobHandler = std::make_unique<PCBNEW_JOBS_HANDLER>( aKiway );
|
2023-01-19 00:14:31 +00:00
|
|
|
|
2023-03-24 10:31:08 +00:00
|
|
|
if( m_start_flags & KFCTL_CLI )
|
2023-08-14 00:31:19 +00:00
|
|
|
{
|
2023-03-24 10:31:08 +00:00
|
|
|
m_jobHandler->SetReporter( &CLI_REPORTER::GetInstance() );
|
2023-08-14 00:31:19 +00:00
|
|
|
m_jobHandler->SetProgressReporter( &CLI_PROGRESS_REPORTER::GetInstance() );
|
|
|
|
}
|
2023-03-24 10:31:08 +00:00
|
|
|
|
2023-01-19 00:14:31 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void IFACE::Reset()
|
|
|
|
{
|
|
|
|
loadGlobalLibTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool IFACE::loadGlobalLibTable()
|
|
|
|
{
|
2019-01-20 18:51:07 +00:00
|
|
|
wxFileName fn = FP_LIB_TABLE::GetGlobalTableFileName();
|
|
|
|
|
|
|
|
if( !fn.FileExists() )
|
2007-08-04 00:47:36 +00:00
|
|
|
{
|
2023-01-19 00:14:31 +00:00
|
|
|
if( !( m_start_flags & KFCTL_CLI ) )
|
2022-12-08 04:55:47 +00:00
|
|
|
{
|
2023-06-24 16:09:43 +00:00
|
|
|
// Ensure the splash screen does not hide the dialog:
|
|
|
|
Pgm().HideSplash();
|
|
|
|
|
2022-12-08 04:55:47 +00:00
|
|
|
DIALOG_GLOBAL_FP_LIB_TABLE_CONFIG fpDialog( nullptr );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2023-03-19 11:30:53 +00:00
|
|
|
if( fpDialog.ShowModal() != wxID_OK )
|
|
|
|
return false;
|
2022-12-08 04:55:47 +00:00
|
|
|
}
|
2007-08-04 00:47:36 +00:00
|
|
|
}
|
2019-01-20 18:51:07 +00:00
|
|
|
else
|
2014-03-20 06:24:33 +00:00
|
|
|
{
|
2019-01-20 18:51:07 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
// The global table is not related to a specific project. All projects
|
|
|
|
// will use the same global table. So the KIFACE::OnKifaceStart() contract
|
|
|
|
// of avoiding anything project specific is not violated here.
|
|
|
|
if( !FP_LIB_TABLE::LoadGlobalTable( GFootprintTable ) )
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& ioe )
|
|
|
|
{
|
|
|
|
// if we are here, a incorrect global footprint library table was found.
|
|
|
|
// Incorrect global symbol library table is not a fatal error:
|
|
|
|
// the user just has to edit the (partially) loaded table.
|
2022-02-04 22:44:59 +00:00
|
|
|
wxString msg = _( "An error occurred attempting to load the global footprint library "
|
|
|
|
"table.\n"
|
|
|
|
"Please edit this global footprint library table in Preferences "
|
|
|
|
"menu." );
|
2019-01-20 18:51:07 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
DisplayErrorMessage( nullptr, msg, ioe.What() );
|
2019-01-20 18:51:07 +00:00
|
|
|
}
|
2014-03-20 06:24:33 +00:00
|
|
|
}
|
2007-08-04 00:47:36 +00:00
|
|
|
|
2012-08-01 11:54:20 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-08-02 17:24:53 +00:00
|
|
|
|
2013-05-08 20:47:23 +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
|
|
|
void IFACE::OnKifaceEnd()
|
2013-05-08 20:47:23 +00:00
|
|
|
{
|
2018-06-01 15:57:52 +00:00
|
|
|
end_common();
|
2012-08-01 11:54:20 +00:00
|
|
|
}
|
2019-11-09 19:39:08 +00:00
|
|
|
|
|
|
|
|
2019-11-10 08:37:39 +00:00
|
|
|
void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aSrcProjectName,
|
|
|
|
const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
|
|
|
|
const wxString& aSrcFilePath, wxString& aErrors )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
wxFileName destFile( aSrcFilePath );
|
2020-02-02 23:00:54 +00:00
|
|
|
wxString destPath = destFile.GetPathWithSep();
|
|
|
|
wxUniChar pathSep = wxFileName::GetPathSeparator();
|
2019-11-09 19:39:08 +00:00
|
|
|
wxString ext = destFile.GetExt();
|
|
|
|
|
2020-02-02 23:00:54 +00:00
|
|
|
if( destPath.StartsWith( aProjectBasePath + pathSep ) )
|
2019-11-09 19:39:08 +00:00
|
|
|
destPath.Replace( aProjectBasePath, aNewProjectBasePath, false );
|
2020-02-02 23:00:54 +00:00
|
|
|
|
2022-02-04 22:44:59 +00:00
|
|
|
wxString srcProjectFootprintLib = pathSep + aSrcProjectName + wxT( ".pretty" ) + pathSep;
|
|
|
|
wxString newProjectFootprintLib = pathSep + aNewProjectName + wxT( ".pretty" ) + pathSep;
|
2020-02-02 23:00:54 +00:00
|
|
|
|
|
|
|
destPath.Replace( srcProjectFootprintLib, newProjectFootprintLib, true );
|
|
|
|
|
|
|
|
destFile.SetPath( destPath );
|
2019-11-09 19:39:08 +00:00
|
|
|
|
2023-12-28 02:10:01 +00:00
|
|
|
if( ext == FILEEXT::KiCadPcbFileExtension
|
|
|
|
|| ext == FILEEXT::KiCadPcbFileExtension + FILEEXT::BackupFileSuffix )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
if( destFile.GetName() == aSrcProjectName )
|
|
|
|
destFile.SetName( aNewProjectName );
|
|
|
|
|
2020-10-02 18:36:06 +00:00
|
|
|
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
2023-12-28 02:10:01 +00:00
|
|
|
else if( ext == FILEEXT::LegacyPcbFileExtension )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
if( destFile.GetName() == aSrcProjectName )
|
|
|
|
destFile.SetName( aNewProjectName );
|
|
|
|
|
2020-10-02 18:36:06 +00:00
|
|
|
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
2023-12-28 02:10:01 +00:00
|
|
|
else if( ext == FILEEXT::LegacyFootprintLibPathExtension
|
|
|
|
|| ext == FILEEXT::KiCadFootprintFileExtension )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
// Footprints are not project-specific. Keep their source names.
|
2020-10-02 18:36:06 +00:00
|
|
|
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
2023-12-28 02:10:01 +00:00
|
|
|
else if( ext == FILEEXT::FootprintAssignmentFileExtension )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
2021-07-17 19:56:18 +00:00
|
|
|
// TODO
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
2022-02-04 22:44:59 +00:00
|
|
|
else if( ext == wxT( "rpt" ) )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
2021-06-09 19:32:58 +00:00
|
|
|
// DRC must be the "gold standard". Since we can't guarantee that there aren't
|
2019-11-09 19:39:08 +00:00
|
|
|
// any non-deterministic cases in the save-as algorithm, we don't want to certify
|
|
|
|
// the result with the source's DRC report. Therefore copy it under the old
|
|
|
|
// name.
|
2020-10-02 18:36:06 +00:00
|
|
|
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
2022-02-04 22:44:59 +00:00
|
|
|
else if( destFile.GetName() == wxT( "fp-lib-table" ) )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
FP_LIB_TABLE fpLibTable;
|
|
|
|
fpLibTable.Load( aSrcFilePath );
|
|
|
|
|
2019-11-10 08:37:39 +00:00
|
|
|
for( unsigned i = 0; i < fpLibTable.GetCount(); i++ )
|
2019-11-09 19:39:08 +00:00
|
|
|
{
|
|
|
|
LIB_TABLE_ROW& row = fpLibTable.At( i );
|
|
|
|
wxString uri = row.GetFullURI();
|
|
|
|
|
2022-02-04 22:44:59 +00:00
|
|
|
uri.Replace( wxT( "/" ) + aSrcProjectName + wxT( ".pretty" ),
|
|
|
|
wxT( "/" ) + aNewProjectName + wxT( ".pretty" ) );
|
2019-11-09 19:39:08 +00:00
|
|
|
|
|
|
|
row.SetFullURI( uri );
|
|
|
|
}
|
|
|
|
|
|
|
|
fpLibTable.Save( destFile.GetFullPath() );
|
|
|
|
}
|
|
|
|
catch( ... )
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
if( !aErrors.empty() )
|
2022-02-04 22:44:59 +00:00
|
|
|
aErrors += wxT( "\n" );
|
2019-11-09 19:39:08 +00:00
|
|
|
|
2021-06-16 22:35:00 +00:00
|
|
|
msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
|
2019-11-09 19:39:08 +00:00
|
|
|
aErrors += msg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-02-04 22:44:59 +00:00
|
|
|
wxFAIL_MSG( wxT( "Unexpected filetype for Pcbnew::SaveFileAs()" ) );
|
2019-11-09 19:39:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-04 01:53:37 +00:00
|
|
|
|
|
|
|
int IFACE::HandleJob( JOB* aJob )
|
|
|
|
{
|
|
|
|
return m_jobHandler->RunJob( aJob );
|
2023-04-18 20:40:25 +00:00
|
|
|
}
|