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.

1684 lines
52 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
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 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
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
* 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
19 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
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
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
12 years ago
12 years ago
12 years ago
18 years ago
12 years ago
19 years ago
12 years ago
12 years ago
12 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 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
19 years ago
19 years ago
19 years ago
16 years ago
19 years ago
19 years ago
19 years ago
19 years ago
17 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
12 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 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
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
19 years ago
18 years ago
18 years ago
18 years ago
18 years ago
19 years ago
19 years ago
19 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  6. * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
  7. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. /**
  27. * @file edit.cpp
  28. * @brief Edit PCB implementation.
  29. */
  30. #include <fctsys.h>
  31. #include <pgm_base.h>
  32. #include <kiface_i.h>
  33. #include <class_drawpanel.h>
  34. #include <confirm.h>
  35. #include <eda_doc.h>
  36. #include <gestfich.h>
  37. #include <kicad_device_context.h>
  38. #include <pcb_edit_frame.h>
  39. #include <pcbnew_id.h>
  40. #include <pcbnew.h>
  41. #include <footprint_edit_frame.h>
  42. #include <class_board.h>
  43. #include <class_module.h>
  44. #include <class_track.h>
  45. #include <class_zone.h>
  46. #include <class_pcb_text.h>
  47. #include <footprint_viewer_frame.h>
  48. #include <pcb_layer_box_selector.h>
  49. #include <dialog_drc.h>
  50. #include <invoke_pcb_dialog.h>
  51. #include <array_creator.h>
  52. #include <connectivity_data.h>
  53. #include <zone_filler.h>
  54. #include <dialog_move_exact.h>
  55. #include <tool/tool_manager.h>
  56. #include <tools/pcb_actions.h>
  57. // Handles the selection of command events.
  58. void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
  59. {
  60. int id = event.GetId();
  61. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  62. MODULE* module;
  63. auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
  64. m_canvas->CrossHairOff( &dc );
  65. switch( id ) // Some (not all ) edit commands must be finished or aborted
  66. {
  67. case wxID_CUT:
  68. case wxID_COPY:
  69. case ID_PCB_USER_GRID_SETUP:
  70. case ID_TOOLBARH_PCB_SELECT_LAYER:
  71. case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
  72. case ID_POPUP_PCB_ROTATE_TEXTEPCB:
  73. case ID_POPUP_PCB_FLIP_TEXTEPCB:
  74. case ID_POPUP_PCB_COPY_TEXTEPCB:
  75. case ID_POPUP_PCB_EDIT_TEXTEPCB:
  76. case ID_POPUP_PCB_EDIT_PCB_TARGET:
  77. case ID_POPUP_PCB_ROTATE_TEXTMODULE:
  78. case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
  79. case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
  80. case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
  81. case ID_POPUP_PCB_EDIT_MODULE_PRMS:
  82. case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT:
  83. case ID_POPUP_PCB_EDIT_TEXTMODULE:
  84. case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
  85. case ID_POPUP_PCB_BEGIN_TRACK:
  86. case ID_POPUP_PCB_END_TRACK:
  87. case ID_POPUP_PCB_PLACE_THROUGH_VIA:
  88. case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
  89. case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
  90. case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
  91. case ID_POPUP_PCB_PLACE_MICROVIA:
  92. case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
  93. case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
  94. case ID_POPUP_PCB_COPY_PAD_SETTINGS:
  95. case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
  96. case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
  97. case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
  98. case ID_POPUP_PCB_FILL_ALL_ZONES:
  99. case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES:
  100. case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
  101. case ID_POPUP_PCB_PLACE_ZONE_CORNER:
  102. case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
  103. case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
  104. case ID_POPUP_PCB_DELETE_ZONE:
  105. case ID_POPUP_PCB_DELETE_ZONE_CORNER:
  106. case ID_POPUP_PCB_MOVE_ZONE_CORNER:
  107. case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
  108. case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
  109. case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
  110. case ID_POPUP_PCB_ADD_ZONE_CORNER:
  111. case ID_POPUP_PCB_DELETE_TRACKSEG:
  112. case ID_POPUP_PCB_DELETE_TRACK:
  113. case ID_POPUP_PCB_DELETE_TRACKNET:
  114. case ID_POPUP_PCB_FILL_ZONE:
  115. case ID_POPUP_PCB_SELECT_LAYER:
  116. case ID_POPUP_PCB_SELECT_CU_LAYER:
  117. case ID_POPUP_PCB_SELECT_LAYER_PAIR:
  118. case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
  119. case ID_POPUP_PCB_MOVE_TRACK_NODE:
  120. case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
  121. case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
  122. case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
  123. case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
  124. case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
  125. case ID_POPUP_PCB_BREAK_TRACK:
  126. case ID_POPUP_PCB_EDIT_NET:
  127. case ID_POPUP_PCB_EDIT_TRACK:
  128. case ID_POPUP_PCB_EDIT_TRACKSEG:
  129. case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
  130. case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
  131. case ID_POPUP_PCB_LOCK_ON_TRACK:
  132. case ID_POPUP_PCB_LOCK_OFF_TRACK:
  133. case ID_POPUP_PCB_LOCK_ON_NET:
  134. case ID_POPUP_PCB_LOCK_OFF_NET:
  135. case ID_POPUP_DELETE_BLOCK:
  136. case ID_POPUP_PLACE_BLOCK:
  137. case ID_POPUP_ZOOM_BLOCK:
  138. case ID_POPUP_FLIP_BLOCK:
  139. case ID_POPUP_ROTATE_BLOCK:
  140. case ID_POPUP_DUPLICATE_BLOCK:
  141. case ID_POPUP_PCB_EDIT_DRAWING:
  142. case ID_POPUP_PCB_GETINFO_MARKER:
  143. case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
  144. case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
  145. case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
  146. case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
  147. case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST:
  148. break;
  149. case ID_POPUP_CANCEL_CURRENT_COMMAND:
  150. if( m_canvas->IsMouseCaptured() )
  151. {
  152. m_canvas->EndMouseCapture();
  153. }
  154. // Should not be executed, just in case
  155. if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
  156. {
  157. GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
  158. GetScreen()->m_BlockLocate.SetState( STATE_NO_BLOCK );
  159. GetScreen()->m_BlockLocate.ClearItemsList();
  160. }
  161. if( GetToolId() == ID_NO_TOOL_SELECTED )
  162. SetNoToolSelected();
  163. else
  164. SetCursor( (wxStockCursor) m_canvas->GetDefaultCursor() );
  165. break;
  166. default: // Finish (abort) the command
  167. if( m_canvas->IsMouseCaptured() )
  168. m_canvas->CallEndMouseCapture( &dc );
  169. if( GetToolId() != id )
  170. {
  171. if( m_lastDrawToolId != GetToolId() )
  172. m_lastDrawToolId = GetToolId();
  173. SetNoToolSelected();
  174. }
  175. break;
  176. }
  177. switch( id ) // Execute command
  178. {
  179. case 0:
  180. break;
  181. case ID_OPEN_MODULE_EDITOR:
  182. {
  183. FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, false );
  184. if( !editor )
  185. {
  186. editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
  187. editor->Zoom_Automatique( false );
  188. }
  189. else
  190. {
  191. // Needed on Windows, other platforms do not use it,
  192. // but it creates no issue
  193. if( editor->IsIconized() )
  194. editor->Iconize( false );
  195. editor->Raise();
  196. // Raising the window does not set the focus on Linux. This should work on
  197. // any platform.
  198. if( wxWindow::FindFocus() != editor )
  199. editor->SetFocus();
  200. }
  201. editor->PushPreferences( m_canvas );
  202. }
  203. break;
  204. case ID_OPEN_MODULE_VIEWER:
  205. {
  206. FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
  207. if( !viewer )
  208. {
  209. viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
  210. viewer->Zoom_Automatique( false );
  211. }
  212. else
  213. {
  214. // Needed on Windows, other platforms do not use it,
  215. // but it creates no issue
  216. if( viewer->IsIconized() )
  217. viewer->Iconize( false );
  218. viewer->Raise();
  219. // Raising the window does not set the focus on Linux. This should work on
  220. // any platform.
  221. if( wxWindow::FindFocus() != viewer )
  222. viewer->SetFocus();
  223. }
  224. viewer->PushPreferences( m_canvas );
  225. }
  226. break;
  227. case ID_PCB_GLOBAL_DELETE:
  228. InstallPcbGlobalDeleteFrame( wxDefaultPosition );
  229. break;
  230. case ID_POPUP_PLACE_BLOCK:
  231. GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
  232. m_canvas->SetAutoPanRequest( false );
  233. HandleBlockPlace( &dc );
  234. break;
  235. case ID_POPUP_DUPLICATE_BLOCK:
  236. GetScreen()->m_BlockLocate.SetCommand( BLOCK_DUPLICATE );
  237. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  238. m_canvas->SetAutoPanRequest( false );
  239. HandleBlockPlace( &dc );
  240. break;
  241. case ID_POPUP_ZOOM_BLOCK:
  242. GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
  243. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  244. HandleBlockEnd( &dc );
  245. break;
  246. case ID_POPUP_DELETE_BLOCK:
  247. GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
  248. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  249. HandleBlockEnd( &dc );
  250. break;
  251. case ID_POPUP_ROTATE_BLOCK:
  252. GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
  253. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  254. HandleBlockEnd( &dc );
  255. break;
  256. case ID_POPUP_FLIP_BLOCK:
  257. GetScreen()->m_BlockLocate.SetCommand( BLOCK_FLIP );
  258. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  259. HandleBlockEnd( &dc );
  260. break;
  261. case ID_DRC_CONTROL:
  262. // Shows the DRC dialog in non modal mode, to allows board editing
  263. // with the DRC dialog opened and showing errors.
  264. m_drc->ShowDRCDialog();
  265. break;
  266. case ID_GET_NETLIST:
  267. InstallNetlistFrame( &dc );
  268. break;
  269. case ID_FIND_ITEMS:
  270. InstallFindFrame();
  271. break;
  272. case ID_POPUP_CLOSE_CURRENT_TOOL:
  273. SetNoToolSelected();
  274. break;
  275. case ID_POPUP_CANCEL_CURRENT_COMMAND:
  276. break;
  277. case ID_POPUP_PCB_END_LINE:
  278. m_canvas->MoveCursorToCrossHair();
  279. // EndSegment(&dc);
  280. break;
  281. case ID_POPUP_PCB_EDIT_TRACK:
  282. if( GetCurItem() == NULL )
  283. break;
  284. Edit_Track_Width( &dc, (TRACK*) GetCurItem() );
  285. m_canvas->MoveCursorToCrossHair();
  286. OnModify();
  287. break;
  288. case ID_POPUP_PCB_EDIT_TRACKSEG:
  289. if( GetCurItem() == NULL )
  290. break;
  291. Edit_TrackSegm_Width( &dc, (TRACK*) GetCurItem() );
  292. m_canvas->MoveCursorToCrossHair();
  293. OnModify();
  294. break;
  295. case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
  296. {
  297. wxCommandEvent dummy;
  298. OnEditTracksAndVias( dummy );
  299. }
  300. m_canvas->MoveCursorToCrossHair();
  301. break;
  302. case ID_POPUP_PCB_BEGIN_TRACK:
  303. m_canvas->MoveCursorToCrossHair();
  304. OnHotkeyBeginRoute( &dc );
  305. break;
  306. case ID_POPUP_PCB_END_TRACK:
  307. m_canvas->MoveCursorToCrossHair();
  308. End_Route( (TRACK*) GetCurItem(), &dc );
  309. break;
  310. case ID_POPUP_PCB_PLACE_MOVED_TRACK_NODE:
  311. m_canvas->MoveCursorToCrossHair();
  312. if( GetCurItem()->IsDragging() )
  313. {
  314. PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
  315. }
  316. break;
  317. case ID_POPUP_PCB_SWITCH_TRACK_POSTURE:
  318. /* change the position of initial segment when creating new tracks
  319. * switch from _/ to -\ .
  320. * If a track is in progress, it will be redrawn
  321. */
  322. if( m_canvas->IsMouseCaptured() )
  323. m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
  324. g_Alternate_Track_Posture = !g_Alternate_Track_Posture;
  325. if( m_canvas->IsMouseCaptured() )
  326. m_canvas->CallMouseCapture( &dc, wxDefaultPosition, false );
  327. break;
  328. case ID_POPUP_PCB_PLACE_MICROVIA:
  329. if( !IsMicroViaAcceptable() )
  330. break;
  331. // fall through
  332. case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
  333. case ID_POPUP_PCB_PLACE_THROUGH_VIA:
  334. case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA:
  335. case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
  336. m_canvas->MoveCursorToCrossHair();
  337. if( GetCurItem()->IsDragging() )
  338. {
  339. PlaceDraggedOrMovedTrackSegment( (TRACK*) GetCurItem(), &dc );
  340. }
  341. else
  342. {
  343. BOARD_DESIGN_SETTINGS &settings = GetDesignSettings();
  344. VIATYPE_T v_type = settings.m_CurrentViaType;
  345. switch( id )
  346. {
  347. case ID_POPUP_PCB_PLACE_BLIND_BURIED_VIA:
  348. case ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA:
  349. settings.m_CurrentViaType = VIA_BLIND_BURIED;
  350. break;
  351. case ID_POPUP_PCB_PLACE_MICROVIA:
  352. settings.m_CurrentViaType = VIA_MICROVIA;
  353. break;
  354. default:
  355. settings.m_CurrentViaType = VIA_THROUGH;
  356. break;
  357. }
  358. // place via and switch layer.
  359. if( id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA ||
  360. id == ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_BLIND_BURIED_VIA )
  361. {
  362. m_canvas->SetIgnoreMouseEvents( true );
  363. wxPoint dlgPosition;
  364. wxGetMousePosition( &dlgPosition.x, &dlgPosition.y );
  365. PCB_LAYER_ID layer = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask(), dlgPosition );
  366. m_canvas->SetIgnoreMouseEvents( false );
  367. m_canvas->MoveCursorToCrossHair();
  368. if( GetActiveLayer() != layer )
  369. {
  370. GetScreen()->m_Route_Layer_TOP = GetActiveLayer();
  371. GetScreen()->m_Route_Layer_BOTTOM = layer;
  372. Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
  373. }
  374. }
  375. else
  376. Other_Layer_Route( (TRACK*) GetCurItem(), &dc );
  377. settings.m_CurrentViaType = v_type;
  378. if( displ_opts->m_ContrastModeDisplay )
  379. m_canvas->Refresh();
  380. }
  381. break;
  382. case ID_POPUP_PCB_DELETE_TRACKSEG:
  383. if( GetCurItem() )
  384. {
  385. m_canvas->MoveCursorToCrossHair();
  386. SetCurItem( Delete_Segment( &dc, (TRACK*) GetCurItem() ) );
  387. OnModify();
  388. }
  389. break;
  390. case ID_POPUP_PCB_DELETE_TRACK:
  391. if( GetCurItem() )
  392. {
  393. m_canvas->MoveCursorToCrossHair();
  394. Delete_Track( &dc, (TRACK*) GetCurItem() );
  395. SetCurItem( NULL );
  396. OnModify();
  397. }
  398. break;
  399. case ID_POPUP_PCB_DELETE_TRACKNET:
  400. m_canvas->MoveCursorToCrossHair();
  401. Delete_net( &dc, (TRACK*) GetCurItem() );
  402. SetCurItem( NULL );
  403. OnModify();
  404. break;
  405. case ID_POPUP_PCB_LOCK_ON_TRACKSEG:
  406. Attribut_Segment( (TRACK*) GetCurItem(), &dc, true );
  407. break;
  408. case ID_POPUP_PCB_LOCK_OFF_TRACKSEG:
  409. Attribut_Segment( (TRACK*) GetCurItem(), &dc, false );
  410. break;
  411. case ID_POPUP_PCB_LOCK_ON_TRACK:
  412. Attribut_Track( (TRACK*) GetCurItem(), &dc, true );
  413. break;
  414. case ID_POPUP_PCB_LOCK_OFF_TRACK:
  415. Attribut_Track( (TRACK*) GetCurItem(), &dc, false );
  416. break;
  417. case ID_POPUP_PCB_LOCK_ON_NET:
  418. Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), true );
  419. break;
  420. case ID_POPUP_PCB_LOCK_OFF_NET:
  421. Attribut_net( &dc, ( (TRACK*) GetCurItem() )->GetNetCode(), false );
  422. break;
  423. case ID_POPUP_PCB_SETFLAGS_TRACK_MNU:
  424. break;
  425. case ID_POPUP_PCB_DELETE_ZONE:
  426. m_canvas->MoveCursorToCrossHair();
  427. if( GetCurItem() )
  428. {
  429. SEGZONE* zsegm = (SEGZONE*) GetCurItem();
  430. int netcode = zsegm->GetNetCode();
  431. Delete_OldZone_Fill( zsegm );
  432. SetCurItem( NULL );
  433. TestNetConnection( NULL, netcode );
  434. OnModify();
  435. SetMsgPanel( GetBoard() );
  436. }
  437. break;
  438. case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
  439. Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
  440. SetCurItem( NULL ); // Outlines can have changed
  441. break;
  442. case ID_POPUP_PCB_ZONE_DUPLICATE:
  443. {
  444. ZONE_CONTAINER* zone = (ZONE_CONTAINER*) GetCurItem();
  445. duplicateZone( &dc, zone );
  446. }
  447. break;
  448. case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
  449. m_canvas->MoveCursorToCrossHair();
  450. m_canvas->SetAutoPanRequest( true );
  451. Add_Similar_Zone( &dc, (ZONE_CONTAINER*) GetCurItem() );
  452. break;
  453. case ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE:
  454. m_canvas->MoveCursorToCrossHair();
  455. m_canvas->SetAutoPanRequest( true );
  456. Add_Zone_Cutout( &dc, (ZONE_CONTAINER*) GetCurItem() );
  457. break;
  458. case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
  459. // Force the main contour selection, to remove the entire zone:
  460. ((ZONE_CONTAINER*) GetCurItem())->SetSelectedCorner( 0 );
  461. // Fall through
  462. case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
  463. m_canvas->MoveCursorToCrossHair();
  464. {
  465. int netcode = ( (ZONE_CONTAINER*) GetCurItem() )->GetNetCode();
  466. Delete_Zone_Contour( &dc, (ZONE_CONTAINER*) GetCurItem() );
  467. SetCurItem( NULL );
  468. TestNetConnection( NULL, netcode );
  469. SetMsgPanel( GetBoard() );
  470. }
  471. break;
  472. case ID_POPUP_PCB_DELETE_ZONE_CORNER:
  473. Remove_Zone_Corner( &dc, (ZONE_CONTAINER*) GetCurItem() );
  474. SetCurItem( NULL );
  475. break;
  476. case ID_POPUP_PCB_MOVE_ZONE_CORNER:
  477. {
  478. m_canvas->MoveCursorToCrossHair();
  479. ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
  480. m_canvas->SetAutoPanRequest( true );
  481. Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), false );
  482. }
  483. break;
  484. case ID_POPUP_PCB_DRAG_ZONE_OUTLINE_SEGMENT:
  485. {
  486. m_canvas->MoveCursorToCrossHair();
  487. ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
  488. m_canvas->SetAutoPanRequest( true );
  489. Start_Move_Zone_Drag_Outline_Edge( &dc, zone_cont, zone_cont->GetSelectedCorner() );
  490. }
  491. break;
  492. case ID_POPUP_PCB_MOVE_ZONE_OUTLINES:
  493. {
  494. m_canvas->MoveCursorToCrossHair();
  495. ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
  496. m_canvas->SetAutoPanRequest( true );
  497. Start_Move_Zone_Outlines( &dc, zone_cont );
  498. }
  499. break;
  500. case ID_POPUP_PCB_ADD_ZONE_CORNER:
  501. {
  502. m_canvas->MoveCursorToCrossHair();
  503. ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
  504. wxPoint pos = GetCrossHairPosition();
  505. /* add corner between zone_cont->m_CornerSelection
  506. * and zone_cont->m_CornerSelection+1
  507. * and start move the new corner
  508. */
  509. zone_cont->Draw( m_canvas, &dc, GR_XOR );
  510. zone_cont->Outline()->InsertVertex( zone_cont->GetSelectedCorner(), pos );
  511. zone_cont->SetSelectedCorner( zone_cont->GetSelectedCorner() + 1 );
  512. zone_cont->Draw( m_canvas, &dc, GR_XOR );
  513. m_canvas->SetAutoPanRequest( true );
  514. Start_Move_Zone_Corner( &dc, zone_cont, zone_cont->GetSelectedCorner(), true );
  515. }
  516. break;
  517. case ID_POPUP_PCB_PLACE_ZONE_OUTLINES:
  518. case ID_POPUP_PCB_PLACE_ZONE_CORNER:
  519. case ID_POPUP_PCB_PLACE_DRAGGED_ZONE_OUTLINE_SEGMENT:
  520. {
  521. m_canvas->MoveCursorToCrossHair();
  522. ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
  523. End_Move_Zone_Corner_Or_Outlines( &dc, zone_cont );
  524. m_canvas->SetAutoPanRequest( false );
  525. }
  526. break;
  527. case ID_POPUP_PCB_FILL_ALL_ZONES:
  528. m_canvas->MoveCursorToCrossHair();
  529. Fill_All_Zones( this );
  530. m_canvas->Refresh();
  531. SetMsgPanel( GetBoard() );
  532. break;
  533. case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE:
  534. if( ( GetCurItem() )->Type() == PCB_ZONE_AREA_T )
  535. {
  536. ZONE_CONTAINER* zone_container = (ZONE_CONTAINER*) GetCurItem();
  537. zone_container->UnFill();
  538. GetBoard()->GetConnectivity()->Update( zone_container );
  539. OnModify();
  540. SetMsgPanel( GetBoard() );
  541. m_canvas->Refresh();
  542. }
  543. Compile_Ratsnest( &dc, false );
  544. SetCurItem( NULL );
  545. break;
  546. case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones :
  547. GetBoard()->m_SegZoneDeprecated.DeleteAll(); // remove deprecated zone segments used
  548. // to fill zones in very old boards.
  549. for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ )
  550. {
  551. // Remove filled areas in zone
  552. ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii );
  553. zone_container->UnFill();
  554. GetBoard()->GetConnectivity()->Update( zone_container );
  555. }
  556. Compile_Ratsnest( &dc, false );
  557. SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer
  558. OnModify();
  559. SetMsgPanel( GetBoard() );
  560. m_canvas->Refresh();
  561. break;
  562. case ID_POPUP_PCB_FILL_ZONE:
  563. {
  564. m_canvas->MoveCursorToCrossHair();
  565. ZONE_FILLER filler( GetBoard() );
  566. filler.Fill( { (ZONE_CONTAINER*) GetCurItem() } );
  567. SetMsgPanel( GetBoard() );
  568. m_canvas->Refresh();
  569. break;
  570. }
  571. case ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST:
  572. StartMoveTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
  573. m_canvas->SetAutoPanRequest( true );
  574. break;
  575. case ID_POPUP_PCB_DRAG_MODULE_REQUEST:
  576. case ID_POPUP_PCB_MOVE_MODULE_REQUEST:
  577. if( GetCurItem() == NULL )
  578. break;
  579. // If the current Item is a pad, text module ...: Get its parent
  580. if( GetCurItem()->Type() != PCB_MODULE_T )
  581. SetCurItem( GetCurItem()->GetParent() );
  582. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  583. break;
  584. module = (MODULE*) GetCurItem();
  585. if( module->IsLocked() )
  586. {
  587. wxString msg;
  588. msg.Printf( _( "Footprint %s found, but it is locked" ),
  589. module->GetReference().GetData() );
  590. DisplayInfoMessage( this, msg );
  591. break;
  592. }
  593. SendMessageToEESCHEMA( module );
  594. SetCrossHairPosition( module->GetPosition() );
  595. m_canvas->MoveCursorToCrossHair();
  596. StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
  597. break;
  598. case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
  599. SetCurItem( GetFootprintFromBoardByReference() );
  600. module = (MODULE*) GetCurItem();
  601. if( module == NULL )
  602. break;
  603. if( module->IsLocked() )
  604. {
  605. wxString msg = wxString::Format(
  606. _( "Footprint %s found, but it is locked" ),
  607. module->GetReference().GetData() );
  608. DisplayInfoMessage( this, msg );
  609. break;
  610. }
  611. SendMessageToEESCHEMA( module );
  612. m_canvas->MoveCursorToCrossHair();
  613. StartMoveModule( module, &dc, false );
  614. break;
  615. case ID_POPUP_PCB_DELETE_MODULE:
  616. m_canvas->MoveCursorToCrossHair();
  617. // If the current Item is a pad, text module ...: Get its parent
  618. if( GetCurItem()->Type() != PCB_MODULE_T )
  619. SetCurItem( GetCurItem()->GetParent() );
  620. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  621. break;
  622. module = (MODULE*) GetCurItem();
  623. if( module->IsLocked() )
  624. {
  625. wxString msg;
  626. msg.Printf( _( "Footprint %s found, but it is locked" ),
  627. module->GetReference().GetData() );
  628. DisplayInfoMessage( this, msg );
  629. break;
  630. }
  631. if( Delete_Module( (MODULE*) GetCurItem(), &dc ) )
  632. {
  633. SetCurItem( NULL );
  634. }
  635. break;
  636. case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
  637. m_canvas->MoveCursorToCrossHair();
  638. // If the current Item is a pad, text module ...: Get its parent
  639. if( GetCurItem()->Type() != PCB_MODULE_T )
  640. SetCurItem( GetCurItem()->GetParent() );
  641. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  642. break;
  643. module = (MODULE*) GetCurItem();
  644. if( module->IsLocked() )
  645. {
  646. wxString msg;
  647. msg.Printf( _( "Footprint %s found, but it is locked" ),
  648. module->GetReference().GetData() );
  649. DisplayInfoMessage( this, msg );
  650. break;
  651. }
  652. // This is a simple rotation, no other editing in progress
  653. if( !GetCurItem()->IsMoving() )
  654. SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
  655. Rotate_Module( &dc, (MODULE*) GetCurItem(), m_rotationAngle, true );
  656. break;
  657. case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
  658. m_canvas->MoveCursorToCrossHair();
  659. // If the current Item is a pad, text module ...: Get its parent
  660. if( GetCurItem()->Type() != PCB_MODULE_T )
  661. SetCurItem( GetCurItem()->GetParent() );
  662. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  663. break;
  664. module = (MODULE*) GetCurItem();
  665. if( module->IsLocked() )
  666. {
  667. wxString msg;
  668. msg.Printf( _( "Footprint %s found, but it is locked" ),
  669. module->GetReference().GetData() );
  670. DisplayInfoMessage( this, msg );
  671. break;
  672. }
  673. // This is a simple rotation, no other editing in progress
  674. if( !GetCurItem()->IsMoving() )
  675. SaveCopyInUndoList( GetCurItem(), UR_CHANGED, ((MODULE*)GetCurItem())->GetPosition() );
  676. Rotate_Module( &dc, (MODULE*) GetCurItem(), -m_rotationAngle, true );
  677. break;
  678. case ID_POPUP_PCB_CHANGE_SIDE_MODULE:
  679. m_canvas->MoveCursorToCrossHair();
  680. // If the current Item is a pad, text module ...: Get its parent
  681. if( GetCurItem()->Type() != PCB_MODULE_T )
  682. SetCurItem( GetCurItem()->GetParent() );
  683. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  684. break;
  685. module = (MODULE*) GetCurItem();
  686. if( module->IsLocked() )
  687. {
  688. wxString msg;
  689. msg.Printf( _( "Footprint %s found, but it is locked" ),
  690. module->GetReference().GetData() );
  691. DisplayInfoMessage( this, msg );
  692. break;
  693. }
  694. // This is a simple flip, no other editing in progress
  695. if( !GetCurItem()->IsMoving() )
  696. SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
  697. Change_Side_Module( (MODULE*) GetCurItem(), &dc );
  698. break;
  699. case ID_POPUP_PCB_UPDATE_FOOTPRINTS:
  700. if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
  701. {
  702. InstallExchangeModuleFrame( (MODULE*) GetCurItem(), true );
  703. m_canvas->MoveCursorToCrossHair();
  704. }
  705. break;
  706. case ID_POPUP_PCB_EXCHANGE_FOOTPRINTS:
  707. if( GetCurItem() && GetCurItem()->Type() == PCB_MODULE_T )
  708. {
  709. InstallExchangeModuleFrame( (MODULE*) GetCurItem(), false );
  710. m_canvas->MoveCursorToCrossHair();
  711. }
  712. break;
  713. case ID_POPUP_PCB_EDIT_MODULE_PRMS:
  714. // If the current Item is a pad, text module ...: Get its parent
  715. if( GetCurItem()->Type() != PCB_MODULE_T )
  716. SetCurItem( GetCurItem()->GetParent() );
  717. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  718. break;
  719. InstallFootprintPropertiesDialog( (MODULE*) GetCurItem(), &dc );
  720. m_canvas->MoveCursorToCrossHair();
  721. break;
  722. case ID_POPUP_PCB_EDIT_MODULE_WITH_MODEDIT:
  723. // If we don't have a current item, there's nothing we can do here
  724. if( !GetCurItem() )
  725. break;
  726. // If the current Item is a pad, text module ...: Get its parent
  727. if( GetCurItem()->Type() != PCB_MODULE_T )
  728. SetCurItem( GetCurItem()->GetParent() );
  729. if( !GetCurItem() || GetCurItem()->Type() != PCB_MODULE_T )
  730. break;
  731. if( GetCurItem()->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
  732. {
  733. GetCurItem()->SetTimeStamp( GetNewTimeStamp() );
  734. OnModify();
  735. }
  736. {
  737. FOOTPRINT_EDIT_FRAME* editor = (FOOTPRINT_EDIT_FRAME*) Kiway().Player( FRAME_PCB_MODULE_EDITOR, true );
  738. editor->Load_Module_From_BOARD( (MODULE*)GetCurItem() );
  739. SetCurItem( NULL ); // the current module could be deleted by
  740. }
  741. m_canvas->MoveCursorToCrossHair();
  742. break;
  743. case ID_POPUP_PCB_DRAG_PAD_REQUEST:
  744. module = (MODULE*) GetCurItem()->GetParent();
  745. if( !module || module->Type() != PCB_MODULE_T )
  746. break;
  747. if( module->IsLocked() )
  748. {
  749. wxString msg;
  750. msg.Printf( _( "The parent (%s) of the pad is locked" ),
  751. module->GetReference().GetData() );
  752. DisplayInfoMessage( this, msg );
  753. break;
  754. }
  755. m_canvas->MoveCursorToCrossHair();
  756. StartMovePad( (D_PAD*) GetCurItem(), &dc, true );
  757. break;
  758. case ID_POPUP_PCB_MOVE_PAD_REQUEST:
  759. module = (MODULE*) GetCurItem()->GetParent();
  760. if( !module || module->Type() != PCB_MODULE_T )
  761. break;
  762. if( module->IsLocked() )
  763. {
  764. wxString msg;
  765. msg.Printf( _( "The parent (%s) of the pad is locked" ),
  766. module->GetReference().GetData() );
  767. DisplayInfoMessage( this, msg );
  768. break;
  769. }
  770. m_canvas->MoveCursorToCrossHair();
  771. StartMovePad( (D_PAD*) GetCurItem(), &dc, false );
  772. break;
  773. case ID_POPUP_PCB_EDIT_PAD:
  774. InstallPadOptionsFrame( (D_PAD*) GetCurItem() );
  775. m_canvas->MoveCursorToCrossHair();
  776. break;
  777. case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
  778. m_canvas->MoveCursorToCrossHair();
  779. SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
  780. Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
  781. break;
  782. case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
  783. m_canvas->MoveCursorToCrossHair();
  784. PushPadProperties((D_PAD*) GetCurItem() );
  785. break;
  786. case ID_POPUP_PCB_COPY_PAD_SETTINGS:
  787. m_canvas->MoveCursorToCrossHair();
  788. Export_Pad_Settings( (D_PAD*) GetCurItem() );
  789. break;
  790. case ID_POPUP_PCB_DELETE_PAD:
  791. SaveCopyInUndoList( GetCurItem()->GetParent(), UR_CHANGED );
  792. DeletePad( (D_PAD*) GetCurItem() );
  793. SetCurItem( NULL );
  794. m_canvas->MoveCursorToCrossHair();
  795. break;
  796. case ID_POPUP_PCB_EDIT_TEXTMODULE:
  797. InstallTextOptionsFrame( GetCurItem(), &dc );
  798. break;
  799. case ID_POPUP_PCB_RESET_TEXT_SIZE:
  800. ResetTextSize( GetCurItem(), &dc );
  801. break;
  802. case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
  803. m_canvas->MoveCursorToCrossHair();
  804. StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
  805. break;
  806. case ID_POPUP_PCB_ROTATE_TEXTMODULE:
  807. RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
  808. m_canvas->MoveCursorToCrossHair();
  809. break;
  810. case ID_POPUP_PCB_DELETE_TEXTMODULE:
  811. DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
  812. SetCurItem( NULL );
  813. m_canvas->MoveCursorToCrossHair();
  814. break;
  815. case ID_POPUP_PCB_SELECT_LAYER:
  816. {
  817. PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer() );
  818. if( itmp >= 0 )
  819. {
  820. // if user changed colors and we are in high contrast mode, then redraw
  821. // because the PAD_ATTRIB_SMD pads may change color.
  822. if( displ_opts->m_ContrastModeDisplay && GetActiveLayer() != itmp )
  823. {
  824. m_canvas->Refresh();
  825. }
  826. SetActiveLayer( itmp );
  827. }
  828. m_canvas->MoveCursorToCrossHair();
  829. }
  830. break;
  831. case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
  832. SelectCopperLayerPair();
  833. break;
  834. case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
  835. {
  836. PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllCuMask() );
  837. if( itmp >= 0 )
  838. SetActiveLayer( itmp );
  839. m_canvas->MoveCursorToCrossHair();
  840. }
  841. break;
  842. case ID_POPUP_PCB_SELECT_CU_LAYER:
  843. {
  844. PCB_LAYER_ID itmp = SelectLayer( GetActiveLayer(), LSET::AllNonCuMask() );
  845. if( itmp >= 0 )
  846. SetActiveLayer( itmp );
  847. }
  848. break;
  849. case ID_POPUP_PCB_SELECT_LAYER_PAIR:
  850. SelectCopperLayerPair();
  851. m_canvas->MoveCursorToCrossHair();
  852. break;
  853. case ID_TOOLBARH_PCB_SELECT_LAYER:
  854. SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
  855. if( displ_opts->m_ContrastModeDisplay )
  856. m_canvas->Refresh( true );
  857. break;
  858. case ID_POPUP_PCB_EDIT_TEXTEPCB:
  859. InstallTextOptionsFrame( GetCurItem(), &dc );
  860. break;
  861. case ID_POPUP_PCB_ROTATE_TEXTEPCB:
  862. Rotate_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
  863. m_canvas->MoveCursorToCrossHair();
  864. break;
  865. case ID_POPUP_PCB_COPY_TEXTEPCB:
  866. CreateTextePcb( &dc, (TEXTE_PCB*) GetCurItem() );
  867. m_canvas->MoveCursorToCrossHair();
  868. m_canvas->SetAutoPanRequest( true );
  869. break;
  870. case ID_POPUP_PCB_FLIP_TEXTEPCB:
  871. FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc );
  872. m_canvas->MoveCursorToCrossHair();
  873. break;
  874. case ID_POPUP_PCB_DELETE_TEXTEPCB:
  875. Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc );
  876. m_canvas->MoveCursorToCrossHair();
  877. break;
  878. case ID_POPUP_PCB_MOVE_PCB_TARGET_REQUEST:
  879. BeginMoveTarget( (PCB_TARGET*) GetCurItem(), &dc );
  880. m_canvas->MoveCursorToCrossHair();
  881. break;
  882. case ID_POPUP_PCB_EDIT_PCB_TARGET:
  883. ShowTargetOptionsDialog( (PCB_TARGET*) GetCurItem(), &dc );
  884. m_canvas->MoveCursorToCrossHair();
  885. break;
  886. case ID_POPUP_PCB_DELETE_PCB_TARGET:
  887. m_canvas->MoveCursorToCrossHair();
  888. DeleteTarget( (PCB_TARGET*) GetCurItem(), &dc );
  889. SetCurItem( NULL );
  890. break;
  891. case ID_POPUP_PCB_DELETE_DIMENSION:
  892. m_canvas->MoveCursorToCrossHair();
  893. DeleteDimension( (DIMENSION*) GetCurItem(), &dc );
  894. SetCurItem( NULL );
  895. break;
  896. case ID_POPUP_PCB_EDIT_DIMENSION:
  897. ShowDimensionPropertyDialog( (DIMENSION*) GetCurItem(), &dc );
  898. m_canvas->MoveCursorToCrossHair();
  899. break;
  900. case ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST:
  901. BeginMoveDimensionText( (DIMENSION*) GetCurItem(), &dc );
  902. break;
  903. case ID_POPUP_PCB_DELETE_DRAWING:
  904. Delete_Segment_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
  905. m_canvas->MoveCursorToCrossHair();
  906. break;
  907. case ID_POPUP_PCB_DELETE_MARKER:
  908. RemoveStruct( GetCurItem(), &dc );
  909. m_canvas->MoveCursorToCrossHair();
  910. break;
  911. case ID_POPUP_PCB_GETINFO_MARKER:
  912. if( GetCurItem() && GetCurItem()->Type() == PCB_MARKER_T )
  913. ( (MARKER_PCB*) GetCurItem() )->DisplayMarkerInfo( this );
  914. m_canvas->MoveCursorToCrossHair();
  915. break;
  916. case ID_POPUP_PCB_DELETE_DRAWING_LAYER:
  917. if( GetCurItem()->GetFlags() != 0 )
  918. break;
  919. Delete_Drawings_All_Layer( GetCurItem()->GetLayer() );
  920. SetCurItem( NULL );
  921. m_canvas->MoveCursorToCrossHair();
  922. m_canvas->Refresh();
  923. break;
  924. case ID_POPUP_PCB_EDIT_DRAWING:
  925. InstallGraphicItemPropertiesDialog( GetCurItem(), &dc );
  926. break;
  927. case ID_POPUP_PCB_MOVE_DRAWING_REQUEST:
  928. m_canvas->MoveCursorToCrossHair();
  929. Start_Move_DrawItem( (DRAWSEGMENT*) GetCurItem(), &dc );
  930. break;
  931. case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
  932. m_canvas->MoveCursorToCrossHair();
  933. if( GetCurItem() && (GetCurItem()->IsNew()) )
  934. {
  935. End_Edge( (DRAWSEGMENT*) GetCurItem(), &dc );
  936. SetCurItem( NULL );
  937. }
  938. break;
  939. case ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE:
  940. m_canvas->MoveCursorToCrossHair();
  941. if( GetCurItem() && (GetCurItem()->IsNew()) )
  942. {
  943. if( End_Zone( &dc ) )
  944. SetCurItem( NULL );
  945. }
  946. m_canvas->SetAutoPanRequest( false );
  947. break;
  948. case ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER:
  949. m_canvas->MoveCursorToCrossHair();
  950. if( GetCurItem() && (GetCurItem()->IsNew()) )
  951. {
  952. if( Delete_LastCreatedCorner( &dc ) == 0 ) // No more segment in outline,
  953. SetCurItem( NULL );
  954. }
  955. break;
  956. case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
  957. m_canvas->MoveCursorToCrossHair();
  958. StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
  959. break;
  960. case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
  961. case ID_POPUP_PCB_MOVE_TRACK_NODE:
  962. m_canvas->MoveCursorToCrossHair();
  963. StartMoveOneNodeOrSegment( (TRACK*) GetScreen()->GetCurItem(), &dc, id );
  964. break;
  965. case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
  966. m_canvas->MoveCursorToCrossHair();
  967. Start_DragTrackSegmentAndKeepSlope( (TRACK*) GetScreen()->GetCurItem(), &dc );
  968. break;
  969. case ID_POPUP_PCB_BREAK_TRACK:
  970. m_canvas->MoveCursorToCrossHair();
  971. {
  972. TRACK* track = (TRACK*) GetScreen()->GetCurItem();
  973. wxPoint pos = GetCrossHairPosition();
  974. track->Draw( m_canvas, &dc, GR_XOR );
  975. PICKED_ITEMS_LIST itemsListPicker;
  976. TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
  977. SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
  978. track->Draw( m_canvas, &dc, GR_XOR );
  979. newtrack->Draw( m_canvas, &dc, GR_XOR );
  980. // compute the new ratsnest, because connectivity could change
  981. TestNetConnection( &dc, track->GetNetCode() );
  982. }
  983. break;
  984. case ID_POPUP_PCB_MOVE_EXACT:
  985. moveExact();
  986. break;
  987. case ID_POPUP_PCB_DUPLICATE_ITEM:
  988. case ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT:
  989. duplicateItems( id == ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT );
  990. break;
  991. case ID_POPUP_PCB_CREATE_ARRAY:
  992. createArray();
  993. break;
  994. case ID_MENU_PCB_CLEAN:
  995. Clean_Pcb();
  996. break;
  997. case ID_MENU_PCB_UPDATE_FOOTPRINTS:
  998. InstallExchangeModuleFrame( (MODULE*) nullptr, true );
  999. break;
  1000. case ID_MENU_PCB_EXCHANGE_FOOTPRINTS:
  1001. InstallExchangeModuleFrame( (MODULE*) nullptr, false );
  1002. break;
  1003. case ID_MENU_PCB_SWAP_LAYERS:
  1004. Swap_Layers( event );
  1005. break;
  1006. case ID_PCB_USER_GRID_SETUP:
  1007. InvokeDialogGrid();
  1008. break;
  1009. case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC:
  1010. {
  1011. wxConfigBase* cfg = Pgm().CommonSettings();
  1012. cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
  1013. GetAssociatedDocument( this, g_DocModulesFileName, &Kiface().KifaceSearch() );
  1014. }
  1015. break;
  1016. case ID_MENU_ARCHIVE_MODULES_IN_LIBRARY:
  1017. ArchiveModulesOnBoard( false );
  1018. break;
  1019. case ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES:
  1020. ArchiveModulesOnBoard( true );
  1021. break;
  1022. case ID_GEN_IMPORT_DXF_FILE:
  1023. InvokeDXFDialogBoardImport( this );
  1024. m_canvas->Refresh();
  1025. break;
  1026. default:
  1027. wxString msg;
  1028. msg.Printf( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
  1029. DisplayError( this, msg );
  1030. break;
  1031. }
  1032. m_canvas->CrossHairOn( &dc );
  1033. m_canvas->SetIgnoreMouseEvents( false );
  1034. }
  1035. void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
  1036. {
  1037. if( Item == NULL )
  1038. return;
  1039. switch( Item->Type() )
  1040. {
  1041. case PCB_MODULE_T:
  1042. Delete_Module( (MODULE*) Item, DC );
  1043. break;
  1044. case PCB_DIMENSION_T:
  1045. DeleteDimension( (DIMENSION*) Item, DC );
  1046. break;
  1047. case PCB_TARGET_T:
  1048. DeleteTarget( (PCB_TARGET*) Item, DC );
  1049. break;
  1050. case PCB_LINE_T:
  1051. Delete_Segment_Edge( (DRAWSEGMENT*) Item, DC );
  1052. break;
  1053. case PCB_TEXT_T:
  1054. Delete_Texte_Pcb( (TEXTE_PCB*) Item, DC );
  1055. break;
  1056. case PCB_TRACE_T:
  1057. Delete_Track( DC, (TRACK*) Item );
  1058. break;
  1059. case PCB_VIA_T:
  1060. Delete_Segment( DC, (TRACK*) Item );
  1061. break;
  1062. case PCB_ZONE_T:
  1063. Delete_OldZone_Fill( (SEGZONE*) Item );
  1064. break;
  1065. case PCB_ZONE_AREA_T:
  1066. {
  1067. SetCurItem( NULL );
  1068. int netcode = ( (ZONE_CONTAINER*) Item )->GetNetCode();
  1069. Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item );
  1070. TestNetConnection( NULL, netcode );
  1071. SetMsgPanel( GetBoard() );
  1072. }
  1073. break;
  1074. case PCB_MARKER_T:
  1075. if( Item == GetCurItem() )
  1076. SetCurItem( NULL );
  1077. ( (MARKER_PCB*) Item )->Draw( m_canvas, DC, GR_XOR );
  1078. // delete the marker, and free memory. Don't use undo stack.
  1079. GetBoard()->Delete( Item );
  1080. break;
  1081. case PCB_PAD_T:
  1082. case PCB_MODULE_TEXT_T:
  1083. case PCB_MODULE_EDGE_T:
  1084. break;
  1085. case TYPE_NOT_INIT:
  1086. case PCB_T:
  1087. default:
  1088. {
  1089. wxString msg = wxString::Format(
  1090. wxT( "Remove: item type %d unknown." ), Item->Type() );
  1091. DisplayError( this, msg );
  1092. }
  1093. break;
  1094. }
  1095. }
  1096. void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
  1097. {
  1098. PCB_LAYER_ID curLayer = GetActiveLayer();
  1099. auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
  1100. // Check if the specified layer matches the present layer
  1101. if( layer == curLayer )
  1102. return;
  1103. // Copper layers cannot be selected unconditionally; how many
  1104. // of those layers are currently enabled needs to be checked.
  1105. if( IsCopperLayer( layer ) )
  1106. {
  1107. // If only one copper layer is enabled, the only such layer
  1108. // that can be selected to is the "Back" layer (so the
  1109. // selection of any other copper layer is disregarded).
  1110. if( GetBoard()->GetCopperLayerCount() < 2 )
  1111. {
  1112. if( layer != B_Cu )
  1113. return;
  1114. }
  1115. // If more than one copper layer is enabled, the "Copper"
  1116. // and "Component" layers can be selected, but the total
  1117. // number of copper layers determines which internal
  1118. // layers are also capable of being selected.
  1119. else
  1120. {
  1121. if( layer != B_Cu && layer != F_Cu && layer >= GetBoard()->GetCopperLayerCount() - 1 )
  1122. return;
  1123. }
  1124. EDA_ITEM* current = GetScreen()->GetCurItem();
  1125. // See if we are drawing a segment; if so, add a via?
  1126. if( GetToolId() == ID_TRACK_BUTT && current )
  1127. {
  1128. if( current->Type() == PCB_TRACE_T && current->IsNew() )
  1129. {
  1130. // Want to set the routing layers so that it switches properly -
  1131. // see the implementation of Other_Layer_Route - the working
  1132. // layer is used to 'start' the via and set the layer masks appropriately.
  1133. GetScreen()->m_Route_Layer_TOP = curLayer;
  1134. GetScreen()->m_Route_Layer_BOTTOM = layer;
  1135. SetActiveLayer( curLayer );
  1136. if( Other_Layer_Route( (TRACK*) GetScreen()->GetCurItem(), DC ) )
  1137. {
  1138. if( displ_opts->m_ContrastModeDisplay )
  1139. m_canvas->Refresh();
  1140. }
  1141. // if the via was allowed by DRC, then the layer swap has already
  1142. // been done by Other_Layer_Route(). if via not allowed, then
  1143. // return now so assignment to setActiveLayer() below doesn't happen.
  1144. return;
  1145. }
  1146. }
  1147. }
  1148. // Is yet more checking required? E.g. when the layer to be selected
  1149. // is a non-copper layer, or when switching between a copper layer
  1150. // and a non-copper layer, or vice-versa?
  1151. // ...
  1152. SetActiveLayer( layer );
  1153. if( displ_opts->m_ContrastModeDisplay )
  1154. m_canvas->Refresh();
  1155. }
  1156. void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
  1157. {
  1158. int id = aEvent.GetId();
  1159. int lastToolID = GetToolId();
  1160. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  1161. auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
  1162. // Stop the current command and deselect the current tool.
  1163. m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
  1164. switch( id )
  1165. {
  1166. case ID_NO_TOOL_SELECTED:
  1167. SetNoToolSelected();
  1168. break;
  1169. case ID_ZOOM_SELECTION:
  1170. // This tool is located on the main toolbar: switch it on or off on click on it
  1171. if( lastToolID != ID_ZOOM_SELECTION )
  1172. SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
  1173. else
  1174. SetNoToolSelected();
  1175. break;
  1176. case ID_TRACK_BUTT:
  1177. if( Settings().m_legacyDrcOn )
  1178. SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) );
  1179. else
  1180. SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) );
  1181. Compile_Ratsnest( &dc, true );
  1182. break;
  1183. case ID_PCB_MODULE_BUTT:
  1184. SetToolID( id, wxCURSOR_PENCIL, _( "Add footprint" ) );
  1185. break;
  1186. case ID_PCB_ZONES_BUTT:
  1187. SetToolID( id, wxCURSOR_PENCIL, _( "Add zones" ) );
  1188. if( displ_opts->m_DisplayZonesMode != 0 )
  1189. DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
  1190. if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
  1191. HighLight( &dc );
  1192. break;
  1193. case ID_PCB_KEEPOUT_AREA_BUTT:
  1194. SetToolID( id, wxCURSOR_PENCIL, _( "Add keepout" ) );
  1195. break;
  1196. case ID_PCB_TARGET_BUTT:
  1197. SetToolID( id, wxCURSOR_PENCIL, _( "Add layer alignment target" ) );
  1198. break;
  1199. case ID_PCB_PLACE_OFFSET_COORD_BUTT:
  1200. SetToolID( id, wxCURSOR_PENCIL, _( "Adjust zero" ) );
  1201. break;
  1202. case ID_PCB_PLACE_GRID_COORD_BUTT:
  1203. SetToolID( id, wxCURSOR_PENCIL, _( "Adjust grid origin" ) );
  1204. break;
  1205. case ID_PCB_ADD_LINE_BUTT:
  1206. SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic line" ) );
  1207. break;
  1208. case ID_PCB_ARC_BUTT:
  1209. SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic arc" ) );
  1210. break;
  1211. case ID_PCB_CIRCLE_BUTT:
  1212. SetToolID( id, wxCURSOR_PENCIL, _( "Add graphic circle" ) );
  1213. break;
  1214. case ID_PCB_ADD_TEXT_BUTT:
  1215. SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
  1216. break;
  1217. case ID_COMPONENT_BUTT:
  1218. SetToolID( id, wxCURSOR_HAND, _( "Add footprint" ) );
  1219. break;
  1220. case ID_PCB_DIMENSION_BUTT:
  1221. SetToolID( id, wxCURSOR_PENCIL, _( "Add dimension" ) );
  1222. break;
  1223. case ID_PCB_DELETE_ITEM_BUTT:
  1224. SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
  1225. break;
  1226. case ID_PCB_HIGHLIGHT_BUTT:
  1227. SetToolID( id, wxCURSOR_HAND, _( "Highlight net" ) );
  1228. break;
  1229. case ID_PCB_SHOW_1_RATSNEST_BUTT:
  1230. SetToolID( id, wxCURSOR_HAND, _( "Select rats nest" ) );
  1231. Compile_Ratsnest( &dc, true );
  1232. break;
  1233. // collect GAL-only tools here
  1234. case ID_PCB_DRAW_VIA_BUTT:
  1235. case ID_PCB_MEASUREMENT_TOOL:
  1236. SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
  1237. break;
  1238. }
  1239. }
  1240. void PCB_EDIT_FRAME::moveExact()
  1241. {
  1242. wxPoint translation;
  1243. double rotation;
  1244. ROTATION_ANCHOR rotationAnchor = ROTATE_AROUND_ITEM_ANCHOR;
  1245. DIALOG_MOVE_EXACT dialog( this, translation, rotation, rotationAnchor );
  1246. int ret = dialog.ShowModal();
  1247. if( ret == wxID_OK )
  1248. {
  1249. if( BOARD_ITEM* item = GetScreen()->GetCurItem() )
  1250. {
  1251. // When a pad is modified, the full footprint is saved
  1252. BOARD_ITEM* itemToSave = item;
  1253. if( item->Type() == PCB_PAD_T )
  1254. itemToSave = item->GetParent();
  1255. // Could be moved or rotated
  1256. SaveCopyInUndoList( itemToSave, UR_CHANGED );
  1257. item->Move( translation );
  1258. switch( rotationAnchor )
  1259. {
  1260. case ROTATE_AROUND_ITEM_ANCHOR:
  1261. item->Rotate( item->GetPosition(), rotation );
  1262. break;
  1263. case ROTATE_AROUND_USER_ORIGIN:
  1264. item->Rotate( GetScreen()->m_O_Curseur, rotation );
  1265. break;
  1266. case ROTATE_AROUND_AUX_ORIGIN:
  1267. item->Rotate( GetAuxOrigin(), rotation );
  1268. break;
  1269. default:
  1270. wxFAIL_MSG( "Rotation choice shouldn't have been available in this context." );
  1271. }
  1272. m_canvas->Refresh();
  1273. }
  1274. }
  1275. m_canvas->MoveCursorToCrossHair();
  1276. }
  1277. void PCB_EDIT_FRAME::duplicateItems( bool aIncrement )
  1278. {
  1279. BOARD_ITEM* item = GetScreen()->GetCurItem();
  1280. if( !item )
  1281. return;
  1282. // In the board editor, the pads or fp texts can be edited
  1283. // but cannot be duplicated (only the fp editor can do that).
  1284. // only the footprint can be duplicated
  1285. if( item->Type() == PCB_PAD_T || item->Type() == PCB_MODULE_TEXT_T )
  1286. item = static_cast<MODULE*>( item )->GetParent();
  1287. PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
  1288. }
  1289. void PCB_BASE_EDIT_FRAME::duplicateItem( BOARD_ITEM* aItem, bool aIncrement )
  1290. {
  1291. if( !aItem )
  1292. return;
  1293. // The easiest way to handle a duplicate item command
  1294. // is to simulate a block copy command, which gives us the undo management
  1295. // for free
  1296. if( GetScreen()->m_BlockLocate.GetState() == STATE_NO_BLOCK )
  1297. {
  1298. m_canvas->MoveCursorToCrossHair();
  1299. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  1300. wxPoint crossHairPos = GetCrossHairPosition();
  1301. const BLOCK_COMMAND_T blockType = aIncrement ? BLOCK_DUPLICATE_AND_INCREMENT : BLOCK_DUPLICATE;
  1302. if( !HandleBlockBegin( &dc, blockType, crossHairPos ) )
  1303. return;
  1304. // Add the item to the block copy pick list:
  1305. PICKED_ITEMS_LIST& itemsList = GetScreen()->m_BlockLocate.GetItems();
  1306. ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
  1307. picker.SetItem ( aItem );
  1308. itemsList.PushItem( picker );
  1309. // Set 2 coordinates updated by the mouse, because our simulation
  1310. // does not use the mouse to call HandleBlockEnd()
  1311. GetScreen()->m_BlockLocate.SetLastCursorPosition( crossHairPos );
  1312. GetScreen()->m_BlockLocate.SetEnd( crossHairPos );
  1313. HandleBlockEnd( &dc );
  1314. }
  1315. }
  1316. class LEGACY_ARRAY_CREATOR: public ARRAY_CREATOR
  1317. {
  1318. public:
  1319. LEGACY_ARRAY_CREATOR( PCB_BASE_EDIT_FRAME& editFrame ):
  1320. ARRAY_CREATOR( editFrame ),
  1321. m_item( m_parent.GetScreen()->GetCurItem() )
  1322. {}
  1323. private:
  1324. int getNumberOfItemsToArray() const override
  1325. {
  1326. // only handle single items
  1327. return (m_item != NULL) ? 1 : 0;
  1328. }
  1329. BOARD_ITEM* getNthItemToArray( int n ) const override
  1330. {
  1331. wxASSERT_MSG( n == 0, "Legacy array tool can only handle a single item" );
  1332. return m_item;
  1333. }
  1334. BOARD* getBoard() const override
  1335. {
  1336. return m_parent.GetBoard();
  1337. }
  1338. MODULE* getModule() const override
  1339. {
  1340. return dynamic_cast<MODULE*>( m_item->GetParent() );
  1341. }
  1342. wxPoint getRotationCentre() const override
  1343. {
  1344. return m_item->GetCenter();
  1345. }
  1346. void finalise() override
  1347. {
  1348. m_parent.GetCanvas()->Refresh();
  1349. }
  1350. BOARD_ITEM* m_item; // only have the one
  1351. };
  1352. void PCB_BASE_EDIT_FRAME::createArray()
  1353. {
  1354. LEGACY_ARRAY_CREATOR array_creator( *this );
  1355. array_creator.Invoke();
  1356. }