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.

773 lines
23 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
11 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2013 CERN
  5. * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
  6. * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file pl_editor_frame.cpp
  27. */
  28. #include <fctsys.h>
  29. #include <kiface_i.h>
  30. #include <class_drawpanel.h>
  31. #include <build_version.h>
  32. #include <macros.h>
  33. #include <base_units.h>
  34. #include <msgpanel.h>
  35. #include <bitmaps.h>
  36. #include <pl_editor_frame.h>
  37. #include <pl_editor_id.h>
  38. #include <hotkeys.h>
  39. #include <pl_editor_screen.h>
  40. #include <worksheet_shape_builder.h>
  41. #include <worksheet_dataitem.h>
  42. #include <design_tree_frame.h>
  43. #include <properties_frame.h>
  44. #include <wildcards_and_files_ext.h>
  45. #include <confirm.h>
  46. /*************************/
  47. /* class PL_EDITOR_FRAME */
  48. /*************************/
  49. PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
  50. EDA_DRAW_FRAME( aKiway, aParent, FRAME_PL_EDITOR, wxT( "PlEditorFrame" ),
  51. wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, PL_EDITOR_FRAME_NAME )
  52. {
  53. m_UserUnits = MILLIMETRES;
  54. m_zoomLevelCoeff = 290.0; // Adjusted to roughly displays zoom level = 1
  55. // when the screen shows a 1:1 image
  56. // obviously depends on the monitor,
  57. // but this is an acceptable value
  58. m_showAxis = false; // true to show X and Y axis on screen
  59. m_showGridAxis = true;
  60. m_showBorderAndTitleBlock = true; // true for reference drawings.
  61. m_hotkeysDescrList = PlEditorHokeysDescr;
  62. m_originSelectChoice = 0;
  63. SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
  64. SetShowPageLimits( true );
  65. m_designTreeWidth = 150;
  66. m_propertiesFrameWidth = 200;
  67. if( m_canvas )
  68. m_canvas->SetEnableBlockCommands( true );
  69. // Give an icon
  70. wxIcon icon;
  71. icon.CopyFromBitmap( KiBitmap( icon_pagelayout_editor_xpm ) );
  72. SetIcon( icon );
  73. wxSize pageSizeIU = GetPageLayout().GetPageSettings().GetSizeIU();
  74. SetScreen( new PL_EDITOR_SCREEN( pageSizeIU ) );
  75. LoadSettings( config() );
  76. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  77. if( ! GetScreen()->GridExists( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 ) )
  78. m_LastGridSizeId = ID_POPUP_GRID_LEVEL_1MM - ID_POPUP_GRID_LEVEL_1000;
  79. GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
  80. ReCreateMenuBar();
  81. ReCreateHToolbar();
  82. ReCreateOptToolbar();
  83. wxWindow* stsbar = GetStatusBar();
  84. int dims[] = {
  85. // balance of status bar on far left is set to a default or whatever is left over.
  86. -1,
  87. // When using GetTextSize() remember the width of '1' is not the same
  88. // as the width of '0' unless the font is fixed width, and it usually won't be.
  89. // zoom:
  90. GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10,
  91. // cursor coords
  92. GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10,
  93. // delta distances
  94. GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10,
  95. // Coord origin (use the bigger message)
  96. GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10,
  97. // units display, Inches is bigger than mm
  98. GetTextSize( _( "Inches" ), stsbar ).x + 10
  99. };
  100. SetStatusWidths( DIM( dims ), dims );
  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. m_propertiesPagelayout = new PROPERTIES_FRAME( this );
  109. EDA_PANEINFO props;
  110. props.LayersToolbarPane();
  111. props.MinSize( m_propertiesPagelayout->GetMinSize() );
  112. props.BestSize( m_propertiesFrameWidth, -1 );
  113. props.Caption( _( "Properties" ) );
  114. m_treePagelayout = new DESIGN_TREE_FRAME( this );
  115. EDA_PANEINFO tree;
  116. tree.LayersToolbarPane();
  117. tree.MinSize( m_treePagelayout->GetMinSize() );
  118. tree.BestSize( m_designTreeWidth, -1 );
  119. tree.Caption( _( "Design" ) );
  120. if( m_mainToolBar )
  121. m_auimgr.AddPane( m_mainToolBar,
  122. wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
  123. if( m_drawToolBar )
  124. m_auimgr.AddPane( m_drawToolBar,
  125. wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );
  126. m_auimgr.AddPane( m_propertiesPagelayout,
  127. props.Name( wxT( "m_propertiesPagelayout" ) ).Right().Layer( 1 ) );
  128. m_auimgr.AddPane( m_treePagelayout,
  129. tree.Name( wxT( "m_treePagelayout" ) ).Left().Layer( 0 ) );
  130. if( m_optionsToolBar )
  131. m_auimgr.AddPane( m_optionsToolBar,
  132. wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );
  133. if( m_canvas )
  134. m_auimgr.AddPane( m_canvas,
  135. wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane().Layer( 5 ) );
  136. if( m_messagePanel )
  137. m_auimgr.AddPane( m_messagePanel,
  138. wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer( 10 ) );
  139. m_auimgr.Update();
  140. // Initialize the current page layout
  141. WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
  142. #if 0 //start with empty layout
  143. pglayout.AllowVoidList( true );
  144. pglayout.ClearList();
  145. #else // start with the default Kicad layout
  146. pglayout.SetPageLayout();
  147. #endif
  148. OnNewPageLayout();
  149. }
  150. PL_EDITOR_FRAME::~PL_EDITOR_FRAME()
  151. {
  152. }
  153. bool PL_EDITOR_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
  154. {
  155. wxString fn = aFileSet[0];
  156. if( !LoadPageLayoutDescrFile( fn ) )
  157. {
  158. wxString msg = wxString::Format(
  159. _( "Error when loading file \"%s\"" ),
  160. GetChars( fn )
  161. );
  162. wxMessageBox( msg );
  163. return false;
  164. }
  165. else
  166. {
  167. OnNewPageLayout();
  168. return true;
  169. }
  170. }
  171. void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
  172. {
  173. if( GetScreen()->IsModify() )
  174. {
  175. wxString msg;
  176. wxString filename = GetCurrFileName();
  177. if( filename.IsEmpty() )
  178. msg = _( "Save changes in a new file before closing?" );
  179. else
  180. msg.Printf( _( "Save the changes in\n\"%s\"\nbefore closing?" ),
  181. GetChars( filename ) );
  182. int ii = DisplayExitDialog( this, msg );
  183. switch( ii )
  184. {
  185. case wxID_CANCEL:
  186. Event.Veto();
  187. return;
  188. case wxID_NO:
  189. break;
  190. case wxID_OK:
  191. case wxID_YES:
  192. {
  193. if( filename.IsEmpty() )
  194. {
  195. wxFileDialog openFileDialog( this, _( "Save As" ), wxEmptyString, wxEmptyString,
  196. PageLayoutDescrFileWildcard(), wxFD_SAVE );
  197. if(openFileDialog.ShowModal() == wxID_CANCEL )
  198. return;
  199. filename = openFileDialog.GetPath();
  200. }
  201. if( !SavePageLayoutDescrFile( filename ) )
  202. {
  203. msg.Printf( _( "Unable to create \"%s\"" ), GetChars( filename ) );
  204. wxMessageBox( msg );
  205. }
  206. }
  207. break;
  208. }
  209. }
  210. // do not show the window because we do not want any paint event
  211. Show( false );
  212. // was: Pgm().SaveCurrentSetupValues( m_configSettings );
  213. wxConfigSaveSetups( Kiface().KifaceSettings(), m_configSettings );
  214. // On Linux, m_propertiesPagelayout must be destroyed
  215. // before deleting the main frame to avoid a crash when closing
  216. m_propertiesPagelayout->Destroy();
  217. Destroy();
  218. }
  219. double PL_EDITOR_FRAME::BestZoom()
  220. {
  221. double sizeX = (double) GetPageLayout().GetPageSettings().GetWidthIU();
  222. double sizeY = (double) GetPageLayout().GetPageSettings().GetHeightIU();
  223. wxPoint centre( sizeX / 2, sizeY / 2 );
  224. // The sheet boundary already affords us some margin, so add only an
  225. // additional 5%.
  226. double margin_scale_factor = 1.05;
  227. return bestZoom( sizeX, sizeY, margin_scale_factor, centre );
  228. }
  229. static const wxChar designTreeWidthKey[] = wxT( "DesignTreeWidth" );
  230. static const wxChar propertiesFrameWidthKey[] = wxT( "PropertiesFrameWidth" );
  231. static const wxChar cornerOriginChoiceKey[] = wxT( "CornerOriginChoice" );
  232. static const wxChar blackBgColorKey[] = wxT( "BlackBgColor" );
  233. void PL_EDITOR_FRAME::LoadSettings( wxConfigBase* aCfg )
  234. {
  235. EDA_DRAW_FRAME::LoadSettings( aCfg );
  236. aCfg->Read( designTreeWidthKey, &m_designTreeWidth, 100);
  237. aCfg->Read( propertiesFrameWidthKey, &m_propertiesFrameWidth, 150);
  238. aCfg->Read( cornerOriginChoiceKey, &m_originSelectChoice );
  239. bool tmp;
  240. aCfg->Read( blackBgColorKey, &tmp, false );
  241. SetDrawBgColor( tmp ? BLACK : WHITE );
  242. }
  243. void PL_EDITOR_FRAME::SaveSettings( wxConfigBase* aCfg )
  244. {
  245. EDA_DRAW_FRAME::SaveSettings( aCfg );
  246. m_designTreeWidth = m_treePagelayout->GetSize().x;
  247. m_propertiesFrameWidth = m_propertiesPagelayout->GetSize().x;
  248. aCfg->Write( designTreeWidthKey, m_designTreeWidth);
  249. aCfg->Write( propertiesFrameWidthKey, m_propertiesFrameWidth);
  250. aCfg->Write( cornerOriginChoiceKey, m_originSelectChoice );
  251. aCfg->Write( blackBgColorKey, GetDrawBgColor() == BLACK );
  252. // was: wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
  253. wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
  254. }
  255. void PL_EDITOR_FRAME::UpdateTitleAndInfo()
  256. {
  257. wxString title;
  258. wxString file = GetCurrFileName();
  259. title.Printf( _( "Page Layout Editor" ) + wxT( " \u2014 %s" ),
  260. file.Length() ? file : _( "no file selected" ) );
  261. SetTitle( title );
  262. }
  263. const wxString& PL_EDITOR_FRAME::GetCurrFileName() const
  264. {
  265. return BASE_SCREEN::m_PageLayoutDescrFileName;
  266. }
  267. void PL_EDITOR_FRAME::SetCurrFileName( const wxString& aName )
  268. {
  269. BASE_SCREEN::m_PageLayoutDescrFileName = aName;
  270. }
  271. void PL_EDITOR_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
  272. {
  273. m_pageLayout.SetPageSettings( aPageSettings );
  274. if( GetScreen() )
  275. GetScreen()->InitDataPoints( aPageSettings.GetSizeIU() );
  276. }
  277. const PAGE_INFO& PL_EDITOR_FRAME::GetPageSettings() const
  278. {
  279. return m_pageLayout.GetPageSettings();
  280. }
  281. const wxSize PL_EDITOR_FRAME::GetPageSizeIU() const
  282. {
  283. // this function is only needed because EDA_DRAW_FRAME is not compiled
  284. // with either -DPCBNEW or -DEESCHEMA, so the virtual is used to route
  285. // into an application specific source file.
  286. return m_pageLayout.GetPageSettings().GetSizeIU();
  287. }
  288. const TITLE_BLOCK& PL_EDITOR_FRAME::GetTitleBlock() const
  289. {
  290. return GetPageLayout().GetTitleBlock();
  291. }
  292. void PL_EDITOR_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
  293. {
  294. m_pageLayout.SetTitleBlock( aTitleBlock );
  295. }
  296. void PL_EDITOR_FRAME::UpdateStatusBar()
  297. {
  298. PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
  299. if( !screen )
  300. return;
  301. // Display Zoom level:
  302. EDA_DRAW_FRAME::UpdateStatusBar();
  303. // coodinate origin can be the paper Top Left corner,
  304. // or each of 4 page corners
  305. // We know the origin, and the orientation of axis
  306. wxPoint originCoord;
  307. int Xsign = 1;
  308. int Ysign = 1;
  309. WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
  310. switch( m_originSelectChoice )
  311. {
  312. default:
  313. case 0: // Origin = paper Left Top corner
  314. break;
  315. case 1: // Origin = page Right Bottom corner
  316. Xsign = -1;
  317. Ysign = -1;
  318. dummy.SetStart( 0, 0, RB_CORNER );
  319. originCoord = dummy.GetStartPosUi();
  320. break;
  321. case 2: // Origin = page Left Bottom corner
  322. Ysign = -1;
  323. dummy.SetStart( 0, 0, LB_CORNER );
  324. originCoord = dummy.GetStartPosUi();
  325. break;
  326. case 3: // Origin = page Right Top corner
  327. Xsign = -1;
  328. dummy.SetStart( 0, 0, RT_CORNER );
  329. originCoord = dummy.GetStartPosUi();
  330. break;
  331. case 4: // Origin = page Left Top corner
  332. dummy.SetStart( 0, 0, LT_CORNER );
  333. originCoord = dummy.GetStartPosUi();
  334. break;
  335. }
  336. SetGridOrigin( originCoord );
  337. // Display absolute coordinates:
  338. wxPoint coord = GetCrossHairPosition() - originCoord;
  339. double dXpos = To_User_Unit( GetUserUnits(), coord.x*Xsign );
  340. double dYpos = To_User_Unit( GetUserUnits(), coord.y*Ysign );
  341. wxString pagesizeformatter = _( "Page size: width %.4g height %.4g" );
  342. wxString absformatter = wxT( "X %.4g Y %.4g" );
  343. wxString locformatter = wxT( "dx %.4g dy %.4g" );
  344. switch( GetUserUnits() )
  345. {
  346. case INCHES: // Should not be used in page layout editor
  347. SetStatusText( _("inches"), 5 );
  348. break;
  349. case MILLIMETRES:
  350. SetStatusText( _("mm"), 5 );
  351. break;
  352. case UNSCALED_UNITS:
  353. SetStatusText( wxEmptyString, 5 );
  354. break;
  355. case DEGREES:
  356. wxASSERT( false );
  357. break;
  358. }
  359. wxString line;
  360. // Display page size
  361. #define milsTomm (25.4/1000)
  362. DSIZE size = GetPageSettings().GetSizeMils();
  363. size = size * milsTomm;
  364. line.Printf( pagesizeformatter, size.x, size.y );
  365. SetStatusText( line, 0 );
  366. // Display abs coordinates
  367. line.Printf( absformatter, dXpos, dYpos );
  368. SetStatusText( line, 2 );
  369. // Display relative coordinates:
  370. int dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
  371. int dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
  372. dXpos = To_User_Unit( GetUserUnits(), dx * Xsign );
  373. dYpos = To_User_Unit( GetUserUnits(), dy * Ysign );
  374. line.Printf( locformatter, dXpos, dYpos );
  375. SetStatusText( line, 3 );
  376. // Display corner reference for coord origin
  377. line.Printf( _("coord origin: %s"),
  378. m_originSelectBox->GetString( m_originSelectChoice ). GetData() );
  379. SetStatusText( line, 4 );
  380. // Display units
  381. }
  382. void PL_EDITOR_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
  383. bool aPrintMirrorMode, void * aData )
  384. {
  385. GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
  386. DrawWorkSheet( aDC, GetScreen(), 0, IU_PER_MILS, wxEmptyString );
  387. }
  388. void PL_EDITOR_FRAME::RedrawActiveWindow( wxDC* aDC, bool aEraseBg )
  389. {
  390. GetScreen()-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
  391. if( aEraseBg )
  392. m_canvas->EraseScreen( aDC );
  393. m_canvas->DrawBackGround( aDC );
  394. const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
  395. WORKSHEET_DATAITEM* selecteditem = GetSelectedItem();
  396. // the color to draw selected items
  397. if( GetDrawBgColor() == WHITE )
  398. WORKSHEET_DATAITEM::m_SelectedColor = DARKCYAN;
  399. else
  400. WORKSHEET_DATAITEM::m_SelectedColor = YELLOW;
  401. for( unsigned ii = 0; ; ii++ )
  402. {
  403. WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
  404. if( item == NULL )
  405. break;
  406. item->SetSelected( item == selecteditem );
  407. }
  408. DrawWorkSheet( aDC, GetScreen(), 0, IU_PER_MILS, GetCurrFileName() );
  409. #ifdef USE_WX_OVERLAY
  410. if( IsShown() )
  411. {
  412. m_overlay.Reset();
  413. wxDCOverlay overlaydc( m_overlay, (wxWindowDC*)aDC );
  414. overlaydc.Clear();
  415. }
  416. #endif
  417. if( m_canvas->IsMouseCaptured() )
  418. m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
  419. m_canvas->DrawCrossHair( aDC );
  420. // Display the filename
  421. UpdateTitleAndInfo();
  422. }
  423. void PL_EDITOR_FRAME::RebuildDesignTree()
  424. {
  425. const WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
  426. int rectId = 0;
  427. int lineId = 0;
  428. int textId = 0;
  429. int polyId = 0;
  430. int bitmapId = 0;
  431. for( unsigned ii = 0; ii < pglayout.GetCount(); ii++ )
  432. {
  433. WORKSHEET_DATAITEM* item = pglayout.GetItem( ii );
  434. switch( item->GetType() )
  435. {
  436. case WORKSHEET_DATAITEM::WS_TEXT:
  437. item->m_Name = wxString::Format( wxT( "text%d:%s" ), ++textId,
  438. GetChars(item->GetClassName()) );
  439. break;
  440. case WORKSHEET_DATAITEM:: WS_SEGMENT:
  441. item->m_Name = wxString::Format( wxT( "segm%d:%s" ), ++lineId,
  442. GetChars(item->GetClassName()) );
  443. break;
  444. case WORKSHEET_DATAITEM::WS_RECT:
  445. item->m_Name = wxString::Format( wxT( "rect%d:%s" ), ++rectId,
  446. GetChars(item->GetClassName()) );
  447. break;
  448. case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
  449. item->m_Name = wxString::Format( wxT( "poly%d:%s" ), ++polyId,
  450. GetChars(item->GetClassName()) );
  451. break;
  452. case WORKSHEET_DATAITEM::WS_BITMAP:
  453. item->m_Name = wxString::Format( wxT( "bm%d:%s" ), ++bitmapId,
  454. GetChars(item->GetClassName()) );
  455. break;
  456. }
  457. }
  458. m_treePagelayout->ReCreateDesignTree();
  459. }
  460. WORKSHEET_DATAITEM * PL_EDITOR_FRAME::AddPageLayoutItem( int aType, int aIdx )
  461. {
  462. WORKSHEET_DATAITEM * item = NULL;
  463. switch( aType )
  464. {
  465. case WORKSHEET_DATAITEM::WS_TEXT:
  466. item = new WORKSHEET_DATAITEM_TEXT( wxT( "Text") );
  467. break;
  468. case WORKSHEET_DATAITEM::WS_SEGMENT:
  469. item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT );
  470. break;
  471. case WORKSHEET_DATAITEM::WS_RECT:
  472. item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT );
  473. break;
  474. case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
  475. item = new WORKSHEET_DATAITEM_POLYPOLYGON();
  476. break;
  477. case WORKSHEET_DATAITEM::WS_BITMAP:
  478. {
  479. wxFileDialog fileDlg( this, _( "Choose Image" ), wxEmptyString, wxEmptyString,
  480. _( "Image Files " ) + wxImage::GetImageExtWildcard(),
  481. wxFD_OPEN );
  482. if( fileDlg.ShowModal() != wxID_OK )
  483. return NULL;
  484. wxString fullFilename = fileDlg.GetPath();
  485. if( !wxFileExists( fullFilename ) )
  486. {
  487. wxMessageBox( _( "Couldn't load image from \"%s\"" ), GetChars( fullFilename ) );
  488. break;
  489. }
  490. BITMAP_BASE* image = new BITMAP_BASE();
  491. if( !image->ReadImageFile( fullFilename ) )
  492. {
  493. wxMessageBox( _( "Couldn't load image from \"%s\"" ),
  494. GetChars( fullFilename ) );
  495. delete image;
  496. break;
  497. }
  498. item = new WORKSHEET_DATAITEM_BITMAP( image );
  499. }
  500. break;
  501. }
  502. if( item == NULL )
  503. return NULL;
  504. WORKSHEET_LAYOUT& pglayout = WORKSHEET_LAYOUT::GetTheInstance();
  505. pglayout.Insert( item, aIdx );
  506. RebuildDesignTree();
  507. return item;
  508. }
  509. WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem()
  510. {
  511. WORKSHEET_DATAITEM* item = m_treePagelayout->GetPageLayoutSelectedItem();
  512. return item;
  513. }
  514. WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
  515. {
  516. const PAGE_INFO& pageInfo = GetPageSettings();
  517. TITLE_BLOCK t_block = GetTitleBlock();
  518. COLOR4D color = COLOR4D( RED ); // Needed, not used
  519. PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
  520. screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
  521. WS_DRAW_ITEM_LIST drawList;
  522. drawList.SetPenSize( 0 );
  523. drawList.SetMilsToIUfactor( IU_PER_MILS );
  524. drawList.SetSheetNumber( screen->m_ScreenNumber );
  525. drawList.SetSheetCount( screen->m_NumberOfScreens );
  526. drawList.SetFileName( GetCurrFileName() );
  527. // GetScreenDesc() returns a temporary string. Store it to avoid issues.
  528. wxString descr = GetScreenDesc();
  529. drawList.SetSheetName( descr );
  530. drawList.BuildWorkSheetGraphicList( pageInfo, t_block, color, color );
  531. // locate items.
  532. // We do not use here the COLLECTOR classes in use in pcbnew and eeschema
  533. // because the locate requirements are very basic.
  534. std::vector <WS_DRAW_ITEM_BASE*> list;
  535. drawList.Locate( list, aPosition );
  536. if( list.size() == 0 )
  537. return NULL;
  538. WS_DRAW_ITEM_BASE* drawitem = list[0];
  539. // Choose item in list if more than 1 item
  540. if( list.size() > 1 )
  541. {
  542. wxArrayString choices;
  543. wxString text;
  544. wxPoint cursPos = GetCrossHairPosition();
  545. for( unsigned ii = 0; ii < list.size(); ++ii )
  546. {
  547. drawitem = list[ii];
  548. text = drawitem->GetParent()->m_Name;
  549. if( (drawitem->m_Flags & (LOCATE_STARTPOINT|LOCATE_ENDPOINT))
  550. == (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
  551. text << wxT( " " ) << _( "(start or end point)" );
  552. else
  553. {
  554. if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
  555. text << wxT( " " ) << _( "(start point)" );
  556. if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
  557. text << wxT( " " ) << _( "(end point)" );
  558. }
  559. if( ! drawitem->GetParent()->m_Info.IsEmpty() )
  560. text << wxT( " \"" ) << drawitem->GetParent()->m_Info << wxT( "\"" );
  561. choices.Add( text );
  562. }
  563. int selection = wxGetSingleChoiceIndex ( wxEmptyString,
  564. _( "Selection Clarification" ),
  565. choices, this );
  566. if( selection < 0 )
  567. return NULL;
  568. SetCrossHairPosition( cursPos );
  569. m_canvas->MoveCursorToCrossHair();
  570. drawitem = list[selection];
  571. }
  572. WORKSHEET_DATAITEM* item = drawitem->GetParent();
  573. item->ClearFlags( LOCATE_STARTPOINT|LOCATE_ENDPOINT );
  574. if( (drawitem->m_Flags & LOCATE_STARTPOINT) )
  575. item->SetFlags( LOCATE_STARTPOINT );
  576. if( (drawitem->m_Flags & LOCATE_ENDPOINT) )
  577. item->SetFlags( LOCATE_ENDPOINT );
  578. return item;
  579. }
  580. void PL_EDITOR_FRAME::OnNewPageLayout()
  581. {
  582. GetScreen()->ClearUndoRedoList();
  583. GetScreen()->ClrModify();
  584. m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
  585. RebuildDesignTree();
  586. Zoom_Automatique( false );
  587. m_canvas->Refresh();
  588. }
  589. const wxString PL_EDITOR_FRAME::GetZoomLevelIndicator() const
  590. {
  591. return EDA_DRAW_FRAME::GetZoomLevelIndicator();
  592. }