kicad/include/wxPcbStruct.h

1693 lines
62 KiB
C
Raw Normal View History

/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 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 wxPcbStruct.h
*/
2008-01-01 11:58:14 +00:00
2012-10-15 22:30:01 +00:00
#ifndef WXPCB_STRUCT_H_
#define WXPCB_STRUCT_H_
2008-01-01 11:58:14 +00:00
#include <wxBasePcbFrame.h>
#include <param_config.h>
#include <class_macros_record.h>
#include <class_undoredo_container.h>
2012-02-06 05:44:19 +00:00
#include <zones.h>
2008-01-01 11:58:14 +00:00
/* Forward declarations of classes. */
class PCB_SCREEN;
class BOARD;
class TEXTE_PCB;
class MODULE;
class TRACK;
class SEGZONE;
class SEGVIA;
class D_PAD;
class TEXTE_MODULE;
class PCB_TARGET;
class DIMENSION;
2008-01-01 11:58:14 +00:00
class EDGE_MODULE;
class DRC;
class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
2010-01-24 02:05:07 +00:00
class PCB_LAYER_WIDGET;
class MARKER_PCB;
class BOARD_ITEM;
class PCB_LAYER_BOX_SELECTOR;
class NETLIST;
class REPORTER;
class PARSE_ERROR;
class IO_ERROR;
class FP_LIB_TABLE;
2008-01-01 11:58:14 +00:00
2009-07-30 11:04:07 +00:00
/**
* class PCB_EDIT_FRAME
* the main frame for Pcbnew
*
* See also class PCB_BASE_FRAME(): Basic class for Pcbnew and GerbView.
2009-11-23 20:18:47 +00:00
*/
class PCB_EDIT_FRAME : public PCB_BASE_FRAME
2008-01-01 11:58:14 +00:00
{
2010-01-24 02:05:07 +00:00
friend class PCB_LAYER_WIDGET;
void updateTraceWidthSelectBox();
void updateViaSizeSelectBox();
int m_RecordingMacros;
MACROS_RECORDED m_Macros[10];
/// The auxiliary right vertical tool bar used to access the microwave tools.
wxAuiToolBar* m_microWaveToolBar;
/// The global footprint library table.
FP_LIB_TABLE* m_globalFootprintTable;
/**
* Function loadFootprints
* loads the footprints for each #COMPONENT in \a aNetlist from the list of libraries.
*
* @param aNetlist is the netlist of components to load the footprints into.
* @param aReporter is the #REPORTER object to report to.
* @throw IO_ERROR if an I/O error occurs or a #PARSE_ERROR if a file parsing error
* occurs while reading footprint library files.
*/
void loadFootprints( NETLIST& aNetlist, REPORTER* aReporter )
throw( IO_ERROR, PARSE_ERROR );
2010-01-21 07:41:30 +00:00
protected:
#ifdef KICAD_SCRIPTING_WXPYTHON
// Panel used to let user talk with internal scripting
wxWindow* m_pythonPanel;
bool m_pythonPanelHidden;
#endif
2010-01-24 02:05:07 +00:00
PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp
2010-01-24 02:05:07 +00:00
PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path.
bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist
// to know the footprint name of components.
2010-01-24 02:05:07 +00:00
// we'll use lower case function names for private member functions.
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
void createPopUpMenuForFpTexts( TEXTE_MODULE* aText, wxMenu* aPopMenu );
void createPopUpMenuForFpPads( D_PAD* aPad, wxMenu* aPopMenu );
void createPopupMenuForTracks( TRACK* aTrack, wxMenu* aPopMenu );
void createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu );
void createPopUpBlockMenu( wxMenu* menu );
void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );
2010-01-21 07:41:30 +00:00
/**
2010-01-24 02:05:07 +00:00
* Function setActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
2010-01-21 07:41:30 +00:00
*/
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true )
2010-01-21 07:41:30 +00:00
{
2010-01-24 02:05:07 +00:00
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
if( doLayerWidgetUpdate )
2012-02-06 05:44:19 +00:00
syncLayerWidgetLayer();
2010-01-24 02:05:07 +00:00
}
/**
* Function getActiveLayer
* returns the active layer
*/
LAYER_NUM getActiveLayer()
2010-01-24 02:05:07 +00:00
{
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
}
/**
2012-02-06 05:44:19 +00:00
* Function syncLayerWidgetLayer
* updates the currently layer "selection" within the PCB_LAYER_WIDGET.
* The currently selected layer is defined by the return value of getActiveLayer().
2010-01-24 02:05:07 +00:00
* <p>
* This function cannot be inline without including layer_widget.h in
* here and we do not want to do that.
* </p>
2010-01-24 02:05:07 +00:00
*/
2012-02-06 05:44:19 +00:00
void syncLayerWidgetLayer();
/**
* Function syncRenderStates
* updates the "Render" checkboxes in the layer widget according
* to current toggle values determined by IsElementVisible(), and is helpful
* immediately after loading a BOARD which may have state information in it.
*/
void syncRenderStates();
2010-01-24 02:05:07 +00:00
/**
* Function syncLayerVisibilities
* updates each "Layer" checkbox in the layer widget according
* to each layer's current visibility determined by IsLayerVisible(), and is
* helpful immediately after loading a BOARD which may have state information in it.
*/
void syncLayerVisibilities();
virtual void unitsChangeRefresh();
2010-01-21 07:41:30 +00:00
/**
* Function doAutoSave
* performs auto save when the board has been modified and not saved within the
* auto save interval.
*
* @return true if the auto save was successful.
*/
virtual bool doAutoSave();
/**
* Function isautoSaveRequired
* returns true if the board has been modified.
*/
virtual bool isAutoSaveRequired() const;
/**
* Function duplicateZone
* duplicates the given zone.
* @param aDC is the current Device Context.
* @param aZone is the zone to duplicate
*/
void duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone );
/**
* Function loadFootprintLibTable
* deletes the existing #FP_LIB_TABLE and creates a new one when a new project is loaded.
*/
void loadFootprintLibTable();
2008-01-01 11:58:14 +00:00
public:
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
wxComboBox* m_SelTrackWidthBox; // a combo box to display and select current track width
wxComboBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
2009-11-23 20:18:47 +00:00
bool m_show_microwave_tools;
bool m_show_layer_manager_tools;
2008-01-01 11:58:14 +00:00
public:
PCB_EDIT_FRAME( wxWindow* father, const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2008-01-01 11:58:14 +00:00
~PCB_EDIT_FRAME();
2008-01-01 11:58:14 +00:00
void OnQuit( wxCommandEvent& event );
2010-01-18 19:33:45 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function ToPlotter
* Open a dialog frame to create plot and drill files
* relative to the current board
*/
void ToPlotter( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
/**
* Function SVG_Print
* shows the print SVG file dialog.
*/
void SVG_Print( wxCommandEvent& event );
2010-11-17 21:47:27 +00:00
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateShowModuleRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateAutoDeleteTrack( wxUpdateUIEvent& aEvent );
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
2011-03-03 19:08:13 +00:00
void OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
/**
* Function RecordMacros.
* records sequence of hotkeys and cursor positions to a macro.
* @param aDC = current device context
* @param aNumber The current number macros.
*/
void RecordMacros( wxDC* aDC, int aNumber );
/**
* Function CallMacros
* play hotkeys and cursor position from a recorded macro.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/
void CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber );
void SaveMacros();
void ReadMacros();
2010-11-17 21:47:27 +00:00
/**
* Function PrintPage , virtual
* used to print a page
* Print the page pointed by the current screen, 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 = a 32 bits mask: bit n = 1 -> layer n is printed
* @param aPrintMirrorMode = true to plot mirrored
* @param aData = a pointer on an auxiliary data (NULL if not used)
*/
virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode,
void * aData = NULL );
void GetKicadAbout( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function IsGridVisible() , virtual
2010-02-01 21:23:27 +00:00
* @return true if the grid must be shown
*/
virtual bool IsGridVisible() const;
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetGridVisibility() , virtual
2010-02-01 21:23:27 +00:00
* It may be overloaded by derived classes
* if you want to store/retrieve the grid visibility in configuration.
2010-02-01 21:23:27 +00:00
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility( bool aVisible );
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function GetGridColor() , virtual
2010-02-01 21:23:27 +00:00
* @return the color of the grid
*/
virtual EDA_COLOR_T GetGridColor() const;
2010-02-01 21:23:27 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetGridColor() , virtual
2010-02-01 21:23:27 +00:00
* @param aColor = the new color of the grid
*/
virtual void SetGridColor(EDA_COLOR_T aColor);
2010-02-01 21:23:27 +00:00
2008-01-01 11:58:14 +00:00
// Configurations:
void InstallConfigFrame();
void Process_Config( wxCommandEvent& event );
2009-11-23 20:18:47 +00:00
/**
* Function GetProjectFileParameters
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
* returns a project file parameter list for Pcbnew.
* <p>
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
* Populate a project file parameter array specific to Pcbnew.
* Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design.
* </p>
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
* @return PARAM_CFG_ARRAY - it is only good until SetBoard() is called, so
* don't keep it around past that event.
*/
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
PARAM_CFG_ARRAY GetProjectFileParameters();
/**
* Function SaveProjectSettings
* saves changes to the project settings to the project (.pro) file.
* @param aAskForSave = true to open a dialog before saving the settings
*/
void SaveProjectSettings( bool aAskForSave );
/**
* Load the project file configuration settings.
*
* @param aProjectFileName = The project filename.
* if not found use kicad.pro and initialize default values
* @return always returns true.
*/
bool LoadProjectSettings( const wxString& aProjectFileName );
/**
* Function GetConfigurationSettings
* returns the Pcbnew applications settings list.
*
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
* This replaces the old statically defined list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
++PCBNew * Removed Pcb_Frame argument from BOARD() constructor, since it precludes having a BOARD being edited by more than one editor, it was a bad design. And this meant removing m_PcbFrame from BOARD. * removed BOARD::SetWindowFrame(), and BOARD::m_PcbFrame * Removed the global BOARD_DESIGN_SETTINGS which was in class_board.cpp * added BOARD_DESIGN_SETTINGS to the BOARD class, a full instance * a couple dialogs now only change BOARD_DESIGN_SETTINGS when OK is pressed, such as dialog_mask_clearance, dialog_drc, etc. * Removed common/pcbcommon.cpp's int g_CurrentVersionPCB = 1 and replaced it with build_version.h's #define BOARD_FILE_VERSION, although there may be a better place for this constant. * Made the public functions in PARAM_CFG_ARRAY be type const. void SaveParam(..) const and void ReadParam(..) const * PARAM_CFG_BASE now has virtual destructor since we have various way of destroying the derived class and boost::ptr_vector must be told about this. * Pass const PARAM_CFG_ARRAY& instead of PARAM_CFG_ARRAY so that we can use an automatic PARAM_CFG_ARRAY which is on the stack.\ * PCB_EDIT_FRAME::GetProjectFileParameters() may no longer cache the array, since it has to access the current BOARD and the BOARD can change. Remember BOARD_DESIGN_SETTINGS are now in the BOARD. * Made the m_BoundingBox member private, this was a brutally hard task, and indicative of the lack of commitment to accessors and object oriented design on the part of KiCad developers. We must do better. Added BOARD::GetBoundingBox, SetBoundingBox(), ComputeBoundingBox(). * Added PCB_BASE_FRAME::GetBoardBoundingBox() which calls BOARD::ComputeBoundingBox()
2011-12-05 06:15:33 +00:00
* 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.
*
* @todo: Define the configuration variables as member variables instead of
* global variables or move them to the object class where they are
* used.
* @return - Reference to the list of applications settings.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
/**
* Function LoadSettings
* loads applications settings specific to Pcbnew.
*
* This overrides the base class PCB_BASE_FRAME::LoadSettings() to
* handle settings specific common to the PCB layout application. It
* calls down to the base class to load settings common to all PCB type
* drawing frames. Please put your application settings for Pcbnew here
* to avoid having application settings loaded all over the place.
*/
virtual void LoadSettings();
/**
* Function SaveSettings
* saves applications settings common to Pcbnew.
*
* This overrides the base class PCB_BASE_FRAME::SaveSettings() to
* save settings specific to the PCB layout application main window. It
* calls down to the base class to save settings common to all PCB type
* drawing frames. Please put your application settings for Pcbnew here
* to avoid having application settings saved all over the place.
*/
virtual void SaveSettings();
/**
* Get the last net list read with the net list dialog box.
*
* @return - Absolute path and file name of the last net list file successfully read.
*/
wxString GetLastNetListRead();
/**
* Set the last net list successfully read by the net list dialog box.
*
* Note: the file path is converted to a path relative to the project file path. If
* the path cannot be made relative, than m_lastNetListRead is set to and empty
* string. This could happen when the net list file is on a different drive than
* the project file. The advantage of relative paths is that is more likely to
* work when opening the same project from both Windows and Linux.
*
* @param aNetListFile - The last net list file with full path successfully read.
*/
void SetLastNetListRead( const wxString& aNetListFile );
/**
* @return true if the .cmp file created by CvPcb should be used to know the
* footprint associated to components, false to use the netlist file only
*/
bool GetUseCmpFileForFpNames() { return m_useCmpFileForFpNames; }
/**
* Set the default option to use or not the .cmp file craeted by CvPcb
* should be used to know the footprints associated to components when
* reading a netlist
* When the .cmp netlist is not used, footprint names are read from the netlist.
* This imply the user has filled the footprint fields in schematic
* @param aUseCmpfile = true to use the .cmp file,
* false to use the netlist file only
*/
void SetUseCmpFileForFpNames( bool aUseCmpfile)
{
m_useCmpFileForFpNames = aUseCmpfile;
}
2010-11-12 15:17:10 +00:00
/**
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
2010-11-12 15:17:10 +00:00
/**
* Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool OnHotkeyDeleteItem( wxDC* aDC );
/**
* Function OnHotkeyPlaceItem
* Place the item (footprint, track, text .. ) found under the mouse cursor
* An item can be placed only if there is this item currently edited
* Only a footprint, a pad or a track can be placed
* @param aDC = current device context
* @return true if an item was placed
*/
bool OnHotkeyPlaceItem( wxDC* aDC );
bool OnHotkeyEditItem( int aIdCommand );
/**
* Function OnHotkeyCopyItem
* returns the copy event id for copyable items.
* @return Event id of a suitable copy event, zero when no copyable item found.
*/
int OnHotkeyCopyItem();
2010-11-12 15:17:10 +00:00
/**
* Function OnHotkeyMoveItem
* Moves or drag the item (footprint, track, text .. ) found under the mouse cursor
* Only a footprint or a track can be dragged
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyMoveItem( int aIdCommand );
2010-11-12 15:17:10 +00:00
/**
* Function OnHotkeyRotateItem
* Rotate the item (text or footprint) found under the mouse cursor
* @note This command can be used with an item currently in edit.
* Only some items can be rotated (footprints and texts).
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool OnHotkeyRotateItem( int aIdCommand );
2012-12-01 20:03:33 +00:00
/**
* Function OnHotkeyBeginRoute
* If the current active layer is a copper layer,
* and if no item currently edited, start a new track segmenton
* the current copper layer.
* If a new track is in progress, terminate the current segment and
* start a new one.
* @param aDC = current device context
* @return a reference to the track if a track is created, or NULL
*/
TRACK * OnHotkeyBeginRoute( wxDC* aDC );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void OnSelectTool( wxCommandEvent& aEvent );
/**
* Function OnResetModuleTextSizes
* resets text size and width of all module text fields of given field
* type to current settings in Preferences
*/
void OnResetModuleTextSizes( wxCommandEvent& event );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar();
void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
PCB_LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
2008-04-29 13:35:26 +00:00
/**
* Function OnModify
* must be called after a board change to set the modified flag.
* <p>
* Reloads the 3D view if required and calls the base PCB_BASE_FRAME::OnModify function
* to update auxiliary information.
* </p>
*/
virtual void OnModify();
2010-01-21 20:53:01 +00:00
/**
* 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_VISIBLE
*/
bool IsElementVisible( int 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_VISIBLE
*/
void SetElementVisibility( int aElement, bool aNewState );
/**
* Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE
*/
void SetVisibleAlls();
/**
2010-01-21 20:53:01 +00:00
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading a new BOARD.
*/
void ReFillLayerWidget();
2010-01-21 20:53:01 +00:00
/**
* Function Show3D_Frame
* displays the 3D view of current printed circuit board.
*/
void Show3D_Frame( wxCommandEvent& event );
void GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey = 0 );
2010-11-12 15:17:10 +00:00
/**
* Function ShowDesignRulesEditor
* displays the Design Rules Editor.
*/
void ShowDesignRulesEditor( wxCommandEvent& event );
/* toolbars update UI functions: */
2009-11-23 20:18:47 +00:00
void PrepareLayerIndicator();
/* mouse functions events: */
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
2008-01-01 11:58:14 +00:00
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterward.
2008-01-01 11:58:14 +00:00
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
2008-01-01 11:58:14 +00:00
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItemToCopy = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
2009-11-23 20:18:47 +00:00
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
2010-11-12 15:17:10 +00:00
/**
* Function SaveCopyInUndoList (overloaded).
* Creates a new entry in undo list of commands.
* add a list of pickers to handle a list of items
* @param aItemsList = the list of items modified by the command to undo
* @param aTypeCommand = command type (see enum UNDO_REDO_T)
2009-11-23 20:18:47 +00:00
* @param aTransformPoint = the reference point of the transformation, for
* commands like move
*/
2009-11-23 20:18:47 +00:00
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList,
UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
2010-11-12 15:17:10 +00:00
/**
* Function PutDataInPreviousState
2009-08-01 19:26:05 +00:00
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorized by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
2009-08-01 19:26:05 +00:00
* @param aRedoCommand = a bool: true for redo, false for undo
* @param aRebuildRatsnet = a bool: true to rebuild ratsnest (normal use), false
* to just retrieve last state (used in abort commands that do not need to
2009-11-23 20:18:47 +00:00
* rebuild ratsnest)
2009-08-01 19:26:05 +00:00
*/
2009-11-23 20:18:47 +00:00
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList,
bool aRedoCommand,
bool aRebuildRatsnet = true );
2010-11-12 15:17:10 +00:00
/**
* Function GetBoardFromRedoList
2009-08-01 19:26:05 +00:00
* Redo the last edition:
* - Save the current board in Undo list
* - Get an old version of the board from Redo list
* @return none
*/
2009-11-23 20:18:47 +00:00
void GetBoardFromRedoList( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function GetBoardFromUndoList
2009-08-01 19:26:05 +00:00
* Undo the last edition:
* - Save the current board in Redo list
* - Get an old version of the board from Undo list
* @return none
*/
2009-11-23 20:18:47 +00:00
void GetBoardFromUndoList( wxCommandEvent& event );
/* Block operations: */
2009-11-23 20:18:47 +00:00
/**
* Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
* block command is started by dragging the mouse.
* @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/
virtual int ReturnBlockCommand( int aKey );
/**
* Function HandleBlockPlace()
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
* Parameters must be initialized in GetScreen()->m_BlockLocate
*/
virtual void HandleBlockPlace( wxDC* DC );
/**
* 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
*/
virtual bool HandleBlockEnd( wxDC* DC );
2009-11-23 20:18:47 +00:00
2009-08-01 19:26:05 +00:00
/**
* Function Block_SelectItems
* Uses GetScreen()->m_BlockLocate
* select items within the selected block.
* selected items are put in the pick list
*/
2009-11-23 20:18:47 +00:00
void Block_SelectItems();
2009-08-01 19:26:05 +00:00
/**
* Function Block_Delete
2009-08-01 19:26:05 +00:00
* deletes all items within the selected block.
*/
2009-11-23 20:18:47 +00:00
void Block_Delete();
2009-08-01 19:26:05 +00:00
/**
* Function Block_Rotate
* Rotate all items within the selected block.
2009-11-23 20:18:47 +00:00
* The rotation center is the center of the block
2009-08-01 19:26:05 +00:00
*/
2009-11-23 20:18:47 +00:00
void Block_Rotate();
2009-08-01 19:26:05 +00:00
/**
* Function Block_Flip
* Flip items within the selected block.
2009-11-23 20:18:47 +00:00
* The flip center is the center of the block
*/
2009-11-23 20:18:47 +00:00
void Block_Flip();
/**
* Function Block_Move
2009-08-01 19:26:05 +00:00
* move all items within the selected block.
2009-11-23 20:18:47 +00:00
* New location is determined by the current offset from the selected
* block's original location.
*/
2009-11-23 20:18:47 +00:00
void Block_Move();
/**
* Function Block_Mirror_X
2009-08-01 19:26:05 +00:00
* mirrors all items within the currently selected block in the X axis.
*/
2009-11-23 20:18:47 +00:00
void Block_Mirror_X();
/**
* Function Block_Duplicate
2009-08-01 19:26:05 +00:00
* Duplicate all items within the selected block.
2009-11-23 20:18:47 +00:00
* New location is determined by the current offset from the selected
* block's original location.
*/
2009-11-23 20:18:47 +00:00
void Block_Duplicate();
2009-11-23 20:18:47 +00:00
void Process_Settings( wxCommandEvent& event );
void OnConfigurePcbOptions( wxCommandEvent& aEvent );
2009-11-23 20:18:47 +00:00
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
2012-02-06 05:44:19 +00:00
2010-11-18 21:16:28 +00:00
void InstallDialogLayerSetup();
/**
* Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file
* See DoGenFootprintsPositionFile for options and file format
*/
void GenFootprintsPositionFile( wxCommandEvent& event );
/**
* Function DoGenFootprintsPositionFile
* Creates an ascii footprint position file
* @param aFullFileName = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @param aForceSmdItems = true to force all footprints with smd pads in list
* = false to put only footprints with option "INSERT" in list
* @param aSide = 0 to list footprints on BACK side,
* 1 to list footprints on FRONT side
* 2 to list footprints on both sides
* @return the number of footprints found on aSide side,
* or -1 if the file could not be created
*/
int DoGenFootprintsPositionFile( const wxString& aFullFileName, bool aUnitsMM,
bool aForceSmdItems, int aSide );
/**
* Function GenFootprintsReport
* Calls DoGenFootprintsReport to create a footprint reprot file
* See DoGenFootprintsReport for file format
*/
void GenFootprintsReport( wxCommandEvent& event );
/**
* Function DoGenFootprintsReport
* Creates an ascii footprint report file giving some infos on footprints
* and board outlines
* @param aFullFilename = the full file name of the file to create
* @param aUnitsMM = false to use inches, true to use mm in coordinates
* @return true if OK, false if error
*/
bool DoGenFootprintsReport( const wxString& aFullFilename, bool aUnitsMM );
2009-11-23 20:18:47 +00:00
void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
2009-11-23 20:18:47 +00:00
void OnFileHistory( wxCommandEvent& event );
/**
* Function Files_io
* is the command event handler for read and write file commands.
*/
2009-11-23 20:18:47 +00:00
void Files_io( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function LoadOnePcbFile
* loads a KiCad board (.brd) from \a aFileName.
*
* @param aFileName - File name including path. If empty, a file dialog will
* be displayed.
* @param aAppend - Append board file aFileName to the currently loaded file if true.
* Default = false.
* @param aForceFileDialog - Display the file open dialog even if aFullFileName is
* valid if true; Default = false.
*
* @return False if file load fails or is canceled by the user, otherwise true.
*/
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
bool aForceFileDialog = false );
2010-01-21 07:41:30 +00:00
/**
* Function ReadPcbFile
* reads a board file &ltfile&gt.brd
* @param aReader The line reader object to read from.
2010-01-21 07:41:30 +00:00
* @param Append if 0: a previously loaded board is deleted before loading
* the file else all items of the board file are added to the
* existing board
*/
int ReadPcbFile( LINE_READER* aReader, bool Append );
2010-01-21 07:41:30 +00:00
/**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
* @param aCreateBackupFile Creates a back of \a aFileName if true. Helper
* definitions #CREATE_BACKUP_FILE and #NO_BACKUP_FILE
* are defined for improved code readability.
* @return True if file was saved successfully.
*/
bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
int SavePcbFormatAscii( FILE* File );
2009-11-23 20:18:47 +00:00
bool WriteGeneralDescrPcb( FILE* File );
2009-08-06 15:42:09 +00:00
// BOARD handling
2009-11-23 20:18:47 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Clear_Pcb
2009-08-06 15:42:09 +00:00
* delete all and reinitialize the current board
* @param aQuery = true to prompt user for confirmation, false to initialize silently
2009-08-06 15:42:09 +00:00
*/
2009-11-23 20:18:47 +00:00
bool Clear_Pcb( bool aQuery );
2009-09-10 13:04:04 +00:00
// Drc control
2009-11-23 20:18:47 +00:00
2009-09-10 13:04:04 +00:00
/* function GetDrcController
* @return the DRC controller
*/
2009-11-23 20:18:47 +00:00
DRC* GetDrcController() { return m_drc; }
2009-08-06 15:42:09 +00:00
/**
* Function RecreateBOMFileFromBoard
* Recreates a .cmp file from the current loaded board
* this is the same as created by CvPcb.
* can be used if this file is lost
*/
void RecreateCmpFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ArchiveModulesOnBoard
* Save modules in a library:
* @param aLibName: the full filename of the library to create or modify
* @param aNewModulesOnly:
* true : save modules not already existing in this lib
* false: save all modules
*/
void ArchiveModulesOnBoard( const wxString& aLibName, bool aNewModulesOnly );
/**
* Function RecreateBOMFileFromBoard
* Creates a BOM file from the current loaded board
*/
void RecreateBOMFileFromBoard( wxCommandEvent& aEvent );
/**
* Function ExportToGenCAD
* creates a file in GenCAD 1.4 format from the current board.
*/
void ExportToGenCAD( wxCommandEvent& event );
2008-03-04 04:22:27 +00:00
/**
* Function OnExportVRML
* will export the current BOARD to a VRML file.
*/
void OnExportVRML( wxCommandEvent& event );
/**
* Function ExportVRML_File
* Creates the file(s) exporting current BOARD to a VRML file.
*
* @note When copying 3D shapes files, the new filename is build from the full path
* name, changing the separators by underscore. This is needed because files
* with the same shortname can exist in different directories
* @note ExportVRML_File generates coordinates in board units (BIU) inside the file.
* @todo Use mm inside the file. A general scale transform is applied to the whole
* file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML
* unit in meters.
* @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specfic scale
* is applied to 3D models to convert them to internal units.
*
* @param aFullFileName = the full filename of the file to create
* @param aMMtoWRMLunit = the VRML scaling factor:
* 1.0 to export in mm. 0.001 for meters
* @param aExport3DFiles = true to copy 3D shapes in the subir a3D_Subdir
* @param a3D_Subdir = sub directory where 3D shapes files are copied
* used only when aExport3DFiles == true
* @return true if Ok.
*/
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
bool aExport3DFiles, const wxString & a3D_Subdir );
2008-01-21 22:16:45 +00:00
/**
* Function ExporttoSPECCTRA
* will export the current BOARD to a specctra dsn file. See
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ExportToSpecctra( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
2008-02-06 22:32:15 +00:00
/**
* Function ImportSpecctraSession
2008-03-04 04:22:27 +00:00
* will import a specctra *.ses file and use it to relocate MODULEs and
2008-02-06 22:32:15 +00:00
* to replace all vias and tracks in an existing and loaded BOARD.
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraSession( wxCommandEvent& event );
2008-02-06 22:32:15 +00:00
/**
* Function ImportSpecctraDesign
2008-03-04 04:22:27 +00:00
* will import a specctra *.dsn file and use it to replace an entire BOARD.
2009-11-23 20:18:47 +00:00
* The new board will not have any graphics, only components, tracks and
* vias.
2008-02-06 22:32:15 +00:00
* See http://www.autotraxeda.com/docs/SPECCTRA/SPECCTRA.pdf for the
* specification.
*/
void ImportSpecctraDesign( wxCommandEvent& event );
2008-03-04 04:22:27 +00:00
2008-03-22 05:55:06 +00:00
/**
* Function Access_to_External_Tool
2008-03-22 05:55:06 +00:00
* Run an external tool (like freeroute )
*/
void Access_to_External_Tool( wxCommandEvent& event );
/**
* Function ListAndSelectModuleName
* builds and shows a list of existing modules on board that the user can select.
* @return a pointer to the selected module or NULL.
*/
MODULE* ListAndSelectModuleName();
2010-11-12 15:17:10 +00:00
/**
* Function ListNetsAndSelect
* called by a command event
* displays the sorted list of nets in a dialog frame
2009-11-23 20:18:47 +00:00
* If a net is selected, it is highlighted
*/
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
// Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
2012-05-30 17:38:52 +00:00
void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC );
TEXTE_PCB* CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText = NULL );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aErase = true );
void Place_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC );
2008-01-01 11:58:14 +00:00
// Graphic Segments type DRAWSEGMENT
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC );
2008-01-01 11:58:14 +00:00
// Footprint edition (see also PCB_BASE_FRAME)
void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
/**
* Function StartMoveModule
* Initialize a drag or move pad command
* @param aModule = the module to move or drag
* @param aDC = the current device context
* @param aDragConnectedTracks = true to drag connected tracks,
* false to just move the module
*/
void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks );
2010-12-29 17:47:32 +00:00
/**
* Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* 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
* @param aRedraw: if true: redraws the footprint
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw );
2010-12-29 17:47:32 +00:00
/**
* Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer
* The ratsnest and pad list are recalculated
* @param aModule = footprint to delete
* @param aDC = currentDevice Context. if NULL: do not redraw new ratsnest
* @param aAskBeforeDeleting : if true: ask for confirmation before deleting
*/
bool Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeDeleting );
2010-12-29 17:47:32 +00:00
/**
* Function Change_Side_Module
* Flip a footprint (switch layer from component or component to copper)
* The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to flip
* @param DC Current Device Context. if NULL, no redraw
*/
void Change_Side_Module( MODULE* Module, wxDC* DC );
2009-11-23 20:18:47 +00:00
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
2009-08-06 07:11:04 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Exchange_Module
2009-08-06 07:11:04 +00:00
* Replaces OldModule by NewModule, using OldModule settings:
* position, orientation, pad netnames ...)
* OldModule is deleted or put in undo list.
* @param aOldModule = footprint to replace
* @param aNewModule = footprint to put
2009-11-23 20:18:47 +00:00
* @param aUndoPickList = the undo list used to save OldModule. If null,
* OldModule is deleted
2009-08-06 07:11:04 +00:00
*/
void Exchange_Module( MODULE* aOldModule, MODULE* aNewModule,
PICKED_ITEMS_LIST* aUndoPickList );
2008-01-01 11:58:14 +00:00
// loading modules: see PCB_BASE_FRAME
2008-01-01 11:58:14 +00:00
// Board handling
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function OnEditItemRequest
* Install the corresponding dialog editor for the given item
* @param aDC = the current device context
* @param aItem = a pointer to the BOARD_ITEM to edit
*/
void OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem );
/**
* Locate track or pad and highlight the corresponding net.
* @return The Netcode, or -1 if no net located.
*/
int SelectHighLight( wxDC* DC );
/**
* Function HighLight.
* highlights the net at the current cursor position.
*/
void HighLight( wxDC* DC );
2008-01-01 11:58:14 +00:00
// Track and via edition:
void Via_Edit_Control( wxCommandEvent& event );
/**
* Function IsMicroViaAcceptable
* return true if a microvia can be placed on the board.
* <p>
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
* </p>
*/
bool IsMicroViaAcceptable( void );
2008-01-01 11:58:14 +00:00
/**
* Function Other_Layer_Route
2009-11-23 20:18:47 +00:00
* operates in one of two ways. If argument track is NULL, then swap the
* active layer between m_Route_Layer_TOP and m_Route_Layer_BOTTOM. If a
* track is in progress (track is not NULL), and if DRC allows it, place
* a via on the end of the current track, and then swap the current active
* layer and start a new segment on the new layer.
2008-01-01 11:58:14 +00:00
* @param track A TRACK* to append the via to or NULL.
* @param DC A device context to draw on.
* @return bool - true if the operation was successful, else false such as
2009-11-23 20:18:47 +00:00
* the case where DRC would not allow a via.
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
void HighlightUnconnectedPads( wxDC* DC );
/**
* Function Delete_Segment
* removes a track segment.
* If a new track is in progress: delete the current new segment.
* Otherwise, delete segment under the mouse cursor.
*/
2009-11-23 20:18:47 +00:00
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
/**
* Function Remove_One_Track
* removes 1 track/
* The leading segment is removed and all adjacent segments
* until a pad or a junction point of more than 2 segments is found
*/
void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
2010-11-12 15:17:10 +00:00
/**
* Function Reset_All_Tracks_And_Vias_To_Netclass_Values
* Reset all tracks width and/or vias diameters and drill
* to their default Netclass value
* @param aTrack : bool true to modify tracks
* @param aVia : bool true to modify vias
*/
bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia );
2010-11-12 15:17:10 +00:00
/**
* Function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
2009-11-23 20:18:47 +00:00
* to their default Netclass value or current values
* @param aNetcode : the netcode of the net to edit
2009-11-23 20:18:47 +00:00
* @param aUseNetclassValue : bool. True to use netclass values, false to
* use current values
*/
bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue );
2009-08-08 06:07:08 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Edit_Track_Width
2009-08-08 06:07:08 +00:00
* Modify a full track width (using DRC control).
2009-11-23 20:18:47 +00:00
* a full track is the set of track segments between 2 ends: pads or a
* point that has more than 2 segments ends connected
* @param aDC = the curred device context (can be NULL)
2009-08-08 06:07:08 +00:00
* @param aTrackSegment = a segment or via on the track to change
*/
void Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment );
2009-08-08 06:07:08 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function Edit_TrackSegm_Width
2009-08-08 06:07:08 +00:00
* Modify one track segment width or one via diameter (using DRC control).
* @param aDC = the current device context (can be NULL)
2009-08-08 06:07:08 +00:00
* @param aTrackItem = the track segment or via to modify
*/
void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
/**
* Function Begin_Route
* Starts a new track and/or establish of a new track point.
*
* For a new track:
* - Search the netname of the new track from the starting point
* if it is on a pad or an existing track
* - Highlight all this net
* If a track is in progress:
* - Call DRC
* - If DRC is OK: finish the track segment and starts a new one.
* @param aTrack = the current track segment, or NULL to start a new track
* @param aDC = the current device context
* @return a pointer to the new track segment or null if not created (DRC error)
*/
TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
/**
* Function End_Route
* Terminates a track currently being created
* @param aTrack = the current track segment in progress
* @param aDC = the current device context
* @return true if the track was created, false if not (due to a DRC error)
*/
bool End_Route( TRACK* aTrack, wxDC* aDC );
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
/**
* Function StartMoveOneNodeOrSegment
* initializes the parameters to move one via or/and a terminal point of a track segment
* The terminal point of other connected segments (if any) are moved too.
*/
void StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aCommand );
bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
/**
* @todo This function is broken, because it merge segments having different
* widths or without any connectivity test.
* 2 collinear segments can be merged only if no other segment or via is
* connected to the common point and if they have the same width. See
* cleanup.cpp for merge functions and consider MarkTrace() to locate segments
* that can be merged
*/
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, LAYER_NUM layer );
/**
* Function Add45DegreeSegment
* adds a track segment between 2 tracks segments if these 2 segments
* make a 90 deg angle, in order to have 45 deg track segments
* Its only works on horizontal or vertical segments.
*
* @param aDC The wxDC device context to draw on.
* @return A bool value true if ok or false if not.
*/
bool Add45DegreeSegment( wxDC* aDC );
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function EraseRedundantTrack
2009-08-08 06:07:08 +00:00
* Called after creating a track
2009-11-23 20:18:47 +00:00
* Remove (if exists) the old track that have the same starting and the
* same ending point as the new created track
2009-08-08 06:07:08 +00:00
* (this is the redunding track)
* @param aDC = the current device context (can be NULL)
2009-11-23 20:18:47 +00:00
* @param aNewTrack = the new created track (a pointer to a segment of the
* track list)
2009-08-08 06:07:08 +00:00
* @param aNewTrackSegmentsCount = number of segments in this new track
2009-11-23 20:18:47 +00:00
* @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL)
2009-09-10 13:04:04 +00:00
*/
int EraseRedundantTrack( wxDC* aDC,
TRACK* aNewTrack,
int aNewTrackSegmentsCount,
PICKED_ITEMS_LIST* aItemsListPicker );
2009-08-08 06:07:08 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetTrackSegmentWidth
2009-08-08 06:07:08 +00:00
* Modify one track segment width or one via diameter (using DRC control).
* Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify
2009-11-23 20:18:47 +00:00
* @param aItemsListPicker = the list picker to use for an undo command
* (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use
* current designSettings value
2009-08-08 06:07:08 +00:00
* @return true if done, false if no not change (because DRC error)
*/
2009-11-23 20:18:47 +00:00
bool SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue );
2009-08-08 06:07:08 +00:00
2008-01-01 11:58:14 +00:00
// zone handling
2010-11-12 15:17:10 +00:00
/**
* Function Delete_OldZone_Fill (obsolete)
* Used for compatibility with old boards
2009-11-23 20:18:47 +00:00
* Remove the zone filling which include the segment aZone, or the zone
* which have the given time stamp.
* For old boards, a zone is a group of SEGZONE segments which have the same TimeStamp
* @param aZone = zone segment within the zone to delete. Can be NULL
2009-11-23 20:18:47 +00:00
* @param aTimestamp = Timestamp for the zone to delete, used if aZone ==
* NULL
*/
void Delete_OldZone_Fill( SEGZONE* aZone, time_t aTimestamp = 0 );
2010-11-12 15:17:10 +00:00
/**
* Function Delete_LastCreatedCorner
2008-03-04 04:22:27 +00:00
* Used only while creating a new zone outline
* Remove and delete the current outline segment in progress
* @return 0 if no corner in list, or corner number
*/
int Delete_LastCreatedCorner( wxDC* DC );
2008-01-01 11:58:14 +00:00
/**
* Function Begin_Zone
* either initializes the first segment of a new zone, or adds an
* intermediate segment.
* A new zone can be:
* created from scratch: the user will be prompted to define parameters (layer, clearence ...)
* created from a similar zone (s_CurrentZone is used): parameters are copied from
* s_CurrentZone
* created as a cutout (an hole) inside s_CurrentZone
2008-01-01 11:58:14 +00:00
*/
int Begin_Zone( wxDC* DC );
2008-01-01 11:58:14 +00:00
/**
* Function End_Zone
* terminates (if no DRC error ) the zone edge creation process
* @param DC = current Device Context
2008-03-04 04:22:27 +00:00
* @return true if Ok, false if DRC error
2008-01-01 11:58:14 +00:00
*/
2009-11-23 20:18:47 +00:00
bool End_Zone( wxDC* DC );
2010-11-12 15:17:10 +00:00
/**
* Function Fill_Zone
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param aZone = zone to fill
* @return error level (0 = no error)
*/
int Fill_Zone( ZONE_CONTAINER* aZone );
2010-11-12 15:17:10 +00:00
/**
* Function Fill_All_Zones
* Fill all zones on the board
* The old fillings are removed
* @param aActiveWindow = the current active window, if a progress bar is shown
* = NULL to do not display a progress bar
* @param aVerbose = true to show error messages
*/
int Fill_All_Zones( wxWindow * aActiveWindow, bool aVerbose = true );
/**
* Function Add_Zone_Cutout
* Add a cutout zone to a given zone outline
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
2009-11-23 20:18:47 +00:00
void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Add_Similar_Zone
* Add a zone to a given zone outline.
2009-11-23 20:18:47 +00:00
* if the zones are overlapping they will be merged
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
2009-11-23 20:18:47 +00:00
void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
2009-11-23 20:18:47 +00:00
void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Start_Move_Zone_Corner
* Prepares a move corner in a zone outline,
* called from a move corner command (IsNewCorner = false),
* or a create new cornet command (IsNewCorner = true )
*/
2009-11-23 20:18:47 +00:00
void Start_Move_Zone_Corner( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id,
bool IsNewCorner );
/**
* Function Start_Move_Zone_Corner
* Prepares a drag edge in an existing zone outline,
*/
void Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id );
2008-03-04 04:22:27 +00:00
/**
* Function End_Move_Zone_Corner_Or_Outlines
* Terminates a move corner in a zone outline, or a move zone outlines
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone
*/
void End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
2008-01-16 20:37:50 +00:00
* Function End_Move_Zone_Corner_Or_Outlines
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
*/
void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
2010-11-12 15:17:10 +00:00
/**
* Function Delete_Zone
2009-11-23 20:18:47 +00:00
* Remove the zone which include the segment aZone, or the zone which have
* the given time stamp. A zone is a group of segments which have the
* same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone is removed
* otherwise, the hole is deleted
*/
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
2008-03-04 04:22:27 +00:00
/**
* Function Start_Move_Zone_Outlines
2009-11-23 20:18:47 +00:00
* Initialize parameters to move an existing zone outlines.
2008-01-16 20:37:50 +00:00
* @param DC = current Device Context (can be NULL)
2008-03-04 04:22:27 +00:00
* @param zone_container: the given zone to move
*/
void Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_container );
2008-01-16 20:37:50 +00:00
// Target handling
PCB_TARGET* CreateTarget( wxDC* DC );
void DeleteTarget( PCB_TARGET* aTarget, wxDC* DC );
void BeginMoveTarget( PCB_TARGET* aTarget, wxDC* DC );
void PlaceTarget( PCB_TARGET* aTarget, wxDC* DC );
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
2008-01-01 11:58:14 +00:00
// Graphic segments type DRAWSEGMENT handling:
2012-05-22 17:51:18 +00:00
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( LAYER_NUM aLayer );
2008-01-01 11:58:14 +00:00
// Dimension handling:
void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC );
DIMENSION* EditDimension( DIMENSION* aDimension, wxDC* aDC );
void DeleteDimension( DIMENSION* aDimension, wxDC* aDC );
void BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC );
void PlaceDimensionText( DIMENSION* aItem, wxDC* DC );
2008-01-01 11:58:14 +00:00
// netlist handling:
void InstallNetlistFrame( wxDC* DC );
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function ReadPcbNetlist
* reads \a aNetlistFileName and ppdates the footprints (load missing footprints and
* delete on demand extra footprints) on the board.
* Update connectivity info, references, values and "TIME STAMP"
*
* @param aNetlistFileName = netlist file name (*.net)
* @param aCmpFileName = cmp/footprint link file name (*.cmp).
* if not found or empty, only the netlist will be used
* @param aReporter is a pointer to a #REPORTER object to write display messages.
* can be NULL.
* @param aChangeFootprint if true, footprints that have changed in netlist will be changed
* @param aDeleteBadTracks if true, erroneous tracks will be deleted
* @param aDeleteExtraFootprints if true, remove unlocked footprints that are not in netlist
* @param aSelectByTimestamp if true, use timestamp instead of reference to identify
* footprints from components (use after reannotation of the
* schematic)
* @param aIsDryRun performs a dry run without making any changes if true.
*/
void ReadPcbNetlist( const wxString& aNetlistFileName,
const wxString& aCmpFileName,
REPORTER* aReporter,
bool aChangeFootprint,
bool aDeleteBadTracks,
bool aDeleteExtraFootprints,
bool aSelectByTimestamp,
bool aIsDryRun );
2010-11-12 15:17:10 +00:00
/**
* Function RemoveMisConnectedTracks
* finds all track segments which are mis-connected (to more than one net).
* When such a bad segment is found, it is flagged to be removed.
* All tracks having at least one flagged segment are removed.
* @return true if any change is made
*/
bool RemoveMisConnectedTracks();
2008-01-01 11:58:14 +00:00
// Autoplacement:
void AutoPlace( wxCommandEvent& event );
/**
* Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console
*/
void ScriptingConsoleEnableDisable( wxCommandEvent& event );
void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
2010-11-12 15:17:10 +00:00
/**
* Function OnOrientFootprints
2009-11-23 20:18:47 +00:00
* install the dialog box for the common Orient Footprints
2008-07-12 07:25:35 +00:00
*/
void OnOrientFootprints( wxCommandEvent& event );
2010-11-12 15:17:10 +00:00
/**
* Function ReOrientModules
2008-07-12 07:25:35 +00:00
* Set the orientation of footprints
* @param ModuleMask = mask (wildcard allowed) selection
* @param Orient = new orientation
* @param include_fixe = true to orient locked footprints
2010-11-26 17:47:35 +00:00
* @return true if some footprints modified, false if no change
2008-07-12 07:25:35 +00:00
*/
bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
void LockModule( MODULE* aModule, bool aLocked );
void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );
/**
* Function AutoPlaceModule
* automatically places footprints within the confines of the PCB edges.
* The components with the FIXED status are not moved. If the menu is
* calling the placement of 1 module, it will be replaced.
*/
void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
/**
* Function GetOptimalModulePlacement
* searches for the optimal position of the \a aModule.
*
* @param aModule A pointer to the MODULE object to get the optimal placement.
* @param aDC The device context to draw on.
* @return 1 if placement impossible or 0 if OK.
*/
int GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC );
void GenModuleOnBoard( MODULE* Module );
/**
* Function Compute_Ratsnest_PlaceModule
* displays the module's ratsnest during displacement, and assess the "cost"
* of the position.
*
* The cost is the longest ratsnest distance with penalty for connections
* approaching 45 degrees.
*/
double Compute_Ratsnest_PlaceModule( wxDC* DC );
/**
* Function GenPlaceBoard
* generates board board (component side copper + rating):
* Allocate the memory needed to represent in "bitmap" on the grid
* Current:
* - The size of clearance area of component (the board)
* - The bitmap PENALTIES
* And initialize the cells of the board has
* - Hole in the cells occupied by a segment EDGE
* - CELL_is_ZONE for cell internal contour EDGE (if closed)
*
* Placement surface (board) gives the cells internal to the contour
* PCB, and among the latter the free cells and cells already occupied
*
* The bitmap PENALTIES give cells occupied by the modules,
* Plus a surface penalty related to the number of pads of the module
*
* Bitmap of the penalty is set to 0
* Occupation cell is a 0 leaves
*/
int GenPlaceBoard();
void DrawInfoPlace( wxDC* DC );
2008-01-01 11:58:14 +00:00
// Autorouting:
int Solve( wxDC* DC, int two_sides );
void Reset_Noroutable( wxDC* DC );
void Autoroute( wxDC* DC, int mode );
void ReadAutoroutedTracks( wxDC* DC );
void GlobalRoute( wxDC* DC );
2008-01-01 11:58:14 +00:00
/**
* Function Show_1_Ratsnest
* draw ratsnest.
*
* The net edge pad with mouse or module locates the mouse.
* Delete the ratsnest if no module or pad is selected.
*/
void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC );
/**
* Function Clean_Pcb
* Clean up the board (remove redundant vias, not connected tracks
* and merges collinear track segments)
* Install the cleanup dialog frame to know what should be cleaned
* and run the cleanup function
*/
void Clean_Pcb();
2008-01-01 11:58:14 +00:00
void InstallFindFrame();
2008-01-01 11:58:14 +00:00
/**
* Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor
* to a part with the same reference as the objectToSync
* @param objectToSync The object whose reference is used to synchronize Eeschema.
2008-01-01 11:58:14 +00:00
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
2008-01-01 11:58:14 +00:00
/**
* Function Edit_Gap
* edits the GAP module if it has changed the position and/or size of the pads that
* form the gap get a new value.
*/
void Edit_Gap( wxDC* DC, MODULE* Module );
/**
* Function Create_MuWaveBasicShape
* create a footprint with pad_count pads for micro wave applications.
* This footprint has pad_count pads:
* PAD_SMD, rectangular, H size = V size = current track width.
*/
MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
/**
* Create_MuWaveComponent
* creates a module "GAP" or "STUB" used in micro wave designs.
* This module has 2 pads:
* PAD_SMD, rectangular, H size = V size = current track width.
* the "gap" is isolation created between this 2 pads
*/
MODULE* Create_MuWaveComponent( int shape_type );
MODULE* Create_MuWavePolygonShape();
void Begin_Self( wxDC* DC );
/**
* Function Genre_Self
* creates a self-shaped coil for microwave applications.
* - Length Mself.lng
* - Extremities Mself.m_Start and Mself.m_End
*
* We must determine:
* Mself.nbrin = number of segments perpendicular to the direction
* (The coil nbrin will demicercles + 1 + 2 1 / 4 circle)
* Mself.lbrin = length of a strand
* Mself.radius = radius of rounded parts of the coil
* Mself.delta = segments extremities connection between him and the coil even
*
* The equations are
* Mself.m_Size.x = 2 * Mself.radius + Mself.lbrin
* Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin * Mself.radius
* Mself.lng = 2 * Mself.delta / / connections to the coil
+ (Mself.nbrin-2) * Mself.lbrin / / length of the strands except 1st and last
+ (Mself.nbrin 1) * (PI * Mself.radius) / / length of rounded
* Mself.lbrin + / 2 - Melf.radius * 2) / / length of 1st and last bit
*
* The constraints are:
* Nbrin >= 2
* Mself.radius < Mself.m_Size.x
* Mself.m_Size.y = Mself.radius * 4 + 2 * Mself.raccord
* Mself.lbrin> Mself.radius * 2
*
* The calculation is conducted in the following way:
* Initially:
* Nbrin = 2
* Radius = 4 * m_Size.x (arbitrarily fixed value)
* Then:
* Increasing the number of segments to the desired length
* (Radius decreases if necessary)
*
*/
MODULE* Genere_Self( wxDC* DC );
2008-01-01 11:58:14 +00:00
2010-11-12 15:17:10 +00:00
/**
* Function SetLanguage
* called on a language menu selection
*/
virtual void SetLanguage( wxCommandEvent& event );
/**
* Function UpdateTitle
* sets the main window title bar text.
* <p>
* If file name defined by PCB_SCREEN::m_FileName is not set, the title is set to the
* application name appended with no file. Otherwise, the title is set to the full path
* and file name and read only is appended to the title if the user does not have write
* access to the file.
* </p>
*/
void UpdateTitle();
2008-01-01 11:58:14 +00:00
DECLARE_EVENT_TABLE()
};
2012-10-15 22:30:01 +00:00
/**
* Function InvokePcbLibTableEditor
* shows the modal DIALOG_FP_LIB_TABLE for purposes of editing two lib tables.
*
* @return int - bits 0 and 1 tell whether a change was made to the @a aGlobal
* and/or the @a aProject table, respectively. If set, table was modified.
*/
int InvokePcbLibTableEditor( wxFrame* aParent, FP_LIB_TABLE* aGlobal, FP_LIB_TABLE* aProject );
#endif // WXPCB_STRUCT_H_