kicad/include/wxPcbStruct.h

850 lines
34 KiB
C
Raw Normal View History

2008-01-01 11:58:14 +00:00
/***********************************************************/
2009-07-30 11:04:07 +00:00
/* wxPcbStruct.h */
2008-01-01 11:58:14 +00:00
/***********************************************************/
#ifndef WXPCB_STRUCT_H
#define WXPCB_STRUCT_H
#include <vector>
#include "wxstruct.h"
#include "base_struct.h"
2008-01-01 11:58:14 +00:00
#ifndef PCB_INTERNAL_UNIT
#define PCB_INTERNAL_UNIT 10000
2008-01-01 11:58:14 +00:00
#endif
/* Forward declarations of classes. */
class PCB_SCREEN;
class WinEDA_Toolbar;
class WinEDA_ModuleEditFrame;
class BOARD;
class TEXTE_PCB;
class MODULE;
class TRACK;
class SEGZONE;
class SEGVIA;
class D_PAD;
class TEXTE_MODULE;
class MIREPCB;
class COTATION;
class EDGE_MODULE;
class WinEDA3D_DrawFrame;
class DRC;
class ZONE_CONTAINER;
class DRAWSEGMENT;
class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
2008-01-01 11:58:14 +00:00
2009-07-30 11:04:07 +00:00
/**
* @info see also class WinEDA_BasePcbFrame: Basic class for pcbnew and gerbview
*/
2008-01-01 11:58:14 +00:00
/*****************************************************/
2009-07-30 11:04:07 +00:00
/* class WinEDA_PcbFrame: the main frame for Pcbnew */
2008-01-01 11:58:14 +00:00
/*****************************************************/
2009-07-30 11:04:07 +00:00
class WinEDA_PcbFrame: public WinEDA_BasePcbFrame
2008-01-01 11:58:14 +00:00
{
public:
2009-10-03 17:18:08 +00:00
WinEDAChoiceBox* m_SelLayerBox; // a combo box to display and select active layer
WinEDAChoiceBox* m_SelTrackWidthBox; // a combo box to display and select current track width
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance
wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass
bool m_TrackAndViasSizesList_Changed;
2008-01-01 11:58:14 +00:00
bool m_show_microwave_tools;
2008-01-01 11:58:14 +00:00
private:
2008-01-01 11:58:14 +00:00
DRC* m_drc; ///< the DRC controller, see drc.cpp
2008-01-01 11:58:14 +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 );
2009-08-01 19:26:05 +00:00
void createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu );
2008-01-01 11:58:14 +00:00
public:
WinEDA_PcbFrame( wxWindow* father, const wxString& title,
2008-01-01 11:58:14 +00:00
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2008-01-01 11:58:14 +00:00
~WinEDA_PcbFrame();
void GetKicadAbout( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
// Configurations:
void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event );
void Update_config( wxWindow* displayframe );
/** Function Read_Config
* Read the project configuration file
* @param projectFileName = the config filename
* if not found use kicad.pro
* if not found : initialize default values
* @return true if the current config is modified, false if no change
*/
bool Read_Config( const wxString& projectFileName );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
bool OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
2009-10-03 17:18:08 +00:00
void Tracks_and_Vias_Size_Event( 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 ReCreateAuxVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
2008-04-29 13:35:26 +00:00
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
/** function ShowDesignRulesEditor
* Display the Design Rules Editor.
*/
void ShowDesignRulesEditor( wxCommandEvent& event );
/* toolbars update UI functions: */
2008-04-29 13:35:26 +00:00
/**
* Function UpdateToolbarLayerInfo
* updates the currently selected layer in the layer listbox and
* the colored icon in the toolbar.
*/
void UpdateToolbarLayerInfo();
2008-04-29 13:35:26 +00:00
void PrepareLayerIndicator();
/**
* Function AuxiliaryToolBar_Update_UI
* update the displayed values on auxiliary horizontal toolbar
* (track width, via sizes, clearance ...
*/
void AuxiliaryToolBar_Update_UI( );
/**
* Function AuxiliaryToolBar_DesignRules_Update_UI
* update the displayed values: track width, via sizes, clearance
* used when a ne netclass is selected
*/
void AuxiliaryToolBar_DesignRules_Update_UI( );
/* 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 afterwards.
* @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
/** 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 UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItemToCopy, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) );
/** 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 UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) );
2009-08-01 19:26:05 +00:00
/** Function PutDataInPreviousState()
* Used in undo or redo command.
* Put data pointed by List in the previous state, i.e. the state memorised by List
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to undo/redo
* @param aRedoCommand = a bool: true for redo, false for undo
* @param aRebuildRatsnet = a bool: true to rebuid ratsnet (normal use), false
* to just retrieve las state (used in abort commands that do not need to rebuild ratsnest)
2009-08-01 19:26:05 +00:00
*/
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand, bool aRebuildRatsnet = true );
2009-08-01 19:26:05 +00:00
/** Function GetBoardFromRedoList
* Redo the last edition:
* - Save the current board in Undo list
* - Get an old version of the board from Redo list
* @return none
*/
void GetBoardFromRedoList(wxCommandEvent& event);
2009-08-01 19:26:05 +00:00
/** Function GetBoardFromUndoList
* Undo the last edition:
* - Save the current board in Redo list
* - Get an old version of the board from Undo list
* @return none
*/
void GetBoardFromUndoList(wxCommandEvent& event);
2008-01-01 11:58:14 +00:00
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
/* Block operations: */
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
* @param none
*/
void Block_SelectItems( );
/**
* Function Block_Delete
2009-08-01 19:26:05 +00:00
* deletes all items within the selected block.
* @param none
*/
void Block_Delete( );
/**
* Function Block_Rotate
* Rotate all items within the selected block.
* The rotation centre is the centre of the block
* @param none
*/
void Block_Rotate( );
/**
* Function Block_Flip
* Flip items within the selected block.
* The flip centre is the centre of the block
* @param none
*/
2009-08-01 19:26:05 +00:00
void Block_Flip( );
/**
* Function Block_Move
2009-08-01 19:26:05 +00:00
* move all items within the selected block.
* New location is determined by the current offset from the selected block's original location.
2009-08-01 19:26:05 +00:00
* @param none
*/
2009-08-01 19:26:05 +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.
* @param none
*/
2009-08-01 19:26:05 +00:00
void Block_Mirror_X( );
/**
* Function Block_Duplicate
2009-08-01 19:26:05 +00:00
* Duplicate all items within the selected block.
* New location is determined by the current offset from the selected block's original location.
2009-08-01 19:26:05 +00:00
* @param none
*/
2009-08-01 19:26:05 +00:00
void Block_Duplicate( );
void SetToolbars();
void Process_Settings( wxCommandEvent& event );
void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id );
void InstallDisplayOptionsDialog( wxCommandEvent& aEvent );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
void GenModulesPosition( wxCommandEvent& event );
void GenModuleReport( wxCommandEvent& event );
void InstallDrillFrame( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void Files_io( wxCommandEvent& event );
bool LoadOnePcbFile( const wxString& FileName, bool Append );
int ReadPcbFile( FILE* File, bool Append );
bool SavePcbFile( const wxString& FileName );
int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File );
2009-08-06 15:42:09 +00:00
// BOARD handling
/** 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 );
2009-09-10 13:04:04 +00:00
// Drc control
/* function GetDrcController
* @return the DRC controller
*/
DRC* GetDrcController() {return m_drc;} ///< return the DRC controller, see drc.cpp
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 RecreateBOMFileFromBoard
* Creates a BOM file from the current loaded board
*/
void RecreateBOMFileFromBoard(wxCommandEvent & aEvent);
void ExportToGenCAD( wxCommandEvent& event );
2008-03-04 04:22:27 +00:00
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.
2008-02-06 22:32:15 +00:00
* The new board will not have any graphics, only components, tracks and vias.
* 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 );
2008-03-22 05:55:06 +00:00
/* Fonctions specifiques */
MODULE* ListAndSelectModuleName();
/** Function ListNetsAndSelect
* called by a command event
* displays the sorted list of nets in a dialog frame
* If a net is selected, it is hightlighted
*/
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
void Install_Test_DRC_Frame( wxDC* DC );
2008-01-01 11:58:14 +00:00
// Handling texts on the board
void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
TEXTE_PCB* Create_Texte_Pcb( wxDC* DC );
void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC );
void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC );
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 );
2009-08-11 10:27:21 +00:00
void InstallGraphicItemPropertiesDialog( DRAWSEGMENT* aItem, wxDC* aDC ); // Graphic items edition
2008-01-01 11:58:14 +00:00
// Footprint edition (see also WinEDA_BasePcbFrame)
2009-08-11 10:27:21 +00:00
void InstallModuleOptionsFrame( MODULE* Module, wxDC * DC );
void StartMove_Module( MODULE* module, wxDC* DC );
bool Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting );
2009-08-11 10:27:21 +00:00
void Change_Side_Module( MODULE* Module, wxDC* DC );
2009-08-06 07:11:04 +00:00
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule );
/** function Exchange_Module
* 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
* @param aUndoPickList = the undo list used to save OldModule. If null, OldModule is deleted
*/
void Exchange_Module( MODULE* aOldModule,
MODULE* aNewModule,
PICKED_ITEMS_LIST* aUndoPickList);
2008-01-01 11:58:14 +00:00
// loading modules: see WinEDA_BasePcbFrame
// Board handling
void RemoveStruct( BOARD_ITEM* Item, wxDC* DC );
2008-01-01 11:58:14 +00:00
// Hightlight functions:
int Select_High_Light( wxDC* DC );
void Hight_Light( wxDC* DC );
2008-01-01 11:58:14 +00:00
// Track and via edition:
2009-08-08 10:08:37 +00:00
void Via_Edit_Control( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
/**
* Function Other_Layer_Route
* 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.
* @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
* the case where DRC would not allow a via.
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
void Affiche_PadsNoConnect( wxDC* DC );
void Affiche_Status_Net( wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
/** 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 );
/** function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
* to their default Netclass value ou current values
* @param aNetcode : the netcode of the net to edit
* @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
/** Function Edit_Track_Width
* Modify a full track width (using DRC control).
* 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 DC = the curred device context (can be NULL)
* @param aTrackSegment = a segment or via on the track to change
*/
void Edit_Track_Width( wxDC* DC, TRACK* Track );
2009-08-08 06:07:08 +00:00
/** Function Edit_TrackSegm_Width
* Modify one track segment width or one via diameter (using DRC control).
* @param DC = 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* DC, TRACK* segm );
TRACK* Begin_Route( TRACK* track, wxDC* DC );
void End_Route( TRACK* track, wxDC* DC );
void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC );
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 );
void Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command );
2009-08-08 06:07:08 +00:00
bool PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC );
bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end );
void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC );
void SwitchLayer( wxDC* DC, int layer );
bool Add_45_degrees_Segment( wxDC* DC );
bool Genere_Pad_Connexion( wxDC* DC, int layer );
2008-01-01 11:58:14 +00:00
2009-08-08 06:07:08 +00:00
/** function EraseRedundantTrack
* Called after creating a track
* Remove (if exists) the old track that have the same starting and the same ending point as the new created track
* (this is the redunding track)
* @param aDC = the current device context (can be NULL)
* @param aNewTrack = the new created track (a pointer to a segment of the track list)
* @param aNewTrackSegmentsCount = number of segments in this new track
2009-09-10 13:04:04 +00:00
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
*/
2009-08-08 06:07:08 +00:00
int EraseRedundantTrack( wxDC* aDC, TRACK* aNewTrack, int aNewTrackSegmentsCount,
PICKED_ITEMS_LIST* aItemsListPicker );
/** Function SetTrackSegmentWidth
* 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
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use g_DesignSettings value
2009-08-08 06:07:08 +00:00
* @return true if done, false if no not change (because DRC error)
*/
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
/** Function Delete_Zone_Fill
* Remove the zone filling 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 aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
2009-08-06 18:30:46 +00:00
void Delete_Zone_Fill( SEGZONE* Track, long aTimestamp = 0 );
2008-03-04 04:22:27 +00:00
/** Function Delete_LastCreatedCorner
* 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
* initiates a zone edge creation process,
* or terminates the current zone edge and creates a new zone edge stub
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
*/
bool End_Zone( wxDC* DC );
/** 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 zone_container = zone to fill
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( ZONE_CONTAINER* zone_container, bool verbose = TRUE );
/** Function Fill_All_Zones()
* Fill all zones on the board
* The old fillings are removed
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_All_Zones( bool verbose = 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
*/
void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Add_Similar_Zone
* Add a zone to a given zone outline.
* if the zones are overlappeing they will be merged
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
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 )
*/
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 );
/** Function Delete_Zone
* 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
* Initialise parametres 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
MIREPCB* Create_Mire( wxDC* DC );
void Delete_Mire( MIREPCB* MirePcb, wxDC* DC );
void StartMove_Mire( MIREPCB* MirePcb, wxDC* DC );
void Place_Mire( MIREPCB* MirePcb, wxDC* DC );
void InstallMireOptionsFrame( MIREPCB* MirePcb, wxDC* DC, const wxPoint& pos );
2008-01-01 11:58:14 +00:00
// Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
2009-08-11 10:27:21 +00:00
void Delete_Drawings_All_Layer( int aLayer );
2008-01-01 11:58:14 +00:00
// Dimension handling:
void Install_Edit_Cotation( COTATION* Cotation, wxDC* DC, const wxPoint& pos );
COTATION* Begin_Cotation( COTATION* Cotation, wxDC* DC );
void Delete_Cotation( COTATION* Cotation, wxDC* DC );
2008-01-01 11:58:14 +00:00
// netlist handling:
void InstallNetlistFrame( wxDC* DC, const wxPoint& pos );
2008-01-01 11:58:14 +00:00
// Autoplacement:
void AutoPlace( wxCommandEvent& event );
2008-07-12 07:25:35 +00:00
/** function OnOrientFootprints
* install the dialog box for the comman Orient Footprints
*/
void OnOrientFootprints( void );
2008-07-12 07:25:35 +00:00
/** function ReOrientModules
* Set the orientation of footprints
* @param ModuleMask = mask (wildcard allowed) selection
* @param Orient = new orientation
* @param include_fixe = true to orient locked footprints
*/
void ReOrientModules( const wxString& ModuleMask, int Orient,
bool include_fixe );
void FixeModule( MODULE* Module, bool Fixe );
2009-10-23 15:28:45 +00:00
void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );
bool SetBoardBoundaryBoxFromEdgesOnly();
void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
int RecherchePlacementModule( MODULE* Module, wxDC* DC );
void GenModuleOnBoard( MODULE* Module );
float Compute_Ratsnest_PlaceModule( wxDC* DC );
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
// divers
void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC );
void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC );
2008-01-01 11:58:14 +00:00
void InstallFindFrame( const wxPoint& pos, wxDC* DC );
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 syncronize eeschema.
*/
void SendMessageToEESCHEMA( BOARD_ITEM* objectToSync );
2008-01-01 11:58:14 +00:00
/* Micro waves functions */
void Edit_Gap( wxDC* DC, MODULE* Module );
MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
MODULE* Create_MuWaveComponent( int shape_type );
MODULE* Create_MuWavePolygonShape();
void Begin_Self( wxDC* DC );
MODULE* Genere_Self( wxDC* DC );
2008-01-01 11:58:14 +00:00
/**
* Load applications settings specific to the PCBNew.
*
* This overrides the base class WinEDA_BasePcbFrame::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();
/**
* Save applications settings common to PCB draw frame objects.
*
* This overrides the base class WinEDA_BasePcbFrame::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();
2008-01-01 11:58:14 +00:00
DECLARE_EVENT_TABLE()
};
/*********************************************************/
/* class WinEDA_ModuleEditFrame: public WinEDA_DrawFrame */
/* Class for the footprint editor */
/*********************************************************/
class WinEDA_ModuleEditFrame : public WinEDA_BasePcbFrame
{
public:
MODULE* CurrentModule;
wxString m_CurrentLib;
public:
WinEDA_ModuleEditFrame( wxWindow* father,
2008-01-01 11:58:14 +00:00
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
2008-01-01 11:58:14 +00:00
~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars();
void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
void Show3D_Frame( wxCommandEvent& event );
void GeneralControle( wxDC* DC, wxPoint Mouse );
void LoadModuleFromBoard( wxCommandEvent& event );
2008-01-01 11:58:14 +00:00
/** function ToPrinter
* Install the print dialog
*/
void ToPrinter( wxCommandEvent& event );
2009-08-06 15:42:09 +00:00
// BOARD handling
/** 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 );
2008-01-01 11:58:14 +00:00
/* handlers for block commands */
int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC );
2008-01-01 11:58:14 +00:00
BOARD_ITEM* ModeditLocateAndDisplay( int aHotKeyCode = 0 );
2008-01-01 11:58:14 +00:00
/* Undo and redo functions */
2008-01-01 11:58:14 +00:00
public:
/** Function SaveCopyInUndoList.
* Creates a new entry in undo list of commands.
* add a picker to handle aItemToCopy
* @param aItem = the board item modified by the command to undo
* @param aTypeCommand = command type (see enum UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( BOARD_ITEM* aItem, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) );
/** 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 UndoRedoOpType)
* @param aTransformPoint = the reference point of the transformation, for commands like move
*/
virtual void SaveCopyInUndoList( PICKED_ITEMS_LIST& aItemsList, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) );
2008-01-01 11:58:14 +00:00
private:
void GetComponentFromUndoList(wxCommandEvent& event);
void GetComponentFromRedoList(wxCommandEvent& event);
2008-01-01 11:58:14 +00:00
public:
// Footprint edition
void Place_Ancre( MODULE* module );
void RemoveStruct( EDA_BaseStruct* Item );
void Transform( MODULE* module, int transform );
2008-01-01 11:58:14 +00:00
// loading Footprint
MODULE* Import_Module( wxDC* DC );
void Export_Module( MODULE* ptmod, bool createlib );
void Load_Module_From_BOARD( MODULE* Module );
2008-01-01 11:58:14 +00:00
// functions to edit footprint edges
/**
* Function Edit_Edge_Width
* changes the width of module perimeter lines, EDGE_MODULEs.
* @param ModuleSegmentWidth (global) = new width
* @param Edge = edge to edit, or NULL. If Edge == NULL change
* the width of all the footprint's edges
* @param DC = current Device Context
*/
void Edit_Edge_Width( EDGE_MODULE* Edge );
void Edit_Edge_Layer( EDGE_MODULE* Edge );
void Delete_Edge_Module( EDGE_MODULE* Edge );
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge );
void End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC );
void Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC );
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
void Place_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
2008-01-01 11:58:14 +00:00
// handlers for libraries:
void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
void Select_Active_Library();
2008-01-01 11:58:14 +00:00
DECLARE_EVENT_TABLE()
};
#endif /* WXPCB_STRUCT_H */