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.

1193 lines
38 KiB

17 years ago
17 years ago
17 years ago
17 years ago
16 years ago
16 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* 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
17 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
17 years ago
17 years ago
17 years ago
17 years ago
17 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /**
  2. * @file dialog_design_rules.cpp
  3. */
  4. /*
  5. * This program source code file is part of KiCad, a free EDA CAD application.
  6. *
  7. * Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
  8. * Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
  9. * Copyright (C) 2009-2015 KiCad Developers, see change_log.txt for contributors.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version 2
  14. * of the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, you may find one here:
  23. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  24. * or you may search the http://www.gnu.org website for the version 2 license,
  25. * or you may write to the Free Software Foundation, Inc.,
  26. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  27. */
  28. /* functions relative to the design rules editor
  29. */
  30. #include <fctsys.h>
  31. #include <class_drawpanel.h>
  32. #include <base_units.h>
  33. #include <confirm.h>
  34. #include <pcbnew.h>
  35. #include <wxPcbStruct.h>
  36. #include <class_board_design_settings.h>
  37. #include <pcbnew_id.h>
  38. #include <class_track.h>
  39. #include <macros.h>
  40. #include <html_messagebox.h>
  41. #include <dialog_design_rules.h>
  42. #include <wx/generic/gridctrl.h>
  43. #include <dialog_design_rules_aux_helper_class.h>
  44. // Column labels for net lists
  45. #define NET_TITLE _( "Net" )
  46. #define CLASS_TITLE _( "Class" )
  47. // Field Positions on rules grid
  48. enum {
  49. GRID_CLEARANCE,
  50. GRID_TRACKSIZE,
  51. GRID_VIASIZE,
  52. GRID_VIADRILL,
  53. GRID_uVIASIZE,
  54. GRID_uVIADRILL,
  55. GRID_DIFF_PAIR_WIDTH,
  56. GRID_DIFF_PAIR_GAP
  57. };
  58. const wxString DIALOG_DESIGN_RULES::wildCard = _( "* (Any)" );
  59. // dialog should remember its previously selected tab
  60. int DIALOG_DESIGN_RULES::s_LastTabSelection = -1;
  61. // methods for the helper class NETS_LIST_CTRL
  62. wxString NETS_LIST_CTRL::OnGetItemText( long item, long column ) const
  63. {
  64. if( column == 0 )
  65. {
  66. if( item < (long) m_Netnames.GetCount() )
  67. return m_Netnames[item];
  68. else
  69. return wxEmptyString;
  70. }
  71. else if( item < (long) m_Classnames.GetCount() )
  72. return m_Classnames[item];
  73. return wxEmptyString;
  74. }
  75. void NETS_LIST_CTRL::SetRowItems( unsigned aRow,
  76. const wxString& aNetname,
  77. const wxString& aNetclassName )
  78. {
  79. // insert blanks if aRow is larger than existing row count
  80. unsigned cnt = m_Netnames.GetCount();
  81. if( cnt <= aRow )
  82. m_Netnames.Add( wxEmptyString, aRow - cnt + 1 );
  83. cnt = m_Classnames.GetCount();
  84. if( cnt <= aRow )
  85. m_Classnames.Add( wxEmptyString, aRow - cnt + 1 );
  86. if( (int)aRow <= GetItemCount() )
  87. SetItemCount( aRow + 1 );
  88. m_Netnames[aRow] = aNetname;
  89. m_Classnames[aRow] = aNetclassName;
  90. }
  91. /**
  92. * Function EnsureGridColumnWidths
  93. * resizes all the columns in a wxGrid based only on the requirements of the
  94. * column titles and not on the grid cell requirements, assuming that the grid
  95. * cell width requirements are narrower than the column title requirements.
  96. */
  97. // @todo: maybe move this to common.cpp if it works.
  98. static void EnsureGridColumnWidths( wxWindow* aShower, wxGrid* aGrid )
  99. {
  100. wxWindowDC sDC( aShower );
  101. sDC.SetFont( aGrid->GetLabelFont() );
  102. int colCount = aGrid->GetNumberCols();
  103. for( int col = 0; col < colCount; ++col )
  104. {
  105. // add two spaces to the text and size it.
  106. wxString colText = aGrid->GetColLabelValue( col ) + wxT( " " );
  107. wxSize needed = sDC.GetTextExtent( colText );
  108. // set the width of this column
  109. aGrid->SetColSize( col, needed.x );
  110. }
  111. }
  112. static void EnsureGridRowTitleWidth( wxWindow* aShower, wxGrid* aGrid, int aMinWidth )
  113. {
  114. wxWindowDC sDC( aShower );
  115. sDC.SetFont( aGrid->GetLabelFont() );
  116. int minsize = aMinWidth;
  117. int rowCount = aGrid->GetNumberRows();
  118. for( int row = 0; row < rowCount; ++row )
  119. {
  120. // add two spaces to the text and size it.
  121. wxString rowText = aGrid->GetRowLabelValue( row ) + wxT( " " );
  122. wxSize needed = sDC.GetTextExtent( rowText );
  123. minsize = std::max( minsize, needed.x );
  124. }
  125. // set the width of the row laberls
  126. aGrid->SetRowLabelSize( minsize );
  127. }
  128. DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent ) :
  129. DIALOG_DESIGN_RULES_BASE( parent )
  130. {
  131. m_Parent = parent;
  132. SetAutoLayout( true );
  133. m_initialRowLabelsSize = m_grid->GetRowLabelSize();
  134. EnsureGridColumnWidths( this, m_grid ); // override any column widths set by wxformbuilder.
  135. wxListItem column0;
  136. wxListItem column1;
  137. column0.Clear();
  138. column1.Clear();
  139. column0.SetMask( wxLIST_MASK_TEXT );
  140. column1.SetMask( wxLIST_MASK_TEXT );
  141. column0.SetText( NET_TITLE );
  142. column1.SetText( CLASS_TITLE );
  143. SetDataValidators();
  144. m_leftListCtrl->InsertColumn( 0, column0 );
  145. m_leftListCtrl->InsertColumn( 1, column1 );
  146. m_leftListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
  147. m_leftListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
  148. m_rightListCtrl->InsertColumn( 0, column0 );
  149. m_rightListCtrl->InsertColumn( 1, column1 );
  150. m_rightListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
  151. m_rightListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
  152. // if user has been into the dialog before, go back to same tab
  153. if( s_LastTabSelection != -1 )
  154. {
  155. m_DRnotebook->SetSelection( s_LastTabSelection );
  156. }
  157. InitDialogRules();
  158. EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
  159. m_sdbSizer1OK->SetDefault();
  160. // Allow tabbing out of grid controls.
  161. m_grid->SetTabBehaviour( wxGrid::Tab_Leave );
  162. m_gridViaSizeList->SetTabBehaviour( wxGrid::Tab_Leave );
  163. m_gridTrackWidthList->SetTabBehaviour( wxGrid::Tab_Leave );
  164. Layout();
  165. // Now all widgets have the size fixed, call FinishDialogSettings
  166. FinishDialogSettings();
  167. }
  168. void DIALOG_DESIGN_RULES::SetDataValidators()
  169. {
  170. // Set floating-point validators for numerical inputs
  171. wxFloatingPointValidator< double > fpValidator( NULL, wxNUM_VAL_ZERO_AS_BLANK | wxNUM_VAL_NO_TRAILING_ZEROES );
  172. int maxDimension = 1000 * IU_PER_MILS; // One-inch
  173. fpValidator.SetRange( 0, To_User_Unit( g_UserUnit, maxDimension ) );
  174. fpValidator.SetPrecision( 10 );
  175. m_SetViasMinSizeCtrl->SetValidator( fpValidator );
  176. m_SetViasMinDrillCtrl->SetValidator( fpValidator );
  177. m_SetMicroViasMinSizeCtrl->SetValidator( fpValidator );
  178. m_SetMicroViasMinDrillCtrl->SetValidator( fpValidator );
  179. m_SetTrackMinWidthCtrl->SetValidator( fpValidator );
  180. }
  181. void DIALOG_DESIGN_RULES::InitDialogRules()
  182. {
  183. // @todo: Move the initialization code into TransferDataToWindow() to follow wxWidgets
  184. // dialog data transfer convention.
  185. SetFocus();
  186. SetReturnCode( 0 );
  187. m_Pcb = m_Parent->GetBoard();
  188. m_BrdSettings = &m_Pcb->GetDesignSettings();
  189. // Initialize the Rules List
  190. InitRulesList();
  191. // copy all NETs into m_AllNets by adding them as NETCUPs.
  192. // @todo go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0 is not
  193. // present in the BOARD::m_NetClasses
  194. NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
  195. NETCLASSPTR netclass = netclasses.GetDefault();
  196. // Initialize list of nets for Default Net Class
  197. for( NETCLASS::iterator name = netclass->begin(); name != netclass->end(); ++name )
  198. {
  199. m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
  200. }
  201. // Initialize list of nets for others (custom) Net Classes
  202. for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
  203. {
  204. netclass = nc->second;
  205. for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
  206. {
  207. m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
  208. }
  209. }
  210. InitializeRulesSelectionBoxes();
  211. InitGlobalRules();
  212. }
  213. void DIALOG_DESIGN_RULES::InitGlobalRules()
  214. {
  215. // Set unit labels
  216. const wxString units = GetAbbreviatedUnitsLabel( g_UserUnit );
  217. m_ViaMinUnits->SetLabel( units );
  218. m_ViaMinDrillUnits->SetLabel( units );
  219. m_MicroViaMinSizeUnits->SetLabel( units );
  220. m_MicroViaMinDrillUnits->SetLabel( units );
  221. m_TrackMinWidthUnits->SetLabel( units );
  222. PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize );
  223. PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill );
  224. m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed );
  225. m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed );
  226. CheckAllowMicroVias();
  227. PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize );
  228. PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill );
  229. PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth );
  230. // Initialize Vias and Tracks sizes lists.
  231. // note we display only extra values, never the current netclass value.
  232. // (the first value in history list)
  233. m_TracksWidthList = m_BrdSettings->m_TrackWidthList;
  234. m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
  235. m_ViasDimensionsList = m_BrdSettings->m_ViasDimensionsList;
  236. m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
  237. InitDimensionsLists();
  238. }
  239. void DIALOG_DESIGN_RULES::InitDimensionsLists()
  240. {
  241. wxString msg;
  242. // Compute the column widths here, after setting texts
  243. msg = wxT("000000.000000"); // This is a very long text to display values.
  244. // Actual values are shorter.
  245. m_gridViaSizeList->SetCellValue( 0, 0, msg );
  246. m_gridViaSizeList->SetCellValue( 0, 1, msg );
  247. m_gridTrackWidthList->SetCellValue( 0, 0, msg );
  248. m_gridViaSizeList->SetColMinimalWidth( 0, 150 );
  249. m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
  250. m_gridViaSizeList->AutoSizeColumns( true );
  251. m_gridTrackWidthList->SetColMinimalWidth( 0, 150 );
  252. m_gridTrackWidthList->AutoSizeColumns( true );
  253. m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
  254. // Fill cells with actual values:
  255. m_gridViaSizeList->SetCellValue( 0, 0, wxEmptyString );
  256. m_gridViaSizeList->SetCellValue( 0, 1, wxEmptyString );
  257. m_gridTrackWidthList->SetCellValue( 0, 0, wxEmptyString );
  258. // Give a correct size to row labels column
  259. m_gridViaSizeList->SetRowLabelSize( wxGRID_AUTOSIZE );
  260. m_gridTrackWidthList->SetRowLabelSize( wxGRID_AUTOSIZE );
  261. for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
  262. {
  263. msg = StringFromValue( g_UserUnit, m_TracksWidthList[ii], false );
  264. m_gridTrackWidthList->SetCellValue( ii, 0, msg );
  265. }
  266. for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ )
  267. {
  268. msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Diameter, false );
  269. m_gridViaSizeList->SetCellValue( ii, 0, msg );
  270. if( m_ViasDimensionsList[ii].m_Drill > 0 )
  271. {
  272. msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Drill, false );
  273. m_gridViaSizeList->SetCellValue( ii, 1, msg );
  274. }
  275. }
  276. }
  277. // Sort comparison function (helper for makePointers() )
  278. static bool sortByClassThenName( NETCUP* a, NETCUP* b )
  279. {
  280. // return a < b
  281. if( a->clazz < b->clazz )
  282. return true;
  283. // inside the same class, sort by net name:
  284. if( a->clazz == b->clazz )
  285. {
  286. if( a->net < b->net )
  287. return true;
  288. }
  289. return false;
  290. }
  291. void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName )
  292. {
  293. aList->clear();
  294. if( wildCard == aNetClassName )
  295. {
  296. for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
  297. {
  298. aList->push_back( &*n );
  299. }
  300. sort( aList->begin(), aList->end(), sortByClassThenName );
  301. // could use a different sort order for wildCard case.
  302. }
  303. else
  304. {
  305. for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
  306. {
  307. if( n->clazz == aNetClassName )
  308. aList->push_back( &*n );
  309. }
  310. sort( aList->begin(), aList->end(), sortByClassThenName );
  311. }
  312. }
  313. void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl,
  314. const wxString& aNetClass )
  315. {
  316. aListCtrl->ClearList();
  317. PNETCUPS ptrList;
  318. // get a subset of m_AllNets in pointer form, sorted as desired.
  319. makePointers( &ptrList, aNetClass );
  320. #if 0 && defined(DEBUG)
  321. int r = 0;
  322. for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
  323. {
  324. printf( "[%d]: %s %s\n", r, TO_UTF8( (*i)->net ), TO_UTF8( (*i)->clazz ) );
  325. }
  326. #endif
  327. // Add netclass info to m_Netnames and m_Classnames wxArrayString buffers
  328. // aListCtrl uses wxLC_VIRTUAL option, so this is fast
  329. wxClientDC sDC( aListCtrl );
  330. int row = 0;
  331. // recompute the column widths here, after setting texts
  332. int net_colsize = sDC.GetTextExtent( NET_TITLE ).x;
  333. int class_colsize = sDC.GetTextExtent( CLASS_TITLE ).x;
  334. for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row )
  335. {
  336. wxSize net_needed = sDC.GetTextExtent( (*i)->net );
  337. wxSize class_needed = sDC.GetTextExtent( (*i)->clazz );
  338. net_colsize = std::max( net_colsize, net_needed.x );
  339. class_colsize = std::max( class_colsize, class_needed.x );
  340. aListCtrl->SetRowItems( row, (*i)->net, (*i)->clazz );
  341. }
  342. int margin = sDC.GetTextExtent( wxT( "XX" ) ).x;
  343. aListCtrl->SetColumnWidth( 0, net_colsize + margin );
  344. aListCtrl->SetColumnWidth( 1, class_colsize + margin );
  345. aListCtrl->Refresh();
  346. }
  347. /* Populates combo boxes with the list of existing net classes
  348. */
  349. void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes()
  350. {
  351. m_rightClassChoice->Clear();
  352. m_leftClassChoice->Clear();
  353. m_rightClassChoice->Append( wildCard );
  354. m_leftClassChoice->Append( wildCard );
  355. for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
  356. {
  357. m_rightClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
  358. m_leftClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
  359. }
  360. m_rightClassChoice->Select( 0 );
  361. m_leftClassChoice->Select( 0 );
  362. m_buttonRightToLeft->Enable( false );
  363. m_buttonLeftToRight->Enable( false );
  364. FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
  365. FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
  366. }
  367. /* Initialize the rules list from board
  368. */
  369. static void class2gridRow( wxGrid* grid, int row, NETCLASSPTR nc )
  370. {
  371. wxString msg;
  372. // label is netclass name
  373. grid->SetRowLabelValue( row, nc->GetName() );
  374. msg = StringFromValue( g_UserUnit, nc->GetClearance() );
  375. grid->SetCellValue( row, GRID_CLEARANCE, msg );
  376. msg = StringFromValue( g_UserUnit, nc->GetTrackWidth() );
  377. grid->SetCellValue( row, GRID_TRACKSIZE, msg );
  378. msg = StringFromValue( g_UserUnit, nc->GetViaDiameter() );
  379. grid->SetCellValue( row, GRID_VIASIZE, msg );
  380. msg = StringFromValue( g_UserUnit, nc->GetViaDrill() );
  381. grid->SetCellValue( row, GRID_VIADRILL, msg );
  382. msg = StringFromValue( g_UserUnit, nc->GetuViaDiameter() );
  383. grid->SetCellValue( row, GRID_uVIASIZE, msg );
  384. msg = StringFromValue( g_UserUnit, nc->GetuViaDrill() );
  385. grid->SetCellValue( row, GRID_uVIADRILL, msg );
  386. msg = StringFromValue( g_UserUnit, nc->GetDiffPairGap() );
  387. grid->SetCellValue( row, GRID_DIFF_PAIR_GAP, msg );
  388. msg = StringFromValue( g_UserUnit, nc->GetDiffPairWidth() );
  389. grid->SetCellValue( row, GRID_DIFF_PAIR_WIDTH, msg );
  390. }
  391. void DIALOG_DESIGN_RULES::InitRulesList()
  392. {
  393. NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
  394. // the +1 is for the Default NETCLASS.
  395. if( netclasses.GetCount() + 1 > (unsigned) m_grid->GetNumberRows() )
  396. {
  397. m_grid->AppendRows( netclasses.GetCount() + 1 - m_grid->GetNumberRows() );
  398. }
  399. // enter the Default NETCLASS.
  400. class2gridRow( m_grid, 0, netclasses.GetDefault() );
  401. // enter others netclasses
  402. int row = 1;
  403. for( NETCLASSES::iterator i = netclasses.begin(); i!=netclasses.end(); ++i, ++row )
  404. {
  405. NETCLASSPTR netclass = i->second;
  406. class2gridRow( m_grid, row, netclass );
  407. }
  408. }
  409. static void gridRow2class( wxGrid* grid, int row, NETCLASSPTR nc )
  410. {
  411. #define MYCELL( col ) \
  412. ValueFromString( g_UserUnit, grid->GetCellValue( row, col ) )
  413. nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
  414. nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
  415. nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
  416. nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
  417. nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
  418. nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
  419. nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
  420. nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
  421. }
  422. void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
  423. {
  424. NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
  425. // Remove all netclasses from board. We'll copy new list after
  426. netclasses.Clear();
  427. // Copy the default NetClass:
  428. gridRow2class( m_grid, 0, netclasses.GetDefault() );
  429. // Copy other NetClasses :
  430. for( int row = 1; row < m_grid->GetNumberRows(); ++row )
  431. {
  432. NETCLASSPTR nc = std::make_shared<NETCLASS>( m_grid->GetRowLabelValue( row ) );
  433. if( !m_BrdSettings->m_NetClasses.Add( nc ) )
  434. {
  435. // this netclass cannot be added because an other netclass with the same name exists
  436. // Should not occur because OnAddNetclassClick() tests for existing NetClass names
  437. wxString msg;
  438. msg.Printf( wxT( "CopyRulesListToBoard(): The NetClass \"%s\" already exists. Skip" ),
  439. GetChars( m_grid->GetRowLabelValue( row ) ) );
  440. wxMessageBox( msg );
  441. continue;
  442. }
  443. gridRow2class( m_grid, row, nc );
  444. }
  445. // Now read all nets and push them in the corresponding netclass net buffer
  446. for( NETCUPS::const_iterator netcup = m_AllNets.begin(); netcup != m_AllNets.end(); ++netcup )
  447. {
  448. NETCLASSPTR nc = netclasses.Find( netcup->clazz );
  449. wxASSERT( nc );
  450. nc->Add( netcup->net );
  451. }
  452. m_Pcb->SynchronizeNetsAndNetClasses();
  453. }
  454. void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
  455. {
  456. m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();
  457. // Update vias minimum values for DRC
  458. m_BrdSettings->m_ViasMinSize = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
  459. m_BrdSettings->m_ViasMinDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
  460. m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue();
  461. // Update microvias minimum values for DRC
  462. m_BrdSettings->m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
  463. m_BrdSettings->m_MicroViasMinDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
  464. // Update tracks minimum values for DRC
  465. m_BrdSettings->m_TrackMinWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
  466. }
  467. void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
  468. {
  469. wxString msg;
  470. // Reinitialize m_TrackWidthList
  471. m_TracksWidthList.clear();
  472. for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
  473. {
  474. msg = m_gridTrackWidthList->GetCellValue( row, 0 );
  475. if( msg.IsEmpty() )
  476. continue;
  477. int value = ValueFromString( g_UserUnit, msg );
  478. m_TracksWidthList.push_back( value );
  479. }
  480. // Sort new list by by increasing value
  481. sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
  482. // Reinitialize m_TrackWidthList
  483. m_ViasDimensionsList.clear();
  484. for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
  485. {
  486. msg = m_gridViaSizeList->GetCellValue( row, 0 );
  487. if( msg.IsEmpty() )
  488. continue;
  489. int value = ValueFromString( g_UserUnit, msg );
  490. VIA_DIMENSION via_dim;
  491. via_dim.m_Diameter = value;
  492. msg = m_gridViaSizeList->GetCellValue( row, 1 );
  493. if( !msg.IsEmpty() )
  494. {
  495. value = ValueFromString( g_UserUnit, msg );
  496. via_dim.m_Drill = value;
  497. }
  498. m_ViasDimensionsList.push_back( via_dim );
  499. }
  500. // Sort new list by by increasing value
  501. sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
  502. std::vector<int>* tlist = &m_BrdSettings->m_TrackWidthList;
  503. // Remove old "custom" sizes
  504. tlist->erase( tlist->begin() + 1, tlist->end() );
  505. // Add new "custom" sizes
  506. tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() );
  507. // Reinitialize m_ViaSizeList
  508. std::vector<VIA_DIMENSION>* vialist = &m_BrdSettings->m_ViasDimensionsList;
  509. vialist->erase( vialist->begin() + 1, vialist->end() );
  510. vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
  511. }
  512. void DIALOG_DESIGN_RULES::OnNotebookPageChanged( wxNotebookEvent& event )
  513. {
  514. s_LastTabSelection = event.GetSelection();
  515. // Skip() allows OSX to properly refresh controls.
  516. event.Skip();
  517. }
  518. bool DIALOG_DESIGN_RULES::TransferDataFromWindow()
  519. {
  520. if( !wxDialog::TransferDataFromWindow() )
  521. return false;
  522. wxString errorMsg;
  523. if( !TestDataValidity( &errorMsg ) )
  524. {
  525. HTML_MESSAGE_BOX dlg( this, _( "Design Rule Setting Error" ) );
  526. dlg.MessageSet( errorMsg );
  527. dlg.ShowModal();
  528. return false;
  529. }
  530. CopyRulesListToBoard();
  531. CopyGlobalRulesToBoard();
  532. CopyDimensionsListsToBoard();
  533. m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
  534. return true;
  535. }
  536. void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
  537. {
  538. wxString class_name;
  539. // @todo set validator to ensure net class name is valid rather than all of the checks
  540. // after the OK button has been selected.
  541. wxTextEntryDialog dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name );
  542. if( dlg.ShowModal() != wxID_OK )
  543. return; // canceled by user
  544. class_name = dlg.GetValue();
  545. class_name.Trim( true );
  546. class_name.Trim( false );
  547. if( class_name.IsEmpty() )
  548. return; // empty name not allowed
  549. // The name must dot exists:
  550. for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
  551. {
  552. wxString value;
  553. value = m_grid->GetRowLabelValue( ii );
  554. if( class_name.CmpNoCase( value ) == 0 ) // Already exists!
  555. {
  556. DisplayError( this, _( "Duplicate net class names are not allowed." ) );
  557. return;
  558. }
  559. }
  560. m_grid->AppendRows();
  561. m_grid->SetRowLabelValue( m_grid->GetNumberRows() - 1, class_name );
  562. // Copy values of the default class:
  563. int irow = m_grid->GetNumberRows() - 1;
  564. for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
  565. {
  566. wxString value;
  567. value = m_grid->GetCellValue( 0, icol );
  568. m_grid->SetCellValue( irow, icol, value );
  569. }
  570. EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
  571. InitializeRulesSelectionBoxes();
  572. }
  573. // Sort function for wxArrayInt. Items (ints) are sorted by decreasing value
  574. // used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick
  575. int sort_int( int* first, int* second )
  576. {
  577. return *second - *first;
  578. }
  579. void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
  580. {
  581. wxArrayInt select = m_grid->GetSelectedRows();
  582. // Sort selection by decreasing index order:
  583. select.Sort( sort_int );
  584. bool reinit = false;
  585. // rows labels are not removed when deleting rows: they are not deleted.
  586. // So we must store them, remove corresponding labels and reinit them
  587. wxArrayString labels;
  588. for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
  589. labels.Add( m_grid->GetRowLabelValue( ii ) );
  590. // Delete rows from last to first (this is the order wxArrayInt select after sorting) )
  591. // This order is Ok when removing rows
  592. for( unsigned ii = 0; ii < select.GetCount(); ii++ )
  593. {
  594. int grid_row = select[ii];
  595. if( grid_row != 0 ) // Do not remove the default class
  596. {
  597. wxString classname = m_grid->GetRowLabelValue( grid_row );
  598. m_grid->DeleteRows( grid_row );
  599. labels.RemoveAt( grid_row ); // Remove corresponding row label
  600. reinit = true;
  601. // reset the net class to default for members of the removed class
  602. swapNetClass( classname, NETCLASS::Default );
  603. }
  604. else
  605. wxMessageBox( _( "The default net class cannot be removed" ) );
  606. }
  607. if( reinit )
  608. {
  609. // Reinit labels :
  610. for( unsigned ii = 1; ii < labels.GetCount(); ii++ )
  611. m_grid->SetRowLabelValue( ii, labels[ii] );
  612. InitializeRulesSelectionBoxes();
  613. EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
  614. }
  615. }
  616. void DIALOG_DESIGN_RULES::CheckAllowMicroVias()
  617. {
  618. bool enabled = m_OptAllowMicroVias->GetValue();
  619. m_SetMicroViasMinSizeCtrl->Enable( enabled );
  620. m_SetMicroViasMinDrillCtrl->Enable( enabled );
  621. }
  622. /**
  623. * Function OnAllowMicroVias
  624. * is called whenever the AllowMicroVias checkbox is toggled
  625. */
  626. void DIALOG_DESIGN_RULES::OnAllowMicroVias( wxCommandEvent& event )
  627. {
  628. CheckAllowMicroVias();
  629. }
  630. void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass( wxCommandEvent& event )
  631. {
  632. // Cannot move up rules if we have 1 or 2 rules only
  633. if( m_grid->GetNumberRows() < 3 )
  634. return;
  635. wxArrayInt select = m_grid->GetSelectedRows();
  636. bool reinit = false;
  637. for( unsigned irow = 0; irow < select.GetCount(); irow++ )
  638. {
  639. int ii = select[irow];
  640. if( ii < 2 ) // The default netclass *must* be the first netclass
  641. continue; // so we cannot move up line 0 and 1
  642. // Swap the rule and the previous rule
  643. wxString curr_value, previous_value;
  644. for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
  645. {
  646. reinit = true;
  647. curr_value = m_grid->GetCellValue( ii, icol );
  648. previous_value = m_grid->GetCellValue( ii - 1, icol );
  649. m_grid->SetCellValue( ii, icol, previous_value );
  650. m_grid->SetCellValue( ii - 1, icol, curr_value );
  651. }
  652. curr_value = m_grid->GetRowLabelValue( ii );
  653. previous_value = m_grid->GetRowLabelValue( ii - 1 );
  654. m_grid->SetRowLabelValue( ii, previous_value );
  655. m_grid->SetRowLabelValue( ii - 1, curr_value );
  656. }
  657. if( reinit )
  658. InitializeRulesSelectionBoxes();
  659. }
  660. void DIALOG_DESIGN_RULES::OnLeftCBSelection( wxCommandEvent& event )
  661. {
  662. FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
  663. if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
  664. {
  665. m_buttonRightToLeft->Enable( false );
  666. m_buttonLeftToRight->Enable( false );
  667. }
  668. else
  669. {
  670. m_buttonRightToLeft->Enable( true );
  671. m_buttonLeftToRight->Enable( true );
  672. }
  673. }
  674. void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
  675. {
  676. FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
  677. if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
  678. {
  679. m_buttonRightToLeft->Enable( false );
  680. m_buttonLeftToRight->Enable( false );
  681. }
  682. else
  683. {
  684. m_buttonRightToLeft->Enable( true );
  685. m_buttonLeftToRight->Enable( true );
  686. }
  687. }
  688. void DIALOG_DESIGN_RULES::moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName )
  689. {
  690. wxListItem item;
  691. wxString netName;
  692. item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item
  693. for( int row = 0; row < src->GetItemCount(); ++row )
  694. {
  695. if( !src->GetItemState( row, wxLIST_STATE_SELECTED ) )
  696. continue;
  697. item.SetColumn( 0 );
  698. item.SetId( row );
  699. src->GetItem( item );
  700. netName = item.GetText();
  701. setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
  702. }
  703. }
  704. void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
  705. {
  706. wxString newClassName = m_leftClassChoice->GetStringSelection();
  707. moveSelectedItems( m_rightListCtrl, newClassName );
  708. FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
  709. FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
  710. }
  711. void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event )
  712. {
  713. wxString newClassName = m_rightClassChoice->GetStringSelection();
  714. moveSelectedItems( m_leftListCtrl, newClassName );
  715. FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
  716. FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
  717. }
  718. void DIALOG_DESIGN_RULES::OnLeftSelectAllButton( wxCommandEvent& event )
  719. {
  720. for( int ii = 0; ii < m_leftListCtrl->GetItemCount(); ii++ )
  721. m_leftListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
  722. }
  723. void DIALOG_DESIGN_RULES::OnRightSelectAllButton( wxCommandEvent& event )
  724. {
  725. for( int ii = 0; ii < m_rightListCtrl->GetItemCount(); ii++ )
  726. m_rightListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
  727. }
  728. void DIALOG_DESIGN_RULES::setNetClass( const wxString& aNetName, const wxString& aClassName )
  729. {
  730. for( NETCUPS::iterator i = m_AllNets.begin(); i != m_AllNets.end(); ++i )
  731. {
  732. if( i->net == aNetName )
  733. {
  734. i->clazz = aClassName;
  735. break;
  736. }
  737. }
  738. }
  739. bool DIALOG_DESIGN_RULES::TestDataValidity( wxString* aErrorMsg )
  740. {
  741. bool result = true;
  742. wxString msg;
  743. wxString errorMsg;
  744. wxString netclassLabel; // Name of a given netclass
  745. wxString netclassError; // Error message particular to a given netclass
  746. wxString units = ReturnUnitSymbol( g_UserUnit, "%s" );
  747. int minViaDia = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
  748. int minViaDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
  749. int minUViaDia = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
  750. int minUViaDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
  751. int minTrackWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
  752. int maxval = 1000 * IU_PER_MILS; // a max value for tracks and vias sizes (1 inch)
  753. // @todo Change this code to set the focus to the control where the first error occurs
  754. // so the user doesn't have to figure out where the issue is.
  755. // Test net class parameters.
  756. for( int row = 0; row < m_grid->GetNumberRows(); row++ )
  757. {
  758. netclassLabel = GetChars( m_grid->GetRowLabelValue( row ) );
  759. netclassError.Clear(); // Clear the error for this netclass
  760. int tracksize = ValueFromString( g_UserUnit,
  761. m_grid->GetCellValue( row, GRID_TRACKSIZE ) );
  762. if( tracksize < minTrackWidth )
  763. {
  764. result = false;
  765. msg.Printf( _( " - <b>Track Size</b> (%f %s) &lt; <b>Min Track Size</b> (%f %s)<br>" ),
  766. To_User_Unit( g_UserUnit, tracksize ), units,
  767. To_User_Unit( g_UserUnit, minTrackWidth ), units );
  768. netclassError += msg;
  769. }
  770. int dpsize = ValueFromString( g_UserUnit,
  771. m_grid->GetCellValue( row, GRID_DIFF_PAIR_WIDTH ) );
  772. if( dpsize < minTrackWidth )
  773. {
  774. result = false;
  775. msg.Printf( _( " - <b>Differential Pair Size</b> (%f %s) &lt; <b>Min Track Size</b> (%f %s)<br>" ),
  776. To_User_Unit( g_UserUnit, dpsize ), units,
  777. To_User_Unit( g_UserUnit, minTrackWidth ), units );
  778. netclassError += msg;
  779. }
  780. // Test vias
  781. int viadia = ValueFromString( g_UserUnit,
  782. m_grid->GetCellValue( row, GRID_VIASIZE ) );
  783. if( viadia < minViaDia )
  784. {
  785. result = false;
  786. msg.Printf( _( " - <b>Via Diameter</b> (%f %s) &lt; <b>Minimum Via Diameter</b> (%f %s)<br>" ),
  787. To_User_Unit( g_UserUnit, viadia ), units,
  788. To_User_Unit( g_UserUnit, minViaDia ), units );
  789. netclassError += msg;
  790. }
  791. int viadrill = ValueFromString( g_UserUnit,
  792. m_grid->GetCellValue( row, GRID_VIADRILL ) );
  793. if( viadrill >= viadia )
  794. {
  795. result = false;
  796. msg.Printf( _( " - <b>Via Drill</b> (%f %s) &ge; <b>Via Dia</b> (%f %s)<br>" ),
  797. To_User_Unit( g_UserUnit, viadrill ), units,
  798. To_User_Unit( g_UserUnit, viadia ), units );
  799. netclassError += msg;
  800. }
  801. if( viadrill < minViaDrill )
  802. {
  803. result = false;
  804. msg.Printf( _( " - <b>Via Drill</b> (%f %s) &lt; <b>Min Via Drill</b> (%f %s)<br>" ),
  805. To_User_Unit( g_UserUnit, viadrill ), units,
  806. To_User_Unit( g_UserUnit, minViaDrill ), units );
  807. netclassError += msg;
  808. }
  809. // Test Micro vias
  810. int muviadia = ValueFromString( g_UserUnit,
  811. m_grid->GetCellValue( row, GRID_uVIASIZE ) );
  812. if( muviadia < minUViaDia )
  813. {
  814. result = false;
  815. msg.Printf( _( " - <b>MicroVia Diameter</b> (%f %s) &lt; <b>MicroVia Min Diameter</b> (%f %s)<br>" ),
  816. To_User_Unit( g_UserUnit, muviadia ), units,
  817. To_User_Unit( g_UserUnit, minUViaDia ), units );
  818. netclassError += msg;
  819. }
  820. int muviadrill = ValueFromString( g_UserUnit,
  821. m_grid->GetCellValue( row, GRID_uVIADRILL ) );
  822. if( muviadrill >= muviadia )
  823. {
  824. result = false;
  825. msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) &ge; <b>MicroVia Dia</b> (%f %s)<br>" ),
  826. To_User_Unit( g_UserUnit, muviadrill ), units,
  827. To_User_Unit( g_UserUnit, muviadia ), units );
  828. netclassError += msg;
  829. }
  830. if( muviadrill < minUViaDrill )
  831. {
  832. result = false;
  833. msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) &lt; <b>MicroVia Min Drill</b> (%f %s)<br>" ),
  834. To_User_Unit( g_UserUnit, muviadrill ), units,
  835. To_User_Unit( g_UserUnit, minUViaDrill ), units );
  836. netclassError += msg;
  837. }
  838. // If this netclass contains errors, add it to the error message
  839. if ( !netclassError.IsEmpty() )
  840. {
  841. msg.Printf( _( "Netclass: <b>%s</b><br>" ), netclassLabel );
  842. errorMsg += msg;
  843. errorMsg += netclassError;
  844. errorMsg += "<br>";
  845. }
  846. }
  847. // Test custom tracks
  848. for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
  849. {
  850. wxString tvalue = m_gridTrackWidthList->GetCellValue( row, 0 );
  851. if( tvalue.IsEmpty() )
  852. continue;
  853. int tracksize = ValueFromString( g_UserUnit, tvalue );
  854. if( tracksize < minTrackWidth )
  855. {
  856. result = false;
  857. msg.Printf( _( "<b>Extra Track %d Size</b> %s &lt; <b>Min Track Size</b><br>" ),
  858. row + 1, GetChars( tvalue ) );
  859. errorMsg += msg;
  860. }
  861. if( tracksize > maxval )
  862. {
  863. result = false;
  864. msg.Printf( _( "<b>Extra Track %d Size</b> %s &gt; <b>1 inch!</b><br>" ),
  865. row + 1, GetChars( tvalue ) );
  866. errorMsg += msg;
  867. }
  868. }
  869. // Test custom vias
  870. for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
  871. {
  872. wxString tvalue = m_gridViaSizeList->GetCellValue( row, 0 );
  873. if( tvalue.IsEmpty() )
  874. continue;
  875. int viadia = ValueFromString( g_UserUnit, tvalue );
  876. if( viadia < minViaDia )
  877. {
  878. result = false;
  879. msg.Printf( _( "<b>Extra Via %d Size</b> %s &lt; <b>Min Via Size</b><br>" ),
  880. row + 1, GetChars( tvalue ) );
  881. errorMsg += msg;
  882. }
  883. wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
  884. if( drlvalue.IsEmpty() )
  885. {
  886. result = false;
  887. msg.Printf( _( "<b>No via drill size define in row %d</b><br>" ), row + 1 );
  888. errorMsg += msg;
  889. continue;
  890. }
  891. int viadrill = ValueFromString( g_UserUnit, drlvalue );
  892. if( viadrill < minViaDrill )
  893. {
  894. result = false;
  895. msg.Printf( _( "<b>Extra Via %d Drill</b> %s &lt; <b>Min Via Drill %s</b><br>" ),
  896. row + 1, GetChars( drlvalue ),
  897. GetChars( m_SetViasMinDrillCtrl->GetValue() ) );
  898. errorMsg += msg;
  899. }
  900. if( viadia <= viadrill )
  901. {
  902. result = false;
  903. msg.Printf( _( "<b>Extra Via %d Size</b> %s &le; <b> Drill Size</b> %s<br>" ),
  904. row + 1, GetChars( tvalue ), GetChars( drlvalue ) );
  905. errorMsg += msg;
  906. }
  907. // Test for a reasonable via size:
  908. if( viadia > maxval ) // 1 inch!
  909. {
  910. result = false;
  911. msg.Printf( _( "<b>Extra Via %d Size</b>%s &gt; <b>1 inch!</b><br>" ),
  912. row + 1, GetChars( tvalue ) );
  913. errorMsg += msg;
  914. }
  915. }
  916. if( !result && aErrorMsg )
  917. *aErrorMsg = errorMsg;
  918. return result;
  919. }