You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

329 lines
9.5 KiB

  1. /**************************************/
  2. /* PCBNEW.H : d�larations communes */
  3. /**************************************/
  4. #ifndef PCBNEW_H
  5. #define PCBNEW_H
  6. #ifndef eda_global
  7. #define eda_global extern
  8. #endif
  9. #include "pcbstruct.h"
  10. #include "macros.h"
  11. #define U_PCB (PCB_INTERNAL_UNIT / EESCHEMA_INTERNAL_UNIT)
  12. /* valeur de flag indicant si le pointeur de reference pour une localisation
  13. * est le curseur sur grille ou le curseur a deplacement fin hors grille */
  14. #define CURSEUR_ON_GRILLE (0 << 0)
  15. #define CURSEUR_OFF_GRILLE (1 << 0)
  16. #define IGNORE_LOCKED (1 << 1) ///< if module is locked, do not select for single module operation
  17. #define MATCH_LAYER (1 << 2) ///< if module not on current layer, do not select
  18. #define VISIBLE_ONLY (1 << 3) ///< if module not on a visible layer, do not select
  19. #define START 0 /* ctes parametre dans les routines de localisation */
  20. #define END 1
  21. #define DIM_ANCRE_MODULE 3 /* dim du symbole de l'ancre (centre) des modules */
  22. #define DIM_ANCRE_TEXTE 2 /* dim du symbole de l'ancre (centre) des textes */
  23. /* Gestion du Menu Zoom */
  24. #define ZOOM_PLUS -1
  25. #define ZOOM_MOINS -2
  26. #define ZOOM_AUTO -3
  27. #define ZOOM_CENTER -4
  28. #define ZOOM_REDRAW -5
  29. /* Definition des cas ou l'on force l'affichage en SKETCH (membre .flags) */
  30. #define FORCE_SKETCH (DRAG | EDIT )
  31. /* Constantes pour options lecture fichier PCB */
  32. #define APPEND_PCB 1 /* pour ajout d'un nouveau circuit */
  33. #define NEWPCB 0 /* pour chargement normal */
  34. eda_global wxArrayString g_LibName_List; // library list to load
  35. eda_global wxSize g_GridList[]
  36. #ifdef MAIN
  37. = {
  38. wxSize( 1000, 1000 ), wxSize( 500, 500 ), wxSize( 250, 250 ), wxSize( 200, 200 ),
  39. wxSize( 100, 100 ), wxSize( 50, 50 ), wxSize( 25, 25 ), wxSize( 20, 20 ),
  40. wxSize( 10, 10 ), wxSize( 5, 5 ), wxSize( 2, 2 ), wxSize( 1, 1 ),
  41. wxSize( -1, -1 ), wxSize( 0, 0 )
  42. }
  43. #endif
  44. ;
  45. #define UNDELETE_STACK_SIZE 10
  46. eda_global EDA_BaseStruct* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Liste des elements supprimes
  47. eda_global int g_UnDeleteStackPtr;
  48. eda_global bool g_ShowGrid
  49. #ifdef MAIN
  50. = TRUE
  51. #endif
  52. ;
  53. /* Look up Table for conversion one layer number -> one bit layer mask: */
  54. eda_global int g_TabOneLayerMask[LAYER_COUNT]
  55. #if defined MAIN
  56. = {
  57. 0x00000001, 0x00000002, 0x00000004, 0x00000008,
  58. 0x00000010, 0x00000020, 0x00000040, 0x00000080,
  59. 0x00000100, 0x00000200, 0x00000400, 0x00000800,
  60. 0x00001000, 0x00002000, 0x00004000, 0x00008000,
  61. 0x00010000, 0x00020000, 0x00040000, 0x00080000,
  62. 0x00100000, 0x00200000, 0x00400000, 0x00800000,
  63. 0x01000000, 0x02000000, 0x04000000, 0x08000000,
  64. 0x10000000, 0x20000000, 0x40000000, 0x80000000
  65. }
  66. #endif
  67. ;
  68. /* Look up Table for conversion copper layer count -> general copper layer mask: */
  69. eda_global int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]
  70. #if defined MAIN
  71. = {
  72. 0x0001, 0x8001, 0x8003, 0x8007,
  73. 0x800F, 0x801F, 0x803F, 0x807F,
  74. 0x80FF, 0x81FF, 0x83FF, 0x87FF,
  75. 0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
  76. };
  77. #endif
  78. ;
  79. /* variables */
  80. extern wxString g_Main_Title;
  81. eda_global bool Drc_On
  82. #ifdef MAIN
  83. = TRUE
  84. #endif
  85. ;
  86. eda_global bool g_AutoDeleteOldTrack /* autorise effacement automatique
  87. * de l'ancienne piste lors des redessins de pistes */
  88. #ifdef MAIN
  89. = TRUE
  90. #endif
  91. ;
  92. eda_global bool g_No_Via_Route;
  93. eda_global bool g_Drag_Pistes_On;
  94. eda_global bool g_Show_Ratsnest;
  95. eda_global bool g_Show_Module_Ratsnest;
  96. eda_global bool g_Show_Pads_Module_in_Move
  97. #ifdef MAIN
  98. = TRUE
  99. #endif
  100. ;
  101. eda_global bool g_Raccord_45_Auto
  102. #ifdef MAIN
  103. = TRUE
  104. #endif
  105. ;
  106. eda_global bool g_ShowIsolDuringCreateTrack; /* .State controle l'affichage
  107. * de l'isolation en trace de piste */
  108. /**************************************************************/
  109. /* Options d'affichages (remplissages des segments, textes..) */
  110. /**************************************************************/
  111. eda_global DISPLAY_OPTIONS DisplayOpt;
  112. /**
  113. * Function IsModuleLayerVisible
  114. * expects either of the two layers on which a module can reside, and returns
  115. * whether that layer is visible.
  116. * @param layer One of the two allowed layers for modules: CMP_N or CUIVRE_N
  117. * @return bool - true if the layer is visible, else false.
  118. */
  119. bool inline IsModuleLayerVisible( int layer )
  120. {
  121. if( layer==CMP_N )
  122. return DisplayOpt.Show_Modules_Cmp;
  123. else if( layer==CUIVRE_N )
  124. return DisplayOpt.Show_Modules_Cu;
  125. else
  126. return true;
  127. }
  128. eda_global bool Track_45_Only; /* Flag pour limiter l'inclinaison
  129. * pistes a 45 degres seulement */
  130. eda_global bool Segments_45_Only;/* Flag pour limiter l'inclinaison
  131. * edge pcb a 45 degres seulement */
  132. eda_global wxString PcbExtBuffer
  133. #ifdef MAIN
  134. ( wxT( ".brd" ) )
  135. #endif
  136. ;
  137. eda_global wxString g_SaveFileName // File Name for periodic saving
  138. #ifdef MAIN
  139. ( wxT( "$savepcb" ) )
  140. #endif
  141. ;
  142. eda_global wxString NetNameBuffer;
  143. eda_global wxString NetExtBuffer
  144. #ifdef MAIN
  145. ( wxT( ".net" ) )
  146. #endif
  147. ;
  148. eda_global wxString NetCmpExtBuffer
  149. #ifdef MAIN
  150. ( wxT( ".cmp" ) )
  151. #endif
  152. ;
  153. // Gestion de la liste des librairies
  154. eda_global wxString LibExtBuffer
  155. #ifdef MAIN
  156. ( wxT( ".mod" ) )
  157. #endif
  158. ;
  159. eda_global wxString g_Shapes3DExtBuffer // extension des fichiers de formes 3D
  160. #ifdef MAIN
  161. ( wxT( ".wrl" ) )
  162. #endif
  163. ;
  164. eda_global int g_NetType; // for cvpcb: Net type identifier
  165. eda_global int g_CurrentVersionPCB
  166. #ifdef MAIN
  167. = 1
  168. #endif
  169. ;
  170. #define BUFMEMSIZE 256000 /* taille du buffer de travail (en octets) */
  171. eda_global char* buf_work; /* pointeur sur le buffer de travail */
  172. eda_global char* adr_lowmem; /* adresse de base memoire de calcul disponible*/
  173. eda_global char* adr_himem; /* adresse haute limite de la memoire disponible*/
  174. eda_global char* adr_max; /* adresse haute maxi utilisee pour la memoire */
  175. /* variables g�erales */
  176. eda_global char cbuf[1024]; /* buffer de formatage texte */
  177. eda_global BOARD* g_ModuleEditor_Pcb; /* Pointeur de l'entete pcb de l'editeur de module*/
  178. eda_global int g_TimeOut; // Duree entre 2 sauvegardes automatiques
  179. eda_global int g_SaveTime; // heure de la prochaine sauvegarde
  180. /* Variables generales d'empreintes */
  181. extern int Angle_Rot_Module;
  182. eda_global wxSize ModuleTextSize; /* dim des textes sur Modules par defaut */
  183. eda_global int ModuleTextWidth;
  184. eda_global int ModuleSegmentWidth;
  185. eda_global int Texte_Module_Type;
  186. /***********************/
  187. /* pistes , vias , pads*/
  188. /***********************/
  189. #define L_MIN_DESSIN 1 /* seuil de largeur des pistes pour trace autre que filaire */
  190. // Current designe settings:
  191. eda_global class EDA_BoardDesignSettings g_DesignSettings;
  192. // valeurs par defaut des caract. des pads
  193. #ifndef GERBVIEW
  194. #ifdef MAIN
  195. D_PAD g_Pad_Master( (MODULE*) NULL );
  196. #else
  197. extern D_PAD g_Pad_Master;
  198. #endif
  199. #endif
  200. eda_global int Route_Layer_TOP;
  201. eda_global int Route_Layer_BOTTOM; /* couches de routage actif */
  202. eda_global int g_MaxLinksShowed; // determine le nombre max de links affich�
  203. // en routage manuel
  204. eda_global bool g_TwoSegmentTrackBuild // FALSE = 1 segment build, TRUE = 2 45 deg segm build
  205. #ifdef MAIN
  206. = TRUE
  207. #endif
  208. ;
  209. /* How to handle magentic pad: feature to move the pcb cursor on a pad center */
  210. enum MagneticPadOptionValues {
  211. no_effect,
  212. capture_cursor_in_track_tool,
  213. capture_always
  214. };
  215. eda_global int g_MagneticPadOption
  216. #ifdef MAIN
  217. = capture_cursor_in_track_tool
  218. #endif
  219. ;
  220. eda_global bool g_HightLigt_Status;
  221. eda_global int g_HightLigth_NetCode /* pour mise en surbrillance des pistes */
  222. #ifdef MAIN
  223. = -1
  224. #endif
  225. ; /* net_code du net a mettre en surbrillance */
  226. eda_global TRACK* g_CurrentTrackSegment; // pointeur sur le segment en cours de trace
  227. eda_global TRACK* g_FirstTrackSegment; // pointeur sur le debut de la piste en cours
  228. eda_global int g_TrackSegmentCount; // nombre de points deja traces
  229. eda_global wxString g_ViaType_Name[4]
  230. #if defined MAIN
  231. = {
  232. wxT( "???" ), // Unused
  233. _( "Blind Via" ), // from inner layer to external layer (TOP or BOTTOM)
  234. _( "Buried Via" ), // from inner to inner layer
  235. _( "Standard Via" ) // Usual via (from TOP to BOTTOM layer)
  236. }
  237. #endif
  238. ;
  239. eda_global int g_ViaHoleLastValue; // Last value for non default value via hole
  240. /* Couleur de fond affichage de bas d'ecran */
  241. eda_global int g_PcbGridColor;
  242. /* couleurs des autres items des empreintes */
  243. #if defined MAIN
  244. int g_PadCMPColor = RED;
  245. int g_PadCUColor = GREEN;
  246. int g_AnchorColor = BLUE;
  247. int g_ModuleTextCMPColor = LIGHTGRAY;
  248. int g_ModuleTextCUColor = MAGENTA;
  249. int g_ModuleTextNOVColor = DARKGRAY;
  250. #else
  251. eda_global int g_ModuleTextCMPColor;
  252. eda_global int g_ModuleTextCUColor;
  253. eda_global int g_ModuleTextNOVColor;
  254. eda_global int g_AnchorColor;
  255. eda_global int g_PadCUColor;
  256. eda_global int g_PadCMPColor;
  257. #endif
  258. eda_global PCB_SCREEN* ScreenPcb; /* Ecran principal */
  259. eda_global PCB_SCREEN* ScreenModule; /* Ecran de l'editeur de modules */
  260. /****************************************************/
  261. /* Gestion du deplacement des modules et des pistes */
  262. /****************************************************/
  263. eda_global wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
  264. /* Pad editing */
  265. eda_global wxString g_Current_PadName; // Last used pad name (pad num)
  266. #endif /* PCBNEW_H */