2007-08-04 04:42:49 +00:00
|
|
|
/**************************************************************/
|
|
|
|
/* pcbstruct.h : definition des structures de donnees type PCB */
|
|
|
|
/**************************************************************/
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
#ifndef PCBSTRUCT_H
|
|
|
|
#define PCBSTRUCT_H
|
|
|
|
|
|
|
|
#include "base_struct.h"
|
|
|
|
|
|
|
|
// Definitions relatives aux libariries
|
|
|
|
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
|
2007-08-04 04:42:49 +00:00
|
|
|
#define ENTETE_LIBDOC "PCBNEW-LibDoc----V1"
|
|
|
|
#define L_ENTETE_LIB 18
|
|
|
|
#define EXT_CMP wxT( ".emp" )
|
|
|
|
#define EXT_CMP_MASK wxT( "*.emp" )
|
|
|
|
#define EXT_DOC wxT( ".mdc" )
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Bits indicateurs du membre .Status, pour pistes, modules... */
|
2007-08-04 04:42:49 +00:00
|
|
|
#define FLAG1 0x2000 /* flag libre pour calculs locaux */
|
|
|
|
#define FLAG0 0x1000 /* flag libre pour calculs locaux */
|
|
|
|
#define BEGIN_ONPAD 0x800 /* flag indiquant un debut de segment sur pad */
|
|
|
|
#define END_ONPAD 0x400 /* flag indiquant une fin de segment sur pad */
|
|
|
|
#define BUSY 0x0200 /* flag indiquant que la structure a deja
|
|
|
|
* ete examinee, dans certaines routines */
|
|
|
|
#define DELETED 0x0100 /* Bit flag de Status pour structures effacee
|
|
|
|
* et mises en chaine "DELETED" */
|
|
|
|
#define NO_TRACE 0x80 /* l'element ne doit pas etre affiche */
|
|
|
|
#define SURBRILL 0x20 /* element en surbrillance */
|
|
|
|
#define DRAG 0x10 /* segment en mode drag */
|
|
|
|
#define EDIT 0x8 /* element en cours d'edition */
|
|
|
|
#define SEGM_FIXE 0x04 /* segment FIXE ( pas d'effacement global ) */
|
|
|
|
#define SEGM_AR 0x02 /* segment Auto_Route */
|
|
|
|
#define CHAIN 0x01 /* segment marque */
|
|
|
|
|
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
/* Layer identification (layer number) */
|
2007-11-01 05:27:31 +00:00
|
|
|
#define FIRST_COPPER_LAYER 0
|
2007-10-07 18:24:15 +00:00
|
|
|
#define COPPER_LAYER_N 0
|
2007-08-04 04:42:49 +00:00
|
|
|
#define LAYER_N_2 1 /* Numero layer 2 */
|
|
|
|
#define LAYER_N_3 2 /* Numero layer 3 */
|
|
|
|
#define LAYER_N_4 3 /* Numero layer 4 */
|
|
|
|
#define LAYER_N_5 4 /* Numero layer 5 */
|
|
|
|
#define LAYER_N_6 5 /* Numero layer 6 */
|
|
|
|
#define LAYER_N_7 6 /* Numero layer 7 */
|
|
|
|
#define LAYER_N_8 7 /* Numero layer 8 */
|
|
|
|
#define LAYER_N_9 8 /* Numero layer 9 */
|
|
|
|
#define LAYER_N_10 9 /* Numero layer 10 */
|
|
|
|
#define LAYER_N_11 10 /* Numero layer 11 */
|
|
|
|
#define LAYER_N_12 11 /* Numero layer 12 */
|
|
|
|
#define LAYER_N_13 12 /* Numero layer 13 */
|
|
|
|
#define LAYER_N_14 13 /* Numero layer 14 */
|
|
|
|
#define LAYER_N_15 14 /* Numero layer 15 */
|
|
|
|
#define LAYER_CMP_N 15
|
|
|
|
#define CMP_N 15
|
2007-11-01 05:27:31 +00:00
|
|
|
#define LAST_COPPER_LAYER 15
|
|
|
|
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
#define FIRST_NO_COPPER_LAYER 16
|
2007-08-04 04:42:49 +00:00
|
|
|
#define ADHESIVE_N_CU 16
|
|
|
|
#define ADHESIVE_N_CMP 17
|
|
|
|
#define SOLDERPASTE_N_CU 18
|
|
|
|
#define SOLDERPASTE_N_CMP 19
|
|
|
|
#define SILKSCREEN_N_CU 20
|
|
|
|
#define SILKSCREEN_N_CMP 21
|
|
|
|
#define SOLDERMASK_N_CU 22
|
|
|
|
#define SOLDERMASK_N_CMP 23
|
|
|
|
#define DRAW_N 24
|
|
|
|
#define COMMENT_N 25
|
|
|
|
#define ECO1_N 26
|
|
|
|
#define ECO2_N 27
|
|
|
|
#define EDGE_N 28
|
|
|
|
#define LAST_NO_COPPER_LAYER 28
|
2007-10-07 03:08:24 +00:00
|
|
|
#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1)
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
#define LAYER_COUNT 32
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-10-01 13:51:07 +00:00
|
|
|
|
|
|
|
/*************************************/
|
|
|
|
/* constantes de gestion des couches */
|
|
|
|
/*************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
#define CUIVRE_LAYER (1<<COPPER_LAYER_N) ///< bit mask for copper layer
|
2007-10-01 13:51:07 +00:00
|
|
|
#define LAYER_2 (1<<LAYER_N_2) ///< bit mask for layer 2
|
|
|
|
#define LAYER_3 (1<<LAYER_N_3) ///< bit mask for layer 3
|
|
|
|
#define LAYER_4 (1<<LAYER_N_4) ///< bit mask for layer 4
|
|
|
|
#define LAYER_5 (1<<LAYER_N_5) ///< bit mask for layer 5
|
|
|
|
#define LAYER_6 (1<<LAYER_N_6) ///< bit mask for layer 6
|
|
|
|
#define LAYER_7 (1<<LAYER_N_7) ///< bit mask for layer 7
|
|
|
|
#define LAYER_8 (1<<LAYER_N_8) ///< bit mask for layer 8
|
|
|
|
#define LAYER_9 (1<<LAYER_N_9) ///< bit mask for layer 9
|
|
|
|
#define LAYER_10 (1<<LAYER_N_10) ///< bit mask for layer 10
|
|
|
|
#define LAYER_11 (1<<LAYER_N_11) ///< bit mask for layer 11
|
|
|
|
#define LAYER_12 (1<<LAYER_N_12) ///< bit mask for layer 12
|
|
|
|
#define LAYER_13 (1<<LAYER_N_13) ///< bit mask for layer 13
|
|
|
|
#define LAYER_14 (1<<LAYER_N_14) ///< bit mask for layer 14
|
|
|
|
#define LAYER_15 (1<<LAYER_N_15) ///< bit mask for layer 15
|
|
|
|
#define CMP_LAYER (1<<LAYER_CMP_N) ///< bit mask for component layer
|
|
|
|
#define ADHESIVE_LAYER_CU (1<<ADHESIVE_N_CU)
|
|
|
|
#define ADHESIVE_LAYER_CMP (1<<ADHESIVE_N_CMP)
|
|
|
|
#define SOLDERPASTE_LAYER_CU (1<<SOLDERPASTE_N_CU)
|
|
|
|
#define SOLDERPASTE_LAYER_CMP (1<<SOLDERPASTE_N_CMP)
|
|
|
|
#define SILKSCREEN_LAYER_CU (1<<SILKSCREEN_N_CU)
|
|
|
|
#define SILKSCREEN_LAYER_CMP (1<<SILKSCREEN_N_CMP)
|
|
|
|
#define SOLDERMASK_LAYER_CU (1<<SOLDERMASK_N_CU)
|
|
|
|
#define SOLDERMASK_LAYER_CMP (1<<SOLDERMASK_N_CMP)
|
|
|
|
#define DRAW_LAYER (1<<DRAW_N)
|
|
|
|
#define COMMENT_LAYER (1<<COMMENT_N)
|
|
|
|
#define ECO1_LAYER (1<<ECO1_N)
|
|
|
|
#define ECO2_LAYER (1<<ECO2_N)
|
|
|
|
#define EDGE_LAYER (1<<EDGE_N)
|
|
|
|
// extra bits 0xE0000000
|
|
|
|
/* masques generaux : */
|
|
|
|
#define ALL_LAYERS 0x1FFFFFFF
|
|
|
|
#define ALL_NO_CU_LAYERS 0x1FFF0000
|
|
|
|
#define ALL_CU_LAYERS 0x0000FFFF
|
|
|
|
#define INTERNAL_LAYERS 0x00007FFE /* Bits layers internes */
|
|
|
|
#define EXTERNAL_LAYERS 0x00008001
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
/* Forme des segments (pistes, contours ..) ( parametre .shape ) */
|
|
|
|
enum Track_Shapes {
|
2007-08-04 04:42:49 +00:00
|
|
|
S_SEGMENT = 0, /* segment rectiligne */
|
|
|
|
S_RECT, /* segment forme rect (i.e. bouts non arrondis) */
|
|
|
|
S_ARC, /* segment en arc de cercle (bouts arrondis)*/
|
|
|
|
S_CIRCLE, /* segment en cercle (anneau)*/
|
|
|
|
S_ARC_RECT, /* segment en arc de cercle (bouts droits) (GERBER)*/
|
|
|
|
S_SPOT_OVALE, /* spot ovale (for GERBER)*/
|
|
|
|
S_SPOT_CIRCLE, /* spot rond (for GERBER)*/
|
|
|
|
S_SPOT_RECT, /* spot rect (for GERBER)*/
|
|
|
|
S_POLYGON /* polygon shape */
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* Forward declaration */
|
|
|
|
class MODULE;
|
|
|
|
class EQUIPOT;
|
2007-11-27 22:49:35 +00:00
|
|
|
class MARKER;
|
2007-05-28 18:09:49 +00:00
|
|
|
class TRACK;
|
|
|
|
class D_PAD;
|
|
|
|
struct CHEVELU;
|
|
|
|
class Ki_PageDescr;
|
|
|
|
class DrawBlockStruct;
|
|
|
|
|
2007-12-09 12:55:53 +00:00
|
|
|
/* Class to handle a board */
|
|
|
|
#include "class_board.h"
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
// Class for handle current printed board design settings
|
|
|
|
#define HIST0RY_NUMBER 8
|
|
|
|
class EDA_BoardDesignSettings
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_CopperLayerCount; // Number of copper layers for this design
|
|
|
|
int m_ViaDrill; // via drill (for the entire board)
|
|
|
|
int m_CurrentViaSize; // Current via size
|
|
|
|
int m_ViaSizeHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used via sizes
|
|
|
|
int m_CurrentViaType; // via type (BLIND, TROUGHT ...), bits 1 and 2 (not 0 and 1)
|
|
|
|
int m_CurrentTrackWidth; // current track width
|
|
|
|
int m_TrackWidhtHistory[HIST0RY_NUMBER]; // Last HIST0RY_NUMBER used track widths
|
|
|
|
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
|
|
|
|
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
|
|
|
|
int m_PcbTextWidth; // current Pcb (not module) Text width
|
|
|
|
wxSize m_PcbTextSize; // current Pcb (not module) Text size
|
|
|
|
int m_TrackClearence; // track to track and track to pads clearance
|
|
|
|
int m_ZoneClearence; // zone to track and zone to pads clearance
|
|
|
|
int m_MaskMargin; // Solder mask margin
|
|
|
|
|
|
|
|
// Color options for screen display of the Printed Board:
|
|
|
|
int m_PcbGridColor; // Grid color
|
|
|
|
int m_LayerColor[32]; // Layer colors (tracks and graphic items)
|
|
|
|
int m_ViaColor[4]; // Via color (depending on is type)
|
|
|
|
int m_ModuleTextCMPColor; // Text module color for modules on the COMPONENT layer
|
|
|
|
int m_ModuleTextCUColor; // Text module color for modules on the COPPER layer
|
|
|
|
int m_ModuleTextNOVColor; // Text module color for "invisible" texts (must be BLACK if really not displayed)
|
|
|
|
int m_AnchorColor; // Anchor color for modules and texts
|
2007-08-30 03:53:26 +00:00
|
|
|
|
|
|
|
int m_PadCUColor; // Pad color for the COPPER side of the pad
|
|
|
|
int m_PadCMPColor; // Pad color for the COMPONENT side of the pad
|
2007-08-04 04:42:49 +00:00
|
|
|
// Pad color for the pads of both sides is m_PadCUColor OR m_PadCMPColor (in terms of colors)
|
|
|
|
|
|
|
|
int m_RatsnestColor; // Ratsnest color
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-30 22:20:52 +00:00
|
|
|
EDA_BoardDesignSettings();
|
2007-08-24 03:40:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetVisibleLayers
|
|
|
|
* returns a bit-map of all the layers that are visible.
|
|
|
|
* @return int - the visible layers in bit-mapped form.
|
|
|
|
*/
|
2007-08-30 22:20:52 +00:00
|
|
|
int GetVisibleLayers() const;
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
2007-08-06 02:02:39 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
// Values for m_DisplayViaMode member:
|
|
|
|
enum DisplayViaMode {
|
2007-08-04 04:42:49 +00:00
|
|
|
VIA_HOLE_NOT_SHOW = 0,
|
|
|
|
VIA_SPECIAL_HOLE_SHOW,
|
|
|
|
ALL_VIA_HOLE_SHOW,
|
|
|
|
OPT_VIA_HOLE_END
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
2007-12-09 12:55:53 +00:00
|
|
|
/* Handle info to display a board */
|
2007-05-28 18:09:49 +00:00
|
|
|
class PCB_SCREEN : public BASE_SCREEN
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_Active_Layer; /* ref couche active */
|
|
|
|
int m_Route_Layer_TOP; /* ref couches actives */
|
|
|
|
int m_Route_Layer_BOTTOM; /* pour placement vias et routage 2 couches */
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
PCB_SCREEN( int idscreen );
|
2007-08-30 22:20:52 +00:00
|
|
|
~PCB_SCREEN();
|
2007-09-06 04:34:03 +00:00
|
|
|
|
2007-08-30 22:20:52 +00:00
|
|
|
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
|
2007-09-06 04:34:03 +00:00
|
|
|
void Init();
|
|
|
|
void SetNextZoom();
|
|
|
|
void SetPreviousZoom();
|
|
|
|
void SetLastZoom();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetCurItem
|
|
|
|
* returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
|
|
|
|
* @return BOARD_ITEM* - the one selected, or NULL.
|
|
|
|
*/
|
|
|
|
BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); }
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
2007-10-26 06:08:19 +00:00
|
|
|
/**********************************/
|
|
|
|
/* Module (Footprint) description */
|
|
|
|
/**********************************/
|
|
|
|
|
|
|
|
#include "class_pad.h" // class for pads
|
|
|
|
#include "class_edge_mod.h" // Class for footprint graphic elements
|
|
|
|
#include "class_text_mod.h" // Class for footprint fields
|
|
|
|
#include "class_module.h" // Class for the footprint
|
2007-05-28 18:09:49 +00:00
|
|
|
#include "class_equipot.h"
|
|
|
|
|
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
/***********************************/
|
|
|
|
/* Description des elements du PCB */
|
|
|
|
/***********************************/
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
class DRAWSEGMENT : public BOARD_ITEM
|
2007-05-28 18:09:49 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-10-06 16:16:48 +00:00
|
|
|
int m_Width; // 0 = line. if > 0 = tracks, bus ...
|
2007-08-23 04:28:46 +00:00
|
|
|
wxPoint m_Start; // Line start point
|
|
|
|
wxPoint m_End; // Line end point
|
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
int m_Shape; // Shape: line, Circle, Arc
|
|
|
|
int m_Type; // Used in complex associations ( Dimensions.. )
|
|
|
|
int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-24 15:10:46 +00:00
|
|
|
DRAWSEGMENT( BOARD_ITEM* StructFather, KICAD_T idtype = TYPEDRAWSEGMENT );
|
2007-08-30 22:20:52 +00:00
|
|
|
~DRAWSEGMENT();
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPosition
|
|
|
|
* returns the position of this object.
|
|
|
|
* Required by pure virtual BOARD_ITEM::GetPosition()
|
|
|
|
* @return const wxPoint& - The position of this object.
|
|
|
|
*/
|
|
|
|
wxPoint& GetPosition()
|
|
|
|
{
|
|
|
|
return m_Start;
|
|
|
|
}
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Save
|
2007-10-31 14:14:21 +00:00
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
2007-10-30 21:30:58 +00:00
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
|
|
|
*/
|
|
|
|
bool Save( FILE* aFile ) const;
|
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
bool ReadDrawSegmentDescr( FILE* File, int* LineNum );
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-10-06 16:16:48 +00:00
|
|
|
/* remove this from the linked list */
|
2007-08-30 22:20:52 +00:00
|
|
|
void UnLink();
|
2007-05-28 18:09:49 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
void Copy( DRAWSEGMENT* source );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Display_Infos
|
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
|
|
|
* Is virtual from EDA_BaseStruct.
|
|
|
|
* @param frame A WinEDA_BasePcbFrame in which to print status information.
|
|
|
|
*/
|
|
|
|
void Display_Infos( WinEDA_DrawFrame* frame );
|
|
|
|
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param ref_pos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
|
|
|
bool HitTest( const wxPoint& ref_pos );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
wxString GetClass() const
|
|
|
|
{
|
2007-09-13 11:28:58 +00:00
|
|
|
return wxT("DRAWSEGMENT");
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#include "class_pcb_text.h"
|
|
|
|
#include "class_cotation.h"
|
|
|
|
#include "class_mire.h"
|
|
|
|
#include "class_track.h"
|
2007-10-26 06:08:19 +00:00
|
|
|
#include "class_marker.h"
|
2007-12-09 12:55:53 +00:00
|
|
|
#include "class_zone.h"
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DISPLAY_OPTIONS
|
|
|
|
{
|
|
|
|
public:
|
2007-08-04 04:42:49 +00:00
|
|
|
bool DisplayPadFill;
|
|
|
|
bool DisplayPadNum;
|
|
|
|
bool DisplayPadNoConn;
|
|
|
|
bool DisplayPadIsol;
|
|
|
|
|
|
|
|
int DisplayModEdge;
|
|
|
|
int DisplayModText;
|
|
|
|
bool DisplayPcbTrackFill; /* FALSE = sketch , TRUE = filled */
|
|
|
|
bool DisplayTrackIsol;
|
2007-08-08 03:50:44 +00:00
|
|
|
|
2007-08-04 04:42:49 +00:00
|
|
|
int m_DisplayViaMode; /* 0 do not show via hole,
|
2007-08-08 03:50:44 +00:00
|
|
|
* 1 show via hole for non default value
|
|
|
|
* 2 show all via hole */
|
2007-08-04 04:42:49 +00:00
|
|
|
|
|
|
|
bool DisplayPolarCood;
|
|
|
|
bool DisplayZones;
|
|
|
|
bool Show_Modules_Cmp;
|
|
|
|
bool Show_Modules_Cu;
|
|
|
|
|
|
|
|
int DisplayDrawItems;
|
|
|
|
bool ContrastModeDisplay;
|
2007-05-28 18:09:49 +00:00
|
|
|
|
|
|
|
public:
|
2007-08-30 22:20:52 +00:00
|
|
|
DISPLAY_OPTIONS();
|
2007-05-28 18:09:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* PCBSTRUCT_H */
|