Commit fe284db0 authored by raburton's avatar raburton

set eol-style native on new files

parent bffa0689
/**************************************************************/ /**************************************************************/
/* class_board.h - Class BOARD to handle a board */ /* class_board.h - Class BOARD to handle a board */
/**************************************************************/ /**************************************************************/
#ifndef CLASS_BOARD_H #ifndef CLASS_BOARD_H
#define CLASS_BOARD_H #define CLASS_BOARD_H
class ZONE_CONTAINER; class ZONE_CONTAINER;
class EDA_BoardDesignSettings; class EDA_BoardDesignSettings;
/***********************************************/ /***********************************************/
/* class BOARD : handle datas to build a board */ /* class BOARD : handle datas to build a board */
/***********************************************/ /***********************************************/
class BOARD : public BOARD_ITEM class BOARD : public BOARD_ITEM
{ {
friend class WinEDA_PcbFrame; friend class WinEDA_PcbFrame;
private: private:
std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer
// std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer // std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer
std::vector<ZONE_CONTAINER*> m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer std::vector<ZONE_CONTAINER*> m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
public: public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
EDA_Rect m_BoundaryBox; // Board size and position EDA_Rect m_BoundaryBox; // Board size and position
int m_Unused; int m_Unused;
int m_Status_Pcb; // Flags used in ratsnet calculation and update int m_Status_Pcb; // Flags used in ratsnet calculation and update
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNets; // Nets (equipotentielles) count int m_NbNets; // Nets (equipotentielles) count
int m_NbNodes; // Active pads (pads attached to a net ) count int m_NbNodes; // Active pads (pads attached to a net ) count
int m_NbLinks; // Ratsnet count int m_NbLinks; // Ratsnet count
int m_NbLoclinks; // Rastests to shew while creating a track int m_NbLoclinks; // Rastests to shew while creating a track
int m_NbNoconnect; // Active ratsnet count (rastnest not alraedy connected by tracks int m_NbNoconnect; // Active ratsnet count (rastnest not alraedy connected by tracks
int m_NbSegmTrack; // Track items count int m_NbSegmTrack; // Track items count
int m_NbSegmZone; // Zone items count int m_NbSegmZone; // Zone items count
BOARD_ITEM* m_Drawings; // linked list of lines & texts BOARD_ITEM* m_Drawings; // linked list of lines & texts
MODULE* m_Modules; // linked list of MODULEs MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets EQUIPOT* m_Equipots; // linked list of nets
TRACK* m_Track; // linked list of TRACKs and SEGVIAs TRACK* m_Track; // linked list of TRACKs and SEGVIAs
SEGZONE* m_Zone; // linked list of SEGZONEs SEGZONE* m_Zone; // linked list of SEGZONEs
D_PAD** m_Pads; // Entry for a sorted pad list (used in ratsnest calculations) D_PAD** m_Pads; // Entry for a sorted pad list (used in ratsnest calculations)
int m_NbPads; // Pad count int m_NbPads; // Pad count
CHEVELU* m_Ratsnest; // Rastnest list CHEVELU* m_Ratsnest; // Rastnest list
CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint
EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */ * de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD(); ~BOARD();
/** /**
* Function GetPosition * Function GetPosition
* is here to satisfy BOARD_ITEM's requirements, but this implementation * is here to satisfy BOARD_ITEM's requirements, but this implementation
* is a dummy. * is a dummy.
* @return const wxPoint& of (0,0) * @return const wxPoint& of (0,0)
*/ */
wxPoint& GetPosition(); wxPoint& GetPosition();
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink(); void UnLink();
/** /**
* Function Add * Function Add
* adds the given item to this BOARD and takes ownership of its memory. * adds the given item to this BOARD and takes ownership of its memory.
* @param aBoardItem The item to add to this board. * @param aBoardItem The item to add to this board.
* @param aControl An int which can vary how the item is added. * @param aControl An int which can vary how the item is added.
*/ */
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 ); void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
/** /**
* Function Delete * Function Delete
* deletes the given single item from this BOARD and deletes its memory. If you * deletes the given single item from this BOARD and deletes its memory. If you
* need the object after deletion, first copy it. * need the object after deletion, first copy it.
* @param aBoardItem The item to remove from this board and delete * @param aBoardItem The item to remove from this board and delete
*/ */
void Delete( BOARD_ITEM* aBoardItem ); void Delete( BOARD_ITEM* aBoardItem );
/** /**
* Function DeleteMARKERs * Function DeleteMARKERs
* deletes ALL MARKERS from the board. * deletes ALL MARKERS from the board.
*/ */
void DeleteMARKERs(); void DeleteMARKERs();
/** /**
* Function DeleteMARKER * Function DeleteMARKER
* deletes one MARKER from the board. * deletes one MARKER from the board.
* @param aIndex The index of the marker to delete. * @param aIndex The index of the marker to delete.
*/ */
void DeleteMARKER( int aIndex ); void DeleteMARKER( int aIndex );
/** /**
* Function GetMARKER * Function GetMARKER
* returns the MARKER at a given index. * returns the MARKER at a given index.
* @param index The array type index into a collection of MARKERS. * @param index The array type index into a collection of MARKERS.
* @return MARKER* - a pointer to the MARKER or NULL if index out of range. * @return MARKER* - a pointer to the MARKER or NULL if index out of range.
*/ */
MARKER* GetMARKER( int index ) const MARKER* GetMARKER( int index ) const
{ {
if( (unsigned) index < m_markers.size() ) if( (unsigned) index < m_markers.size() )
return m_markers[index]; return m_markers[index];
return NULL; return NULL;
} }
/** /**
* Function GetMARKERCount * Function GetMARKERCount
* @return int - The number of MARKERS. * @return int - The number of MARKERS.
*/ */
int GetMARKERCount() const int GetMARKERCount() const
{ {
return (int) m_markers.size(); return (int) m_markers.size();
} }
/* Routines de calcul des nombres de segments pistes et zones */ /* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();
int GetNumNoconnect(); // retourne le nombre de connexions manquantes int GetNumNoconnect(); // retourne le nombre de connexions manquantes
/** /**
* Function GetNumRatsnests * Function GetNumRatsnests
* @return int - The number of rats * @return int - The number of rats
*/ */
int GetNumRatsnests() int GetNumRatsnests()
{ {
return m_NbLinks; return m_NbLinks;
} }
int GetNumNodes(); // retourne le nombre de pads a netcode > 0 int GetNumNodes(); // retourne le nombre de pads a netcode > 0
// Calcul du rectangle d'encadrement: // Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox(); bool ComputeBoundaryBox();
/** /**
* Function Display_Infos * Function Display_Infos
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel. * about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct. * Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information. * @param frame A WinEDA_DrawFrame in which to print status information.
*/ */
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
/** /**
* Function Visit * Function Visit
* may be re-implemented for each derived class in order to handle * may be re-implemented for each derived class in order to handle
* all the types given by its member data. Implementations should call * all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward() * inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data. * to do so on lists of such data.
* @param inspector An INSPECTOR instance to use in the inspection. * @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector. * @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order * @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT. * is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan, * @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE, and determined by the inspector. * else SCAN_CONTINUE, and determined by the inspector.
*/ */
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData, SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] ); const KICAD_T scanTypes[] );
/** /**
* Function FindNet * Function FindNet
* searches for a net with the given netcode. * searches for a net with the given netcode.
* @param aNetcode A netcode to search for. * @param aNetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found. * @return EQUIPOT* - the net or NULL if not found.
*/ */
EQUIPOT* FindNet( int aNetcode ) const; EQUIPOT* FindNet( int aNetcode ) const;
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/** /**
* Function GetClass * Function GetClass
* returns the class name. * returns the class name.
* @return wxString * @return wxString
*/ */
wxString GetClass() const wxString GetClass() const
{ {
return wxT( "BOARD" ); return wxT( "BOARD" );
} }
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level * @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree. * of nesting of this object within the overall tree.
* @param os The ostream& to output to. * @param os The ostream& to output to.
*/ */
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
#endif #endif
}; };
#endif // #ifndef CLASS_BOARD_H #endif // #ifndef CLASS_BOARD_H
/*************************************************/ /*************************************************/
/* class_drc_item.cpp - DRC_ITEM class functions */ /* class_drc_item.cpp - DRC_ITEM class functions */
/*************************************************/ /*************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
wxString DRC_ITEM::GetErrorText() const wxString DRC_ITEM::GetErrorText() const
{ {
switch( m_ErrorCode ) switch( m_ErrorCode )
{ {
// case DRCE_: not assigned yet // case DRCE_: not assigned yet
case DRCE_UNCONNECTED_PADS: case DRCE_UNCONNECTED_PADS:
return wxString( _("Unconnected pads") ); return wxString( _("Unconnected pads") );
case DRCE_TRACK_NEAR_THROUGH_HOLE: case DRCE_TRACK_NEAR_THROUGH_HOLE:
return wxString( _("Track near thru-hole") ); return wxString( _("Track near thru-hole") );
case DRCE_TRACK_NEAR_PAD: case DRCE_TRACK_NEAR_PAD:
return wxString( _("Track near pad") ); return wxString( _("Track near pad") );
case DRCE_TRACK_NEAR_VIA: case DRCE_TRACK_NEAR_VIA:
return wxString( _("Track near via") ); return wxString( _("Track near via") );
case DRCE_VIA_NEAR_VIA: case DRCE_VIA_NEAR_VIA:
return wxString( _("Via near via") ); return wxString( _("Via near via") );
case DRCE_VIA_NEAR_TRACK: case DRCE_VIA_NEAR_TRACK:
return wxString( _("Via near track") ); return wxString( _("Via near track") );
case DRCE_TRACK_ENDS1: case DRCE_TRACK_ENDS1:
case DRCE_TRACK_ENDS2: case DRCE_TRACK_ENDS2:
case DRCE_TRACK_ENDS3: case DRCE_TRACK_ENDS3:
case DRCE_TRACK_ENDS4: case DRCE_TRACK_ENDS4:
case DRCE_ENDS_PROBLEM1: case DRCE_ENDS_PROBLEM1:
case DRCE_ENDS_PROBLEM2: case DRCE_ENDS_PROBLEM2:
case DRCE_ENDS_PROBLEM3: case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4: case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5: case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") ); return wxString( _("Two track ends") );
case DRCE_TRACK_UNKNOWN1: case DRCE_TRACK_UNKNOWN1:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment return wxString( _("This looks bad") ); ///< @todo check source code and change this comment
case DRCE_TRACKS_CROSSING: case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") ); return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1: case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") ); return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER: case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter")); return wxString( _("Via hole > diameter"));
default: default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") ); return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
} }
} }
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos ) wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{ {
wxString temp; wxString temp;
wxString ret; wxString ret;
ret << wxT("@(") << valeur_param( aPos.x, temp ); ret << wxT("@(") << valeur_param( aPos.x, temp );
ret << wxT(",") << valeur_param( aPos.y, temp ); ret << wxT(",") << valeur_param( aPos.y, temp );
ret << wxT(")"); ret << wxT(")");
return ret; return ret;
} }
/**********************************/ /**********************************/
/* classes to handle copper zones */ /* classes to handle copper zones */
/**********************************/ /**********************************/
#include "fctsys.h" #include "fctsys.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
/************************/ /************************/
/* class ZONE_CONTAINER */ /* class ZONE_CONTAINER */
/************************/ /************************/
ZONE_CONTAINER::ZONE_CONTAINER (BOARD * parent): ZONE_CONTAINER::ZONE_CONTAINER (BOARD * parent):
BOARD_ITEM (parent, TYPEZONE_CONTAINER) BOARD_ITEM (parent, TYPEZONE_CONTAINER)
{ {
m_NetCode = -1; // Net number for fast comparisons m_NetCode = -1; // Net number for fast comparisons
} }
ZONE_CONTAINER::~ZONE_CONTAINER() ZONE_CONTAINER::~ZONE_CONTAINER()
{ {
} }
bool ZONE_CONTAINER::Save( FILE* aFile ) const bool ZONE_CONTAINER::Save( FILE* aFile ) const
{ {
return true; return true;
} }
/**********************/ /**********************/
/* Class EDGE_ZONE */ /* Class EDGE_ZONE */
/**********************/ /**********************/
/* Constructor */ /* Constructor */
EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) : EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) :
DRAWSEGMENT( parent, TYPEEDGEZONE ) DRAWSEGMENT( parent, TYPEEDGEZONE )
{ {
m_Width = 2; // a minimum for visibility, while dragging m_Width = 2; // a minimum for visibility, while dragging
} }
/* Destructor */ /* Destructor */
EDGE_ZONE:: ~EDGE_ZONE() EDGE_ZONE:: ~EDGE_ZONE()
{ {
} }
bool EDGE_ZONE::Save( FILE* aFile ) const bool EDGE_ZONE::Save( FILE* aFile ) const
{ {
if( GetState( DELETED ) ) if( GetState( DELETED ) )
return true; return true;
int ret = fprintf( aFile, "ZE %d %d %d %d %d %lX %X\n", int ret = fprintf( aFile, "ZE %d %d %d %d %d %lX %X\n",
m_Start.x, m_Start.y, m_Start.x, m_Start.y,
m_End.x, m_End.y, m_End.x, m_End.y,
m_Angle, m_Angle,
m_TimeStamp, m_TimeStamp,
ReturnStatus() ReturnStatus()
); );
return (ret > 14 ); return (ret > 14 );
} }
/**********************************/ /**********************************/
/* classes to handle copper zones */ /* classes to handle copper zones */
/**********************************/ /**********************************/
#ifndef CLASS_ZONE_H #ifndef CLASS_ZONE_H
#define CLASS_ZONE_H #define CLASS_ZONE_H
/************************/ /************************/
/* class ZONE_CONTAINER */ /* class ZONE_CONTAINER */
/************************/ /************************/
/* handle a list of polygons delimiting a copper zone /* handle a list of polygons delimiting a copper zone
* a zone is described by a main polygon, a time stamp, a layer and a net name. * a zone is described by a main polygon, a time stamp, a layer and a net name.
* others polygons inside this main polygon are holes. * others polygons inside this main polygon are holes.
*/ */
class ZONE_CONTAINER : public BOARD_ITEM // Not sure BOARD_ITEM is better than EDA_BaseStruct class ZONE_CONTAINER : public BOARD_ITEM // Not sure BOARD_ITEM is better than EDA_BaseStruct
{ {
public: public:
wxString m_Netname; /* Net Name */ wxString m_Netname; /* Net Name */
private: private:
int m_NetCode; // Net number for fast comparisons int m_NetCode; // Net number for fast comparisons
public: public:
ZONE_CONTAINER(BOARD * parent); ZONE_CONTAINER(BOARD * parent);
~ZONE_CONTAINER(); ~ZONE_CONTAINER();
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
}; };
/*******************/ /*******************/
/* class EDGE_ZONE */ /* class EDGE_ZONE */
/*******************/ /*******************/
class EDGE_ZONE : public DRAWSEGMENT class EDGE_ZONE : public DRAWSEGMENT
{ {
public: public:
EDGE_ZONE( BOARD_ITEM* StructFather ); EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone ); EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE(); ~EDGE_ZONE();
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; } EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; }
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; } EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
}; };
#endif // #ifndef CLASS_ZONE_H #endif // #ifndef CLASS_ZONE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment