2009-11-20 14:55:20 +00:00
|
|
|
/***********/
|
|
|
|
/* protos.h */
|
|
|
|
/***********/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifndef PROTO_H
|
|
|
|
#define PROTO_H
|
|
|
|
|
2008-03-18 04:04:17 +00:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
class COMMAND;
|
|
|
|
|
2010-11-12 16:59:16 +00:00
|
|
|
/**
|
|
|
|
* Function SwapData
|
2009-08-03 07:55:08 +00:00
|
|
|
* Used in undo / redo command:
|
|
|
|
* swap data between Item and a copy
|
|
|
|
* swapped data is data modified by edition, so NOT ALL values are swapped
|
|
|
|
* @param aItem = the item
|
|
|
|
* @param aImage = a copy of the item
|
|
|
|
*/
|
|
|
|
void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage );
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/*******************/
|
2008-01-05 17:30:56 +00:00
|
|
|
/* PAD_CONNECT.CPP */
|
2009-11-20 14:55:20 +00:00
|
|
|
/*******************/
|
2008-03-18 04:04:17 +00:00
|
|
|
|
|
|
|
class D_PAD;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CreateSortedPadListByXCoord
|
|
|
|
* first empties then fills the vector with all pads and sorts them by
|
|
|
|
* increasing x coordinate. The vector only holds pointers to the pads and
|
|
|
|
* those pointers are only references to pads which are owned by the BOARD
|
|
|
|
* through other links.
|
|
|
|
* @param aBoard Which board to gather pads from.
|
|
|
|
* @param aVector Where to put the pad pointers.
|
|
|
|
*/
|
|
|
|
void CreateSortedPadListByXCoord( BOARD* aBoard, std::vector<D_PAD*>* aVector );
|
|
|
|
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/***************/
|
|
|
|
/* TRPISTE.CPP */
|
|
|
|
/***************/
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Routine trace of n consecutive segments in memory.
|
|
|
|
* Useful for mounting a track record for being the segments that
|
|
|
|
* Tracks are contiguous in memory
|
|
|
|
* Parameters:
|
|
|
|
* Pt_start_piste = starting address of the list of segments
|
|
|
|
* Nbsegment = number of segments was traced
|
|
|
|
* Mode_color = mode (GrXOR, Gror ..)
|
|
|
|
* CAUTION:
|
|
|
|
* The starting point of a track following MUST exist: may be
|
|
|
|
* Then put a 0 before calling a routine if the track is the last draw
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void Trace_Une_Piste( EDA_DRAW_PANEL* panel,
|
|
|
|
wxDC* DC,
|
|
|
|
TRACK* pt_start_piste,
|
|
|
|
int nbsegment,
|
|
|
|
int mode_color );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/****************/
|
|
|
|
/* LOCATE.CPP : */
|
|
|
|
/****************/
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Find a pad by it's name om the module. */
|
|
|
|
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2008-03-04 19:17:19 +00:00
|
|
|
/**
|
|
|
|
* Function Locate_Via_Area
|
|
|
|
* finds the first SEGVIA which covers the given aPos with a matching layer.
|
|
|
|
* @param aStart The starting TRACK or SEGVIA in the BOARD's list.
|
|
|
|
* @param aPos The wxPoint to HitTest() against.
|
|
|
|
* @param aLayer The layer to match, pass -1 for a don't care.
|
|
|
|
* @return TRACK* - actually a SEGVIA* if found, else NULL.
|
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& aPos, int aLayer = ALL_LAYERS );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Locates the center through the point x, y, on layer data
|
|
|
|
* by masquelayer.
|
|
|
|
* Search is done to address start_adr has end_adr (not included)
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int masquelayer );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Locates the center through the point x, y, on layer data
|
|
|
|
* by masquelayer.
|
|
|
|
* Search is done to address start_adr has end_adr (not included)
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Fast_Locate_Piste( TRACK* start_adr, TRACK* end_adr,
|
|
|
|
const wxPoint& ref_pos, int masquelayer );
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
/* Search for segment connected to the segment edge by
|
|
|
|
* Ptr_piste:
|
|
|
|
* If int = START, the point of beginning of the segment is used
|
|
|
|
* If int = END, the end point of the segment is used
|
|
|
|
* The search is done only on the ends of segments
|
|
|
|
* The search is limited to the area [... pt_base] pt_lim.
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Locate_Piste_Connectee( TRACK* ptr_piste, TRACK* pt_base, TRACK* pt_lim, int extr );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
|
|
|
/*
|
2009-11-20 14:55:20 +00:00
|
|
|
* 1 - Locate segment of track leading from the mouse.
|
|
|
|
* 2 - Locate segment of track point by point.
|
|
|
|
* Ref_pX, ref_pY.
|
2008-02-26 21:12:08 +00:00
|
|
|
*
|
2009-11-20 14:55:20 +00:00
|
|
|
* If layer <0 the layer is not tested.
|
2008-02-26 21:12:08 +00:00
|
|
|
*
|
2009-11-20 14:55:20 +00:00
|
|
|
* The search begins to address start_adresse
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Locate_Pistes( BOARD* aPcb, TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
/* Locate pad connected to the beginning or end of a segment
|
|
|
|
* Input: pointer to the segment, and flag = START or END
|
|
|
|
* Returns:
|
|
|
|
* A pointer to the description of the patch if pad was found.
|
|
|
|
* NULL pointer if pad was not found.
|
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
D_PAD* Locate_Pad_Connecte( BOARD* aPcb, TRACK* ptr_segment, int extr );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
|
|
|
/*
|
2009-11-20 14:55:20 +00:00
|
|
|
* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the current
|
|
|
|
* cursor position, search done on all tracks.
|
|
|
|
* Entry:
|
|
|
|
* - Mouse coord (Curseur_X and Curseur_Y)
|
|
|
|
* Or ref_pX, ref_pY
|
|
|
|
* Returns:
|
|
|
|
* Pointer to the pad if found
|
|
|
|
* NULL pointer if pad not found
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
D_PAD* Locate_Any_Pad( BOARD* aPcb, const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
/* Locate pad pointed to by the coordinate ref_pX,, ref_pY or the cursor
|
|
|
|
* position of the current footprint.
|
|
|
|
* Input:
|
|
|
|
* - The module to search.
|
|
|
|
* - Layer to search or -1 to search all layers.
|
|
|
|
* Returns:
|
|
|
|
* A pointer to the pad if found otherwise NULL.
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
D_PAD* Locate_Pads( MODULE* Module, const wxPoint& ref_pos, int layer );
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
/* Locate a footprint by its bounding rectangle. */
|
2011-02-01 15:46:25 +00:00
|
|
|
MODULE* Locate_Prefered_Module( BOARD* aPcb, const wxPoint& aPosition, int aActiveLayer,
|
|
|
|
bool aVisibleOnly, bool aIgnoreLocked = false );
|
2009-11-20 14:55:20 +00:00
|
|
|
|
|
|
|
/* Locate a pad pointed to by the cursor on the footprint.
|
|
|
|
* Module.
|
|
|
|
* Input:
|
|
|
|
* - Module to search.
|
|
|
|
* Returns:
|
|
|
|
* A pointer to the pad if found otherwise NULL.
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
D_PAD* Locate_Pads( MODULE* Module, int typeloc );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Locate a trace segment at the current cursor position.
|
|
|
|
* The search begins to address start_adresse.
|
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Locate_Pistes( TRACK* start_adresse, int typeloc );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int LayerSearch, int typeloc );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Locate pad containing the point px, py, layer on layer.
|
2008-02-26 21:12:08 +00:00
|
|
|
*
|
2009-11-20 14:55:20 +00:00
|
|
|
* The list of pads must already exist.
|
|
|
|
*
|
|
|
|
* Returns:
|
|
|
|
* Pointer to the pad if found, otherwise NULL.
|
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
D_PAD* Fast_Locate_Pad_Connecte( BOARD* Pcb, const wxPoint& ref_pos, int layer );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
|
|
|
/*
|
2009-11-20 14:55:20 +00:00
|
|
|
* 1 - Locate trace segment at the current cursor position.
|
|
|
|
* 2 - Locate trace segment at the given coordinates ref_pos.
|
2008-02-26 21:12:08 +00:00
|
|
|
*
|
2009-11-20 14:55:20 +00:00
|
|
|
* If layer == -1, check all layers.
|
2008-02-26 21:12:08 +00:00
|
|
|
*
|
2009-11-20 14:55:20 +00:00
|
|
|
* The search begins to address start_adresse
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
TRACK* Locate_Zone( TRACK* start_adresse, const wxPoint& ref_pos, int layer );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*************/
|
|
|
|
/* MODULES.C */
|
|
|
|
/*************/
|
2011-02-01 15:46:25 +00:00
|
|
|
int ChangeSideNumLayer( int oldlayer );
|
2011-01-21 19:30:59 +00:00
|
|
|
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
|
2011-02-03 19:27:28 +00:00
|
|
|
void Montre_Position_Empreinte( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/****************/
|
|
|
|
/* EDITRACK.C : */
|
|
|
|
/****************/
|
|
|
|
|
2011-01-30 22:22:38 +00:00
|
|
|
TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef );
|
2008-02-27 15:26:16 +00:00
|
|
|
|
2011-02-03 19:27:28 +00:00
|
|
|
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
|
|
|
bool aErase );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
|
2011-01-31 18:26:12 +00:00
|
|
|
* depending on it's position from the origin (ox, oy) and \a aPosiition..
|
2009-11-20 14:55:20 +00:00
|
|
|
*/
|
2011-02-01 15:46:25 +00:00
|
|
|
void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*****************/
|
|
|
|
/* TRACK.CPP : */
|
|
|
|
/*****************/
|
2009-11-20 14:55:20 +00:00
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
/**
|
|
|
|
* Function Marque_Une_Piste
|
|
|
|
* marks a chain of track segments, connected to aTrackList.
|
2009-11-20 14:55:20 +00:00
|
|
|
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
|
|
|
* continuity is detected by walking each segment, and finally the segments
|
|
|
|
* are rearranged into a contiguous chain within the given list.
|
|
|
|
*
|
|
|
|
* @param aPcb = the board to analyze
|
|
|
|
* @param aStartSegm - The first interesting segment within a list of track
|
|
|
|
* segment of aPcb
|
|
|
|
* @param aSegmCount = a pointer to an integer where to return the number of
|
|
|
|
* interesting segments
|
|
|
|
* @param aTrackLen = a pointer to an integer where to return the lenght of the
|
|
|
|
* track
|
|
|
|
* @param aReorder = true for reorder the interesting segments (useful for
|
|
|
|
* track edition/deletion) in this case the flag BUSY is
|
|
|
|
* set (the user is responsible of flag clearing). False
|
|
|
|
* for no reorder : useful when we want just calculate the
|
|
|
|
* track length in this case, flags are reset
|
2009-10-10 17:27:53 +00:00
|
|
|
* @return TRACK* the first in the chain of interesting segments.
|
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
TRACK* Marque_Une_Piste( BOARD* aPcb,
|
|
|
|
TRACK* aStartSegm,
|
|
|
|
int* aSegmCount,
|
|
|
|
int* aTrackLen,
|
|
|
|
bool aReorder );
|
|
|
|
|
|
|
|
/* Calculate end coordinate of a trace.
|
|
|
|
* Returns 1 if OK, 0 if trace looped back on itself.
|
|
|
|
* The coord are returned StartTrack-> ox, oy
|
|
|
|
* And EndTrack-> fx, fy if OK
|
|
|
|
* The segments are drawn consecutively.
|
|
|
|
*/
|
2010-12-08 20:12:46 +00:00
|
|
|
int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, TRACK** StartTrack, TRACK** EndTrack );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Update the state of a list of structures. */
|
2010-12-08 20:12:46 +00:00
|
|
|
void ListSetState( EDA_ITEM* Start, int Nbitem, int State, int onoff );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***************/
|
|
|
|
/* DUPLTRAC.CPP */
|
|
|
|
/***************/
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Routine to find the point "attachment" at the end of a trace.
|
|
|
|
* This may be a PAD or another trace segment.
|
|
|
|
* Returns:
|
|
|
|
* - Pointer to the PAD or:
|
|
|
|
* - Pointer to the segment or:
|
|
|
|
* - NULL
|
|
|
|
* Parameters:
|
|
|
|
* - aPos - coordinate point test
|
|
|
|
* ALayerMask of mask layers to be tested
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2009-08-08 06:07:08 +00:00
|
|
|
BOARD_ITEM* LocateLockPoint( BOARD* aPcb, wxPoint aPos, int aLayerMask );
|
2008-02-26 21:12:08 +00:00
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Create an intermediate point on a segment
|
2010-05-27 10:23:29 +00:00
|
|
|
* aSegm segment is broken into 2 segments connecting point pX, pY
|
|
|
|
* After insertion:
|
|
|
|
* The new segment starts from to new point, and ends to initial aSegm ending point
|
|
|
|
* the old segment aSegm ends to new point
|
2009-11-20 14:55:20 +00:00
|
|
|
* Returns:
|
2010-05-27 10:23:29 +00:00
|
|
|
* NULL if no new point (ie if aRefPoint already corresponded at one end of aSegm
|
|
|
|
* or
|
|
|
|
* Pointer to the segment created
|
|
|
|
* Returns the exact value of aRefPoint
|
2009-11-20 14:55:20 +00:00
|
|
|
* If aSegm points to a via:
|
2010-05-27 10:23:29 +00:00
|
|
|
* Returns the exact value of aRefPoint and a pointer to the via,
|
|
|
|
* But does not create extra point
|
2008-02-26 21:12:08 +00:00
|
|
|
*/
|
2010-05-27 10:23:29 +00:00
|
|
|
TRACK* CreateLockPoint( BOARD* aPcb,
|
|
|
|
wxPoint& aRefPoint,
|
2009-11-20 14:55:20 +00:00
|
|
|
TRACK* aSegm,
|
|
|
|
PICKED_ITEMS_LIST* aItemsListPicker );
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/****************/
|
|
|
|
/* CONTROLE.CPP */
|
|
|
|
/****************/
|
2007-08-14 19:24:48 +00:00
|
|
|
void RemoteCommand( const char* cmdline );
|
2008-02-29 20:35:11 +00:00
|
|
|
bool Project( wxPoint* res, wxPoint on_grid, const TRACK* track );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2008-02-26 21:12:08 +00:00
|
|
|
#endif /* #define PROTO_H */
|