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.

1387 lines
45 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
* 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
++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
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
* 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
* 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
* 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
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
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
9 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
  7. * Copyright (C) 2013-2018 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software: you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation, either version 3 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * @file pcb_edit_frame.cpp
  24. * @brief PCB editor main frame implementation.
  25. */
  26. #include <fctsys.h>
  27. #include <kiface_i.h>
  28. #include <pgm_base.h>
  29. #include <class_drawpanel.h>
  30. #include <confirm.h>
  31. #include <pcb_edit_frame.h>
  32. #include <collectors.h>
  33. #include <build_version.h>
  34. #include <macros.h>
  35. #include <3d_viewer/eda_3d_viewer.h>
  36. #include <msgpanel.h>
  37. #include <fp_lib_table.h>
  38. #include <bitmaps.h>
  39. #include <trace_helpers.h>
  40. #include <pcbnew.h>
  41. #include <pcbnew_id.h>
  42. #include <drc.h>
  43. #include <layer_widget.h>
  44. #include <dialog_design_rules.h>
  45. #include <pcb_layer_widget.h>
  46. #include <hotkeys.h>
  47. #include <config_params.h>
  48. #include <footprint_edit_frame.h>
  49. #include <dialog_helpers.h>
  50. #include <dialog_plot.h>
  51. #include <dialog_exchange_footprints.h>
  52. #include <dialog_edit_footprint_for_BoardEditor.h>
  53. #include <convert_to_biu.h>
  54. #include <view/view.h>
  55. #include <view/view_controls.h>
  56. #include <pcb_painter.h>
  57. #include <invoke_pcb_dialog.h>
  58. #include <class_track.h>
  59. #include <class_board.h>
  60. #include <class_module.h>
  61. #include <worksheet_viewitem.h>
  62. #include <connectivity_data.h>
  63. #include <ratsnest_viewitem.h>
  64. #include <tool/tool_manager.h>
  65. #include <tool/tool_dispatcher.h>
  66. #include <tools/pcb_actions.h>
  67. #include <wildcards_and_files_ext.h>
  68. #include <kicad_string.h>
  69. #if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
  70. #include <python_scripting.h>
  71. #endif
  72. #include <pcb_draw_panel_gal.h>
  73. #include <gal/graphics_abstraction_layer.h>
  74. #include <functional>
  75. using namespace std::placeholders;
  76. ///@{
  77. /// \ingroup config
  78. static const wxString PlotLineWidthEntry = "PlotLineWidth_mm";
  79. static const wxString MagneticPadsEntry = "PcbMagPadOpt";
  80. static const wxString MagneticTracksEntry = "PcbMagTrackOpt";
  81. static const wxString ShowMicrowaveEntry = "ShowMicrowaveTools";
  82. static const wxString ShowLayerManagerEntry = "ShowLayerManagerTools";
  83. static const wxString ShowPageLimitsEntry = "ShowPageLimits";
  84. static const wxString IconScaleEntry = "PcbIconScale";
  85. ///@}
  86. BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
  87. EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer )
  88. EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest )
  89. EVT_CHOICE( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
  90. EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
  91. EVT_CLOSE( PCB_EDIT_FRAME::OnCloseWindow )
  92. EVT_SIZE( PCB_EDIT_FRAME::OnSize )
  93. EVT_TOOL( ID_LOAD_FILE, PCB_EDIT_FRAME::Files_io )
  94. EVT_TOOL( ID_MENU_READ_BOARD_BACKUP_FILE, PCB_EDIT_FRAME::Files_io )
  95. EVT_TOOL( ID_MENU_RECOVER_BOARD_AUTOSAVE, PCB_EDIT_FRAME::Files_io )
  96. EVT_TOOL( ID_NEW_BOARD, PCB_EDIT_FRAME::Files_io )
  97. EVT_TOOL( ID_SAVE_BOARD, PCB_EDIT_FRAME::Files_io )
  98. EVT_TOOL( ID_OPEN_MODULE_EDITOR, PCB_EDIT_FRAME::Process_Special_Functions )
  99. EVT_TOOL( ID_OPEN_MODULE_VIEWER, PCB_EDIT_FRAME::Process_Special_Functions )
  100. // Menu Files:
  101. EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions )
  102. EVT_MENU( ID_MENU_PCB_FLIP_VIEW, PCB_EDIT_FRAME::OnFlipPcbView )
  103. EVT_MENU( ID_APPEND_FILE, PCB_EDIT_FRAME::Files_io )
  104. EVT_MENU( ID_SAVE_BOARD_AS, PCB_EDIT_FRAME::Files_io )
  105. EVT_MENU( ID_COPY_BOARD_AS, PCB_EDIT_FRAME::Files_io )
  106. EVT_MENU( ID_IMPORT_NON_KICAD_BOARD, PCB_EDIT_FRAME::Files_io )
  107. EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, PCB_EDIT_FRAME::OnFileHistory )
  108. EVT_MENU( ID_GEN_PLOT, PCB_EDIT_FRAME::ToPlotter )
  109. EVT_MENU( ID_GEN_EXPORT_SPECCTRA, PCB_EDIT_FRAME::ExportToSpecctra )
  110. EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, PCB_EDIT_FRAME::ExportToGenCAD )
  111. EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, PCB_EDIT_FRAME::GenFootprintsReport )
  112. EVT_MENU( ID_GEN_EXPORT_FILE_VRML, PCB_EDIT_FRAME::OnExportVRML )
  113. EVT_MENU( ID_GEN_EXPORT_FILE_IDF3, PCB_EDIT_FRAME::OnExportIDF3 )
  114. EVT_MENU( ID_GEN_EXPORT_FILE_STEP, PCB_EDIT_FRAME::OnExportSTEP )
  115. EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,PCB_EDIT_FRAME::ImportSpecctraSession )
  116. EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, PCB_EDIT_FRAME::ImportSpecctraDesign )
  117. EVT_MENU( ID_GEN_IMPORT_DXF_FILE, PCB_EDIT_FRAME::Process_Special_Functions )
  118. EVT_MENU( ID_MENU_ARCHIVE_MODULES_IN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions )
  119. EVT_MENU( ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
  120. EVT_MENU( wxID_EXIT, PCB_EDIT_FRAME::OnQuit )
  121. // menu Config
  122. EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, PCB_EDIT_FRAME::OnConfigurePcbOptions )
  123. EVT_MENU( ID_PCB_LIB_TABLE_EDIT, PCB_EDIT_FRAME::Process_Config )
  124. EVT_MENU( ID_PCB_3DSHAPELIB_WIZARD, PCB_EDIT_FRAME::Process_Config )
  125. EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, PCB_EDIT_FRAME::OnConfigurePaths )
  126. EVT_MENU( ID_CONFIG_SAVE, PCB_EDIT_FRAME::Process_Config )
  127. EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config )
  128. EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
  129. PCB_EDIT_FRAME::Process_Config )
  130. EVT_MENU( wxID_PREFERENCES, PCB_EDIT_FRAME::Process_Config )
  131. EVT_MENU( ID_PCB_LAYERS_SETUP, PCB_EDIT_FRAME::Process_Config )
  132. EVT_MENU( ID_PCB_MASK_CLEARANCE, PCB_EDIT_FRAME::Process_Config )
  133. EVT_MENU( ID_PCB_PAD_SETUP, PCB_EDIT_FRAME::Process_Config )
  134. EVT_MENU( ID_CONFIG_SAVE, PCB_EDIT_FRAME::Process_Config )
  135. EVT_MENU( ID_CONFIG_READ, PCB_EDIT_FRAME::Process_Config )
  136. EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, PCB_EDIT_FRAME::InstallDisplayOptionsDialog )
  137. EVT_MENU( ID_PCB_USER_GRID_SETUP, PCB_EDIT_FRAME::Process_Special_Functions )
  138. // menu Postprocess
  139. EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, PCB_EDIT_FRAME::GenFootprintsPositionFile )
  140. EVT_MENU( ID_PCB_GEN_DRILL_FILE, PCB_EDIT_FRAME::InstallDrillFrame )
  141. EVT_MENU( ID_PCB_GEN_D356_FILE, PCB_EDIT_FRAME::GenD356File )
  142. EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard )
  143. EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard )
  144. // menu Miscellaneous
  145. EVT_MENU( ID_MENU_LIST_NETS, PCB_EDIT_FRAME::ListNetsAndSelect )
  146. EVT_MENU( ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, PCB_EDIT_FRAME::Process_Special_Functions )
  147. EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions )
  148. EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions )
  149. EVT_MENU( ID_MENU_PCB_UPDATE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
  150. EVT_MENU( ID_MENU_PCB_EXCHANGE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
  151. EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )
  152. EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
  153. PCB_EDIT_FRAME::OnResetModuleTextSizes )
  154. // Menu Help
  155. EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
  156. EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp )
  157. EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
  158. EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
  159. // Menu 3D Frame
  160. EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame )
  161. // Switching canvases
  162. EVT_MENU( ID_MENU_CANVAS_LEGACY, PCB_EDIT_FRAME::OnSwitchCanvas )
  163. EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::OnSwitchCanvas )
  164. EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::OnSwitchCanvas )
  165. // Menu Get Design Rules Editor
  166. EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, PCB_EDIT_FRAME::ShowDesignRulesEditor )
  167. // Horizontal toolbar
  168. EVT_TOOL( ID_RUN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions )
  169. EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
  170. EVT_TOOL( wxID_CUT, PCB_EDIT_FRAME::Process_Special_Functions )
  171. EVT_TOOL( wxID_COPY, PCB_EDIT_FRAME::Process_Special_Functions )
  172. EVT_TOOL( wxID_PASTE, PCB_EDIT_FRAME::Process_Special_Functions )
  173. EVT_TOOL( wxID_UNDO, PCB_BASE_EDIT_FRAME::RestoreCopyFromUndoList )
  174. EVT_TOOL( wxID_REDO, PCB_BASE_EDIT_FRAME::RestoreCopyFromRedoList )
  175. EVT_TOOL( wxID_PRINT, PCB_EDIT_FRAME::ToPrinter )
  176. EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::SVG_Print )
  177. EVT_TOOL( ID_GEN_PLOT, PCB_EDIT_FRAME::Process_Special_Functions )
  178. EVT_TOOL( ID_FIND_ITEMS, PCB_EDIT_FRAME::Process_Special_Functions )
  179. EVT_TOOL( ID_GET_NETLIST, PCB_EDIT_FRAME::Process_Special_Functions )
  180. EVT_TOOL( ID_DRC_CONTROL, PCB_EDIT_FRAME::Process_Special_Functions )
  181. EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::Process_Special_Functions )
  182. EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
  183. EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions )
  184. EVT_CHOICE( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
  185. EVT_CHOICE( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
  186. #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
  187. EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh )
  188. #endif
  189. #if defined( KICAD_SCRIPTING_WXPYTHON )
  190. // has meaning only with KICAD_SCRIPTING_WXPYTHON enabled
  191. EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable )
  192. EVT_UPDATE_UI( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
  193. PCB_EDIT_FRAME::OnUpdateScriptingConsoleState )
  194. #endif
  195. // Option toolbar
  196. EVT_TOOL( ID_TB_OPTIONS_DRC_OFF,
  197. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  198. EVT_TOOL( ID_TB_OPTIONS_SHOW_RATSNEST,
  199. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  200. EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
  201. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  202. EVT_TOOL( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
  203. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  204. EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
  205. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  206. EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
  207. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  208. EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
  209. EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
  210. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  211. EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
  212. PCB_EDIT_FRAME::OnSelectOptionToolbar )
  213. // Vertical main toolbar:
  214. EVT_TOOL( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnSelectTool )
  215. EVT_TOOL( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnSelectTool )
  216. EVT_TOOL_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_MEASUREMENT_TOOL,
  217. PCB_EDIT_FRAME::OnSelectTool )
  218. EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
  219. PCB_EDIT_FRAME::ProcessMuWaveFunctions )
  220. EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
  221. PCB_EDIT_FRAME::Process_Special_Functions )
  222. // Tracks and vias sizes general options
  223. EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
  224. ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
  225. PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
  226. // popup menus
  227. EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, PCB_EDIT_FRAME::Process_Special_Functions )
  228. EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
  229. PCB_EDIT_FRAME::Process_Special_Functions )
  230. EVT_MENU( ID_POPUP_PCB_SPREAD_ALL_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
  231. EVT_MENU( ID_POPUP_PCB_SPREAD_NEW_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
  232. EVT_MENU( ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, PCB_EDIT_FRAME::Process_Special_Functions )
  233. EVT_MENU( ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
  234. EVT_MENU( ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, PCB_EDIT_FRAME::Process_Special_Functions )
  235. EVT_MENU( ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, PCB_EDIT_FRAME::Process_Special_Functions )
  236. // User interface update event handlers.
  237. EVT_UPDATE_UI( ID_SAVE_BOARD, PCB_EDIT_FRAME::OnUpdateSave )
  238. EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair )
  239. EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
  240. EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
  241. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest )
  242. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode )
  243. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode )
  244. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
  245. PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode )
  246. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
  247. PCB_EDIT_FRAME::OnUpdateShowLayerManager )
  248. EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
  249. PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar )
  250. EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
  251. EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
  252. EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
  253. EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
  254. PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
  255. EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
  256. EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH,
  257. PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth )
  258. EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
  259. EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8,
  260. PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
  261. EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8,
  262. PCB_EDIT_FRAME::OnUpdateSelectViaSize )
  263. EVT_UPDATE_UI_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_MEASUREMENT_TOOL,
  264. PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
  265. EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
  266. PCB_EDIT_FRAME::OnUpdateMuWaveToolbar )
  267. EVT_COMMAND( wxID_ANY, LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE, PCB_EDIT_FRAME::OnLayerColorChange )
  268. END_EVENT_TABLE()
  269. PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
  270. PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB, wxT( "Pcbnew" ), wxDefaultPosition,
  271. wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PCB_EDIT_FRAME_NAME )
  272. {
  273. m_showBorderAndTitleBlock = true; // true to display sheet references
  274. m_showAxis = false; // true to display X and Y axis
  275. m_showOriginAxis = true;
  276. m_showGridAxis = true;
  277. m_SelTrackWidthBox = NULL;
  278. m_SelViaSizeBox = NULL;
  279. m_SelLayerBox = NULL;
  280. m_show_microwave_tools = false;
  281. m_show_layer_manager_tools = true;
  282. m_hotkeysDescrList = g_Board_Editor_Hotkeys_Descr;
  283. m_hasAutoSave = true;
  284. m_microWaveToolBar = NULL;
  285. m_Layers = nullptr;
  286. // We don't know what state board was in when it was lasat saved, so we have to
  287. // assume dirty
  288. m_ZoneFillsDirty = true;
  289. m_rotationAngle = 900;
  290. // Create GAL canvas
  291. EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
  292. m_FrameSize,
  293. GetGalDisplayOptions(),
  294. EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
  295. SetGalCanvas( galCanvas );
  296. SetBoard( new BOARD() );
  297. // Create the PCB_LAYER_WIDGET *after* SetBoard():
  298. m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas() );
  299. m_drc = new DRC( this ); // these 2 objects point to each other
  300. wxIcon icon;
  301. icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
  302. SetIcon( icon );
  303. // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
  304. // initialize parameters in m_LayersManager
  305. LoadSettings( config() );
  306. SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
  307. GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
  308. // PCB drawings start in the upper left corner.
  309. GetScreen()->m_Center = false;
  310. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  311. GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
  312. GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
  313. if( m_canvas )
  314. m_canvas->SetEnableBlockCommands( true );
  315. ReCreateMenuBar();
  316. ReCreateHToolbar();
  317. ReCreateAuxiliaryToolbar();
  318. ReCreateVToolbar();
  319. ReCreateOptToolbar();
  320. ReCreateMicrowaveVToolbar();
  321. m_auimgr.SetManagedWindow( this );
  322. EDA_PANEINFO horiz;
  323. horiz.HorizontalToolbarPane();
  324. EDA_PANEINFO vert;
  325. vert.VerticalToolbarPane();
  326. EDA_PANEINFO mesg;
  327. mesg.MessageToolbarPane();
  328. // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
  329. // LAYER_WIDGET is floatable, but initially docked at far right
  330. EDA_PANEINFO lyrs;
  331. lyrs.LayersToolbarPane();
  332. lyrs.MinSize( m_Layers->GetBestSize() ); // updated in ReFillLayerWidget
  333. lyrs.BestSize( m_Layers->GetBestSize() );
  334. lyrs.Caption( _( "Layers Manager" ) );
  335. lyrs.TopDockable( false ).BottomDockable( false );
  336. if( m_mainToolBar ) // The main horizontal toolbar
  337. {
  338. m_auimgr.AddPane( m_mainToolBar,
  339. wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
  340. }
  341. if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...)
  342. {
  343. m_auimgr.AddPane( m_auxiliaryToolBar,
  344. wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );
  345. }
  346. if( m_microWaveToolBar ) // The auxiliary vertical right toolbar (currently microwave tools)
  347. m_auimgr.AddPane( m_microWaveToolBar,
  348. wxAuiPaneInfo( vert ).Name( wxT( "m_microWaveToolBar" ) ).
  349. Right().Layer( 1 ).Position(1).Hide() );
  350. if( m_drawToolBar ) // The main right vertical toolbar
  351. m_auimgr.AddPane( m_drawToolBar,
  352. wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Layer( 2 ) );
  353. // Add the layer manager ( most right side of pcbframe )
  354. m_auimgr.AddPane( m_Layers, lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 3 ) );
  355. if( m_optionsToolBar ) // The left vertical toolbar (fast acces display options of Pcbnew)
  356. {
  357. m_auimgr.AddPane( m_optionsToolBar,
  358. wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left().Layer(1) );
  359. m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
  360. m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools );
  361. }
  362. if( m_canvas )
  363. m_auimgr.AddPane( m_canvas,
  364. wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
  365. if( GetGalCanvas() )
  366. m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
  367. wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
  368. if( m_messagePanel )
  369. m_auimgr.AddPane( m_messagePanel,
  370. wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(10) );
  371. ReFillLayerWidget(); // this is near end because contents establish size
  372. m_Layers->ReFillRender(); // Update colors in Render after the config is read
  373. syncLayerWidgetLayer();
  374. m_auimgr.Update();
  375. setupTools();
  376. Zoom_Automatique( false );
  377. EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = loadCanvasTypeSetting();
  378. // Nudge user to switch to OpenGL if they are on legacy or Cairo
  379. if( m_firstRunDialogSetting < 1 )
  380. {
  381. if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL )
  382. {
  383. wxString msg = _( "KiCad can use your graphics card to give you a smoother "
  384. "and faster experience. This option is turned off by "
  385. "default since it is not compatible with all computers.\n\n"
  386. "Would you like to try enabling graphics acceleration?\n\n"
  387. "If you'd like to choose later, select Modern Toolset "
  388. "(Accelerated) in the Preferences menu." );
  389. wxMessageDialog dlg( this, msg, _( "Enable Graphics Acceleration" ),
  390. wxYES_NO );
  391. dlg.SetYesNoLabels( _( "&Enable Acceleration" ), _( "&No Thanks" ) );
  392. if( dlg.ShowModal() == wxID_YES )
  393. {
  394. // Save Cairo as default in case OpenGL crashes
  395. saveCanvasTypeSetting( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
  396. // Switch to OpenGL, which will save the new setting if successful
  397. wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_OPENGL );
  398. GetEventHandler()->ProcessEvent( evt );
  399. // Switch back to Cairo if OpenGL is not supported
  400. if( GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
  401. {
  402. wxCommandEvent cairoEvt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
  403. GetEventHandler()->ProcessEvent( cairoEvt );
  404. }
  405. }
  406. else if( canvasType == EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
  407. {
  408. // If they were on legacy, switch them to Cairo
  409. wxCommandEvent evt( wxEVT_MENU, ID_MENU_CANVAS_CAIRO );
  410. GetEventHandler()->ProcessEvent( evt );
  411. }
  412. }
  413. m_firstRunDialogSetting = 1;
  414. SaveSettings( config() );
  415. }
  416. else
  417. {
  418. if( canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE )
  419. {
  420. if( GetGalCanvas()->SwitchBackend( canvasType ) )
  421. UseGalCanvas( true );
  422. }
  423. }
  424. enableGALSpecificMenus();
  425. // disable Export STEP item if kicad2step does not exist
  426. wxString strK2S = Pgm().GetExecutablePath();
  427. #ifdef __WXMAC__
  428. if (strK2S.find( _("pcbnew.app") ) != wxNOT_FOUND )
  429. {
  430. // On macOS, we have standalone applications inside the main bundle, so we handle that here:
  431. strK2S += "../../";
  432. }
  433. strK2S += "Contents/MacOS/";
  434. #endif
  435. wxFileName appK2S( strK2S, "kicad2step" );
  436. #ifdef _WIN32
  437. appK2S.SetExt( "exe" );
  438. #endif
  439. if( !appK2S.FileExists() )
  440. GetMenuBar()->FindItem( ID_GEN_EXPORT_FILE_STEP )->Enable( false );
  441. }
  442. PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
  443. {
  444. delete m_drc;
  445. }
  446. void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
  447. {
  448. PCB_BASE_EDIT_FRAME::SetBoard( aBoard );
  449. if( IsGalCanvasActive() )
  450. {
  451. aBoard->GetConnectivity()->Build( aBoard );
  452. // reload the worksheet
  453. SetPageSettings( aBoard->GetPageSettings() );
  454. }
  455. }
  456. BOARD_ITEM_CONTAINER* PCB_EDIT_FRAME::GetModel() const
  457. {
  458. return m_Pcb;
  459. }
  460. void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
  461. {
  462. PCB_BASE_FRAME::SetPageSettings( aPageSettings );
  463. if( IsGalCanvasActive() )
  464. {
  465. PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
  466. // Prepare worksheet template
  467. KIGFX::WORKSHEET_VIEWITEM* worksheet;
  468. worksheet = new KIGFX::WORKSHEET_VIEWITEM( IU_PER_MILS ,&m_Pcb->GetPageSettings(),
  469. &m_Pcb->GetTitleBlock() );
  470. worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
  471. BASE_SCREEN* screen = GetScreen();
  472. if( screen != NULL )
  473. {
  474. worksheet->SetSheetNumber( screen->m_ScreenNumber );
  475. worksheet->SetSheetCount( screen->m_NumberOfScreens );
  476. }
  477. // PCB_DRAW_PANEL_GAL takes ownership of the worksheet
  478. drawPanel->SetWorksheet( worksheet );
  479. }
  480. }
  481. bool PCB_EDIT_FRAME::isAutoSaveRequired() const
  482. {
  483. if( GetScreen() )
  484. return GetScreen()->IsSave();
  485. return false;
  486. }
  487. void PCB_EDIT_FRAME::setupTools()
  488. {
  489. // Create the manager and dispatcher & route draw panel events to the dispatcher
  490. m_toolManager = new TOOL_MANAGER;
  491. m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
  492. GetGalCanvas()->GetViewControls(), this );
  493. m_actions = new PCB_ACTIONS();
  494. m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
  495. // Register tools
  496. m_actions->RegisterAllTools( m_toolManager );
  497. m_toolManager->InitTools();
  498. // Run the selection tool, it is supposed to be always active
  499. m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
  500. }
  501. void PCB_EDIT_FRAME::ReFillLayerWidget()
  502. {
  503. m_Layers->ReFill();
  504. wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_Layers );
  505. wxSize bestz = m_Layers->GetBestSize();
  506. lyrs.MinSize( bestz );
  507. lyrs.BestSize( bestz );
  508. lyrs.FloatingSize( bestz );
  509. if( lyrs.IsDocked() )
  510. m_auimgr.Update();
  511. else
  512. m_Layers->SetSize( bestz );
  513. }
  514. void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
  515. {
  516. Close( false );
  517. }
  518. void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
  519. {
  520. m_canvas->SetAbortRequest( true );
  521. if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
  522. {
  523. wxString msg = wxString::Format( _(
  524. "Save the changes in\n"
  525. "\"%s\"\n"
  526. "before closing?" ),
  527. GetChars( GetBoard()->GetFileName() )
  528. );
  529. int ii = DisplayExitDialog( this, msg );
  530. switch( ii )
  531. {
  532. case wxID_CANCEL:
  533. Event.Veto();
  534. return;
  535. case wxID_NO:
  536. break;
  537. case wxID_YES:
  538. // save the board. if the board has no name,
  539. // the ID_SAVE_BOARD_AS will actually made
  540. Files_io_from_id( ID_SAVE_BOARD );
  541. break;
  542. }
  543. }
  544. if( IsGalCanvasActive() )
  545. {
  546. // On Windows 7 / 32 bits, on OpenGL mode only, Pcbnew crashes
  547. // when closing this frame if a footprint was selected, and the footprint editor called
  548. // to edit this footprint, and when closing pcbnew if this footprint is still selected
  549. // See https://bugs.launchpad.net/kicad/+bug/1655858
  550. // I think this is certainly a OpenGL event fired after frame deletion, so this workaround
  551. // avoid the crash (JPC)
  552. GetGalCanvas()->SetEvtHandlerEnabled( false );
  553. }
  554. GetGalCanvas()->StopDrawing();
  555. // Delete the auto save file if it exists.
  556. wxFileName fn = GetBoard()->GetFileName();
  557. // Auto save file name is the normal file name prefixed with '_autosave'.
  558. fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
  559. // When the auto save feature does not have write access to the board file path, it falls
  560. // back to a platform specific user temporary file path.
  561. if( !fn.IsOk() || !fn.IsDirWritable() )
  562. fn.SetPath( wxFileName::GetTempDir() );
  563. wxLogTrace( traceAutoSave, "Deleting auto save file <" + fn.GetFullPath() + ">" );
  564. // Remove the auto save file on a normal close of Pcbnew.
  565. if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
  566. {
  567. wxString msg = wxString::Format( _(
  568. "The auto save file \"%s\" could not be removed!" ),
  569. GetChars( fn.GetFullPath() )
  570. );
  571. wxMessageBox( msg, Pgm().App().GetAppName(), wxOK | wxICON_ERROR, this );
  572. }
  573. // Delete board structs and undo/redo lists, to avoid crash on exit
  574. // when deleting some structs (mainly in undo/redo lists) too late
  575. Clear_Pcb( false );
  576. // do not show the window because ScreenPcb will be deleted and we do not
  577. // want any paint event
  578. Show( false );
  579. Destroy();
  580. }
  581. void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
  582. {
  583. bool forceRecreateIfNotOwner = true;
  584. CreateAndShow3D_Frame( forceRecreateIfNotOwner );
  585. }
  586. void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
  587. {
  588. if( !aEnable )
  589. Compile_Ratsnest( NULL, true );
  590. PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
  591. COLORS_DESIGN_SETTINGS& cds = Settings().Colors();
  592. if( aEnable )
  593. {
  594. cds.SetLegacyMode( false );
  595. GetGalCanvas()->GetGAL()->SetGridColor( cds.GetLayerColor( LAYER_GRID ) );
  596. auto view = GetGalCanvas()->GetView();
  597. view->GetPainter()->GetSettings()->ImportLegacyColors( &cds );
  598. GetGalCanvas()->Refresh();
  599. }
  600. enableGALSpecificMenus();
  601. // Force colors to be legacy-compatible in case they were changed in GAL
  602. if( !aEnable )
  603. {
  604. cds.SetLegacyMode( true );
  605. Refresh();
  606. }
  607. // Re-create the layer manager to allow arbitrary colors when GAL is enabled
  608. UpdateUserInterface();
  609. }
  610. void PCB_EDIT_FRAME::enableGALSpecificMenus()
  611. {
  612. // some menus are active only in GAL mode and do nothing in legacy mode.
  613. // So enable or disable them, depending on the display mode
  614. ReCreateMenuBar();
  615. if( GetMenuBar() )
  616. {
  617. // Enable / disable some menus which are usable only on GAL
  618. pcbnew_ids id_list[] =
  619. {
  620. ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
  621. ID_DIFF_PAIR_BUTT,
  622. ID_TUNE_SINGLE_TRACK_LEN_BUTT,
  623. ID_TUNE_DIFF_PAIR_LEN_BUTT,
  624. ID_TUNE_DIFF_PAIR_SKEW_BUTT,
  625. ID_MENU_DIFF_PAIR_DIMENSIONS,
  626. ID_MENU_PCB_FLIP_VIEW
  627. };
  628. bool enbl = IsGalCanvasActive();
  629. for( unsigned ii = 0; ii < DIM( id_list ); ii++ )
  630. {
  631. if( GetMenuBar()->FindItem( id_list[ii] ) )
  632. GetMenuBar()->FindItem( id_list[ii] )->Enable( enbl );
  633. }
  634. // Update settings for GAL menus
  635. auto view = GetGalCanvas()->GetView();
  636. GetMenuBar()->FindItem( ID_MENU_PCB_FLIP_VIEW )->Check( view->IsMirroredX() );
  637. }
  638. }
  639. void PCB_EDIT_FRAME::ShowDesignRulesEditor( wxCommandEvent& event )
  640. {
  641. DIALOG_DESIGN_RULES dR_editor( this );
  642. int returncode = dR_editor.ShowModal();
  643. if( returncode == wxID_OK ) // New rules, or others changes.
  644. {
  645. ReCreateLayerBox();
  646. ReCreateAuxiliaryToolbar();
  647. m_Layers->ReFillRender();
  648. OnModify();
  649. }
  650. }
  651. void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
  652. {
  653. PCB_BASE_FRAME::LoadSettings( aCfg );
  654. wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
  655. m_configSettings.Load( aCfg );
  656. double dtmp;
  657. aCfg->Read( PlotLineWidthEntry, &dtmp, 0.1 ); // stored in mm
  658. if( dtmp < 0.01 )
  659. dtmp = 0.01;
  660. if( dtmp > 5.0 )
  661. dtmp = 5.0;
  662. g_DrawDefaultLineThickness = Millimeter2iu( dtmp );
  663. aCfg->Read( ShowMicrowaveEntry, &m_show_microwave_tools );
  664. aCfg->Read( ShowLayerManagerEntry, &m_show_layer_manager_tools );
  665. aCfg->Read( ShowPageLimitsEntry, &m_showPageLimits );
  666. }
  667. void PCB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
  668. {
  669. m_configSettings.Save( aCfg );
  670. PCB_BASE_FRAME::SaveSettings( aCfg );
  671. wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
  672. // This value is stored in mm )
  673. aCfg->Write( PlotLineWidthEntry, MM_PER_IU * g_DrawDefaultLineThickness );
  674. aCfg->Write( ShowMicrowaveEntry, (long) m_show_microwave_tools );
  675. aCfg->Write( ShowLayerManagerEntry, (long)m_show_layer_manager_tools );
  676. aCfg->Write( ShowPageLimitsEntry, m_showPageLimits );
  677. }
  678. bool PCB_EDIT_FRAME::IsGridVisible() const
  679. {
  680. return IsElementVisible( LAYER_GRID );
  681. }
  682. void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible)
  683. {
  684. SetElementVisibility( LAYER_GRID, aVisible );
  685. }
  686. COLOR4D PCB_EDIT_FRAME::GetGridColor()
  687. {
  688. return Settings().Colors().GetItemColor( LAYER_GRID );
  689. }
  690. void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
  691. {
  692. Settings().Colors().SetItemColor( LAYER_GRID, aColor );
  693. if( IsGalCanvasActive() )
  694. {
  695. GetGalCanvas()->GetGAL()->SetGridColor( aColor );
  696. }
  697. }
  698. bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
  699. {
  700. int copperlayercnt = GetBoard()->GetCopperLayerCount( );
  701. PCB_LAYER_ID currLayer = GetActiveLayer();
  702. if( !GetDesignSettings().m_MicroViasAllowed )
  703. return false; // Obvious..
  704. if( copperlayercnt < 4 )
  705. return false; // Only on multilayer boards..
  706. if( ( currLayer == B_Cu )
  707. || ( currLayer == F_Cu )
  708. || ( currLayer == copperlayercnt - 2 )
  709. || ( currLayer == In1_Cu ) )
  710. return true;
  711. return false;
  712. }
  713. void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
  714. {
  715. PCB_BASE_FRAME::SetActiveLayer( aLayer );
  716. syncLayerWidgetLayer();
  717. if( IsGalCanvasActive() )
  718. {
  719. m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
  720. GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
  721. GetGalCanvas()->SetHighContrastLayer( aLayer );
  722. GetGalCanvas()->Refresh();
  723. }
  724. }
  725. void PCB_EDIT_FRAME::onBoardLoaded()
  726. {
  727. UpdateTitle();
  728. // Re-create layers manager based on layer info in board
  729. ReFillLayerWidget();
  730. ReCreateLayerBox();
  731. // Sync layer and item visibility
  732. syncLayerVisibilities();
  733. syncLayerWidgetLayer();
  734. syncRenderStates();
  735. // Update the tracks / vias available sizes list:
  736. ReCreateAuxiliaryToolbar();
  737. // Update the RATSNEST items, which were not loaded at the time
  738. // BOARD::SetVisibleElements() was called from within any PLUGIN.
  739. // See case LAYER_RATSNEST: in BOARD::SetElementVisibility()
  740. GetBoard()->SetVisibleElements( GetBoard()->GetVisibleElements() );
  741. // Display the loaded board:
  742. Zoom_Automatique( false );
  743. Refresh();
  744. SetMsgPanel( GetBoard() );
  745. SetStatusText( wxEmptyString );
  746. }
  747. void PCB_EDIT_FRAME::syncLayerWidgetLayer()
  748. {
  749. m_Layers->SelectLayer( GetActiveLayer() );
  750. m_Layers->OnLayerSelected();
  751. }
  752. void PCB_EDIT_FRAME::syncRenderStates()
  753. {
  754. m_Layers->ReFillRender();
  755. }
  756. void PCB_EDIT_FRAME::syncLayerVisibilities()
  757. {
  758. m_Layers->SyncLayerVisibilities();
  759. static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
  760. }
  761. void PCB_EDIT_FRAME::OnUpdateLayerAlpha( wxUpdateUIEvent & )
  762. {
  763. m_Layers->SyncLayerAlphaIndicators();
  764. }
  765. void PCB_EDIT_FRAME::unitsChangeRefresh()
  766. {
  767. PCB_BASE_FRAME::unitsChangeRefresh(); // Update the grid size select box.
  768. ReCreateAuxiliaryToolbar();
  769. }
  770. bool PCB_EDIT_FRAME::IsElementVisible( GAL_LAYER_ID aElement ) const
  771. {
  772. return GetBoard()->IsElementVisible( aElement );
  773. }
  774. void PCB_EDIT_FRAME::SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState )
  775. {
  776. GetGalCanvas()->GetView()->SetLayerVisible( aElement , aNewState );
  777. GetBoard()->SetElementVisibility( aElement, aNewState );
  778. m_Layers->SetRenderState( aElement, aNewState );
  779. }
  780. void PCB_EDIT_FRAME::SetVisibleAlls()
  781. {
  782. GetBoard()->SetVisibleAlls();
  783. for( GAL_LAYER_ID ii = GAL_LAYER_ID_START; ii < GAL_LAYER_ID_BITMASK_END; ++ii )
  784. m_Layers->SetRenderState( ii, true );
  785. }
  786. void PCB_EDIT_FRAME::ShowChangedLanguage()
  787. {
  788. // call my base class
  789. PCB_BASE_FRAME::ShowChangedLanguage();
  790. // update the layer manager
  791. m_Layers->Freeze();
  792. wxAuiPaneInfo& pane_info = m_auimgr.GetPane( m_Layers );
  793. pane_info.Caption( _( "Visibles" ) );
  794. m_auimgr.Update();
  795. m_Layers->SetLayersManagerTabsText();
  796. ReFillLayerWidget();
  797. m_Layers->ReFillRender();
  798. // upate the layer widget to match board visibility states, both layers and render columns.
  799. syncLayerVisibilities();
  800. syncLayerWidgetLayer();
  801. syncRenderStates();
  802. m_Layers->Thaw();
  803. // pcbnew-specific toolbars
  804. ReCreateMicrowaveVToolbar();
  805. }
  806. wxString PCB_EDIT_FRAME::GetLastNetListRead()
  807. {
  808. wxFileName absoluteFileName = m_lastNetListRead;
  809. wxFileName pcbFileName = GetBoard()->GetFileName();
  810. if( !absoluteFileName.MakeAbsolute( pcbFileName.GetPath() ) || !absoluteFileName.FileExists() )
  811. {
  812. absoluteFileName.Clear();
  813. m_lastNetListRead = wxEmptyString;
  814. }
  815. return absoluteFileName.GetFullPath();
  816. }
  817. void PCB_EDIT_FRAME::SetLastNetListRead( const wxString& aLastNetListRead )
  818. {
  819. wxFileName relativeFileName = aLastNetListRead;
  820. wxFileName pcbFileName = GetBoard()->GetFileName();
  821. if( relativeFileName.MakeRelativeTo( pcbFileName.GetPath() )
  822. && relativeFileName.GetFullPath() != aLastNetListRead )
  823. {
  824. m_lastNetListRead = relativeFileName.GetFullPath();
  825. }
  826. }
  827. void PCB_EDIT_FRAME::OnModify( )
  828. {
  829. PCB_BASE_FRAME::OnModify();
  830. Update3DView();
  831. m_ZoneFillsDirty = true;
  832. }
  833. void PCB_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
  834. {
  835. PCB_PLOT_PARAMS plot_prms = GetPlotSettings();
  836. // we don't want dialogs knowing about complex wxFrame functions so
  837. // pass everything the dialog needs without reference to *this frame's class.
  838. if( InvokeSVGPrint( this, GetBoard(), &plot_prms ) )
  839. {
  840. if( !plot_prms.IsSameAs( GetPlotSettings(), false ) )
  841. {
  842. // First, mark board as modified only for parameters saved in file
  843. if( !plot_prms.IsSameAs( GetPlotSettings(), true ) )
  844. OnModify();
  845. // Now, save any change, for the session
  846. SetPlotSettings( plot_prms );
  847. }
  848. }
  849. }
  850. void PCB_EDIT_FRAME::UpdateTitle()
  851. {
  852. wxFileName fileName = GetBoard()->GetFileName();
  853. wxString fileinfo;
  854. if( fileName.IsOk() && fileName.FileExists() )
  855. {
  856. fileinfo = fileName.IsFileWritable() ? wxString( wxEmptyString ) : _( " [Read Only]" );
  857. }
  858. else
  859. {
  860. fileinfo = _( " [new file]" );
  861. }
  862. wxString title;
  863. title.Printf( _( "Pcbnew" ) + wxT( " \u2014 %s%s" ),
  864. fileName.GetFullPath(),
  865. fileinfo );
  866. SetTitle( title );
  867. }
  868. void PCB_EDIT_FRAME::UpdateUserInterface()
  869. {
  870. // Update the layer manager and other widgets from the board setup
  871. // (layer and items visibility, colors ...)
  872. // Rebuild list of nets (full ratsnest rebuild)
  873. Compile_Ratsnest( NULL, true );
  874. GetBoard()->BuildConnectivity();
  875. // Update info shown by the horizontal toolbars
  876. ReCreateLayerBox();
  877. // Update the layer manager
  878. m_Layers->Freeze();
  879. ReFillLayerWidget();
  880. m_Layers->ReFillRender();
  881. // upate the layer widget to match board visibility states, both layers and render columns.
  882. syncLayerVisibilities();
  883. syncLayerWidgetLayer();
  884. syncRenderStates();
  885. m_Layers->Thaw();
  886. }
  887. #if defined( KICAD_SCRIPTING_WXPYTHON )
  888. void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
  889. {
  890. wxWindow * pythonPanelFrame = findPythonConsole();
  891. bool pythonPanelShown = true;
  892. if( pythonPanelFrame == NULL )
  893. pythonPanelFrame = CreatePythonShellWindow( this, pythonConsoleNameId() );
  894. else
  895. pythonPanelShown = ! pythonPanelFrame->IsShown();
  896. if( pythonPanelFrame )
  897. pythonPanelFrame->Show( pythonPanelShown );
  898. else
  899. wxMessageBox( wxT( "Error: unable to create the Python Console" ) );
  900. }
  901. #endif
  902. void PCB_EDIT_FRAME::OnLayerColorChange( wxCommandEvent& aEvent )
  903. {
  904. ReCreateLayerBox();
  905. }
  906. void PCB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
  907. {
  908. // switches currently used canvas (default / Cairo / OpenGL).
  909. PCB_BASE_FRAME::OnSwitchCanvas( aEvent );
  910. // The base class method reinit the layers manager.
  911. // We must upate the layer widget to match board visibility states,
  912. // both layers and render columns.
  913. syncLayerVisibilities();
  914. syncLayerWidgetLayer();
  915. syncRenderStates();
  916. }
  917. void PCB_EDIT_FRAME::ToPlotter( wxCommandEvent& event )
  918. {
  919. // Force rebuild the dialog if currently open because the old dialog can be not up to date
  920. // if the board (or units) has changed
  921. wxWindow* dlg = wxWindow::FindWindowByName( DLG_WINDOW_NAME );
  922. if( dlg )
  923. dlg->Destroy();
  924. dlg = new DIALOG_PLOT( this );
  925. dlg->Show( true );
  926. }
  927. bool PCB_EDIT_FRAME::SetCurrentNetClass( const wxString& aNetClassName )
  928. {
  929. bool change = GetDesignSettings().SetCurrentNetClass( aNetClassName );
  930. if( change )
  931. {
  932. ReCreateAuxiliaryToolbar();
  933. }
  934. return change;
  935. }
  936. void PCB_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
  937. {
  938. Pgm().ConfigurePaths( this );
  939. }
  940. void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
  941. {
  942. if( Kiface().IsSingle() )
  943. {
  944. DisplayError( this, _( "Cannot update the PCB, because Pcbnew is "
  945. "opened in stand-alone mode. In order to create or update "
  946. "PCBs from schematics, you need to launch the KiCad project manager "
  947. "and create a PCB project." ) );
  948. return;
  949. }
  950. else
  951. {
  952. // Update PCB requires a netlist. Therefore the schematic editor must be running
  953. // If this is not the case, open the schematic editor
  954. KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
  955. if( !frame->IsShown() )
  956. {
  957. wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
  958. frame->OpenProjectFiles( std::vector<wxString>( 1, schfn.GetFullPath() ) );
  959. // Because the schematic editor frame is not on screen, iconize it:
  960. // However, another valid option is to do not iconize the schematic editor frame
  961. // and show it
  962. frame->Iconize( true );
  963. // we show the schematic editor frame, because do not show is seen as
  964. // a not yet opened schematic by Kicad manager, which is not the case
  965. frame->Show( true );
  966. }
  967. Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_PCB_UPDATE_REQUEST, "", this );
  968. }
  969. }
  970. void PCB_EDIT_FRAME::OnFlipPcbView( wxCommandEvent& evt )
  971. {
  972. auto view = GetGalCanvas()->GetView();
  973. view->SetMirror( evt.IsChecked(), false );
  974. view->RecacheAllItems();
  975. Refresh();
  976. }
  977. void PCB_EDIT_FRAME::PythonPluginsReload()
  978. {
  979. // Reload Python plugins if they are newer than
  980. // the already loaded, and load new plugins
  981. #if defined(KICAD_SCRIPTING)
  982. //Reload plugin list: reload Python plugins if they are newer than
  983. // the already loaded, and load new plugins
  984. PythonPluginsReloadBase();
  985. #if defined(KICAD_SCRIPTING_ACTION_MENU)
  986. // Action plugins can be modified, therefore the plugins menu
  987. // must be updated:
  988. RebuildActionPluginMenus();
  989. #endif
  990. #endif
  991. }
  992. void PCB_EDIT_FRAME::InstallFootprintPropertiesDialog( MODULE* Module, wxDC* DC )
  993. {
  994. if( Module == NULL )
  995. return;
  996. #ifdef __WXMAC__
  997. // avoid Avoid "writes" in the dialog, creates errors with WxOverlay and NSView & Modal
  998. // Raising an Exception - Fixes #764678
  999. DC = NULL;
  1000. #endif
  1001. DIALOG_FOOTPRINT_BOARD_EDITOR* dlg = new DIALOG_FOOTPRINT_BOARD_EDITOR( this, Module, DC );
  1002. int retvalue = dlg->ShowModal();
  1003. /* retvalue =
  1004. * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_ABORT if abort,
  1005. * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_EXCHANGE_FP if exchange module,
  1006. * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_EDIT_OK for normal edition
  1007. * FP_PRM_EDITOR_RETVALUE::PRM_EDITOR_WANT_MODEDIT for a goto editor command
  1008. */
  1009. dlg->Close();
  1010. dlg->Destroy();
  1011. #ifdef __WXMAC__
  1012. // If something edited, push a refresh request
  1013. if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_EDIT_OK )
  1014. m_canvas->Refresh();
  1015. #endif
  1016. if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_MODEDIT )
  1017. {
  1018. FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
  1019. editor->Load_Module_From_BOARD( Module );
  1020. SetCurItem( NULL );
  1021. editor->Show( true );
  1022. editor->Raise(); // Iconize( false );
  1023. }
  1024. if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_UPDATE_FP )
  1025. {
  1026. InstallExchangeModuleFrame( Module, true );
  1027. }
  1028. if( retvalue == DIALOG_FOOTPRINT_BOARD_EDITOR::PRM_EDITOR_WANT_EXCHANGE_FP )
  1029. {
  1030. InstallExchangeModuleFrame( Module, false );
  1031. }
  1032. }
  1033. int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module, bool updateMode )
  1034. {
  1035. DIALOG_EXCHANGE_FOOTPRINTS dialog( this, Module, updateMode );
  1036. return dialog.ShowQuasiModal();
  1037. }
  1038. int PCB_EDIT_FRAME::GetIconScale()
  1039. {
  1040. int scale = 0;
  1041. Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
  1042. return scale;
  1043. }
  1044. void PCB_EDIT_FRAME::SetIconScale( int aScale )
  1045. {
  1046. Kiface().KifaceSettings()->Write( IconScaleEntry, aScale );
  1047. ReCreateMenuBar();
  1048. ReCreateHToolbar();
  1049. ReCreateAuxiliaryToolbar();
  1050. ReCreateVToolbar();
  1051. ReCreateOptToolbar();
  1052. ReCreateMicrowaveVToolbar();
  1053. Layout();
  1054. SendSizeEvent();
  1055. }
  1056. void PCB_EDIT_FRAME::LockModule( MODULE* aModule, bool aLocked )
  1057. {
  1058. const wxString ModulesMaskSelection = wxT( "*" );
  1059. if( aModule )
  1060. {
  1061. aModule->SetLocked( aLocked );
  1062. SetMsgPanel( aModule );
  1063. OnModify();
  1064. }
  1065. else
  1066. {
  1067. aModule = GetBoard()->m_Modules;
  1068. for( ; aModule != NULL; aModule = aModule->Next() )
  1069. {
  1070. if( WildCompareString( ModulesMaskSelection, aModule->GetReference() ) )
  1071. {
  1072. aModule->SetLocked( aLocked );
  1073. OnModify();
  1074. }
  1075. }
  1076. }
  1077. }