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.

540 lines
18 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
5 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
5 years ago
Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  5. * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 2004-2020 KiCad Developers, see change_log.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. #include <pgm_base.h>
  26. #include <kiface_base.h>
  27. #include <confirm.h>
  28. #include <gestfich.h>
  29. #include <eda_dde.h>
  30. #include <eeschema_settings.h>
  31. #include <sch_edit_frame.h>
  32. #include <symbol_edit_frame.h>
  33. #include <symbol_viewer_frame.h>
  34. #include <transform.h>
  35. #include <symbol_lib_table.h>
  36. #include <dialogs/dialog_global_sym_lib_table_config.h>
  37. #include <dialogs/panel_sym_lib_table.h>
  38. #include <kiway.h>
  39. #include <sim/sim_plot_frame.h>
  40. #include <settings/settings_manager.h>
  41. #include <symbol_editor_settings.h>
  42. #include <sexpr/sexpr.h>
  43. #include <sexpr/sexpr_parser.h>
  44. #include <kiface_ids.h>
  45. #include <netlist_exporters/netlist_exporter_kicad.h>
  46. #include <wx/ffile.h>
  47. #include <wildcards_and_files_ext.h>
  48. #include <schematic.h>
  49. #include <connection_graph.h>
  50. #include <panel_template_fieldnames.h>
  51. #include <panel_eeschema_color_settings.h>
  52. #include <panel_sym_color_settings.h>
  53. #include <panel_eeschema_editing_options.h>
  54. #include <panel_sym_editing_options.h>
  55. #include <dialogs/panel_gal_display_options.h>
  56. #include <panel_eeschema_display_options.h>
  57. #include <panel_sym_display_options.h>
  58. // The main sheet of the project
  59. SCH_SHEET* g_RootSheet = nullptr;
  60. // a transform matrix, to display symbols in lib editor
  61. TRANSFORM DefaultTransform = TRANSFORM( 1, 0, 0, -1 );
  62. namespace SCH {
  63. static std::unique_ptr<SCHEMATIC> readSchematicFromFile( const std::string& aFilename )
  64. {
  65. auto pi = SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_KICAD );
  66. std::unique_ptr<SCHEMATIC> schematic = std::make_unique<SCHEMATIC>( nullptr );
  67. auto &manager = Pgm().GetSettingsManager();
  68. manager.LoadProject( "" );
  69. schematic->Reset();
  70. schematic->SetProject( &manager.Prj() );
  71. schematic->SetRoot( pi->Load( aFilename, schematic.get() ) );
  72. schematic->CurrentSheet().push_back( &schematic->Root() );
  73. SCH_SCREENS screens( schematic->Root() );
  74. for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
  75. screen->UpdateLocalLibSymbolLinks();
  76. SCH_SHEET_LIST sheets = schematic->GetSheets();
  77. // Restore all of the loaded symbol instances from the root sheet screen.
  78. sheets.UpdateSymbolInstances( schematic->RootScreen()->GetSymbolInstances() );
  79. sheets.AnnotatePowerSymbols();
  80. // NOTE: This is required for multi-unit symbols to be correct
  81. // Normally called from SCH_EDIT_FRAME::FixupJunctions() but could be refactored
  82. for( SCH_SHEET_PATH& sheet : sheets )
  83. sheet.UpdateAllScreenReferences();
  84. // NOTE: SchematicCleanUp is not called; QA schematics must already be clean or else
  85. // SchematicCleanUp must be freed from its UI dependencies.
  86. schematic->ConnectionGraph()->Recalculate( sheets, true );
  87. return schematic;
  88. }
  89. bool generateSchematicNetlist( const wxString& aFilename, wxString& aNetlist )
  90. {
  91. std::unique_ptr<SCHEMATIC> schematic = readSchematicFromFile( aFilename.ToStdString() );
  92. NETLIST_EXPORTER_KICAD exporter( schematic.get() );
  93. STRING_FORMATTER formatter;
  94. exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
  95. aNetlist = formatter.GetString();
  96. return true;
  97. }
  98. static struct IFACE : public KIFACE_BASE
  99. {
  100. // Of course all are virtual overloads, implementations of the KIFACE.
  101. IFACE( const char* aName, KIWAY::FACE_T aType ) :
  102. KIFACE_BASE( aName, aType )
  103. {}
  104. bool OnKifaceStart( PGM_BASE* aProgram, int aCtlBits ) override;
  105. void OnKifaceEnd() override;
  106. wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway,
  107. int aCtlBits = 0 ) override
  108. {
  109. switch( aClassId )
  110. {
  111. case FRAME_SCH:
  112. {
  113. SCH_EDIT_FRAME* frame = new SCH_EDIT_FRAME( aKiway, aParent );
  114. if( Kiface().IsSingle() )
  115. {
  116. // only run this under single_top, not under a project manager.
  117. frame->CreateServer( KICAD_SCH_PORT_SERVICE_NUMBER );
  118. }
  119. return frame;
  120. }
  121. case FRAME_SCH_SYMBOL_EDITOR:
  122. {
  123. SYMBOL_EDIT_FRAME* frame = new SYMBOL_EDIT_FRAME( aKiway, aParent );
  124. return frame;
  125. }
  126. #ifdef KICAD_SPICE
  127. case FRAME_SIMULATOR:
  128. {
  129. SIM_PLOT_FRAME* frame = new SIM_PLOT_FRAME( aKiway, aParent );
  130. return frame;
  131. }
  132. #endif
  133. case FRAME_SCH_VIEWER:
  134. case FRAME_SCH_VIEWER_MODAL:
  135. {
  136. SYMBOL_VIEWER_FRAME* frame = new SYMBOL_VIEWER_FRAME( aKiway, aParent,
  137. FRAME_T( aClassId ) );
  138. return frame;
  139. }
  140. case DIALOG_SCH_LIBRARY_TABLE:
  141. InvokeSchEditSymbolLibTable( aKiway, aParent );
  142. // Dialog has completed; nothing to return.
  143. return nullptr;
  144. case PANEL_SYM_DISP_OPTIONS:
  145. {
  146. SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
  147. APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
  148. return new PANEL_SYM_DISPLAY_OPTIONS( aParent, cfg );
  149. }
  150. case PANEL_SYM_EDIT_OPTIONS:
  151. {
  152. EDA_BASE_FRAME* unitsProvider = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
  153. if( !unitsProvider )
  154. unitsProvider = aKiway->Player( FRAME_SCH_VIEWER, false );
  155. if( !unitsProvider )
  156. unitsProvider = aKiway->Player( FRAME_SCH, false );
  157. if( !unitsProvider )
  158. {
  159. // If we can't find an eeschema unitsProvider we'll have to make do with the units
  160. // defined in whatever FRAME we _can_ find.
  161. for( unsigned i = 0; !unitsProvider && i < KIWAY_PLAYER_COUNT; ++i )
  162. unitsProvider = aKiway->Player( (FRAME_T) i, false );
  163. }
  164. if( !unitsProvider )
  165. {
  166. wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
  167. unitsProvider = static_cast<EDA_BASE_FRAME*>( manager );
  168. }
  169. return new PANEL_SYM_EDITING_OPTIONS( aParent, unitsProvider );
  170. }
  171. case PANEL_SYM_COLORS:
  172. return new PANEL_SYM_COLOR_SETTINGS( aParent );
  173. case PANEL_SCH_DISP_OPTIONS:
  174. {
  175. SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
  176. APP_SETTINGS_BASE* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
  177. return new PANEL_EESCHEMA_DISPLAY_OPTIONS( aParent, cfg );
  178. }
  179. case PANEL_SCH_EDIT_OPTIONS:
  180. {
  181. EDA_BASE_FRAME* unitsProvider = aKiway->Player( FRAME_SCH, false );
  182. if( !unitsProvider )
  183. unitsProvider = aKiway->Player( FRAME_SCH_SYMBOL_EDITOR, false );
  184. if( !unitsProvider )
  185. unitsProvider = aKiway->Player( FRAME_SCH_VIEWER, false );
  186. if( !unitsProvider )
  187. {
  188. // If we can't find an eeschema frame we'll have to make do with the units
  189. // defined in whatever FRAME we _can_ find.
  190. for( unsigned i = 0; !unitsProvider && i < KIWAY_PLAYER_COUNT; ++i )
  191. unitsProvider = aKiway->Player( (FRAME_T) i, false );
  192. }
  193. if( !unitsProvider )
  194. {
  195. wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
  196. unitsProvider = static_cast<EDA_BASE_FRAME*>( manager );
  197. }
  198. return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, unitsProvider );
  199. }
  200. case PANEL_SCH_COLORS:
  201. return new PANEL_EESCHEMA_COLOR_SETTINGS( aParent );
  202. case PANEL_SCH_FIELD_NAME_TEMPLATES:
  203. return new PANEL_TEMPLATE_FIELDNAMES( aParent, nullptr );
  204. default:
  205. return nullptr;
  206. }
  207. }
  208. /**
  209. * Return a pointer to the requested object.
  210. *
  211. * The safest way to use this is to retrieve a pointer to a static instance of an interface,
  212. * similar to how the KIFACE interface is exported. But if you know what you are doing use
  213. * it to retrieve anything you want.
  214. *
  215. * @param aDataId identifies which object you want the address of.
  216. * @return the object requested and must be cast into the know type.
  217. */
  218. void* IfaceOrAddress( int aDataId ) override
  219. {
  220. switch( aDataId )
  221. {
  222. case KIFACE_NETLIST_SCHEMATIC:
  223. return (void*) generateSchematicNetlist;
  224. }
  225. return nullptr;
  226. }
  227. /**
  228. * Saving a file under a different name is delegated to the various KIFACEs because
  229. * the project doesn't know the internal format of the various files (which may have
  230. * paths in them that need updating).
  231. */
  232. void SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
  233. const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
  234. const wxString& aSrcFilePath, wxString& aErrors ) override;
  235. } kiface( "eeschema", KIWAY::FACE_SCH );
  236. } // namespace
  237. using namespace SCH;
  238. static PGM_BASE* process;
  239. KIFACE_BASE& Kiface() { return kiface; }
  240. // KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
  241. // KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
  242. MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
  243. {
  244. process = aProgram;
  245. return &kiface;
  246. }
  247. PGM_BASE& Pgm()
  248. {
  249. wxASSERT( process ); // KIFACE_GETTER has already been called.
  250. return *process;
  251. }
  252. // Similar to PGM_BASE& Pgm(), but return nullptr when a *.ki_face is run from
  253. // a python script or something else.
  254. PGM_BASE* PgmOrNull()
  255. {
  256. return process;
  257. }
  258. bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
  259. {
  260. // This is process-level-initialization, not project-level-initialization of the DSO.
  261. // Do nothing in here pertinent to a project!
  262. InitSettings( new EESCHEMA_SETTINGS );
  263. aProgram->GetSettingsManager().RegisterSettings( KifaceSettings() );
  264. start_common( aCtlBits );
  265. wxFileName fn = SYMBOL_LIB_TABLE::GetGlobalTableFileName();
  266. if( !fn.FileExists() )
  267. {
  268. DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG fpDialog( nullptr );
  269. fpDialog.ShowModal();
  270. }
  271. else
  272. {
  273. try
  274. {
  275. // The global table is not related to a specific project. All projects
  276. // will use the same global table. So the KIFACE::OnKifaceStart() contract
  277. // of avoiding anything project specific is not violated here.
  278. if( !SYMBOL_LIB_TABLE::LoadGlobalTable( SYMBOL_LIB_TABLE::GetGlobalLibTable() ) )
  279. return false;
  280. }
  281. catch( const IO_ERROR& ioe )
  282. {
  283. // if we are here, a incorrect global symbol library table was found.
  284. // Incorrect global symbol library table is not a fatal error:
  285. // the user just has to edit the (partially) loaded table.
  286. wxString msg = _(
  287. "An error occurred attempting to load the global symbol library table.\n"
  288. "Please edit this global symbol library table in Preferences menu."
  289. );
  290. DisplayErrorMessage( nullptr, msg, ioe.What() );
  291. }
  292. }
  293. return true;
  294. }
  295. void IFACE::OnKifaceEnd()
  296. {
  297. end_common();
  298. }
  299. static void traverseSEXPR( SEXPR::SEXPR* aNode,
  300. const std::function<void( SEXPR::SEXPR* )>& aVisitor )
  301. {
  302. aVisitor( aNode );
  303. if( aNode->IsList() )
  304. {
  305. for( unsigned i = 0; i < aNode->GetNumberOfChildren(); i++ )
  306. traverseSEXPR( aNode->GetChild( i ), aVisitor );
  307. }
  308. }
  309. void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProjectName,
  310. const wxString& aNewProjectBasePath, const wxString& aNewProjectName,
  311. const wxString& aSrcFilePath, wxString& aErrors )
  312. {
  313. wxFileName destFile( aSrcFilePath );
  314. wxString destPath = destFile.GetPathWithSep();
  315. wxUniChar pathSep = wxFileName::GetPathSeparator();
  316. wxString ext = destFile.GetExt();
  317. if( destPath.StartsWith( aProjectBasePath + pathSep ) )
  318. destPath.Replace( aProjectBasePath, aNewProjectBasePath, false );
  319. destFile.SetPath( destPath );
  320. if( ext == LegacySchematicFileExtension ||
  321. ext == LegacySchematicFileExtension + BackupFileSuffix ||
  322. ext == KiCadSchematicFileExtension ||
  323. ext == KiCadSchematicFileExtension + BackupFileSuffix )
  324. {
  325. if( destFile.GetName() == aProjectName )
  326. destFile.SetName( aNewProjectName );
  327. // Sheet paths when auto-generated are relative to the root, so those will stay
  328. // pointing to whatever they were pointing at.
  329. // The author can create their own absolute and relative sheet paths. Absolute
  330. // sheet paths aren't an issue, and relative ones will continue to work as long
  331. // as the author didn't include any '..'s. If they did, it's still not clear
  332. // whether they should be adjusted or not (as the author may be duplicating an
  333. // entire tree with several projects within it), so we leave this as an exercise
  334. // to the author.
  335. KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
  336. }
  337. else if( ext == SchematicSymbolFileExtension )
  338. {
  339. // Symbols are not project-specific. Keep their source names.
  340. KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
  341. }
  342. else if( ext == LegacySymbolLibFileExtension || ext == LegacySymbolDocumentFileExtension ||
  343. ext == KiCadSymbolLibFileExtension )
  344. {
  345. if( destFile.GetName() == aProjectName + "-cache" )
  346. destFile.SetName( aNewProjectName + "-cache" );
  347. KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
  348. }
  349. else if( ext == NetlistFileExtension )
  350. {
  351. bool success = false;
  352. if( destFile.GetName() == aProjectName )
  353. destFile.SetName( aNewProjectName );
  354. try
  355. {
  356. SEXPR::PARSER parser;
  357. std::unique_ptr<SEXPR::SEXPR> sexpr( parser.ParseFromFile( TO_UTF8( aSrcFilePath ) ) );
  358. traverseSEXPR( sexpr.get(), [&]( SEXPR::SEXPR* node )
  359. {
  360. if( node->IsList() && node->GetNumberOfChildren() > 1
  361. && node->GetChild( 0 )->IsSymbol()
  362. && node->GetChild( 0 )->GetSymbol() == "source" )
  363. {
  364. auto pathNode = dynamic_cast<SEXPR::SEXPR_STRING*>( node->GetChild( 1 ) );
  365. auto symNode = dynamic_cast<SEXPR::SEXPR_SYMBOL*>( node->GetChild( 1 ) );
  366. wxString path;
  367. if( pathNode )
  368. path = pathNode->m_value;
  369. else if( symNode )
  370. path = symNode->m_value;
  371. if( path == aProjectName + ".sch" )
  372. path = aNewProjectName + ".sch";
  373. else if( path == aProjectBasePath + "/" + aProjectName + ".sch" )
  374. path = aNewProjectBasePath + "/" + aNewProjectName + ".sch";
  375. else if( path.StartsWith( aProjectBasePath ) )
  376. path.Replace( aProjectBasePath, aNewProjectBasePath, false );
  377. if( pathNode )
  378. pathNode->m_value = path;
  379. else if( symNode )
  380. symNode->m_value = path;
  381. }
  382. } );
  383. wxFFile destNetList( destFile.GetFullPath(), "wb" );
  384. if( destNetList.IsOpened() )
  385. success = destNetList.Write( sexpr->AsString( 0 ) );
  386. // wxFFile dtor will close the file
  387. }
  388. catch( ... )
  389. {
  390. success = false;
  391. }
  392. if( !success )
  393. {
  394. wxString msg;
  395. if( !aErrors.empty() )
  396. aErrors += "\n";
  397. msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
  398. aErrors += msg;
  399. }
  400. }
  401. else if( destFile.GetName() == "sym-lib-table" )
  402. {
  403. SYMBOL_LIB_TABLE symbolLibTable;
  404. symbolLibTable.Load( aSrcFilePath );
  405. for( unsigned i = 0; i < symbolLibTable.GetCount(); i++ )
  406. {
  407. LIB_TABLE_ROW& row = symbolLibTable.At( i );
  408. wxString uri = row.GetFullURI();
  409. uri.Replace( "/" + aProjectName + "-cache.lib", "/" + aNewProjectName + "-cache.lib" );
  410. uri.Replace( "/" + aProjectName + "-rescue.lib", "/" + aNewProjectName +
  411. "-rescue.lib" );
  412. uri.Replace( "/" + aProjectName + ".lib", "/" + aNewProjectName + ".lib" );
  413. row.SetFullURI( uri );
  414. }
  415. try
  416. {
  417. symbolLibTable.Save( destFile.GetFullPath() );
  418. }
  419. catch( ... )
  420. {
  421. wxString msg;
  422. if( !aErrors.empty() )
  423. aErrors += "\n";
  424. msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
  425. aErrors += msg;
  426. }
  427. }
  428. else
  429. {
  430. wxFAIL_MSG( "Unexpected filetype for Eeschema::SaveFileAs()" );
  431. }
  432. }