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.

230 lines
7.3 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
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
  5. * Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
  6. * Copyright (C) 2004-2012 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 footprint_wizard_frame.h
  27. */
  28. #ifndef FOOTPRINT_WIZARD_FRAME_H_
  29. #define FOOTPRINT_WIZARD_FRAME_H_
  30. #include <wx/gdicmn.h>
  31. #include <class_footprint_wizard.h>
  32. class wxSashLayoutWindow;
  33. class wxListBox;
  34. class wxGrid;
  35. class wxGridEvent;
  36. class FOOTPRINT_EDIT_FRAME;
  37. // A helper class to display messages when building a footprin
  38. class FOOTPRINT_WIZARD_MESSAGES;
  39. /**
  40. * Class FOOTPRINT_WIZARD_FRAME
  41. */
  42. class FOOTPRINT_WIZARD_FRAME : public PCB_BASE_FRAME
  43. {
  44. private:
  45. wxListBox* m_pageList; ///< The list of pages
  46. int m_pageListWidth; ///< width of the window
  47. wxGrid* m_parameterGrid; ///< The list of parameters
  48. int m_parameterGridWidth; ///< size of the grid
  49. FOOTPRINT_WIZARD_MESSAGES* m_messagesFrame;
  50. // Column index to display parameters in m_parameterGrid
  51. static int m_columnPrmName;
  52. static int m_columnPrmValue;
  53. static int m_columnPrmUnit;
  54. protected:
  55. wxString m_wizardName; ///< name of the current wizard
  56. wxString m_wizardDescription; ///< description of the wizard
  57. wxString m_wizardStatus; ///< current wizard status
  58. public:
  59. FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* parent, FRAME_T aFrameType );
  60. ~FOOTPRINT_WIZARD_FRAME();
  61. MODULE* GetBuiltFootprint();
  62. private:
  63. void OnSize( wxSizeEvent& event );
  64. /**
  65. * Function ExportSelectedFootprint();
  66. * will let the caller exit from the wait loop, and get the built footprint
  67. *
  68. */
  69. void ExportSelectedFootprint( wxCommandEvent& aEvent );
  70. /**
  71. * Function OnSashDrag
  72. * resizes the child windows when dragging a sash window border.
  73. */
  74. void OnSashDrag( wxSashEvent& event );
  75. /**
  76. * Function ReCreatePageList
  77. * Creates or recreates the list of parameter pages for the current wizard.
  78. * This list is sorted
  79. */
  80. void ReCreatePageList();
  81. /**
  82. * Function ReCreateParameterList
  83. * Creates the list of parameters for the current page
  84. */
  85. void ReCreateParameterList();
  86. /**
  87. * Function initParameterGrid
  88. * Prepare the grid where parameters are displayed
  89. */
  90. void initParameterGrid();
  91. /**
  92. * Function SelectFootprintWizard
  93. * Shows the list of footprint wizards available into the system
  94. */
  95. void SelectFootprintWizard();
  96. /**
  97. * Function ReloadFootprint
  98. * Reloads the current footprint
  99. */
  100. void ReloadFootprint();
  101. /**
  102. * Function DisplayBuildMessages
  103. * Display the message generated by the python build footprint script
  104. */
  105. void DisplayBuildMessage( wxString& aMessage );
  106. /**
  107. * Function GetMyWizard
  108. * Reloads the wizard by name
  109. */
  110. FOOTPRINT_WIZARD* GetMyWizard();
  111. void Process_Special_Functions( wxCommandEvent& event );
  112. /**
  113. * Function DisplayWizardInfos
  114. * Shows all the details about the current wizard
  115. */
  116. void DisplayWizardInfos();
  117. void RedrawActiveWindow( wxDC* DC, bool EraseBg );
  118. void OnCloseWindow( wxCloseEvent& Event );
  119. void ReCreateHToolbar();
  120. void ReCreateVToolbar();
  121. void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
  122. void ClickOnPageList( wxCommandEvent& event );
  123. void OnSetRelativeOffset( wxCommandEvent& event );
  124. bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 );
  125. void LoadSettings( wxConfigBase* aCfg ); // override virtual
  126. void SaveSettings( wxConfigBase* aCfg ); // override virtual
  127. ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
  128. EDA_HOTKEY* GetHotKeyDescription( int ) const { return NULL; }
  129. /**
  130. * Function OnActivate
  131. * is called when the frame frame is activate to reload the libraries and component lists
  132. * that can be changed by the schematic editor or the library editor.
  133. */
  134. virtual void OnActivate( wxActivateEvent& event );
  135. void SelectCurrentWizard( wxCommandEvent& event );
  136. /**
  137. * Function ParametersUpdated
  138. * Update the footprint python parameters values from the values in grid
  139. */
  140. void ParametersUpdated( wxGridEvent& event );
  141. bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
  142. /**
  143. * Function Show3D_Frame (virtual)
  144. * displays 3D view of the footprint (module) being edited.
  145. */
  146. void Show3D_Frame( wxCommandEvent& event );
  147. /**
  148. * Function Update3D_Frame
  149. * must be called after a footprint selection
  150. * Updates the 3D view and 3D frame title.
  151. * @param aForceReloadFootprint = true to reload data (default)
  152. * = false to update title only -(aftre creating the 3D viewer)
  153. */
  154. void Update3D_Frame( bool aForceReloadFootprint = true );
  155. /*
  156. * Virtual functions, not used here, but needed by PCB_BASE_FRAME
  157. * (virtual pure functions )
  158. */
  159. void OnLeftDClick( wxDC*, const wxPoint& ) {}
  160. void SaveCopyInUndoList( BOARD_ITEM*, UNDO_REDO_T, const wxPoint& ) {}
  161. void SaveCopyInUndoList( const PICKED_ITEMS_LIST&, UNDO_REDO_T, const wxPoint& ) {}
  162. DECLARE_EVENT_TABLE()
  163. };
  164. // A miniframe to display messages from the builder
  165. class FOOTPRINT_WIZARD_MESSAGES: public wxMiniFrame
  166. {
  167. public:
  168. FOOTPRINT_WIZARD_MESSAGES( FOOTPRINT_WIZARD_FRAME* aParent, wxConfigBase* aCfg );
  169. ~FOOTPRINT_WIZARD_MESSAGES();
  170. void PrintMessage( const wxString& aMessage );
  171. void ClearScreen();
  172. void SaveSettings();
  173. void LoadSettings();
  174. private:
  175. wxTextCtrl* m_messageWindow;
  176. wxPoint m_position;
  177. wxSize m_size;
  178. wxConfigBase* m_config;
  179. bool m_canClose; // false to veto a close event, true to allow it
  180. void OnCloseMsgWindow( wxCloseEvent& aEvent );
  181. DECLARE_EVENT_TABLE()
  182. };
  183. #endif // FOOTPRINT_WIZARD_FRM_H_