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.

520 lines
17 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
* 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
14 years ago
14 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
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software: you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation, either version 3 of the License, or (at your
  9. * option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * @file footprint_edit_frame.h
  21. * @brief Definition of class FOOTPRINT_EDIT_FRAME.
  22. */
  23. #ifndef FOOTPRINT_EDIT_FRAME_H
  24. #define FOOTPRINT_EDIT_FRAME_H
  25. #include <pcb_base_frame.h>
  26. #include <pcb_base_edit_frame.h>
  27. #include <io_mgr.h>
  28. #include <config_params.h>
  29. class PCB_LAYER_WIDGET;
  30. class FP_LIB_TABLE;
  31. class EDGE_MODULE;
  32. namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c
  33. class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
  34. {
  35. friend struct PCB::IFACE;
  36. public:
  37. ~FOOTPRINT_EDIT_FRAME();
  38. /**
  39. * Function GetFootprintEditorFrameName (static)
  40. * @return the frame name used when creating the frame
  41. * used to get a reference to this frame, if exists
  42. */
  43. static const wxChar* GetFootprintEditorFrameName();
  44. ///> @copydoc PCB_BASE_EDIT_FRAME::GetModel()
  45. BOARD_ITEM_CONTAINER* GetModel() const override;
  46. BOARD_DESIGN_SETTINGS& GetDesignSettings() const override;
  47. void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ) override;
  48. const PCB_PLOT_PARAMS& GetPlotSettings() const override;
  49. void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) override;
  50. void LoadSettings( wxConfigBase* aCfg ) override;
  51. void SaveSettings( wxConfigBase* aCfg ) override;
  52. double BestZoom() override;
  53. /**
  54. * Function GetConfigurationSettings
  55. * returns the footprint editor settings list.
  56. *
  57. * Currently, only the settings that are needed at start
  58. * up by the main window are defined here. There are other locally used
  59. * settings that are scattered throughout the Pcbnew source code. If you need
  60. * to define a configuration setting that needs to be loaded at run time,
  61. * this is the place to define it.
  62. *
  63. * @return - Reference to the list of applications settings.
  64. */
  65. PARAM_CFG_ARRAY& GetConfigurationSettings();
  66. void OnCloseWindow( wxCloseEvent& Event ) override;
  67. void CloseModuleEditor( wxCommandEvent& Event );
  68. void Process_Special_Functions( wxCommandEvent& event );
  69. void ProcessPreferences( wxCommandEvent& event );
  70. /**
  71. * Function RedrawActiveWindoow
  72. * draws the footprint editor BOARD, and others elements such as axis and grid.
  73. */
  74. void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
  75. /**
  76. * Function ReCreateHToolbar
  77. * create the main horizontal toolbar for the footprint editor
  78. */
  79. void ReCreateHToolbar() override;
  80. void ReCreateVToolbar() override;
  81. void ReCreateOptToolbar() override;
  82. void ReCreateAuxiliaryToolbar() override;
  83. void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
  84. /**
  85. * Function OnLeftDClick
  86. * handles the double click in the footprint editor:
  87. * If the double clicked item is editable: call the corresponding editor.
  88. */
  89. void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
  90. /**
  91. * Function OnRightClick
  92. * handles the right mouse click in the footprint editor:
  93. * Create the pop up menu
  94. * After this menu is built, the standard ZOOM menu is added
  95. */
  96. bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
  97. /**
  98. * @brief (Re)Create the menubar for the module editor frame
  99. */
  100. void ReCreateMenuBar() override;
  101. // The Tool Framework initalization, for GAL mode
  102. void setupTools();
  103. void ToolOnRightClick( wxCommandEvent& event ) override;
  104. void OnSelectOptionToolbar( wxCommandEvent& event );
  105. void OnConfigurePaths( wxCommandEvent& aEvent );
  106. /**
  107. * Function OnSaveLibraryAs
  108. * saves the current library to a new name and/or library type.
  109. *
  110. * @note Saving as a new library type requires the plug-in to support saving libraries
  111. * @see PLUGIN::FootprintSave and PLUGIN::FootprintLibCreate
  112. */
  113. void OnSaveLibraryAs( wxCommandEvent& aEvent );
  114. ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
  115. EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
  116. /**
  117. * Function OnHotKey
  118. * handle hot key events.
  119. * <p>
  120. * Some commands are relative to the item under the mouse cursor. Commands are
  121. * case insensitive
  122. * </p>
  123. */
  124. bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
  125. BOARD_ITEM* PrepareItemForHotkey( bool failIfCurrentlyEdited );
  126. bool OnHotkeyEditItem( int aIdCommand );
  127. bool OnHotkeyDeleteItem( int aIdCommand );
  128. bool OnHotkeyMoveItem( int aIdCommand );
  129. bool OnHotkeyMoveItemExact();
  130. bool OnHotkeyRotateItem( int aIdCommand );
  131. bool OnHotkeyDuplicateItem( int aIdCommand );
  132. /**
  133. * Function Show3D_Frame
  134. * displays 3D view of the footprint (module) being edited.
  135. */
  136. void Show3D_Frame( wxCommandEvent& event ) override;
  137. bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
  138. void OnVerticalToolbar( wxCommandEvent& aEvent );
  139. /**
  140. * handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools
  141. */
  142. void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
  143. /**
  144. * handle most of tools og the vertical right toolbar ("Tools" toolbar)
  145. */
  146. void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
  147. void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent );
  148. void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
  149. void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
  150. void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
  151. void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
  152. ///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
  153. void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) override;
  154. /**
  155. * Function LoadModuleFromBoard
  156. * called from the main toolbar to load a footprint from board mainly to edit it.
  157. */
  158. void LoadModuleFromBoard( wxCommandEvent& event );
  159. /**
  160. * Function SaveFootprint
  161. * Save in an existing library a given footprint
  162. * @param aModule = the given footprint
  163. * @return : true if OK, false if abort
  164. */
  165. bool SaveFootprint( MODULE* aModule );
  166. bool SaveFootprintAs( MODULE* aModule );
  167. /**
  168. * Virtual Function OnModify()
  169. * Must be called after a footprint change
  170. * in order to set the "modify" flag of the current screen
  171. * and prepare, if needed the refresh of the 3D frame showing the footprint
  172. * do not forget to call the basic OnModify function to update auxiliary info
  173. */
  174. virtual void OnModify() override;
  175. /**
  176. * Function ToPrinter
  177. * Install the print dialog
  178. */
  179. void ToPrinter( wxCommandEvent& event );
  180. /**
  181. * Function PrintPage
  182. * is used to print a page. Prints the page pointed by ActiveScreen,
  183. * set by the calling print function.
  184. * @param aDC = wxDC given by the calling print function
  185. * @param aPrintMaskLayer = not used here
  186. * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
  187. * @param aData = a pointer on an auxiliary data (NULL if not used)
  188. */
  189. virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
  190. void * aData = NULL) override;
  191. // BOARD handling
  192. /**
  193. * Function Clear_Pcb
  194. * delete all and reinitialize the current board
  195. * @param aQuery = true to prompt user for confirmation, false to initialize silently
  196. */
  197. bool Clear_Pcb( bool aQuery );
  198. /* handlers for block commands */
  199. virtual int BlockCommand( EDA_KEY key ) override;
  200. /**
  201. * Function HandleBlockPlace
  202. * handles the BLOCK PLACE command
  203. * Last routine for block operation for:
  204. * - block move & drag
  205. * - block copy & paste
  206. */
  207. virtual void HandleBlockPlace( wxDC* DC ) override;
  208. /**
  209. * Function HandleBlockEnd( )
  210. * Handle the "end" of a block command,
  211. * i.e. is called at the end of the definition of the area of a block.
  212. * depending on the current block command, this command is executed
  213. * or parameters are initialized to prepare a call to HandleBlockPlace
  214. * in GetScreen()->m_BlockLocate
  215. * @return false if no item selected, or command finished,
  216. * true if some items found and HandleBlockPlace must be called later
  217. */
  218. virtual bool HandleBlockEnd( wxDC* DC ) override;
  219. BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
  220. /// Return the current library nickname.
  221. const wxString GetCurrentLib() const;
  222. void RemoveStruct( EDA_ITEM* Item );
  223. /**
  224. * Function Transform
  225. * performs a geometric transform on the current footprint.
  226. */
  227. void Transform( MODULE* module, int transform );
  228. // importing / exporting Footprint
  229. /**
  230. * Function Export_Module
  231. * Create a file containing only one footprint.
  232. * Used to export a footprint
  233. * Exported files have the standard ext .emp
  234. * This is the same format as .mod files but restricted to only one footprint
  235. * So Create a new lib (which will contains one module) and export a footprint
  236. * is basically the same thing
  237. * @param aModule = the module to export
  238. */
  239. void Export_Module( MODULE* aModule );
  240. /**
  241. * Function Import_Module
  242. * Read a file containing only one footprint.
  243. * Used to import (after exporting) a footprint
  244. * Exported files have the standard ext .emp
  245. * This is the same format as .mod files but restricted to only one footprint
  246. * The import function can also read gpcb footprint file, in Newlib format
  247. * (One footprint per file, Newlib files have no special ext.)
  248. */
  249. MODULE* Import_Module( const wxString& aName = wxT("") );
  250. /**
  251. * Function Load_Module_From_BOARD
  252. * load in Modedit a footprint from the main board
  253. * @param Module = the module to load. If NULL, a module reference will we asked to user
  254. * @return true if a module isloaded, false otherwise.
  255. */
  256. bool Load_Module_From_BOARD( MODULE* Module );
  257. /**
  258. * Function SelectFootprint
  259. * Display the list of modules currently existing on the BOARD
  260. * @return a pointer to a module if this module is selected or NULL otherwise
  261. * @param aPcb = the board from modules can be loaded
  262. */
  263. MODULE* SelectFootprintFromBoard( BOARD* aPcb );
  264. // functions to edit footprint edges
  265. /**
  266. * Function Edit_Edge_Width
  267. * changes the width of module perimeter lines, EDGE_MODULEs.
  268. * param ModuleSegmentWidth (global) = new width
  269. * @param aEdge = edge to edit, or NULL. If aEdge == NULL change
  270. * the width of all footprint's edges
  271. */
  272. void Edit_Edge_Width( EDGE_MODULE* aEdge );
  273. /**
  274. * Function Edit_Edge_Layer
  275. * changes the EDGE_MODULE Edge layer, (The new layer will be asked)
  276. * if Edge == NULL change the layer of the entire footprint edges
  277. * @param Edge = edge to edit, or NULL
  278. */
  279. void Edit_Edge_Layer( EDGE_MODULE* Edge );
  280. /**
  281. * Function Delete_Edge_Module
  282. * deletes EDGE_MODULE Edge
  283. * @param Edge = edge to delete
  284. */
  285. void Delete_Edge_Module( EDGE_MODULE* Edge );
  286. /**
  287. * Function Begin_Edge_Module
  288. * creates a new edge item (line, arc ..).
  289. * @param Edge = if NULL: create new edge else terminate edge and create a
  290. * new edge
  291. * @param DC = current Device Context
  292. * @param type_edge = S_SEGMENT,S_ARC ..
  293. * @return the new created edge.
  294. */
  295. EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
  296. /**
  297. * Function End_Edge_Module
  298. * terminates a move or create edge function
  299. */
  300. void End_Edge_Module( EDGE_MODULE* Edge );
  301. /// Function to initialize the move function params of a graphic item type DRAWSEGMENT
  302. void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
  303. /// Function to place a graphic item type EDGE_MODULE currently moved
  304. void Place_EdgeMod( EDGE_MODULE* drawitem );
  305. /**
  306. * Function DlgGlobalChange_PadSettings
  307. * changes pad characteristics for the given footprint
  308. * or all footprints which look like the given footprint.
  309. * Options are set by the opened dialog.
  310. * @param aPad is the pattern. The given footprint is the parent of this pad
  311. */
  312. void PushPadProperties( D_PAD* aPad );
  313. /**
  314. * Function DeleteModuleFromLibrary
  315. * prompts user for footprint name, then deletes it from current library.
  316. */
  317. bool DeleteModuleFromLibrary();
  318. /**
  319. * Function IsElementVisible
  320. * tests whether a given element category is visible. Keep this as an
  321. * inline function.
  322. * @param aElement is from the enum by the same name
  323. * @return bool - true if the element is visible.
  324. * @see enum PCB_LAYER_ID
  325. */
  326. bool IsElementVisible( GAL_LAYER_ID aElement ) const;
  327. /**
  328. * Function SetElementVisibility
  329. * changes the visibility of an element category
  330. * @param aElement is from the enum by the same name
  331. * @param aNewState = The new visibility state of the element category
  332. * @see enum PCB_LAYER_ID
  333. */
  334. void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
  335. /**
  336. * Function IsGridVisible() , virtual
  337. * @return true if the grid must be shown
  338. */
  339. virtual bool IsGridVisible() const override;
  340. /**
  341. * Function SetGridVisibility() , virtual
  342. * It may be overloaded by derived classes
  343. * if you want to store/retrieve the grid visibility in configuration.
  344. * @param aVisible = true if the grid must be shown
  345. */
  346. virtual void SetGridVisibility( bool aVisible ) override;
  347. /**
  348. * Function GetGridColor() , virtual
  349. * @return the color of the grid
  350. */
  351. virtual COLOR4D GetGridColor() override;
  352. ///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
  353. void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
  354. ///> @copydoc PCB_BASE_FRAME::OnUpdateLayerAlpha()
  355. void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
  356. ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
  357. virtual void UseGalCanvas( bool aEnable ) override;
  358. /**
  359. * Function OpenProjectFiles (was LoadOnePcbFile)
  360. * loads a KiCad board (.kicad_pcb) from \a aFileName.
  361. *
  362. * @param aFileSet - hold the BOARD file to load, a vector of one element.
  363. *
  364. * @param aCtl - KICTL_ bits, one to indicate that an append of the board file
  365. * aFileName to the currently loaded file is desired.
  366. * @see #KIWAY_PLAYER for bit defines.
  367. *
  368. * @return bool - false if file load fails, otherwise true.
  369. bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
  370. bool aForceFileDialog = false );
  371. */
  372. bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
  373. /**
  374. * Allows Modedit to install its preferences panel into the preferences dialog.
  375. */
  376. void InstallPreferences( PAGED_DIALOG* aParent ) override;
  377. /**
  378. * Called after the preferences dialog is run.
  379. */
  380. void CommonSettingsChanged() override;
  381. /**
  382. * redraws the message panel.
  383. * If a item is currently selected, displays the item info.
  384. * If nothing selected, display the current footprint info, or
  385. * clear the message panel if nothing is edited
  386. */
  387. void UpdateMsgPanel() override;
  388. DECLARE_EVENT_TABLE()
  389. protected:
  390. /// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
  391. FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
  392. PCB_LAYER_WIDGET* m_Layers; ///< the layer manager
  393. /// List of footprint editor configuration parameters.
  394. PARAM_CFG_ARRAY m_configParams;
  395. /**
  396. * Function UpdateTitle
  397. * updates window title according to getLibNickName().
  398. */
  399. void updateTitle();
  400. /// Reloads displayed items and sets view.
  401. void updateView();
  402. /// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
  403. const wxString getLibPath();
  404. void restoreLastFootprint();
  405. void retainLastFootprint();
  406. /**
  407. * Creates a new text for the footprint
  408. * @param aModule is the owner of the text
  409. * @param aDC is the current DC (can be NULL )
  410. * @return a pointer to the new text, or NULL if aborted
  411. */
  412. TEXTE_MODULE* CreateTextModule( MODULE* aModule, wxDC* aDC );
  413. private:
  414. /**
  415. * Function moveExact
  416. * Move the selected item exactly, popping up a dialog to allow the
  417. * user the enter the move delta
  418. */
  419. void moveExact();
  420. /**
  421. * Function duplicateItems
  422. * Duplicate the item under the cursor
  423. * @param aIncrement increment the number of pad (if that is what is selected)
  424. */
  425. void duplicateItems( bool aIncrement ) override;
  426. };
  427. #endif // FOOTPRINT_EDIT_FRAME_H