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.

1025 lines
29 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
* 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
* 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) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2018 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 cvpcb_mainframe.cpp
  27. */
  28. #include <fctsys.h>
  29. #include <build_version.h>
  30. #include <kiway_express.h>
  31. #include <kiface_i.h>
  32. #include <kiface_ids.h>
  33. #include <macros.h>
  34. #include <confirm.h>
  35. #include <eda_dde.h>
  36. #include <html_messagebox.h>
  37. #include <fp_lib_table.h>
  38. #include <netlist_reader.h>
  39. #include <bitmaps.h>
  40. #include <widgets/progress_reporter.h>
  41. #include <3d_cache/3d_cache.h>
  42. #include <dialog_configure_paths.h>
  43. #include <cvpcb.h>
  44. #include <listboxes.h>
  45. #include <invoke_pcb_dialog.h>
  46. #include <display_footprints_frame.h>
  47. #include <cvpcb_id.h>
  48. #include <cvpcb_mainframe.h>
  49. wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
  50. wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
  51. ///@{
  52. /// \ingroup config
  53. static const wxString FilterFootprintEntry = "FilterFootprint";
  54. ///@}
  55. BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
  56. // Menu events
  57. EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::OnSaveAndContinue )
  58. EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
  59. EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
  60. EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
  61. EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
  62. EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
  63. // Toolbar events
  64. EVT_TOOL( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
  65. EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
  66. EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
  67. EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
  68. EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
  69. EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
  70. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
  71. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  72. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
  73. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  74. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
  75. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  76. EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME,
  77. CVPCB_MAINFRAME::OnSelectFilteringFootprint )
  78. EVT_TEXT( ID_CVPCB_FILTER_TEXT_EDIT, CVPCB_MAINFRAME::OnEnterFilteringText )
  79. // Button events
  80. EVT_BUTTON( wxID_OK, CVPCB_MAINFRAME::OnOK )
  81. EVT_BUTTON( wxID_CANCEL, CVPCB_MAINFRAME::OnCancel )
  82. // Frame events
  83. EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
  84. EVT_SIZE( CVPCB_MAINFRAME::OnSize )
  85. // UI event handlers
  86. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords)
  87. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyPinCount )
  88. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, CVPCB_MAINFRAME::OnFilterFPbyLibrary )
  89. EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, CVPCB_MAINFRAME::OnFilterFPbyKeyName )
  90. END_EVENT_TABLE()
  91. #define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
  92. CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
  93. KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
  94. wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
  95. {
  96. m_compListBox = NULL;
  97. m_footprintListBox = NULL;
  98. m_libListBox = NULL;
  99. m_mainToolBar = NULL;
  100. m_modified = false;
  101. m_skipComponentSelect = false;
  102. m_filteringOptions = 0;
  103. m_tcFilterString = NULL;
  104. m_FootprintsList = FOOTPRINT_LIST::GetInstance( Kiway() );
  105. m_initialized = false;
  106. // Give an icon
  107. wxIcon icon;
  108. icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
  109. SetIcon( icon );
  110. SetAutoLayout( true );
  111. LoadSettings( config() );
  112. wxSize const frame_min( ConvertDialogToPixels( FRAME_MIN_SIZE_DU ) );
  113. SetSizeHints( frame_min );
  114. // Frame size and position
  115. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  116. ReCreateMenuBar();
  117. ReCreateHToolbar();
  118. // Create list of available modules and components of the schematic
  119. BuildCmpListBox();
  120. BuildFOOTPRINTS_LISTBOX();
  121. BuildLIBRARY_LISTBOX();
  122. m_auimgr.SetManagedWindow( this );
  123. EDA_PANEINFO horiz;
  124. horiz.HorizontalToolbarPane();
  125. EDA_PANEINFO info;
  126. info.InfoToolbarPane();
  127. if( m_mainToolBar )
  128. m_auimgr.AddPane( m_mainToolBar,
  129. wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
  130. if( m_compListBox )
  131. m_auimgr.AddPane( m_compListBox,
  132. wxAuiPaneInfo( horiz ).Name( wxT( "m_compListBox" ) ).CentrePane() );
  133. if( m_libListBox)
  134. m_auimgr.AddPane( m_libListBox,
  135. wxAuiPaneInfo( info ).Name( wxT( "m_libListBox" ) ).
  136. Left().BestSize( (int) ( m_FrameSize.x * 0.20 ), m_FrameSize.y ) );
  137. if( m_footprintListBox )
  138. m_auimgr.AddPane( m_footprintListBox,
  139. wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
  140. Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
  141. // Build the bottom panel, to display 2 status texts and the buttons:
  142. auto bottomPanel = new wxPanel( this );
  143. auto panelSizer = new wxBoxSizer( wxVERTICAL );
  144. wxFont statusFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
  145. statusFont.SetSymbolicSize( wxFONTSIZE_SMALL );
  146. m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
  147. m_statusLine1->SetFont( statusFont );
  148. panelSizer->Add( m_statusLine1, 0, wxTOP, 4 );
  149. m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
  150. m_statusLine2->SetFont( statusFont );
  151. panelSizer->Add( m_statusLine2, 0, 0, 4 );
  152. // Add buttons:
  153. auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
  154. auto sdbSizer = new wxStdDialogButtonSizer();
  155. m_saveAndContinue = new wxButton( bottomPanel, wxID_SAVE,
  156. _( "Apply, Save Schematic && Continue" ) );
  157. buttonsSizer->Add( m_saveAndContinue, 0, wxALIGN_BOTTOM | wxBOTTOM | wxRIGHT, 10 );
  158. auto sdbSizerOK = new wxButton( bottomPanel, wxID_OK );
  159. sdbSizer->AddButton( sdbSizerOK );
  160. auto sdbSizerCancel = new wxButton( bottomPanel, wxID_CANCEL );
  161. sdbSizer->AddButton( sdbSizerCancel );
  162. sdbSizer->Realize();
  163. buttonsSizer->Add( sdbSizer, 0, 0, 5 );
  164. panelSizer->Add( buttonsSizer, 0, wxALIGN_RIGHT, 5 );
  165. bottomPanel->SetSizer( panelSizer );
  166. bottomPanel->Fit();
  167. sdbSizerOK->SetDefault();
  168. m_auimgr.AddPane( bottomPanel, wxAuiPaneInfo( horiz ).Name( wxT( "buttons" ) ).Bottom() );
  169. m_auimgr.Update();
  170. m_initialized = true;
  171. // Connect Events
  172. m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
  173. m_footprintListBox->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), NULL, this );
  174. }
  175. CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
  176. {
  177. // Disconnect Events
  178. m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
  179. m_footprintListBox->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( CVPCB_MAINFRAME::OnFootprintRightClick ), NULL, this );
  180. m_auimgr.UnInit();
  181. }
  182. void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
  183. {
  184. EDA_BASE_FRAME::LoadSettings( aCfg );
  185. wxSize const frame_default( ConvertDialogToPixels( FRAME_DEFAULT_SIZE_DU ) );
  186. if( m_FrameSize == wxDefaultSize )
  187. m_FrameSize = frame_default;
  188. aCfg->Read( FilterFootprintEntry, &m_filteringOptions, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
  189. }
  190. void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
  191. {
  192. EDA_BASE_FRAME::SaveSettings( aCfg );
  193. aCfg->Write( FilterFootprintEntry, m_filteringOptions );
  194. }
  195. void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event )
  196. {
  197. event.Skip();
  198. }
  199. void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
  200. {
  201. if( m_modified )
  202. {
  203. wxString msg = _( "Component to Footprint links modified.\nSave before exit?" );
  204. int ii = DisplayExitDialog( this, msg );
  205. switch( ii )
  206. {
  207. case wxID_CANCEL:
  208. Event.Veto();
  209. return;
  210. case wxID_NO:
  211. break;
  212. case wxID_YES:
  213. SaveFootprintAssociation( false );
  214. break;
  215. }
  216. }
  217. // Close module display frame
  218. if( GetFootprintViewerFrame() )
  219. GetFootprintViewerFrame()->Close( true );
  220. m_modified = false;
  221. Destroy();
  222. }
  223. void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
  224. {
  225. wxWindow* hasFocus = wxWindow::FindFocus();
  226. if( aMoveRight )
  227. {
  228. if( hasFocus == m_libListBox )
  229. m_compListBox->SetFocus();
  230. else if( hasFocus == m_compListBox )
  231. m_footprintListBox->SetFocus();
  232. else if( hasFocus == m_footprintListBox )
  233. m_libListBox->SetFocus();
  234. }
  235. else
  236. {
  237. if( hasFocus == m_libListBox )
  238. m_footprintListBox->SetFocus();
  239. else if( hasFocus == m_compListBox )
  240. m_libListBox->SetFocus();
  241. else if( hasFocus == m_footprintListBox )
  242. m_compListBox->SetFocus();
  243. }
  244. }
  245. void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
  246. {
  247. if( m_netlist.IsEmpty() )
  248. return;
  249. int first_selected = m_compListBox->GetFirstSelected();
  250. if( first_selected < 0 )
  251. first_selected = -1; // We will start to 0 for the first search , if no item selected
  252. int candidate = -1;
  253. for( int jj = first_selected+1; jj < (int)m_netlist.GetCount(); jj++ )
  254. {
  255. if( m_netlist.GetComponent( jj )->GetFPID().empty() )
  256. {
  257. candidate = jj;
  258. break;
  259. }
  260. }
  261. if( candidate >= 0 )
  262. {
  263. m_compListBox->DeselectAll();
  264. m_compListBox->SetSelection( candidate );
  265. SendMessageToEESCHEMA();
  266. }
  267. }
  268. void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
  269. {
  270. if( m_netlist.IsEmpty() )
  271. return;
  272. int first_selected = m_compListBox->GetFirstSelected();
  273. if( first_selected < 0 )
  274. first_selected = m_compListBox->GetCount();
  275. int candidate = -1;
  276. for( int jj = first_selected-1; jj >= 0; jj-- )
  277. {
  278. if( m_netlist.GetComponent( jj )->GetFPID().empty() )
  279. {
  280. candidate = jj;
  281. break;
  282. }
  283. }
  284. if( candidate >= 0 )
  285. {
  286. m_compListBox->DeselectAll();
  287. m_compListBox->SetSelection( candidate );
  288. SendMessageToEESCHEMA();
  289. }
  290. }
  291. void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
  292. {
  293. SaveFootprintAssociation( false );
  294. m_modified = false;
  295. Close( true );
  296. }
  297. void CVPCB_MAINFRAME::OnSaveAndContinue( wxCommandEvent& aEvent )
  298. {
  299. SaveFootprintAssociation( true );
  300. m_modified = false;
  301. }
  302. void CVPCB_MAINFRAME::OnCancel( wxCommandEvent& event )
  303. {
  304. // Throw away modifications on a Cancel
  305. m_modified = false;
  306. Close( false );
  307. }
  308. void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
  309. {
  310. Close( false );
  311. }
  312. void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
  313. {
  314. if( IsOK( this, _( "Delete selections" ) ) )
  315. {
  316. m_skipComponentSelect = true;
  317. // Remove all selections to avoid issues when setting the fpids
  318. m_compListBox->DeselectAll();
  319. for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
  320. {
  321. LIB_ID fpid;
  322. m_netlist.GetComponent( i )->SetFPID( fpid );
  323. SetNewPkg( wxEmptyString );
  324. }
  325. // Remove all selections after setting the fpids
  326. m_compListBox->DeselectAll();
  327. m_skipComponentSelect = false;
  328. m_compListBox->SetSelection( 0 );
  329. }
  330. DisplayStatus();
  331. }
  332. bool CVPCB_MAINFRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
  333. {
  334. return true;
  335. }
  336. void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
  337. {
  338. FP_LIB_TABLE* globalTable;
  339. bool tableChanged = false;
  340. KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
  341. if( kiface )
  342. globalTable = (FP_LIB_TABLE*) kiface->IfaceOrAddress( KIFACE_GLOBAL_FOOTPRINT_TABLE );
  343. else
  344. globalTable = &GFootprintTable; // Shouldn't happen now that Cvpcb is integrated
  345. int r = InvokePcbLibTableEditor( this, globalTable, Prj().PcbFootprintLibs( Kiway() ) );
  346. if( r & 1 )
  347. {
  348. wxString fileName = FP_LIB_TABLE::GetGlobalTableFileName();
  349. try
  350. {
  351. globalTable->Save( fileName );
  352. tableChanged = true;
  353. }
  354. catch( const IO_ERROR& ioe )
  355. {
  356. wxString msg = wxString::Format(
  357. _( "Error occurred saving the global footprint library table:\n\"%s\"\n%s" ),
  358. GetChars( fileName ),
  359. GetChars( ioe.What() )
  360. );
  361. wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
  362. }
  363. }
  364. if( r & 2 )
  365. {
  366. wxString fileName = Prj().FootprintLibTblName();
  367. try
  368. {
  369. Prj().PcbFootprintLibs( Kiway() )->Save( fileName );
  370. tableChanged = true;
  371. }
  372. catch( const IO_ERROR& ioe )
  373. {
  374. wxString msg = wxString::Format(
  375. _( "Error occurred saving the project footprint library table:\n\"%s\"\n%s" ),
  376. GetChars( fileName ),
  377. GetChars( ioe.What() )
  378. );
  379. wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
  380. }
  381. }
  382. if( tableChanged )
  383. {
  384. wxBusyCursor dummy;
  385. BuildLIBRARY_LISTBOX();
  386. m_FootprintsList->ReadFootprintFiles( Prj().PcbFootprintLibs( Kiway() ) );
  387. }
  388. }
  389. void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
  390. {
  391. CreateScreenCmp();
  392. GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
  393. }
  394. void CVPCB_MAINFRAME::OnFootprintRightClick( wxMouseEvent& event )
  395. {
  396. wxMenu menu;
  397. menu.Append( ID_CVPCB_CREATE_SCREENCMP, _( "View Footprint" ), _( "Show the current footprint in the footprint viewer" ) );
  398. PopupMenu( &menu );
  399. }
  400. void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
  401. {
  402. if( m_skipComponentSelect )
  403. return;
  404. wxString libraryName;
  405. COMPONENT* component = GetSelectedComponent();
  406. libraryName = m_libListBox->GetSelectedLibrary();
  407. m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, component,
  408. m_currentSearchPattern, m_filteringOptions);
  409. refreshAfterComponentSearch (component);
  410. }
  411. void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
  412. {
  413. // Tell AuiMgr that objects are changed !
  414. if( m_auimgr.GetManagedWindow() ) // Be sure Aui Manager is initialized
  415. // (could be not the case when starting CvPcb
  416. m_auimgr.Update();
  417. if( component == NULL )
  418. {
  419. DisplayStatus();
  420. return;
  421. }
  422. // Preview of the already assigned footprint.
  423. // Find the footprint that was already chosen for this component and select it,
  424. // but only if the selection is made from the component list or the library list.
  425. // If the selection is made from the footprint list, do not change the current
  426. // selected footprint.
  427. if( FindFocus() == m_compListBox || FindFocus() == m_libListBox )
  428. {
  429. wxString module = FROM_UTF8( component->GetFPID().Format().c_str() );
  430. bool found = false;
  431. for( int ii = 0; ii < m_footprintListBox->GetCount(); ii++ )
  432. {
  433. wxString footprintName;
  434. wxString msg = m_footprintListBox->OnGetItemText( ii, 0 );
  435. msg.Trim( true );
  436. msg.Trim( false );
  437. footprintName = msg.AfterFirst( wxChar( ' ' ) );
  438. if( module.Cmp( footprintName ) == 0 )
  439. {
  440. m_footprintListBox->SetSelection( ii, true );
  441. found = true;
  442. break;
  443. }
  444. }
  445. if( !found )
  446. {
  447. int ii = m_footprintListBox->GetSelection();
  448. if ( ii >= 0 )
  449. m_footprintListBox->SetSelection( ii, false );
  450. if( GetFootprintViewerFrame() )
  451. {
  452. CreateScreenCmp();
  453. }
  454. }
  455. }
  456. SendMessageToEESCHEMA();
  457. DisplayStatus();
  458. }
  459. void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
  460. {
  461. int option = 0;
  462. switch( event.GetId() )
  463. {
  464. case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
  465. option = FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD;
  466. break;
  467. case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
  468. option = FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT;
  469. break;
  470. case ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST:
  471. option = FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY;
  472. break;
  473. case ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME:
  474. m_currentSearchPattern = m_tcFilterString->GetValue();
  475. option = FOOTPRINTS_LISTBOX::FILTERING_BY_NAME;
  476. break;
  477. }
  478. if( event.IsChecked() )
  479. m_filteringOptions |= option;
  480. else
  481. m_filteringOptions &= ~option;
  482. wxListEvent l_event;
  483. OnSelectComponent( l_event );
  484. }
  485. void CVPCB_MAINFRAME::OnFilterFPbyKeywords( wxUpdateUIEvent& event )
  486. {
  487. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD );
  488. }
  489. void CVPCB_MAINFRAME::OnFilterFPbyPinCount( wxUpdateUIEvent& event )
  490. {
  491. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT );
  492. }
  493. void CVPCB_MAINFRAME::OnFilterFPbyLibrary( wxUpdateUIEvent& event )
  494. {
  495. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY );
  496. }
  497. void CVPCB_MAINFRAME::OnFilterFPbyKeyName( wxUpdateUIEvent& event )
  498. {
  499. event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME );
  500. }
  501. void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
  502. {
  503. // Called when changing the filter string in main toolbar.
  504. // If the option FOOTPRINTS_LISTBOX::FILTERING_BY_NAME is set, update the list of
  505. // available footprints which match the filter
  506. m_currentSearchPattern = m_tcFilterString->GetValue();
  507. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) == 0 )
  508. return;
  509. OnSelectFilteringFootprint( aEvent );
  510. }
  511. void CVPCB_MAINFRAME::DisplayStatus()
  512. {
  513. if( !m_initialized )
  514. return;
  515. wxString filters, msg;
  516. COMPONENT* component = GetSelectedComponent();
  517. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
  518. {
  519. msg.Empty();
  520. if( component )
  521. {
  522. for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
  523. {
  524. if( msg.IsEmpty() )
  525. msg += component->GetFootprintFilters()[ii];
  526. else
  527. msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
  528. }
  529. }
  530. filters += _( "key words" ) + wxString::Format( wxT( " (%s)" ), msg );
  531. }
  532. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
  533. {
  534. msg.Empty();
  535. if( component )
  536. msg = wxString::Format( wxT( "%i" ), component->GetPinCount() );
  537. if( !filters.IsEmpty() )
  538. filters += wxT( ", " );
  539. filters += _( "pin count" ) + wxString::Format( wxT( " (%s)" ), msg );
  540. }
  541. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
  542. {
  543. msg = m_libListBox->GetSelectedLibrary();
  544. if( !filters.IsEmpty() )
  545. filters += wxT( ", " );
  546. filters += _( "library" ) + wxString::Format( wxT( " (%s)" ), msg );
  547. }
  548. if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
  549. {
  550. if( !filters.IsEmpty() )
  551. filters += wxT( ", " );
  552. filters += _( "search text" );
  553. }
  554. if( filters.IsEmpty() )
  555. msg = _( "No filtering" );
  556. else
  557. msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
  558. msg << wxT( ": " ) << m_footprintListBox->GetCount();
  559. SetStatusText( msg );
  560. msg.Empty();
  561. wxString footprintName = GetSelectedFootprint();
  562. FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
  563. if( module ) // can be NULL if no netlist loaded
  564. {
  565. msg = wxString::Format( _( "Description: %s; Key words: %s" ),
  566. module->GetDoc(),
  567. module->GetKeywords() );
  568. }
  569. SetStatusText( msg, 1 );
  570. }
  571. bool CVPCB_MAINFRAME::LoadFootprintFiles()
  572. {
  573. FP_LIB_TABLE* fptbl = Prj().PcbFootprintLibs( Kiway() );
  574. // Check if there are footprint libraries in the footprint library table.
  575. if( !fptbl || !fptbl->GetLogicalLibs().size() )
  576. {
  577. wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
  578. "library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
  579. return false;
  580. }
  581. WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
  582. m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
  583. if( m_FootprintsList->GetErrorCount() )
  584. {
  585. m_FootprintsList->DisplayErrors( this );
  586. }
  587. return true;
  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 schematic.\n%s" ), ioe.What().GetData() );
  617. wxMessageBox( msg, _( "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() );
  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. 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::SetStatusText( const wxString& aText, int aNumber )
  744. {
  745. wxASSERT( aNumber < 2 );
  746. if( aNumber == 1 )
  747. m_statusLine2->SetLabel( aText );
  748. else
  749. m_statusLine1->SetLabel( aText );
  750. }
  751. void CVPCB_MAINFRAME::OnConfigurePaths( wxCommandEvent& aEvent )
  752. {
  753. DIALOG_CONFIGURE_PATHS dlg( this, Prj().Get3DCacheManager()->GetResolver() );
  754. dlg.ShowModal();
  755. }
  756. void CVPCB_MAINFRAME::ShowChangedLanguage()
  757. {
  758. EDA_BASE_FRAME::ShowChangedLanguage();
  759. ReCreateHToolbar();
  760. DisplayStatus();
  761. }
  762. void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
  763. {
  764. const std::string& payload = mail.GetPayload();
  765. DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
  766. switch( mail.Command() )
  767. {
  768. case MAIL_EESCHEMA_NETLIST:
  769. ReadNetListAndFpFiles( payload );
  770. /* @todo
  771. Go into SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event ) and trim GNL_ALL down.
  772. */
  773. break;
  774. case MAIL_STATUS:
  775. SetStatusText( payload, 1 );
  776. break;
  777. default:
  778. ; // ignore most
  779. }
  780. }