2007-08-04 04:40:07 +00:00
|
|
|
/**************************************/
|
2007-10-29 15:51:48 +00:00
|
|
|
/* PCBNEW.H : headers */
|
2007-08-04 04:40:07 +00:00
|
|
|
/**************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifndef PCBNEW_H
|
|
|
|
#define PCBNEW_H
|
|
|
|
|
|
|
|
#ifndef eda_global
|
|
|
|
#define eda_global extern
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "pcbstruct.h"
|
|
|
|
#include "macros.h"
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
#define U_PCB (PCB_INTERNAL_UNIT / EESCHEMA_INTERNAL_UNIT)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Flag used in locate functions
|
|
|
|
* the locate ref point is the on grid cursor or the off grid mouse cursor */
|
2007-08-04 04:40:07 +00:00
|
|
|
#define CURSEUR_ON_GRILLE (0 << 0)
|
|
|
|
#define CURSEUR_OFF_GRILLE (1 << 0)
|
2007-06-25 08:05:45 +00:00
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
#define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation
|
|
|
|
#define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select
|
|
|
|
#define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
|
2007-06-15 16:08:55 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
#define START 0 /* Flag used in locale routines */
|
2007-08-04 04:40:07 +00:00
|
|
|
#define END 1
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint centre) */
|
2008-03-24 20:54:45 +00:00
|
|
|
#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text centre) */
|
|
|
|
|
|
|
|
#define TEXTS_MIN_SIZE 50 // Min size in pcbnew units value (50 * 0.0001 mils)
|
|
|
|
#define TEXTS_MAX_SIZE 100000 // Min size in pcbnew units value (1 inch) )
|
|
|
|
#define TEXTS_MAX_WIDTH 5000 // Max width in pcbnew units value (0.5 inches)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Used in Zoom menu */
|
2007-08-04 04:40:07 +00:00
|
|
|
#define ZOOM_PLUS -1
|
2007-06-05 12:10:51 +00:00
|
|
|
#define ZOOM_MOINS -2
|
2007-08-04 04:40:07 +00:00
|
|
|
#define ZOOM_AUTO -3
|
2007-06-05 12:10:51 +00:00
|
|
|
#define ZOOM_CENTER -4
|
|
|
|
#define ZOOM_REDRAW -5
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Flag to force the SKETCH mode to display items (.flags member) */
|
2007-06-05 12:10:51 +00:00
|
|
|
#define FORCE_SKETCH (DRAG | EDIT )
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Flags used in read board file */
|
|
|
|
#define APPEND_PCB 1 /* used to append the new board to the existing board */
|
|
|
|
#define NEWPCB 0 /* used for normal load file */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global wxArrayString g_LibName_List; // library list to load
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global wxSize g_GridList[]
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
= {
|
|
|
|
wxSize( 1000, 1000 ), wxSize( 500, 500 ), wxSize( 250, 250 ), wxSize( 200, 200 ),
|
|
|
|
wxSize( 100, 100 ), wxSize( 50, 50 ), wxSize( 25, 25 ), wxSize( 20, 20 ),
|
|
|
|
wxSize( 10, 10 ), wxSize( 5, 5 ), wxSize( 2, 2 ), wxSize( 1, 1 ),
|
|
|
|
wxSize( -1, -1 ), wxSize( 0, 0 )
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
#define UNDELETE_STACK_SIZE 10
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
|
|
|
|
eda_global int g_UnDeleteStackPtr;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global bool g_ShowGrid
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
/* Look up Table for conversion one layer number -> one bit layer mask: */
|
|
|
|
eda_global int g_TabOneLayerMask[LAYER_COUNT]
|
|
|
|
#if defined MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
= {
|
|
|
|
0x00000001, 0x00000002, 0x00000004, 0x00000008,
|
|
|
|
0x00000010, 0x00000020, 0x00000040, 0x00000080,
|
|
|
|
0x00000100, 0x00000200, 0x00000400, 0x00000800,
|
|
|
|
0x00001000, 0x00002000, 0x00004000, 0x00008000,
|
|
|
|
0x00010000, 0x00020000, 0x00040000, 0x00080000,
|
|
|
|
0x00100000, 0x00200000, 0x00400000, 0x00800000,
|
|
|
|
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
|
|
|
0x10000000, 0x20000000, 0x40000000, 0x80000000
|
|
|
|
}
|
2007-10-29 15:51:48 +00:00
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
2007-08-04 04:40:07 +00:00
|
|
|
;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Look up Table for conversion copper layer count -> general copper layer mask: */
|
|
|
|
eda_global int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]
|
|
|
|
#if defined MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
= {
|
|
|
|
0x0001, 0x8001, 0x8003, 0x8007,
|
|
|
|
0x800F, 0x801F, 0x803F, 0x807F,
|
|
|
|
0x80FF, 0x81FF, 0x83FF, 0x87FF,
|
|
|
|
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
#endif
|
2007-08-04 04:40:07 +00:00
|
|
|
;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* variables */
|
|
|
|
|
|
|
|
extern wxString g_Main_Title;
|
|
|
|
|
|
|
|
eda_global bool Drc_On
|
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global bool g_AutoDeleteOldTrack /* Allows automatic deletion of the old track after
|
2008-01-12 20:31:56 +00:00
|
|
|
* creation of a new track */
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
eda_global bool g_No_Via_Route;
|
|
|
|
eda_global bool g_Drag_Pistes_On;
|
|
|
|
eda_global bool g_Show_Ratsnest;
|
|
|
|
eda_global bool g_Show_Module_Ratsnest;
|
|
|
|
eda_global bool g_Show_Pads_Module_in_Move
|
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
eda_global bool g_Raccord_45_Auto
|
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global bool g_ShowIsolDuringCreateTrack; /* Show clearance while track creation */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/*********************************/
|
2008-02-12 21:12:46 +00:00
|
|
|
/* Display options for board items */
|
2007-10-29 15:51:48 +00:00
|
|
|
/*********************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
eda_global DISPLAY_OPTIONS DisplayOpt;
|
|
|
|
|
2007-08-08 03:50:44 +00:00
|
|
|
/**
|
|
|
|
* Function IsModuleLayerVisible
|
|
|
|
* expects either of the two layers on which a module can reside, and returns
|
|
|
|
* whether that layer is visible.
|
2007-10-07 22:49:16 +00:00
|
|
|
* @param layer One of the two allowed layers for modules: CMP_N or COPPER_LAYER_N
|
2007-08-08 03:50:44 +00:00
|
|
|
* @return bool - true if the layer is visible, else false.
|
|
|
|
*/
|
2007-10-29 15:51:48 +00:00
|
|
|
bool inline IsModuleLayerVisible( int layer ) {
|
2007-08-08 03:50:44 +00:00
|
|
|
if( layer==CMP_N )
|
|
|
|
return DisplayOpt.Show_Modules_Cmp;
|
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
else if( layer==COPPER_LAYER_N )
|
2007-08-08 03:50:44 +00:00
|
|
|
return DisplayOpt.Show_Modules_Cu;
|
|
|
|
|
|
|
|
else
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global bool Track_45_Only; /* Flag pour limiter l'inclinaison
|
2007-10-29 15:51:48 +00:00
|
|
|
* pistes a 45 degres seulement */
|
2008-01-12 20:31:56 +00:00
|
|
|
eda_global bool Segments_45_Only; /* Flag pour limiter l'inclinaison
|
2007-08-04 04:40:07 +00:00
|
|
|
* edge pcb a 45 degres seulement */
|
2008-01-12 20:31:56 +00:00
|
|
|
eda_global wxString PcbExtBuffer // Board file extension
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( ".brd" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global wxString g_SaveFileName // File Name for periodic saving
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( "$savepcb" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
2008-03-22 18:08:44 +00:00
|
|
|
eda_global wxString NetExtBuffer // Netlist file extension
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( ".net" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
2008-01-12 20:31:56 +00:00
|
|
|
eda_global wxString NetCmpExtBuffer // cmp/footprint association file extension
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( ".cmp" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
// Gestion de la liste des librairies
|
|
|
|
eda_global wxString LibExtBuffer
|
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( ".mod" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
2008-01-12 20:31:56 +00:00
|
|
|
eda_global wxString g_Shapes3DExtBuffer //3D shape file extension
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
( wxT( ".wrl" ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
|
|
|
eda_global int g_CurrentVersionPCB
|
|
|
|
#ifdef MAIN
|
|
|
|
= 1
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* A buffer used in some computations (will be removed in next cleanup code, do not use) */
|
|
|
|
#define BUFMEMSIZE 256000 /* buffer size (in bytes) */
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global char* buf_work; /* pointeur sur le buffer de travail */
|
|
|
|
eda_global char* adr_lowmem; /* adresse de base memoire de calcul disponible*/
|
|
|
|
eda_global char* adr_himem; /* adresse haute limite de la memoire disponible*/
|
|
|
|
eda_global char* adr_max; /* adresse haute maxi utilisee pour la memoire */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2008-07-31 15:30:57 +00:00
|
|
|
/* variables generales */
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global int g_TimeOut; // Timer for automatic saving
|
|
|
|
eda_global int g_SaveTime; // Time for next saving
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
|
|
|
|
/* Variables used in footprint handling */
|
2007-08-04 04:40:07 +00:00
|
|
|
extern int Angle_Rot_Module;
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global wxSize ModuleTextSize; /* Default footprint texts size */
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global int ModuleTextWidth;
|
|
|
|
eda_global int ModuleSegmentWidth;
|
|
|
|
eda_global int Texte_Module_Type;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
/***********************/
|
|
|
|
/* pistes , vias , pads*/
|
|
|
|
/***********************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
#define L_MIN_DESSIN 1 /* Min width segments to allow draws with tickness */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
// Current designe settings:
|
|
|
|
eda_global class EDA_BoardDesignSettings g_DesignSettings;
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
// Default values for pad editions
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifndef GERBVIEW
|
|
|
|
#ifdef MAIN
|
2008-01-12 20:31:56 +00:00
|
|
|
D_PAD g_Pad_Master( (MODULE*) NULL );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#else
|
|
|
|
extern D_PAD g_Pad_Master;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Layer pair for auto routing and switch layers by hotkey */
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global int Route_Layer_TOP;
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global int Route_Layer_BOTTOM;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global int g_MaxLinksShowed; // Mxa count links showed in routing
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 deg segm build
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
|
|
|
= TRUE
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2008-03-04 05:40:15 +00:00
|
|
|
/* How to handle magnetic pads & tracks: feature to move the pcb cursor on a pad center / track length */
|
2007-06-05 12:10:51 +00:00
|
|
|
enum MagneticPadOptionValues {
|
2007-08-04 04:40:07 +00:00
|
|
|
no_effect,
|
|
|
|
capture_cursor_in_track_tool,
|
|
|
|
capture_always
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
eda_global int g_MagneticPadOption
|
|
|
|
#ifdef MAIN
|
|
|
|
= capture_cursor_in_track_tool
|
|
|
|
#endif
|
|
|
|
;
|
2008-03-04 05:40:15 +00:00
|
|
|
eda_global int g_MagneticTrackOption
|
|
|
|
#ifdef MAIN
|
|
|
|
= capture_cursor_in_track_tool
|
|
|
|
#endif
|
|
|
|
;
|
2007-10-29 15:51:48 +00:00
|
|
|
/* Variables to handle hightlight nets */
|
2007-06-05 12:10:51 +00:00
|
|
|
eda_global bool g_HightLigt_Status;
|
2007-10-29 15:51:48 +00:00
|
|
|
eda_global int g_HightLigth_NetCode
|
2007-06-05 12:10:51 +00:00
|
|
|
#ifdef MAIN
|
|
|
|
= -1
|
|
|
|
#endif
|
2007-10-29 15:51:48 +00:00
|
|
|
;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-29 15:51:48 +00:00
|
|
|
/* used in track creation : */
|
|
|
|
eda_global TRACK* g_CurrentTrackSegment; // current created segment
|
|
|
|
eda_global TRACK* g_FirstTrackSegment; // first segment created
|
|
|
|
eda_global int g_TrackSegmentCount; // New created segment count
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
eda_global wxString g_ViaType_Name[4]
|
|
|
|
#if defined MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
= {
|
2008-01-12 20:31:56 +00:00
|
|
|
_( "??? Via" ), // Not used yet
|
|
|
|
_( "Micro Via" ), // from external layer (TOP or BOTTOM) from the near neightbour inner layer only
|
|
|
|
_( "Blind/Buried Via" ), // from inner or external to inner or external layer (no restriction)
|
|
|
|
_( "Through Via" ) // Usual via (from TOP to BOTTOM layer only )
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
;
|
|
|
|
/* couleurs des autres items des empreintes */
|
|
|
|
#if defined MAIN
|
2007-08-04 04:40:07 +00:00
|
|
|
int g_PadCMPColor = RED;
|
|
|
|
int g_PadCUColor = GREEN;
|
|
|
|
int g_AnchorColor = BLUE;
|
|
|
|
int g_ModuleTextCMPColor = LIGHTGRAY;
|
|
|
|
int g_ModuleTextCUColor = MAGENTA;
|
|
|
|
int g_ModuleTextNOVColor = DARKGRAY;
|
2007-06-05 12:10:51 +00:00
|
|
|
#else
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global int g_ModuleTextCMPColor;
|
|
|
|
eda_global int g_ModuleTextCUColor;
|
|
|
|
eda_global int g_ModuleTextNOVColor;
|
|
|
|
eda_global int g_AnchorColor;
|
|
|
|
eda_global int g_PadCUColor;
|
|
|
|
eda_global int g_PadCMPColor;
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */
|
2008-07-31 15:30:57 +00:00
|
|
|
eda_global BOARD* g_ModuleEditor_Pcb; /* board used to edit footprints (used by modedit)*/
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
/****************************************************/
|
|
|
|
/* Gestion du deplacement des modules et des pistes */
|
|
|
|
/****************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
eda_global wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Pad editing */
|
2007-08-04 04:40:07 +00:00
|
|
|
eda_global wxString g_Current_PadName; // Last used pad name (pad num)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* PCBNEW_H */
|