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.

825 lines
28 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* 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
* 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
12 years ago
  1. /**
  2. * @file dialog_plot.cpp
  3. */
  4. /*
  5. * This program source code file is part of KiCad, a free EDA CAD application.
  6. *
  7. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. #include <kiface_i.h>
  27. #include <plot_common.h>
  28. #include <confirm.h>
  29. #include <wxPcbStruct.h>
  30. #include <pcbplot.h>
  31. #include <base_units.h>
  32. #include <macros.h>
  33. #include <reporter.h>
  34. #include <class_board.h>
  35. #include <wx/ffile.h>
  36. #include <dialog_plot.h>
  37. DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
  38. DIALOG_PLOT_BASE( aParent ), m_parent( aParent ),
  39. m_board( aParent->GetBoard() ),
  40. m_plotOpts( aParent->GetPlotSettings() )
  41. {
  42. m_config = Kiface().KifaceSettings();
  43. Init_Dialog();
  44. GetSizer()->Fit( this );
  45. GetSizer()->SetSizeHints( this );
  46. }
  47. void DIALOG_PLOT::Init_Dialog()
  48. {
  49. wxString msg;
  50. wxFileName fileName;
  51. m_config->Read( OPTKEY_PLOT_X_FINESCALE_ADJ, &m_XScaleAdjust );
  52. m_config->Read( OPTKEY_PLOT_Y_FINESCALE_ADJ, &m_YScaleAdjust );
  53. // m_PSWidthAdjust is stored in mm in user config
  54. double dtmp;
  55. m_config->Read( CONFIG_PS_FINEWIDTH_ADJ, &dtmp, 0 );
  56. m_PSWidthAdjust = KiROUND( dtmp * IU_PER_MM );
  57. // The reasonable width correction value must be in a range of
  58. // [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
  59. m_widthAdjustMinValue = -( m_board->GetDesignSettings().m_TrackMinWidth - 1 );
  60. m_widthAdjustMaxValue = m_board->GetDesignSettings().GetSmallestClearanceValue() - 1;
  61. switch( m_plotOpts.GetFormat() )
  62. {
  63. default:
  64. case PLOT_FORMAT_GERBER:
  65. m_plotFormatOpt->SetSelection( 0 );
  66. break;
  67. case PLOT_FORMAT_POST:
  68. m_plotFormatOpt->SetSelection( 1 );
  69. break;
  70. case PLOT_FORMAT_SVG:
  71. m_plotFormatOpt->SetSelection( 2 );
  72. break;
  73. case PLOT_FORMAT_DXF:
  74. m_plotFormatOpt->SetSelection( 3 );
  75. break;
  76. case PLOT_FORMAT_HPGL:
  77. m_plotFormatOpt->SetSelection( 4 );
  78. break;
  79. case PLOT_FORMAT_PDF:
  80. m_plotFormatOpt->SetSelection( 5 );
  81. break;
  82. }
  83. msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMargin, true );
  84. m_SolderMaskMarginCurrValue->SetLabel( msg );
  85. msg = StringFromValue( g_UserUnit, m_board->GetDesignSettings().m_SolderMaskMinWidth, true );
  86. m_SolderMaskMinWidthCurrValue->SetLabel( msg );
  87. // Set units and value for HPGL pen size (this param in in mils).
  88. AddUnitSymbol( *m_textPenSize, g_UserUnit );
  89. msg = StringFromValue( g_UserUnit,
  90. m_plotOpts.GetHPGLPenDiameter() * IU_PER_MILS );
  91. m_HPGLPenSizeOpt->AppendText( msg );
  92. // Set units and value for HPGL pen overlay (this param in in mils).
  93. AddUnitSymbol( *m_textPenOvr, g_UserUnit );
  94. msg = StringFromValue( g_UserUnit,
  95. m_plotOpts.GetHPGLPenOverlay() * IU_PER_MILS );
  96. m_HPGLPenOverlayOpt->AppendText( msg );
  97. AddUnitSymbol( *m_textDefaultPenSize, g_UserUnit );
  98. msg = StringFromValue( g_UserUnit, m_plotOpts.GetLineWidth() );
  99. m_linesWidth->AppendText( msg );
  100. // Set units for PS global width correction.
  101. AddUnitSymbol( *m_textPSFineAdjustWidth, g_UserUnit );
  102. m_useAuxOriginCheckBox->SetValue( m_plotOpts.GetUseAuxOrigin() );
  103. // Test for a reasonable scale value. Set to 1 if problem
  104. if( m_XScaleAdjust < PLOT_MIN_SCALE || m_YScaleAdjust < PLOT_MIN_SCALE
  105. || m_XScaleAdjust > PLOT_MAX_SCALE || m_YScaleAdjust > PLOT_MAX_SCALE )
  106. m_XScaleAdjust = m_YScaleAdjust = 1.0;
  107. msg.Printf( wxT( "%f" ), m_XScaleAdjust );
  108. m_fineAdjustXscaleOpt->AppendText( msg );
  109. msg.Printf( wxT( "%f" ), m_YScaleAdjust );
  110. m_fineAdjustYscaleOpt->AppendText( msg );
  111. // Test for a reasonable PS width correction value. Set to 0 if problem.
  112. if( m_PSWidthAdjust < m_widthAdjustMinValue || m_PSWidthAdjust > m_widthAdjustMaxValue )
  113. m_PSWidthAdjust = 0.;
  114. msg.Printf( wxT( "%f" ), To_User_Unit( g_UserUnit, m_PSWidthAdjust ) );
  115. m_PSFineAdjustWidthOpt->AppendText( msg );
  116. m_plotPSNegativeOpt->SetValue( m_plotOpts.GetNegative() );
  117. m_forcePSA4OutputOpt->SetValue( m_plotOpts.GetA4Output() );
  118. // Could devote a PlotOrder() function in place of UIOrder().
  119. m_layerList = m_board->GetEnabledLayers().UIOrder();
  120. for( LSEQ seq = m_layerList; seq; ++seq )
  121. {
  122. LAYER_ID layer = *seq;
  123. m_layerList.push_back( layer );
  124. int checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) );
  125. if( m_plotOpts.GetLayerSelection()[layer] )
  126. m_layerCheckListBox->Check( checkIndex );
  127. }
  128. // Option for using proper Gerber extensions
  129. m_useGerberExtensions->SetValue( m_plotOpts.GetUseGerberExtensions() );
  130. // Option for including Gerber attributes (from Gerber X2 format) in the output
  131. m_useGerberAttributes->SetValue( m_plotOpts.GetUseGerberAttributes() );
  132. // Option for excluding contents of "Edges Pcb" layer
  133. m_excludeEdgeLayerOpt->SetValue( m_plotOpts.GetExcludeEdgeLayer() );
  134. m_subtractMaskFromSilk->SetValue( m_plotOpts.GetSubtractMaskFromSilk() );
  135. // Option to plot page references:
  136. m_plotSheetRef->SetValue( m_plotOpts.GetPlotFrameRef() );
  137. // Option to allow pads on silkscreen layers
  138. m_plotPads_on_Silkscreen->SetValue( m_plotOpts.GetPlotPadsOnSilkLayer() );
  139. // Options to plot texts on footprints
  140. m_plotModuleValueOpt->SetValue( m_plotOpts.GetPlotValue() );
  141. m_plotModuleRefOpt->SetValue( m_plotOpts.GetPlotReference() );
  142. m_plotInvisibleText->SetValue( m_plotOpts.GetPlotInvisibleText() );
  143. // Options to plot pads and vias holes
  144. m_drillShapeOpt->SetSelection( m_plotOpts.GetDrillMarksType() );
  145. // Scale option
  146. m_scaleOpt->SetSelection( m_plotOpts.GetScaleSelection() );
  147. // Plot mode
  148. m_plotModeOpt->SetSelection( m_plotOpts.GetMode() );
  149. // Plot mirror option
  150. m_plotMirrorOpt->SetValue( m_plotOpts.GetMirror() );
  151. // Put vias on mask layer
  152. m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
  153. // Output directory
  154. m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
  155. // Update options values:
  156. wxCommandEvent cmd_event;
  157. SetPlotFormat( cmd_event );
  158. OnSetScaleOpt( cmd_event );
  159. }
  160. void DIALOG_PLOT::OnQuit( wxCommandEvent& event )
  161. {
  162. Close( true ); // true is to force the frame to close
  163. }
  164. void DIALOG_PLOT::OnClose( wxCloseEvent& event )
  165. {
  166. applyPlotSettings();
  167. EndModal( 0 );
  168. }
  169. // A helper function to show a popup menu, when the dialog is right clicked.
  170. void DIALOG_PLOT::OnRightClick( wxMouseEvent& event )
  171. {
  172. PopupMenu( m_popMenu );
  173. }
  174. // Select or deselect groups of layers in the layers list:
  175. #include <layers_id_colors_and_visibility.h>
  176. void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event )
  177. {
  178. unsigned int i;
  179. switch( event.GetId() )
  180. {
  181. case ID_LAYER_FAB: // Select layers usually needed to build a board
  182. for( i = 0; i < m_layerList.size(); i++ )
  183. {
  184. LSET layermask( m_layerList[ i ] );
  185. if( ( layermask & ( LSET::AllCuMask() | LSET::AllTechMask() ) ).any() )
  186. m_layerCheckListBox->Check( i, true );
  187. else
  188. m_layerCheckListBox->Check( i, false );
  189. }
  190. break;
  191. case ID_SELECT_COPPER_LAYERS:
  192. for( i = 0; i < m_layerList.size(); i++ )
  193. {
  194. if( IsCopperLayer( m_layerList[i] ) )
  195. m_layerCheckListBox->Check( i, true );
  196. }
  197. break;
  198. case ID_DESELECT_COPPER_LAYERS:
  199. for( i = 0; i < m_layerList.size(); i++ )
  200. {
  201. if( IsCopperLayer( m_layerList[i] ) )
  202. m_layerCheckListBox->Check( i, false );
  203. }
  204. break;
  205. case ID_SELECT_ALL_LAYERS:
  206. for( i = 0; i < m_layerList.size(); i++ )
  207. m_layerCheckListBox->Check( i, true );
  208. break;
  209. case ID_DESELECT_ALL_LAYERS:
  210. for( i = 0; i < m_layerList.size(); i++ )
  211. m_layerCheckListBox->Check( i, false );
  212. break;
  213. default:
  214. break;
  215. }
  216. }
  217. void DIALOG_PLOT::CreateDrillFile( wxCommandEvent& event )
  218. {
  219. m_parent->InstallDrillFrame( event );
  220. }
  221. void DIALOG_PLOT::OnSetScaleOpt( wxCommandEvent& event )
  222. {
  223. /* Disable sheet reference for scale != 1:1 */
  224. bool scale1 = ( m_scaleOpt->GetSelection() == 1 );
  225. m_plotSheetRef->Enable( scale1 );
  226. if( !scale1 )
  227. m_plotSheetRef->SetValue( false );
  228. }
  229. void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
  230. {
  231. // Build the absolute path of current output plot directory
  232. // to preselect it when opening the dialog.
  233. wxFileName fn( m_outputDirectoryName->GetValue() );
  234. wxString path;
  235. if( fn.IsRelative() )
  236. path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
  237. else
  238. path = m_outputDirectoryName->GetValue();
  239. wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
  240. if( dirDialog.ShowModal() == wxID_CANCEL )
  241. return;
  242. wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
  243. wxMessageDialog dialog( this, _( "Use a relative path? " ),
  244. _( "Plot Output Directory" ),
  245. wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
  246. if( dialog.ShowModal() == wxID_YES )
  247. {
  248. wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath();
  249. if( !dirName.MakeRelativeTo( boardFilePath ) )
  250. wxMessageBox( _( "Cannot make path relative (target volume different from board file volume)!" ),
  251. _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
  252. }
  253. m_outputDirectoryName->SetValue( dirName.GetFullPath() );
  254. }
  255. PlotFormat DIALOG_PLOT::GetPlotFormat()
  256. {
  257. // plot format id's are ordered like displayed in m_plotFormatOpt
  258. static const PlotFormat plotFmt[] =
  259. {
  260. PLOT_FORMAT_GERBER,
  261. PLOT_FORMAT_POST,
  262. PLOT_FORMAT_SVG,
  263. PLOT_FORMAT_DXF,
  264. PLOT_FORMAT_HPGL,
  265. PLOT_FORMAT_PDF
  266. };
  267. return plotFmt[ m_plotFormatOpt->GetSelection() ];
  268. }
  269. // Enable or disable widgets according to the plot format selected
  270. // and clear also some optional values
  271. void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
  272. {
  273. switch( GetPlotFormat() )
  274. {
  275. case PLOT_FORMAT_PDF:
  276. case PLOT_FORMAT_SVG:
  277. m_drillShapeOpt->Enable( true );
  278. m_plotModeOpt->Enable( false );
  279. m_plotModeOpt->SetSelection( 1 );
  280. m_plotMirrorOpt->Enable( true );
  281. m_useAuxOriginCheckBox->Enable( false );
  282. m_useAuxOriginCheckBox->SetValue( false );
  283. m_linesWidth->Enable( true );
  284. m_HPGLPenSizeOpt->Enable( false );
  285. m_HPGLPenOverlayOpt->Enable( false );
  286. m_excludeEdgeLayerOpt->Enable( true );
  287. m_subtractMaskFromSilk->Enable( false );
  288. m_subtractMaskFromSilk->SetValue( false );
  289. m_useGerberExtensions->Enable( false );
  290. m_useGerberExtensions->SetValue( false );
  291. m_useGerberAttributes->Enable( false );
  292. m_useGerberAttributes->SetValue( false );
  293. m_scaleOpt->Enable( false );
  294. m_scaleOpt->SetSelection( 1 );
  295. m_fineAdjustXscaleOpt->Enable( false );
  296. m_fineAdjustYscaleOpt->Enable( false );
  297. m_PSFineAdjustWidthOpt->Enable( false );
  298. m_plotPSNegativeOpt->Enable( true );
  299. m_forcePSA4OutputOpt->Enable( false );
  300. m_forcePSA4OutputOpt->SetValue( false );
  301. m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
  302. m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
  303. m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
  304. break;
  305. case PLOT_FORMAT_POST:
  306. m_drillShapeOpt->Enable( true );
  307. m_plotModeOpt->Enable( true );
  308. m_plotMirrorOpt->Enable( true );
  309. m_useAuxOriginCheckBox->Enable( false );
  310. m_useAuxOriginCheckBox->SetValue( false );
  311. m_linesWidth->Enable( true );
  312. m_HPGLPenSizeOpt->Enable( false );
  313. m_HPGLPenOverlayOpt->Enable( false );
  314. m_excludeEdgeLayerOpt->Enable( true );
  315. m_subtractMaskFromSilk->Enable( false );
  316. m_subtractMaskFromSilk->SetValue( false );
  317. m_useGerberExtensions->Enable( false );
  318. m_useGerberExtensions->SetValue( false );
  319. m_useGerberAttributes->Enable( false );
  320. m_useGerberAttributes->SetValue( false );
  321. m_scaleOpt->Enable( true );
  322. m_fineAdjustXscaleOpt->Enable( true );
  323. m_fineAdjustYscaleOpt->Enable( true );
  324. m_PSFineAdjustWidthOpt->Enable( true );
  325. m_plotPSNegativeOpt->Enable( true );
  326. m_forcePSA4OutputOpt->Enable( true );
  327. m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
  328. m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
  329. m_PlotOptionsSizer->Show( m_PSOptionsSizer );
  330. break;
  331. case PLOT_FORMAT_GERBER:
  332. m_drillShapeOpt->Enable( false );
  333. m_drillShapeOpt->SetSelection( 0 );
  334. m_plotModeOpt->Enable( false );
  335. m_plotModeOpt->SetSelection( 1 );
  336. m_plotMirrorOpt->Enable( false );
  337. m_plotMirrorOpt->SetValue( false );
  338. m_useAuxOriginCheckBox->Enable( true );
  339. m_linesWidth->Enable( true );
  340. m_HPGLPenSizeOpt->Enable( false );
  341. m_HPGLPenOverlayOpt->Enable( false );
  342. m_excludeEdgeLayerOpt->Enable( true );
  343. m_subtractMaskFromSilk->Enable( true );
  344. m_useGerberExtensions->Enable( true );
  345. m_useGerberAttributes->Enable( true );
  346. m_scaleOpt->Enable( false );
  347. m_scaleOpt->SetSelection( 1 );
  348. m_fineAdjustXscaleOpt->Enable( false );
  349. m_fineAdjustYscaleOpt->Enable( false );
  350. m_PSFineAdjustWidthOpt->Enable( false );
  351. m_plotPSNegativeOpt->Enable( false );
  352. m_plotPSNegativeOpt->SetValue( false );
  353. m_forcePSA4OutputOpt->Enable( false );
  354. m_forcePSA4OutputOpt->SetValue( false );
  355. m_PlotOptionsSizer->Show( m_GerberOptionsSizer );
  356. m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
  357. m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
  358. break;
  359. case PLOT_FORMAT_HPGL:
  360. m_drillShapeOpt->Enable( true );
  361. m_plotModeOpt->Enable( true );
  362. m_plotMirrorOpt->Enable( true );
  363. m_useAuxOriginCheckBox->Enable( false );
  364. m_useAuxOriginCheckBox->SetValue( false );
  365. m_linesWidth->Enable( false );
  366. m_HPGLPenSizeOpt->Enable( true );
  367. m_HPGLPenOverlayOpt->Enable( true );
  368. m_excludeEdgeLayerOpt->Enable( true );
  369. m_subtractMaskFromSilk->Enable( false );
  370. m_subtractMaskFromSilk->SetValue( false );
  371. m_useGerberExtensions->Enable( false );
  372. m_useGerberExtensions->SetValue( false );
  373. m_useGerberAttributes->Enable( false );
  374. m_useGerberAttributes->SetValue( false );
  375. m_scaleOpt->Enable( true );
  376. m_fineAdjustXscaleOpt->Enable( false );
  377. m_fineAdjustYscaleOpt->Enable( false );
  378. m_PSFineAdjustWidthOpt->Enable( false );
  379. m_plotPSNegativeOpt->SetValue( false );
  380. m_plotPSNegativeOpt->Enable( false );
  381. m_forcePSA4OutputOpt->Enable( true );
  382. m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
  383. m_PlotOptionsSizer->Show( m_HPGLOptionsSizer );
  384. m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
  385. break;
  386. case PLOT_FORMAT_DXF:
  387. m_drillShapeOpt->Enable( true );
  388. m_plotModeOpt->Enable( false );
  389. m_plotMirrorOpt->Enable( false );
  390. m_plotMirrorOpt->SetValue( false );
  391. m_useAuxOriginCheckBox->Enable( true );
  392. m_linesWidth->Enable( false );
  393. m_HPGLPenSizeOpt->Enable( false );
  394. m_HPGLPenOverlayOpt->Enable( false );
  395. m_excludeEdgeLayerOpt->Enable( true );
  396. m_subtractMaskFromSilk->Enable( false );
  397. m_subtractMaskFromSilk->SetValue( false );
  398. m_useGerberExtensions->Enable( false );
  399. m_useGerberExtensions->SetValue( false );
  400. m_useGerberAttributes->Enable( false );
  401. m_useGerberAttributes->SetValue( false );
  402. m_scaleOpt->Enable( false );
  403. m_scaleOpt->SetSelection( 1 );
  404. m_fineAdjustXscaleOpt->Enable( false );
  405. m_fineAdjustYscaleOpt->Enable( false );
  406. m_PSFineAdjustWidthOpt->Enable( false );
  407. m_plotPSNegativeOpt->Enable( false );
  408. m_plotPSNegativeOpt->SetValue( false );
  409. m_forcePSA4OutputOpt->Enable( false );
  410. m_forcePSA4OutputOpt->SetValue( false );
  411. m_PlotOptionsSizer->Hide( m_GerberOptionsSizer );
  412. m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer );
  413. m_PlotOptionsSizer->Hide( m_PSOptionsSizer );
  414. break;
  415. default:
  416. wxASSERT( false );
  417. }
  418. /* Update the interlock between scale and frame reference
  419. * (scaling would mess up the frame border...) */
  420. OnSetScaleOpt( event );
  421. Layout();
  422. m_MainSizer->SetSizeHints( this );
  423. }
  424. // A helper function to "clip" aValue between aMin and aMax
  425. // and write result in * aResult
  426. // return false if clipped, true if aValue is just copied into * aResult
  427. static bool setDouble( double* aResult, double aValue, double aMin, double aMax )
  428. {
  429. if( aValue < aMin )
  430. {
  431. *aResult = aMin;
  432. return false;
  433. }
  434. else if( aValue > aMax )
  435. {
  436. *aResult = aMax;
  437. return false;
  438. }
  439. *aResult = aValue;
  440. return true;
  441. }
  442. static bool setInt( int* aResult, int aValue, int aMin, int aMax )
  443. {
  444. if( aValue < aMin )
  445. {
  446. *aResult = aMin;
  447. return false;
  448. }
  449. else if( aValue > aMax )
  450. {
  451. *aResult = aMax;
  452. return false;
  453. }
  454. *aResult = aValue;
  455. return true;
  456. }
  457. void DIALOG_PLOT::applyPlotSettings()
  458. {
  459. PCB_PLOT_PARAMS tempOptions;
  460. tempOptions.SetExcludeEdgeLayer( m_excludeEdgeLayerOpt->GetValue() );
  461. tempOptions.SetSubtractMaskFromSilk( m_subtractMaskFromSilk->GetValue() );
  462. tempOptions.SetPlotFrameRef( m_plotSheetRef->GetValue() );
  463. tempOptions.SetPlotPadsOnSilkLayer( m_plotPads_on_Silkscreen->GetValue() );
  464. tempOptions.SetUseAuxOrigin( m_useAuxOriginCheckBox->GetValue() );
  465. tempOptions.SetPlotValue( m_plotModuleValueOpt->GetValue() );
  466. tempOptions.SetPlotReference( m_plotModuleRefOpt->GetValue() );
  467. tempOptions.SetPlotInvisibleText( m_plotInvisibleText->GetValue() );
  468. tempOptions.SetScaleSelection( m_scaleOpt->GetSelection() );
  469. tempOptions.SetDrillMarksType( static_cast<PCB_PLOT_PARAMS::DrillMarksType>
  470. ( m_drillShapeOpt->GetSelection() ) );
  471. tempOptions.SetMirror( m_plotMirrorOpt->GetValue() );
  472. tempOptions.SetMode( static_cast<EDA_DRAW_MODE_T>( m_plotModeOpt->GetSelection() ) );
  473. tempOptions.SetPlotViaOnMaskLayer( m_plotNoViaOnMaskOpt->GetValue() );
  474. // Update settings from text fields. Rewrite values back to the fields,
  475. // since the values may have been constrained by the setters.
  476. // read HPLG pen size (this param is stored in mils)
  477. wxString msg = m_HPGLPenSizeOpt->GetValue();
  478. int tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
  479. if( !tempOptions.SetHPGLPenDiameter( tmp ) )
  480. {
  481. msg = StringFromValue( g_UserUnit, tempOptions.GetHPGLPenDiameter() * IU_PER_MILS );
  482. m_HPGLPenSizeOpt->SetValue( msg );
  483. msg.Printf( _( "HPGL pen size constrained!\n" ) );
  484. m_messagesBox->AppendText( msg );
  485. }
  486. // Read HPGL pen overlay (this param is stored in mils)
  487. msg = m_HPGLPenOverlayOpt->GetValue();
  488. tmp = ValueFromString( g_UserUnit, msg ) / IU_PER_MILS;
  489. if( !tempOptions.SetHPGLPenOverlay( tmp ) )
  490. {
  491. msg = StringFromValue( g_UserUnit,
  492. tempOptions.GetHPGLPenOverlay() * IU_PER_MILS );
  493. m_HPGLPenOverlayOpt->SetValue( msg );
  494. msg.Printf( _( "HPGL pen overlay constrained!\n" ) );
  495. m_messagesBox->AppendText( msg );
  496. }
  497. // Default linewidth
  498. msg = m_linesWidth->GetValue();
  499. tmp = ValueFromString( g_UserUnit, msg );
  500. if( !tempOptions.SetLineWidth( tmp ) )
  501. {
  502. msg = StringFromValue( g_UserUnit, tempOptions.GetLineWidth() );
  503. m_linesWidth->SetValue( msg );
  504. msg.Printf( _( "Default line width constrained!\n" ) );
  505. m_messagesBox->AppendText( msg );
  506. }
  507. // X scale
  508. double tmpDouble;
  509. msg = m_fineAdjustXscaleOpt->GetValue();
  510. msg.ToDouble( &tmpDouble );
  511. if( !setDouble( &m_XScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
  512. {
  513. msg.Printf( wxT( "%f" ), m_XScaleAdjust );
  514. m_fineAdjustXscaleOpt->SetValue( msg );
  515. msg.Printf( _( "X scale constrained!\n" ) );
  516. m_messagesBox->AppendText( msg );
  517. }
  518. ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust );
  519. // Y scale
  520. msg = m_fineAdjustYscaleOpt->GetValue();
  521. msg.ToDouble( &tmpDouble );
  522. if( !setDouble( &m_YScaleAdjust, tmpDouble, PLOT_MIN_SCALE, PLOT_MAX_SCALE ) )
  523. {
  524. msg.Printf( wxT( "%f" ), m_YScaleAdjust );
  525. m_fineAdjustYscaleOpt->SetValue( msg );
  526. msg.Printf( _( "Y scale constrained!\n" ) );
  527. m_messagesBox->AppendText( msg );
  528. }
  529. ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust );
  530. // PS Width correction
  531. msg = m_PSFineAdjustWidthOpt->GetValue();
  532. int itmp = ValueFromString( g_UserUnit, msg );
  533. if( !setInt( &m_PSWidthAdjust, itmp, m_widthAdjustMinValue, m_widthAdjustMaxValue ) )
  534. {
  535. msg = StringFromValue( g_UserUnit, m_PSWidthAdjust );
  536. m_PSFineAdjustWidthOpt->SetValue( msg );
  537. msg.Printf( _( "Width correction constrained!\n"
  538. "The reasonable width correction value must be in a range of\n"
  539. " [%+f; %+f] (%s) for current design rules!\n" ),
  540. To_User_Unit( g_UserUnit, m_widthAdjustMinValue ),
  541. To_User_Unit( g_UserUnit, m_widthAdjustMaxValue ),
  542. ( g_UserUnit == INCHES ) ? wxT( "\"" ) : wxT( "mm" ) );
  543. m_messagesBox->AppendText( msg );
  544. }
  545. // Store m_PSWidthAdjust in mm in user config
  546. ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ,
  547. (double)m_PSWidthAdjust / IU_PER_MM );
  548. tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
  549. tempOptions.SetUseGerberAttributes( m_useGerberAttributes->GetValue() );
  550. tempOptions.SetFormat( GetPlotFormat() );
  551. LSET selectedLayers;
  552. for( unsigned i = 0; i < m_layerList.size(); i++ )
  553. {
  554. if( m_layerCheckListBox->IsChecked( i ) )
  555. selectedLayers.set( m_layerList[i] );
  556. }
  557. tempOptions.SetLayerSelection( selectedLayers );
  558. tempOptions.SetNegative( m_plotPSNegativeOpt->GetValue() );
  559. tempOptions.SetA4Output( m_forcePSA4OutputOpt->GetValue() );
  560. // Set output directory and replace backslashes with forward ones
  561. wxString dirStr;
  562. dirStr = m_outputDirectoryName->GetValue();
  563. dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
  564. tempOptions.SetOutputDirectory( dirStr );
  565. if( m_plotOpts != tempOptions )
  566. {
  567. m_parent->SetPlotSettings( tempOptions );
  568. m_plotOpts = tempOptions;
  569. m_parent->OnModify();
  570. }
  571. }
  572. void DIALOG_PLOT::Plot( wxCommandEvent& event )
  573. {
  574. applyPlotSettings();
  575. // Create output directory if it does not exist (also transform it in
  576. // absolute form). Bail if it fails
  577. wxFileName outputDir = wxFileName::DirName( m_plotOpts.GetOutputDirectory() );
  578. wxString boardFilename = m_parent->GetBoard()->GetFileName();
  579. WX_TEXT_CTRL_REPORTER reporter( m_messagesBox );
  580. if( !EnsureOutputDirectory( &outputDir, boardFilename, &reporter ) )
  581. {
  582. wxString msg;
  583. msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
  584. GetChars( outputDir.GetPath() ) );
  585. DisplayError( this, msg );
  586. return;
  587. }
  588. m_plotOpts.SetAutoScale( false );
  589. m_plotOpts.SetScale( 1 );
  590. switch( m_plotOpts.GetScaleSelection() )
  591. {
  592. default:
  593. break;
  594. case 0: // Autoscale option
  595. m_plotOpts.SetAutoScale( true );
  596. break;
  597. case 2: // 3:2 option
  598. m_plotOpts.SetScale( 1.5 );
  599. break;
  600. case 3: // 2:1 option
  601. m_plotOpts.SetScale( 2 );
  602. break;
  603. case 4: // 3:1 option
  604. m_plotOpts.SetScale( 3 );
  605. break;
  606. }
  607. /* If the scale factor edit controls are disabled or the scale value
  608. * is 0, don't adjust the base scale factor. This fixes a bug when
  609. * the default scale adjust is initialized to 0 and saved in program
  610. * settings resulting in a divide by zero fault.
  611. */
  612. if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 )
  613. m_plotOpts.SetFineScaleAdjustX( m_XScaleAdjust );
  614. if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
  615. m_plotOpts.SetFineScaleAdjustY( m_YScaleAdjust );
  616. if( m_PSFineAdjustWidthOpt->IsEnabled() )
  617. m_plotOpts.SetWidthAdjust( m_PSWidthAdjust );
  618. wxString file_ext( GetDefaultPlotExtension( m_plotOpts.GetFormat() ) );
  619. // Test for a reasonable scale value
  620. // XXX could this actually happen? isn't it constrained in the apply
  621. // function?
  622. if( m_plotOpts.GetScale() < PLOT_MIN_SCALE )
  623. DisplayInfoMessage( this,
  624. _( "Warning: Scale option set to a very small value" ) );
  625. if( m_plotOpts.GetScale() > PLOT_MAX_SCALE )
  626. DisplayInfoMessage( this,
  627. _( "Warning: Scale option set to a very large value" ) );
  628. // Save the current plot options in the board
  629. m_parent->SetPlotSettings( m_plotOpts );
  630. wxBusyCursor dummy;
  631. for( LSEQ seq = m_plotOpts.GetLayerSelection().UIOrder(); seq; ++seq )
  632. {
  633. LAYER_ID layer = *seq;
  634. // Pick the basename from the board file
  635. wxFileName fn( boardFilename );
  636. // Use Gerber Extensions based on layer number
  637. // (See http://en.wikipedia.org/wiki/Gerber_File)
  638. if( m_plotOpts.GetFormat() == PLOT_FORMAT_GERBER && m_useGerberExtensions->GetValue() )
  639. file_ext = GetGerberExtension( layer );
  640. // Create file name (from the English layer name for non copper layers).
  641. BuildPlotFileName( &fn, outputDir.GetPath(),
  642. m_board->GetStandardLayerName( layer ),
  643. file_ext );
  644. LOCALE_IO toggle;
  645. BOARD* board = m_parent->GetBoard();
  646. PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, layer, fn.GetFullPath(), wxEmptyString );
  647. // Print diags in messages box:
  648. wxString msg;
  649. if( plotter )
  650. {
  651. PlotOneBoardLayer( board, plotter, layer, m_plotOpts );
  652. plotter->EndPlot();
  653. delete plotter;
  654. msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) );
  655. }
  656. else
  657. msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
  658. msg << wxT( "\n" );
  659. m_messagesBox->AppendText( msg );
  660. }
  661. // If no layer selected, we have nothing plotted.
  662. // Prompt user if it happens because he could think there is a bug in Pcbnew.
  663. if( !m_plotOpts.GetLayerSelection().any() )
  664. DisplayError( this, _( "No layer selected" ) );
  665. }