Commit e126042b authored by raburton's avatar raburton

set eol-style native on new files

parent 5eda8a52
This diff is collapsed.
This diff is collapsed.
// PolyLine.h ... definition of CPolyLine class // PolyLine.h ... definition of CPolyLine class
// //
// A polyline contains one or more contours, where each contour // A polyline contains one or more contours, where each contour
// is defined by a list of corners and side-styles // is defined by a list of corners and side-styles
// There may be multiple contours in a polyline. // There may be multiple contours in a polyline.
// The last contour may be open or closed, any others must be closed. // The last contour may be open or closed, any others must be closed.
// All of the corners and side-styles are concatenated into 2 arrays, // All of the corners and side-styles are concatenated into 2 arrays,
// separated by setting the end_contour flag of the last corner of // separated by setting the end_contour flag of the last corner of
// each contour. // each contour.
// //
// When used for copper areas, the first contour is the outer edge // When used for copper areas, the first contour is the outer edge
// of the area, subsequent ones are "holes" in the copper. // of the area, subsequent ones are "holes" in the copper.
// //
// If a CDisplayList pointer is provided, the polyline can draw itself // If a CDisplayList pointer is provided, the polyline can draw itself
#ifndef POLYLINE2KICAD_H #ifndef POLYLINE2KICAD_H
#define POLYLINE2KICAD_H #define POLYLINE2KICAD_H
#define PCBU_PER_MIL 10 #define PCBU_PER_MIL 10
#define MAX_LAYERS 32 #define MAX_LAYERS 32
#define NM_PER_MIL 10 // 25400 #define NM_PER_MIL 10 // 25400
// pad shapes // pad shapes
enum enum
{ {
PAD_NONE = 0, PAD_NONE = 0,
PAD_ROUND, PAD_ROUND,
PAD_SQUARE, PAD_SQUARE,
PAD_RECT, PAD_RECT,
PAD_RRECT, PAD_RRECT,
PAD_OVAL, PAD_OVAL,
PAD_OCTAGON PAD_OCTAGON
}; };
/* /*
enum enum
{ {
// visible layers // visible layers
LAY_SELECTION = 0, LAY_SELECTION = 0,
LAY_BACKGND, LAY_BACKGND,
LAY_VISIBLE_GRID, LAY_VISIBLE_GRID,
LAY_HILITE, LAY_HILITE,
LAY_DRC_ERROR, LAY_DRC_ERROR,
LAY_BOARD_OUTLINE, LAY_BOARD_OUTLINE,
LAY_RAT_LINE, LAY_RAT_LINE,
LAY_SILK_TOP, LAY_SILK_TOP,
LAY_SILK_BOTTOM, LAY_SILK_BOTTOM,
LAY_SM_TOP, LAY_SM_TOP,
LAY_SM_BOTTOM, LAY_SM_BOTTOM,
LAY_PAD_THRU, LAY_PAD_THRU,
LAY_TOP_COPPER, LAY_TOP_COPPER,
LAY_BOTTOM_COPPER, LAY_BOTTOM_COPPER,
// invisible layers // invisible layers
LAY_MASK_TOP = -100, LAY_MASK_TOP = -100,
LAY_MASK_BOTTOM = -101, LAY_MASK_BOTTOM = -101,
LAY_PASTE_TOP = -102, LAY_PASTE_TOP = -102,
LAY_PASTE_BOTTOM = -103 LAY_PASTE_BOTTOM = -103
}; };
*/ */
#define LAY_SELECTION 0 #define LAY_SELECTION 0
#define LAY_TOP_COPPER 0 #define LAY_TOP_COPPER 0
#define CDC wxDC #define CDC wxDC
class wxDC; class wxDC;
#if 0 #if 0
class dl_element; class dl_element;
class CDisplayList { class CDisplayList {
public: public:
void Set_visible(void*, int) {}; void Set_visible(void*, int) {};
int Get_x(void) { return 0;}; int Get_x(void) { return 0;};
int Get_y(void) { return 0;}; int Get_y(void) { return 0;};
void StopDragging(void) {}; void StopDragging(void) {};
void CancelHighLight(void) {}; void CancelHighLight(void) {};
void StartDraggingLineVertex(...) {}; void StartDraggingLineVertex(...) {};
void Add() {}; void Add() {};
}; };
#endif #endif
class CRect { class CRect {
public: public:
int left, right, top, bottom; int left, right, top, bottom;
}; };
class CPoint { class CPoint {
public: public:
int x, y; int x, y;
public: public:
CPoint(void) { x = y = 0;}; CPoint(void) { x = y = 0;};
CPoint(int i, int j) { x = i; y = j;}; CPoint(int i, int j) { x = i; y = j;};
}; };
#endif // #ifndef POLYLINE2KICAD_H #endif // #ifndef POLYLINE2KICAD_H
/* stuff for class CDisplayList */ /* stuff for class CDisplayList */
#include "PolyLine.h" #include "PolyLine.h"
dl_element * CDisplayList::Add( id id, void * ptr, int glayer, int gtype, int visible, dl_element * CDisplayList::Add( id id, void * ptr, int glayer, int gtype, int visible,
int w, int holew, int x, int y, int xf, int yf, int xo, int yo, int w, int holew, int x, int y, int xf, int yf, int xo, int yo,
int radius, int orig_layer ) int radius, int orig_layer )
{ {
return NULL; return NULL;
} }
dl_element * CDisplayList::AddSelector( id id, void * ptr, int glayer, int gtype, int visible, dl_element * CDisplayList::AddSelector( id id, void * ptr, int glayer, int gtype, int visible,
int w, int holew, int x, int y, int xf, int yf, int xo, int yo, int radius ) int w, int holew, int x, int y, int xf, int yf, int xo, int yo, int radius )
{ {
return NULL; return NULL;
} }
void CDisplayList::Set_visible( dl_element * el, int visible ) void CDisplayList::Set_visible( dl_element * el, int visible )
{ {
} }
int CDisplayList::StopDragging() int CDisplayList::StopDragging()
{ {
return 0; return 0;
} }
int CDisplayList::CancelHighLight() int CDisplayList::CancelHighLight()
{ {
return 0; return 0;
} }
void CDisplayList::Set_id( dl_element * el, id * id ) void CDisplayList::Set_id( dl_element * el, id * id )
{ {
} }
id CDisplayList::Remove( dl_element * element ) id CDisplayList::Remove( dl_element * element )
{ {
return 0; return 0;
} }
int CDisplayList::Get_w( dl_element * el ) int CDisplayList::Get_w( dl_element * el )
{ {
return 0; return 0;
} }
int CDisplayList::Get_x( dl_element * el ) int CDisplayList::Get_x( dl_element * el )
{ {
return 0; return 0;
} }
int CDisplayList::Get_y( dl_element * el ) int CDisplayList::Get_y( dl_element * el )
{ {
return 0; return 0;
} }
int CDisplayList::Get_xf( dl_element * el ) int CDisplayList::Get_xf( dl_element * el )
{ {
return 0; return 0;
} }
int CDisplayList::Get_yf( dl_element * el ) int CDisplayList::Get_yf( dl_element * el )
{ {
return 0; return 0;
} }
int CDisplayList::HighLight( int gtype, int x, int y, int xf, int yf, int w, int orig_layer ) int CDisplayList::HighLight( int gtype, int x, int y, int xf, int yf, int w, int orig_layer )
{ {
return 0; return 0;
} }
int CDisplayList::StartDraggingLineVertex( CDC * pDC, int x, int y, int xi, int yi, int CDisplayList::StartDraggingLineVertex( CDC * pDC, int x, int y, int xi, int yi,
int xf, int yf, int xf, int yf,
int layer1, int layer2, int w1, int w2, int layer1, int layer2, int w1, int w2,
int style1, int style2, int style1, int style2,
int layer_no_via, int via_w, int via_holew, int dir, int layer_no_via, int via_w, int via_holew, int dir,
int crosshair ) int crosshair )
{ {
return 0; return 0;
} }
int CDisplayList::StartDraggingArc( CDC * pDC, int style, int x, int y, int xi, int yi, int CDisplayList::StartDraggingArc( CDC * pDC, int style, int x, int y, int xi, int yi,
int layer, int w, int crosshair ) int layer, int w, int crosshair )
{ {
return 0; return 0;
} }
This diff is collapsed.
// definition of ID structure used by FreePCB // definition of ID structure used by FreePCB
// //
#pragma once #pragma once
// struct id : this structure is used to identify PCB design elements // struct id : this structure is used to identify PCB design elements
// such as instances of parts or nets, and their subelements // such as instances of parts or nets, and their subelements
// Each element will have its own id. // Each element will have its own id.
// An id is attached to each item of the Display List so that it can // An id is attached to each item of the Display List so that it can
// be linked back to the PCB design element which drew it. // be linked back to the PCB design element which drew it.
// These are mainly used to identify items selected by clicking the mouse // These are mainly used to identify items selected by clicking the mouse
// //
// In general: // In general:
// id.type = type of PCB element (e.g. part, net, text) // id.type = type of PCB element (e.g. part, net, text)
// id.st = subelement type (e.g. part pad, net connection) // id.st = subelement type (e.g. part pad, net connection)
// id.i = subelement index (zero-based) // id.i = subelement index (zero-based)
// id.sst = subelement of subelement (e.g. net connection segment) // id.sst = subelement of subelement (e.g. net connection segment)
// id.ii = subsubelement index (zero-based) // id.ii = subsubelement index (zero-based)
// //
// For example, the id for segment 0 of connection 4 of net 12 would be // For example, the id for segment 0 of connection 4 of net 12 would be
// id = { ID_NET, 12, ID_CONNECT, 4, ID_SEG, 0 }; // id = { ID_NET, 12, ID_CONNECT, 4, ID_SEG, 0 };
// //
// //
class id { class id {
public: public:
// constructor // constructor
id( int qt=0, int qst=0, int qis=0, int qsst=0, int qiis=0 ) id( int qt=0, int qst=0, int qis=0, int qsst=0, int qiis=0 )
{ type=qt; st=qst; i=qis; sst=qsst; ii=qiis; } { type=qt; st=qst; i=qis; sst=qsst; ii=qiis; }
// operators // operators
friend int operator ==(id id1, id id2) friend int operator ==(id id1, id id2)
{ return (id1.type==id2.type { return (id1.type==id2.type
&& id1.st==id2.st && id1.st==id2.st
&& id1.sst==id2.sst && id1.sst==id2.sst
&& id1.i==id2.i && id1.i==id2.i
&& id1.ii==id2.ii ); && id1.ii==id2.ii );
} }
// member functions // member functions
void Clear() void Clear()
{ type=0; st=0; i=0; sst=0; ii=0; } { type=0; st=0; i=0; sst=0; ii=0; }
void Set( int qt, int qst=0, int qis=0, int qsst=0, int qiis=0 ) void Set( int qt, int qst=0, int qis=0, int qsst=0, int qiis=0 )
{ type=qt; st=qst; i=qis; sst=qsst; ii=qiis; } { type=qt; st=qst; i=qis; sst=qsst; ii=qiis; }
// member variables // member variables
unsigned int type; // type of element unsigned int type; // type of element
unsigned int st; // type of subelement unsigned int st; // type of subelement
unsigned int i; // index of subelement unsigned int i; // index of subelement
unsigned int sst; // type of subsubelement unsigned int sst; // type of subsubelement
unsigned int ii; // index of subsubelement unsigned int ii; // index of subsubelement
}; };
// these are constants used in ids // these are constants used in ids
// root types // root types
enum { enum {
ID_NONE = 0, // an undefined type or st (or an error) ID_NONE = 0, // an undefined type or st (or an error)
ID_BOARD, // board outline ID_BOARD, // board outline
ID_PART, // part ID_PART, // part
ID_NET, // net ID_NET, // net
ID_TEXT, // free-standing text ID_TEXT, // free-standing text
ID_DRC, // DRC error ID_DRC, // DRC error
ID_SM_CUTOUT, // cutout for solder mask ID_SM_CUTOUT, // cutout for solder mask
ID_MULTI // if multiple selections ID_MULTI // if multiple selections
}; };
// subtypes of ID_PART // subtypes of ID_PART
enum { enum {
ID_PAD = 1, // pad_stack in a part ID_PAD = 1, // pad_stack in a part
ID_SEL_PAD, // selection rectangle for pad_stack in a part ID_SEL_PAD, // selection rectangle for pad_stack in a part
ID_OUTLINE, // part outline ID_OUTLINE, // part outline
ID_REF_TXT, // text showing ref num for part ID_REF_TXT, // text showing ref num for part
ID_ORIG, // part origin ID_ORIG, // part origin
ID_SEL_RECT, // selection rectangle for part ID_SEL_RECT, // selection rectangle for part
ID_SEL_REF_TXT // selection rectangle for ref text ID_SEL_REF_TXT // selection rectangle for ref text
}; };
// subtypes of ID_TEXT // subtypes of ID_TEXT
enum { enum {
ID_SEL_TXT = 1, // selection rectangle ID_SEL_TXT = 1, // selection rectangle
ID_STROKE // stroke for text ID_STROKE // stroke for text
}; };
// subtypes of ID_NET // subtypes of ID_NET
enum { enum {
ID_ENTIRE_NET = 0, ID_ENTIRE_NET = 0,
ID_CONNECT, // connection ID_CONNECT, // connection
ID_AREA // copper area ID_AREA // copper area
}; };
// subtypes of ID_BOARD // subtypes of ID_BOARD
enum { enum {
ID_BOARD_OUTLINE = 1, ID_BOARD_OUTLINE = 1,
}; };
// subsubtypes of ID_NET.ID_CONNECT // subsubtypes of ID_NET.ID_CONNECT
enum { enum {
ID_ENTIRE_CONNECT = 0, ID_ENTIRE_CONNECT = 0,
ID_SEG, ID_SEG,
ID_SEL_SEG, ID_SEL_SEG,
ID_VERTEX, ID_VERTEX,
ID_SEL_VERTEX, ID_SEL_VERTEX,
ID_VIA ID_VIA
}; };
// subsubtypes of ID_NET.ID_AREA, ID_BOARD.ID_BOARD_OUTLINE, ID_SM_CUTOUT // subsubtypes of ID_NET.ID_AREA, ID_BOARD.ID_BOARD_OUTLINE, ID_SM_CUTOUT
enum { enum {
ID_SIDE = 1, ID_SIDE = 1,
ID_SEL_SIDE, ID_SEL_SIDE,
ID_SEL_CORNER, ID_SEL_CORNER,
ID_HATCH, ID_HATCH,
ID_PIN_X, // only used by ID_AREA ID_PIN_X, // only used by ID_AREA
ID_STUB_X // only used by ID_AREA ID_STUB_X // only used by ID_AREA
}; };
// subtypes of ID_DRC // subtypes of ID_DRC
// for subsubtypes, use types in DesignRules.h // for subsubtypes, use types in DesignRules.h
enum { enum {
ID_DRE = 1, ID_DRE = 1,
ID_SEL_DRE ID_SEL_DRE
}; };
This diff is collapsed.
// math stuff for graphics, from FreePCB // math stuff for graphics, from FreePCB
typedef struct PointTag typedef struct PointTag
{ {
double X,Y; double X,Y;
} Point; } Point;
typedef struct EllipseTag typedef struct EllipseTag
{ {
Point Center; /* ellipse center */ Point Center; /* ellipse center */
// double MaxRad,MinRad; /* major and minor axis */ // double MaxRad,MinRad; /* major and minor axis */
// double Phi; /* major axis rotation */ // double Phi; /* major axis rotation */
double xrad, yrad; // radii on x and y double xrad, yrad; // radii on x and y
double theta1, theta2; // start and end angle for arc double theta1, theta2; // start and end angle for arc
} EllipseKH; } EllipseKH;
const CPoint zero(0,0); const CPoint zero(0,0);
class my_circle { class my_circle {
public: public:
my_circle(){}; my_circle(){};
my_circle( int xx, int yy, int rr ) my_circle( int xx, int yy, int rr )
{ {
x = xx; x = xx;
y = yy; y = yy;
r = rr; r = rr;
}; };
int x, y, r; int x, y, r;
}; };
class my_rect { class my_rect {
public: public:
my_rect(){}; my_rect(){};
my_rect( int xi, int yi, int xf, int yf ) my_rect( int xi, int yi, int xf, int yf )
{ {
xlo = min(xi,xf); xlo = min(xi,xf);
xhi = max(xi,xf); xhi = max(xi,xf);
ylo = min(yi,yf); ylo = min(yi,yf);
yhi = max(yi,yf); yhi = max(yi,yf);
}; };
int xlo, ylo, xhi, yhi; int xlo, ylo, xhi, yhi;
}; };
class my_seg { class my_seg {
public: public:
my_seg(){}; my_seg(){};
my_seg( int xxi, int yyi, int xxf, int yyf ) my_seg( int xxi, int yyi, int xxf, int yyf )
{ {
xi = xxi; xi = xxi;
yi = yyi; yi = yyi;
xf = xxf; xf = xxf;
yf = yyf; yf = yyf;
}; };
int xi, yi, xf, yf; int xi, yi, xf, yf;
}; };
// math stuff for graphics // math stuff for graphics
BOOL Quadratic( double a, double b, double c, double *x1, double *x2 ); BOOL Quadratic( double a, double b, double c, double *x1, double *x2 );
void DrawArc( CDC * pDC, int shape, int xxi, int yyi, int xxf, int yyf, BOOL bMeta=FALSE ); void DrawArc( CDC * pDC, int shape, int xxi, int yyi, int xxf, int yyf, BOOL bMeta=FALSE );
void RotatePoint( CPoint *p, int angle, CPoint org ); void RotatePoint( CPoint *p, int angle, CPoint org );
void RotateRect( CRect *r, int angle, CPoint org ); void RotateRect( CRect *r, int angle, CPoint org );
int TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist ); int TestLineHit( int xi, int yi, int xf, int yf, int x, int y, double dist );
int FindLineIntersection( double a, double b, double c, double d, double * x, double * y ); int FindLineIntersection( double a, double b, double c, double d, double * x, double * y );
int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int yf, int style, int FindLineSegmentIntersection( double a, double b, int xi, int yi, int xf, int yf, int style,
double * x1, double * y1, double * x2, double * y2, double * dist=NULL ); double * x1, double * y1, double * x2, double * y2, double * dist=NULL );
int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style, int FindSegmentIntersections( int xi, int yi, int xf, int yf, int style,
int xi2, int yi2, int xf2, int yf2, int style2, int xi2, int yi2, int xf2, int yf2, int style2,
double x[]=NULL, double y[]=NULL ); double x[]=NULL, double y[]=NULL );
BOOL FindLineEllipseIntersections( double a, double b, double c, double d, double *x1, double *x2 ); BOOL FindLineEllipseIntersections( double a, double b, double c, double d, double *x1, double *x2 );
BOOL FindVerticalLineEllipseIntersections( double a, double b, double x, double *y1, double *y2 ); BOOL FindVerticalLineEllipseIntersections( double a, double b, double x, double *y1, double *y2 );
BOOL TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y1f, BOOL TestForIntersectionOfStraightLineSegments( int x1i, int y1i, int x1f, int y1f,
int x2i, int y2i, int x2f, int y2f, int x2i, int y2i, int x2f, int y2f,
int * x=NULL, int * y=NULL, double * dist=NULL ); int * x=NULL, int * y=NULL, double * dist=NULL );
void GetPadElements( int type, int x, int y, int wid, int len, int radius, int angle, void GetPadElements( int type, int x, int y, int wid, int len, int radius, int angle,
int * nr, my_rect r[], int * nc, my_circle c[], int * ns, my_seg s[] ); int * nr, my_rect r[], int * nc, my_circle c[], int * ns, my_seg s[] );
int GetClearanceBetweenPads( int type1, int x1, int y1, int w1, int l1, int r1, int angle1, int GetClearanceBetweenPads( int type1, int x1, int y1, int w1, int l1, int r1, int angle1,
int type2, int x2, int y2, int w2, int l2, int r2, int angle2 ); int type2, int x2, int y2, int w2, int l2, int r2, int angle2 );
int GetClearanceBetweenSegmentAndPad( int x1, int y1, int x2, int y2, int w, int GetClearanceBetweenSegmentAndPad( int x1, int y1, int x2, int y2, int w,
int type, int x, int y, int wid, int len, int type, int x, int y, int wid, int len,
int radius, int angle ); int radius, int angle );
int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, int w1, int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1, int w1,
int x2i, int y2i, int x2f, int y2f, int style2, int w2, int x2i, int y2i, int x2f, int y2f, int style2, int w2,
int max_cl, int * x, int * y ); int max_cl, int * x, int * y );
/** Function GetPointToLineSegmentDistance /** Function GetPointToLineSegmentDistance
* Get distance between line segment and point * Get distance between line segment and point
* @param x,y = point * @param x,y = point
* @param xi,yi and xf,yf = the end-points of the line segment * @param xi,yi and xf,yf = the end-points of the line segment
* @return the distance * @return the distance
*/ */
double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf ); double GetPointToLineSegmentDistance( int x, int y, int xi, int yi, int xf, int yf );
double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL ); double GetPointToLineDistance( double a, double b, int x, int y, double * xp=NULL, double * yp=NULL );
BOOL InRange( double x, double xi, double xf ); BOOL InRange( double x, double xi, double xf );
double Distance( int x1, int y1, int x2, int y2 ); double Distance( int x1, int y1, int x2, int y2 );
int GetArcIntersections( EllipseKH * el1, EllipseKH * el2, int GetArcIntersections( EllipseKH * el1, EllipseKH * el2,
double * x1=NULL, double * y1=NULL, double * x1=NULL, double * y1=NULL,
double * x2=NULL, double * y2=NULL ); double * x2=NULL, double * y2=NULL );
CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode ); CPoint GetInflectionPoint( CPoint pi, CPoint pf, int mode );
// quicksort (2-way or 3-way) // quicksort (2-way or 3-way)
void quickSort(int numbers[], int index[], int array_size); void quickSort(int numbers[], int index[], int array_size);
void q_sort(int numbers[], int index[], int left, int right); void q_sort(int numbers[], int index[], int left, int right);
void q_sort_3way( int a[], int b[], int left, int right ); void q_sort_3way( int a[], int b[], int left, int right );
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