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.

991 lines
28 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
10 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
18 years ago
18 years ago
18 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
18 years ago
18 years ago
18 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
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 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
18 years ago
18 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file cvframe.cpp
  27. */
  28. #include <fctsys.h>
  29. #include <build_version.h>
  30. #include <kiway_express.h>
  31. #include <pgm_base.h>
  32. #include <kiface_i.h>
  33. #include <macros.h>
  34. #include <confirm.h>
  35. #include <eda_doc.h>
  36. #include <eda_dde.h>
  37. #include <gestfich.h>
  38. #include <html_messagebox.h>
  39. #include <wildcards_and_files_ext.h>
  40. #include <fp_lib_table.h>
  41. #include <netlist_reader.h>
  42. #include <bitmaps.h>
  43. #include <cvpcb_mainframe.h>
  44. #include <cvpcb.h>
  45. #include <listview_classes.h>
  46. #include <invoke_pcb_dialog.h>
  47. #include <class_DisplayFootprintsFrame.h>
  48. #include <cvpcb_id.h>
  49. #define FRAME_MIN_SIZE_X 450
  50. #define FRAME_MIN_SIZE_Y 300
  51. ///@{
  52. /// \ingroup config
  53. /// Nonzero iff cvpcb should be kept open after saving files
  54. static const wxString KeepCvpcbOpenEntry = "KeepCvpcbOpen";
  55. static const wxString FootprintDocFileEntry = "footprints_doc_file";
  56. static const wxString FilterFootprintEntry = "FilterFootprint";
  57. ///@}
  58. BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
  59. // Menu events
  60. EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb )
  61. EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
  62. EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
  63. EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
  64. EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
  65. EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
  66. EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
  67. // Toolbar events
  68. EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
  69. EVT_TOOL( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
  70. EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
  71. EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
  72. EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
  73. EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
  74. EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
  75. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
  76. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  77. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
  78. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  79. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
  80. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  81. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME,
  82. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  83. EVT_TEXT( ID_CVPCB_FILTER_TEXT_EDIT, CVPCB_MAINFRAME::OnEnterFilteringText )
  84. // Frame events
  85. EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
  86. EVT_SIZE( CVPCB_MAINFRAME::OnSize )
  87. // UI event handlers
  88. EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
  89. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords)
  90. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyPinCount )
  91. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, CVPCB_MAINFRAME::OnFilterFPbyLibrary )
  92. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, CVPCB_MAINFRAME::OnFilterFPbyKeyName )
  93. END_EVENT_TABLE()
  94. #define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
  95. CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
  96. KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, wxT( "CvPCB" ), wxDefaultPosition,
  97. wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
  98. {
  99. m_compListBox = NULL;
  100. m_footprintListBox = NULL;
  101. m_libListBox = NULL;
  102. m_mainToolBar = NULL;
  103. m_modified = false;
  104. m_keepCvpcbOpen = false;
  105. m_undefinedComponentCnt = 0;
  106. m_skipComponentSelect = false;
  107. m_filteringOptions = 0;
  108. m_tcFilterString = NULL;
  109. m_FootprintsList = FOOTPRINT_LIST::GetInstance( Kiway() );
  110. /* Name of the document footprint list
  111. * usually located in share/modules/footprints_doc
  112. * this is of the responsibility to users to create this file
  113. * if they want to have a list of footprints
  114. */
  115. m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME;
  116. // Give an icon
  117. wxIcon icon;
  118. icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
  119. SetIcon( icon );
  120. SetAutoLayout( true );
  121. LoadSettings( config() );
  122. if( m_FrameSize.x < FRAME_MIN_SIZE_X )
  123. m_FrameSize.x = FRAME_MIN_SIZE_X;
  124. if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
  125. m_FrameSize.y = FRAME_MIN_SIZE_Y;
  126. // Set minimal frame width and height
  127. SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
  128. // Frame size and position
  129. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  130. // create the status bar
  131. static const int dims[3] = { -1, -1, 250 };
  132. CreateStatusBar( 3 );
  133. SetStatusWidths( 3, dims );
  134. ReCreateMenuBar();
  135. ReCreateHToolbar();
  136. // Create list of available modules and components of the schematic
  137. BuildCmpListBox();
  138. BuildFOOTPRINTS_LISTBOX();
  139. BuildLIBRARY_LISTBOX();
  140. m_auimgr.SetManagedWindow( this );
  141. UpdateTitle();
  142. EDA_PANEINFO horiz;
  143. horiz.HorizontalToolbarPane();
  144. EDA_PANEINFO info;
  145. info.InfoToolbarPane();
  146. if( m_mainToolBar )
  147. m_auimgr.AddPane( m_mainToolBar,
  148. wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
  149. if( m_compListBox )
  150. m_auimgr.AddPane( m_compListBox,
  151. wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
  152. if( m_libListBox)
  153. m_auimgr.AddPane( m_libListBox,
  154. wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
  155. Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
  156. if( m_footprintListBox )
  157. m_auimgr.AddPane( m_footprintListBox,
  158. wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
  159. Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
  160. m_auimgr.Update();
  161. }
  162. CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
  163. {
  164. m_auimgr.UnInit();
  165. }
  166. void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
  167. {
  168. EDA_BASE_FRAME::LoadSettings( aCfg );
  169. aCfg->Read( KeepCvpcbOpenEntry, &m_keepCvpcbOpen, true );
  170. aCfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
  171. DEFAULT_FOOTPRINTS_LIST_FILENAME );
  172. aCfg->Read( FilterFootprintEntry, &m_filteringOptions, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
  173. }
  174. void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
  175. {
  176. EDA_BASE_FRAME::SaveSettings( aCfg );
  177. aCfg->Write( KeepCvpcbOpenEntry, m_keepCvpcbOpen );
  178. aCfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
  179. aCfg->Write( FilterFootprintEntry, m_filteringOptions );
  180. }
  181. void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event )
  182. {
  183. event.Skip();
  184. }
  185. void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
  186. {
  187. Close( false );
  188. }
  189. void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
  190. {
  191. if( m_modified )
  192. {
  193. wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
  194. int ii = DisplayExitDialog( this, msg );
  195. switch( ii )
  196. {
  197. case wxID_CANCEL:
  198. Event.Veto();
  199. return;
  200. case wxID_NO:
  201. break;
  202. case wxID_YES:
  203. SaveFootprintAssociation();
  204. break;
  205. }
  206. }
  207. // Close module display frame
  208. if( GetFootprintViewerFrame() )
  209. GetFootprintViewerFrame()->Close( true );
  210. m_modified = false;
  211. Destroy();
  212. return;
  213. }
  214. void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
  215. {
  216. wxWindow* hasFocus = wxWindow::FindFocus();
  217. if( aMoveRight )
  218. {
  219. if( hasFocus == m_libListBox )
  220. m_compListBox->SetFocus();
  221. else if( hasFocus == m_compListBox )
  222. m_footprintListBox->SetFocus();
  223. else if( hasFocus == m_footprintListBox )
  224. m_libListBox->SetFocus();
  225. }
  226. else
  227. {
  228. if( hasFocus == m_libListBox )
  229. m_footprintListBox->SetFocus();
  230. else if( hasFocus == m_compListBox )
  231. m_libListBox->SetFocus();
  232. else if( hasFocus == m_footprintListBox )
  233. m_compListBox->SetFocus();
  234. }
  235. }
  236. void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
  237. {
  238. if( m_netlist.IsEmpty() )
  239. return;
  240. long first_selected = m_compListBox->GetFirstSelected();
  241. if( first_selected < 0 )
  242. first_selected = -1; // We will start to 0 for the first search , if no item selected
  243. int candidate = -1;
  244. for( unsigned jj = first_selected+1; jj < m_netlist.GetCount(); jj++ )
  245. {
  246. if( m_netlist.GetComponent( jj )->GetFPID().empty() )
  247. {
  248. candidate = jj;
  249. break;
  250. }
  251. }
  252. if( candidate >= 0 )
  253. {
  254. m_compListBox->DeselectAll();
  255. m_compListBox->SetSelection( candidate );
  256. SendMessageToEESCHEMA();
  257. }
  258. }
  259. void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
  260. {
  261. if( m_netlist.IsEmpty() )
  262. return;
  263. int first_selected = m_compListBox->GetFirstSelected();
  264. if( first_selected < 0 )
  265. first_selected = m_compListBox->GetCount();
  266. int candidate = -1;
  267. for( int jj = first_selected-1; jj >= 0; jj-- )
  268. {
  269. if( m_netlist.GetComponent( jj )->GetFPID().empty() )
  270. {
  271. candidate = jj;
  272. break;
  273. }
  274. }
  275. if( candidate >= 0 )
  276. {
  277. m_compListBox->DeselectAll();
  278. m_compListBox->SetSelection( candidate );
  279. SendMessageToEESCHEMA();
  280. }
  281. }
  282. void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
  283. {
  284. SaveFootprintAssociation();
  285. m_modified = false;
  286. if( !m_keepCvpcbOpen )
  287. Close( true );
  288. }
  289. void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
  290. {
  291. if( IsOK( this, _( "Delete selections" ) ) )
  292. {
  293. m_skipComponentSelect = true;
  294. // Remove all selections to avoid issues when setting the fpids
  295. m_compListBox->DeselectAll();
  296. for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
  297. {
  298. LIB_ID fpid;
  299. m_netlist.GetComponent( i )->SetFPID( fpid );
  300. SetNewPkg( wxEmptyString );
  301. }
  302. // Remove all selections after setting the fpids
  303. m_compListBox->DeselectAll();
  304. m_skipComponentSelect = false;
  305. m_compListBox->SetSelection( 0 );
  306. m_undefinedComponentCnt = m_netlist.GetCount();
  307. }
  308. DisplayStatus();
  309. }
  310. bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
  311. {
  312. return true;
  313. }
  314. void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
  315. {
  316. bool tableChanged = false;
  317. int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs( Kiway() ) );
  318. if( r & 1 )
  319. {
  320. wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
  321. try
  322. {
  323. GFootprintTable.Save( fileName );
  324. tableChanged = true;
  325. }
  326. catch( const IO_ERROR& ioe )
  327. {
  328. wxString msg = wxString::Format(
  329. _( "Error occurred saving the global footprint library table:\n'%s'\n%s" ),
  330. GetChars( fileName ),
  331. GetChars( ioe.What() )
  332. );
  333. wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
  334. }
  335. }
  336. if( r & 2 )
  337. {
  338. wxString fileName = Prj().FootprintLibTblName();
  339. try
  340. {
  341. Prj().PcbFootprintLibs( Kiway() )->Save( fileName );
  342. tableChanged = true;
  343. }
  344. catch( const IO_ERROR& ioe )
  345. {
  346. wxString msg = wxString::Format(
  347. _( "Error occurred saving the project footprint library table:\n'%s'\n%s" ),
  348. GetChars( fileName ),
  349. GetChars( ioe.What() )
  350. );
  351. wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
  352. }
  353. }
  354. if( tableChanged )
  355. {
  356. wxBusyCursor dummy;
  357. BuildLIBRARY_LISTBOX();
  358. m_FootprintsList->ReadFootprintFiles( Prj().PcbFootprintLibs( Kiway() ) );
  359. }
  360. }
  361. void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
  362. {
  363. m_keepCvpcbOpen = event.IsChecked();
  364. }
  365. void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
  366. {
  367. CreateScreenCmp();
  368. GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
  369. }
  370. void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
  371. {
  372. if( m_skipComponentSelect )
  373. return;
  374. wxString libraryName;
  375. COMPONENT* component = GetSelectedComponent();
  376. libraryName = m_libListBox->GetSelectedLibrary();
  377. m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
  378. m_currentSearchPattern, m_filteringOptions);
  379. refreshAfterComponentSearch (component);
  380. }
  381. void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
  382. {
  383. // Tell AuiMgr that objects are changed !
  384. if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
  385. // (could be not the case when starting CvPcb
  386. m_auimgr.Update();
  387. if( component == NULL )
  388. return;
  389. // Preview of the already assigned footprint.
  390. // Find the footprint that was already chosen for this component and select it,
  391. // but only if the selection is made from the component list or the library list.
  392. // If the selection is made from the footprint list, do not change the current
  393. // selected footprint.
  394. if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
  395. {
  396. wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
  397. bool found = false;
  398. for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
  399. {
  400. wxString footprintName;
  401. wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
  402. msg.Trim( true );
  403. msg.Trim( false );
  404. footprintName = msg.AfterFirst( wxChar( ' ' ) );
  405. if( module.Cmp( footprintName ) == 0 )
  406. {
  407. m_footprintListBox->SetSelection( ii, true );
  408. found = true;
  409. break;
  410. }
  411. }
  412. if( !found )
  413. {
  414. int ii = m_footprintListBox->GetSelection();
  415. if ( ii >= 0 )
  416. m_footprintListBox->SetSelection( ii, false );
  417. if( GetFootprintViewerFrame() )
  418. {
  419. CreateScreenCmp();
  420. }
  421. }
  422. }
  423. SendMessageToEESCHEMA();
  424. DisplayStatus();
  425. }
  426. void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
  427. {
  428. int option = 0;
  429. switch( event.GetId() )
  430. {
  431. case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
  432. option = FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD;
  433. break;
  434. case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
  435. option = FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT;
  436. break;
  437. case ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST:
  438. option = FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY;
  439. break;
  440. case ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME:
  441. m_currentSearchPattern = m_tcFilterString->GetValue();
  442. option = FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
  443. break;
  444. }
  445. if( event.IsChecked() )
  446. m_filteringOptions |= option;
  447. else
  448. m_filteringOptions &= ~option;
  449. wxListEvent l_event;
  450. OnSelectComponent( l_event );
  451. }
  452. void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
  453. {
  454. event.Check( m_keepCvpcbOpen );
  455. }
  456. void CVPCB_MAINFRAME::OnFilterFPbyKeywords( wxUpdateUIEvent& event )
  457. {
  458. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD );
  459. }
  460. void CVPCB_MAINFRAME::OnFilterFPbyPinCount( wxUpdateUIEvent& event )
  461. {
  462. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT );
  463. }
  464. void CVPCB_MAINFRAME::OnFilterFPbyLibrary( wxUpdateUIEvent& event )
  465. {
  466. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
  467. }
  468. void CVPCB_MAINFRAME::OnFilterFPbyKeyName( wxUpdateUIEvent& event )
  469. {
  470. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME );
  471. }
  472. void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
  473. {
  474. // Called when changing the filter string in main toolbar.
  475. // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_NAME is set, update the list of
  476. // available footprints which match the filter
  477. m_currentSearchPattern = m_tcFilterString->GetValue();
  478. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) == 0 )
  479. return;
  480. OnSelectFilteringFootprint( aEvent );
  481. }
  482. void CVPCB_MAINFRAME::DisplayStatus()
  483. {
  484. wxString msg;
  485. COMPONENT* component;
  486. if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
  487. {
  488. msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
  489. m_undefinedComponentCnt );
  490. SetStatusText( msg, 0 );
  491. msg.Empty();
  492. component = GetSelectedComponent();
  493. if( component )
  494. {
  495. for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
  496. {
  497. if( msg.IsEmpty() )
  498. msg += component->GetFootprintFilters()[ii];
  499. else
  500. msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
  501. }
  502. msg = _( "Filter list: " ) + msg;
  503. }
  504. SetStatusText( msg, 1 );
  505. }
  506. else
  507. {
  508. wxString footprintName = GetSelectedFootprint();
  509. FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
  510. if( module ) // can be NULL if no netlist loaded
  511. {
  512. msg = _( "Description: " ) + module->GetDoc();
  513. SetStatusText( msg, 0 );
  514. msg = _( "Key words: " ) + module->GetKeywords();
  515. SetStatusText( msg, 1 );
  516. }
  517. }
  518. msg.Empty();
  519. wxString filters;
  520. if( m_footprintListBox )
  521. {
  522. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
  523. filters = _( "key words" );
  524. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
  525. {
  526. if( !filters.IsEmpty() )
  527. filters += wxT( "+" );
  528. filters += _( "pin count" );
  529. }
  530. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
  531. {
  532. if( !filters.IsEmpty() )
  533. filters += wxT( "+" );
  534. filters += _( "library" );
  535. }
  536. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
  537. {
  538. if( !filters.IsEmpty() )
  539. filters += wxT( "+" );
  540. filters += _( "name" );
  541. }
  542. if( filters.IsEmpty() )
  543. msg = _( "No filtering" );
  544. else
  545. msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
  546. msg << wxT( ": " ) << m_footprintListBox->GetCount();
  547. SetStatusText( msg, 2 );
  548. }
  549. }
  550. bool CVPCB_MAINFRAME::LoadFootprintFiles()
  551. {
  552. FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
  553. // Check if there are footprint libraries in the footprint library table.
  554. if( !fptbl || !fptbl->GetLogicalLibs().size() )
  555. {
  556. wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
  557. "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
  558. return false;
  559. }
  560. {
  561. wxBusyCursor dummy; // Let the user know something is happening.
  562. m_FootprintsList->ReadFootprintFiles( fptbl );
  563. }
  564. if( m_FootprintsList->GetErrorCount() )
  565. {
  566. m_FootprintsList->DisplayErrors( this );
  567. }
  568. return true;
  569. }
  570. void CVPCB_MAINFRAME::UpdateTitle()
  571. {
  572. wxString title;
  573. PROJECT& prj = Prj();
  574. wxFileName fn = prj.GetProjectFullName();
  575. if( fn.IsOk() && !prj.GetProjectFullName().IsEmpty() && fn.FileExists() )
  576. {
  577. title.Printf( L"Cvpcb \u2014 %s%s",
  578. fn.GetFullPath(),
  579. fn.IsFileWritable()
  580. ? wxString( wxEmptyString )
  581. : _( " [Read Only]" ) );
  582. }
  583. else
  584. {
  585. title = "Cvpcb";
  586. }
  587. SetTitle( title );
  588. }
  589. void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
  590. {
  591. if( m_netlist.IsEmpty() )
  592. return;
  593. int selection = m_compListBox->GetSelection();
  594. if ( selection < 0 )
  595. selection = 0;
  596. if( m_netlist.GetComponent( selection ) == NULL )
  597. return;
  598. COMPONENT* component = m_netlist.GetComponent( selection );
  599. std::string packet = StrPrintf( "$PART: \"%s\"", TO_UTF8( component->GetReference() ) );
  600. if( Kiface().IsSingle() )
  601. SendCommand( MSG_TO_SCH, packet.c_str() );
  602. else
  603. Kiway().ExpressMail( FRAME_SCH, MAIL_CROSS_PROBE, packet, this );
  604. }
  605. int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
  606. {
  607. STRING_LINE_READER* strrdr = new STRING_LINE_READER( aNetlist, "Eeschema via Kiway" );
  608. KICAD_NETLIST_READER netrdr( strrdr, &m_netlist );
  609. m_netlist.Clear();
  610. try
  611. {
  612. netrdr.LoadNetlist();
  613. }
  614. catch( const IO_ERROR& ioe )
  615. {
  616. wxString msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.What().GetData() );
  617. wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
  618. return 1;
  619. }
  620. // We also remove footprint name if it is "$noname" because this is a dummy name,
  621. // not the actual name of the footprint.
  622. for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
  623. {
  624. if( m_netlist.GetComponent( ii )->GetFPID().GetLibItemName() == std::string( "$noname" ) )
  625. m_netlist.GetComponent( ii )->SetFPID( LIB_ID( wxEmptyString ) );
  626. }
  627. // Sort components by reference:
  628. m_netlist.SortByReference();
  629. return 0;
  630. }
  631. void CVPCB_MAINFRAME::CreateScreenCmp()
  632. {
  633. DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFootprintViewerFrame();
  634. if( !fpframe )
  635. {
  636. fpframe = new DISPLAY_FOOTPRINTS_FRAME( &Kiway(), this );
  637. fpframe->Show( true );
  638. }
  639. else
  640. {
  641. if( fpframe->IsIconized() )
  642. fpframe->Iconize( false );
  643. // The display footprint window might be buried under some other
  644. // windows, so CreateScreenCmp() on an existing window would not
  645. // show any difference, leaving the user confused.
  646. // So we want to put it to front, second after our CVPCB_MAINFRAME.
  647. // We do this by a little dance of bringing it to front then the main
  648. // frame back.
  649. fpframe->Raise(); // Make sure that is visible.
  650. Raise(); // .. but still we want the focus.
  651. }
  652. fpframe->InitDisplay();
  653. }
  654. void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
  655. {
  656. wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
  657. if( m_footprintListBox == NULL )
  658. {
  659. m_footprintListBox = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
  660. wxDefaultPosition, wxDefaultSize );
  661. m_footprintListBox->SetFont( wxFont( guiFont.GetPointSize(),
  662. wxFONTFAMILY_MODERN,
  663. wxFONTSTYLE_NORMAL,
  664. wxFONTWEIGHT_NORMAL ) );
  665. }
  666. m_footprintListBox->SetFootprints( *m_FootprintsList, wxEmptyString, NULL,
  667. wxEmptyString, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
  668. DisplayStatus();
  669. }
  670. void CVPCB_MAINFRAME::BuildCmpListBox()
  671. {
  672. wxString msg;
  673. COMPONENT* component;
  674. wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
  675. if( m_compListBox == NULL )
  676. {
  677. m_compListBox = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
  678. wxDefaultPosition, wxDefaultSize );
  679. m_compListBox->SetFont( wxFont( guiFont.GetPointSize(),
  680. wxFONTFAMILY_MODERN,
  681. wxFONTSTYLE_NORMAL,
  682. wxFONTWEIGHT_NORMAL ) );
  683. }
  684. m_compListBox->m_ComponentList.Clear();
  685. for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
  686. {
  687. component = m_netlist.GetComponent( i );
  688. msg.Printf( CMP_FORMAT, m_compListBox->GetCount() + 1,
  689. GetChars( component->GetReference() ),
  690. GetChars( component->GetValue() ),
  691. GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
  692. m_compListBox->m_ComponentList.Add( msg );
  693. }
  694. if( m_compListBox->m_ComponentList.Count() )
  695. {
  696. m_compListBox->SetItemCount( m_compListBox->m_ComponentList.Count() );
  697. m_compListBox->SetSelection( 0, true );
  698. m_compListBox->RefreshItems( 0L, m_compListBox->m_ComponentList.Count()-1 );
  699. m_compListBox->UpdateWidth();
  700. }
  701. }
  702. void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
  703. {
  704. wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
  705. if( m_libListBox == NULL )
  706. {
  707. m_libListBox = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
  708. wxDefaultPosition, wxDefaultSize );
  709. m_libListBox->SetFont( wxFont( guiFont.GetPointSize(),
  710. wxFONTFAMILY_MODERN,
  711. wxFONTSTYLE_NORMAL,
  712. wxFONTWEIGHT_NORMAL ) );
  713. }
  714. FP_LIB_TABLE* tbl = Prj().PcbFootprintLibs( Kiway() );
  715. if( tbl )
  716. {
  717. wxArrayString libNames;
  718. std::vector< wxString > libNickNames = tbl->GetLogicalLibs();
  719. for( unsigned ii = 0; ii < libNickNames.size(); ii++ )
  720. libNames.Add( libNickNames[ii] );
  721. m_libListBox->SetLibraryList( libNames );
  722. }
  723. }
  724. COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
  725. {
  726. int selection = m_compListBox->GetSelection();
  727. if( selection >= 0 && selection < (int) m_netlist.GetCount() )
  728. return m_netlist.GetComponent( selection );
  729. return NULL;
  730. }
  731. DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
  732. {
  733. // returns the Footprint Viewer frame, if exists, or NULL
  734. return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>
  735. ( wxWindow::FindWindowByName( FOOTPRINTVIEWER_FRAME_NAME ) );
  736. }
  737. const wxString CVPCB_MAINFRAME::GetSelectedFootprint()
  738. {
  739. // returns the LIB_ID of the selected footprint in footprint listview
  740. // or a empty string
  741. return m_footprintListBox->GetSelectedFootprint();
  742. }
  743. void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
  744. {
  745. Pgm().ConfigurePaths( this );
  746. }
  747. void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
  748. {
  749. const std::string& payload = mail.GetPayload();
  750. DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
  751. switch( mail.Command() )
  752. {
  753. case MAIL_EESCHEMA_NETLIST:
  754. ReadNetListAndLinkFiles( payload );
  755. /* @todo
  756. Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
  757. */
  758. break;
  759. default:
  760. ; // ignore most
  761. }
  762. }