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.

225 lines
6.9 KiB

Modular-Kicad milestone B), major portions: *) Rework the set language support, simplify it by using KIWAY. Now any major frame with a "change language" menu can change the language for all KIWAY_PLAYERs in the whole KIWAY. Multiple KIWAYs are not supported yet. *) Simplify "modal wxFrame" support, and add that support exclusively to KIWAY_PLAYER where it is inherited by all derivatives. The function KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable. *) Remove the requirements and assumptions that the wxFrame hierarchy always had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers and editors. This is no longer the case, nor required. *) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame quickly. It also gives control to the KIWAY as to frame hierarchical relationships. *) Change single_top to use the KIWAY for loading a KIFACE and instantiating the single KIWAY_PLAYER, see bullet immediately above. *) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this gives the KIFACEs a chance to save their final configuration dope to disk. *) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and these modal frames are distinctly different than their non-modal equivalents. KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor, so this is another important reason for having a dedicated FRAME_T for each modal wxFrame. On balance, more lines were deleted than were added to achieve all this.
12 years ago
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
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
  5. * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  6. * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file footprint_wizard_frame.h
  27. */
  28. #ifndef FOOTPRINT_WIZARD_FRAME_H_
  29. #define FOOTPRINT_WIZARD_FRAME_H_
  30. #include <wx/gdicmn.h>
  31. #include <footprint_wizard.h>
  32. class wxSashLayoutWindow;
  33. class wxListBox;
  34. class WX_GRID;
  35. class wxGridEvent;
  36. class FOOTPRINT_EDIT_FRAME;
  37. enum WizardParameterColumnNames
  38. {
  39. WIZ_COL_NAME = 0,
  40. WIZ_COL_VALUE,
  41. WIZ_COL_UNITS
  42. };
  43. /**
  44. * Class FOOTPRINT_WIZARD_FRAME
  45. */
  46. class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
  47. {
  48. private:
  49. wxPanel* m_parametersPanel; ///< Panel for the page list and parameter grid
  50. wxListBox* m_pageList; ///< The list of pages
  51. WX_GRID* m_parameterGrid; ///< The list of parameters
  52. int m_parameterGridPage; ///< the page currently displayed by m_parameterGrid
  53. ///< it is most of time the m_pageList selection, but can differ
  54. ///< during transitions between pages.
  55. wxTextCtrl* m_buildMessageBox;
  56. wxString m_auiPerspective; ///< Encoded string describing the AUI layout
  57. bool m_wizardListShown; ///< A show-once flag for the wizard list
  58. protected:
  59. wxString m_wizardName; ///< name of the current wizard
  60. wxString m_wizardDescription; ///< description of the wizard
  61. wxString m_wizardStatus; ///< current wizard status
  62. public:
  63. FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
  64. ~FOOTPRINT_WIZARD_FRAME();
  65. MODULE* GetBuiltFootprint();
  66. /**
  67. * Reload the Python plugins if they are newer than
  68. * the already loaded, and load new plugins if any
  69. * Do nothing if KICAD_SCRIPTING is not defined
  70. */
  71. void PythonPluginsReload();
  72. private:
  73. void OnSize( wxSizeEvent& event ) override;
  74. void OnGridSize( wxSizeEvent& aSizeEvent );
  75. /**
  76. * redraws the message panel.
  77. * display the current footprint info, or
  78. * clear the message panel if nothing is loaded
  79. */
  80. void UpdateMsgPanel() override;
  81. /**
  82. * rebuild the GAL view (reint tool manager, colors and drawings)
  83. * must be run after any footprint change.
  84. */
  85. void updateView();
  86. /**
  87. * Function ExportSelectedFootprint();
  88. * will let the caller exit from the wait loop, and get the built footprint
  89. *
  90. */
  91. void ExportSelectedFootprint( wxCommandEvent& aEvent );
  92. /**
  93. * Function OnSashDrag
  94. * resizes the child windows when dragging a sash window border.
  95. */
  96. void OnSashDrag( wxSashEvent& event );
  97. /**
  98. * Function ReCreatePageList
  99. * Creates or recreates the list of parameter pages for the current wizard.
  100. * This list is sorted
  101. */
  102. void ReCreatePageList();
  103. /**
  104. * Function ReCreateParameterList
  105. * Creates the list of parameters for the current page
  106. */
  107. void ReCreateParameterList();
  108. /**
  109. * Expand the 'Value' column to fill available
  110. */
  111. void ResizeParamColumns();
  112. /**
  113. * Function initParameterGrid
  114. * Prepare the grid where parameters are displayed
  115. */
  116. void initParameterGrid();
  117. /**
  118. * Function SelectFootprintWizard
  119. * Shows the list of footprint wizards available into the system
  120. */
  121. void SelectFootprintWizard();
  122. /**
  123. * Function ReloadFootprint
  124. * Reloads the current footprint
  125. */
  126. void ReloadFootprint();
  127. /**
  128. * Function DisplayBuildMessages
  129. * Display the message generated by the python build footprint script
  130. */
  131. void DisplayBuildMessage( wxString& aMessage );
  132. /**
  133. * Function GetMyWizard
  134. * Reloads the wizard by name
  135. */
  136. FOOTPRINT_WIZARD* GetMyWizard();
  137. void Process_Special_Functions( wxCommandEvent& event );
  138. /**
  139. * Function DisplayWizardInfos
  140. * Shows all the details about the current wizard
  141. */
  142. void DisplayWizardInfos();
  143. void OnCloseWindow( wxCloseEvent& Event ) override;
  144. void ReCreateHToolbar() override;
  145. void ReCreateVToolbar() override;
  146. void ClickOnPageList( wxCommandEvent& event );
  147. void LoadSettings( wxConfigBase* aCfg ) override;
  148. void SaveSettings( wxConfigBase* aCfg ) override;
  149. /**
  150. * Function OnActivate
  151. * is called when the frame frame is activate to reload the libraries and component lists
  152. * that can be changed by the schematic editor or the library editor.
  153. */
  154. void OnActivate( wxActivateEvent& event );
  155. void SelectCurrentWizard( wxCommandEvent& event );
  156. void DefaultParameters( wxCommandEvent& event );
  157. /**
  158. * Function ParametersUpdated
  159. * Update the footprint python parameters values from the values in grid
  160. */
  161. void ParametersUpdated( wxGridEvent& event );
  162. /**
  163. * Function Update3D_Frame
  164. * must be called after a footprint selection
  165. * Updates the 3D view and 3D frame title.
  166. * @param aForceReload = true to reload data immediately
  167. * @param aTitle (optional) the window title to set for the viewer
  168. */
  169. void Update3DView( bool aForceReload, const wxString* aTitle ) override;
  170. /*
  171. * Virtual functions, not used here, but needed by PCB_BASE_FRAME
  172. * (virtual pure functions )
  173. */
  174. void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) override {}
  175. void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) override {}
  176. DECLARE_EVENT_TABLE()
  177. };
  178. #endif // FOOTPRINT_WIZARD_FRM_H_