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.

885 lines
24 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
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. /**
  25. * @file gerbview_frame.cpp
  26. */
  27. #include <fctsys.h>
  28. #include <kiface_i.h>
  29. #include <wxstruct.h>
  30. #include <class_drawpanel.h>
  31. #include <build_version.h>
  32. #include <macros.h>
  33. #include <trigo.h>
  34. #include <base_units.h>
  35. #include <colors_selection.h>
  36. #include <class_gbr_layer_box_selector.h>
  37. #include <msgpanel.h>
  38. #include <gerbview.h>
  39. #include <gerbview_frame.h>
  40. #include <class_gerber_draw_item.h>
  41. #include <pcbplot.h>
  42. #include <gerbview_id.h>
  43. #include <hotkeys.h>
  44. #include <class_GERBER.h>
  45. #include <dialog_helpers.h>
  46. #include <class_DCodeSelectionbox.h>
  47. #include <class_gerbview_layer_widget.h>
  48. #include <class_gbr_screen.h>
  49. // Config keywords
  50. static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) );
  51. static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
  52. static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
  53. static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
  54. /*************************************/
  55. /* class GERBVIEW_FRAME for GerbView */
  56. /*************************************/
  57. #define GERBVIEW_FRAME_NAME wxT( "GerberFrame" )
  58. GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
  59. EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
  60. wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
  61. {
  62. m_colorsSettings = &g_ColorsSettings;
  63. m_gerberLayout = NULL;
  64. m_FrameName = GERBVIEW_FRAME_NAME;
  65. m_show_layer_manager_tools = true;
  66. m_showAxis = true; // true to show X and Y axis on screen
  67. m_showBorderAndTitleBlock = false; // true for reference drawings.
  68. m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
  69. m_SelLayerBox = NULL;
  70. m_DCodeSelector = NULL;
  71. m_displayMode = 0;
  72. m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 );
  73. if( m_canvas )
  74. m_canvas->SetEnableBlockCommands( true );
  75. // Give an icon
  76. wxIcon icon;
  77. icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
  78. SetIcon( icon );
  79. SetLayout( new GBR_LAYOUT() );
  80. SetVisibleLayers( -1 ); // All draw layers visible.
  81. SetScreen( new GBR_SCREEN( GetGerberLayout()->GetPageSettings().GetSizeIU() ) );
  82. // Create the PCB_LAYER_WIDGET *after* SetLayout():
  83. wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
  84. int pointSize = font.GetPointSize();
  85. int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
  86. if( screenHeight <= 900 )
  87. pointSize = (pointSize * 8) / 10;
  88. m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );
  89. // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
  90. // initialize parameters in m_LayersManager
  91. LoadSettings( config() );
  92. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  93. if( m_LastGridSizeId < 0 )
  94. m_LastGridSizeId = 0;
  95. if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
  96. m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000;
  97. GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
  98. ReCreateMenuBar();
  99. ReCreateHToolbar();
  100. ReCreateOptToolbar();
  101. m_auimgr.SetManagedWindow( this );
  102. EDA_PANEINFO horiz;
  103. horiz.HorizontalToolbarPane();
  104. EDA_PANEINFO vert;
  105. vert.VerticalToolbarPane();
  106. EDA_PANEINFO mesg;
  107. mesg.MessageToolbarPane();
  108. EDA_PANEINFO lyrs;
  109. lyrs.LayersToolbarPane();
  110. lyrs.MinSize( m_LayersManager->GetBestSize() );
  111. lyrs.BestSize( m_LayersManager->GetBestSize() );
  112. lyrs.Caption( _( "Visibles" ) );
  113. if( m_mainToolBar )
  114. m_auimgr.AddPane( m_mainToolBar,
  115. wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
  116. if( m_drawToolBar )
  117. m_auimgr.AddPane( m_drawToolBar,
  118. wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
  119. m_auimgr.AddPane( m_LayersManager,
  120. lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );
  121. if( m_optionsToolBar )
  122. m_auimgr.AddPane( m_optionsToolBar,
  123. wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
  124. if( m_canvas )
  125. m_auimgr.AddPane( m_canvas,
  126. wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
  127. if( m_messagePanel )
  128. m_auimgr.AddPane( m_messagePanel,
  129. wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
  130. ReFillLayerWidget(); // this is near end because contents establish size
  131. m_LayersManager->ReFillRender(); // Update colors in Render after the config is read
  132. m_auimgr.Update();
  133. setActiveLayer( 0, true );
  134. Zoom_Automatique( true ); // Gives a default zoom value
  135. }
  136. GERBVIEW_FRAME::~GERBVIEW_FRAME()
  137. {
  138. }
  139. void GERBVIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
  140. {
  141. Destroy();
  142. }
  143. bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
  144. {
  145. const unsigned limit = std::min( unsigned( aFileSet.size() ), unsigned( GERBER_DRAWLAYERS_COUNT ) );
  146. int layer = 0;
  147. for( unsigned i=0; i<limit; ++i, ++layer )
  148. {
  149. setActiveLayer( layer );
  150. LoadGerberFiles( aFileSet[i] );
  151. }
  152. Zoom_Automatique( true ); // Zoom fit in frame
  153. UpdateTitleAndInfo();
  154. return true;
  155. }
  156. double GERBVIEW_FRAME::BestZoom()
  157. {
  158. GERBER_DRAW_ITEM* item = GetGerberLayout()->m_Drawings;
  159. // gives a minimal value to zoom, if no item in list
  160. if( item == NULL )
  161. return ZOOM_FACTOR( 350.0 );
  162. EDA_RECT bbox = GetGerberLayout()->ComputeBoundingBox();
  163. wxSize size = m_canvas->GetClientSize();
  164. double x = (double) bbox.GetWidth() / (double) size.x;
  165. double y = (double) bbox.GetHeight() / (double) size.y;
  166. SetScrollCenterPosition( bbox.Centre() );
  167. double best_zoom = std::max( x, y );
  168. return best_zoom;
  169. }
  170. void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
  171. {
  172. EDA_DRAW_FRAME::LoadSettings( aCfg );
  173. // was: wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() );
  174. wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
  175. PAGE_INFO pageInfo( wxT( "GERBER" ) );
  176. aCfg->Read( cfgShowBorderAndTitleBlock, &m_showBorderAndTitleBlock, false );
  177. if( m_showBorderAndTitleBlock )
  178. {
  179. wxString pageType;
  180. aCfg->Read( cfgShowPageSizeOption, &pageType, wxT( "GERBER" ) );
  181. pageInfo.SetType( pageType );
  182. }
  183. SetPageSettings( pageInfo );
  184. GetScreen()->InitDataPoints( pageInfo.GetSizeIU() );
  185. bool tmp;
  186. aCfg->Read( cfgShowDCodes, &tmp, true );
  187. SetElementVisibility( DCODES_VISIBLE, tmp );
  188. aCfg->Read( cfgShowNegativeObjects, &tmp, false );
  189. SetElementVisibility( NEGATIVE_OBJECTS_VISIBLE, tmp );
  190. // because we have 2 file historues, we must read this one
  191. // using a specific path
  192. aCfg->SetPath( wxT( "drl_files" ) );
  193. m_drillFileHistory.Load( *aCfg );
  194. aCfg->SetPath( wxT( ".." ) );
  195. // WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
  196. // when reading doubles in config,
  197. // but forget to back to current locale. So we call SetLocaleTo_Default
  198. SetLocaleTo_Default();
  199. }
  200. void GERBVIEW_FRAME::SaveSettings( wxConfigBase* aCfg )
  201. {
  202. EDA_DRAW_FRAME::SaveSettings( aCfg );
  203. // was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
  204. wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
  205. aCfg->Write( cfgShowPageSizeOption, GetPageSettings().GetType() );
  206. aCfg->Write( cfgShowBorderAndTitleBlock, m_showBorderAndTitleBlock );
  207. aCfg->Write( cfgShowDCodes, IsElementVisible( DCODES_VISIBLE ) );
  208. aCfg->Write( cfgShowNegativeObjects,
  209. IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) );
  210. // Save the drill file history list.
  211. // Because we have 2 file histories, we must save this one
  212. // in a specific path
  213. aCfg->SetPath( wxT( "drl_files" ) );
  214. m_drillFileHistory.Save( *aCfg );
  215. aCfg->SetPath( wxT( ".." ) );
  216. }
  217. void GERBVIEW_FRAME::ReFillLayerWidget()
  218. {
  219. m_LayersManager->ReFill();
  220. wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
  221. wxSize bestz = m_LayersManager->GetBestSize();
  222. lyrs.MinSize( bestz );
  223. lyrs.BestSize( bestz );
  224. lyrs.FloatingSize( bestz );
  225. if( lyrs.IsDocked() )
  226. m_auimgr.Update();
  227. else
  228. m_LayersManager->SetSize( bestz );
  229. syncLayerWidget();
  230. }
  231. /**
  232. * Function SetElementVisibility
  233. * changes the visibility of an element category
  234. * @param aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID
  235. * @param aNewState = The new visibility state of the element category
  236. */
  237. void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible,
  238. bool aNewState )
  239. {
  240. switch( aItemIdVisible )
  241. {
  242. case DCODES_VISIBLE:
  243. m_DisplayOptions.m_DisplayDCodes = aNewState;
  244. break;
  245. case NEGATIVE_OBJECTS_VISIBLE:
  246. m_DisplayOptions.m_DisplayNegativeObjects = aNewState;
  247. break;
  248. case GERBER_GRID_VISIBLE:
  249. SetGridVisibility( aNewState );
  250. break;
  251. default:
  252. wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aItemIdVisible );
  253. }
  254. m_LayersManager->SetRenderState( aItemIdVisible, aNewState );
  255. }
  256. int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const
  257. {
  258. int layer = aLayer;
  259. for( int i = 0; i < GERBER_DRAWLAYERS_COUNT; ++i )
  260. {
  261. GERBER_IMAGE* gerber = g_GERBER_List[ layer ];
  262. if( gerber == NULL || gerber->m_FileName.IsEmpty() )
  263. return layer;
  264. ++layer;
  265. if( layer >= GERBER_DRAWLAYERS_COUNT )
  266. layer = 0;
  267. }
  268. return NO_AVAILABLE_LAYERS;
  269. }
  270. void GERBVIEW_FRAME::syncLayerWidget()
  271. {
  272. m_LayersManager->SelectLayer( getActiveLayer() );
  273. UpdateTitleAndInfo();
  274. }
  275. /**
  276. * Function syncLayerBox
  277. * updates the currently "selected" layer within m_SelLayerBox
  278. * The currently active layer, as defined by the return value of
  279. * getActiveLayer(). And updates the colored icon in the toolbar.
  280. */
  281. void GERBVIEW_FRAME::syncLayerBox()
  282. {
  283. m_SelLayerBox->SetSelection( getActiveLayer() );
  284. int dcodeSelected = -1;
  285. GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()];
  286. if( gerber )
  287. dcodeSelected = gerber->m_Selected_Tool;
  288. if( m_DCodeSelector )
  289. {
  290. m_DCodeSelector->SetDCodeSelection( dcodeSelected );
  291. m_DCodeSelector->Enable( gerber != NULL );
  292. }
  293. UpdateTitleAndInfo();
  294. }
  295. void GERBVIEW_FRAME::Liste_D_Codes()
  296. {
  297. int ii, jj;
  298. D_CODE* pt_D_code;
  299. wxString Line;
  300. wxArrayString list;
  301. double scale = g_UserUnit == INCHES ? IU_PER_MILS * 1000 :
  302. IU_PER_MM;
  303. int curr_layer = getActiveLayer();
  304. for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
  305. {
  306. GERBER_IMAGE* gerber = g_GERBER_List[layer];
  307. if( gerber == NULL )
  308. continue;
  309. if( gerber->UsedDcodeNumber() == 0 )
  310. continue;
  311. if( layer == curr_layer )
  312. Line.Printf( wxT( "*** Active layer (%2.2d) ***" ), layer + 1 );
  313. else
  314. Line.Printf( wxT( "*** layer %2.2d ***" ), layer + 1 );
  315. list.Add( Line );
  316. const char* units = g_UserUnit == INCHES ? "\"" : "mm";
  317. for( ii = 0, jj = 1; ii < TOOLS_MAX_COUNT; ii++ )
  318. {
  319. pt_D_code = gerber->GetDCODE( ii + FIRST_DCODE, false );
  320. if( pt_D_code == NULL )
  321. continue;
  322. if( !pt_D_code->m_InUse && !pt_D_code->m_Defined )
  323. continue;
  324. Line.Printf( wxT( "tool %2.2d: D%2.2d V %.4f %s H %.4f %s %s " ),
  325. jj,
  326. pt_D_code->m_Num_Dcode,
  327. pt_D_code->m_Size.y / scale, units,
  328. pt_D_code->m_Size.x / scale, units,
  329. D_CODE::ShowApertureType( pt_D_code->m_Shape )
  330. );
  331. if( !pt_D_code->m_Defined )
  332. Line += wxT( "(not used)" );
  333. if( !pt_D_code->m_InUse )
  334. Line += wxT( "(in use)" );
  335. list.Add( Line );
  336. jj++;
  337. }
  338. }
  339. #if wxCHECK_VERSION( 2, 9, 4 )
  340. wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (void**) NULL,
  341. wxCHOICEDLG_STYLE & ~wxCANCEL );
  342. #else
  343. wxSingleChoiceDialog dlg( this, wxEmptyString, _( "D Codes" ), list, (char**) NULL,
  344. wxCHOICEDLG_STYLE & ~wxCANCEL );
  345. #endif
  346. dlg.ShowModal();
  347. }
  348. /*
  349. * Function UpdateTitleAndInfo
  350. * displays the short filename (if exists) of the selected layer
  351. * on the caption of the main GerbView window
  352. * displays image name and the last layer name (found in the gerber file: LN <name> command)
  353. * in the status bar
  354. * Note layer name can change when reading a gerber file, and the layer name is the last found.
  355. * So, show the layer name is not very useful, and can be seen as a debug feature.
  356. */
  357. void GERBVIEW_FRAME::UpdateTitleAndInfo()
  358. {
  359. GERBER_IMAGE* gerber = g_GERBER_List[ getActiveLayer() ];
  360. wxString text;
  361. // Display the gerber filename
  362. if( gerber == NULL )
  363. {
  364. text.Printf( wxT( "GerbView %s" ), GetChars( GetBuildVersion() ) );
  365. SetTitle( text );
  366. SetStatusText( wxEmptyString, 0 );
  367. text.Printf( _( "Layer %d not in use" ), getActiveLayer() + 1 );
  368. m_TextInfo->SetValue( text );
  369. ClearMsgPanel();
  370. return;
  371. }
  372. text = _( "File:" );
  373. text << wxT( " " ) << gerber->m_FileName;
  374. SetTitle( text );
  375. gerber->DisplayImageInfo();
  376. // Display Image Name and Layer Name (from the current gerber data):
  377. text.Printf( _( "Image name: '%s' Layer name: '%s'" ),
  378. GetChars( gerber->m_ImageName ),
  379. GetChars( gerber->GetLayerParams().m_LayerName ) );
  380. SetStatusText( text, 0 );
  381. // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
  382. text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
  383. gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
  384. gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
  385. gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
  386. gerber->m_NoTrailingZeros ? 'T' : 'L' );
  387. m_TextInfo->SetValue( text );
  388. }
  389. /*
  390. * Function IsElementVisible
  391. * tests whether a given element category is visible
  392. * aItemIdVisible is an item id from the enum GERBER_VISIBLE_ID
  393. * return true if the element is visible.
  394. */
  395. bool GERBVIEW_FRAME::IsElementVisible( GERBER_VISIBLE_ID aItemIdVisible ) const
  396. {
  397. switch( aItemIdVisible )
  398. {
  399. case DCODES_VISIBLE:
  400. return m_DisplayOptions.m_DisplayDCodes;
  401. break;
  402. case NEGATIVE_OBJECTS_VISIBLE:
  403. return m_DisplayOptions.m_DisplayNegativeObjects;
  404. break;
  405. case GERBER_GRID_VISIBLE:
  406. return IsGridVisible();
  407. break;
  408. default:
  409. wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aItemIdVisible );
  410. }
  411. return true;
  412. }
  413. /**
  414. * Function SetVisibleAlls
  415. * Set the status of all layers to VISIBLE
  416. */
  417. void GERBVIEW_FRAME::SetVisibleAlls()
  418. {
  419. }
  420. /**
  421. * Function GetVisibleLayers
  422. * is a proxy function that calls the correspondent function in m_BoardSettings
  423. * Returns a bit-mask of all the layers that are visible
  424. * @return int - the visible layers in bit-mapped form.
  425. */
  426. long GERBVIEW_FRAME::GetVisibleLayers() const
  427. {
  428. return -1; // TODO
  429. }
  430. /**
  431. * Function SetVisibleLayers
  432. * is a proxy function that calls the correspondent function in m_BoardSettings
  433. * changes the bit-mask of visible layers
  434. * @param aLayerMask = The new bit-mask of visible layers
  435. */
  436. void GERBVIEW_FRAME::SetVisibleLayers( long aLayerMask )
  437. {
  438. // GetGerberLayout()->SetVisibleLayers( aLayerMask );
  439. }
  440. /**
  441. * Function IsLayerVisible
  442. * tests whether a given layer is visible
  443. * @param aLayer = The layer to be tested
  444. * @return bool - true if the layer is visible.
  445. */
  446. bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
  447. {
  448. if( ! m_DisplayOptions.m_IsPrinting )
  449. return m_LayersManager->IsLayerVisible( aLayer );
  450. else
  451. return GetGerberLayout()->IsLayerPrintable( aLayer );
  452. }
  453. /**
  454. * Function GetVisibleElementColor
  455. * returns the color of a pcb visible element.
  456. * @see enum PCB_VISIBLE
  457. */
  458. EDA_COLOR_T GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const
  459. {
  460. EDA_COLOR_T color = UNSPECIFIED_COLOR;
  461. switch( aItemIdVisible )
  462. {
  463. case NEGATIVE_OBJECTS_VISIBLE:
  464. case DCODES_VISIBLE:
  465. color = m_colorsSettings->GetItemColor( aItemIdVisible );
  466. break;
  467. case GERBER_GRID_VISIBLE:
  468. color = GetGridColor();
  469. break;
  470. default:
  471. wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ),
  472. (int)aItemIdVisible );
  473. }
  474. return color;
  475. }
  476. /*
  477. * Virtual from EDA_DRAW_FRAME
  478. */
  479. void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
  480. {
  481. EDA_DRAW_FRAME::SetGridVisibility( aVisible );
  482. m_LayersManager->SetRenderState( GERBER_GRID_VISIBLE, aVisible );
  483. }
  484. void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
  485. EDA_COLOR_T aColor )
  486. {
  487. switch( aItemIdVisible )
  488. {
  489. case NEGATIVE_OBJECTS_VISIBLE:
  490. case DCODES_VISIBLE:
  491. m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
  492. break;
  493. case GERBER_GRID_VISIBLE:
  494. SetGridColor( aColor );
  495. m_colorsSettings->SetItemColor( aItemIdVisible, aColor );
  496. break;
  497. default:
  498. wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ),
  499. (int) aItemIdVisible );
  500. }
  501. }
  502. /*
  503. * Function GetNegativeItemsColor
  504. * returns the color of negative items.
  505. * This is usually the background color, but can be an other color
  506. * in order to see negative objects
  507. * therefore returns the background color if negative items not visible
  508. * and the color selection of negative items if they are visible
  509. */
  510. EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
  511. {
  512. if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) )
  513. return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE );
  514. else
  515. return GetDrawBgColor();
  516. }
  517. /*
  518. * Function GetLayerColor
  519. * gets a layer color for any valid layer.
  520. */
  521. EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
  522. {
  523. return m_colorsSettings->GetLayerColor( aLayer );
  524. }
  525. /**
  526. * Function SetLayerColor
  527. * changes a layer color for any valid layer.
  528. */
  529. void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
  530. {
  531. m_colorsSettings->SetLayerColor( aLayer, aColor );
  532. }
  533. /**
  534. * Function getActiveLayer
  535. * returns the active layer
  536. */
  537. int GERBVIEW_FRAME::getActiveLayer()
  538. {
  539. return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer;
  540. }
  541. /**
  542. * Function setActiveLayer
  543. * will change the currently active layer to \a aLayer and also
  544. * update the PCB_LAYER_WIDGET.
  545. */
  546. void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate )
  547. {
  548. ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
  549. if( doLayerWidgetUpdate )
  550. m_LayersManager->SelectLayer( getActiveLayer() );
  551. }
  552. void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
  553. {
  554. wxASSERT( m_gerberLayout );
  555. m_gerberLayout->SetPageSettings( aPageSettings );
  556. if( GetScreen() )
  557. GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
  558. }
  559. const PAGE_INFO& GERBVIEW_FRAME::GetPageSettings() const
  560. {
  561. wxASSERT( m_gerberLayout );
  562. return m_gerberLayout->GetPageSettings();
  563. }
  564. const wxSize GERBVIEW_FRAME::GetPageSizeIU() const
  565. {
  566. wxASSERT( m_gerberLayout );
  567. // this function is only needed because EDA_DRAW_FRAME is not compiled
  568. // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
  569. // into an application specific source file.
  570. return m_gerberLayout->GetPageSettings().GetSizeIU();
  571. }
  572. const TITLE_BLOCK& GERBVIEW_FRAME::GetTitleBlock() const
  573. {
  574. wxASSERT( m_gerberLayout );
  575. return m_gerberLayout->GetTitleBlock();
  576. }
  577. void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
  578. {
  579. wxASSERT( m_gerberLayout );
  580. m_gerberLayout->SetTitleBlock( aTitleBlock );
  581. }
  582. const wxPoint& GERBVIEW_FRAME::GetAuxOrigin() const
  583. {
  584. wxASSERT( m_gerberLayout );
  585. return m_gerberLayout->GetAuxOrigin();
  586. }
  587. void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition )
  588. {
  589. wxASSERT( m_gerberLayout );
  590. m_gerberLayout->SetAuxOrigin( aPosition );
  591. }
  592. void GERBVIEW_FRAME::SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo )
  593. {
  594. GetScreen()->SetCurItem( aItem );
  595. if( aItem )
  596. {
  597. if( aDisplayInfo )
  598. {
  599. MSG_PANEL_ITEMS items;
  600. aItem->GetMsgPanelInfo( items );
  601. SetMsgPanel( items );
  602. }
  603. }
  604. else
  605. {
  606. EraseMsgBox();
  607. }
  608. }
  609. /*
  610. * Function GetGerberLayoutBoundingBox
  611. * returns the bounding box containing all gerber items.
  612. */
  613. EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox()
  614. {
  615. GetGerberLayout()->ComputeBoundingBox();
  616. return GetGerberLayout()->GetBoundingBox();
  617. }
  618. /*
  619. * Update the status bar information.
  620. */
  621. void GERBVIEW_FRAME::UpdateStatusBar()
  622. {
  623. EDA_DRAW_FRAME::UpdateStatusBar();
  624. GBR_SCREEN* screen = (GBR_SCREEN*) GetScreen();
  625. if( !screen )
  626. return;
  627. int dx;
  628. int dy;
  629. double dXpos;
  630. double dYpos;
  631. wxString line;
  632. wxString locformatter;
  633. if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
  634. {
  635. double theta, ro;
  636. dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
  637. dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
  638. // atan2 in the 0,0 case returns 0
  639. theta = RAD2DEG( atan2( -dy, dx ) );
  640. ro = hypot( dx, dy );
  641. wxString formatter;
  642. switch( g_UserUnit )
  643. {
  644. case INCHES:
  645. formatter = wxT( "Ro %.6f Th %.1f" );
  646. break;
  647. case MILLIMETRES:
  648. formatter = wxT( "Ro %.5f Th %.1f" );
  649. break;
  650. case UNSCALED_UNITS:
  651. formatter = wxT( "Ro %f Th %f" );
  652. break;
  653. }
  654. line.Printf( formatter, To_User_Unit( g_UserUnit, ro ), theta );
  655. SetStatusText( line, 3 );
  656. }
  657. // Display absolute coordinates:
  658. dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
  659. dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
  660. wxString absformatter;
  661. switch( g_UserUnit )
  662. {
  663. case INCHES:
  664. absformatter = wxT( "X %.6f Y %.6f" );
  665. locformatter = wxT( "dx %.6f dy %.6f d %.6f" );
  666. break;
  667. case MILLIMETRES:
  668. absformatter = wxT( "X %.5f Y %.5f" );
  669. locformatter = wxT( "dx %.5f dy %.5f d %.5f" );
  670. break;
  671. case UNSCALED_UNITS:
  672. absformatter = wxT( "X %f Y %f" );
  673. locformatter = wxT( "dx %f dy %f d %f" );
  674. break;
  675. }
  676. line.Printf( absformatter, dXpos, dYpos );
  677. SetStatusText( line, 2 );
  678. if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
  679. {
  680. // Display relative coordinates:
  681. dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
  682. dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
  683. dXpos = To_User_Unit( g_UserUnit, dx );
  684. dYpos = To_User_Unit( g_UserUnit, dy );
  685. // We already decided the formatter above
  686. line.Printf( locformatter, dXpos, dYpos, hypot( dXpos, dYpos ) );
  687. SetStatusText( line, 3 );
  688. }
  689. }