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.

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