kicad/pcbnew/module_editor_frame.h

541 lines
18 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file module_editor_frame.h
* @brief Definition of class FOOTPRINT_EDIT_FRAME.
*/
#ifndef MODULE_EDITOR_FRAME_H_
#define MODULE_EDITOR_FRAME_H_
#include <wxBasePcbFrame.h>
#include <pcb_base_edit_frame.h>
#include <io_mgr.h>
#include <config_params.h>
class PCB_LAYER_WIDGET;
class FP_LIB_TABLE;
class EDGE_MODULE;
* 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.
2014-03-20 00:42:08 +00:00
namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
{
* 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.
2014-03-20 00:42:08 +00:00
friend struct PCB::IFACE;
public:
~FOOTPRINT_EDIT_FRAME();
/**
* Function GetFootprintEditorFrameName (static)
* @return the frame name used when creating the frame
* used to get a reference to this frame, if exists
*/
static const wxChar* GetFootprintEditorFrameName();
2017-06-20 06:10:30 +00:00
///> @copydoc PCB_BASE_EDIT_FRAME::GetModel()
2016-05-13 15:31:54 +00:00
BOARD_ITEM_CONTAINER* GetModel() const override;
2016-09-25 17:06:49 +00:00
BOARD_DESIGN_SETTINGS& GetDesignSettings() const override;
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ) override;
2016-09-25 17:06:49 +00:00
const PCB_PLOT_PARAMS& GetPlotSettings() const override;
void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ) override;
2016-09-25 17:06:49 +00:00
void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override;
/**
* Function GetConfigurationSettings
* returns the footpr<EFBFBD>int editor settings list.
*
* Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that needs to be loaded at run time,
* this is the place to define it.
*
* @return - Reference to the list of applications settings.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
void InstallOptionsFrame( const wxPoint& pos );
2016-09-24 18:53:15 +00:00
void OnCloseWindow( wxCloseEvent& Event ) override;
void CloseModuleEditor( wxCommandEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void ProcessPreferences( wxCommandEvent& event );
/**
* Function RedrawActiveWindoow
* draws the footprint editor BOARD, and others elements such as axis and grid.
*/
2016-09-24 18:53:15 +00:00
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
/**
* Function ReCreateHToolbar
* create the main horizontal toolbar for the footprint editor
*/
2016-09-24 18:53:15 +00:00
void ReCreateHToolbar() override;
2016-09-24 18:53:15 +00:00
void ReCreateVToolbar() override;
void ReCreateOptToolbar();
2016-09-24 18:53:15 +00:00
void ReCreateAuxiliaryToolbar() override;
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
/**
* Function OnLeftDClick
* handles the double click in the footprint editor:
* If the double clicked item is editable: call the corresponding editor.
*/
2016-09-24 18:53:15 +00:00
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) override;
/**
* Function OnRightClick
* handles the right mouse click in the footprint editor:
* Create the pop up menu
* After this menu is built, the standard ZOOM menu is added
*/
2016-09-24 18:53:15 +00:00
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
/**
* @brief (Re)Create the menubar for the module editor frame
*/
2016-09-24 18:53:15 +00:00
void ReCreateMenuBar() override;
// The Tool Framework initalization, for GAL mode
void setupTools();
2016-09-24 18:53:15 +00:00
void ToolOnRightClick( wxCommandEvent& event ) override;
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnConfigurePaths( wxCommandEvent& aEvent );
/**
* Function OnSaveLibraryAs
* saves the current library to a new name and/or library type.
*
* @note Saving as a new library type requires the plug-in to support saving libraries
* @see PLUGIN::FootprintSave and PLUGIN::FootprintLibCreate
*/
void OnSaveLibraryAs( wxCommandEvent& aEvent );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
2016-09-24 18:53:15 +00:00
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
/**
* Function OnHotKey
* handle hot key events.
* <p>
* Some commands are relative to the item under the mouse cursor. Commands are
* case insensitive
* </p>
*/
2016-09-24 18:53:15 +00:00
bool OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
BOARD_ITEM* PrepareItemForHotkey( bool failIfCurrentlyEdited );
bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand );
bool OnHotkeyMoveItem( int aIdCommand );
bool OnHotkeyMoveItemExact();
bool OnHotkeyRotateItem( int aIdCommand );
bool OnHotkeyDuplicateItem( int aIdCommand );
/**
* Function Show3D_Frame
* displays 3D view of the footprint (module) being edited.
*/
2016-09-24 18:53:15 +00:00
void Show3D_Frame( wxCommandEvent& event ) override;
2016-09-24 18:53:15 +00:00
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
void OnVerticalToolbar( wxCommandEvent& aEvent );
/**
* handle ID_ZOOM_SELECTION and ID_NO_TOOL_SELECTED tools
*/
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
/**
* handle most of tools og the vertical right toolbar ("Tools" toolbar)
*/
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateLibSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );
void OnUpdateInsertModuleInBoard( wxUpdateUIEvent& aEvent );
void OnUpdateReplaceModuleInBoard( wxUpdateUIEvent& aEvent );
void OnUpdateSelectCurrentLib( wxUpdateUIEvent& aEvent );
///> @copydoc PCB_BASE_EDIT_FRAME::OnEditItemRequest()
2016-09-24 18:53:15 +00:00
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) override;
2010-11-12 15:17:10 +00:00
/**
* Function LoadModuleFromBoard
* called from the main toolbar to load a footprint from board mainly to edit it.
*/
void LoadModuleFromBoard( wxCommandEvent& event );
/**
* Function SaveFootprintInLibrary
* Save in an existing library a given footprint
* @param aLibName = name of the library to use
* @param aModule = the given footprint
* @param aOverwrite = true to overwrite an existing footprint, false to
* abort if an existing footprint with same name is found
* @param aDisplayDialog = true to display a dialog to enter or confirm the
* footprint name
* @return : true if OK, false if abort
*/
bool SaveFootprintInLibrary( const wxString& aLibName,
MODULE* aModule,
bool aOverwrite,
bool aDisplayDialog );
/**
* Virtual Function OnModify()
* Must be called after a footprint change
* in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info
*/
2016-09-24 18:53:15 +00:00
virtual void OnModify() override;
2010-11-12 15:17:10 +00:00
/**
* Function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
/**
2012-02-19 04:02:19 +00:00
* Function PrintPage
* is used to print a page. Prints the page pointed by ActiveScreen,
* set by the calling print function.
* @param aDC = wxDC given by the calling print function
2010-12-29 17:47:32 +00:00
* @param aPrintMaskLayer = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LSET aPrintMaskLayer, bool aPrintMirrorMode,
2016-09-25 17:06:49 +00:00
void * aData = NULL) override;
// BOARD handling
2010-11-12 15:17:10 +00:00
/**
* Function Clear_Pcb
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to initialize silently
*/
bool Clear_Pcb( bool aQuery );
/* handlers for block commands */
2016-09-24 18:53:15 +00:00
virtual int BlockCommand( EDA_KEY key ) override;
/**
* Function HandleBlockPlace
* handles the BLOCK PLACE command
* Last routine for block operation for:
* - block move & drag
* - block copy & paste
*/
2016-09-24 18:53:15 +00:00
virtual void HandleBlockPlace( wxDC* DC ) override;
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
2016-09-24 18:53:15 +00:00
virtual bool HandleBlockEnd( wxDC* DC ) override;
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
/// Return the current library nickname.
const wxString GetCurrentLib() const;
// Footprint edition
void RemoveStruct( EDA_ITEM* Item );
/**
* Function Transform
* performs a geometric transform on the current footprint.
*/
void Transform( MODULE* module, int transform );
// importing / exporting Footprint
2010-12-29 17:47:32 +00:00
/**
* Function Export_Module
* Create a file containing only one footprint.
* Used to export a footprint
* Exported files have the standard ext .emp
* This is the same format as .mod files but restricted to only one footprint
* So Create a new lib (which will contains one module) and export a footprint
* is basically the same thing
* @param aModule = the module to export
*/
void Export_Module( MODULE* aModule );
/**
* Function Import_Module
* Read a file containing only one footprint.
* Used to import (after exporting) a footprint
* Exported files have the standard ext .emp
* This is the same format as .mod files but restricted to only one footprint
* The import function can also read gpcb footprint file, in Newlib format
* (One footprint per file, Newlib files have no special ext.)
*/
MODULE* Import_Module( const wxString& aName = wxT("") );
/**
* Function SaveCurrentModule
* saves the module which is currently being edited into aLibPath or into the
* currently selected library if aLibPath is NULL.
* @return bool - true if successfully saved, else false because abort or error.
*/
bool SaveCurrentModule( const wxString* aLibPath = NULL );
2010-11-12 15:17:10 +00:00
/**
* Function Load_Module_From_BOARD
* load in Modedit a footprint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise.
*/
bool Load_Module_From_BOARD( MODULE* Module );
2010-11-12 15:17:10 +00:00
/**
* Function SelectFootprint
* Display the list of modules currently existing on the BOARD
* @return a pointer to a module if this module is selected or NULL otherwise
* @param aPcb = the board from modules can be loaded
*/
MODULE* SelectFootprint( BOARD* aPcb );
// functions to edit footprint edges
2010-11-12 15:17:10 +00:00
/**
* Function Edit_Edge_Width
* changes the width of module perimeter lines, EDGE_MODULEs.
* param ModuleSegmentWidth (global) = new width
* @param aEdge = edge to edit, or NULL. If aEdge == NULL change
* the width of all footprint's edges
*/
void Edit_Edge_Width( EDGE_MODULE* aEdge );
/**
* Function Edit_Edge_Layer
* changes the EDGE_MODULE Edge layer, (The new layer will be asked)
* if Edge == NULL change the layer of the entire footprint edges
* @param Edge = edge to edit, or NULL
*/
void Edit_Edge_Layer( EDGE_MODULE* Edge );
/**
* Function Delete_Edge_Module
* deletes EDGE_MODULE Edge
* @param Edge = edge to delete
*/
void Delete_Edge_Module( EDGE_MODULE* Edge );
/**
* Function Begin_Edge_Module
* creates a new edge item (line, arc ..).
* @param Edge = if NULL: create new edge else terminate edge and create a
* new edge
* @param DC = current Device Context
* @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge.
*/
2012-05-22 17:51:18 +00:00
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
/**
* Function End_Edge_Module
* terminates a move or create edge function
*/
void End_Edge_Module( EDGE_MODULE* Edge );
2010-11-12 15:17:10 +00:00
/**
* Function Enter_Edge_Width
2010-12-29 17:47:32 +00:00
* Edition of width of module outlines
* Ask for a new width.
* Change the width of EDGE_MODULE Edge if aEdge != NULL
* @param aEdge = edge to edit, or NULL
2010-12-29 17:47:32 +00:00
* changes ModuleSegmentWidth (global) = new width
*/
void Enter_Edge_Width( EDGE_MODULE* aEdge );
/// Function to initialize the move function params of a graphic item type DRAWSEGMENT
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
/// Function to place a graphic item type EDGE_MODULE currently moved
void Place_EdgeMod( EDGE_MODULE* drawitem );
/**
* Function InstallFootprintBodyItemPropertiesDlg
* Install a dialog to edit a graphic item of a footprint body.
* @param aItem = a pointer to the graphic item to edit
*/
void InstallFootprintBodyItemPropertiesDlg( EDGE_MODULE* aItem );
/**
* Function DlgGlobalChange_PadSettings
* changes pad characteristics for the given footprint
2012-02-19 04:02:19 +00:00
* or all footprints which look like the given footprint.
* Options are set by the opened dialog.
* @param aPad is the pattern. The given footprint is the parent of this pad
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad );
/**
* Function DeleteModuleFromCurrentLibrary
* prompts user for footprint name, then deletes it from current library.
*/
bool DeleteModuleFromCurrentLibrary();
/**
* Function IsElementVisible
* tests whether a given element category is visible. Keep this as an
* inline function.
* @param aElement is from the enum by the same name
* @return bool - true if the element is visible.
* @see enum PCB_LAYER_ID
*/
bool IsElementVisible( GAL_LAYER_ID aElement ) const;
/**
* Function SetElementVisibility
* changes the visibility of an element category
* @param aElement is from the enum by the same name
* @param aNewState = The new visibility state of the element category
* @see enum PCB_LAYER_ID
*/
void SetElementVisibility( GAL_LAYER_ID aElement, bool aNewState );
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
2016-09-24 18:53:15 +00:00
virtual bool IsGridVisible() const override;
/**
* Function SetGridVisibility() , virtual
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
2016-09-24 18:53:15 +00:00
virtual void SetGridVisibility( bool aVisible ) override;
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual COLOR4D GetGridColor() override;
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
2016-09-24 18:53:15 +00:00
virtual void UseGalCanvas( bool aEnable ) override;
/**
* Function OpenProjectFiles (was LoadOnePcbFile)
* loads a KiCad board (.kicad_pcb) from \a aFileName.
*
* @param aFileSet - hold the BOARD file to load, a vector of one element.
*
* @param aCtl - KICTL_ bits, one to indicate that an append of the board file
* aFileName to the currently loaded file is desired.
* @see #KIWAY_PLAYER for bit defines.
*
* @return bool - false if file load fails, otherwise true.
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false );
*/
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
DECLARE_EVENT_TABLE()
protected:
* 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.
2014-03-20 00:42:08 +00:00
/// protected so only friend PCB::IFACE::CreateWindow() can act as sole factory.
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.
2014-05-03 17:40:19 +00:00
FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
* 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.
2014-03-20 00:42:08 +00:00
PCB_LAYER_WIDGET* m_Layers; ///< the layer manager
/// List of footprint editor configuration parameters.
PARAM_CFG_ARRAY m_configParams;
/**
* Function UpdateTitle
* updates window title according to getLibNickName().
*/
void updateTitle();
/// Reloads displayed items and sets view.
void updateView();
/// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
const wxString getLibPath();
void restoreLastFootprint();
void retainLastFootprint();
/**
* Creates a new text for the footprint
* @param aModule is the owner of the text
* @param aDC is the current DC (can be NULL )
* @return a pointer to the new text, or NULL if aborted
*/
TEXTE_MODULE* CreateTextModule( MODULE* aModule, wxDC* aDC );
private:
/**
* Function moveExact
* Move the selected item exactly, popping up a dialog to allow the
* user the enter the move delta
*/
void moveExact();
/**
* Function duplicateItems
* Duplicate the item under the cursor
* @param aIncrement increment the number of pad (if that is what is selected)
*/
2016-09-25 17:06:49 +00:00
void duplicateItems( bool aIncrement ) override;
};
#endif // MODULE_EDITOR_FRAME_H_