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.

996 lines
29 KiB

Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
5 years ago
* 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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. #include <bitmaps.h>
  26. #include <dialog_shim.h>
  27. #include <dialogs/panel_common_settings.h>
  28. #include <dialogs/panel_mouse_settings.h>
  29. #include <filehistory.h>
  30. #include <id.h>
  31. #include <kiface_i.h>
  32. #include <menus_helpers.h>
  33. #include <panel_hotkeys_editor.h>
  34. #include <pgm_base.h>
  35. #include <settings/app_settings.h>
  36. #include <settings/common_settings.h>
  37. #include <settings/settings_manager.h>
  38. #include <pgm_base.h>
  39. #include <project/project_local_settings.h>
  40. #include <tool/action_manager.h>
  41. #include <tool/action_menu.h>
  42. #include <tool/actions.h>
  43. #include <tool/common_control.h>
  44. #include <tool/tool_manager.h>
  45. #include <tool/tool_dispatcher.h>
  46. #include <trace_helpers.h>
  47. #include <widgets/paged_dialog.h>
  48. #include <widgets/infobar.h>
  49. #include <wx/display.h>
  50. #include <wx/stdpaths.h>
  51. #include <wx/string.h>
  52. #include <kiplatform/app.h>
  53. #include <functional>
  54. wxDEFINE_EVENT( UNITS_CHANGED, wxCommandEvent );
  55. // Minimum window size
  56. static const int s_minsize_x = 500;
  57. static const int s_minsize_y = 400;
  58. BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
  59. EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
  60. EVT_MENU( wxID_PREFERENCES, EDA_BASE_FRAME::OnPreferences )
  61. EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook )
  62. EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuEvent )
  63. EVT_MENU_CLOSE( EDA_BASE_FRAME::OnMenuEvent )
  64. EVT_MENU_HIGHLIGHT_ALL( EDA_BASE_FRAME::OnMenuEvent )
  65. EVT_MOVE( EDA_BASE_FRAME::OnMove )
  66. EVT_MAXIMIZE( EDA_BASE_FRAME::OnMaximize )
  67. END_EVENT_TABLE()
  68. EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
  69. const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
  70. long aStyle, const wxString& aFrameName, KIWAY* aKiway ) :
  71. wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName ),
  72. TOOLS_HOLDER(),
  73. KIWAY_HOLDER( aKiway, KIWAY_HOLDER::FRAME ),
  74. m_Ident( aFrameType ),
  75. m_infoBar( nullptr ),
  76. m_settingsManager( nullptr ),
  77. m_fileHistory( nullptr ),
  78. m_hasAutoSave( false ),
  79. m_autoSaveState( false ),
  80. m_autoSaveInterval(-1 ),
  81. m_UndoRedoCountMax( DEFAULT_MAX_UNDO_ITEMS ),
  82. m_userUnits( EDA_UNITS::MILLIMETRES ),
  83. m_isClosing( false ),
  84. m_isNonUserClose( false )
  85. {
  86. m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
  87. m_mruPath = wxStandardPaths::Get().GetDocumentsDir();
  88. m_FrameSize = wxSize( s_minsize_x, s_minsize_y );
  89. m_settingsManager = &Pgm().GetSettingsManager();
  90. // Set a reasonable minimal size for the frame
  91. SetSizeHints( s_minsize_x, s_minsize_y, -1, -1, -1, -1 );
  92. // Store dimensions of the user area of the main window.
  93. GetClientSize( &m_FrameSize.x, &m_FrameSize.y );
  94. Connect( ID_AUTO_SAVE_TIMER, wxEVT_TIMER,
  95. wxTimerEventHandler( EDA_BASE_FRAME::onAutoSaveTimer ) );
  96. // hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems
  97. // to be called before any other hook for wxCloseEvent, which is necessary.
  98. Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( EDA_BASE_FRAME::windowClosing ) );
  99. }
  100. wxWindow* EDA_BASE_FRAME::findQuasiModalDialog()
  101. {
  102. for( auto& iter : GetChildren() )
  103. {
  104. DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
  105. if( dlg && dlg->IsQuasiModal() )
  106. return dlg;
  107. }
  108. // FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
  109. // so we have to look for it separately.
  110. if( m_Ident == FRAME_SCH )
  111. {
  112. wxWindow* cvpcb = wxWindow::FindWindowByName( "CvpcbFrame" );
  113. if( cvpcb )
  114. return cvpcb;
  115. }
  116. return nullptr;
  117. }
  118. void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
  119. {
  120. // Don't allow closing when a quasi-modal is open.
  121. wxWindow* quasiModal = findQuasiModalDialog();
  122. if( quasiModal )
  123. {
  124. // Raise and notify; don't give the user a warning regarding "quasi-modal dialogs"
  125. // when they have no idea what those are.
  126. quasiModal->Raise();
  127. wxBell();
  128. if( event.CanVeto() )
  129. event.Veto();
  130. return;
  131. }
  132. if( event.GetId() == wxEVT_QUERY_END_SESSION
  133. || event.GetId() == wxEVT_END_SESSION )
  134. {
  135. // End session means the OS is going to terminate us
  136. m_isNonUserClose = true;
  137. }
  138. if( canCloseWindow( event ) )
  139. {
  140. m_isClosing = true;
  141. APP_SETTINGS_BASE* cfg = config();
  142. if( cfg )
  143. SaveSettings( cfg ); // virtual, wxFrame specific
  144. doCloseWindow();
  145. // Destroy (safe delete frame) this frame only in non modal mode.
  146. // In modal mode, the caller will call Destroy().
  147. if( !IsModal() )
  148. Destroy();
  149. }
  150. else
  151. {
  152. if( event.CanVeto() )
  153. event.Veto();
  154. }
  155. }
  156. EDA_BASE_FRAME::~EDA_BASE_FRAME()
  157. {
  158. delete m_autoSaveTimer;
  159. delete m_fileHistory;
  160. ClearUndoRedoList();
  161. KIPLATFORM::APP::RemoveShutdownBlockReason( this );
  162. }
  163. bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
  164. {
  165. #ifdef __WXMAC__
  166. // Apple in its infinite wisdom will raise a disabled window before even passing
  167. // us the event, so we have no way to stop it. Instead, we have to catch an
  168. // improperly ordered disabled window and quasi-modal dialog here and reorder
  169. // them.
  170. if( !IsEnabled() && IsActive() )
  171. {
  172. wxWindow* dlg = findQuasiModalDialog();
  173. if( dlg )
  174. dlg->Raise();
  175. }
  176. #endif
  177. if( !wxFrame::ProcessEvent( aEvent ) )
  178. return false;
  179. if( IsShown() && m_hasAutoSave && IsActive() &&
  180. (m_autoSaveState != isAutoSaveRequired()) && (m_autoSaveInterval > 0) )
  181. {
  182. if( !m_autoSaveState )
  183. {
  184. wxLogTrace( traceAutoSave, wxT( "Starting auto save timer." ) );
  185. m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
  186. m_autoSaveState = true;
  187. }
  188. else if( m_autoSaveTimer->IsRunning() )
  189. {
  190. wxLogTrace( traceAutoSave, wxT( "Stopping auto save timer." ) );
  191. m_autoSaveTimer->Stop();
  192. m_autoSaveState = false;
  193. }
  194. }
  195. return true;
  196. }
  197. void EDA_BASE_FRAME::SetAutoSaveInterval( int aInterval )
  198. {
  199. m_autoSaveInterval = aInterval;
  200. if( m_autoSaveTimer->IsRunning() )
  201. {
  202. if( m_autoSaveInterval > 0 )
  203. {
  204. m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
  205. }
  206. else
  207. {
  208. m_autoSaveTimer->Stop();
  209. m_autoSaveState = false;
  210. }
  211. }
  212. }
  213. void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
  214. {
  215. if( !doAutoSave() )
  216. m_autoSaveTimer->Start( m_autoSaveInterval * 1000, wxTIMER_ONE_SHOT );
  217. }
  218. bool EDA_BASE_FRAME::doAutoSave()
  219. {
  220. wxCHECK_MSG( false, true, wxT( "Auto save timer function not overridden. Bad programmer!" ) );
  221. }
  222. void EDA_BASE_FRAME::OnCharHook( wxKeyEvent& event )
  223. {
  224. wxLogTrace( kicadTraceKeyEvent, "EDA_BASE_FRAME::OnCharHook %s", dump( event ) );
  225. // Key events can be filtered here.
  226. // Currently no filtering is made.
  227. event.Skip();
  228. }
  229. void EDA_BASE_FRAME::OnMenuEvent( wxMenuEvent& aEvent )
  230. {
  231. if( !m_toolDispatcher )
  232. aEvent.Skip();
  233. else
  234. m_toolDispatcher->DispatchWxEvent( aEvent );
  235. }
  236. void EDA_BASE_FRAME::RegisterUIUpdateHandler( int aID, const ACTION_CONDITIONS& aConditions )
  237. {
  238. UIUpdateHandler evtFunc = std::bind( &EDA_BASE_FRAME::HandleUpdateUIEvent,
  239. std::placeholders::_1,
  240. this,
  241. aConditions );
  242. m_uiUpdateMap[aID] = evtFunc;
  243. Bind( wxEVT_UPDATE_UI, evtFunc, aID );
  244. }
  245. void EDA_BASE_FRAME::UnregisterUIUpdateHandler( int aID )
  246. {
  247. const auto it = m_uiUpdateMap.find( aID );
  248. if( it == m_uiUpdateMap.end() )
  249. return;
  250. Unbind( wxEVT_UPDATE_UI, it->second, aID );
  251. }
  252. void EDA_BASE_FRAME::HandleUpdateUIEvent( wxUpdateUIEvent& aEvent, EDA_BASE_FRAME* aFrame,
  253. ACTION_CONDITIONS aCond )
  254. {
  255. bool checkRes = false;
  256. bool enableRes = true;
  257. bool showRes = true;
  258. SELECTION& selection = aFrame->GetCurrentSelection();
  259. try
  260. {
  261. checkRes = aCond.checkCondition( selection );
  262. enableRes = aCond.enableCondition( selection );
  263. showRes = aCond.showCondition( selection );
  264. }
  265. catch( std::exception& )
  266. {
  267. // Something broke with the conditions, just skip the event.
  268. aEvent.Skip();
  269. return;
  270. }
  271. aEvent.Enable( enableRes );
  272. aEvent.Show( showRes );
  273. bool canCheck = true;
  274. // wxMenuItems don't want to be checked unless they actually are checkable, so we have to check to
  275. // see if they can be and can't just universally apply a check in this event.
  276. if( auto menu = dynamic_cast<wxMenu*>( aEvent.GetEventObject() ) )
  277. canCheck = menu->FindItem( aEvent.GetId() )->IsCheckable();
  278. if( canCheck )
  279. aEvent.Check( checkRes );
  280. }
  281. void EDA_BASE_FRAME::setupUIConditions()
  282. {
  283. // Setup the conditions to check a language menu item
  284. auto isCurrentLang =
  285. [] ( const SELECTION& aSel, int aLangIdentifier )
  286. {
  287. return Pgm().GetSelectedLanguageIdentifier() == aLangIdentifier;
  288. };
  289. for( unsigned ii = 0; LanguagesList[ii].m_KI_Lang_Identifier != 0; ii++ )
  290. {
  291. ACTION_CONDITIONS cond;
  292. cond.Check( std::bind( isCurrentLang, std::placeholders::_1,
  293. LanguagesList[ii].m_WX_Lang_Identifier ) );
  294. RegisterUIUpdateHandler( LanguagesList[ii].m_KI_Lang_Identifier, cond );
  295. }
  296. }
  297. void EDA_BASE_FRAME::ReCreateMenuBar()
  298. {
  299. }
  300. void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar )
  301. {
  302. COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
  303. ACTION_MENU* helpMenu = new ACTION_MENU( false, commonControl );
  304. helpMenu->Add( ACTIONS::help );
  305. helpMenu->Add( ACTIONS::gettingStarted );
  306. helpMenu->Add( ACTIONS::listHotKeys );
  307. helpMenu->Add( ACTIONS::getInvolved );
  308. helpMenu->Add( ACTIONS::reportBug );
  309. helpMenu->AppendSeparator();
  310. helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
  311. aMenuBar->Append( helpMenu, _( "&Help" ) );
  312. }
  313. void EDA_BASE_FRAME::ShowChangedLanguage()
  314. {
  315. if( GetMenuBar() )
  316. {
  317. ReCreateMenuBar();
  318. GetMenuBar()->Refresh();
  319. }
  320. }
  321. void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
  322. {
  323. TOOLS_HOLDER::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
  324. COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
  325. if( m_fileHistory )
  326. {
  327. int historySize = settings->m_System.file_history_size;
  328. m_fileHistory->SetMaxFiles( (unsigned) std::max( 0, historySize ) );
  329. }
  330. if( GetMenuBar() )
  331. {
  332. // For icons in menus, icon scaling & hotkeys
  333. ReCreateMenuBar();
  334. GetMenuBar()->Refresh();
  335. }
  336. }
  337. void EDA_BASE_FRAME::LoadWindowState( const wxString& aFileName )
  338. {
  339. if( !Pgm().GetCommonSettings()->m_Session.remember_open_files )
  340. return;
  341. const PROJECT_FILE_STATE* state = Prj().GetLocalSettings().GetFileState( aFileName );
  342. if( state != nullptr )
  343. {
  344. LoadWindowState( state->window );
  345. }
  346. }
  347. void EDA_BASE_FRAME::LoadWindowState( const WINDOW_STATE& aState )
  348. {
  349. m_FramePos.x = aState.pos_x;
  350. m_FramePos.y = aState.pos_y;
  351. m_FrameSize.x = aState.size_x;
  352. m_FrameSize.y = aState.size_y;
  353. wxLogTrace( traceDisplayLocation, "Config position (%d, %d) with size (%d, %d)",
  354. m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  355. // Ensure minimum size is set if the stored config was zero-initialized
  356. if( m_FrameSize.x < s_minsize_x || m_FrameSize.y < s_minsize_y )
  357. {
  358. m_FrameSize.x = s_minsize_x;
  359. m_FrameSize.y = s_minsize_y;
  360. wxLogTrace( traceDisplayLocation, "Using minimum size (%d, %d)", m_FrameSize.x, m_FrameSize.y );
  361. }
  362. wxLogTrace( traceDisplayLocation, "Number of displays: %d", wxDisplay::GetCount() );
  363. if( aState.display >= wxDisplay::GetCount() )
  364. {
  365. wxLogTrace( traceDisplayLocation, "Previous display not found" );
  366. // If it isn't attached, use the first display
  367. // Warning wxDisplay has 2 ctor variants. the parameter needs a type:
  368. const unsigned int index = 0;
  369. wxDisplay display( index );
  370. wxRect clientSize = display.GetGeometry();
  371. m_FramePos = wxDefaultPosition;
  372. // Ensure the window fits on the display, since the other one could have been larger
  373. if( m_FrameSize.x > clientSize.width )
  374. m_FrameSize.x = clientSize.width;
  375. if( m_FrameSize.y > clientSize.height )
  376. m_FrameSize.y = clientSize.height;
  377. }
  378. else
  379. {
  380. wxPoint upperRight( m_FramePos.x + m_FrameSize.x, m_FramePos.y );
  381. wxPoint upperLeft( m_FramePos.x, m_FramePos.y );
  382. wxDisplay display( aState.display );
  383. wxRect clientSize = display.GetClientArea();
  384. // The percentage size (represented in decimal) of the region around the screen's border where
  385. // an upper corner is not allowed
  386. #define SCREEN_BORDER_REGION 0.10
  387. int yLim = clientSize.y + ( clientSize.height * ( 1.0 - SCREEN_BORDER_REGION ) );
  388. int xLimLeft = clientSize.x + ( clientSize.width * SCREEN_BORDER_REGION );
  389. int xLimRight = clientSize.x + ( clientSize.width * ( 1.0 - SCREEN_BORDER_REGION ) );
  390. if( upperLeft.x > xLimRight || // Upper left corner too close to right edge of screen
  391. upperRight.x < xLimLeft || // Upper right corner too close to left edge of screen
  392. upperRight.y > yLim ) // Upper corner too close to the bottom of the screen
  393. {
  394. m_FramePos = wxDefaultPosition;
  395. wxLogTrace( traceDisplayLocation, "Resetting to default position" );
  396. }
  397. }
  398. // Ensure Window title bar is visible
  399. #if defined( __WXOSX__ )
  400. // for macOSX, the window must be below system (macOSX) toolbar
  401. int Ypos_min = 20;
  402. #else
  403. int Ypos_min = 0;
  404. #endif
  405. if( m_FramePos.y < Ypos_min )
  406. m_FramePos.y = Ypos_min;
  407. wxLogTrace( traceDisplayLocation, "Final window position (%d, %d) with size (%d, %d)",
  408. m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  409. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  410. // Center the window if we reset to default
  411. if( m_FramePos.x == -1 )
  412. {
  413. wxLogTrace( traceDisplayLocation, "Centering window" );
  414. Center();
  415. m_FramePos = GetPosition();
  416. }
  417. // Record the frame sizes in an un-maximized state
  418. m_NormalFrameSize = m_FrameSize;
  419. m_NormalFramePos = m_FramePos;
  420. // Maximize if we were maximized before
  421. if( aState.maximized )
  422. {
  423. wxLogTrace( traceDisplayLocation, "Maximizing window" );
  424. Maximize();
  425. }
  426. }
  427. void EDA_BASE_FRAME::LoadWindowSettings( const WINDOW_SETTINGS* aCfg )
  428. {
  429. LoadWindowState( aCfg->state );
  430. if( m_hasAutoSave )
  431. m_autoSaveInterval = Pgm().GetCommonSettings()->m_System.autosave_interval;
  432. m_perspective = aCfg->perspective;
  433. m_mruPath = aCfg->mru_path;
  434. TOOLS_HOLDER::CommonSettingsChanged( false, false );
  435. }
  436. void EDA_BASE_FRAME::SaveWindowSettings( WINDOW_SETTINGS* aCfg )
  437. {
  438. wxString text;
  439. if( IsIconized() )
  440. return;
  441. wxString baseCfgName = ConfigBaseName();
  442. // If the window is maximized, we use the saved window size from before it was maximized
  443. if( IsMaximized() )
  444. {
  445. m_FramePos = m_NormalFramePos;
  446. m_FrameSize = m_NormalFrameSize;
  447. }
  448. else
  449. {
  450. m_FrameSize = GetWindowSize();
  451. m_FramePos = GetPosition();
  452. }
  453. aCfg->state.pos_x = m_FramePos.x;
  454. aCfg->state.pos_y = m_FramePos.y;
  455. aCfg->state.size_x = m_FrameSize.x;
  456. aCfg->state.size_y = m_FrameSize.y;
  457. aCfg->state.maximized = IsMaximized();
  458. aCfg->state.display = wxDisplay::GetFromWindow( this );
  459. wxLogTrace( traceDisplayLocation, "Saving window maximized: %s", IsMaximized() ? "true" : "false" );
  460. wxLogTrace( traceDisplayLocation, "Saving config position (%d, %d) with size (%d, %d)",
  461. m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  462. // TODO(JE) should auto-save in common settings be overwritten by every app?
  463. if( m_hasAutoSave )
  464. Pgm().GetCommonSettings()->m_System.autosave_interval = m_autoSaveInterval;
  465. // Once this is fully implemented, wxAuiManager will be used to maintain
  466. // the persistance of the main frame and all it's managed windows and
  467. // all of the legacy frame persistence position code can be removed.
  468. aCfg->perspective = m_auimgr.SavePerspective().ToStdString();
  469. aCfg->mru_path = m_mruPath;
  470. }
  471. void EDA_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
  472. {
  473. LoadWindowSettings( GetWindowSettings( aCfg ) );
  474. // Get file history size from common settings
  475. int fileHistorySize = Pgm().GetCommonSettings()->m_System.file_history_size;
  476. // Load the recently used files into the history menu
  477. m_fileHistory = new FILE_HISTORY( (unsigned) std::max( 0, fileHistorySize ),
  478. ID_FILE1, ID_FILE_LIST_CLEAR );
  479. m_fileHistory->Load( *aCfg );
  480. }
  481. void EDA_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
  482. {
  483. SaveWindowSettings( GetWindowSettings( aCfg ) );
  484. bool fileOpen = m_isClosing && m_isNonUserClose;
  485. wxString currentlyOpenedFile = GetCurrentFileName();
  486. if( Pgm().GetCommonSettings()->m_Session.remember_open_files && !currentlyOpenedFile.IsEmpty() )
  487. {
  488. wxFileName rfn( currentlyOpenedFile );
  489. rfn.MakeRelativeTo( Prj().GetProjectPath() );
  490. Prj().GetLocalSettings().SaveFileState( rfn.GetFullPath(), &aCfg->m_Window, fileOpen );
  491. }
  492. // Save the recently used files list
  493. if( m_fileHistory )
  494. {
  495. // Save the currently opened file in the file history
  496. if( !currentlyOpenedFile.IsEmpty() )
  497. UpdateFileHistory( currentlyOpenedFile );
  498. m_fileHistory->Save( *aCfg );
  499. }
  500. }
  501. WINDOW_SETTINGS* EDA_BASE_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
  502. {
  503. return &aCfg->m_Window;
  504. }
  505. APP_SETTINGS_BASE* EDA_BASE_FRAME::config() const
  506. {
  507. // KICAD_MANAGER_FRAME overrides this
  508. return Kiface().KifaceSettings();
  509. }
  510. const SEARCH_STACK& EDA_BASE_FRAME::sys_search()
  511. {
  512. return Kiface().KifaceSearch();
  513. }
  514. wxString EDA_BASE_FRAME::help_name()
  515. {
  516. return Kiface().GetHelpFileName();
  517. }
  518. void EDA_BASE_FRAME::PrintMsg( const wxString& text )
  519. {
  520. SetStatusText( text );
  521. }
  522. void EDA_BASE_FRAME::ShowInfoBarError( const wxString& aErrorMsg )
  523. {
  524. GetInfoBar()->ShowMessageFor( aErrorMsg, 5000, wxICON_ERROR );
  525. }
  526. void EDA_BASE_FRAME::ShowInfoBarWarning( const wxString& aWarningMsg )
  527. {
  528. GetInfoBar()->ShowMessageFor( aWarningMsg, 5000, wxICON_WARNING );
  529. }
  530. void EDA_BASE_FRAME::ShowInfoBarMsg( const wxString& aMsg )
  531. {
  532. GetInfoBar()->ShowMessageFor( aMsg, 10000, wxICON_INFORMATION );
  533. }
  534. void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName, FILE_HISTORY* aFileHistory )
  535. {
  536. if( !aFileHistory )
  537. aFileHistory = m_fileHistory;
  538. wxASSERT( aFileHistory );
  539. aFileHistory->AddFileToHistory( FullFileName );
  540. // Update the menubar to update the file history menu
  541. if( !m_isClosing && GetMenuBar() )
  542. {
  543. ReCreateMenuBar();
  544. GetMenuBar()->Refresh();
  545. }
  546. }
  547. wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
  548. FILE_HISTORY* aFileHistory )
  549. {
  550. if( !aFileHistory )
  551. aFileHistory = m_fileHistory;
  552. wxASSERT( aFileHistory );
  553. int baseId = aFileHistory->GetBaseId();
  554. wxASSERT( cmdId >= baseId && cmdId < baseId + (int) aFileHistory->GetCount() );
  555. unsigned i = cmdId - baseId;
  556. if( i < aFileHistory->GetCount() )
  557. {
  558. wxString fn = aFileHistory->GetHistoryFile( i );
  559. if( wxFileName::FileExists( fn ) )
  560. return fn;
  561. else
  562. {
  563. wxString msg = wxString::Format( _( "File \"%s\" was not found." ), fn );
  564. wxMessageBox( msg );
  565. aFileHistory->RemoveFileFromHistory( i );
  566. }
  567. }
  568. // Update the menubar to update the file history menu
  569. if( GetMenuBar() )
  570. {
  571. ReCreateMenuBar();
  572. GetMenuBar()->Refresh();
  573. }
  574. return wxEmptyString;
  575. }
  576. void EDA_BASE_FRAME::ClearFileHistory( FILE_HISTORY* aFileHistory )
  577. {
  578. if( !aFileHistory )
  579. aFileHistory = m_fileHistory;
  580. wxASSERT( aFileHistory );
  581. aFileHistory->ClearFileHistory();
  582. // Update the menubar to update the file history menu
  583. if( GetMenuBar() )
  584. {
  585. ReCreateMenuBar();
  586. GetMenuBar()->Refresh();
  587. }
  588. }
  589. void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
  590. {
  591. void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
  592. ShowAboutDialog( this );
  593. }
  594. void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
  595. {
  596. PAGED_DIALOG dlg( this, _( "Preferences" ), true );
  597. wxTreebook* book = dlg.GetTreebook();
  598. book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
  599. book->AddPage( new PANEL_MOUSE_SETTINGS( &dlg, book ), _( "Mouse and Touchpad" ) );
  600. PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( this, book, false );
  601. book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
  602. for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
  603. {
  604. KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
  605. if( frame )
  606. frame->InstallPreferences( &dlg, hotkeysPanel );
  607. }
  608. // The Kicad manager frame is not a player so we have to add it by hand
  609. wxWindow* manager = wxFindWindowByName( KICAD_MANAGER_FRAME_NAME );
  610. if( manager )
  611. static_cast<EDA_BASE_FRAME*>( manager )->InstallPreferences( &dlg, hotkeysPanel );
  612. for( size_t i = 0; i < book->GetPageCount(); ++i )
  613. book->GetPage( i )->Layout();
  614. if( dlg.ShowModal() == wxID_OK )
  615. dlg.Kiway().CommonSettingsChanged( false, false );
  616. }
  617. bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName )
  618. {
  619. wxString msg;
  620. wxFileName fn = aFileName;
  621. // Check for absence of a file path with a file name. Unfortunately KiCad
  622. // uses paths relative to the current project path without the ./ part which
  623. // confuses wxFileName. Making the file name path absolute may be less than
  624. // elegant but it solves the problem.
  625. if( fn.GetPath().IsEmpty() && fn.HasName() )
  626. fn.MakeAbsolute();
  627. wxCHECK_MSG( fn.IsOk(), false,
  628. wxT( "File name object is invalid. Bad programmer!" ) );
  629. wxCHECK_MSG( !fn.GetPath().IsEmpty(), false,
  630. wxT( "File name object path <" ) + fn.GetFullPath() +
  631. wxT( "> is not set. Bad programmer!" ) );
  632. if( fn.IsDir() && !fn.IsDirWritable() )
  633. {
  634. msg.Printf( _( "You do not have write permissions to folder \"%s\"." ),
  635. GetChars( fn.GetPath() ) );
  636. }
  637. else if( !fn.FileExists() && !fn.IsDirWritable() )
  638. {
  639. msg.Printf( _( "You do not have write permissions to save file \"%s\" to folder \"%s\"." ),
  640. GetChars( fn.GetFullName() ), GetChars( fn.GetPath() ) );
  641. }
  642. else if( fn.FileExists() && !fn.IsFileWritable() )
  643. {
  644. msg.Printf( _( "You do not have write permissions to save file \"%s\"." ),
  645. GetChars( fn.GetFullPath() ) );
  646. }
  647. if( !msg.IsEmpty() )
  648. {
  649. wxMessageBox( msg );
  650. return false;
  651. }
  652. return true;
  653. }
  654. void EDA_BASE_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
  655. {
  656. wxCHECK_RET( aFileName.IsOk(), wxT( "Invalid file name!" ) );
  657. wxFileName autoSaveFileName = aFileName;
  658. // Check for auto save file.
  659. autoSaveFileName.SetName( GetAutoSaveFilePrefix() + aFileName.GetName() );
  660. wxLogTrace( traceAutoSave,
  661. wxT( "Checking for auto save file " ) + autoSaveFileName.GetFullPath() );
  662. if( !autoSaveFileName.FileExists() )
  663. return;
  664. wxString msg = wxString::Format( _(
  665. "Well this is potentially embarrassing!\n"
  666. "It appears that the last time you were editing the file\n"
  667. "\"%s\"\n"
  668. "it was not saved properly. Do you wish to restore the last saved edits you made?" ),
  669. GetChars( aFileName.GetFullName() )
  670. );
  671. int response = wxMessageBox( msg, Pgm().App().GetAppName(), wxYES_NO | wxICON_QUESTION, this );
  672. // Make a backup of the current file, delete the file, and rename the auto save file to
  673. // the file name.
  674. if( response == wxYES )
  675. {
  676. if( !wxRenameFile( autoSaveFileName.GetFullPath(), aFileName.GetFullPath() ) )
  677. {
  678. wxMessageBox( _( "The auto save file could not be renamed to the board file name." ),
  679. Pgm().App().GetAppName(), wxOK | wxICON_EXCLAMATION, this );
  680. }
  681. }
  682. else
  683. {
  684. wxLogTrace( traceAutoSave,
  685. wxT( "Removing auto save file " ) + autoSaveFileName.GetFullPath() );
  686. // Remove the auto save file when using the previous file as is.
  687. wxRemoveFile( autoSaveFileName.GetFullPath() );
  688. }
  689. }
  690. bool EDA_BASE_FRAME::IsContentModified()
  691. {
  692. // This function should be overridden in child classes
  693. return false;
  694. }
  695. void EDA_BASE_FRAME::ClearUndoRedoList()
  696. {
  697. ClearUndoORRedoList( UNDO_LIST );
  698. ClearUndoORRedoList( REDO_LIST );
  699. }
  700. void EDA_BASE_FRAME::PushCommandToUndoList( PICKED_ITEMS_LIST* aNewitem )
  701. {
  702. m_undoList.PushCommand( aNewitem );
  703. // Delete the extra items, if count max reached
  704. if( m_UndoRedoCountMax > 0 )
  705. {
  706. int extraitems = GetUndoCommandCount() - m_UndoRedoCountMax;
  707. if( extraitems > 0 )
  708. ClearUndoORRedoList( UNDO_LIST, extraitems );
  709. }
  710. }
  711. void EDA_BASE_FRAME::PushCommandToRedoList( PICKED_ITEMS_LIST* aNewitem )
  712. {
  713. m_redoList.PushCommand( aNewitem );
  714. // Delete the extra items, if count max reached
  715. if( m_UndoRedoCountMax > 0 )
  716. {
  717. int extraitems = GetRedoCommandCount() - m_UndoRedoCountMax;
  718. if( extraitems > 0 )
  719. ClearUndoORRedoList( REDO_LIST, extraitems );
  720. }
  721. }
  722. PICKED_ITEMS_LIST* EDA_BASE_FRAME::PopCommandFromUndoList( )
  723. {
  724. return m_undoList.PopCommand();
  725. }
  726. PICKED_ITEMS_LIST* EDA_BASE_FRAME::PopCommandFromRedoList( )
  727. {
  728. return m_redoList.PopCommand();
  729. }
  730. void EDA_BASE_FRAME::ChangeUserUnits( EDA_UNITS aUnits )
  731. {
  732. SetUserUnits( aUnits );
  733. unitsChangeRefresh();
  734. wxCommandEvent e( UNITS_CHANGED );
  735. ProcessEventLocally( e );
  736. }
  737. void EDA_BASE_FRAME::OnMaximize( wxMaximizeEvent& aEvent )
  738. {
  739. // When we maximize the window, we want to save the old information
  740. // so that we can add it to the settings on next window load.
  741. // Contrary to the documentation, this event seems to be generated
  742. // when the window is also being unmaximized on OSX, so we only
  743. // capture the size information when we maximize the window when on OSX.
  744. #ifdef __WXOSX__
  745. if( !IsMaximized() )
  746. #endif
  747. {
  748. m_NormalFrameSize = GetWindowSize();
  749. m_NormalFramePos = GetPosition();
  750. wxLogTrace( traceDisplayLocation, "Maximizing window - Saving position (%d, %d) with size (%d, %d)",
  751. m_NormalFramePos.x, m_NormalFramePos.y, m_NormalFrameSize.x, m_NormalFrameSize.y );
  752. }
  753. // Skip event to actually maximize the window
  754. aEvent.Skip();
  755. }
  756. wxSize EDA_BASE_FRAME::GetWindowSize()
  757. {
  758. #ifdef __WXGTK__
  759. // GTK includes the window decorations in the normal GetSize call,
  760. // so we have to use a GTK-specific sizing call that returns the
  761. // non-decorated window size.
  762. int width = 0;
  763. int height = 0;
  764. GTKDoGetSize( &width, &height );
  765. wxSize winSize( width, height );
  766. #else
  767. wxSize winSize = GetSize();
  768. #endif
  769. return winSize;
  770. }