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.

1047 lines
36 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
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /**
  2. * @file common_plotPS_functions.cpp
  3. * @brief Kicad: Common plot Postscript Routines
  4. */
  5. #include <fctsys.h>
  6. #include <trigo.h>
  7. #include <wxstruct.h>
  8. #include <base_struct.h>
  9. #include <common.h>
  10. #include <plot_common.h>
  11. #include <macros.h>
  12. #include <kicad_string.h>
  13. /* Forward declaration of the font width metrics
  14. (yes extern! this is the way to forward declare variables */
  15. extern const double hv_widths[256];
  16. extern const double hvb_widths[256];
  17. extern const double hvo_widths[256];
  18. extern const double hvbo_widths[256];
  19. const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718;
  20. // Common routines for Postscript-like plotting engines
  21. void PSLIKE_PLOTTER::SetDefaultLineWidth( int width )
  22. {
  23. defaultPenWidth = width;
  24. currentPenWidth = -1;
  25. }
  26. void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
  27. {
  28. // Return at invalid color index
  29. if( color < 0 )
  30. return;
  31. if( colorMode )
  32. {
  33. double r = g_ColorRefs[color].m_Red / 255.0;
  34. double g = g_ColorRefs[color].m_Green / 255.0;
  35. double b = g_ColorRefs[color].m_Blue / 255.0;
  36. if( negativeMode )
  37. emitSetRGBColor( 1 - r, 1 - g, 1 - b );
  38. else
  39. emitSetRGBColor( r, g, b );
  40. }
  41. else
  42. {
  43. /* B/W Mode - Use BLACK or WHITE for all items
  44. * note the 2 colors are used in B&W mode, mainly by Pcbnew to draw
  45. * holes in white on pads in black
  46. */
  47. double k = 1; // White
  48. if( color != WHITE )
  49. k = 0;
  50. if( negativeMode )
  51. emitSetRGBColor( 1 - k, 1 - k, 1 - k );
  52. else
  53. emitSetRGBColor( k, k, k );
  54. }
  55. }
  56. void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
  57. EDA_DRAW_MODE_T modetrace )
  58. {
  59. wxASSERT( outputFile );
  60. int x0, y0, x1, y1, delta;
  61. wxSize size( aSize );
  62. // The pad is reduced to an oval by dy > dx
  63. if( size.x > size.y )
  64. {
  65. EXCHG( size.x, size.y );
  66. orient = AddAngles( orient, 900 );
  67. }
  68. delta = size.y - size.x;
  69. x0 = 0;
  70. y0 = -delta / 2;
  71. x1 = 0;
  72. y1 = delta / 2;
  73. RotatePoint( &x0, &y0, orient );
  74. RotatePoint( &x1, &y1, orient );
  75. if( modetrace == FILLED )
  76. ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ),
  77. wxPoint( pos.x + x1, pos.y + y1 ), size.x, modetrace );
  78. else
  79. sketchOval( pos, size, orient, -1 );
  80. }
  81. void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
  82. EDA_DRAW_MODE_T modetrace )
  83. {
  84. int current_line_width;
  85. wxASSERT( outputFile );
  86. SetCurrentLineWidth( -1 );
  87. current_line_width = GetCurrentLineWidth();
  88. if( current_line_width > diametre )
  89. current_line_width = diametre;
  90. if( modetrace == FILLED )
  91. Circle( pos, diametre - currentPenWidth, FILLED_SHAPE, current_line_width );
  92. else
  93. Circle( pos, diametre - currentPenWidth, NO_FILL, current_line_width );
  94. SetCurrentLineWidth( -1 );
  95. }
  96. void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
  97. double orient, EDA_DRAW_MODE_T trace_mode )
  98. {
  99. static std::vector< wxPoint > cornerList;
  100. wxSize size( aSize );
  101. cornerList.clear();
  102. SetCurrentLineWidth( -1 );
  103. int w = currentPenWidth;
  104. size.x -= w;
  105. if( size.x < 1 )
  106. size.x = 1;
  107. size.y -= w;
  108. if( size.y < 1 )
  109. size.y = 1;
  110. int dx = size.x / 2;
  111. int dy = size.y / 2;
  112. wxPoint corner;
  113. corner.x = pos.x - dx;
  114. corner.y = pos.y + dy;
  115. cornerList.push_back( corner );
  116. corner.x = pos.x - dx;
  117. corner.y = pos.y - dy;
  118. cornerList.push_back( corner );
  119. corner.x = pos.x + dx;
  120. corner.y = pos.y - dy;
  121. cornerList.push_back( corner );
  122. corner.x = pos.x + dx;
  123. corner.y = pos.y + dy,
  124. cornerList.push_back( corner );
  125. for( unsigned ii = 0; ii < cornerList.size(); ii++ )
  126. {
  127. RotatePoint( &cornerList[ii], pos, orient );
  128. }
  129. cornerList.push_back( cornerList[0] );
  130. PlotPoly( cornerList, ( trace_mode == FILLED ) ? FILLED_SHAPE : NO_FILL );
  131. }
  132. void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
  133. double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
  134. {
  135. static std::vector< wxPoint > cornerList;
  136. cornerList.clear();
  137. for( int ii = 0; ii < 4; ii++ )
  138. cornerList.push_back( aCorners[ii] );
  139. if( aTrace_Mode == FILLED )
  140. {
  141. SetCurrentLineWidth( 0 );
  142. }
  143. else
  144. {
  145. SetCurrentLineWidth( -1 );
  146. int w = currentPenWidth;
  147. // offset polygon by w
  148. // coord[0] is assumed the lower left
  149. // coord[1] is assumed the upper left
  150. // coord[2] is assumed the upper right
  151. // coord[3] is assumed the lower right
  152. /* Trace the outline. */
  153. cornerList[0].x += w;
  154. cornerList[0].y -= w;
  155. cornerList[1].x += w;
  156. cornerList[1].y += w;
  157. cornerList[2].x -= w;
  158. cornerList[2].y += w;
  159. cornerList[3].x -= w;
  160. cornerList[3].y -= w;
  161. }
  162. for( int ii = 0; ii < 4; ii++ )
  163. {
  164. RotatePoint( &cornerList[ii], aPadOrient );
  165. cornerList[ii] += aPadPos;
  166. }
  167. cornerList.push_back( cornerList[0] );
  168. PlotPoly( cornerList, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL );
  169. }
  170. /**
  171. * Write on a stream a string escaped for postscript/PDF
  172. */
  173. void PSLIKE_PLOTTER::fputsPostscriptString(FILE *fout, const wxString& txt)
  174. {
  175. putc( '(', fout );
  176. for( unsigned i = 0; i < txt.length(); i++ )
  177. {
  178. // Lazyness made me use stdio buffering yet another time...
  179. wchar_t ch = txt[i];
  180. if( ch < 256 )
  181. {
  182. switch (ch)
  183. {
  184. // The ~ shouldn't reach the outside
  185. case '~':
  186. break;
  187. // These characters must be escaped
  188. case '(':
  189. case ')':
  190. case '\\':
  191. putc( '\\', fout );
  192. // FALLTHRU
  193. default:
  194. putc( ch, fout );
  195. break;
  196. }
  197. }
  198. }
  199. putc( ')', fout );
  200. }
  201. /**
  202. * Sister function for the GraphicTextWidth in drawtxt.cpp
  203. * Does the same processing (i.e. calculates a text string width) but
  204. * using postscript metrics for the Helvetica font (optionally used for
  205. * PS and PDF plotting
  206. */
  207. int PSLIKE_PLOTTER::returnPostscriptTextWidth( const wxString& aText, int aXSize,
  208. bool aItalic, bool aBold )
  209. {
  210. const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
  211. : ( aItalic ? hvo_widths : hv_widths );
  212. double tally = 0;
  213. for( unsigned i = 0; i < aText.length(); i++ )
  214. {
  215. wchar_t AsciiCode = aText[i];
  216. // Skip the negation marks and untabled points
  217. if( AsciiCode != '~' && AsciiCode < 256 )
  218. {
  219. tally += width_table[AsciiCode];
  220. }
  221. }
  222. // Widths are proportional to height, but height is enlarged by a
  223. // scaling factor
  224. return KiROUND( aXSize * tally / postscriptTextAscent );
  225. }
  226. /**
  227. * Computes the x coordinates for the overlining in a string of text.
  228. * Fills the passed vector with couples of (start, stop) values to be
  229. * used in the text coordinate system (use computeTextParameters to
  230. * obtain the parameters to estabilish such a system)
  231. */
  232. void PSLIKE_PLOTTER::postscriptOverlinePositions( const wxString& aText, int aXSize,
  233. bool aItalic, bool aBold,
  234. std::vector<int> *pos_pairs )
  235. {
  236. /* XXX This function is *too* similar to returnPostscriptTextWidth.
  237. Consider merging them... */
  238. const double *width_table = aBold ? ( aItalic ? hvbo_widths : hvb_widths )
  239. : ( aItalic ? hvo_widths : hv_widths );
  240. double tally = 0;
  241. for( unsigned i = 0; i < aText.length(); i++ )
  242. {
  243. wchar_t AsciiCode = aText[i];
  244. // Skip the negation marks and untabled points
  245. if( AsciiCode != '~' && AsciiCode < 256 )
  246. {
  247. tally += width_table[AsciiCode];
  248. }
  249. else
  250. {
  251. if( AsciiCode == '~' )
  252. pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
  253. }
  254. }
  255. // Special rule: we have to complete the last bar if the ~ aren't matched
  256. if( pos_pairs->size() % 2 == 1 )
  257. pos_pairs->push_back( KiROUND( aXSize * tally / postscriptTextAscent ) );
  258. }
  259. void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
  260. double aScale, bool aMirror )
  261. {
  262. wxASSERT( !outputFile );
  263. m_plotMirror = aMirror;
  264. plotOffset = aOffset;
  265. plotScale = aScale;
  266. m_IUsPerDecimil = aIusPerDecimil;
  267. iuPerDeviceUnit = 1.0 / aIusPerDecimil;
  268. /* Compute the paper size in IUs */
  269. paperSize = pageInfo.GetSizeMils();
  270. paperSize.x *= 10.0 * aIusPerDecimil;
  271. paperSize.y *= 10.0 * aIusPerDecimil;
  272. SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
  273. }
  274. /** This is the core for postscript/PDF text alignment
  275. * It computes the transformation matrix to generate a user space
  276. * system aligned with the text. Even the PS uses the concat
  277. * operator to simplify PDF generation (concat is everything PDF
  278. * has to modify the CTM. Lots of parameters, both in and out.
  279. */
  280. void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
  281. const wxString& aText,
  282. int aOrient,
  283. const wxSize& aSize,
  284. enum EDA_TEXT_HJUSTIFY_T aH_justify,
  285. enum EDA_TEXT_VJUSTIFY_T aV_justify,
  286. int aWidth,
  287. bool aItalic,
  288. bool aBold,
  289. double *wideningFactor,
  290. double *ctm_a,
  291. double *ctm_b,
  292. double *ctm_c,
  293. double *ctm_d,
  294. double *ctm_e,
  295. double *ctm_f,
  296. double *heightFactor )
  297. {
  298. // Compute the starting position (compensated for alignment)
  299. wxPoint start_pos = aPos;
  300. // This is an approximation of the text bounds (in IUs)
  301. int tw = returnPostscriptTextWidth( aText, aSize.x, aItalic, aWidth );
  302. int th = aSize.y;
  303. int dx, dy;
  304. switch( aH_justify )
  305. {
  306. case GR_TEXT_HJUSTIFY_CENTER:
  307. dx = -tw / 2;
  308. break;
  309. case GR_TEXT_HJUSTIFY_RIGHT:
  310. dx = -tw;
  311. break;
  312. case GR_TEXT_HJUSTIFY_LEFT:
  313. dx = 0;
  314. break;
  315. }
  316. switch( aV_justify )
  317. {
  318. case GR_TEXT_VJUSTIFY_CENTER:
  319. dy = th / 2;
  320. break;
  321. case GR_TEXT_VJUSTIFY_TOP:
  322. dy = th;
  323. break;
  324. case GR_TEXT_VJUSTIFY_BOTTOM:
  325. dy = 0;
  326. break;
  327. }
  328. RotatePoint( &dx, &dy, aOrient );
  329. RotatePoint( &tw, &th, aOrient );
  330. start_pos.x += dx;
  331. start_pos.y += dy;
  332. DPOINT pos_dev = userToDeviceCoordinates( start_pos );
  333. DPOINT sz_dev = userToDeviceSize( aSize );
  334. // Now returns the final values... the widening factor
  335. *wideningFactor = sz_dev.y / sz_dev.x;
  336. // The CTM transformation matrix
  337. double alpha = DECIDEG2RAD( aOrient );
  338. double sinalpha = sin( alpha );
  339. double cosalpha = cos( alpha );
  340. *ctm_a = cosalpha;
  341. *ctm_b = sinalpha;
  342. *ctm_c = -sinalpha;
  343. *ctm_d = cosalpha;
  344. *ctm_e = pos_dev.x;
  345. *ctm_f = pos_dev.y;
  346. // This is because the letters are less than 1 unit high
  347. *heightFactor = sz_dev.y / postscriptTextAscent;
  348. }
  349. /* Set the current line width (in IUs) for the next plot
  350. */
  351. void PS_PLOTTER::SetCurrentLineWidth( int width )
  352. {
  353. wxASSERT( outputFile );
  354. int pen_width;
  355. if( width >= 0 )
  356. pen_width = width;
  357. else
  358. pen_width = defaultPenWidth;
  359. if( pen_width != currentPenWidth )
  360. fprintf( outputFile, "%g setlinewidth\n",
  361. userToDeviceSize( pen_width ) );
  362. currentPenWidth = pen_width;
  363. }
  364. void PS_PLOTTER::emitSetRGBColor( double r, double g, double b )
  365. {
  366. wxASSERT( outputFile );
  367. // XXX why %.3g ? shouldn't %g suffice? who cares...
  368. fprintf( outputFile, "%.3g %.3g %.3g setrgbcolor\n", r, g, b );
  369. }
  370. /**
  371. * Postscript supports dashed lines
  372. */
  373. void PS_PLOTTER::SetDash( bool dashed )
  374. {
  375. wxASSERT( outputFile );
  376. if( dashed )
  377. fputs( "dashedline\n", outputFile );
  378. else
  379. fputs( "solidline\n", outputFile );
  380. }
  381. void PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width )
  382. {
  383. DPOINT p1_dev = userToDeviceCoordinates( p1 );
  384. DPOINT p2_dev = userToDeviceCoordinates( p2 );
  385. SetCurrentLineWidth( width );
  386. fprintf( outputFile, "%g %g %g %g rect%d\n", p1_dev.x, p1_dev.y,
  387. p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, fill );
  388. }
  389. void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width )
  390. {
  391. wxASSERT( outputFile );
  392. DPOINT pos_dev = userToDeviceCoordinates( pos );
  393. double radius = userToDeviceSize( diametre / 2.0 );
  394. SetCurrentLineWidth( width );
  395. fprintf( outputFile, "%g %g %g cir%d\n", pos_dev.x, pos_dev.y, radius, fill );
  396. }
  397. void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
  398. int radius, FILL_T fill, int width )
  399. {
  400. wxASSERT( outputFile );
  401. if( radius <= 0 )
  402. return;
  403. if( StAngle > EndAngle )
  404. EXCHG( StAngle, EndAngle );
  405. SetCurrentLineWidth( width );
  406. // Calculate start point.
  407. DPOINT centre_dev = userToDeviceCoordinates( centre );
  408. double radius_dev = userToDeviceSize( radius );
  409. if( m_plotMirror )
  410. {
  411. if( m_mirrorIsHorizontal )
  412. {
  413. StAngle = 1800.0 -StAngle;
  414. EndAngle = 1800.0 -EndAngle;
  415. EXCHG( StAngle, EndAngle );
  416. }
  417. else
  418. {
  419. StAngle = -StAngle;
  420. EndAngle = -EndAngle;
  421. }
  422. }
  423. fprintf( outputFile, "%g %g %g %g %g arc%d\n", centre_dev.x, centre_dev.y,
  424. radius_dev, StAngle / 10.0, EndAngle / 10.0, fill );
  425. }
  426. void PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
  427. FILL_T aFill, int aWidth )
  428. {
  429. if( aCornerList.size() <= 1 )
  430. return;
  431. SetCurrentLineWidth( aWidth );
  432. DPOINT pos = userToDeviceCoordinates( aCornerList[0] );
  433. fprintf( outputFile, "newpath\n%g %g moveto\n", pos.x, pos.y );
  434. for( unsigned ii = 1; ii < aCornerList.size(); ii++ )
  435. {
  436. pos = userToDeviceCoordinates( aCornerList[ii] );
  437. fprintf( outputFile, "%g %g lineto\n", pos.x, pos.y );
  438. }
  439. // Close/(fill) the path
  440. fprintf( outputFile, "poly%d\n", aFill );
  441. }
  442. /**
  443. * Postscript-likes at the moment are the only plot engines supporting bitmaps...
  444. */
  445. void PS_PLOTTER::PlotImage( const wxImage & aImage, const wxPoint& aPos,
  446. double aScaleFactor )
  447. {
  448. wxSize pix_size; // size of the bitmap in pixels
  449. pix_size.x = aImage.GetWidth();
  450. pix_size.y = aImage.GetHeight();
  451. DPOINT drawsize( aScaleFactor * pix_size.x,
  452. aScaleFactor * pix_size.y ); // requested size of image
  453. // calculate the bottom left corner position of bitmap
  454. wxPoint start = aPos;
  455. start.x -= drawsize.x / 2; // left
  456. start.y += drawsize.y / 2; // bottom (Y axis reversed)
  457. // calculate the top right corner position of bitmap
  458. wxPoint end;
  459. end.x = start.x + drawsize.x;
  460. end.y = start.y - drawsize.y;
  461. fprintf( outputFile, "/origstate save def\n" );
  462. fprintf( outputFile, "/pix %d string def\n", pix_size.x );
  463. // Locate lower-left corner of image
  464. DPOINT start_dev = userToDeviceCoordinates( start );
  465. fprintf( outputFile, "%g %g translate\n", start_dev.x, start_dev.y );
  466. // Map image size to device
  467. DPOINT end_dev = userToDeviceCoordinates( end );
  468. fprintf( outputFile, "%g %g scale\n",
  469. std::abs(end_dev.x - start_dev.x), std::abs(end_dev.y - start_dev.y));
  470. // Dimensions of source image (in pixels
  471. fprintf( outputFile, "%d %d 8", pix_size.x, pix_size.y );
  472. // Map unit square to source
  473. fprintf( outputFile, " [%d 0 0 %d 0 %d]\n", pix_size.x, -pix_size.y , pix_size.y);
  474. // include image data in ps file
  475. fprintf( outputFile, "{currentfile pix readhexstring pop}\n" );
  476. if( colorMode )
  477. fputs( "false 3 colorimage\n", outputFile );
  478. else
  479. fputs( "image\n", outputFile );
  480. // Single data source, 3 colors, Output RGB data (hexadecimal)
  481. // (or the same downscaled to gray)
  482. int jj = 0;
  483. for( int yy = 0; yy < pix_size.y; yy ++ )
  484. {
  485. for( int xx = 0; xx < pix_size.x; xx++, jj++ )
  486. {
  487. if( jj >= 16 )
  488. {
  489. jj = 0;
  490. fprintf( outputFile, "\n");
  491. }
  492. int red, green, blue;
  493. red = aImage.GetRed( xx, yy) & 0xFF;
  494. green = aImage.GetGreen( xx, yy) & 0xFF;
  495. blue = aImage.GetBlue( xx, yy) & 0xFF;
  496. if( colorMode )
  497. fprintf( outputFile, "%2.2X%2.2X%2.2X", red, green, blue );
  498. else
  499. fprintf( outputFile, "%2.2X", (red + green + blue) / 3 );
  500. }
  501. }
  502. fprintf( outputFile, "\n");
  503. fprintf( outputFile, "origstate restore\n" );
  504. }
  505. void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
  506. {
  507. wxASSERT( outputFile );
  508. if( plume == 'Z' )
  509. {
  510. if( penState != 'Z' )
  511. {
  512. fputs( "stroke\n", outputFile );
  513. penState = 'Z';
  514. penLastpos.x = -1;
  515. penLastpos.y = -1;
  516. }
  517. return;
  518. }
  519. if( penState == 'Z' )
  520. {
  521. fputs( "newpath\n", outputFile );
  522. }
  523. if( penState != plume || pos != penLastpos )
  524. {
  525. DPOINT pos_dev = userToDeviceCoordinates( pos );
  526. fprintf( outputFile, "%g %g %sto\n",
  527. pos_dev.x, pos_dev.y,
  528. ( plume=='D' ) ? "line" : "move" );
  529. }
  530. penState = plume;
  531. penLastpos = pos;
  532. }
  533. /**
  534. * The code within this function (and the CloseFilePS function)
  535. * creates postscript files whose contents comply with Adobe's
  536. * Document Structuring Convention, as documented by assorted
  537. * details described within the following URLs:
  538. *
  539. * http://en.wikipedia.org/wiki/Document_Structuring_Conventions
  540. * http://partners.adobe.com/public/developer/en/ps/5001.DSC_Spec.pdf
  541. *
  542. *
  543. * BBox is the boundary box (position and size of the "client rectangle"
  544. * for drawings (page - margins) in mils (0.001 inch)
  545. */
  546. bool PS_PLOTTER::StartPlot()
  547. {
  548. wxASSERT( outputFile );
  549. wxString msg;
  550. static const char* PSMacro[] =
  551. {
  552. "%%BeginProlog\n"
  553. "/line { newpath moveto lineto stroke } bind def\n",
  554. "/cir0 { newpath 0 360 arc stroke } bind def\n",
  555. "/cir1 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
  556. "/cir2 { newpath 0 360 arc gsave fill grestore stroke } bind def\n",
  557. "/arc0 { newpath arc stroke } bind def\n",
  558. "/arc1 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
  559. " grestore stroke } bind def\n",
  560. "/arc2 { newpath 4 index 4 index moveto arc closepath gsave fill\n",
  561. " grestore stroke } bind def\n",
  562. "/poly0 { stroke } bind def\n",
  563. "/poly1 { closepath gsave fill grestore stroke } bind def\n",
  564. "/poly2 { closepath gsave fill grestore stroke } bind def\n",
  565. "/rect0 { rectstroke } bind def\n",
  566. "/rect1 { rectfill } bind def\n",
  567. "/rect2 { rectfill } bind def\n",
  568. "/linemode0 { 0 setlinecap 0 setlinejoin 0 setlinewidth } bind def\n",
  569. "/linemode1 { 1 setlinecap 1 setlinejoin } bind def\n",
  570. "/dashedline { [200] 100 setdash } bind def\n",
  571. "/solidline { [] 0 setdash } bind def\n",
  572. // This is for 'hidden' text (search anchors for PDF)
  573. "/phantomshow { moveto\n",
  574. " /KicadFont findfont 0.000001 scalefont setfont\n",
  575. " show } bind def\n",
  576. // This is for regular postscript text
  577. "/textshow { gsave\n",
  578. " findfont exch scalefont setfont concat 1 scale 0 0 moveto show\n",
  579. " } bind def\n",
  580. // Utility for getting Latin1 encoded fonts
  581. "/reencodefont {\n",
  582. " findfont dup length dict begin\n",
  583. " { 1 index /FID ne\n",
  584. " { def }\n",
  585. " { pop pop } ifelse\n",
  586. " } forall\n",
  587. " /Encoding ISOLatin1Encoding def\n",
  588. " currentdict\n",
  589. " end } bind def\n"
  590. // Remap AdobeStandard fonts to Latin1
  591. "/KicadFont /Helvetica reencodefont definefont pop\n",
  592. "/KicadFont-Bold /Helvetica-Bold reencodefont definefont pop\n",
  593. "/KicadFont-Oblique /Helvetica-Oblique reencodefont definefont pop\n",
  594. "/KicadFont-BoldOblique /Helvetica-BoldOblique reencodefont definefont pop\n",
  595. "%%EndProlog\n",
  596. NULL
  597. };
  598. time_t time1970 = time( NULL );
  599. fputs( "%!PS-Adobe-3.0\n", outputFile ); // Print header
  600. fprintf( outputFile, "%%%%Creator: %s\n", TO_UTF8( creator ) );
  601. /* A "newline" character ("\n") is not included in the following string,
  602. because it is provided by the ctime() function. */
  603. fprintf( outputFile, "%%%%CreationDate: %s", ctime( &time1970 ) );
  604. fprintf( outputFile, "%%%%Title: %s\n", TO_UTF8( filename ) );
  605. fprintf( outputFile, "%%%%Pages: 1\n" );
  606. fprintf( outputFile, "%%%%PageOrder: Ascend\n" );
  607. // Print boundary box in 1/72 pixels per inch, box is in mils
  608. const double BIGPTsPERMIL = 0.072;
  609. /* The coordinates of the lower left corner of the boundary
  610. box need to be "rounded down", but the coordinates of its
  611. upper right corner need to be "rounded up" instead. */
  612. wxSize psPaperSize = pageInfo.GetSizeMils();
  613. if( !pageInfo.IsPortrait() )
  614. psPaperSize.Set( pageInfo.GetHeightMils(), pageInfo.GetWidthMils() );
  615. fprintf( outputFile, "%%%%BoundingBox: 0 0 %d %d\n",
  616. (int) ceil( psPaperSize.x * BIGPTsPERMIL ),
  617. (int) ceil( psPaperSize.y * BIGPTsPERMIL ) );
  618. // Specify the size of the sheet and the name associated with that size.
  619. // (If the "User size" option has been selected for the sheet size,
  620. // identify the sheet size as "Custom" (rather than as "User"), but
  621. // otherwise use the name assigned by KiCad for each sheet size.)
  622. //
  623. // (The Document Structuring Convention also supports sheet weight,
  624. // sheet color, and sheet type properties being specified within a
  625. // %%DocumentMedia comment, but they are not being specified here;
  626. // a zero and two null strings are subsequently provided instead.)
  627. //
  628. // (NOTE: m_Size.y is *supposed* to be listed before m_Size.x;
  629. // the order in which they are specified is not wrong!)
  630. // Also note pageSize is given in mils, not in internal units and must be
  631. // converted to internal units.
  632. if( pageInfo.IsCustom() )
  633. fprintf( outputFile, "%%%%DocumentMedia: Custom %d %d 0 () ()\n",
  634. KiROUND( psPaperSize.x * BIGPTsPERMIL ),
  635. KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
  636. else // a standard paper size
  637. fprintf( outputFile, "%%%%DocumentMedia: %s %d %d 0 () ()\n",
  638. TO_UTF8( pageInfo.GetType() ),
  639. KiROUND( psPaperSize.x * BIGPTsPERMIL ),
  640. KiROUND( psPaperSize.y * BIGPTsPERMIL ) );
  641. if( pageInfo.IsPortrait() )
  642. fprintf( outputFile, "%%%%Orientation: Portrait\n" );
  643. else
  644. fprintf( outputFile, "%%%%Orientation: Landscape\n" );
  645. fprintf( outputFile, "%%%%EndComments\n" );
  646. // Now specify various other details.
  647. for( int ii = 0; PSMacro[ii] != NULL; ii++ )
  648. {
  649. fputs( PSMacro[ii], outputFile );
  650. }
  651. // The following string has been specified here (rather than within
  652. // PSMacro[]) to highlight that it has been provided to ensure that the
  653. // contents of the postscript file comply with the details specified
  654. // within the Document Structuring Convention.
  655. fputs( "%%Page: 1 1\n"
  656. "%%BeginPageSetup\n"
  657. "gsave\n"
  658. "0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
  659. "linemode1\n", outputFile );
  660. // Rototranslate the coordinate to achieve the landscape layout
  661. if( !pageInfo.IsPortrait() )
  662. fprintf( outputFile, "%d 0 translate 90 rotate\n", 10 * psPaperSize.x );
  663. // Apply the user fine scale adjustments
  664. if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
  665. fprintf( outputFile, "%g %g scale\n",
  666. plotScaleAdjX, plotScaleAdjY );
  667. // Set default line width
  668. fprintf( outputFile, "%g setlinewidth\n",
  669. userToDeviceSize( defaultPenWidth ) );
  670. fputs( "%%EndPageSetup\n", outputFile );
  671. return true;
  672. }
  673. bool PS_PLOTTER::EndPlot()
  674. {
  675. wxASSERT( outputFile );
  676. fputs( "showpage\n"
  677. "grestore\n"
  678. "%%EOF\n", outputFile );
  679. fclose( outputFile );
  680. outputFile = NULL;
  681. return true;
  682. }
  683. void PS_PLOTTER::Text( const wxPoint& aPos,
  684. enum EDA_COLOR_T aColor,
  685. const wxString& aText,
  686. double aOrient,
  687. const wxSize& aSize,
  688. enum EDA_TEXT_HJUSTIFY_T aH_justify,
  689. enum EDA_TEXT_VJUSTIFY_T aV_justify,
  690. int aWidth,
  691. bool aItalic,
  692. bool aBold,
  693. bool aMultilineAllowed )
  694. {
  695. SetCurrentLineWidth( aWidth );
  696. SetColor( aColor );
  697. // Fix me: see how to use PS text mode for multiline texts
  698. if( aMultilineAllowed && !aText.Contains( wxT( "\n" ) ) )
  699. aMultilineAllowed = false; // the text has only one line.
  700. // Draw the native postscript text (if requested)
  701. if( m_textMode == PLOTTEXTMODE_NATIVE && !aMultilineAllowed )
  702. {
  703. const char *fontname = aItalic ? (aBold ? "/KicadFont-BoldOblique"
  704. : "/KicadFont-Oblique")
  705. : (aBold ? "/KicadFont-Bold"
  706. : "/KicadFont");
  707. // Compute the copious tranformation parameters
  708. double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
  709. double wideningFactor, heightFactor;
  710. computeTextParameters( aPos, aText, aOrient, aSize, aH_justify,
  711. aV_justify, aWidth, aItalic, aBold,
  712. &wideningFactor, &ctm_a, &ctm_b, &ctm_c,
  713. &ctm_d, &ctm_e, &ctm_f, &heightFactor );
  714. // The text must be escaped correctly, the others are the various
  715. // parameters. The CTM is formatted with %f since sin/cos tends
  716. // to make %g use exponential notation (which is not supported)
  717. fputsPostscriptString( outputFile, aText );
  718. fprintf( outputFile, " %g [%f %f %f %f %f %f] %g %s textshow\n",
  719. wideningFactor, ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
  720. heightFactor, fontname );
  721. /* The textshow operator retained the coordinate system, we use it
  722. * to plot the overbars. See the PDF sister function for more
  723. * details */
  724. std::vector<int> pos_pairs;
  725. postscriptOverlinePositions( aText, aSize.x, aItalic, aBold, &pos_pairs );
  726. int overbar_y = KiROUND( aSize.y * 1.1 );
  727. for( unsigned i = 0; i < pos_pairs.size(); i += 2)
  728. {
  729. DPOINT dev_from = userToDeviceSize( wxSize( pos_pairs[i], overbar_y ) );
  730. DPOINT dev_to = userToDeviceSize( wxSize( pos_pairs[i + 1], overbar_y ) );
  731. fprintf( outputFile, "%g %g %g %g line ",
  732. dev_from.x, dev_from.y, dev_to.x, dev_to.y );
  733. }
  734. // Restore the CTM
  735. fputs( "grestore\n", outputFile );
  736. }
  737. // Draw the hidden postscript text (if requested)
  738. if( m_textMode == PLOTTEXTMODE_PHANTOM )
  739. {
  740. fputsPostscriptString( outputFile, aText );
  741. DPOINT pos_dev = userToDeviceCoordinates( aPos );
  742. fprintf( outputFile, " %g %g phantomshow\n",
  743. pos_dev.x, pos_dev.y );
  744. }
  745. // Draw the stroked text (if requested)
  746. if( m_textMode != PLOTTEXTMODE_NATIVE || aMultilineAllowed )
  747. {
  748. PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
  749. aWidth, aItalic, aBold, aMultilineAllowed );
  750. }
  751. }
  752. /**
  753. * Character widths for Helvetica
  754. */
  755. const double hv_widths[256] = {
  756. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  757. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  758. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  759. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  760. 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
  761. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  762. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  763. 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
  764. 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
  765. 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
  766. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  767. 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
  768. 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
  769. 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
  770. 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
  771. 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
  772. 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
  773. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  774. 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
  775. 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
  776. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
  777. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  778. 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
  779. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  780. 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
  781. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  782. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  783. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  784. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
  785. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  786. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
  787. 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
  788. };
  789. /**
  790. * Character widths for Helvetica-Bold
  791. */
  792. const double hvb_widths[256] = {
  793. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  794. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  795. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  796. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  797. 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
  798. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  799. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  800. 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
  801. 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
  802. 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
  803. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  804. 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
  805. 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
  806. 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
  807. 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
  808. 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
  809. 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
  810. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  811. 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
  812. 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
  813. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
  814. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  815. 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
  816. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  817. 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
  818. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  819. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  820. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  821. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
  822. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  823. 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
  824. 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
  825. };
  826. /**
  827. * Character widths for Helvetica-Oblique
  828. */
  829. const double hvo_widths[256] = {
  830. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  831. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  832. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  833. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  834. 0.278, 0.278, 0.355, 0.556, 0.556, 0.889, 0.667, 0.191,
  835. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  836. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  837. 0.556, 0.556, 0.278, 0.278, 0.584, 0.584, 0.584, 0.556,
  838. 1.015, 0.667, 0.667, 0.722, 0.722, 0.667, 0.611, 0.778,
  839. 0.722, 0.278, 0.500, 0.667, 0.556, 0.833, 0.722, 0.778,
  840. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  841. 0.667, 0.667, 0.611, 0.278, 0.278, 0.278, 0.469, 0.556,
  842. 0.333, 0.556, 0.556, 0.500, 0.556, 0.556, 0.278, 0.556,
  843. 0.556, 0.222, 0.222, 0.500, 0.222, 0.833, 0.556, 0.556,
  844. 0.556, 0.556, 0.333, 0.500, 0.278, 0.556, 0.500, 0.722,
  845. 0.500, 0.500, 0.500, 0.334, 0.260, 0.334, 0.584, 0.278,
  846. 0.278, 0.278, 0.222, 0.556, 0.333, 1.000, 0.556, 0.556,
  847. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  848. 0.278, 0.222, 0.222, 0.333, 0.333, 0.350, 0.556, 1.000,
  849. 0.333, 1.000, 0.500, 0.333, 0.944, 0.278, 0.278, 0.667,
  850. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.260, 0.556,
  851. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  852. 0.400, 0.584, 0.333, 0.333, 0.333, 0.556, 0.537, 0.278,
  853. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  854. 0.667, 0.667, 0.667, 0.667, 0.667, 0.667, 1.000, 0.722,
  855. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  856. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  857. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  858. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.500,
  859. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  860. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584,
  861. 0.611, 0.556, 0.556, 0.556, 0.556, 0.500, 0.556, 0.500
  862. };
  863. /**
  864. * Character widths for Helvetica-BoldOblique
  865. */
  866. const double hvbo_widths[256] = {
  867. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  868. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  869. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  870. 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278, 0.278,
  871. 0.278, 0.333, 0.474, 0.556, 0.556, 0.889, 0.722, 0.238,
  872. 0.333, 0.333, 0.389, 0.584, 0.278, 0.333, 0.278, 0.278,
  873. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556,
  874. 0.556, 0.556, 0.333, 0.333, 0.584, 0.584, 0.584, 0.611,
  875. 0.975, 0.722, 0.722, 0.722, 0.722, 0.667, 0.611, 0.778,
  876. 0.722, 0.278, 0.556, 0.722, 0.611, 0.833, 0.722, 0.778,
  877. 0.667, 0.778, 0.722, 0.667, 0.611, 0.722, 0.667, 0.944,
  878. 0.667, 0.667, 0.611, 0.333, 0.278, 0.333, 0.584, 0.556,
  879. 0.333, 0.556, 0.611, 0.556, 0.611, 0.556, 0.333, 0.611,
  880. 0.611, 0.278, 0.278, 0.556, 0.278, 0.889, 0.611, 0.611,
  881. 0.611, 0.611, 0.389, 0.556, 0.333, 0.611, 0.556, 0.778,
  882. 0.556, 0.556, 0.500, 0.389, 0.280, 0.389, 0.584, 0.278,
  883. 0.278, 0.278, 0.278, 0.556, 0.500, 1.000, 0.556, 0.556,
  884. 0.333, 1.000, 0.667, 0.333, 1.000, 0.278, 0.278, 0.278,
  885. 0.278, 0.278, 0.278, 0.500, 0.500, 0.350, 0.556, 1.000,
  886. 0.333, 1.000, 0.556, 0.333, 0.944, 0.278, 0.278, 0.667,
  887. 0.278, 0.333, 0.556, 0.556, 0.556, 0.556, 0.280, 0.556,
  888. 0.333, 0.737, 0.370, 0.556, 0.584, 0.333, 0.737, 0.333,
  889. 0.400, 0.584, 0.333, 0.333, 0.333, 0.611, 0.556, 0.278,
  890. 0.333, 0.333, 0.365, 0.556, 0.834, 0.834, 0.834, 0.611,
  891. 0.722, 0.722, 0.722, 0.722, 0.722, 0.722, 1.000, 0.722,
  892. 0.667, 0.667, 0.667, 0.667, 0.278, 0.278, 0.278, 0.278,
  893. 0.722, 0.722, 0.778, 0.778, 0.778, 0.778, 0.778, 0.584,
  894. 0.778, 0.722, 0.722, 0.722, 0.722, 0.667, 0.667, 0.611,
  895. 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.889, 0.556,
  896. 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
  897. 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584,
  898. 0.611, 0.611, 0.611, 0.611, 0.611, 0.556, 0.611, 0.556
  899. };