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.

865 lines
24 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
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
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
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
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
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
* 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
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
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
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
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
* 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
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
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
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
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
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
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
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
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
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
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
* 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
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
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
12 years ago
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
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
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 2004-2015 KiCad Developers, see change_log.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. /**
  26. * @file modview_frame.cpp
  27. */
  28. #include <fctsys.h>
  29. #include <pgm_base.h>
  30. #include <kiway.h>
  31. #include <class_drawpanel.h>
  32. #include <pcb_draw_panel_gal.h>
  33. #include <wxPcbStruct.h>
  34. #include <3d_viewer.h>
  35. #include <dialog_helpers.h>
  36. #include <msgpanel.h>
  37. #include <fp_lib_table.h>
  38. #include <fpid.h>
  39. #include <confirm.h>
  40. #include <class_board.h>
  41. #include <class_module.h>
  42. #include <pcbnew.h>
  43. #include <pcbnew_id.h>
  44. #include <modview_frame.h>
  45. #include <footprint_info.h>
  46. #include <hotkeys.h>
  47. #include <wildcards_and_files_ext.h>
  48. #include <pcbnew_config.h>
  49. #include <tool/tool_manager.h>
  50. #include <tool/tool_dispatcher.h>
  51. #include "tools/pcbnew_control.h"
  52. #include "tools/common_actions.h"
  53. #include <boost/bind.hpp>
  54. #define NEXT_PART 1
  55. #define NEW_PART 0
  56. #define PREVIOUS_PART -1
  57. BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME )
  58. // Window events
  59. EVT_CLOSE( FOOTPRINT_VIEWER_FRAME::OnCloseWindow )
  60. EVT_SIZE( FOOTPRINT_VIEWER_FRAME::OnSize )
  61. EVT_ACTIVATE( FOOTPRINT_VIEWER_FRAME::OnActivate )
  62. // Menu (and/or hotkey) events
  63. EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer )
  64. EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset )
  65. // Toolbar events
  66. EVT_TOOL( ID_MODVIEW_SELECT_LIB,
  67. FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary )
  68. EVT_TOOL( ID_MODVIEW_SELECT_PART,
  69. FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint )
  70. EVT_TOOL( ID_MODVIEW_NEXT,
  71. FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList )
  72. EVT_TOOL( ID_MODVIEW_PREVIOUS,
  73. FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList )
  74. EVT_TOOL( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD,
  75. FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint )
  76. EVT_TOOL( ID_MODVIEW_SHOW_3D_VIEW, FOOTPRINT_VIEWER_FRAME::Show3D_Frame )
  77. // listbox events
  78. EVT_LISTBOX( ID_MODVIEW_LIB_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnLibList )
  79. EVT_LISTBOX( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList )
  80. EVT_LISTBOX_DCLICK( ID_MODVIEW_FOOTPRINT_LIST, FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList )
  81. END_EVENT_TABLE()
  82. /* Note:
  83. * FOOTPRINT_VIEWER_FRAME can be build in "modal mode", or as a usual frame.
  84. * In modal mode:
  85. * a tool to export the selected footprint is shown in the toolbar
  86. * the style is wxSTAY_ON_TOP on Windows and wxFRAME_FLOAT_ON_PARENT on unix
  87. * reason:
  88. * the parent is usually the kicad window manager (not easy to change)
  89. * On windows, when the frame with stype wxFRAME_FLOAT_ON_PARENT is displayed
  90. * its parent frame is brought to the foreground, on the top of the calling frame.
  91. * and stays displayed when closing the FOOTPRINT_VIEWER_FRAME frame.
  92. * this issue does not happen on unix
  93. *
  94. * So we use wxSTAY_ON_TOP on Windows, and wxFRAME_FLOAT_ON_PARENT on unix
  95. * to simulate a dialog called by ShowModal.
  96. */
  97. #define FOOTPRINT_VIEWER_FRAME_NAME wxT( "ModViewFrame" )
  98. FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType ) :
  99. PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Library Browser" ),
  100. wxDefaultPosition, wxDefaultSize,
  101. aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL ?
  102. #ifdef __WINDOWS__
  103. KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP :
  104. #else
  105. KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT :
  106. #endif
  107. KICAD_DEFAULT_DRAWFRAME_STYLE,
  108. FOOTPRINT_VIEWER_FRAME_NAME )
  109. {
  110. wxASSERT( aFrameType==FRAME_PCB_MODULE_VIEWER || aFrameType==FRAME_PCB_MODULE_VIEWER_MODAL );
  111. if( aFrameType == FRAME_PCB_MODULE_VIEWER_MODAL )
  112. SetModal( true );
  113. m_configFrameName = FOOTPRINT_VIEWER_FRAME_NAME;
  114. m_showAxis = true; // true to draw axis.
  115. // Give an icon
  116. wxIcon icon;
  117. icon.CopyFromBitmap( KiBitmap( modview_icon_xpm ) );
  118. SetIcon( icon );
  119. m_hotkeysDescrList = g_Module_Viewer_Hokeys_Descr;
  120. m_libList = new wxListBox( this, ID_MODVIEW_LIB_LIST,
  121. wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
  122. m_footprintList = new wxListBox( this, ID_MODVIEW_FOOTPRINT_LIST,
  123. wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL );
  124. SetBoard( new BOARD() );
  125. // In viewer, the default net clearance is not known (it depends on the actual board).
  126. // So we do not show the default clearance, by setting it to 0
  127. // The footprint or pad specific clearance will be shown
  128. GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
  129. // Ensure all layers and items are visible:
  130. GetBoard()->SetVisibleAlls();
  131. SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
  132. GetScreen()->m_Center = true; // Center coordinate origins on screen.
  133. LoadSettings( config() );
  134. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  135. GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
  136. // Menu bar is not mandatory: uncomment/comment the next line
  137. // to add/remove the menubar
  138. ReCreateMenuBar();
  139. ReCreateHToolbar();
  140. ReCreateVToolbar();
  141. ReCreateLibraryList();
  142. UpdateTitle();
  143. PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
  144. // Create GAL canvas
  145. PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
  146. parentFrame->GetGalCanvas()->GetBackend() );
  147. SetGalCanvas( drawPanel );
  148. // Create the manager and dispatcher & route draw panel events to the dispatcher
  149. m_toolManager = new TOOL_MANAGER;
  150. m_toolManager->SetEnvironment( GetBoard(), drawPanel->GetView(),
  151. drawPanel->GetViewControls(), this );
  152. m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
  153. drawPanel->SetEventDispatcher( m_toolDispatcher );
  154. m_toolManager->RegisterTool( new PCBNEW_CONTROL );
  155. m_toolManager->ResetTools( TOOL_BASE::RUN );
  156. // If a footprint was previously loaded, reload it
  157. if( getCurNickname().size() && getCurFootprintName().size() )
  158. {
  159. FPID id;
  160. id.SetLibNickname( getCurNickname() );
  161. id.SetFootprintName( getCurFootprintName() );
  162. GetBoard()->Add( loadFootprint( id ) );
  163. }
  164. drawPanel->DisplayBoard( m_Pcb );
  165. updateView();
  166. m_auimgr.SetManagedWindow( this );
  167. wxSize minsize(100,-1); // Min size of list boxes
  168. // Main toolbar is initially docked at the top of the main window and dockable on any side.
  169. // The close button is disable because the footprint viewer has no main menu to re-enable it.
  170. // The tool bar will only be dockable on the top or bottom of the main frame window. This is
  171. // most likely due to the fact that the other windows are not dockable and are preventing the
  172. // tool bar from docking on the right and left.
  173. wxAuiPaneInfo toolbarPaneInfo;
  174. toolbarPaneInfo.Name( wxT( "m_mainToolBar" ) ).ToolbarPane().Top().CloseButton( false );
  175. EDA_PANEINFO info;
  176. info.InfoToolbarPane();
  177. EDA_PANEINFO mesg;
  178. mesg.MessageToolbarPane();
  179. // Manage main toolbar, top pane
  180. m_auimgr.AddPane( m_mainToolBar, toolbarPaneInfo );
  181. // Manage the list of libraries, left pane.
  182. m_auimgr.AddPane( m_libList,
  183. wxAuiPaneInfo( info ).Name( wxT( "m_libList" ) )
  184. .Left().Row( 1 ).MinSize( minsize ) );
  185. // Manage the list of footprints, center pane.
  186. m_auimgr.AddPane( m_footprintList,
  187. wxAuiPaneInfo( info ).Name( wxT( "m_footprintList" ) )
  188. .Left().Row( 2 ).MinSize( minsize ) );
  189. // Manage the draw panel, right pane.
  190. m_auimgr.AddPane( m_canvas,
  191. wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
  192. m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
  193. wxAuiPaneInfo().Name( wxT( "DrawFrameGal" ) ).CentrePane().Hide() );
  194. // Manage the message panel, bottom pane.
  195. m_auimgr.AddPane( m_messagePanel,
  196. wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom() );
  197. if( !m_perspective.IsEmpty() )
  198. {
  199. // Restore last saved sizes, pos and other params
  200. // However m_mainToolBar size cannot be set to its last saved size
  201. // because the actual size change depending on the way modview was called:
  202. // the tool to export the current footprint exist or not.
  203. // and the saved size is not always OK
  204. // the trick is to get the default toolbar size, and set the size after
  205. // calling LoadPerspective
  206. wxSize tbsize = m_mainToolBar->GetSize();
  207. m_auimgr.LoadPerspective( m_perspective, false );
  208. m_auimgr.GetPane( m_mainToolBar ).BestSize( tbsize );
  209. }
  210. // after changing something to the aui manager,
  211. // call Update()() to reflect the changes
  212. m_auimgr.Update();
  213. // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
  214. #ifdef USE_WX_GRAPHICS_CONTEXT
  215. GetScreen()->SetZoom( BestZoom() );
  216. #else
  217. Zoom_Automatique( false );
  218. #endif
  219. UseGalCanvas( parentFrame->IsGalCanvasActive() );
  220. if( !IsModal() ) // For modal mode, calling ShowModal() will show this frame
  221. {
  222. Raise(); // On some window managers, this is needed
  223. Show( true );
  224. }
  225. }
  226. FOOTPRINT_VIEWER_FRAME::~FOOTPRINT_VIEWER_FRAME()
  227. {
  228. if( m_Draw3DFrame )
  229. m_Draw3DFrame->Destroy();
  230. }
  231. void FOOTPRINT_VIEWER_FRAME::OnCloseWindow( wxCloseEvent& Event )
  232. {
  233. DBG(printf( "%s:\n", __func__ );)
  234. if( IsGalCanvasActive() )
  235. GetGalCanvas()->StopDrawing();
  236. if( IsModal() )
  237. {
  238. // Only dismiss a modal frame once, so that the return values set by
  239. // the prior DismissModal() are not bashed for ShowModal().
  240. if( !IsDismissed() )
  241. DismissModal( false );
  242. // window to be destroyed by the caller of KIWAY_PLAYER::ShowModal()
  243. }
  244. else
  245. Destroy();
  246. }
  247. void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
  248. {
  249. if( m_auimgr.GetManagedWindow() )
  250. m_auimgr.Update();
  251. SizeEv.Skip();
  252. }
  253. void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
  254. {
  255. GetScreen()->m_O_Curseur = GetCrossHairPosition();
  256. UpdateStatusBar();
  257. }
  258. void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList()
  259. {
  260. m_libList->Clear();
  261. std::vector< wxString > nicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
  262. for( unsigned ii = 0; ii < nicknames.size(); ii++ )
  263. m_libList->Append( nicknames[ii] );
  264. // Search for a previous selection:
  265. int index = m_libList->FindString( getCurNickname() );
  266. if( index != wxNOT_FOUND )
  267. {
  268. m_libList->SetSelection( index, true );
  269. }
  270. else
  271. {
  272. // If not found, clear current library selection because it can be
  273. // deleted after a configuration change.
  274. setCurNickname( wxEmptyString );
  275. setCurFootprintName( wxEmptyString );
  276. }
  277. ReCreateFootprintList();
  278. ReCreateHToolbar();
  279. m_canvas->Refresh();
  280. }
  281. void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList()
  282. {
  283. m_footprintList->Clear();
  284. if( !getCurNickname() )
  285. {
  286. setCurFootprintName( wxEmptyString );
  287. return;
  288. }
  289. FOOTPRINT_LIST fp_info_list;
  290. wxString nickname = getCurNickname();
  291. fp_info_list.ReadFootprintFiles( Prj().PcbFootprintLibs(), !nickname ? NULL : &nickname );
  292. if( fp_info_list.GetErrorCount() )
  293. {
  294. fp_info_list.DisplayErrors( this );
  295. return;
  296. }
  297. BOOST_FOREACH( const FOOTPRINT_INFO& footprint, fp_info_list.GetList() )
  298. {
  299. m_footprintList->Append( footprint.GetFootprintName() );
  300. }
  301. int index = m_footprintList->FindString( getCurFootprintName() );
  302. if( index == wxNOT_FOUND )
  303. setCurFootprintName( wxEmptyString );
  304. else
  305. m_footprintList->SetSelection( index, true );
  306. }
  307. void FOOTPRINT_VIEWER_FRAME::ClickOnLibList( wxCommandEvent& event )
  308. {
  309. int ii = m_libList->GetSelection();
  310. if( ii < 0 )
  311. return;
  312. wxString name = m_libList->GetString( ii );
  313. if( getCurNickname() == name )
  314. return;
  315. setCurNickname( name );
  316. ReCreateFootprintList();
  317. UpdateTitle();
  318. ReCreateHToolbar();
  319. }
  320. void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
  321. {
  322. if( m_footprintList->GetCount() == 0 )
  323. return;
  324. int ii = m_footprintList->GetSelection();
  325. if( ii < 0 )
  326. return;
  327. wxString name = m_footprintList->GetString( ii );
  328. if( getCurFootprintName().CmpNoCase( name ) != 0 )
  329. {
  330. setCurFootprintName( name );
  331. SetCurItem( NULL );
  332. // Delete the current footprint
  333. GetBoard()->m_Modules.DeleteAll();
  334. FPID id;
  335. id.SetLibNickname( getCurNickname() );
  336. id.SetFootprintName( getCurFootprintName() );
  337. try
  338. {
  339. GetBoard()->Add( loadFootprint( id ) );
  340. }
  341. catch( const IO_ERROR& ioe )
  342. {
  343. wxString msg = wxString::Format(
  344. _( "Could not load footprint \"%s\" from library \"%s\".\n\nError %s." ),
  345. GetChars( getCurFootprintName() ),
  346. GetChars( getCurNickname() ),
  347. GetChars( ioe.errorText ) );
  348. DisplayError( this, msg );
  349. }
  350. UpdateTitle();
  351. if( IsGalCanvasActive() )
  352. updateView();
  353. Zoom_Automatique( false );
  354. m_canvas->Refresh();
  355. Update3D_Frame();
  356. }
  357. }
  358. void FOOTPRINT_VIEWER_FRAME::DClickOnFootprintList( wxCommandEvent& event )
  359. {
  360. if( IsModal() )
  361. {
  362. // @todo(DICK)
  363. ExportSelectedFootprint( event );
  364. // Prevent the double click from being as a single mouse button release
  365. // event in the parent window which would cause the part to be parked
  366. // rather than staying in move mode.
  367. // Remember the mouse button will be released in the parent window
  368. // thus creating a mouse button release event which should be ignored
  369. PCB_EDIT_FRAME* pcbframe = dynamic_cast<PCB_EDIT_FRAME*>( GetParent() );
  370. // The parent may not be the board editor:
  371. if( pcbframe )
  372. {
  373. pcbframe->SkipNextLeftButtonReleaseEvent();
  374. }
  375. }
  376. }
  377. void FOOTPRINT_VIEWER_FRAME::ExportSelectedFootprint( wxCommandEvent& event )
  378. {
  379. int ii = m_footprintList->GetSelection();
  380. if( ii >= 0 )
  381. {
  382. wxString fp_name = m_footprintList->GetString( ii );
  383. FPID fpid;
  384. fpid.SetLibNickname( getCurNickname() );
  385. fpid.SetFootprintName( fp_name );
  386. DismissModal( true, fpid.Format() );
  387. }
  388. else
  389. {
  390. DismissModal( false );
  391. }
  392. Close( true );
  393. }
  394. void FOOTPRINT_VIEWER_FRAME::LoadSettings( wxConfigBase* aCfg )
  395. {
  396. EDA_DRAW_FRAME::LoadSettings( aCfg );
  397. }
  398. void FOOTPRINT_VIEWER_FRAME::SaveSettings( wxConfigBase* aCfg )
  399. {
  400. EDA_DRAW_FRAME::SaveSettings( aCfg );
  401. }
  402. const wxString FOOTPRINT_VIEWER_FRAME::getCurNickname()
  403. {
  404. return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_NICKNAME );
  405. }
  406. void FOOTPRINT_VIEWER_FRAME::setCurNickname( const wxString& aNickname )
  407. {
  408. Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_NICKNAME, aNickname );
  409. }
  410. const wxString FOOTPRINT_VIEWER_FRAME::getCurFootprintName()
  411. {
  412. return Prj().GetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FPNAME );
  413. }
  414. void FOOTPRINT_VIEWER_FRAME::setCurFootprintName( const wxString& aName )
  415. {
  416. Prj().SetRString( PROJECT::PCB_FOOTPRINT_VIEWER_FPNAME, aName );
  417. }
  418. void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
  419. {
  420. EDA_DRAW_FRAME::OnActivate( event );
  421. // Ensure we do not have old selection:
  422. if( !event.GetActive() )
  423. return;
  424. // Ensure we have the right library list:
  425. std::vector< wxString > libNicknames = Prj().PcbFootprintLibs()->GetLogicalLibs();
  426. if( libNicknames.size() == m_libList->GetCount() )
  427. {
  428. unsigned ii;
  429. for( ii = 0; ii < libNicknames.size(); ii++ )
  430. {
  431. if( libNicknames[ii] != m_libList->GetString( ii ) )
  432. break;
  433. }
  434. if( ii == libNicknames.size() )
  435. return;
  436. }
  437. // If we are here, the library list has changed, rebuild it
  438. ReCreateLibraryList();
  439. UpdateTitle();
  440. }
  441. bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
  442. {
  443. bool eventHandled = true;
  444. // Filter out the 'fake' mouse motion after a keyboard movement
  445. if( !aHotKey && m_movingCursorWithKeyboard )
  446. {
  447. m_movingCursorWithKeyboard = false;
  448. return false;
  449. }
  450. wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
  451. cmd.SetEventObject( this );
  452. wxPoint oldpos = GetCrossHairPosition();
  453. wxPoint pos = aPosition;
  454. GeneralControlKeyMovement( aHotKey, &pos, true );
  455. if( aHotKey )
  456. {
  457. eventHandled = OnHotKey( aDC, aHotKey, aPosition );
  458. }
  459. SetCrossHairPosition( pos );
  460. RefreshCrossHair( oldpos, aPosition, aDC );
  461. UpdateStatusBar(); // Display new cursor coordinates
  462. return eventHandled;
  463. }
  464. void FOOTPRINT_VIEWER_FRAME::Show3D_Frame( wxCommandEvent& event )
  465. {
  466. if( m_Draw3DFrame )
  467. {
  468. // Raising the window does not show the window on Windows if iconized.
  469. // This should work on any platform.
  470. if( m_Draw3DFrame->IsIconized() )
  471. m_Draw3DFrame->Iconize( false );
  472. m_Draw3DFrame->Raise();
  473. // Raising the window does not set the focus on Linux. This should work on any platform.
  474. if( wxWindow::FindFocus() != m_Draw3DFrame )
  475. m_Draw3DFrame->SetFocus();
  476. return;
  477. }
  478. m_Draw3DFrame = new EDA_3D_FRAME( &Kiway(), this, wxEmptyString );
  479. Update3D_Frame( false );
  480. m_Draw3DFrame->Raise(); // Needed with some Window Managers
  481. m_Draw3DFrame->Show( true );
  482. }
  483. void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint )
  484. {
  485. if( m_Draw3DFrame == NULL )
  486. return;
  487. wxString frm3Dtitle = wxString::Format(
  488. _( "ModView: 3D Viewer [%s]" ),
  489. GetChars( getCurFootprintName() ) );
  490. m_Draw3DFrame->SetTitle( frm3Dtitle );
  491. if( aForceReloadFootprint )
  492. {
  493. m_Draw3DFrame->ReloadRequest();
  494. // Force 3D screen refresh immediately
  495. if( GetBoard()->m_Modules )
  496. m_Draw3DFrame->NewDisplay();
  497. }
  498. }
  499. EDA_COLOR_T FOOTPRINT_VIEWER_FRAME::GetGridColor() const
  500. {
  501. return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
  502. }
  503. void FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList( wxCommandEvent& event )
  504. {
  505. wxString msg;
  506. switch( event.GetId() )
  507. {
  508. case ID_MODVIEW_NEXT:
  509. SelectAndViewFootprint( NEXT_PART );
  510. break;
  511. case ID_MODVIEW_PREVIOUS:
  512. SelectAndViewFootprint( PREVIOUS_PART );
  513. break;
  514. default:
  515. wxString id = wxString::Format(wxT("%i"),event.GetId());
  516. wxFAIL_MSG( wxT( "FOOTPRINT_VIEWER_FRAME::OnIterateFootprintList error: id = " ) + id );
  517. }
  518. }
  519. void FOOTPRINT_VIEWER_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
  520. {
  521. }
  522. bool FOOTPRINT_VIEWER_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
  523. {
  524. return true;
  525. }
  526. void FOOTPRINT_VIEWER_FRAME::UpdateTitle()
  527. {
  528. wxString msg;
  529. msg = _( "Library Browser" );
  530. msg << wxT( " [" );
  531. if( getCurNickname().size() )
  532. msg << getCurNickname();
  533. else
  534. msg += _( "no library selected" );
  535. msg << wxT( "]" );
  536. SetTitle( msg );
  537. }
  538. void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
  539. {
  540. wxString selection = SelectLibrary( getCurNickname() );
  541. if( !!selection && selection != getCurNickname() )
  542. {
  543. setCurNickname( selection );
  544. UpdateTitle();
  545. ReCreateFootprintList();
  546. int id = m_libList->FindString( getCurNickname() );
  547. if( id >= 0 )
  548. m_libList->SetSelection( id );
  549. }
  550. }
  551. void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
  552. {
  553. #if 0 // cannot remember why this is here
  554. // The PCB_EDIT_FRAME may not be the FOOTPRINT_VIEW_FRAME's parent,
  555. // so use Kiway().Player() to fetch.
  556. PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, true );
  557. (void*) parent;
  558. #endif
  559. wxString nickname = getCurNickname();
  560. MODULE* oldmodule = GetBoard()->m_Modules;
  561. MODULE* module = LoadModuleFromLibrary( nickname, Prj().PcbFootprintLibs(), false );
  562. if( module )
  563. {
  564. module->SetPosition( wxPoint( 0, 0 ) );
  565. // Only one footprint allowed: remove the previous footprint (if exists)
  566. if( oldmodule )
  567. {
  568. GetBoard()->Remove( oldmodule );
  569. delete oldmodule;
  570. }
  571. setCurFootprintName( module->GetFPID().GetFootprintName() );
  572. wxString nickname = module->GetFPID().GetLibNickname();
  573. if( !getCurNickname() && nickname.size() )
  574. {
  575. // Set the listbox
  576. int index = m_libList->FindString( nickname );
  577. if( index != wxNOT_FOUND )
  578. m_libList->SetSelection( index, true );
  579. setCurNickname( nickname );
  580. }
  581. module->ClearFlags();
  582. SetCurItem( NULL );
  583. Zoom_Automatique( false );
  584. m_canvas->Refresh();
  585. Update3D_Frame();
  586. m_footprintList->SetStringSelection( getCurFootprintName() );
  587. }
  588. }
  589. void FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint( int aMode )
  590. {
  591. if( !getCurNickname() )
  592. return;
  593. int selection = m_footprintList->FindString( getCurFootprintName() );
  594. if( aMode == NEXT_PART )
  595. {
  596. if( selection != wxNOT_FOUND && selection < (int)m_footprintList->GetCount()-1 )
  597. selection++;
  598. }
  599. if( aMode == PREVIOUS_PART )
  600. {
  601. if( selection != wxNOT_FOUND && selection > 0 )
  602. selection--;
  603. }
  604. if( selection != wxNOT_FOUND )
  605. {
  606. m_footprintList->SetSelection( selection );
  607. setCurFootprintName( m_footprintList->GetString( selection ) );
  608. SetCurItem( NULL );
  609. // Delete the current footprint
  610. GetBoard()->m_Modules.DeleteAll();
  611. MODULE* footprint = Prj().PcbFootprintLibs()->FootprintLoad(
  612. getCurNickname(), getCurFootprintName() );
  613. if( footprint )
  614. GetBoard()->Add( footprint, ADD_APPEND );
  615. Update3D_Frame();
  616. if( IsGalCanvasActive() )
  617. updateView();
  618. }
  619. UpdateTitle();
  620. Zoom_Automatique( false );
  621. m_canvas->Refresh();
  622. }
  623. void FOOTPRINT_VIEWER_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
  624. {
  625. if( !GetBoard() )
  626. return;
  627. m_canvas->DrawBackGround( DC );
  628. GetBoard()->Draw( m_canvas, DC, GR_COPY );
  629. MODULE* module = GetBoard()->m_Modules;
  630. m_canvas->DrawCrossHair( DC );
  631. ClearMsgPanel();
  632. if( module )
  633. SetMsgPanel( module );
  634. }
  635. void FOOTPRINT_VIEWER_FRAME::updateView()
  636. {
  637. if( IsGalCanvasActive() )
  638. {
  639. static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( GetBoard() );
  640. m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
  641. m_toolManager->RunAction( COMMON_ACTIONS::zoomFitScreen, true );
  642. }
  643. }
  644. void FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer( wxCommandEvent& event )
  645. {
  646. Close();
  647. }