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.

1028 lines
30 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
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
18 years ago
18 years ago
18 years ago
18 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
* 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
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
16 years ago
17 years ago
16 years ago
16 years ago
18 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
  5. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file modedit.cpp
  26. */
  27. #include <fctsys.h>
  28. #include <kiface_i.h>
  29. #include <kiway.h>
  30. #include <class_drawpanel.h>
  31. #include <pcb_draw_panel_gal.h>
  32. #include <confirm.h>
  33. #include <gestfich.h>
  34. #include <pgm_base.h>
  35. #include <trigo.h>
  36. #include <3d_viewer/eda_3d_viewer.h>
  37. #include <wxPcbStruct.h>
  38. #include <kicad_device_context.h>
  39. #include <macros.h>
  40. #include <invoke_pcb_dialog.h>
  41. #include <class_pcb_layer_widget.h>
  42. #include <board_commit.h>
  43. #include <class_board.h>
  44. #include <class_module.h>
  45. #include <class_edge_mod.h>
  46. #include <ratsnest_data.h>
  47. #include <pcbnew.h>
  48. #include <protos.h>
  49. #include <pcbnew_id.h>
  50. #include <module_editor_frame.h>
  51. #include <modview_frame.h>
  52. #include <collectors.h>
  53. #include <tool/tool_manager.h>
  54. #include <tools/pcb_actions.h>
  55. #include <dialog_edit_module_for_Modedit.h>
  56. #include <dialog_move_exact.h>
  57. #include <dialog_create_array.h>
  58. #include <wildcards_and_files_ext.h>
  59. #include <menus_helpers.h>
  60. #include <footprint_wizard_frame.h>
  61. #include <config_params.h>
  62. #include <functional>
  63. using namespace std::placeholders;
  64. // Functions defined in block_module_editor, but used here
  65. // These 3 functions are used in modedit to rotate, mirror or move the
  66. // whole footprint so they are called with force_all = true
  67. void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
  68. void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
  69. void MoveMarkedItemsExactly( MODULE* module, const wxPoint& centre,
  70. const wxPoint& translation, double rotation,
  71. bool force_all = false );
  72. BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
  73. {
  74. BOARD_ITEM* item = GetCurItem();
  75. if( GetBoard()->m_Modules == NULL )
  76. return NULL;
  77. GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
  78. // Assign to scanList the proper item types desired based on tool type
  79. // or hotkey that is in play.
  80. const KICAD_T* scanList = NULL;
  81. if( aHotKeyCode )
  82. {
  83. // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
  84. // int aHotKeyCode ) when searching is needed from a hotkey handler
  85. }
  86. else
  87. {
  88. scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
  89. }
  90. m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
  91. // Remove redundancies: when an item is found, we can remove the module from list
  92. if( m_Collector->GetCount() > 1 )
  93. {
  94. for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
  95. {
  96. item = (*m_Collector)[ii];
  97. if( item->Type() != PCB_MODULE_T )
  98. continue;
  99. m_Collector->Remove( ii );
  100. ii--;
  101. }
  102. }
  103. if( m_Collector->GetCount() <= 1 )
  104. {
  105. item = (*m_Collector)[0];
  106. SetCurItem( item );
  107. }
  108. else // we can't figure out which item user wants, do popup menu so user can choose
  109. {
  110. wxMenu itemMenu;
  111. // Give a title to the selection menu. It also allow to close the popup menu without any action
  112. AddMenuItem( &itemMenu, wxID_NONE, _( "Clarify Selection" ),
  113. KiBitmap( info_xpm ) );
  114. itemMenu.AppendSeparator();
  115. int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
  116. for( int ii = 0; ii<limit; ++ii )
  117. {
  118. item = (*m_Collector)[ii];
  119. wxString text = item->GetSelectMenuText();
  120. BITMAP_DEF xpm = item->GetMenuImage();
  121. AddMenuItem( &itemMenu,
  122. ID_POPUP_PCB_ITEM_SELECTION_START + ii,
  123. text,
  124. KiBitmap( xpm ) );
  125. }
  126. // this menu's handler is void
  127. // PCB_BASE_FRAME::ProcessItemSelection()
  128. // and it calls SetCurItem() which in turn calls DisplayInfo() on the
  129. // item.
  130. m_canvas->SetAbortRequest( true ); // changed in false if an item is selected
  131. PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
  132. m_canvas->MoveCursorToCrossHair();
  133. m_canvas->SetIgnoreMouseEvents( false );
  134. // The function ProcessItemSelection() has set the current item, return it.
  135. item = GetCurItem();
  136. }
  137. if( item )
  138. {
  139. SetMsgPanel( item );
  140. }
  141. return item;
  142. }
  143. void FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard( wxCommandEvent& event )
  144. {
  145. if( GetScreen()->IsModify() )
  146. {
  147. if( !IsOK( this,
  148. _( "Current footprint changes will be lost and this operation cannot be undone. Continue?" ) ) )
  149. return;
  150. }
  151. if( ! Load_Module_From_BOARD( NULL ) )
  152. return;
  153. GetScreen()->ClearUndoRedoList();
  154. GetScreen()->ClrModify();
  155. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  156. if( draw3DFrame )
  157. draw3DFrame->NewDisplay( true );
  158. }
  159. void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
  160. {
  161. int id = event.GetId();
  162. wxPoint pos;
  163. INSTALL_UNBUFFERED_DC( dc, m_canvas );
  164. wxGetMousePosition( &pos.x, &pos.y );
  165. pos.y += 20;
  166. switch( id )
  167. {
  168. case wxID_CUT:
  169. case wxID_COPY:
  170. case ID_TOOLBARH_PCB_SELECT_LAYER:
  171. case ID_MODEDIT_PAD_SETTINGS:
  172. case ID_PCB_USER_GRID_SETUP:
  173. case ID_POPUP_PCB_ROTATE_TEXTEPCB:
  174. case ID_POPUP_PCB_EDIT_TEXTEPCB:
  175. case ID_POPUP_PCB_ROTATE_TEXTMODULE:
  176. case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
  177. case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
  178. case ID_POPUP_PCB_EDIT_TEXTMODULE:
  179. case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
  180. case ID_POPUP_PCB_COPY_PAD_SETTINGS:
  181. case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
  182. case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
  183. case ID_POPUP_MODEDIT_EDIT_BODY_ITEM:
  184. case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
  185. case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
  186. case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
  187. case ID_POPUP_PCB_DELETE_EDGE:
  188. case ID_POPUP_PCB_DELETE_TEXTMODULE:
  189. case ID_POPUP_PCB_DELETE_PAD:
  190. case ID_POPUP_DELETE_BLOCK:
  191. case ID_POPUP_PLACE_BLOCK:
  192. case ID_POPUP_ZOOM_BLOCK:
  193. case ID_POPUP_MIRROR_X_BLOCK:
  194. case ID_POPUP_ROTATE_BLOCK:
  195. case ID_POPUP_DUPLICATE_BLOCK:
  196. break;
  197. case ID_POPUP_CANCEL_CURRENT_COMMAND:
  198. default:
  199. if( m_canvas->IsMouseCaptured() )
  200. {
  201. // for all other commands: stop the move in progress
  202. m_canvas->CallEndMouseCapture( &dc );
  203. }
  204. if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
  205. SetNoToolSelected();
  206. break;
  207. }
  208. switch( id )
  209. {
  210. case ID_EXIT:
  211. Close( true );
  212. break;
  213. case ID_MODEDIT_SELECT_CURRENT_LIB:
  214. {
  215. wxString library = SelectLibrary( GetCurrentLib() );
  216. if( library.size() )
  217. {
  218. Prj().SetRString( PROJECT::PCB_LIB_NICKNAME, library );
  219. updateTitle();
  220. }
  221. }
  222. break;
  223. case ID_OPEN_MODULE_VIEWER:
  224. {
  225. FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
  226. if( !viewer )
  227. {
  228. viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
  229. viewer->Show( true );
  230. viewer->Zoom_Automatique( false );
  231. }
  232. else
  233. {
  234. // On Windows, Raise() does not bring the window on screen, when iconized
  235. if( viewer->IsIconized() )
  236. viewer->Iconize( false );
  237. viewer->Raise();
  238. // Raising the window does not set the focus on Linux. This should work on
  239. // any platform.
  240. if( wxWindow::FindFocus() != viewer )
  241. viewer->SetFocus();
  242. }
  243. }
  244. break;
  245. case ID_MODEDIT_DELETE_PART:
  246. DeleteModuleFromCurrentLibrary();
  247. break;
  248. case ID_MODEDIT_NEW_MODULE:
  249. {
  250. if( !Clear_Pcb( true ) )
  251. break;
  252. SetCrossHairPosition( wxPoint( 0, 0 ) );
  253. MODULE* module = CreateNewModule( wxEmptyString );
  254. if( module ) // i.e. if create module command not aborted
  255. {
  256. // Initialize data relative to nets and netclasses (for a new
  257. // module the defaults are used)
  258. // This is mandatory to handle and draw pads
  259. GetBoard()->BuildListOfNets();
  260. module->SetPosition( wxPoint( 0, 0 ) );
  261. if( GetBoard()->m_Modules )
  262. GetBoard()->m_Modules->ClearFlags();
  263. Zoom_Automatique( false );
  264. }
  265. updateView();
  266. m_canvas->Refresh();
  267. GetScreen()->ClrModify();
  268. }
  269. break;
  270. case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
  271. {
  272. if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
  273. {
  274. if( !IsOK( this,
  275. _( "Current Footprint will be lost and this operation cannot be undone. Continue ?" ) ) )
  276. break;
  277. }
  278. FOOTPRINT_WIZARD_FRAME* wizard = (FOOTPRINT_WIZARD_FRAME*) Kiway().Player(
  279. FRAME_PCB_FOOTPRINT_WIZARD_MODAL, true, this );
  280. if( wizard->ShowModal( NULL, this ) )
  281. {
  282. // Creates the new footprint from python script wizard
  283. MODULE* module = wizard->GetBuiltFootprint();
  284. if( module == NULL ) // i.e. if create module command aborted
  285. break;
  286. Clear_Pcb( false );
  287. SetCrossHairPosition( wxPoint( 0, 0 ) );
  288. // Add the new object to board
  289. GetBoard()->Add( module, ADD_APPEND );
  290. // Initialize data relative to nets and netclasses (for a new
  291. // module the defaults are used)
  292. // This is mandatory to handle and draw pads
  293. GetBoard()->BuildListOfNets();
  294. module->SetPosition( wxPoint( 0, 0 ) );
  295. module->ClearFlags();
  296. Zoom_Automatique( false );
  297. updateView();
  298. m_canvas->Refresh();
  299. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  300. if( draw3DFrame )
  301. draw3DFrame->NewDisplay( true );
  302. GetScreen()->ClrModify();
  303. }
  304. wizard->Destroy();
  305. }
  306. break;
  307. case ID_MODEDIT_SAVE_LIBMODULE:
  308. if( GetBoard()->m_Modules && GetCurrentLib().size() )
  309. {
  310. SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true );
  311. GetScreen()->ClrModify();
  312. }
  313. break;
  314. case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
  315. case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:
  316. {
  317. // update module in the current board,
  318. // not just add it to the board with total disregard for the netlist...
  319. PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
  320. if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
  321. {
  322. wxMessageBox( _("No board currently edited" ) );
  323. break;
  324. }
  325. BOARD* mainpcb = pcbframe->GetBoard();
  326. MODULE* source_module = NULL;
  327. MODULE* module_in_edit = GetBoard()->m_Modules;
  328. // Search the old module (source) if exists
  329. // Because this source could be deleted when editing the main board...
  330. if( module_in_edit->GetLink() ) // this is not a new module ...
  331. {
  332. source_module = mainpcb->m_Modules;
  333. for( ; source_module != NULL; source_module = source_module->Next() )
  334. {
  335. if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
  336. break;
  337. }
  338. }
  339. if( ( source_module == NULL )
  340. && ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
  341. {
  342. wxString msg;
  343. msg.Printf( _( "Unable to find the footprint source on the main board" ) );
  344. msg << _( "\nCannot update the footprint" );
  345. DisplayError( this, msg );
  346. break;
  347. }
  348. if( ( source_module != NULL )
  349. && ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
  350. {
  351. wxString msg;
  352. msg.Printf( _( "A footprint source was found on the main board" ) );
  353. msg << _( "\nCannot insert this footprint" );
  354. DisplayError( this, msg );
  355. break;
  356. }
  357. m_toolManager->RunAction( PCB_ACTIONS::selectionClear, true );
  358. pcbframe->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
  359. BOARD_COMMIT commit( pcbframe );
  360. // Create the "new" module
  361. MODULE* newmodule = new MODULE( *module_in_edit );
  362. newmodule->SetParent( mainpcb );
  363. newmodule->SetLink( 0 );
  364. if( source_module ) // this is an update command
  365. {
  366. // In the main board,
  367. // the new module replace the old module (pos, orient, ref, value
  368. // and connexions are kept)
  369. // and the source_module (old module) is deleted
  370. pcbframe->Exchange_Module( source_module, newmodule, commit );
  371. newmodule->SetTimeStamp( module_in_edit->GetLink() );
  372. commit.Push( wxT( "Update module" ) );
  373. }
  374. else // This is an insert command
  375. {
  376. wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
  377. commit.Add( newmodule );
  378. pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
  379. pcbframe->PlaceModule( newmodule, NULL );
  380. newmodule->SetPosition( wxPoint( 0, 0 ) );
  381. pcbframe->SetCrossHairPosition( cursor_pos );
  382. newmodule->SetTimeStamp( GetNewTimeStamp() );
  383. commit.Push( wxT( "Insert module" ) );
  384. }
  385. newmodule->ClearFlags();
  386. GetScreen()->ClrModify();
  387. pcbframe->SetCurItem( NULL );
  388. // @todo LEGACY should be unnecessary
  389. mainpcb->m_Status_Pcb = 0;
  390. }
  391. break;
  392. case ID_MODEDIT_IMPORT_PART:
  393. if( ! Clear_Pcb( true ) )
  394. break; // //this command is aborted
  395. SetCrossHairPosition( wxPoint( 0, 0 ) );
  396. Import_Module();
  397. if( GetBoard()->m_Modules )
  398. GetBoard()->m_Modules->ClearFlags();
  399. GetScreen()->ClrModify();
  400. Zoom_Automatique( false );
  401. m_canvas->Refresh();
  402. {
  403. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  404. if( draw3DFrame )
  405. draw3DFrame->NewDisplay( true );
  406. }
  407. break;
  408. case ID_MODEDIT_EXPORT_PART:
  409. if( GetBoard()->m_Modules )
  410. Export_Module( GetBoard()->m_Modules );
  411. break;
  412. case ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART:
  413. if( GetBoard()->m_Modules )
  414. {
  415. // CreateModuleLibrary() only creates a new library, does not save footprint
  416. wxString libPath = CreateNewLibrary();
  417. if( libPath.size() )
  418. SaveCurrentModule( &libPath );
  419. }
  420. break;
  421. case ID_MODEDIT_SHEET_SET:
  422. break;
  423. case ID_MODEDIT_LOAD_MODULE:
  424. wxLogDebug( wxT( "Loading module from library " ) + getLibPath() );
  425. if( ! Clear_Pcb( true ) )
  426. break;
  427. SetCrossHairPosition( wxPoint( 0, 0 ) );
  428. LoadModuleFromLibrary( GetCurrentLib(), Prj().PcbFootprintLibs(), true );
  429. if( GetBoard() && GetBoard()->m_Modules )
  430. {
  431. GetBoard()->m_Modules->ClearFlags();
  432. // if either m_Reference or m_Value are gone, reinstall them -
  433. // otherwise you cannot see what you are doing on board
  434. TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
  435. TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();
  436. if( val && ref )
  437. {
  438. ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
  439. if( ref->GetLength() == 0 )
  440. ref->SetText( wxT( "Ref**" ) );
  441. val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
  442. if( val->GetLength() == 0 )
  443. val->SetText( wxT( "Val**" ) );
  444. }
  445. }
  446. Zoom_Automatique( false );
  447. {
  448. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  449. if( draw3DFrame )
  450. draw3DFrame->NewDisplay( true );
  451. }
  452. GetScreen()->ClrModify();
  453. updateView();
  454. m_canvas->Refresh();
  455. break;
  456. case ID_MODEDIT_PAD_SETTINGS:
  457. InstallPadOptionsFrame( NULL );
  458. break;
  459. case ID_MODEDIT_CHECK:
  460. // Currently: not implemented
  461. break;
  462. case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
  463. if( GetBoard()->m_Modules )
  464. {
  465. SetCurItem( GetBoard()->m_Modules );
  466. DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
  467. dialog.ShowModal();
  468. GetScreen()->GetCurItem()->ClearFlags();
  469. m_canvas->Refresh();
  470. }
  471. break;
  472. case ID_POPUP_CLOSE_CURRENT_TOOL:
  473. break;
  474. case ID_POPUP_CANCEL_CURRENT_COMMAND:
  475. break;
  476. case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
  477. m_canvas->MoveCursorToCrossHair();
  478. Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
  479. m_canvas->Refresh();
  480. break;
  481. case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
  482. m_canvas->MoveCursorToCrossHair();
  483. Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
  484. m_canvas->Refresh();
  485. break;
  486. case ID_POPUP_PCB_EDIT_MODULE_PRMS:
  487. {
  488. DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
  489. dialog.ShowModal();
  490. GetScreen()->GetCurItem()->ClearFlags();
  491. m_canvas->MoveCursorToCrossHair();
  492. m_canvas->Refresh();
  493. }
  494. break;
  495. case ID_POPUP_PCB_MOVE_PAD_REQUEST:
  496. m_canvas->MoveCursorToCrossHair();
  497. StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc, false );
  498. break;
  499. case ID_POPUP_PCB_EDIT_PAD:
  500. InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() );
  501. m_canvas->MoveCursorToCrossHair();
  502. break;
  503. case ID_POPUP_PCB_DELETE_PAD:
  504. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  505. DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
  506. SetCurItem( NULL );
  507. m_canvas->MoveCursorToCrossHair();
  508. break;
  509. case ID_POPUP_PCB_DUPLICATE_ITEM:
  510. duplicateItems( false );
  511. break;
  512. case ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT:
  513. duplicateItems( true );
  514. break;
  515. case ID_POPUP_PCB_MOVE_EXACT:
  516. moveExact();
  517. break;
  518. case ID_POPUP_PCB_CREATE_ARRAY:
  519. createArray();
  520. break;
  521. case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
  522. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  523. m_canvas->MoveCursorToCrossHair();
  524. Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
  525. break;
  526. case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
  527. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  528. // Calls the global change dialog:
  529. DlgGlobalChange_PadSettings( (D_PAD*) GetScreen()->GetCurItem() );
  530. m_canvas->MoveCursorToCrossHair();
  531. break;
  532. case ID_POPUP_PCB_COPY_PAD_SETTINGS:
  533. m_canvas->MoveCursorToCrossHair();
  534. Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() );
  535. break;
  536. case ID_POPUP_PCB_EDIT_TEXTMODULE:
  537. InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
  538. m_canvas->MoveCursorToCrossHair();
  539. break;
  540. case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
  541. m_canvas->MoveCursorToCrossHair();
  542. StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
  543. break;
  544. case ID_POPUP_PCB_ROTATE_TEXTMODULE:
  545. RotateTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
  546. m_canvas->MoveCursorToCrossHair();
  547. break;
  548. case ID_POPUP_PCB_DELETE_TEXTMODULE:
  549. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  550. DeleteTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ) );
  551. SetCurItem( NULL );
  552. m_canvas->MoveCursorToCrossHair();
  553. break;
  554. case ID_POPUP_PCB_MOVE_EDGE:
  555. Start_Move_EdgeMod( static_cast<EDGE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
  556. m_canvas->MoveCursorToCrossHair();
  557. break;
  558. case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
  559. m_canvas->MoveCursorToCrossHair();
  560. if( GetScreen()->GetCurItem()->IsNew() )
  561. {
  562. End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() );
  563. SetCurItem( NULL );
  564. }
  565. break;
  566. case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
  567. {
  568. EDGE_MODULE* edge = NULL;
  569. if( GetScreen()->GetCurItem()
  570. && ( GetScreen()->GetCurItem()->Type() == PCB_MODULE_EDGE_T ) )
  571. {
  572. edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
  573. }
  574. Enter_Edge_Width( edge );
  575. m_canvas->MoveCursorToCrossHair();
  576. if( edge )
  577. m_canvas->Refresh();
  578. }
  579. break;
  580. case ID_POPUP_MODEDIT_EDIT_BODY_ITEM :
  581. m_canvas->MoveCursorToCrossHair();
  582. InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) GetScreen()->GetCurItem() );
  583. m_canvas->Refresh();
  584. break;
  585. case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
  586. m_canvas->MoveCursorToCrossHair();
  587. Edit_Edge_Width( NULL );
  588. m_canvas->Refresh();
  589. break;
  590. case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
  591. m_canvas->MoveCursorToCrossHair();
  592. Edit_Edge_Layer( NULL );
  593. m_canvas->Refresh();
  594. break;
  595. case ID_POPUP_PCB_DELETE_EDGE:
  596. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  597. m_canvas->MoveCursorToCrossHair();
  598. RemoveStruct( GetScreen()->GetCurItem() );
  599. SetCurItem( NULL );
  600. break;
  601. case ID_MODEDIT_MODULE_ROTATE:
  602. case ID_MODEDIT_MODULE_MIRROR:
  603. case ID_MODEDIT_MODULE_MOVE_EXACT:
  604. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  605. Transform( (MODULE*) GetScreen()->GetCurItem(), id );
  606. m_canvas->Refresh();
  607. break;
  608. case ID_PCB_DRAWINGS_WIDTHS_SETUP:
  609. InstallOptionsFrame( pos );
  610. break;
  611. case ID_PCB_PAD_SETUP:
  612. {
  613. BOARD_ITEM* item = GetCurItem();
  614. if( item )
  615. {
  616. if( item->Type() != PCB_PAD_T )
  617. item = NULL;
  618. }
  619. InstallPadOptionsFrame( (D_PAD*) item );
  620. }
  621. break;
  622. case ID_PCB_USER_GRID_SETUP:
  623. InvokeDialogGrid();
  624. break;
  625. case ID_POPUP_PLACE_BLOCK:
  626. GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
  627. m_canvas->SetAutoPanRequest( false );
  628. HandleBlockPlace( &dc );
  629. break;
  630. case ID_POPUP_DUPLICATE_BLOCK:
  631. GetScreen()->m_BlockLocate.SetCommand( BLOCK_DUPLICATE );
  632. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  633. m_canvas->SetAutoPanRequest( false );
  634. HandleBlockPlace( &dc );
  635. break;
  636. case ID_POPUP_ZOOM_BLOCK:
  637. GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
  638. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  639. HandleBlockEnd( &dc );
  640. break;
  641. case ID_POPUP_DELETE_BLOCK:
  642. GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
  643. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  644. HandleBlockEnd( &dc );
  645. break;
  646. case ID_POPUP_ROTATE_BLOCK:
  647. GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
  648. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  649. HandleBlockEnd( &dc );
  650. break;
  651. case ID_POPUP_MIRROR_X_BLOCK:
  652. GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
  653. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  654. HandleBlockEnd( &dc );
  655. break;
  656. case ID_POPUP_MOVE_BLOCK_EXACT:
  657. GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE_EXACT );
  658. GetScreen()->m_BlockLocate.SetMessageBlock( this );
  659. HandleBlockEnd( &dc );
  660. break;
  661. case ID_GEN_IMPORT_DXF_FILE:
  662. if( GetBoard()->m_Modules )
  663. {
  664. InvokeDXFDialogModuleImport( this, GetBoard()->m_Modules );
  665. m_canvas->Refresh();
  666. }
  667. break;
  668. default:
  669. DisplayError( this,
  670. wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) );
  671. break;
  672. }
  673. }
  674. void FOOTPRINT_EDIT_FRAME::moveExact()
  675. {
  676. MOVE_PARAMETERS params;
  677. params.allowOverride = false;
  678. params.editingFootprint = true;
  679. DIALOG_MOVE_EXACT dialog( this, params );
  680. int ret = dialog.ShowModal();
  681. if( ret == wxID_OK )
  682. {
  683. SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
  684. BOARD_ITEM* item = GetScreen()->GetCurItem();
  685. wxPoint anchorPoint = item->GetPosition();
  686. if( params.origin == RELATIVE_TO_CURRENT_POSITION )
  687. {
  688. anchorPoint = wxPoint( 0, 0 );
  689. }
  690. wxPoint finalMoveVector = params.translation - anchorPoint;
  691. item->Move( finalMoveVector );
  692. item->Rotate( item->GetPosition(), params.rotation );
  693. m_canvas->Refresh();
  694. }
  695. m_canvas->MoveCursorToCrossHair();
  696. }
  697. void FOOTPRINT_EDIT_FRAME::duplicateItems( bool aIncrement )
  698. {
  699. BOARD_ITEM* item = GetScreen()->GetCurItem();
  700. PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
  701. }
  702. void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
  703. {
  704. switch( transform )
  705. {
  706. case ID_MODEDIT_MODULE_ROTATE:
  707. RotateMarkedItems( module, wxPoint(0,0), true );
  708. break;
  709. case ID_MODEDIT_MODULE_MIRROR:
  710. MirrorMarkedItems( module, wxPoint(0,0), true );
  711. break;
  712. case ID_MODEDIT_MODULE_MOVE_EXACT:
  713. {
  714. MOVE_PARAMETERS params;
  715. DIALOG_MOVE_EXACT dialog( this, params );
  716. int ret = dialog.ShowModal();
  717. if( ret == wxID_OK )
  718. {
  719. MoveMarkedItemsExactly( module, wxPoint( 0, 0 ),
  720. params.translation, params.rotation, true );
  721. }
  722. break;
  723. }
  724. default:
  725. DisplayInfoMessage( this, wxT( "Not available" ) );
  726. break;
  727. }
  728. module->CalculateBoundingBox();
  729. OnModify();
  730. }
  731. void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
  732. {
  733. int id = aEvent.GetId();
  734. int lastToolID = GetToolId();
  735. // Stop the current command and deselect the current tool.
  736. SetNoToolSelected();
  737. switch( id )
  738. {
  739. case ID_NO_TOOL_SELECTED:
  740. break;
  741. case ID_ZOOM_SELECTION:
  742. // This tool is located on the main toolbar: switch it on or off on click on it
  743. if( lastToolID != ID_ZOOM_SELECTION )
  744. SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
  745. else
  746. SetNoToolSelected();
  747. break;
  748. case ID_MODEDIT_LINE_TOOL:
  749. SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
  750. break;
  751. case ID_MODEDIT_ARC_TOOL:
  752. SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
  753. break;
  754. case ID_MODEDIT_CIRCLE_TOOL:
  755. SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
  756. break;
  757. case ID_MODEDIT_TEXT_TOOL:
  758. SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
  759. break;
  760. case ID_MODEDIT_ANCHOR_TOOL:
  761. SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
  762. break;
  763. case ID_MODEDIT_PLACE_GRID_COORD:
  764. SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
  765. break;
  766. case ID_MODEDIT_PAD_TOOL:
  767. if( GetBoard()->m_Modules )
  768. {
  769. SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
  770. }
  771. else
  772. {
  773. SetToolID( id, wxCURSOR_ARROW, _( "Pad settings" ) );
  774. InstallPadOptionsFrame( NULL );
  775. SetNoToolSelected();
  776. }
  777. break;
  778. case ID_MODEDIT_DELETE_TOOL:
  779. SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
  780. break;
  781. case ID_MODEDIT_MEASUREMENT_TOOL:
  782. DisplayError( this, wxT( "Unsupported tool in legacy canvas" ) );
  783. SetNoToolSelected();
  784. break;
  785. default:
  786. wxFAIL_MSG( wxT( "Unknown command id." ) );
  787. SetNoToolSelected();
  788. }
  789. }
  790. COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
  791. {
  792. return Settings().Colors().GetItemColor( LAYER_GRID );
  793. }
  794. void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
  795. {
  796. PCB_BASE_FRAME::SetActiveLayer( aLayer );
  797. m_Layers->SelectLayer( GetActiveLayer() );
  798. m_Layers->OnLayerSelected();
  799. if( IsGalCanvasActive() )
  800. {
  801. GetGalCanvas()->SetHighContrastLayer( aLayer );
  802. GetGalCanvas()->Refresh();
  803. }
  804. }
  805. bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
  806. {
  807. if( ! Clear_Pcb( true ) )
  808. return false; // //this command is aborted
  809. SetCrossHairPosition( wxPoint( 0, 0 ) );
  810. Import_Module( aFileSet[0] );
  811. if( GetBoard()->m_Modules )
  812. GetBoard()->m_Modules->ClearFlags();
  813. GetScreen()->ClrModify();
  814. Zoom_Automatique( false );
  815. m_canvas->Refresh();
  816. return true;
  817. }