You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1015 lines
36 KiB

* 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.
12 years ago
17 years ago
* 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.
12 years ago
14 years ago
14 years ago
* 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.
12 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
14 years ago
11 years ago
* 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.
12 years ago
* 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.
12 years ago
* 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.
12 years ago
* 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.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
  5. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef WXPCB_STRUCT_H_
  21. #define WXPCB_STRUCT_H_
  22. #include <unordered_map>
  23. #include <map>
  24. #include "pcb_base_edit_frame.h"
  25. #include "config_params.h"
  26. #include "undo_redo_container.h"
  27. #include "zones.h"
  28. /* Forward declarations of classes. */
  29. class ACTION_PLUGIN;
  30. class PCB_SCREEN;
  31. class BOARD;
  32. class BOARD_COMMIT;
  33. class BOARD_ITEM_CONTAINER;
  34. class TEXTE_PCB;
  35. class MODULE;
  36. class TRACK;
  37. class VIA;
  38. class D_PAD;
  39. class TEXTE_MODULE;
  40. class PCB_TARGET;
  41. class DIMENSION;
  42. class EDGE_MODULE;
  43. class DRC;
  44. class DIALOG_PLOT;
  45. class ZONE_CONTAINER;
  46. class DRAWSEGMENT;
  47. class GENERAL_COLLECTOR;
  48. class GENERAL_COLLECTORS_GUIDE;
  49. class PCB_LAYER_WIDGET;
  50. class MARKER_PCB;
  51. class BOARD_ITEM;
  52. class PCB_LAYER_BOX_SELECTOR;
  53. class NETLIST;
  54. class REPORTER;
  55. struct PARSE_ERROR;
  56. class IO_ERROR;
  57. class FP_LIB_TABLE;
  58. class BOARD_NETLIST_UPDATER;
  59. class ACTION_MENU;
  60. namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
  61. /**
  62. * Enum to signify the result of editing tracks and vias
  63. */
  64. enum TRACK_ACTION_RESULT
  65. {
  66. TRACK_ACTION_DRC_ERROR = -1,//!< TRACK_ACTION_DRC_ERROR - Track not changed to to DRC
  67. TRACK_ACTION_SUCCESS, //!< TRACK_ACTION_SUCCESS - Track changed successfully
  68. TRACK_ACTION_NONE //!< TRACK_ACTION_NONE - Nothing to change
  69. };
  70. /**
  71. * Class PCB_EDIT_FRAME
  72. * is the main frame for Pcbnew.
  73. *
  74. * See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
  75. */
  76. class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
  77. {
  78. friend struct PCB::IFACE;
  79. friend class PCB_LAYER_WIDGET;
  80. /// The auxiliary right vertical tool bar used to access the microwave tools.
  81. ACTION_TOOLBAR* m_microWaveToolBar;
  82. protected:
  83. PCB_LAYER_WIDGET* m_Layers;
  84. PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings.
  85. PARAM_CFG_ARRAY m_projectFileParams;
  86. wxString m_lastNetListRead; ///< Last net list read with relative path.
  87. // The Tool Framework initalization
  88. void setupTools();
  89. wxString createBackupFile( const wxString& aFileName );
  90. /**
  91. * switches currently used canvas (Cairo / OpenGL).
  92. * It also reinit the layers manager that slightly changes with canvases
  93. */
  94. void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
  95. #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
  96. /**
  97. * Function buildActionPluginMenus
  98. * Fill action menu with all registered action plugins
  99. */
  100. void buildActionPluginMenus( ACTION_MENU* aActionMenu );
  101. /**
  102. * Function AddActionPluginTools
  103. * Append action plugin buttons to main toolbar
  104. */
  105. void AddActionPluginTools();
  106. /**
  107. * Function RunActionPlugin
  108. * Executes action plugin's Run() method and updates undo buffer
  109. * @param aActionPlugin action plugin
  110. */
  111. void RunActionPlugin( ACTION_PLUGIN* aActionPlugin );
  112. /**
  113. * Function OnActionPluginMenu
  114. * Launched by the menu when an action is called
  115. * @param aEvent sent by wx
  116. */
  117. void OnActionPluginMenu( wxCommandEvent& aEvent);
  118. /**
  119. * Function OnActionPluginButton
  120. * Launched by the button when an action is called
  121. * @param aEvent sent by wx
  122. */
  123. void OnActionPluginButton( wxCommandEvent& aEvent );
  124. /**
  125. * Function OnActionPluginRefresh
  126. * Refresh plugin list (reload Python plugins)
  127. * @param aEvent sent by wx
  128. */
  129. void OnActionPluginRefresh( wxCommandEvent& aEvent)
  130. {
  131. PythonPluginsReload();
  132. }
  133. #endif
  134. /** Has meaning only if KICAD_SCRIPTING_WXPYTHON option is
  135. * not defined
  136. * @return the frame name identifier for the python console frame
  137. */
  138. static const wxChar * pythonConsoleNameId()
  139. {
  140. return wxT( "PythonConsole" );
  141. }
  142. /**
  143. * @return a pointer to the python console frame, or NULL if not exist
  144. */
  145. static wxWindow * findPythonConsole()
  146. {
  147. return FindWindowByName( pythonConsoleNameId() );
  148. }
  149. /**
  150. * Updates the state of the GUI after a new board is loaded or created
  151. */
  152. void onBoardLoaded();
  153. /**
  154. * Function syncLayerWidgetLayer
  155. * updates the currently layer "selection" within the PCB_LAYER_WIDGET.
  156. * The currently selected layer is defined by the return value of GetActiveLayer().
  157. * <p>
  158. * This function cannot be inline without including layer_widget.h in
  159. * here and we do not want to do that.
  160. * </p>
  161. */
  162. void syncLayerWidgetLayer();
  163. /**
  164. * Function syncRenderStates
  165. * updates the "Render" checkboxes in the layer widget according
  166. * to current toggle values determined by IsElementVisible(), and is helpful
  167. * immediately after loading a BOARD which may have state information in it.
  168. */
  169. void syncRenderStates();
  170. /**
  171. * Function syncLayerVisibilities
  172. * updates each "Layer" checkbox in the layer widget according
  173. * to each layer's current visibility determined by IsLayerVisible(), and is
  174. * helpful immediately after loading a BOARD which may have state information in it.
  175. */
  176. void syncLayerVisibilities();
  177. /**
  178. * Function doAutoSave
  179. * performs auto save when the board has been modified and not saved within the
  180. * auto save interval.
  181. *
  182. * @return true if the auto save was successful.
  183. */
  184. bool doAutoSave() override;
  185. /**
  186. * Function isautoSaveRequired
  187. * returns true if the board has been modified.
  188. */
  189. bool isAutoSaveRequired() const override;
  190. /**
  191. * Load the given filename but sets the path to the current project path.
  192. * @param full filepath of file to be imported.
  193. * @param aFileType PCB_FILE_T value for filetype
  194. */
  195. bool importFile( const wxString& aFileName, int aFileType );
  196. /**
  197. * Use the existing edge_cut line thicknesses to infer the edge clearace.
  198. */
  199. int inferLegacyEdgeClearance( BOARD* aBoard );
  200. /**
  201. * Rematch orphaned zones and vias to schematic nets.
  202. */
  203. bool fixEagleNets( const std::unordered_map<wxString, wxString>& aRemap );
  204. // protected so that PCB::IFACE::CreateWindow() is the only factory.
  205. PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
  206. public:
  207. PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
  208. wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
  209. wxChoice* m_SelViaSizeBox; // a choice box to display and select current via diameter
  210. bool m_show_microwave_tools;
  211. bool m_show_layer_manager_tools;
  212. bool m_ZoneFillsDirty; // Board has been modified since last zone fill.
  213. virtual ~PCB_EDIT_FRAME();
  214. /**
  215. * Function loadFootprints
  216. * loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
  217. *
  218. * @param aNetlist is the netlist of components to load the footprints into.
  219. * @param aReporter is the #REPORTER object to report to.
  220. * @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
  221. * occurs while reading footprint library files.
  222. */
  223. void LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter );
  224. void OnQuit( wxCommandEvent& event );
  225. /**
  226. * Reload the Python plugins if they are newer than
  227. * the already loaded, and load new plugins if any
  228. * Do nothing if KICAD_SCRIPTING is not defined
  229. */
  230. void PythonPluginsReload();
  231. /**
  232. * Update the layer manager and other widgets from the board setup
  233. * (layer and items visibility, colors ...)
  234. */
  235. void UpdateUserInterface();
  236. /**
  237. * Execute a remote command send by Eeschema via a socket,
  238. * port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
  239. * this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
  240. * @param cmdline = received command from socket
  241. */
  242. void ExecuteRemoteCommand( const char* cmdline ) override;
  243. void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
  244. /**
  245. * Function ToPlotter
  246. * Open a dialog frame to create plot and drill files relative to the current board.
  247. */
  248. void ToPlotter( int aID );
  249. /**
  250. * Function SVG_Print
  251. * Shows the Export to SVG file dialog.
  252. */
  253. void ExportSVG( wxCommandEvent& event );
  254. // User interface update command event handlers.
  255. void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
  256. bool LayerManagerShown();
  257. bool MicrowaveToolbarShown();
  258. void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
  259. void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
  260. void OnLayerColorChange( wxCommandEvent& aEvent );
  261. void RunEeschema();
  262. void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit = true );
  263. void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit = true );
  264. /**
  265. * Function IsGridVisible() , virtual
  266. * @return true if the grid must be shown
  267. */
  268. bool IsGridVisible() const override;
  269. /**
  270. * Function SetGridVisibility() , virtual
  271. * It may be overloaded by derived classes
  272. * if you want to store/retrieve the grid visibility in configuration.
  273. * @param aVisible = true if the grid must be shown
  274. */
  275. void SetGridVisibility( bool aVisible ) override;
  276. /**
  277. * Function GetGridColor() , virtual
  278. * @return the color of the grid
  279. */
  280. COLOR4D GetGridColor() override;
  281. /**
  282. * Function SetGridColor() , virtual
  283. * @param aColor = the new color of the grid
  284. */
  285. void SetGridColor( COLOR4D aColor ) override;
  286. // Configurations:
  287. void Process_Config( wxCommandEvent& event );
  288. #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
  289. /**
  290. * Function SetActionPluginSettings
  291. * Set a set of plugins that have visible buttons on toolbar
  292. * Plugins are identified by their module path
  293. */
  294. void SetActionPluginSettings( const std::vector< std::pair<wxString, wxString> >& aPluginsWithButtons );
  295. /**
  296. * Function GetActionPluginSettings
  297. * Get a set of plugins that have visible buttons on toolbar
  298. */
  299. std::vector< std::pair<wxString, wxString> > GetActionPluginSettings();
  300. /**
  301. * Function GetActionPluginButtonVisible
  302. * Returns true if button visibility action plugin setting was set to true
  303. * or it is unset and plugin defaults to true.
  304. */
  305. bool GetActionPluginButtonVisible( const wxString& aPluginPath, bool aPluginDefault );
  306. /**
  307. * Function GetOrderedActionPlugins
  308. * Returns ordered list of plugins in sequence in which they should appear on toolbar or in settings
  309. */
  310. std::vector<ACTION_PLUGIN*> GetOrderedActionPlugins();
  311. #endif
  312. /**
  313. * Function GetProjectFileParameters
  314. * returns a project file parameter list for Pcbnew.
  315. * <p>
  316. * Populate a project file parameter array specific to Pcbnew.
  317. * Creating the parameter list at run time has the advantage of being able
  318. * to define local variables. The old method of statically building the array
  319. * at compile time requiring global variable definitions by design.
  320. * </p>
  321. * @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
  322. * don't keep it around past that event.
  323. */
  324. PARAM_CFG_ARRAY& GetProjectFileParameters();
  325. /**
  326. * Function SaveProjectSettings
  327. * saves changes to the project settings to the project (.pro) file.
  328. * @param aAskForSave = true to open a dialog before saving the settings
  329. */
  330. void SaveProjectSettings( bool aAskForSave ) override;
  331. /**
  332. * Load the current project's file configuration settings which are pertinent
  333. * to this PCB_EDIT_FRAME instance.
  334. *
  335. * @return always returns true.
  336. */
  337. bool LoadProjectSettings();
  338. /**
  339. * Function GetConfigurationSettings
  340. * returns the Pcbnew applications settings list.
  341. *
  342. * This replaces the old statically defined list that had the project
  343. * file settings and the application settings mixed together. This
  344. * was confusing and caused some settings to get saved and loaded
  345. * incorrectly. Currently, only the settings that are needed at start
  346. * up by the main window are defined here. There are other locally used
  347. * settings that are scattered throughout the Pcbnew source code. If you need
  348. * to define a configuration setting that needs to be loaded at run time,
  349. * this is the place to define it.
  350. *
  351. * @return - Reference to the list of applications settings.
  352. */
  353. PARAM_CFG_ARRAY& GetConfigurationSettings();
  354. void LoadSettings( wxConfigBase* aCfg ) override;
  355. void SaveSettings( wxConfigBase* aCfg ) override;
  356. wxConfigBase* GetSettings() { return config(); };
  357. /**
  358. * Get the last net list read with the net list dialog box.
  359. * @return - Absolute path and file name of the last net list file successfully read.
  360. */
  361. wxString GetLastNetListRead();
  362. /**
  363. * Set the last net list successfully read by the net list dialog box.
  364. *
  365. * Note: the file path is converted to a path relative to the project file path. If
  366. * the path cannot be made relative, than m_lastNetListRead is set to and empty
  367. * string. This could happen when the net list file is on a different drive than
  368. * the project file. The advantage of relative paths is that is more likely to
  369. * work when opening the same project from both Windows and Linux.
  370. *
  371. * @param aNetListFile - The last net list file with full path successfully read.
  372. */
  373. void SetLastNetListRead( const wxString& aNetListFile );
  374. void OnCloseWindow( wxCloseEvent& Event ) override;
  375. void Process_Special_Functions( wxCommandEvent& event );
  376. void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
  377. /**
  378. * Function OnEditTextAndGraphics
  379. * Dialog for editing properties of text and graphic items, selected by type, layer,
  380. * and/or parent footprint.
  381. */
  382. void OnEditTextAndGraphics( wxCommandEvent& event );
  383. /**
  384. * Function OnEditTracksAndVias
  385. * Dialog for editing the properties of tracks and vias, selected by net, netclass,
  386. * and/or layer.
  387. */
  388. void OnEditTracksAndVias( wxCommandEvent& event );
  389. void ReCreateHToolbar() override;
  390. void ReCreateAuxiliaryToolbar() override;
  391. void ReCreateVToolbar() override;
  392. void ReCreateMicrowaveVToolbar();
  393. void ReCreateOptToolbar() override;
  394. void ReCreateMenuBar() override;
  395. /**
  396. * Re create the layer Box by clearing the old list, and building
  397. * le new one, from the new layers names and cole layers
  398. * @param aForceResizeToolbar = true to resize the parent toolbar
  399. * false if not needed (mainly in parent toolbar creation,
  400. * or when the layers names are not modified)
  401. */
  402. void ReCreateLayerBox( bool aForceResizeToolbar = true );
  403. /**
  404. * Function SetCurrentNetClass
  405. * Must be called after a netclass selection (or after a netclass parameter change
  406. * calls BOARD_DESIGN_SETTINGS::SetCurrentNetClass() and update trace width and via size
  407. * combo boxes on main toolbar
  408. * Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
  409. * and some others parameters (netclass name ....)
  410. * @param aNetClassName = the new netclass name
  411. * @return true if lists of tracks and vias sizes are modified
  412. */
  413. bool SetCurrentNetClass( const wxString& aNetClassName );
  414. /**
  415. * Function OnModify
  416. * must be called after a board change to set the modified flag.
  417. * <p>
  418. * Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
  419. * to update auxiliary information.
  420. * </p>
  421. */
  422. void OnModify() override;
  423. /**
  424. * Function SetActiveLayer
  425. * will change the currently active layer to \a aLayer and also
  426. * update the PCB_LAYER_WIDGET.
  427. */
  428. void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
  429. PCB_LAYER_WIDGET* GetLayerManager() { return m_Layers; }
  430. /**
  431. * Update the UI to reflect changes to the current layer's transparency.
  432. */
  433. void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
  434. /**
  435. * Function IsElementVisible
  436. * tests whether a given element category is visible. Keep this as an
  437. * inline function.
  438. * @param aElement is from the enum by the same name
  439. * @return bool - true if the element is visible.
  440. * @see enum GAL_LAYER_ID
  441. */
  442. bool IsElementVisible( GAL_LAYER_ID aElement ) const;
  443. /**
  444. * Function SetElementVisibility
  445. * changes the visibility of an element category
  446. * @param aElement is from the enum by the same name
  447. * @param aNewState The new visibility state of the element category
  448. * @see enum PCB_LAYER_ID
  449. */
  450. void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
  451. /**
  452. * Function SetVisibleAlls
  453. * Set the status of all visible element categories and layers to VISIBLE
  454. */
  455. void SetVisibleAlls();
  456. /**
  457. * Function ReFillLayerWidget
  458. * changes out all the layers in m_Layers and may be called upon
  459. * loading a new BOARD.
  460. */
  461. void ReFillLayerWidget();
  462. ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
  463. void ActivateGalCanvas() override;
  464. /**
  465. * Function ShowBoardSetupDialog
  466. */
  467. void DoShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString,
  468. const wxString& aInitialParentPage = wxEmptyString );
  469. /* toolbars update UI functions: */
  470. void PrepareLayerIndicator( bool aForceRebuild = false );
  471. void ToggleLayersManager();
  472. void ToggleMicrowaveToolbar();
  473. /**
  474. * Function DoGenFootprintsPositionFile
  475. * Creates an ascii footprint position file
  476. * @param aFullFileName = the full file name of the file to create
  477. * @param aUnitsMM = false to use inches, true to use mm in coordinates
  478. * @param aForceSmdItems = true to force all footprints with smd pads in list
  479. * = false to put only footprints with option "INSERT" in list
  480. * @param aTopSide true to list footprints on front (top) side,
  481. * @param BottomSide true to list footprints on back (bottom) side,
  482. * if aTopSide and aTopSide are true, list footprints on both sides
  483. * @param aFormatCSV = true to use a comma separated file (CSV) format; defautl = false
  484. * @return the number of footprints found on aSide side,
  485. * or -1 if the file could not be created
  486. */
  487. int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
  488. bool aForceSmdItems, bool aTopSide, bool BottomSide, bool aFormatCSV = false );
  489. /**
  490. * Function GenFootprintsReport
  491. * Calls DoGenFootprintsReport to create a footprint reprot file
  492. * See DoGenFootprintsReport for file format
  493. */
  494. void GenFootprintsReport( wxCommandEvent& event );
  495. /**
  496. * Function DoGenFootprintsReport
  497. * Creates an ascii footprint report file giving some infos on footprints
  498. * and board outlines
  499. * @param aFullFilename = the full file name of the file to create
  500. * @param aUnitsMM = false to use inches, true to use mm in coordinates
  501. * @return true if OK, false if error
  502. */
  503. bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
  504. void GenD356File( wxCommandEvent& event );
  505. void OnFileHistory( wxCommandEvent& event );
  506. /**
  507. * Function Files_io
  508. * @param event is the command event handler.
  509. * do nothing else than call Files_io_from_id with the
  510. * wxCommandEvent id
  511. */
  512. void Files_io( wxCommandEvent& event );
  513. /**
  514. * Function Files_io_from_id
  515. * Read and write board files
  516. * @param aId is an event ID ciming from file command events:
  517. * ID_LOAD_FILE
  518. * ID_MENU_READ_BOARD_BACKUP_FILE
  519. * ID_MENU_RECOVER_BOARD_AUTOSAVE
  520. * ID_NEW_BOARD
  521. * ID_SAVE_BOARD
  522. * ID_COPY_BOARD_AS
  523. * ID_SAVE_BOARD_AS
  524. * Files_io_from_id prepare parameters and calls the specialized function
  525. */
  526. bool Files_io_from_id( int aId );
  527. /**
  528. * Function OpenProjectFiles (was LoadOnePcbFile)
  529. * loads a KiCad board (.kicad_pcb) from \a aFileName.
  530. *
  531. * @param aFileSet - hold the BOARD file to load, a vector of one element.
  532. *
  533. * @param aCtl - KICTL_ bits, one to indicate that an append of the board file
  534. * aFileName to the currently loaded file is desired.
  535. * @see #KIWAY_PLAYER for bit defines.
  536. *
  537. * @return bool - false if file load fails, otherwise true.
  538. bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
  539. bool aForceFileDialog = false );
  540. */
  541. bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
  542. /**
  543. * Function SavePcbFile
  544. * writes the board data structures to \a a aFileName
  545. * Creates backup when requested and update flags (modified and saved flgs)
  546. *
  547. * @param aFileName The file name to write or wxEmptyString to prompt user for
  548. * file name.
  549. * @param aCreateBackupFile Creates a back of \a aFileName if true. Helper
  550. * definitions #CREATE_BACKUP_FILE and #NO_BACKUP_FILE
  551. * are defined for improved code readability.
  552. * @return True if file was saved successfully.
  553. */
  554. bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
  555. /**
  556. * Function SavePcbCopy
  557. * writes the board data structures to \a a aFileName
  558. * but unlike SavePcbFile, does not make anything else
  559. * (no backup, borad fliename change, no flag changes ...)
  560. * Used under a project mgr to save under a new name the current board
  561. *
  562. * When not under a project mgr, the full SavePcbFile is used.
  563. * @param aFileName The file name to write.
  564. * @return True if file was saved successfully.
  565. */
  566. bool SavePcbCopy( const wxString& aFileName );
  567. // BOARD handling
  568. /**
  569. * Function Clear_Pcb
  570. * delete all and reinitialize the current board
  571. * @param aQuery = true to prompt user for confirmation, false to initialize silently
  572. * @param aFinal = if true, we are clearing the board to exit, so don't run more events
  573. */
  574. bool Clear_Pcb( bool aQuery, bool aFinal = false );
  575. ///> @copydoc PCB_BASE_FRAME::SetBoard()
  576. void SetBoard( BOARD* aBoard ) override;
  577. ///> @copydoc PCB_BASE_EDIT_FRAME::GetModel()
  578. BOARD_ITEM_CONTAINER* GetModel() const override;
  579. ///> @copydoc PCB_BASE_FRAME::SetPageSettings()
  580. void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
  581. /**
  582. * Function RecreateBOMFileFromBoard
  583. * Recreates a .cmp file from the current loaded board
  584. * this is the same as created by CvPcb.
  585. * can be used if this file is lost
  586. */
  587. void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
  588. /**
  589. * Function ArchiveModulesOnBoard
  590. * Save modules in a library:
  591. * @param aStoreInNewLib:
  592. * true : save modules in a existing lib. Existing footprints will be kept
  593. * or updated.
  594. * This lib should be in fp lib table, and is type is .pretty
  595. * false: save modules in a new lib. It it is an existing lib,
  596. * previous footprints will be removed
  597. *
  598. * @param aLibName:
  599. * optional library name to create, stops dialog call.
  600. * must be called with aStoreInNewLib as true
  601. */
  602. void ArchiveModulesOnBoard( bool aStoreInNewLib, const wxString& aLibName = wxEmptyString,
  603. wxString* aLibPath = NULL );
  604. /**
  605. * Function RecreateBOMFileFromBoard
  606. * Creates a BOM file from the current loaded board
  607. */
  608. void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
  609. /**
  610. * Function ExportToGenCAD
  611. * creates a file in GenCAD 1.4 format from the current board.
  612. */
  613. void ExportToGenCAD( wxCommandEvent& event );
  614. /**
  615. * Function OnExportVRML
  616. * will export the current BOARD to a VRML file.
  617. */
  618. void OnExportVRML( wxCommandEvent& event );
  619. /**
  620. * Function ExportVRML_File
  621. * Creates the file(s) exporting current BOARD to a VRML file.
  622. *
  623. * @note When copying 3D shapes files, the new filename is build from the full path
  624. * name, changing the separators by underscore. This is needed because files
  625. * with the same shortname can exist in different directories
  626. * @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
  627. * @todo Use mm inside the file. A general scale transform is applied to the whole
  628. * file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
  629. * unit in meters.
  630. * @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specific scale
  631. * is applied to 3D models to convert them to internal units.
  632. *
  633. * @param aFullFileName = the full filename of the file to create
  634. * @param aMMtoWRMLunit = the VRML scaling factor:
  635. * 1.0 to export in mm. 0.001 for meters
  636. * @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
  637. * @param aUseRelativePaths set to true to use relative paths instead of absolute paths
  638. * in the board VRML file URLs.
  639. * @param aUsePlainPCB set to true to export a board with no copper or silkskreen;
  640. * this is useful for generating a VRML file which can be
  641. * converted to a STEP model.
  642. * @param a3D_Subdir = sub directory where 3D shapes files are copied. This is only used
  643. * when aExport3DFiles == true
  644. * @param aXRef = X value of PCB (0,0) reference point
  645. * @param aYRef = Y value of PCB (0,0) reference point
  646. * @return true if Ok.
  647. */
  648. bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
  649. bool aExport3DFiles, bool aUseRelativePaths, bool aUsePlainPCB,
  650. const wxString & a3D_Subdir, double aXRef, double aYRef );
  651. /**
  652. * Function OnExportIDF3
  653. * will export the current BOARD to a IDFv3 board and lib files.
  654. */
  655. void OnExportIDF3( wxCommandEvent& event );
  656. /**
  657. * Function OnExportHyperlynx
  658. * will export the current BOARD to a Hyperlynx HYP file.
  659. */
  660. void OnExportHyperlynx( wxCommandEvent& event );
  661. /**
  662. * Function Export_IDF3
  663. * Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.
  664. *
  665. * @param aPcb = a pointer to the board to be exported to IDF
  666. * @param aFullFileName = the full filename of the export file
  667. * @param aUseThou = set to true if the desired IDF unit is thou (mil)
  668. * @param aXRef = the board Reference Point in mm, X value
  669. * @param aYRef = the board Reference Point in mm, Y value
  670. * @return true if OK
  671. */
  672. bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName,
  673. bool aUseThou, double aXRef, double aYRef );
  674. /**
  675. * Function OnExportSTEP
  676. * Exports the current BOARD to a STEP assembly.
  677. */
  678. void OnExportSTEP( wxCommandEvent& event );
  679. /**
  680. * Function ExportSpecctraFile
  681. * will export the current BOARD to a specctra dsn file.
  682. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  683. * specification.
  684. * @return true if OK
  685. */
  686. bool ExportSpecctraFile( const wxString& aFullFilename );
  687. /**
  688. * Function ImportSpecctraSession
  689. * will import a specctra *.ses file and use it to relocate MODULEs and
  690. * to replace all vias and tracks in an existing and loaded BOARD.
  691. * See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
  692. * specification.
  693. */
  694. bool ImportSpecctraSession( const wxString& aFullFilename );
  695. // Footprint editing (see also PCB_BASE_FRAME)
  696. void InstallFootprintPropertiesDialog( MODULE* Module );
  697. int InstallExchangeModuleFrame( MODULE* aModule, bool updateMode, bool selectedMode );
  698. /**
  699. * Function Exchange_Module
  700. * Replaces OldModule by NewModule, using OldModule settings:
  701. * position, orientation, pad netnames ...)
  702. * OldModule is deleted or put in undo list.
  703. * @param aSrc = footprint to replace
  704. * @param aDest = footprint to put
  705. * @param aCommit = commit that should store the changes
  706. */
  707. void Exchange_Module( MODULE* aSrc, MODULE* aDest, BOARD_COMMIT& aCommit,
  708. bool deleteExtraTexts = true,
  709. bool resetTextLayers = true, bool resetTextEffects = true );
  710. // loading modules: see PCB_BASE_FRAME
  711. /**
  712. * Function OnEditItemRequest
  713. * Install the corresponding dialog editor for the given item
  714. * @param aDC = the current device context
  715. * @param aItem = a pointer to the BOARD_ITEM to edit
  716. */
  717. void OnEditItemRequest( BOARD_ITEM* aItem ) override;
  718. /**
  719. * Function Edit_TrackSegm_Width
  720. * Modify one track segment width or one via diameter (using DRC control).
  721. * @param aTrackItem = the track segment or via to modify
  722. */
  723. void Edit_TrackSegm_Width( TRACK* aTrackItem );
  724. void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override;
  725. /**
  726. * Function SetTrackSegmentWidth
  727. * Modify one track segment width or one via diameter (using DRC control).
  728. * Basic routine used by other routines when editing tracks or vias.
  729. * Note that casting this to boolean will allow you to determine whether any action
  730. * happened.
  731. * @param aTrackItem = the track segment or via to modify
  732. * @param aItemsListPicker = the list picker to use for an undo command
  733. * (can be NULL)
  734. * @param aUseNetclassValue = true to use NetClass value, false to use
  735. * current designSettings value
  736. * @return 0 if items successfully changed,
  737. * -1 if there was a DRC error,
  738. * 1 if items were changed successfully
  739. */
  740. int SetTrackSegmentWidth( TRACK* aTrackItem,
  741. PICKED_ITEMS_LIST* aItemsListPicker,
  742. bool aUseNetclassValue );
  743. /**
  744. * Function Edit_Zone_Params
  745. * Edit params (layer, clearance, ...) for a zone outline
  746. */
  747. void Edit_Zone_Params( ZONE_CONTAINER* zone_container );
  748. // Properties dialogs
  749. void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
  750. void ShowDimensionPropertyDialog( DIMENSION* aDimension );
  751. void InstallNetlistFrame();
  752. /**
  753. * Function FetchNetlistFromSchematic
  754. * @param aNetlist a NETLIST owned by the caller. This function fills it in.
  755. * @return true if a netlist was fetched.
  756. */
  757. enum FETCH_NETLIST_MODE { NO_ANNOTATION, QUIET_ANNOTATION, ANNOTATION_DIALOG };
  758. bool FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST_MODE aMode );
  759. /**
  760. * Function DoUpdatePCBFromNetlist
  761. * An automated version of UpdatePCBFromNetlist which skips the UI dialog.
  762. * @param aNetlist
  763. * @param aUseTimestamps
  764. */
  765. void DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimestamps );
  766. /**
  767. * Reads a netlist from a file into a NETLIST object.
  768. *
  769. * @param aFilename is the netlist to load
  770. * @param aNetlist is the object to populate with data
  771. * @param aReporter is a #REPORTER object to display messages
  772. * @return true if the netlist was read successfully
  773. */
  774. bool ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, REPORTER& aReporter );
  775. /**
  776. * Called after netlist is updated
  777. * @param aUpdater is the updater object that was run
  778. * @param aRunDragCommand is set to true if the drag command was invoked by this call
  779. */
  780. void OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aRunDragCommand );
  781. #if defined( KICAD_SCRIPTING_WXPYTHON )
  782. /**
  783. * Function ScriptingConsoleEnableDisable
  784. * enables or disabled the scripting console
  785. */
  786. void ScriptingConsoleEnableDisable();
  787. #endif
  788. void LockModule( MODULE* aModule, bool aLocked );
  789. /**
  790. * Function SpreadFootprints
  791. * Footprints (after loaded by reading a netlist for instance) are moved
  792. * to be in a small free area (outside the current board) without overlapping.
  793. * @param aFootprints: a list of footprints to be spread out.
  794. * @param aMoveFootprintsOutsideBoardOnly: true to move only
  795. * footprints outside the board outlines
  796. * (they are outside if the position of a footprint anchor is outside
  797. * the board outlines bounding box). It imply the board outlines exist
  798. * @param aCheckForBoardEdges: true to try to place footprints outside of
  799. * board edges, if aSpreadAreaPosition is incorrectly chosen.
  800. * @param aSpreadAreaPosition the position of the upper left corner of the
  801. * area used to spread footprints
  802. * @param aPrepareUndoCommand = true (defualt) to commit a undo command for the
  803. * spread footprints, false to do just the spread command
  804. * (no undo specific to this move command)
  805. */
  806. void SpreadFootprints( std::vector<MODULE*>* aFootprints,
  807. bool aMoveFootprintsOutsideBoardOnly,
  808. bool aCheckForBoardEdges,
  809. wxPoint aSpreadAreaPosition,
  810. bool aPrepareUndoCommand = true );
  811. /**
  812. * Function SendMessageToEESCHEMA
  813. * sends a message to the schematic editor so that it may move its cursor
  814. * to a part with the same reference as the objectToSync
  815. * @param objectToSync The object whose reference is used to synchronize Eeschema.
  816. */
  817. void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
  818. /**
  819. * Sends a net name to eeschema for highlighting
  820. *
  821. * @param aNetName is the name of a net, or empty string to clear highlight
  822. */
  823. void SendCrossProbeNetName( const wxString& aNetName );
  824. /**
  825. * Function CreateMuWaveBaseFootprint
  826. * create a basic footprint for micro wave applications.
  827. * @param aValue = the text value
  828. * @param aTextSize = the size of ref and value texts ( <= 0 to use board default values )
  829. * @param aPadCount = number of pads
  830. * Pads settings are:
  831. * PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
  832. */
  833. MODULE* CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount );
  834. /**
  835. * Create_MuWaveComponent
  836. * creates a module "GAP" or "STUB" used in micro wave designs.
  837. * This module has 2 pads:
  838. * PAD_ATTRIB_SMD, rectangular, H size = V size = current track width.
  839. * the "gap" is isolation created between this 2 pads
  840. */
  841. MODULE* Create_MuWaveComponent( int shape_type );
  842. MODULE* Create_MuWavePolygonShape();
  843. void ShowChangedLanguage() override;
  844. /**
  845. * Function UpdateTitle
  846. * sets the main window title bar text.
  847. * <p>
  848. * If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
  849. * application name appended with no file. Otherwise, the title is set to the full path
  850. * and file name and read only is appended to the title if the user does not have write
  851. * access to the file.
  852. * </p>
  853. */
  854. void UpdateTitle();
  855. void On3DShapeLibWizard( wxCommandEvent& event );
  856. /**
  857. * Allows Pcbnew to install its preferences panel into the preferences dialog.
  858. */
  859. void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
  860. /**
  861. * Called after the preferences dialog is run.
  862. */
  863. void CommonSettingsChanged( bool aEnvVarsChanged ) override;
  864. void SyncToolbars() override;
  865. DECLARE_EVENT_TABLE()
  866. };
  867. #endif // WXPCB_STRUCT_H_