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.

715 lines
23 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
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
* 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
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
  5. * Copyright (C) 2012-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  6. * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
  7. * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. /**
  27. * @file footprint_wizard_frame.cpp
  28. */
  29. #include <fctsys.h>
  30. #include <kiface_i.h>
  31. #include <gal/graphics_abstraction_layer.h>
  32. #include <class_drawpanel.h>
  33. #include <pcb_draw_panel_gal.h>
  34. #include <pcb_edit_frame.h>
  35. #include <pcbnew.h>
  36. #include <3d_viewer/eda_3d_viewer.h>
  37. #include <msgpanel.h>
  38. #include <macros.h>
  39. #include <bitmaps.h>
  40. #include <grid_tricks.h>
  41. #include <eda_dockart.h>
  42. #include <class_board.h>
  43. #include <class_module.h>
  44. #include <footprint_edit_frame.h>
  45. #include <pcbnew_id.h>
  46. #include "footprint_wizard_frame.h"
  47. #include <footprint_info.h>
  48. #include <wx/grid.h>
  49. #include <wx/tokenzr.h>
  50. #include <wx/numformatter.h>
  51. #include <wx/statline.h>
  52. #include <hotkeys.h>
  53. #include <wildcards_and_files_ext.h>
  54. #include <base_units.h>
  55. #include <tool/tool_manager.h>
  56. #include <tool/tool_dispatcher.h>
  57. #include <tool/common_tools.h>
  58. #include "tools/selection_tool.h"
  59. #include "tools/pcbnew_control.h"
  60. #include "tools/pcb_actions.h"
  61. BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
  62. // Window events
  63. EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
  64. EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
  65. EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
  66. // Toolbar events
  67. EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
  68. EVT_TOOL( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, FOOTPRINT_WIZARD_FRAME::DefaultParameters )
  69. EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT, FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
  70. EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS, FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
  71. EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE, FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
  72. EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
  73. // listbox events
  74. EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
  75. EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
  76. FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
  77. EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset )
  78. END_EVENT_TABLE()
  79. // Note: our FOOTPRINT_WIZARD_FRAME is always modal.
  80. FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent,
  81. FRAME_T aFrameType ) :
  82. PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
  83. wxDefaultPosition, wxDefaultSize,
  84. aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
  85. : KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
  86. FOOTPRINT_WIZARD_FRAME_NAME ),
  87. m_wizardListShown( false )
  88. {
  89. wxASSERT( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD );
  90. // This frame is always show modal:
  91. SetModal( true );
  92. m_showAxis = true; // true to draw axis.
  93. // Give an icon
  94. wxIcon icon;
  95. icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
  96. SetIcon( icon );
  97. m_hotkeysDescrList = g_Module_Viewer_Hotkeys_Descr;
  98. m_wizardName.Empty();
  99. SetBoard( new BOARD() );
  100. // Ensure all layers and items are visible:
  101. GetBoard()->SetVisibleAlls();
  102. SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
  103. GetScreen()->m_Center = true; // Center coordinate origins on screen.
  104. LoadSettings( config() );
  105. SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
  106. // Set some display options here, because the FOOTPRINT_WIZARD_FRAME
  107. // does not have a config menu to do that:
  108. // the footprint wizard frame has no config menu. so use some settings
  109. // from the caller, or force some options:
  110. PCB_BASE_FRAME* caller = dynamic_cast<PCB_BASE_FRAME*>( aParent );
  111. if( caller )
  112. SetUserUnits( caller->GetUserUnits() );
  113. auto disp_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
  114. // In viewer, the default net clearance is not known (it depends on the actual board).
  115. // So we do not show the default clearance, by setting it to 0
  116. // The footprint or pad specific clearance will be shown
  117. GetBoard()->GetDesignSettings().GetDefault()->SetClearance(0);
  118. disp_opts->m_DisplayPadIsol = true;
  119. disp_opts->m_DisplayPadNum = true;
  120. GetBoard()->SetElementVisibility( LAYER_NO_CONNECTS, false );
  121. GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
  122. // Create GAL canvas
  123. #ifdef __WXMAC__
  124. // Cairo renderer doesn't handle Retina displays
  125. EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
  126. #else
  127. EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
  128. #endif
  129. PCB_DRAW_PANEL_GAL* gal_drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
  130. GetGalDisplayOptions(), backend );
  131. SetGalCanvas( gal_drawPanel );
  132. // Create the manager and dispatcher & route draw panel events to the dispatcher
  133. m_toolManager = new TOOL_MANAGER;
  134. m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
  135. gal_drawPanel->GetViewControls(), this );
  136. m_actions = new PCB_ACTIONS();
  137. m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
  138. gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
  139. m_toolManager->RegisterTool( new PCBNEW_CONTROL );
  140. m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
  141. m_toolManager->RegisterTool( new COMMON_TOOLS );
  142. m_toolManager->InitTools();
  143. // Run the control tool, it is supposed to be always active
  144. m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
  145. // Create the toolbars
  146. ReCreateHToolbar();
  147. ReCreateVToolbar();
  148. // Create the parameters panel
  149. m_parametersPanel = new wxPanel( this, wxID_ANY );
  150. m_pageList = new wxListBox( m_parametersPanel, ID_FOOTPRINT_WIZARD_PAGE_LIST,
  151. wxDefaultPosition, wxDefaultSize, 0, NULL,
  152. wxLB_HSCROLL | wxNO_BORDER );
  153. auto divider = new wxStaticLine( m_parametersPanel, wxID_ANY,
  154. wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
  155. m_parameterGrid = new WX_GRID( m_parametersPanel, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
  156. initParameterGrid();
  157. m_parameterGrid->PushEventHandler( new GRID_TRICKS( m_parameterGrid ) );
  158. ReCreatePageList();
  159. wxBoxSizer* parametersSizer = new wxBoxSizer( wxHORIZONTAL );
  160. parametersSizer->Add( m_pageList, 0, wxEXPAND, 5 );
  161. parametersSizer->Add( divider, 0, wxEXPAND, 5 );
  162. parametersSizer->Add( m_parameterGrid, 1, wxEXPAND, 5 );
  163. m_parametersPanel->SetSizer( parametersSizer );
  164. m_parametersPanel->Layout();
  165. // Create the build message box
  166. m_buildMessageBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString,
  167. wxDefaultPosition, wxDefaultSize,
  168. wxTE_MULTILINE | wxTE_READONLY | wxNO_BORDER );
  169. DisplayWizardInfos();
  170. m_auimgr.SetManagedWindow( this );
  171. m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
  172. m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
  173. m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
  174. m_auimgr.AddPane( m_parametersPanel, EDA_PANE().Palette().Name( "Params" ).Left().Position(0)
  175. .Caption( _( "Parameters" ) ).MinSize( 360, 180 ) );
  176. m_auimgr.AddPane( m_buildMessageBox, EDA_PANE().Palette().Name( "Output" ).Left().Position(1)
  177. .CaptionVisible( false ).MinSize( 360, -1 ) );
  178. m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
  179. m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
  180. wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
  181. auto& galOpts = GetGalDisplayOptions();
  182. galOpts.m_fullscreenCursor = true;
  183. galOpts.m_forceDisplayCursor = true;
  184. galOpts.m_axesEnabled = true;
  185. // Set up viewport
  186. KIGFX::VIEW* view = GetGalCanvas()->GetView();
  187. view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
  188. view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
  189. UseGalCanvas();
  190. updateView();
  191. SetActiveLayer( F_Cu );
  192. // Now Drawpanel is sized, we can use BestZoom to show the component (if any)
  193. #ifdef USE_WX_GRAPHICS_CONTEXT
  194. GetScreen()->SetScalingFactor( BestZoom() );
  195. #else
  196. Zoom_Automatique( false );
  197. #endif
  198. // Do not Run a dialog here: on some Window Managers, it creates issues.
  199. // Reason: the FOOTPRINT_WIZARD_FRAME is run as modal;
  200. // It means the call to FOOTPRINT_WIZARD_FRAME::ShowModal will change the
  201. // Event Loop Manager, and stop the one created by the dialog.
  202. // It does not happen on all W.M., perhaps due to the way the order events are called
  203. // See the call in onActivate instead
  204. }
  205. FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
  206. {
  207. // Delete the GRID_TRICKS.
  208. m_parameterGrid->PopEventHandler( true );
  209. GetGalCanvas()->StopDrawing();
  210. // Be sure any event cannot be fired after frame deletion:
  211. GetGalCanvas()->SetEvtHandlerEnabled( false );
  212. // Be sure a active tool (if exists) is desactivated:
  213. if( m_toolManager )
  214. m_toolManager->DeactivateTool();
  215. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  216. if( draw3DFrame )
  217. draw3DFrame->Destroy();
  218. // Now this frame can be deleted
  219. }
  220. void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
  221. {
  222. SaveSettings( config() );
  223. if( IsModal() )
  224. {
  225. // Only dismiss a modal frame once, so that the return values set by
  226. // the prior DismissModal() are not bashed for ShowModal().
  227. if( !IsDismissed() )
  228. DismissModal( false );
  229. }
  230. else
  231. {
  232. Destroy();
  233. }
  234. }
  235. void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
  236. {
  237. DismissModal( true );
  238. Close();
  239. }
  240. void FOOTPRINT_WIZARD_FRAME::OnGridSize( wxSizeEvent& aSizeEvent )
  241. {
  242. // Resize the parameter columns
  243. ResizeParamColumns();
  244. aSizeEvent.Skip();
  245. }
  246. void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
  247. {
  248. if( m_auimgr.GetManagedWindow() )
  249. m_auimgr.Update();
  250. SizeEv.Skip();
  251. }
  252. void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
  253. {
  254. GetScreen()->m_O_Curseur = GetCrossHairPosition();
  255. UpdateStatusBar();
  256. }
  257. void FOOTPRINT_WIZARD_FRAME::updateView()
  258. {
  259. auto dp = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
  260. dp->UseColorScheme( &Settings().Colors() );
  261. dp->DisplayBoard( GetBoard() );
  262. m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
  263. m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
  264. UpdateMsgPanel();
  265. }
  266. void FOOTPRINT_WIZARD_FRAME::UpdateMsgPanel()
  267. {
  268. BOARD_ITEM* footprint = GetBoard()->m_Modules;
  269. if( footprint )
  270. {
  271. MSG_PANEL_ITEMS items;
  272. footprint->GetMsgPanelInfo( m_UserUnits, items );
  273. SetMsgPanel( items );
  274. }
  275. else
  276. ClearMsgPanel();
  277. }
  278. void FOOTPRINT_WIZARD_FRAME::initParameterGrid()
  279. {
  280. m_parameterGridPage = -1;
  281. // Prepare the grid where parameters are displayed
  282. m_parameterGrid->CreateGrid( 0, 3 );
  283. m_parameterGrid->SetColLabelValue( WIZ_COL_NAME, _( "Parameter" ) );
  284. m_parameterGrid->SetColLabelValue( WIZ_COL_VALUE, _( "Value" ) );
  285. m_parameterGrid->SetColLabelValue( WIZ_COL_UNITS, _( "Units" ) );
  286. m_parameterGrid->SetColLabelSize( 22 );
  287. m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
  288. m_parameterGrid->AutoSizeColumns();
  289. m_parameterGrid->AutoSizeRows();
  290. m_parameterGrid->SetRowLabelSize( 0 );
  291. m_parameterGrid->DisableDragGridSize();
  292. m_parameterGrid->DisableDragColSize();
  293. m_parameterGrid->Connect( wxEVT_SIZE,
  294. wxSizeEventHandler( FOOTPRINT_WIZARD_FRAME::OnGridSize ),
  295. NULL, this );
  296. }
  297. void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
  298. {
  299. if( m_pageList == NULL )
  300. return;
  301. FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
  302. if( !footprintWizard )
  303. return;
  304. m_pageList->Clear();
  305. int max_page = footprintWizard->GetNumParameterPages();
  306. for( int i = 0; i<max_page; i++ )
  307. {
  308. wxString name = footprintWizard->GetParameterPageName( i );
  309. m_pageList->Append( name );
  310. }
  311. m_pageList->SetSelection( 0, true );
  312. ReCreateParameterList();
  313. ReCreateHToolbar();
  314. DisplayWizardInfos();
  315. m_canvas->Refresh();
  316. }
  317. void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
  318. {
  319. if( m_parameterGrid == NULL )
  320. return;
  321. FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
  322. if( footprintWizard == NULL )
  323. return;
  324. m_parameterGrid->ClearGrid();
  325. m_parameterGridPage = m_pageList->GetSelection();
  326. if( m_parameterGridPage < 0 ) // Should not happen
  327. return;
  328. // Get the list of names, values, types, hints and designators
  329. wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
  330. wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
  331. wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
  332. wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
  333. wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
  334. // Dimension the wxGrid
  335. if( m_parameterGrid->GetNumberRows() > 0 )
  336. m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() );
  337. m_parameterGrid->AppendRows( namesList.size() );
  338. wxString designator, name, value, units, hint;
  339. for( unsigned int i = 0; i< namesList.size(); i++ )
  340. {
  341. designator = designatorsList[i];
  342. name = namesList[i];
  343. value = valuesList[i];
  344. units = typesList[i];
  345. hint = hintsList[i];
  346. m_parameterGrid->SetRowLabelValue( i, designator );
  347. // Set the 'Name'
  348. m_parameterGrid->SetCellValue( i, WIZ_COL_NAME, name );
  349. m_parameterGrid->SetReadOnly( i, WIZ_COL_NAME );
  350. // Boolean parameters are displayed using a checkbox
  351. if( units == WIZARD_PARAM_UNITS_BOOL )
  352. {
  353. // Set to ReadOnly as we delegate interactivity to GRID_TRICKS
  354. m_parameterGrid->SetReadOnly( i, WIZ_COL_VALUE );
  355. m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer );
  356. }
  357. // Parameters that can be selected from a list of multiple options
  358. else if( units.Contains( "," ) ) // Indicates list of available options
  359. {
  360. wxStringTokenizer tokenizer( units, "," );
  361. wxArrayString options;
  362. while( tokenizer.HasMoreTokens() )
  363. {
  364. options.Add( tokenizer.GetNextToken() );
  365. }
  366. m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellChoiceEditor( options ) );
  367. units = wxT( "" );
  368. }
  369. // Integer parameters
  370. else if( units == WIZARD_PARAM_UNITS_INTEGER )
  371. {
  372. m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellNumberEditor );
  373. }
  374. // Non-integer numerical parameters
  375. else if( ( units == WIZARD_PARAM_UNITS_MM ) ||
  376. ( units == WIZARD_PARAM_UNITS_MILS ) ||
  377. ( units == WIZARD_PARAM_UNITS_FLOAT ) ||
  378. ( units == WIZARD_PARAM_UNITS_RADIANS ) ||
  379. ( units == WIZARD_PARAM_UNITS_DEGREES ) ||
  380. ( units == WIZARD_PARAM_UNITS_PERCENT ) )
  381. {
  382. m_parameterGrid->SetCellEditor( i, WIZ_COL_VALUE, new wxGridCellFloatEditor );
  383. // Convert separators to the locale-specific character
  384. value.Replace( ",", wxNumberFormatter::GetDecimalSeparator() );
  385. value.Replace( ".", wxNumberFormatter::GetDecimalSeparator() );
  386. }
  387. // Set the 'Units'
  388. m_parameterGrid->SetCellValue( i, WIZ_COL_UNITS, units );
  389. m_parameterGrid->SetReadOnly( i, WIZ_COL_UNITS );
  390. // Set the 'Value'
  391. m_parameterGrid->SetCellValue( i, WIZ_COL_VALUE, value );
  392. }
  393. ResizeParamColumns();
  394. }
  395. void FOOTPRINT_WIZARD_FRAME::ResizeParamColumns()
  396. {
  397. // Parameter grid is not yet configured
  398. if( ( m_parameterGrid == NULL ) || ( m_parameterGrid->GetNumberCols() == 0 ) )
  399. return;
  400. // first auto-size the columns to ensure enough space around text
  401. m_parameterGrid->AutoSizeColumns();
  402. // Auto-size the value column
  403. int width = m_parameterGrid->GetClientSize().GetWidth() -
  404. m_parameterGrid->GetRowLabelSize() -
  405. m_parameterGrid->GetColSize( WIZ_COL_NAME ) -
  406. m_parameterGrid->GetColSize( WIZ_COL_UNITS );
  407. if( width > m_parameterGrid->GetColMinimalAcceptableWidth() )
  408. {
  409. m_parameterGrid->SetColSize( WIZ_COL_VALUE, width );
  410. }
  411. }
  412. void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
  413. {
  414. if( m_pageList->GetSelection() > 0 )
  415. {
  416. ReCreateParameterList();
  417. m_canvas->Refresh();
  418. DisplayWizardInfos();
  419. }
  420. }
  421. #define AUI_PERSPECTIVE_KEY wxT( "Fpwizard_auiPerspective" )
  422. void FOOTPRINT_WIZARD_FRAME::LoadSettings( wxConfigBase* aCfg )
  423. {
  424. EDA_DRAW_FRAME::LoadSettings( aCfg );
  425. aCfg->Read( AUI_PERSPECTIVE_KEY, &m_auiPerspective );
  426. }
  427. void FOOTPRINT_WIZARD_FRAME::SaveSettings( wxConfigBase* aCfg )
  428. {
  429. EDA_DRAW_FRAME::SaveSettings( aCfg );
  430. aCfg->Write( AUI_PERSPECTIVE_KEY, m_auimgr.SavePerspective() );
  431. }
  432. void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
  433. {
  434. EDA_DRAW_FRAME::OnActivate( event );
  435. // Ensure we do not have old selection:
  436. if( !event.GetActive() )
  437. return;
  438. if( !m_wizardListShown )
  439. {
  440. m_wizardListShown = true;
  441. SelectFootprintWizard();
  442. }
  443. #if 0
  444. // Currently, we do not have a way to see if a Python wizard has changed,
  445. // therefore the lists of parameters and option has to be rebuilt
  446. // This code could be enabled when this way exists
  447. bool footprintWizardsChanged = false;
  448. if( footprintWizardsChanged )
  449. {
  450. // If we are here, the library list has changed, rebuild it
  451. ReCreatePageList();
  452. DisplayWizardInfos();
  453. }
  454. #endif
  455. }
  456. void FOOTPRINT_WIZARD_FRAME::Show3D_Frame( wxCommandEvent& event )
  457. {
  458. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  459. // We can probably remove this for 6.0, but just to be safe we'll stick to
  460. // one 3DFrame at a time for 5.0
  461. if( draw3DFrame )
  462. draw3DFrame->Close( true );
  463. draw3DFrame = new EDA_3D_VIEWER( &Kiway(), this, _( "3D Viewer" ) );
  464. Update3D_Frame( false );
  465. #ifdef __WXMAC__
  466. // A stronger version of Raise() which promotes the window to its parent's level.
  467. draw3DFrame->ReparentQuasiModal();
  468. #else
  469. draw3DFrame->Raise(); // Needed with some Window Managers
  470. #endif
  471. draw3DFrame->Show( true );
  472. }
  473. /**
  474. * Function Update3D_Frame
  475. * must be called after a footprint selection
  476. * Updates the 3D view and 3D frame title.
  477. */
  478. void FOOTPRINT_WIZARD_FRAME::Update3D_Frame( bool aForceReloadFootprint )
  479. {
  480. EDA_3D_VIEWER* draw3DFrame = Get3DViewerFrame();
  481. if( draw3DFrame == NULL )
  482. return;
  483. wxString frm3Dtitle;
  484. frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), GetChars( m_wizardName ) );
  485. draw3DFrame->SetTitle( frm3Dtitle );
  486. if( aForceReloadFootprint )
  487. {
  488. // Force 3D screen refresh immediately
  489. draw3DFrame->NewDisplay( true );
  490. }
  491. }
  492. void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
  493. {
  494. wxString msg;
  495. if( !m_mainToolBar )
  496. {
  497. m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
  498. KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
  499. // Set up toolbar
  500. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
  501. KiBitmap( module_wizard_xpm ),
  502. _( "Select wizard script to run" ) );
  503. m_mainToolBar->AddSeparator();
  504. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, wxEmptyString,
  505. KiBitmap( reload_xpm ),
  506. _( "Reset wizard parameters to default") );
  507. m_mainToolBar->AddSeparator();
  508. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
  509. KiBitmap( lib_previous_xpm ),
  510. _( "Select previous parameters page" ) );
  511. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
  512. KiBitmap( lib_next_xpm ),
  513. _( "Select next parameters page" ) );
  514. m_mainToolBar->AddSeparator();
  515. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, wxEmptyString,
  516. KiBitmap( three_d_xpm ),
  517. _( "Show footprint in 3D viewer" ) );
  518. m_mainToolBar->AddSeparator();
  519. m_mainToolBar->Add( ACTIONS::zoomRedraw );
  520. m_mainToolBar->Add( ACTIONS::zoomInCenter );
  521. m_mainToolBar->Add( ACTIONS::zoomOutCenter );
  522. m_mainToolBar->Add( ACTIONS::zoomFitScreen );
  523. // The footprint wizard always can export the current footprint
  524. m_mainToolBar->AddSeparator();
  525. m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_DONE,
  526. wxEmptyString, KiBitmap( export_footprint_names_xpm ),
  527. _( "Export footprint to editor" ) );
  528. // after adding the buttons to the toolbar, must call Realize() to
  529. // reflect the changes
  530. m_mainToolBar->Realize();
  531. }
  532. m_mainToolBar->Refresh();
  533. }
  534. void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar()
  535. {
  536. // Currently, there is no vertical toolbar
  537. }
  538. #if defined(KICAD_SCRIPTING)
  539. void FOOTPRINT_WIZARD_FRAME::PythonPluginsReload()
  540. {
  541. // Reload the Python plugins
  542. // Because the board editor has also a plugin python menu,
  543. // call PCB_EDIT_FRAME::PythonPluginsReload() if the board editor
  544. // is running
  545. PCB_EDIT_FRAME* brd_frame =
  546. static_cast<PCB_EDIT_FRAME*>( Kiway().Player( FRAME_PCB, false ) );
  547. if( brd_frame )
  548. brd_frame->PythonPluginsReload();
  549. else
  550. PythonPluginsReloadBase();
  551. }
  552. #endif